1import { WsIconButton as Ke, WsTooltip as Gs, toast as Le, ToastStatus as Pe, WsDialogSection as Xs, WsSelect as gn, WsSelectTrigger as bn, WsSelectPanel as vn, WsSelectOptions as _n, WsSelectOption as yn, WsInput as dt, WsDialogActions as Ys, WsButton as qe, openDialog as Ei, WsMenu as Ze, WsMenuItem as we, WsColorPickerCustomColor as An, WsCard as yt, vLoading as wn, prompt as es, PromptResult as ts } from "@mfl/common-components"; 2import { defineComponent as Te, openBlock as E, createElementBlock as x, createElementVNode as w, Fragment as de, renderList as me, normalizeClass as Ne, toDisplayString as R, useModel as Ti, useTemplateRef as Cn, ref as Q, computed as H, onMounted as gt, onUnmounted as En, resolveComponent as ti, createVNode as S, unref as b, createTextVNode as te, withCtx as k, mergeModels as ht, createBlock as W, createCommentVNode as G, watch as is, onBeforeUnmount as Tn, normalizeStyle as In, createSlots as Sn, renderSlot as ii, withDirectives as kn } from "vue"; 3import { auth4Sdks as Ws } from "@mfl/platform-shell"; 4import { WsFontFamily as xn } from "@mfl/signature-font-family"; 5const Rt = "ws1/settings-gateway", On = Rt + "/custom-domains", Ln = Rt + "/links", Pn = Rt + "/company-fields", Un = 200, Mn = "brand_color", Dn = "brand_font_family", Rn = "logo", $n = "banner", Fn = [ 6 Dn, 7 Mn, 8 Rn, 9 $n 10]; 11var ss; 12(function(i) {
13 i[i.Undefined = 0] = "Undefined", i[i.Queued = 1] = "Queued", i[i.InProgress = 2] = "InProgress", i[i.Succeeded = 3] = "Succeeded", i[i.Failed = 4] = "Failed", i[i.Aborted = 5] = "Aborted"; 14})(ss || (ss = {})); 15var rs; 16(function(i) { 17 i[i.Success = 0] = "Success", i[i.InternalError = 1] = "InternalError"; 18})(rs || (rs = {})); 19var ns; 20(function(i) { 21 i[i.UNSPECIFIED = 0] = "UNSPECIFIED", i[i.GOOGLE = 1] = "GOOGLE", i[i.MICROSOFT = 2] = "MICROSOFT", i[i.OTHER = 3] = "OTHER", i[i.HIBOB = 4] = "HIBOB"; 22})(ns || (ns = {})); 23var os; 24(function(i) { 25 i[i.MaximumImageQuality = 0] = "MaximumImageQuality", i[i.FitImageToSignatureSize = 1] = "FitImageToSignatureSize"; 26})(os || (os = {})); 27var as; 28(function(i) { 29 i[i.UNSPECIFIED = 0] = "UNSPECIFIED", i[i.ALL = 1] = "ALL", i[i.NONE = 2] = "NONE", i[i.CUSTOM = 3] = "CUSTOM"; 30})(as || (as = {})); 31const Nn = [ 32 "getDomainGeneralInfo", 33 "getDomainBasicInfo", 34 "updateDomainBasicInfo", 35 "updateDomainName", 36 "updateOrganizationName", 37 "removeDomainIntegration", 38 "getDomainSyncSettings", 39 "updateDomainSyncSettings", 40 "getFetchSpecificatorStatus", 41 "getSpecificators", 42 "runSync", 43 "getSyncStatus", 44 "getInvitationTrustPolicy", 45 "getEmployeePortalSettings", 46 "updateEmployeePortalSettings", 47 "sendTestInviteEmail", 48 "getInviteEmailPreview", 49 "uploadBrandingLogo", 50 "uploadBrandingFavicon", 51 "getDomainGoogleAnalyticsSettings", 52 "updateDomainGoogleAnalyticsSettings", 53 "setCentralizedManagement" 54]; 55var ls; 56(function(i) { 57 i[i.UNDEFINED = 0] = "UNDEFINED", i[i.VERIFIED = 1] = "VERIFIED", i[i.NOT_VERIFIED = 2] = "NOT_VERIFIED", i[i.VERIFICATION_FAILED = 3] = "VERIFICATION_FAILED"; 58})(ls || (ls = {})); 59const Bn = [ 60 "certifyDomain", 61 "verifyDomain", 62 "createCustomDomain", 63 "deleteCustomDomain", 64 "checkCustomDomainExists" 65], Vn = [ 66 "getLinksSettings", 67 "setLinksSettings" 68]; 69var pi; 70(function(i) { 71 i[i.SUCCESS = 0] = "SUCCESS", i[i.INTERNAL_ERROR = 1] = "INTERNAL_ERROR", i[i.ORGANIZATION_NOT_FOUND = 2] = "ORGANIZATION_NOT_FOUND"; 72})(pi || (pi = {})); 73var mi; 74(function(i) { 75 i[i.SUCCESS = 0] = "SUCCESS", i[i.INTERNAL_ERROR = 1] = "INTERNAL_ERROR", i[i.VALIDATION_ERROR = 2] = "VALIDATION_ERROR"; 76})(mi || (mi = {})); 77var D; 78(function(i) { 79 i[i.PLAIN_TEXT = 0] = "PLAIN_TEXT", i[i.EMAIL = 1] = "EMAIL", i[i.PHONE = 2] = "PHONE", i[i.IMAGE = 3] = "IMAGE", i[i.BANNER = 4] = "BANNER", i[i.URL = 5] = "URL", i[i.ADDRESS = 6] = "ADDRESS", i[i.COLOR = 7] = "COLOR", i[i.FONT_FAMILY = 8] = "FONT_FAMILY"; 80})(D || (D = {})); 81var ge; 82(function(i) { 83 i[i.BASIC_INFORMATION = 0] = "BASIC_INFORMATION", i[i.BRAND_KIT = 1] = "BRAND_KIT", i[i.SOCIAL_LINKS = 2] = "SOCIAL_LINKS"; 84})(ge || (ge = {})); 85const zn = [ 86 "getCompanyProfile", 87 "updateCompanyProfile" 88]; 89class Hn extends Error { 90 url; 91 constructor(e, t) { 92 super(e), this.url = t, this.name = "RateLimitError"; 93 } 94} 95async function jn(i, e, t, s) { 96 if (e.status === 429) { 97 let n = "Too many requests, please try again later."; 98 if (s.includeResponseBodyInMessage) 99 try { 100 const o = await t(), a = JSON.parse(o); 101 a.message && (n = a.message); 102 } catch { 103 } 104 throw new Hn(n, i); 105 } 106 const r = s.includeResponseBodyInMessage ? " - " + await t() : ""; 107 throw new Error(`${i} failed: ${e.status} - ${e.statusText}${r}`); 108} 109function $t(i) { 110 return new Gn(i); 111} 112class Gn { 113 options; 114 baseUrl; 115 _auth; 116 requireAuth; 117 constructor(e) { 118 this.options = e; 119 const { methods: t, requireAuth: s } = e; 120 t.forEach((r) => { 121 this[r] = (n) => this.sdkMethod(r, n); 122 }), Array.isArray(s) ? this.requireAuth = new Set(s) : s && (this.requireAuth = new Set(t)); 123 } 124 /** 125 * 126 * @param localPort Intended ONLY for service test 127 */ 128 async init(e, t) { 129 this.baseUrl = await this.getBaseUrl(t), this._auth = e, console.log(`${this.options.sdkPackageName} Initialized`); 130 } 131 async getBaseUrl(e) { 132 const { baseRoute: t } = this.options; 133 return e ? `http://localhost:${e}/${t}` : window.location.host.includes("local") ? `http://${window.location.hostname}:37000/${t}` : `https://webapp.wisestamp.com/${t}`; 134 } 135 checkInit() { 136 if (!this.baseUrl) 137 throw new Error(`${this.options.sdkPackageName} Not initialized`); 138 } 139 /** 140 * Perform a POST request 141 * 142 * CONSIDER: Auto logs and metric (configurable with a flag) 143 * @param method The route to call 144 * @param request The request POJO to stringify 145 * @returns The response as a POJO (or throws an error) 146 */ 147 async sdkMethod(e, t) { 148 this.checkInit(); 149 const s = `${this.baseUrl}/${e}`; 150 console.log({ 151 message: `${this.options.sdkPackageName}: Calling ${e}`, 152 request: t 153 }); 154 const r = JSON.stringify(t), n = { 155 "content-type": "application/json" 156 }, o = this.requireAuth?.has(e); 157 if (o) { 158 if (!this._auth) 159 throw new Error(`${this.options.sdkPackageName} is missing iAuth`); 160 const l = await this.getAccessToken(); 161 n["ws-auth"] = l; 162 } 163 let a = await this.doFetch(s, r, n); 164 return a.status === 401 && o && (n["ws-auth"] = await this._auth?.refresh() || "", a = await this.doFetch(s, r, n)), a.ok || await jn(s, a, () => a.text(), { 165 includeResponseBodyInMessage: !!this.baseUrl?.includes("localhost") 166 }), await a.json(); 167 } 168 async doFetch(e, t, s) { 169 return await fetch(e, { 170 method: "POST", 171 body: t, 172 headers: s, 173 mode: "cors", 174 redirect: "follow", 175 // need this only on local 176 credentials: "include" 177 }); 178 } 179 async getAccessToken() { 180 if (!this._auth) 181 return; 182 const e = this._auth.getCurrentAccessToken(); 183 return e || await this._auth.refresh(); 184 } 185} 186const cs = $t({ 187 baseRoute: Rt, 188 methods: Nn, 189 sdkPackageName: "@msl/settings-gateway-sdk", 190 requireAuth: !0 191}); 192$t({ 193 baseRoute: On, 194 methods: Bn, 195 sdkPackageName: "@msl/settings-gateway-sdk", 196 requireAuth: !0 197}); 198$t({ 199 baseRoute: Ln, 200 methods: Vn, 201 sdkPackageName: "@msl/settings-gateway-sdk", 202 requireAuth: !0 203}); 204const si = $t({ 205 baseRoute: Pn, 206 methods: zn, 207 sdkPackageName: "@msl/settings-gateway-sdk", 208 requireAuth: !0 209}), T = { 210 company: "Company", 211 companyProfile: "Company profile", 212 cancel: "Cancel", 213 close: "Close", 214 save: "Save", 215 basicInformation: "Basic information", 216 socialLinks: "Social links", 217 brandKit: "Brand kit", 218 fontFamilySection: "Font family", 219 selectFontPlaceholder: "Select...", 220 brandColorsSection: "Brand colors", 221 logosSection: "Logos", 222 bannersSection: "Banners", 223 addVariable: "Add variable", 224 addColor: "Add color", 225 addAnotherColor: "Add another color", 226 addLogo: "Add logo", 227 addAnotherLogo: "Add another logo", 228 addBanner: "Add banner", 229 addAnotherBanner: "Add another banner", 230 editVariable: "Edit variable", 231 edit: "Edit", 232 delete: "Delete", 233 clickToUpload: "Click to upload", 234 uploadPhotoOrLogo: "Upload photo or logo", 235 imageSizeRequirement: "Image should be at least 100X100px", 236 invalidUploadData: "Invalid upload data", 237 failedToUploadImage: "Failed to upload image", 238 uploadCustomIcon: "Upload custom icon", 239 saveSuccess: "Company profile updated successfully", 240 saveError: "Failed to update company profile", 241 discardChangesTitle: "Discard changes", 242 discardChangesMessage: "Are you sure you want to discard recent changes?", 243 discard: "Discard changes", 244 saveChangesTitle: "Apply changes across all signatures", 245 saveChangesMessage: "These changes will be applied everywhere an edited field is used.", 246 confirm: "Confirm", 247 removeActionTooltip: "Delete", 248 replaceActionTooltip: "Replace",
249 editActionTooltip: "Edit" 250}, Xn = { class: "company-profile-tabs" }, Yn = { class: "navigation-items-list" }, Wn = ["aid"], Kn = ["onClick"], qn = { class: "navigation-item-icon-container" }, Zn = { class: "item-text" }, Qn = /* @__PURE__ */ Te({ 251 __name: "company-profile-tabs", 252 props: { 253 activeTab: {} 254 }, 255 emits: ["update:activeTab"], 256 setup(i, { emit: e }) { 257 const t = i, s = e, r = [ 258 { 259 key: ge.BASIC_INFORMATION, 260 label: T.basicInformation, 261 icon: "rectangle-list" 262 }, 263 { 264 key: ge.SOCIAL_LINKS, 265 label: T.socialLinks, 266 icon: "icons" 267 }, 268 { 269 key: ge.BRAND_KIT, 270 label: T.brandKit, 271 icon: "book-font", 272 sharp: !0 273 } 274 ]; 275 function n(l, c) { 276 const u = c === "light" ? "fa-light" : "fa-regular"; 277 return l.sharp ? ["fa-sharp", u] : [u]; 278 } 279 function o(l) { 280 s("update:activeTab", l); 281 } 282 function a(l) { 283 return t.activeTab === l; 284 } 285 return (l, c) => (E(), x("div", Xn, [ 286 w("ul", Yn, [ 287 (E(), x(de, null, me(r, (u) => w("li", { 288 key: u.key, 289 class: Ne(["navigation-item", { 290 "navigation-item-active": a(u.key) 291 }]), 292 aid: `COMPANY_PROFILE_TAB_${u.key}` 293 }, [ 294 w("a", { 295 onClick: (d) => o(u.key) 296 }, [ 297 w("div", qn, [ 298 w("span", { 299 class: Ne([...n(u, "light"), `fa-${u.icon}`]) 300 }, null, 2), 301 w("span", { 302 class: Ne([...n(u, "regular"), `fa-${u.icon}`]) 303 }, null, 2) 304 ]), 305 w("div", Zn, R(u.label), 1) 306 ], 8, Kn) 307 ], 10, Wn)), 64)) 308 ]) 309 ])); 310 } 311}), ve = (i, e) => { 312 const t = i.__vccOpts || i; 313 for (const [s, r] of e) 314 t[s] = r; 315 return t; 316}, Jn = /* @__PURE__ */ ve(Qn, [["__scopeId", "data-v-71ca539f"]]), us = Fn; 317function ze(i, e) { 318 return i.map((t) => t.property).filter( 319 (t) => t !== void 0 && (e === void 0 || t !== e) 320 ); 321} 322function gi(i) { 323 return i.toLowerCase().trim().replace(/\s+/g, "_"); 324} 325function Ks(i) { 326 return i.charAt(0).toUpperCase() + i.slice(1).replace(/_/g, " "); 327} 328function eo(i) { 329 return i.type === D.IMAGE; 330} 331function to(i) { 332 return i.type === D.BANNER; 333} 334function qs(i) { 335 return i.type === D.COLOR; 336} 337function io(i) { 338 return i.type === D.FONT_FAMILY; 339} 340function so(i, e) { 341 const t = new Set(ze(i)); 342 let s = i.filter((r) => qs(r)).length + 1; 343 for (; ; ) { 344 const r = `Color ${s}`, n = gi(r); 345 if (!t.has(n)) 346 return { 347 property: n, 348 label: r, 349 type: D.COLOR, 350 value: "", 351 tab: e, 352 icon: "", 353 isDefault: !1 354 }; 355 s++; 356 } 357} 358function At(i) { 359 return [...i].sort((e, t) => { 360 const s = us.indexOf(e.property ?? ""), r = us.indexOf(t.property ?? ""); 361 return s !== -1 && r !== -1 ? s - r : s !== -1 ? -1 : r !== -1 ? 1 : (e.property ?? "").localeCompare(t.property ?? ""); 362 }); 363} 364function ri(i, e) { 365 if (i.length !== e.length) 366 return !1; 367 const t = new Map(i.map((r) => [r.property, r])), s = new Map(e.map((r) => [r.property, r])); 368 if (t.size !== s.size) 369 return !1; 370 for (const [r, n] of t) { 371 const o = s.get(r); 372 if (!o || n.value !== o.value || n.type !== o.type || n.tab !== o.tab || n.icon !== o.icon) 373 return !1; 374 } 375 return !0; 376} 377function ds(i) { 378 return i.map((e) => ({ 379 property: e.property, 380 label: e.label, 381 type: e.type, 382 value: e.value, 383 tab: e.tab, 384 icon: e.icon, 385 isDefault: e.isDefault 386 })); 387} 388var ro = Object.defineProperty, no = (i, e, t) => e in i ? ro(i, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[e] = t, Ii = (i, e, t) => (no(i, typeof e != "symbol" ? e + "" : e, t), t); 389function oo(i) { 390 let e = (t) => { 391 var s; 392 for (let r in t) 393 ((s = t[r]) == null ? void 0 : s.constructor) === Object && (t[r] = e(t[r])); 394 return { ...t }; 395 }; 396 return e(i); 397} 398var $ = class { 399 constructor(i) { 400 i.constructor === Object ? this.store = oo(i) : (this._storeIsProxy = !0, this.store = i), this.callbackMap = /* @__PURE__ */ Object.create(null); 401 } 402 static warn(i, e) { 403 console.warn(`Symbiote Data: cannot ${i}. Prop name: ` + e); 404 } 405 read(i) { 406 return !this._storeIsProxy && !this.store.hasOwnProperty(i) ? ($.warn("read", i), null) : this.store[i]; 407 } 408 has(i) { 409 return this._storeIsProxy ? this.store[i] !== void 0 : this.store.hasOwnProperty(i); 410 } 411 add(i, e, t = !1) {
412 !t && Object.keys(this.store).includes(i) || (this.store[i] = e, this.notify(i)); 413 } 414 pub(i, e) { 415 if (!this._storeIsProxy && !this.store.hasOwnProperty(i)) { 416 $.warn("publish", i); 417 return; 418 } 419 this.store[i] = e, this.notify(i); 420 } 421 multiPub(i) { 422 for (let e in i) 423 this.pub(e, i[e]); 424 } 425 notify(i) { 426 this.callbackMap[i] && this.callbackMap[i].forEach((e) => { 427 e(this.store[i]); 428 }); 429 } 430 sub(i, e, t = !0) { 431 return !this._storeIsProxy && !this.store.hasOwnProperty(i) ? ($.warn("subscribe", i), null) : (this.callbackMap[i] || (this.callbackMap[i] = /* @__PURE__ */ new Set()), this.callbackMap[i].add(e), t && e(this.store[i]), { 432 remove: () => { 433 this.callbackMap[i].delete(e), this.callbackMap[i].size || delete this.callbackMap[i]; 434 }, 435 callback: e 436 }); 437 } 438 static registerCtx(i, e = /* @__PURE__ */ Symbol()) { 439 let t = $.globalStore.get(e); 440 return t ? console.warn('State: context UID "' + e + '" already in use') : (t = new $(i), $.globalStore.set(e, t)), t; 441 } 442 static deleteCtx(i) { 443 $.globalStore.delete(i); 444 } 445 static getCtx(i, e = !0) { 446 return $.globalStore.get(i) || (e && console.warn('State: wrong context UID - "' + i + '"'), null); 447 } 448}; 449$.globalStore = /* @__PURE__ */ new Map(); 450var L = Object.freeze({ 451 BIND_ATTR: "set", 452 ATTR_BIND_PRFX: "@", 453 EXT_DATA_CTX_PRFX: "*", 454 NAMED_DATA_CTX_SPLTR: "/", 455 CTX_NAME_ATTR: "ctx-name", 456 CTX_OWNER_ATTR: "ctx-owner", 457 CSS_CTX_PROP: "--ctx-name", 458 EL_REF_ATTR: "ref", 459 AUTO_TAG_PRFX: "sym", 460 REPEAT_ATTR: "repeat", 461 REPEAT_ITEM_TAG_ATTR: "repeat-item-tag", 462 SET_LATER_KEY: "__toSetLater__", 463 USE_TPL: "use-template", 464 ROOT_STYLE_ATTR_NAME: "sym-component" 465}), Zs = "1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm", ao = Zs.length - 1, Ft = class { 466 static generate(i = "XXXXXXXXX-XXX") { 467 let e = ""; 468 for (let t = 0; t < i.length; t++) 469 e += i[t] === "-" ? i[t] : Zs.charAt(Math.random() * ao); 470 return e; 471 } 472}; 473function Qs(i, e, t) { 474 let s = !0, r, n = e.split("."); 475 return n.forEach((o, a) => { 476 a < n.length - 1 ? i = i[o] : r = o; 477 }), i ? i[r] = t : s = !1, s; 478} 479function lo(i) { 480 return i.split("-").map((e, t) => e && t ? e[0].toUpperCase() + e.slice(1) : e).join("").split("_").map((e, t) => e && t ? e.toUpperCase() : e).join(""); 481} 482function co(i, e) { 483 [...i.querySelectorAll(`[${L.REPEAT_ATTR}]`)].forEach((t) => { 484 let s = t.getAttribute(L.REPEAT_ITEM_TAG_ATTR), r; 485 if (s && (r = window.customElements.get(s)), !r) { 486 r = class extends e.BaseComponent { 487 constructor() { 488 super(), s || (this.style.display = "contents"); 489 } 490 }; 491 let o = t.innerHTML; 492 r.template = o, r.reg(s); 493 } 494 for (; t.firstChild; ) 495 t.firstChild.remove(); 496 let n = t.getAttribute(L.REPEAT_ATTR); 497 e.sub(n, (o) => { 498 if (!o) { 499 for (; t.firstChild; ) 500 t.firstChild.remove(); 501 return; 502 } 503 let a = [...t.children], l, c = (u) => { 504 u.forEach((h, p) => { 505 if (a[p]) 506 if (a[p].set$) 507 setTimeout(() => { 508 a[p].set$(h); 509 }); 510 else 511 for (let g in h) 512 a[p][g] = h[g]; 513 else { 514 l || (l = new DocumentFragment()); 515 let g = new r(); 516 Object.assign(g.init$, h), l.appendChild(g); 517 } 518 }), l && t.appendChild(l); 519 let d = a.slice(u.length, a.length); 520 for (let h of d) 521 h.remove(); 522 }; 523 if (o.constructor === Array) 524 c(o); 525 else if (o.constructor === Object) { 526 let u = []; 527 for (let d in o) { 528 let h = o[d]; 529 Object.defineProperty(h, "_KEY_", { 530 value: d, 531 enumerable: !0 532 }), u.push(h); 533 } 534 c(u); 535 } else 536 console.warn("Symbiote repeat data type error:"), console.log(o); 537 }), t.removeAttribute(L.REPEAT_ATTR), t.removeAttribute(L.REPEAT_ITEM_TAG_ATTR); 538 }); 539} 540var hs = "__default__"; 541function uo(i, e) { 542 if (e.shadowRoot) 543 return; 544 let t = [...i.querySelectorAll("slot")]; 545 if (!t.length) 546 return; 547 let s = {}; 548 t.forEach((r) => { 549 let n = r.getAttribute("name") || hs; 550 s[n] = { 551 slot: r, 552 fr: document.createDocumentFragment() 553 }; 554 }
554), e.initChildren.forEach((r) => { 555 var n; 556 let o = hs; 557 r instanceof Element && r.hasAttribute("slot") && (o = r.getAttribute("slot"), r.removeAttribute("slot")), (n = s[o]) == null || n.fr.appendChild(r); 558 }), Object.values(s).forEach((r) => { 559 if (r.fr.childNodes.length) 560 r.slot.parentNode.replaceChild(r.fr, r.slot); 561 else if (r.slot.childNodes.length) { 562 let n = document.createDocumentFragment(); 563 n.append(...r.slot.childNodes), r.slot.parentNode.replaceChild(n, r.slot); 564 } else 565 r.slot.remove(); 566 }); 567} 568function ho(i, e) { 569 [...i.querySelectorAll(`[${L.EL_REF_ATTR}]`)].forEach((t) => { 570 let s = t.getAttribute(L.EL_REF_ATTR); 571 e.ref[s] = t, t.removeAttribute(L.EL_REF_ATTR); 572 }); 573} 574function fo(i, e) { 575 [...i.querySelectorAll(`[${L.BIND_ATTR}]`)].forEach((t) => { 576 let r = t.getAttribute(L.BIND_ATTR).split(";"); 577 [...t.attributes].forEach((n) => { 578 if (n.name.startsWith("-") && n.value) { 579 let o = lo(n.name.replace("-", "")); 580 r.push(o + ":" + n.value), t.removeAttribute(n.name); 581 } 582 }), r.forEach((n) => { 583 if (!n) 584 return; 585 let o = n.split(":").map((u) => u.trim()), a = o[0], l; 586 a.indexOf(L.ATTR_BIND_PRFX) === 0 && (l = !0, a = a.replace(L.ATTR_BIND_PRFX, "")); 587 let c = o[1].split(",").map((u) => u.trim()); 588 for (let u of c) { 589 let d; 590 u.startsWith("!!") ? (d = "double", u = u.replace("!!", "")) : u.startsWith("!") && (d = "single", u = u.replace("!", "")), e.sub(u, (h) => { 591 d === "double" ? h = !!h : d === "single" && (h = !h), l ? h?.constructor === Boolean ? h ? t.setAttribute(a, "") : t.removeAttribute(a) : t.setAttribute(a, h) : Qs(t, a, h) || (t[L.SET_LATER_KEY] || (t[L.SET_LATER_KEY] = /* @__PURE__ */ Object.create(null)), t[L.SET_LATER_KEY][a] = h); 592 }); 593 } 594 }), t.removeAttribute(L.BIND_ATTR); 595 }); 596} 597var Ot = "{{", lt = "}}", po = "skip-text"; 598function mo(i) { 599 let e, t = [], s = document.createTreeWalker(i, NodeFilter.SHOW_TEXT, { 600 acceptNode: (r) => { 601 var n; 602 return !((n = r.parentElement) != null && n.hasAttribute(po)) && r.textContent.includes(Ot) && r.textContent.includes(lt) && 1; 603 } 604 }); 605 for (; e = s.nextNode(); ) 606 t.push(e); 607 return t; 608} 609var go = function(i, e) {
610 mo(i).forEach((s) => { 611 let r = [], n; 612 for (; s.textContent.includes(lt); ) 613 s.textContent.startsWith(Ot) ? (n = s.textContent.indexOf(lt) + lt.length, s.splitText(n), r.push(s)) : (n = s.textContent.indexOf(Ot), s.splitText(n)), s = s.nextSibling; 614 r.forEach((o) => { 615 let a = o.textContent.replace(Ot, "").replace(lt, ""); 616 o.textContent = "", e.sub(a, (l) => { 617 o.textContent = l; 618 }); 619 }); 620 }); 621}, bo = [co, uo, ho, fo, go], Pt = "'", Qe = '"', vo = /\\([0-9a-fA-F]{1,6} ?)/g; 622function _o(i) { 623 return (i[0] === Qe || i[0] === Pt) && (i[i.length - 1] === Qe || i[i.length - 1] === Pt); 624} 625function yo(i) { 626 return (i[0] === Qe || i[0] === Pt) && (i = i.slice(1)), (i[i.length - 1] === Qe || i[i.length - 1] === Pt) && (i = i.slice(0, -1)), i; 627} 628function Ao(i) { 629 let e = "", t = ""; 630 for (var s = 0; s < i.length; s++) { 631 const r = i[s + 1]; 632 i[s] === "\\" && r === '"' ? (e += '\\"', s++) : i[s] === '"' && t !== "\\" ? e += '\\"' : e += i[s], t = i[s]; 633 } 634 return e; 635} 636function wo(i) { 637 let e = i; 638 _o(i) && (e = yo(e), e = e.replace(vo, (t, s) => String.fromCodePoint(parseInt(s.trim(), 16))), e = e.replaceAll(`\\ 639`, "\\n"), e = Ao(e), e = Qe + e + Qe); 640 try { 641 return JSON.parse(e); 642 } catch { 643 throw new Error(`Failed to parse CSS property value: ${e}. Original input: ${i}`); 644 } 645} 646var fs = 0, Ge = null, ye = null, Se = class extends HTMLElement { 647 constructor() { 648 super(), Ii(this, "updateCssData", () => { 649 var i; 650 this.dropCssDataCache(), (i = this.__boundCssProps) == null || i.forEach((e) => { 651 let t = this.getCssData(this.__extractCssName(e), !0); 652 t !== null && this.$[e] !== t && (this.$[e] = t); 653 }); 654 }), this.init$ = /* @__PURE__ */ Object.create(null), this.cssInit$ = /* @__PURE__ */ Object.create(null), this.tplProcessors = /* @__PURE__ */ new Set(), this.ref = /* @__PURE__ */ Object.create(null), this.allSubs = /* @__PURE__ */ new Set(), this.pauseRender = !1, this.renderShadow = !1, this.readyToDestroy = !0, this.processInnerHtml = !1, this.allowCustomTemplate = !1, this.ctxOwner = !1; 655 } 656 get BaseComponent() { 657 return Se; 658 } 659 initCallback() { 660 }
661 __initCallback() { 662 var i; 663 this.__initialized || (this.__initialized = !0, (i = this.initCallback) == null || i.call(this)); 664 } 665 render(i, e = this.renderShadow) { 666 let t; 667 if ((e || this.constructor.__shadowStylesUrl) && !this.shadowRoot && this.attachShadow({ 668 mode: "open" 669 }), this.allowCustomTemplate) { 670 let r = this.getAttribute(L.USE_TPL); 671 if (r) { 672 let n = this.getRootNode(), o = n?.querySelector(r) || document.querySelector(r); 673 o ? i = o.content.cloneNode(!0) : console.warn(`Symbiote template "${r}" is not found...`); 674 } 675 } 676 if (this.processInnerHtml) 677 for (let r of this.tplProcessors) 678 r(this, this); 679 if (i || this.constructor.template) { 680 if (this.constructor.template && !this.constructor.__tpl && (this.constructor.__tpl = document.createElement("template"), this.constructor.__tpl.innerHTML = this.constructor.template), i?.constructor === DocumentFragment) 681 t = i; 682 else if (i?.constructor === String) { 683 let r = document.createElement("template"); 684 r.innerHTML = i, t = r.content.cloneNode(!0); 685 } else this.constructor.__tpl && (t = this.constructor.__tpl.content.cloneNode(!0)); 686 for (let r of this.tplProcessors) 687 r(t, this); 688 } 689 let s = () => { 690 t && (e && this.shadowRoot.appendChild(t) || this.appendChild(t)), this.__initCallback(); 691 }; 692 if (this.constructor.__shadowStylesUrl) { 693 e = !0; 694 let r = document.createElement("link"); 695 r.rel = "stylesheet", r.href = this.constructor.__shadowStylesUrl, r.onload = s, this.shadowRoot.prepe
695nd(r); 696 } else 697 s(); 698 } 699 addTemplateProcessor(i) { 700 this.tplProcessors.add(i); 701 } 702 get autoCtxName() { 703 return this.__autoCtxName || (this.__autoCtxName = Ft.generate(), this.style.setProperty(L.CSS_CTX_PROP, `'${this.__autoCtxName}'`)), this.__autoCtxName; 704 } 705 get cssCtxName() { 706 return this.getCssData(L.CSS_CTX_PROP, !0); 707 } 708 get ctxName() { 709 var i; 710 let e = ((i = this.getAttribute(L.CTX_NAME_ATTR)) == null ? void 0 : i.trim()) || this.cssCtxName || this.__cachedCtxName || this.autoCtxName; 711 return this.__cachedCtxName = e, e; 712 } 713 get localCtx() { 714 return this.__localCtx || (this.__localCtx = $.registerCtx({}, this)), this.__localCtx; 715 } 716 get nodeCtx() { 717 return $.getCtx(this.ctxName, !1) || $.registerCtx({}, this.ctxName); 718 } 719 static __parseProp(i, e) { 720 let t, s; 721 if (i.startsWith(L.EXT_DATA_CTX_PRFX)) 722 t = e.nodeCtx, s = i.replace(L.EXT_DATA_CTX_PRFX, ""); 723 else if (i.includes(L.NAMED_DATA_CTX_SPLTR)) { 724 let r = i.split(L.NAMED_DATA_CTX_SPLTR); 725 t = $.getCtx(r[0]), s = r[1]; 726 } else 727 t = e.localCtx, s = i; 728 return { 729 ctx: t, 730 name: s 731 }; 732 } 733 sub(i, e, t = !0) { 734 let s = (n) => { 735 this.isConnected && e(n); 736 }, r = Se.__parseProp(i, this); 737 r.ctx.has(r.name) ? this.allSubs.add(r.ctx.sub(r.name, s, t)) : window.setTimeout(() => { 738 this.allSubs.add(r.ctx.sub(r.name, s, t)); 739 }); 740 } 741 notify(i) { 742 let e = Se.__parseProp(i, this); 743 e.ctx.notify(e.name); 744 } 745 has(i) { 746 let e = Se.__parseProp(i, this); 747 return e.ctx.has(e.name); 748 } 749 add(i, e, t = !1) { 750 let s = Se.__parseProp(i, this); 751 s.ctx.add(s.name, e, t); 752 } 753 add$(i, e = !1) { 754 for (let t in i) 755 this.add(t, i[t], e); 756 } 757 get $() { 758 if (!this.__stateProxy) { 759 let i = /* @__PURE__ */ Object.create(null); 760 this.__stateProxy = new Proxy(i, { 761 set: (e, t, s) => { 762 let r = Se.__parseProp(t, this); 763 return r.ctx.pub(r.name, s), !0; 764 }, 765 get: (e, t) => { 766 let s = Se.__parseProp(t, this); 767 return s.ctx.read(s.name); 768 } 769 }); 770 } 771 return this.__stateProxy; 772 } 773 set$(i, e = !1) { 774 for (let t in i) { 775 let s = i[t]; 776 e || ![String, Number, Boolean].includes(s?.constructor) ? this.$[t] = s : this.$[t] !== s && (this.$[t] = s); 777 } 778 } 779 get __ctxOwner() { 780 return this.ctxOwner || this.hasAttribute(L.CTX_OWNER_ATTR) && this.getAttribute(L.CTX_OWNER_ATTR) !== "fal
780se"; 781 } 782 __initDataCtx() { 783 let i = this.constructor.__attrDesc; 784 if (i) 785 for (let e of Object.values(i)) 786 Object.keys(this.init$).includes(e) || (this.init$[e] = ""); 787 for (let e in this.init$) 788 if (e.startsWith(L.EXT_DATA_CTX_PRFX)) 789 this.nodeCtx.add(e.replace(L.EXT_DATA_CTX_PRFX, ""), this.init$[e], this.__ctxOwner); 790 else if (e.includes(L.NAMED_DATA_CTX_SPLTR)) { 791 let t = e.split(L.NAMED_DATA_CTX_SPLTR), s = t[0].trim(), r = t[1].trim(); 792 if (s && r) { 793 let n = $.getCtx(s, !1); 794 n || (n = $.registerCtx({}, s)), n.add(r, this.init$[e]); 795 } 796 } else 797 this.localCtx.add(e, this.init$[e]); 798 for (let e in this.cssInit$) 799 this.bindCssData(e, this.cssInit$[e]); 800 this.__dataCtxInitialized = !0; 801 } 802 connectedCallback() { 803 var i; 804 if (this.isConnected) { 805 if (this.__disconnectTimeout && window.clearTimeout(this.__disconnectTimeout), !this.connectedOnce) { 806 let e = (i = this.getAttribute(L.CTX_NAME_ATTR)) == null ? void 0 : i.trim(); 807 if (e && this.style.setProperty(L.CSS_CTX_PROP, `'${e}'`), this.__initDataCtx(), this[L.SET_LATER_KEY]) { 808 for (let t in this[L.SET_LATER_KEY]) 809 Qs(this, t, this[L.SET_LATER_KEY][t]); 810 delete this[L.SET_LATER_KEY]; 811 } 812 this.initChildren = [...this.childNodes]; 813 for (let t of bo) 814 this.addTemplateProcessor(t); 815 if (this.pauseRender) 816 this.__initCallback(); 817 else if (this.constructor.__rootStylesLink) { 818 let t = this.getRootNode(); 819 if (!t) 820 return; 821 if (t?.querySelector(`link[${L.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)) { 822 this.render(); 823 return; 824 } 825 let r = this.constructor.__rootStylesLink.cloneNode(!0); 826 r.setAttribute(L.ROOT_STYLE_ATTR_NAME, this.constructor.is), r.onload = () => { 827 this.render(); 828 }, t.nodeType === Node.DOCUMENT_NODE ? t.head.appendChild(r) : t.prepend(r); 829 } else 830 this.render(); 831 } 832 this.connectedOnce = !0; 833 } 834 } 835 destroyCallback() { 836 } 837 disconnectedCallback() { 838 this.connectedOnce && (this.dropCssDataCache(), this.readyToDestroy && (this.__disconnectTimeout && window.clearTimeout(this.__disconnectTimeout), this.__disconnectTimeout = window.setTimeout(() => { 839 this.destroyCallback(); 840 for (let i of this.allSubs) 841 i.remove(), this.allSubs.delete(i); 842 for (let i of this.tplProcessors) 843 this.tplProcessors.delete(i); 844 ye?.delete(this.updateCssData), ye?.size || (Ge?.disconnect(), Ge = null, ye = null); 845 }, 100))); 846 } 847 static reg(i, e = !1) { 848 i || (fs++, i = `${L.AUTO_TAG_PRFX}-${fs}`), this.__tag = i; 849 let t = window.customElements.get(i); 850 if (t) { 851 !e && t !== this && console.warn([ 852 `Element with tag name "${i}" already registered.`, 853 `You're trying to override it with another class "${this.name}".`, 854 "This is most likely a mistake.", 855 "New element will not be registered." 856 ].join(` 857`)); 858 return; 859 } 860 window.customElements.define(i, e ? class extends this { 861 } : this); 862 } 863 static get is() { 864 return this.__tag || this.reg(), this.__tag; 865 } 866 static bindAttributes(i) {
867 this.observedAttributes = Object.keys(i), this.__attrDesc = i; 868 } 869 attributeChangedCallback(i, e, t) { 870 var s; 871 if (e === t) 872 return; 873 let r = (s = this.constructor.__attrDesc) == null ? void 0 : s[i]; 874 r ? this.__dataCtxInitialized ? this.$[r] = t : this.init$[r] = t : this[i] = t; 875 } 876 getCssData(i, e = !1) { 877 if (this.__cssDataCache || (this.__cssDataCache = /* @__PURE__ */ Object.create(null)), !Object.keys(this.__cssDataCache).includes(i)) { 878 this.__computedStyle || (this.__computedStyle = window.getComputedStyle(this)); 879 let t = this.__computedStyle.getPropertyValue(i).trim(); 880 try { 881 this.__cssDataCache[i] = wo(t); 882 } catch { 883 !e && console.warn(`CSS Data error: ${i}`), this.__cssDataCache[i] = null; 884 } 885 } 886 return this.__cssDataCache[i]; 887 } 888 __extractCssName(i) { 889 return i.split("--").map((e, t) => t === 0 ? "" : e).join("--"); 890 } 891 __initStyleAttrObserver() { 892 ye || (ye = /* @__PURE__ */ new Set()), ye.add(this.updateCssData), Ge || (Ge = new MutationObserver((i) => { 893 i[0].type === "attributes" && ye.forEach((e) => { 894 e(); 895 }); 896 }), Ge.observe(document, { 897 childList: !0, 898 subtree: !0, 899 attributes: !0, 900 attributeFilter: ["style"] 901 })); 902 } 903 bindCssData(i, e = "") { 904 this.__boundCssProps || (this.__boundCssProps = /* @__PURE__ */ new Set()), this.__boundCssProps.add(i); 905 let t = this.getCssData(this.__extractCssName(i), !0); 906 t === null && (t = e), this.add(i, t), this.__initStyleAttrObserver(); 907 } 908 dropCssDataCache() { 909 this.__cssDataCache = null, this.__computedStyle = null; 910 } 911 defineAccessor(i, e, t) { 912 let s = "__" + i; 913 this[s] = this[i], Object.defineProperty(this, i, { 914 set: (r) => { 915 this[s] = r, t ? window.setTimeout(() => { 916 e?.(r); 917 }) : e?.(r); 918 }, 919 get: () => this[s] 920 }), this[i] = this[s]; 921 } 922 static set shadowStyles(i) { 923 let e = new Blob([i], { 924 type: "text/css" 925 }); 926 this.__shadowStylesUrl = URL.createObjectURL(e); 927 } 928 static set rootStyles(i) { 929 if (!this.__rootStylesLink) { 930 let e = new Blob([i], { 931 type: "text/css" 932 }), t = URL.createObjectURL(e), s = document.createElement("link"); 933 s.href = t, s.rel = "stylesheet", this.__rootStylesLink = s; 934 } 935 } 936}, bt = Se; 937Ii(bt, "template"); 938function Si(i, e) { 939 for (let t in e) 940 t.includes("-") ? i.style.setProperty(t, e[t]) : i.style[t] = e[t]; 941} 942function Co(i, e) { 943 for (let t in e) 944 e[t].constructor === Boolean ? e[t] ? i.setAttribute(t, "") : i.removeAttribute(t) : i.setAttribute(t, e[t]); 945} 946function Js(i = { tag: "div" }) { 947 let e = document.createElement(i.tag); 948 if (i.attributes && Co(e, i.attributes), i.styles && Si(e, i.styles), i.properties) 949 for (let t in i.properties) 950 e[t] = i.properties[t]; 951 return i.processors && i.processors.forEach((t) => { 952 t(e); 953 }), i.children && i.children.forEach((t) => { 954 let s = Js(t); 955 e.appendChild(s); 956 }), e; 957} 958var er = "idb-store-ready", Eo = "symbiote-db", To = "symbiote-idb-update_", Io = class { 959 _notifyWhenReady(i = null) { 960 window.dispatchEvent(new CustomEvent(er, { 961 detail: { 962 dbName: this.name, 963 storeName: this.storeName, 964 event: i 965 } 966 })); 967 } 968 get _updEventName() { 969 return To + this.name; 970 } 971 _getUpdateEvent(i) { 972 return new CustomEvent(this._updEventName, { 973 detail: { 974 key: this.name, 975 newValue: i 976 } 977 }); 978 } 979 _notifySubscribers(i) { 980 window.localStorage.removeItem(this.name), window.localStorage.setItem(this.name, i), window.dispatchEvent(this._getUpdateEvent(i)); 981 } 982 constructor(i, e) { 983 this.name = i, this.storeName = e, this.version = 1, this.request = window.indexedDB.open(this.name, this.version), this.request.onupgradeneeded = (t) => { 984 this.db = t.target.result, this.objStore = this.db.createObjectStore(e, { 985 keyPath: "_key" 986 }), this.objStore.transaction.oncomplete = (s) => { 987 this._notifyWhenReady(s); 988 }; 989 }, this.request.onsuccess = (t) => { 990 this.db = t.target.result, this._notifyWhenReady(t); 991 }, this.request.onerror = (t) => { 992 console.error(t); 993 }, this._subscriptionsMap = {}, this._updateHandler = (t) => { 994 t.key === this.name && this._subscriptionsMap[t.newValue] && this._subscriptionsMap[t.newValue].forEach(async (r) => { 995 r(await this.read(t.newValue)); 996 }); 997 }, this._localUpdateHandler = (t) => { 998 this._updateHandler(t.detail); 999 }, window.addEventListener("storage", this._updateHandler), window.addEventListener(this._updEventName, this._localUpdateHandler); 1000 } 1001 read(i) { 1002 let t = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).get(i); 1003 return new Promise((s, r) => { 1004 t.onsuccess = (n) => { 1005 var o; 1006 (o = n.target.result) != null && o._value ? s(n.target.result._value) : (s(null), console.warn(`IDB: cannot read "${i}"`)); 1007 }, t.onerror = (n) => { 1008 r(n); 1009 }; 1010 }); 1011 } 1012 write(i, e, t = !1) { 1013 let s = { 1014 _key: i, 1015 _value: e 1016 }, n = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).put(s); 1017 return new Promise((o, a) => { 1018 n.onsuccess = (l) => { 1019 t || this._notifySubscribers(i), o(l.target.result); 1020 }, n.onerror = (l) => { 1021 a(l); 1022 }; 1023 }); 1024 } 1025 delete(i, e = !1) { 1026 let s = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).delete(i); 1027 return new Promise((r, n) => { 1028 s.onsuccess = (o) => { 1029 e || this._notifySubscribers(i), r(o); 1030 }, s.onerror = (o) => { 1031 n(o); 1032 }; 1033 }); 1034 } 1035 getAll() { 1036 let e = this.db.transaction(this.storeName, "readwrite").objectStore(this.storeName).getAll(); 1037 return new Promise((t, s) => { 1038 e.onsuccess = (r) => { 1039 let n = r.target.result; 1040 t(n.map((o) => o._value)); 1041 }, e.onerror = (r) => { 1042 s(r); 1043 }; 1044 }); 1045 } 1046 subscribe(i, e) { 1047 this._subscriptionsMap[i] || (this._subscriptionsMap[i] = /* @__PURE__ */ new Set()); 1048 let t = this._subscriptionsMap[i]; 1049 return t.add(e), { 1050 remove: () => { 1051 t.delete(e), t.size || delete this._subscriptionsMap[i]; 1052 } 1053 }; 1054 } 1055 stop() { 1056 window.removeEventListener("storage", this._updateHandler), this._subscriptionsMap = null, tr.clear(this.name); 1057 } 1058}, tr = class { 1059 static get readyEventName() { 1060 return er; 1061 }
1062 static open(i = Eo, e = "store") { 1063 let t = i + "/" + e; 1064 return this._reg[t] || (this._reg[t] = new Io(i, e)), this._reg[t]; 1065 } 1066 static clear(i) { 1067 window.indexedDB.deleteDatabase(i); 1068 for (let e in this._reg) 1069 e.split("/")[0] === i && delete this._reg[e]; 1070 } 1071}; 1072Ii(tr, "_reg", /* @__PURE__ */ Object.create(null)); 1073const ir = (i) => { 1074 if (typeof i != "string" || !i) 1075 return ""; 1076 let e = i.trim(); 1077 return e.startsWith("-/") ? e = e.slice(2) : e.startsWith("/") && (e = e.slice(1)), e.endsWith("/") && (e = e.slice(0, e.length - 1)), e; 1078}, ki = (...i) => i.filter((e) => typeof e == "string" && e).map((e) => ir( 1079 /** @type {String} */ 1080 e 1081)).join("/-/"), Ue = (...i) => { 1082 let e = ki(...i); 1083 return e ? `-/${e}/` : ""; 1084}; 1085function xi(i) { 1086 let e = new URL(i), t = e.pathname + e.search + e.hash, s = t.lastIndexOf("http"), r = t.lastIndexOf("/"), n = ""; 1087 return s >= 0 ? n = t.slice(s) : r >= 0 && (n = t.slice(r + 1)), n; 1088} 1089function sr(i) { 1090 let e = new URL(i), { pathname: t } = e; 1091 const s = t.indexOf("/"), r = t.indexOf("/", s + 1); 1092 return t.substring(s + 1, r); 1093} 1094function rr(i) { 1095 let e = nr(i), t = new URL(e), s = t.pathname.indexOf("/-/"); 1096 return s === -1 ? "" : t.pathname.substring(s).slice(1); 1097} 1098function So(i) { 1099 return rr(i).split("/-/").filter(Boolean).map((t) => ir(t)); 1100} 1101function nr(i) { 1102 let e = new URL(i), t = xi(i), s = or(t) ? ar(t).pathname : t; 1103 return e.pathname = e.pathname.replace(s, ""), e.search = "", e.hash = "", e.toString(); 1104} 1105function or(i) { 1106 return i.startsWith("http"); 1107} 1108function ar(i) { 1109 let e = new URL(i); 1110 return { 1111 pathname: e.origin + e.pathname || "", 1112 search: e.search || "", 1113 hash: e.hash || "" 1114 }; 1115} 1116const ae = (i, e, t) => { 1117 let s = new URL(nr(i)); 1118 if (t = t || xi(i), s.pathname.startsWith("//") && (s.pathname = s.pathname.replace("//", "/")), or(t)) { 1119 let r = ar(t); 1120 s.pathname = s.pathname + (e || "") + (r.pathname || ""), s.search = r.search, s.hash = r.hash; 1121 } else 1122 s.pathname = s.pathname + (e || "") + (t || ""); 1123 return s.toString(); 1124}, ft = (i, e) => { 1125 let t = new URL(i); 1126 return t.pathname = e + "/", t.toString(); 1127}, Me = (i, e = ",") => i.trim().split(e).map((t) => t.trim()).filter((t) => t.length > 0), ne = Object.freeze({ 1128 brightness: 0, 1129 exposure: 0, 1130 gamma: 100, 1131 contrast: 0, 1132 saturation: 0, 1133 vibrance: 0, 1134 warmth: 0, 1135 enhance: 0, 1136 filter: 0, 1137 rotate: 0, 1138 mirror: !1, 1139 flip: !1, 1140 crop: void 0 1141}), lr = ( 1142 /** @type {const} */ 1143 [ 1144 "enhance", 1145 "brightness", 1146 "exposure", 1147 "gamma", 1148 "contrast", 1149 "saturation", 1150 "vibrance", 1151 "warmth", 1152 "filter", 1153 "mirror", 1154 "flip", 1155 "rotate", 1156 "crop" 1157 ] 1158); 1159function ko(i, e) { 1160 if (typeof e == "number") { 1161 const t = e; 1162 return ne[i] !== t ? `${i}/${t}` : ""; 1163 } 1164 if (typeof e == "boolean") { 1165 const t = e; 1166 return ne[i] !== t ? `${i}` : ""; 1167 } 1168 if (i === "filter" && e) { 1169 const { name: t, amount: s } = ( 1170 /** @type {NonNullable<import('../types').Transformations['filter']>} */ 1171 e 1172 ); 1173 return ne.filter === s ? "" : `${i}/${t}/${s}`; 1174 } 1175 if (i === "crop" && e) { 1176 let { dimensions: t, coords: s } = ( 1177 /** @type {NonNullable<import('../types').Transformations['crop']>} */ 1178 e 1179 ); 1180 return `${i}/${t.join("x")}/${s.join(",")}`; 1181 } 1182 return ""; 1183} 1184function Nt(i) { 1185 return ki( 1186 ...lr.filter( 1187 (e) => typeof i[e] < "u" && i[e] !== null 1188 ).map((e) => { 1189 let t = i[e]; 1190 return ko(e, t); 1191 }).filter((e) => !!e) 1192 ); 1193} 1194const cr = ki("format/auto", "progressive/yes"), Ae = ([i]) => typeof i < "u" ? Number(i) : void 0, ps = () => !0, xo = ([i, e]) => ({ 1195 name: i, 1196 amount: typeof e < "u" ? Number(e) : 100 1197}), Oo = ([i, e]) => { 1198 if (!/\d+x\d+/.test(i) || !/\d+,\d+/.test(e)) 1199 throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported."); 1200 return ( 1201 /** @type {{ dimensions: [number, number]; coords: [number, number] }} */ 1202 { 1203 dimensions: Me(i, "x").map(Number), 1204 coords: Me(e).map(Number) 1205 } 1206 ); 1207}, Lo = Object.freeze({ 1208 enhance: Ae, 1209 brightness: Ae, 1210 exposure: Ae, 1211 gamma: Ae, 1212 contrast: Ae, 1213 saturation: Ae, 1214 vibrance: Ae, 1215 warmth: Ae, 1216 filter: xo, 1217 mirror: ps, 1218 flip: ps, 1219 rotate: Ae, 1220 crop: Oo 1221}); 1222function Po(i) { 1223 const e = {}; 1224 for (const t of i) { 1225 const [s, ...r] = t.split("/"); 1226 if (!lr.includes(s)) 1227 continue; 1228 const n = ( 1229 /** @type {(typeof SUPPORTED_OPERATIONS_ORDERED)[number]} */ 1230 s 1231 ), o = Lo[n]; 1232 try { 1233 const a = o(r); 1234 e[n] = a; 1235 } catch (a) { 1236 console.warn( 1237 [ 1238 `Failed to parse URL operation "${t}". It will be ignored.`, 1239 a instanceof Error ? `Error message: "${a.message}"` : a, 1240 "If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new" 1241 ].join(` 1242`) 1243 ); 1244 } 1245 } 1246 return ( 1247 /** @type {import('../types.js').Transformations} */ 1248 e 1249 ); 1250} 1251const V = Object.freeze({ 1252 CROP: "crop", 1253 TUNING: "tuning", 1254 FILTERS: "filters" 1255}), be = [V.CROP, V.TUNING, V.FILTERS], Uo = [ 1256 "brightness", 1257 "exposure", 1258 "gamma", 1259 "contrast", 1260 "saturation", 1261 "vibrance", 1262 "warmth", 1263 "enhance" 1264], Mo = [ 1265 "adaris", 1266 "briaril", 1267 "calarel", 1268 "carris", 1269 "cynarel", 1270 "cyren", 1271 "elmet", 1272 "elonni", 1273 "enzana", 1274 "erydark", 1275 "fenralan", 1276 "ferand", 1277 "galen", 1278 "gavin", 1279 "gethriel", 1280 "iorill", 1281 "iothari", 1282 "iselva", 1283 "jadis", 1284 "lavra", 1285 "misiara", 1286 "namala", 1287 "nerion", 1288 "nethari", 1289 "pamaya", 1290 "sarnar", 1291 "sedis", 1292 "sewen", 1293 "sorahel", 1294 "sorlen", 1295 "tarian", 1296 "thellassan", 1297 "varriel", 1298 "varven", 1299 "vevera", 1300 "virkas", 1301 "yedis", 1302 "yllara", 1303 "zatvel", 1304 "zevcen" 1305], Do = ["rotate", "mirror", "flip"], Je = Object.freeze({ 1306 brightness: { 1307 zero: ne.brightness, 1308 range: [-100, 100], 1309 keypointsNumber: 2 1310 }, 1311 exposure: { 1312 zero: ne.exposure, 1313 range: [-500, 500], 1314 keypointsNumber: 2 1315 }, 1316 gamma: { 1317 zero: ne.gamma, 1318 range: [0, 1e3], 1319 keypointsNumber: 2 1320 }, 1321 contrast: { 1322 zero: ne.contrast, 1323 range: [-100, 500], 1324 keypointsNumber: 2 1325 }, 1326 saturation: { 1327 zero: ne.saturation, 1328 range: [-100, 500], 1329 keypointsNumber: 1 1330 }, 1331 vibrance: { 1332 zero: ne.vibrance, 1333 range: [-100, 500], 1334 keypointsNumber: 1 1335 }, 1336 warmth: { 1337 zero: ne.warmth, 1338 range: [-100, 100], 1339 keypointsNumber: 1 1340 }, 1341 enhance: { 1342 zero: ne.enhance, 1343 range: [0, 100], 1344 keypointsNumber: 1 1345 }, 1346 filter: { 1347 zero: ne.filter, 1348 range: [0, 100], 1349 keypointsNumber: 1 1350 } 1351}), Ro = (i) => i ? i.split(",").map((e) => e.trim()) : [], Oi = (i) => i ? i.join(",") : "", $o = "https://ucarecdn.com", Fo = "https://upload.uploadcare.com", No = "https://social.uploadcare.com", xe = { 1352 pubkey: "", 1353 multiple: !0, 1354 multipleMin: 0, 1355 multipleMax: Number.MAX_SAFE_INTEGER, 1356 confirmUpload: !1, 1357 imgOnly: !1, 1358 accept: "", 1359 externalSourcesPreferredTypes: "", 1360 externalSourcesEmbedCss: "", 1361 store: "auto", 1362 cameraMirror: !1, 1363 cameraCapture: "", 1364 sourceList: "local, url, camera, dropbox, gdrive", 1365 cloudImageEditorTabs: Oi(be), 1366 maxLocalFileSizeBytes: 0, 1367 thumbSize: 76, 1368 showEmptyList: !1, 1369 useLocalImageEditor: !1, 1370 useCloudImageEditor: !0, 1371 removeCopyright: !1, 1372 cropPreset: "", 1373 imageShrink: "", 1374 modalScrollLock: !0, 1375 modalBackdropStrokes: !1, 1376 sourceListWrap: !0, 1377 remoteTabSessionKey: "", 1378 cdnCname: $o, 1379 baseUrl: Fo, 1380 socialBaseUrl: No, 1381 secureSignature: "", 1382 secureExpire: "", 1383 secureDeliveryProxy: "", 1384 retryThrottledRequestMaxTimes: 1, 1385 multipartMinFileSize: 26214400, 1386 multipartChunkSize: 5242880, 1387 maxConcurrentRequests: 10, 1388 multipartMaxConcurrentRequests: 4, 1389 multipartMaxAttempts: 3, 1390 checkForUrlDuplicates: !1, 1391 saveUrlForRecurrentUploads: !1, 1392 groupOutput: !1, 1393 userAgentIntegration: "", 1394 debug: !1, 1395 metadata: null, 1396 localeName: "en", 1397 localeDefinitionOverride: null, 1398 secureUploadsExpireThreshold: 600 * 1e3, 1399 secureUploadsSignatureResolver: null, 1400 secureDeliveryProxyUrlResolver: null, 1401 iconHrefResolver: null, 1402 fileValidators: [], 1403 collectionValidators: [], 1404 defaultCameraMode: "photo", 1405 enableAudioRecording: !0, 1406 enableVideoRecording: !0, 1407 maxVideoRecordingDuration: null, 1408 mediaRecorerOptions: null 1409}, Bo = 20, z = Object.freeze({ 1410 FILE_ADDED: "file-added", 1411 FILE_REMOVED: "file-removed", 1412 FILE_UPLOAD_START: "file-upload-start", 1413 FILE_UPLOAD_PROGRESS: "file-upload-progress", 1414 FILE_UPLOAD_SUCCESS: "file-upload-success", 1415 FILE_UPLOAD_FAILED: "file-upload-failed", 1416 FILE_URL_CHANGED: "file-url-changed", 1417 MODAL_OPEN: "modal-open", 1418 MODAL_CLOSE: "modal-close", 1419 DONE_CLICK: "done-click", 1420 UPLOAD_CLICK: "upload-click", 1421 ACTIVITY_CHANGE: "activity-change", 1422 COMMON_UPLOAD_START: "common-upload-start", 1423 COMMON_UPLOAD_PROGRESS: "common-upload-progress", 1424 COMMON_UPLOAD_SUCCESS: "common-upload-success", 1425 COMMON_UPLOAD_FAILED: "common-upload-failed", 1426 CHANGE: "change", 1427 GROUP_CREATED: "group-created" 1428}); 1429class Vo { 1430 /** 1431 * @private 1432 * @type {Map<string, number>} 1433 */ 1434 _timeoutStore = /* @__PURE__ */ new Map(); 1435 /** 1436 * @private 1437 * @type {Set<import('../../abstract/Block.js').Block>} 1438 */ 1439 _targets = /* @__PURE__ */ new Set(); 1440 /** 1441 * @private 1442 * @type {((...args: unknown[]) => void) | null} 1443 */ 1444 _debugPrint = null; 1445 /** @param {(...args: unknown[]) => void} debugPrint */ 1446 constructor(e) { 1447 this._debugPrint = e; 1448 } 1449 /** @param {import('../../abstract/Block.js').Block} target */ 1450 bindTarget(e) { 1451 this._targets.add(e); 1452 } 1453 /** @param {import('../../abstract/Block.js').Block} target */ 1454 unbindTarget(e) { 1455 this._targets.delete(e); 1456 } 1457 /** 1458 * @private 1459 * @template {(typeof EventType)[keyof typeof EventType]} T 1460 * @param {T} type 1461 * @param {unknown} [payload] 1462 */ 1463 _dispatch(e, t) { 1464 for (const s of this._targets) 1465 s.dispatchEvent( 1466 new CustomEvent(e, { 1467 detail: t 1468 }) 1469 ); 1470 this._debugPrint?.(() => { 1471 const s = t && typeof t == "object" ? { ...t } : t; 1472 return [`event "${e}"`, s]; 1473 }); 1474 } 1475 /** 1476 * @template {(typeof EventType)[keyof typeof EventType]} T 1477 * @template {boolean | number | undefined} TDebounce 1478 * @param {T} type 1479 * @param {TDebounce extends false | undefined ? unknown : () => unknown} [payload] 1480 * @param {{ debounce?: TDebounce }} [options] 1481 */ 1482 emit(e, t, { debounce: s } = {}) { 1483 if (typeof s != "number" && !s) { 1484 this._dispatch(e, typeof t == "function" ? t() : t); 1485 return; 1486 } 1487 this._timeoutStore.has(e) && window.clearTimeout(this._timeoutStore.get(e)); 1488 const r = typeof s == "number" ? s : Bo, n = window.setTimeout(() => { 1489 this._dispatch(e, typeof t == "function" ? t() : t), this._timeoutStore.delete(e); 1490 }, r); 1491 this._timeoutStore.set(e, n); 1492 } 1493} 1494function le(i, e) { 1495 let t; 1496 const s = ( 1497 /** @param {...any} args */ 1498 (...r) => { 1499 clearTimeout(t), t = setTimeout(() => i(...r), e); 1500 } 1501 ); 1502 return s.cancel = () => { 1503 clearTimeout(t); 1504 }, /** @type {T & { cancel: () => void }} } */ 1505 s; 1506} 1507const ms = "--uploadcare-blocks-window-height"; 1508class gs { 1509 /** 1510 * @private 1511 * @type {Set<unknown>} 1512 */ 1513 static clientsRegistry = /* @__PURE__ */ new Set(); 1514 /** @private */ 1515 static flush = le(() => { 1516 document.documentElement.style.setProperty(ms, `${window.innerHeight}px`); 1517 }, 100); 1518 /** 1519 * @param {unknown} client 1520 * @public 1521 */ 1522 static registerClient(e) { 1523 this.clientsRegistry.size === 0 && this.attachTracker(), this.clientsRegistry.add(e); 1524 } 1525 /** 1526 * @param {unknown} client 1527 * @public 1528 */ 1529 static unregisterClient(e) { 1530 this.clientsRegistry.delete(e), this.clientsRegistry.size === 0 && this.detachTracker(); 1531 } 1532 /** @private */ 1533 static attachTracker() { 1534 window.addEventListener("resize", this.flush, { passive: !0, capture: !0 }), this.flush(); 1535 } 1536 /** @private */ 1537 static detachTracker() { 1538 window.removeEventListener("resize", this.flush, { capture: !0 }), document.documentElement.style.removeProperty(ms); 1539 } 1540} 1541const zo = (i) => { 1542 const e = ( 1543 /** @type {any} */ 1544 new Intl.Locale(i) 1545 ); 1546 let t = "ltr"; 1547 return typeof e.getTextInfo == "function" && e.getTextInfo().direction ? t = e.getTextInfo().direction : "textInfo" in e && e.textInfo?.direction && (t = e.textInfo.direction), t; 1548}, ur = (i, e) => new Intl.PluralRules(i).select(e), Ho = (i) => i, bi = "{{", dr = "}}", bs = "plural:"; 1549function vi(i, e, t = {}) { 1550 let { openToken: s = bi, closeToken: r = dr, transform: n = Ho } = t; 1551 for (let o in e) { 1552 let a = e[o]?.toString(); 1553 i = i.replaceAll(s + o + r, typeof a == "string" ? n(a) : a); 1554 } 1555 return i; 1556} 1557function jo(i) { 1558 const e = []; 1559 let t = i.indexOf(bi); 1560 for (; t !== -1; ) { 1561 const s = i.indexOf(dr, t), r = i.substring(t + 2, s); 1562 if (r.startsWith(bs)) { 1563 const n = i.substring(t + 2, s).replace(bs, ""), o = n.substring(0, n.indexOf("(")), a = n.substring(n.indexOf("(") + 1, n.indexOf(")")); 1564 e.push({ variable: r, pluralKey: o, countVariable: a }); 1565 } 1566 t = i.indexOf(bi, s); 1567 } 1568 return e; 1569}
1570const Go = ({ element: i, attribute: e, onSuccess: t, onTimeout: s, timeout: r = 300 }) => { 1571 const n = i.getAttribute(e); 1572 if (n !== null) { 1573 t(n); 1574 return; 1575 } 1576 const o = new MutationObserver((c) => { 1577 const u = c[c.length - 1]; 1578 l(u); 1579 }); 1580 o.observe(i, { 1581 attributes: !0, 1582 attributeFilter: [e] 1583 }); 1584 const a = setTimeout(() => { 1585 o.disconnect(), s(); 1586 }, r), l = (c) => { 1587 const u = i.getAttribute(e); 1588 c.type === "attributes" && c.attributeName === e && u !== null && (clearTimeout(a), o.disconnect(), t(u)); 1589 }; 1590}; 1591function vs(i) { 1592 return Object.prototype.toString.call(i) === "[object Object]"; 1593} 1594const Xo = /\W|_/g; 1595function Yo(i) { 1596 return i.split(Xo).map((e, t) => e.charAt(0)[t > 0 ? "toUpperCase" : "toLowerCase"]() + e.slice(1)).join(""); 1597} 1598function _s(i, { ignoreKeys: e } = { ignoreKeys: [] }) { 1599 return Array.isArray(i) ? i.map((t) => Ie(t, { ignoreKeys: e })) : i; 1600} 1601function Ie(i, { ignoreKeys: e } = { ignoreKeys: [] }) { 1602 if (Array.isArray(i)) 1603 return _s(i, { ignoreKeys: e }); 1604 if (!vs(i)) 1605 return i; 1606 const t = {}; 1607 for (const s of Object.keys(i)) { 1608 let r = i[s]; 1609 if (e.includes(s)) { 1610 t[s] = r; 1611 continue; 1612 } 1613 vs(r) ? r = Ie(r, { ignoreKeys: e }) : Array.isArray(r) && (r = _s(r, { ignoreKeys: e })), t[Yo(s)] = r; 1614 } 1615 return t; 1616} 1617const hr = (i, e) => new Promise((t) => { 1618 if (e?.aborted) { 1619 t(); 1620 return; 1621 } 1622 const s = () => { 1623 clearTimeout(r), e?.removeEventListener("abort", s), t(); 1624 }, r = setTimeout(s, i); 1625 e?.addEventListener("abort", s, { once: !0 }); 1626}); 1627function fr({ libraryName: i, libraryVersion: e, userAgent: t, publicKey: s = "", integration: r = "" }) { 1628 const n = "JavaScript"; 1629 if (typeof t == "string") 1630 return t; 1631 if (typeof t == "function") 1632 return t({ 1633 publicKey: s, 1634 libraryName: i, 1635 libraryVersion: e, 1636 languageName: n, 1637 integration: r 1638 }); 1639 const o = [i, e, s].filter(Boolean).join("/"), a = [n, r].filter(Boolean).join("; "); 1640 return `${o} (${a})`; 1641} 1642const Wo = { 1643 factor: 2, 1644 time: 100 1645}; 1646function Ko(i, e = Wo) { 1647 let t = 0; 1648 function s(r) { 1649 const n = Math.round(e.time * e.factor ** t); 1650 return r({ 1651 attempt: t, 1652 retry: (a) => hr(a ?? n).then(() => (t += 1, s(r))) 1653 }); 1654 } 1655 return s(i); 1656}
1657class Li extends Error { 1658} 1659class vt extends Li { 1660 originalProgressEvent; 1661 constructor(e) { 1662 super(), this.name = "NetworkError", this.message = "Network error", Object.setPrototypeOf(this, vt.prototype), this.originalProgressEvent = e; 1663 } 1664} 1665const Pi = (i, e) => { 1666 i && (i.aborted ? Promise.resolve().then(e) : i.addEventListener("abort", () => e(), { once: !0 })); 1667}; 1668class Ce extends Li { 1669 isCancel = !0; 1670 constructor(e = "Request canceled") { 1671 super(e), this.name = "CancelError", Object.setPrototypeOf(this, Ce.prototype); 1672 } 1673} 1674const qo = 500, pr = async ({ check: i, interval: e = qo, timeout: t, signal: s }) => { 1675 const r = Date.now(), n = () => t === void 0 ? 1 / 0 : t - (Date.now() - r); 1676 for (; ; ) { 1677 if (s?.aborted) 1678 throw new Ce("Poll cancelled"); 1679 if (n() <= 0) 1680 throw new Ce("Timed out"); 1681 let o; 1682 try { 1683 o = await i(s); 1684 } catch (a) { 1685 throw s?.aborted ? new Ce("Poll cancelled") : a; 1686 } 1687 if (s?.aborted) 1688 throw new Ce("Poll cancelled"); 1689 if (o) 1690 return o; 1691 await hr(Math.min(e, n()), s); 1692 } 1693}, U = { 1694 baseCDN: "https://ucarecdn.com", 1695 prefixedBaseCDN: "https://ucarecd.net", 1696 baseURL: "https://upload.uploadcare.com", 1697 retryThrottledRequestMaxTimes: 1, 1698 retryNetworkErrorMaxTimes: 3, 1699 multipartMinFileSize: 25 * 1024 * 1024, 1700 // 25 MB 1701 multipartChunkSize: 5 * 1024 * 1024, 1702 // 5 MB 1703 maxConcurrentRequests: 4, 1704 pusherKey: "79ae88bd931ea68464d9" 1705}, Bt = "application/octet-stream", mr = "original", De = ({ method: i, url: e, data: t, headers: s = {}, signal: r, onProgress: n }) => new Promise((o, a) => { 1706 const l = new XMLHttpRequest(), c = i?.toUpperCase() || "GET"; 1707 let u = !1; 1708 l.open(c, e, !0), s && Object.entries(s).forEach((d) => { 1709 const [h, p] = d; 1710 typeof p < "u" && !Array.isArray(p) && l.setRequestHeader(h, p); 1711 }), l.responseType = "text", Pi(r, () => { 1712 u = !0, l.abort(), a(new Ce()); 1713 }), l.onload = () => { 1714 if (l.status != 200) 1715 a(new Error(`Error ${l.status}: ${l.statusText}`)); 1716 else { 1717 const d = { 1718 method: c, 1719 url: e, 1720 data: t, 1721 headers: s || void 0, 1722 signal: r, 1723 onProgress: n 1724 }, h = l.getAllResponseHeaders().trim().split(/[\r\n]+/), p = {}; 1725 h.forEach(function(A) { 1726 const _ = A.split(": "), v = _.shift(), m = _.join(": "); 1727 v && typeof v < "u" && (p[v] = m); 1728 }); 1729 const g = l.response, y = l.status; 1730 o({ 1731 request: d, 1732 data: g, 1733 headers: p, 1734 status: y 1735 }); 1736 } 1737 }, l.onerror = (d) => { 1738 u || a(new vt(d)); 1739 }, n && typeof n == "function" && (l.upload.onprogress = (d) => { 1740 d.lengthComputable ? n({ 1741 isComputable: !0, 1742 value: d.loaded / d.total 1743 }) : n({ isComputable: !1 }); 1744 }), t ? l.send(t) : l.send(); 1745}); 1746function Zo(i, ...e) { 1747 return i; 1748} 1749const Qo = ({ name: i }) => i ? [i] : [], Jo = Zo; 1750var ea = () => new FormData(); 1751const gr = (i) => !1, Vt = (i) => typeof Blob < "u" && i instanceof Blob, zt = (i) => typeof File < "u" && i instanceof File, Ht = (i) => !!i && typeof i == "object" && !Array.isArray(i) && "uri" in i && typeof i.uri == "string", it = (i) => Vt(i) || zt(i) || gr() || Ht(i), ta = (i) => typeof i == "string" || typeof i == "number" || typeof i > "u", ia = (i) => !!i && typeof i == "object" && !Array.isArray(i), sa = (i) => !!i && typeof i == "object" && "data" in i && it(i.data); 1752function br(i, e, t) { 1753 if (Array.isArray(t)) 1754 for (const s of t) 1755 br(i, `${e}[]`, s); 1756 else if (sa(t)) { 1757 const { name: s, contentType: r } = t, n = Jo(t.data, s, r ?? Bt), o = Qo({ name: s }); 1758 i.push([e, n, ...o]); 1759 } else if (ia(t)) 1760 for (const [s, r] of Object.entries(t)) 1761 typeof r < "u" && i.push([`${e}[${s}]`, String(r)]); 1762 else ta(t) && t && i.push([e, t.toString()]); 1763} 1764function ra(i) { 1765 const e = []; 1766 for (const [t, s] of Object.entries(i)) 1767 br(e, t, s); 1768 return e; 1769} 1770function jt(i) { 1771 const e = ea(), t = ra(i); 1772 for (const s of t) { 1773 const [r, n, ...o] = s; 1774 e.append(r, n, ...o); 1775 } 1776 return e; 1777} 1778class ee extends Li { 1779 code; 1780 request; 1781 response; 1782 headers; 1783 constructor(e, t, s, r, n) { 1784 super(), this.name = "UploadError", this.message = e, this.code = t, this.request = s, this.response = r, this.headers = n, Object.setPrototypeOf(this, ee.prototype); 1785 } 1786} 1787const na = (i) => { 1788 const e = new URLSearchParams(); 1789 for (const [t, s] of Object.entries(i)) 1790 s && typeof s == "object" && !Array.isArray(s) ? Object.entries(s).filter((r) =>
1790 r[1] ?? !1).forEach((r) => e.set(`${t}[${r[0]}]`, String(r[1]))) : Array.isArray(s) ? s.forEach((r) => { 1791 e.append(`${t}[]`, r); 1792 }) : typeof s == "string" && s ? e.set(t, s) : typeof s == "number" && e.set(t, s.toString()); 1793 return e.toString(); 1794}, Ee = (i, e, t) => { 1795 const s = new URL(i); 1796 return s.pathname = (s.pathname + e).replace("//", "/"), t && (s.search = na(t)), s.toString(); 1797}; 1798var oa = "6.21.0"; 1799const aa = "UploadcareUploadClient", la = oa; 1800function He(i) { 1801 return fr({ 1802 libraryName: aa, 1803 libraryVersion: la, 1804 ...i 1805 }); 1806} 1807const ca = "RequestThrottledError", ys = 15e3, ua = 1e3; 1808function da(i) { 1809 const { headers: e } = i || {}; 1810 if (!e || typeof e["retry-after"] != "string") 1811 return ys; 1812 const t = parseInt(e["retry-after"], 10); 1813 return Number.isFinite(t) ? t * 1e3 : ys; 1814} 1815function Re(i, e) { 1816 const { retryThrottledRequestMaxTimes: t, retryNetworkErrorMaxTimes: s } = e; 1817 return Ko(({ attempt: r, retry: n }) => i().catch((o) => { 1818 if ("response" in o && o?.code === ca && r < t) 1819 return n(da(o)); 1820 if (o instanceof vt && r < s) 1821 return n((r + 1) * ua); 1822 throw o; 1823 })); 1824} 1825const vr = (i) => { 1826 let e = ""; 1827 return (Vt(i) || zt(i) || Ht(i)) && (e = i.type), e || Bt; 1828}, _r = (i) => { 1829 let e = ""; 1830 return zt(i) && i.name ? e = i.name : Vt(i) || gr() ? e = "" : Ht(i) && i.name && (e = i.name), e || mr; 1831}; 1832function Ui(i) { 1833 return typeof i > "u" || i === "auto" ? "auto" : i ? "1" : "0"; 1834} 1835function Mi(i) { 1836 return Array.isArray(i) ? i.join(",") : typeof i == "string" ? i : void 0; 1837} 1838function ha(i, { publicKey: e, fileName: t, contentType: s, baseURL: r = U.baseURL, secureSignature: n, secureExpire: o, store: a, signal: l, onProgress: c, source: u = "local", integration: d, userAgent: h, retryThrottledRequestMaxTimes: p = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: g = U.retryNetworkErrorMaxTimes, metadata: y, tags: A }) { 1839 return Re(() => De({ 1840 method: "POST", 1841 url: Ee(r, "/base/", { 1842 jsonerrors: 1 1843 }), 1844 headers: { 1845 "X-UC-User-Agent": He({ publicKey: e, integration: d, userAgent: h }) 1846 }, 1847 data: jt({ 1848 file: { 1849 data: i, 1850 name: t || _r(i), 1851 contentType: s || vr(i) 1852 }, 1853 UPLOADCARE_PUB_KEY: e, 1854 UPLOADCARE_STORE: Ui(a), 1855 signature: n, 1856 expire: o, 1857 source: u, 1858 metadata: y, 1859 tags: Mi(A) 1860 }), 1861 signal: l, 1862 onProgress: c 1863 }).then(({ data: _, headers: v, request: m }) => { 1864 const f = Ie(JSON.parse(_)); 1865 if ("error" in f) 1866 throw new ee(f.error.content, f.error.errorCode, m, f, v); 1867 return f; 1868 }), { retryNetworkErrorMaxTimes: g, retryThrottledRequestMaxTimes: p }); 1869} 1870var _i; 1871(function(i) { 1872 i.Token = "token", i.FileInfo = "file_info"; 1873})(_i || (_i = {})); 1874function fa(i, { publicKey: e, baseURL: t = U.baseURL, store: s, fileName: r, checkForUrlDuplicates: n, saveUrlForRecurrentUploads: o, secureSignature: a, secureExpire: l, source: c = "url", signal: u, integration: d, userAgent: h, retryThrottledRequestMaxTimes: p = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: g = U.retryNetworkErrorMaxTimes, metadata: y, tags: A }) { 1875 return Re(() => De({ 1876 method: "POST", 1877 headers: { 1878 "X-UC-User-Agent": He({ publicKey: e, integration: d, userAgent: h }) 1879 }, 1880 url: Ee(t, "/from_url/", { 1881 jsonerrors: 1, 1882 pub_key: e, 1883 source_url: i, 1884 store: Ui(s), 1885 filename: r, 1886 check_URL_duplicates: n ? 1 : void 0, 1887 save_URL_duplicates: o ? 1 : void 0, 1888 signature: a, 1889 expire: l, 1890 source: c, 1891 metadata: y, 1892 tags: Mi(A) 1893 }), 1894 signal: u 1895 }).then(({ data: _, headers: v, request: m }) => { 1896 const f = Ie(JSON.parse(_)); 1897 if ("error" in f) 1898 throw new ee(f.error.content, f.error.errorCode, m, f, v); 1899 return f; 1900 }), { retryNetworkErrorMaxTimes: g, retryThrottledRequestMaxTimes: p }); 1901} 1902var J; 1903(function(i) { 1904 i.Unknown = "unknown", i.Waiting = "waiting", i.Progress = "progress", i.Error = "error", i.Success = "success"; 1905})(J || (J = {})); 1906const pa = (i) => "status" in i && i.status === J.Error; 1907function ma(i, { publicKey: e, baseURL: t = U.baseURL, signal: s, integration: r, userAgent: n, retryThrottledRequestMaxTimes: o = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: a = U.retryNetworkErrorMaxTimes } = {}) { 1908 return Re(() => De({ 1909 method: "GET", 1910 headers: e ? { 1911 "X-UC-User-Agent": He({ 1912 publicKey: e, 1913 integration: r, 1914 userAgent: n 1915 }) 1916 } : void 0, 1917 url: Ee(t, "/from_url/status/", { 1918 jsonerrors: 1, 1919 token: i 1920 }), 1921 signal: s 1922 }).then(({ data: l, headers: c, request: u }) => { 1923 const d = Ie(JSON.parse(l)); 1924 if ("error" in d && !pa(d)) 1925 throw new ee(d.error.content, d.error.errorCode, u, d, c); 1926 return d; 1927 }), { retryNetworkErrorMaxTimes: a, retryThrottledRequestMaxTimes: o }); 1928} 1929function ga(i, { publicKey: e, baseURL: t = U.baseURL, jsonpCallback: s, secureSignature: r, secureExpire: n, signal: o, source: a, integration: l, userAgent: c, retryThrottledRequestMaxTimes: u = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: d = U.retryNetworkErrorMaxTimes }) { 1930 return Re(() => De({ 1931 method: "POST", 1932 headers: { 1933 "X-UC-User-Agent": He({ publicKey: e, integration: l, userAgent: c }) 1934 }, 1935 url: Ee(t, "/group/", { 1936 jsonerrors: 1 1937 }), 1938 data: jt({ 1939 files: i, 1940 callback: s, 1941 pub_key: e, 1942 signature: r, 1943 expire: n, 1944 source: a 1945 }), 1946 signal: o 1947 }).then(({ data: h, headers: p, request: g }) => { 1948 const y = Ie(JSON.parse(h)); 1949 if ("error" in y) 1950 throw new ee(y.error.content, y.error.errorCode, g, y, p); 1951 return y; 1952 }), { retryNetworkErrorMaxTimes: d, retryThrottledRequestMaxTimes: u }); 1953} 1954function ba(i, { publicKey: e, baseURL: t = U.baseURL, signal: s, source: r, integration: n, userAgent: o, retryThrottledRequestMaxTimes: a = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: l = U.retryNetworkErrorMaxTimes }) { 1955 return Re(() => De({ 1956 method: "GET", 1957 headers: { 1958 "X-UC-User-Agent": He({ publicKey: e, integration: n, userAgent: o }) 1959 }, 1960 url: Ee(t, "/info/", { 1961 jsonerrors: 1, 1962 pub_key: e, 1963 file_id: i, 1964 source: r 1965 }), 1966 signal: s 1967 }).then(({ data: c, headers: u, request: d }) => { 1968 const h = Ie(JSON.parse(c)); 1969 if ("error" in h) 1970 throw new ee(h.error.content, h.error.errorCode, d, h, u); 1971 return h; 1972 }), { retryThrottledRequestMaxTimes: a, retryNetworkErrorMaxTimes: l }); 1973} 1974function va(i, { publicKey: e, contentType: t, fileName: s, multipartChunkSize: r = U.multipartChunkSize, baseURL: n = "", secureSignature: o, secureExpire: a, store: l, signal: c, source: u = "local", integration: d, userAgent: h, retryThrottledRequestMaxTimes: p = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: g = U.retryNetworkErrorMaxTimes, metadata: y, tags: A }) { 1975 return Re(() => De({ 1976 method: "POST", 1977 url: Ee(n, "/multipart/start/", { jsonerrors: 1 }), 1978 headers: { 1979 "X-UC-User-Agent": He({ publicKey: e, integration: d, userAgent: h }) 1980 }, 1981 data: jt({ 1982 filename: s || mr, 1983 size: i, 1984 content_type: t || Bt, 1985 part_size: r, 1986 UPLOADCARE_STORE: Ui(l), 1987 UPLOADCARE_PUB_KEY: e, 1988 signature: o, 1989 expire: a, 1990 source: u, 1991 metadata: y, 1992 tags: Mi(A) 1993 }), 1994 signal: c 1995 }).then(({ data: _, headers: v, request: m }) => { 1996 const f = Ie(JSON.parse(_)); 1997 if ("error" in f) 1998 throw new ee(f.error.content, f.error.errorCode, m, f, v); 1999 return f.parts = Object.keys(f.parts).map((C) => f.parts[Number(C)]), f; 2000 }), { retryThrottledRequestMaxTimes: p, retryNetworkErrorMaxTimes: g }); 2001} 2002function _a(i, e, { contentType: t, signal: s, onProgress: r, retryThrottledRequestMaxTimes: n = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: o = U.retryNetworkErrorMaxTimes }) { 2003 return Re(() => De({ 2004 method: "PUT", 2005 url: e, 2006 data: i, 2007 // Upload request can't be non-computable because we always know exact size 2008 onProgress: r, 2009 signal: s, 2010 headers: { 2011 "Content-Type": t || Bt 2012 } 2013 }).then((a) => (r && r({ 2014 isComputable: !0, 2015 value: 1 2016 }), a)).then(({ status: a }) => ({ code: a })), { 2017 retryThrottledRequestMaxTimes: n, 2018 retryNetworkErrorMaxTimes: o 2019 }); 2020} 2021function ya(i, { publicKey: e, baseURL: t = U.baseURL, source: s = "local", signal: r, integration: n, userAgent: o, retryThrottledRequestMaxTimes: a = U.retryThrottledRequestMaxTimes, retryNetworkErrorMaxTimes: l = U.retryNetworkErrorMaxTimes }) { 2022 return Re(() => De({ 2023 method: "POST", 2024 url: Ee(t, "/multipart/complete/", { jsonerrors: 1 }), 2025 headers: { 2026 "X-UC-User-Agent": He({ publicKey: e, integration: n, userAgent: o }) 2027 }, 2028 data: jt({ 2029 uuid: i, 2030 UPLOADCARE_PUB_KEY: e, 2031 source: s 2032 }), 2033 signal: r 2034 }).then(({ data: c, headers: u, request: d }) => { 2035 const h = Ie(JSON.parse(c)); 2036 if ("error" in h) 2037 throw new ee(h.error.content, h.error.errorCode, d, h, u); 2038 return h; 2039 }), { retryThrottledRequestMaxTimes: a, retryNetworkErrorMaxTimes: l }); 2040} 2041function Gt(i, { publicKey: e, baseURL: t, source: s, integration: r, userAgent: n, retryThrottledRequestMaxTimes: o, retryNetworkErrorMaxTimes: a, signal: l, onProgress: c }) { 2042 return pr({ 2043 check: (u) => ba(i, { 2044 publicKey: e, 2045 baseURL: t, 2046 signal: u, 2047 source: s, 2048 integration: r, 2049 userAgent: n, 2050 retryThrottledRequestMaxTimes: o, 2051 retryNetworkErrorMaxTimes: a 2052 }).then((d) => d.isReady ? (c && c({ isComputable: !0, value: 1 }), d) : !1), 2053 signal: l 2054 }); 2055} 2056const Aa = (i, e) => { 2057 const t = new URL(e); 2058 return t.hostname = `${i}.${t.hostname}`, t.toString().replace(/\/$/, ""); 2059}, wa = (i) => i.toString(36).slice(0, 10), Ca = (i, e) => { 2060 try { 2061 const t = new URL(i).hostname, s = new URL(e).hostname; 2062 return t === s || t.endsWith(`.${s}`); 2063 } catch { 2064 return !1; 2065 } 2066}, Ea = (i) => { 2067 const e = new DataView(i); 2068 let t = 0n; 2069 for (let s = 0; s < i.byteLength; s += 8) 2070 t = t << 64n | e.getBigUint64(s); 2071 return t; 2072}, Ta = async (i) => Ea( 2073 await globalThis.crypto.subtle.digest(
2074 "SHA-256", 2075 new TextEncoder().encode(i) 2076 ) 2077), Ia = async (i) => wa(await Ta(i)), Sa = async (i, e) => { 2078 const t = await Ia(i); 2079 return Aa(t, e); 2080}, ka = (i, e) => Sa(i, e), yr = ({ publicKey: i, baseCDN: e, prefixedBaseCDN: t = U.prefixedBaseCDN }) => i ? e === void 0 || Ca(e, t) ? ka(i, t) : Promise.resolve(e) : Promise.resolve(e ?? U.baseCDN); 2081function xa(i) { 2082 return "defaultEffects" in i; 2083} 2084class Di { 2085 uuid; 2086 name; 2087 size; 2088 isStored; 2089 isImage; 2090 mimeType; 2091 cdnUrl; 2092 s3Url; 2093 originalFilename; 2094 imageInfo; 2095 videoInfo; 2096 contentInfo; 2097 metadata; 2098 tags; 2099 s3Bucket; 2100 defaultEffects = null; 2101 constructor(e, { baseCDN: t = U.baseCDN, fileName: s } = {}) { 2102 const { uuid: r, s3Bucket: n } = e, o = Ee(t, `${r}/`), a = n ? Ee(`https://${n}.s3.amazonaws.com/`, `${r}/${e.filename}`) : null; 2103 this.uuid = r, this.name = s || e.filename, this.size = e.size, this.isStored = e.isStored, this.isImage = e.isImage, this.mimeType = e.mimeType, this.cdnUrl = o, this.originalFilename = e.originalFilename, this.imageInfo = e.imageInfo, this.videoInfo = e.videoInfo, this.contentInfo = e.contentInfo, this.metadata = e.metadata || null, this.tags = e.tags || null, this.s3Bucket = n || null, this.s3Url = a, xa(e) && (this.defaultEffects = e.defaultEffects); 2104 } 2105} 2106const Xt = async (i, { publicKey: e, baseCDN: t, prefixedBaseCDN: s, fileName: r }) => { 2107 const n = await yr({ 2108 publicKey: e, 2109 baseCDN: t, 2110 prefixedBaseCDN: s 2111 }); 2112 return new Di(i, { baseCDN: n, fileName: r }); 2113}, Oa = (i, { publicKey: e, fileName: t, baseURL: s, secureSignature: r, secureExpire: n, store: o, contentType: a, signal: l, onProgress: c, source: u, integration: d, userAgent: h, retryThrottledRequestMaxTimes: p, retryNetworkErrorMaxTimes: g, baseCDN: y, prefixedBaseCDN: A, metadata: _, tags: v }) => ha(i, { 2114 publicKey: e, 2115 fileName: t, 2116 contentType: a, 2117 baseURL: s, 2118 secureSignature: r, 2119 secureExpire: n, 2120 store: o, 2121 signal: l, 2122 onProgress: c, 2123 source: u, 2124 integration: d, 2125 userAgent: h, 2126 retryThrottledRequestMaxTimes: p, 2127 retryNetworkErrorMaxTimes: g, 2128 metadata: _, 2129 tags: v 2130}).then(({ file: m }) => Gt(m, { 2131 publicKey: e, 2132 baseURL: s, 2133 source: u, 2134 integration: d, 2135 userAgent: h, 2136 retryThrottledRequestMaxTimes: p, 2137 retryNetworkErrorMaxTimes: g, 2138 onProgress: c, 2139 signal: l 2140})).then((m) => Xt(m, { publicKey: e, baseCDN: y, prefixedBaseCDN: A })), La = (i, { publicKey: e, fileName: t, baseURL: s, signal: r, onProgress: n, source: o, integration: a, userAgent: l, retryThrottledRequestMaxTimes: c, retryNetworkErrorMaxTimes: u, baseCDN: d, prefixedBaseCDN: h }) => Gt(i, { 2141 publicKey: e, 2142 baseURL: s, 2143 signal: r, 2144 onProgress: n, 2145 source: o, 2146 integration: a, 2147 userAgent: l, 2148 retryThrottledRequestMaxTimes: c, 2149 retryNetworkErrorMaxTimes: u 2150}).then((p) => Xt(p, { 2151 publicKey: e, 2152 baseCDN: d, 2153 prefixedBaseCDN: h, 2154 fileName: t 2155})), Pa = (i, { signal: e } = {}) => { 2156 let t = null, s = null; 2157 const r = i.map(() => new AbortController()), n = (o) => () => { 2158 s = o, r.forEach((a, l) => l !== o && a.abort()); 2159 }; 2160 return Pi(e, () => { 2161 r.forEach((o) => o.abort()); 2162 }), Promise.all(i.map((o, a) => { 2163 const l = n(a); 2164 return Promise.resolve().then(() => o({ stopRace: l, signal: r[a].signal })).then((c) => (l(), c)).catch((c) => (t = c, null)); 2165 })).then((o) => { 2166 if (s === null) 2167 throw t; 2168 return o[s]; 2169 }); 2170}; 2171var Ua = window.WebSocket; 2172class Ma { 2173 events = /* @__PURE__ */ Object.create({}); 2174 emit(e, t) { 2175 this.events[e]?.forEach((s) => s(t)); 2176 } 2177 on(e, t) { 2178 this.events[e] = this.events[e] || [], this.events[e].push(t); 2179 } 2180 off(e, t) { 2181 t ? this.events[e] = this.events[e].filter((s) => s !== t) : this.events[e] = []; 2182 } 2183} 2184const Da = (i, e) => i === "success" ? { status: J.Success, ...e } : i === "progress" ? { status: J.Progress, ...e } : { status: J.Error, ...e }; 2185class Ra { 2186 key; 2187 disconnectTime; 2188 ws = void 0; 2189 queue = []; 2190 isConnected = !1; 2191 subscribers = 0; 2192 emmitter = new Ma(); 2193 disconnectTimeoutId = null; 2194 constructor(e, t = 3e4) { 2195 this.key = e, this.disconnectTime = t; 2196 } 2197 connect() { 2198 if (this.disconnectTimeoutId && clearTimeout(this.disconnectTimeoutId), !this.isConnected && !this.ws) { 2199 const e = `wss://ws.pusherapp.com/app/${this.key}
2199?protocol=5&client=js&version=1.12.2`; 2200 this.ws = new Ua(e), this.ws.addEventListener("error", (t) => { 2201 this.emmitter.emit("error", new Error(t.message)); 2202 }), this.emmitter.on("connected", () => { 2203 this.isConnected = !0, this.queue.forEach((t) => this.send(t.event, t.data)), this.queue = []; 2204 }), this.ws.addEventListener("message", (t) => { 2205 const s = JSON.parse(t.data.toString()); 2206 switch (s.event) { 2207 case "pusher:connection_established": { 2208 this.emmitter.emit("connected", void 0); 2209 break; 2210 } 2211 case "pusher:ping": { 2212 this.send("pusher:pong", {}); 2213 break; 2214 } 2215 case "progress": 2216 case "success": 2217 case "fail": 2218 this.emmitter.emit(s.channel, Da(s.event, JSON.parse(s.data))); 2219 } 2220 }); 2221 } 2222 } 2223 disconnect() { 2224 const e = () => { 2225 this.ws?.close(), this.ws = void 0, this.isConnected = !1; 2226 }; 2227 this.disconnectTime ? this.disconnectTimeoutId = setTimeout(() => { 2228 e(); 2229 }, this.disconnectTime) : e(); 2230 } 2231 send(e, t) { 2232 const s = JSON.stringify({ event: e, data: t }); 2233 this.ws?.send(s); 2234 } 2235 subscribe(e, t) { 2236 this.subscribers += 1, this.connect(); 2237 const s = `task-status-${e}`, r = { 2238 event: "pusher:subscribe", 2239 data: { channel: s } 2240 }; 2241 this.emmitter.on(s, t), this.isConnected ? this.send(r.event, r.data) : this.queue.push(r); 2242 } 2243 unsubscribe(e) { 2244 this.subscribers -= 1; 2245 const t = `task-status-${e}`, s = { 2246 event: "pusher:unsubscribe", 2247 data: { channel: t } 2248 }; 2249 this.emmitter.off(t), this.isConnected ? this.send(s.event, s.data) : this.queue = this.queue.filter((r) => r.data.channel !== t), this.subscribers === 0 && this.disconnect(); 2250 } 2251 onError(e) { 2252 return this.emmitter.on("error", e), () => this.emmitter.off("error", e); 2253 } 2254} 2255let ni = null; 2256const Ri = (i) => { 2257 if (!ni) { 2258 const e = typeof window > "u" ? 0 : 3e4; 2259 ni = new Ra(i, e); 2260 } 2261 return ni; 2262}, $a = (i) => { 2263 Ri(i).connect(); 2264}; 2265function Fa({ token: i, publicKey: e, baseURL: t, integration: s, userAgent: r, retryThrottledRequestMaxTimes: n, retryNetworkErrorMaxTimes: o, onProgress: a, signal: l }) { 2266 return pr({ 2267 check: (c) => ma(i, { 2268 publicKey: e, 2269 baseURL: t, 2270 integration: s, 2271 userAgent: r, 2272 retryThrottledRequestMaxTimes: n, 2273 retryNetworkErrorMaxTimes: o, 2274 signal: c 2275 }).then((u) => { 2276 switch (u.status) { 2277 case J.Error: 2278 return new ee(u.error, u.errorCode); 2279 case J.Waiting: 2280 return !1; 2281 case J.Unknown: 2282 return new ee(`Token "${i}" was not found.`); 2283 case J.Progress: 2284 return a && (u.total === "unknown" ? a({ isComputable: !1 }) : a({ 2285 isComputable: !0, 2286 value: u.done / u.total 2287 })), !1; 2288 case J.Success: 2289 return a && a({ 2290 isComputable: !0, 2291 value: u.done / u.total 2292 }), u; 2293 default: 2294 throw new Error("Unknown status"); 2295 } 2296 }), 2297 signal: l 2298 }); 2299} 2300const Na = ({ token: i, pusherKey: e, signal: t, onProgress: s }) => new Promise((r, n) => { 2301 const o = Ri(e), a = o.onError(n), l = () => { 2302 a(), o.unsubscribe(i); 2303 }; 2304 Pi(t, () => { 2305 l(), n(new Ce("pusher cancelled")); 2306 }), o.subscribe(i, (c) => { 2307 switch (c.status) { 2308 case J.Progress: { 2309 s && (c.total === "unknown" ? s({ isComputable: !1 }) : s({ 2310 isComputable: !0, 2311 value: c.done / c.total 2312 })); 2313 break; 2314 } 2315 case J.Success: { 2316 l(), s && s({ 2317 isComputable: !0, 2318 value: c.done / c.total 2319 }), r(c); 2320 break; 2321 } 2322 case J.Error: 2323 l(), n(new ee(c.msg, c.error_code)); 2324 } 2325 }); 2326}), Ba = (i, { publicKey: e, fileName: t, baseURL: s, baseCDN: r, prefixedBaseCDN: n, checkForUrlDuplicates: o, saveUrlForRecurrentUploads: a, secureSignature: l, secureExpire: c, store: u, signal: d, onProgress: h, source: p, integration: g, userAgent: y, retryThrottledRequestMaxTimes: A, pusherKey: _ = U.pusherKey, metadata: v, tags: m }) => Promise.resolve($a(_)).then(() => fa(i, { 2327 publicKey: e, 2328 fileName: t, 2329 baseURL: s, 2330 checkForUrlDuplicates: o, 2331 saveUrlForRecurrentUploads: a, 2332 secureSignature: l, 2333 secureExpire: c, 2334 store: u, 2335 signal: d, 2336 source: p, 2337 integration: g, 2338 userAgent: y, 2339 retryThrottledRequestMaxTimes: A, 2340 metadata: v, 2341 tags: m 2342})).catch((f) => (Ri(_)?.disconnect(), Promise.reject(f))).then((f) => f.type === _i.FileInfo ? f : Pa([ 2343 ({ signal: C }) => Fa({ 2344 token: f.token, 2345 publicKey: e, 2346 baseURL: s, 2347 integration: g, 2348 userAgent: y, 2349 retryThrottledRequestMaxTimes: A, 2350 onProgress: h, 2351 signal: C 2352 }), 2353 ({ signal: C }) => Na({ 2354 token: f.token, 2355 pusherKey: _, 2356 signal: C, 2357 onProgress: h 2358 }) 2359], { signal: d })).then((f) => { 2360 if (f instanceof ee) 2361 throw f; 2362 return f; 2363}).then((f) => f.isReady ? f : Gt(f.uuid, { 2364 publicKey: e, 2365 baseURL: s, 2366 integration: g, 2367 userAgent: y, 2368 retryThrottledRequestMaxTimes: A, 2369 onProgress: h, 2370 signal: d 2371})).then((f) => Xt(f, { publicKey: e, baseCDN: r, prefixedBaseCDN: n })), oi = /* @__PURE__ */ new WeakMap(), Va = async (i) => { 2372 if (oi.has(i)) 2373 return oi.get(i); 2374 const e = await fetch(i.uri).then((t) => t.blob()); 2375 return oi.set(i, e), e; 2376}, Ar = async (i) => { 2377 if (zt(i) || Vt(i)) 2378 return i.size; 2379 if (Ht(i)) 2380 return (await Va(i)).size; 2381 throw new Error("Unknown file type. Cannot determine file size."); 2382}, za = (i, e = U.multipartMinFileSize) => i >= e, wr = (i) => { 2383 const e = "[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}", t = new RegExp(e); 2384 return !it(i) && t.test(i); 2385}, $i = (i) => { 2386 const e = "^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}
2386|localhost[\\:?\\d]*)\\S*$", t = new RegExp(e); 2387 return !it(i) && t.test(i); 2388}, Ha = (i, e) => new Promise((t, s) => { 2389 const r = []; 2390 let n = !1, o = e.length; 2391 const a = [...e], l = () => { 2392 const c = e.length - a.length, u = a.shift(); 2393 u && u().then((d) => { 2394 n || (r[c] = d, o -= 1, o ? l() : t(r)); 2395 }).catch((d) => { 2396 n = !0, s(d); 2397 }); 2398 }; 2399 for (let c = 0; c < i; c++) 2400 l(); 2401}), ja = (i, e, t, s) => { 2402 const r = s * e, n = Math.min(r + s, t); 2403 return i.slice(r, n); 2404}, Ga = async (i, e, t) => (s) => ja(i, s, e, t), Xa = (i, e, { publicKey: t, contentType: s, onProgress: r, signal: n, integration: o, retryThrottledRequestMaxTimes: a, retryNetworkErrorMaxTimes: l }) => _a(i, e, { 2405 contentType: s, 2406 onProgress: r, 2407 signal: n, 2408 retryThrottledRequestMaxTimes: a, 2409 retryNetworkErrorMaxTimes: l 2410}), Ya = async (i, { publicKey: e, fileName: t, fileSize: s, baseURL: r, secureSignature: n, secureExpire: o, store: a, signal: l, onProgress: c, source: u, integration: d, userAgent: h, retryThrottledRequestMaxTimes: p, retryNetworkErrorMaxTimes: g, contentType: y, multipartChunkSize: A = U.multipartChunkSize, maxConcurrentRequests: _ = U.maxConcurrentRequests, baseCDN: v, prefixedBaseCDN: m, metadata: f, tags: C }) => { 2411 const ce = s ?? await Ar(i); 2412 let ie; 2413 const _e = (I, M) => { 2414 if (!c) 2415 return; 2416 ie || (ie = Array(I).fill(0)); 2417 const K = (q) => q.reduce((je, ei) => je + ei, 0); 2418 return (q) => { 2419 q.isComputable && (ie[M] = q.value, c({ 2420 isComputable: !0, 2421 value: K(ie) / I 2422 })); 2423 }; 2424 }; 2425 return y ||= vr(i), va(ce, { 2426 publicKey: e, 2427 contentType: y, 2428 fileName: t || _r(i), 2429 baseURL: r, 2430 secureSignature: n, 2431 secureExpire: o, 2432 store: a, 2433 signal: l, 2434 source: u, 2435 integration: d, 2436 userAgent: h, 2437 retryThrottledRequestMaxTimes: p, 2438 retryNetworkErrorMaxTimes: g, 2439 metadata: f, 2440 tags: C, 2441 multipartChunkSize: A 2442 }).then(async ({ uuid: I, parts: M }) => { 2443 const K = await Ga(i, ce, A); 2444 return Promise.all([ 2445 I, 2446 Ha(_, M.map((q, je) => () => Xa(K(je), q, { 2447 publicKey: e, 2448 contentType: y, 2449 onProgress: _e(M.length, je), 2450 signal: l, 2451 integration: d, 2452 retryThrottledRequestMaxTimes: p, 2453 retryNetworkErrorMaxTimes: g 2454 }))) 2455 ]); 2456 }).then(([I]) => ya(I, { 2457 publicKey: e, 2458 baseURL: r, 2459 source: u, 2460 integration: d, 2461 userAgent: h, 2462 retryThrottledRequestMaxTimes: p, 2463 retryNetworkErrorMaxTimes: g 2464 })).then((I) => I.isReady ? I : Gt(I.uuid, { 2465 publicKey: e, 2466 baseURL: r, 2467 source: u, 2468 integration: d, 2469 userAgent: h, 2470 retryThrottledRequestMaxTimes: p, 2471 retryNetworkErrorMaxTimes: g, 2472 onProgress: c, 2473 signal: l 2474 })).then((I) => Xt(I, { publicKey: e, baseCDN: v, prefixedBaseCDN: m })); 2475}; 2476async function Cr(i, { 2477 publicKey: e, 2478 fileName: t, 2479 baseURL: s = U.baseURL, 2480 secureSignature: r, 2481 secureExpire: n, 2482 store: o, 2483 signal: a, 2484 onProgress: l, 2485 source: c, 2486 integration: u, 2487 userAgent: d, 2488 retryThrottledRequestMaxTimes: h, 2489 retryNetworkErrorMaxTimes: p, 2490 contentType: g, 2491 multipartMinFileSize: y, 2492 multipartChunkSize: A, 2493 maxConcurrentRequests: _, 2494 // Left undefined on purpose when the caller omits it, so `resolveCdnBase` 2495 // can distinguish "not set" (→ prefixed default) from an explicit base 2496 // (→ used verbatim, e.g. the legacy `https://ucarecdn.com`). 2497 baseCDN: v, 2498 prefixedBaseCDN: m = U.prefixedBaseCDN, 2499 checkForUrlDuplicates: f, 2500 saveUrlForRecurrentUploads: C, 2501 pusherKey: ce, 2502 metadata: ie, 2503 tags: _e 2504}) { 2505 if (it(i)) { 2506 const I = await Ar(i); 2507 return za(I, y) ? Ya(i, { 2508 publicKey: e, 2509 contentType: g, 2510 multipartChunkSize: A, 2511 fileSize: I, 2512 fileName: t, 2513 baseURL: s, 2514 secureSignature: r, 2515 secureExpire: n, 2516 store: o, 2517 signal: a, 2518 onProgress: l, 2519 source: c, 2520 integration: u, 2521 userAgent: d, 2522 maxConcurrentRequests: _, 2523 retryThrottledRequestMaxTimes: h, 2524 retryNetworkErrorMaxTimes: p, 2525 baseCDN: v, 2526 prefixedBaseCDN: m, 2527 metadata: ie, 2528 tags: _e 2529 }) : Oa(i, { 2530 publicKey: e, 2531 fileName: t, 2532 contentType: g, 2533 baseURL: s, 2534 secureSignature: r, 2535 secureExpire: n, 2536 store: o, 2537 signal: a, 2538 onProgress: l, 2539 source: c, 2540 integration: u, 2541 userAgent: d, 2542 retryThrottledRequestMaxTimes: h, 2543 retryNetworkErrorMaxTimes: p, 2544 baseCDN: v, 2545 prefixedBaseCDN: m, 2546 metadata: ie, 2547 tags: _e 2548 }); 2549 } 2550 if ($i(i)) 2551 return Ba(i, { 2552 publicKey: e, 2553 fileName: t, 2554 baseURL: s, 2555 baseCDN: v, 2556 prefixedBaseCDN: m, 2557 checkForUrlDuplicates: f, 2558 saveUrlForRecurrentUploads: C, 2559 secureSignature: r, 2560 secureExpire: n, 2561 store: o, 2562 signal: a, 2563 onProgress: l, 2564 source: c, 2565 integration: u, 2566 userAgent: d, 2567 retryThrottledRequestMaxTimes: h, 2568 pusherKey: ce, 2569 metadata: ie, 2570 tags: _e 2571 }); 2572 if (wr(i)) 2573 return La(i, { 2574 publicKey: e, 2575 fileName: t, 2576 baseURL: s, 2577 signal: a, 2578 onProgress: l, 2579 source: c, 2580 integration: u, 2581 userAgent: d, 2582 retryThrottledRequestMaxTimes: h, 2583 retryNetworkErrorMaxTimes: p, 2584 baseCDN: v, 2585 prefixedBaseCDN: m 2586 }); 2587 throw new TypeError(`File uploading from "${i}" is not supported`); 2588} 2589const Wa = (i, e) => { 2590 try { 2591 const t = new URL(i), s = new URL(e); 2592 return t.protocol = s.protocol, t.hostname = s.hostname, t.port = s.port, t.toString(); 2593 } catch { 2594 return i; 2595 } 2596}; 2597class Ka { 2598 uuid; 2599 filesCount; 2600 totalSize; 2601 isStored; 2602 isImage; 2603 cdnUrl; 2604 files; 2605 createdAt; 2606 storedAt = null; 2607 constructor(e, { baseCDN: t = U.baseCDN } = {}) { 2608 this.uuid = e.id, this.filesCount = e.filesCount;
2609 const s = e.files.filter(Boolean); 2610 this.totalSize = Object.values(s).reduce((r, n) => r + n.size, 0), this.isStored = !!e.datetimeStored, this.isImage = !!Object.values(s).filter((r) => r.isImage).length, this.cdnUrl = Wa(e.cdnUrl, t), this.files = s.map((r) => new Di(r, { baseCDN: t })), this.createdAt = e.datetimeCreated, this.storedAt = e.datetimeStored; 2611 } 2612} 2613const qa = async (i, { publicKey: e, baseCDN: t, prefixedBaseCDN: s }) => { 2614 const r = await yr({ 2615 publicKey: e, 2616 baseCDN: t, 2617 prefixedBaseCDN: s 2618 }); 2619 return new Ka(i, { baseCDN: r }); 2620}, Za = (i) => { 2621 for (const e of i) 2622 if (!it(e)) 2623 return !1; 2624 return !0; 2625}, Qa = (i) => { 2626 for (const e of i) 2627 if (!wr(e)) 2628 return !1; 2629 return !0; 2630}, Ja = (i) => { 2631 for (const e of i) 2632 if (!$i(e)) 2633 return !1; 2634 return !0; 2635}; 2636function el(i, { 2637 publicKey: e, 2638 fileName: t, 2639 baseURL: s = U.baseURL, 2640 secureSignature: r, 2641 secureExpire: n, 2642 store: o, 2643 signal: a, 2644 onProgress: l, 2645 source: c, 2646 integration: u, 2647 userAgent: d, 2648 retryThrottledRequestMaxTimes: h, 2649 retryNetworkErrorMaxTimes: p, 2650 contentType: g, 2651 multipartChunkSize: y = U.multipartChunkSize, 2652 // Left undefined on purpose when the caller omits it, so `resolveCdnBase` 2653 // can distinguish "not set" (→ prefixed default) from an explicit base 2654 // (→ used verbatim, e.g. the legacy `https://ucarecdn.com`). 2655 baseCDN: A, 2656 prefixedBaseCDN: _ = U.prefixedBaseCDN, 2657 checkForUrlDuplicates: v, 2658 saveUrlForRecurrentUploads: m, 2659 jsonpCallback: f 2660}) { 2661 if (!Za(i) && !Ja(i) && !Qa(i)) 2662 throw new TypeError(`Group uploading from "${i}" is not supported`); 2663 let C, ce = !0; 2664 const ie = i.length, _e = (I, M) => { 2665 if (!l) 2666 return; 2667 C || (C = Array(I).fill(0)); 2668 const K = (q) => q.reduce((je, ei) => je + ei) / I; 2669 return (q) => { 2670 if (!q.isComputable || !ce) { 2671 ce = !1, l({ isComputable: !1 }); 2672 return; 2673 } 2674 C[M] = q.value, l({ isComputable: !0, value: K(C) }); 2675 }; 2676 }; 2677 return Promise.all(i.map((I, M) => it(I) || $i(I) ? Cr(I, { 2678 publicKey: e, 2679 fileName: t, 2680 baseURL: s, 2681 secureSignature: r, 2682 secureExpire: n, 2683 store: o, 2684 signal: a, 2685 onProgress: _e(ie, M), 2686 source: c, 2687 integration: u, 2688 userAgent: d, 2689 retryThrottledRequestMaxTimes: h, 2690 retryNetworkErrorMaxTimes: p, 2691 contentType: g, 2692 multipartChunkSize: y, 2693 baseCDN: A, 2694 prefixedBaseCDN: _, 2695 checkForUrlDuplicates: v, 2696 saveUrlForRecurrentUploads: m 2697 }).then((K) => K.uuid) : I)).then((I) => ga(I, { 2698 publicKey: e, 2699 baseURL: s, 2700 jsonpCallback: f, 2701 secureSignature: r, 2702 secureExpire: n, 2703 signal: a, 2704 source: c, 2705 integration: u, 2706 userAgent: d, 2707 retryThrottledRequestMaxTimes: h, 2708 retryNetworkErrorMaxTimes: p 2709 }).then((M) => qa(M, { publicKey: e, baseCDN: A, prefixedBaseCDN: _ })).then((M) => (l && l({ isComputable: !0, value: 1 }), M))); 2710} 2711class tl { 2712 _concurrency = 1; 2713 _pending = []; 2714 _running = 0; 2715 _resolvers = /* @__PURE__ */ new Map(); 2716 _rejectors = /* @__PURE__ */ new Map(); 2717 constructor(e) { 2718 this._concurrency = e; 2719 } 2720 /** Run tasks from the queue up to the concurrency limit */ 2721 run() { 2722 const e = this._concurrency - this._running; 2723 for (let t = 0; t < e; t++) { 2724 const s = this._pending.shift(); 2725 if (!s) 2726 return; 2727 const r = this._resolvers.get(s), n = this._rejectors.get(s); 2728 if (!r || !n) 2729 throw new Error("Unexpected behavior: resolver or rejector is undefined"); 2730 this._running += 1, s().finally(() => { 2731 this._resolvers.delete(s), this._rejectors.delete(s), this._running -= 1, this.run(); 2732 }).then((o) => r(o)).catch((o) => n(o)); 2733 } 2734 } 2735 /** 2736 * Add a task to the queue 2737 * 2738 * If you want to add a lot of tasks at once, consider setting `autoRun` to 2739 * false and calling `run()` manually after adding all tasks to avoid multiple 2740 * redundant calls to `run()`. 2741 * 2742 * @param task The task to add 2743 * @param autoRun Whether to automatically run the queue after adding the task 2744 * (default: true) 2745 * @returns A promise that resolves or rejects with the task's result 2746 */ 2747 add(e, { autoRun: t } = { autoRun: !0 }) { 2748 return new Promise((s, r) => { 2749 this._resolvers.set(e, s), this._rejectors.set(e, r), this._pending.push(e), t && this.run(); 2750 }); 2751 } 2752 get pending() { 2753 return this._pending.length; 2754 } 2755 get running() { 2756 return this._running; 2757 } 2758 set concurrency(e) { 2759 this._concurrency = e, this.run(); 2760 } 2761 get concurrency() { 2762 return this._concurrency; 2763 } 2764} 2765const Er = () => ({}), Tr = (i) => ({ 2766 ...Er(), 2767 "*currentActivity": null, 2768 "*currentActivityParams": {}, 2769 "*history": [], 2770 "*historyBack": null, 2771 "*closeModal": () => { 2772 i.set$({ 2773 "*currentActivity": null, 2774 "*modalActive": !1 2775 }); 2776 } 2777}), Ir = (i) => ({ 2778 ...Tr(i), 2779 "*commonProgress": 0, 2780 "*uploadList": [], 2781 "*uploadQueue": new tl(1), 2782 /** @type {ReturnType<import('../types').OutputErrorCollection>[]} */ 2783 "*collectionErrors": [], 2784 /** @type {import('../types').OutputCollectionState | null} */ 2785 "*collectionState": null, 2786 /** @type {import('@uploadcare/upload-client').UploadcareGroup | null} */ 2787 "*groupInfo": null, 2788 /** @type {Set<string>} */ 2789 "*uploadTrigger": /* @__PURE__ */ new Set(), 2790 /** @type {import('./SecureUploadsManager.js').SecureUploadsManager | null} */ 2791 "*secureUploadsManager": null 2792}), Fi = { 2793 "locale-id": "en", 2794 "social-source-lang": "en", 2795 "upload-file": "Upload file", 2796 "upload-files": "Upload files", 2797 "choose-file": "Choose file", 2798 "choose-files": "Choose files", 2799 "drop-files-here": "Drop files here", 2800 "select-file-source": "Select file source", 2801 selected: "Selected", 2802 upload: "Upload", 2803 "add-more": "Add more", 2804 cancel: "Cancel", 2805 "start-from-cancel": "Cancel", 2806 clear: "Clear", 2807 "camera-shot": "Shot", 2808 "upload-url": "Import", 2809 "upload-url-placeholder": "Paste link here", 2810 "edit-image": "Edit image", 2811 "edit-detail": "Details", 2812 back: "Back", 2813 done: "Done", 2814 ok: "Ok", 2815 "remove-from-list": "Remove", 2816 no: "No", 2817 yes: "Yes", 2818 "confirm-your-action": "Confirm your action", 2819 "are-you-sure": "Are you sure?", 2820 "selected-count": "{{count}} of {{total}} selected", 2821 "select-all": "Select all", 2822 "deselect-all": "Deselect all", 2823 "upload-error": "Upload error", 2824 "validation-error": "Validation error", 2825 "no-files": "No files selected", 2826 browse: "Browse", 2827 "not-uploaded-yet": "Not uploaded yet...", 2828 file__one: "file", 2829 file__other: "files", 2830 error__one: "error", 2831 error__other: "errors", 2832 "header-uploading": "Uploading {{count}} {{plural:file(count)}}", 2833 "header-failed": "{{count}} {{plural:error(count)}}", 2834 "header-succeed": "{{count}} {{plural:file(count)}} uploaded", 2835 "header-total": "{{count}} {{plural:file(count)}} selected", 2836 "src-type-local": "From device", 2837 "src-type-from-url": "From link", 2838 "src-type-camera": "Camera", 2839 "src-type-draw": "Draw", 2840 "src-type-facebook": "Facebook", 2841 "src-type-dropbox": "Dropbox", 2842 "src-type-gdrive": "Google Drive", 2843 "src-type-gphotos": "Google Photos", 2844 "src-type-flickr": "Flickr", 2845 "src-type-vk": "VK", 2846 "src-type-evernote": "Evernote", 2847 "src-type-box": "Box", 2848 "src-type-onedrive": "Onedrive", 2849 "src-type-huddle": "Huddle", 2850 "src-type-other": "Other", 2851 "caption-from-url": "Import from link", 2852 "caption-camera": "Camera", 2853 "caption-draw": "Draw", 2854 "caption-edit-file": "Edit file", 2855 "file-no-name": "No name...", 2856 "toggle-fullscreen": "Toggle fullscreen", 2857 "toggle-guides": "Toggle guides", 2858 rotate: "Rotate",
2859 "flip-vertical": "Flip vertical", 2860 "flip-horizontal": "Flip horizontal", 2861 apply: "Apply", 2862 brightness: "Brightness", 2863 contrast: "Contrast", 2864 saturation: "Saturation", 2865 exposure: "Exposure", 2866 gamma: "Gamma", 2867 vibrance: "Vibrance", 2868 warmth: "Warmth", 2869 enhance: "Enhance", 2870 original: "Original", 2871 resize: "Resize image", 2872 crop: "Crop", 2873 "select-color": "Select color", 2874 text: "Text", 2875 draw: "Draw", 2876 "cancel-edit": "Cancel edit", 2877 "tab-view": "Preview", 2878 "tab-details": "Details", 2879 "file-name": "Name", 2880 "file-size": "Size", 2881 "cdn-url": "CDN URL", 2882 "file-size-unknown": "Unknown", 2883 "camera-permissions-denied": "Camera access denied", 2884 "camera-permissions-prompt": "Please allow access to the camera", 2885 "camera-permissions-request": "Request access", 2886 "files-count-limit-error-title": "Files count limit overflow", 2887 "files-count-limit-error-too-few": "You’ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.", 2888 "files-count-limit-error-too-many": "You’ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.", 2889 "files-max-size-limit-error": "File is too big. Max file size is {{maxFileSize}}.", 2890 "has-validation-errors": "File validation error ocurred. Please, check your files before upload.", 2891 "images-only-accepted": "Only image files are accepted.", 2892 "file-type-not-allowed": "Uploading of these file types is not allowed.", 2893 "some-files-were-not-uploaded": "Some files were not uploaded.", 2894 "file-item-edit-button": "Edit", 2895 "file-item-remove-button": "Remove", 2896 "a11y-editor-tab-filters": "Filters", 2897 "a11y-editor-tab-tuning": "Tuning", 2898 "a11y-editor-tab-crop": "Crop", 2899 "a11y-activity-header-button-close": "Close", 2900 flip: "Flip", 2901 mirror: "Mirror", 2902 "a11y-cloud-editor-apply-filter": "Apply {{name}} filter", 2903 "a11y-cloud-editor-apply-crop": "Apply {{name}} operation", 2904 "a11y-cloud-editor-apply-tuning": "Apply {{name}} tuning", 2905 finished: "Finished", 2906 failed: "Failed", 2907 uploading: "Uploading", 2908 idle: "Idle", 2909 "a11y-file-item-status": "File {{fileName}} in status {{status}}" 2910}, Ut = /* @__PURE__ */ new Map(), yi = /* @__PURE__ */ new Map(), Sr = (i, e) => { 2911 Ut.has(i) && console.log(`Locale ${i} is already defined. Overwriting...`), Ut.set(i, { ...Fi, ...e }); 2912}, il = (i, e) => { 2913 yi.set(i, e); 2914}, kr = (i, e) => { 2915 typeof e == "function" ? il(i, e) : Sr(i, e); 2916}, sl = async (i) => { 2917 if (!Ut.has(i)) { 2918 if (!yi.has(i)) 2919 throw new Error(`Locale ${i} is not defined`); 2920 const t = await /** @type {LocaleDefinitionResolver} */ 2921 yi.get(i)(); 2922 Sr(i, t); 2923 } 2924 return ( 2925 /** @type {LocaleDefinition} */ 2926 Ut.get(i) 2927 ); 2928}; 2929kr("en", Fi); 2930const Be = (i) => `*l10n/${i}`, rl = "en"; 2931class nl { 2932 /** 2933 * @private 2934 * @type {import('./Block.js').Block | null} 2935 */ 2936 _blockInstance = null; 2937 /** @private */ 2938 _localeName = ""; 2939 /** 2940 * @private 2941 * @type {Set<() => void>} 2942 */ 2943 _callbacks = /* @__PURE__ */ new Set(); 2944 /** 2945 * @private 2946 * @type {Map<import('./Block.js').Block, Map<string, () => void>>} 2947 */ 2948 _boundBlocks = /* @__PURE__ */ new Map(); 2949 /** @param {import('./Block.js').Block} blockInstance */ 2950 constructor(e) { 2951 this._blockInstance = e; 2952 for (let [t, s] of Object.entries(Fi)) 2953 this._blockInstance.add(Be(t), s, !1); 2954 setTimeout(() => { 2955 e.subConfigValue("localeName", async (t) => { 2956 if (!this._blockInstance || !t) 2957 return; 2958 this._localeName = t; 2959 const s = await sl(t); 2960 if (t !== rl && this._localeName !== t) 2961 return; 2962 const r = this._blockInstance.cfg.localeDefinitionOverride?.[t]; 2963 for (const [n, o] of Object.entries(s)) { 2964 const a = r?.[n]; 2965 this._blockInstance.add(Be(n), a ?? o, !0); 2966 for (const l of this._callbacks) 2967 l(); 2968 } 2969 }), e.subConfigValue("localeDefinitionOverride", (t) => { 2970 if (!t) 2971 return; 2972 const s = t[this._localeName]; 2973 if (s) 2974 for (const [r, n] of Object.entries(s)) { 2975 this._blockInstance?.add(Be(r), n, !0); 2976 for (const o of this._callbacks) 2977 o(); 2978 } 2979 }); 2980 }); 2981 } 2982 /** 2983 * @param {() => void} callback 2984 * @returns {() => void} 2985 */ 2986 onLocaleChange(e) {
2987 const t = le(e, 0); 2988 return this._callbacks.add(t), () => { 2989 this._callbacks.delete(t); 2990 }; 2991 } 2992 /** 2993 * @param {import('./Block.js').Block} block 2994 * @param {string} key 2995 * @param {() => void} resolver 2996 */ 2997 bindL10n(e, t, s) { 2998 e.$[t] = s(), this._boundBlocks.has(e) || this._boundBlocks.set(e, /* @__PURE__ */ new Map()), this._boundBlocks.get(e)?.get(t)?.(); 2999 const r = this.onLocaleChange(() => { 3000 e.$[t] = s(); 3001 }); 3002 this._boundBlocks.get(e)?.set(t, r); 3003 } 3004 /** @param {import('./Block.js').Block} block */ 3005 destroyL10nBindings(e) { 3006 const t = this._boundBlocks.get(e); 3007 if (t) { 3008 for (const s of t.values()) 3009 s(); 3010 this._boundBlocks.delete(e); 3011 } 3012 } 3013 destroy() { 3014 this._callbacks.clear(); 3015 } 3016} 3017function ol(i, e) { 3018 [...i.querySelectorAll("[l10n]")].forEach((t) => { 3019 let s = t.getAttribute("l10n"); 3020 if (!s) 3021 return; 3022 let r = "textContent", n = !1; 3023 if (s.includes(":")) { 3024 const l = s.split(":"); 3025 r = l[0], s = l[1], r.startsWith("@") && (r = r.slice(1), n = !0); 3026 } 3027 const o = s; 3028 e.has(o) && e.sub(o, (l) => { 3029 if (!l) 3030 return; 3031 e.l10nProcessorSubs.has(o) || e.l10nProcessorSubs.set(o, /* @__PURE__ */ new Set()); 3032 const c = e.l10nProcessorSubs.get(o); 3033 c?.forEach( 3034 /** @param {{ remove: () => void }} sub */ 3035 (h) => { 3036 h.remove(), c.delete(h), e.allSubs.delete(h); 3037 } 3038 ); 3039 const u = Be(l).replace("*", ""); 3040 e.nodeCtx.has(u) || e.nodeCtx.add(u, l); 3041 const d = e.nodeCtx.sub(u, () => { 3042 t[ 3043 /** @type {'textContent'} */ 3044 r 3045 ] = e.l10n(l); 3046 }); 3047 c?.add(d), e.allSubs.add(d), t.removeAttribute("l10n"); 3048 }); 3049 const a = Be(s); 3050 e.has(a) || e.add(a, ""), e.sub(a, () => { 3051 s = /** @type {string} */ 3052 s, n ? t.setAttribute(r, e.l10n(s)) : t[ 3053 /** @type {'textContent'} */ 3054 r 3055 ] = e.l10n(s); 3056 }), t.removeAttribute("l10n"); 3057 }); 3058} 3059const oe = (i) => `*cfg/${i}`, al = { 3060 button: ["toolbar"], 3061 checkbox: ["toolbar"], 3062 menuitem: ["menu", "menubar"], 3063 option: ["listbox"], 3064 tab: ["tablist"] 3065}; 3066function st(i, e) { 3067 e.tabIndex = 0, e.focus(), i.tabIndex = -1; 3068} 3069function ai(i) { 3070 let e = i.role || i.type || i.tagName; 3071 if (!e) return null; 3072 let t = al[e.toLowerCase()]; 3073 if (!t) return null; 3074 for (let s of t) { 3075 let r = i.closest(`[role=${s}]`); 3076 if (r) return r; 3077 } 3078} 3079function li(i, e) { 3080 return e.role === "toolbar" ? ll(e) : e.querySelectorAll(`[role=${i.role}]`); 3081} 3082function ll(i) { 3083 return [...i.querySelectorAll("*")].filter((t) => t.role === "button" || t.type === "button" || t.role === "checkbox" || t.type === "checkbox"); 3084} 3085function cl(i) { 3086 let e = i.getAttribute("aria-orientation"); 3087 if (e === "vertical") return !1; 3088 if (e === "horizontal") return !0; 3089 let t = i.role; 3090 return t === "menubar" || t === "tablist" || t === "toolbar"; 3091} 3092function ul(i) { 3093 return (e) => { 3094 let t = !1, s = 300, r = 0, n = ""; 3095 function o(d) { 3096 let h = ai(d.target); 3097 if (!h) { 3098 a(); 3099 return; 3100 } 3101 let p = li(d.target, h), g = Array.from(p).indexOf(d.target), y = "ArrowDown", A = "ArrowUp"; 3102 if (cl(h) && (e.document.dir === "rtl" ? (y = "ArrowLeft", A = "ArrowRight") : (y = "ArrowRight", A = "ArrowLeft")), d.key === y) 3103 d.preventDefault(), st(d.target, p[g + 1] || p[0]); 3104 else if (d.key === A) 3105 d.preventDefault(), st(d.target, p[g - 1] || p[p.length - 1]); 3106 else if (d.key === "Home") 3107 d.preventDefault(), st(d.target, p[0]); 3108 else if (d.key === "End") 3109 d.preventDefault(), st(d.target, p[p.length - 1]); 3110 else if (d.key.length === 1 && h.role !== "tablist") { 3111 let _ = Date.now(); 3112 _ - r <= s ? n += d.key.toLowerCase() : n = d.key.toLowerCase(), r = _; 3113 let v = Array.from(p).find((m) => m.textContent?.trim()?.toLowerCase()?.startsWith(n)); 3114 v && (d.preventDefault(), st(d.target, v)); 3115 } 3116 } 3117 function a() { 3118 t = !1, e.removeEventListener("keydown", o); 3119 } 3120 function l(d) { 3121 let h = ai(d.target); 3122 if (h) { 3123 t || (t = !0, e.addEventListener("keydown", o)); 3124 let p = li(d.target, h); 3125 for (let g of p) 3126 g !== d.target && g.setAttribute("tabindex", -1); 3127 } else t && a(); 3128 } 3129 function c(d) { 3130 (!d.relatedTarget || d.relatedTarget === e.document) && a(); 3131 } 3132 function u(d) { 3133 let h = ai(d.target); 3134 if (h) { 3135 let p = li(d.target, h); 3136 for (let g of p) 3137 g !== d.target && g.setAttribute("tabindex", -1); 3138 d.target.setAttribute("tabindex", 0); 3139 } 3140 } 3141 return e.addEventListener("click", u), e.addEventListener("focusin", l), e.addEventListener("focusout", c), () => { 3142 a(), e.removeEventListener("click", u), e.removeEventListener("focusin", l), e.removeEventListener("focusout", c); 3143 }; 3144 }; 3145} 3146function dl() { 3147 return (i) => { 3148 let e, t; 3149 function s(n) { 3150 if (n.target.getAttribute("aria-hidden") === "true") { 3151 e = n.target, e.setAttribute("aria-hidden", "false"), t = e.hidden, t && (e.hidden = !1); 3152 let o = n.target.querySelector(
3153 'a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])' 3154 ); 3155 o && (o.tabIndex = 0); 3156 } 3157 } 3158 function r(n) { 3159 e && e.contains(n.target) && (!n.relatedTarget || !e.contains(n.relatedTarget)) && (n.target.tabIndex = -1, e.setAttribute("aria-hidden", "true"), t && (e.hidden = !0), e = null); 3160 } 3161 return i.addEventListener("keyuxJump", s), i.addEventListener("focusout", r), () => { 3162 i.removeEventListener("keyuxJump", s), i.removeEventListener("focusout", r); 3163 }; 3164 }; 3165} 3166function hl() { 3167 return (i) => { 3168 let e = []; 3169 function t(l) { 3170 let c = i.document.activeElement; 3171 c && c !== i.document.body && e.push(new WeakRef(c)), l.focus({ focusVisible: !0 }); 3172 } 3173 function s() { 3174 let l = e.pop(); 3175 if (!l) { 3176 i.document.activeElement.blur(); 3177 return; 3178 } 3179 let c = l.deref(); 3180 c && c.isConnected ? c.focus() : s(); 3181 } 3182 let r = 0, n; 3183 function o(l) { 3184 clearInterval(n); 3185 let c = l.getAttribute("aria-controls"); 3186 n = setInterval(() => { 3187 if (r++ > 50) { 3188 clearInterval(n); 3189 return; 3190 } 3191 let u = i.document.getElementById(c); 3192 if (u) { 3193 let d = u.querySelector( 3194 'a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])' 3195 ); 3196 d && (clearInterval(n), u.dispatchEvent( 3197 new i.CustomEvent("keyuxJump", { bubbles: !0 }) 3198 ), t(d)); 3199 } 3200 }, 50); 3201 } 3202 function a(l) { 3203 l.target.getAttribute("aria-controls") && l.key === "Enter" && o(l.target), l.key === "Escape" && s(); 3204 } 3205 return i.addEventListener("keydown", a), () => { 3206 i.removeEventListener("keydown", a); 3207 }; 3208 }; 3209} 3210function fl(i) { 3211 let e, t = i.split(" "), s; 3212 function r(a) { 3213 a.key === "Enter" && (a.target.tagName === "BUTTON" || a.target.tagName === "A") && (n(), a.target.classList.add(...t), e = a.target, s = a.target); 3214 } 3215 function n() { 3216 e && e.classList.remove(...t), s = null; 3217 } 3218 function o(a) { 3219 a.clientX === 0 && a.clientY === 0 && s !== a.target && (n(), a.target.classList.add(...t), e = a.target); 3220 } 3221 return (a) => (a.addEventListener("click", o), a.addEventListener("keydown", r), a.addEventListener("keyup", n), () => { 3222 a.removeEventListener("click", o), a.removeEventListener("keydown", r), a.removeEventListener("keyup", n); 3223 }); 3224} 3225function pl(i, e) { 3226 let t = e.map((s) => s(i)); 3227 return () => { 3228 t.forEach((s) => s()); 3229 }; 3230} 3231class ml { 3232 /** 3233 * @private 3234 * @type {Map<Function, (event: Event) => void>} 3235 */ 3236 _listeners = /* @__PURE__ */ new Map(); 3237 /** 3238 * @private 3239 * @type {Node[]} 3240 */ 3241 _scope = []; 3242 /** 3243 * @param {'keydown' | 'keyup'} type 3244 * @param {(event: Event) => void} listener 3245 */ 3246 addEventListener(e, t) { 3247 const s = (r) => { 3248 const n = r.target; 3249 n && this._scope.some((o) => o === r.target || o.contains( 3250 /** @type {Node} */ 3251 n 3252 )) && t(r); 3253 }; 3254 this._listeners.set(t, s), window.addEventListener(e, s); 3255 } 3256 /** 3257 * @param {'keydown' | 'keyup'} type 3258 * @param {(event: {}) => void} listener 3259 */ 3260 removeEventListener(e, t) { 3261 const s = this._listeners.get(t); 3262 s && window.removeEventListener(e, s), this._listeners.delete(t); 3263 } 3264 get CustomEvent() { 3265 return window.CustomEvent; 3266 } 3267 get document() { 3268 return window.document; 3269 } 3270 get navigator() { 3271 return window.navigator; 3272 } 3273 /** @param {Node} scope */ 3274 registerScope(e) { 3275 this._scope.push(e); 3276 } 3277 destroy() { 3278 this._scope = [], this._listeners.forEach((e, t) => { 3279 window.removeEventListener("keydown", e), window.removeEventListener("keyup", e), this._listeners.delete(t); 3280 }); 3281 } 3282} 3283class gl { 3284 /** 3285 * @private 3286 * @type {(() => void) | undefined} 3287 */ 3288 _destroyKeyUX; 3289 /** 3290 * @private 3291 * @type {ScopedMinimalWindow} 3292 */ 3293 _scopedWindow; 3294 constructor() { 3295 this._scopedWindow = new ml(), this._destroyKeyUX = pl(this._scopedWindow, [ 3296 ul(), 3297 fl("is-pressed"), 3298 hl(), 3299 dl() 3300 ]); 3301 } 3302 /** @param {import('./Block.js').Block} scope */ 3303 registerBlock(e) { 3304 this._scopedWindow.registerScope(e); 3305 } 3306 destroy() { 3307 this._destroyKeyUX?.(), this._scopedWindow.destroy(); 3308 } 3309} 3310const bl = "uc-"; 3311class B extends bt { 3312 /** @type {string | null} */ 3313 static StateConsumerScope = null; 3314 /** @type {string[]} */ 3315 static styleAttrs = []; 3316 /** @protected */ 3317 requireCtxName = !1; 3318 /** @type {import('./ActivityBlock.js').ActivityType} */ 3319 activityType = null; 3320 init$ = Er(); 3321 /** 3322 * @param {String} str 3323 * @param {{ [key: string]: string | number }} variables 3324 * @returns {String} 3325 */ 3326 l10n(e, t = {}) { 3327 if (!e) 3328 return ""; 3329 let s = this.$[Be(e)] || e, r = jo(s); 3330 for (let o of r) 3331 t[o.variable] = this.pluralize( 3332 o.pluralKey, 3333 Number(t[o.countVariable]) 3334 ); 3335 return vi(s, t); 3336 } 3337 /** 3338 * @private 3339 * @param {string} key 3340 * @param {number} count 3341 * @returns {string} 3342 */ 3343 pluralize(e, t) { 3344 const s = this.l10n("locale-id") || "en", r = ur(s, t); 3345 return this.l10n(`${e}__${r}`); 3346 } 3347 /** 3348 * @param {string} key 3349 * @param {() => void} resolver 3350 * @protected 3351 */ 3352 bindL10n(e, t) { 3353 this.localeManager?.bindL10n(this, e, t); 3354 } 3355 constructor() { 3356 super(), this.l10nProcessorSubs = /* @__PURE__ */ new Map(), this.addTemplateProcessor(ol); 3357 } 3358 /** 3359 * @param {Parameters<import('../blocks/UploadCtxProvider/EventEmitter.js').EventEmitter['emit']>[0]} type 3360 * @param {Parameters<import('../blocks/UploadCtxProvider/EventEmitter.js').EventEmitter['emit']>[1]} [payload] 3361 * @param {Parameters<import('../blocks/UploadCtxProvider/EventEmitter.js').EventEmitter['emit']>[2]} [options] 3362 */ 3363 emit(e, t, s) { 3364 const r = this.has("*eventEmitter") && this.$["*eventEmitter"]; 3365 r && r.emit(e, t, s); 3366 } 3367 /** 3368 * @param {(block: Block) => boolean} callback 3369 * @returns {Boolean} 3370 */ 3371 hasBlockInCtx(e) { 3372 for (let t of this.blocksRegistry) 3373 if (e(t)) 3374 return !0; 3375 return !1; 3376 } 3377 /** 3378 * @param {String} prop 3379 * @param {any} newVal 3380 */ 3381 setOrAddState(e, t) { 3382 this.add$( 3383 { 3384 [e]: t 3385 }, 3386 !0 3387 ); 3388 } 3389 /** @protected */ 3390 connectedCallback() { 3391 /** @type {typeof Block} */
3392 this.constructor.styleAttrs.forEach((t) => { 3393 this.setAttribute(t, ""); 3394 }), this.hasAttribute("retpl") && (this.constructor.template = null, this.processInnerHtml = !0), this.requireCtxName ? Go({ 3395 element: this, 3396 attribute: "ctx-name", 3397 onSuccess: () => { 3398 super.connectedCallback(); 3399 }, 3400 onTimeout: () => { 3401 console.error("Attribute `ctx-name` is required and it is not set."); 3402 } 3403 }) : super.connectedCallback(), gs.registerClient(this); 3404 } 3405 /** @protected */ 3406 disconnectedCallback() { 3407 super.disconnectedCallback(), gs.unregisterClient(this); 3408 } 3409 /** @protected */ 3410 initCallback() { 3411 this.has("*blocksRegistry") || this.add("*blocksRegistry", /* @__PURE__ */ new Set()), this.$["*blocksRegistry"].add(this), this.has("*eventEmitter") || this.add("*eventEmitter", new Vo(this.debugPrint.bind(this))), this.has("*localeManager") || this.add("*localeManager", new nl(this)), this.has("*a11y") || this.add("*a11y", new gl()), this.sub(Be("locale-id"), (t) => { 3412 const s = zo(t); 3413 this.style.direction = s === "ltr" ? "" : s; 3414 }); 3415 } 3416 /** 3417 * @private 3418 * @returns {LocaleManager | null} 3419 */ 3420 get localeManager() { 3421 return this.has("*localeManager") ? this.$["*localeManager"] : null; 3422 } 3423 /** 3424 * @returns {A11y | null} 3425 * @protected 3426 */ 3427 get a11y() { 3428 return this.has("*a11y") ? this.$["*a11y"] : null; 3429 } 3430 /** @type {Set<Block>} */ 3431 get blocksRegistry() { 3432 return this.$["*blocksRegistry"]; 3433 } 3434 /** @protected */ 3435 destroyCallback() { 3436 super.destroyCallback(); 3437 let e = this.blocksRegistry; 3438 e?.delete(this), this.localeManager?.destroyL10nBindings(this), this.l10nProcessorSubs = /* @__PURE__ */ new Map(), $.deleteCtx(this), e?.size === 0 && setTimeout(() => { 3439 this.destroyCtxCallback(); 3440 }, 0); 3441 } 3442 /** 3443 * Called when the last block is removed from the context. Note that inheritors must run their callback before that. 3444 * 3445 * @protected 3446 */ 3447 destroyCtxCallback() { 3448 $.deleteCtx(this.ctxName), this.localeManager?.destroy(); 3449 } 3450 /** 3451 * @param {String} url 3452 * @returns {Promise<String>} 3453 * @protected 3454 */ 3455 async proxyUrl(e) { 3456 if (this.cfg.secureDeliveryProxy && this.cfg.secureDeliveryProxyUrlResolver && console.warn( 3457 "Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used." 3458 ), this.cfg.secureDeliveryProxyUrlResolver) 3459 try { 3460 return await this.cfg.secureDeliveryProxyUrlResolver(e, { 3461 uuid: sr(e), 3462 cdnUrlModifiers: rr(e), 3463 fileName: xi(e) 3464 }); 3465 } catch (t) { 3466 return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.", t), e; 3467 } 3468 return this.cfg.secureDeliveryProxy ? vi( 3469 this.cfg.secureDeliveryProxy, 3470 { previewUrl: e }, 3471 { transform: (t) => window.encodeURIComponent(t) } 3472 ) : e; 3473 } 3474 /** @returns {import('../types').ConfigType} } */ 3475 get cfg() { 3476 if (!this.__cfgProxy) { 3477 let e = /* @__PURE__ */ Object.create(null); 3478 this.__cfgProxy = new Proxy(e, { 3479 set: (t, s, r) => { 3480 if (typeof s != "string") 3481 return !1; 3482 const n = oe( 3483 /** @type {keyof import('../types').ConfigType} */ 3484 s 3485 ); 3486 return this.has(n) || this.add(n, xe[ 3487 /** @type {keyof import('../types').ConfigType} */ 3488 s 3489 ]), this.$[n] = r, !0; 3490 }, 3491 /** 3492 * @param {never} obj 3493 * @param {keyof import('../types').ConfigType} key 3494 */ 3495 get: (t, s) => { 3496 const r = oe(s); 3497 return this.has(r) || this.add(r, xe[s]), this.$[oe(s)]; 3498 } 3499 }); 3500 } 3501 return this.__cfgProxy; 3502 } 3503 /** 3504 * @template {keyof import('../types').ConfigType} T 3505 * @param {T} key 3506 * @param {(value: import('../types').ConfigType[T]) => void} callback 3507 */ 3508 subConfigValue(e, t) { 3509 const s = oe(e); 3510 this.has(s) || this.add(s, xe[e]), this.sub(s, t); 3511 } 3512 /** @param {unknown[]} args */ 3513 debugPrint(...e) { 3514 if (!this.cfg.debug) 3515 return; 3516 let t = e; 3517 if (typeof e?.[0] == "function") { 3518 const s = e[0]; 3519 t = s(); 3520 } 3521 console.log(`[${this.ctxName}]`, ...t); 3522 } 3523 /** @param {String} [name] */ 3524 static reg(e) { 3525 if (!e) { 3526 super.reg(); 3527 return; 3528 } 3529 e.startsWith(bl) && super.reg(e); 3530 } 3531} 3532const vl = "<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.71
35325-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z
vendor: 15,962 bytes, line 3532
3532'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-
3532onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>"; 3533class Yt extends B {
3534 static styleAttrs = ["uc-wgt-common"]; 3535 requireCtxName = !0; 3536 init$ = Ir(this); 3537 _template = null; 3538 initCallback() { 3539 super.initCallback(), this.a11y?.registerBlock(this); 3540 } 3541 static set template(e) { 3542 this._template = vl + e + /** HTML */ 3543 "<slot></slot>"; 3544 } 3545 static get template() { 3546 return this._template; 3547 } 3548} 3549const As = "active", rt = "___ACTIVITY_IS_ACTIVE___"; 3550class O extends B { 3551 /** @protected */ 3552 historyTracked = !1; 3553 init$ = Tr(this); 3554 _debouncedHistoryFlush = le(this._historyFlush.bind(this), 10); 3555 /** @private */ 3556 _deactivate() { 3557 let e = O._activityCallbacks.get(this); 3558 this[rt] = !1, this.removeAttribute(As), e?.deactivateCallback?.(); 3559 } 3560 /** @private */ 3561 _activate() { 3562 let e = O._activityCallbacks.get(this); 3563 this.$["*historyBack"] = this.historyBack.bind(this), this[rt] = !0, this.setAttribute(As, ""), e?.activateCallback?.(), this._debouncedHistoryFlush(), this.emit(z.ACTIVITY_CHANGE, { 3564 activity: this.activityType 3565 }); 3566 } 3567 /** @protected */ 3568 initCallback() { 3569 super.initCallback(), this.hasAttribute("current-activity") && this.sub("*currentActivity", (e) => { 3570 this.setAttribute("current-activity", e); 3571 }), this.activityType && (this.hasAttribute("activity") || this.setAttribute("activity", this.activityType), this.sub("*currentActivity", (e) => { 3572 try { 3573 this.activityType !== e && this[rt] ? this._deactivate() : this.activityType === e && !this[rt] && this._activate(); 3574 } catch (t) { 3575 console.error(`Error in activity "${this.activityType}". `, t), this.$["*currentActivity"] = this.$["*history"][this.$["*history"].length - 1] ?? null; 3576 } 3577 e || (this.$["*history"] = []); 3578 }), this.has("*modalActive") && this.sub("*modalActive", (e) => { 3579 !e && this.activityType === this.$["*currentActivity"] && (this.$["*currentActivity"] = null); 3580 })); 3581 } 3582 /** @private */ 3583 _historyFlush() { 3584 let e = this.$["*history"]; 3585 e && (e.length > 10 && (e = e.slice(e.length - 11, e.length - 1)), this.historyTracked && e[e.length - 1] !== this.activityType && e.push(this.activityType), this.$["*history"] = e); 3586 } 3587 /** @private */ 3588 _isActivityRegistered() { 3589 return this.activityType && O._activityCallbacks.has(this); 3590 } 3591 /** 3592 * @private 3593 * @type {Map< 3594 * ActivityBlock, 3595 * { activateCallback: (() => void) | undefined; deactivateCallback: (() => void) | undefined } 3596 * >} 3597 */ 3598 static _activityCallbacks = /* @__PURE__ */ new Map(); 3599 get isActivityActive() { 3600 return this[rt]; 3601 } 3602 get couldOpenActivity() { 3603 return !0; 3604 } 3605 /** 3606 * TODO: remove name argument 3607 * 3608 * @param {String} name 3609 * @param {Object} [options] 3610 * @param {() => void} [options.onActivate] 3611 * @param {() => void} [options.onDeactivate] 3612 */ 3613 registerActivity(e, t = {}) { 3614 const { onActivate: s, onDeactivate: r } = t; 3615 O._activityCallbacks.set(this, { 3616 activateCallback: s, 3617 deactivateCallback: r 3618 }); 3619 } 3620 unregisterActivity() { 3621 this.isActivityActive && this._deactivate(), O._activityCallbacks.delete(this); 3622 } 3623 /** @protected */ 3624 destroyCallback() { 3625 super.destroyCallback(), this._isActivityRegistered() && this.unregisterActivity(); 3626 const e = this.$["*currentActivity"]; 3627 [...this.blocksRegistry].find( 3628 (s) => s instanceof O && s.activityType === e 3629 ) || (this.$["*currentActivity"] = null, this.setOrAddState("*modalActive", !1)); 3630 } 3631 get activityKey() { 3632 return this.ctxName + this.activityType; 3633 } 3634 /** @type {ActivityParamsMap[keyof ActivityParamsMap]} */ 3635 get activityParams() { 3636 return this.$["*currentActivityParams"]; 3637 } 3638 /** @type {String} */ 3639 get initActivity() { 3640 return this.getCssData("--cfg-init-activity"); 3641 } 3642 /** @type {String} */ 3643 get doneActivity() { 3644 return this.getCssData("--cfg-done-activity"); 3645 } 3646 historyBack() { 3647 let e = this.$["*history"]; 3648 if (e) { 3649 let t = e.pop(); 3650 for (; t === this.activityType; ) 3651 t = e.pop(); 3652 let s = !!t; 3653 t && (s = /** @type {ActivityBlock} */ 3654 [...this.blocksRegistry].find((n) => n.activityType === t)?.couldOpenActivity ?? !1), t = s ? t : void 0, this.$["*currentActivity"] = t, this.$["*history"] = e, t || this.setOrAddState("*modalActive", !1); 3655 } 3656 } 3657} 3658O.activities = Object.freeze({ 3659 START_FROM: "start-from", 3660 CAMERA: "camera", 3661 DRAW: "draw",
3662 UPLOAD_LIST: "upload-list", 3663 URL: "url", 3664 CLOUD_IMG_EDIT: "cloud-image-edit", 3665 EXTERNAL: "external" 3666}); 3667const _l = 20, Ai = 24, ct = 34, xr = 3, pe = xr / 2, $e = 1, wt = 100 / 3, P = 1, ws = 24, yl = 6; 3668function Ye(i, e) { 3669 for (let t in e) i.setAttributeNS(null, t, e[t].toString()); 3670} 3671function ue(i, e = {}) { 3672 let t = document.createElementNS("http://www.w3.org/2000/svg", i); 3673 return Ye(t, e), t; 3674} 3675function Al(i, e, t) { 3676 let { x: s, y: r, width: n, height: o } = i, a = e.includes("w") ? 0 : 1, l = e.includes("n") ? 0 : 1, c = [-1, 1][a], u = [-1, 1][l], d = [ 3677 s + a * n + pe * c, 3678 r + l * o + pe * u - Ai * t * u 3679 ], h = [s + a * n + pe * c, r + l * o + pe * u], p = [ 3680 s + a * n - Ai * t * c + pe * c, 3681 r + l * o + pe * u 3682 ]; 3683 return { 3684 d: `M ${d[0]} ${d[1]} L ${h[0]} ${h[1]} L ${p[0]} ${p[1]}`, 3685 center: h 3686 }; 3687} 3688function wl(i, e, t) { 3689 let { x: s, y: r, width: n, height: o } = i, a = ["n", "s"].includes(e) ? 0.5 : { w: 0, e: 1 }[ 3690 /** @type {Extract<import('./types.js').Direction, 'w' | 'e'>} */ 3691 e 3692 ], l = ["w", "e"].includes(e) ? 0.5 : { n: 0, s: 1 }[ 3693 /** @type {Extract<import('./types.js').Direction, 'n' | 's'>} */ 3694 e 3695 ], c = [-1, 1][a], u = [-1, 1][l], d, h; 3696 ["n", "s"].includes(e) ? (d = [s + a * n - ct * t / 2, r + l * o + pe * u], h = [s + a * n + ct * t / 2, r + l * o + pe * u]) : (d = [s + a * n + pe * c, r + l * o - ct * t / 2], h = [s + a * n + pe * c, r + l * o + ct * t / 2]); 3697 let p = `M ${d[0]} ${d[1]} L ${h[0]} ${h[1]}`, g = [h[0] - (h[0] - d[0]) / 2, h[1] - (h[1] - d[1]) / 2]; 3698 return { d: p, center: g }; 3699} 3700function Cl(i) { 3701 return i === "" ? "move" : ["e", "w"].includes(i) ? "ew-resize" : ["n", "s"].includes(i) ? "ns-resize" : ["nw", "se"].includes(i) ? "nwse-resize" : "nesw-resize"; 3702} 3703function El({ rect: i, delta: [e, t], imageBox: s }) { 3704 return Mt( 3705 { 3706 ...i, 3707 x: i.x + e, 3708 y: i.y + t 3709 }, 3710 s 3711 ); 3712} 3713function Mt(i, e) { 3714 let { x: t } = i, { y: s } = i; 3715 return i.x < e.x ? t = e.x : i.x + i.width > e.x + e.width && (t = e.x + e.width - i.width), i.y < e.y ? s = e.y : i.y + i.height > e.y + e.height && (s = e.y + e.height - i.height), { 3716 ...i, 3717 x: t, 3718 y: s 3719 }; 3720} 3721function Tl({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3722 const [, r] = e; 3723 let { y: n, width: o, height: a } = i; 3724 n += r, a -= r, t && (o = a * t); 3725 let l = i.x + i.width / 2 - o / 2; 3726 return n <= s.y && (n = s.y, a = i.y + i.height - n, t && (o = a * t, l = i.x + i.width / 2 - o / 2)), l <= s.x && (l = s.x, n = i.y + i.height - a), l + o >= s.x + s.width && (l = Math.max(s.x, s.x + s.width - o), o = s.x + s.width - l, t && (a = o / t), n = i.y + i.height - a), a < P && (a = P, t && (o = a * t, l = i.x + i.width / 2 - o / 2), n = i.y + i.height - a), o < P && (o = P, t && (a = o / t, l = i.x + i.width / 2 - o / 2), n = i.y + i.height - a), { x: l, y: n, width: o, height: a }; 3727} 3728function Il({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3729 const [r] = e; 3730 let { x: n, width: o, height: a } = i; 3731 n += r, o -= r, t && (a = o / t); 3732 let l = i.y + i.height / 2 - a / 2; 3733 return n <= s.x && (n = s.x, o = i.x + i.width - n, t && (a = o / t, l = i.y + i.height / 2 - a / 2)), l <= s.y && (l = s.y, n = i.x + i.width - o), l + a >= s.y + s.height && (l = Math.max(s.y, s.y + s.height - a), a = s.y + s.height - l, t && (o = a * t), n = i.x + i.width - o), a < P && (a = P, t && (o = a * t), l = i.y + i.height / 2 - a / 2, n = i.x + i.width - o), o < P && (o = P, t && (a = o / t), l = i.y + i.height / 2 - a / 2, n = i.x + i.width - o), { x: n, y: l, width: o, height: a }; 3734} 3735function Sl({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3736 const [, r] = e; 3737 let { y: n, width: o, height: a } = i; 3738 a += r, t && (o = a * t); 3739 let l = i.x + i.width / 2 - o / 2; 3740 return n + a >= s.y + s.height && (a = s.y + s.height - n, t && (o = a * t), l = i.x + i.width / 2 - o / 2), l <= s.x && (l = s.x, n = i.y), l + o >= s.x + s.width && (l = Math.max(s.x, s.x + s.width - o), o = s.x + s.width - l, t && (a = o / t), n = i.y), a < P && (a = P, t && (o = a * t), l = i.x + i.width / 2 - o / 2), o < P && (o = P, t && (a = o / t), l = i.x + i.width / 2 - o / 2), { x: l, y: n, width: o, height: a }; 3741} 3742function kl({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3743 const [r] = e; 3744 let { x: n, width: o, height: a } = i; 3745 o += r, t && (a = o / t); 3746 let l = i.y + i.height / 2 - a / 2; 3747 return n + o >= s.x + s.width && (o = s.x + s.width - n, t && (a = o / t), l = i.y + i.height / 2 - a / 2), l <= s.y && (l = s.y, n = i.x), l + a >= s.y + s.height && (l = Math.max(s.y, s.y + s.height - a), a = s.y + s.height - l, t && (o = a * t), n = i.x), a < P && (a = P, t && (o = a * t), l = i.y + i.height / 2 - a / 2), o < P && (o = P, t && (a = o / t), l = i.y + i.height / 2 - a / 2), { x: n, y: l, width: o, height: a }; 3748} 3749function xl({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3750 let [r, n] = e, { x: o, y: a, width: l, height: c } = i; 3751 return o + r < s.x && (r = s.x - o), a + n < s.y && (n = s.y - a), o += r, l -= r, a += n, c -= n, t && Math.abs(l / c) > t ? (n = l / t - c, c += n, a -= n, a <= s.y && (c = c - (s.y - a), l = c * t, o = i.x + i.width - l, a = s.y)) : t && (r = c * t - l, l = l + r, o -= r, o <= s.x && (l = l - (s.x - o), c = l / t, o = s.x, a = i.y + i.height - c)), c < P && (c = P, t && (l = c * t), o = i.x + i.width - l, a = i.y + i.height - c), l < P && (l = P, t && (c = l / t), o = i.x + i.width - l, a = i.y + i.height - c), { x: o, y: a, width: l, height: c }; 3752} 3753function Ol({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3754 let [r, n] = e, { x: o, y: a, width: l, height: c } = i; 3755 return o + l + r > s.x + s.width && (r = s.x + s.width - o - l), a + n < s.y && (n = s.y - a), l += r, a += n, c -= n, t && Math.abs(l / c) > t ? (n = l / t - c, c += n, a -= n, a <= s.y && (c = c - (s.y - a), l = c * t, o = i.x, a = s.y)) : t && (r = c * t - l, l += r, o + l >= s.x + s.width && (l = s.x + s.width - o, c = l / t, o = s.x + s.width - l, a = i.y + i.height - c)), c < P && (c = P, t && (l = c * t), a = i.y + i.height - c), l < P && (l = P, t && (c = l / t), a = i.y + i.height - c), { x: o, y: a, width: l, height: c }; 3756} 3757function Ll({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3758 let [r, n] = e, { x: o, y: a, width: l, height: c } = i; 3759 return o + r < s.x && (r = s.x - o), a + c + n > s.y + s.height && (n = s.y + s.height - a - c), o += r, l -= r, c += n, t && Math.abs(l / c) > t ? (n = l / t - c, c += n, a + c >= s.y + s.height && (c = s.y + s.height - a, l = c * t, o = i.x + i.width - l, a = s.y + s.height - c)) : t && (r = c * t - l, l += r, o -= r, o <= s.x && (l = l - (s.x - o), c = l / t, o = s.x, a = i.y)), c < P && (c = P, t && (l = c * t), o = i.x + i.width - l), l < P && (l = P, t && (c = l / t), o = i.x + i.width - l), { x: o, y: a, width: l, height: c }; 3760} 3761function Pl({ rect: i, delta: e, aspectRatio: t, imageBox: s }) { 3762 let [r, n] = e, { x: o, y: a, width: l, height: c } = i; 3763 return o + l + r > s.x + s.width && (r = s.x + s.width - o - l), a + c + n > s.y + s.height && (n = s.y + s.height - a - c), l += r, c += n, t && Math.abs(l / c) > t ? (n = l / t - c, c += n, a + c >= s.y + s.height && (c = s.y + s.height - a, l = c * t, o = i.x, a = s.y + s.height - c)) : t && (r = c * t - l, l += r, o + l >= s.x + s.width && (l = s.x + s.width - o, c = l / t, o = s.x + s.width - l, a = i.y)), c < P && (c = P, t && (l = c * t)), l < P && (l = P, t && (c = l / t)), { x: o, y: a, width: l, height: c }; 3764} 3765function Ul({ direction: i, ...e }) { 3766 switch (i) { 3767 case "n": 3768 return Tl(e); 3769 case "w": 3770 return Il(e); 3771 case "s": 3772 return Sl(e); 3773 case "e": 3774 return kl(e); 3775 case "nw": 3776 return xl(e); 3777 case "ne": 3778 return Ol(e); 3779 case "sw": 3780 return Ll(e); 3781 case "se": 3782 return Pl(e); 3783 default: 3784 return e.rect; 3785 } 3786} 3787function Ml(i, [e, t]) { 3788 return i.x <= e && e <= i.x + i.width && i.y <= t && t <= i.y + i.height; 3789} 3790function Dl(i, e) { 3791 return i.x >= e.x && i.y >= e.y && i.x + i.width <= e.x + e.width && i.y + i.height <= e.y + e.height; 3792} 3793function Rl(i, e) { 3794 return Math.abs(i.width / i.height - e) < 0.1; 3795} 3796function nt({ width: i, height: e }, t) { 3797 let s = t / 90 % 2 !== 0; 3798 return { width: s ? e : i, height: s ? i : e }; 3799} 3800function $l(i, e, t) { 3801 const s = i / e; 3802 let r, n; 3803 s > t ? (r = Math.round(e * t), n = e) : (r = i, n = Math.round(i / t)); 3804 const o = Math.round((i - r) / 2), a = Math.round((e - n) / 2); 3805 return o + r > i && (r = i - o), a + n > e && (n = e - a), { x: o, y: a, width: r, height: n }; 3806} 3807function Lt(i) { 3808 return { 3809 x: Math.round(i.x), 3810 y: Math.round(i.y), 3811 width: Math.round(i.width), 3812 height: Math.round(i.height) 3813 }; 3814} 3815function We(i, e, t) { 3816 return Math.min(Math.max(i, e), t); 3817} 3818const Or = (i) => { 3819 if (!i) return []; 3820 const [e, t] = i.split(":").map(Number); 3821 if (!Number.isFinite(e) || !Number.isFinite(t)) { 3822 console.error(`Invalid crop preset: ${i}`); 3823 return; 3824 } 3825 return [{ type: "aspect-ratio", width: e, height: t }]; 3826}, Wt = "blocks", Kt = "1.12.0"; 3827function Fl(i) { 3828 return fr({ 3829 ...i, 3830 libraryName: Wt, 3831 libraryVersion: Kt 3832 }); 3833} 3834const Cs = (i) => Math.floor(i / 1e3), Nl = (i, { threshold: e }) => { 3835 const { secureExpire: t } = i, s = Cs(Date.now()), r = Number(t), n = Cs(e); 3836 return s + n >= r; 3837}; 3838class Bl { 3839 /** 3840 * @private 3841 * @type {import('./UploaderBlock.js').UploaderBlock} 3842 */ 3843 _block; 3844 /** 3845 * @private 3846 * @type {import('../types').SecureUploadsSignatureAndExpire | null} 3847 */ 3848 _secureToken = null; 3849 /** @param {import('./UploaderBlock.js').UploaderBlock} block */ 3850 constructor(e) { 3851 this._block = e; 3852 } 3853 /** 3854 * @private 3855 * @param {unknown[]} args 3856 */ 3857 _debugPrint(...e) { 3858 this._block.debugPrint("[secure-uploads]", ...e); 3859 } 3860 /** @returns {Promise<import('../types').SecureUploadsSignatureAndExpire | null>} */ 3861 async getSecureToken() { 3862 const { secureSignature: e, secureExpire: t, secureUploadsSignatureResolver: s } = this._block.cfg; 3863 if ((e || t) && s && console.warn( 3864 "Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used." 3865 ), s) { 3866 if (!this._secureToken || Nl(this._secureToken, { threshold: this._block.cfg.secureUploadsExpireThreshold })) { 3867 this._secureToken ? this._debugPrint("Secure signature is expired. Resolving a new one...") : this._debugPrint("Secure signature is not set yet."); 3868 try { 3869 const r = await s(); 3870 r ? !r.secureSignature || !r.secureExpire ? console.error("Secure signature resolver returned an invali
3870d result:", r) : (this._debugPrint("Secure signature resolved:", r), this._debugPrint( 3871 "Secure signature will expire in", 3872 new Date(Number(r.secureExpire) * 1e3).toISOString() 3873 ), this._secureToken = r) : (this._debugPrint("Secure signature resolver returned nothing."), this._secureToken = null); 3874 } catch (r) { 3875 console.error("Secure signature resolving failed. Falling back to the previous one.", r); 3876 } 3877 } 3878 return this._secureToken; 3879 } 3880 return e && t ? (this._debugPrint("Secure signature and expire are set. Using them...", { 3881 secureSignature: e, 3882 secureExpire: t 3883 }), { 3884 secureSignature: e, 3885 secureExpire: t 3886 }) : null; 3887 } 3888} 3889const Es = "[Typed State] Wrong property name: ", Vl = "[Typed State] Wrong property type: "; 3890class zl { 3891 /** 3892 * @param {Object<string, { type: any; value: any; nullable?: Boolean }>} typedSchema 3893 * @param {String} [ctxName] 3894 */ 3895 constructor(e, t) { 3896 this.__typedSchema = e, this.__ctxId = t || Ft.generate(), this.__schema = Object.keys(e).reduce((s, r) => (s[r] = e[r].value, s), {}), this.__data = $.registerCtx(this.__schema, this.__ctxId); 3897 } 3898 /** @returns {String} */ 3899 get uid() { 3900 return this.__ctxId; 3901 } 3902 /** 3903 * @param {String} prop 3904 * @param {any} value 3905 */ 3906 setValue(e, t) { 3907 if (!this.__typedSchema.hasOwnProperty(e)) { 3908 console.warn(Es + e); 3909 return; 3910 } 3911 let s = this.__typedSchema[e]; 3912 if (t?.constructor === s.type || t instanceof s.type || s.nullable && t === null) { 3913 this.__data.pub(e, t); 3914 return; 3915 } 3916 console.warn(Vl + e); 3917 } 3918 /** @param {Object<string, any>} updObj */ 3919 setMultipleValues(e) { 3920 for (let t in e) 3921 this.setValue(t, e[t]); 3922 } 3923 /** @param {String} prop */ 3924 getValue(e) { 3925 if (!this.__typedSchema.hasOwnProperty(e)) { 3926 console.warn(Es + e); 3927 return; 3928 } 3929 return this.__data.read(e); 3930 } 3931 /** 3932 * @param {String} prop 3933 * @param {(newVal: any) => void} handler 3934 */ 3935 subscribe(e, t) { 3936 return this.__data.sub(e, t); 3937 } 3938 remove() { 3939 $.deleteCtx(this.__ctxId); 3940 } 3941} 3942class Hl { 3943 /** 3944 * @param {Object} options 3945 * @param {Object<string, { type: any; value: any }>} options.typedSchema 3946 * @param {String[]} [options.watchList] 3947 * @param {(list: string[], added: Set<any>, removed: Set<any>) => void} [options.handler] 3948 * @param {String} [options.ctxName] 3949 */ 3950 constructor(e) { 3951 this.__typedSchema = e.typedSchema, this.__ctxId = e.ctxName || Ft.generate(), this.__data = $.registerCtx({}, this.__ctxId), this.__watchList = e.watchList || [], this.__subsMap = /* @__PURE__ */ Object.create(null), this.__propertyObservers = /* @__PURE__ */ new Set(), this.__collectionObservers = /* @__PURE__ */ new Set(), this.__items = /* @__PURE__ */ new Set(), this.__removed = /* @__PURE__ */ new Set(), this.__added = /* @__PURE__ */ new Set(); 3952 let t = /* @__PURE__ */ Object.create(null); 3953 this.__notifyObservers = (s, r) => { 3954 this.__observeTimeout && window.clearTimeout(this.__observeTimeout), t[s] || (t[s] = /* @__PURE__ */ new Set()), t[s].add(r), this.__observeTimeout = window.setTimeout(() => { 3955 Object.keys(t).length !== 0 && (this.__propertyObservers.forEach((n) => { 3956 n({ ...t }); 3957 }), t = /* @__PURE__ */ Object.create(null)); 3958 }); 3959 }; 3960 } 3961 notify() { 3962 this.__notifyTimeout && window.clearTimeout(this.__notifyTimeout), this.__notifyTimeout = window.setTimeout(() => { 3963 let e = new Set(this.__added), t = new Set(this.__removed); 3964 this.__added.clear(), this.__removed.clear(); 3965 for (const s of this.__collectionObservers) 3966 s?.([...this.__items], e, t); 3967 }); 3968 } 3969 /** @param {(list: string[], added: Set<any>, removed: Set<any>) => void} handler */ 3970 observeCollection(e) { 3971 return this.__collectionObservers.add(e), this.__items.size > 0 && this.notify(), () => { 3972 this.unobserveCollection(e); 3973 }; 3974 } 3975 /** @param {Function} handler */ 3976 unobserveCollection(e) { 3977 this.__collectionObservers?.delete(e); 3978 } 3979 /** 3980 * @param {Object<string, any>} init 3981 * @returns {string} 3982 */ 3983 add(e) { 3984 let t = new zl(this.__typedSchema); 3985 for (let s in e) 3986 t.setValue(s, e[s]); 3987 return this.__items.add(t.uid), this.notify(), this.__data.add(t.uid, t), this.__added.add(t), this.__watchList.forEach((s) => { 3988 this.__subsMap[t.uid] || (this.__subsMap[t.uid] = []), this.__subsMap[t.uid].push( 3989 t.subscribe(s, () => { 3990 this.__notifyObservers(s, t.uid); 3991 }) 3992 ); 3993 }), t.uid; 3994 } 3995 /** 3996 * @param {String} id 3997 * @returns {TypedData}
3997 3998 */ 3999 read(e) { 4000 return this.__data.read(e); 4001 } 4002 /** 4003 * @param {String} id 4004 * @param {String} propName 4005 * @returns {any} 4006 */ 4007 readProp(e, t) { 4008 return this.read(e).getValue(t); 4009 } 4010 /** 4011 * @template T 4012 * @param {String} id 4013 * @param {String} propName 4014 * @param {T} value 4015 */ 4016 publishProp(e, t, s) { 4017 this.read(e).setValue(t, s); 4018 } 4019 /** @param {String} id */ 4020 remove(e) { 4021 this.__removed.add(this.__data.read(e)), this.__items.delete(e), this.notify(), this.__data.pub(e, null), delete this.__subsMap[e]; 4022 } 4023 clearAll() { 4024 this.__items.forEach((e) => { 4025 this.remove(e); 4026 }); 4027 } 4028 /** @param {Function} handler */ 4029 observeProperties(e) { 4030 return this.__propertyObservers.add(e), () => { 4031 this.unobserveProperties(e); 4032 }; 4033 } 4034 /** @param {Function} handler */ 4035 unobserveProperties(e) { 4036 this.__propertyObservers?.delete(e); 4037 } 4038 /** 4039 * @param {(item: TypedData) => Boolean} checkFn 4040 * @returns {String[]} 4041 */ 4042 findItems(e) { 4043 let t = []; 4044 return this.__items.forEach((s) => { 4045 let r = this.read(s); 4046 e(r) && t.push(s); 4047 }), t; 4048 } 4049 items() { 4050 return [...this.__items]; 4051 } 4052 get size() { 4053 return this.__items.size; 4054 } 4055 destroy() { 4056 $.deleteCtx(this.__ctxId), this.__propertyObservers = null, this.__collectionObservers = null; 4057 for (let e in this.__subsMap) 4058 this.__subsMap[e].forEach((t) => { 4059 t.remove(); 4060 }), delete this.__subsMap[e]; 4061 } 4062} 4063const qt = Object.freeze({ 4064 FACEBOOK: "facebook", 4065 DROPBOX: "dropbox", 4066 GDRIVE: "gdrive", 4067 GPHOTOS: "gphotos", 4068 FLICKR: "flickr", 4069 VK: "vk", 4070 EVERNOTE: "evernote", 4071 BOX: "box", 4072 ONEDRIVE: "onedrive", 4073 HUDDLE: "huddle" 4074}), Y = Object.freeze({ 4075 LOCAL: "local", 4076 DROP_AREA: "drop-area", 4077 CAMERA: "camera", 4078 EXTERNAL: "external", 4079 API: "js-api", 4080 URL: "url", 4081 DRAW: "draw", 4082 ...qt 4083}), Ni = [ 4084 "image/*", 4085 "image/heif", 4086 "image/heif-sequence", 4087 "image/heic", 4088 "image/heic-sequence", 4089 "image/avif", 4090 "image/avif-sequence", 4091 ".heif", 4092 ".heifs", 4093 ".heic", 4094 ".heics", 4095 ".avif", 4096 ".avifs" 4097], Lr = (i) => i ? i.filter((e) => typeof e == "string").map((e) => Me(e)).flat() : [], Pr = (i, e) => e.some((t) => t.endsWith("*") ? (t = t.replace("*", ""), i.startsWith(t)) : i === t), jl = (i, e) => e.some((t) => t.startsWith(".") ? i.toLowerCase().endsWith(t.toLowerCase()) : !1), Gl = (i) => { 4098 let e = i?.type; 4099 return e ? Pr(e, Ni) : !1; 4100}, Xl = /[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i, Yl = new RegExp(`^/?(${Xl.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`, "i"), Wl = ({ url: i, cdnBase: e }) => { 4101 const t = new URL(e), s = new URL(i); 4102 if (t.host !== s.host) 4103 return null; 4104 const [, r, n, o] = Yl.exec(s.pathname); 4105 return { 4106 uuid: r, 4107 cdnUrlModifiers: n || "", 4108 filename: o || null 4109 }; 4110}, Kl = (i) => { 4111 const e = /* @__PURE__ */ new Map(); 4112 return ( 4113 /** @type {T} */ 4114 ((...t) => { 4115 const s = JSON.stringify(t); 4116 if (e.has(s)) 4117 return e.get(s); 4118 const r = i(...t); 4119 return e.set(s, r), r; 4120 }) 4121 ); 4122}, Ts = /* @__PURE__ */ new Set(); 4123function ql(i) { 4124 Ts.has(i) || (Ts.add(i), console.warn(i)); 4125} 4126function Zl(i) { 4127 let e = !1; 4128 return setTimeout(() => { 4129 e = !0; 4130 }, 0), (s) => ( 4131 /** @type {T} */ 4132 ((...r) => (e && ql(i), s(...r))) 4133 ); 4134} 4135function Ql(i) { 4136 const e = { 4137 /** @returns {number} */ 4138 progress: () => i.$["*commonProgress"], 4139 /** @returns {ReturnType<import('../types').OutputErrorFile>[]} */ 4140 errors: () => i.$["*collectionErrors"], 4141 /** @returns {import('@uploadcare/upload-client').UploadcareGroup | null} */ 4142 group: () => i.$["*groupInfo"], 4143 totalCount: () => i.uploadCollection.size, 4144 failedCount: () => t.failedEntries.length, 4145 successCount: () => t.successEntries.length, 4146 uploadingCount: () => t.uploadingEntries.length, 4147 status: () => t.isFailed ? "failed" : t.isUploading ? "uploading" : t.isSuccess ? "success" : "idle", 4148 isSuccess: () => t.allEntries.length > 0 && t.errors.length === 0 && t.successEntries.length === t.allEntries.length, 4149 isUploading: () => t.allEntries.some((r) => r.status === "uploading"), 4150 isFailed: () => t.errors.length > 0 || t.failedEntries.length > 0, 4151 allEntries: () => i.getOutputData(), 4152 successEntries: () => t.allEntries.filter((r) => r.status === "success"), 4153 failedEntries: () => t.allEntries.filter((r) => r.status === "failed"), 4154 uploadingEntries: () => t.allEntries.filter((r) => r.status === "uploading"), 4155 idleEntries: () => t.allEntries.filter((r) => r.status === "idle") 4156 }, t = ( 4157 /** @type {import('../index.js').OutputCollectionState<TCollectionStatus, TGroupFlag>} */ 4158 /** @type {unknown} */ 4159 {} 4160 ), s = Zl( 4161 "You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than
4161it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`" 4162 ); 4163 for (const [r, n] of Object.entries(e)) { 4164 const o = ( 4165 /** @type {keyof typeof getters} */ 4166 r 4167 ), l = Kl(s( 4168 /** @type {(typeof getters)[name]} */ 4169 n 4170 )); 4171 Object.defineProperty(t, o, { 4172 get: l, 4173 enumerable: !0 4174 }); 4175 } 4176 return t; 4177} 4178class Jl { 4179 /** 4180 * @private 4181 * @type {import('./UploaderBlock.js').UploaderBlock} 4182 */ 4183 _ctx; 4184 /** @param {import('./UploaderBlock.js').UploaderBlock} ctx */ 4185 constructor(e) { 4186 this._ctx = e; 4187 } 4188 /** @private */ 4189 get _uploadCollection() { 4190 return this._ctx.uploadCollection; 4191 } 4192 get cfg() { 4193 return this._ctx.cfg; 4194 } 4195 get l10n() { 4196 return this._ctx.l10n.bind(this._ctx); 4197 } 4198 /** 4199 * TODO: Probably we should not allow user to override `source` property 4200 * 4201 * @param {string} url 4202 * @param {{ silent?: boolean; fileName?: string; source?: string }} [options] 4203 * @returns {import('../types').OutputFileEntry<'idle'>} 4204 */ 4205 addFileFromUrl = (e, { silent: t, fileName: s, source: r } = {}) => { 4206 const n = this._uploadCollection.add({ 4207 externalUrl: e, 4208 fileName: s ?? null, 4209 silent: t ?? !1, 4210 source: r ?? Y.API 4211 }); 4212 return this.getOutputItem(n); 4213 }; 4214 /** 4215 * @param {string} uuid 4216 * @param {{ silent?: boolean; fileName?: string; source?: string }} [options] 4217 * @returns {import('../types').OutputFileEntry<'idle'>} 4218 */ 4219 addFileFromUuid = (e, { silent: t, fileName: s, source: r } = {}) => { 4220 const n = this._uploadCollection.add({ 4221 uuid: e, 4222 fileName: s ?? null, 4223 silent: t ?? !1, 4224 source: r ?? Y.API 4225 }); 4226 return this.getOutputItem(n); 4227 }; 4228 /** 4229 * @param {string} cdnUrl 4230 * @param {{ silent?: boolean; fileName?: string; source?: string }} [options] 4231 * @returns {import('../types').OutputFileEntry<'idle'>} 4232 */ 4233 addFileFromCdnUrl = (e, { silent: t, fileName: s, source: r } = {}) => { 4234 const n = Wl({ url: e, cdnBase: this.cfg.cdnCname }); 4235 if (!n) 4236 throw new Error("Invalid CDN URL"); 4237 const o = this._uploadCollection.add({ 4238 uuid: n.uuid, 4239 cdnUrl: e, 4240 cdnUrlModifiers: n.cdnUrlModifiers, 4241 fileName: s ?? n.filename ?? null, 4242 silent: t ?? !1, 4243 source: r ?? Y.API 4244 }); 4245 return this.getOutputItem(o); 4246 }; 4247 /** 4248 * @param {File} file 4249 * @param {{ silent?: boolean; fileName?: string; source?: string; fullPath?: string }} [options] 4250 * @returns {import('../types').OutputFileEntry<'idle'>} 4251 */ 4252 addFileFromObject = (e, { silent: t, fileName: s, source: r, fullPath: n } = {}) => { 4253 const o = this._uploadCollection.add({ 4254 file: e, 4255 isImage: Gl(e), 4256 mimeType: e.type, 4257 fileName: s ?? e.name, 4258 fileSize: e.size, 4259 silent: t ?? !1, 4260 source: r ?? Y.API, 4261 fullPath: n ?? null 4262 }); 4263 return this.getOutputItem(o); 4264 }; 4265 /** @param {string} internalId */ 4266 removeFileByInternalId = (e) => { 4267 if (!this._uploadCollection.read(e)) 4268 throw new Error(`File with internalId ${e} not found`); 4269 this._uploadCollection.remove(e); 4270 }; 4271 removeAllFiles() { 4272 this._uploadCollection.clearAll(); 4273 } 4274 uploadAll = () => { 4275 const e = this._uploadCollection.items().filter((t) => { 4276 const s = this._uploadCollection.read(t); 4277 return !s.getValue("isRemoved") && !s.getValue("isUploading") && !s.getValue("fileInfo"); 4278 }); 4279 e.length !== 0 && (this._ctx.$["*uploadTrigger"] = new Set(e), this._ctx.emit( 4280 z.COMMON_UPLOAD_START, 4281 /** @type {import('../types').OutputCollectionState<'uploading'>} */ 4282 this.getOutputCollectionState() 4283 )); 4284 }; 4285 /** @param {{ captureCamera?: boolean }} options */ 4286 openSystemDialog = (e = {}) => { 4287 const t = Oi( 4288 Lr([this.cfg.accept ?? "", ...this.cfg.imgOnly ? Ni : []]) 4289 ); 4290 this.cfg.accept && this.cfg.imgOnly && console.warn( 4291 "There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list." 4292 ); 4293 const s = "uploadcare-file-input", r = document.createElement("input"); 4294 r.setAttribute(s, ""), Si(r, { 4295 opacity: 0, 4296 height: 0, 4297 width: 0, 4298 visibility: "hidden" 4299 }), r.type = "file", r.multiple = this.cfg.multiple, e.captureCamera ? (r.capture = this.cfg.cameraCapture, r.accept = this.cfg.enableVideoRecording ? ["image/*", "video/*"].join(",") : "image/*") : r.accept = t, r.addEventListener( 4300 "change", 4301 () => {
4302 r.files && ([...r.files].forEach( 4303 (n) => this.addFileFromObject(n, { source: e.captureCamera ? Y.CAMERA : Y.LOCAL }) 4304 ), this._ctx.$["*currentActivity"] = O.activities.UPLOAD_LIST, this._ctx.setOrAddState("*modalActive", !0), r.remove()); 4305 }, 4306 { 4307 once: !0 4308 } 4309 ), document.querySelectorAll(`[${s}]`).forEach((n) => n.remove()), document.body.appendChild(r), r.dispatchEvent(new MouseEvent("click")); 4310 }; 4311 /** 4312 * @template {import('../types').OutputFileStatus} TStatus 4313 * @param {string} entryId 4314 * @returns {import('../types/exported.js').OutputFileEntry<TStatus>} 4315 */ 4316 getOutputItem = (e) => { 4317 const t = ( 4318 /** @type {import('./uploadEntrySchema.js').UploadEntry} */ 4319 $.getCtx(e).store 4320 ), s = t.fileInfo; 4321 let r = t.isRemoved ? "removed" : t.errors.length > 0 ? "failed" : t.fileInfo ? "success" : t.isUploading ? "uploading" : "idle"; 4322 return { 4323 uuid: s?.uuid ?? t.uuid ?? null, 4324 internalId: e, 4325 name: s?.originalFilename ?? t.fileName, 4326 size: s?.size ?? t.fileSize, 4327 isImage: s?.isImage ?? t.isImage, 4328 mimeType: s?.mimeType ?? t.mimeType, 4329 file: t.file, 4330 externalUrl: t.externalUrl, 4331 cdnUrlModifiers: t.cdnUrlModifiers, 4332 cdnUrl: t.cdnUrl ?? s?.cdnUrl ?? null, 4333 fullPath: t.fullPath, 4334 uploadProgress: t.uploadProgress, 4335 fileInfo: s ?? null, 4336 metadata: t.metadata ?? s?.metadata ?? null, 4337 isSuccess: r === "success", 4338 isUploading: r === "uploading", 4339 isFailed: r === "failed", 4340 isRemoved: r === "removed", 4341 errors: ( 4342 /** @type {import('../types/exported.js').OutputFileEntry['errors']} */ 4343 t.errors 4344 ), 4345 status: r, 4346 source: t?.source 4347 }; 4348 }; 4349 /** @template {import('../types').OutputCollectionStatus} TStatus */ 4350 getOutputCollectionState = () => ( 4351 /** @type {ReturnType<typeof buildOutputCollectionState<TStatus>>} */ 4352 Ql(this._ctx) 4353 ); 4354 /** @param {Boolean} [force] */ 4355 initFlow = (e = !1) => { 4356 if (this._uploadCollection.size > 0 && !e) 4357 this._ctx.set$({ 4358 "*currentActivity": O.activities.UPLOAD_LIST 4359 }), this._ctx.setOrAddState("*modalActive", !0); 4360 else if (this._sourceList?.length === 1) { 4361 const t = this._sourceList[0]; 4362 if (t === "local") { 4363 this._ctx.$["*currentActivity"] = O.activities.UPLOAD_LIST, this.openSystemDialog(); 4364 return; 4365 } 4366 const s = this._ctx.$["*blocksRegistry"], r = (o) => "type" in o && o.type === t; 4367 [...s].find(r)?.activate(), this._ctx.$["*currentActivity"] && this._ctx.setOrAddState("*modalActive", !0); 4368 } else 4369 this._ctx.set$({ 4370 "*currentActivity": O.activities.START_FROM 4371 }), this._ctx.setOrAddState("*modalActive", !0); 4372 }; 4373 doneFlow = () => { 4374 this._ctx.set$({ 4375 "*currentActivity": this._ctx.doneActivity, 4376 "*history": this._ctx.doneActivity ? [this._ctx.doneActivity] : [] 4377 }), this._ctx.$["*currentActivity"] || this._ctx.setOrAddState("*modalActive", !1); 4378 }; 4379 /** 4380 * @type {<T extends import('./ActivityBlock.js').ActivityType>( 4381 * activityType: T, 4382 * ...params: T extends keyof import('./ActivityBlock.js').ActivityParamsMap 4383 * ? [import('./ActivityBlock.js').ActivityParamsMap[T]] 4384 * : T extends import('./ActivityBlock.js').RegisteredActivityType 4385 * ? [undefined?] 4386 * : [any?] 4387 * ) => void} 4388 */ 4389 setCurrentActivity = (e, t = void 0) => { 4390 if (this._ctx.hasBlockInCtx((s) => s.activityType === e)) { 4391 this._ctx.set$({ 4392 "*currentActivityParams": t ?? {}, 4393 "*currentActivity": e 4394 }); 4395 return; 4396 } 4397 console.warn(`Activity type "${e}" not found in the context`); 4398 }; 4399 /** @returns {import('./ActivityBlock.js').ActivityType} */ 4400 getCurrentActivity = () => this._ctx.$["*currentActivity"]; 4401 /** @param {boolean} opened */ 4402 setModalState = (e) => { 4403 if (e && !this._ctx.$["*currentActivity"]) { 4404 console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`); 4405 return; 4406 } 4407 this._ctx.setOrAddState("*modalActive", e); 4408 }; 4409 /** 4410 * @private 4411 * @type {string[]} 4412 */ 4413 get _sourceList() { 4414 let e = []; 4415 return this.cfg.sourceList && (e = Me(this.cfg.sourceList)), e; 4416 } 4417} 4418const ec = (i, e) => { 4419 const t = e.cfg.imgOnly, s = i.isImage; 4420 if (!(!t || s) && !(!i.fileInfo && i.externalUrl) && !(!i.fileInfo && !i.mimeType)) 4421 return { 4422 type: "NOT_AN_IMAGE", 4423 message: e.l10n("images-only-accepted"), 4424 payload: { entry: i } 4425 }; 4426}, tc = (i, e) => { 4427 const t = e.cfg.imgOnly, s = e.cfg.accept, r = Lr([...t ? Ni : [], s]); 4428 if (!r.length) return; 4429 const n = i.mimeType, o = i.name; 4430 if (!n || !o) 4431 return; 4432 const a = Pr(n, r), l = jl(o, r); 4433 if (!a && !l) 4434 return { 4435 type: "FORBIDDEN_FILE_TYPE", 4436 message: e.l10n("file-type-not-allowed"), 4437 payload: { entry: i } 4438 }; 4439}, fe = 1e3, Fe = Object.freeze({ 4440 AUTO: "auto", 4441 BYTE: "byte", 4442 KB: "kb", 4443 MB: "mb", 4444 GB: "gb", 4445 TB: "tb", 4446 PB: "pb" 4447}), ot = (i) =>
4447 Math.ceil(i * 100) / 100, ic = (i, e = Fe.AUTO) => { 4448 const t = e === Fe.AUTO; 4449 if (e === Fe.BYTE || t && i < fe ** 1) { 4450 const s = ( 4451 /** @type {Extract<import('./getPluralForm').PluralForm, 'one' | 'other'>} */ 4452 ur("en-US", i) 4453 ), r = { 4454 one: "byte", 4455 other: "bytes" 4456 }[s]; 4457 return `${i} ${r}`; 4458 } 4459 return e === Fe.KB || t && i < fe ** 2 ? `${ot(i / fe ** 1)} KB` : e === Fe.MB || t && i < fe ** 3 ? `${ot(i / fe ** 2)} MB` : e === Fe.GB || t && i < fe ** 4 ? `${ot(i / fe ** 3)} GB` : e === Fe.TB || t && i < fe ** 5 ? `${ot(i / fe ** 4)} TB` : `${ot(i / fe ** 5)} PB`; 4460}, sc = (i, e) => { 4461 const t = e.cfg.maxLocalFileSizeBytes, s = i.size; 4462 if (t && s && s > t) 4463 return { 4464 type: "FILE_SIZE_EXCEEDED", 4465 message: e.l10n("files-max-size-limit-error", { maxFileSize: ic(t) }), 4466 payload: { entry: i } 4467 }; 4468}, rc = (i, e) => { 4469 const { internalId: t } = i, r = e._uploadCollection.read(t)?.getValue("uploadError"); 4470 if (!r) 4471 return; 4472 if (r instanceof ee) 4473 return { 4474 type: "UPLOAD_ERROR", 4475 message: r.message, 4476 payload: { 4477 entry: i, 4478 error: r 4479 } 4480 }; 4481 if (r instanceof vt) 4482 return { 4483 type: "NETWORK_ERROR", 4484 message: r.message, 4485 payload: { 4486 entry: i, 4487 error: r 4488 } 4489 }; 4490 const n = r instanceof Error ? r : new Error("Unknown error", { cause: r }); 4491 return { 4492 type: "UNKNOWN_ERROR", 4493 message: n.message, 4494 payload: { 4495 entry: i, 4496 error: n 4497 } 4498 }; 4499}, nc = (i, e) => { 4500 if (i.failedCount > 0) 4501 return { 4502 type: "SOME_FILES_HAS_ERRORS", 4503 message: e.l10n("some-files-were-not-uploaded") 4504 }; 4505}, oc = (i, e) => { 4506 const t = i.totalCount, s = e.cfg.multiple ? e.cfg.multipleMin : 0, r = e.cfg.multiple ? e.cfg.multipleMax : 1; 4507 if (s && t < s) 4508 return { 4509 type: "TOO_FEW_FILES", 4510 message: e.l10n("files-count-limit-error-too-few", { 4511 min: s, 4512 max: r, 4513 total: t 4514 }), 4515 payload: { 4516 total: t, 4517 min: s, 4518 max: r 4519 } 4520 }; 4521 if (r && t > r) 4522 return { 4523 type: "TOO_MANY_FILES", 4524 message: e.l10n("files-count-limit-error-too-many", { 4525 min: s, 4526 max: r, 4527 total: t 4528 }), 4529 payload: { 4530 total: t, 4531 min: s, 4532 max: r 4533 } 4534 }; 4535}, Ct = { 4536 file: "File validator execution has failed", 4537 collection: "Collection validator execution has failed", 4538 message: "Missing message. We recommend adding message: value." 4539}; 4540class ac { 4541 /** 4542 * @private 4543 * @type {import('./UploaderBlock.js').UploaderBlock} 4544 */ 4545 _blockInstance; 4546 /** @type {FuncFileValidator[]} */ 4547 _fileValidators = [ec, tc, sc, rc]; 4548 /** @type {FuncCollectionValidator[]} */ 4549 _collectionValidators = [oc, nc]; 4550 /** @param {import('./UploaderBlock.js').UploaderBlock} blockInstance */ 4551 constructor(e) { 4552 this._blockInstance = e, this._uploadCollection = this._blockInstance.uploadCollection; 4553 const t = () => { 4554 this.runFileValidators(), this.runCollectionValidators(); 4555 }; 4556 this._blockInstance.subConfigValue("maxLocalFileSizeBytes", t), this._blockInstance.subConfigValue("multipleMin", t), this._blockInstance.subConfigValue("multipleMax", t), this._blockInstance.subConfigValue("multiple", t), this._blockInstance.subConfigValue("imgOnly", t), this._blockInstance.subConfigValue("accept", t); 4557 } 4558 /** @param {string[]} [entryIds] */ 4559 runFileValidators(e) { 4560 const t = e ?? this._uploadCollection.items(); 4561 for (const s of t) { 4562 const r = this._uploadCollection.read(s); 4563 r && this._runFileValidatorsForEntry(r); 4564 } 4565 } 4566 runCollectionValidators() { 4567 const e = this._blockInstance.api.getOutputCollectionState(), t = []; 4568 for (const s of [ 4569 ...this._collectionValidators, 4570 ...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators) 4571 ]) 4572 try { 4573 const r = s(e, this._blockInstance.api); 4574 if (!r) 4575 continue; 4576 r && (t.push(r), r.message || console.warn(Ct.message)); 4577 } catch (r) { 4578 console.warn(Ct.collection, r); 4579 } 4580 this._blockInstance.$["*collectionErrors"] = t, t.length > 0 && this._blockInstance.emit( 4581 z.COMMON_UPLOAD_FAILED, 4582 () => ( 4583 /** @type {import('../types').OutputCollectionState<'failed'>} */ 4584 this._blockInstance.api.getOutputCollectionState() 4585 ), 4586 { debounce: !0 } 4587 ); 4588 } 4589 /** 4590 * @private 4591 * @param {import('./TypedData.js').TypedData}
4591 entry 4592 */ 4593 _runFileValidatorsForEntry(e) { 4594 const t = this._blockInstance.api.getOutputItem(e.uid), s = []; 4595 for (const r of [ 4596 ...this._fileValidators, 4597 ...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators) 4598 ]) 4599 try { 4600 const n = r(t, this._blockInstance.api); 4601 if (!n) 4602 continue; 4603 n && (s.push(n), n.message || console.warn(Ct.message)); 4604 } catch (n) { 4605 console.warn(Ct.file, n); 4606 } 4607 e.setValue("errors", s); 4608 } 4609 /** 4610 * @template T 4611 * @param {T[]} validators 4612 * @returns {T[]} 4613 */ 4614 _addCustomTypeToValidators(e) { 4615 return e.map((t) => (...s) => { 4616 const r = t(...s); 4617 return r ? { ...r, type: "CUSTOM_ERROR" } : void 0; 4618 }); 4619 } 4620} 4621const lc = Object.freeze({ 4622 file: { 4623 type: File, 4624 value: null 4625 }, 4626 externalUrl: { 4627 type: String, 4628 value: null 4629 }, 4630 fileName: { 4631 type: String, 4632 value: null, 4633 nullable: !0 4634 }, 4635 fileSize: { 4636 type: Number, 4637 value: null, 4638 nullable: !0 4639 }, 4640 lastModified: { 4641 type: Number, 4642 value: Date.now() 4643 }, 4644 uploadProgress: { 4645 type: Number, 4646 value: 0 4647 }, 4648 uuid: { 4649 type: String, 4650 value: null 4651 }, 4652 isImage: { 4653 type: Boolean, 4654 value: !1 4655 }, 4656 mimeType: { 4657 type: String, 4658 value: null, 4659 nullable: !0 4660 }, 4661 ctxName: { 4662 type: String, 4663 value: null 4664 }, 4665 cdnUrl: { 4666 type: String, 4667 value: null 4668 }, 4669 cdnUrlModifiers: { 4670 type: String, 4671 value: null 4672 }, 4673 fileInfo: { 4674 type: Di, 4675 value: null 4676 }, 4677 isUploading: { 4678 type: Boolean, 4679 value: !1 4680 }, 4681 abortController: { 4682 type: AbortController, 4683 value: null, 4684 nullable: !0 4685 }, 4686 thumbUrl: { 4687 type: String, 4688 value: null, 4689 nullable: !0 4690 }, 4691 silent: { 4692 type: Boolean, 4693 value: !1 4694 }, 4695 source: { 4696 type: String, 4697 value: !1, 4698 nullable: !0 4699 }, 4700 fullPath: { 4701 type: String, 4702 value: null, 4703 nullable: !0 4704 }, 4705 metadata: { 4706 type: Object, 4707 value: null, 4708 nullable: !0 4709 }, 4710 errors: { 4711 type: Array, 4712 value: [] 4713 }, 4714 uploadError: { 4715 type: Error, 4716 value: null, 4717 nullable: !0 4718 }, 4719 isRemoved: { 4720 type: Boolean, 4721 value: !1 4722 } 4723}); 4724class X extends O { 4725 /** @protected */ 4726 couldBeCtxOwner = !1; 4727 /** @private */ 4728 isCtxOwner = !1; 4729 init$ = Ir(this); 4730 /** @private */ 4731 get hasCtxOwner() { 4732 return this.hasBlockInCtx((e) => e instanceof X ? e.isCtxOwner && e.isConnected && e !== this : !1); 4733 } 4734 /** @protected */ 4735 initCallback() { 4736 if (super.initCallback(), !this.has("*uploadCollection")) { 4737 let e = new Hl({ 4738 typedSchema: lc, 4739 watchList: ["uploadProgress", "uploadError", "fileInfo", "errors", "cdnUrl", "isUploading"] 4740 }); 4741 this.add("*uploadCollection", e); 4742 } 4743 this.has("*publicApi") || this.add("*publicApi", new Jl(this)), this.has("*validationManager") || this.add("*validationManager", new ac(this)), !this.hasCtxOwner && this.couldBeCtxOwner && this.initCtxOwner(); 4744 } 4745 /** 4746 * @returns {ValidationManager} 4747 * @protected 4748 */ 4749 get validationManager() { 4750 if (!this.has("*validationManager")) 4751 throw new Error("Unexpected error: ValidationManager is not initialized"); 4752 return this.$["*validationManager"]; 4753 } 4754 /** @returns {UploaderPublicApi} */ 4755 get api() { 4756 if (!this.has("*publicApi")) 4757 throw new Error("Unexpected error: UploaderPublicApi is not initialized"); 4758 return this.$["*publicApi"]; 4759 } 4760 getAPI() { 4761 return this.api; 4762 } 4763 /** @returns {TypedCollection} */ 4764 get uploadCollection() { 4765 if (!this.has("*uploadCollection")) 4766 throw new Error("Unexpected error: TypedCollection is not initialized"); 4767 return this.$["*uploadCollection"]; 4768 } 4769 /** @protected */ 4770 destroyCtxCallback() { 4771 this._unobserveCollectionProperties?.(), this._unobserveCollection?.(), this.uploadCollection.destroy(), this.$["*uploadCollection"] = null, super.destroyCtxCallback(); 4772 } 4773 /** @private */ 4774 initCtxOwner() { 4775 this.isCtxOwner = !0, this._unobserveCollection = this.uploadCollection.observeCollection(this._handleCollectionUpdate), this._unobserveCollectionProperties = this.uploadCollection.observeProperties( 4776 this._handleCollectionPropertiesUpdate 4777 ), this.subConfigValue("maxConcurrentRequests", (e) => { 4778 this.$["*uploadQueue"].concurrency = Number(e) || 1; 4779 }), this.$["*secureUploadsManager"] || (this.$["*secureUploadsManager"] = new Bl(this)), this.has("*modalActive") && this.sub("*modalActive", (e) => { 4780 e && !this.$["*currentActivity"] && (this.$["*modalActive"] = !1); 4781 }); 4782 } 4783 /** 4784 * @private 4785 * @param {import('../types').OutputCollectionState} collectionState 4786 */ 4787 async _createGroup(e) { 4788 const t = await this.getUploadClientOptions(), s = e.allEntries.map((a) => a.uuid + (a.cdnUrlModifiers ? `/${a.cdnUrlModifiers}` : "")), r = new AbortController(), n = await el(s, { ...t, signal: r.signal }); 4789 if (this.$["*collectionState"] !== e) { 4790 r.abort(); 4791 return; 4792 } 4793 this.$["*groupInfo"] = n; 4794 const o = ( 4795 /** @type {import('../types').OutputCollectionState<'success', 'has-group'>} */ 4796 this.api.getOutputCollectionState() 4797 );
4798 this.emit(z.GROUP_CREATED, o), this.emit(z.CHANGE, () => this.api.getOutputCollectionState(), { debounce: !0 }), this.$["*collectionState"] = o; 4799 } 4800 /** @private */ 4801 _flushOutputItems = le(async () => { 4802 if (this.getOutputData().length !== this.uploadCollection.size) 4803 return; 4804 const t = this.api.getOutputCollectionState(); 4805 this.$["*collectionState"] = t, this.emit(z.CHANGE, () => this.api.getOutputCollectionState(), { debounce: !0 }), this.cfg.groupOutput && t.totalCount > 0 && t.status === "success" && this._createGroup(t); 4806 }, 300); 4807 /** 4808 * @private 4809 * @type {Parameters<import('./TypedCollection.js').TypedCollection['observeCollection']>[0]} 4810 * @param {Set<import('./TypedData.js').TypedData>} removed 4811 */ 4812 _handleCollectionUpdate = (e, t, s) => { 4813 (t.size || s.size) && (this.$["*groupInfo"] = null), this.validationManager.runFileValidators(), this.validationManager.runCollectionValidators(); 4814 for (const r of t) 4815 r.getValue("silent") || this.emit(z.FILE_ADDED, this.api.getOutputItem(r.uid)); 4816 for (const r of s) 4817 this.$["*uploadTrigger"].delete(r.uid), r.getValue("abortController")?.abort(), r.setMultipleValues({ 4818 isRemoved: !0, 4819 abortController: null, 4820 isUploading: !1, 4821 uploadProgress: 0 4822 }), URL.revokeObjectURL(r?.getValue("thumbUrl")), this.emit(z.FILE_REMOVED, this.api.getOutputItem(r.uid)); 4823 this.$["*uploadList"] = e.map((r) => ({ uid: r })), this._flushCommonUploadProgress(), this._flushOutputItems(); 4824 }; 4825 /** 4826 * @private 4827 * @param {Record<keyof import('./uploadEntrySchema.js').UploadEntry, Set<string>>} changeMap 4828 */ 4829 _handleCollectionPropertiesUpdate = (e) => { 4830 this._flushOutputItems(); 4831 const t = this.uploadCollection, s = [ 4832 ...new Set( 4833 Object.entries(e).filter(([r]) => ["uploadError", "fileInfo"].includes(r)).map(([, r]) => [...r]).flat() 4834 ) 4835 ]; 4836 if (s.length > 0 && setTimeout(() => { 4837 this.validationManager.runFileValidators(s); 4838 }), e.uploadProgress) { 4839 for (const r of e.uploadProgress) { 4840 const { isUploading: n, silent: o } = $.getCtx(r).store; 4841 n && !o && this.emit(z.FILE_UPLOAD_PROGRESS, this.api.getOutputItem(r)); 4842 } 4843 this._flushCommonUploadProgress(); 4844 } 4845 if (e.isUploading) 4846 for (const r of e.isUploading) { 4847 const { isUploading: n, silent: o } = $.getCtx(r).store; 4848 n && !o && this.emit(z.FILE_UPLOAD_START, this.api.getOutputItem(r)); 4849 } 4850 if (e.fileInfo) { 4851 for (const r of e.fileInfo) { 4852 const { fileInfo: n, silent: o } = $.getCtx(r).store; 4853 n && !o && this.emit(z.FILE_UPLOAD_SUCCESS, this.api.getOutputItem(r)); 4854 } 4855 this.cfg.cropPreset && this.setInitialCrop(); 4856 } 4857 if (e.errors) { 4858 for (const o of e.errors) { 4859 const { errors: a } = $.getCtx(o).store; 4860 a.length >
4860 0 && (this.emit(z.FILE_UPLOAD_FAILED, this.api.getOutputItem(o)), this.emit( 4861 z.COMMON_UPLOAD_FAILED, 4862 () => ( 4863 /** @type {import('../types').OutputCollectionState<'failed'>} */ 4864 this.api.getOutputCollectionState() 4865 ), 4866 { debounce: !0 } 4867 )); 4868 } 4869 const r = t.findItems((o) => !!o.getValue("fileInfo")), n = t.findItems((o) => o.getValue("errors").length > 0); 4870 t.size > 0 && n.length === 0 && t.size === r.length && this.$["*collectionErrors"].length === 0 && this.emit( 4871 z.COMMON_UPLOAD_SUCCESS, 4872 /** @type {import('../types').OutputCollectionState<'success'>} */ 4873 this.api.getOutputCollectionState() 4874 ); 4875 } 4876 e.cdnUrl && ([...e.cdnUrl].filter((n) => !!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach((n) => { 4877 this.emit(z.FILE_URL_CHANGED, this.api.getOutputItem(n)); 4878 }), this.$["*groupInfo"] = null); 4879 }; 4880 /** @private */ 4881 _flushCommonUploadProgress = () => { 4882 let e = 0; 4883 const s = [...this.$["*uploadTrigger"]].filter((n) => !!this.uploadCollection.read(n));
4884 s.forEach((n) => { 4885 const o = this.uploadCollection.readProp(n, "uploadProgress"); 4886 e += o; 4887 }); 4888 const r = s.length ? Math.round(e / s.length) : 0; 4889 this.$["*commonProgress"] !== r && (this.$["*commonProgress"] = r, this.emit( 4890 z.COMMON_UPLOAD_PROGRESS, 4891 /** @type {import('../types').OutputCollectionState<'uploading'>} */ 4892 this.api.getOutputCollectionState() 4893 )); 4894 }; 4895 /** @private */ 4896 setInitialCrop() { 4897 const e = Or(this.cfg.cropPreset); 4898 if (e) { 4899 const [t] = e, s = this.uploadCollection.findItems( 4900 (r) => r.getValue("fileInfo") && r.getValue("isImage") && !r.getValue("cdnUrlModifiers")?.includes("/crop/") 4901 ).map((r) => this.uploadCollection.read(r)); 4902 for (const r of s) { 4903 const n = r.getValue("fileInfo"), { width: o, height: a } = n.imageInfo, l = t.width / t.height, c = $l(o, a, l), u = Ue( 4904 `crop/${c.width}x${c.height}/${c.x},${c.y}`, 4905 "preview" 4906 ); 4907 r.setMultipleValues({ 4908 cdnUrlModifiers: u, 4909 cdnUrl: ae(r.getValue("cdnUrl"), u) 4910 }), this.uploadCollection.size === 1 && this.cfg.useCloudImageEditor && this.hasBlockInCtx((d) => d.activityType === O.activities.CLOUD_IMG_EDIT) && (this.$["*currentActivityParams"] = { 4911 internalId: r.uid 4912 }, this.$["*currentActivity"] = O.activities.CLOUD_IMG_EDIT); 4913 } 4914 } 4915 } 4916 /** 4917 * @param {string} entryId 4918 * @protected 4919 */ 4920 async getMetadataFor(e) { 4921 const t = this.cfg.metadata || void 0; 4922 if (typeof t == "function") { 4923 const s = this.api.getOutputItem(e); 4924 return await t(s); 4925 } 4926 return t; 4927 } 4928 /** 4929 * @returns {Promise<import('@uploadcare/upload-client').FileFromOptions>} 4930 * @protected 4931 */ 4932 async getUploadClientOptions() { 4933 const t = await this.$["*secureUploadsManager"].getSecureToken().catch(() => null); 4934 return { 4935 store: this.cfg.store, 4936 publicKey: this.cfg.pubkey, 4937 baseCDN: this.cfg.cdnCname, 4938 baseURL: this.cfg.baseUrl, 4939 userAgent: Fl, 4940 integration: this.cfg.userAgentIntegration, 4941 secureSignature: t?.secureSignature, 4942 secureExpire: t?.secureExpire, 4943 retryThrottledRequestMaxTimes: this.cfg.retryThrottledRequestMaxTimes, 4944 multipartMinFileSize: this.cfg.multipartMinFileSize, 4945 multipartChunkSize: this.cfg.multipartChunkSize, 4946 maxConcurrentRequests: this.cfg.multipartMaxConcurrentRequests, 4947 multipartMaxAttempts: this.cfg.multipartMaxAttempts, 4948 checkForUrlDuplicates: !!this.cfg.checkForUrlDuplicates, 4949 saveUrlForRecurrentUploads: !!this.cfg.saveUrlForRecurrentUploads 4950 }; 4951 } 4952 /** @returns {import('../types/exported.js').OutputFileEntry[]} */ 4953 getOutputData() { 4954 return this.uploadCollection.items().map((s) => this.api.getOutputItem(s)); 4955 } 4956} 4957X.extSrcList = Object.freeze({ 4958 ...qt 4959}); 4960X.sourceTypes = Object.freeze({ 4961 ...Y 4962}); 4963const Zt = (i) => i.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map((e) => e.toLowerCase()).join("-"), j = (i) => String(i), se = (i) => { 4964 const e = Number(i); 4965 if (Number.isNaN(e)) 4966 throw new Error(`Invalid number: "${i}"`); 4967 return e; 4968}, N = (i) => { 4969 if (typeof i > "u" || i === null) return !1; 4970 if (typeof i == "boolean") return i; 4971 if (i === "true" || i === "") return !0; 4972 if (i === "false") return !1; 4973 throw new Error(`Invalid boolean: "${i}"`); 4974}, cc = (i) => i === "auto" ? i : N(i), uc = (i) => { 4975 const e = j(i); 4976 if (e !== "user" && e !== "environment" && e !== "") 4977 throw new Error(`Invalid "cameraCapture" value: "${e}"`); 4978 return e; 4979}, dc = (i) => { 4980 const e = j(i); 4981 if (e !== "photo" && e !== "video") 4982 throw new Error(`Invalid "CameraTab" value: "${e}"`); 4983 return e; 4984}, hc = (i) => { 4985 if (typeof i == "object" && !Array.isArray(i) || typeof i == "function") 4986 return ( 4987 /** @type {import('../../types').MetadataCallback} */ 4988 i 4989 ); 4990 throw new Error("Invalid metadata value. Must be an object or function."); 4991}, Is = (i) => { 4992 if (typeof i == "object") 4993 return ( 4994 /** @type {T} */ 4995 i 4996 ); 4997 throw new Error("Invalid value. Must be an object."); 4998}, ci = (i) => { 4999 if (typeof i == "function") 5000 return ( 5001 /** @type {T} */ 5002 i 5003 ); 5004 throw new Error("Invalid value. Must be a function."); 5005}, Ss = (i) => { 5006 if (Array.isArray(i)) 5007 return ( 5008 /** @type {T} */ 5009 i 5010 );
5011 throw new Error("Must be an array."); 5012}, fc = { 5013 pubkey: j, 5014 multiple: N, 5015 multipleMin: se, 5016 multipleMax: se, 5017 confirmUpload: N, 5018 imgOnly: N, 5019 accept: j, 5020 externalSourcesPreferredTypes: j, 5021 externalSourcesEmbedCss: j, 5022 store: cc, 5023 cameraMirror: N, 5024 cameraCapture: uc, 5025 sourceList: j, 5026 maxLocalFileSizeBytes: se, 5027 thumbSize: se, 5028 showEmptyList: N, 5029 useLocalImageEditor: N, 5030 useCloudImageEditor: N, 5031 cloudImageEditorTabs: j, 5032 removeCopyright: N, 5033 cropPreset: j, 5034 imageShrink: j, 5035 modalScrollLock: N, 5036 modalBackdropStrokes: N, 5037 sourceListWrap: N, 5038 remoteTabSessionKey: j, 5039 cdnCname: j, 5040 baseUrl: j, 5041 socialBaseUrl: j, 5042 secureSignature: j, 5043 secureExpire: j, 5044 secureDeliveryProxy: j, 5045 retryThrottledRequestMaxTimes: se, 5046 multipartMinFileSize: se, 5047 multipartChunkSize: se, 5048 maxConcurrentRequests: se, 5049 multipartMaxConcurrentRequests: se, 5050 multipartMaxAttempts: se, 5051 checkForUrlDuplicates: N, 5052 saveUrlForRecurrentUploads: N, 5053 groupOutput: N, 5054 userAgentIntegration: j, 5055 debug: N, 5056 localeName: j, 5057 metadata: hc, 5058 secureUploadsExpireThreshold: se, 5059 localeDefinitionOverride: ( 5060 /** @type {typeof asObject<import('../../types').LocaleDefinitionOverride>} */ 5061 Is 5062 ), 5063 secureUploadsSignatureResolver: ( 5064 /** @type {typeof asFunction<import('../../types').SecureUploadsSignatureResolver>} */ 5065 ci 5066 ), 5067 secureDeliveryProxyUrlResolver: ( 5068 /** @type {typeof asFunction<import('../../types').SecureDeliveryProxyUrlResolver>} */ 5069 ci 5070 ), 5071 iconHrefResolver: ( 5072 /** @type {typeof asFunction<import('../../types').IconHrefResolver>} */ 5073 ci 5074 ), 5075 fileValidators: ( 5076 /** @type {typeof asArray<import('../../types').FileValidators>} */ 5077 Ss 5078 ), 5079 collectionValidators: ( 5080 /** @type {typeof asArray<import('../../types').CollectionValidators>} */ 5081 Ss 5082 ), 5083 defaultCameraMode: dc, 5084 enableAudioRecording: N, 5085 enableVideoRecording: N, 5086 mediaRecorerOptions: Is, 5087 maxVideoRecordingDuration: se 5088}, pc = (i, e) => { 5089 if (!(typeof e > "u" || e === null)) 5090 try { 5091 return fc[i](e); 5092 } catch (t) { 5093 return console.error(`Invalid value for config key "${i}".`, t), xe[i]; 5094 } 5095}, Bi = ( 5096 /** @type {(keyof import('../../types').ConfigType)[]} */ 5097 [ 5098 // "debug" option should go first to be able to print debug messages from the very beginning 5099 .../* @__PURE__ */ new Set(["debug", ...Object.keys(xe)]) 5100 ] 5101), mc = [ 5102 "metadata", 5103 "localeDefinitionOverride", 5104 "secureUploadsSignatureResolver", 5105 "secureDeliveryProxyUrlResolver", 5106 "iconHrefResolver", 5107 "fileValidators", 5108 "collectionValidators", 5109 "mediaRecorerOptions" 5110], gc = (i) => mc.includes(i), et = ( 5111 /** @type {(keyof import('../../types').ConfigPlainType)[]} */ 5112 Bi.filter((i) => !gc(i)) 5113), bc = ( 5114 /** @type {Record<keyof import('../../types').ConfigAttributesType, keyof import('../../types').ConfigPlainType>} */ 5115 { 5116 ...Object.fromEntries(et.map((i) => [Zt(i), i])), 5117 ...Object.fromEntries(et.map((i) => [i.toLowerCase(), i])) 5118 } 5119), vc = ( 5120 /** @type {Record<keyof import('../../types').ConfigAttributesType, string>} */ 5121 { 5122 ...Object.fromEntries(et.map((i) => [Zt(i), oe(i)])), 5123 ...Object.fromEntries(et.map((i) => [i.toLowerCase(), oe(i)])) 5124 } 5125), ks = (i) => "__" + i; 5126class Vi extends B { 5127 requireCtxName = !0; 5128 constructor() { 5129 super(), this.init$ = { 5130 ...this.init$, 5131 ...Object.fromEntries( 5132 Object.entries(xe).map(([e, t]) => [ 5133 oe( 5134 /** @type {keyof import('../../types').ConfigType} */ 5135 e 5136 ), 5137 t 5138 ]) 5139 ) 5140 }; 5141 } 5142 /** 5143 * @private 5144 * @param {keyof import('../../types').ConfigType} key 5145 * @param {unknown} value 5146 */ 5147 _flushValueToAttribute(e, t) { 5148 if (et.includes(e)) { 5149 const s = [.../* @__PURE__ */ new Set([Zt(e), e.toLowerCase()])]; 5150 for (const r of s) 5151 typeof t > "u" || t === null ? this.removeAttribute(r) : this.getAttribute(r) !== t.toString() && this.setAttribute(r, t.toString()); 5152 } 5153 } 5154 /** 5155 * @private 5156 * @param {keyof import('../../types').ConfigType} key 5157 * @param {unknown} value 5158 */ 5159 _flushValueToState(e, t) { 5160 this.$[oe(e)] !== t && (typeof t > "u" || t === null ? this.$[oe(e)] = xe[e] : this.$[oe(e)] = t); 5161 } 5162 /** 5163 * @private 5164 * @param {keyof import('../../types').ConfigType} key 5165 * @param {unknown} value 5166 */ 5167 _setValue(e, t) { 5168 const s = ( 5169 /** @type {typeof this & any} */ 5170 this 5171 ), r = pc(e, t), n = ks(e);
5172 s[n] !== r && (this._assertSameValueDifferentReference(e, s[n], r), s[n] = r, this._flushValueToAttribute(e, r), this._flushValueToState(e, r), this.debugPrint(`[uc-config] "${e}"`, r)); 5173 } 5174 /** 5175 * @private 5176 * @param {keyof import('../../types').ConfigType} key 5177 */ 5178 _getValue(e) { 5179 const t = ( 5180 /** @type {typeof this & any} */ 5181 this 5182 ), s = ks(e); 5183 return t[s]; 5184 } 5185 /** 5186 * @param {string} key 5187 * @param {unknown} previousValue 5188 * @param {unknown} nextValue 5189 */ 5190 _assertSameValueDifferentReference(e, t, s) { 5191 this.cfg.debug && s !== t && typeof s == "object" && typeof t == "object" && JSON.stringify(s) === JSON.stringify(t) && (console.warn( 5192 `[uc-config] Option "${e}" value is the same as the previous one but the reference is different` 5193 ), console.warn( 5194 "[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations" 5195 ), console.warn(`[uc-config] "${e}" previous value:`, t), console.warn(`[uc-config] "${e}" new value:`, s)); 5196 } 5197 initCallback() { 5198 super.initCallback(); 5199 const e = ( 5200 /** @type {typeof this & any} */ 5201 this 5202 ); 5203 for (const t of et) 5204 this.sub( 5205 oe(t), 5206 (s) => { 5207 this._setValue(t, s); 5208 }, 5209 !1 5210 ); 5211 for (const t of Bi) { 5212 const s = e[t] ?? this.$[oe(t)]; 5213 s !== xe[t] && this._setValue(t, s), Object.defineProperty(this, t, { 5214 /** @param {unknown} value */ 5215 set: (r) => { 5216 this._setValue(t, r); 5217 }, 5218 get: () => this._getValue(t) 5219 }); 5220 } 5221 } 5222 /** 5223 * @param {keyof typeof attrStateMapping} name 5224 * @param {string} oldVal 5225 * @param {string} newVal 5226 */ 5227 attributeChangedCallback(e, t, s) { 5228 if (t === s) return; 5229 const r = ( 5230 /** @type {typeof this & any} */ 5231 this 5232 ), n = bc[e]; 5233 r[n] = s; 5234 } 5235} 5236Vi.bindAttributes(vc); 5237for (const i of Bi) 5238 Vi.prototype[i] = void 0; 5239const _c = ( 5240 /** @type {Config} */ 5241 /** @type {unknown} */ 5242 Vi 5243); 5244class zi extends B { 5245 constructor() { 5246 super(), this.init$ = { 5247 ...this.init$, 5248 name: "", 5249 href: "" 5250 }; 5251 } 5252 initCallback() { 5253 super.initCallback(), this.sub("name", (e) => { 5254 if (!e) 5255 return; 5256 let t = `#uc-icon-${e}`; 5257 this.subConfigValue("iconHrefResolver", (s) => { 5258 s && (t = s(e) ?? t), this.$.href = t; 5259 }); 5260 }); 5261 } 5262} 5263zi.template = /* HTML */ 5264` 5265 <svg ref="svg" xmlns="http://www.w3.org/2000/svg"> 5266 <use set="@href: href;"></use> 5267 </svg> 5268`; 5269zi.bindAttributes({ 5270 name: "name" 5271}); 5272const yc = (i) => [...new Set(i)], Ac = (i) => Object.entries(i).filter(([e, t]) => t !== void 0 && t !== "").map(([e, t]) => e === "cdn-operations" || e === "analytics" ? t : `${e}/${t}`), wc = "https://ucarecdn.com", Dt = Object.freeze({ 5273 "dev-mode": {}, 5274 pubkey: {}, 5275 uuid: {}, 5276 src: {}, 5277 // alt: {}, 5278 // 'placeholder-src': {}, // available via CSS 5279 lazy: { 5280 default: 1 5281 }, 5282 intersection: {}, 5283 breakpoints: { 5284 // '200, 300, 400' 5285 }, 5286 "cdn-cname": { 5287 default: wc 5288 }, 5289 "proxy-cname": {}, 5290 "secure-delivery-proxy": {}, 5291 "hi-res-support": { 5292 default: 1 5293 }, 5294 "ultra-res-support": {}, 5295 // ? 5296 format: {}, 5297 "cdn-operations": {}, 5298 progressive: {}, 5299 quality: {}, 5300 "is-background-for": {}, 5301 "is-preview-blur": { 5302 default: 1 5303 } 5304}), ut = "--uc-img-", xs = "unresolved", Et = 2, Tt = 3, Os = !window.location.host.trim() || window.location.host.includes(":") || window.location.hostname.includes("localhost"), Ls = 3e3, Ps = 5e3, Us = Object.freeze({ 5305 PREVIEW: "PREVIEW", 5306 MAIN: "MAIN" 5307}), Ur = /* @__PURE__ */ Object.create(null); 5308for (let i in Dt) 5309 Ur[ut + i] = Dt[i]?.default || ""; 5310class Cc extends bt { 5311 cssInit$ = Ur; 5312 /** 5313 * @param {String} key 5314 * @returns {any} 5315 */ 5316 $$(e) { 5317 return this.$[ut + e]; 5318 } 5319 /** @param {Object<String, String | Number>} kvObj */ 5320 set$$(e) { 5321 for (let t in e) 5322 this.$[ut + t] = e[t]; 5323 } 5324 /** 5325 * @param {String} key 5326 * @param {(val: any) => void} kbFn 5327 */ 5328 sub$$(e, t) { 5329 this.sub(ut + e, (s) => { 5330 s === null || s === "" || t(s); 5331 }); 5332 } 5333 analyticsParams() { 5334 return `-/@clib/${Wt}/${Kt}/uc-img/`; 5335 } 5336 initAttributes(e) {
5337 [...this.attributes].forEach((t) => { 5338 Dt[t.name] || e.setAttribute(t.name, t.value); 5339 }); 5340 } 5341 /** 5342 * @param {HTMLElement} el 5343 * @param {() => void} cbkFn 5344 */ 5345 initIntersection(e, t) { 5346 let s = { 5347 root: null, 5348 rootMargin: "0px" 5349 }; 5350 this._isnObserver = new IntersectionObserver((r) => { 5351 r.forEach((n) => { 5352 n.isIntersecting && (t(), this._isnObserver.unobserve(e)); 5353 }); 5354 }, s), this._isnObserver.observe(e), this._observed || (this._observed = /* @__PURE__ */ new Set()), this._observed.add(e); 5355 } 5356 destroyCallback() { 5357 super.destroyCallback(), this._isnObserver && (this._observed.forEach((e) => { 5358 this._isnObserver.unobserve(e); 5359 }), this._isnObserver = null), $.deleteCtx(this); 5360 } 5361 static get observedAttributes() { 5362 return Object.keys(Dt); 5363 } 5364 attributeChangedCallback(e, t, s) { 5365 window.setTimeout(() => { 5366 this.$[ut + e] = s; 5367 }); 5368 } 5369} 5370class Ec extends Cc { 5371 _img = new Image(); 5372 _imgPreview = new Image(); 5373 /** 5374 * @private 5375 * @param {String} src 5376 */ 5377 _fmtAbs(e) { 5378 return !e.includes("//") && !Os && (e = new URL(e, document.baseURI).href), e; 5379 } 5380 /** 5381 * Validate size 5382 * 5383 * @param {String} [size] 5384 * @returns {String | Number} 5385 */ 5386 _validateSize(e) { 5387 if (e?.trim() !== "") { 5388 let t = e.match(/\d+/)[0], s = e.match(/[a-zA-Z]+/)[0]; 5389 const r = parseInt(t, 10); 5390 if (Number(r) > Ps && this.hasFormatJPG) 5391 return Ps + s; 5392 if (Number(r) > Ls && !this.hasFormatJPG) 5393 return Ls + s; 5394 } 5395 return e; 5396 } 5397 /** 5398 * Image operations 5399 * 5400 * @param {String} [size] 5401 * @param {String} [blur] 5402 */ 5403 _getCdnModifiers(e, t) { 5404 const s = { 5405 format: this.$$("format"), 5406 quality: this.$$("quality"), 5407 resize: this._validateSize(e), 5408 blur: t, 5409 "cdn-operations": this.$$("cdn-operations"), 5410 analytics: this.analyticsParams() 5411 }; 5412 return Ue(...Ac(s)); 5413 } 5414 /** 5415 * @private 5416 * @param {String} [size] 5417 * @param {String} [blur] 5418 * @returns {any} 5419 */ 5420 _getUrlBase(e = "", t = "") { 5421 if (this.$$("src").startsWith("data:") || this.$$("src").startsWith("blob:")) 5422 return this.$$("src"); 5423 if (Os && this.$$("src") && !this.$$("src").includes("//")) 5424 return this._proxyUrl(this.$$("src")); 5425 let s = this._getCdnModifiers(e, t); 5426 if (this.$$("src").startsWith(this.$$("cdn-cname"))) 5427 return ae(this.$$("src"), s); 5428 if (this.$$("cdn-cname") && this.$$("uuid")) 5429 return this._proxyUrl( 5430 ae( 5431 // 5432 ft(this.$$("cdn-cname"), this.$$("uuid")), 5433 s 5434 ) 5435 ); 5436 if (this.$$("uuid")) 5437 return this._proxyUrl( 5438 ae( 5439 // 5440 ft(this.$$("cdn-cname"), this.$$("uuid")), 5441 s 5442 ) 5443 ); 5444 if (this.$$("proxy-cname")) 5445 return this._proxyUrl( 5446 ae( 5447 // 5448 this.$$("proxy-cname"), 5449 s, 5450 this._fmtAbs(this.$$("src")) 5451 ) 5452 ); 5453 if (this.$$("pubkey")) 5454 return this._proxyUrl( 5455 ae( 5456 // 5457 `https://${this.$$("pubkey")}.ucr.io/`, 5458 s, 5459 this._fmtAbs(this.$$("src")) 5460 ) 5461 ); 5462 } 5463 /** 5464 * @private 5465 * @param {String} url 5466 * @returns {String} 5467 */ 5468 _proxyUrl(e) { 5469 return this.$$("secure-delivery-proxy") ? vi( 5470 this.$$("secure-delivery-proxy"), 5471 { previewUrl: e }, 5472 { transform: (s) => window.encodeURIComponent(s) } 5473 ) : e; 5474 } 5475 /** 5476 * @param {HTMLElement} el 5477 * @param {Number} [k] 5478 * @param {Boolean} [wOnly] 5479 */ 5480 _getElSize(e, t = 1, s = !0) { 5481 let r = e.getBoundingClientRect(), n = t * Math.round(r.width), o = s ? "" : t * Math.round(r.height); 5482 return n || o ? `${n || ""}x${o || ""}` : null; 5483 } 5484 /** @param {HTMLImageElement} img */ 5485 _setupEventProxy(e) { 5486 let t = (r) => { 5487 r.stopPropagation(); 5488 let n = new Event(r.type, r); 5489 this.dispatchEvent(n); 5490 }, s = ["load", "error"]; 5491 for (let r of s) 5492 e.addEventListener(r, t); 5493 } 5494 /** @type {HTMLImageElement} */ 5495 get img() { 5496 return this.hasPreviewImage || (this._setupConfigForImage({ elNode: this._img }), this.appendChild(this._img)), this._img; 5497 } 5498 get currentImg() { 5499 return this.hasPreviewImage ? { 5500 type: Us.PREVIEW, 5501 img: this._imgPreview 5502 } : { 5503 type: Us.MAIN, 5504 img: this.img 5505 }; 5506 } 5507 get hasPreviewImage() { 5508 return this.$$("is-preview-blur"); 5509 } 5510 get bgSelector() { 5511 return this.$$("is-background-for"); 5512 } 5513 get breakpoints() { 5514 if (this.$$("breakpoints")) { 5515 const e = Me(this.$$("breakpoints")); 5516 return yc(e.map((t) => parseInt(t, 10))); 5517 } else 5518 return null; 5519 } 5520 get hasFormatJPG() { 5521 return this.$$("format").toLowerCase() === "jpeg"; 5522 } 5523 /** @param {HTMLElement} el */ 5524 renderBg(e) { 5525 let t = /* @__PURE__ */ new Set(); 5526 t.add(`url("${this._getUrlBase(this._getElSize(e))}") 1x`), this.$$("hi-res-support") && t.add(`url("${this._getUrlBase(this._getElSize(e, Et))}") ${Et}x`), this.$$("ultra-res-support") && t.add(`url("${this._getUrlBase(this._getElSize(e, Tt))}") ${Tt}x`); 5527 let s = `image-set(${[...t].join(", ")})`; 5528 e.style.setProperty("background-image", s), e.style.setProperty("background-image", "-webkit-" + s); 5529 } 5530 getSrcset() { 5531 let e = /* @__PURE__ */ new Set();
5532 return this.breakpoints ? this.breakpoints.forEach((t) => { 5533 e.add(this._getUrlBase(t + "x") + ` ${this._validateSize(t + "w")}`), this.$$("hi-res-support") && e.add(this._getUrlBase(t * Et + "x") + ` ${this._validateSize(t * Et + "w")}`), this.$$("ultra-res-support") && e.add(this._getUrlBase(t * Tt + "x") + ` ${this._validateSize(t * Tt + "w")}`); 5534 }) : (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(); 5535 } 5536 getSrc() { 5537 return this._getUrlBase(); 5538 } 5539 get srcUrlPreview() { 5540 return this._getUrlBase("100x", "100"); 5541 } 5542 renderBackground() { 5543 [...document.querySelectorAll(this.bgSelector)].forEach((e) => { 5544 this.$$("intersection") ? this.initIntersection(e, () => { 5545 this.renderBg(e); 5546 }) : this.renderBg(e); 5547 }); 5548 } 5549 _appendURL({ elNode: e, src: t, srcset: s }) { 5550 t && (e.src = t), s && (e.srcset = s); 5551 } 5552 _setupConfigForImage({ elNode: e }) { 5553 this._setupEventProxy(e), this.initAttributes(e); 5554 } 5555 loaderImage({ src: e, srcset: t, elNode: s }) { 5556 return new Promise((r, n) => { 5557 this._setupConfigForImage({ elNode: s }), s.setAttribute(xs, ""), s.addEventListener("load", () => { 5558 s.removeAttribute(xs), r(s); 5559 }), s.addEventListener("error", () => { 5560 n(!1); 5561 }), this._appendURL({ 5562 elNode: s, 5563 src: e, 5564 srcset: t 5565 }); 5566 }); 5567 } 5568 async renderImage() { 5569 if (this.$$("intersection")) { 5570 this.hasPreviewImage && (this._setupConfigForImage({ elNode: this._imgPreview }), this.appendChild(this._imgPreview)), this.initIntersection(this.currentImg.img, async () => { 5571 this.hasPreviewImage && (this._imgPreview.src = this.srcUrlPreview); 5572 try { 5573 await this.loaderImage({ 5574 src: this.getSrc(), 5575 srcset: this.getSrcset(), 5576 elNode: this._img 5577 }), this.hasPreviewImage && await this._imgPreview.remove(), this.appendChild(this._img); 5578 } catch { 5579 this.hasPreviewImage && await this._imgPreview?.remove(), this.appendChild(this._img); 5580 } 5581 }); 5582 return; 5583 } 5584 try { 5585 this.hasPreviewImage && (await this.loaderImage({ 5586 src: this.srcUrlPreview, 5587 elNode: this._imgPreview 5588 }), this.appendChild(this._imgPreview)), await this.loaderImage({ 5589 src: this.getSrc(), 5590 srcset: this.getSrcset(), 5591 elNode: this._img 5592 }), this.hasPreviewImage && await this._imgPreview?.remove(), this.appendChild(this._img); 5593 } catch { 5594 this.hasPreviewImage && await this._imgPreview?.remove(), this.appendChild(this._img); 5595 } 5596 } 5597 init() { 5598 this.bgSelector ? this.renderBackground() : this.renderImage(); 5599 } 5600} 5601class Tc extends Ec { 5602 initCallback() { 5603 super.initCallback(), this.sub$$("src", () => { 5604 this.init(); 5605 }), this.sub$$("uuid", () => { 5606 this.init(); 5607 }), this.sub$$("lazy", (e) => { 5608 !this.$$("is-background-for") && !this.$$("is-preview-blur") && (this.img.loading = e ? "lazy" : "eager"); 5609 }); 5610 } 5611} 5612class Hi extends X { 5613 static styleAttrs = [...super.styleAttrs, "uc-simple-btn"]; 5614 couldBeCtxOwner = !0; 5615 constructor() { 5616 super(), this.init$ = { 5617 ...this.init$, 5618 withDropZone: !0, 5619 onClick: () => { 5620 this.api.initFlow(); 5621 }, 5622 "button-text": "" 5623 }; 5624 } 5625 initCallback() { 5626 super.initCallback(), this.defineAccessor( 5627 "dropzone", 5628 /** @param {unknown} val */ 5629 (e) => { 5630 typeof e > "u" || (this.$.withDropZone = N(e)); 5631 } 5632 ), this.subConfigValue("multiple", (e) => { 5633 this.$["button-text"] = e ? "upload-files" : "upload-file"; 5634 }); 5635 } 5636} 5637Hi.template = /* HTML */ 5638` 5639 <uc-drop-area set="@disabled: !withDropZone"> 5640 <button type="button" set="onclick: onClick"> 5641 <uc-icon name="upload"></uc-icon> 5642 <span l10n="button-text"></span> 5643 <slot></slot> 5644 <div class="uc-visual-drop-area" l10n="drop-files-here"></div> 5645 </button> 5646 </uc-drop-area> 5647`; 5648Hi.bindAttributes({ 5649 // @ts-expect-error TODO: we need to update symbiote types 5650 dropzone: null 5651}); 5652class Mr extends O { 5653 historyTracked = !0; 5654 /** @type {import('../../abstract/ActivityBlock.js').ActivityType} */ 5655 activityType = "start-from"; 5656 initCallback() { 5657 super.initCallback(), this.registerActivity(this.activityType); 5658 } 5659} 5660Mr.template = /* HTML */ 5661' <div class="uc-content"><slot></slot></div> '; 5662function Ic(i) { 5663 return new Promise((e) => { 5664 typeof window.FileReader != "function" && e(!1); 5665 try { 5666 let t = new FileReader(); 5667 t.onerror = () => { 5668 e(!0); 5669 }; 5670 let s = (r) => { 5671 r.type !== "loadend" && t.abort(), e(!1); 5672 };
5673 t.onloadend = s, t.onprogress = s, t.readAsDataURL(i); 5674 } catch { 5675 e(!1); 5676 } 5677 }); 5678} 5679function Sc(i, e) { 5680 return new Promise((t) => { 5681 let s = 0; 5682 const r = [], n = (a) => { 5683 a || (console.warn("Unexpectedly received empty content entry", { scope: "drag-and-drop" }), t(null)), a.isFile ? (s++, a.file((l) => { 5684 s--; 5685 const c = new File([l], l.name, { type: l.type || e }); 5686 r.push({ 5687 type: "file", 5688 file: c, 5689 fullPath: a.fullPath 5690 }), s === 0 && t(r); 5691 })) : a.isDirectory && o( 5692 /** @type {FileSystemDirectoryEntry} */ 5693 a.createReader() 5694 ); 5695 }; 5696 let o = (a) => { 5697 s++, a.readEntries((l) => { 5698 s--; 5699 for (let c of l) 5700 n(c); 5701 s === 0 && t(r); 5702 }); 5703 }; 5704 n(i); 5705 }); 5706} 5707function kc(i) { 5708 const e = [], t = []; 5709 for (let s = 0; s < i.items.length; s++) { 5710 let r = i.items[s]; 5711 if (r) 5712 if (r.kind === "file") { 5713 const n = r.type; 5714 if (typeof r.webkitGetAsEntry == "function" || typeof /** @type {any} */ 5715 r.getAsEntry == "function") { 5716 let a = typeof r.webkitGetAsEntry == "function" ? r.webkitGetAsEntry() : ( 5717 /** @type {any} */ 5718 r.getAsEntry() 5719 ); 5720 t.push( 5721 Sc(a, n).then((l) => { 5722 l && e.push(...l); 5723 }) 5724 ); 5725 continue; 5726 } 5727 const o = r.getAsFile(); 5728 o && t.push( 5729 Ic(o).then((a) => { 5730 a || e.push({ 5731 type: "file", 5732 file: o 5733 }); 5734 }) 5735 ); 5736 } else r.kind === "string" && r.type.match("^text/uri-list") && t.push( 5737 new Promise((n) => { 5738 r.getAsString((o) => { 5739 e.push({ 5740 type: "url", 5741 url: o 5742 }), n(void 0); 5743 }); 5744 }) 5745 ); 5746 } 5747 return Promise.all(t).then(() => e); 5748} 5749const Z = { 5750 ACTIVE: 0, 5751 INACTIVE: 1, 5752 NEAR: 2, 5753 OVER: 3 5754}; 5755let Ms = ["focus"], xc = 100, ui = /* @__PURE__ */ new Map(); 5756function Oc(i, e) { 5757 let t = Math.max(Math.min(i[0], e.x + e.width), e.x), s = Math.max(Math.min(i[1], e.y + e.height), e.y); 5758 return Math.sqrt((i[0] - t) * (i[0] - t) + (i[1] - s) * (i[1] - s)); 5759} 5760function Ds(i) { 5761 let e = 0, t = document.body, s = /* @__PURE__ */ new Set(), r = (g) => s.add(g), n = Z.INACTIVE, o = (g) => { 5762 i.shouldIgnore() && g !== Z.INACTIVE || (n !== g && s.forEac
5762h((y) => y(g)), n = g); 5763 }, a = () => e > 0; 5764 r((g) => i.onChange(g)); 5765 let l = () => { 5766 e = 0, o(Z.INACTIVE); 5767 }, c = () => { 5768 e += 1, n === Z.INACTIVE && o(Z.ACTIVE); 5769 }, u = () => { 5770 e -= 1, a() || o(Z.INACTIVE); 5771 }, d = (g) => { 5772 g.preventDefault(), e = 0, o(Z.INACTIVE); 5773 }, h = (g) => { 5774 if (i.shouldIgnore()) 5775 return; 5776 a() || (e += 1); 5777 let y = [g.x, g.y], A = i.element.getBoundingClientRect(), _ = Math.floor(Oc(y, A)), v = _ < xc, m = g.composedPath().includes(i.element); 5778 ui.set(i.element, _); 5779 let f = Math.min(...ui.values()) === _; 5780 m && f ? (g.preventDefault(), o(Z.OVER)) : o(v && f ? Z.NEAR : Z.ACTIVE); 5781 }, p = async (g) => { 5782 if (i.shouldIgnore()) 5783 return; 5784 g.preventDefault(); 5785 let y = await kc(g.dataTransfer); 5786 i.onItems(y), o(Z.INACTIVE); 5787 }; 5788 return t.addEventListener("drop", d), t.addEventListener("dragleave", u), t.addEventListener("dragenter", c), t.addEventListener("dragover", h), i.element.addEventListener("drop", p), Ms.forEach((g) => { 5789 window.addEventListener(g, l); 5790 }), () => { 5791 ui.delete(i.element), t.removeEventListener("drop", d), t.removeEventListener("dragleave", u), t.removeEventListener("dragenter", c), t.removeEventListener("dragover", h), i.element.removeEventListener("drop", p), Ms.forEach((g) => { 5792 window.removeEventListener(g, l); 5793 }); 5794 }; 5795} 5796const Dr = "uc-drop-area", Xe = `${Dr}/registry`; 5797class ji extends X { 5798 static styleAttrs = [...super.styleAttrs, "uc-drop-area"]; 5799 constructor() { 5800 super(), this.init$ = { 5801 ...this.init$, 5802 state: Z.INACTIVE, 5803 withIcon: !1, 5804 isClickable: !1, 5805 isFullscreen: !1, 5806 isEnabled: !0, 5807 isVisible: !0, 5808 text: "", 5809 [Xe]: null 5810 }; 5811 } 5812 isActive() { 5813 if (!this.$.isEnabled) 5814 return !1; 5815 const e = this.getBoundingClientRect(), t = e.width > 0 && e.height > 0, s = e.top >= 0 && e.left >= 0 && e.bottom <= (window.innerHeight || document.documentElement.clientHeight) && e.right <= (window.innerWidth || document.documentElement.clientWidth), r = window.getComputedStyle(this), n = r.visibility !== "hidden" && r.display !== "none"; 5816 return t && n && s; 5817 } 5818 initCallback() { 5819 super.initCallback(), this.bindL10n("text", () => this.l10n("drop-files-here")), this.$[Xe] || (this.$[Xe] = /* @__PURE__ */ new Set()), this.$[Xe].add(this), this.defineAccessor( 5820 "disabled", 5821 /** @param {unknown} value */ 5822 (t) => { 5823 this.set$({ isEnabled: !N(t) }); 5824 } 5825 ), this.defineAccessor( 5826 "clickable", 5827 /** @param {unknown} value */ 5828 (t) => { 5829 this.set$({ isClickable: N(t) }); 5830 } 5831 ), this.defineAccessor( 5832 "with-icon", 5833 /** @param {unknown} value */ 5834 (t) => { 5835 this.set$({ withIcon: N(t) }); 5836 } 5837 ), this.defineAccessor( 5838 "fullscreen", 5839 /** @param {unknown} value */ 5840 (t) => { 5841 this.set$({ isFullscreen: N(t) }); 5842 } 5843 ), this.defineAccessor( 5844 "text", 5845 /** @param {unknown} value */ 5846 (t) => { 5847 typeof t == "string" ? this.bindL10n("text", () => this.l10n(t) || t) : this.bindL10n("text", () => this.l10n("drop-files-here")); 5848 } 5849 ), this._destroyDropzone = Ds({ 5850 element: this, 5851 shouldIgnore: () => this._shouldIgnore(), 5852 /** @param {DropzoneState} state */ 5853 onChange: (t) => { 5854 this.$.state = t; 5855 }, 5856 /** @param {import('./getDropItems.js').DropItem[]} items */ 5857 onItems: (t) => { 5858 t.length && (t.forEach((s) => { 5859 s.type === "url" ? this.api.addFileFromUrl(s.url, { source: Y.DROP_AREA }) : s.type === "file" && this.api.addFileFromObject(s.file, { source: Y.DROP_AREA, fullPath: s.fullPath }); 5860 }), this.uploadCollection.size && (this.set$({ 5861 "*currentActivity": O.activities.UPLOAD_LIST 5862 }), this.setOrAddState("*modalActive", !0))); 5863 } 5864 }); 5865 let e = this.ref["content-wrapper"]; 5866 e && (this._destroyContentWrapperDropzone = Ds({ 5867 element: e, 5868 /** @param {DropzoneState} state */ 5869 onChange: (t) => { 5870 const s = Object.entries(Z).find(([, r]) => r === t)?.[0].toLowerCase(); 5871 s && e.setAttribute("drag-state", s); 5872 }, 5873 onItems: () => { 5874 }, 5875 shouldIgnore: () => this._shouldIgnore() 5876 })), this.sub("state", (t) => { 5877 const s = Object.entries(Z).find(([, r]) => r === t)?.[0].toLowerCase(); 5878 s && this.setAttribute("drag-state", s); 5879 }), this.subConfigValue("sourceList", (t) => { 5880 const s = Me(t); 5881 this.$.isEnabled = s.includes(Y.LOCAL), this.$.isVisible = this.$.isEnabled || !this.querySelector("[data-default-slot]"); 5882 }), this.sub("isVisible", (t) => { 5883 this.toggleAttribute("hidden", !t); 5884 }), this.sub("isClickable", (t) => { 5885 this.toggleAttribute("clickable", t); 5886 }), this.$.isClickable && (this._onAreaClicked = (t) => { 5887 t.type === "keydown" ? (t.code === "Space" || t.code === "Enter") && this.api.openSystemDialog() : t.type === "click" && this.api.openSystemDialog(); 5888 }, this.addEventListener("keydown", this._onAreaClicked), this.addEventListener("click", this._onAreaClicked)); 5889 } 5890 /** 5891 * Ignore drop events if there are other visible drop areas on the page 5892 * 5893 * @private 5894 * @returns {Boolean} 5895 */ 5896 _shouldIgnore() { 5897 return !this.$.isEnabled || !this._couldHandleFiles() ? !0 : this.$.isFullscreen ? [...this.$[Xe]].filter((s) => s !== this).filter((s) => s.isActive()).length > 0 : !1; 5898 } 5899 /** @private */
5900 _couldHandleFiles() { 5901 let e = this.cfg.multiple, t = this.cfg.multipleMax, s = this.uploadCollection.size; 5902 return !(e && t && s >= t || !e && s > 0); 5903 } 5904 destroyCallback() { 5905 super.destroyCallback(); 5906 const e = this.$[Xe]; 5907 e && (e.delete(this), e.size === 0 && $.deleteCtx(Dr)), this._destroyDropzone?.(), this._destroyContentWrapperDropzone?.(), this._onAreaClicked && (this.removeEventListener("keydown", this._onAreaClicked), this.removeEventListener("click", this._onAreaClicked)); 5908 } 5909} 5910ji.template = /* HTML */ 5911` 5912 <slot> 5913 <div data-default-slot hidden></div> 5914 <div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"> 5915 <div class="uc-icon-container" set="@hidden: !withIcon"> 5916 <uc-icon name="default"></uc-icon> 5917 <uc-icon name="arrow-down"></uc-icon> 5918 </div> 5919 <span class="uc-text">{{text}}</span> 5920 </div> 5921 </slot> 5922`; 5923ji.bindAttributes({ 5924 // @ts-expect-error TODO: fix types inside symbiote 5925 "with-icon": null, 5926 // @ts-expect-error TODO: fix types inside symbiote 5927 clickable: null, 5928 // @ts-expect-error TODO: fix types inside symbiote 5929 text: null, 5930 // @ts-expect-error TODO: fix types inside symbiote 5931 fullscreen: null, 5932 // @ts-expect-error TODO: fix types inside symbiote 5933 disabled: null 5934}); 5935const Lc = "src-type-"; 5936class Gi extends X { 5937 couldBeCtxOwner = !0; 5938 /** @type {string | undefined} */ 5939 type = void 0; 5940 /** 5941 * @private 5942 * @type {Record<string, TConfig>} 5943 */ 5944 _registeredTypes = {}; 5945 constructor() { 5946 super(), this.init$ = { 5947 ...this.init$, 5948 iconName: "default", 5949 "src-type": "" 5950 }; 5951 } 5952 initTypes() { 5953 this.registerType({ 5954 type: Y.LOCAL, 5955 activate: () => (this.api.openSystemDialog(), !1) 5956 }), this.registerType({ 5957 type: Y.URL, 5958 activity: O.activities.URL, 5959 textKey: "from-url" 5960 }), this.registerType({ 5961 type: Y.CAMERA, 5962 activity: O.activities.CAMERA, 5963 activate: () => { 5964 const e = "capture" in document.createElement("input"); 5965 return e && this.api.openSystemDialog({ captureCamera: !0 }), !e; 5966 } 5967 }), this.registerType({ 5968 type: "draw", 5969 activity: O.activities.DRAW, 5970 icon: "edit-draw" 5971 }); 5972 for (let e of Object.values(qt)) 5973 this.registerType({ 5974 type: e, 5975 activity: O.activities.EXTERNAL, 5976 activityParams: { 5977 externalSourceType: e 5978 } 5979 }); 5980 } 5981 initCallback() { 5982 super.initCallback(), this.initTypes(), this.defineAccessor( 5983 "type", 5984 /** @param {string} val */ 5985 (e) => { 5986 e && this.applyType(e); 5987 } 5988 ); 5989 } 5990 /** @param {TConfig} typeConfig */ 5991 registerType(e) { 5992 this._registeredTypes[e.type] = e; 5993 } 5994 /** @param {string} type */ 5995 getType(e) { 5996 return this._registeredTypes[e]; 5997 } 5998 activate() { 5999 if (!this.type) 6000 return; 6001 const e = this._registeredTypes[this.type], { activity: t, activate: s, activityParams: r = {} } = e; 6002 (s ? s() : t) && this.set$({ 6003 "*currentActivityParams": r, 6004 "*currentActivity": t 6005 }); 6006 } 6007 /** @param {string} type */ 6008 applyType(e) { 6009 const t = this._registeredTypes[e]; 6010 if (!t) { 6011 console.warn("Unsupported source type: " + e); 6012 return; 6013 } 6014 const { textKey: s = e, icon: r = e } = t; 6015 this.$["src-type"] = `${Lc}${s}`, this.$.iconName = r, this.onclick = () => { 6016 this.activate(); 6017 }; 6018 } 6019} 6020Gi.template = /* HTML */ 6021` 6022 <button type="button"> 6023 <uc-icon set="@name: iconName"></uc-icon> 6024 <div class="uc-txt" l10n="src-type"></div> 6025 </button> 6026`; 6027Gi.bindAttributes({ 6028 // @ts-expect-error symbiote types bug 6029 type: null 6030}); 6031class Pc extends B { 6032 initCallback() { 6033 super.initCallback(), this.subConfigValue("sourceList", (e) => { 6034 let t = Me(e), s = ""; 6035 t.forEach((r) => { 6036 if (r === "instagram") { 6037 console.error( 6038 "Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here:https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US" 6039 ); 6040 return; 6041 } 6042 s += /* HTML */ 6043 `<uc-source-btn type="${r}"></uc-source-btn>`; 6044 }), this.cfg.sourceListWrap ? this.innerHTML = s : this.outerHTML = s; 6045 }); 6046 } 6047} 6048const Qt = () => { 6049 const i = []; 6050 return { 6051 stack: i, 6052 promiseReadJpegChunks: (t) => new Promise((s, r) => { 6053 let n = 2; 6054 const o = (c, u) => { 6055 const d = new FileReader(); 6056 d.addEventListener("load", () => { 6057 u(new DataView(d.result)); 6058 }), d.addEventListener("error", (h) => { 6059 r(`Reader error: ${h}`); 6060 }), d.readAsArrayBuffer(c); 6061 }, a = () => o(t.slice(n, n + 128), (c) => { 6062 let u, d, h; 6063 for (u = d = 0, h = c.byteLength; h >= 0 ? d < h : d > h; u = h >= 0 ? ++d : --d) 6064 if (c.getUint8(u) === 255) { 6065 n += u; 6066 break; 6067 } 6068 l(); 6069 }), l = () => { 6070 const c = n; 6071 return o(t.slice(n, n += 4), (u) => { 6072 if (u.byteLength !== 4 || u.getUint8(0) !== 255) { 6073 r("Corrupted"); 6074 return; 6075 } 6076 const d = u.getUint8(1); 6077 if (d === 218) { 6078 s(!0); 6079 return; 6080 } 6081 const h = u.getUint16(2) - 2; 6082 return o(t.slice(n, n += h), (p) => { 6083 if (p.byteLength !== h) { 6084 r("Corrupted"); 6085 return; 6086 } 6087 i.push({ startPos: c, length: h, marker: d, view: p }), a(); 6088 }); 6089 }); 6090 }; 6091 FileReader && DataView || r("Not Support"), o(t.slice(0, 2), (c) => { 6092 c.getUint16(0) !== 65496 && r("Not jpeg"), a(); 6093 }); 6094 }) 6095 }; 6096}, Uc = async (i) => { 6097 const e = [], { promiseReadJpegChunks: t, stack: s } = Qt();
6098 return await t(i), s.forEach(({ marker: r, view: n }) => { 6099 r === 226 && // check for "ICC_PROFILE\0" 6100 n.getUint32(0) === 1229144927 && n.getUint32(4) === 1347571526 && n.getUint32(8) === 1229735168 && e.push(n); 6101 }), e; 6102}, Rr = async (i, e, t) => { 6103 { 6104 const s = [], r = [], { promiseReadJpegChunks: n, stack: o } = Qt(); 6105 await n(i), o.forEach((c) => { 6106 if (c.marker === e) 6107 return s.push(c.startPos), r.push(c.length); 6108 }); 6109 const a = [i.slice(0, 2)]; 6110 for (const c of t) { 6111 const u = new DataView(new ArrayBuffer(4)); 6112 u.setUint16(0, 65280 + e), u.setUint16(2, c.byteLength + 2), a.push(u.buffer), a.push(c); 6113 } 6114 let l = 2; 6115 for (let c = 0; c < s.length; c++) 6116 s[c] > l && a.push(i.slice(l, s[c])), l = s[c] + r[c] + 4; 6117 return a.push(i.slice(l, i.size)), new Blob(a, { 6118 type: i.type 6119 }); 6120 } 6121}, Mc = 226, $r = (i, e) => Rr(i, Mc, e.map((t) => t.buffer)), Dc = async (i) => { 6122 try { 6123 return await $r(i, []); 6124 } catch (e) { 6125 throw new Error(`Failed to strip ICC profile: ${e}`); 6126 } 6127}, Rc = (i, e, t) => new Promise((s, r) => { 6128 const n = (o) => { 6129 if (!o) { 6130 r("Failed to convert canvas to blob"); 6131 return; 6132 } 6133 s(o); 6134 }; 6135 i.toBlob(n, e, t), i.width = i.height = 1; 6136}), pt = () => { 6137 const i = document.createElement("canvas"), e = i.getContext("2d"); 6138 return { 6139 canvas: i, 6140 ctx: e 6141 }; 6142}, $c = (i) => { 6143 const { ctx: t, canvas: s } = pt(); 6144 s.width = s.height = 50, t.drawImage(i, 0, 0, 50, 50); 6145 const r = t.getImageData(0, 0, 50, 50).data; 6146 s.width = s.height = 1; 6147 for (let n = 3; n < r.length; n += 4) 6148 if (r[n] < 254) 6149 return !0; 6150 return !1; 6151}, Fc = async (i) => { 6152 let e = null; 6153 const { promiseReadJpegChunks: t, stack: s } = Qt(); 6154 return await t(i), s.forEach(({ marker: r, view: n }) => { 6155 if (!e && r === 225 && n.byteLength >= 14 && // check for "Exif\0" 6156 n.getUint32(0) === 1165519206 && n.getUint16(4) === 0) { 6157 e = n; 6158 return; 6159 } 6160 }), e; 6161}, Nc = "data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k="; 6162let It; 6163const Bc = () => new Promise((i) => { 6164 if (It !== void 0) 6165 i(It); 6166 else { 6167 const e = new Image(); 6168 e.addEventListener("load", () => { 6169 It = e.naturalWidth < e.naturalHeight, e.src = "//:0", i(It); 6170 }), e.src = Nc; 6171 } 6172}), Vc = (i, e) => { 6173 let t, s, r, n; 6174 if (!i || i.byteLength < 14 || i.getUint32(0) !== 1165519206 || i.getUint16(4) !== 0) 6175 return; 6176 if (i.getUint16(6) === 18761) 6177 s = !0; 6178 else if (i.getUint16(6) === 19789) 6179 s = !1; 6180 else 6181 return; 6182 if (i.getUint16(8, s) !== 42) 6183 return; 6184 r = 8 + i.getUint32(10, s); 6185 const o = i.getUint16(r - 2, s); 6186 for (t = 0, n = o; n >= 0 ? t < n : t > n; n >= 0 ? ++t : --t) { 6187 if (i.byteLength < r + 10) 6188 return; 6189 i.getUint16(r, s) === 274 && e(r + 8, s), r += 12; 6190 } 6191}, zc = (i, e) => { 6192 Vc(i, (t, s) => i.setUint16(t, e, s)); 6193}, Hc = async (i, e, t) => (t && zc(e, 1), Rr(i, 225, [e.buffer])), jc = (i, e) => new Promise((t, s) => { 6194 e && (i.src = e), i.complete ? t(i) : (i.addEventListener("load", () => { 6195 t(i); 6196 }), i.addEventListener("error", () => { 6197 s(new Error("Failed to load image. Probably not an image.")); 6198 })); 6199}), Gc = (i) => jc(new Image(), i), Xc = [ 6200 1, 6201 // L (black-white) 6202 3 6203 // RGB 6204], Yc = [ 6205 192, 6206 // ("SOF0", "Baseline DCT", SOF) 6207 193, 6208 // ("SOF1", "Extended Sequential DCT", SOF) 6209 194, 6210 // ("SOF2", "Progressive DCT", SOF) 6211 195, 6212 // ("SOF3", "Spatial lossless", SOF) 6213 197, 6214 // ("SOF5", "Differential sequential DCT", SOF) 6215 198, 6216 // ("SOF6", "Differential progressive DCT", SOF) 6217 199, 6218 // ("SOF7", "Differential spatial", SOF) 6219 201, 6220 // ("SOF9", "Extended sequential DCT (AC)", SOF) 6221 202, 6222 // ("SOF10", "Progressive DCT (AC)", SOF) 6223 203, 6224 // ("SOF11", "Spatial lossless DCT (AC)", SOF) 6225 205, 6226 // ("SOF13", "Differential sequential DCT (AC)", SOF) 6227 206, 6228 // ("SOF14", "Differential progressive DCT (AC)", SOF) 6229 207 6230 // ("SOF15", "Differential spatial (AC)", SOF) 6231], Rs = { 6232 squareSide: [ 6233 // Safari (iOS < 9, ram >= 256) 6234 // We are supported mobile safari < 9 since widget v2, by 5 Mpx limit 6235 // so it's better to continue support despite the absence of this browser in the support table 6236 Math.floor(Math.sqrt(5 * 1e3 * 1e3)), 6237 // IE Mobile (Windows Phone 8.x) 6238 // Safari (iOS >= 9) 6239 4096, 6240 // IE 9 (Win) 6241 8192, 6242 // Firefox 63 (Mac, Win) 6243 11180, 6244 // Chrome 68 (Android 6) 6245 10836, 6246 // Chrome 68 (Android 5) 6247 11402, 6248 // Chrome 68 (Android 7.1-9) 6249 14188, 6250 // Chrome 70 (Mac, Win) 6251 // Chrome 68 (Android 4.4) 6252 // Edge 17 (Win) 6253 // Safari 7-12 (Mac) 6254 16384 6255 ], 6256 dimension: [ 6257 // IE Mobile (Windows Phone 8.x) 6258 4096, 6259 // IE 9 (Win) 6260 8192, 6261 // Edge 17 (Win) 6262 // IE11 (Win) 6263 16384, 6264 // Chrome 70 (Mac, Win) 6265 // Chrome 68 (Android 4.4-9) 6266 // Firefox 63 (Mac, Win) 6267 32767, 6268 // Chrome 83 (Mac, Win) 6269 // Safari 7-12 (Mac) 6270 // Safari (iOS 9-12)
6271 // Actually Safari has a much bigger limits - 4194303 of width and 8388607 of height, 6272 // but we will not use them 6273 65535 6274 ] 6275}, Wc = async (i) => { 6276 let e = !1; 6277 const { promiseReadJpegChunks: t, stack: s } = Qt(); 6278 return await t(i).then(() => (s.forEach(({ marker: r, view: n }) => { 6279 if (!e && Yc.indexOf(r) >= 0) { 6280 const o = n.getUint8(5); 6281 Xc.indexOf(o) < 0 && (e = !0); 6282 } 6283 }), e)).catch(() => e); 6284}, Fr = (i, e) => { 6285 const t = {}; 6286 return (...s) => { 6287 const r = e(s, t); 6288 return r in t ? t[r] : t[r] = i(...s); 6289 }; 6290}, Nr = (i, e) => { 6291 const [t] = i, s = Object.keys(e).map((r) => parseInt(r, 10)).sort((r, n) => r - n); 6292 for (let r = 0; r < s.length; r++) { 6293 const n = s[r], o = !!e[n]; 6294 if (n > t && o || n < t && !o) 6295 return n; 6296 } 6297 return t; 6298}, ke = { 6299 R: 55, 6300 G: 110, 6301 B: 165, 6302 A: 255 6303}, Kc = `rgba(${ke.R}, ${ke.G}, ${ke.B}, ${ke.A / 255})`, Br = (i, e) => { 6304 try { 6305 const t = [i - 1, e - 1, 1, 1], { canvas: s, ctx: r } = pt(); 6306 s.width = 1, s.height = 1; 6307 const { canvas: n, ctx: o } = pt(); 6308 n.width = i, n.height = e, o && (o.fillStyle = Kc, o.fillRect(...t), r.drawImage(n, i - 1, e - 1, 1, 1, 0, 0, 1, 1)); 6309 const a = r && r.getImageData(0, 0, 1, 1).data; 6310 let l = !1; 6311 return a && (l = a[0] === ke.R && a[1] === ke.G && a[2] === ke.B && a[3] === ke.A), n.width = n.height = 1, l; 6312 } catch { 6313 return console.error(`Failed to test for max canvas size of ${i}x${e}.`), !1; 6314 } 6315}; 6316function Vr(i) { 6317 return (...e) => new Promise((t) => { 6318 setTimeout(() => { 6319 const s = i(...e); 6320 t(s); 6321 }, 0); 6322 }); 6323} 6324const qc = Vr(Fr(Br, Nr)), Zc = Vr(Fr(Br, Nr)), zr = async (i, e) => { 6325 const t = Rs.squareSide.find((o) => o * o >= i * e), s = Rs.dimension.find((o) => o >= i && o >= e); 6326 if (!t || !s) 6327 throw new Error("Not supported"); 6328 const [r, n] = await Promise.all([ 6329 qc(t, t), 6330 Zc(s, 1) 6331 ]); 6332 if (r && n) 6333 return !0; 6334 throw new Error("Not supported"); 6335}, Hr = async (i, e, t) => { 6336 try { 6337 const { ctx: s, canvas: r } = pt(); 6338 return r.width = e, r.height = t, s.imageSmoothingQuality = "high", s.drawImage(i, 0, 0, e, t), i instanceof HTMLImageElement && (i.src = "//:0"), i instanceof HTMLCanvasElement && (i.width = i.height = 1), r; 6339 } catch (s) { 6340 throw new Error("Canvas resize error", { cause: s }); 6341 } 6342}, Qc = ({ img: i, targetW: e, targetH: t }) => Hr(i, e, t), Jc = function({ sourceW: i, targetW: e, targetH: t, step: s }) { 6343 const r = []; 6344 let n = e, o = t; 6345 do 6346 r.push([n, o]), n = Math.round(n / s), o = Math.round(o / s); 6347 while (n < i * s); 6348 return r.reverse(); 6349}, eu = ({ img: i, sourceW: e, targetW: t, targetH: s, step: r }) => { 6350 const n = Jc({ sourceW: e, targetW: t, targetH: s, step: r }); 6351 return n.reduce((o, [a, l], c) => o.then((u) => zr(a, l).then(() => Hr(u, a, l)).catch(() => { 6352 if (c === n.length - 1) 6353 throw new Error("Not supported"); 6354 return u; 6355 })), Promise.resolve(i)); 6356}, tu = () => /iPad|iPhone|iPod/.test(navigator.platform) ? !0 : navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform), iu = navigator.maxTouchPoints && navigator.maxTouchPoints > 2 && /MacIntel/.test(navigator.platform), di = 0.71, su = (i, e) => { 6357 if (i.width * di * i.height * di < e.size) 6358 throw new Error("Not required"); 6359 const t = i.width, s = i.height, r = t / s, n = Math.floor(Math.sqrt(e.size * r)), o = Math.floor(e.size / Math.sqrt(e.size * r)); 6360 return zr(n, o).then(() => { 6361 const { ctx: a } = pt(); 6362 return "imageSmoothingQuality" in a && !tu() && !iu ? Qc({ img: i, targetW: n, targetH: o }) : eu({ img: i, sourceW: t, targetW: n, targetH: o, step: di }); 6363 }).catch(() => Promise.reject("Not supported")); 6364}, ru = async (i, e) => { 6365 try { 6366 if (await Wc(i)) 6367 throw new Error("Should skipped"); 6368 const s = await Promise.allSettled([ 6369 Fc(i), 6370 Bc(), 6371 Uc(i) 6372 ]), n = !s.some((y) => y.status === "rejected"), [o, a, l] = s, c = await Dc(i).catch(() => i), u = await Gc(URL.createObjectURL(c)); 6373 URL.revokeObjectURL(u.src); 6374 const d = await su(u, e); 6375 let h = "image/jpeg", p = e?.quality || 0.8; 6376 !n && $c(d) && (h = "image/png", p = void 0); 6377 let g = await Rc(d, h, p); 6378 if (n && o.status === "fulfilled" && o.value) { 6379 const y = o.value, A = a.status === "fulfilled" ? a.value : !1; 6380 g = await Hc(g, y, A); 6381 } 6382 return n && l.status === "fulfilled" && l.value.length > 0 && (g = await $r(g, l.value)), g; 6383 } catch (t) { 6384 let s; 6385 throw t instanceof Error && (s = t.message), typeof t == "string" && (s = t), new Error(`Failed to shrink image. ${s ? `Message: "${s}".` : ""}`, { cause: t }); 6386 } 6387}; 6388function nu(i) { 6389 let e = new Blob([i], { 6390 type: "image/svg+xml" 6391 }); 6392 return URL.createObjectURL(e); 6393} 6394function $s(i = "hsl(209, 21%, 65%)", e = 32, t = 32) { 6395 return nu( 6396 /*svg*/ 6397 ` 6398 <svg width="${e}" height="${t}
6398" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"> 6399 <path fill-rule="evenodd" fill="${i}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/> 6400 </svg> 6401 ` 6402 ); 6403} 6404function ou(i, e = 40) { 6405 if (i.type === "image/svg+xml") 6406 return URL.createObjectURL(i); 6407 let t = document.createElement("canvas"), s = t.getContext("2d"), r = new Image(), n = new Promise((o, a) => { 6408 r.onload = () => { 6409 let l = r.height / r.width; 6410 l > 1 ? (t.width = e, t.height = e * l) : (t.height = e, t.width = e / l), s.fillStyle = "rgb(240, 240, 240)", s.fillRect(0, 0, t.width, t.height), s.drawImage(r, 0, 0, t.width, t.height), t.toBlob((c) => { 6411 if (!c) { 6412 a(); 6413 return; 6414 } 6415 let u = URL.createObjectURL(c); 6416 o(u); 6417 }); 6418 }, r.onerror = (l) => { 6419 a(l); 6420 }; 6421 }); 6422 return r.src = URL.createObjectURL(i), n; 6423} 6424const Fs = 16384, au = /^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i, lu = (i) => { 6425 const e = au.exec(i?.toLocaleLowerCase()) || []; 6426 if (!e.length) 6427 return !1; 6428 const t = e[1] * e[2], s = Fs * Fs; 6429 return t > s ? (console.warn( 6430 `Shrinked size can not be larger than ${Math.floor(s / 1e3 / 1e3)}MP. You have set ${e[1]}x${e[2]} (${Math.ceil(t / 1e3 / 100) / 10}MP).` 6431 ), !1) : { 6432 quality: e[3] ? e[3] / 100 : void 0, 6433 size: t 6434 }; 6435}, re = Object.freeze({ 6436 FINISHED: /* @__PURE__ */ Symbol("FINISHED"), 6437 FAILED: /* @__PURE__ */ Symbol("FAILED"), 6438 UPLOADING: /* @__PURE__ */ Symbol("UPLOADING"), 6439 IDLE: /* @__PURE__ */ Symbol("IDLE") 6440}); 6441class Ve extends X { 6442 couldBeCtxOwner = !0; 6443 pauseRender = !0; 6444 /** @private */ 6445 _entrySubs = /* @__PURE__ */ new Set(); 6446 /** 6447 * @private 6448 * @type {any} TODO: Add types for upload entry 6449 */ 6450 _entry = null; 6451 /** @private */ 6452 _isIntersecting = !1; 6453 /** @private */ 6454 _debouncedGenerateThumb = le(this._generateThumbnail.bind(this), 100); 6455 /** @private */ 6456 _debouncedCalculateState = le(this._calculateState.bind(this), 100); 6457 /** @private */ 6458 _renderedOnce = !1; 6459 constructor() { 6460 super(), this.init$ = { 6461 ...this.init$, 6462 uid: "", 6463 itemName: "", 6464 errorText: "", 6465 thumbUrl: "", 6466 progressValue: 0, 6467 progressVisible: !1, 6468 badgeIcon: "", 6469 isFinished: !1, 6470 isFailed: !1, 6471 isUploading: !1, 6472 isFocused: !1, 6473 isEditable: !1, 6474 state: re.IDLE, 6475 ariaLabelStatusFile: "", 6476 onEdit: () => { 6477 this.$["*currentActivityParams"] = { 6478 internalId: this._entry.uid 6479 }, this.$["*currentActivity"] = O.activities.CLOUD_IMG_EDIT; 6480 }, 6481 onRemove: () => { 6482 this.uploadCollection.remove(this.$.uid); 6483 }, 6484 onUpload: () => { 6485 this.upload(); 6486 } 6487 }; 6488 } 6489 _reset() { 6490 for (let e of this._entrySubs) 6491 e.remove(); 6492 this._debouncedGenerateThumb.cancel(), this._debouncedCalculateState.cancel(), this._entrySubs = /* @__PURE__ */ new Set(), this._entry = null; 6493 } 6494 /** 6495 * @private 6496 * @param {IntersectionObserverEntry[]} entries 6497 */ 6498 _observerCallback(e) { 6499 let [t] = e; 6500 this._isIntersecting = t.isIntersecting, t.isIntersecting && !this._renderedOnce && (this.render(), this._renderedOnce = !0), t.intersectionRatio === 0 ? this._debouncedGenerateThumb.cancel() : this._debouncedGenerateThumb(); 6501 } 6502 /** @private */ 6503 _calculateState() { 6504 if (!this._entry) 6505 return; 6506 let e = this._entry, t = re.IDLE; 6507 e.getValue("errors").length > 0 ? t = re.FAILED : e.getValue("isUploading") ? t = re.UPLOADING : e.getValue("fileInfo") && (t = re.FINISHED), this.$.state = t; 6508 } 6509 /** @private */ 6510 async _generateThumbnail() { 6511 if (!this._entry) 6512 return; 6513 let e = this._entry; 6514 if (e.getValue("fileInfo") && e.getValue("isImage")) { 6515 let t = this.cfg.thumbSize, s = await this.proxyUrl( 6516 ae( 6517 ft(this.cfg.cdnCname, this._entry.getValue("uuid")), 6518 Ue(e.getValue("cdnUrlModifiers"), `scale_crop/${t}x${t}/center`) 6519 ) 6520 ), r = e.getValue("thumbUrl"); 6521 r !== s && (e.setValue("thumbUrl", s), r?.startsWith("blob:") && URL.revokeObjectURL(r)); 6522 return; 6523 } 6524 if (!e.getValue("thumbUrl")) 6525 if (e.getValue("file")?.type.includes("image")) 6526 try { 6527 let t = await ou(e.getValue("file"), this.cfg.thumbSize); 6528 e.setValue("thumbUrl", t); 6529 } catch { 6530 let s = window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground"); 6531 e.setValue("thumbUrl", $s(s)); 6532 } 6533 else { 6534 let t = window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground"); 6535 e.setValue("thumbUrl", $s(t)); 6536 } 6537 } 6538 /** 6539 * @private 6540 * @param {string} prop 6541 * @param {(value: any) => void} handler 6542 */ 6543 _subEntry(e, t) { 6544 let s = this._entry.subscribe( 6545 e, 6546 /** @param {any} value */ 6547 (r) => { 6548 this.isConnected && t(r); 6549 } 6550 ); 6551 this._entrySubs.add(s); 6552 } 6553 /** 6554 * @private 6555 * @param {String} id 6556 */ 6557 _handleEntryId(e) { 6558 this._reset(); 6559 let t = this.uploadCollection?.read(e); 6560 this._entry = t, t && (this._subEntry("uploadProgress", (s) => { 6561 this.$.progressValue = s; 6562 }), this._subEntry("fileName", (s) => { 6563 this.$.itemName = s || t.getValue("externalUrl") || this.l10n("file-no-name"), this._debouncedCalculateState(); 6564 }), this._subEntry("externalUrl", (s) => { 6565 this.$.itemName = t.getValue("fileName") || s || this.l10n("file-no-name"); 6566 }), this._subEntry("fileInfo", (s) => { 6567 this._debouncedCalculateState(), s && this._isIntersecting && this._debouncedGenerateThumb(); 6568 }), this._subEntry("cdnUrlModifiers", () => { 6569 this._isIntersecting && this._debouncedGenerateThumb(); 6570 }), this._subEntry("thumbUrl", (s) => { 6571 this.$.thumbUrl = s ? `url(${s})` : ""; 6572 }), this._subEntry("errors", () => this._debouncedCalculateState()), this._subEntry("isUploading", () => this._debouncedCalculateState()), this._subEntry("fileSize", () => this._debouncedCalculateState()), this._subEntry("mimeType", () => this._debouncedCalculateState()), this._subEntry("isImage", () => this._debouncedCalculateState()), this._isIntersecting && this._debouncedGenerateThumb()); 6573 } 6574 initCallback() { 6575 super.initCallback(), this.sub("uid", (e) => { 6576 this._handleEntryId(e); 6577 }), this.sub("state", (e) => { 6578 this._handleState(e); 6579 }), this.subConfigValue("useCloudImageEditor", () => this._debouncedCalculateState()), this.onclick = () => {
6580 Ve.activeInstances.forEach((e) => { 6581 e === this ? e.setAttribute("focused", "") : e.removeAttribute("focused"); 6582 }); 6583 }, this.sub( 6584 "*uploadTrigger", 6585 /** @param {Set<string>} itemsToUpload */ 6586 (e) => { 6587 e.has(this._entry.uid) && setTimeout(() => this.isConnected && this.upload()); 6588 } 6589 ), Ve.activeInstances.add(this); 6590 } 6591 /** @param {(typeof FileItemState)[keyof typeof FileItemState]} state */ 6592 _handleState(e) { 6593 e === re.FAILED ? this.$.badgeIcon = "badge-error" : e === re.FINISHED && (this.$.badgeIcon = "badge-success"), e === re.UPLOADING ? this.$.isFocused = !1 : this.$.progressValue = 0, this.set$({ 6594 isFailed: e === re.FAILED, 6595 isUploading: e === re.UPLOADING, 6596 isFinished: e === re.FINISHED, 6597 progressVisible: e === re.UPLOADING, 6598 isEditable: this.cfg.useCloudImageEditor && this._entry?.getValue("isImage") && this._entry?.getValue("cdnUrl"), 6599 errorText: this._entry.getValue("errors")?.[0]?.message, 6600 ariaLabelStatusFile: this.l10n("a11y-file-item-status", { 6601 fileName: this._entry?.getValue("fileName"), 6602 status: this.l10n(e?.description?.toLocaleLowerCase() ?? "").toLocaleLowerCase() 6603 }) 6604 }); 6605 } 6606 destroyCallback() { 6607 super.destroyCallback(), Ve.activeInstances.delete(this), this._reset(); 6608 } 6609 connectedCallback() { 6610 super.connectedCallback(), this._observer = new window.IntersectionObserver(this._observerCallback.bind(this), { 6611 threshold: [0, 1] 6612 }), this._observer.observe(this); 6613 } 6614 disconnectedCallback() { 6615 super.disconnectedCallback(), this._debouncedGenerateThumb.cancel(), this._observer?.disconnect(); 6616 } 6617 _settingsOfShrink() { 6618 return lu(this.cfg.imageShrink); 6619 } 6620 /** 6621 * @private 6622 * @param {File} file 6623 */ 6624 _processShrink(e) { 6625 return ru(e, this._settingsOfShrink()); 6626 } 6627 async upload() { 6628 let e = this._entry; 6629 if (!this.uploadCollection.read(e.uid) || e.getValue("fileInfo") || e.getValue("isUploading") || e.getValue("errors").length > 0) 6630 return; 6631 const t = this.cfg.multiple ? this.cfg.multipleMax : 1; 6632 if (!(t && this.uploadCollection.size > t)) { 6633 this._debouncedCalculateState(), e.setValue("isUploading", !0), e.setValue("errors", []); 6634 try { 6635 let s = new AbortController(); 6636 e.setValue("abortController", s); 6637 const r = async () => { 6638 let o = e.getValue("file"); 6639 o && this.cfg.imageShrink && (o = await this._processShrink(o).catch(() => o)); 6640 const a = o || e.getValue("externalUrl") || e.getValue("uuid"), c = { 6641 ...await this.getUploadClientOptions(), 6642 fileName: e.getValue("fileName"), 6643 source: e.getValue("source"), 6644 onProgress: (u) => { 6645 if (u.isComputable) { 6646 let d = u.value * 100; 6647 e.setValue("uploadProgress", d); 6648 } 6649 }, 6650 signal: s.signal, 6651 metadata: await this.getMetadataFor(e.uid) 6652 }; 6653 return this.debugPrint("upload options", a, c), Cr(a, c); 6654 }; 6655 let n = await this.$["*uploadQueue"].add(r); 6656 e.setMultipleValues({ 6657 fileInfo: n, 6658 isUploading: !1, 6659 fileName: n.originalFilename, 6660 fileSize: n.size, 6661 isImage: n.isImage, 6662 mimeType: n.contentInfo?.mime?.mime ?? n.mimeType, 6663 uuid: n.uuid, 6664 cdnUrl: e.getValue("cdnUrl") ?? n.cdnUrl, 6665 cdnUrlModifiers: e.getValue("cdnUrlModifiers") ?? "", 6666 uploadProgress: 100, 6667 source: e.getValue("source") ?? null 6668 }), e === this._entry && this._debouncedCalculateState(); 6669 } catch (s) { 6670 s instanceof Ce && s.isCancel ? e.setMultipleValues({ 6671 isUploading: !1, 6672 uploadProgress: 0 6673 }) : e.setMultipleValues({ 6674 isUploading: !1, 6675 uploadProgress: 0, 6676 uploadError: s 6677 }), e === this._entry && this._debouncedCalculateState(); 6678 } 6679 } 6680 } 6681} 6682Ve.template = /* HTML */ 6683` 6684 <div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"> 6685 <div class="uc-thumb" set="style.backgroundImage: thumbUrl"> 6686 <div class="uc-badge"> 6687 <uc-icon set="@name: badgeIcon"></uc-icon> 6688 </div> 6689 </div> 6690 <div aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;">
6691 <span class="uc-file-name" set="@title: itemName">{{itemName}}</span> 6692 <span class="uc-file-error" set="@hidden: !errorText">{{errorText}}</span> 6693 </div> 6694 <div class="uc-file-actions"> 6695 <button 6696 type="button" 6697 l10n="@title:file-item-edit-button" 6698 class="uc-edit-btn uc-mini-btn" 6699 set="onclick: onEdit; @hidden: !isEditable" 6700 > 6701 <uc-icon name="edit-file"></uc-icon> 6702 </button> 6703 <button 6704 type="button" 6705 l10n="@title:file-item-remove-button" 6706 class="uc-remove-btn uc-mini-btn" 6707 set="onclick: onRemove;" 6708 > 6709 <uc-icon name="remove-file"></uc-icon> 6710 </button> 6711 <button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"> 6712 <uc-icon name="upload"></uc-icon> 6713 </button> 6714 </div> 6715 <uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"> </uc-progress-bar> 6716 </div> 6717`; 6718Ve.activeInstances = /* @__PURE__ */ new Set(); 6719class jr extends B { 6720 static styleAttrs = [...super.styleAttrs, "uc-modal"]; 6721 static StateConsumerScope = "modal"; 6722 constructor() { 6723 super(), this.init$ = { 6724 ...this.init$, 6725 "*modalActive": !1, 6726 isOpen: !1, 6727 closeClicked: this._handleDialogClose 6728 }; 6729 } 6730 _handleBackdropClick = () => { 6731 this._closeDialog(); 6732 }; 6733 _closeDialog = () => { 6734 this.setOrAddState("*modalActive", !1); 6735 }; 6736 _handleDialogClose = () => { 6737 this._closeDialog(); 6738 }; 6739 /** @param {Event} e */ 6740 _handleDialogMouseDown = (e) => { 6741 this._mouseDownTarget = e.target; 6742 }; 6743 /** @param {Event} e */ 6744 _handleDialogMouseUp = (e) => { 6745 e.target === this.ref.dialog && e.target === this._mouseDownTarget && this._closeDialog(); 6746 }; 6747 show() { 6748 this.ref.dialog.showModal ? this.ref.dialog.showModal() : this.ref.dialog.setAttribute("open", ""); 6749 } 6750 hide() { 6751 this.ref.dialog.close ? this.ref.dialog.close() : this.ref.dialog.removeAttribute("open"); 6752 } 6753 initCallback() { 6754 super.initCallback(), this.ref.dialog.addEventListener("close", this._handleDialogClose), this.ref.dialog.addEventListener("mousedown", this._handleDialogMouseDown), this.ref.dialog.addEventListener("mouseup", this._handleDialogMouseUp), this.sub("*modalActive", (e) => { 6755 this.$.isOpen !== e && (this.$.isOpen = e), e && this.cfg.modalScrollLock ? document.body.style.overflow = "hidden" : document.body.style.overflow = ""; 6756 }), this.subConfigValue("modalBackdropStrokes", (e) => { 6757 e ? this.setAttribute("strokes", "") : this.removeAttribute("strokes"); 6758 }), this.sub("isOpen", (e) => { 6759 e ? (this.show(), this.setAttribute("aria-modal", "true")) : (this.hide(), this.setAttribute("aria-modal", "false")); 6760 }); 6761 } 6762 destroyCallback() { 6763 super.destroyCallback(), document.body.style.overflow = "", this._mouseDownTarget = void 0, this.ref.dialog.removeEventListener("close", this._handleDialogClose), this.ref.dialog.removeEventListener("mousedown", this._handleDialogMouseDown), this.ref.dialog.removeEventListener("mouseup", this._handleDialogMouseUp); 6764 } 6765} 6766jr.template = /* HTML */ 6767` 6768 <dialog ref="dialog"> 6769 <slot></slot> 6770 </dialog> 6771`; 6772const Gr = (i, e) => { 6773 let t, s, r; 6774 const n = (...o) => { 6775 t ? (clearTimeout(s), s = setTimeout( 6776 () => { 6777 Date.now() - r >= e && (i(...o), r = Date.now()); 6778 }, 6779 Math.max(e - (Date.now() - r), 0) 6780 )) : (i(...o), r = Date.now(), t = !0); 6781 }; 6782 return Object.defineProperty(n, "cancel", { 6783 configurable: !1, 6784 writable: !1, 6785 enumerable: !1, 6786 value: () => { 6787 clearTimeout(s); 6788 } 6789 }), /** @type {T & { readonly cancel: () => void }} */ 6790 /** @type {unknown} */ 6791 n; 6792}; 6793class Xr extends X { 6794 // Context owner should have access to CSS l10n 6795 // TODO: We need to move away l10n from CSS 6796 couldBeCtxOwner = !0; 6797 historyTracked = !0; 6798 activityType = O.activities.UPLOAD_LIST; 6799 constructor() { 6800 super(), this.init$ = { 6801 ...this.init$, 6802 doneBtnVisible: !1, 6803 doneBtnEnabled: !1, 6804 uploadBtnVisible: !1, 6805 addMoreBtnVisible: !1, 6806 addMoreBtnEnabled: !1, 6807 headerText: "", 6808 commonErrorMessage: "", 6809 hasFiles: !1, 6810 onAdd: () => { 6811 this.api.initFlow(!0); 6812 }, 6813 onUpload: () => {
6814 this.emit(z.UPLOAD_CLICK), this.api.uploadAll(), this._throttledHandleCollectionUpdate(); 6815 }, 6816 onDone: () => { 6817 this.emit(z.DONE_CLICK, this.api.getOutputCollectionState()), this.api.doneFlow(); 6818 }, 6819 onCancel: () => { 6820 this.uploadCollection.clearAll(); 6821 } 6822 }; 6823 } 6824 /** @private */ 6825 _throttledHandleCollectionUpdate = Gr(() => { 6826 this.isConnected && (this._updateUploadsState(), !this.couldOpenActivity && this.$["*currentActivity"] === this.activityType && this.historyBack()); 6827 }, 300); 6828 /** @private */ 6829 _updateUploadsState() { 6830 const e = this.api.getOutputCollectionState(), t = { 6831 total: e.totalCount, 6832 succeed: e.successCount, 6833 uploading: e.uploadingCount, 6834 failed: e.failedCount 6835 }, s = !e.errors.some( 6836 (d) => d.type === "TOO_MANY_FILES" || d.type === "TOO_FEW_FILES" 6837 ), r = e.errors.some((d) => d.type === "TOO_MANY_FILES"), n = e.totalCount === (this.cfg.multiple ? this.cfg.multipleMax : 1), o = t.failed === 0 && e.errors.length === 0; 6838 let a = !1, l = !1, c = !1; 6839 if (t.total - t.succeed - t.uploading - t.failed > 0 && s) 6840 a = !0; 6841 else { 6842 l = !0; 6843 const d = this.cfg.groupOutput ? !!e.group : !0; 6844 c = t.total === t.succeed && s && o && d; 6845 } 6846 this.set$({ 6847 doneBtnVisible: l, 6848 doneBtnEnabled: c, 6849 uploadBtnVisible: a, 6850 addMoreBtnEnabled: t.total === 0 || !r && !n, 6851 addMoreBtnVisible: !n || this.cfg.multiple 6852 }), this.bindL10n("headerText", () => this._getHeaderText(t)); 6853 } 6854 /** 6855 * @private 6856 * @param {Summary} summary 6857 */ 6858 _getHeaderText(e) { 6859 const t = (s) => { 6860 const r = e[s]; 6861 return this.l10n(`header-${s}`, { 6862 count: r 6863 }); 6864 }; 6865 return e.uploading > 0 ? t("uploading") : e.failed > 0 ? t("failed") : e.succeed > 0 ? t("succeed") : t("total"); 6866 } 6867 get couldOpenActivity() { 6868 return this.cfg.showEmptyList || this.uploadCollection.size > 0; 6869 } 6870 initCallback() { 6871 super.initCallback(), this.registerActivity(this.activityType), this.subConfigValue("multiple", this._throttledHandleCollectionUpdate), this.subConfigValue("multipleMin", this._throttledHandleCollectionUpdate), this.subConfigValue("multipleMax", this._throttledHandleCollectionUpdate), this.sub("*groupInfo", (e) => { 6872 e && this._throttledHandleCollectionUpdate(); 6873 }), this.sub("*currentActivity", (e) => { 6874 !this.couldOpenActivity && e === this.activityType && (this.$["*currentActivity"] = this.initActivity); 6875 }), this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate), this.sub( 6876 "*uploadList", 6877 (e) => { 6878 this._throttledHandleCollectionUpdate(), this.set$({ 6879 hasFiles: e.length > 0 6880 }), this.cfg.confirmUpload || this.api.uploadAll(); 6881 }, 6882 !1 6883 ), this.sub( 6884 "*collectionErrors", 6885 /** @param {import('../../types').OutputError<import('../../types').OutputCollectionErrorType>[]} errors */ 6886 (e) => { 6887 const t = e.filter((s) => s.type !== "SOME_FILES_HAS_ERRORS")[0]; 6888 if (!t) { 6889 this.set$({ 6890 commonErrorMessage: null 6891 }); 6892 return; 6893 } 6894 this.set$({ 6895 commonErrorMessage: t.message 6896 }); 6897 } 6898 ); 6899 } 6900 destroyCallback() { 6901 super.destroyCallback(), this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate); 6902 } 6903} 6904Xr.template = /* HTML */ 6905` 6906 <uc-activity-header> 6907 <span aria-live="polite" class="uc-header-text">{{headerText}}</span> 6908 <button 6909 type="button" 6910 class="uc-mini-btn uc-close-btn" 6911 set="onclick: *closeModal" 6912 l10n="@title:a11y-activity-header-button-close" 6913 > 6914 <uc-icon name="close"></uc-icon> 6915 </button> 6916 </uc-activity-header> 6917 6918 <div class="uc-no-files" set="@hidden: hasFiles"> 6919 <slot name="empty"><span l10n="no-files"></span></slot> 6920 </div> 6921 6922 <div class="uc-files" repeat="*uploadList" repeat-item-tag="uc-file-item"></div> 6923 6924 <div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div> 6925 6926 <div class="uc-toolbar"> 6927 <button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button> 6928 <div class="uc-toolbar-spacer"></div> 6929 <button 6930 type="button" 6931 class="uc-add-more-btn uc-secondary-btn"
6932 set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" 6933 > 6934 <uc-icon name="add"></uc-icon><span l10n="add-more"></span> 6935 </button> 6936 <button 6937 type="button" 6938 class="uc-upload-btn uc-primary-btn" 6939 set="@hidden: !uploadBtnVisible; onclick: onUpload;" 6940 l10n="upload" 6941 ></button> 6942 <button 6943 type="button" 6944 class="uc-done-btn uc-primary-btn" 6945 set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" 6946 l10n="done" 6947 ></button> 6948 </div> 6949 6950 <uc-drop-area ghost></uc-drop-area> 6951`; 6952class Yr extends X { 6953 couldBeCtxOwner = !0; 6954 activityType = O.activities.URL; 6955 init$ = { 6956 ...this.init$, 6957 importDisabled: !0, 6958 onUpload: (e) => { 6959 e.preventDefault(); 6960 let t = this.ref.input.value; 6961 this.api.addFileFromUrl(t, { source: Y.URL }), this.$["*currentActivity"] = O.activities.UPLOAD_LIST; 6962 }, 6963 onCancel: () => { 6964 this.historyBack(); 6965 }, 6966 onInput: (e) => { 6967 let t = ( 6968 /** @type {HTMLInputElement} */ 6969 e.target.value 6970 ); 6971 this.set$({ importDisabled: !t }); 6972 } 6973 }; 6974 initCallback() { 6975 super.initCallback(), this.registerActivity(this.activityType, { 6976 onActivate: () => { 6977 this.ref.input.value = "", this.ref.input.focus(); 6978 } 6979 }); 6980 } 6981} 6982Yr.template = /* HTML */ 6983` 6984 <uc-activity-header> 6985 <button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"> 6986 <uc-icon name="back"></uc-icon> 6987 </button> 6988 <div> 6989 <uc-icon name="url"></uc-icon> 6990 <span l10n="caption-from-url"></span> 6991 </div> 6992 <button 6993 type="button" 6994 class="uc-mini-btn uc-close-btn" 6995 set="onclick: *closeModal" 6996 l10n="@title:a11y-activity-header-button-close" 6997 > 6998 <uc-icon name="close"></uc-icon> 6999 </button> 7000 </uc-activity-header> 7001 <form class="uc-content"> 7002 <input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /> 7003 <button 7004 type="submit" 7005 class="uc-url-upload-btn uc-primary-btn" 7006 set="onclick: onUpload; @disabled: importDisabled" 7007 l10n="upload-url" 7008 ></button> 7009 </form> 7010`; 7011const cu = () => typeof navigator.permissions < "u", uu = { 7012 width: { 7013 ideal: 1920 7014 }, 7015 height: { 7016 ideal: 1080 7017 }, 7018 frameRate: { 7019 ideal: 30 7020 } 7021}, Ns = ["camera", "microphone"]; 7022function St(i) { 7023 const e = Math.floor(i / 60).toString().padStart(2, "0"), t = Math.floor(i % 60).toString().padStart(2, "0"); 7024 return `${e}:${t}`; 7025} 7026const Bs = "image/jpeg", Vs = "video/webm"; 7027class F extends X { 7028 couldBeCtxOwner = !0; 7029 activityType = O.activities.CAMERA; 7030 /** @private */ 7031 _unsubPermissions = null; 7032 /** @type {BlobPart[]} */ 7033 _chunks = []; 7034 /** @type {MediaRecorder | null} */ 7035 _mediaRecorder = null; 7036 /** @type {MediaStream | null} */ 7037 _stream = null; 7038 /** @type {string | null} */ 7039 _selectedAudioId = null; 7040 /** @type {string | null} */ 7041 _selectedCameraId = null; 7042 constructor() { 7043 super(), this.init$ = { 7044 ...this.init$, 7045 video: null, 7046 videoTransformCss: null, 7047 videoHidden: !0, 7048 messageHidden: !0, 7049 requestBtnHidden: cu(), 7050 cameraSelectOptions: null, 7051 cameraSelectHidden: !0, 7052 l10nMessage: "", 7053 // This is refs 7054 switcher: null, 7055 panels: null, 7056 timer: null, 7057 timerHidden: !0, 7058 cameraHidden: !0, 7059 cameraActionsHidden: !0, 7060 audioSelectOptions: null, 7061 audioSelectHidden: !0, 7062 audioSelectDisabled: !0, 7063 audioToggleMicorphoneHidden: !0, 7064 tabCameraHidden: !0, 7065 tabVideoHidden: !0, 7066 currentIcon: "camera-full", 7067 currentTimelineIcon: "play", 7068 toggleMicorphoneIcon: "microphone", 7069 /** @type {Number} */ 7070 _startTime: 0, 7071 /** @type {Number} */ 7072 _elapsedTime: 0, 7073 _animationFrameId: null, 7074 mutableClassButton: "uc-shot-btn uc-camera-action", 7075 /** @param {Event} e */ 7076 onCameraSelectChange: (e) => { 7077 this._selectedCameraId = e.target.value, this._capture(); 7078 }, 7079 /** @param {Event} e */ 7080 onAudioSelectChange: (e) => { 7081 this._selectedAudioId = e.target.value, this._capture(); 7082 }, 7083 onCancel: () => { 7084 this.historyBack(); 7085 }, 7086 onShot: () => this._shot(), 7087 onRequestPermissions: () => this._capture(), 7088 /** General method for photo and video capture */ 7089 onStartCamera: () => this._chooseActionWithCamera(), 7090 onStartRecording: () => this._startRecording(), 7091 onStopRecording: () => this._stopRecording(), 7092 onToggleRecording: () => this._toggleRecording(), 7093 onToggleAudio: () => this._toggleEnableAudio(), 7094 onRetake: () => this._retake(), 7095 onAccept: () => this._accept(), 7096 /** @param {MouseEvent} e */ 7097 onClickTab: (e) => { 7098 const t = ( 7099 /** @type {HTMLElement} */ 7100 e.currentTarget.getAttribute("data-id") 7101 ); 7102 t && this._handleActiveTab( 7103 /** @type {CameraTabId} */ 7104 t 7105 ); 7106 } 7107 }; 7108 } 7109 _chooseActionWithCamera = () => { 7110 if (this._activeTab === F.types.PHOTO && this._shot(), this._activeTab === F.types.VIDEO) { 7111 if (this._mediaRecorder?.state === "recording") { 7112 this._stopRecording(); 7113 return; 7114 } 7115 this._startRecording(); 7116 } 7117 }; 7118 _updateTimer = () => { 7119 const e = Math.floor((performance.now() - this.$._startTime + this.$._elapsedTime) / 1e3); 7120 if (typeof this.cfg.maxVideoRecordingDuration == "number" && this.cfg.maxVideoRecordingDuration > 0) { 7121 const t = this.cfg.maxVideoRecordingDuration - e; 7122 if (t <= 0) { 7123 this.ref.timer.textContent = St(t), this._stopRecording(); 7124 return; 7125 } 7126 this.ref.timer.textContent = St(t); 7127 } else 7128 this.ref.timer.textContent = St(e); 7129 this._animationFrameId = requestAnimationFrame(this._updateTimer); 7130 }; 7131 _startTimer = () => { 7132 this.$._startTime = performance.now(), this.$._elapsedTime = 0, this._updateTimer(); 7133 }; 7134 _stopTimer = () => { 7135 this._animationFrameId && cancelAnimationFrame(this._animationFrameId); 7136 }; 7137 _startTimeline = () => { 7138 const e = this.ref.video.currentTime, t = this.ref.video.duration; 7139 this.ref.line.style.transform = `scaleX(${e / t})`, this.ref.timer.textContent = St(e), this._animationFrameId = requestAnimationFrame(this._startTimeline); 7140 }; 7141 _stopTimeline = () => { 7142 this._animationFrameId && cancelAnimationFrame(this._animationFrameId); 7143 }; 7144 _startRecording = () => { 7145 try { 7146 this._chunks = [], this._options = { 7147 ...this.cfg.mediaRecorerOptions 7148 }; 7149 const { mimeType: e } = this.cfg.mediaRecorerOptions || {};
7150 e && MediaRecorder.isTypeSupported(e) ? this._options.mimeType = e : MediaRecorder.isTypeSupported(Vs) ? this._options.mimeType = Vs : this._options.mimeType = "video/mp4", this._stream && (this._mediaRecorder = new MediaRecorder(this._stream, this._options), this._mediaRecorder.start(), this._mediaRecorder.addEventListener("dataavailable", (t) => { 7151 this._chunks.push(t.data); 7152 }), this._startTimer(), this.classList.add("uc-recording"), this._setCameraState(F.events.PLAY)); 7153 } catch (e) { 7154 console.error("Failed to start recording", e); 7155 } 7156 }; 7157 /** @private */ 7158 _stopRecording = () => { 7159 this._mediaRecorder?.addEventListener("stop", () => { 7160 this._previewVideo(), this._stopTimer(), this._setCameraState(F.events.STOP); 7161 }), this._mediaRecorder?.stop(), this.classList.remove("uc-recording"); 7162 }; 7163 /** This method is used to toggle recording pause/resume */ 7164 _toggleRecording = () => { 7165 this._mediaRecorder?.state !== "recording" && (!this.ref.video.paused && !this.ref.video.ended && this.ref.video.readyState > 2 ? this.ref.video.pause() : this.ref.video.paused && this.ref.video.play()); 7166 }; 7167 _toggleEnableAudio = () => { 7168 this._stream?.getAudioTracks().forEach((e) => { 7169 e.enabled = !e.enabled, this.$.toggleMicorphoneIcon = e.enabled ? "microphone" : "microphone-mute", this.$.audioSelectDisabled = !e.enabled; 7170 }); 7171 }; 7172 /** 7173 * Previewing the video that was recorded on the camera 7174 * 7175 * @private 7176 */ 7177 _previewVideo = () => { 7178 try { 7179 const e = new Blob(this._chunks, { 7180 type: this._mediaRecorder?.mimeType 7181 }), t = URL.createObjectURL(e); 7182 this.ref.video.muted = !1, this.ref.video.volume = 1, this.$.video = null, this.ref.video.src = t, this.ref.video.addEventListener("play", () => { 7183 this._startTimeline(), this.set$({ 7184 currentTimelineIcon: "pause" 7185 }); 7186 }), this.ref.video.addEventListener("pause", () => { 7187 this.set$({ 7188 currentTimelineIcon: "play" 7189 }), this._stopTimeline(); 7190 }); 7191 } catch (e) { 7192 console.error("Failed to preview video", e); 7193 } 7194 }; 7195 _retake = () => { 7196 this._setCameraState(F.events.RETAKE), this._activeTab === F.types.VIDEO && (this.$.video = this._stream, this.ref.video.muted = !0), this.ref.video.play(); 7197 }; 7198 _accept = () => { 7199 if (this._setCameraState(F.events.ACCEPT), this._activeTab === F.types.PHOTO) { 7200 this._canvas?.toBlob((r) => { 7201 const n = this._createFile("camera", "jpeg", Bs, r); 7202 this._toSend(n); 7203 }, Bs); 7204 return; 7205 } 7206 const e = new Blob(this._chunks, { 7207 type: this._mediaRecorder?.mimeType 7208 }), t = this._guessExtensionByMime(this._mediaRecorder?.mimeType), s = this._createFile("video", t, `video/${t}`, e); 7209 this._toSend(s), this._chunks = []; 7210 }; 7211 /** @param {CameraStatus} status */ 7212 _handlePhoto = (e) => { 7213 e === F.events.SHOT && this.set$({ 7214 tabVideoHidden: !0, 7215 cameraHidden: !0, 7216 tabCameraHidden: !0, 7217 cameraActionsHidden: !1, 7218 cameraSelectHidden: !0 7219 }), (e === F.events.RETAKE || e === F.events.ACCEPT) && this.set$({ 7220 tabVideoHidden: !this.cfg.enableVideoRecording, 7221 cameraHidden: !1, 7222 tabCameraHidden: !1, 7223 cameraActionsHidden: !0, 7224 cameraSelectHidden: this.cameraDevices.length <= 1 7225 }); 7226 }; 7227 /** @param {CameraStatus} status */ 7228 _handleVideo = (e) => { 7229 e === F.events.PLAY && this.set$({ 7230 timerHidden: !1, 7231 tabCameraHidden: !0, 7232 cameraSelectHidden: !0, 7233 audioSelectHidden: !0, 7234 currentTimelineIcon: "pause", 7235 currentIcon: "square", 7236 mutableClassButton: "uc-shot-btn uc-camera-action uc-stop-record" 7237 }), e === F.events.STOP && this.set$({ 7238 timerHidden: !1, 7239 cameraHidden: !0, 7240 audioToggleMicorphoneHidden: !0, 7241 cameraActionsHidden: !1 7242 }), (e === F.events.RETAKE || e === F.events.ACCEPT) && this.set$({ 7243 timerHidden: !0, 7244 tabCameraHidden: !1, 7245 cameraHidden: !1, 7246 cameraActionsHidden: !0, 7247 audioToggleMicorphoneHidden: !this.cfg.enableAudioRecording, 7248 currentIcon: "video-camera-full",
7249 mutableClassButton: "uc-shot-btn uc-camera-action", 7250 audioSelectHidden: !this.cfg.enableAudioRecording || this.audioDevices.length <= 1, 7251 cameraSelectHidden: this.cameraDevices.length <= 1 7252 }); 7253 }; 7254 /** 7255 * @private 7256 * @param {CameraStatus} status 7257 */ 7258 _setCameraState = (e) => { 7259 this._activeTab === F.types.PHOTO && (e === "shot" || e === "retake" || e === "accept") && this._handlePhoto(e), this._activeTab === F.types.VIDEO && (e === "play" || e === "stop" || e === "retake" || e === "accept" || e === "pause" || e === "resume") && this._handleVideo(e); 7260 }; 7261 /** @private */ 7262 _shot() { 7263 if (this._setCameraState("shot"), this._canvas = document.createElement("canvas"), this._ctx = this._canvas.getContext("2d"), !this._ctx) 7264 throw new Error("Failed to get canvas context"); 7265 this._canvas.height = this.ref.video.videoHeight, this._canvas.width = this.ref.video.videoWidth, this.cfg.cameraMirror && (this._ctx.translate(this._canvas.width, 0), this._ctx.scale(-1, 1)), this._ctx.drawImage(this.ref.video, 0, 0), this.ref.video.pause(); 7266 } 7267 /** 7268 * @private 7269 * @param {CameraTabId} tabId 7270 */ 7271 _handleActiveTab = (e) => { 7272 this.ref.switcher.querySelectorAll("button").forEach((t) => { 7273 t.classList.toggle("uc-active", t.getAttribute("data-id") === e); 7274 }), e === F.types.PHOTO && this.set$({ 7275 currentIcon: "camera-full", 7276 audioSelectHidden: !0, 7277 audioToggleMicorphoneHidden: !0 7278 }), e === F.types.VIDEO && this.set$({ 7279 currentTimelineIcon: "play", 7280 currentIcon: "video-camera-full", 7281 audioSelectHidden: !this.cfg.enableAudioRecording || this.audioDevices.length <= 1, 7282 audioToggleMicorphoneHidden: !this.cfg.enableAudioRecording 7283 }), this._activeTab = e; 7284 }; 7285 /** 7286 * @param {'camera' | 'video'} type 7287 * @param {'jpeg' | 'webm'} ext 7288 * @param {String} format 7289 * @param {Blob} blob 7290 */ 7291 _createFile = (e, t, s, r) => { 7292 const n = Date.now(), o = `${e}-${n}.${t}`; 7293 return new File([r], o, { 7294 lastModified: n, 7295 type: s 7296 }); 7297 }; 7298 /** @param {String | undefined} mime */ 7299 _guessExtensionByMime(e) { 7300 const t = { 7301 mp4: "mp4", 7302 ogg: "ogg", 7303 webm: "webm", 7304 quicktime: "mov", 7305 "x-matroska": "mkv" 7306 }; 7307 if (e === "") 7308 return "webm"; 7309 if (e && (e = e.split("/"), e?.[0] === "video")) { 7310 e = e.slice(1).join("/"); 7311 const s = e?.split(";")[0]; 7312 if (t[s]) 7313 return t[s]; 7314 } 7315 return "avi"; 7316 } 7317 /** 7318 * The send file to the server 7319 * 7320 * @param {File} file 7321 */ 7322 _toSend = (e) => { 7323 this.api.addFileFromObject(e, { source: Y.CAMERA }), this.set$({ 7324 "*currentActivity": O.activities.UPLOAD_LIST 7325 }); 7326 }; 7327 /** 7328 * @private 7329 * @param {'granted' | 'denied' | 'prompt'} state 7330 */ 7331 _setPermissionsState = le((e) => { 7332 this.classList.toggle("uc-initialized", e === "granted"); 7333 const t = this._activeTab === F.types.VIDEO && this.cfg.enableAudioRecording, s = this._activeTab === F.types.PHOTO ? "camera-full" : "video-camera-full"; 7334 e === "granted" ? this.set$({ 7335 videoHidden: !1, 7336 cameraHidden: !1, 7337 tabCameraHidden: !1, 7338 messageHidden: !0, 7339 timerHidden: !0, 7340 currentIcon: s, 7341 audioToggleMicorphoneHidden: !t, 7342 audioSelectHidden: !t 7343 }) : e === "prompt" ? (this.$.l10nMessage = "camera-permissions-prompt", this.set$({ 7344 videoHidden: !0, 7345 cameraHidden: !0, 7346 tabCameraHidden: !0, 7347 messageHidden: !1 7348 }), this._stopCapture()) : (this.$.l10nMessage = "camera-permissions-denied", this.set$({ 7349 videoHidden: !0, 7350 messageHidden: !1, 7351 tabCameraHidden: !1, 7352 tabVideoHidden: !this.cfg.enableVideoRecording, 7353 cameraActionsHidden: !0, 7354 mutableClassButton: "uc-shot-btn uc-camera-action" 7355 }), this._stopCapture()); 7356 }, 300); 7357 _makeStreamInactive = () => { 7358 if (!this._stream) return !1; 7359 const e = this._stream?.getAudioTracks(), t = this._stream?.getVideoTracks(); 7360 e.forEach((s) => s.stop()), t.forEach((s) => s.stop()); 7361 }; 7362 _stopCapture = () => { 7363 this._capturing && (this.ref.video.volume = 0, this.$.video?.getTracks()[0].stop(), this.$.video = null, this._makeStreamInactive(), this._stopTimer(), this._capturing = !1); 7364 }; 7365 _capture = async () => { 7366 const e = { 7367 video: uu, 7368 audio: this.cfg.enableAudioRecording ? {} : !1 7369 }; 7370 this._selectedCameraId && (e.video = { 7371 deviceId: { 7372 exact: this._selectedCameraId 7373 } 7374 }), this._selectedAudioId && this.cfg.enableAudioRecording && (e.audio = { 7375 deviceId: { 7376 exact: this._selectedAudioId 7377 } 7378 }), this.ref.video.volume = 0; 7379 try { 7380 this._setPermissionsState("prompt"), this._stream = await navigator.mediaDevices.getUserMedia(e), this._stream.addEventListener("inactive", () => { 7381 this._setPermissionsState("denied"); 7382 }), this.$.video = this._stream, this._capturing = !0, this._setPermissionsState("granted"); 7383 } catch (t) { 7384 this._setPermissionsState("denied"), console.log("Failed to capture camera", t); 7385 } 7386 }; 7387 _handlePermissionsChange = () => { 7388 this._capture(); 7389 }; 7390 _permissionAccess = async () => { 7391 try { 7392 for (const e of Ns) 7393 this[`${e}Response`] = await navigator.permissions.query({ name: e }), this[`${e}Response`].addEventListener("change", this._handlePermissionsChange); 7394 } catch (e) { 7395 console.log("Failed to use permissions API. Fallback to manual request mode.", e), this._capture(); 7396 } 7397 }; 7398 _getPermission = () => { 7399 }; 7400 _requestDeviceAccess = async () => { 7401 try { 7402 await navigator.mediaDevices.getUserMedia({ video: !0, audio: this.cfg.enableAudioRecording }), await this._getDevices(), navigator.mediaDevices.addEventListener("devicechange", this._getDevices); 7403 } catch (e) { 7404 console.log("Failed to get user media", e); 7405 } 7406 }; 7407 _getDevices = async () => { 7408 try { 7409 const e = await navigator.mediaDevices.enumerateDevices(); 7410 this.cameraDevices = e.filter((t) => t.kind === "videoinput").map((t, s) => ({ 7411 text: t.label.trim() || `${this.l10n("caption-camera")} ${s + 1}`, 7412 value: t.deviceId 7413 })), this.audioDevices = this.cfg.enableAudioRecording && e.filter((t) => t.kind === "audioinput").map((t) => ({ 7414 text: t.label.trim(), 7415 value: t.deviceId 7416 })), this.cameraDevices.length > 1 && this.set$({ 7417 cameraSelectOptions: this.cameraDevices, 7418 cameraSelectHidden: !1 7419 }), this._selectedCameraId = this.cameraDevices[0]?.value, this.audioDevices.length > 1 && this.set$({ 7420 audioSelectOptions: this.audioDevices, 7421 audioSelectHidden: !1 7422 }), this._selectedAudioId = this.audioDevices[0]?.value; 7423 } catch (e) { 7424 console.log("Failed to get devices", e); 7425 } 7426 }; 7427 _onActivate = async () => { 7428 await this._permissionAccess(), await this._requestDeviceAccess(), await this._capture(); 7429 }; 7430 _onDeactivate = async () => { 7431 this._unsubPermissions && this._unsubPermissions(), window.chrome || this._setPermissionsState("denied"), this._stopCapture(); 7432 }; 7433 initCallback() { 7434 super.initCallback(), this.registerActivity(this.activityType, { 7435 onActivate: this._onActivate, 7436 onDeactivate: this._onDeactivate 7437 }), this.subConfigValue("cameraMirror", (e) => { 7438 this.$.videoTransformCss = e ? "scaleX(-1)" : null; 7439 }), this.subConfigValue("enableAudioRecording", (e) => { 7440 this.$.audioToggleMicorphoneHidden = !e, this.$.audioSelectDisabled = !e; 7441 }), this.subConfigValue("enableVideoRecording", (e) => { 7442 this.$.tabVideoHidden = !e; 7443 }), this.subConfigValue("defaultCameraMode", (e) => { 7444 if (this.cfg.enableVideoRecording) { 7445 this._handleActiveTab(e); 7446 return; 7447 } 7448 this._handleActiveTab("photo"); 7449 }); 7450 } 7451 _destroy() { 7452 for (const e of Ns) 7453 this[`${e}Response`]?.removeEventListener("change", this._handlePermissionsChange); 7454 navigator.mediaDevices?.removeEventListener("devicechange", this._getDevices); 7455 } 7456 async destroyCallback() { 7457 super.destroyCallback(), this._destroy(); 7458 } 7459} 7460F.types = Object.freeze({ 7461 PHOTO: "photo", 7462 VIDEO: "video" 7463}); 7464F.events = Object.freeze({ 7465 IDLE: "idle", 7466 SHOT: "shot", 7467 PLAY: "play", 7468 PAUSE: "pause", 7469 RESUME: "resume", 7470 STOP: "stop", 7471 RETAKE: "retake", 7472 ACCEPT: "accept" 7473}); 7474F.template = /* HTML */ 7475` 7476 <uc-activity-header> 7477 <button type="button" class="uc-mini-btn" set="onclick: *historyBack" l10n="@title:back"> 7478 <uc-icon name="back"></uc-icon> 7479 </button> 7480 <div set="@hidden: !cameraSelectHidden"> 7481 <uc-icon name="camera"></uc-icon>
7482 <span l10n="caption-camera"></span> 7483 </div> 7484 <uc-select 7485 class="uc-camera-select" 7486 set="$.options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" 7487 > 7488 </uc-select> 7489 <button 7490 type="button" 7491 class="uc-mini-btn uc-close-btn" 7492 set="onclick: *closeModal" 7493 l10n="@title:a11y-activity-header-button-close" 7494 > 7495 <uc-icon name="close"></uc-icon> 7496 </button> 7497 </uc-activity-header> 7498 <div class="uc-content"> 7499 <video 7500 muted 7501 autoplay 7502 playsinline 7503 set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" 7504 ref="video" 7505 ></video> 7506 <div class="uc-message-box" set="@hidden: messageHidden"> 7507 <span l10n="l10nMessage"></span> 7508 <button 7509 type="button" 7510 set="onclick: onRequestPermissions; @hidden: requestBtnHidden" 7511 l10n="camera-permissions-request" 7512 ></button> 7513 </div> 7514 </div> 7515 7516 <div class="uc-controls"> 7517 <div ref="switcher" class="uc-switcher" set="@hidden:!timerHidden"> 7518 <button 7519 data-id="photo" 7520 type="button" 7521 class="uc-switch uc-mini-btn" 7522 set="onclick: onClickTab; @hidden: tabCameraHidden" 7523 > 7524 <uc-icon name="camera"></uc-icon> 7525 </button> 7526 <button 7527 data-id="video" 7528 type="button" 7529 class="uc-switch uc-mini-btn" 7530 set="onclick: onClickTab; @hidden: tabVideoHidden" 7531 > 7532 <uc-icon name="video-camera"></uc-icon> 7533 </button> 7534 </div> 7535 7536 <button class="uc-secondary-btn uc-recording-timer" set="@hidden:timerHidden; onclick: onToggleRecording"> 7537 <uc-icon set="@name: currentTimelineIcon"></uc-icon> 7538 <span ref="timer"> 00:00 </span> 7539 <span ref="line" class="uc-line"></span> 7540 </button> 7541 7542 <div class="uc-camera-actions uc-camera-action" set="@hidden: cameraActionsHidden"> 7543 <button type="button" class="uc-secondary-btn" set="onclick: onRetake">Retake</button> 7544 <button type="button" class="uc-primary-btn" set="onclick: onAccept">Accept</button> 7545 </div> 7546 7547 <button 7548 type="button" 7549 class="uc-shot-btn uc-camera-action" 7550 set="onclick: onStartCamera; @class: mutableClassButton; @hidden: cameraHidden;" 7551 > 7552 <uc-icon set="@name: currentIcon"></uc-icon> 7553 </button> 7554 7555 <div class="uc-select"> 7556 <button class="uc-mini-btn uc-btn-microphone" set="onclick: onToggleAudio; @hidden: audioToggleMicorphoneHidden;"> 7557 <uc-icon set="@name:toggleMicorphoneIcon"></uc-icon> 7558 </button> 7559 7560 <uc-select 7561 class="uc-audio-select" 7562 set="$.options: audioSelectOptions; onchange: onAudioSelectChange; @hidden: audioSelectHidden; @disabled: audioSelectDisabled" 7563 > 7564 </uc-select> 7565 </div> 7566 </div> 7567`; 7568class Wr extends X { 7569 requireCtxName = !0; 7570 initCallback() { 7571 super.initCallback(), this.$["*eventEmitter"].bindTarget(this); 7572 } 7573 destroyCallback() { 7574 super.destroyCallback(), this.$["*eventEmitter"].unbindTarget(this); 7575 } 7576} 7577Wr.EventType = z; 7578const du = ( 7579 /** @type {UploadCtxProvider} */ 7580 /** @type {unknown} */ 7581 Wr 7582); 7583class Kr extends X { 7584 init$ = { 7585 ...this.init$, 7586 visible: !1, 7587 value: 0, 7588 "*commonProgress": 0 7589 }; 7590 initCallback() { 7591 super.initCallback(), this._unobserveCollection = this.uploadCollection.observeProperties(() => { 7592 let e = this.uploadCollection.items().some((t) => this.uploadCollection.read(t).getValue("isUploading")); 7593 this.$.visible = e; 7594 }), this.sub("visible", (e) => { 7595 e ? this.setAttribute("active", "") : this.removeAttribute("active"); 7596 }), this.sub("*commonProgress", (e) => { 7597 this.$.value = e; 7598 }); 7599 } 7600 destroyCallback() { 7601 super.destroyCallback(), this._unobserveCollection?.(); 7602 } 7603} 7604Kr.template = /* HTML */ 7605' <uc-progress-bar set="visible: visible; value: value"></uc-progress-bar> '; 7606class qr extends B { 7607 /** @type {Number} */ 7608 _value = 0; 7609 init$ = { 7610 ...this.init$, 7611 width: 0, 7612 opacity: 0 7613 }; 7614 initCallback() { 7615 super.initCallback(), this.defineAccessor("value", (e) => { 7616 if (e === void 0) 7617 return; 7618 const t = this._value; 7619 if (this._value = e, e === 0 && t > 0) { 7620 this.ref.line.addEventListener("transitionend", () => { 7621 this.style.setProperty("--l-width", this._value.toString()); 7622 }); 7623 return; 7624 } 7625 this.style.setProperty("--l-width", this._value.toString()); 7626 }), this.defineAccessor("visible", (e) => { 7627 this.ref.line.classList.toggle("uc-progress--hidden", !e); 7628 }); 7629 } 7630} 7631qr.template = /* HTML */ 7632' <div ref="line" class="uc-progress"></div> '; 7633const tt = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="; 7634function Zr(...i) { 7635 return i.reduce((e, t) => { 7636 if (typeof t == "string") 7637 return e[t] = !0, e; 7638 for (let s of Object.keys(t)) 7639 e[s] = t[s]; 7640 return e; 7641 }, {}); 7642}
7643function he(...i) { 7644 let e = Zr(...i); 7645 return Object.keys(e).reduce((t, s) => (e[s] && t.push(s), t), []).join(" "); 7646} 7647function hu(i, ...e) { 7648 let t = Zr(...e); 7649 for (let s of Object.keys(t)) 7650 i.classList.toggle(s, t[s]); 7651} 7652const fu = (i) => { 7653 if (!i) return be; 7654 const e = Ro(i).filter((t) => be.includes(t)); 7655 return e.length === 0 ? be : e; 7656}; 7657function pu(i) { 7658 return { 7659 "*originalUrl": null, 7660 "*faderEl": null, 7661 "*cropperEl": null, 7662 "*imgEl": null, 7663 "*imgContainerEl": null, 7664 "*networkProblems": !1, 7665 "*imageSize": null, 7666 /** @type {import('./types.js').Transformations} */ 7667 "*editorTransformations": {}, 7668 /** @type {import('./types.js').CropPresetList} */ 7669 "*cropPresetList": [], 7670 "*tabList": be, 7671 "*tabId": V.CROP, 7672 entry: null, 7673 extension: null, 7674 editorMode: !1, 7675 modalCaption: "", 7676 isImage: !1, 7677 msg: "", 7678 src: tt, 7679 fileType: "", 7680 showLoader: !1, 7681 // options 7682 uuid: null, 7683 cdnUrl: null, 7684 cropPreset: "", 7685 tabs: Oi(be), 7686 "presence.networkProblems": !1, 7687 "presence.modalCaption": !0, 7688 "presence.editorToolbar": !1, 7689 "presence.viewerToolbar": !0, 7690 // TODO: beware of wrong ctx in case of element re-creation: 7691 "*on.retryNetwork": () => { 7692 let e = i.querySelectorAll("img"); 7693 for (let t of e) { 7694 let s = t.src; 7695 t.src = tt, t.src = s; 7696 } 7697 i.$["*networkProblems"] = !1; 7698 }, 7699 /** @param {import('./types.js').Transformations} transformations */ 7700 "*on.apply": (e) => { 7701 if (!e) 7702 return; 7703 let t = i.$["*originalUrl"], s = Ue(Nt(e), "preview"), r = ae(t, s), n = { 7704 originalUrl: t, 7705 cdnUrlModifiers: s, 7706 cdnUrl: r, 7707 transformations: e 7708 }; 7709 i.dispatchEvent( 7710 new CustomEvent("apply", { 7711 detail: n, 7712 bubbles: !0, 7713 composed: !0 7714 }) 7715 ), i.remove(); 7716 }, 7717 "*on.cancel": () => { 7718 i.remove(), i.dispatchEvent( 7719 new CustomEvent("cancel", { 7720 bubbles: !0, 7721 composed: !0 7722 }) 7723 ); 7724 } 7725 }; 7726} 7727const mu = "<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol>
7727<symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='puc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#puc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#suc-icon-id__a)'/>
7727<path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#suc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#suc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#suc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#suc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#suc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#suc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#suc-icon-id__h)'/><defs><linearGradient id='suc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>", gu = ( 7728 /* HTML */ 7729 ` 7730 ${mu}
7731 <div class="uc-wrapper uc-wrapper_desktop"> 7732 <uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"> 7733 <div class="uc-network_problems_content"> 7734 <div class="uc-network_problems_icon"> 7735 <uc-icon name="sad"></uc-icon> 7736 </div> 7737 <div class="uc-network_problems_text">Network error</div> 7738 </div> 7739 <div class="uc-network_problems_footer"> 7740 <uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui> 7741 </div> 7742 </uc-presence-toggle> 7743 <div class="uc-viewport"> 7744 <div class="uc-file_type_outer"> 7745 <div class="uc-file_type">{{fileType}}</div> 7746 </div> 7747 <div class="uc-image_container" ref="img-container-el"> 7748 <img src="${tt}" class="uc-image uc-image_visible_from_editor" ref="img-el" /> 7749 <uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper> 7750 <uc-editor-image-fader ref="fader-el"></uc-editor-image-fader> 7751 </div> 7752 <div class="uc-info_pan">{{msg}}</div> 7753 </div> 7754 <div class="uc-toolbar"> 7755 <uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui> 7756 <div class="uc-toolbar_content uc-toolbar_content__editor"> 7757 <uc-editor-toolbar></uc-editor-toolbar> 7758 </div> 7759 </div> 7760 </div> 7761` 7762); 7763class _t extends B { 7764 ctxOwner = !0; 7765 static styleAttrs = ["uc-cloud-image-editor"]; 7766 constructor() { 7767 super(), this.init$ = { 7768 ...this.init$, 7769 ...pu(this) 7770 }; 7771 } 7772 /** @private */ 7773 _debouncedShowLoader = le(this._showLoader.bind(this), 300); 7774 /** 7775 * @private 7776 * @param {boolean} show 7777 */ 7778 _showLoader(e) { 7779 this.$.showLoader = e; 7780 } 7781 /** 7782 * To proper work, we need non-zero size the element. So, we'll wait for it. 7783 * 7784 * @private 7785 * @returns {Promise<void>} 7786 */ 7787 _waitForSize() { 7788 return new Promise((t, s) => { 7789 const r = setTimeout(() => { 7790 s(new Error("[cloud-image-editor] timeout waiting for non-zero container size")); 7791 }, 3e3), n = new ResizeObserver(([o]) => { 7792 o.contentRect.width > 0 && o.contentRect.height > 0 && (t(), clearTimeout(r), n.disconnect()); 7793 }); 7794 n.observe(this); 7795 }); 7796 } 7797 initCallback() { 7798 super.initCallback(), this.$["*faderEl"] = this.ref["fader-el"], this.$["*cropperEl"] = this.ref["cropper-el"], this.$["*imgContainerEl"] = this.ref["img-container-el"], this.initEditor(); 7799 } 7800 async updateImage() { 7801 if (this.isConnected) { 7802 if (await this._waitForSize(), this.$.cdnUrl) { 7803 const e = sr(this.$.cdnUrl), t = ft(this.$.cdnUrl, e); 7804 if (t === this.$["*originalUrl"]) 7805 return; 7806 this.$["*originalUrl"] = t; 7807 const s = So(this.$.cdnUrl), r = Po(s); 7808 this.$["*editorTransformations"] = r; 7809 } else if (this.$.uuid) { 7810 const e = ft(this.cfg.cdnCname, this.$.uuid); 7811 if (e === this.$["*originalUrl"]) 7812 return; 7813 this.$["*originalUrl"] = e, this.$["*editorTransformations"] = {}; 7814 } else 7815 throw new Error("No UUID nor CDN URL provided"); 7816 this.$["*tabId"] === V.CROP ? this.$["*cropperEl"].deactivate({ reset: !0 }) : this.$["*faderEl"].deactivate(); 7817 try { 7818 const e = await this.proxyUrl(ae(this.$["*originalUrl"], Ue("json"))), t = await fetch(e).then((n) => n.json()), { width: s, height: r } = ( 7819 /** @type {{ width: number; height: number }} */ 7820 t 7821 ); 7822 this.$["*imageSize"] = { width: s, height: r }, this.$["*tabId"] === V.CROP ? this.$["*cropperEl"].activate(this.$["*imageSize"]) : this.$["*faderEl"].activate({ url: this.$["*originalUrl"] }); 7823 } catch (e) { 7824 e && console.error("Failed to load image info", e); 7825 } 7826 } 7827 } 7828 async initEditor() { 7829 try { 7830 await this._waitForSize(); 7831 } catch (e) { 7832 this.isConnected && console.error(e.message); 7833 return; 7834 } 7835 this.ref["img-el"].addEventListener("load", () => { 7836 this._imgLoading = !1, this._debouncedShowLoader(!1), this.$.src !== tt && (this.$["*networkProblems"] = !1); 7837 }), this.ref["img-el"].addEventListener("error", () => { 7838 this._imgLoading = !1, this._debouncedShowLoader(!1), this.$["*networkProblems"] = !0; 7839 }), this.sub("src", (e) => { 7840 let t = this.ref["img-el"]; 7841 t.src !== e && (this._imgLoading = !0, t.src = e || tt); 7842 }), this.sub("cropPreset", (e) => { 7843 this.$["*cropPresetList"] = Or(e); 7844 }), this.sub( 7845 "tabs", 7846 /** @param {string} val */ 7847 (e) => { 7848 this.$["*tabList"] = fu(e); 7849 } 7850 ), this.sub("*tabId", (e) => { 7851 this.ref["img-el"].className = he("uc-image", { 7852 "uc-image_hidden_to_cropper": e === V.CROP, 7853 "uc-image_hidden_effects": e !== V.CROP 7854 }); 7855 }), this.classList.add("uc-editor_ON"), this.sub("*networkProblems", (e) => { 7856 this.$["presence.networkProblems"] = e, this.$["presence.modalCaption"] = !e; 7857 }), this.sub( 7858 "*editorTransformations", 7859 (e) => { 7860 if (Object.keys(e).length === 0) 7861 return; 7862 let t = this.$["*originalUrl"], s = Ue(Nt(e), "preview"), r = ae(t, s), n = { 7863 originalUrl: t, 7864 cdnUrlModifiers: s, 7865 cdnUrl: r, 7866 transformations: e 7867 }; 7868 this.dispatchEvent( 7869 new CustomEvent("change", { 7870 detail: n, 7871 bubbles: !0, 7872 composed: !0 7873 }) 7874 ); 7875 }, 7876 !1 7877 ), this.sub("uuid", (e) => e && this.updateImage()), this.sub("cdnUrl", (e) => e && this.updateImage()); 7878 } 7879} 7880_t.template = gu; 7881_t.bindAttributes({ 7882 uuid: "uuid", 7883 "cdn-url": "cdnUrl", 7884 "crop-preset": "cropPreset", 7885 tabs: "tabs" 7886}); 7887class Qr extends B { 7888 constructor() { 7889 super(), this.init$ = { 7890 ...this.init$, 7891 dragging: !1 7892 }, this._handlePointerUp = this._handlePointerUp_.bind(this), this._handlePointerMove = this._handlePointerMove_.bind(this), this._handleSvgPointerMove = this._handleSvgPointerMove_.bind(this); 7893 } 7894 /** 7895 * @private 7896 * @param {import('./types.js').Direction} direction 7897 */ 7898 _shouldThumbBeDisabled(e) { 7899 let t = this.$["*imageBox"]; 7900 if (!t) 7901 return; 7902 if (e === "" && t.height <= P && t.width <= P) 7903 return !0; 7904 let s = t.height <= P && (e.includes("n") || e.includes("s")), r = t.width <= P && (e.includes("e") || e.includes("w")); 7905 return s || r; 7906 } 7907 /** @private */ 7908 _createBackdrop() { 7909 let e = this.$["*cropBox"]; 7910 if (!e) 7911 return; 7912 let { x: t, y: s, width: r, height: n } = e, o = this.ref["svg-el"], a = ue("mask", { id: "backdrop-mask" }), l = ue("rect", { 7913 x: 0, 7914 y: 0, 7915 width: "100%", 7916 height: "100%", 7917 fill: "white" 7918 }), c = ue("rect", { 7919 x: t, 7920 y: s, 7921 width: r, 7922 height: n, 7923 fill: "black" 7924 }); 7925 a.appendChild(l), a.appendChild(c); 7926 let u = ue("rect", { 7927 x: 0, 7928 y: 0, 7929 width: "100%", 7930 height: "100%", 7931 fill: "var(--color-image-background)", 7932 "fill-opacity": 0.85, 7933 mask: "url(#backdrop-mask)" 7934 }); 7935 o.appendChild(u), o.appendChild(a), this._backdropMask = a, this._backdropMaskInner = c; 7936 } 7937 /** 7938 * @private Super Tricky workaround for the chromium bug See 7939 * https://bugs.chromium.org/p/chromium/issues/detail?id=330815 7940 */ 7941 _resizeBackdrop() { 7942 this._backdropMask && (this._backdropMask.style.display = "none", window.requestAnimationFrame(() => { 7943 this._backdropMask && (this._backdropMask.style.display = "block"); 7944 })); 7945 } 7946 /** @private */ 7947 _updateBackdrop() { 7948 let e = this.$["*cropBox"]; 7949 if (!e) 7950 return; 7951 let { x: t, y: s, width: r, height: n } = e; 7952 this._backdropMaskInner && Ye(this._backdropMaskInner, { x: t, y: s, width: r, height: n }); 7953 } 7954 /** @private */ 7955 _updateFrame() { 7956 let e = this.$["*cropBox"];
7957 if (!(!e || !this._frameGuides || !this._frameThumbs)) { 7958 for (let t of Object.values(this._frameThumbs)) { 7959 let { direction: s, pathNode: r, interactionNode: n, groupNode: o } = t, a = s === "", l = s.length === 2, { x: c, y: u, width: d, height: h } = e; 7960 if (a) 7961 Ye(n, { 7962 x: c, 7963 y: u, 7964 width: d, 7965 height: h 7966 }); 7967 else { 7968 const g = We( 7969 Math.min(d, h) / (Ai * 2 + ct) / 2, 7970 0, 7971 1 7972 ); 7973 let { d: y, center: A } = l ? Al(e, s, g) : wl( 7974 e, 7975 /** @type {Extract<import('./types.js').Direction, 'n' | 's' | 'w' | 'e'>} */ 7976 s, 7977 g 7978 ); 7979 const _ = Math.max( 7980 ws * We(Math.min(d, h) / ws / 3, 0, 1), 7981 yl 7982 ); 7983 Ye(n, { 7984 x: A[0] - _, 7985 y: A[1] - _, 7986 width: _ * 2, 7987 height: _ * 2 7988 }), Ye(r, { d: y }); 7989 } 7990 let p = this._shouldThumbBeDisabled(s); 7991 o.setAttribute( 7992 "class", 7993 he("uc-thumb", { 7994 "uc-thumb--hidden": p, 7995 "uc-thumb--visible": !p 7996 }) 7997 ); 7998 } 7999 Ye(this._frameGuides, { 8000 x: e.x - $e * 0.5, 8001 y: e.y - $e * 0.5, 8002 width: e.width + $e, 8003 height: e.height + $e 8004 }); 8005 } 8006 } 8007 /** 8008 * @param {import('./types.js').FrameThumbs} frameThumbs 8009 * @param {import('./types.js').Direction} direction 8010 */ 8011 _createThumb(e, t) { 8012 let s = ue("g"); 8013 s.classList.add("uc-thumb"), s.setAttribute("with-effects", ""); 8014 let r = ue("rect", { 8015 fill: "transparent" 8016 }), n = ue("path", { 8017 stroke: "currentColor", 8018 fill: "none", 8019 "stroke-width": xr 8020 }); 8021 s.appendChild(n), s.appendChild(r), e[t] = { 8022 direction: t, 8023 pathNode: n, 8024 interactionNode: r, 8025 groupNode: s 8026 }, t === "" && (s.style.cursor = "move"), r.addEventListener("pointerdown", this._handlePointerDown.bind(this, t)); 8027 } 8028 /** @private */ 8029 _createThumbs() { 8030 const e = {}; 8031 for (let t = 0; t < 3; t++) 8032 for (let s = 0; s < 3; s++) { 8033 let r = ( 8034 /** @type {import('./types.js').Direction} */ 8035 `${["n", "", "s"][t]}${["w", "", "e"][s]}` 8036 ); 8037 r !== "" && this._createThumb(e, r); 8038 } 8039 return this._createThumb(e, ""), e; 8040 } 8041 /** @private */ 8042 _createGuides() { 8043 let e = ue("svg"), t = ue("rect", { 8044 x: 0, 8045 y: 0, 8046 width: "100%", 8047 height: "100%", 8048 fill: "none", 8049 stroke: "currentColor", 8050 "stroke-width": $e, 8051 "stroke-opacity": 0.5 8052 }); 8053 e.appendChild(t); 8054 for (let s = 1; s <= 2; s++) { 8055 let r = ue("line", { 8056 x1: `${wt * s}%`, 8057 y1: "0%", 8058 x2: `${wt * s}%`, 8059 y2: "100%", 8060 stroke: "currentColor", 8061 "stroke-width": $e, 8062 "stroke-opacity": 0.3 8063 }); 8064 e.appendChild(r); 8065 } 8066 for (let s = 1; s <= 2; s++) { 8067 let r = ue("line", { 8068 x1: "0%", 8069 y1: `${wt * s}%`, 8070 x2: "100%", 8071 y2: `${wt * s}%`, 8072 stroke: "currentColor", 8073 "stroke-width": $e, 8074 "stroke-opacity": 0.3 8075 }); 8076 e.appendChild(r); 8077 } 8078 return e.classList.add("uc-guides", "uc-guides--semi-hidden"), e; 8079 } 8080 /** @private */ 8081 _createFrame() { 8082 let e = this.ref["svg-el"], t = document.createDocumentFragment(), s = this._createGuides(); 8083 t.appendChild(s); 8084 let r = this._createThumbs(); 8085 for (let { groupNode: n } of Object.values(r)) 8086 t.appendChild(n); 8087 e.appendChild(t), this._frameThumbs = r, this._frameGuides = s; 8088 } 8089 /** 8090 * @private 8091 * @param {import('./types.js').Direction} direction 8092 * @param {PointerEvent} e 8093 */ 8094 _handlePointerDown(e, t) { 8095 if (!this._frameThumbs) return; 8096 let s = this._frameThumbs[e]; 8097 if (this._shouldThumbBeDisabled(e)) 8098 return; 8099 let r = this.$["*cropBox"], { x: n, y: o } = this.ref["svg-el"].getBoundingClientRect(), a = t.x - n, l = t.y - o; 8100 this.$.dragging = !0, this._draggingThumb = s, this._dragStartPoint = [a, l], this._dragStartCrop = { ...r }; 8101 } 8102 /** 8103 * @private 8104 * @param {PointerEvent} e 8105 */ 8106 _handlePointerUp_(e) {
8107 this._updateCursor(), this.$.dragging && (e.stopPropagation(), e.preventDefault(), this.$.dragging = !1); 8108 } 8109 /** 8110 * @private 8111 * @param {PointerEvent} e 8112 */ 8113 _handlePointerMove_(e) { 8114 if (!this.$.dragging || !this._dragStartPoint || !this._draggingThumb) 8115 return; 8116 e.stopPropagation(), e.preventDefault(); 8117 let t = this.ref["svg-el"], { x: s, y: r } = t.getBoundingClientRect(), n = e.x - s, o = e.y - r, a = n - this._dragStartPoint[0], l = o - this._dragStartPoint[1], { direction: c } = this._draggingThumb; 8118 const u = this._calcCropBox(c, [a, l]); 8119 u && (this.$["*cropBox"] = u); 8120 } 8121 /** 8122 * @private 8123 * @param {import('./types.js').Direction} direction 8124 * @param {[Number, Number]} delta 8125 */ 8126 _calcCropBox(e, t) { 8127 const [s, r] = t; 8128 let n = this.$["*imageBox"], o = ( 8129 /** @type {import('./types.js').Rectangle} */ 8130 this._dragStartCrop ?? this.$["*cropBox"] 8131 ); 8132 const a = this.$["*cropPresetList"]?.[0], l = a ? a.width / a.height : void 0; 8133 if (e === "" ? o = El({ rect: o, delta: [s, r], imageBox: n }) : o = Ul({ rect: o, delta: [s, r], direction: e, aspectRatio: l, imageBox: n }), !Object.values(o).every((c) => Number.isFinite(c) && c >= 0)) { 8134 console.error("CropFrame is trying to create invalid rectangle", { 8135 payload: o 8136 }); 8137 return; 8138 } 8139 return Mt(Lt(o), this.$["*imageBox"]); 8140 } 8141 /** 8142 * @private 8143 * @param {PointerEvent} e 8144 */ 8145 _handleSvgPointerMove_(e) { 8146 if (!this._frameThumbs) return; 8147 let t = Object.values(this._frameThumbs).find((s) => { 8148 if (this._shouldThumbBeDisabled(s.direction)) 8149 return !1; 8150 let n = s.interactionNode.getBoundingClientRect(), o = { 8151 x: n.x, 8152 y: n.y, 8153 width: n.width, 8154 height: n.height 8155 }; 8156 return Ml(o, [e.x, e.y]); 8157 }); 8158 this._hoverThumb = t, this._updateCursor(); 8159 } 8160 /** @private */ 8161 _updateCursor() { 8162 let e = this._hoverThumb; 8163 this.ref["svg-el"].style.cursor = e ? Cl(e.direction) : "initial"; 8164 } 8165 /** @private */ 8166 _render() { 8167 this._updateBackdrop(), this._updateFrame(); 8168 } 8169 /** @param {boolean} visible */ 8170 toggleThumbs(e) { 8171 this._frameThumbs && Object.values(this._frameThumbs).map(({ groupNode: t }) => t).forEach((t) => { 8172 t.setAttribute( 8173 "class", 8174 he("uc-thumb", { 8175 "uc-thumb--hidden": !e, 8176 "uc-thumb--visible": e 8177 }) 8178 ); 8179 }); 8180 } 8181 initCallback() { 8182 super.initCallback(), this._createBackdrop(), this._createFrame(), this.sub("*imageBox", () => { 8183 this._resizeBackdrop(), window.requestAnimationFrame(() => { 8184 this._render(); 8185 }); 8186 }), this.sub("*cropBox", (e) => { 8187 e && (this._guidesHidden = e.height <= P || e.width <= P, window.requestAnimationFrame(() => { 8188 this._render(); 8189 })); 8190 }), this.sub("dragging", (e) => { 8191 this._frameGuides && this._frameGuides.setAttribute( 8192 "class", 8193 he({ 8194 "uc-guides--hidden": this._guidesHidden, 8195 "uc-guides--visible": !this._guidesHidden && e, 8196 "uc-guides--semi-hidden": !this._guidesHidden && !e 8197 }) 8198 ); 8199 }), this.ref["svg-el"].addEventListener("pointermove", this._handleSvgPointerMove, !0), document.addEventListener("pointermove", this._handlePointerMove, !0), document.addEventListener("pointerup", this._handlePointerUp, !0); 8200 } 8201 destroyCallback() { 8202 super.destroyCallback(), document.removeEventListener("pointermove", this._handlePointerMove), document.removeEventListener("pointerup", this._handlePointerUp); 8203 } 8204} 8205Qr.template = /* HTML */ 8206' <svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg> '; 8207class Jt extends B { 8208 init$ = { 8209 ...this.init$, 8210 active: !1, 8211 title: "", 8212 icon: "", 8213 "on.click": null, 8214 "title-prop": "" 8215 }; 8216 initCallback() { 8217 super.initCallback(), this._titleEl = this.ref["title-el"], this._iconEl = this.ref["icon-el"], this.sub("title", (e) => { 8218 this._titleEl && (this._titleEl.style.display = e ? "block" : "none"); 8219 }), this.sub("active", (e) => { 8220 this.className = he({ 8221 "uc-active": e, 8222 "uc-not_active": !e 8223 }); 8224 }), this.sub("on.click", (e) => { 8225 this.onclick = e; 8226 }); 8227 } 8228} 8229Jt.template = /* HTML */ 8230` 8231 <button type="button" role="option" l10n="@title:title-prop"> 8232 <uc-icon set="@name: icon;"></uc-icon> 8233 <div class="uc-title" ref="title-el">{{title}}</div> 8234 </button> 8235`; 8236function bu(i) { 8237 let e = i + 90; 8238 return e = e >= 360 ? 0 : e, e; 8239} 8240function vu(i, e) { 8241 return i === "rotate" ? bu(e) : ["mirror", "flip"].includes(i) ? !e : null; 8242} 8243class Jr extends Jt { 8244 initCallback() { 8245 super.initCallback(), this.defineAccessor("operation", (e) => { 8246 e && (this._operation = e, this.$.icon = e, this.bindL10n( 8247 "title-prop", 8248 () => this.l10n("a11y-cloud-editor-apply-crop", { 8249 name: this.l10n(e).toLowerCase() 8250 }) 8251 )); 8252 }), this.$["on.click"] = () => { 8253 let e = this.$["*cropperEl"].getValue(this._operation), t = vu(this._operation, e); 8254 this.$["*cropperEl"].setValue(this._operation, t); 8255 }; 8256 } 8257} 8258const at = { 8259 FILTER: "filter", 8260 COLOR_OPERATION: "color_operation" 8261}, Oe = "original"; 8262class en extends B { 8263 init$ = { 8264 ...this.init$, 8265 disabled: !1, 8266 min: 0, 8267 max: 100, 8268 value: 0, 8269 defaultValue: 0, 8270 zero: 0, 8271 "on.input": (e) => { 8272 this.$["*faderEl"].set(e), this.$.value = e; 8273 } 8274 }; 8275 /** 8276 * @param {String} operation 8277 * @param {String} [filter] 8278 */ 8279 setOperation(e, t) { 8280 this._controlType = e === "filter" ? at.FILTER : at.COLOR_OPERATION, this._operation = e, this._iconName = e, this._title = e.toUpperCase(), this._filter = t, this._initializeValues(), this.$["*faderEl"].activate({ 8281 url: this.$["*originalUrl"], 8282 operation: this._operation, 8283 value: this._filter === Oe ? void 0 : this.$.value, 8284 filter: this._filter === Oe ? void 0 : this._filter, 8285 fromViewer: !1 8286 }); 8287 } 8288 /** @private */ 8289 _initializeValues() { 8290 let { range: e, zero: t } = Je[this._operation], [s, r] = e; 8291 this.$.min = s, this.$.max = r, this.$.zero = t; 8292 let n = this.$["*editorTransformations"][this._operation]; 8293 if (this._controlType === at.FILTER) { 8294 let o = r; 8295 if (n) { 8296 let { name: a, amount: l } = n; 8297 o = a === this._filter ? l : r; 8298 } 8299 this.$.value = o, this.$.defaultValue = o; 8300 } 8301 if (this._controlType === at.COLOR_OPERATION) { 8302 let o = typeof n < "u" ? n : t; 8303 this.$.value = o, this.$.defaultValue = o; 8304 } 8305 } 8306 apply() { 8307 let e; 8308 this._controlType === at.FILTER ? this._filter === Oe ? e = null : e = { name: this._filter, amount: this.$.value } : e = this.$.value; 8309 let t = { 8310 ...this.$["*editorTransformations"], 8311 [this._operation]: e 8312 };
8313 this.$["*editorTransformations"] = t; 8314 } 8315 cancel() { 8316 this.$["*faderEl"].deactivate({ hide: !1 }); 8317 } 8318 initCallback() { 8319 super.initCallback(), this.sub("*originalUrl", (e) => { 8320 this._originalUrl = e; 8321 }), this.sub("value", (e) => { 8322 let t = `${this._filter || this._operation} ${e}`; 8323 this.$["*operationTooltip"] = t; 8324 }); 8325 } 8326} 8327en.template = /* HTML */ 8328` 8329 <uc-slider-ui 8330 ref="slider-el" 8331 set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" 8332 ></uc-slider-ui> 8333`; 8334function Xi(i) { 8335 let e = new Image(); 8336 return { promise: new Promise((r, n) => { 8337 e.src = i, e.onload = r, e.onerror = n; 8338 }), image: e, cancel: () => { 8339 e.naturalWidth === 0 && (e.src = tt); 8340 } }; 8341} 8342function wi(i) { 8343 let e = []; 8344 for (let n of i) { 8345 let o = Xi(n); 8346 e.push(o); 8347 } 8348 let t = e.map((n) => n.image); 8349 return { promise: Promise.allSettled(e.map((n) => n.promise)), images: t, cancel: () => { 8350 e.forEach((n) => { 8351 n.cancel(); 8352 }); 8353 } }; 8354} 8355class Yi extends Jt { 8356 constructor() { 8357 super(), this.init$ = { 8358 ...this.init$, 8359 active: !1, 8360 title: "", 8361 icon: "", 8362 isOriginal: !1, 8363 iconSize: "20", 8364 "on.click": null 8365 }; 8366 } 8367 _previewSrc() { 8368 let e = parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"), 10), t = window.devicePixelRatio, s = Math.ceil(t * e), r = t >= 2 ? "lightest" : "normal", n = 100, o = { ...this.$["*editorTransformations"] }; 8369 return o[this._operation] = this._filter !== Oe ? { 8370 name: this._filter, 8371 amount: n 8372 } : void 0, ae( 8373 this._originalUrl, 8374 Ue( 8375 cr, 8376 Nt(o), 8377 `quality/${r}`, 8378 `scale_crop/${s}x${s}/center` 8379 ) 8380 ); 8381 } 8382 /** 8383 * @param {IntersectionObserverEntry[]} entries 8384 * @param {IntersectionObserver} observer 8385 */ 8386 async _observerCallback(e, t) { 8387 if (e[0].isIntersecting) { 8388 let r = await this.proxyUrl(this._previewSrc()), n = this.ref["preview-el"], { promise: o, cancel: a } = Xi(r); 8389 this._cancelPreload = a, o.catch((l) => { 8390 this.$["*networkProblems"] = !0, console.error("Failed to load image", { error: l }); 8391 }).finally(() => { 8392 n.style.backgroundImage = `url(${r})`, n.setAttribute("loaded", ""), t.unobserve(this); 8393 }); 8394 } else 8395 this._cancelPreload?.(); 8396 } 8397 initCallback() { 8398 super.initCallback(), this.$["on.click"] = () => { 8399 this.$.active ? this.$.isOriginal || (this.$["*sliderEl"].setOperation(this._operation, this._filter), this.$["*showSlider"] = !0) : (this.$["*sliderEl"].setOperation(this._operation, this._filter), this.$["*sliderEl"].apply()), this.$["*currentFilter"] = this._filter; 8400 }, this.defineAccessor( 8401 "filter", 8402 /** @param {string} filter */ 8403 (t) => { 8404 this._operation = "filter", this._filter = t, this.$.isOriginal = t === Oe, this.$.icon = this.$.isOriginal ? "original" : "slider", this.bindL10n( 8405 "title-prop", 8406 () => this.l10n("a11y-cloud-editor-apply-filter", { 8407 name: t.toLowerCase() 8408 }) 8409 ); 8410 } 8411 ), this._observer = new window.IntersectionObserver(this._observerCallback.bind(this), { 8412 threshold: [0, 1] 8413 }); 8414 let e = this.$["*originalUrl"]; 8415 this._originalUrl = e, this.$.isOriginal ? this.ref["icon-el"].classList.add("uc-original-icon") : this._observer.observe(this), this.sub("*currentFilter", (t) => { 8416 this.$.active = t && t === this._filter; 8417 }), this.sub("isOriginal", (t) => { 8418 this.$.iconSize = t ? 40 : 20; 8419 }), this.sub("active", (t) => { 8420 if (this.$.isOriginal) 8421 return; 8422 let s = this.ref["icon-el"]; 8423 s.style.opacity = t ? "1" : "0"; 8424 let r = this.ref["preview-el"]; 8425 t ? r.style.opacity = "0" : r.style.backgroundImage && (r.style.opacity = "1"); 8426 }), this.sub("*networkProblems", async (t) => { 8427 if (!t) { 8428 let s = await this.proxyUrl(this._previewSrc()), r = this.ref["preview-el"]; 8429 r.style.backgroundImage && (r.style.backgroundImage = "none", r.style.backgroundImage = `url(${s})`); 8430 } 8431 }); 8432 } 8433 destroyCallback() { 8434 super.destroyCallback(), this._observer?.disconnect(), this._cancelPreload?.(); 8435 } 8436} 8437Yi.template = /* HTML */ 8438` 8439 <button type="button" role="option" l10n="@title:title-prop"> 8440 <div class="uc-preview" ref="preview-el"></div> 8441 <uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon> 8442 </button> 8443`; 8444class tn extends Jt { 8445 /** 8446 * @private 8447 * @type {String} 8448 */ 8449 _operation = ""; 8450 initCallback() { 8451 super.initCallback(), this.$["on.click"] = (e) => { 8452 this.$["*sliderEl"].setOperation(this._operation), this.$["*showSlider"] = !0, this.$["*currentOperation"] = this._operation; 8453 }, this.defineAccessor("operation", (e) => { 8454 e && (this._operation = e, this.$.icon = e, this.bindL10n( 8455 "title-prop", 8456 () => this.l10n("a11y-cloud-editor-apply-tuning", { 8457 name: this.l10n(e).toLowerCase() 8458 }) 8459 ), this.bindL10n("title", () => this.l10n(e))); 8460 }), this.sub("*editorTransformations", (e) => { 8461 if (!this._operation) 8462 return; 8463 let { zero: t } = Je[this._operation], s = e[this._operation], r = typeof s < "u" ? s !== t : !1; 8464 this.$.active = r; 8465 }); 8466 } 8467} 8468function _u(i, e) { 8469 let t = {}; 8470 for (let s of e) { 8471 let r = i[s]; 8472 (i.hasOwnProperty(s) || r !== void 0) && (t[s] = r); 8473 } 8474 return t; 8475} 8476function Wi(i, e, t) { 8477 let r = window.devicePixelRatio, n = Math.min(Math.ceil(e * r), 3e3), o = r >= 2 ? "lightest" : "normal"; 8478 return ae( 8479 i, 8480 Ue( 8481 cr, 8482 Nt(t), 8483 `quality/${o}`, 8484 `stretch/off/-/resize/${n}x`, 8485 `@clib/${Wt}/${Kt}/uc-cloud-image-editor/` 8486 ) 8487 ); 8488} 8489function yu(i) { 8490 return i ? [
8491 ({ dimensions: t, coords: s }) => [...t, ...s].every((r) => Number.isInteger(r) && Number.isFinite(r)), 8492 ({ dimensions: t, coords: s }) => t.every((r) => r > 0) && s.every((r) => r >= 0) 8493 ].every((t) => t(i)) : !0; 8494} 8495class sn extends B { 8496 ctxOwner = !0; 8497 constructor() { 8498 super(), this.init$ = { 8499 ...this.init$, 8500 image: null, 8501 "*padding": _l, 8502 /** @type {Operations} */ 8503 "*operations": { 8504 rotate: 0, 8505 mirror: !1, 8506 flip: !1 8507 }, 8508 /** @type {import('./types.js').Rectangle} */ 8509 "*imageBox": { 8510 x: 0, 8511 y: 0, 8512 width: 0, 8513 height: 0 8514 }, 8515 /** @type {import('./types.js').Rectangle} */ 8516 "*cropBox": { 8517 x: 0, 8518 y: 0, 8519 width: 0, 8520 height: 0 8521 } 8522 }, this._commitDebounced = le(this._commit.bind(this), 300), this._handleResizeThrottled = Gr(this._handleResize.bind(this), 100), this._imageSize = { width: 0, height: 0 }; 8523 } 8524 /** @private */ 8525 _handleResize() { 8526 !this.isConnected || !this._isActive || (this._initCanvas(), this._syncTransformations(), this._alignImage(), this._alignCrop(), this._draw()); 8527 } 8528 /** @private */ 8529 _syncTransformations() { 8530 let e = this.$["*editorTransformations"], t = _u(e, Object.keys(this.$["*operations"])), s = { ...this.$["*operations"], ...t }; 8531 this.$["*operations"] = s; 8532 } 8533 /** @private */ 8534 _initCanvas() { 8535 let e = this.ref["canvas-el"], t = e.getContext("2d"), s = this.offsetWidth, r = this.offsetHeight, n = window.devicePixelRatio; 8536 e.style.width = `${s}px`, e.style.height = `${r}px`, e.width = s * n, e.height = r * n, t?.scale(n, n), this._canvas = e, this._ctx = t; 8537 } 8538 /** @private */ 8539 _alignImage() { 8540 if (!this._isActive || !this.$.image) 8541 return; 8542 let e = this.$.image, t = this.$["*padding"], s = this.$["*operations"], { rotate: r } = s, n = { width: this.offsetWidth, height: this.offsetHeight }, o = nt({ width: e.naturalWidth, height: e.naturalHeight }, r), a; 8543 if (o.width > n.width - t * 2 || o.height > n.height - t * 2) { 8544 let l = o.width / o.height, c = n.width / n.height; 8545 if (l > c) { 8546 let u = n.width - t * 2, d = u / l, h = 0 + t, p = t + (n.height - t * 2) / 2 - d / 2; 8547 a = { x: h, y: p, width: u, height: d }; 8548 } else { 8549 let u = n.height - t * 2, d = u * l, h = t + (n.width - t * 2) / 2 - d / 2, p = 0 + t; 8550 a = { x: h, y: p, width: d, height: u }; 8551 } 8552 } else { 8553 let { width: l, height: c } = o, u = t + (n.width - t * 2) / 2 - l / 2, d = t + (n.height - t * 2) / 2 - c / 2; 8554 a = { x: u, y: d, width: l, height: c }; 8555 } 8556 this.$["*imageBox"] = Lt(a); 8557 } 8558 /** @private */ 8559 _alignCrop() { 8560 let e = this.$["*cropBox"], t = this.$["*imageBox"], s = this.$["*operations"], { rotate: r } = s, n = this.$["*editorTransformations"].crop, { width: o, x: a, y: l } = this.$["*imageBox"]; 8561 if (n) { 8562 let { 8563 dimensions: [d, h], 8564 coords: [p, g] 8565 } = n, { width: y } = nt(this._imageSize, r), A = o / y; 8566 e = Mt( 8567 Lt({ 8568 x: a + p * A, 8569 y: l + g * A, 8570 width: d * A, 8571 height: h * A 8572 }), 8573 this.$["*imageBox"] 8574 ); 8575 } 8576 const c = this.$["*cropPresetList"]?.[0], u = c ? c.width / c.height : void 0; 8577 if (!Dl(e, t) || u && !Rl(e, u)) { 8578 const d = t.width / t.height; 8579 let h = t.width, p = t.height; 8580 u && (d > u ? h = Math.min(t.height * u, t.width) : p = Math.min(t.width / u, t.height)), e = { 8581 x: t.x + t.width / 2 - h / 2, 8582 y: t.y + t.height / 2 - p / 2, 8583 width: h, 8584 height: p 8585 }; 8586 } 8587 this.$["*cropBox"] = Mt(Lt(e), this.$["*imageBox"]); 8588 } 8589 /** @private */ 8590 _drawImage() { 8591 let e = this._ctx; 8592 if (!e) return; 8593 let t = this.$.image, s = this.$["*imageBox"], r = this.$["*operations"], { mirror: n, flip: o, rotate: a } = r, l = nt({ width: s.width, height: s.height }, a); 8594 e.save(), e.translate(s.x + s.width / 2, s.y + s.height / 2), e.rotate(a * Math.PI * -1 / 180), e.scale(n ? -1 : 1, o ? -1 : 1), e.drawImage(t, -l.width / 2, -l.height / 2, l.width, l.height), e.restore(
8594); 8595 } 8596 /** @private */ 8597 _draw() { 8598 if (!this._isActive || !this.$.image || !this._canvas || !this._ctx) 8599 return; 8600 let e = this._canvas; 8601 this._ctx.clearRect(0, 0, e.width, e.height), this._drawImage(); 8602 } 8603 /** 8604 * @private 8605 * @param {{ fromViewer?: boolean }} options 8606 */ 8607 _animateIn({ fromViewer: e }) { 8608 this.$.image && (this.ref["frame-el"].toggleThumbs(!0), this._transitionToImage(), setTimeout(() => { 8609 this.className = he({ 8610 "uc-active_from_viewer": e, 8611 "uc-active_from_editor": !e, 8612 "uc-inactive_to_editor": !1 8613 }); 8614 })); 8615 } 8616 /** 8617 * @private 8618 * @returns {NonNullable<import('./types.js').Transformations['crop']>['dimensions']} 8619 */ 8620 _getCropDimensions() { 8621 let e = this.$["*cropBox"], t = this.$["*imageBox"], s = this.$["*operations"], { rotate: r } = s, { width: n, height: o } = t, { width: a, height: l } = nt(this._imageSize, r), { width: c, height: u } = e, d = n / a, h = o / l; 8622 return [ 8623 We(Math.round(c / d), 1, a), 8624 We(Math.round(u / h), 1, l) 8625 ]; 8626 } 8627 /** 8628 * @private 8629 * @returns {import('./types.js').Transformations['crop']} 8630 */ 8631 _getCropTransformation() { 8632 let e = this.$["*cropBox"], t = this.$["*imageBox"], s = this.$["*operations"], { rotate: r } = s, { width: n, height: o, x: a, y: l } = t, { width: c, height: u } = nt(this._imageSize, r), { x: d, y: h } = e, p = n / c, g = o / u, y = this._getCropDimensions(), A = { 8633 dimensions: y, 8634 coords: ( 8635 /** @type {[Number, Number]} */ 8636 [ 8637 We(Math.round((d - a) / p), 0, c - y[0]), 8638 We(Math.round((h - l) / g), 0, u - y[1]) 8639 ] 8640 ) 8641 }; 8642 if (!yu(A)) { 8643 console.error("Cropper is trying to create invalid crop object", { 8644 payload: A 8645 }); 8646 return; 8647 } 8648 if (!(y[0] === c && y[1] === u)) 8649 return A; 8650 } 8651 /** @private */ 8652 _commit() { 8653 if (!this.isConnected || !this._imageSize) 8654 return; 8655 let e = this.$["*operations"], { rotate: t, mirror: s, flip: r } = e, n = this._getCropTransformation(), a = { 8656 ...this.$["*editorTransformations"], 8657 crop: n, 8658 rotate: t, 8659 mirror: s, 8660 flip: r 8661 }; 8662 this.$["*editorTransformations"] = a; 8663 } 8664 /** 8665 * @param {String} operation 8666 * @param {Number} value 8667 * @returns {void} 8668 */ 8669 setValue(e, t) { 8670 this.$["*operations"] = { 8671 ...this.$["*operations"], 8672 [e]: t 8673 }, this._isActive && (this._alignImage(), this._alignCrop(), this._draw()); 8674 } 8675 /** 8676 * @param {keyof Operations} operation 8677 * @returns {Number | boolean} 8678 */ 8679 getValue(e) { 8680 return this.$["*operations"][e]; 8681 } 8682 /** 8683 * @param {import('./types.js').ImageSize} imageSize 8684 * @param {{ fromViewer?: boolean }} options 8685 */ 8686 async activate(e, { fromViewer: t } = {}) { 8687 if (!this._isActive) { 8688 this._isActive = !0, this._imageSize = e, this.removeEventListener("transitionend", this._reset); 8689 try { 8690 this.$.image = await this._waitForImage(this.$["*originalUrl"], this.$["*editorTransformations"]), this._syncTransformations(), this._animateIn({ fromViewer: t }); 8691 } catch (s) { 8692 console.error("Failed to activate cropper", { error: s }); 8693 } 8694 this._observer = new ResizeObserver(([s]) => { 8695 s.contentRect.width > 0 && s.contentRect.height > 0 && this._isActive && this.$.image && this._handleResizeThrottled(); 8696 }), this._observer.observe(this); 8697 } 8698 } 8699 deactivate({ reset: e = !1 } = {}) { 8700 this._isActive && (!e && this._commit(), this._isActive = !1, this._transitionToCrop(), this.className = he({ 8701 "uc-active_from_viewer": !1, 8702 "uc-active_from_editor": !1, 8703 "uc-inactive_to_editor": !0 8704 }), this.ref["frame-el"].toggleThumbs(!1), this.addEventListener("transitionend", this._reset, { once: !0 }), this._observer?.disconnect()); 8705 } 8706 /** @private */ 8707 _transitionToCrop() { 8708 let e = this._getCropDimensions(), t = Math.min(this.offsetWidth, e[0]) / this.$["*cropBox"].width, s = Math.min(this.offsetHeight, e[1]) / this.$["*cropBox"].height, r = Math.min(t, s), n = this.$["*cropBox"].x + this.$["*cropBox"].width / 2, o = this.$["*cropBox"].y + this.$["*cropBox"].height / 2; 8709 this.style.transform = `scale(${r}) translate(${(this.offsetWidth / 2 - n) / r}px, ${(this.offsetHeight / 2 - o) / r}px)`, this.style.transformOrigin = `${n}px ${o}px`; 8710 } 8711 /** @private */ 8712 _transitionToImage() { 8713 let e = this.$["*cropBox"].x + this.$["*cropBox"].width / 2, t = this.$["*cropBox"].y + this.$["*cropBox"].height / 2; 8714 this.style.transform = "scale(1)", this.style.transformOrigin = `${e}px ${t}px`; 8715 } 8716 /** @private */ 8717 _reset() { 8718 this._isActive || (this.$.image = null); 8719 } 8720 /** 8721 * @private 8722 * @param {String} originalUrl 8723 * @param {import('./types.js').Transformations} transformations 8724 * @returns {Promise<HTMLImageElement>} 8725 */ 8726 async _waitForImage(e, t) { 8727 let s = this.offsetWidth; 8728 t = { 8729 ...t, 8730 crop: void 0, 8731 rotate: void 0, 8732 flip: void 0, 8733 mirror: void 0 8734 }; 8735 let r = await this.proxyUrl(Wi(e, s, t)), { promise: n, cancel: o, image: a } = Xi(r), l = this._handleImageLoading(r); 8736 return a.addEventListener("load", l, { once: !0 }), a.addEventListener("error", l, { once: !0 }), this._cancelPreload?.(), this._cancelPreload = o, n.then(() => a).catch((c) => (console.error("Failed to load image", { error: c }), this.$["*networkProblems"] = !0, Promise.resolve(a))); 8737 } 8738 /** 8739 * @private 8740 * @param {String} src 8741 * @returns {() => void} Destructor 8742 */ 8743 _handleImageLoading(e) { 8744 let t = "crop", s = this.$["*loadingOperations"];
8745 return s.get(t) || s.set(t, /* @__PURE__ */ new Map()), s.get(t).get(e) || (s.set(t, s.get(t).set(e, !0)), this.$["*loadingOperations"] = s), () => { 8746 s?.get(t)?.has(e) && (s.get(t).delete(e), this.$["*loadingOperations"] = s); 8747 }; 8748 } 8749 initCallback() { 8750 super.initCallback(), this.sub("*imageBox", () => { 8751 this._draw(); 8752 }), this.sub("*cropBox", () => { 8753 this.$.image && this._commitDebounced(); 8754 }), this.sub("*cropPresetList", () => { 8755 this._alignCrop(); 8756 }), setTimeout(() => { 8757 this.sub("*networkProblems", (e) => { 8758 e || this._isActive && this.activate(this._imageSize, { fromViewer: !1 }); 8759 }); 8760 }, 0); 8761 } 8762 destroyCallback() { 8763 super.destroyCallback(), this._observer?.disconnect(); 8764 } 8765} 8766sn.template = /* HTML */ 8767` 8768 <canvas class="uc-canvas" ref="canvas-el"></canvas> 8769 <uc-crop-frame ref="frame-el"></uc-crop-frame> 8770`; 8771function zs(i, e, t) { 8772 let s = Array(t); 8773 t--; 8774 for (let r = t; r >= 0; r--) 8775 s[r] = Math.ceil((r * e + (t - r) * i) / t); 8776 return s; 8777} 8778function Au(i) { 8779 return i.reduce( 8780 (e, t, s) => s < i.length - 1 ? [...e, [t, i[s + 1]]] : e, 8781 [] 8782 ); 8783} 8784function wu(i, e, t) { 8785 let s = Au(i).find(([r, n]) => r <= e && e <= n); 8786 return i.map((r) => { 8787 let n = Math.abs(s[0] - s[1]), o = Math.abs(e - s[0]) / n; 8788 return s[0] === r ? e > t ? 1 : 1 - o : s[1] === r ? e >= t ? o : 1 : 0; 8789 }); 8790} 8791function Cu(i, e) { 8792 return i.map((t, s) => t < e ? i.length - s : s); 8793} 8794function Hs(i, e) { 8795 let t = Je[i].keypointsNumber, { range: s, zero: r } = Je[i]; 8796 return [.../* @__PURE__ */ new Set([...zs(s[0], r, t + 1), ...zs(r, s[1], t + 1), r, e])].sort( 8797 (n, o) => n - o 8798 ); 8799} 8800class Eu extends B { 8801 constructor() { 8802 super(), this._isActive = !1, this._hidden = !0, this._addKeypointDebounced = le(this._addKeypoint.bind(this), 600), this.classList.add("uc-inactive_to_cropper"); 8803 } 8804 /** 8805 * @private 8806 * @param {String} src 8807 * @returns {() => void} Destructor 8808 */ 8809 _handleImageLoading(e) { 8810 let t = this._operation, s = this.$["*loadingOperations"]; 8811 return s.get(t) || s.set(t, /* @__PURE__ */ new Map()), s.get(t).get(e) || (s.set(t, s.get(t).set(e, !0)), this.$["*loadingOperations"] = s), () => { 8812 s?.get(t)?.has(e) && (s.get(t).delete(e), this.$["*loadingOperations"] = s); 8813 }; 8814 } 8815 /** @private */ 8816 _flush() { 8817 window.cancelAnimationFrame(this._raf), this._raf = window.requestAnimationFrame(() => { 8818 for (let e of this._keypoints) { 8819 let { image: t } = e; 8820 t && (t.style.opacity = e.opacity.toString(), t.style.zIndex = e.zIndex.toString()); 8821 } 8822 }); 8823 } 8824 /** 8825 * @private 8826 * @param {Object} options 8827 * @param {String} [options.url] 8828 * @param {String} [options.filter] 8829 * @param {String} [options.operation] 8830 * @param {Number} [options.value] 8831 * @returns {Promise<String>} 8832 */ 8833 async _imageSrc({ url: e = this._url, filter: t = this._filter, operation: s, value: r } = {}) { 8834 let n = { ...this._transformations }; 8835 s && (n[s] = t ? { name: t, amount: r } : r); 8836 let o = this.offsetWidth; 8837 return await this.proxyUrl(Wi(e, o, n)); 8838 } 8839 /** 8840 * @private 8841 * @param {String} operation 8842 * @param {Number} value 8843 * @returns {Promise<Keypoint>} 8844 */ 8845 async _constructKeypoint(e, t) { 8846 return { 8847 src: await this._imageSrc({ operation: e, value: t }), 8848 image: null, 8849 opacity: 0, 8850 zIndex: 0, 8851 value: t 8852 }; 8853 } 8854 /** 8855 * Check if current operation and filter equals passed ones 8856 * 8857 * @private 8858 * @param {String} operation 8859 * @param {String} [filter] 8860 * @returns {Boolean} 8861 */ 8862 _isSame(e, t) { 8863 return this._operation === e && this._filter === t; 8864 } 8865 /** 8866 * @private 8867 * @param {String} operation 8868 * @param {String | null} filter 8869 * @param {Number} value 8870 */ 8871 async _addKeypoint(e, t, s) { 8872 let r = () => !this._isSame(e, t) || this._value !== s || !!this._keypoints.find((l) => l.value === s); 8873 if (r()) 8874 return; 8875 let n = await this._constructKeypoint(e, s), o = new Image(); 8876 o.src = n.src; 8877 let a = this._handleImageLoading(n.src); 8878 o.addEventListener("load", a, { once: !0 }), o.addEventListener("error", a, { once: !0 }), n.image = o, o.classList.add("uc-fader-image"), o.addEventListener( 8879 "load", 8880 () => { 8881 if (r()) 8882 return; 8883 let l = this._keypoints, c = l.findIndex((d) => d.value > s), u = c < l.length ? l[c].image : null; 8884 !this._container || u && !this._container.contains(u) || (l.splice(c, 0, n), this._container.insertBefore(o, u), this._update(e, s)); 8885 }, 8886 { once: !0 } 8887 ), o.addEventListener( 8888 "error", 8889 () => { 8890 this.$["*networkProblems"] = !0; 8891 }, 8892 { once: !0 } 8893 ); 8894 } 8895 /** @param {String | Number} value */ 8896 set(e) { 8897 e = typeof e == "string" ? parseInt(e, 10) : e, this._update(this._operation, e), this._addKeypointDebounced(this._operation, this._filter, e); 8898 } 8899 /** 8900 * @private 8901 * @param {String} operation 8902 * @param {Number} value 8903 */ 8904 _update(e, t) { 8905 this._operation = e, this._value = t; 8906 let { zero: s } = Je[e], r = this._keypoints.map((a) => a.value), n = wu(r, t, s), o = Cu(r, s); 8907 for (let [a, l] of Object.entries(this._keypoints)) 8908 l.opacity = n[a], l.zIndex = o[a]; 8909 this._flush(); 8910 } 8911 /** @private */ 8912 _createPreviewImage() { 8913 let e = new Image(); 8914 return e.classList.add("uc-fader-image", "uc-fader-image--preview"), e.style.opacity = "0", e; 8915 } 8916 /** @private */ 8917 async _initNodes() { 8918 let e = document.createDocumentFragment(); 8919 this._previewImage = this._previewImage || this._createPreviewImage(), !this.contains(this._previewImage) && e.appendChild(this._previewImage); 8920 let t = document.createElement("div"); 8921 e.appendChild(t); 8922 let s = this._keypoints.map((c) => c.src), { images: r, promise: n, cancel: o } = wi(s); 8923 r.forEach((c) => { 8924 let u = this._handleImageLoading(c.src); 8925 c.addEventListener("load", u), c.addEventListener("error", u); 8926 }), this._cancelLastImages = () => { 8927 o(), this._cancelLastImages = void 0; 8928 }; 8929 let a = this._operation, l = this._filter; 8930 await n, this._isActive && this._isSame(a, l) && (this._container && this._container.remove(), this._container = t, this._keypoints.forEac
8930h((c, u) => { 8931 let d = r[u]; 8932 d.classList.add("uc-fader-image"), c.image = d, this._container.appendChild(d); 8933 }), this.appendChild(e), this._flush()); 8934 } 8935 /** @param {import('./types.js').Transformations} transformations */ 8936 async setTransformations(e) { 8937 if (this._transformations = e, this._previewImage) { 8938 let t = await this._imageSrc(), s = this._handleImageLoading(t); 8939 this._previewImage.src = t, this._previewImage.addEventListener("load", s, { once: !0 }), this._previewImage.addEventListener("error", s, { once: !0 }), this._previewImage.style.opacity = "1", this._previewImage.addEventListener( 8940 "error", 8941 () => { 8942 this.$["*networkProblems"] = !0; 8943 }, 8944 { once: !0 } 8945 ); 8946 } 8947 } 8948 /** 8949 * @param {object} options 8950 * @param {String} options.url 8951 * @param {String} options.operation 8952 * @param {Number} options.value 8953 * @param {String} [options.filter] 8954 */ 8955 async preload({ url: e, filter: t, operation: s, value: r }) { 8956 this._cancelBatchPreload && this._cancelBatchPreload(); 8957 let n = Hs(s, r), o = await Promise.all(n.map((l) => this._imageSrc({ url: e, filter: t, operation: s, value: l }))), { cancel: a } = wi(o); 8958 this._cancelBatchPreload = a; 8959 } 8960 /** @private */ 8961 _setOriginalSrc(e) { 8962 let t = this._previewImage || this._createPreviewImage(); 8963 if (!this.contains(t) && this.appendChild(t), this._previewImage = t, t.src === e) { 8964 t.style.opacity = "1", t.style.transform = "scale(1)", this.className = he({ 8965 "uc-active_from_viewer": this._fromViewer, 8966 "uc-active_from_cropper": !this._fromViewer, 8967 "uc-inactive_to_cropper": !1 8968 }); 8969 return; 8970 } 8971 t.style.opacity = "0"; 8972 let s = this._handleImageLoading(e); 8973 t.addEventListener("error", s, { once: !0 }), t.src = e, t.addEventListener( 8974 "load", 8975 () => { 8976 s(), t && (t.style.opacity = "1", t.style.transform = "scale(1)", this.className = he({ 8977 "uc-active_from_viewer": this._fromViewer, 8978 "uc-active_from_cropper": !this._fromViewer, 8979 "uc-inactive_to_cropper": !1 8980 })); 8981 }, 8982 { once: !0 } 8983 ), t.addEventListener( 8984 "error", 8985 () => { 8986 this.$["*networkProblems"] = !0; 8987 }, 8988 { once: !0 } 8989 ); 8990 } 8991 /** 8992 * @param {object} options 8993 * @param {String} options.url 8994 * @param {String} [options.operation] 8995 * @param {Number} [options.value] 8996 * @param {String} [options.filter] 8997 * @param {Boolean} [options.fromViewer] 8998 */ 8999 async activate({ url: e, operation: t, value: s, filter: r, fromViewer: n }) { 9000 if (this._isActive = !0, this._hidden = !1, this._url = e, this._operation = t || "initial", this._value = s, this._filter = r, this._fromViewer = n, typeof s != "number" && !r) { 9001 let a = await this._imageSrc({ operation: t, value: s }); 9002 this._setOriginalSrc(a), this._container && this._container.remove(); 9003 return; 9004 } 9005 this._keypoints = await Promise.all( 9006 Hs(t, s).map((a) => this._constructKeypoint(t, a)) 9007 ), this._update(t, s), this._initNodes(); 9008 } 9009 /** @param {{ hide?: Boolean }} options */ 9010 deactivate({ hide: e = !0 } = {}) { 9011 this._isActive = !1, this._cancelLastImages && this._cancelLastImages(), this._cancelBatchPreload && this._cancelBatchPreload(), e && !this._hidden ? (this._hidden = !0, this._previewImage && (this._previewImage.style.transform = "scale(1)"), this.className = he({ 9012 "uc-active_from_viewer": !1, 9013 "uc-active_from_cropper": !1, 9014 "uc-inactive_to_cropper": !0 9015 }), this.addEventListener( 9016 "transitionend", 9017 () => { 9018 this._container && this._container.remove(); 9019 }, 9020 { once: !0 } 9021 )) : this._container && this._container.remove(); 9022 } 9023} 9024const Tu = 1; 9025class rn extends B { 9026 initCallback() { 9027 super.initCallback(), this.addEventListener( 9028 "wheel", 9029 (e) => { 9030 e.preventDefault(); 9031 let { deltaY: t, deltaX: s } = e; 9032 Math.abs(s) > Tu ? this.scrollLeft += s : this.scrollLeft += t; 9033 }, 9034 { 9035 passive: !1 9036 } 9037 ), this.addEventListener("scroll", () => { 9038 }, {
9039 passive: !0 9040 }); 9041 } 9042} 9043rn.template = /* HTML */ 9044" <slot></slot> "; 9045function Iu(i) { 9046 return ( 9047 /* HTML */ 9048 ` 9049 <uc-presence-toggle 9050 class="uc-tab-toggle" 9051 set="visible: presence.tabToggle.${i}; styles: presence.tabToggleStyles;" 9052 > 9053 <uc-btn-ui 9054 theme="tab" 9055 ref="tab-toggle-${i}" 9056 data-id="${i}" 9057 icon="${i}" 9058 set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${i}; title-prop: a11y-editor-tab-${i}" 9059 > 9060 </uc-btn-ui> 9061 </uc-presence-toggle> 9062 ` 9063 ); 9064} 9065function Su(i) { 9066 return ( 9067 /* HTML */ 9068 ` 9069 <uc-presence-toggle 9070 id="tab_${i}" 9071 class="uc-tab-content" 9072 set="visible: presence.tabContent.${i}; styles: presence.tabContentStyles" 9073 > 9074 <uc-editor-scroller hidden-scrollbar> 9075 <div class="uc-controls-list_align"> 9076 <div 9077 role="listbox" 9078 aria-orientation="horizontal" 9079 class="uc-controls-list_inner" 9080 ref="controls-list-${i}" 9081 ></div> 9082 </div> 9083 </uc-editor-scroller> 9084 </uc-presence-toggle> 9085 ` 9086 ); 9087} 9088class nn extends B { 9089 constructor() { 9090 super(), this.init$ = { 9091 ...this.init$, 9092 "*sliderEl": null, 9093 /** @type {import('./types.js').LoadingOperations} */ 9094 "*loadingOperations": /* @__PURE__ */ new Map(), 9095 "*showSlider": !1, 9096 "*currentFilter": Oe, 9097 "*currentOperation": null, 9098 showLoader: !1, 9099 filters: Mo, 9100 colorOperations: Uo, 9101 cropOperations: Do, 9102 "*operationTooltip": null, 9103 "presence.mainToolbar": !0, 9104 "presence.subToolbar": !1, 9105 "presence.tabToggles": !0, 9106 "presence.tabContent.crop": !1, 9107 "presence.tabContent.tuning": !1, 9108 "presence.tabContent.filters": !1, 9109 "presence.tabToggle.crop": !0, 9110 "presence.tabToggle.tuning": !0, 9111 "presence.tabToggle.filters": !0, 9112 "presence.subTopToolbarStyles": { 9113 hidden: "uc-sub-toolbar--top-hidden", 9114 visible: "uc-sub-toolbar--visible" 9115 }, 9116 "presence.subBottomToolbarStyles": { 9117 hidden: "uc-sub-toolbar--bottom-hidden", 9118 visible: "uc-sub-toolbar--visible" 9119 }, 9120 "presence.tabContentStyles": { 9121 hidden: "uc-tab-content--hidden", 9122 visible: "uc-tab-content--visible" 9123 }, 9124 "presence.tabToggleStyles": { 9125 hidden: "uc-tab-toggle--hidden", 9126 visible: "uc-tab-toggle--visible" 9127 }, 9128 "presence.tabTogglesStyles": { 9129 hidden: "uc-tab-toggles--hidden", 9130 visible: "uc-tab-toggles--visible" 9131 }, 9132 "on.cancel": () => { 9133 this._cancelPreload?.(), this.$["*on.cancel"](); 9134 }, 9135 "on.apply": () => { 9136 this.$["*on.apply"](this.$["*editorTransformations"]); 9137 }, 9138 "on.applySlider": () => { 9139 this.ref["slider-el"].apply(), this._onSliderClose(); 9140 }, 9141 "on.cancelSlider": () => { 9142 this.ref["slider-el"].cancel(), this._onSliderClose(); 9143 }, 9144 /** @param {MouseEvent} e */ 9145 "on.clickTab": (e) => { 9146 const t = ( 9147 /** @type {HTMLElement} */ 9148 e.currentTarget.getAttribute("data-id") 9149 ); 9150 t && this._activateTab(t, { fromViewer: !1 }); 9151 }, 9152 tab_role: "tab", 9153 [`tab_${V.TUNING}`]: `tab_${V.TUNING}`, 9154 [`tab_${V.CROP}`]: `tab_${V.CROP}`, 9155 [`tab_${V.FILTERS}`]: `tab_${V.FILTERS}`, 9156 cancel: "cancel", 9157 apply: "apply", 9158 "a11y-editor-tab-filters": "a11y-editor-tab-filters", 9159 "a11y-editor-tab-tuning": "a11y-editor-tab-tuning", 9160 "a11y-editor-tab-crop": "a11y-editor-tab-crop" 9161 }, this._debouncedShowLoader = le(this._showLoader.bind(this), 500); 9162 } 9163 /** @private */ 9164 _onSliderClose() { 9165 this.$["*showSlider"] = !1, this.$["*tabId"] === V.TUNING && this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible", !1); 9166 } 9167 /** 9168 * @private 9169 * @param {String} operation 9170 */ 9171 _createOperationControl(e) { 9172 let t = new tn(); 9173 return t.operation = e, t; 9174 } 9175 /** 9176 * @private 9177 * @param {String} filter 9178 */ 9179 _createFilterControl(e) { 9180 let t = new Yi(); 9181 return t.filter = e, t; 9182 } 9183 /** 9184 * @private 9185 * @param {String} operation 9186 */ 9187 _createToggleControl(e) { 9188 let t = new Jr(); 9189 return t.operation = e, t; 9190 } 9191 /** 9192 * @private 9193 * @param {String} tabId 9194 */ 9195 _renderControlsList(e) { 9196 let t = this.ref[`controls-list-${e}`], s = document.createDocumentFragment(); 9197 e === V.CROP ? this.$.cropOperations.forEach( 9198 /** @param {string} operation */ 9199 (r) => { 9200 let n = this._createToggleControl(r); 9201 s.appendChild(n); 9202 }
9203 ) : e === V.FILTERS ? [Oe, ...this.$.filters].forEach((r) => { 9204 let n = this._createFilterControl(r); 9205 s.appendChild(n); 9206 }) : e === V.TUNING && this.$.colorOperations.forEach( 9207 /** @param {string} operation */ 9208 (r) => { 9209 let n = this._createOperationControl(r); 9210 s.appendChild(n); 9211 } 9212 ), [...s.children].forEach((r, n) => { 9213 n === s.childNodes.length - 1 && r.classList.add("uc-controls-list_last-item"); 9214 }), t.innerHTML = "", t.appendChild(s); 9215 } 9216 /** 9217 * @private 9218 * @param {String} id 9219 * @param {{ fromViewer?: Boolean }} options 9220 */ 9221 _activateTab(e, { fromViewer: t }) { 9222 this.$["*tabId"] = e, e === V.CROP ? (this.$["*faderEl"].deactivate(), this.$["*cropperEl"].activate(this.$["*imageSize"], { fromViewer: t })) : (this.$["*faderEl"].activate({ url: this.$["*originalUrl"], fromViewer: t }), this.$["*cropperEl"].deactivate()); 9223 for (let s of be) { 9224 let r = s === e, n = this.ref[`tab-toggle-${s}`]; 9225 n.active = r, r ? (this._renderControlsList(e), this._syncTabIndicator()) : this._unmountTabControls(s), this.$[`presence.tabContent.${s}`] = r; 9226 } 9227 } 9228 /** 9229 * @private 9230 * @param {String} tabId 9231 */ 9232 _unmountTabControls(e) { 9233 let t = this.ref[`controls-list-${e}`]; 9234 t && (t.innerHTML = ""); 9235 } 9236 /** @private */ 9237 _syncTabIndicator() { 9238 let e = this.ref[`tab-toggle-${this.$["*tabId"]}`], t = this.ref["tabs-indicator"]; 9239 t.style.transform = `translateX(${e.offsetLeft}px)`; 9240 } 9241 /** @private */ 9242 async _preloadEditedImage() { 9243 if (this.$["*imgContainerEl"] && this.$["*originalUrl"]) { 9244 let e = this.$["*imgContainerEl"].offsetWidth, t = await this.proxyUrl(Wi(this.$["*originalUrl"], e, this.$["*editorTransformations"])); 9245 this._cancelPreload?.(); 9246 let { cancel: s } = wi([t]); 9247 this._cancelPreload = () => { 9248 s(), this._cancelPreload = void 0; 9249 }; 9250 } 9251 } 9252 /** 9253 * @private 9254 * @param {boolean} show 9255 */ 9256 _showLoader(e) { 9257 this.$.showLoader = e; 9258 } 9259 _updateInfoTooltip = le(() => { 9260 const e = this.$["*editorTransformations"], t = this.$["*currentOperation"]; 9261 let s = "", r = !1; 9262 if (this.$["*tabId"] === V.FILTERS) 9263 if (r = !0, this.$["*currentFilter"] && e?.filter?.name === this.$["*currentFilter"]) { 9264 let n = e?.filter?.amount || 100; 9265 s = this.$["*currentFilter"] + " " + n; 9266 } else 9267 s = this.l10n(Oe); 9268 else if (this.$["*tabId"] === V.TUNING && t) { 9269 r = !0; 9270 let n = e?.[t] || Je[t].zero; 9271 s = this.l10n(t) + " " + n; 9272 } 9273 r && (this.$["*operationTooltip"] = s), this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible", r); 9274 }, 0); 9275 initCallback() { 9276 super.initCallback(), this.$["*sliderEl"] = this.ref["slider-el"], this.sub("*imageSize", (e) => { 9277 e && setTimeout(() => { 9278 this._activateTab(this.$["*tabId"], { fromViewer: !0 }); 9279 }, 0); 9280 }), this.sub("*editorTransformations", (e) => { 9281 let t = e?.filter?.name; 9282 this.$["*currentFilter"] !== t && (this.$["*currentFilter"] = t); 9283 }), this.sub("*currentFilter", () => { 9284 this._updateInfoTooltip(); 9285 }), this.sub("*currentOperation", () => { 9286 this._updateInfoTooltip(); 9287 }), this.sub("*tabId", () => { 9288 this._updateInfoTooltip(); 9289 }), this.sub("*originalUrl", () => { 9290 this.$["*faderEl"] && this.$["*faderEl"].deactivate(); 9291 }), this.sub("*editorTransformations", (e) => { 9292 this._preloadEditedImage(), this.$["*faderEl"] && this.$["*faderEl"].setTransformations(e); 9293 }), this.sub("*loadingOperations", (e) => { 9294 let t = !1; 9295 for (let [, s] of e.entries()) { 9296 if (t) 9297 break; 9298 for (let [, r] of s.entries()) 9299 if (r) { 9300 t = !0; 9301 break; 9302 } 9303 } 9304 this._debouncedShowLoader(t); 9305 }), this.sub("*showSlider", (e) => { 9306 this.$["presence.subToolbar"] = e, this.$["presence.mainToolbar"] = !e; 9307 }), this.sub("*tabList", (e) => { 9308 this.$["presence.tabToggles"] = e.length > 1; 9309 for (const t of be) { 9310 this.$[`presence.tabToggle.${t}`] = e.includes(t); 9311 const s = this.ref[`tab-toggle-${t}`]; 9312 s.style.gridColumn = e.indexOf(t) + 1; 9313 } 9314 e.includes(this.$["*tabId"]) || this._activateTab(e[0], { fromViewer: !1 }); 9315 }), this._updateInfoTooltip(); 9316 } 9317} 9318nn.template = /* HTML */ 9319` 9320 <uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui> 9321 <div class="uc-info-tooltip_container"> 9322 <div class="uc-info-tooltip_wrapper"> 9323 <div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div> 9324 </div> 9325 </div> 9326 <div class="uc-toolbar-container"> 9327 <uc-presence-toggle 9328 role="tablist" 9329 class="uc-sub-toolbar"
9330 set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" 9331 > 9332 <div class="uc-tab-content-row">${be.map(Su).join("")}</div> 9333 <div class="uc-controls-row"> 9334 <uc-presence-toggle 9335 class="uc-tab-toggles" 9336 set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" 9337 > 9338 <div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> 9339 ${be.map(Iu).join("")} 9340 </uc-presence-toggle> 9341 <uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"> 9342 </uc-btn-ui> 9343 <uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop:apply"> </uc-btn-ui> 9344 </div> 9345 </uc-presence-toggle> 9346 <uc-presence-toggle 9347 class="uc-sub-toolbar" 9348 set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" 9349 > 9350 <div class="uc-slider"> 9351 <uc-editor-slider ref="slider-el"></uc-editor-slider> 9352 </div> 9353 <div class="uc-controls-row"> 9354 <uc-btn-ui theme="secondary" set="onclick: on.cancelSlider" l10n="@text:cancel"> </uc-btn-ui> 9355 <uc-btn-ui theme="primary" set="onclick: on.applySlider" l10n="@text:apply"> </uc-btn-ui> 9356 </div> 9357 </uc-presence-toggle> 9358 </div> 9359`; 9360class Ki extends B { 9361 constructor() { 9362 super(), this._iconReversed = !1, this._iconSingle = !1, this._iconHidden = !1, this.init$ = { 9363 ...this.init$, 9364 text: "", 9365 icon: "", 9366 iconCss: this._iconCss(), 9367 theme: null, 9368 "aria-role": "", 9369 "aria-controls": "", 9370 "title-prop": "" 9371 }, this.defineAccessor("active", (e) => { 9372 e ? this.setAttribute("active", "") : this.removeAttribute("active"); 9373 }); 9374 } 9375 _iconCss() { 9376 return he("uc-icon", { 9377 "uc-icon_left": !this._iconReversed, 9378 "uc-icon_right": this._iconReversed, 9379 "uc-icon_hidden": this._iconHidden, 9380 "uc-icon_single": this._iconSingle 9381 }); 9382 } 9383 initCallback() { 9384 super.initCallback(), this.sub("icon", (e) => { 9385 this._iconSingle = !this.$.text, this._iconHidden = !e, this.$.iconCss = this._iconCss(); 9386 }), this.sub("theme", (e) => { 9387 e !== "custom" && (this.className = `uc-${e}`); 9388 }), this.sub("text", (e) => { 9389 this._iconSingle = !1; 9390 }), this.hasAttribute("theme") || this.setAttribute("theme", "default"), this.defineAccessor("aria-role", (e) => { 9391 this.$["aria-role"] = e || ""; 9392 }), this.defineAccessor("aria-controls", (e) => { 9393 this.$["aria-controls"] = e || ""; 9394 }), this.defineAccessor("title-prop", (e) => { 9395 this.$["title-prop"] = e || ""; 9396 }); 9397 } 9398 set reverse(e) { 9399 this.hasAttribute("reverse") ? (this.style.flexDirection = "row-reverse", this._iconReversed = !0) : (this._iconReversed = !1, this.style.flexDirection = null); 9400 } 9401} 9402Ki.bindAttributes({ text: "text", icon: "icon", reverse: "reverse", theme: "theme" }); 9403Ki.template = /* HTML */ 9404` 9405 <button type="button" set="@role:aria-role; @aria-controls: aria-controls;" l10n="@title:title-prop"> 9406 <uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon> 9407 <div class="uc-text">{{text}}</div> 9408 </button> 9409`; 9410class on extends B { 9411 constructor() { 9412 super(), this._active = !1, this._handleTransitionEndRight = () => { 9413 let e = this.ref["line-el"]; 9414 e.style.transition = "initial", e.style.opacity = "0", e.style.transform = "translateX(-101%)", this._active && this._start(); 9415 }; 9416 } 9417 initCallback() { 9418 super.initCallback(), this.defineAccessor("active", (e) => { 9419 typeof e == "boolean" && (e ? this._start() : this._stop()); 9420 }); 9421 } 9422 _start() { 9423 this._active = !0; 9424 let { width: e } = this.getBoundingClientRect(), t = this.ref["line-el"]; 9425 t.style.transition = "transform 1s", t.style.opacity = "1", t.style.transform = `translateX(${e}px)`, t.addEventListener("transitionend", this._handleTransitionEndRight, { 9426 once: !0 9427 }); 9428 } 9429 _stop() { 9430 this._active = !1; 9431 } 9432} 9433on.template = /* HTML */ 9434` 9435 <div class="uc-inner"> 9436 <div class="uc-line" ref="line-el"></div> 9437 </div> 9438`; 9439const kt = { 9440 transition: "uc-transition", 9441 visible: "uc-visible", 9442 hidden: "uc-hidden" 9443}; 9444class an extends B { 9445 constructor() { 9446 super(), this._visible = !1, this._visibleStyle = kt.visible, this._hiddenStyle = kt.hidden, this._externalTransitions = !1, this.defineAccessor("styles", (e) => { 9447 e && (this._externalTransitions = !0, this._visibleStyle = e.visible, this._hiddenStyle = e.hidden); 9448 }), this.defineAccessor("visible", (e) => { 9449 typeof e == "boolean" && (this._visible = e, this._handleVisible()); 9450 }); 9451 } 9452 _handleVisible() { 9453 this.style.visibility = this._visible ? "inherit" : "hidden", hu(this, { 9454 [kt.transition]: !this._externalTransitions, 9455 [this._visibleStyle]: this._visible, 9456 [this._hiddenStyle]: !this._visible 9457 }), this.setAttribute("aria-hidden", this._visible ? "false" : "true"); 9458 } 9459 initCallback() { 9460 super.initCallback(), this.classList.toggle("uc-initial", !0), this._externalTransitions || this.classList.add(kt.transition), this._handleVisible(), setTimeout(() => { 9461 this.classList.toggle("uc-initial", !1); 9462 }, 0); 9463 } 9464} 9465an.template = /* HTML */ 9466"<slot></slot> "; 9467class ln extends B { 9468 init$ = { 9469 ...this.init$, 9470 disabled: !1, 9471 min: 0, 9472 max: 100, 9473 onInput: null, 9474 onChange: null, 9475 defaultValue: null, 9476 "on.sliderInput": () => { 9477 let e = parseInt(this.ref["input-el"].value, 10);
9478 this._updateValue(e), this.$.onInput && this.$.onInput(e); 9479 }, 9480 "on.sliderChange": () => { 9481 let e = parseInt(this.ref["input-el"].value, 10); 9482 this.$.onChange && this.$.onChange(e); 9483 } 9484 }; 9485 constructor() { 9486 super(), this.setAttribute("with-effects", ""); 9487 } 9488 initCallback() { 9489 super.initCallback(), this.defineAccessor("disabled", (t) => { 9490 this.$.disabled = t; 9491 }), this.defineAccessor("min", (t) => { 9492 this.$.min = t; 9493 }), this.defineAccessor("max", (t) => { 9494 this.$.max = t; 9495 }), this.defineAccessor("defaultValue", (t) => { 9496 this.$.defaultValue = t, this.ref["input-el"].value = t, this._updateValue(t); 9497 }), this.defineAccessor("zero", (t) => { 9498 this._zero = t; 9499 }), this.defineAccessor("onInput", (t) => { 9500 t && (this.$.onInput = t); 9501 }), this.defineAccessor("onChange", (t) => { 9502 t && (this.$.onChange = t); 9503 }), this._updateSteps(), this._observer = new ResizeObserver(() => { 9504 this._updateSteps(); 9505 let t = parseInt(this.ref["input-el"].value, 10); 9506 this._updateValue(t); 9507 }), this._observer.observe(this), this._thumbSize = parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"), 10), setTimeout(() => { 9508 let t = parseInt(this.ref["input-el"].value, 10); 9509 this._updateValue(t); 9510 }, 0), this.sub("disabled", (t) => { 9511 let s = this.ref["input-el"]; 9512 t ? s.setAttribute("disabled", "disabled") : s.removeAttribute("disabled"); 9513 }); 9514 let e = this.ref["input-el"]; 9515 e.addEventListener("focus", () => { 9516 this.style.setProperty("--color-effect", "var(--hover-color-rgb)"); 9517 }), e.addEventListener("blur", () => { 9518 this.style.setProperty("--color-effect", "var(--idle-color-rgb)"); 9519 }); 9520 } 9521 _updateValue(e) { 9522 this._updateZeroDot(e); 9523 let { width: t } = this.getBoundingClientRect(), n = 100 / (this.$.max - this.$.min) * (e - this.$.min) * (t - this._thumbSize) / 100; 9524 window.requestAnimationFrame(() => { 9525 this.ref["thumb-el"].style.transform = `translateX(${n}px)`; 9526 }); 9527 } 9528 _updateZeroDot(e) { 9529 if (!this._zeroDotEl) 9530 return; 9531 e === this._zero ? this._zeroDotEl.style.opacity = "0" : this._zeroDotEl.style.opacity = "1"; 9532 let { width: t } = this.getBoundingClientRect(), n = 100 / (this.$.max - this.$.min) * (this._zero - this.$.min) * (t - this._thumbSize) / 100; 9533 window.requestAnimationFrame(() => { 9534 this._zeroDotEl.style.transform = `translateX(${n}px)`; 9535 }); 9536 } 9537 _updateSteps() { 9538 let t = this.ref["steps-el"], { width: s } = t.getBoundingClientRect(), r = Math.ceil(s / 2), n = Math.ceil(r / 15) - 2; 9539 if (this._stepsCount === n) 9540 return; 9541 let o = document.createDocumentFragment(), a = document.createElement("div"), l = document.createElement("div"); 9542 a.className = "uc-minor-step", l.className = "uc-border-step", o.appendChild(l); 9543 for (let u = 0; u < n; u++) 9544 o.appendChild(a.cloneNode()); 9545 o.appendChild(l.cloneNode()); 9546 for (let u = 0; u < n; u++) 9547 o.appendChild(a.cloneNode()); 9548 o.appendChild(l.cloneNode()); 9549 let c = document.createElement("div"); 9550 c.className = "uc-zero-dot", o.appendChild(c), this._zeroDotEl = c, t.innerHTML = "", t.appendChild(o), this._stepsCount = n; 9551 } 9552 destroyCallback() { 9553 super.destroyCallback(), this._observer?.disconnect(); 9554 } 9555} 9556ln.template = /* HTML */ 9557` 9558 <div class="uc-steps" ref="steps-el"></div> 9559 <div ref="thumb-el" class="uc-thumb"></div> 9560 <input 9561 class="uc-input" 9562 type="range" 9563 ref="input-el" 9564 set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" 9565 /> 9566`; 9567class ku extends X { 9568 couldBeCtxOwner = !0; 9569 activityType = O.activities.CLOUD_IMG_EDIT; 9570 /** 9571 * @private 9572 * @type {import('../../abstract/TypedData.js').TypedData | undefined} 9573 */ 9574 _entry; 9575 /** 9576 * @private 9577 * @type {CloudImageEditorBlock | undefined} 9578 */ 9579 _instance; 9580 /** @type {ActivityParams} */ 9581 get activityParams() { 9582 const e = super.activityParams; 9583 if ("internalId" in e) 9584 return e; 9585 throw new Error("Cloud Image Editor activity params not found"); 9586 } 9587 initCallback() { 9588 super.initCallback(), this.registerActivity(this.activityType, { 9589 onActivate: () => this.mountEditor(), 9590 onDeactivate: () => this.unmountEditor() 9591 }), this.subConfigValue("cropPreset", (e) => { 9592 this._instance && this._instance.getAttribute("crop-preset") !== e && this._instance.setAttribute("crop-preset", e); 9593 }), this.subConfigValue("cloudImageEditorTabs", (e) => { 9594 this._instance && this._instance.getAttribute("tabs") !== e && this._instance.setAttribute("tabs", e); 9595 }); 9596 } 9597 /** @param {CustomEvent<import('../CloudImageEditor/src/types.js').ApplyResult>} e */ 9598 handleApply(e) { 9599 if (!this._entry) 9600 return; 9601 let t = e.detail; 9602 this._entry.setMultipleValues({ 9603 cdnUrl: t.cdnUrl, 9604 cdnUrlModifiers: t.cdnUrlModifiers 9605 }), this.historyBack(); 9606 } 9607 handleCancel() { 9608 this.historyBack(); 9609 } 9610 mountEditor() { 9611 const { internalId: e } = this.activityParams; 9612 if (this._entry = this.uploadCollection.read(e), !this._entry) 9613 throw new Error(`Entry with internalId "${e}" not found`); 9614 const t = this._entry.getValue("cdnUrl"); 9615 if (!t) 9616 throw new Error(`Entry with internalId "${e}" hasn't uploaded yet`); 9617 const s = new _t(), r = this.cfg.cropPreset, n = this.cfg.cloudImageEditorTabs; 9618 s.setAttribute("ctx-name", this.ctxName), s.setAttribute("cdn-url", t), r && s.setAttribute("crop-preset", r), n && s.setAttribute("tabs", n), s.addEventListener("apply", (o) => { 9619 const a = ( 9620 /** @type {CustomEvent<import('../CloudImageEditor/src/types.js').ApplyResult>} */ 9621 o 9622 ); 9623 this.handleApply(a), this.debugPrint('editor event "apply"', a.detail); 9624 }), s.addEventListener("cancel", (o) => { 9625 const a = ( 9626 /** @type {CustomEvent<void>} */ 9627 o 9628 ); 9629 this.handleCancel(), this.debugPrint('editor event "cancel"', a.detail); 9630 }), s.addEventListener("change", (o) => { 9631 const a = ( 9632 /** @type {CustomEvent<import('../CloudImageEditor/src/types.js').ChangeResult>} */ 9633 o 9634 ); 9635 this.debugPrint('editor event "change"', a.detail); 9636 }), this.innerHTML = "", this.appendChild(s), this._instance = s; 9637 } 9638 unmountEditor() { 9639 this._instance = void 0, this._entry = void 0, this.innerHTML = ""; 9640 } 9641} 9642const xu = function(i) { 9643 return i.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"); 9644}, Ou = function(i, e = "i") { 9645 const t = i.split("*").map(xu); 9646 return new RegExp("^" + t.join(".+") + "$", e); 9647}; 9648function Lu(i, e) { 9649 return window.getComputedStyle(i).getPropertyValue(e).trim(); 9650} 9651const Pu = ( 9652 /** @type {(keyof import('./types.js').ThemeDefinition)[]} */ 9653 [ 9654 "--uc-font-family", 9655 "--uc-font-size", 9656 "--uc-line-height", 9657 "--uc-button-size", 9658 "--uc-preview-size", 9659 "--uc-input-size", 9660 "--uc-padding", 9661 "--uc-radius", 9662 "--uc-transition", 9663 "--uc-background", 9664 "--uc-foreground", 9665 "--uc-primary", 9666 "--uc-primary-hover", 9667 "--uc-primary-transparent", 9668 "--uc-primary-foreground", 9669 "--uc-secondary", 9670 "--uc-secondary-hover", 9671 "--uc-secondary-foreground", 9672 "--uc-muted", 9673 "--uc-muted-foreground", 9674 "--uc-destructive", 9675 "--uc-destructive-foreground", 9676 "--uc-border" 9677 ] 9678); 9679function Uu(i) { 9680 return Pu.reduce( 9681 (e, t) => { 9682 const s = Lu(i, t); 9683 return s && (e[t] = s), e; 9684 },
9685 /** @type {Record<keyof import('./types.js').ThemeDefinition, string>} */ 9686 {} 9687 ); 9688} 9689const Mu = ["selected-files-change"], Du = (i) => !i || typeof i != "object" ? !1 : "type" in i && Mu.includes( 9690 /** @type {import('./types').InputMessageType} */ 9691 i.type 9692); 9693class Ru { 9694 /** @type {Map<string, Set<import('./types').InputMessageHandler<import('./types').InputMessageType>>>} */ 9695 _handlerMap = /* @__PURE__ */ new Map(); 9696 /** @type {Window} */ 9697 _context; 9698 /** @param {Window} context */ 9699 constructor(e) { 9700 this._context = e, window.addEventListener("message", this._handleMessage); 9701 } 9702 /** @param {MessageEvent} e */ 9703 _handleMessage = (e) => { 9704 if (e.source !== this._context) 9705 return; 9706 const t = e.data; 9707 if (!Du(t)) 9708 return; 9709 const s = this._handlerMap.get(t.type); 9710 if (s) 9711 for (const r of s) 9712 r(t); 9713 }; 9714 /** 9715 * @template {import('./types').InputMessageType} T 9716 * @param {T} type 9717 * @param {import('./types').InputMessageHandler<T>} handler 9718 */ 9719 on(e, t) { 9720 const s = this._handlerMap.get(e) ?? /* @__PURE__ */ new Set(); 9721 this._handlerMap.has(e) || this._handlerMap.set(e, s), s.add( 9722 /** @type {import('./types').InputMessageHandler<import('./types').InputMessageType>} */ 9723 t 9724 ); 9725 } 9726 /** @param {import('./types').OutputMessage} message */ 9727 send(e) { 9728 this._context.postMessage(e, "*"); 9729 } 9730 destroy() { 9731 window.removeEventListener("message", this._handleMessage); 9732 } 9733} 9734function $u(i) { 9735 let e = []; 9736 for (let [t, s] of Object.entries(i)) 9737 s == null || typeof s == "string" && s.length === 0 || e.push(`${t}=${encodeURIComponent(s)}`); 9738 return e.join("&"); 9739} 9740class cn extends X { 9741 couldBeCtxOwner = !0; 9742 activityType = O.activities.EXTERNAL; 9743 constructor() { 9744 super(), this.init$ = { 9745 ...this.init$, 9746 activityIcon: "", 9747 activityCaption: "", 9748 /** @type {import('./types.js').InputMessageMap['selected-files-change']['selectedFiles']} */ 9749 selectedList: [], 9750 total: 0, 9751 isSelectionReady: !1, 9752 isDoneBtnEnabled: !1, 9753 couldSelectAll: !1, 9754 couldDeselectAll: !1, 9755 showSelectionStatus: !1, 9756 counterText: "", 9757 doneBtnTextClass: "uc-hidden", 9758 onDone: () => { 9759 for (const e of this.$.selectedList) { 9760 const t = this.extractUrlFromSelectedFile(e), { filename: s } = e, { externalSourceType: r } = this.activityParams; 9761 this.api.addFileFromUrl(t, { fileName: s, source: r }); 9762 } 9763 this.$["*currentActivity"] = O.activities.UPLOAD_LIST; 9764 }, 9765 onCancel: () => { 9766 this.historyBack(); 9767 }, 9768 onSelectAll: () => { 9769 this._messageBridge?.send({ type: "select-all" }); 9770 }, 9771 onDeselectAll: () => { 9772 this._messageBridge?.send({ type: "deselect-all" }); 9773 } 9774 }; 9775 } 9776 /** @type {ActivityParams} */ 9777 get activityParams() { 9778 const e = super.activityParams; 9779 if ("externalSourceType" in e) 9780 return e; 9781 throw new Error("External Source activity params not found"); 9782 } 9783 initCallback() { 9784 super.initCallback(), this.registerActivity(this.activityType, { 9785 onActivate: () => { 9786 let { externalSourceType: e } = ( 9787 /** @type {ActivityParams} */ 9788 this.activityParams 9789 ); 9790 if (!e) { 9791 this.$["*currentActivity"] = null, this.setOrAddState("*modalActive", !1), console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`); 9792 return; 9793 } 9794 this.set$({ 9795 activityCaption: `${e?.[0].toUpperCase()}${e?.slice(1)}`, 9796 activityIcon: e 9797 }), this.mountIframe(); 9798 } 9799 }), this.sub("*currentActivityParams", (e) => { 9800 this.isActivityActive && (this.unmountIframe(), this.mountIframe()); 9801 }), this.sub("*currentActivity", (e) => { 9802 e !== this.activityType && this.unmountIframe(); 9803 }), this.subConfigValue("multiple", (e) => { 9804 this.$.showSelectionStatus = e; 9805 }), this.subConfigValue("localeName", (e) => { 9806 this.setupL10n(); 9807 }), this.subConfigValue("externalSourcesEmbedCss", (e) => { 9808 this.applyEmbedCss(e); 9809 }); 9810 } 9811 /** 9812 * @private 9813 * @param {NonNullable<import('./types.js').InputMessageMap['selected-files-change']['selectedFiles']>[number]} selectedFile 9814 */ 9815 extractUrlFromSelectedFile(e) { 9816 if (e.alternatives) { 9817 const t = Me(this.cfg.externalSourcesPreferredTypes); 9818 for (const s of t) { 9819 const r = Ou(s); 9820 for (const [n, o] of Object.entries(e.alternatives)) 9821 if (r.test(n)) 9822 return o; 9823 } 9824 } 9825 return e.url; 9826 } 9827 /** 9828 * @private 9829 * @param {import('./types.js').InputMessageMap['selected-files-change']} message 9830 */ 9831 async handleSelectedFilesChange(e) { 9832 if (this.cfg.multiple !== e.isMultipleMode) { 9833 console.error("Multiple mode mismatch"); 9834 return; 9835 } 9836 this.bindL10n( 9837 "counterText", 9838 () => this.l10n("selected-count", { 9839 count: e.selectedCount, 9840 total: e.total 9841 }) 9842 ), this.set$({ 9843 doneBtnTextClass: e.isReady ? "" : "uc-hidden", 9844 isSelectionReady: e.isReady, 9845 isDoneBtnEnabled: e.isReady && e.selectedFiles.length > 0, 9846 showSelectionStatus: e.isMultipleMode && e.total > 0, 9847 couldSelectAll: e.selectedCount < e.total, 9848 couldDeselectAll: e.selectedCount === e.total, 9849 selectedList: e.selectedFiles 9850 }); 9851 } 9852 /** @private */ 9853 handleIframeLoad() { 9854 this.applyEmbedCss(this.cfg.externalSourcesEmbedCss), this.applyTheme(), this.setupL10n(); 9855 } 9856 /** @private */ 9857 applyTheme() { 9858 this._messageBridge?.send({ 9859 type: "set-theme-definition", 9860 theme: Uu(this) 9861 }); 9862 } 9863 /** 9864 * @private 9865 * @param {string} css 9866 */ 9867 applyEmbedCss(e) { 9868 this._messageBridge?.send({ 9869 type: "set-embed-css", 9870 css: e 9871 }); 9872 } 9873 /** @private */ 9874 setupL10n() { 9875 this._messageBridge?.send({ 9876 type: "set-locale-definition", 9877 localeDefinition: this.cfg.localeName 9878 }); 9879 } 9880 /** @private */ 9881 remoteUrl() { 9882 const { pubkey: e, remoteTabSessionKey: t, socialBaseUrl: s, multiple: r }
9882 = this.cfg, { externalSourceType: n } = this.activityParams, a = { 9883 lang: this.l10n("social-source-lang")?.split("-")?.[0] || "en", 9884 public_key: e, 9885 images_only: "false", 9886 session_key: t, 9887 wait_for_theme: !0, 9888 multiple: r.toString() 9889 }, l = new URL(`/window4/${n}`, s); 9890 return l.search = $u(a), l.toString(); 9891 } 9892 /** @private */ 9893 mountIframe() { 9894 let e = Js({ 9895 tag: "iframe", 9896 attributes: { 9897 src: this.remoteUrl(), 9898 marginheight: 0, 9899 marginwidth: 0, 9900 frameborder: 0, 9901 allowTransparency: !0 9902 } 9903 }); 9904 e.addEventListener("load", this.handleIframeLoad.bind(this)), this.ref.iframeWrapper.innerHTML = "", this.ref.iframeWrapper.appendChild(e), e.contentWindow && (this._messageBridge?.destroy(), this._messageBridge = new Ru(e.contentWindow), this._messageBridge.on("selected-files-change", this.handleSelectedFilesChange.bind(this)), this.resetSelectionStatus()); 9905 } 9906 /** @private */ 9907 unmountIframe() { 9908 this._messageBridge?.destroy(), this._messageBridge = void 0, this.ref.iframeWrapper.innerHTML = "", this.resetSelectionStatus(); 9909 } 9910 /** @private */ 9911 resetSelectionStatus() { 9912 this.set$({ 9913 selectedList: [], 9914 total: 0, 9915 isDoneBtnEnabled: !1, 9916 couldSelectAll: !1, 9917 couldDeselectAll: !1, 9918 showSelectionStatus: !1 9919 }); 9920 } 9921} 9922cn.template = /* HTML */ 9923` 9924 <uc-activity-header> 9925 <button 9926 type="button" 9927 class="uc-mini-btn uc-close-btn" 9928 set="onclick: *historyBack" 9929 l10n="@title:a11y-activity-header-button-close" 9930 > 9931 <uc-icon name="close"></uc-icon> 9932 </button> 9933 </uc-activity-header> 9934 <div class="uc-content"> 9935 <div ref="iframeWrapper" class="uc-iframe-wrapper"></div> 9936 <div class="uc-toolbar"> 9937 <button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button> 9938 <div set="@hidden: !showSelectionStatus" class="uc-selection-status-box"> 9939 <span>{{counterText}}</span> 9940 <button type="button" set="onclick: onSelectAll; @hidden: !couldSelectAll" l10n="select-all"></button> 9941 <button type="button" set="onclick: onDeselectAll; @hidden: !couldDeselectAll" l10n="deselect-all"></button> 9942 </div> 9943 <button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !isDoneBtnEnabled;"> 9944 <uc-spinner set="@hidden: isSelectionReady"></uc-spinner> 9945 <span l10n="done" set="@class: doneBtnTextClass"></span> 9946 </button> 9947 </div> 9948 </div> 9949`; 9950class Fu extends X { 9951 requireCtxName = !0; 9952 _createValidationInput() { 9953 const e = document.createElement("input"); 9954 return e.type = "text", e.name = this.ctxName, e.required = this.cfg.multipleMin > 0, e.tabIndex = -1, Si(e, { 9955 opacity: 0, 9956 height: 0, 9957 width: 0 9958 }), e; 9959 } 9960 initCallback() { 9961 super.initCallback(), this._validationInputElement = this._createValidationInput(), this.appendChild(this._validationInputElement), this.sub( 9962 "*collectionState", 9963 (e) => { 9964 { 9965 if (this._dynamicInputsContainer || (this._dynamicInputsContainer = document.createElement("div"), this.appendChild(this._dynamicInputsContainer)), !this._validationInputElement) { 9966 const n = this._createValidationInput(); 9967 this.appendChild(n), this._validationInputElement = n; 9968 } 9969 if (this._dynamicInputsContainer.innerHTML = "", e.status === "uploading" || e.status === "idle") { 9970 this._validationInputElement.value = "", this._validationInputElement.setCustomValidity(""); 9971 return; 9972 } 9973 if (e.status === "failed") { 9974 const n = e.errors[0]?.message; 9975 this._validationInputElement.value = "", this._validationInputElement.setCustomValidity(n); 9976 return; 9977 } 9978 const t = e.group ? e.group : null; 9979 if (t) { 9980 this._validationInputElement.value = t.cdnUrl, this._validationInputElement.setCustomValidity(""); 9981 return; 9982 } 9983 const s = e.allEntries.map((n) => n.cdnUrl); 9984 if (!this.cfg.multiple && s.length === 1) {
9985 this._validationInputElement.value = s[0], this._validationInputElement.setCustomValidity(""); 9986 return; 9987 } 9988 this._validationInputElement.remove(), this._validationInputElement = null; 9989 const r = new DocumentFragment(); 9990 for (let n of s) { 9991 const o = document.createElement("input"); 9992 o.type = "hidden", o.name = `${this.ctxName}[]`, o.value = n, r.appendChild(o); 9993 } 9994 this._dynamicInputsContainer.replaceChildren(r); 9995 } 9996 }, 9997 !1 9998 ); 9999 } 10000} 10001class Nu extends O { 10002} 10003class un extends B { 10004 init$ = { 10005 ...this.init$, 10006 currentText: "", 10007 options: [], 10008 selectHtml: "", 10009 onSelect: (e) => { 10010 e.preventDefault(), e.stopPropagation(), this.value = this.ref.select.value, this.$.currentText = this.$.options.find((t) => t.value == this.value)?.text || "", this.dispatchEvent(new Event("change")); 10011 } 10012 }; 10013 initCallback() { 10014 super.initCallback(), this.sub("options", (e) => { 10015 this.$.currentText = e?.[0]?.text || ""; 10016 let t = ""; 10017 e?.forEach((s) => { 10018 t += /* HTML */ 10019 `<option value="${s.value}">${s.text}</option>`; 10020 }), this.$.selectHtml = t; 10021 }); 10022 } 10023} 10024un.template = /* HTML */ 10025' <select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select> '; 10026class Bu extends B { 10027 initCallback() { 10028 super.initCallback(), this.subConfigValue( 10029 "removeCopyright", 10030 /** @param {number} value */ 10031 (e) => { 10032 this.toggleAttribute("hidden", !!e); 10033 } 10034 ); 10035 } 10036 static template = ( 10037 /* HTML */ 10038 ` 10039 <a 10040 href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" 10041 target="_blank noopener" 10042 class="uc-credits" 10043 >Powered by Uploadcare</a 10044 > 10045 ` 10046 ); 10047} 10048class dn extends bt { 10049} 10050dn.template = /* HTML */ 10051' <div class="uc-spinner"></div> '; 10052class qi extends Yt { 10053 static styleAttrs = [...super.styleAttrs, "uc-file-uploader-regular"]; 10054 constructor() { 10055 super(), this.init$ = { 10056 ...this.init$, 10057 isHidden: !1 10058 }; 10059 } 10060 initCallback() { 10061 super.initCallback(), this.defineAccessor( 10062 "headless", 10063 /** @param {unknown} value */ 10064 (e) => { 10065 this.set$({ isHidden: N(e) }); 10066 } 10067 ), this.sub( 10068 "*modalActive", 10069 (e) => { 10070 this._lastModalActive !== e && this.emit(e ? z.MODAL_OPEN : z.MODAL_CLOSE, void 0, { debounce: !0 }), this._lastModalActive = e; 10071 }, 10072 !1 10073 ); 10074 } 10075} 10076qi.template = /* HTML */ 10077` 10078 <uc-simple-btn set="@hidden: isHidden"></uc-simple-btn> 10079 10080 <uc-modal strokes block-body-scrolling> 10081 <uc-start-from> 10082 <uc-drop-area with-icon clickable></uc-drop-area> 10083 <uc-source-list wrap></uc-source-list> 10084 <button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button> 10085 <uc-copyright></uc-copyright> 10086 </uc-start-from> 10087 <uc-upload-list></uc-upload-list> 10088 <uc-camera-source></uc-camera-source> 10089 <uc-url-source></uc-url-source> 10090 <uc-external-source></uc-external-source> 10091 <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity> 10092 </uc-modal> 10093`; 10094qi.bindAttributes({ 10095 // @ts-expect-error TODO: fix types inside symbiote 10096 headless: null 10097}); 10098class hn extends Yt { 10099 static styleAttrs = [...super.styleAttrs, "uc-file-uploader-minimal"]; 10100 initCallback() { 10101 super.initCallback(); 10102 const e = this.ref.uBlock; 10103 this.sub("*currentActivity", (t) => { 10104 t || (this.$["*currentActivity"] = e.initActivity || O.activities.START_FROM); 10105 }), this.sub("*uploadList", (t) => { 10106 t?.length > 0 ? this.$["*currentActivity"] = O.activities.UPLOAD_LIST : this.$["*currentActivity"] = e.initActivity || O.activities.START_FROM; 10107 }), this.subConfigValue("sourceList", (t) => { 10108 t !== "local" && (this.cfg.sourceList = "local"); 10109 }), this.subConfigValue("confirmUpload", (t) => { 10110 t !== !1 && (this.cfg.confirmUpload = !1); 10111 }); 10112 } 10113} 10114hn.template = /* HTML */ 10115` 10116 <uc-start-from> 10117 <uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area> 10118 <uc-copyright></uc-copyright> 10119 </uc-start-from> 10120 <uc-upload-list ref="uBlock"></uc-upload-list> 10121`; 10122class fn extends Yt { 10123 static styleAttrs = [...super.styleAttrs, "uc-file-uploader-inline"]; 10124 constructor() { 10125 super(), this.init$ = { 10126 ...this.init$, 10127 couldCancel: !1, 10128 cancel: () => { 10129 this.couldHistoryBack ? this.$["*historyBack"]() : this.couldShowList && (this.$["*currentActivity"] = O.activities.UPLOAD_LIST); 10130 } 10131 }; 10132 } 10133 get couldHistoryBack() { 10134 const e = this.$["*history"]; 10135 return e.length > 1 && e[e.length - 1] !== O.activities.START_FROM; 10136 } 10137 get couldShowList() { 10138 return this.cfg.showEmptyList || this.$["*uploadList"].length > 0; 10139 } 10140 initCallback() { 10141 super.initCallback(); 10142 const e = this.ref.uBlock; 10143 this.sub("*currentActivity", (t) => { 10144 t || (this.$["*currentActivity"] = e.initActivity || O.activities.START_FROM); 10145 }), this.sub("*uploadList", (t) => { 10146 t?.length > 0 && this.$["*currentActivity"] === (e.initActivity || O.activities.START_FROM) && (this.$["*currentActivity"] = O.activities.UPLOAD_LIST); 10147 }), this.sub("*history", () => { 10148 this.$.couldCancel = this.couldHistoryBack || this.couldShowList; 10149 }); 10150 } 10151} 10152fn.template = /* HTML */ 10153` 10154 <uc-start-from> 10155 <uc-drop-area with-icon clickable></uc-drop-area> 10156 <uc-source-list wrap></uc-source-list> 10157 <button 10158 type="button" 10159 l10n="start-from-cancel" 10160 class="uc-cancel-btn uc-secondary-btn"
10161 set="onclick: cancel; @hidden: !couldCancel" 10162 ></button> 10163 <uc-copyright></uc-copyright> 10164 </uc-start-from> 10165 <uc-upload-list ref="uBlock"></uc-upload-list> 10166 <uc-camera-source></uc-camera-source> 10167 <uc-url-source></uc-url-source> 10168 <uc-external-source></uc-external-source> 10169 <uc-cloud-image-editor-activity></uc-cloud-image-editor-activity> 10170`; 10171class Vu extends _t { 10172 static styleAttrs = [...super.styleAttrs, "uc-wgt-common"]; 10173 initCallback() { 10174 super.initCallback(), this.a11y?.registerBlock(this); 10175 } 10176} 10177function Zi(i) { 10178 for (let e in i) { 10179 let t = [...e].reduce((s, r) => (r.toUpperCase() === r && (r = "-" + r.toLowerCase()), s += r), ""); 10180 t.startsWith("-") && (t = t.replace("-", "")), t.startsWith("uc-") || (t = "uc-" + t), i[e].reg && i[e].reg(t); 10181 } 10182} 10183const hi = "UC"; 10184async function zu(i, e = !1) { 10185 return new Promise((t, s) => { 10186 if (typeof document != "object") { 10187 t(null); 10188 return; 10189 } 10190 if (typeof window == "object" && window[hi]) { 10191 t(window[hi]); 10192 return; 10193 } 10194 let r = document.createElement("script"); 10195 r.async = !0, r.src = i, r.onerror = () => { 10196 s(); 10197 }, r.onload = () => { 10198 let n = window[hi]; 10199 e && Zi(n), t(n); 10200 }, document.head.appendChild(r); 10201 }); 10202} 10203const Hu = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ 10204 __proto__: null, 10205 ActivityBlock: O, 10206 ActivityHeader: Nu, 10207 BaseComponent: bt, 10208 Block: B, 10209 BtnUi: Ki, 10210 CameraSource: F, 10211 CloudImageEditor: Vu, 10212 CloudImageEditorActivity: ku, 10213 CloudImageEditorBlock: _t, 10214 Config: _c, 10215 Copyright: Bu, 10216 CropFrame: Qr, 10217 Data: $, 10218 DropArea: ji, 10219 EditorCropButtonControl: Jr, 10220 EditorFilterControl: Yi, 10221 EditorImageCropper: sn, 10222 EditorImageFader: Eu, 10223 EditorOperationControl: tn, 10224 EditorScroller: rn, 10225 EditorSlider: en, 10226 EditorToolbar: nn, 10227 ExternalSource: cn, 10228 ExternalUploadSource: qt, 10229 FileItem: Ve, 10230 FileUploaderInline: fn, 10231 FileUploaderMinimal: hn, 10232 FileUploaderRegular: qi, 10233 FormInput: Fu, 10234 Icon: zi, 10235 Img: Tc, 10236 LineLoaderUi: on, 10237 Modal: jr, 10238 PACKAGE_NAME: Wt, 10239 PACKAGE_VERSION: Kt, 10240 PresenceToggle: an, 10241 ProgressBar: qr, 10242 ProgressBarCommon: Kr, 10243 Select: un, 10244 SimpleBtn: Hi, 10245 SliderUi: ln, 10246 SolutionBlock: Yt, 10247 SourceBtn: Gi, 10248 SourceList: Pc, 10249 Spinner: dn, 10250 StartFrom: Mr, 10251 UID: Ft, 10252 UploadCtxProvider: du, 10253 UploadList: Xr, 10254 UploadSource: Y, 10255 UploaderBlock: X, 10256 UrlSource: Yr, 10257 defineComponents: Zi, 10258 defineLocale: kr, 10259 loadFileUploaderFrom: zu, 10260 toKebabCase: Zt 10261}, Symbol.toStringTag, { value: "Module" })), ju = { class: "image-uploader_empty-state_content" }, Gu = { class: "image-uploader_empty-state_title" }, Xu = { class: "image-uploader_empty-state_subtitle" }, Yu = { 10262 key: 1, 10263 class: "image-uploader_image-wrapper" 10264}, Wu = ["src"], Ku = { class: "image-uploader_image-wrapper-action-buttons column justify-between" }, js = "UNEXPECTED_ERROR", qu = /* @__PURE__ */ Te({ 10265 __name: "company-image-uploader", 10266 props: /* @__PURE__ */ ht({ 10267 ctxName: {}, 10268 cropPreset: {}, 10269 fieldType: {} 10270 }, { 10271 modelValue: { required: !0 }, 10272 modelModifiers: {} 10273 }), 10274 emits: /* @__PURE__ */ ht(["remove"], ["update:modelValue"]), 10275 setup(i, { emit: e }) { 10276 Zi(Hu); 10277 const t = "c1d6ce04c47e2145d20b", s = Ti(i, "modelValue"), r = i, n = Cn("uploaderCtx"), o = Q(), a = H(() => s.value || ""), l = [ 10278 { 10279 aid: "IMAGE_UPLOADER_REMOVE_IMAGE", 10280 icon: "fa-light fa-trash-can fa-sm", 10281 tooltip: T.removeActionTooltip, 10282 onClick: g, 10283 isRemove: !0 10284 }, 10285 { 10286 aid: "IMAGE_UPLOADER_REPLACE_IMAGE", 10287 icon: "fa-light fa-arrows-rotate fa-sm", 10288 tooltip: T.replaceActionTooltip, 10289 onClick: p 10290 } 10291 ], c = e; 10292 async function u() { 10293 await cs.init(Ws()); 10294 } 10295 async function d(A) { 10296 o.value = A.detail.mimeType; 10297 } 10298 async function h(A) { 10299 const _ = A.detail.successEntries[0]; 10300 try { 10301 await u(); 10302 const v = r.fieldType === D.IMAGE ? "image" : "banner", { objectCdnUrl: m } = await cs.uploadBrandingLogo({ 10303 uuid: _.uuid, 10304 cdnUrl: _.cdnUrl, 10305 imageFormat: _.fileInfo.imageInfo?.format, 10306 fieldType: v 10307 }); 10308 if (!m) { 10309 Le({ 10310 aid: js, 10311 message: T.failedToUploadImage, 10312 status: Pe.Error 10313 }); 10314 return; 10315 } 10316 s.value = m, n.value?.getAPI().removeAllFiles(); 10317 } catch (v) { 10318 throw Le({ 10319 aid: js, 10320 message: T.failedToUploadImage, 10321 status: Pe.Error 10322 }), v; 10323 } 10324 } 10325 function p() { 10326 n.value?.getAPI().initFlow(); 10327 } 10328 function g() { 10329 n.value?.getAPI()?.removeAllFiles(), s.value = "", c("remove"); 10330 } 10331 function y() { 10332 n.value?.getAPI().removeAllFiles(); 10333 } 10334 return gt(() => { 10335 n.value && (n.value.addEventListener("file-added", d), n.value.addEventListener("done-click", h), n.value.addEventListener("modal-close", y)); 10336 }), En(() => { 10337 n.value && (n.value.removeEventListener("file-added", d), n.value.removeEventListener("done-click", h), n.value.removeEventListener("modal-close", y)); 10338 }), (A, _) => { 10339 const v = ti("uc-config"), m = ti("uc-upload-ctx-provider"), f = ti("uc-file-uploader-regular"); 10340 return E(), x("div", { 10341 class: Ne({ 10342 "image-uploader": !0, 10343 "with-image": a.value 10344 }) 10345 }, [ 10346 S(v, { 10347 "ctx-name": i.ctxName, 10348 pubkey: b(t), 10349 multiple: "false", 10350 "img-only": "true", 10351 "source-list": "local, url, dropbox, gdrive", 10352 "max-local-file-size-bytes": "10485760", 10353 "use-cloud-image-editor": !0 10354 }, null, 8, ["ctx-name", "pubkey"]), 10355 S(m, { 10356 ref_key: "uploaderCtx", 10357 ref: n, 10358 "ctx-name": i.ctxName 10359 }, null, 8, ["ctx-name"]), 10360 S(f, { 10361 "ctx-name": i.ctxName, 10362 headless: "true",
10363 class: "uc-light", 10364 "preview-step": !0, 10365 crop: !!i.cropPreset, 10366 "crop-preset": i.cropPreset, 10367 tabs: ["file", "url", "camera"] 10368 }, null, 8, ["ctx-name", "crop", "crop-preset"]), 10369 a.value ? (E(), x("div", Yu, [ 10370 w("img", { 10371 src: a.value, 10372 alt: "Uploaded image", 10373 class: "uploaded-image", 10374 onClick: p 10375 }, null, 8, Wu), 10376 w("div", Ku, [ 10377 (E(), x(de, null, me(l, (C) => S(b(Ke), { 10378 key: C.icon, 10379 variant: "text", 10380 color: "gray-400", 10381 size: "sm", 10382 aid: C.aid, 10383 class: Ne({ remove: C.isRemove }), 10384 onClick: C.onClick 10385 }, { 10386 default: k(() => [ 10387 w("i", { 10388 class: Ne(C.icon) 10389 }, null, 2), 10390 S(b(Gs), { 10391 aid: `${C.aid}_TOOLTIP` 10392 }, { 10393 default: k(() => [ 10394 te(R(C.tooltip), 1) 10395 ]), 10396 _: 2 10397 }, 1032, ["aid"]) 10398 ]), 10399 _: 2 10400 }, 1032, ["aid", "class", "onClick"])), 64)) 10401 ]) 10402 ])) : (E(), x("div", { 10403 key: 0, 10404 class: "image-uploader_empty-state", 10405 aid: "IMAGE_UPLOADER_ADD_IMAGE", 10406 onClick: p 10407 }, [ 10408 w("div", ju, [ 10409 w("span", Gu, [ 10410 _[0] || (_[0] = w("span", { class: "fa-light fa-plus-circle icon" }, null, -1)), 10411 te(" " + R(b(T).uploadPhotoOrLogo), 1) 10412 ]), 10413 w("span", Xu, R(b(T).imageSizeRequirement), 1) 10414 ]) 10415 ])) 10416 ], 2); 10417 }; 10418 } 10419}), Ci = /* @__PURE__ */ ve(qu, [["__scopeId", "data-v-9e145607"]]), Zu = { class: "add-edit-variable-modal" }, Qu = { class: "form-fields" }, Ju = { 10420 key: 0, 10421 class: "field-item" 10422}, ed = { class: "field-item" }, td = { 10423 key: 1, 10424 class: "field-item" 10425}, id = { 10426 key: 2, 10427 class: "field-item" 10428}, sd = /* @__PURE__ */ Te({ 10429 inheritAttrs: !1, 10430 __name: "add-edit-variable-modal", 10431 props: { 10432 dialog: {} 10433 }, 10434 setup(i) { 10435 const e = i, t = H(() => !!e.dialog.input?.field), s = H( 10436 () => e.dialog.input?.fieldTypeOptions ?? [] 10437 ), r = H(() => s.value.length > 1), n = H( 10438 () => e.dialog.input?.existingProperties ?? [] 10439 ), o = H( 10440 () => e.dialog.input?.tab ?? ge.BASIC_INFORMATION 10441 ), a = e.dialog.input?.field, l = Q(a?.property ?? ""), c = Q( 10442 a?.type ?? s.value[0] ?? D.PLAIN_TEXT 10443 ), u = Q(a?.value ?? ""), d = { 10444 [D.PLAIN_TEXT]: "Plain text", 10445 [D.EMAIL]: "Email", 10446 [D.PHONE]: "Phone", 10447 [D.IMAGE]: "Image", 10448 [D.BANNER]: "Banner", 10449 [D.URL]: "URL", 10450 [D.ADDRESS]: "Address", 10451 [D.COLOR]: "Color", 10452 [D.FONT_FAMILY]: "Font family" 10453 }; 10454 function h(A) { 10455 return d[A] ?? String(A); 10456 } 10457 const p = H(() => { 10458 const A = l.value.trim(); 10459 if (A.length === 0) 10460 return !1; 10461 const _ = gi(A); 10462 return t.value && a?.property === _ ? !0 : !n.value.includes(_); 10463 }); 10464 function g() { 10465 e.dialog.close(); 10466 } 10467 function y() { 10468 if (!p.value) 10469 return; 10470 const A = gi(l.value), _ = { 10471 property: A, 10472 label: Ks(A), 10473 type: c.value, 10474 value: u.value, 10475 tab: o.value, 10476 icon: a?.icon ?? "", 10477 isDefault: a?.isDefault ?? !1 10478 }; 10479 e.dialog.close({ field: _ }); 10480 } 10481 return (A, _) => (E(), x("div", Zu, [ 10482 S(b(Xs), { class: "modal-content" }, { 10483 default: k(() => [ 10484 w("div", Qu, [ 10485 r.value ? (E(), x("div", Ju, [ 10486 S(b(gn), { 10487 id: "field-type", 10488 "model-value": c.value, 10489 "option-label": h, 10490 "option-key": (v) => String(v), 10491 disabled: t.value, 10492 label: "Variable type", 10493 "label-position": "inside", 10494 aid: "ADD_EDIT_VARIABLE_TYPE_SELECT", 10495 advanced: "", 10496 "onUpdate:modelValue": _[0] || (_[0] = (v) => c.value = v) 10497 }, { 10498 default: k(() => [ 10499 S(b(bn)), 10500 S(b(vn), null, { 10501 default: k(() => [ 10502 S(b(_n), null, { 10503 default: k(() => [ 10504 (E(!0), x(de, null, me(s.value, (v) => (E(), W(b(yn), { 10505 key: String(v), 10506 value: v 10507 }, { 10508 default: k(() => [ 10509 te(R(h(v)), 1) 10510 ]), 10511 _: 2 10512 }, 1032, ["value"]))), 128)) 10513 ]), 10514 _: 1 10515 }) 10516 ]), 10517 _: 1 10518 }) 10519 ]), 10520 _: 1 10521 }, 8, ["model-value", "option-key", "disabled"]) 10522 ])) : G("", !0), 10523 w("div", ed, [ 10524 S(b(dt), { 10525 id: "variable-name", 10526 "model-value": l.value, 10527 aid: "ADD_EDIT_VARIABLE_NAME_INPUT", 10528 placeholder: "Variable name", 10529 label: "Variable name",
10530 "hide-bottom-space": "", 10531 "onUpdate:modelValue": _[1] || (_[1] = (v) => l.value = v) 10532 }, null, 8, ["model-value"]) 10533 ]), 10534 c.value !== b(D).IMAGE && c.value !== b(D).BANNER ? (E(), x("div", td, [ 10535 S(b(dt), { 10536 id: "variable-content", 10537 "model-value": u.value, 10538 aid: "ADD_EDIT_VARIABLE_CONTENT_INPUT", 10539 placeholder: "Variable content", 10540 label: "Variable content", 10541 "hide-bottom-space": "", 10542 "onUpdate:modelValue": _[2] || (_[2] = (v) => u.value = v) 10543 }, null, 8, ["model-value"]) 10544 ])) : G("", !0), 10545 c.value === b(D).IMAGE || c.value === b(D).BANNER ? (E(), x("div", id, [ 10546 (E(), W(Ci, { 10547 key: `image-uploader-${c.value}`, 10548 modelValue: u.value, 10549 "onUpdate:modelValue": _[3] || (_[3] = (v) => u.value = v), 10550 "ctx-name": `add-variable-${c.value}`, 10551 "field-type": c.value, 10552 "crop-preset": "free,1:1", 10553 onRemove: _[4] || (_[4] = (v) => u.value = "") 10554 }, null, 8, ["modelValue", "ctx-name", "field-type"])) 10555 ])) : G("", !0) 10556 ]) 10557 ]), 10558 _: 1 10559 }), 10560 S(b(Ys), null, { 10561 default: k(() => [ 10562 S(b(qe), { 10563 label: b(T).cancel, 10564 aid: "ADD_EDIT_VARIABLE_DIALOG_CANCEL", 10565 color: "gray-400", 10566 variant: "text", 10567 onClick: g 10568 }, null, 8, ["label"]), 10569 S(b(qe), { 10570 label: b(T).save, 10571 aid: "ADD_EDIT_VARIABLE_DIALOG_SAVE", 10572 color: "primary", 10573 disabled: !p.value, 10574 onClick: y 10575 }, null, 8, ["label", "disabled"]) 10576 ]), 10577 _: 1 10578 }) 10579 ])); 10580 } 10581}), rd = /* @__PURE__ */ ve(sd, [["__scopeId", "data-v-de0af38b"]]); 10582async function mt(i) { 10583 return await Ei({ 10584 aid: "ADD_EDIT_VARIABLE_DIALOG", 10585 headerText: i.field ? T.editVariable : i.addHeaderText ?? T.addVariable, 10586 component: rd, 10587 input: i, 10588 persistent: !1 10589 }); 10590} 10591function Qi() { 10592 const i = /* @__PURE__ */ new Map(); 10593 function e(s, r) { 10594 s && (r ? i.set(s, r) : i.delete(s)); 10595 } 10596 function t(s) { 10597 if (!s) return; 10598 const r = i.get(s); 10599 r && r.scrollIntoView({ behavior: "smooth", block: "center" }); 10600 } 10601 return { setFieldRef: e, scrollToField: t }; 10602} 10603const nd = { class: "basic-information-content" }, od = { class: "content-header" }, ad = { class: "title" }, ld = { style: { "margin-left": "6px" } }, cd = { class: "fields-container" }, ud = { class: "field-header" }, dd = ["for"], hd = /* @__PURE__ */ Te({ 10604 __name: "basic-information-content", 10605 props: { 10606 fields: {}, 10607 tab: {}, 10608 focusedField: {} 10609 }, 10610 emits: ["fieldUpdate", "fieldDelete"], 10611 setup(i, { emit: e }) { 10612 const t = i, { setFieldRef: s, scrollToField: r } = Qi(); 10613 gt(() => { 10614 r(t.focusedField); 10615 }); 10616 const n = e, o = [ 10617 D.PLAIN_TEXT, 10618 D.EMAIL, 10619 D.PHONE, 10620 D.ADDRESS, 10621 D.URL 10622 ]; 10623 function a(d, h) { 10624 const p = { 10625 ...d, 10626 value: h 10627 }; 10628 n("fieldUpdate", p); 10629 } 10630 async function l() { 10631 const d = ze(t.fields), h = await mt({ 10632 tab: t.tab, 10633 fieldTypeOptions: o, 10634 existingProperties: d 10635 }); 10636 h?.field && (n("fieldUpdate", h.field), Le({ 10637 aid: "VARIABLE_ADDED_SUCCESS", 10638 message: `${h.field.label} added successfully`, 10639 status: Pe.Completed 10640 })); 10641 } 10642 async function c(d) { 10643 const h = ze( 10644 t.fields, 10645 d.property 10646 ), p = await mt({ 10647 tab: t.tab, 10648 fieldTypeOptions: o, 10649 existingProperties: h, 10650 field: d 10651 }); 10652 p?.field && (d.property && p.field.property !== d.property && n("fieldDelete", d), n("fieldUpdate", p.field)); 10653 } 10654 function u(d) { 10655 n("fieldDelete", d); 10656 } 10657 return (d, h) => (E(), x("div", nd, [ 10658 w("div", od, [ 10659 w("div", ad, R(b(T).basicInformation), 1), 10660 S(b(qe), { 10661 variant: "text", 10662 color: "primary", 10663 aid: "ADD_VARIABLE_LINK", 10664 size: "sm", 10665 onClick: l 10666 }, { 10667 default: k(() => [ 10668 h[0] || (h[0] = w("i", { class: "fa-regular fa-circle-plus" }, null, -1)), 10669 w("span", ld, R(b(T).addVariable), 1) 10670 ]), 10671 _: 1 10672 }) 10673 ]), 10674 w("div", cd, [ 10675 (E(!0), x(de, null, me(i.fields, (p) => (E(), x("div", { 10676 key: p.property, 10677 class: "field-item", 10678 ref_for: !0, 10679 ref: (g) => b(s)(p.property, g) 10680 }, [ 10681 w("div", ud, [ 10682 w("label", { 10683 class: "field-label", 10684 for: `field-${p.property}` 10685 }, R(b(T).company) + " " + R(p.label), 9, dd), 10686 p.isDefault ? G("", !0) : (E(), W(b(Ke), { 10687 key: 0, 10688 variant: "text", 10689 color: "gray-400", 10690 aid: `COMPANY_FIELD_${p.property}_MENU_BUTTON` 10691 }, { 10692 default: k(() => [ 10693 h[1] || (h[1] = w("i", { class: "fa-regular fa-ellipsis" }, null, -1)), 10694 S(b(Ze), { 10695 aid: `COMPANY_FIELD_${p.property}_MENU` 10696 }, { 10697 default: k(() => [ 10698 S(b(we), { 10699 aid: `COMPANY_FIELD_${p.property}_EDIT`, 10700 icon: "fa-light fa-pen", 10701 onClick: (g) => c(p) 10702 }, { 10703 default: k(() => [ 10704 te(R(b(T).edit), 1) 10705 ]), 10706 _: 1 10707 }, 8, ["aid", "onClick"]), 10708 S(b(we), { 10709 aid: `COMPANY_FIELD_${p.property}
10709_DELETE`, 10710 icon: "fa-light fa-trash-can", 10711 onClick: (g) => u(p) 10712 }, { 10713 default: k(() => [ 10714 te(R(b(T).delete), 1) 10715 ]), 10716 _: 1 10717 }, 8, ["aid", "onClick"]) 10718 ]), 10719 _: 2 10720 }, 1032, ["aid"]) 10721 ]), 10722 _: 2 10723 }, 1032, ["aid"])) 10724 ]), 10725 S(b(dt), { 10726 id: `field-${p.property}`, 10727 "model-value": p.value || "", 10728 aid: `COMPANY_FIELD_${p.property}`, 10729 placeholder: p.label, 10730 autofocus: p.property === i.focusedField, 10731 maxlength: p.property === "name" ? b(Un) : void 0, 10732 "hide-bottom-space": "", 10733 "onUpdate:modelValue": (g) => a(p, g) 10734 }, null, 8, ["id", "model-value", "aid", "placeholder", "autofocus", "maxlength", "onUpdate:modelValue"]) 10735 ]))), 128)) 10736 ]) 10737 ])); 10738 } 10739}), fd = /* @__PURE__ */ ve(hd, [["__scopeId", "data-v-382ed1a2"]]), pd = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2092.3%20132.3'%20width='18'%20height='18'%3e%3cpath%20fill='%231a73e8'%20d='M60.2%202.2C55.8.8%2051%200%2046.1%200%2032%200%2019.3%206.4%2010.8%2016.5l21.8%2018.3L60.2%202.2z'/%3e%3cpath%20fill='%23ea4335'%20d='M10.8%2016.5C4.1%2024.5%200%2034.9%200%2046.1c0%208.7%201.7%2015.7%204.6%2022l28-33.3-21.8-18.3z'/%3e%3cpath%20fill='%234285f4'%20d='M46.2%2028.5c9.8%200%2017.7%207.9%2017.7%2017.7%200%204.3-1.6%208.3-4.2%2011.4%200%200%2013.9-16.6%2027.5-32.7-5.6-10.8-15.3-19-27-22.7L32.6%2034.8c3.3-3.8%208.1-6.3%2013.6-6.3'/%3e%3cpath%20fill='%23fbbc04'%20d='M46.2%2063.8c-9.8%200-17.7-7.9-17.7-17.7%200-4.3%201.5-8.3%204.1-11.3l-28%2033.3c4.8%2010.6%2012.8%2019.2%2021%2029.9l34.1-40.5c-3.3%203.9-8.1%206.3-13.5%206.3'/%3e%3cpath%20fill='%2334a853'%20d='M59.1%20109.2c15.4-24.1%2033.3-35%2033.3-63%200-7.7-1.9-14.9-5.2-21.3L25.6%2098c2.6%203.4%205.3%207.3%207.9%2011.3%209.4%2014.5%206.8%2023.1%2012.8%2023.1s3.4-8.7%2012.8-23.2'/%3e%3c/svg%3e", md = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20id='RSSicon'%20viewBox='0%200%208%208'%20width='18'%20height='18'%3e%3cstyle%3e.symbol{stroke:none;fill:%23fff}%3c/style%3e%3crect%20width='8'%20height='8'%20rx='1.5'%20style='stroke:none;fill:%23fe6500'/%3e%3ccircle%20class='symbol'%20cx='2'%20cy='6'%20r='1'/%3e%3cpath%20class='symbol'%20d='M1%204a3%203%200%200%201%203%203h1a4%204%200%200%200-4-4z'/%3e%3cpath%20class='symbol'%20d='M1%202a5%205%200%200%201%205%205h1a6%206%200%200%200-6-6z'/%3e%3c/svg%3e", gd = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20stroke='%23fff'%20stroke-width='30'%20viewBox='0%200%20512%20512'%20width='18'%20height='18'%3e%3crect%20width='512'%20height='512'%20fill='%23f58025'%20rx='15%25'%20stroke='none'/%3e%3cpath%20fill='none'%20d='M125%20297v105h241V297'/%3e%3cpath%20d='M170%20341h150m-144-68l148%2031M199%20204l136%2064m-95-129l115%2097M293%2089l90%20120'/%3e%3c/svg%3e", bd = "data:image/svg+xml,%3csvg%20clip-rule='evenodd'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20viewBox='0%200%2023.283%2025.577'%20width='18'%20height='18'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20fill='%23006aff'%20fill-rule='nonzero'%3e%3cpath%20d='m15.743%206.897c.117-.026.169.013.24.091.403.448%201.691%202.021%202.041%202.45.065.078.02.163-.032.208-2.6%202.028-5.493%204.901-7.105%206.955-.032.046-.006.046.02.039%202.808-1.209%209.405-3.14%2012.376-3.679v-3.763l-11.628-9.198-11.648%209.191v4.114c3.607-2.144%2011.953-5.466%2015.736-6.408z'/%3e%3cpath%20d='m6.279%2022.705c-.097.052-.176.039-.254-.039l-2.171-2.587c-.058-.072-.065-.111.013-.221%201.678-2.457%205.103-6.286%207.287-7.904.039-.026.026-.059-.02-.039-2.275.741-8.742%203.523-11.134%204.875v8.787h23.277v-8.462c-3.172.539-12.675%203.367-16.998%205.59z'/%3e%3c/g%3e%3c/svg%3e", vd = [ 10740 "google-maps", 10741 "rss", 10742 "stack-overflow", 10743 "zillow" 10744], Ji = { 10745 facebook: "facebook_link", 10746 instagram: "instagram_link", 10747 linkedin: "linkedin_link", 10748 x: "twitter_link", 10749 tiktok: "tiktok_link", 10750 youtube: "youtube_link", 10751 telegram: "telegram_link", 10752 meetup: "meetup_link", 10753 yelp: "yelp_link", 10754 "google-maps": "google_maps_link", 10755 "play-store": "play_store_link", 10756 "stack-overflow": "stack_overflow_link", 10757 behance: "behance_link", 10758 upwork: "upwork_link", 10759 ebay: "ebay_link", 10760 threads: "threads_link", 10761 etsy: "etsy_link", 10762 pinterest: "pinterest_link", 10763 "app-store": "app_store_link", 10764 blogger: "blogger_link", 10765 medium: "medium_link", 10766 soundcloud: "soundcloud_link", 10767 flickr: "flickr_link", 10768 deviantart: "deviantart_link", 10769 reddit: "reddit_link", 10770 whatsapp: "whatsapp_link", 10771 amazon: "amazon_link", 10772 slack: "slack_link", 10773 patreon: "patreon_link", 10774 tumblr: "tumblr_link", 10775 wordpress: "wordpress_link", 10776 rss: "rss_link", 10777 zillow: "zillow_link", 10778 imdb: "imdb_link", 10779 snapchat: "snapchat_link", 10780 github: "github_link", 10781 vimeo: "vimeo_link" 10782}, _d = { 10783 facebook: { 10784 icon: "fa-brands fa-facebook-f", 10785 label: "Facebook" 10786 }, 10787 x: { 10788 icon: "fa-brands fa-x-twitter", 10789 label: "X (Twitter)" 10790 }, 10791 linkedin: { 10792 icon: "fa-brands fa-linkedin-in", 10793 label: "LinkedIn" 10794 }, 10795 instagram: { 10796 icon: "fa-brands fa-instagram", 10797 label: "Instagram" 10798 }, 10799 telegram: { 10800 icon: "fa-brands fa-telegram", 10801 label: "Telegram" 10802 }, 10803 whatsapp: { 10804 icon: "fa-brands fa-whatsapp", 10805 label: "WhatsApp" 10806 }, 10807 pinterest: { 10808 icon: "fa-brands fa-pinterest", 10809 label: "Pinterest" 10810 }, 10811 slack: { 10812 icon: "fa-brands fa-slack", 10813 label: "Slack" 10814 }, 10815 threads: { 10816 icon: "fa-brands fa-threads", 10817 label: "Threads" 10818 }, 10819 youtube: { 10820 icon: "fa-brands fa-youtube", 10821 label: "YouTube" 10822 }, 10823 vimeo: { 10824 icon: "fa-brands fa-vimeo-v", 10825 label: "Vimeo" 10826 }, 10827 tiktok: { 10828 icon: "fa-brands fa-tiktok", 10829 label: "TikTok" 10830 }, 10831 "play-store": { 10832 icon: "fa-brands fa-google-play", 10833 label: "Google Play" 10834 }, 10835 medium: { 10836 icon: "fa-brands fa-medium", 10837 label: "Medium" 10838 }, 10839 wordpress: { 10840 icon: "fa-brands fa-wordpress", 10841 label: "WordPress" 10842 }, 10843 github: { 10844 icon: "fa-brands fa-github", 10845 label: "GitHub" 10846 }, 10847 behance: { 10848 icon: "fa-brands fa-behance", 10849 label: "Behance" 10850 }, 10851 reddit: { 10852 icon: "fa-brands fa-reddit-alien", 10853 label: "Reddit" 10854 }, 10855 etsy: { 10856 icon: "fa-brands fa-etsy", 10857 label: "Etsy" 10858 }, 10859 yelp: { 10860 icon: "fa-brands fa-yelp", 10861 label: "Yelp" 10862 }, 10863 ebay: { 10864 icon: "fa-brands fa-ebay", 10865 label: "eBay" 10866 }, 10867 amazon: { 10868 icon: "fa-brands fa-amazon", 10869 label: "Amazon" 10870 }, 10871 imdb: { 10872 icon: "fa-brands fa-imdb", 10873 label: "IMDb" 10874 }, 10875 snapchat: { 10876 icon: "fa-brands fa-snapchat", 10877 label: "Snapchat" 10878 }, 10879 blogger: { 10880 icon: "fa-brands fa-blogger-b", 10881 label: "Blogger" 10882 }, 10883 soundcloud: { 10884 icon: "fa-brands fa-soundcloud", 10885 label: "SoundCloud" 10886 }, 10887 flickr: { 10888 icon: "fa-brands fa-flickr", 10889 label: "Flickr" 10890 }, 10891 deviantart: { 10892 icon: "fa-brands fa-deviantart", 10893 label: "DeviantArt" 10894 }, 10895 meetup: { 10896 icon: "fa-brands fa-meetup", 10897 label: "Meetup" 10898 }, 10899 tumblr: { 10900 icon: "fa-brands fa-tumblr", 10901 label: "Tumblr" 10902 }, 10903 patreon: { 10904 icon: "fa-brands fa-patreon", 10905 label: "Patreon" 10906 }, 10907 upwork: { 10908 icon: "fa-brands fa-upwork", 10909 label: "Upwork" 10910 }, 10911 "app-store": { 10912 icon: "fa-brands fa-apple", 10913 label: "App Store" 10914 } 10915}, yd = { 10916 "google-maps": { 10917 icon: pd, 10918 label: "Google Maps" 10919 }, 10920 rss: { 10921 icon: md, 10922 label: "RSS" 10923 }, 10924 "stack-overflow": { 10925 icon: gd, 10926 label: "Stack Overflow" 10927 }, 10928 zillow: { 10929 icon: bd, 10930 label: "Zillow" 10931 } 10932}, pn = { 10933 ..._d, 10934 ...yd 10935}, Ad = { 10936 "google-maps": "googlemaps", 10937 "play-store": "googleplay", 10938 "stack-overflow": "stackoverflow", 10939 "app-store": "appstore", 10940 x: "twitter", 10941 whatsapp: "wa", 10942 slack: "sl", 10943 rss: "blogRSS" 10944}, wd = { 10945 facebook: "1877f2", 10946 x: "000000", 10947 linkedin: "0277b5", 10948 instagram: "e54260", 10949 telegram: "0088cc", 10950 whatsapp: "24d366", 10951 youtube: "ff130d", 10952 vimeo: "1ab7ea", 10953 tiktok: "000000", 10954 "play-store": "fabd05", 10955 "google-maps": "1a73e8", 10956 medium: "e03c40", 10957 wordpress: "21759b", 10958 github: "181717", 10959 behance: "1777f6", 10960 reddit: "ff4500", 10961 etsy: "d5641b", 10962 yelp: "c41200", 10963 ebay: "ec5c5d", 10964 amazon: "ff9900", 10965 imdb: "f5c518", 10966 snapchat: "fffc00", 10967 blogger: "f67c01", 10968 soundcloud: "ff8800", 10969 flickr: "ff0084", 10970 deviantart: "09cc48", 10971 meetup: "e51937", 10972 tumblr: "36465d", 10973 patreon: "f96854", 10974 upwork: "77dc50", 10975 pinterest: "e60023",
10976 slack: "4a154b", 10977 threads: "000000", 10978 rss: "fe6500", 10979 "stack-overflow": "f58025", 10980 zillow: "006aff", 10981 "app-store": "0169e2" 10982}, fi = Object.fromEntries( 10983 Object.entries(pn).map(([i, e]) => { 10984 const t = Ji[i] || `${i}_link`, s = Ad[i] || i, r = wd[i] || "000000", n = `https://cdn.gifo.wisestamp.com/s/${s}/${r}/64/16.png`; 10985 return [ 10986 t, 10987 { 10988 icon: e.icon, 10989 iconUrl: n, 10990 label: e.label 10991 } 10992 ]; 10993 }) 10994); 10995function Cd() { 10996 return Object.fromEntries( 10997 Object.entries(pn).map(([i, e]) => { 10998 const t = Ji[i] || `${i}_link`; 10999 return [ 11000 t, 11001 { 11002 icon: e.icon, 11003 label: e.label, 11004 property: t, 11005 iconType: i 11006 } 11007 ]; 11008 }) 11009 ); 11010} 11011function Ed(i) { 11012 return vd.includes(i); 11013} 11014const Td = Object.fromEntries( 11015 Object.entries(Ji).map(([i, e]) => [ 11016 e, 11017 i 11018 ]) 11019); 11020function Id(i) { 11021 const e = Td[i]; 11022 return e ? Ed(e) : !1; 11023} 11024const Sd = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAACUlBMVEUAAAAAgvsAl/8Akv8Ah/cAgP/39/cAf/wAgf8AAAAAf/0AP4MAnv8AmP8Am/8AgPUAS4oAof8AgP8AfvoAmf8Ag/MAUZ8AYsAAgP0Amv8AkP4Akv4Amv8AlP8AhvcAd+YAnP8AlfwAd+IAdOAAatMAT6AAQYEAZ6UAmP8Ak/8An/8AnP8AnfwAkP0DgfcAhvcAnv8Ah/YAifgAi/MAmPwAe+sAZMYAifMAZ9EActoAiPUAa9UAb9sAUqIAct8AaM8AXLoAfe8AeekAXLEAgvkARI8Akf8AjvwAof8Aqf8An/8AhPEAnv/++/f4+fcrmvcAkvsAlP8Amf4AhvQAiPgAifYAmfwApP8AfOgAd+MAkPgAgMwAh+4Ae+YAS5cAlfkAR5sAjfEARYoAVa0ASpAAi/cAgP////8Af/8Ag/8Agf8Ae//5/P8Hef/7/f8lkf8KfP/+//8Aff8Acv8Bdf/k8v8fjP8bi//H5P8pk/8AZ//q9v8AbP8Alv8Egv8AffoAk/8AiP0AgP0Adv8Ab/8Ahf0Amf8Ah/8Fd/8Abv8AnP8AkP8Ug/8Aav/3+//p9P8Bf/8Af/0Agfvy+P/Z7P8Aj/8Aiv8Bff8AcP8AaP/t9v/g7/+73f+u1/+o1P9Op/8jjv8gjf8RgP8Je/8Aev8Acf8AY/8Affzd7v/R5//G4/+l0v+ez/+Wy/+QyP+Cwf97vv9otP8/nf82mf8wmP8AjP8gif8Whv8Gev8JdP8Aa/8Ajv7h8f/T6f/N5f+02v+Gw/9gsP9YrP9Vqv8eg/8AeP9fWNJUAAAAZnRSTlMANf7v1vzW/v4F+wz6+ustG/7+/PEoIh/+9evl3d3Xy8qmfXE6LycI8u7r5d/X1tLRy7+8t7WwrpaSj4VoYVpYWE0+NjMU+fbz7Ozi19bW1szBvrW0sa+uqZ2WjYqDe3hzbllXPiGEwwHiAAAEbUlEQVRo3u3bZXMaQRjA8a1c7wppmqSRuru7u7u763MX0tISqOMaJE2IpxpP3d31e3XLpAS4S0nhbvcN/zfMIPOb5/Zglrk5JE59csTc2UOmDhrQf1y3ZBrXf8CgSUNnz12weDSK3+gFgzKtLo8nPwiyFPR4PDbf2BlL1R2bPRFaMtBa1cqB/Nkr0+bkdigvT/cHOVAmrq/dPUeNh5NoppVlQMFUdtMyicN8Kq1MBcrGqV7tEbld3BYGFE9VtjHGXe7rwwGBmLKJUXKOrw8QCctTI8+wTFIull3722T8MBSvL7FUppGorWWvGCAYu/YvnM0CyRjXIRRqRBUDRGPTxoTg9RYgG2MbgXArrAwQLjgA4fa6gHScezSG0y1APNdwhPJMWUA8y1CEFvmBQmsQmm8H8mW5x6BZGqCQaRUakg8UMmWgDUlOrBFKm/Reo9HpdHqNXkNBqQCdyJ+LxgeTUcFRXBN48e3Jw5v3L93/8ujpj8uBolqjwwxxYnNQNiScprq26M6tEh0fme76vQd3DBCn/N6oX8Is1AYenMYSL6qipRPw6gTX2OzwPpRUcZeuxIVXol4Jut7X13gtdhOEuyQIm98/53WYTQLumpDrfMFrsUAa1vz6iV0acDH+DpGHsfuYpwJXB7BLAdbU3uJ5GnB1A6+jAjuf8nQmNt7QxYE/KwJXX5CgQj9jp8uvl5y/W/Gp4rZRCbj5mYSr5a99rTtT5DDom2ucRr1ZCbj4lpR7811xAQgChJMfrqkQH2f+dkupBnBKwvpyMXyjxQygMCw0asUDv3RoFIcLAzoR/NFoBuXhN7yoR+9Bebjgohi+46AEX26iA+sChXRg7TmBDny6COjA11IwsTU+I6RgeWAhMmk4Orngc5GdeS2G3zWei8osC1xYz2uji4V1sa83FMoCX+D/s+s1QAe+56QE3zZSgp/Qgr8bKMEvmyjBb0rpwOVvBTrwDSPQgW8WU4IfOynBz/SU4OcOSnB9gUxwvehf6T+f0DYKMsEXy89HJYZLSq62d1cP8sBQ2qyPyNsg3oF4De05DGaF9lx18fZcSu0yz8bbZabgFJyCU3AKlhvuRQdeSQn24Ev1dCbujcbSgtPtNGB7DppIZWJrLhqSTwM2ZaBZGirwKjSfxhpzbjU6boVw5Cbuj1CGiYNwpGB2G0IonYVwpGDbQgzvcxGHGV8GhkeZGAhFDmYnoT9NsEAoYjBTtTgEL/kQGpkczPZDuPDpRQzOqlrYBo/0/8fIBXXJwuyE8D0Dw8qyoNPw5SRh1peLwq2zcKRgle0Yak+d2YcjAzO23VE3xORlWhgSsMq2HUWXl4ZlxWHGNhPFNmagTaUwzLDWI0iigz6WURDmGFt2jvQNT3lb3fa+CsFMqyttOMKudKNmmPzYlhnmAFzu7OFq9K/US3eMt36o9HtaNdJJwW8FTUdZ8q2Vlb0GzhuFOlHGyEWH5w3bOX3alO6Du8c2ecumHjFtnozfFhv+6JRp03cNO3D0xAqpWX8DYfVYijGtfbUAAAAASUVORK5CYII=", kd = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAC/VBMVEUAAABIacXaum3zII/cjED0SXFfY8KATTvmMJz+yixdUKaTXrP+M4TqXyZGSKFKOmZ7YMDjSjt9Wq3MQKJ9RZuYPpjdQl6uTqavPIvpgiGSVbLHOnP1uidbUKGJPGDjKm9QYsO3LVLHiB9VbtK/hBjtsSE2U7vzqSP////+/P3tXSTtVyXtIlTtH1ntJU/tYyRQU6LrHX3sHl/oHoVvTp/thiLsLkftfyJZUqHtKEp8TZ1bUKCBTJ1qT5/sHnZlUKBVU6JgUaGkPJTtdCPteSPtM0HtMzvtbyPsjiFzTZ7tnyGeO5XkIInsF3PtmCFMVaOrOZHrF3rtKGplTJ6YPJbILobtM1zuPS7tTiztUCXspSNUUKHBMYnfJI1IVaTtNjPtayTtZyTsGmS4NY3rGYLwwFbuUyvuqijtSib++Pq0PZXsF2vaKZDuyGjtL2XuOVSwNY7uOjpCV6V3TZ4+WKbuRy7uQidgTp/tJnLOK4FrS52HSpyRPZfuQkJFV6XvxV3uPUvuK0HSLZLutTesQZfvukH67fPvSDj98OTKMpPusCvurzTCNpTTKX3aJnrwtEu8OpXsH215Q5mCQJnvuk2ce7jvskLoRzKkRZmKPZnjKmTvqkHvWyzsKmDlLVTwkj7wwUzgPkJyRpq5L4rwhzr21nruvmPpPl7gJnHwnELkQzvux3Lwo0jvfTbvczXvYy6SSZvXJYPHN23vazH73+maR5rBNneMSptvP5a6N4DvtVraK23NOWTsTFPwq1DbPUulMpKzOIfXOlTlHH3SO1vrIQnsOiPoA0DsRxjqDxboBU/tjinrOwliQJfUCWnsIiPqag2YHobTKnbqCy71n8LmLY7wY1T949v4usvuV0Ln0+j0wdnXLF/hA13rE1frF0D81NT6zLn1jXzrUw3tiLbxbZh6HIThCHD5t630aGnrlw7qfwjVstX3m5vrTY6BLo5VKYqxEX/LDX/zflX73srOXajDJYVKZ7q8jMGzeLdpKov0sHfZPHZYW7VYW6X0crB/AAAAKHRSTlMA+TDkL/z5FOLzkf74zFEk9Mz95c3My+nMyMfHxsM3h9pXXfd9bNOaA3NLTwAADzRJREFUaN6k079r4mAcx3FdLESIIgcFwSIcHLo5OEiteHaTDnfQboUuTjqV9kCIcpNkPiwFXe8vcLhix/4DHVy99XASkg7FH9DjPk+efP0+Mcn11ztRF5OX3+eJkaASuvYp+upi0ZhaMpYUZTU94QOCVS0aXXwL6UIcSt9lZ2dnX3CiQqHwGZVKpXKtVqtWq5VqKpnSnrf1bFR1OHY4gEiKpEqWYdCVSjGZ1P8/bXbhZQMd5ghEAmUVKLtCNlLJvXBX87HBFmvsEUoswSQXi6l0CLvzUW6hIFUV2xfKMUhm2a9KGCUDt1pfXHASZY5FxpTKTjU2A1RkpPQQFyJMR+UBQ0XmVJJQWmKujuXWAlxJIj9JSc8R/RyJHIOo7kQyuzBdNPShAVhisl0N9pgkj7uErKvuzsJhJXrKIJNoizw+Zoc5b+Qp1eMJBc6SekoBU82tRZWmYWwxJHFsKjK72pOjkksez9lut2ECZJNQWM9j+0qX+xr/gbdYEttuwhNJUqIhFO5LTmibxc6oLqkuS
11024d17uw2t399/trR0EzEPyyiZtn2cil+/tPjBen17EBSPvCd3eMtV1IpxbxvXczOfe0V5c7rsrPudTpB9oIwc27BlxKphVO7t6ynQNzRdWVZHJH28cRh5B67+F66T67qqUQRr5t5cczm7GneUVFoDnCkEsXDtS7BvL58z47PxeNxhneUPgGM+13Cyl+Li9zWfDcejscxDY60TT0Fs8daeEvuuoa3uyA0023iudQFLVnXXJrnvk5vd7s0N0WzHtYhWYpbceoCbf2E+++TkRuYZOx3RXJfUnyKbXXw258v4aDjsUifckdqhaLC7nJvq09GcHA0Gg43tbnc6khEsTBdF/T7vLyYwV9bMGoaKh77uJpPVVKF/TQYy1QYsWaDE9terjZtrrmaWggZrvcOet7vJo8n3mE96A0raDixYQt34mqlljVxUior5VdTD0cIn3nC2Np1PfvNd8CWRau9GMrTA1NUa60S/dcYqgxSkc5EDtbZ7mJOMxQbrtXcjH1gFiqw4LiCXRvWKwFDjvNFotHCIfogTL3k4PfzZ3OjR+V0qLmBC3f7RWTevSkRhHMeDuNCiXRRB/4BBXjBBuJt27QoycJcbcyNK64I2zWJAMLnQqoErhItcZkxBVPRiIMxCUOeS5FsLTYIwFK4UtOh3Xp7znLnWd0bCivn4HJ2j376Yjf4bqwQSuVWlgge6tapXbuOBVma13dU+YMYlrFDq8aNn9Dovdu1RlUjVb9dvHa8iHpvNsIC1PVpJ2Y3RyPV9ZOGAbRV9+0ED/+5GRtViPSJmbmXEWc7gIc5NWc84W5fL5c0RjTxcVQAbW8IWKmFXu243ooK0Odm9DIcnTiaz5hk3jlNef9FPC5sK2mf8DGBGxTbxggcmlFWD3MNJNdXh3Gs21zP+JK8dx2kexXRHWICKwSXMqujnL7qXulqt26jxHuqa4jB1hrxTNkulkoMVUIVYekS0gc0ubN7iL11iSbXFXsdUrVb/BV/MZrOl0npAl1s7ZZs+c+LsfaiaRV26mX6twLJqodVqp7OcDXwX+cPZctFZVGWtZic0rrvIouacPjFrB5Gs4MhW3HXpTamLFEtoFQl1UIhZFYbL8aKlOjR7Rri4JjrklXdsGrBRwQKma+4bllXUGM99Ejl3rulFCFO4LlxRlj5sJaRkJGGNSvb9+/cXCd5m0bjBbCT/cCzl8Uw9TbeSyaSQCwRnbZlgmFDhRmB21bCNBi6LabaSfxmOr6fT6cQ4MQvD5aKVz+eTogjMNGCozDJc2Rxn4Q6Z3aZ9yKLFYpEGK+Q8w4eALfnUibP6m12qN2xYu6TC9W13W3ZzRdC6vI7hLM2MJAxVumqjokuXN3DFHWvcgNz/y+PrWs7jOAZfyyIjA4Zqfc3WDSzYXq9Xff1au7zO+NMN58u7d5fz0MdTXu3gCmjdNswy4PP8TQC2buBMT7C918r1vADbsGGHO0EwmeRyk0kQ3B0YGncvZKb/CSMFK/WDyoKJxel53mWPr+7utCeXUQ4Bb9/1+d9OFwEbOpG2YEvW8AdSXyGC/0gXebK2b9ZzCJaTdKhk5AZgDZ1PpyMwy4C1ChO9fGlgmNJtCHeyNHvhoE0m023+eTUfQ2WaYbGdsAzYUuEybI17gIF5XlhxnDjY5pkxcpHkLZhlwFC1K3pu4BGxgOM7NJHbjsfjB3HKyPzKlrliUdNRGDLTgI0JFTE8Gnkjz6t5tYNaO6TL7kzj8Us4KNInN2nkYVAkGTHcggxXyKUs4AtQiUVvGEaCFU3py/Jr/xJF+mVFtwf08woTW3QE5pkBkynZNyOCn9Zqo5rqYPdpTIWByWVc8ZM7NDLWWrUFa5pgVpENU7tT8ztiuiuzcZLNDTcLtFu04SRgkhVsUKifPm3Bqb29vX4YUw36u9wxum3+U5DjmW2YZCThN7pP6ONHhoHWUuJM9b/GVPMpXsbuHuOWHdCy+IBB6wycTiSZzp48cYFQyVpwKvUkpet/jqm+A5YxbeTJDr0fgNE2nCAYnTxxjlXRO4LfpoT85GoKR9+nz9aD1B5HtO6OgfU2HoETgGlmBf8txd5Bm4riOI4HH0RBERdBFEVR1NQHClFcXDRRCgo62KRLVDRNES0ZUlyCitiEOoggFnyggg981UEnQR3k1gQv3ICQ6KI2WdoUp3Rz8Xce//M/tzfx+b1ppVjz6f/cZ7XVt2/vEnwuHqN8sGwnfIsOwJBlfhhpl2CNCteC4/G7cZVnlvo8ZKKB2/bmuRZMtAXvh0szS1igYKWKCM6n4qYyHVzfP8ZAUz6az7mX7zdtY5rhXVu3vjMyYJpVlWKYK0/QmVKOIRtnm8+593QRD8CIYVYf332csuEegr06/T7gxWjXk6to2B/NBQSwpi34zP5dSiZ4sWFlBi6M9SCN59frJr04iul8Uz+kS+bcL3QVh2zDtgyYUDQy0jNmw1TKMTeJcjYuUi42Q380Nwl5OTdDG/jkLi0fJ5hZPzzYMyY35Ezod8XI2SzJ9thfB9abyypfR9vDxxVssyODNozACnnsM0w1TzmVlc2gy0N8x8bJxbYNIwkfZ3hElfPDFEau0ftisalY3tDlT/STvfzI1xQ/fIVG1vAIlRnJZRhOGHgM8ljVPM2NY2aSsxouf+eHvY84won2w/t5ZIYTI4lEBpUITpcyg6VBKud8W29mdjzl0pJ7NC96CRcy0xYs5YNK1nACbiYAywYzemzrgb7qjIHMa7n8eoj/buCrPq9JNvAxASMDJyQrSyYZvgnYJEaum3fH0JOe46WQ53lVrIVxv5e3n0dSFrYfvuKH4aYTSagiC8ZXlp1wxn2/tI3XJ6vVyfrEkGLpyIuBRTw1wYcAsyzgdCKNFz4lk11+2KTlb0R0/NW8HI/FQTP+C3hhWtTVhZcoSe/9PIkvupJcIuPUSO7k6juachVtw8gPQ4WrMrD+mu10klfbjtc5lYXKNGwb5
11024pEV3GWKYLPgSARf2qXTTh1CexbHVVZGtM7A23wjAzYmIFD0jS8iJvZvuulae7r22Sn0CDeV5ScIGz697dihAByBqmvQN45Gtogi/m4m3VYtyBYnnbFCrkeUTYk0HD+/nc60TdtuHTrEaw04QkmpUVyvakWOHt3C4W81XXJHcQ5Z9Y/jgpITjfQUyEaSfk3f9AWwkM+okQ1MQGN6vepH48iRo9QWTqy8WxqtT0zXisXa9ES9WnIzCZST9ai5ifbq5kHs1i0xMmSCt1CSaNDj1XRjLzoiO2oyfMN13VJJfEqmUcLQiOk4P60B5pElzKowKi1amwpc0xGVT1crjwCTTUMTXR4yv/zc0vKZMxo+ioCKJNFPa13ZTbX3nysdMo5Ppu0F9ybpbDu8UcLIwEfIlO02O7lY2SOCy83UzeBdiOgMZNzCReVv5m552IIhA95rTFnljf4hMfKOHZC5IM82aGQu7OrBxavSOf/962EtA4YMeKkx0R5U6ae7H2CVrRMu+E40yc4QPZfsHDgs5dOQCWZUtGNH5Ye5GlWiUbBWhGuebZsmOceX9omPAwMMCxkwzwNVVOk3j1eQTQGdaZ7aHtrhB7HYdgEfBgzZwCKYumh06sf6gNyB99MREcm2+907N6BkwJAVHEWsiio1c8+pTU3tk0Wj+wI40UjTLLsu30KL3rlzkBmGDBhvaieFDfw/xK9Ac4z7bDU1yyWn1c8PYvmUgpEPVpEqmnpqPUcVf+ybmoqq78GmXaLN0GbkRskt4Q7Gbt3L5wFDBqxlwOv2BTtAuxlh+A3TT948+tCmKDK6GBpXsxet+ni/ZGkHO3kD81rPC63pBuRTRVNP8E/+K3InnHyWYETwytCKPgGBA49N/Im6px78n8zzFrJt4K2rQuHhAxxUyXYf6G7e2PC/NP55yykUCoD56FLygkWh0HLLVayq2Zwm+V/Z2qCbyxUK+TZwKISdDGuG2tvd29vb3XxV/J+B++vOYI5hPqyx1MsAL5qPhaUUi/rER7P55J/pobrrJhId4AUrQuiC35Vqn667eXl86B+GHW+5bjrRGQ6JVvfNnNZ0qe9Sb7N57cn4dPHPUs9/oyUXT2KdYZxMsvm0W2WatOrD7m52W9mnARJXEVxC9lZQA3VFnuNx6BfwgrCCVw8TSqt8aXh4GKLVDflxA68ZPUK30b179549ezY6+uLFi+fPAd+UI8MNwjQwRu71zUvqBWyXLlwTG17cDXxYMmwBk/x7eEGICkP2ufBkUmXW7rLYpPyUZuaRfwnjkDatHSbVZi/Krl2kLl+8PLM3lwE/BS3gdnKBYLgPJYyFtlpuz8sui1cvX0X0WW5k++TOMJKX6tkhX/PJRazeuXj1DqCOQYf8huTAXiZXwg/FOl/nHWzLgNXEirU7cedEsFdXXwXkUSErmGTlAoYbDgXkPsBgkZy4o8iseL16BZjke34ZdKHwOf/69euBhwgDY95gy4dpZIJt8uyJs9SDE9jOPsALsqi9DPszei2S7sPTS0JtWzu/V8MIMCiOWfkJG2hRUObrCFzNousLVoY6FF4Omke24FNiC6ZpyChwbCuX5Llzw6HOzZk/34bbcswSzUP76c+fq8yuIqMTvRz2JcCQbfXJqSftYzpwXlWrEoa6hNnOhVfDviMOrrP3f5/ExejySBPnFnC5t1utKpqchMqL/Fs8PAfN+tvmBAt3QH8CzVZPTB0FdDkAAAAASUVORK5CYII=", xd = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAABKVBMVEUCW44BXI0AAAACc7EAAAACjdoCU4ECT3oCX5MCXpMANlIAN1gCjNkDhc4DfsEBf8IBXpICWooCU4ADY5kEV4cAPVsDjNYBi9YBhs0DiM0DYpcCdLP///8CdrYBYqkCdrUBcrIAX6cef7n3+/282+v3+v3+/v8Bc7MNcbEBZKoAX6gAa670+fy92utnq9EAXaf6/f4GdrX8/f4CcLEAW6UAWKQJa64Bba8Chc4CebrI4e8DZ60BYakkgrvt9frS5vG/3extr9NZpM4phr0Xebbc7PW32Oq01ul+uNkCgslDmMc7ksQ0jsEvisAUcLHx9/vf7vXX6fPL4/CkzuScyeKQw94CfcEbdrX1+vzj8Pe62eqp0OZOnstLm8gAUqCr0eVysdVvsNQATp+xDAI3AAAAG3RSTlOgqgD9BfSjeFKgMSr68Laxq4iBZUg6x8XCvp+9qgeQAAADeklEQVRo3u3biVLaQACA4Yj1vq9eWUICugpqN3c4BQHl9j6qVnu8/0N0xcrS3bRTZthNR/OP4yib8XNj3ISBSJFu0xNTkpCmJmaeRAy/iUyOpTOxqJBimfTYJCYjEv70vjEqC2y08QGjeMbvomJcIkffPs545UqUS+SrFQzPinOJPBuR1hpyADXWpKWoHEDRJWk8IwdQZlxajMkBFFuURoLZ1SMh7N/rgFXL2iTfiYJVpFQ7laqWJw+JgA2ns54AuOPza2TIODGwpWQBBL+6cMgAZ9hyddN8dk1wgMgQXzgJdUCC8MQxhMBOsTtdIoPLlAjYamHqt3SwJQK2ixBQwQtFAOwCFt5D/GGrA3za4g97X/zggvpyYasd0K72P7hSAmD7lIGBkH8n755dQK5lAbDsnEBqybxDQmDZBXq/a+7ZhhjYuwZmb9Im3CNXIZxgIudOAXyiIajZZIAXTHJaxS6cuI3bIi59SJbtVpqtuIKYC00hl7e+C+XLvaDvL4T/1KZqefjQ2BQLewhtFdrNZrtSzSHNGxg2klRKziCHep4a7I0ht1w67p1XbmrlI9saDFZ2qD7vpnpu3KTGsqj7y9rxQ+ZsWmw51kBwAlCtawSmx84e4W2lBiAN4wdOCprBC8YzNrS2CU3Ahh+sOwY32LC/Ax34p4NDLPOBNbtOXCYT1LDM5W/8455yaXk/yWfGDuWye/uIC3x+aIK/ZxYdDjDsflDRm1TUYcCDB0t2QDBwxcKkshcMDEuIGwzJF2xwJ8UJ1kHia7kTj1fKt8B31a6qPGDsftPQtorbtt2s34LStHjAunmkkPX44dxnd9dzHGC8JnoyyXg4YOG7PI8Z7ytyf2qVnfIZGj4Md+hnV84poLvROMz4UqF+QG4f0B0rHOACfRWtFgDdRnL4sM6e512d2cgdPnyAGFjbY87J7ubQ4UMWRgci4MskO+Msc+hvDR+u5xg4VQJ0HOD9bRbeFQF/CuEQDuEQDuEQDuEQDuEQDuEQfo1wfoNKz6I+mBr0e9KGSglqK/NfYCOvUPW/0qZRY3kvxsBGLk9v9WJfTQ3hEP4/4GDevD8S0O0K0XFpORA4syxNp+UASk9LkbEgbsIZi0iRybRweTQ9ieHIfEawPJqZf7q1bEHMnMl8FzDavZludS6diYlJvkrPrWISw91mRN0++PH59sGfGaITkDKAs5cAAAAASUVORK5CYII=", Od = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAC7lBMVEUAAAD////+//8UDhgZESEVDhcp/v16+fUbISoaEh8ZEh4DAAYFDRYBDBP/Ml/7epQAAAD///8o///7//8C8uoXAAMB8+sACxEdYWgQDBMZCA4eFST9a4YUDhj9BSz8CDLjK1H6//8LDhY6Fif/NGMX9O0QDxocEiERDRQNDA30//4o+vkO8+z7NF0ZDRIfEh4YEhi4JEX8gZgNChH8BDAr///9QWX3L1r9JVAtEyP93OP+xdFuHDMfhooTDxf7Czf+9ffzLlf7FT1UGS792eAZV1/TKE0ZHyS7+/qW+fdI9vH8YoCKHztIGCoWDxoTDhcUDhj5AB8DAgf/DEAn+Pcm9fQP3Nz++/z+h6Af8+07GCf96e39ssH9l6zvLVUcQUkWMzvq/f77bonmLVXN+/pw+vdlGzEbJy6I+fYdFCIaEiAVDxgUDhcMCw8D+PIZ//8B//7P/fv/XH3/NGX6Llf6HkReBBIm6egl397809z9v8zZKU7HJkjQI0fi/f0jxMUgqKn8d5CbIT79iqEgfIF3HTaz/Pxn9/MfFiYeFCIcEyIZEh8YERwcEyEWDxoUDRcQDBMb/PkJHyDY/fz+7PH7Tm8ZGSBg+fUt9e/94+gJop/AJkeiCykk19YRUFOeIz9fGi+h+vhS5OUecnh+HzgZER93/fumWngaHyoMAANissWxc5P67/EfbnPjGEHm3+L6obMIjZAnU1zS+/k69PAE6eb/oLmnI0EAKC0gk5anJEFE0dcglJiOaHgpLDfoAy8vAgvj4+TobIQKwL8hkJQfdXxOf4UdFCQaEh///
11024/8cFCEcEiAaEyAaDBkK8+v//Pwn9e4gFiYXAAL9DzoZAwso//8aFyT//v7+LVT/MV39FkMfFiUdFCP8LVMWER8QERwKDxom8+sgEyH8//8r9e4l9e38MlgaDx3/LlkaChUo/vsn+vUO9ewm8Oj5K1H9IUoiFygW9e39KVH9CjUhFyce9e3/Gkn9Ejz8AScm+PCt8uteAAAAyHRSTlMA/v2yHJH7+fX9+wT+/v31Bvv9/v38/v75C/37+Hf++/n7+/n++/rTOyP7+/v6+vn5+PdC/fz6+fn5+Pf39hb8+/v5+Pf39/f29vb29vamgGb+/v37+/v6+vn5+Pj4+Pj49/f39vb29vXiwotRLf78+vr6+vr6+fj4+Pj4+Pj39/f39/b29vX09O3WxbCknVs2/Pr4+Pj49/f39/f39vb29vX19fXM/fv7+/r6+fn5+Pj4+Pf39/f39/b29fX19fX19PTz8vHvpUrZGA0AAAjsSURBVGjexZt1dBNBEMZziwaSQmhTaIHixd3d3d3d3d3d3d3d3d3ucgdpAiSlSYCS0uKu/zG7e0CCPmCz+S68R9L37tdvZnb2Nt3V/Ewh8+r1rBOPieb0nNs7RPNnJdVo4tedkdpiYienJXXWtPHh1r/HFsxqcWpFxlKclpnZfovO1t2hVUQfSKs4svb+BTm5JqSHRQtufaMksqMOMf0jN1tqUxLRh0pimpYdMD+kN+3bJGDXl9JqX86lZE/uVYdP7aqmLWm9yPBmtpMDF0xjsic3LQ8u9dyLVhiNc7aXPk6vJzm7R4uE/HKTdho4VQPdw8TNMICdc76Qs1k4GoZgv4yvZrg7+OUp00xquaCDK/hbfWUVecs0C3PjW8AwX2lThwC4rlPkLcXRC0daETmLxjoktegHTddoeltE/lIsZTT1nKIf5Cio6WkS/SBTPU2dfwYrcTc9pPwduK4m3j+D42y7U31V5UfKX4ET/Af4WtfCt74qYT6RHzhxwogHWVT1bZfy3n1+4OuJDBmoDKeHVLzHEyypCmwW1VEv8wQjAYEkaUShouF8HQv4haRFZQOK3+EJFpAkwGVAuR+W0nENNb7AtdT6zUq9zDfUxLO9XLrc4TLf4lKznCYKYs0PDESaZ3O5dB1T3uebYwHn2C61CqvYwMazgQhwIbAspamwxmrjNpzwhfMMZFRk5wpjqE3hAQYmWFZtmwMH7Djc1mh9pCgKB8eqELzM7lYb+jWZ1C7UaLVxCDV50fI2u1GnpX37BTVZYVQ4hBpJJMcIEbyQ4eD6LRu2m3zvGPMEmmkaAND5Bnd87JiWlTqcSR8T8Ad7z+W9I/u4ZWKfhEeQtMLdJRoObHHXt+Avgwk7Jm+I40rpAjIxBeMRei1O8W4giNQVbZ0EjhiDFVPcTasxT9dtcd9yDMJYczlktmO2mvMSDMGKYjVWTTVudePCl296NRCEYTVrGqBnqlyBIViJs+bZuDphisdPHvStfPPOXUUFqxUlFKhf4YhBsiOaYmahVmzWfOMapXgS/eB6UPPOBxrkLX5HBX+prGQfqgwp1noXkiDgArMc20KNpRM+jo55Fbys28IM6MKegKI6+Ytj6jHZjTb68FUVBrRqacA11rIQC7DNWnXoreiId0E1OhlwV0wTFZn+G5i2jWQ3ymdUUqZeVbaha/H48QVqvvh/MHBTFX4SHRPcvBOS3AJCgheY9mlwPChclO+kDO8yqtj791Hvb2f+3wYC3NIpoh/EBHU2ABYH1suxRJ+rwXHRJNCeZeWePkntyWvz5x8FZfAfYMp9FhERXE0KFOj04wVG5MKOb+elJFm8p9OD/rNXQ5yBGxPUXwpEX9rxD44l7NhrCSPLgP0fsBJatTDmgt8vE9+PjmlVs1072YxDnzyICe4mBVKzgP0uxyTrCMBQxuzAinUSjKNXywxu3BrpFPh9VQtfQl37HkNwnpzREOgxtPPjf8guSeM9wCASCCiuiszAYLg0GH66VCCBBpntQtPh+4pEZu7o6RiPZACvYwc2GYd+wobddDFqNwslag5+03D0phbhnvOxRB0zXB8/apsCMlxDQDSVZtShflTmtXn1uruiDOCcGIzoNMEUrFiP3yKtg3AFM8odFlA+b0q1M8QlIWAyRSDsuBY7sHHYk4iYXDnUJ0ipQFhs7oz46ywKztf4KR5OGE0cT9AzC3W+Rg8i3tVAtCnaF4XFwpAhdim40dPOAKUvApYZga91TfEg4no30q2w4TeRIz2W3nFLcj6dirBd6vhhfmbg0LYAhhRTrmHQa6gfr1/r+lSBPswD+AND8M3KGLxQnQdalnUF5FW8fq2nAFZ7dZoo1uBc7dUsliwU2TGjx62huZDhRL8QGPCCZajXABiKmi6+WxWKHO1xa8U49knw+q8rpyIswY/aETC4xdeIQg9HedxazpcwIri/pPYPQ7HXD0+wAkPdJozGjukEtDxd7Eid7Dlv4Z8RCbgAYDgxbCCfSI5Jm0DFXhcN/zaKYd56VQOR2gLXJcNctyczbJnjHuNwquvtiWGZv858NuvYxxFBU0hdQW+B/uFiOR9DWUfD3eHmQDY3rfBabSAm2Xrp1rN3zZGb5thuyP3alTuJyAyshDaOhraISKztUqX6mdellBXlkTV07K1nMUGdJLXuzCXCYiOr6GV2YOupW+8OGShZMksl6z88syA0T7vSjR4/Iw9ihIvsQocPrgDoamwffYLa09qSkFkqMTjsZL/GhW9FxLwKqi4Eqsk3lysb6yqa0cQSbN2YIqg66YoI4GYJtU63tUmf4ODrNcZIgbiwyKfJ3rhu19LLDMFQvcMeNze4kdqfwHRgydbVq1fLIQCXdi27fXkYNgxchmDxWmjOPtgyCTcdPVT0SR5kNhR78Tygi44x2HSzauE+7TERmIjEHIIOL8KF/5iFmm9iH1aBccYWLNpuVp0/3+ymT5PUOr7Ud5DgiR9jXQPz3RVZg4Gcp0lCyK1ERPkgMI39ogIfY59nrq2T2YNF0yPj/oQ57HTQqmQBzGK7TReHAXcyBJo5mNb2gotTkBvZAfd18QYNxTCiwgfgbgIuezAlX7Meu1JScNO8SiA7zMEli3x0uSIHdqFc9mCKftTAWKXZ8HKI/r0HNR0+cdDHF7HPb7cprgeu78Ai/mZlyNliRToUaNasQIcigwvdeO5y3c5dSwdP+D4Fg+7f01Uc/T6q4Y0bUS8iIx/eDmhTK1wvy6KPwRStz9vlaJU25cuXT7+yVgsdwf4buM5fgGnA7+n1GUE6WDP+IxbAdf9lA4qsyKIsK4r473LW09QDMH/Blpt5ftlk5Ijvr21VftpIpsQDcFq/bJ3z42ZB/rEmW/b8uSEUtsBytmzaDFBimfemXzBMLPttmzM0EZ7g6YRLle0lt2BDZXlt3ndwImvfwuZ97scVfn5QgoNnRUu4/I+kKORIyo+HcN7yP4RDySEzfXnsSGupkxQC+6Pwh/O6O3yB/v1BK4ouOMPiZN66FefbHuRo2W+VHR+mczI9TLc5bZk/YqnzkDJl4jNSmTIhP0V+Bozakb0Q5KLOAAAAAElFTkSuQmCC", Ld = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAAAM1BMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACjBUbJAAAAEHRSTlMAgCDf7xC/QJBwoM8wUGCvKHDy+wAAA05JREFUaN7tm22P4yAMhB0gJIG8+P//2pO6d3UVF02oRbiVOt9W2uopGaZMLUovGveUAzdSiGl39E5TDNxaSaPdwUBt0FPgm+S3V+7AN2qwcu3kjW/W9MN1nm9WcA9w4tt1PBbMHTTJgu9V7LRgDiPt3EU7Je6iRJG7KFPgLgrEnfQFl/QFtwCHoahr2fPDi2LFihcqabt42opcwGDRWiTP1/uFLhkY7MciOUPuUuRiMMci2CGbh4tvk8DLa22egTEwTtNnNsfLbZ3g1hynHz19j1yUHwEXgzk+wV6aIbDZu+ueEHBLQLJdJ0uAMZg3+qv9HO8BvECCBMBoAfPZwWgIMAZz/gca88l352GADWBgMwiwCSyg7RRvZXNWATaBw3q22YnNIMAGsNpPKt4gwAYwp/N+GsRmEGATWO8nsXkBATaCeRWQshkE2AAGNoMAm8AaJJFdQYCNYFnSqmwuBNgMVqDzLj68A1wTWEDp/PRBgAHYYLMKsA2Mj4tNcz3bwbgVBFfgGsG4FWTQ9A1g0ApmWHox2G7zwM3AuhUEV+DawLgVyNMn3xSsjwv50A5NwboV7OpsNoJxK1AhawvWreAZMm8Am2x2oSlYHxeLstkIxq1A2dwWzFPR5twWLKdDOocstASHlYo27y3Bm+oc6rPUDMZzqP1zm8nCJZqxzXawAERjVkdmC3AuV0tgsw3sHWltJ5spW8CYu8oSwfwNg3GARc6r40KOTBMYj88O+eMTm+mTII1eLRHP3zAYB/hQxwWav2EwDrCUWWizHZxPXN0KwPwNg3GQlkIrKM7fMBhzBcFWm6k6wKVZgZq/mcFbgQtsXixgHWDwJfK6zVQXYDArUM8AgGsCjGcF8yWbqSbAcFZQYTPVBxjaHJyyBoBRgPGs4LrNVBFg+I/a5hWAKwIMvkQe/iFsM9UEGG9+rQTAVQHG9wrwW6ZPAlx1r2ANGIwDjG3WWgAYBBgq1tlMFQEGGqpspooAI03gKgUGx+FFwkXyQ0n5/75k9FZf8BdcrX4XQjN3Uex26bffNeexj8mOKHIHJen798pJn7pVSU7L1tI9o8fD3mrKHP/+n/8M9KLN800Kp2bmEt+iwwnzPnSI74uo21NsFq2Q0z6S6A8UQeF1RirvugAAAABJRU5ErkJggg==", Pd = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAABVCAMAAAC1iNAIAAAANlBMVEUAAAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AAD/AADH+EB1AAAAEXRSTlMAv98gYECfgO8QcK9QMM+PkKhTMeQAAAILSURBVGjexdoLbhsxDEXRJ+o7mp+5
11024/822HgMhkjaBJU7Is4ELhJIhM8b3YtzzllKv9SylrOEveuEv6CU8lVLOWmtKOee44H1xS7WsBzW+RaMQSk15x0/yeUjvbuHc8F9LbfzLqEb8Y2tsgBK+ONlIxSeFzRRAVDZ0SjexqY/THYlNtUX3h9YfMGJjDZfM5vIVfrC5xxU+2NxxhdnBIiO2tQPY2EGyv8VyulZ2UAAENiXHurGDBoBdAJFdxNFrTHTTRR4NB/Rb0hvSaBixsF5CHQ7fku7j4Usi9SOkzIT16TIdRnzowmEurB31OhMWG/GkoAirRh1AujBi5RmkCMuojcMik11YO2oCa8JiGR21PiyjNg6LnczDMmqnMLpPOAf2CMdgcLj09wntnnBvPKTd88mVD+OPTBmuQ3g5eQLhUIZ74xmH8gWSyfjpI8OdDpfhsGK4Yp0P16Z7Vz/mwpm025c6E94DK1X0wbAMV6UPfz++6d9EaXgjIMNVyV7Ll90rvPjtuUDsgOyXqHIrCzso8hS21b029BlOW9QdPgvrBvgc6wD4nK4O+Aw54hLYljxj2IxcJo/jVeShSmyIIj7ExmaadE1/n0C74qumQojqraD+pz6SXn911G3N+Na+1TUQ34yOUlPEG5Y9b6nWR1lDOIhGFytEdP2GrvaUclygEp/yy5Y+yy/xCW/6A/1tTa0tu9ydAAAAAElFTkSuQmCC", Ud = { class: "social-links-content" }, Md = { class: "content-header" }, Dd = { class: "title" }, Rd = { style: { "margin-left": "6px" } }, $d = { class: "social-icons-menu" }, Fd = { class: "social-icons-menu-list" }, Nd = ["onClick"], Bd = ["src", "alt"], Vd = ["src", "alt"], zd = { class: "fields-container" }, Hd = ["src", "alt"], jd = ["src", "alt"], Gd = /* @__PURE__ */ Te({ 11025 __name: "social-links-content", 11026 props: { 11027 fields: {}, 11028 tab: {}, 11029 focusedField: {} 11030 }, 11031 emits: ["fieldUpdate", "fieldDelete"], 11032 setup(i, { emit: e }) { 11033 const t = i, s = e, { setFieldRef: r, scrollToField: n } = Qi(); 11034 gt(() => { 11035 n(t.focusedField); 11036 }); 11037 const o = [D.PLAIN_TEXT], a = H(() => ze(t.fields)), l = Cd(), c = { 11038 facebook_link: Sd, 11039 instagram_link: kd, 11040 linkedin_link: xd, 11041 tiktok_link: Od, 11042 twitter_link: Ld, 11043 youtube_link: Pd 11044 }; 11045 function u(_) { 11046 return c[_]; 11047 } 11048 const d = H(() => Object.fromEntries( 11049 Object.entries(l).filter( 11050 ([_]) => !a.value.includes(_) 11051 ) 11052 )); 11053 function h(_) { 11054 return _.property ? fi[_.property] ? !0 : !!(_.icon && !fi[_.property]) : !1; 11055 } 11056 function p(_, v) { 11057 const m = { 11058 ..._, 11059 value: v 11060 }; 11061 s("fieldUpdate", m); 11062 } 11063 function g(_) { 11064 const v = fi[_], m = { 11065 property: _, 11066 label: v?.label ?? Ks(_), 11067 type: D.PLAIN_TEXT, 11068 value: "", 11069 tab: t.tab, 11070 icon: v?.iconUrl, 11071 isDefault: !1 11072 }; 11073 s("fieldUpdate", m); 11074 const f = v?.label ?? _; 11075 Le({ 11076 aid: "VARIABLE_ADDED_SUCCESS", 11077 message: `${f} added successfully`, 11078 status: Pe.Completed 11079 }); 11080 } 11081 async function y(_) { 11082 const v = ze( 11083 t.fields, 11084 _.property 11085 ), m = await mt({ 11086 tab: t.tab, 11087 fieldTypeOptions: o, 11088 existingProperties: v, 11089 field: _ 11090 }); 11091 m?.field && (_.property && m.field.property !== _.property && s("fieldDelete", _), s("fieldUpdate", m.field)); 11092 } 11093 function A(_) { 11094 s("fieldDelete", _); 11095 } 11096 return (_, v) => (E(), x("div", Ud, [ 11097 w("div", Md, [ 11098 w("div", Dd, R(b(T).socialLinks), 1), 11099 S(b(qe), { 11100 variant: "text", 11101 color: "primary", 11102 aid: "ADD_VARIABLE_LINK", 11103 size: "sm" 11104 }, { 11105 default: k(() => [ 11106 v[0] || (v[0] = w("i", { class: "fa-regular fa-circle-plus" }, null, -1)), 11107 w("span", Rd, R(b(T).addVariable), 1), 11108 S(b(Ze), { aid: "ADD_SOCIAL_ICON_MENU" }, { 11109 default: k(() => [ 11110 w("div", $d, [ 11111 w("div", Fd, [ 11112 (E(!0), x(de, null, me(d.value, (m, f) => (E(), x("div", { 11113 key: f, 11114 class: "social-icons-menu-list-item", 11115 onClick: (C) => g(f) 11116 }, [ 11117 S(b(Gs), { 11118 aid: `ADD_SOCIAL_ICON_MENU_ITEM_TOOLTIP_${String(f).toUpperCase()}` 11119 }, { 11120 default: k(() => [ 11121 te(R(m.label), 1) 11122 ]), 11123 _: 2 11124 }, 1032, ["aid"]), 11125 u(f) ? (E(), x("img", { 11126 key: 0, 11127 src: u(f), 11128 alt: m.label 11129 }, null, 8, Bd)) : b(Id)(f) ? (E(), x("img", { 11130 key: 2, 11131 src: m.icon, 11132 alt: m.label 11133 }, null, 8, Vd)) : (E(), x("i", { 11134 key: 1, 11135 class: Ne(m.icon) 11136 }, null, 2)) 11137 ], 8, Nd))), 128)) 11138 ]) 11139 ]) 11140 ]), 11141 _: 1 11142 }) 11143 ]), 11144 _: 1 11145 }) 11146 ]), 11147 w("div", zd, [ 11148 (E(!0), x(de, null, me(i.fields, (m) => (E(), x("div", { 11149 key: m.property, 11150 class: "field-item", 11151 ref_for: !0, 11152 ref: (f) => b(r)(m.property, f) 11153 }, [ 11154 S(b(dt), { 11155 id: `field-${m.property}`, 11156 "model-value": m.value || "", 11157 aid: `COMPANY_FIELD_${m.property}`, 11158 placeholder: m.label, 11159 autofocus: m.property === i.focusedField,
11160 "hide-bottom-space": "", 11161 class: "field-input", 11162 "onUpdate:modelValue": (f) => p(m, f) 11163 }, { 11164 prepend: k(() => [ 11165 m.property && u(m.property) ? (E(), x("img", { 11166 key: 0, 11167 src: u(m.property), 11168 alt: m.label, 11169 class: "field-icon" 11170 }, null, 8, Hd)) : m.icon ? (E(), x("img", { 11171 key: 1, 11172 src: m.icon, 11173 alt: m.label, 11174 class: "field-icon" 11175 }, null, 8, jd)) : G("", !0) 11176 ]), 11177 append: k(() => [ 11178 m.isDefault ? G("", !0) : (E(), W(b(Ke), { 11179 key: 0, 11180 variant: "text", 11181 color: "gray-400", 11182 aid: `COMPANY_FIELD_${m.property}_MENU_BUTTON`, 11183 class: "field-menu-button" 11184 }, { 11185 default: k(() => [ 11186 v[1] || (v[1] = w("i", { class: "fa-regular fa-ellipsis" }, null, -1)), 11187 S(b(Ze), { 11188 aid: `COMPANY_FIELD_${m.property}_MENU` 11189 }, { 11190 default: k(() => [ 11191 h(m) ? G("", !0) : (E(), W(b(we), { 11192 key: 0, 11193 aid: `COMPANY_FIELD_${m.property}_EDIT`, 11194 icon: "fa-light fa-pen", 11195 onClick: (f) => y(m) 11196 }, { 11197 default: k(() => [ 11198 te(R(b(T).edit), 1) 11199 ]), 11200 _: 1 11201 }, 8, ["aid", "onClick"])), 11202 S(b(we), { 11203 aid: `COMPANY_FIELD_${m.property}_DELETE`, 11204 icon: "fa-light fa-trash-can", 11205 onClick: (f) => A(m) 11206 }, { 11207 default: k(() => [ 11208 te(R(b(T).delete), 1) 11209 ]), 11210 _: 1 11211 }, 8, ["aid", "onClick"]) 11212 ]), 11213 _: 2 11214 }, 1032, ["aid"]) 11215 ]), 11216 _: 2 11217 }, 1032, ["aid"])) 11218 ]), 11219 _: 2 11220 }, 1032, ["id", "model-value", "aid", "placeholder", "autofocus", "onUpdate:modelValue"]) 11221 ]))), 128)) 11222 ]) 11223 ])); 11224 } 11225}), Xd = /* @__PURE__ */ ve(Gd, [["__scopeId", "data-v-fd2d92f1"]]), Yd = ["aid"], Wd = { class: "company-brand-color-field-controls" }, Kd = ["aid"], qd = { 11226 key: 0, 11227 class: "company-brand-color-field-popup" 11228}, Zd = /* @__PURE__ */ Te({ 11229 __name: "company-brand-color-field", 11230 props: /* @__PURE__ */ ht({ 11231 aid: {}, 11232 deletable: { type: Boolean } 11233 }, { 11234 modelValue: { 11235 required: !0, 11236 default: "" 11237 }, 11238 modelModifiers: {} 11239 }), 11240 emits: /* @__PURE__ */ ht(["delete"], ["update:modelValue"]), 11241 setup(i, { emit: e }) { 11242 const t = i, s = e, r = Ti(i, "modelValue"), n = Q(""), o = Q(""), a = Q(!1), l = Q(!1), c = Q(null); 11243 is( 11244 () => r.value, 11245 (I) => { 11246 a.value || (n.value = I, o.value = I); 11247 }, 11248 { immediate: !0 } 11249 ); 11250 function u(I) { 11251 if (!I?.trim()) 11252 return ""; 11253 const M = /^([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(I) ? `#${I}` : I; 11254 return /^#([0-9A-F]{3}|[0-9A-F]{6})$/i.test(M) && typeof CSS < "u" && CSS.supports("color", M) ? M.toUpperCase() : null; 11255 } 11256 function d(I) { 11257 o.value = I, r.value = I; 11258 } 11259 function h(I) { 11260 n.value = I; 11261 const M = u(I); 11262 M !== null && d(M); 11263 } 11264 function p() { 11265 a.value = !0, o.value = r.value; 11266 } 11267 function g() { 11268 a.value = !1; 11269 const I = u(n.value); 11270 if (I !== null) { 11271 n.value = I, d(I); 11272 return; 11273 } 11274 n.value = r.value, o.value = r.value; 11275 } 11276 const y = H(() => o.value ? { backgroundColor: o.value } : { 11277 backgroundImage: "repeating-conic-gradient(#ccc 0% 25%, #fff 0% 50%) 50% / 12px 12px" 11278 }); 11279 function A() { 11280 l.value = !1; 11281 } 11282 function _() { 11283 l.value = !0; 11284 } 11285 let v = []; 11286 function m(I) { 11287 const M = []; 11288 let K = I.parentElement; 11289 for (; K; ) { 11290 const { overflowY: q } = getComputedStyle(K); 11291 (q === "auto" || q === "scroll") && M.push(K), K = K.parentElement; 11292 } 11293 return M; 11294 } 11295 function f() { 11296 A(); 11297 } 11298 function C() { 11299 v.forEach((I) => { 11300 I.removeEventListener("scroll", f); 11301 }), v = []; 11302 } 11303 function ce(I) { 11304 if (!l.value || !c.value) 11305 return; 11306 const M = I.target; 11307 !(M instanceof Node) || c.value.contains(M) || A(); 11308 } 11309 is(l, (I) => { 11310 if (!I) { 11311 document.removeEventListener("click", ce), C(); 11312 return; 11313 } 11314 document.addEventListener("click", ce), c.value && (v = m(c.value), v.forEach((M) => { 11315 M.addEventListener("scroll", f, { passive: !0 }); 11316 })); 11317 }), Tn(() => { 11318 document.removeEventListener("click", ce), C(); 11319 }); 11320 function ie(I) { 11321 const M = I.toUpperCase(); 11322 n.value = M, d(M), A(); 11323 } 11324 function _e() { 11325 A(); 11326 } 11327 return (I, M) => (E(), x("div", { 11328 ref_key: "rootRef", 11329 ref: c, 11330 class: "company-brand-color-field", 11331 aid: i.aid 11332 }, [ 11333 w("div", Wd, [ 11334 w("button", { 11335 type: "button", 11336 class: "company-brand-color-field-swatch", 11337 style: In(y.value), 11338 aid: `${i.aid}_SWATCH`, 11339 onClick: _ 11340 }, null, 12, Kd), 11341 S(b(dt), { 11342 "model-value": n.value, 11343 size: "sm",
11344 "hide-bottom-space": "", 11345 class: "company-brand-color-field-input", 11346 aid: `${i.aid}_INPUT`, 11347 "onUpdate:modelValue": h, 11348 onFocus: p, 11349 onBlur: g 11350 }, Sn({ _: 2 }, [ 11351 t.deletable ? { 11352 name: "append", 11353 fn: k(() => [ 11354 S(b(Ke), { 11355 variant: "text", 11356 color: "gray-400", 11357 class: "company-brand-color-field-menu", 11358 aid: `${t.aid}_MENU_BUTTON` 11359 }, { 11360 default: k(() => [ 11361 M[1] || (M[1] = w("i", { class: "fa-regular fa-ellipsis" }, null, -1)), 11362 S(b(Ze), { 11363 aid: `${t.aid}_MENU`, 11364 anchor: "bottom end", 11365 self: "top end" 11366 }, { 11367 default: k(() => [ 11368 S(b(we), { 11369 aid: `${t.aid}_DELETE`, 11370 icon: "fa-light fa-trash-can", 11371 onClick: M[0] || (M[0] = (K) => s("delete")) 11372 }, { 11373 default: k(() => [ 11374 te(R(b(T).delete), 1) 11375 ]), 11376 _: 1 11377 }, 8, ["aid"]) 11378 ]), 11379 _: 1 11380 }, 8, ["aid"]) 11381 ]), 11382 _: 1 11383 }, 8, ["aid"]) 11384 ]), 11385 key: "0" 11386 } : void 0 11387 ]), 1032, ["model-value", "aid"]) 11388 ]), 11389 l.value ? (E(), x("div", qd, [ 11390 S(b(An), { 11391 "initial-color": r.value || void 0, 11392 onDone: ie, 11393 onCancel: _e 11394 }, null, 8, ["initial-color"]) 11395 ])) : G("", !0) 11396 ], 8, Yd)); 11397 } 11398}), Qd = /* @__PURE__ */ ve(Zd, [["__scopeId", "data-v-17d00c47"]]), Jd = /* @__PURE__ */ Te({ 11399 __name: "company-brand-font-field", 11400 props: /* @__PURE__ */ ht({ 11401 aid: {} 11402 }, { 11403 modelValue: { 11404 required: !0, 11405 default: "" 11406 }, 11407 modelModifiers: {} 11408 }), 11409 emits: ["update:modelValue"], 11410 setup(i) { 11411 const e = Ti(i, "modelValue"); 11412 return (t, s) => (E(), W(b(xn), { 11413 "font-family": e.value, 11414 "onUpdate:fontFamily": s[0] || (s[0] = (r) => e.value = r), 11415 size: "sm", 11416 class: "company-brand-font-field", 11417 aid: i.aid, 11418 "show-tooltip": !1, 11419 placeholder: b(T).selectFontPlaceholder 11420 }, null, 8, ["font-family", "aid", "placeholder"])); 11421 } 11422}), eh = /* @__PURE__ */ ve(Jd, [["__scopeId", "data-v-8533ea37"]]), th = {}, ih = { class: "ws-card-section" }, sh = { 11423 key: 0, 11424 class: "ws-card-section-title" 11425}, rh = { class: "ws-card-section-body" }, nh = { class: "ws-card-section-desc" }, oh = { class: "ws-card-section-control" }; 11426function ah(i, e) { 11427 return E(), x("div", ih, [ 11428 i.$slots.title ? (E(), x("div", sh, [ 11429 ii(i.$slots, "title", {}, void 0, !0) 11430 ])) : G("", !0), 11431 w("div", rh, [ 11432 w("div", nh, [ 11433 ii(i.$slots, "desc", {}, void 0, !0) 11434 ]), 11435 w("div", oh, [ 11436 ii(i.$slots, "control", {}, void 0, !0) 11437 ]) 11438 ]) 11439 ]); 11440} 11441const xt = /* @__PURE__ */ ve(th, [["render", ah], ["__scopeId", "data-v-085fd11d"]]), lh = { class: "visual-assets-content" }, ch = { class: "content-header" }, uh = { class: "title" }, dh = { class: "fields-container" }, hh = { 11442 key: 0, 11443 class: "field-item", 11444 aid: "BRAND_KIT_FONT_FAMILY_SECTION" 11445}, fh = { class: "section-title" }, ph = { 11446 class: "field-item", 11447 aid: "BRAND_KIT_BRAND_COLORS_SECTION" 11448}, mh = { class: "section-title" }, gh = { class: "brand-colors-control" }, bh = { 11449 key: 1, 11450 class: "field-item", 11451 aid: "BRAND_KIT_LOGOS_SECTION" 11452}, vh = { class: "section-title" }, _h = ["aid"], yh = { class: "visual-asset-field-footer" }, Ah = { class: "field-label" }, wh = { 11453 class: "field-item", 11454 aid: "BRAND_KIT_BANNERS_SECTION" 11455}, Ch = { class: "section-title" }, Eh = ["aid"], Th = { class: "visual-asset-field-footer" }, Ih = { class: "field-label" }, Sh = /* @__PURE__ */ Te({ 11456 __name: "visual-assets-content", 11457 props: { 11458 fields: {}, 11459 tab: {}, 11460 focusedField: {} 11461 }, 11462 emits: ["fieldUpdate", "fieldDelete"], 11463 setup(i, { emit: e }) { 11464 const t = i, s = e, { setFieldRef: r, scrollToField: n } = Qi(); 11465 gt(() => { 11466 n(t.focusedField); 11467 }); 11468 const o = H( 11469 () => At(t.fields.filter((v) => io(v))) 11470 ), a = H( 11471 () => At(t.fields.filter((v) => qs(v))) 11472 ), l = H( 11473 () => At(t.fields.filter((v) => eo(v))) 11474 ), c = H( 11475 () => At(t.fields.filter((v) => to(v))) 11476 ), u = H( 11477 () => a.value.length > 0 ? T.addAnotherColor : T.addColor 11478 ), d = H( 11479 () => l.value.length > 0 ? T.addAnotherLogo : T.addLogo 11480 ), h = H( 11481 () => c.value.length > 0 ? T.addAnotherBanner : T.addBanner 11482 ); 11483 function p(v, m) { 11484 s("fieldUpdate", { 11485 ...v, 11486 value: m 11487 }); 11488 } 11489 function g(v) { 11490 s("fieldDelete", v); 11491 } 11492 async function y(v, m) { 11493 const f = ze( 11494 t.fields, 11495 v.property 11496 ), C = await mt({ 11497 tab: t.tab, 11498 fieldTypeOptions: m, 11499 existingProperties: f, 11500 field: v 11501 }); 11502 C?.field && (v.property && C.field.property !== v.property && s("fieldDelete", v), s("fieldUpdate", C.field)); 11503 } 11504 function A() { 11505 const v = so(t.fields, t.tab); 11506 s("fieldUpdate", v), Le({ 11507 aid: "VARIABLE_ADDED_SUCCESS", 11508 message: `${v.label} added successfully`, 11509 status: Pe.Completed 11510 }); 11511 } 11512 async function _(v, m) { 11513 const f = ze(t.fields), C = await mt({ 11514 tab: t.tab, 11515 fieldTypeOptions: v, 11516 existingProperties: f, 11517 addHeaderText: m 11518 }); 11519 C?.field && (s("fieldUpdate", C.field), Le({ 11520 aid: "VARIABLE_ADDED_SUCCESS", 11521 message: `${C.field.label} added successfully`, 11522 status: Pe.Completed 11523 })); 11524 } 11525 return (v, m) => (E(), x("div", lh, [ 11526 w("div", ch, [ 11527 w("div", uh, R(b(T).brandKit), 1) 11528 ]), 11529 w("div", dh, [ 11530 o.value.length > 0 ? (E(), x("div", hh, [ 11531 S(b(yt), null, { 11532 default: k(() => [ 11533 S(xt, null, { 11534 desc: k(() => [ 11535 w("div", fh, R(b(T).fontFamilySection), 1) 11536 ]), 11537 control: k(() => [ 11538 (E(!0), x(de, null, me(o.value, (f) => (E(), x("div", { 11539 key: f.property, 11540 class: "section-field", 11541 ref_for: !0, 11542 ref: (C) => b(r)(f.property, C) 11543 }, [ 11544 f.property ? (E(), W(eh, { 11545 key: 0, 11546 "model-value": f.value || "", 11547 aid: `COMPANY_FIELD_${f.property}`, 11548 "onUpdate:modelValue": (C) => p(f, C) 11549 }, null, 8, ["model-value", "aid", "onUpdate:modelValue"])) : G("", !0) 11550 ]))), 128)) 11551 ]), 11552 _: 1 11553 }) 11554 ]), 11555 _: 1 11556 }) 11557 ])) : G("", !0), 11558 w("div", ph, [ 11559 S(b(yt), null, { 11560 default: k(() => [ 11561 S(xt, null, { 11562 desc: k(() => [ 11563 w("div", mh, R(b(T).brandColorsSection), 1) 11564 ]), 11565 control: k(() => [ 11566 w("div", gh, [ 11567 (E(!0), x(de, null, me(a.value, (f) => (E(), x("div", { 11568 key: f.property, 11569 class: "brand-color-field-row", 11570 ref_for: !0, 11571 ref: (C) => b(r)(f.property, C) 11572 }, [ 11573 f.property ? (E(), W(Qd, { 11574 key: 0, 11575 "model-value": f.value || "", 11576 deletable: !f.isDefault, 11577 aid: `COMPANY_FIELD_${f.property}`, 11578 "onUpdate:modelValue": (C) => p(f, C), 11579 onDelete: (C) => g(f) 11580 }, null, 8, ["model-value", "deletable", "aid", "onUpdate:modelValue", "onDelete"])) : G("", !0) 11581 ]))), 128)), 11582 w("button", { 11583 type: "button",
11584 class: "visual-asset-add-trigger visual-asset-add-trigger--color", 11585 aid: "BRAND_KIT_ADD_COLOR_VARIABLE", 11586 onClick: A 11587 }, [ 11588 m[2] || (m[2] = w("i", { class: "fa-regular fa-circle-plus visual-asset-add-trigger_icon" }, null, -1)), 11589 w("span", null, R(u.value), 1) 11590 ]) 11591 ]) 11592 ]), 11593 _: 1 11594 }) 11595 ]), 11596 _: 1 11597 }) 11598 ]), 11599 l.value.length > 0 ? (E(), x("div", bh, [ 11600 S(b(yt), null, { 11601 default: k(() => [ 11602 S(xt, null, { 11603 title: k(() => [ 11604 w("div", vh, R(b(T).logosSection), 1) 11605 ]), 11606 _: 1 11607 }), 11608 (E(!0), x(de, null, me(l.value, (f) => (E(), x("div", { 11609 key: f.property, 11610 class: "section-field", 11611 aid: f.property ? `COMPANY_FIELD_${f.property}` : void 0, 11612 ref_for: !0, 11613 ref: (C) => b(r)(f.property, C) 11614 }, [ 11615 f.property && f.type ? (E(), W(Ci, { 11616 key: 0, 11617 "model-value": f.value || "", 11618 "ctx-name": `visual-asset-${f.property}`, 11619 "field-type": f.type, 11620 "crop-preset": "free,1:1", 11621 "onUpdate:modelValue": (C) => p(f, C) 11622 }, null, 8, ["model-value", "ctx-name", "field-type", "onUpdate:modelValue"])) : G("", !0), 11623 w("div", yh, [ 11624 w("div", Ah, R(f.label), 1), 11625 f.isDefault ? G("", !0) : (E(), W(b(Ke), { 11626 key: 0, 11627 variant: "text", 11628 color: "gray-400", 11629 aid: `COMPANY_FIELD_${f.property}_MENU_BUTTON` 11630 }, { 11631 default: k(() => [ 11632 m[3] || (m[3] = w("i", { class: "fa-regular fa-ellipsis" }, null, -1)), 11633 S(b(Ze), { 11634 aid: `COMPANY_FIELD_${f.property}_MENU`, 11635 anchor: "bottom end", 11636 self: "top end" 11637 }, { 11638 default: k(() => [ 11639 S(b(we), { 11640 aid: `COMPANY_FIELD_${f.property}_EDIT`, 11641 icon: "fa-light fa-pen", 11642 onClick: (C) => y(f, [b(D).IMAGE]) 11643 }, { 11644 default: k(() => [ 11645 te(R(b(T).edit), 1) 11646 ]), 11647 _: 1 11648 }, 8, ["aid", "onClick"]), 11649 S(b(we), { 11650 aid: `COMPANY_FIELD_${f.property}_DELETE`, 11651 icon: "fa-light fa-trash-can", 11652 onClick: (C) => g(f) 11653 }, { 11654 default: k(() => [ 11655 te(R(b(T).delete), 1) 11656 ]), 11657 _: 1 11658 }, 8, ["aid", "onClick"]) 11659 ]), 11660 _: 2 11661 }, 1032, ["aid"]) 11662 ]), 11663 _: 2 11664 }, 1032, ["aid"])) 11665 ]) 11666 ], 8, _h))), 128)), 11667 w("button", { 11668 type: "button",
11669 class: "visual-asset-add-trigger", 11670 aid: "BRAND_KIT_ADD_LOGO_VARIABLE", 11671 onClick: m[0] || (m[0] = (f) => _([b(D).IMAGE], b(T).addLogo)) 11672 }, [ 11673 m[4] || (m[4] = w("i", { class: "fa-regular fa-circle-plus visual-asset-add-trigger_icon" }, null, -1)), 11674 w("span", null, R(d.value), 1) 11675 ]) 11676 ]), 11677 _: 1 11678 }) 11679 ])) : G("", !0), 11680 w("div", wh, [ 11681 S(b(yt), null, { 11682 default: k(() => [ 11683 S(xt, null, { 11684 title: k(() => [ 11685 w("div", Ch, R(b(T).bannersSection), 1) 11686 ]), 11687 _: 1 11688 }), 11689 (E(!0), x(de, null, me(c.value, (f) => (E(), x("div", { 11690 key: f.property, 11691 class: "section-field", 11692 aid: f.property ? `COMPANY_FIELD_${f.property}` : void 0, 11693 ref_for: !0, 11694 ref: (C) => b(r)(f.property, C) 11695 }, [ 11696 f.property && f.type ? (E(), W(Ci, { 11697 key: 0, 11698 "model-value": f.value || "", 11699 "ctx-name": `visual-asset-${f.property}`, 11700 "field-type": f.type, 11701 "crop-preset": "free,1:1", 11702 "onUpdate:modelValue": (C) => p(f, C) 11703 }, null, 8, ["model-value", "ctx-name", "field-type", "onUpdate:modelValue"])) : G("", !0), 11704 w("div", Th, [ 11705 w("div", Ih, R(f.label), 1), 11706 f.isDefault ? G("", !0) : (E(), W(b(Ke), { 11707 key: 0, 11708 variant: "text", 11709 color: "gray-400", 11710 aid: `COMPANY_FIELD_${f.property}_MENU_BUTTON` 11711 }, { 11712 default: k(() => [ 11713 m[5] || (m[5] = w("i", { class: "fa-regular fa-ellipsis" }, null, -1)), 11714 S(b(Ze), { 11715 aid: `COMPANY_FIELD_${f.property}_MENU`, 11716 anchor: "bottom end", 11717 self: "top end" 11718 }, { 11719 default: k(() => [ 11720 S(b(we), { 11721 aid: `COMPANY_FIELD_${f.property}_EDIT`, 11722 icon: "fa-light fa-pen", 11723 onClick: (C) => y(f, [b(D).BANNER]) 11724 }, { 11725 default: k(() => [ 11726 te(R(b(T).edit), 1) 11727 ]), 11728 _: 1 11729 }, 8, ["aid", "onClick"]), 11730 S(b(we), { 11731 aid: `COMPANY_FIELD_${f.property}_DELETE`, 11732 icon: "fa-light fa-trash-can", 11733 onClick: (C) => g(f) 11734 }, { 11735 default: k(() => [ 11736 te(R(b(T).delete), 1) 11737 ]), 11738 _: 1 11739 }, 8, ["aid", "onClick"]) 11740 ]), 11741 _: 2 11742 }, 1032, ["aid"]) 11743 ]), 11744 _: 2 11745 }, 1032, ["aid"])) 11746 ]) 11747 ], 8, Eh))), 128)), 11748 w("button", { 11749 type: "button",
11750 class: "visual-asset-add-trigger", 11751 aid: "BRAND_KIT_ADD_BANNER_VARIABLE", 11752 onClick: m[1] || (m[1] = (f) => _([b(D).BANNER], b(T).addBanner)) 11753 }, [ 11754 m[6] || (m[6] = w("i", { class: "fa-regular fa-circle-plus visual-asset-add-trigger_icon" }, null, -1)), 11755 w("span", null, R(h.value), 1) 11756 ]) 11757 ]), 11758 _: 1 11759 }) 11760 ]) 11761 ]) 11762 ])); 11763 } 11764}), kh = /* @__PURE__ */ ve(Sh, [["__scopeId", "data-v-e834b13e"]]), xh = { class: "company-profile-dialog" }, Oh = { class: "dialog-layout" }, Lh = { class: "content-area" }, Ph = /* @__PURE__ */ Te({ 11765 inheritAttrs: !1, 11766 __name: "company-profile-dialog-content", 11767 props: { 11768 dialog: {} 11769 }, 11770 setup(i) { 11771 const e = i, t = Q(!0), s = Q(!1), r = Q([]), n = Q([]), o = Q(ge.BASIC_INFORMATION), a = H( 11772 () => e.dialog.input?.focusedField?.trim().toLowerCase() || void 0 11773 ), l = H(() => r.value.filter((m) => m.tab === o.value)), c = H(() => !ri(r.value, n.value)); 11774 async function u() { 11775 await si.init(Ws()); 11776 } 11777 function d() { 11778 const m = a.value; 11779 if (!m) return; 11780 const f = r.value.find( 11781 (C) => C.property?.toLowerCase() === m 11782 ); 11783 !f?.property || f.tab === void 0 || (o.value = f.tab); 11784 } 11785 async function h() { 11786 t.value = !0; 11787 try { 11788 await u(); 11789 const m = await si.getCompanyProfile({}); 11790 m.statusCode === pi.SUCCESS && m.profile?.fields ? (r.value = m.profile.fields, n.value = ds(m.profile.fields)) : (r.value = [], n.value = []); 11791 } catch (m) { 11792 console.error("Failed to fetch company profile", m), r.value = [], n.value = []; 11793 } finally { 11794 t.value = !1, r.value.length > 0 && d(); 11795 } 11796 } 11797 function p(m) { 11798 const f = r.value.findIndex( 11799 (C) => C.property === m.property 11800 ); 11801 f !== -1 ? r.value[f] = m : r.value.push(m), e.dialog.setPersistent(!ri(r.value, n.value)); 11802 } 11803 function g(m) { 11804 if (m.isDefault) 11805 return; 11806 const f = r.value.findIndex( 11807 (C) => C.property === m.property 11808 ); 11809 f !== -1 && r.value.splice(f, 1), e.dialog.setPersistent(!ri(r.value, n.value)); 11810 } 11811 function y() { 11812 Le({ 11813 status: Pe.Error, 11814 message: T.saveError, 11815 aid: "COMPANY_PROFILE_SAVE_ERROR" 11816 }); 11817 } 11818 async function A() { 11819 if (c.value && !(!e.dialog.input?.skipSaveConfirmation && await es({ 11820 aid: "SAVE_CHANGES_CONFIRMATION", 11821 header: T.saveChangesTitle, 11822 question: T.saveChangesMessage, 11823 primaryButtonText: T.confirm, 11824 secondaryButtonText: T.cancel 11825 }) !== ts.Primary)) { 11826 s.value = !0; 11827 try { 11828 await u(), (await si.updateCompanyProfile({ 11829 fields: r.value 11830 })).statusCode === mi.SUCCESS ? (n.value = ds(r.value), e.dialog.setPersistent(!1), Le({ 11831 status: Pe.Completed, 11832 message: T.saveSuccess, 11833 aid: "COMPANY_PROFILE_SAVE_SUCCESS" 11834 }), e.dialog.close(!0)) : y(); 11835 } catch (m) { 11836 console.error("Failed to save company profile", m), y(); 11837 } finally { 11838 s.value = !1; 11839 } 11840 } 11841 } 11842 async function _() { 11843 c.value && await es({ 11844 aid: "DISCARD_CHANGES_CONFIRMATION", 11845 header: T.discardChangesTitle, 11846 question: T.discardChangesMessage, 11847 primaryButtonText: T.discard, 11848 secondaryButtonText: T.cancel 11849 }) !== ts.Primary || e.dialog.close(); 11850 } 11851 function v(m) { 11852 o.value = m; 11853 } 11854 return gt(() => { 11855 h(); 11856 }), (m, f) => kn((E(), x("div", xh, [ 11857 S(b(Xs), { class: "dialog-content" }, { 11858 default: k(() => [ 11859 w("div", Oh, [ 11860 S(Jn, { 11861 "active-tab": o.value, 11862 "onUpdate:activeTab": v 11863 }, null, 8, ["active-tab"]), 11864 w("div", Lh, [ 11865 t.value ? G("", !0) : (E(), x(de, { key: 0 }, [ 11866 o.value === b(ge).BASIC_INFORMATION ? (E(), W(fd, { 11867 key: 0, 11868 fields: l.value, 11869 tab: o.value, 11870 "focused-field": a.value,
11871 onFieldUpdate: p, 11872 onFieldDelete: g 11873 }, null, 8, ["fields", "tab", "focused-field"])) : o.value === b(ge).SOCIAL_LINKS ? (E(), W(Xd, { 11874 key: 1, 11875 fields: l.value, 11876 tab: o.value, 11877 "focused-field": a.value, 11878 onFieldUpdate: p, 11879 onFieldDelete: g 11880 }, null, 8, ["fields", "tab", "focused-field"])) : o.value === b(ge).BRAND_KIT ? (E(), W(kh, { 11881 key: 2, 11882 fields: l.value, 11883 tab: o.value, 11884 "focused-field": a.value, 11885 onFieldUpdate: p, 11886 onFieldDelete: g 11887 }, null, 8, ["fields", "tab", "focused-field"])) : G("", !0) 11888 ], 64)) 11889 ]) 11890 ]) 11891 ]), 11892 _: 1 11893 }), 11894 S(b(Ys), null, { 11895 default: k(() => [ 11896 S(b(qe), { 11897 label: b(T).cancel, 11898 aid: "COMPANY_PROFILE_DIALOG_CANCEL", 11899 color: "gray-500", 11900 variant: "outlined", 11901 disabled: s.value, 11902 onClick: _ 11903 }, null, 8, ["label", "disabled"]), 11904 S(b(qe), { 11905 label: b(T).save, 11906 aid: "COMPANY_PROFILE_DIALOG_SAVE", 11907 color: "primary", 11908 loading: s.value, 11909 disabled: s.value || !c.value, 11910 onClick: A 11911 }, null, 8, ["label", "loading", "disabled"]) 11912 ]), 11913 _: 1 11914 }) 11915 ])), [ 11916 [b(wn), t.value] 11917 ]); 11918 } 11919}), mn = /* @__PURE__ */ ve(Ph, [["__scopeId", "data-v-754652f4"]]); 11920async function $h(i) { 11921 await Ei({ 11922 aid: "COMPANY_PROFILE_DIALOG", 11923 headerText: T.companyProfile, 11924 component: mn, 11925 persistent: !1, 11926 input: i ?? {} 11927 }); 11928} 11929async function Fh(i) { 11930 return await Ei({ 11931 aid: "COMPANY_PROFILE_DIALOG", 11932 headerText: T.companyProfile, 11933 component: mn, 11934 persistent: !1, 11935 input: i ?? {} 11936 }) === !0; 11937} 11938export { 11939 Qd as CompanyBrandColorField, 11940 $h as openCompanyProfileDialog, 11941 Fh as openCompanyProfileDialogWithOptions 11942}; 11943//# sourceMappingURL=company-profile-dialog.js.map 11944(function(){"use strict";try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('.company-profile-tabs[data-v-71ca539f]{width:228px;border-right:1px solid rgb(var(--color-gray-100));padding:14px}.navigation-items-list[data-v-71ca539f]{list-style:none;margin:0;padding:0}.navigation-item>a[data-v-71ca539f]{height:36px;padding-left:14px;padding-right:14px;margin-bottom:8px;font-weight:400;font-size:14px;line-height:20px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;border:1px solid transparent;border-radius:50px}.navigation-item>a[data-v-71ca539f]:focus-visible{border:1px solid rgb(var(--color-primary-450))}.navigation-item>a[data-v-71ca539f]:hover{background-color:rgb(var(--color-primary-50));font-weight:600}.navigation-item>a:hover>.navigation-item-icon-container .fa-light[data-v-71ca539f]{display:none}.navigation-item>a:hover>.navigation-item-icon-container .fa-regular[data-v-71ca539f]{display:inline}.navigation-item>a>.navigation-item-icon-container[data-v-71ca539f]{margin-right:10px;text-align:center}.navigation-item>a>.navigation-item-icon-container>span[data-v-71ca539f]{width:21px;min-width:21px;font-size:20px}.navigation-item>a>.navigation-item-icon-container .fa-light[data-v-71ca539f]{display:inline}.navigation-item>a>.navigation-item-icon-container .fa-regular[data-v-71ca539f]{display:none}.navigation-item>a>.item-text[data-v-71ca539f]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.navigation-item-active>a[data-v-71ca539f],.navigation-item-active>a[data-v-71ca539f]:hover{border-radius:50px;background:rgb(var(--color-primary-300));font-weight:600}.navigation-item-active>a>.navigation-item-icon-container .fa-light[data-v-71ca539f],.navigation-item-active>a:hover>.navigation-item-icon-container .fa-light[data-v-71ca539f]{display:none}.navigation-item-active>a>.navigation-item-icon-container .fa-regular[data-v-71ca539f],.navigation-item-active>a:hover>.navigation-item-icon-container .fa-regular[data-v-71ca539f]{display:inline}:where([uc-wgt-common]){--cfg-init-activity: "start-from";--cfg-done-activity: ""}:where([uc-wgt-common]){--uc-font-family: system-ui;
11944--uc-font-size: 14px;--uc-line-height: normal;--uc-simple-btn-font-family: system-ui;--uc-simple-btn-font-size: 14px;--uc-button-size: 32px;--uc-preview-size: 32px;--uc-padding: 10px;--uc-radius: 8px;--uc-transition: .2s ease;--uc-dialog-width: 430px;--uc-dialog-max-width: 920px;--uc-dialog-max-height: 675px;--uc-simple-btn-padding: 7px 14px;--uc-background: var(--uc-background-light);--uc-foreground: var(--uc-foreground-light);--uc-primary: var(--uc-primary-light);--uc-primary-hover: var(--uc-primary-hover-light);--uc-primary-transparent: var(--uc-primary-transparent-light);--uc-primary-foreground: var(--uc-primary-foreground-light);--uc-secondary: var(--uc-secondary-light);--uc-secondary-hover: var(--uc-secondary-hover-light);--uc-secondary-foreground: var(--uc-secondary-foreground-light);--uc-muted: var(--uc-muted-light);--uc-muted-foreground: var(--uc-muted-foreground-light);--uc-destructive: var(--uc-destructive-light);--uc-destructive-foreground: var(--uc-destructive-foreground-light);--uc-border: var(--uc-border-light);--uc-dialog-shadow: var(--uc-dialog-shadow-light);--uc-simple-btn: var(--uc-simple-btn-light);--uc-simple-btn-hover: var(--uc-simple-btn-hover-light);--uc-simple-btn-foreground: var(--uc-simple-btn-foreground-light)}@supports not (color: oklch(0% 0 0)){:where([uc-wgt-common]){--uc-primary-rgb-light: 23 75 215;--uc-primary-light: rgb(var(--uc-primary-rgb-light));--uc-primary-hover-light: rgb(var(--uc-primary-rgb-light) / 90%);--uc-primary-transparent-light: rgb(var(--uc-primary-rgb-light) / 10%);--uc-background-light: rgb(255 255 255);--uc-foreground-light: rgb(24 24 24);--uc-primary-foreground-light: #fff;--uc-secondary-light: rgb(24 24 24 / 5%);--uc-secondary-hover-light: rgb(24 24 24 / 8%);--uc-secondary-foreground-light: rgb(24 24 24);--uc-muted-light: rgb(245 245 245);--uc-muted-foreground-light: rgb(113 113 113);--uc-destructive-light: rgb(232 19 20 / 5%);--uc-destructive-foreground-light: rgb(232 19 20);--uc-border-light: rgb(228 228 232);--uc-dialog-shadow-light: 0px 6px 20px rgb(0 0 0 / 10%);--uc-simple-btn-light: rgb(235 235 235);--uc-simple-btn-hover-light: rgb(228 228 228);--uc-simple-btn-foreground-light: rgb(24 24 24);--uc-primary-rgb-dark: 87 154 255;--uc-primary-dark: rgb(var(--uc-primary-rgb-dark));--uc-primary-hover-dark: rgb(var(--uc-primary-rgb-dark) / 90%);--uc-primary-transparent-dark: rgb(var(--uc-primary-rgb-dark) / 7%);--uc-background-dark: rgb(27 27 27);--uc-foreground-dark: rgb(225 225 225);--uc-primary-foreground-dark: rgb(0 0 0);--uc-secondary-dark: rgb(225 225 225 / 7%);--uc-secondary-hover-dark: rgb(225 225 225 / 10%);--uc-secondary-foreground-dark: rgb(225 225 225);--uc-muted-dark: rgb(36 36 36);--uc-muted-foreground-dark: rgb(152 152 152);--uc-destructive-dark: rgb(244 90 79 / 10%);--uc-destructive-foreground-dark: rgb(244 90 79);--uc-border-dark: rgb(61 61 61);--uc-dialog-shadow-dark: 0px 6px 20px rgb(0 0 0 / 25%);--uc-simple-btn-dark: rgb(36 36 36);--uc-simple-btn-hover-dark: rgb(43 43 43);--uc-simple-btn-foreground-dark: rgb(255 255 255)}}@supports (color: oklch(0% 0 0)){:where([uc-wgt-common]){--uc-primary-oklch-light: 47% .22 264;--uc-primary-light: oklch(var(--uc-primary-oklch-light));--uc-primary-hover-light: oklch(var(--uc-primary-oklch-light) / 90%);--uc-primary-transparent-light: oklch(var(--uc-primary-oklch-light) / 7%);--uc-background-light: oklch(100% 0 0);--uc-foreground-light: oklch(21% 0 0);--uc-primary-foreground-light: oklch(100% 0 0);--uc-secondary-light: oklch(21% 0 0 / .05);--uc-secondary-hover-light: oklch(21% 0 0 / .08);--uc-secondary-foreground-light: oklch(21% 0 0);--uc-muted-light: oklch(97% 0 0);--uc-muted-foreground-light: oklch(40% 0 0);--uc-destructive-light: oklch(59% .235 28.5 / .05);--uc-destructive-foreground-light: oklch(59% .235 28.5);--uc-border-light: oklch(92% 0 0);--uc-dialog-shadow-light: 0px 6px 20px oklch(0% 0 0 / .1);--uc-simple-btn-light: oklch(94% 0 0);--uc-simple-btn-hover-light: oklch(92% 0 0);--uc-simple-btn-foreground-light: oklch(20% 0 0);--uc-primary-oklch-dark: 69% .1768 258.4;--uc-primary-dark: oklch(var(--uc-primary-oklch-dark));--uc-primary-hover-dark: oklch(var(--uc-primary-oklch-dark) / 90%);--uc-primary-transparent-dark: oklch(var(--uc-primary-oklch-dark) / 7%);--uc-background-dark: oklch(22% 0 0);--uc-foreground-dark: oklch(91% 0 0);--uc-primary-foreground-dark: oklch(0% 0 0);--uc-secondary-dark: oklch(91% 0 0 / .07);--uc-secondary-hover-dark: oklch(91% 0 0 / .1);
11944--uc-secondary-foreground-dark: oklch(91% 0 0);--uc-muted-dark: oklch(26% 0 0);--uc-muted-foreground-dark: oklch(68% 0 0);--uc-destructive-dark: oklch(67% .191 27.5 / .1);--uc-destructive-foreground-dark: oklch(67% .191 27.5);--uc-border-dark: oklch(36% 0 0);--uc-dialog-shadow-dark: 0px 6px 20px oklch(0% 0 0 / .25);--uc-simple-btn-dark: oklch(26% 0 0);--uc-simple-btn-hover-dark: oklch(29% 0 0);--uc-simple-btn-foreground-dark: oklch(100% 0 0)}}@media only screen and (max-height:600px){:where([uc-wgt-common]){--uc-dialog-max-height: 100%}}@media only screen and (max-width:430px){:where([uc-wgt-common]){--uc-dialog-max-width: 100vw;--uc-dialog-max-height: var(--uploadcare-blocks-window-height)}}@media(prefers-color-scheme:light){:where([uc-wgt-common]){--uc-background: var(--uc-background-light);--uc-foreground: var(--uc-foreground-light);--uc-primary: var(--uc-primary-light);--uc-primary-hover: var(--uc-primary-hover-light);--uc-primary-transparent: var(--uc-primary-transparent-light);--uc-primary-foreground: var(--uc-primary-foreground-light);--uc-secondary: var(--uc-secondary-light);--uc-secondary-hover: var(--uc-secondary-hover-light);--uc-secondary-foreground: var(--uc-secondary-foreground-light);--uc-muted: var(--uc-muted-light);--uc-muted-foreground: var(--uc-muted-foreground-light);--uc-destructive: var(--uc-destructive-light);--uc-destructive-foreground: var(--uc-destructive-foreground-light);--uc-border: var(--uc-border-light);--uc-dialog-shadow: var(--uc-dialog-shadow-light);--uc-simple-btn: var(--uc-simple-btn-light);--uc-simple-btn-hover: var(--uc-simple-btn-hover-light);--uc-simple-btn-foreground: var(--uc-simple-btn-foreground-light)}}@media(prefers-color-scheme:dark){:where([uc-wgt-common]){--uc-background: var(--uc-background-dark);--uc-foreground: var(--uc-foreground-dark);--uc-primary: var(--uc-primary-dark);--uc-primary-hover: var(--uc-primary-hover-dark);--uc-primary-transparent: var(--uc-primary-transparent-dark);--uc-primary-foreground: var(--uc-primary-foreground-dark);--uc-secondary: var(--uc-secondary-dark);--uc-secondary-hover: var(--uc-secondary-hover-dark);--uc-secondary-foreground: var(--uc-secondary-foreground-dark);--uc-muted: var(--uc-muted-dark);--uc-muted-foreground: var(--uc-muted-foreground-dark);--uc-destructive: var(--uc-destructive-dark);--uc-destructive-foreground: var(--uc-destructive-foreground-dark);--uc-border: var(--uc-border-dark);--uc-dialog-shadow: var(--uc-dialog-shadow-dark);--uc-simple-btn: var(--uc-simple-btn-dark);--uc-simple-btn-hover: var(--uc-simple-btn-hover-dark);--uc-simple-btn-foreground: var(--uc-simple-btn-foreground-dark)}}:where(.uc-light){--uc-background: var(--uc-background-light);--uc-foreground: var(--uc-foreground-light);--uc-primary: var(--uc-primary-light);--uc-primary-hover: var(--uc-primary-hover-light);--uc-primary-transparent: var(--uc-primary-transparent-light);--uc-primary-foreground: var(--uc-primary-foreground-light);--uc-secondary: var(--uc-secondary-light);--uc-secondary-hover: var(--uc-secondary-hover-light);--uc-secondary-foreground: var(--uc-secondary-foreground-light);--uc-muted: var(--uc-muted-light);--uc-muted-foreground: var(--uc-muted-foreground-light);--uc-destructive: var(--uc-destructive-light);--uc-destructive-foreground: var(--uc-destructive-foreground-light);--uc-border: var(--uc-border-light);--uc-dialog-shadow: var(--uc-dialog-shadow-light);--uc-simple-btn: var(--uc-simple-btn-light);--uc-simple-btn-hover: var(--uc-simple-btn-hover-light);--uc-simple-btn-foreground: var(--uc-simple-btn-foreground-light)}:where(.uc-dark){--uc-background: var(--uc-background-dark);--uc-foreground: var(--uc-foreground-dark);--uc-primary: var(--uc-primary-dark);--uc-primary-hover: var(--uc-primary-hover-dark);--uc-primary-transparent: var(--uc-primary-transparent-dark);--uc-primary-foreground: var(--uc-primary-foreground-dark);--uc-secondary: var(--uc-secondary-dark);--uc-secondary-hover: var(--uc-secondary-hover-dark);--uc-secondary-foreground: var(--uc-secondary-foreground-dark);--uc-muted: var(--uc-muted-dark);--uc-muted-foreground: var(--uc-muted-foreground-dark);--uc-destructive: var(--uc-destructive-dark);--uc-destructive-foreground: var(--uc-destructive-foreground-dark);--uc-border: var(--uc-border-dark);--uc-dialog-shadow: var(--uc-dialog-shadow-dark);--uc-simple-btn: var(--uc-simple-btn-dark);--uc-simple-btn-hover: var(--uc-simple-btn-hover-dark);--uc-simple-btn-foreground: var(--uc-simple-btn-foreground-dark)}:where(.uc-purple){--uc-primary-oklch-light: 47% .22 300;--uc-primary-oklch-dark: 69% .1768 300}:where(.uc-red){--uc-primary-oklch-light: 47% .21 21;--uc-primary-oklch-dark: 71% .1768 21}:where(.uc-orange){--uc-primary-oklch-light: 47% .1376 51.88;--uc-primary-oklch-dark: 69% .1768 51.88}:where(.uc-green){--uc-primary-oklch-light: 45% .14 130;--uc-primary-oklch-dark: 69% .1768 130}:where(.uc-turquoise){--uc-primary-oklch-light: 45% .0854 174;--uc-primary-oklch-dark: 69% .1768 174}:where(.uc-gray){--uc-primary-oklch-light: 10% 0 0;--uc-primary-oklch-dark: 97% 0 0}:where(.uc-contrast){--uc-border-light: oklch(50% 0 0);--uc-border-dark: oklch(50% 0 0);--uc-muted-light: oklch(98% 0 0);
11944--uc-muted-dark: oklch(16% 0 0);--uc-muted-foreground-light: oklch(20% 0 0);--uc-muted-foreground-dark: oklch(80% 0 0);--uc-background-light: oklch(100% 0 0);--uc-foreground-light: oklch(0% 0 0);--uc-background-dark: oklch(10% 0 0);--uc-foreground-dark: oklch(100% 0 0)}:where([uc-wgt-common]){color:var(--uc-foreground);font-size:var(--uc-font-size);line-height:var(--uc-line-height);font-family:var(--uc-font-family)}:where([uc-wgt-common]) *{box-sizing:border-box}:where([uc-wgt-common]) [hidden]{display:none!important}:where([uc-wgt-common]) [activity]:not([active]){display:none}:where([uc-wgt-common]) dialog:not([open]) [activity]{display:none}:where([uc-wgt-common]) button{display:flex;align-items:center;justify-content:center;height:var(--uc-button-size);padding-right:14px;padding-left:14px;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--uc-radius);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--uc-transition)}:where([uc-wgt-common]) button.uc-primary-btn{color:var(--uc-primary-foreground);background-color:var(--uc-primary)}:where([uc-wgt-common]) button.uc-primary-btn:hover{background-color:var(--uc-primary-hover)}:where([uc-wgt-common]) button.uc-secondary-btn{color:var(--uc-secondary-foreground);background-color:var(--uc-secondary)}:where([uc-wgt-common]) button.uc-secondary-btn:hover{background-color:var(--uc-secondary-hover)}:where([uc-wgt-common].uc-contrast) button.uc-secondary-btn{border:1px solid var(--uc-border)}:where([uc-wgt-common]) button.uc-mini-btn{height:var(--uc-button-size);padding:0;background-color:transparent;color:var(--uc-secondary-foreground)}:where([uc-wgt-common]) button.uc-mini-btn:hover{background-color:var(--uc-secondary)}:where([uc-wgt-common]) :is(button[disabled],button.uc-primary-btn[disabled],button.uc-secondary-btn[disabled]){opacity:.5;pointer-events:none}:where([uc-wgt-common]) a{color:var(--uc-primary);text-decoration:none}:where([uc-wgt-common]) a[disabled]{pointer-events:none}:where([uc-wgt-common]) input[type=text]{display:flex;width:100%;height:var(--uc-button-size);padding-right:10px;padding-left:10px;color:var(--uc-foreground);font-size:1em;font-family:inherit;background-color:var(--uc-background);border:1px solid var(--uc-border);outline:1px solid transparent;border-radius:var(--uc-radius);transition:border-color var(--uc-transition),outline-color var(--uc-transition)}:where([uc-wgt-common]) input[type=text]::placeholder{color:var(--uc-muted-foreground)}:where([uc-wgt-common]) input[type=text]:focus{outline-color:var(--uc-primary-hover);border-color:var(--uc-primary-hover)}:where([uc-wgt-common]) input[disabled]{opacity:.6;pointer-events:none}:where([uc-wgt-common]) uc-select[disabled],:where([uc-wgt-common]) select[disabled]{opacity:.6;pointer-events:none}uc-icon{display:inline-flex;align-items:center;justify-content:center;width:var(--uc-button-size);height:var(--uc-button-size)}uc-icon svg{width:calc(var(--uc-button-size) / 2);height:calc(var(--uc-button-size) / 2)}uc-range{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--uc-button-size)}uc-range datalist{display:none}uc-range input{width:100%;height:100%;opacity:0}uc-range .uc-track-wrapper{position:absolute;right:10px;left:10px;display:flex;align-items:center;justify-content:center;height:2px;-webkit-user-select:none;user-select:none;pointer-events:none}uc-range .uc-track{position:absolute;right:0;left:0;display:flex;align-items:center;justify-content:center;height:2px;background-color:currentColor;border-radius:2px;opacity:.5}uc-range .uc-slider{position:absolute;width:16px;height:16px;background-color:currentColor;border-radius:100%;transform:translate(-50%)}uc-range .uc-bar{position:absolute;left:0;height:100%;background-color:currentColor;border-radius:2px}uc-range .uc-caption{position:absolute;display:inline-flex;justify-content:center}uc-config{display:none}:where([uc-simple-btn]){position:relative;display:inline-flex}:where([uc-simple-btn]) button{height:auto;gap:.5em;padding:var(--uc-simple-btn-padding);background-color:var(--uc-simple-btn);color:var(--uc-simple-btn-foreground);font-size:var(--uc-simple-btn-font-size);font-family:var(--uc-simple-btn-font-family)}:where([uc-simple-btn]) button uc-icon{width:auto;height:auto}:where([uc-simple-btn]) button uc-icon svg{width:.9em;height:.9em}:where([uc-simple-btn]) button:hover{background-color:var(--uc-simple-btn-hover)}:where([uc-simple-btn])>uc-drop-area{display:contents}:where([uc-simple-btn]) .uc-visual-drop-area{position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:var(--uc-simple-btn-padding);background-color:transparent;color:transparent;font-size:var(--uc-simple-btn-font-size);border:1px dashed var(--uc-simple-btn-foreground);border-radius:inherit;opacity:0;transition:opacity var(--uc-transition)}:where([uc-simple-btn])>uc-drop-area[drag-state=active] .uc-visual-drop-area{opacity:1}:where([uc-simple-btn])>uc-drop-area[drag-state=inactive] .uc-visual-drop-area{opacity:0}
11944:where([uc-simple-btn])>uc-drop-area[drag-state=near] .uc-visual-drop-area{opacity:1}:where([uc-simple-btn])>uc-drop-area[drag-state=over] .uc-visual-drop-area{opacity:1}uc-source-btn>button{display:flex;align-items:center;margin-bottom:2px;padding:2px var(--uc-padding);color:var(--uc-foreground);border-radius:var(--uc-radius);cursor:pointer;transition:background-color var(--uc-transition),color var(--uc-transition);-webkit-user-select:none;user-select:none;width:100%;background-color:unset;height:unset}uc-source-btn:last-child>button{margin-bottom:0}uc-source-btn>button:hover{background-color:var(--uc-primary-transparent)}:where(.uc-contrast) uc-source-btn>button:hover{background-color:var(--uc-secondary);color:var(--uc-foreground)}uc-source-btn uc-icon{display:inline-flex;flex-grow:1;justify-content:center;min-width:var(--uc-button-size);margin-right:var(--uc-padding);opacity:.8}:where(.uc-contrast) uc-source-btn uc-icon{opacity:1}uc-source-btn .uc-txt{display:flex;align-items:center;box-sizing:border-box;width:100%;height:var(--uc-button-size);padding:0;white-space:nowrap;border:none}:where([uc-drop-area]){padding:2px;overflow:hidden;border:1px dashed var(--uc-border);border-radius:calc(var(--uc-radius) * 1.75);transition:border var(--uc-transition),border-radius var(--uc-transition)}:where([uc-drop-area]),:where([uc-drop-area]) .uc-content-wrapper{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:where([uc-drop-area]) .uc-text{position:relative;margin:var(--uc-padding);color:var(--uc-muted-foreground);transition:color var(--uc-transition)}:where([uc-drop-area])[ghost][drag-state=inactive]{display:none}:where([uc-drop-area])[ghost]:not([fullscreen]):is([drag-state=active],[drag-state=near],[drag-state=over]){background:var(--uc-background)}:where([uc-drop-area]):is([drag-state=active],[drag-state=near],[drag-state=over],:hover){background:var(--uc-primary-transparent);border-color:var(--uc-primary-transparent)}:where(.uc-contrast) :where([uc-drop-area]):is([drag-state=active],[drag-state=near],[drag-state=over],:hover){color:var(--uc-foreground);background:transparent;border-color:var(--uc-foreground);border-width:2px;border-style:solid}:where([uc-drop-area]):is([drag-state=active],[drag-state=near]){opacity:1}:where([uc-drop-area])[drag-state=over]{border-color:var(--uc-primary);opacity:1}:where([uc-drop-area])[with-icon]{min-height:180px}:where([uc-drop-area])[with-icon] .uc-content-wrapper{display:flex;flex-direction:column}:where([uc-drop-area])[with-icon] .uc-text{color:var(--uc-foreground);font-weight:500;font-size:1.1em}:where([uc-drop-area])[with-icon] .uc-icon-container{position:relative;width:64px;height:64px;margin:var(--uc-padding);overflow:hidden;color:var(--uc-foreground);background-color:var(--uc-muted);border-radius:50%;transition:color var(--uc-transition),background-color var(--uc-transition)}:where([uc-drop-area])[with-icon] uc-icon{position:absolute;width:32px;height:32px;top:calc(50% - 16px);left:calc(50% - 16px);transition:transform var(--uc-transition)}:where([uc-drop-area])[with-icon] uc-icon:last-child{transform:translateY(48px)}:where(.uc-contrast) :where([uc-drop-area])[with-icon]:hover .uc-icon-container,:where(.uc-contrast) :where([uc-drop-area])[with-icon]:hover .uc-text{color:var(--uc-foreground)}:where([uc-drop-area])[with-icon]:hover .uc-icon-container{background-color:var(--uc-primary-transparent)}:where(.uc-contrast) :where([uc-drop-area])[with-icon]:hover .uc-icon-container{background-color:var(--uc-muted)}:where([uc-drop-area])[with-icon]>.uc-content-wrapper:is([drag-state=active],[drag-state=near],[drag-state=over]) .uc-icon-container{color:var(--uc-primary-foreground);background-color:var(--uc-primary)}:where([uc-drop-area])[with-icon]>.uc-content-wrapper:is([drag-state=active],[drag-state=near],[drag-state=over]) .uc-text{color:var(--uc-foreground)}:where(.uc-contrast) :where([uc-drop-area])[with-icon]>.uc-content-wrapper:is([drag-state=active],[drag-state=near],[drag-state=over]) .uc-text{color:var(--uc-foreground)}:where([uc-drop-area])[with-icon]>.uc-content-wrapper:is([drag-state=active],[drag-state=near],[drag-state=over]) uc-icon:first-child{transform:translateY(-48px)}
11944:where([uc-drop-area])[with-icon]>.uc-content-wrapper:is([drag-state=active],[drag-state=near],[drag-state=over]) uc-icon:last-child{transform:translateY(0)}:where([uc-drop-area])[with-icon]>.uc-content-wrapper[drag-state=near] uc-icon:last-child{transform:scale(1.3)}:where([uc-drop-area])[with-icon]>.uc-content-wrapper[drag-state=over] uc-icon:last-child{transform:scale(1.5)}:where([uc-drop-area])[fullscreen]{position:fixed;inset:0;z-index:2147483647;display:flex;align-items:center;justify-content:center;width:calc(100vw - var(--uc-padding) * 2);height:calc(100vh - var(--uc-padding) * 2);margin:var(--uc-padding)}:where([uc-drop-area])[fullscreen] .uc-content-wrapper{width:100%;max-width:calc(var(--uc-dialog-width) * .8);height:180px;color:var(--uc-foreground);background-color:var(--uc-background);border-radius:calc(var(--uc-radius) * 1.75);box-shadow:var(--uc-dialog-shadow);transition:color var(--uc-transition),background-color var(--uc-transition),box-shadow var(--uc-transition),border-radius var(--uc-transition),transform var(--uc-transition)}:where([uc-drop-area])[with-icon][fullscreen][drag-state=active]>.uc-content-wrapper,:where([uc-drop-area])[with-icon][fullscreen][drag-state=near]>.uc-content-wrapper{transform:translateY(10px);opacity:0}:where([uc-drop-area])[with-icon][fullscreen][drag-state=over]>.uc-content-wrapper{transform:translateY(0);opacity:1}:is(:where([uc-drop-area])[with-icon][fullscreen])>.uc-content-wrapper uc-icon:first-child{transform:translateY(-48px)}:where([uc-drop-area])[clickable]{cursor:pointer}@supports selector(dialog::backdrop){:where([uc-modal])>dialog::backdrop{background-color:#0000001a}:where([uc-modal])[strokes]>dialog::backdrop{background-image:var(--modal-backdrop-background-image)}}:where([uc-modal])>dialog[open]{transform:translateY(0);visibility:visible;opacity:1}:where([uc-modal])>dialog:not([open]){transform:translateY(20px);visibility:hidden;opacity:0}:where([uc-modal])>dialog{display:flex;flex-direction:column;width:min(var(--uc-dialog-width),100%);max-width:min(calc(100% - var(--uc-padding) * 2),var(--uc-dialog-max-width));min-height:var(--uc-button-size);max-height:min(calc(100% - var(--uc-padding) * 2),var(--uc-dialog-max-height));margin:auto;padding:0;overflow:hidden;background-color:var(--uc-background);border:0;border-radius:calc(var(--uc-radius) * 1.75);box-shadow:var(--uc-dialog-shadow);transition:transform .4s ease,opacity .4s ease}:where(.uc-contrast) :where([uc-modal])>dialog{outline:1px solid var(--uc-border)}uc-url-source{display:block;background-color:var(--uc-background)}uc-url-source>.uc-content{display:grid;grid-gap:4px;grid-template-columns:1fr min-content;padding:var(--uc-padding);padding-top:0}uc-url-source .uc-url-input{display:flex}uc-camera-source{position:relative;display:flex;flex-direction:column;width:100%;height:100%;max-height:100%;overflow:hidden;background-color:var(--uc-background);border-radius:var(--uc-radius)}[uc-modal]>dialog:has(uc-camera-source[active]){width:100%;height:100%}uc-camera-source:not(.uc-initialized) .uc-controls{display:none}uc-camera-source video{display:block;width:100%;max-height:100%;object-fit:contain;object-position:center center;background-color:var(--uc-muted);border-radius:var(--uc-radius)}uc-camera-source .uc-toolbar{position:absolute;bottom:0;display:flex;justify-content:space-between;width:100%;padding:var(--uc-padding);background-color:var(--uc-background)}uc-camera-source .uc-content{display:flex;flex:1;justify-content:center;width:100%;height:100%;padding:var(--uc-padding);padding-top:0;overflow:hidden}uc-camera-source .uc-message-box{display:flex;flex-direction:column;grid-gap:40px;align-items:center;justify-content:center;padding:40px 40px 0;color:var(--uc-foreground)}uc-camera-source .uc-message-box button{color:var(--uc-primary-foreground);background-color:var(--uc-primary)}uc-camera-source .uc-shot-btn{width:58px;height:58px;color:var(--uc-background);background-color:var(--uc-primary-light);border-radius:50%;opacity:.85;transition:bottom var(--uc-transition),opacity var(--uc-transition),transform var(--uc-transition)}uc-camera-source .uc-shot-btn:hover{transform:scale(1.05);opacity:1}uc-camera-source .uc-shot-btn:active{transform:scale(1);opacity:1}uc-camera-source .uc-shot-btn[disabled]{bottom:-80px}uc-camera-source .uc-shot-btn uc-icon svg{width:20px;height:20px}uc-camera-source .uc-controls{position:relative;display:flex;align-items:center;flex-wrap:wrap;justify-content:space-between;padding:0 var(--uc-padding) var(--uc-padding);min-height:74px}uc-camera-source .uc-switcher{display:flex}uc-camera-source .uc-switch.uc-active{background-color:var(--uc-secondary)}uc-camera-source .uc-camera-actions{display:flex;justify-content:center;align-items:center;gap:5px}uc-camera-source .uc-stop-record{background-color:var(--uc-destructive-foreground-light);opacity:1}:where(uc-camera-source:is(.uc-recording)) .uc-recording-timer uc-icon{display:none}:where(uc-camera-source:is(.uc-recording)) .uc-recording-timer{pointer-events:none}uc-camera-source .uc-recording-timer{z-index:1;position:relative;overflow:hidden}:where(uc-camera-source) .uc-recording-timer uc-icon{width:10px;height:10px;margin-right:10px}uc-camera-source .uc-recording-timer .uc-line{position:absolute;content:"";bottom:0;left:0;right:0;height:2px;background-color:var(--uc-foreground-light);
11944transform:scaleX(0);transform-origin:left;transition:transform var(--uc-transition)}uc-camera-source .uc-btn-microphone{z-index:1}uc-camera-source .uc-select{display:flex}uc-camera-source .uc-audio-select{width:98px}uc-camera-source .uc-audio-select select{width:100%}uc-camera-source .uc-camera-action{position:absolute;inset:0 var(--uc-padding) var(--uc-padding);margin:0 auto}uc-external-source{display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--uc-background);overflow:hidden;position:relative}[uc-modal]>dialog:has(uc-external-source[active]){width:100%;height:100%}uc-external-source>.uc-content{position:relative;display:grid;flex:1;grid-template-rows:1fr min-content}uc-external-source iframe{display:block;width:100%;height:100%;border:none}uc-external-source .uc-iframe-wrapper{overflow:hidden}uc-external-source .uc-toolbar{display:flex;width:100%;grid-gap:var(--uc-padding);align-items:center;justify-content:space-between;padding:var(--uc-padding);border-top:1px solid var(--uc-border)}uc-external-source .uc-back-btn{padding-left:0}uc-external-source .uc-selection-status-box{color:var(--uc-foreground);display:flex;flex-direction:column;align-items:center;justify-content:center}uc-external-source .uc-selection-status-box button{color:var(--uc-primary);height:auto;padding:0;background:none}uc-external-source .uc-selection-status-box button:hover{text-decoration:underline}uc-external-source uc-activity-header{position:absolute;width:100%;justify-content:flex-end;z-index:1;left:0;top:0;right:0;pointer-events:none}uc-external-source uc-activity-header .uc-close-btn{pointer-events:auto}uc-external-source .uc-done-btn>span.uc-hidden{visibility:hidden;pointer-events:none}uc-external-source .uc-done-btn>uc-spinner{position:absolute;width:100%;height:100%;display:flex;align-items:center;justify-content:center}uc-upload-list{display:flex;flex-direction:column;width:100%;height:max-content;overflow:hidden;background-color:var(--uc-background);transition:opacity var(--uc-transition)}uc-upload-list .uc-no-files{height:32px;padding:20px}uc-upload-list .uc-files{display:block;flex:1;min-height:32px;padding:0 var(--uc-padding);overflow:auto}uc-upload-list .uc-toolbar{display:flex;gap:4px;justify-content:space-between;padding:var(--uc-padding);background-color:var(--uc-background)}uc-upload-list .uc-toolbar-spacer{flex:1}uc-upload-list uc-drop-area{position:absolute;top:0;left:0;width:calc(100% - var(--uc-padding) * 2);height:calc(100% - var(--uc-padding) * 2);margin:var(--uc-padding);border-radius:var(--uc-radius)}uc-upload-list uc-activity-header>.uc-header-text{padding:0 var(--uc-padding)}uc-upload-list .uc-common-error{border-radius:var(--uc-radius);color:var(--uc-destructive-foreground);background-color:var(--uc-destructive);display:flex;align-items:center;justify-content:center;padding:var(--uc-padding);margin:4px var(--uc-padding) 0 var(--uc-padding);font-size:.925em}uc-upload-list .uc-add-more-btn uc-icon{display:none}uc-start-from{display:block;overflow-y:auto}uc-start-from .uc-content{display:grid;grid-auto-flow:row;gap:calc(var(--uc-padding) * 2);width:100%;height:100%;padding:calc(var(--uc-padding) * 2);background-color:var(--uc-background)}[uc-modal]>dialog:has(uc-start-from[active]){width:var(--uc-dialog-width)}[uc-modal] uc-start-from uc-drop-area{border-radius:var(--uc-radius)}@media only screen and (max-width:430px){[uc-modal] uc-start-from uc-drop-area{display:none}}uc-file-item{--uc-file-item-gap: 4px;--uc-file-item-height: calc(var(--uc-preview-size) + var(--uc-padding) * 2 + var(--uc-file-item-gap));display:block;overflow:hidden;min-height:var(--uc-file-item-height)}uc-file-item:last-of-type{--uc-file-item-gap: 0}uc-file-item>.uc-inner{position:relative;display:grid;grid-template-columns:var(--uc-preview-size) 1fr max-content;gap:2px;align-items:center;margin-bottom:var(--uc-file-item-gap);padding:var(--uc-padding);overflow:hidden;font-size:.925em;background-color:var(--uc-muted);border-radius:var(--uc-radius);transition:background-color var(--uc-transition)}uc-file-item>.uc-inner[focused]{background-color:transparent}uc-file-item>.uc-inner[uploading] .uc-edit-btn{display:none}uc-file-item>:where(.uc-inner[failed],.uc-inner[limit-overflow]){background-color:var(--uc-destructive)}uc-file-item .uc-thumb{position:relative;display:inline-flex;width:var(--uc-preview-size);height:var(--uc-preview-size);background-color:var(--uc-secondary);background-position:center center;background-size:cover;border-radius:var(--uc-radius)}uc-file-item .uc-file-name-wrapper{text-align:left;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;max-width:100%;padding-right:var(--uc-padding);padding-left:var(--uc-padding);overflow:hidden;color:var(--uc-muted-foreground)}uc-file-item .uc-file-name{max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}uc-file-item .uc-file-error{display:none;color:var(--uc-destructive-foreground);font-size:.85em}uc-file-item button.uc-remove-btn,uc-file-item button.uc-edit-btn{color:var(--uc-muted-foreground)}uc-file-item button svg{pointer-events:none}uc-file-item button.uc-upload-btn{display:none}uc-file-item .uc-badge{position:absolute;bottom:2px;right:2px;width:14px;
11944height:14px;color:var(--uc-background);background-color:var(--uc-foreground);border-radius:50%;transform:scale(.3);opacity:0;transition:opacity var(--uc-transition),transform var(--uc-transition);display:flex;justify-content:center;align-items:center}uc-file-item>.uc-inner:where([failed],[limit-overflow],[finished]) .uc-badge{transform:scale(1);opacity:1}uc-file-item>.uc-inner:where([failed],[limit-overflow]) .uc-badge{background-color:var(--uc-destructive-foreground)}uc-file-item>.uc-inner:where([failed],[limit-overflow]) .uc-file-error{display:block}uc-file-item .uc-badge uc-icon,uc-file-item .uc-badge uc-icon svg{width:100%;height:100%}uc-file-item .uc-progress-bar{opacity:.7;top:calc(100% - 2px);height:2px}:where(.uc-contrast) uc-file-item .uc-progress-bar{opacity:1}uc-file-item .uc-file-actions{display:flex;gap:2px;align-items:center;justify-content:center}uc-progress-bar-common{position:fixed;right:0;bottom:0;left:0;z-index:10000;display:block;height:10px;background-color:var(--uc-background);transition:opacity .3s}uc-progress-bar-common:not([active]){opacity:0;pointer-events:none}uc-progress-bar{position:absolute;top:0;bottom:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none}uc-progress-bar .uc-progress{width:calc(var(--l-width) * 1%);height:100%;background-color:var(--uc-primary);transform:translate(0);opacity:1;transition:width .6s,opacity .3s}uc-progress-bar .uc-progress--hidden{opacity:0}
11944uc-activity-header{display:flex;justify-content:space-between;gap:var(--uc-padding);padding:var(--uc-padding);color:var(--uc-foreground);font-weight:500;font-size:1em}uc-activity-header>*{display:flex;align-items:center}uc-copyright{display:flex;width:100%;justify-content:center}uc-copyright .uc-credits{all:unset;position:absolute;bottom:12px;background-color:var(--uc-background);padding:2px 5px;border-radius:6px;color:var(--uc-muted-foreground);font-weight:400;font-size:12px;opacity:.9;cursor:pointer;transition:opacity var(--uc-transition),background-color var(--uc-transition)}uc-copyright .uc-credits:focus-visible{outline:1px auto -webkit-focus-ring-color}uc-copyright .uc-credits:hover{opacity:1;background-color:var(--uc-muted)}[uc-cloud-image-editor]{--color-primary-accent: var(--uc-primary);--color-text-base: var(--uc-foreground);--color-text-accent-contrast: var(--uc-background);--color-fill-contrast: var(--uc-background);--color-modal-backdrop: oklch(0 0 0 / .1);--color-image-background: var(--uc-muted);--color-focus-ring: var(--color-primary-accent);--color-crop-guides: var(--uc-foreground);--font-size-ui: var(--uc-font-size);--size-touch-area: var(--uc-button-size);--size-panel-heading: calc(var(--uc-button-size) + var(--uc-padding) * 2);--size-ui-min-width: 130px;--size-line-width: 1px;--size-modal-width: 650px;--size-icon: calc(var(--uc-button-size) / 2);--border-radius-editor: var(--uc-radius);--border-radius-thumb: var(--uc-radius);--border-radius-ui: var(--uc-radius);--border-radius-base: var(--uc-radius);--cldtr-gap-min: 5px;--cldtr-gap-mid-1: 10px;--cldtr-gap-mid-2: 15px;--cldtr-gap-max: 20px;--transition-duration-2: var(--transition-duration-all, .2s);--transition-duration-3: var(--transition-duration-all, .3s);--transition-duration-4: var(--transition-duration-all, .4s);--transition-duration-5: var(--transition-duration-all, .5s);--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading);--transparent-pixel: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=);display:block;width:100%;height:100%;max-height:100%}[uc-cloud-image-editor] :is([can-handle-paste]:hover,[can-handle-paste]:focus){--can-handle-paste: "true"}[uc-cloud-image-editor] :is([tabindex][focus-visible],[tabindex]:hover,[with-effects][focus-visible],[with-effects]:hover){--filter-effect: var(--hover-filter) !important;--opacity-effect: var(--hover-opacity) !important;--color-effect: var(--hover-color-rgb) !important;--background-effect: var(--hover-background) !important}[uc-cloud-image-editor] :is([tabindex]:active,[with-effects]:active){--filter-effect: var(--down-filter) !important;--opacity-effect: var(--down-opacity) !important;--color-effect: var(--down-color-rgb) !important;--background-effect: var(--down-background) !important}[uc-cloud-image-editor] :is([tabindex][active],[with-effects][active]){--filter-effect: var(--active-filter) !important;--opacity-effect: var(--active-opacity) !important;--color-effect: var(--active-color-rgb) !important;--background-effect: var(--active-background) !important}[uc-cloud-image-editor] [hidden-scrollbar]::-webkit-scrollbar{display:none}[uc-cloud-image-editor] [hidden-scrollbar]{-ms-overflow-style:none;scrollbar-width:none}[uc-cloud-image-editor].uc-editor_ON{--modal-header-opacity: 0;--modal-header-height: 0px;--modal-toolbar-height: calc(var(--size-panel-heading) * 2)}[uc-cloud-image-editor].uc-editor_OFF{--modal-header-opacity: 1;--modal-header-height: var(--size-panel-heading);--modal-toolbar-height: var(--size-panel-heading)}[uc-cloud-image-editor]>.uc-wrapper{--l-min-img-height: var(--modal-toolbar-height);--l-max-img-height: 100%;--l-edit-button-width: 120px;--l-toolbar-horizontal-padding: var(--cldtr-gap-mid-1);position:relative;display:grid;grid-template-rows:minmax(var(--l-min-img-height),var(--l-max-img-height)) minmax(var(--modal-toolbar-height),auto);height:100%;overflow:hidden;overflow-y:auto}@media only screen and (max-width:800px){[uc-cloud-image-editor]>.uc-wrapper{--l-edit-button-width: 70px;--l-toolbar-horizontal-padding: var(--cldtr-gap-min)}}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport{display:flex;align-items:center;justify-content:center;overflow:hidden}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-image_container>.uc-image{--viewer-image-opacity: 1;position:absolute;top:0;left:0;z-index:10;display:block;box-sizing:border-box;width:100%;height:100%;object-fit:scale-down;background-color:var(--color-image-background);transform:scale(1);opacity:var(--viewer-image-opacity);-webkit-user-select:none;user-select:none;pointer-events:auto}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-image_container>.uc-image.uc-image_visible_viewer{transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-4)}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-image_container>.uc-image.uc-image_hidden_to_cropper{--viewer-image-opacity: 0;background-image:var(--transparent-pixel);transform:scale(1);transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-image_container>.uc-image.uc-image_hidden_effects{--viewer-image-opacity: 0;transform:scale(1);transition:opacity var(--transition-duration-3) cubic-bezier(.5,0,1,1),transform var(--transition-duration-4);pointer-events:none}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-image_container{position:relative;display:block;width:100%;height:100%;background-color:var(--color-image-background);transition:var(--transition-duration-3)}[uc-cloud-image-editor]>.uc-wrapper>.uc-toolbar{position:relative;transition:.3s}[uc-cloud-image-editor]>.uc-wrapper>.uc-toolbar>.uc-toolbar_content{position:absolute;bottom:0;left:0;box-sizing:border-box;width:100%;height:var(--modal-toolbar-height);min-height:var(--size-panel-heading);background-color:var(--color-fill-contrast)}[uc-cloud-image-editor]>.uc-wrapper>.uc-toolbar>.uc-toolbar_content.uc-toolbar_content__viewer{display:flex;align-items:center;justify-content:space-between;
11944height:var(--size-panel-heading);padding-right:var(--l-toolbar-horizontal-padding);padding-left:var(--l-toolbar-horizontal-padding)}[uc-cloud-image-editor]>.uc-wrapper>.uc-toolbar>.uc-toolbar_content.uc-toolbar_content__editor{display:flex}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-info_pan{position:absolute;-webkit-user-select:none;user-select:none}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-file_type_outer{position:absolute;z-index:2;display:flex;max-width:120px;transform:translate(-40px);-webkit-user-select:none;user-select:none}[uc-cloud-image-editor]>.uc-wrapper>.uc-viewport>.uc-file_type_outer>.uc-file_type{padding:4px .8em}[uc-cloud-image-editor]>.uc-wrapper>.uc-network_problems_splash{position:absolute;z-index:4;display:flex;flex-direction:column;width:100%;height:100%;background-color:var(--color-fill-contrast)}[uc-cloud-image-editor]>.uc-wrapper>.uc-network_problems_splash>.uc-network_problems_content{display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}[uc-cloud-image-editor]>.uc-wrapper>.uc-network_problems_splash>.uc-network_problems_content>.uc-network_problems_icon{display:flex;align-items:center;justify-content:center;width:40px;height:40px;color:var(--uc-foreground);background-color:var(--uc-muted);border-radius:50%}[uc-cloud-image-editor]>.uc-wrapper>.uc-network_problems_splash>.uc-network_problems_content>.uc-network_problems_text{margin-top:var(--cldtr-gap-max);font-size:var(--font-size-ui);color:var(--uc-foreground)}[uc-cloud-image-editor]>.uc-wrapper>.uc-network_problems_splash>.uc-network_problems_footer{display:flex;align-items:center;justify-content:center;height:var(--size-panel-heading)}uc-crop-frame>.uc-svg{position:absolute;top:0;left:0;z-index:2;width:100%;height:100%;border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);opacity:inherit;transition:var(--transition-duration-3)}uc-crop-frame>.uc-thumb{--idle-color-rgb: var(--color-text-base);--hover-color-rgb: var(--color-primary-accent);--focus-color-rgb: var(--color-primary-accent);--down-color-rgb: var(--color-primary-accent);--color-effect: var(--idle-color-rgb);color:var(--color-effect);transition:color var(--transition-duration-3),opacity var(--transition-duration-3)}uc-crop-frame>.uc-thumb--visible{opacity:1;pointer-events:auto}uc-crop-frame>.uc-thumb--hidden{opacity:0;pointer-events:none}uc-crop-frame>.uc-guides{transition:var(--transition-duration-3)}uc-crop-frame>.uc-guides--hidden{opacity:0}
11944uc-crop-frame>.uc-guides--semi-hidden{opacity:.2}uc-crop-frame>.uc-guides--visible{opacity:1}uc-editor-button-control,uc-editor-crop-button-control,uc-editor-filter-control,uc-editor-operation-control{--l-base-min-width: var(--uc-button-size);--l-base-height: var(--uc-button-size);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--background-effect: var(--idle-background);--filter-effect: var(--idle-filter);--idle-color-rgb: var(--uc-secondary-foreground);--idle-opacity: 1;--idle-filter: 1;--idle-background: var(--uc-secondary);--hover-color-rgb: var(--uc-secondary-foreground);--hover-opacity: 1;--hover-filter: .8;--hover-background: var(--uc-secondary-hover);--down-color-rgb: var(--hover-color-rgb);--down-opacity: 1;--down-filter: .6;--down-background: var(--uc-secondary);border-radius:var(--uc-radius)}uc-editor-button-control>button,uc-editor-crop-button-control>button,uc-editor-filter-control>button,uc-editor-operation-control>button{all:unset;position:relative;display:grid;grid-template-columns:var(--l-base-min-width) auto;grid-template-rows:100%;align-items:center;height:var(--l-base-height);color:var(--color-effect);opacity:var(--opacity-effect);outline:none;cursor:pointer;transition:var(--l-width-transition)}:where(uc-editor-button-control,uc-editor-crop-button-control,uc-editor-filter-control,uc-editor-operation-control)>uc-icon>svg{width:var(--size-icon);height:var(--size-icon)}uc-editor-filter-control>uc-icon.uc-original-icon>svg{width:100%;height:100%}uc-editor-button-control.uc-active,uc-editor-operation-control.uc-active,uc-editor-crop-button-control.uc-active,uc-editor-filter-control.uc-active{--idle-color-rgb: var(--uc-primary-foreground);--idle-background: var(--uc-primary);--idle-opacity: 1;--hover-color-rgb: var(--uc-primary-foreground);--hover-background: var(--uc-primary);--hover-opacity: 1}uc-editor-filter-control.uc-not_active .uc-preview[loaded]{opacity:1}uc-editor-filter-control.uc-active .uc-preview{opacity:0}
11944uc-editor-button-control.uc-not_active,uc-editor-operation-control.uc-not_active,uc-editor-crop-button-control.uc-not_active,uc-editor-filter-control.uc-not_active{--idle-color-rgb: var(--uc-secondary-foreground)}:where(.uc-contrast) uc-editor-button-control.uc-not_active,:where(.uc-contrast) uc-editor-operation-control.uc-not_active,:where(.uc-contrast) uc-editor-crop-button-control.uc-not_active,:where(.uc-contrast) uc-editor-filter-control.uc-not_active{--idle-background: transparent;--hover-background: var(--uc-secondary);outline:1px solid var(--uc-border);outline-offset:-1px}uc-editor-button-control>button:before,uc-editor-operation-control>button:before,uc-editor-crop-button-control>button:before,uc-editor-filter-control>button:before{position:absolute;content:"";right:0;left:0;z-index:-1;width:100%;height:100%;background-color:var(--background-effect);border-radius:var(--border-radius-editor);transition:var(--transition-duration-3)}uc-editor-button-control>button .uc-title,uc-editor-operation-control>button .uc-title,uc-editor-crop-button-control>button .uc-title,uc-editor-filter-control>button .uc-title{padding-right:var(--cldtr-gap-mid-1);font-size:.7em;letter-spacing:1.004px;text-transform:uppercase}uc-editor-button-control>button uc-icon,uc-editor-operation-control>button uc-icon,uc-editor-crop-button-control>button uc-icon,uc-editor-filter-control>button uc-icon{pointer-events:none}uc-editor-filter-control>button .uc-preview{position:absolute;right:0;left:0;z-index:-1;width:100%;height:var(--l-base-height);background-repeat:no-repeat;background-size:contain;border-radius:var(--border-radius-editor);opacity:0;filter:brightness(var(--filter-effect));transition:var(--transition-duration-3)}uc-editor-filter-control>.uc-original-icon{color:var(--color-effect);opacity:.3}uc-editor-image-cropper{position:absolute;top:0;left:0;z-index:10;display:block;width:100%;height:100%;opacity:0;pointer-events:none;touch-action:none;color:var(--color-crop-guides)}uc-editor-image-cropper.uc-active_from_editor{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}uc-editor-image-cropper.uc-active_from_viewer{transform:scale(1) translate(0);opacity:1;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1) .4s,opacity var(--transition-duration-3);pointer-events:auto}uc-editor-image-cropper.uc-inactive_to_editor{opacity:0;transition:transform var(--transition-duration-4) cubic-bezier(.37,0,.63,1),opacity var(--transition-duration-3) calc(var(--transition-duration-3) + .05s);pointer-events:none}uc-editor-image-cropper>.uc-canvas{position:absolute;top:0;left:0;z-index:1;display:block;width:100%;height:100%}uc-editor-image-fader{position:absolute;top:0;left:0;display:block;width:100%;height:100%}uc-editor-image-fader.uc-active_from_viewer{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-start);pointer-events:auto}uc-editor-image-fader.uc-active_from_cropper{z-index:3;transform:scale(1);opacity:1;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:auto}uc-editor-image-fader.uc-inactive_to_cropper{z-index:3;transform:scale(1);opacity:0;transition:transform var(--transition-duration-4),opacity var(--transition-duration-3) steps(1,jump-end);pointer-events:none}uc-editor-image-fader .uc-fader-image{position:absolute;top:0;left:0;display:block;width:100%;height:100%;object-fit:scale-down;transform:scale(1);-webkit-user-select:none;user-select:none;content-visibility:auto}uc-editor-image-fader .uc-fader-image--preview{background-color:var(--color-image-background);border-top-left-radius:var(--border-radius-base);border-top-right-radius:var(--border-radius-base);transform:scale(1);opacity:0;transition:var(--transition-duration-3)}uc-editor-scroller{display:flex;align-items:center;width:100%;height:100%;overflow-x:scroll}uc-editor-slider{display:flex;align-items:center;justify-content:center;width:100%;height:var(--size-panel-heading)}uc-editor-toolbar{position:relative;width:100%;height:100%}@media only screen and (max-width:600px){uc-editor-toolbar{--l-tab-gap: var(--cldtr-gap-mid-1);--l-slider-padding: var(--uc-padding);
11944--l-controls-padding: var(--uc-padding)}}@media only screen and (min-width:601px){uc-editor-toolbar{--l-tab-gap: var(--cldtr-gap-max);--l-slider-padding: var(--uc-padding);--l-controls-padding: var(--uc-padding)}}uc-editor-toolbar>.uc-toolbar-container{position:relative;width:100%;height:100%;overflow:hidden}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar{position:absolute;display:grid;grid-template-rows:1fr 1fr;width:100%;height:100%;background-color:var(--color-fill-contrast);transition:opacity var(--transition-duration-3) ease-in-out,transform var(--transition-duration-3) ease-in-out,visibility var(--transition-duration-3) ease-in-out}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar.uc-sub-toolbar--visible{transform:translateY(0);opacity:1;pointer-events:auto}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar.uc-sub-toolbar--top-hidden{transform:translateY(100%);opacity:0;pointer-events:none}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar.uc-sub-toolbar--bottom-hidden{transform:translateY(-100%);opacity:0;pointer-events:none}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row{display:flex;align-items:center;justify-content:space-between;padding-right:var(--l-controls-padding);padding-left:var(--l-controls-padding)}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row>.uc-tab-toggles{position:relative;display:grid;grid-auto-flow:column;grid-gap:0px var(--l-tab-gap);align-items:center;height:100%}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row>.uc-tab-toggles>.uc-tab-toggles_indicator{position:absolute;bottom:0;left:0;width:var(--size-touch-area);height:2px;background-color:var(--uc-secondary-foreground);transform:translate(0);transition:transform var(--transition-duration-3)}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-tab-content-row{position:relative}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-tab-content-row>.uc-tab-content{position:absolute;top:0;left:0;display:flex;width:100%;height:100%;overflow:hidden;opacity:0;content-visibility:auto}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-tab-content-row>.uc-tab-content.uc-tab-content--visible{opacity:1;pointer-events:auto}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-tab-content-row>.uc-tab-content.uc-tab-content--hidden{opacity:0;pointer-events:none}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row>.uc-tab-toggles>.uc-tab-toggle.uc-tab-toggle--visible{display:contents}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row>.uc-tab-toggles>.uc-tab-toggle.uc-tab-toggle--hidden{display:none}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row>.uc-tab-toggles.uc-tab-toggles--hidden{display:none}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row>.uc-tab-toggles>.uc-tab-toggle>uc-btn-ui{width:var(--uc-button-size)}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-controls-row>.uc-tab-toggles>.uc-tab-toggle>uc-btn-ui>uc-icon>svg{width:var(--size-icon);height:var(--size-icon)}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-tab-content-row>.uc-tab-content .uc-controls-list_align{display:grid;grid-template-areas:". inner .";grid-template-columns:1fr auto 1fr;box-sizing:border-box;min-width:100%;padding-left:var(--uc-padding)}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-tab-content-row>.uc-tab-content .uc-controls-list_inner{display:grid;grid-area:inner;grid-auto-flow:column;gap:6px}uc-editor-toolbar>.uc-toolbar-container>.uc-sub-toolbar>.uc-tab-content-row>.uc-tab-content .uc-controls-list_inner:last-child{padding-right:var(--uc-padding)}uc-editor-toolbar .uc-controls-list_last-item{margin-right:var(--cldtr-gap-max)}uc-editor-toolbar .uc-info-tooltip_container{position:absolute;display:flex;align-items:flex-start;justify-content:center;width:100%;height:100%}uc-editor-toolbar .uc-info-tooltip_wrapper{position:absolute;top:calc(-100% - var(--cldtr-gap-mid-2));display:flex;flex-direction:column;justify-content:flex-end;height:100%;pointer-events:none}uc-editor-toolbar .uc-info-tooltip{z-index:3;padding:3px 6px;color:var(--color-text-base);font-size:.7em;letter-spacing:1px;text-transform:uppercase;background-color:var(--color-text-accent-contrast);border-radius:var(--border-radius-editor);transform:translateY(100%);opacity:0;transition:var(--transition-duration-3)}uc-editor-toolbar .uc-info-tooltip_visible{transform:translateY(0);opacity:1}uc-editor-toolbar .uc-slider{padding-right:var(--l-slider-padding);padding-left:var(--l-slider-padding)}uc-btn-ui>button{--filter-effect: var(--idle-brightness);--opacity-effect: var(--idle-opacity);--color-effect: var(--idle-color-rgb);--background-effect: var(--idle-background);--l-transition-effect: var( --css-transition, color var(--transition-duration-2), background-color var(--transition-duration-2), filter var(--transition-duration-2) );all:unset;display:inline-flex;align-items:center;box-sizing:var(--css-box-sizing, border-box);height:var(--css-height, var(--uc-button-size));padding-right:var(--css-padding-right, 14px);padding-left:var(--css-padding-left, 14px);font-size:1em;color:var(--color-effect);background-color:var(--background-effect);border-radius:var(--uc-radius);opacity:var(--opacity-effect);outline:none;cursor:pointer;filter:brightness(var(--filter-effect));transition:var(--l-transition-effect);-webkit-user-select:none;user-select:none}uc-btn-ui>button>uc-icon{pointer-events:none}uc-btn-ui .uc-text{white-space:nowrap}uc-btn-ui .uc-icon{display:flex;align-items:center;justify-content:center;color:var(--color-effect);filter:brightness(var(--filter-effect));transition:var(--l-transition-effect)}uc-btn-ui .uc-icon_left{margin-right:var(--cldtr-gap-mid-1);margin-left:0}uc-btn-ui .uc-icon_right{margin-right:0;margin-left:var(--cldtr-gap-mid-1)}uc-btn-ui .uc-icon_single{margin-right:0;margin-left:0}uc-btn-ui .uc-icon_hidden{display:none;margin:0}uc-btn-ui.uc-primary>button{--idle-color-rgb: var(--uc-primary-foreground);--idle-brightness: 1;--idle-opacity: 1;--idle-background: var(--uc-primary);--hover-color-rgb: var(--uc-primary-foreground);--hover-brightness: 1;
11944--hover-opacity: 1;--hover-background: var(--uc-primary-hover);--down-color-rgb: var(--uc-primary-foreground);--down-brightness: .75;--down-opacity: 1;--down-background: var(--uc-primary);--active-color-rgb: var(--uc-primary-foreground);--active-brightness: 1;--active-opacity: 1;--active-background: var(--uc-primary)}uc-btn-ui.uc-primary-icon>button{--idle-color-rgb: var(--uc-primary);--idle-brightness: 1;--idle-opacity: 1;--idle-background: transparent;--hover-color-rgb: var(--uc-primary);--hover-brightness: 1;--hover-opacity: 1;--hover-background: var(--uc-primary-transparent);--down-color-rgb: var(--uc-primary);--down-brightness: .75;--down-opacity: 1;--down-background: var(--uc-primary-transparent);--active-color-rgb: var(--uc-primary-foreground);--active-brightness: 1;--active-opacity: 1;--active-background: var(--uc-primary);padding:0;width:var(--uc-button-size)}uc-btn-ui.uc-secondary>button{--idle-color-rgb: var(--uc-secondary-foreground);--idle-brightness: 1;--idle-opacity: 1;--idle-background: var(--uc-secondary);--hover-color-rgb: var(--uc-secondary-foreground);--hover-brightness: 1;--hover-opacity: 1;--hover-background: var(--uc-secondary-hover);--down-color-rgb: var(--uc-secondary-foreground);--down-brightness: 1;--down-opacity: 1;--down-background: var(--uc-secondary-hover);--active-color-rgb: var(--uc-secondary-foreground);--active-brightness: 1;--active-opacity: 1;--active-background: transparent}:where(.uc-contrast) uc-btn-ui.uc-secondary>button{border:1px solid var(--uc-border)}uc-btn-ui.uc-secondary-icon>button{--idle-color-rgb: var(--uc-secondary-foreground);--idle-brightness: 1;--idle-opacity: 1;--idle-background: transparent;--hover-color-rgb: var(--uc-secondary-foreground);--hover-brightness: 1;--hover-opacity: 1;--hover-background: var(--uc-secondary);--down-color-rgb: var(--uc-secondary-foreground);--down-brightness: 1;--down-opacity: 1;--down-background: var(--uc-secondary);--active-color-rgb: var(--uc-secondary-foreground);--active-brightness: 1;--active-opacity: 1;--active-background: transparent;padding:0;width:var(--uc-button-size)}uc-btn-ui.uc-tab>button{--idle-color-rgb: var(--uc-secondary-foreground);--idle-brightness: 1;--idle-opacity: 1;--idle-background: transparent;--hover-color-rgb: var(--uc-secondary-foreground);--hover-brightness: 1;--hover-opacity: 1;--hover-background: var(--uc-secondary);--down-color-rgb: var(--uc-secondary-foreground);--down-brightness: 1;--down-opacity: 1;--down-background: var(--uc-secondary);--active-color-rgb: var(--uc-secondary-foreground);--active-brightness: 1;--active-opacity: 1;--active-background: transparent;padding:0;width:var(--uc-button-size)}uc-btn-ui.uc-default>button{--idle-color-rgb: var(--uc-secondary-foreground);--idle-brightness: 1;--idle-opacity: 1;--idle-background: var(--uc-secondary);--hover-color-rgb: var(--uc-secondary-foreground);--hover-brightness: 1;--hover-opacity: 1;--hover-background: var(--uc-secondary-hover);--down-color-rgb: var(--uc-secondary-foreground);--down-brightness: .75;--down-opacity: 1;--down-background: var(--uc-secondary);--active-color-rgb: var(--uc-primary);--active-brightness: 1;--active-opacity: 1;--active-background: var(--uc-primary-transparent)}:where(.uc-contrast) uc-btn-ui.uc-default>button{--idle-background: transparent;--hover-background: var(--uc-secondary);--active-background: var(--uc-foreground);--active-color-rgb: var(--uc-background)}uc-line-loader-ui{position:absolute;top:0;left:0;z-index:9999;width:100%;height:2px;opacity:.5}uc-line-loader-ui .uc-inner{width:25%;max-width:200px;height:100%}uc-line-loader-ui .uc-line{width:100%;height:100%;background-color:var(--uc-primary);transform:translate(-101%);transition:transform 1s}uc-slider-ui{--l-thumb-size: 24px;--l-zero-dot-size: 5px;--l-zero-dot-offset: 2px;--idle-color-rgb: var(--uc-foreground);--hover-color-rgb: var(--uc-primary);--down-color-rgb: var(--uc-primary);--color-effect: var(--idle-color-rgb);--l-color: var(--color-effect);position:relative;display:flex;align-items:center;justify-content:center;width:100%;
11944height:calc(var(--l-thumb-size) + (var(--l-zero-dot-size) + var(--l-zero-dot-offset)) * 2)}uc-slider-ui .uc-thumb{position:absolute;left:0;width:var(--l-thumb-size);height:var(--l-thumb-size);background-color:var(--l-color);border-radius:50%;transform:translate(0);opacity:1;transition:opacity var(--transition-duration-2),background-color var(--transition-duration-2)}uc-slider-ui .uc-steps{position:absolute;display:flex;align-items:center;justify-content:space-between;box-sizing:border-box;width:100%;height:100%;padding-right:calc(var(--l-thumb-size) / 2);padding-left:calc(var(--l-thumb-size) / 2)}uc-slider-ui .uc-border-step{width:0px;height:10px;border-right:1px solid var(--uc-foreground);opacity:1;transition:border-color var(--transition-duration-2)}uc-slider-ui .uc-minor-step{width:0px;height:4px;border-right:1px solid var(--uc-foreground);opacity:.6;transition:border-color var(--transition-duration-2)}uc-slider-ui .uc-zero-dot{position:absolute;top:calc(100% - var(--l-zero-dot-offset) * 2);left:calc(var(--l-thumb-size) / 2 - var(--l-zero-dot-size) / 2);width:var(--l-zero-dot-size);height:var(--l-zero-dot-size);background-color:var(--color-primary-accent);border-radius:50%;opacity:0;transition:var(--transition-duration-3)}uc-slider-ui .uc-input{position:absolute;width:calc(100% - 10px);height:100%;margin:0;cursor:pointer;opacity:0}uc-presence-toggle.uc-transition{transition:opacity var(--transition-duration-3),visibility var(--transition-duration-3)}uc-presence-toggle.uc-visible{opacity:1;pointer-events:inherit}uc-presence-toggle.uc-hidden{opacity:0;pointer-events:none}uc-presence-toggle.uc-initial{display:none!important;transition:none!important}[uc-cloud-image-editor] [role=button]:focus-visible,[uc-cloud-image-editor] button:focus-visible{outline:1px auto -webkit-focus-ring-color}:where([uc-cloud-image-editor]) uc-icon{display:flex;align-items:center;justify-content:center;width:100%;height:100%}:where([uc-cloud-image-editor]) uc-icon svg{width:calc(var(--uc-button-size) / 2);height:calc(var(--uc-button-size) / 2)}uc-cloud-image-editor-activity{position:relative;display:flex;width:100%;height:100%;overflow:hidden;background-color:var(--uc-background)}[uc-modal]>dialog:has(uc-cloud-image-editor-activity[active]){width:100%;height:100%}uc-select{display:inline-flex}uc-select select{position:relative;display:inline-flex;align-items:center;justify-content:center;height:var(--uc-button-size);padding:0 14px;font-size:1em;font-family:inherit;white-space:nowrap;border:none;border-radius:var(--uc-radius);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color var(--uc-transition);color:var(--uc-secondary-foreground);background-color:var(--uc-secondary)}@keyframes uc-spinner-keyframes{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.uc-spinner{width:1em;height:1em;border:solid 2px transparent;border-top-color:currentColor;border-left-color:currentColor;border-radius:50%;animation:uc-spinner-keyframes .4s linear infinite}:where([uc-wgt-common]) uc-source-btn[type]{all:unset}.image-uploader[data-v-9e145607]{display:flex;align-items:center;justify-content:center;padding:24px 1px;border:1px dashed #e0e0e0;border-radius:6px;height:84px;position:relative}.image-uploader_empty-state[data-v-9e145607]{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;text-align:center;cursor:pointer}.image-uploader_empty-state_content[data-v-9e145607]{display:flex;flex-direction:column;align-items:center;gap:4px}.image-uploader_empty-state_title[data-v-9e145607]{font-family:Mulish;font-size:14px;font-weight:600;color:rgb(var(--color-gray-900))}.image-uploader_empty-state_title .icon[data-v-9e145607]{color:#1e90fa}.image-uploader_empty-state_subtitle[data-v-9e145607]{font-family:Mulish;font-size:12px;color:rgb(var(--color-gray-400))}.image-uploader.with-image[data-v-9e145607]{padding:0;height:84px}.image-uploader_icon-wrapper[data-v-9e145607]{display:flex;flex-direction:row;align-items:center;gap:10px}.image-uploader_image-wrapper[data-v-9e145607]{width:100%;height:84px;display:flex;align-items:center;justify-content:center;position:relative;background:#f5f5f5;border-radius:6px}.image-uploader_image-wrapper .uploaded-image[data-v-9e145607]{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;cursor:pointer}.image-uploader_image-wrapper-action-buttons[data-v-9e145607]{position:absolute;top:6px;right:6px;opacity:1;transition:opacity .2s ease-in-out;gap:4px}.image-uploader_image-wrapper-action-buttons[data-v-9e145607] .q-focus-helper{display:none}.image-uploader_image-wrapper-action-buttons[data-v-9e145607]>*{border-radius:4px;border:1px solid var(--Gray-200, #e0e0e0);background:#fff}.image-uploader_image-wrapper-action-buttons[data-v-9e145607]>*:hover{color:rgb(var(--color-primary-450))}.image-uploader_image-wrapper-action-buttons>*.remove[data-v-9e145607]:hover{color:rgb(var(--color-danger))}.add-edit-variable-modal[data-v-de0af38b]{width:452px;max-width:100%}.modal-content[data-v-de0af38b]{padding:24px}.form-fields[data-v-de0af38b]{display:flex;flex-direction:column;gap:20px}.field-item[data-v-de0af38b]{width:100%;display:flex;flex-direction:column;gap:8px}.field-label[data-v-de0af38b]{font-family:Mulish;font-size:13px;font-style:normal;font-weight:400;line-height:19px;color:rgb(var(--color-gray-500))}.basic-information-content[data-v-382ed1a2]{flex:1;display:flex;flex-direction:column;overflow:hidden}.content-header[data-v-382ed1a2]{display:flex;justify-content:space-between;align-items:center;padding:14px 24px}.title[data-v-382ed1a2]{font-size:14px;font-style:normal;font-weight:600;line-height:20px}.fields-container[data-v-382ed1a2]{flex:1;overflow-y:auto;padding:0 24px 24px;display:flex;flex-direction:column;gap:14px}.field-item[data-v-382ed1a2]{width:100%;display:flex;flex-direction:column;gap:8px}.field-header[data-v-382ed1a2]{display:flex;justify-content:space-between;align-items:center}.field-label[data-v-382ed1a2]{font-family:Mulish;font-size:13px;font-style:normal;font-weight:400;line-height:19px;color:rgb(var(--color-gray-500))}:root{--facebook-brand-color: #1877f2;--twitter-brand-color: #000000;--linkedin-brand-color: #0277b5;--instagram-brand-color: #e54260;--telegram-brand-color: #0088cc;--whatsapp-brand-color: #24d366;--google-maps-brand-color: #1a73e8;--rss-brand-color: #fe6500;--stack-overflow-brand-color: #f58025;--zillow-brand-color: #006aff;--youtube-brand-color: #ff130d;--vimeo-brand-color: #1ab7ea;--tiktok-brand-color: #000000;--apple-brand-color: #0169e2;--wordpress-brand-color: #21759b;--github-brand-color: #181717;--google-play-brand-color: #fabd05;--behance-brand-color: #1777f6;--reddit-alien-brand-color: #ff4500;--etsy-brand-color: #d5641b;--yelp-brand-color: #c41200;--ebay-brand-color: #ec5c5d;--amazon-brand-color: #ff9900;--imdb-brand-color: #f5c518;--snapchat-brand-color: #fffc00;--blogger-brand-color: #f67c01;
11944--medium-brand-color: #e03c40;--soundcloud-brand-color: #ff8800;--flickr-brand-color: #ff0084;--deviantart-brand-color: #09cc48;--meetup-brand-color: #e51937;--tumblr-brand-color: #36465d;--patreon-brand-color: #f96854;--upwork-brand-color: #77dc50;--pinterest-brand-color: #e60023;--slack-brand-color: #4a154b;--threads-brand-color: #000000}.social-links-content[data-v-fd2d92f1]{flex:1;display:flex;flex-direction:column;overflow:hidden}.content-header[data-v-fd2d92f1]{display:flex;justify-content:space-between;align-items:center;padding:14px 24px}.title[data-v-fd2d92f1]{font-size:14px;font-style:normal;font-weight:600;line-height:20px}.fields-container[data-v-fd2d92f1]{flex:1;overflow-y:auto;padding:0 24px 24px;display:flex;flex-direction:column;gap:24px}.field-item[data-v-fd2d92f1],.field-input[data-v-fd2d92f1]{width:100%}.field-input[data-v-fd2d92f1] .q-field__prepend{padding-right:8px}.field-input[data-v-fd2d92f1] .q-field__append{padding-left:8px}.field-icon[data-v-fd2d92f1]{width:20px;height:20px;object-fit:contain}.field-menu-button[data-v-fd2d92f1]{flex-shrink:0}.social-icons-menu[data-v-fd2d92f1]{width:352px;padding:14px 24px}.social-icons-menu-list[data-v-fd2d92f1]{display:grid;grid-template-columns:repeat(6,1fr);gap:22px;overflow-y:auto}.social-icons-menu-list-item[data-v-fd2d92f1]{display:flex;align-items:center;cursor:pointer;justify-content:center;width:32px;height:32px;border-radius:4px;transition:background-color .2s ease-in-out;position:relative}.social-icons-menu-list-item[data-v-fd2d92f1]:hover{background-color:rgb(var(--color-gray-100))}.social-icons-menu-list-item i[data-v-fd2d92f1]{font-size:18px;text-align:center}.social-icons-menu-list-item img[data-v-fd2d92f1]{width:18px;height:18px;object-fit:contain}i.fa-facebook-f[data-v-fd2d92f1]{color:var(--facebook-brand-color)}i.fa-x-twitter[data-v-fd2d92f1]{color:var(--twitter-brand-color)}i.fa-linkedin-in[data-v-fd2d92f1]{color:var(--linkedin-brand-color)}i.fa-instagram[data-v-fd2d92f1]{color:var(--instagram-brand-color)}i.fa-telegram[data-v-fd2d92f1]{color:var(--telegram-brand-color)}i.fa-whatsapp[data-v-fd2d92f1]{color:var(--whatsapp-brand-color)}i.fa-pinterest[data-v-fd2d92f1]{color:var(--pinterest-brand-color)}i.fa-slack[data-v-fd2d92f1]{color:var(--slack-brand-color)}i.fa-threads[data-v-fd2d92f1]{color:var(--threads-brand-color)}i.fa-youtube[data-v-fd2d92f1]{color:var(--youtube-brand-color)}i.fa-vimeo-v[data-v-fd2d92f1]{color:var(--vimeo-brand-color)}i.fa-tiktok[data-v-fd2d92f1]{color:var(--tiktok-brand-color)}i.fa-apple[data-v-fd2d92f1]{color:var(--apple-brand-color)}i.fa-wordpress[data-v-fd2d92f1]{color:var(--wordpress-brand-color)}i.fa-github[data-v-fd2d92f1]{color:var(--github-brand-color)}i.fa-google-play[data-v-fd2d92f1]{color:var(--google-play-brand-color)}i.fa-behance[data-v-fd2d92f1]{color:var(--behance-brand-color)}i.fa-reddit-alien[data-v-fd2d92f1]{color:var(--reddit-alien-brand-color)}i.fa-etsy[data-v-fd2d92f1]{color:var(--etsy-brand-color)}i.fa-yelp[data-v-fd2d92f1]{color:var(--yelp-brand-color)}i.fa-ebay[data-v-fd2d92f1]{color:var(--ebay-brand-color)}i.fa-amazon[data-v-fd2d92f1]{color:var(--amazon-brand-color)}i.fa-imdb[data-v-fd2d92f1]{color:var(--imdb-brand-color)}i.fa-snapchat[data-v-fd2d92f1]{color:var(--snapchat-brand-color)}i.fa-blogger-b[data-v-fd2d92f1]{color:var(--blogger-brand-color)}i.fa-medium[data-v-fd2d92f1]{color:var(--medium-brand-color)}i.fa-soundcloud[data-v-fd2d92f1]{color:var(--soundcloud-brand-color)}i.fa-flickr[data-v-fd2d92f1]{color:var(--flickr-brand-color)}i.fa-deviantart[data-v-fd2d92f1]{color:var(--deviantart-brand-color)}i.fa-meetup[data-v-fd2d92f1]{color:var(--meetup-brand-color)}i.fa-tumblr[data-v-fd2d92f1]{color:var(--tumblr-brand-color)}i.fa-patreon[data-v-fd2d92f1]{color:var(--patreon-brand-color)}i.fa-upwork[data-v-fd2d92f1]{color:var(--upwork-brand-color)}.company-brand-color-field[data-v-17d00c47]{position:relative}.company-brand-color-field-controls[data-v-17d00c47]{display:flex;align-items:center;gap:8px}.company-brand-color-field-swatch[data-v-17d00c47]{width:34px;height:34px;border:1px solid rgb(var(--color-gray-200));border-radius:3px;
11944cursor:pointer;padding:0;flex-shrink:0}.company-brand-color-field-input[data-v-17d00c47]{flex:1;min-width:0}.company-brand-color-field-input[data-v-17d00c47] .q-field__append{padding-left:8px}.company-brand-color-field-input[data-v-17d00c47] input{text-transform:uppercase}.company-brand-color-field-menu[data-v-17d00c47]{flex-shrink:0}.company-brand-color-field-popup[data-v-17d00c47]{position:absolute;top:calc(100% + 8px);left:0;z-index:100;min-width:225px}.company-brand-font-field[data-v-8533ea37],.company-brand-font-field[data-v-8533ea37] .font-family-select{width:100%}.ws-card-section[data-v-085fd11d]{display:flex;flex-direction:column;gap:6px;width:100%}.ws-card-section-title[data-v-085fd11d]{color:var(--Gray-400, #191c2b);font-family:Mulish;font-size:14px;font-style:normal;font-weight:700;line-height:20px;display:flex;justify-content:space-between}.ws-card-section-body[data-v-085fd11d]{margin:0;padding:0;display:flex;flex-direction:row;align-items:flex-start;align-content:flex-start;justify-content:space-between;flex-grow:1;gap:24px;width:100%}.ws-card-section-desc[data-v-085fd11d]{color:var(--Gray-400, #191c2b);font-family:Mulish;font-size:14px;font-style:normal;font-weight:400;line-height:20px;flex:1 1 0;min-width:0}.ws-card-section-control[data-v-085fd11d]{flex:2 1 0;min-width:0}@media only screen and (max-width:748px){.ws-card-section-body[data-v-085fd11d]{flex-direction:column}}.visual-assets-content[data-v-e834b13e]{flex:1;display:flex;flex-direction:column;overflow:hidden}.content-header[data-v-e834b13e]{display:flex;justify-content:space-between;align-items:center;padding:14px 24px}.title[data-v-e834b13e]{font-size:14px;font-style:normal;font-weight:600;line-height:20px}.fields-container[data-v-e834b13e]{flex:1;overflow-y:auto;padding:20px 24px 24px;display:flex;flex-direction:column;gap:14px}.field-item[data-v-e834b13e]{width:100%;display:flex;flex-direction:column;gap:8px}.section-header[data-v-e834b13e]{display:flex;justify-content:space-between;align-items:center;width:100%}.section-title[data-v-e834b13e]{font-family:Mulish;font-size:13px;font-style:normal;font-weight:600;line-height:19px;color:rgb(var(--color-gray-500));margin-bottom:0}.add-variable-label[data-v-e834b13e]{margin-left:6px}.section-field[data-v-e834b13e]{display:flex;flex-direction:column}.brand-colors-control[data-v-e834b13e]{display:flex;flex-direction:column;gap:4px;width:100%}.brand-color-field-row[data-v-e834b13e]{width:100%}.brand-color-field-row[data-v-e834b13e] .company-brand-color-field{min-width:0}.field-label[data-v-e834b13e]{font-family:Mulish;font-size:12px;font-weight:400;line-height:19px;color:rgb(var(--color-gray-700))}.visual-asset-field-footer[data-v-e834b13e]{display:flex;justify-content:space-between;align-items:center;min-height:32px}
11944.visual-asset-add-trigger[data-v-e834b13e]{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;height:40px;padding:0 16px;border:1px dashed rgb(var(--color-gray-200));border-radius:6px;background:#fff;cursor:pointer;font-family:Mulish;font-size:14px;font-weight:600;line-height:20px;color:rgb(var(--color-primary-450))}.visual-asset-add-trigger_icon[data-v-e834b13e]{font-size:16px}.visual-asset-add-trigger--color[data-v-e834b13e]{justify-content:flex-start;height:auto;padding:8px 0 0;border:none;font-size:13px;line-height:19px}.visual-asset-add-trigger--color .visual-asset-add-trigger_icon[data-v-e834b13e]{font-size:12px;width:12px;height:12px}.company-profile-dialog[data-v-754652f4]{width:700px;height:567px;display:flex;flex-direction:column}.dialog-content[data-v-754652f4]{flex:1;overflow:hidden;padding:0}.dialog-layout[data-v-754652f4]{display:flex;height:100%}.content-area[data-v-754652f4]{flex:1;display:flex;flex-direction:column;overflow:hidden}')),document.head.appendChild(r)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.