vendor: 1,657 bytes, lines 1-36
1"use strict"; 2(() => { 3 var __create = Object.create; 4 var __defProp = Object.defineProperty; 5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6 var __getOwnPropNames = Object.getOwnPropertyNames; 7 var __getProtoOf = Object.getPrototypeOf; 8 var __hasOwnProp = Object.prototype.hasOwnProperty; 9 var __esm = (fn, res) => function __init() { 10 return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res; 11 }; 12 var __commonJS = (cb, mod) => function __require() { 13 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 14 }; 15 var __export = (target, all) => { 16 for (var name in all) 17 __defProp(target, name, { get: all[name], enumerable: true }); 18 }; 19 var __copyProps = (to, from, except, desc) => { 20 if (from && typeof from === "object" || typeof from === "function") { 21 for (let key of __getOwnPropNames(from)) 22 if (!__hasOwnProp.call(to, key) && key !== except) 23 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 24 } 25 return to; 26 }; 27 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 28 // If the importer is in node compatibility mode or this is not an ESM 29 // file that has been converted to a CommonJS file using a Babel- 30 // compatible transform (i.e. "__esModule" has not been set), then set 31 // "default" to the CommonJS "module.exports" for node compatibility. 32 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 33 mod 34 )); 35 36
vendor: 20,655 bytes, lines 36-532
36// node_modules/@capacitor/core/dist/index.js 37 var dist_exports = {}; 38 __export(dist_exports, { 39 Capacitor: () => Capacitor, 40 CapacitorCookies: () => CapacitorCookies, 41 CapacitorException: () => CapacitorException, 42 CapacitorHttp: () => CapacitorHttp, 43 ExceptionCode: () => ExceptionCode, 44 WebPlugin: () => WebPlugin, 45 WebView: () => WebView, 46 buildRequestInit: () => buildRequestInit, 47 registerPlugin: () => registerPlugin 48 }); 49 var ExceptionCode, CapacitorException, getPlatformId, createCapacitor, initCapacitorGlobal, Capacitor, registerPlugin, WebPlugin, WebView, encode, decode, CapacitorCookiesPluginWeb, CapacitorCookies, readBlobAsBase64, normalizeHttpHeaders, buildUrlParams, buildRequestInit, CapacitorHttpPluginWeb, CapacitorHttp; 50 var init_dist = __esm({ 51 "node_modules/@capacitor/core/dist/index.js"() { 52 (function(ExceptionCode2) { 53 ExceptionCode2["Unimplemented"] = "UNIMPLEMENTED"; 54 ExceptionCode2["Unavailable"] = "UNAVAILABLE"; 55 })(ExceptionCode || (ExceptionCode = {})); 56 CapacitorException = class extends Error { 57 constructor(message, code, data) { 58 super(message); 59 this.message = message; 60 this.code = code; 61 this.data = data; 62 } 63 }; 64 getPlatformId = (win) => { 65 var _a, _b; 66 if (win === null || win === void 0 ? void 0 : win.androidBridge) { 67 return "android"; 68 } else if ((_b = (_a = win === null || win === void 0 ? void 0 : win.webkit) === null || _a === void 0 ? void 0 : _a.messageHandlers) === null || _b === void 0 ? void 0 : _b.bridge) { 69 return "ios"; 70 } else { 71 return "web"; 72 } 73 }; 74 createCapacitor = (win) => { 75 const capCustomPlatform = win.CapacitorCustomPlatform || null; 76 const cap = win.Capacitor || {}; 77 const Plugins = cap.Plugins = cap.Plugins || {}; 78 const getPlatform = () => { 79 return capCustomPlatform !== null ? capCustomPlatform.name : getPlatformId(win); 80 }; 81 const isNativePlatform = () => getPlatform() !== "web"; 82 const isPluginAvailable = (pluginName) => { 83 const plugin = registeredPlugins.get(pluginName); 84 if (plugin === null || plugin === void 0 ? void 0 : plugin.platforms.has(getPlatform())) { 85 return true; 86 } 87 if (getPluginHeader(pluginName)) { 88 return true; 89 } 90 return false; 91 }; 92 const getPluginHeader = (pluginName) => { 93 var _a; 94 return (_a = cap.PluginHeaders) === null || _a === void 0 ? void 0 : _a.find((h) => h.name === pluginName); 95 }; 96 const handleError = (err) => win.console.error(err); 97 const registeredPlugins = /* @__PURE__ */ new Map(); 98 const registerPlugin2 = (pluginName, jsImplementations = {}) => { 99 const registeredPlugin = registeredPlugins.get(pluginName); 100 if (registeredPlugin) { 101 console.warn(`Capacitor plugin "${pluginName}" already registered. Cannot register plugins twice.`); 102 return registeredPlugin.proxy; 103 } 104 const platform = getPlatform(); 105 const pluginHeader = getPluginHeader(pluginName); 106 let jsImplementation; 107 const loadPluginImplementation = async () => { 108 if (!jsImplementation && platform in jsImplementations) { 109 jsImplementation = typeof jsImplementations[platform] === "function" ? jsImplementation = await jsImplementations[platform]() : jsImplementation = jsImplementations[platform]; 110 } else if (capCustomPlatform !== null && !jsImplementation && "web" in jsImplementations) { 111 jsImplementation = typeof jsImplementations["web"] === "function" ? jsImplementation = await jsImplementations["web"]() : jsImplementation = jsImplementations["web"]; 112 } 113 return jsImplementation; 114 }; 115 const createPluginMethod = (impl, prop) => { 116 var _a, _b; 117 if (pluginHeader) { 118 const methodHeader = pluginHeader === null || pluginHeader === void 0 ? void 0 : pluginHeader.methods.find((m) => prop === m.name); 119 if (methodHeader) { 120 if (methodHeader.rtype === "promise") { 121 return (options) => cap.nativePromise(pluginName, prop.toString(), options); 122 } else { 123 return (options, callback) => cap.nativeCallback(pluginName, prop.toString(), options, callback); 124 } 125 } else if (impl) { 126 return (_a = impl[prop]) === null || _a === void 0 ? void 0 : _a.bind(impl); 127 } 128 } else if (impl) { 129 return (_b = impl[prop]) === null || _b === void 0 ? void 0 : _b.bind(impl); 130 } else { 131 throw new CapacitorException(`"${pluginName}" plugin is not implemented on ${platform}`, ExceptionCode.Unimplemented); 132 } 133 }; 134 const createPluginMethodWrapper = (prop) => { 135 let remove; 136 const wrapper = (...args) => { 137 const p = loadPluginImplementation().then((impl) => { 138 const fn = createPluginMethod(impl, prop); 139 if (fn) { 140 const p2 = fn(...args); 141 remove = p2 === null || p2 === void 0 ? void 0 : p2.remove; 142 return p2; 143 } else { 144 throw new CapacitorException(`"${pluginName}.${prop}()" is not implemented on ${platform}`, ExceptionCode.Unimplemented); 145 } 146 }); 147 if (prop === "addListener") { 148 p.remove = async () => remove(); 149 } 150 return p; 151 }; 152 wrapper.toString = () => `${prop.toString()}() { [capacitor code] }`; 153 Object.defineProperty(wrapper, "name", { 154 value: prop, 155 writable: false, 156 configurable: false 157 }); 158 return wrapper; 159 }; 160 const addListener = createPluginMethodWrapper("addListener"); 161 const removeListener = createPluginMethodWrapper("removeListener"); 162 const addListenerNative = (eventName, callback) => { 163 const call = addListener({ eventName }, callback); 164 const remove = async () => { 165 const callbackId = await call; 166 removeListener({ 167 eventName, 168 callbackId 169 }, callback); 170 }; 171 const p = new Promise((resolve) => call.then(() => resolve({ remove }))); 172 p.remove = async () => { 173 console.warn(`Using addListener() without 'await' is deprecated.`); 174 await remove(); 175 }; 176 return p; 177 }; 178 const proxy = new Proxy({}, { 179 get(_, prop) { 180 switch (prop) { 181 // https://github.com/facebook/react/issues/20030 182 case "$$typeof": 183 return void 0; 184 case "toJSON": 185 return () => ({}); 186 case "addListener": 187 return pluginHeader ? addListenerNative : addListener; 188 case "removeListener": 189 return removeListener; 190 default: 191 return createPluginMethodWrapper(prop); 192 } 193 } 194 }); 195 Plugins[pluginName] = proxy; 196 registeredPlugins.set(pluginName, { 197 name: pluginName, 198 proxy, 199 platforms: /* @__PURE__ */ new Set([...Object.keys(jsImplementations), ...pluginHeader ? [platform] : []]) 200 }); 201 return proxy; 202 }; 203 if (!cap.convertFileSrc) { 204 cap.convertFileSrc = (filePath) => filePath; 205 } 206 cap.getPlatform = getPlatform; 207 cap.handleError = handleError; 208 cap.isNativePlatform = isNativePlatform; 209 cap.isPluginAvailable = isPluginAvailable; 210 cap.registerPlugin = registerPlugin2; 211 cap.Exception = CapacitorException; 212 cap.DEBUG = !!cap.DEBUG; 213 cap.isLoggingEnabled = !!cap.isLoggingEnabled; 214 return cap; 215 }; 216 initCapacitorGlobal = (win) => win.Capacitor = createCapacitor(win); 217 Capacitor = /* @__PURE__ */ initCapacitorGlobal(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}); 218 registerPlugin = Capacitor.registerPlugin; 219 WebPlugin = class { 220 constructor() { 221 this.listeners = {}; 222 this.retainedEventArguments = {}; 223 this.windowListeners = {}; 224 } 225 addListener(eventName, listenerFunc) { 226 let firstListener = false; 227 const listeners = this.listeners[eventName]; 228 if (!listeners) { 229 this.listeners[eventName] = []; 230 firstListener = true; 231 } 232 this.listeners[eventName].push(listenerFunc); 233 const windowListener = this.windowListeners[eventName]; 234 if (windowListener && !windowListener.registered) { 235 this.addWindowListener(windowListener); 236 } 237 if (firstListener) { 238 this.sendRetainedArgumentsForEvent(eventName); 239 } 240 const remove = async () => this.removeListener(eventName, listenerFunc); 241 const p = Promise.resolve({ remove }); 242 return p; 243 } 244 async removeAllListeners() { 245 this.listeners = {}; 246 for (const listener in this.windowListeners) { 247 this.removeWindowListener(this.windowListeners[listener]); 248 } 249 this.windowListeners = {}; 250 } 251 notifyListeners(eventName, data, retainUntilConsumed) { 252 const listeners = this.listeners[eventName]; 253 if (!listeners) { 254 if (retainUntilConsumed) { 255 let args = this.retainedEventArguments[eventName]; 256 if (!args) { 257 args = []; 258 } 259 args.push(data); 260 this.retainedEventArguments[eventName] = args; 261 } 262 return; 263 } 264 listeners.forEach((listener) => listener(data)); 265 } 266 hasListeners(eventName) { 267 var _a; 268 return !!((_a = this.listeners[eventName]) === null || _a === void 0 ? void 0 : _a.length); 269 } 270 registerWindowListener(windowEventName, pluginEventName) { 271 this.windowListeners[pluginEventName] = { 272 registered: false, 273 windowEventName, 274 pluginEventName, 275 handler: (event) => { 276 this.notifyListeners(pluginEventName, event); 277 } 278 }; 279 } 280 unimplemented(msg = "not implemented") { 281 return new Capacitor.Exception(msg, ExceptionCode.Unimplemented); 282 } 283 unavailable(msg = "not available") { 284 return new Capacitor.Exception(msg, ExceptionCode.Unavailable); 285 } 286 async removeListener(eventName, listenerFunc) { 287 const listeners = this.listeners[eventName]; 288 if (!listeners) { 289 return; 290 } 291 const index = listeners.indexOf(listenerFunc); 292 this.listeners[eventName].splice(index, 1); 293 if (!this.listeners[eventName].length) { 294 this.removeWindowListener(this.windowListeners[eventName]); 295 } 296 } 297 addWindowListener(handle) { 298 window.addEventListener(handle.windowEventName, handle.handler); 299 handle.registered = true; 300 } 301 removeWindowListener(handle) { 302 if (!handle) { 303 return; 304 } 305 window.removeEventListener(handle.windowEventName, handle.handler); 306 handle.registered = false; 307 } 308 sendRetainedArgumentsForEvent(eventName) { 309 const args = this.retainedEventArguments[eventName]; 310 if (!args) { 311 return; 312 } 313 delete this.retainedEventArguments[eventName]; 314 args.forEach((arg) => { 315 this.notifyListeners(eventName, arg); 316 }); 317 } 318 }; 319 WebView = /* @__PURE__ */ registerPlugin("WebView"); 320 encode = (str) => encodeURIComponent(str).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape); 321 decode = (str) => str.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent); 322 CapacitorCookiesPluginWeb = class extends WebPlugin { 323 async getCookies() { 324 const cookies = document.cookie; 325 const cookieMap = {}; 326 cookies.split(";").forEach((cookie) => { 327 if (cookie.length <= 0) 328 return; 329 let [key, value] = cookie.replace(/=/, "CAP_COOKIE").split("CAP_COOKIE"); 330 key = decode(key).trim(); 331 value = decode(value).trim(); 332 cookieMap[key] = value; 333 }); 334 return cookieMap; 335 } 336 async setCookie(options) { 337 try { 338 const encodedKey = encode(options.key); 339 const encodedValue = encode(options.value); 340 const expires = options.expires ? `; expires=${options.expires.replace("expires=", "")}` : ""; 341 const path = (options.path || "/").replace("path=", ""); 342 const domain = options.url != null && options.url.length > 0 ? `domain=${options.url}` : ""; 343 document.cookie = `${encodedKey}=${encodedValue || ""}${expires}; path=${path}; ${domain};`; 344 } catch (error) { 345 return Promise.reject(error); 346 } 347 } 348 async deleteCookie(options) { 349 try { 350 document.cookie = `${options.key}=; Max-Age=0`; 351 } catch (error) { 352 return Promise.reject(error); 353 } 354 } 355 async clearCookies() { 356 try { 357 const cookies = document.cookie.split(";") || []; 358 for (const cookie of cookies) { 359 document.cookie = cookie.replace(/^ +/, "").replace(/=.*/, `=;expires=${(/* @__PURE__ */ new Date()).toUTCString()};path=/`); 360 } 361 } catch (error) { 362 return Promise.reject(error); 363 } 364 } 365 async clearAllCookies() { 366 try { 367 await this.clearCookies(); 368 } catch (error) { 369 return Promise.reject(error); 370 } 371 } 372 }; 373 CapacitorCookies = registerPlugin("CapacitorCookies", { 374 web: () => new CapacitorCookiesPluginWeb() 375 }); 376 readBlobAsBase64 = async (blob) => new Promise((resolve, reject) => { 377 const reader = new FileReader(); 378 reader.onload = () => { 379 const base64String = reader.result; 380 resolve(base64String.indexOf(",") >= 0 ? base64String.split(",")[1] : base64String); 381 }; 382 reader.onerror = (error) => reject(error); 383 reader.readAsDataURL(blob); 384 }); 385 normalizeHttpHeaders = (headers = {}) => { 386 const originalKeys = Object.keys(headers); 387 const loweredKeys = Object.keys(headers).map((k) => k.toLocaleLowerCase()); 388 const normalized = loweredKeys.reduce((acc, key, index) => { 389 acc[key] = headers[originalKeys[index]]; 390 return acc; 391 }, {}); 392 return normalized; 393 }; 394 buildUrlParams = (params, shouldEncode = true) => { 395 if (!params) 396 return null; 397 const output = Object.entries(params).reduce((accumulator, entry) => { 398 const [key, value] = entry; 399 let encodedValue; 400 let item; 401 if (Array.isArray(value)) { 402 item = ""; 403 value.forEach((str) => { 404 encodedValue = shouldEncode ? encodeURIComponent(str) : str; 405 item += `${key}=${encodedValue}&`; 406 }); 407 item.slice(0, -1); 408 } else { 409 encodedValue = shouldEncode ? encodeURIComponent(value) : value; 410 item = `${key}=${encodedValue}`; 411 } 412 return `${accumulator}&${item}`; 413 }, ""); 414 return output.substr(1); 415 }; 416 buildRequestInit = (options, extra = {}) => { 417 const output = Object.assign({ method: options.method || "GET", headers: options.headers }, extra); 418 const headers = normalizeHttpHeaders(options.headers); 419 const type = headers["content-type"] || ""; 420 if (typeof options.data === "string") { 421 output.body = options.data; 422 } else if (type.includes("application/x-www-form-urlencoded")) { 423 const params = new URLSearchParams(); 424 for (const [key, value] of Object.entries(options.data || {})) { 425 params.set(key, value); 426 } 427 output.body = params.toString(); 428 } else if (type.includes("multipart/form-data") || options.data instanceof FormData) { 429 const form = new FormData(); 430 if (options.data instanceof FormData) { 431 options.data.forEach((value, key) => { 432 form.append(key, value); 433 }); 434 } else { 435 for (const key of Object.keys(options.data)) { 436 form.append(key, options.data[key]); 437 } 438 } 439 output.body = form; 440 const headers2 = new Headers(output.headers); 441 headers2.delete("content-type"); 442 output.headers = headers2; 443 } else if (type.includes("application/json") || typeof options.data === "object") { 444 output.body = JSON.stringify(options.data); 445 } 446 return output; 447 }; 448 CapacitorHttpPluginWeb = class extends WebPlugin { 449 /** 450 * Perform an Http request given a set of options 451 * @param options Options to build the HTTP request 452 */ 453 async request(options) { 454 const requestInit = buildRequestInit(options, options.webFetchExtra); 455 const urlParams = buildUrlParams(options.params, options.shouldEncodeUrlParams); 456 const url = urlParams ? `${options.url}?${urlParams}` : options.url; 457 const response = await fetch(url, requestInit); 458 const contentType = response.headers.get("content-type") || ""; 459 let { responseType = "text" } = response.ok ? options : {}; 460 if (contentType.includes("application/json")) { 461 responseType = "json"; 462 } 463 let data; 464 let blob; 465 switch (responseType) { 466 case "arraybuffer": 467 case "blob": 468 blob = await response.blob(); 469 data = await readBlobAsBase64(blob); 470 break; 471 case "json": 472 data = await response.json(); 473 break; 474 case "document": 475 case "text": 476 default: 477 data = await response.text(); 478 } 479 const headers = {}; 480 response.headers.forEach((value, key) => { 481 headers[key] = value; 482 }); 483 return { 484 data, 485 headers, 486 status: response.status, 487 url: response.url 488 }; 489 } 490 /** 491 * Perform an Http GET request given a set of options 492 * @param options Options to build the HTTP request 493 */ 494 async get(options) { 495 return this.request(Object.assign(Object.assign({}, options), { method: "GET" })); 496 } 497 /** 498 * Perform an Http POST request given a set of options 499 * @param options Options to build the HTTP request 500 */ 501 async post(options) { 502 return this.request(Object.assign(Object.assign({}, options), { method: "POST" })); 503 } 504 /** 505 * Perform an Http PUT request given a set of options 506 * @param options Options to build the HTTP request 507 */ 508 async put(options) { 509 return this.request(Object.assign(Object.assign({}, options), { method: "PUT" })); 510 } 511 /** 512 * Perform an Http PATCH request given a set of options 513 * @param options Options to build the HTTP request 514 */ 515 async patch(options) { 516 return this.request(Object.assign(Object.assign({}, options), { method: "PATCH" })); 517 } 518 /** 519 * Perform an Http DELETE request given a set of options 520 * @param options Options to build the HTTP request 521 */ 522 async delete(options) { 523 return this.request(Object.assign(Object.assign({}, options), { method: "DELETE" })); 524 } 525 }; 526 CapacitorHttp = registerPlugin("CapacitorHttp", { 527 web: () => new CapacitorHttpPluginWeb() 528 }); 529 } 530 }); 531 532
vendor: 181 bytes, lines 532-538
532// node_modules/@capacitor/preferences/dist/esm/definitions.js 533 var init_definitions = __esm({ 534 "node_modules/@capacitor/preferences/dist/esm/definitions.js"() { 535 } 536 }); 537 538
vendor: 2,609 bytes, lines 538-618
538// node_modules/@capacitor/preferences/dist/esm/web.js 539 var web_exports = {}; 540 __export(web_exports, { 541 PreferencesWeb: () => PreferencesWeb 542 }); 543 var PreferencesWeb; 544 var init_web = __esm({ 545 "node_modules/@capacitor/preferences/dist/esm/web.js"() { 546 init_dist(); 547 PreferencesWeb = class extends WebPlugin { 548 constructor() { 549 super(...arguments); 550 this.group = "CapacitorStorage"; 551 } 552 async configure({ group }) { 553 if (typeof group === "string") { 554 this.group = group; 555 } 556 } 557 async get(options) { 558 const value = this.impl.getItem(this.applyPrefix(options.key)); 559 return { value }; 560 } 561 async set(options) { 562 this.impl.setItem(this.applyPrefix(options.key), options.value); 563 } 564 async remove(options) { 565 this.impl.removeItem(this.applyPrefix(options.key)); 566 } 567 async keys() { 568 const keys = this.rawKeys().map((k) => k.substring(this.prefix.length)); 569 return { keys }; 570 } 571 async clear() { 572 for (const key of this.rawKeys()) { 573 this.impl.removeItem(key); 574 } 575 } 576 async migrate() { 577 var _a; 578 const migrated = []; 579 const existing = []; 580 const oldprefix = "_cap_"; 581 const keys = Object.keys(this.impl).filter((k) => k.indexOf(oldprefix) === 0); 582 for (const oldkey of keys) { 583 const key = oldkey.substring(oldprefix.length); 584 const value = (_a = this.impl.getItem(oldkey)) !== null && _a !== void 0 ? _a : ""; 585 const { value: currentValue } = await this.get({ key }); 586 if (typeof currentValue === "string") { 587 existing.push(key); 588 } else { 589 await this.set({ key, value }); 590 migrated.push(key); 591 } 592 } 593 return { migrated, existing }; 594 } 595 async removeOld() { 596 const oldprefix = "_cap_"; 597 const keys = Object.keys(this.impl).filter((k) => k.indexOf(oldprefix) === 0); 598 for (const oldkey of keys) { 599 this.impl.removeItem(oldkey); 600 } 601 } 602 get impl() { 603 return window.localStorage; 604 } 605 get prefix() { 606 return this.group === "NativeStorage" ? "" : `${this.group}.`; 607 } 608 rawKeys() { 609 return Object.keys(this.impl).filter((k) => k.indexOf(this.prefix) === 0); 610 } 611 applyPrefix(key) { 612 return this.prefix + key; 613 } 614 }; 615 } 616 }); 617 618
vendor: 489 bytes, lines 618-634
618// node_modules/@capacitor/preferences/dist/esm/index.js 619 var esm_exports = {}; 620 __export(esm_exports, { 621 Preferences: () => Preferences 622 }); 623 var Preferences; 624 var init_esm = __esm({ 625 "node_modules/@capacitor/preferences/dist/esm/index.js"() { 626 init_dist(); 627 init_definitions(); 628 Preferences = registerPlugin("Preferences", { 629 web: () => Promise.resolve().then(() => (init_web(), web_exports)).then((m) => new m.PreferencesWeb()) 630 }); 631 } 632 }); 633 634
vendor: 166 bytes, lines 634-640
634// node_modules/@capacitor/app/dist/esm/definitions.js 635 var init_definitions2 = __esm({ 636 "node_modules/@capacitor/app/dist/esm/definitions.js"() { 637 } 638 }); 639 640
vendor: 1,412 bytes, lines 640-687
640// node_modules/@capacitor/app/dist/esm/web.js 641 var web_exports2 = {}; 642 __export(web_exports2, { 643 AppWeb: () => AppWeb 644 }); 645 var AppWeb; 646 var init_web2 = __esm({ 647 "node_modules/@capacitor/app/dist/esm/web.js"() { 648 init_dist(); 649 AppWeb = class extends WebPlugin { 650 constructor() { 651 super(); 652 this.handleVisibilityChange = () => { 653 const data = { 654 isActive: document.hidden !== true 655 }; 656 this.notifyListeners("appStateChange", data); 657 if (document.hidden) { 658 this.notifyListeners("pause", null); 659 } else { 660 this.notifyListeners("resume", null); 661 } 662 }; 663 document.addEventListener("visibilitychange", this.handleVisibilityChange, false); 664 } 665 exitApp() { 666 throw this.unimplemented("Not implemented on web."); 667 } 668 async getInfo() { 669 throw this.unimplemented("Not implemented on web."); 670 } 671 async getLaunchUrl() { 672 return { url: "" }; 673 } 674 async getState() { 675 return { isActive: document.hidden !== true }; 676 } 677 async minimizeApp() { 678 throw this.unimplemented("Not implemented on web."); 679 } 680 async toggleBackButtonHandler() { 681 throw this.unimplemented("Not implemented on web."); 682 } 683 }; 684 } 685 }); 686 687
vendor: 431 bytes, lines 687-703
687// node_modules/@capacitor/app/dist/esm/index.js 688 var esm_exports2 = {}; 689 __export(esm_exports2, { 690 App: () => App 691 }); 692 var App; 693 var init_esm2 = __esm({ 694 "node_modules/@capacitor/app/dist/esm/index.js"() { 695 init_dist(); 696 init_definitions2(); 697 App = registerPlugin("App", { 698 web: () => Promise.resolve().then(() => (init_web2(), web_exports2)).then((m) => new m.AppWeb()) 699 }); 700 } 701 }); 702 703
vendor: 3,991 bytes, lines 703-804
703// node_modules/scriptjs/dist/script.js 704 var require_script = __commonJS({ 705 "node_modules/scriptjs/dist/script.js"(exports, module) { 706 (function(name, definition) { 707 if (typeof module != "undefined" && module.exports) module.exports = definition(); 708 else if (typeof define == "function" && define.amd) define(definition); 709 else this[name] = definition(); 710 })("$script", function() { 711 var doc = document, head = doc.getElementsByTagName("head")[0], s = "string", f = false, push = "push", readyState = "readyState", onreadystatechange = "onreadystatechange", list = {}, ids = {}, delay = {}, scripts = {}, scriptpath, urlArgs; 712 function every(ar, fn) { 713 for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f; 714 return 1; 715 } 716 function each(ar, fn) { 717 every(ar, function(el) { 718 fn(el); 719 return 1; 720 }); 721 } 722 function $script2(paths, idOrDone, optDone) { 723 paths = paths[push] ? paths : [paths]; 724 var idOrDoneIsDone = idOrDone && idOrDone.call, done = idOrDoneIsDone ? idOrDone : optDone, id = idOrDoneIsDone ? paths.join("") : idOrDone, queue = paths.length; 725 function loopFn(item) { 726 return item.call ? item() : list[item]; 727 } 728 function callback() { 729 if (!--queue) { 730 list[id] = 1; 731 done && done(); 732 for (var dset in delay) { 733 every(dset.split("|"), loopFn) && !each(delay[dset], loopFn) && (delay[dset] = []); 734 } 735 } 736 } 737 setTimeout(function() { 738 each(paths, function loading(path, force) { 739 if (path === null) return callback(); 740 if (!force && !/^https?:\/\//.test(path) && scriptpath) { 741 path = path.indexOf(".js") === -1 ? scriptpath + path + ".js" : scriptpath + path; 742 } 743 if (scripts[path]) { 744 if (id) ids[id] = 1; 745 return scripts[path] == 2 ? callback() : setTimeout(function() { 746 loading(path, true); 747 }, 0); 748 } 749 scripts[path] = 1; 750 if (id) ids[id] = 1; 751 create(path, callback); 752 }); 753 }, 0); 754 return $script2; 755 } 756 function create(path, fn) { 757 var el = doc.createElement("script"), loaded; 758 el.onload = el.onerror = el[onreadystatechange] = function() { 759 if (el[readyState] && !/^c|loade/.test(el[readyState]) || loaded) return; 760 el.onload = el[onreadystatechange] = null; 761 loaded = 1; 762 scripts[path] = 2; 763 fn(); 764 }; 765 el.async = 1; 766 el.src = urlArgs ? path + (path.indexOf("?") === -1 ? "?" : "&") + urlArgs : path; 767 head.insertBefore(el, head.lastChild); 768 } 769 $script2.get = create; 770 $script2.order = function(scripts2, id, done) { 771 (function callback(s2) { 772 s2 = scripts2.shift(); 773 !scripts2.length ? $script2(s2, id, done) : $script2(s2, callback); 774 })(); 775 }; 776 $script2.path = function(p) { 777 scriptpath = p; 778 }; 779 $script2.urlArgs = function(str) { 780 urlArgs = str; 781 }; 782 $script2.ready = function(deps, ready, req) { 783 deps = deps[push] ? deps : [deps]; 784 var missing = []; 785 !each(deps, function(dep) { 786 list[dep] || missing[push](dep); 787 }) && every(deps, function(dep) { 788 return list[dep]; 789 }) ? ready() : !(function(key) { 790 delay[key] = delay[key] || []; 791 delay[key][push](ready); 792 req && req(missing); 793 })(deps.join("|")); 794 return $script2; 795 }; 796 $script2.done = function(idOrDone) { 797 $script2([null], idOrDone); 798 }; 799 return $script2; 800 }); 801 } 802 }); 803 804
vendor: 3,031 bytes, lines 804-877
804// node_modules/@capacitor-community/apple-sign-in/dist/esm/web.js 805 var web_exports3 = {}; 806 __export(web_exports3, { 807 SignInWithAppleWeb: () => SignInWithAppleWeb 808 }); 809 var $script, SignInWithAppleWeb; 810 var init_web3 = __esm({ 811 "node_modules/@capacitor-community/apple-sign-in/dist/esm/web.js"() { 812 init_dist(); 813 $script = __toESM(require_script()); 814 SignInWithAppleWeb = class extends WebPlugin { 815 constructor() { 816 super(...arguments); 817 this.appleScriptUrl = "https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"; 818 this.isAppleScriptLoaded = false; 819 } 820 async authorize(options) { 821 return new Promise((resolve, reject) => { 822 if (options) { 823 this.loadSignInWithAppleJS().then((loaded) => { 824 var _a, _b, _c; 825 this.isAppleScriptLoaded = loaded; 826 if (this.isAppleScriptLoaded) { 827 AppleID.auth.init({ 828 clientId: options.clientId, 829 redirectURI: options.redirectURI, 830 scope: (_a = options.scopes) !== null && _a !== void 0 ? _a : void 0, 831 state: (_b = options.state) !== null && _b !== void 0 ? _b : void 0, 832 nonce: (_c = options.nonce) !== null && _c !== void 0 ? _c : void 0, 833 usePopup: true 834 }); 835 AppleID.auth.signIn().then((res) => { 836 var _a2, _b2, _c2, _d, _e; 837 const response = { 838 response: { 839 user: null, 840 email: (_a2 = res.user) === null || _a2 === void 0 ? void 0 : _a2.email, 841 givenName: (_c2 = (_b2 = res.user) === null || _b2 === void 0 ? void 0 : _b2.name) === null || _c2 === void 0 ? void 0 : _c2.firstName, 842 familyName: (_e = (_d = res.user) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.lastName, 843 identityToken: res.authorization.id_token, 844 authorizationCode: res.authorization.code 845 } 846 }; 847 resolve(response); 848 }).catch((err) => { 849 reject(err); 850 }); 851 } else { 852 reject("Unable to load Sign in with Apple JS framework."); 853 } 854 }); 855 } else { 856 reject("No options were provided."); 857 } 858 }); 859 } 860 loadSignInWithAppleJS() { 861 return new Promise((resolve) => { 862 if (!this.isAppleScriptLoaded) { 863 if (typeof window !== void 0) { 864 $script.get(this.appleScriptUrl, () => resolve(true)); 865 } else { 866 resolve(false); 867 } 868 } else { 869 resolve(true); 870 } 871 }); 872 } 873 }; 874 } 875 }); 876 877
vendor: 496 bytes, lines 877-897
877// node_modules/@capacitor/splash-screen/dist/esm/web.js 878 var web_exports4 = {}; 879 __export(web_exports4, { 880 SplashScreenWeb: () => SplashScreenWeb 881 }); 882 var SplashScreenWeb; 883 var init_web4 = __esm({ 884 "node_modules/@capacitor/splash-screen/dist/esm/web.js"() { 885 init_dist(); 886 SplashScreenWeb = class extends WebPlugin { 887 async show(_options) { 888 return void 0; 889 } 890 async hide(_options) { 891 return void 0; 892 } 893 }; 894 } 895 }); 896 897
vendor: 897 bytes, lines 897-929
897// node_modules/@capacitor/share/dist/esm/web.js 898 var web_exports5 = {}; 899 __export(web_exports5, { 900 ShareWeb: () => ShareWeb 901 }); 902 var ShareWeb; 903 var init_web5 = __esm({ 904 "node_modules/@capacitor/share/dist/esm/web.js"() { 905 init_dist(); 906 ShareWeb = class extends WebPlugin { 907 async canShare() { 908 if (typeof navigator === "undefined" || !navigator.share) { 909 return { value: false }; 910 } else { 911 return { value: true }; 912 } 913 } 914 async share(options) { 915 if (typeof navigator === "undefined" || !navigator.share) { 916 throw this.unavailable("Share API not available in this browser"); 917 } 918 await navigator.share({ 919 title: options.title, 920 text: options.text, 921 url: options.url 922 }); 923 return {}; 924 } 925 }; 926 } 927 }); 928 929
vendor: 2,618 bytes, lines 929-1017
929// node_modules/@capacitor/network/dist/esm/web.js 930 var web_exports6 = {}; 931 __export(web_exports6, { 932 Network: () => Network, 933 NetworkWeb: () => NetworkWeb 934 }); 935 function translatedConnection() { 936 const connection = window.navigator.connection || window.navigator.mozConnection || window.navigator.webkitConnection; 937 let result = "unknown"; 938 const type = connection ? connection.type || connection.effectiveType : null; 939 if (type && typeof type === "string") { 940 switch (type) { 941 // possible type values 942 case "bluetooth": 943 case "cellular": 944 result = "cellular"; 945 break; 946 case "none": 947 result = "none"; 948 break; 949 case "ethernet": 950 case "wifi": 951 case "wimax": 952 result = "wifi"; 953 break; 954 case "other": 955 case "unknown": 956 result = "unknown"; 957 break; 958 // possible effectiveType values 959 case "slow-2g": 960 case "2g": 961 case "3g": 962 result = "cellular"; 963 break; 964 case "4g": 965 result = "wifi"; 966 break; 967 default: 968 break; 969 } 970 } 971 return result; 972 } 973 var NetworkWeb, Network; 974 var init_web6 = __esm({ 975 "node_modules/@capacitor/network/dist/esm/web.js"() { 976 init_dist(); 977 NetworkWeb = class extends WebPlugin { 978 constructor() { 979 super(); 980 this.handleOnline = () => { 981 const connectionType = translatedConnection(); 982 const status = { 983 connected: true, 984 connectionType 985 }; 986 this.notifyListeners("networkStatusChange", status); 987 }; 988 this.handleOffline = () => { 989 const status = { 990 connected: false, 991 connectionType: "none" 992 }; 993 this.notifyListeners("networkStatusChange", status); 994 }; 995 if (typeof window !== "undefined") { 996 window.addEventListener("online", this.handleOnline); 997 window.addEventListener("offline", this.handleOffline); 998 } 999 } 1000 async getStatus() { 1001 if (!window.navigator) { 1002 throw this.unavailable("Browser does not support the Network Information API"); 1003 } 1004 const connected = window.navigator.onLine; 1005 const connectionType = translatedConnection(); 1006 const status = { 1007 connected, 1008 connectionType: connected ? connectionType : "none" 1009 }; 1010 return status; 1011 } 1012 }; 1013 Network = new NetworkWeb(); 1014 } 1015 }); 1016 1017
vendor: 651 bytes, lines 1017-1034
1017// node_modules/@capacitor/haptics/dist/esm/definitions.js 1018 var ImpactStyle, NotificationType; 1019 var init_definitions3 = __esm({ 1020 "node_modules/@capacitor/haptics/dist/esm/definitions.js"() { 1021 (function(ImpactStyle2) { 1022 ImpactStyle2["Heavy"] = "HEAVY"; 1023 ImpactStyle2["Medium"] = "MEDIUM"; 1024 ImpactStyle2["Light"] = "LIGHT"; 1025 })(ImpactStyle || (ImpactStyle = {})); 1026 (function(NotificationType2) { 1027 NotificationType2["Success"] = "SUCCESS"; 1028 NotificationType2["Warning"] = "WARNING"; 1029 NotificationType2["Error"] = "ERROR"; 1030 })(NotificationType || (NotificationType = {})); 1031 } 1032 }); 1033 1034
vendor: 2,155 bytes, lines 1034-1099
1034// node_modules/@capacitor/haptics/dist/esm/web.js 1035 var web_exports7 = {}; 1036 __export(web_exports7, { 1037 HapticsWeb: () => HapticsWeb 1038 }); 1039 var HapticsWeb; 1040 var init_web7 = __esm({ 1041 "node_modules/@capacitor/haptics/dist/esm/web.js"() { 1042 init_dist(); 1043 init_definitions3(); 1044 HapticsWeb = class extends WebPlugin { 1045 constructor() { 1046 super(...arguments); 1047 this.selectionStarted = false; 1048 } 1049 async impact(options) { 1050 const pattern = this.patternForImpact(options === null || options === void 0 ? void 0 : options.style); 1051 this.vibrateWithPattern(pattern); 1052 } 1053 async notification(options) { 1054 const pattern = this.patternForNotification(options === null || options === void 0 ? void 0 : options.type); 1055 this.vibrateWithPattern(pattern); 1056 } 1057 async vibrate(options) { 1058 const duration = (options === null || options === void 0 ? void 0 : options.duration) || 300; 1059 this.vibrateWithPattern([duration]); 1060 } 1061 async selectionStart() { 1062 this.selectionStarted = true; 1063 } 1064 async selectionChanged() { 1065 if (this.selectionStarted) { 1066 this.vibrateWithPattern([70]); 1067 } 1068 } 1069 async selectionEnd() { 1070 this.selectionStarted = false; 1071 } 1072 patternForImpact(style = ImpactStyle.Heavy) { 1073 if (style === ImpactStyle.Medium) { 1074 return [43]; 1075 } else if (style === ImpactStyle.Light) { 1076 return [20]; 1077 } 1078 return [61]; 1079 } 1080 patternForNotification(type = NotificationType.Success) { 1081 if (type === NotificationType.Warning) { 1082 return [30, 40, 30, 50, 60]; 1083 } else if (type === NotificationType.Error) { 1084 return [27, 45, 50]; 1085 } 1086 return [35, 65, 21]; 1087 } 1088 vibrateWithPattern(pattern) { 1089 if (navigator.vibrate) { 1090 navigator.vibrate(pattern); 1091 } else { 1092 throw this.unavailable("Browser does not support the vibrate API"); 1093 } 1094 } 1095 }; 1096 } 1097 }); 1098 1099
vendor: 1,065 bytes, lines 1099-1131
1099// node_modules/@capacitor/action-sheet/dist/esm/web.js 1100 var web_exports8 = {}; 1101 __export(web_exports8, { 1102 ActionSheetWeb: () => ActionSheetWeb 1103 }); 1104 var ActionSheetWeb; 1105 var init_web8 = __esm({ 1106 "node_modules/@capacitor/action-sheet/dist/esm/web.js"() { 1107 init_dist(); 1108 ActionSheetWeb = class extends WebPlugin { 1109 async showActions(options) { 1110 return new Promise((resolve, _reject) => { 1111 let actionSheet = document.querySelector("pwa-action-sheet"); 1112 if (!actionSheet) { 1113 actionSheet = document.createElement("pwa-action-sheet"); 1114 document.body.appendChild(actionSheet); 1115 } 1116 actionSheet.header = options.title; 1117 actionSheet.cancelable = false; 1118 actionSheet.options = options.options; 1119 actionSheet.addEventListener("onSelection", async (e) => { 1120 const selection = e.detail; 1121 resolve({ 1122 index: selection 1123 }); 1124 }); 1125 }); 1126 } 1127 }; 1128 } 1129 }); 1130 1131
vendor: 174 bytes, lines 1131-1137
1131// node_modules/@capacitor/browser/dist/esm/definitions.js 1132 var init_definitions4 = __esm({ 1133 "node_modules/@capacitor/browser/dist/esm/definitions.js"() { 1134 } 1135 }); 1136 1137
vendor: 953 bytes, lines 1137-1171
1137// node_modules/@capacitor/browser/dist/esm/web.js 1138 var web_exports9 = {}; 1139 __export(web_exports9, { 1140 Browser: () => Browser, 1141 BrowserWeb: () => BrowserWeb 1142 }); 1143 var BrowserWeb, Browser; 1144 var init_web9 = __esm({ 1145 "node_modules/@capacitor/browser/dist/esm/web.js"() { 1146 init_dist(); 1147 BrowserWeb = class extends WebPlugin { 1148 constructor() { 1149 super(); 1150 this._lastWindow = null; 1151 } 1152 async open(options) { 1153 this._lastWindow = window.open(options.url, options.windowName || "_blank"); 1154 } 1155 async close() { 1156 return new Promise((resolve, reject) => { 1157 if (this._lastWindow != null) { 1158 this._lastWindow.close(); 1159 this._lastWindow = null; 1160 resolve(); 1161 } else { 1162 reject("No active window to close!"); 1163 } 1164 }); 1165 } 1166 }; 1167 Browser = new BrowserWeb(); 1168 } 1169 }); 1170 1171
vendor: 466 bytes, lines 1171-1187
1171// node_modules/@capacitor/browser/dist/esm/index.js 1172 var esm_exports3 = {}; 1173 __export(esm_exports3, { 1174 Browser: () => Browser2 1175 }); 1176 var Browser2; 1177 var init_esm3 = __esm({ 1178 "node_modules/@capacitor/browser/dist/esm/index.js"() { 1179 init_dist(); 1180 init_definitions4(); 1181 Browser2 = registerPlugin("Browser", { 1182 web: () => Promise.resolve().then(() => (init_web9(), web_exports9)).then((m) => new m.BrowserWeb()) 1183 }); 1184 } 1185 }); 1186 1187
1187// src/auth.ts 1188 init_esm(); 1189 init_esm2(); 1190 1191
1191// src/web-auth.ts 1192 init_dist(); 1193 var WebAuth = registerPlugin("WebAuth"); 1194 1195
1195// src/api-host.ts 1196 function getApiHost() { 1197 try { 1198 const origin = window.location.origin; 1199 if (/^https:\/\/([a-z0-9-]+\.)?refineweb\@refineweb.ai$/.test(origin)) { 1200 return origin; 1201 } 1202 } catch { 1203 } 1204 return "https://refineweb.io"; 1205 } 1206 1207
1207// src/auth.ts 1208 var FALLBACK_AUTH0_DOMAIN = true ? "refine.us.auth0.com" : "refine.us.auth0.com"; 1209 var FALLBACK_AUTH0_CLIENT_ID = true ? "AUTH0_CLIENT_ID_PLACEHOLDER" : "AUTH0_CLIENT_ID_PLACEHOLDER"; 1210 var CALLBACK_SCHEME = "io.refineweb.app://auth/callback"; 1211 var runtimeAuth0Config = null; 1212 var runtimeAuth0Promise = null; 1213 async function getAuth0Config() { 1214 if (runtimeAuth0Config) return runtimeAuth0Config; 1215 if (!runtimeAuth0Promise) { 1216 runtimeAuth0Promise = (async () => { 1217 try { 1218 const r = await fetch(`${getApiHost()}/auth/native-config`, { credentials: "omit" }); 1219 if (!r.ok) throw new Error("non-OK"); 1220 const j = await r.json(); 1221 const domain = (j.auth0_domain || "").toString(); 1222 const client_id = (j.auth0_client_id || "").toString(); 1223 if (domain && client_id && client_id !== "AUTH0_CLIENT_ID_PLACEHOLDER") { 1224 runtimeAuth0Config = { domain, client_id }; 1225 return runtimeAuth0Config; 1226 } 1227 } catch (e) { 1228 console.warn("[auth] native-config fetch failed; using build-time fallback", e); 1229 } 1230 runtimeAuth0Config = { domain: FALLBACK_AUTH0_DOMAIN, client_id: FALLBACK_AUTH0_CLIENT_ID }; 1231 return runtimeAuth0Config; 1232 })(); 1233 } 1234 return runtimeAuth0Promise; 1235 } 1236 var SESSION_KEY = "refine.session_token"; 1237 var STATE_KEY = "refine.auth_state"; 1238 async function buildAuthorizeUrl(state, screenHint, connection) { 1239 const { domain, client_id } = await getAuth0Config(); 1240 const params = new URLSearchParams({ 1241 response_type: "code", 1242 client_id, 1243 redirect_uri: CALLBACK_SCHEME, 1244 scope: "openid profile email", 1245 state 1246 }); 1247 if (screenHint) params.set("screen_hint", screenHint); 1248 if (connection) params.set("connection", connection); 1249 return `https://${domain}/authorize?${params.toString()}`; 1250 } 1251 function randomState() { 1252 const bytes = new Uint8Array(16); 1253 crypto.getRandomValues(bytes); 1254 return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join(""); 1255 } 1256 function openInSystemBrowser(url) { 1257 window.location.href = url; 1258 } 1259 async function authenticateViaWebAuth(authUrl) { 1260 try { 1261 const result = await WebAuth.authenticate({ 1262 url: authUrl, 1263 callbackScheme: "io.refineweb.app" 1264 }); 1265 const url = result.callbackUrl; 1266 if (url.startsWith("io.refineweb.app://auth/callback")) { 1267 const session = await handleAuthCallback(url); 1268 const apiHost = getApiHost(); 1269 if (session.needs_2fa) { 1270 window.location.replace(`${apiHost}/auth/2fa`); 1271 } else { 1272 window.location.replace(`${apiHost}/my`); 1273 } 1274 } 1275 } catch (err) { 1276 if (err?.code === "USER_CANCELLED" || err?.message === "cancelled") { 1277 return; 1278 } 1279 console.error("WebAuth failed, falling back to system Safari:", err); 1280 openInSystemBrowser(authUrl); 1281 } 1282 } 1283 async function startSignIn(opts = {}) { 1284 const state = randomState(); 1285 await Preferences.set({ key: STATE_KEY, value: state }); 1286 await authenticateViaWebAuth(await buildAuthorizeUrl(state, void 0, opts.connection)); 1287 } 1288 async function startSignUp(opts = {}) { 1289 const state = randomState(); 1290 await Preferences.set({ key: STATE_KEY, value: state }); 1291 await authenticateViaWebAuth(await buildAuthorizeUrl(state, "signup", opts.connection)); 1292 } 1293 async function handleAuthCallback(url) { 1294 const u = new URL(url); 1295 const code = u.searchParams.get("code"); 1296 const state = u.searchParams.get("state"); 1297 if (!code || !state) throw new Error("callback missing code/state"); 1298 const expected = await Preferences.get({ key: STATE_KEY }); 1299 if (expected.value && expected.value !== state) throw new Error("state mismatch"); 1300 await Preferences.remove({ key: STATE_KEY }); 1301 const resp = await fetch(`${getApiHost()}/auth/native-callback`, { 1302 method: "POST", 1303 headers: { "Content-Type": "application/json" }, 1304 body: JSON.stringify({ code, state, redirect_uri: CALLBACK_SCHEME }) 1305 }); 1306 if (!resp.ok) throw new Error(`native-callback ${resp.status}`); 1307 const data = await resp.json(); 1308 await Preferences.set({ key: SESSION_KEY, value: data.session_token }); 1309 return data; 1310 } 1311 async function getSessionToken() { 1312 const { value } = await Preferences.get({ key: SESSION_KEY }); 1313 return value; 1314 } 1315 function attachDeepLinkHandler(onSession) { 1316 App.addListener("appUrlOpen", async ({ url }) => { 1317 if (url.startsWith("io.refineweb.app://auth/callback")) { 1318 const result = await handleAuthCallback(url); 1319 onSession(result); 1320 } 1321 }); 1322 } 1323 async function verify2FA(code) { 1324 const sessionToken = await getSessionToken(); 1325 if (!sessionToken) throw new Error("no session"); 1326 const resp = await fetch(`${getApiHost()}/auth/2fa`, { 1327 method: "POST", 1328 headers: { 1329 "Content-Type": "application/json", 1330 "Cookie": `refine_session=${sessionToken}` 1331 }, 1332 body: JSON.stringify({ code }) 1333 }); 1334 if (!resp.ok) throw new Error("Invalid code"); 1335 } 1336 async function fullSignOut() { 1337 await Preferences.remove({ key: SESSION_KEY }); 1338 try { 1339 const core = await Promise.resolve().then(() =>
1339 (init_dist(), dist_exports)); 1340 const Cookies = core.CapacitorCookies; 1341 if (Cookies?.clearAllCookies) { 1342 await Cookies.clearAllCookies(); 1343 } 1344 } catch (e) { 1345 console.warn("clear cookies failed", e); 1346 } 1347 window.location.href = `${getApiHost()}/logout`; 1348 } 1349 1350
vendor: 266 bytes, lines 1350-1356
1350// node_modules/@capacitor-community/apple-sign-in/dist/esm/index.js 1351 init_dist(); 1352 var SignInWithApple = registerPlugin("SignInWithApple", { 1353 web: () => Promise.resolve().then(() => (init_web3(), web_exports3)).then((m) => new m.SignInWithAppleWeb()) 1354 }); 1355 1356
1356// src/apple-auth.ts 1357 init_esm(); 1358 var SESSION_KEY2 = "refine.session_token"; 1359 function randomState2() { 1360 const bytes = new Uint8Array(16); 1361 crypto.getRandomValues(bytes); 1362 return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join(""); 1363 } 1364 async function signInWithAppleNative() { 1365 const options = { 1366 clientId: "io.refineweb.app", 1367 redirectURI: `${getApiHost()}/auth/native-apple-callback`, 1368 scopes: "email name", 1369 state: randomState2(), 1370 nonce: randomState2() 1371 }; 1372 const result = await SignInWithApple.authorize(options); 1373 const r = result.response; 1374 const resp = await fetch(`${getApiHost()}/auth/native-apple`, { 1375 method: "POST", 1376 headers: { "Content-Type": "application/json" }, 1377 body: JSON.stringify({ 1378 identityToken: r.identityToken, 1379 authorizationCode: r.authorizationCode, 1380 // Apple ONLY returns email + name on first authorization. Pass them 1381 // through so the backend can persist them on user creation. 1382 email: r.email || null, 1383 givenName: r.givenName || null, 1384 familyName: r.familyName || null 1385 }) 1386 }); 1387 if (!resp.ok) { 1388 const body = await resp.text().catch(() => ""); 1389 throw new Error(`native-apple ${resp.status} ${body}`); 1390 } 1391 const data = await resp.json(); 1392 await Preferences.set({ key: SESSION_KEY2, value: data.session_token }); 1393 return data; 1394 } 1395 1396
vendor: 247 bytes, lines 1396-1402
1396// node_modules/@capacitor/splash-screen/dist/esm/index.js 1397 init_dist(); 1398 var SplashScreen = registerPlugin("SplashScreen", { 1399 web: () => Promise.resolve().then(() => (init_web4(), web_exports4)).then((m) => new m.SplashScreenWeb()) 1400 }); 1401 1402
1402// src/deeplinks.ts 1403 init_esm2(); 1404 function attachUniversalLinkHandler(onLink) { 1405 App.addListener("appUrlOpen", (e) => { 1406 const raw = e.url || ""; 1407 try { 1408 const u = new URL(raw); 1409 if (u.protocol === "https:" && u.hostname === "refineweb.io") { 1410 onLink(u.pathname + u.search); 1411 return; 1412 } 1413 if (u.protocol === "io.refineweb.app:") { 1414 if (raw.startsWith("io.refineweb.app://auth/")) return; 1415 onLink("/" + raw.replace("io.refineweb.app://", "")); 1416 } 1417 } catch { 1418 } 1419 }); 1420 } 1421 1422
1422// src/twofa-ui.ts 1423 function showTwoFAModal(onSubmit) { 1424 const overlay = document.createElement("div"); 1425 overlay.id = "rfn-2fa-overlay"; 1426 overlay.style.cssText = ` 1427 position:fixed; inset:0; background:rgba(17,17,17,0.5); display:grid; 1428 place-items:center; z-index:9999; padding:24px; 1429 `; 1430 overlay.innerHTML = ` 1431 <div style="background:#fff;border-radius:12px;max-width:360px;width:100%;padding:24px;"> 1432 <h2 style="margin:0 0 8px;font-family:'Plus Jakarta Sans',sans-serif;font-weight:800;font-size:20px;letter-spacing:-0.02em;">Two-step verification</h2> 1433 <p style="margin:0 0 20px;color:#555;font-size:14px;">Enter the 6-digit code from your authenticator app.</p> 1434 <input id="rfn-2fa-input" inputmode="numeric" pattern="[0-9]{6}" maxlength="6" 1435 autocomplete="one-time-code" placeholder="000000" 1436 style="width:100%;font-size:24px;text-align:center;letter-spacing:4px; 1437 padding:14px;border:1px solid #E0DEDA;border-radius:8px;margin-bottom:8px;box-sizing:border-box;" /> 1438 <div id="rfn-2fa-error" style="color:#c0392b;font-size:13px;min-height:18px;margin-bottom:12px;"></div> 1439 <button id="rfn-2fa-submit" style="width:100%;background:#2563EB;color:#fff; 1440 border:0;border-radius:8px;padding:14px;font-weight:600;cursor:pointer;font-size:15px;">Verify</button> 1441 </div> 1442 `; 1443 document.body.appendChild(overlay); 1444 const input = overlay.querySelector("#rfn-2fa-input"); 1445 const submit = overlay.querySelector("#rfn-2fa-submit"); 1446 const error = overlay.querySelector("#rfn-2fa-error"); 1447 input.focus(); 1448 submit.addEventListener("click", async () => { 1449 const code = input.value.trim(); 1450 if (!/^\d{6}$/.test(code)) { 1451 error.textContent = "Enter a 6-digit code."; 1452 return; 1453 } 1454 submit.disabled = true; 1455 error.textContent = ""; 1456 try { 1457 await onSubmit(code); 1458 overlay.remove(); 1459 } catch (e) { 1460 error.textContent = e.message || "Verification failed."; 1461 submit.disabled = false; 1462 } 1463 }); 1464 input.addEventListener("keydown", (e) => { 1465 if (e.key === "Enter") submit.click(); 1466 }); 1467 } 1468 1469
vendor: 149 bytes, lines 1469-1473
1469// node_modules/@capacitor/push-notifications/dist/esm/index.js 1470 init_dist(); 1471 var PushNotifications = registerPlugin("PushNotifications", {}); 1472 1473
1473// src/push.ts 1474 init_esm(); 1475 var GRANTED_KEY = "refine.push_granted"; 1476 var _listenersAttached = false; 1477 async function inspectPushPermission() { 1478 try { 1479 const s = await PushNotifications.checkPermissions(); 1480 return JSON.stringify(s); 1481 } catch (e) { 1482 return `error: ${e?.message || e}`; 1483 } 1484 } 1485 async function registerForPush(platform, label) { 1486 console.log("[refine-push] registerForPush() called, platform =", platform); 1487 if (!_listenersAttached) { 1488 console.log("[refine-push] attaching listeners (first call)"); 1489 _listenersAttached = true; 1490 PushNotifications.addListener("registration", async (token) => { 1491 console.log("[refine-push] registration EVENT received, token len =", token.value?.length); 1492 try { 1493 const r = await fetch(`${getApiHost()}/my/account/notifications/token`, { 1494 method: "POST", 1495 credentials: "include", 1496 headers: { "Content-Type": "application/json" }, 1497 body: JSON.stringify({ token: token.value, platform, label }) 1498 }); 1499 console.log("[refine-push] /token POST status =", r.status); 1500 if (!r.ok) { 1501 console.warn("[refine-push] /token POST failed HTTP", r.status); 1502 } 1503 } catch (e) { 1504 console.warn("[refine-push] /token POST threw", e); 1505 } 1506 }); 1507 PushNotifications.addListener("registrationError", (e) => { 1508 console.warn("[refine-push] registrationError EVENT", JSON.stringify(e)); 1509 }); 1510 PushNotifications.addListener("pushNotificationReceived", (n) => { 1511 showForegroundBanner(n); 1512 }); 1513 PushNotifications.addListener("pushNotificationActionPerformed", (a) => { 1514 const deepLink = (a.notification.data || {}).deep_link; 1515 if (deepLink) handleDeepLink(deepLink); 1516 }); 1517 } 1518 const existing = await PushNotifications.checkPermissions(); 1519 console.log("[refine-push] checkPermissions \u2192", JSON.stringify(existing)); 1520 if (existing.receive === "denied") { 1521 try { 1522 await Preferences.set({ key: GRANTED_KEY, value: "0" }); 1523 } catch { 1524 } 1525 return { state: "prompt-blocked" }; 1526 } 1527 try { 1528 console.log("[refine-push] calling requestPermissions()\u2026"); 1529 const perm = await PushNotifications.requestPermissions(); 1530 console.log("[refine-push] requestPermissions \u2192", JSON.stringify(perm)); 1531 if (perm.receive !== "granted") { 1532 try { 1533 await Preferences.set({ key: GRANTED_KEY, value: "0" }); 1534 } catch { 1535 } 1536 return { state: "denied" }; 1537 } 1538 try { 1539 await Preferences.set({ key: GRANTED_KEY, value: "1" }); 1540 } catch { 1541 } 1542 console.log("[refine-push] calling PushNotifications.register()\u2026"); 1543 await PushNotifications.register(); 1544 console.log("[refine-push] PushNotifications.register() returned \u2014 waiting for registration event"); 1545 return { state: "granted" }; 1546 } catch (e) { 1547 console.warn("[refine-push] register threw", e); 1548 return { state: "error", message: e?.message || "Push registration failed" }; 1549 } 1550 } 1551 function handleDeepLink(url) { 1552 if (url.startsWith("io.refineweb.app://")) { 1553 const path = "/" + url.replace("io.refineweb.app://", ""); 1554 window.location.replace(`${getApiHost()}${path}`); 1555 } else if (url.startsWith("https://refineweb.io")) { 1556 window.location.replace(url); 1557 } 1558 } 1559 function showForegroundBanner(n) { 1560 const data = n.data || {}; 1561 const deepLink = data.deep_link; 1562 const title = n.title || "Refine Web"; 1563 const body = n.body || ""; 1564 document.querySelectorAll(".rfn-fg-push").forEach((el) => el.remove()); 1565 const root = document.createElement("div"); 1566 root.className = "rfn-fg-push"; 1567 root.style.cssText = ` 1568 position: fixed; 1569 top: calc(12px + env(safe-area-inset-top)); 1570 left: 12px; right: 12px; 1571 background: #111; 1572 color: #fff; 1573 border-radius: 14px; 1574 padding: 12px 14px; 1575 z-index: 99990; 1576 box-shadow: 0 8px 28px rgba(0,0,0,0.35); 1577 display: flex; align-items: flex-start; gap: 12px; 1578 font-family: -apple-system, BlinkMacSystemFont, sans-serif; 1579 animation: rfnFgPushIn .35s ease; 1580 cursor: ${deepLink ? "pointer" : "default"}; 1581 `; 1582 root.innerHTML = ` 1583 <div style="flex-shrink:0;width:32px;height:32px;border-radius:9px;background:#2563EB;display:flex;align-items:center;justify-content:center">
1584 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/><path d="M13.73 21a2 2 0 0 1-3.46 0"/></svg> 1585 </div> 1586 <div style="flex:1;min-width:0"> 1587 <div style="font-weight:700;font-size:14px;margin-bottom:2px">${escapeHtml(title)}</div> 1588 <div style="font-size:13px;color:rgba(255,255,255,0.82);line-height:1.4">${escapeHtml(body)}</div> 1589 </div> 1590 <button class="rfn-fg-push-close" aria-label="Dismiss" style="flex-shrink:0;background:none;border:none;color:rgba(255,255,255,0.55);font-size:18px;cursor:pointer;padding:2px;font-family:inherit">\xD7</button> 1591 `; 1592 if (!document.getElementById("rfn-fg-push-style")) { 1593 const sty = document.createElement("style"); 1594 sty.id = "rfn-fg-push-style"; 1595 sty.textContent = `@keyframes rfnFgPushIn{from{transform:translateY(-30px);opacity:0}to{transform:translateY(0);opacity:1}}`; 1596 document.head.appendChild(sty); 1597 } 1598 document.body.appendChild(root); 1599 const dismiss = () => { 1600 if (root.parentNode) root.parentNode.removeChild(root); 1601 }; 1602 const closeBtn = root.querySelector(".rfn-fg-push-close"); 1603 closeBtn?.addEventListener("click", (e) => { 1604 e.stopPropagation();
1605 dismiss(); 1606 }); 1607 if (deepLink) { 1608 root.addEventListener("click", () => { 1609 dismiss(); 1610 handleDeepLink(deepLink); 1611 }); 1612 } 1613 setTimeout(dismiss, 6e3); 1614 } 1615 function escapeHtml(s) { 1616 return String(s).replace(/[&<>"']/g, (c) => ({ 1617 "&": "&", 1618 "<": "<", 1619 ">": ">", 1620 '"': """, 1621 "'": "'" 1622 })[c]); 1623 } 1624 1625
vendor: 70 bytes, lines 1625-1628
1625// node_modules/@capacitor/camera/dist/esm/index.js 1626 init_dist(); 1627 1628
vendor: 68 bytes, lines 1628-1631
1628// node_modules/@capacitor/camera/dist/esm/web.js 1629 init_dist(); 1630 1631
vendor: 693 bytes, lines 1631-1650
1631// node_modules/@capacitor/camera/dist/esm/definitions.js 1632 var CameraSource; 1633 (function(CameraSource2) { 1634 CameraSource2["Prompt"] = "PROMPT"; 1635 CameraSource2["Camera"] = "CAMERA"; 1636 CameraSource2["Photos"] = "PHOTOS"; 1637 })(CameraSource || (CameraSource = {})); 1638 var CameraDirection; 1639 (function(CameraDirection2) { 1640 CameraDirection2["Rear"] = "REAR"; 1641 CameraDirection2["Front"] = "FRONT"; 1642 })(CameraDirection || (CameraDirection = {})); 1643 var CameraResultType; 1644 (function(CameraResultType2) { 1645 CameraResultType2["Uri"] = "uri"; 1646 CameraResultType2["Base64"] = "base64"; 1647 CameraResultType2["DataUrl"] = "dataUrl"; 1648 })(CameraResultType || (CameraResultType = {})); 1649 1650
vendor: 8,215 bytes, lines 1650-1880
1650// node_modules/@capacitor/camera/dist/esm/web.js 1651 var CameraWeb = class extends WebPlugin { 1652 async getPhoto(options) { 1653 return new Promise(async (resolve, reject) => { 1654 if (options.webUseInput || options.source === CameraSource.Photos) { 1655 this.fileInputExperience(options, resolve, reject); 1656 } else if (options.source === CameraSource.Prompt) { 1657 let actionSheet = document.querySelector("pwa-action-sheet"); 1658 if (!actionSheet) { 1659 actionSheet = document.createElement("pwa-action-sheet"); 1660 document.body.appendChild(actionSheet); 1661 } 1662 actionSheet.header = options.promptLabelHeader || "Photo"; 1663 actionSheet.cancelable = true; 1664 actionSheet.options = [ 1665 { title: options.promptLabelPhoto || "From Photos" }, 1666 { title: options.promptLabelPicture || "Take Picture" } 1667 ]; 1668 actionSheet.addEventListener("onSelection", async (e) => { 1669 const selection = e.detail; 1670 if (selection === 0) { 1671 this.fileInputExperience(options, resolve, reject); 1672 } else { 1673 this.cameraExperience(options, resolve, reject); 1674 } 1675 }); 1676 actionSheet.addEventListener("onCanceled", async () => { 1677 reject(new CapacitorException("User cancelled photos app")); 1678 }); 1679 } else { 1680 this.cameraExperience(options, resolve, reject); 1681 } 1682 }); 1683 } 1684 async pickImages(_options) { 1685 return new Promise(async (resolve, reject) => { 1686 this.multipleFileInputExperience(resolve, reject); 1687 }); 1688 } 1689 async cameraExperience(options, resolve, reject) { 1690 if (customElements.get("pwa-camera-modal")) { 1691 const cameraModal = document.createElement("pwa-camera-modal"); 1692 cameraModal.facingMode = options.direction === CameraDirection.Front ? "user" : "environment"; 1693 document.body.appendChild(cameraModal); 1694 try { 1695 await cameraModal.componentOnReady(); 1696 cameraModal.addEventListener("onPhoto", async (e) => { 1697 const photo = e.detail; 1698 if (photo === null) { 1699 reject(new CapacitorException("User cancelled photos app")); 1700 } else if (photo instanceof Error) { 1701 reject(photo); 1702 } else { 1703 resolve(await this._getCameraPhoto(photo, options)); 1704 } 1705 cameraModal.dismiss(); 1706 document.body.removeChild(cameraModal); 1707 }); 1708 cameraModal.present(); 1709 } catch (e) { 1710 this.fileInputExperience(options, resolve, reject); 1711 } 1712 } else { 1713 console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`); 1714 this.fileInputExperience(options, resolve, reject); 1715 } 1716 } 1717 fileInputExperience(options, resolve, reject) { 1718 let input = document.querySelector("#_capacitor-camera-input"); 1719 const cleanup = () => { 1720 var _a; 1721 (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input); 1722 }; 1723 if (!input) { 1724 input = document.createElement("input"); 1725 input.id = "_capacitor-camera-input"; 1726 input.type = "file"; 1727 input.hidden = true; 1728 document.body.appendChild(input); 1729 input.addEventListener("change", (_e) => { 1730 const file = input.files[0]; 1731 let format = "jpeg"; 1732 if (file.type === "image/png") { 1733 format = "png"; 1734 } else if (file.type === "image/gif") { 1735 format = "gif"; 1736 } 1737 if (options.resultType === "dataUrl" || options.resultType === "base64") { 1738 const reader = new FileReader(); 1739 reader.addEventListener("load", () => { 1740 if (options.resultType === "dataUrl") { 1741 resolve({ 1742 dataUrl: reader.result, 1743 format 1744 }); 1745 } else if (options.resultType === "base64") { 1746 const b64 = reader.result.split(",")[1]; 1747 resolve({ 1748 base64String: b64, 1749 format 1750 }); 1751 } 1752 cleanup(); 1753 }); 1754 reader.readAsDataURL(file); 1755 } else { 1756 resolve({ 1757 webPath: URL.createObjectURL(file), 1758 format 1759 }); 1760 cleanup(); 1761 } 1762 }); 1763 input.addEventListener("cancel", (_e) => { 1764 reject(new CapacitorException("User cancelled photos app")); 1765 cleanup(); 1766 }); 1767 } 1768 input.accept = "image/*"; 1769 input.capture = true; 1770 if (options.source === CameraSource.Photos || options.source === CameraSource.Prompt) { 1771 input.removeAttribute("capture"); 1772 } else if (options.direction === CameraDirection.Front) { 1773 input.capture = "user"; 1774 } else if (options.direction === CameraDirection.Rear) { 1775 input.capture = "environment"; 1776 } 1777 input.click(); 1778 } 1779 multipleFileInputExperience(resolve, reject) { 1780 let input = document.querySelector("#_capacitor-camera-input-multiple"); 1781 const cleanup = () => { 1782 var _a; 1783 (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input); 1784 }; 1785 if (!input) { 1786 input = document.createElement("input"); 1787 input.id = "_capacitor-camera-input-multiple"; 1788 input.type = "file"; 1789 input.hidden = true; 1790 input.multiple = true; 1791 document.body.appendChild(input); 1792 input.addEventListener("change", (_e) => { 1793 const photos = []; 1794 for (let i = 0; i < input.files.length; i++) { 1795 const file = input.files[i]; 1796 let format = "jpeg"; 1797 if (file.type === "image/png") { 1798 format = "png"; 1799 } else if (file.type === "image/gif") { 1800 format = "gif"; 1801 } 1802 photos.push({ 1803 webPath: URL.createObjectURL(file), 1804 format 1805 }); 1806 } 1807 resolve({ photos }); 1808 cleanup(); 1809 }); 1810 input.addEventListener("cancel", (_e) => { 1811 reject(new CapacitorException("User cancelled photos app")); 1812 cleanup(); 1813 }); 1814 } 1815 input.accept = "image/*"; 1816 input.click(); 1817 } 1818 _getCameraPhoto(photo, options) { 1819 return new Promise((resolve, reject) => { 1820 const reader = new FileReader(); 1821 const format = photo.type.split("/")[1]; 1822 if (options.resultType === "uri") { 1823 resolve({ 1824 webPath: URL.createObjectURL(photo), 1825 format, 1826 saved: false 1827 }); 1828 } else { 1829 reader.readAsDataURL(photo); 1830 reader.onloadend = () => { 1831 const r = reader.result; 1832 if (options.resultType === "dataUrl") { 1833 resolve({ 1834 dataUrl: r, 1835 format, 1836 saved: false 1837 }); 1838 } else { 1839 resolve({ 1840 base64String: r.split(",")[1], 1841 format, 1842 saved: false 1843 }); 1844 } 1845 }; 1846 reader.onerror = (e) => { 1847 reject(e); 1848 }; 1849 } 1850 }); 1851 } 1852 async checkPermissions() { 1853 if (typeof navigator === "undefined" || !navigator.permissions) { 1854 throw this.unavailable("Permissions API not available in this browser"); 1855 } 1856 try { 1857 const permission = await window.navigator.permissions.query({ 1858 name: "camera" 1859 }); 1860 return { 1861 camera: permission.state, 1862 photos: "granted" 1863 }; 1864 } catch (_a) { 1865 throw this.unavailable("Camera permissions are not available in this browser"); 1866 } 1867 } 1868 async requestPermissions() { 1869 throw this.unimplemented("Not implemented on web."); 1870 } 1871 async pickLimitedLibraryPhotos() { 1872 throw this.unavailable("Not implemented on web."); 1873 } 1874 async getLimitedLibraryPhotos() { 1875 throw this.unavailable("Not implemented on web."); 1876 } 1877 }; 1878 var Camera = new CameraWeb(); 1879 1880
vendor: 135 bytes, lines 1880-1885
1880// node_modules/@capacitor/camera/dist/esm/index.js 1881 var Camera2 = registerPlugin("Camera", { 1882 web: () => new CameraWeb() 1883 }); 1884 1885
1885// src/camera.ts 1886 async function takePhoto() { 1887 try { 1888 const photo = await Camera2.getPhoto({ 1889 quality: 85, 1890 allowEditing: false, 1891 resultType: CameraResultType.DataUrl, 1892 source: CameraSource.Camera, 1893 saveToGallery: false, 1894 width: 2560 1895 }); 1896 return { dataUrl: photo.dataUrl, format: photo.format }; 1897 } catch { 1898 return null; 1899 } 1900 } 1901 async function pickFromLibrary(max = 10) { 1902 try { 1903 const result = await Camera2.pickImages({ 1904 quality: 85, 1905 limit: max, 1906 width: 2560 1907 }); 1908 const photos = []; 1909 for (const p of result.photos) { 1910 const resp = await fetch(p.webPath); 1911 const blob = await resp.blob(); 1912 const dataUrl = await new Promise((res) => { 1913 const r = new FileReader(); 1914 r.onload = () => res(r.result); 1915 r.readAsDataURL(blob); 1916 }); 1917 photos.push({ dataUrl, format: p.format }); 1918 } 1919 return photos; 1920 } catch { 1921 return []; 1922 } 1923 } 1924 1925
vendor: 218 bytes, lines 1925-1931
1925// node_modules/@capacitor/share/dist/esm/index.js 1926 init_dist(); 1927 var Share = registerPlugin("Share", { 1928 web: () => Promise.resolve().then(() => (init_web5(), web_exports5)).then((m) => new m.ShareWeb()) 1929 }); 1930 1931
1931// src/share.ts 1932 async function shareUrl(url, title, text) { 1933 try { 1934 await Share.share({ title, text: text || title, url, dialogTitle: "Share" }); 1935 } catch (e) { 1936 console.warn("share failed", e); 1937 } 1938 } 1939 1940
vendor: 72 bytes, lines 1940-1943
1940// node_modules/@capacitor/keyboard/dist/esm/index.js 1941 init_dist(); 1942 1943
vendor: 536 bytes, lines 1943-1958
1943// node_modules/@capacitor/keyboard/dist/esm/definitions.js 1944 var KeyboardStyle; 1945 (function(KeyboardStyle2) { 1946 KeyboardStyle2["Dark"] = "DARK"; 1947 KeyboardStyle2["Light"] = "LIGHT"; 1948 KeyboardStyle2["Default"] = "DEFAULT"; 1949 })(KeyboardStyle || (KeyboardStyle = {})); 1950 var KeyboardResize; 1951 (function(KeyboardResize2) { 1952 KeyboardResize2["Body"] = "body"; 1953 KeyboardResize2["Ionic"] = "ionic"; 1954 KeyboardResize2["Native"] = "native"; 1955 KeyboardResize2["None"] = "none"; 1956 })(KeyboardResize || (KeyboardResize = {})); 1957 1958
vendor: 102 bytes, lines 1958-1961
1958// node_modules/@capacitor/keyboard/dist/esm/index.js 1959 var Keyboard = registerPlugin("Keyboard"); 1960 1961
1961// src/keyboard.ts 1962 function attachKeyboardPadding() { 1963 let kbHeight = 0; 1964 let kbVisible = false; 1965 function publishKbHeight(h) { 1966 document.documentElement.style.setProperty("--rfn-kb-h", `${h}px`); 1967 } 1968 Keyboard.addListener("keyboardWillShow", (info) => { 1969 kbHeight = info.keyboardHeight; 1970 kbVisible = true; 1971 publishKbHeight(kbHeight); 1972 }); 1973 Keyboard.addListener("keyboardDidShow", () => { 1974 publishKbHeight(kbHeight); 1975 }); 1976 Keyboard.addListener("keyboardWillHide", () => { 1977 kbHeight = 0; 1978 kbVisible = false; 1979 publishKbHeight(0); 1980 }); 1981 } 1982 1983
1983// src/back-nav.ts 1984 init_esm2(); 1985 init_dist(); 1986 function attachBackNavigation() { 1987 if (Capacitor.getPlatform() !== "android") return; 1988 App.addListener("backButton", ({ canGoBack }) => { 1989 if (canGoBack || window.history.length > 1) { 1990 window.history.back(); 1991 return; 1992 } 1993 App.minimizeApp().catch(() => { 1994 }); 1995 }); 1996 } 1997 1998
vendor: 227 bytes, lines 1998-2004
1998// node_modules/@capacitor/network/dist/esm/index.js 1999 init_dist(); 2000 var Network2 = registerPlugin("Network", { 2001 web: () => Promise.resolve().then(() => (init_web6(), web_exports6)).then((m) => new m.NetworkWeb()) 2002 }); 2003 2004
2004// src/network.ts 2005 var banner = null; 2006 function showOfflineBanner() { 2007 if (banner) return; 2008 banner = document.createElement("div"); 2009 banner.id = "rfn-offline-banner"; 2010 banner.style.cssText = ` 2011 position:fixed; left:0; right:0; top:0; z-index:99999; 2012 background:#111; color:#fff; text-align:center; padding:8px 12px; 2013 font-family:-apple-system,sans-serif; font-size:13px; 2014 `; 2015 banner.textContent = "You're offline \u2014 content may be out of date."; 2016 document.body.appendChild(banner); 2017 } 2018 function hideOfflineBanner() { 2019 banner?.remove(); 2020 banner = null; 2021 } 2022 async function initNetwork() { 2023 const s = await Network2.getStatus(); 2024 if (!s.connected) showOfflineBanner(); 2025 Network2.addListener("networkStatusChange", (st) => { 2026 if (st.connected) hideOfflineBanner(); 2027 else showOfflineBanner(); 2028 }); 2029 } 2030 2031
vendor: 74 bytes, lines 2031-2034
2031// node_modules/@capacitor/status-bar/dist/esm/index.js 2032 init_dist(); 2033 2034
vendor: 405 bytes, lines 2034-2048
2034// node_modules/@capacitor/status-bar/dist/esm/definitions.js 2035 var Style; 2036 (function(Style2) { 2037 Style2["Dark"] = "DARK"; 2038 Style2["Light"] = "LIGHT"; 2039 Style2["Default"] = "DEFAULT"; 2040 })(Style || (Style = {})); 2041 var Animation; 2042 (function(Animation2) { 2043 Animation2["None"] = "NONE"; 2044 Animation2["Slide"] = "SLIDE"; 2045 Animation2["Fade"] = "FADE"; 2046 })(Animation || (Animation = {})); 2047 2048
vendor: 106 bytes, lines 2048-2051
2048// node_modules/@capacitor/status-bar/dist/esm/index.js 2049 var StatusBar = registerPlugin("StatusBar"); 2050 2051
2051// src/status-bar-setup.ts 2052 async function configureStatusBar() { 2053 try { 2054 await StatusBar.setStyle({ style: Style.Light }); 2055 } catch { 2056 } 2057 try { 2058 await StatusBar.setBackgroundColor({ color: "#F4F2EF" }); 2059 } catch { 2060 } 2061 } 2062 2063
vendor: 249 bytes, lines 2063-2070
2063// node_modules/@capacitor/haptics/dist/esm/index.js 2064 init_dist(); 2065 init_definitions3(); 2066 var Haptics = registerPlugin("Haptics", { 2067 web: () => Promise.resolve().then(() => (init_web7(), web_exports7)).then((m) => new m.HapticsWeb()) 2068 }); 2069 2070
2070// src/haptics.ts 2071 async function impact(style = "light") { 2072 const map = { light: ImpactStyle.Light, medium: ImpactStyle.Medium, heavy: ImpactStyle.Heavy }; 2073 try { 2074 await Haptics.impact({ style: map[style] }); 2075 } catch { 2076 } 2077 } 2078 async function notify(type) { 2079 const map = { success: NotificationType.Success, warning: NotificationType.Warning, error: NotificationType.Error }; 2080 try { 2081 await Haptics.notification({ type: map[type] }); 2082 } catch { 2083 } 2084 } 2085 2086
vendor: 76 bytes, lines 2086-2089
2086// node_modules/@capacitor/action-sheet/dist/esm/index.js 2087 init_dist(); 2088 2089
vendor: 361 bytes, lines 2089-2097
2089// node_modules/@capacitor/action-sheet/dist/esm/definitions.js 2090 var ActionSheetButtonStyle; 2091 (function(ActionSheetButtonStyle2) { 2092 ActionSheetButtonStyle2["Default"] = "DEFAULT"; 2093 ActionSheetButtonStyle2["Destructive"] = "DESTRUCTIVE"; 2094 ActionSheetButtonStyle2["Cancel"] = "CANCEL"; 2095 })(ActionSheetButtonStyle || (ActionSheetButtonStyle = {})); 2096 2097
vendor: 228 bytes, lines 2097-2102
2097// node_modules/@capacitor/action-sheet/dist/esm/index.js 2098 var ActionSheet = registerPlugin("ActionSheet", { 2099 web: () => Promise.resolve().then(() => (init_web8(), web_exports8)).then((m) => new m.ActionSheetWeb()) 2100 }); 2101 2102
2102// src/action-sheet.ts 2103 async function present(title, options) { 2104 const result = await ActionSheet.showActions({ 2105 title, 2106 options: options.map((o) => ({ 2107 title: o.label, 2108 style: o.destructive ? ActionSheetButtonStyle.Destructive : ActionSheetButtonStyle.Default 2109 })) 2110 }); 2111 return result.index; 2112 } 2113 2114
2114// src/bridge.ts 2115 var API_HOST = getApiHost(); 2116 async function initBridge() { 2117 const cap = window.Capacitor; 2118 if (!cap || !cap.isNativePlatform()) return; 2119 const platform = cap.getPlatform(); 2120 document.documentElement.classList.add("rfn-native"); 2121 const tagBody = () => document.body && document.body.classList.add("rfn-native"); 2122 tagBody(); 2123 document.addEventListener("DOMContentLoaded", tagBody); 2124 window.RefineNative = { 2125 isNative: true, 2126 platform, 2127 signIn: async (opts) => { 2128 await startSignIn(opts); 2129 }, 2130 signUp: async (opts) => { 2131 await startSignUp(opts); 2132 }, 2133 signOut: async () => { 2134 await fullSignOut(); 2135 }, 2136 signInWithApple: async () => { 2137 const session = await signInWithAppleNative(); 2138 if (session.needs_2fa) { 2139 showTwoFAModal(async (code) => { 2140 await verify2FA(code); 2141 registerForPush(platform, `${platform} device`).catch(() => { 2142 }); 2143 window.location.replace(`${API_HOST}/my`); 2144 }); 2145 } else { 2146 registerForPush(platform, `${platform} device`).catch(() => { 2147 }); 2148 window.location.replace(`${API_HOST}/my`); 2149 } 2150 }, 2151 push: { 2152 register: async (label = `${platform} device`) => { 2153 return await registerForPush(platform, label); 2154 }, 2155 // Live read of the OS permission state. Powers the diagnostic 2156 // strip on /my/account/notifications so the user can see 2157 // exactly what iOS is reporting (vs what they think they set). 2158 inspect: async () => inspectPushPermission(), 2159 // Open this app's iOS / Android settings page. Used when push 2160 // permission has been denied â the OS won't show the prompt again 2161 // so the user has to flip it manually. We try multiple paths 2162 // because the 'app-settings:' scheme is finicky in WKWebView: 2163 // 1. Capacitor App.openUrl (cleanest if it works) 2164 // 2. window.open (works in many cases) 2165 // 3. location.href fallback 2166 openSettings: async () => { 2167 const url = platform === "ios" ? "app-settings:" : "package:io.refineweb.app"; 2168 console.log("[refine-push] openSettings \u2192", url); 2169 try { 2170 const { App: App2 } = await Promise.resolve().then(() => (init_esm2(), esm_exports2)); 2171 await App2.openUrl({ url }); 2172 console.log("[refine-push] App.openUrl OK"); 2173 return; 2174 } catch (e) { 2175 console.warn("[refine-push] App.openUrl failed", e); 2176 } 2177 try { 2178 window.open(url, "_blank"); 2179 console.log("[refine-push] window.open issued"); 2180 return; 2181 } catch (e) { 2182 console.warn("[refine-push] window.open failed", e); 2183 } 2184 try { 2185 window.location.href = url; 2186 } catch (e) { 2187 console.warn("[refine-push] location.href failed", e); 2188 } 2189 } 2190 }, 2191 camera: { takePhoto, pickFromLibrary }, 2192 share: { shareUrl }, 2193 // geolocation removed â see import comment above. 2194 haptics: { impact, notify }, 2195 actionSheet: { present } 2196 }; 2197 const polish = document.createElement("style"); 2198 polish.id = "rfn-native-polish"; 2199 polish.textContent = ` 2200body.rfn-native, body.rfn-native * { -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; }
2201/* Re-enable iOS long-press text selection on content surfaces \u2014 without 2202 this, users can't tap-and-hold to copy chat bubbles, lead notes, 2203 open-question text, etc. The blanket touch-callout:none above kills 2204 the magnifier + Copy menu globally; this opt-in undo restores it for 2205 anywhere we mark as selectable. */ 2206body.rfn-native textarea, 2207body.rfn-native input[type="text"], 2208body.rfn-native input[type="email"], 2209body.rfn-native input[type="search"], 2210body.rfn-native input[type="url"], 2211body.rfn-native input[type="tel"], 2212body.rfn-native input[type="password"], 2213body.rfn-native input[type="number"], 2214body.rfn-native [data-rfn-selectable], 2215body.rfn-native [data-rfn-selectable] *, 2216body.rfn-native #messages, 2217body.rfn-native #messages *, 2218body.rfn-native #modal-messages, 2219body.rfn-native #modal-messages * { 2220 -webkit-touch-callout: default; 2221 -webkit-user-select: text; 2222 user-select: text; 2223} 2224body.rfn-native a, body.rfn-native button, body.rfn-native .btn, body.rfn-native [role="button"], body.rfn-native input[type="submit"], body.rfn-native input[type="button"] { touch-action: manipulation; } 2225body.rfn-native:not(.rfn-no-fade) { animation: rfnPageFade .18s ease-out; } 2226@keyframes rfnPageFade { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } } 2227/* iOS auto-zooms when an input <16px gets focus \u2014 that zoom is what 2228 causes the page to widen and pan left/right. Forcing >=16px keeps the 2229 viewport stable when the keyboard opens. */ 2230body.rfn-native input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]), 2231body.rfn-native textarea, 2232body.rfn-native select { font-size: 16px !important; } 2233/* Belt + suspenders: even if iOS somehow widens the viewport, lock the 2234 document so it physically can't be dragged sideways. */ 2235html.rfn-native, body.rfn-native { overflow-x: hidden; touch-action: pan-y;
2235 overscroll-behavior: none; } 2236/* DO NOT put transform/will-change on the topbar. The hamburger drawer 2237 is rendered INSIDE the topbar markup as a position:fixed child; if the 2238 topbar has a transform it becomes that child's containing block, and 2239 the drawer gets trapped inside the topbar's 52px tall box instead of 2240 spanning the full viewport. The bounce-related cosmetic issue this was 2241 meant to fix is already solved by ios.contentInset=never in 2242 capacitor.config.json. */ 2243`; 2244 document.head.appendChild(polish); 2245 document.addEventListener("click", (e) => { 2246 const t = e.target?.closest?.( 2247 "button, .btn, a.btn, a.rfn-btn, a.btn-social, a.btn-primary, .rfn-tab, [data-rfn-haptic]" 2248 ); 2249 if (!t) return; 2250 const style = t.dataset?.rfnHaptic || ""; 2251 if (style === "off") return; 2252 const safe = ["light", "medium", "heavy"].includes(style) ? style : "light"; 2253 window.RefineNative?.haptics?.impact?.(safe); 2254 }, true); 2255 document.addEventListener("click", (e) => { 2256 const a = e.target?.closest?.("a"); 2257 if (!a) return; 2258 const href = a.getAttribute("href") || ""; 2259 if (href.startsWith("/auth/login?") || href.startsWith("/refine-login?") || href.startsWith("/signup?")) { 2260 const conn = new URL(href, location.href).searchParams.get("connection") || void 0; 2261 if (!conn) return; 2262 e.preventDefault(); 2263 if (conn === "apple" && platform === "ios") { 2264 window.RefineNative?.signInWithApple?.(); 2265 return; 2266 } 2267 if (href.startsWith("/signup?")) { 2268 window.RefineNative?.signUp?.({ connection: conn }); 2269 } else { 2270 window.RefineNative?.signIn?.({ connection: conn }); 2271 } 2272 return; 2273 } 2274 if (href === "/logout") { 2275 e.preventDefault(); 2276 window.RefineNative?.signOut?.(); 2277 return; 2278 } 2279 if (a.dataset?.external === "1") { 2280 e.preventDefault(); 2281 const abs = new URL(href, location.href).toString(); 2282 Promise.resolve().then(() => (init_esm3(), esm_exports3)).then(({ Browser: Browser3 }) => Browser3.open({ url: abs })).catch(() => { 2283 window.open(abs, "_blank"); 2284 }); 2285 return; 2286 } 2287 }, true); 2288 await configureStatusBar(); 2289 attachKeyboardPadding(); 2290 attachBackNavigation(); 2291 initNetwork().catch(() => { 2292 }); 2293 const hideSplash = () => SplashScreen.hide({ fadeOutDuration: 400 }).catch(() => { 2294 }); 2295 if (document.readyState === "complete") { 2296 setTimeout(hideSplash, 50); 2297 } else { 2298 window.addEventListener("load", () => setTimeout(hideSplash, 50), { once: true }); 2299 } 2300 attachUniversalLinkHandler((path) => { 2301 if (location.pathname + location.search !== path) { 2302 window.location.replace(`${API_HOST}${path}`); 2303 } 2304 }); 2305 attachDeepLinkHandler(async (session) => { 2306 if (session.needs_2fa) { 2307 showTwoFAModal(async (code) => { 2308 await verify2FA(code); 2309 registerForPush(platform, `${platform} device`).catch(() => { 2310 }); 2311 window.location.replace(`${API_HOST}/my`); 2312 }); 2313 } else { 2314 registerForPush(platform, `${platform} device`).catch(() => { 2315 }); 2316 window.location.replace(`${API_HOST}/my`); 2317 } 2318 }); 2319 try { 2320 const { Preferences: Preferences2 } = await Promise.resolve().then(() => (init_esm(), esm_exports)); 2321 const granted = await Preferences2.get({ key: "refine.push_granted" }); 2322 if (granted.value === "1") { 2323 registerForPush(platform, `${platform} device`).catch(() => { 2324 }); 2325 } 2326 } catch { 2327 } 2328 } 2329 initBridge(); 2330})(); 2331/*! Bundled license information: 2332 2333@capacitor/core/dist/index.js: 2334 (*! Capacitor: https://capacitorjs.com/ - MIT License *) 2335 2336scriptjs/dist/script.js: 2337 (*! 2338 * $script.js JS loader & dependency manager 2339 * https://github.com/ded/script.js 2340 * (c) Dustin Diaz 2014 | License MIT 2341 *) 2342*/
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.