@paypay/mini-app-js-sdk 1.50.0 → 1.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -85,8 +85,8 @@ function normalizeNativeResponseData(data2) {
85
85
  }
86
86
  class JsBridge {
87
87
  constructor(global2) {
88
- this.version = "1.50.0";
89
- this.revision = "d2542c6";
88
+ this.version = "1.51.0";
89
+ this.revision = "8d484fc";
90
90
  this.messageHandlers = new Map();
91
91
  this.responseCallbacks = new Map();
92
92
  this.global = global2;
@@ -1635,7 +1635,10 @@ function openWebview(openWebviewParams) {
1635
1635
  } catch (_) {
1636
1636
  }
1637
1637
  if (params == null ? void 0 : params.authorization) {
1638
- params.url = getAuthUrl(params.url);
1638
+ const url2 = getAuthUrl(params);
1639
+ if (url2 === null)
1640
+ return;
1641
+ params.url = url2;
1639
1642
  openWebviewInternal(params);
1640
1643
  } else if (["http:", "https:"].includes(url.protocol) && ((params == null ? void 0 : params.style) === "external" || ((_b = appDetail == null ? void 0 : appDetail.whiteListDomains) == null ? void 0 : _b.includes(url.host)) || url.host === (openUrl2 == null ? void 0 : openUrl2.host))) {
1641
1644
  openWebviewInternal(params);
@@ -1666,8 +1669,8 @@ function openWebviewInternal(params) {
1666
1669
  }
1667
1670
  }
1668
1671
  }
1669
- function getAuthUrl(redirectUrl) {
1670
- var _a;
1672
+ function getAuthUrl(params) {
1673
+ var _a, _b;
1671
1674
  let authUrl = "";
1672
1675
  switch (getEnv()) {
1673
1676
  case "staging":
@@ -1687,7 +1690,13 @@ function getAuthUrl(redirectUrl) {
1687
1690
  authUrl = "https://www.paypay.ne.jp";
1688
1691
  }
1689
1692
  const clientId = (_a = getClientId()) != null ? _a : "";
1690
- return `${authUrl}/portal/auth/mini-app/permission?clientId=${clientId}&redirectUrl=${encodeURIComponent(redirectUrl)}`;
1693
+ if (!clientId) {
1694
+ (_b = params == null ? void 0 : params.fail) == null ? void 0 : _b.call(params, {
1695
+ errorCode: MiniAppErrorType.sdkNotInitialized
1696
+ });
1697
+ return null;
1698
+ }
1699
+ return `${authUrl}/portal/auth/mini-app/permission?clientId=${clientId}&redirectUrl=${encodeURIComponent(params.url)}`;
1691
1700
  }
1692
1701
  function isDef(val2) {
1693
1702
  return val2 !== void 0 && val2 !== null;
@@ -1957,7 +1966,7 @@ const opaUrl = () => {
1957
1966
  const createHeaderMiniAppApi = (urlEndpoint, customHeaders) => {
1958
1967
  let headers = new Headers(__spreadValues({
1959
1968
  "Content-Type": "application/json",
1960
- "Client-Version": "1.50.0",
1969
+ "Client-Version": "1.51.0",
1961
1970
  "Client-OS-Type": getRuntime()
1962
1971
  }, customHeaders));
1963
1972
  if (urlEndpoint === "web-api/app/v2/payment/methods" || urlEndpoint === "web-api/app/v2/payment/consult" || urlEndpoint === "web-api/app/v1/payment/cashbackDetail" || urlEndpoint === "web-api/app/v1/confirmAgeForCashback" || urlEndpoint === "web-api/app/v1/internal/request" || urlEndpoint === "web-api/app/v1/addressbyzip" || urlEndpoint === "/web-api/app/platform/v1/balance" || urlEndpoint === "web-api/app/v1/users/autoTopupConfiguration" || urlEndpoint === "web-api/app/v1/users/preTransactionAutoTopupConfiguration") {
@@ -2773,7 +2782,7 @@ function createGetter(isReadonly2 = false, shallow = false) {
2773
2782
  return res;
2774
2783
  };
2775
2784
  }
2776
- const set$1 = /* @__PURE__ */ createSetter();
2785
+ const set = /* @__PURE__ */ createSetter();
2777
2786
  const shallowSet = /* @__PURE__ */ createSetter(true);
2778
2787
  function createSetter(shallow = false) {
2779
2788
  return function set2(target, key2, value2, receiver2) {
@@ -2825,7 +2834,7 @@ function ownKeys(target) {
2825
2834
  }
2826
2835
  const mutableHandlers = {
2827
2836
  get,
2828
- set: set$1,
2837
+ set,
2829
2838
  deleteProperty,
2830
2839
  has,
2831
2840
  ownKeys
@@ -2893,7 +2902,7 @@ function add(value2) {
2893
2902
  }
2894
2903
  return this;
2895
2904
  }
2896
- function set$1$1(key2, value2) {
2905
+ function set$1(key2, value2) {
2897
2906
  value2 = toRaw(value2);
2898
2907
  const target = toRaw(this);
2899
2908
  const { has: has2, get: get2 } = getProto(target);
@@ -2986,7 +2995,7 @@ function createInstrumentations() {
2986
2995
  },
2987
2996
  has: has$1,
2988
2997
  add,
2989
- set: set$1$1,
2998
+ set: set$1,
2990
2999
  delete: deleteEntry,
2991
3000
  clear,
2992
3001
  forEach: createForEach(false, false)
@@ -3000,7 +3009,7 @@ function createInstrumentations() {
3000
3009
  },
3001
3010
  has: has$1,
3002
3011
  add,
3003
- set: set$1$1,
3012
+ set: set$1,
3004
3013
  delete: deleteEntry,
3005
3014
  clear,
3006
3015
  forEach: createForEach(false, true)
@@ -8516,7 +8525,7 @@ const _sfc_main$1A = defineComponent({
8516
8525
  try {
8517
8526
  const url = new URL(buttonInfo.deeplink);
8518
8527
  const urlParam = url.searchParams.get("url");
8519
- if (buttonInfo.deeplink.startsWith("paypay://") && url.host === "embed" && urlParam) {
8528
+ if (buttonInfo.deeplink.startsWith("paypay://") && (url.host === "embed" || url.pathname === "//embed") && urlParam) {
8520
8529
  openWebviewInternal({ url: urlParam });
8521
8530
  return;
8522
8531
  }
@@ -26323,8 +26332,8 @@ const _sfc_main$1a = defineComponent({
26323
26332
  buttonDisabled.value = !editOK;
26324
26333
  }
26325
26334
  });
26326
- const open2 = computed(() => props.open);
26327
- watch(open2, (newOpen, prevOpen) => {
26335
+ const open = computed(() => props.open);
26336
+ watch(open, (newOpen, prevOpen) => {
26328
26337
  if (newOpen === false && prevOpen === true) {
26329
26338
  Object.assign(state, createInitialState$1());
26330
26339
  } else {
@@ -26528,12 +26537,12 @@ const _sfc_main$19 = defineComponent({
26528
26537
  const lg2 = getLanguage();
26529
26538
  const style = useCssModule();
26530
26539
  const close2 = () => emit("close");
26531
- const del2 = () => emit("del");
26540
+ const del = () => emit("del");
26532
26541
  const img2 = getImages();
26533
26542
  return {
26534
26543
  style,
26535
26544
  close: close2,
26536
- del: del2,
26545
+ del,
26537
26546
  lg: lg2,
26538
26547
  img: img2
26539
26548
  };
@@ -26908,7 +26917,7 @@ const _sfc_main$17 = defineComponent({
26908
26917
  return handleError2();
26909
26918
  }
26910
26919
  };
26911
- const del2 = async () => {
26920
+ const del = async () => {
26912
26921
  var _a, _b, _c;
26913
26922
  const addressListResponse = await getAddressList();
26914
26923
  if ((addressListResponse == null ? void 0 : addressListResponse.ppFetchResult) === "success") {
@@ -26943,7 +26952,7 @@ const _sfc_main$17 = defineComponent({
26943
26952
  addAddress: addAddress2,
26944
26953
  addSheetLoading: computed(() => state.addSheetLoading),
26945
26954
  addressList: computed(() => state.addressList),
26946
- del: del2,
26955
+ del,
26947
26956
  isDesktopPay,
26948
26957
  addOrEdit,
26949
26958
  triggerLayoutUpdate,
@@ -28050,7 +28059,7 @@ const _sfc_main$11 = defineComponent({
28050
28059
  },
28051
28060
  setup(props, { emit }) {
28052
28061
  const images2 = getImages();
28053
- const click2 = () => emit("click");
28062
+ const click = () => emit("click");
28054
28063
  const style = useCssModule();
28055
28064
  const cashBackInfo2 = computed(() => {
28056
28065
  var _a, _b, _c, _d, _e, _f;
@@ -28073,7 +28082,7 @@ const _sfc_main$11 = defineComponent({
28073
28082
  return cashBackInfo2.value.cashBackAmount;
28074
28083
  });
28075
28084
  return {
28076
- click: click2,
28085
+ click,
28077
28086
  style,
28078
28087
  cashBackInfo: cashBackInfo2,
28079
28088
  images: images2,
@@ -28442,7 +28451,7 @@ const _sfc_main$10 = defineComponent({
28442
28451
  millisecond: true,
28443
28452
  onFinish: () => {
28444
28453
  isCountDown.value = false;
28445
- click2();
28454
+ click();
28446
28455
  countDown.reset();
28447
28456
  }
28448
28457
  });
@@ -28465,7 +28474,7 @@ const _sfc_main$10 = defineComponent({
28465
28474
  state.showShrinkAnimation = false;
28466
28475
  }, timeout);
28467
28476
  };
28468
- const click2 = () => {
28477
+ const click = () => {
28469
28478
  if (state.showCashBackDetailList || props.hasCashBackAnimation && isMobile.value || props.hasCashBackAnimation && !props.hasConfirmAge && isDesktop.value)
28470
28479
  return;
28471
28480
  context.emit("success");
@@ -28498,7 +28507,7 @@ const _sfc_main$10 = defineComponent({
28498
28507
  }),
28499
28508
  statusLabelColor: computed(() => props.paymentResult.statusLabelColor.toLowerCase()),
28500
28509
  labelText: computed(() => props.paymentResult.statusLabelString),
28501
- click: click2,
28510
+ click,
28502
28511
  copy,
28503
28512
  showCashBackDetailList: computed(() => state.showCashBackDetailList),
28504
28513
  openCashBackDetailList,
@@ -29707,13 +29716,13 @@ const _sfc_main$U = defineComponent({
29707
29716
  },
29708
29717
  setup(props, { emit }) {
29709
29718
  const style = useCssModule();
29710
- const click2 = (price2) => {
29719
+ const click = (price2) => {
29711
29720
  emit("click", price2);
29712
29721
  };
29713
29722
  return {
29714
29723
  style,
29715
29724
  numberWithCommas,
29716
- click: click2
29725
+ click
29717
29726
  };
29718
29727
  }
29719
29728
  });
@@ -32245,8 +32254,6 @@ const _sfc_main$M = defineComponent({
32245
32254
  if (!alwaysDisplay)
32246
32255
  showPaymentResult(res.unsigned.data);
32247
32256
  (cashBackInfo2 == null ? void 0 : cashBackInfo2.cashBackDetail) && handleCashBackDetails(cashBackInfo2.cashBackDetail);
32248
- } else {
32249
- endApplication();
32250
32257
  }
32251
32258
  });
32252
32259
  };
@@ -33056,7 +33063,7 @@ const _sfc_main$K = defineComponent({
33056
33063
  },
33057
33064
  setup(props, { emit }) {
33058
33065
  const style = useCssModule();
33059
- const click2 = (item2, index2) => {
33066
+ const click = (item2, index2) => {
33060
33067
  emit("click", item2, index2);
33061
33068
  };
33062
33069
  return {
@@ -33076,7 +33083,7 @@ const _sfc_main$K = defineComponent({
33076
33083
  var _a, _b, _c;
33077
33084
  return (_c = (_b = (_a = props == null ? void 0 : props.selectedPaymentMethod) == null ? void 0 : _a.descriptionBannerInfo) == null ? void 0 : _b.displayResponse) == null ? void 0 : _c.buttonList;
33078
33085
  }),
33079
- click: click2,
33086
+ click,
33080
33087
  style
33081
33088
  };
33082
33089
  }
@@ -34942,22 +34949,12 @@ const initGetUserAddress = async (params) => {
34942
34949
  app.unmount();
34943
34950
  }, 300);
34944
34951
  };
34945
- const app = createApp(__spreadProps(__spreadValues({
34946
- setup() {
34947
- const close2 = () => {
34948
- closeSheet();
34949
- };
34950
- return {
34951
- show: show2,
34952
- close: close2
34953
- };
34954
- }
34955
- }, popStateHandler(closeSheet, params)), {
34952
+ const app = createApp(__spreadProps(__spreadValues({}, popStateHandler(closeSheet, params)), {
34956
34953
  render() {
34957
34954
  var _a2, _b2, _c2;
34958
34955
  return h(AppVue$7, {
34959
- show: this.show,
34960
- onClick: this.close,
34956
+ show: show2.value,
34957
+ onClick: closeSheet,
34961
34958
  getUserAddressParams: params,
34962
34959
  addresses: (_c2 = (_b2 = (_a2 = res == null ? void 0 : res.body) == null ? void 0 : _a2.unsigned) == null ? void 0 : _b2.data) == null ? void 0 : _c2.addresses
34963
34960
  });
@@ -35147,21 +35144,11 @@ const initInputAddress = (params) => {
35147
35144
  app.unmount();
35148
35145
  }, 300);
35149
35146
  };
35150
- const app = createApp(__spreadProps(__spreadValues({
35151
- setup() {
35152
- const close2 = () => {
35153
- closeSheet();
35154
- };
35155
- return {
35156
- show: show2,
35157
- close: close2
35158
- };
35159
- }
35160
- }, popStateHandler(closeSheet, params)), {
35147
+ const app = createApp(__spreadProps(__spreadValues({}, popStateHandler(closeSheet, params)), {
35161
35148
  render() {
35162
35149
  return h(AppView, {
35163
- show: this.show,
35164
- onClick: this.close,
35150
+ show: show2.value,
35151
+ onClick: closeSheet,
35165
35152
  inputAddressParams: params
35166
35153
  });
35167
35154
  }
@@ -35283,7 +35270,7 @@ function debug(params) {
35283
35270
  function execute$6(params) {
35284
35271
  var _a;
35285
35272
  (_a = params == null ? void 0 : params.success) == null ? void 0 : _a.call(params, {
35286
- v: "1.50.0"
35273
+ v: "1.51.0"
35287
35274
  });
35288
35275
  }
35289
35276
  function useCallBack(props, ctx) {
@@ -36424,22 +36411,12 @@ async function initRegisterEmail(initRegisterEmail2, allowsUpdate) {
36424
36411
  }, 350);
36425
36412
  };
36426
36413
  const resendOption = allowsUpdate && email2 && !emailVerified ? { resend: true, maskedEmail: email2 } : null;
36427
- const app = createApp(__spreadProps(__spreadValues({
36428
- setup() {
36429
- const closeApp2 = () => {
36430
- closeSheet();
36431
- };
36432
- return {
36433
- show: show2,
36434
- closeApp: closeApp2
36435
- };
36436
- }
36437
- }, popStateHandler(closeSheet, initRegisterEmail2)), {
36414
+ const app = createApp(__spreadProps(__spreadValues({}, popStateHandler(closeSheet, initRegisterEmail2)), {
36438
36415
  render() {
36439
36416
  return h(AppVue$1, {
36440
- show: this.show,
36417
+ show: show2.value,
36441
36418
  params: initRegisterEmail2,
36442
- onClick: this.closeApp,
36419
+ onClick: closeSheet,
36443
36420
  resendOption
36444
36421
  });
36445
36422
  }
@@ -37315,177 +37292,14 @@ function callbackHandler(params, callback) {
37315
37292
  }
37316
37293
  }
37317
37294
  var isVue2 = false;
37318
- function set(target, key2, val2) {
37319
- if (Array.isArray(target)) {
37320
- target.length = Math.max(target.length, key2);
37321
- target.splice(key2, 1, val2);
37322
- return val2;
37323
- }
37324
- target[key2] = val2;
37325
- return val2;
37326
- }
37327
- function del(target, key2) {
37328
- if (Array.isArray(target)) {
37329
- target.splice(key2, 1);
37330
- return;
37331
- }
37332
- delete target[key2];
37333
- }
37334
- function getDevtoolsGlobalHook() {
37335
- return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
37336
- }
37337
- function getTarget() {
37338
- return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
37339
- }
37340
- const isProxyAvailable = typeof Proxy === "function";
37341
- const HOOK_SETUP = "devtools-plugin:setup";
37342
- const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
37343
- let supported;
37344
- let perf;
37345
- function isPerformanceSupported() {
37346
- var _a;
37347
- if (supported !== void 0) {
37348
- return supported;
37349
- }
37350
- if (typeof window !== "undefined" && window.performance) {
37351
- supported = true;
37352
- perf = window.performance;
37353
- } else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
37354
- supported = true;
37355
- perf = global.perf_hooks.performance;
37356
- } else {
37357
- supported = false;
37358
- }
37359
- return supported;
37360
- }
37361
- function now() {
37362
- return isPerformanceSupported() ? perf.now() : Date.now();
37363
- }
37364
- class ApiProxy {
37365
- constructor(plugin, hook) {
37366
- this.target = null;
37367
- this.targetQueue = [];
37368
- this.onQueue = [];
37369
- this.plugin = plugin;
37370
- this.hook = hook;
37371
- const defaultSettings = {};
37372
- if (plugin.settings) {
37373
- for (const id in plugin.settings) {
37374
- const item2 = plugin.settings[id];
37375
- defaultSettings[id] = item2.defaultValue;
37376
- }
37377
- }
37378
- const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
37379
- let currentSettings = Object.assign({}, defaultSettings);
37380
- try {
37381
- const raw = localStorage.getItem(localSettingsSaveId);
37382
- const data2 = JSON.parse(raw);
37383
- Object.assign(currentSettings, data2);
37384
- } catch (e) {
37385
- }
37386
- this.fallbacks = {
37387
- getSettings() {
37388
- return currentSettings;
37389
- },
37390
- setSettings(value2) {
37391
- try {
37392
- localStorage.setItem(localSettingsSaveId, JSON.stringify(value2));
37393
- } catch (e) {
37394
- }
37395
- currentSettings = value2;
37396
- },
37397
- now() {
37398
- return now();
37399
- }
37400
- };
37401
- if (hook) {
37402
- hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value2) => {
37403
- if (pluginId === this.plugin.id) {
37404
- this.fallbacks.setSettings(value2);
37405
- }
37406
- });
37407
- }
37408
- this.proxiedOn = new Proxy({}, {
37409
- get: (_target, prop) => {
37410
- if (this.target) {
37411
- return this.target.on[prop];
37412
- } else {
37413
- return (...args) => {
37414
- this.onQueue.push({
37415
- method: prop,
37416
- args
37417
- });
37418
- };
37419
- }
37420
- }
37421
- });
37422
- this.proxiedTarget = new Proxy({}, {
37423
- get: (_target, prop) => {
37424
- if (this.target) {
37425
- return this.target[prop];
37426
- } else if (prop === "on") {
37427
- return this.proxiedOn;
37428
- } else if (Object.keys(this.fallbacks).includes(prop)) {
37429
- return (...args) => {
37430
- this.targetQueue.push({
37431
- method: prop,
37432
- args,
37433
- resolve: () => {
37434
- }
37435
- });
37436
- return this.fallbacks[prop](...args);
37437
- };
37438
- } else {
37439
- return (...args) => {
37440
- return new Promise((resolve2) => {
37441
- this.targetQueue.push({
37442
- method: prop,
37443
- args,
37444
- resolve: resolve2
37445
- });
37446
- });
37447
- };
37448
- }
37449
- }
37450
- });
37451
- }
37452
- async setRealTarget(target) {
37453
- this.target = target;
37454
- for (const item2 of this.onQueue) {
37455
- this.target.on[item2.method](...item2.args);
37456
- }
37457
- for (const item2 of this.targetQueue) {
37458
- item2.resolve(await this.target[item2.method](...item2.args));
37459
- }
37460
- }
37461
- }
37462
- function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
37463
- const descriptor = pluginDescriptor;
37464
- const target = getTarget();
37465
- const hook = getDevtoolsGlobalHook();
37466
- const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
37467
- if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
37468
- hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
37469
- } else {
37470
- const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
37471
- const list2 = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
37472
- list2.push({
37473
- pluginDescriptor: descriptor,
37474
- setupFn,
37475
- proxy
37476
- });
37477
- if (proxy)
37478
- setupFn(proxy.proxiedTarget);
37479
- }
37480
- }
37481
37295
  /*!
37482
- * pinia v2.0.18
37296
+ * pinia v2.0.22
37483
37297
  * (c) 2022 Eduardo San Martin Morote
37484
37298
  * @license MIT
37485
37299
  */
37486
37300
  let activePinia;
37487
37301
  const setActivePinia = (pinia) => activePinia = pinia;
37488
- const piniaSymbol = Symbol("pinia");
37302
+ const piniaSymbol = Symbol();
37489
37303
  function isPlainObject(o) {
37490
37304
  return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function";
37491
37305
  }
@@ -37495,721 +37309,6 @@ var MutationType;
37495
37309
  MutationType2["patchObject"] = "patch object";
37496
37310
  MutationType2["patchFunction"] = "patch function";
37497
37311
  })(MutationType || (MutationType = {}));
37498
- const IS_CLIENT = typeof window !== "undefined";
37499
- const _global = /* @__PURE__ */ (() => typeof window === "object" && window.window === window ? window : typeof self === "object" && self.self === self ? self : typeof global === "object" && global.global === global ? global : typeof globalThis === "object" ? globalThis : { HTMLElement: null })();
37500
- function bom(blob, { autoBom = false } = {}) {
37501
- if (autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
37502
- return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
37503
- }
37504
- return blob;
37505
- }
37506
- function download(url, name2, opts) {
37507
- const xhr = new XMLHttpRequest();
37508
- xhr.open("GET", url);
37509
- xhr.responseType = "blob";
37510
- xhr.onload = function() {
37511
- saveAs(xhr.response, name2, opts);
37512
- };
37513
- xhr.onerror = function() {
37514
- console.error("could not download file");
37515
- };
37516
- xhr.send();
37517
- }
37518
- function corsEnabled(url) {
37519
- const xhr = new XMLHttpRequest();
37520
- xhr.open("HEAD", url, false);
37521
- try {
37522
- xhr.send();
37523
- } catch (e) {
37524
- }
37525
- return xhr.status >= 200 && xhr.status <= 299;
37526
- }
37527
- function click(node) {
37528
- try {
37529
- node.dispatchEvent(new MouseEvent("click"));
37530
- } catch (e) {
37531
- const evt = document.createEvent("MouseEvents");
37532
- evt.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
37533
- node.dispatchEvent(evt);
37534
- }
37535
- }
37536
- const _navigator = typeof navigator === "object" ? navigator : { userAgent: "" };
37537
- const isMacOSWebView = /* @__PURE__ */ (() => /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent))();
37538
- const saveAs = !IS_CLIENT ? () => {
37539
- } : typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : "msSaveOrOpenBlob" in _navigator ? msSaveAs : fileSaverSaveAs;
37540
- function downloadSaveAs(blob, name2 = "download", opts) {
37541
- const a = document.createElement("a");
37542
- a.download = name2;
37543
- a.rel = "noopener";
37544
- if (typeof blob === "string") {
37545
- a.href = blob;
37546
- if (a.origin !== location.origin) {
37547
- if (corsEnabled(a.href)) {
37548
- download(blob, name2, opts);
37549
- } else {
37550
- a.target = "_blank";
37551
- click(a);
37552
- }
37553
- } else {
37554
- click(a);
37555
- }
37556
- } else {
37557
- a.href = URL.createObjectURL(blob);
37558
- setTimeout(function() {
37559
- URL.revokeObjectURL(a.href);
37560
- }, 4e4);
37561
- setTimeout(function() {
37562
- click(a);
37563
- }, 0);
37564
- }
37565
- }
37566
- function msSaveAs(blob, name2 = "download", opts) {
37567
- if (typeof blob === "string") {
37568
- if (corsEnabled(blob)) {
37569
- download(blob, name2, opts);
37570
- } else {
37571
- const a = document.createElement("a");
37572
- a.href = blob;
37573
- a.target = "_blank";
37574
- setTimeout(function() {
37575
- click(a);
37576
- });
37577
- }
37578
- } else {
37579
- navigator.msSaveOrOpenBlob(bom(blob, opts), name2);
37580
- }
37581
- }
37582
- function fileSaverSaveAs(blob, name2, opts, popup) {
37583
- popup = popup || open("", "_blank");
37584
- if (popup) {
37585
- popup.document.title = popup.document.body.innerText = "downloading...";
37586
- }
37587
- if (typeof blob === "string")
37588
- return download(blob, name2, opts);
37589
- const force = blob.type === "application/octet-stream";
37590
- const isSafari2 = /constructor/i.test(String(_global.HTMLElement)) || "safari" in _global;
37591
- const isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
37592
- if ((isChromeIOS || force && isSafari2 || isMacOSWebView) && typeof FileReader !== "undefined") {
37593
- const reader = new FileReader();
37594
- reader.onloadend = function() {
37595
- let url = reader.result;
37596
- if (typeof url !== "string") {
37597
- popup = null;
37598
- throw new Error("Wrong reader.result type");
37599
- }
37600
- url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, "data:attachment/file;");
37601
- if (popup) {
37602
- popup.location.href = url;
37603
- } else {
37604
- location.assign(url);
37605
- }
37606
- popup = null;
37607
- };
37608
- reader.readAsDataURL(blob);
37609
- } else {
37610
- const url = URL.createObjectURL(blob);
37611
- if (popup)
37612
- popup.location.assign(url);
37613
- else
37614
- location.href = url;
37615
- popup = null;
37616
- setTimeout(function() {
37617
- URL.revokeObjectURL(url);
37618
- }, 4e4);
37619
- }
37620
- }
37621
- function toastMessage(message, type) {
37622
- const piniaMessage = "\u{1F34D} " + message;
37623
- if (typeof __VUE_DEVTOOLS_TOAST__ === "function") {
37624
- __VUE_DEVTOOLS_TOAST__(piniaMessage, type);
37625
- } else if (type === "error") {
37626
- console.error(piniaMessage);
37627
- } else if (type === "warn") {
37628
- console.warn(piniaMessage);
37629
- } else {
37630
- console.log(piniaMessage);
37631
- }
37632
- }
37633
- function isPinia(o) {
37634
- return "_a" in o && "install" in o;
37635
- }
37636
- function checkClipboardAccess() {
37637
- if (!("clipboard" in navigator)) {
37638
- toastMessage(`Your browser doesn't support the Clipboard API`, "error");
37639
- return true;
37640
- }
37641
- }
37642
- function checkNotFocusedError(error2) {
37643
- if (error2 instanceof Error && error2.message.toLowerCase().includes("document is not focused")) {
37644
- toastMessage('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.', "warn");
37645
- return true;
37646
- }
37647
- return false;
37648
- }
37649
- async function actionGlobalCopyState(pinia) {
37650
- if (checkClipboardAccess())
37651
- return;
37652
- try {
37653
- await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));
37654
- toastMessage("Global state copied to clipboard.");
37655
- } catch (error2) {
37656
- if (checkNotFocusedError(error2))
37657
- return;
37658
- toastMessage(`Failed to serialize the state. Check the console for more details.`, "error");
37659
- console.error(error2);
37660
- }
37661
- }
37662
- async function actionGlobalPasteState(pinia) {
37663
- if (checkClipboardAccess())
37664
- return;
37665
- try {
37666
- pinia.state.value = JSON.parse(await navigator.clipboard.readText());
37667
- toastMessage("Global state pasted from clipboard.");
37668
- } catch (error2) {
37669
- if (checkNotFocusedError(error2))
37670
- return;
37671
- toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, "error");
37672
- console.error(error2);
37673
- }
37674
- }
37675
- async function actionGlobalSaveState(pinia) {
37676
- try {
37677
- saveAs(new Blob([JSON.stringify(pinia.state.value)], {
37678
- type: "text/plain;charset=utf-8"
37679
- }), "pinia-state.json");
37680
- } catch (error2) {
37681
- toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
37682
- console.error(error2);
37683
- }
37684
- }
37685
- let fileInput;
37686
- function getFileOpener() {
37687
- if (!fileInput) {
37688
- fileInput = document.createElement("input");
37689
- fileInput.type = "file";
37690
- fileInput.accept = ".json";
37691
- }
37692
- function openFile() {
37693
- return new Promise((resolve2, reject) => {
37694
- fileInput.onchange = async () => {
37695
- const files = fileInput.files;
37696
- if (!files)
37697
- return resolve2(null);
37698
- const file = files.item(0);
37699
- if (!file)
37700
- return resolve2(null);
37701
- return resolve2({ text: await file.text(), file });
37702
- };
37703
- fileInput.oncancel = () => resolve2(null);
37704
- fileInput.onerror = reject;
37705
- fileInput.click();
37706
- });
37707
- }
37708
- return openFile;
37709
- }
37710
- async function actionGlobalOpenStateFile(pinia) {
37711
- try {
37712
- const open2 = await getFileOpener();
37713
- const result2 = await open2();
37714
- if (!result2)
37715
- return;
37716
- const { text: text2, file } = result2;
37717
- pinia.state.value = JSON.parse(text2);
37718
- toastMessage(`Global state imported from "${file.name}".`);
37719
- } catch (error2) {
37720
- toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
37721
- console.error(error2);
37722
- }
37723
- }
37724
- function formatDisplay(display) {
37725
- return {
37726
- _custom: {
37727
- display
37728
- }
37729
- };
37730
- }
37731
- const PINIA_ROOT_LABEL = "\u{1F34D} Pinia (root)";
37732
- const PINIA_ROOT_ID = "_root";
37733
- function formatStoreForInspectorTree(store) {
37734
- return isPinia(store) ? {
37735
- id: PINIA_ROOT_ID,
37736
- label: PINIA_ROOT_LABEL
37737
- } : {
37738
- id: store.$id,
37739
- label: store.$id
37740
- };
37741
- }
37742
- function formatStoreForInspectorState(store) {
37743
- if (isPinia(store)) {
37744
- const storeNames = Array.from(store._s.keys());
37745
- const storeMap = store._s;
37746
- const state2 = {
37747
- state: storeNames.map((storeId) => ({
37748
- editable: true,
37749
- key: storeId,
37750
- value: store.state.value[storeId]
37751
- })),
37752
- getters: storeNames.filter((id) => storeMap.get(id)._getters).map((id) => {
37753
- const store2 = storeMap.get(id);
37754
- return {
37755
- editable: false,
37756
- key: id,
37757
- value: store2._getters.reduce((getters, key2) => {
37758
- getters[key2] = store2[key2];
37759
- return getters;
37760
- }, {})
37761
- };
37762
- })
37763
- };
37764
- return state2;
37765
- }
37766
- const state = {
37767
- state: Object.keys(store.$state).map((key2) => ({
37768
- editable: true,
37769
- key: key2,
37770
- value: store.$state[key2]
37771
- }))
37772
- };
37773
- if (store._getters && store._getters.length) {
37774
- state.getters = store._getters.map((getterName) => ({
37775
- editable: false,
37776
- key: getterName,
37777
- value: store[getterName]
37778
- }));
37779
- }
37780
- if (store._customProperties.size) {
37781
- state.customProperties = Array.from(store._customProperties).map((key2) => ({
37782
- editable: true,
37783
- key: key2,
37784
- value: store[key2]
37785
- }));
37786
- }
37787
- return state;
37788
- }
37789
- function formatEventData(events) {
37790
- if (!events)
37791
- return {};
37792
- if (Array.isArray(events)) {
37793
- return events.reduce((data2, event) => {
37794
- data2.keys.push(event.key);
37795
- data2.operations.push(event.type);
37796
- data2.oldValue[event.key] = event.oldValue;
37797
- data2.newValue[event.key] = event.newValue;
37798
- return data2;
37799
- }, {
37800
- oldValue: {},
37801
- keys: [],
37802
- operations: [],
37803
- newValue: {}
37804
- });
37805
- } else {
37806
- return {
37807
- operation: formatDisplay(events.type),
37808
- key: formatDisplay(events.key),
37809
- oldValue: events.oldValue,
37810
- newValue: events.newValue
37811
- };
37812
- }
37813
- }
37814
- function formatMutationType(type) {
37815
- switch (type) {
37816
- case MutationType.direct:
37817
- return "mutation";
37818
- case MutationType.patchFunction:
37819
- return "$patch";
37820
- case MutationType.patchObject:
37821
- return "$patch";
37822
- default:
37823
- return "unknown";
37824
- }
37825
- }
37826
- let isTimelineActive = true;
37827
- const componentStateTypes = [];
37828
- const MUTATIONS_LAYER_ID = "pinia:mutations";
37829
- const INSPECTOR_ID = "pinia";
37830
- const getStoreType = (id) => "\u{1F34D} " + id;
37831
- function registerPiniaDevtools(app, pinia) {
37832
- setupDevtoolsPlugin({
37833
- id: "dev.esm.pinia",
37834
- label: "Pinia \u{1F34D}",
37835
- logo: "https://pinia.vuejs.org/logo.svg",
37836
- packageName: "pinia",
37837
- homepage: "https://pinia.vuejs.org",
37838
- componentStateTypes,
37839
- app
37840
- }, (api2) => {
37841
- if (typeof api2.now !== "function") {
37842
- toastMessage("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
37843
- }
37844
- api2.addTimelineLayer({
37845
- id: MUTATIONS_LAYER_ID,
37846
- label: `Pinia \u{1F34D}`,
37847
- color: 15064968
37848
- });
37849
- api2.addInspector({
37850
- id: INSPECTOR_ID,
37851
- label: "Pinia \u{1F34D}",
37852
- icon: "storage",
37853
- treeFilterPlaceholder: "Search stores",
37854
- actions: [
37855
- {
37856
- icon: "content_copy",
37857
- action: () => {
37858
- actionGlobalCopyState(pinia);
37859
- },
37860
- tooltip: "Serialize and copy the state"
37861
- },
37862
- {
37863
- icon: "content_paste",
37864
- action: async () => {
37865
- await actionGlobalPasteState(pinia);
37866
- api2.sendInspectorTree(INSPECTOR_ID);
37867
- api2.sendInspectorState(INSPECTOR_ID);
37868
- },
37869
- tooltip: "Replace the state with the content of your clipboard"
37870
- },
37871
- {
37872
- icon: "save",
37873
- action: () => {
37874
- actionGlobalSaveState(pinia);
37875
- },
37876
- tooltip: "Save the state as a JSON file"
37877
- },
37878
- {
37879
- icon: "folder_open",
37880
- action: async () => {
37881
- await actionGlobalOpenStateFile(pinia);
37882
- api2.sendInspectorTree(INSPECTOR_ID);
37883
- api2.sendInspectorState(INSPECTOR_ID);
37884
- },
37885
- tooltip: "Import the state from a JSON file"
37886
- }
37887
- ],
37888
- nodeActions: [
37889
- {
37890
- icon: "restore",
37891
- tooltip: "Reset the state (option store only)",
37892
- action: (nodeId) => {
37893
- const store = pinia._s.get(nodeId);
37894
- if (!store) {
37895
- toastMessage(`Cannot reset "${nodeId}" store because it wasn't found.`, "warn");
37896
- } else if (!store._isOptionsAPI) {
37897
- toastMessage(`Cannot reset "${nodeId}" store because it's a setup store.`, "warn");
37898
- } else {
37899
- store.$reset();
37900
- toastMessage(`Store "${nodeId}" reset.`);
37901
- }
37902
- }
37903
- }
37904
- ]
37905
- });
37906
- api2.on.inspectComponent((payload, ctx) => {
37907
- const proxy = payload.componentInstance && payload.componentInstance.proxy;
37908
- if (proxy && proxy._pStores) {
37909
- const piniaStores = payload.componentInstance.proxy._pStores;
37910
- Object.values(piniaStores).forEach((store) => {
37911
- payload.instanceData.state.push({
37912
- type: getStoreType(store.$id),
37913
- key: "state",
37914
- editable: true,
37915
- value: store._isOptionsAPI ? {
37916
- _custom: {
37917
- value: toRaw(store.$state),
37918
- actions: [
37919
- {
37920
- icon: "restore",
37921
- tooltip: "Reset the state of this store",
37922
- action: () => store.$reset()
37923
- }
37924
- ]
37925
- }
37926
- } : Object.keys(store.$state).reduce((state, key2) => {
37927
- state[key2] = store.$state[key2];
37928
- return state;
37929
- }, {})
37930
- });
37931
- if (store._getters && store._getters.length) {
37932
- payload.instanceData.state.push({
37933
- type: getStoreType(store.$id),
37934
- key: "getters",
37935
- editable: false,
37936
- value: store._getters.reduce((getters, key2) => {
37937
- try {
37938
- getters[key2] = store[key2];
37939
- } catch (error2) {
37940
- getters[key2] = error2;
37941
- }
37942
- return getters;
37943
- }, {})
37944
- });
37945
- }
37946
- });
37947
- }
37948
- });
37949
- api2.on.getInspectorTree((payload) => {
37950
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
37951
- let stores = [pinia];
37952
- stores = stores.concat(Array.from(pinia._s.values()));
37953
- payload.rootNodes = (payload.filter ? stores.filter((store) => "$id" in store ? store.$id.toLowerCase().includes(payload.filter.toLowerCase()) : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase())) : stores).map(formatStoreForInspectorTree);
37954
- }
37955
- });
37956
- api2.on.getInspectorState((payload) => {
37957
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
37958
- const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
37959
- if (!inspectedStore) {
37960
- return;
37961
- }
37962
- if (inspectedStore) {
37963
- payload.state = formatStoreForInspectorState(inspectedStore);
37964
- }
37965
- }
37966
- });
37967
- api2.on.editInspectorState((payload, ctx) => {
37968
- if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
37969
- const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
37970
- if (!inspectedStore) {
37971
- return toastMessage(`store "${payload.nodeId}" not found`, "error");
37972
- }
37973
- const { path } = payload;
37974
- if (!isPinia(inspectedStore)) {
37975
- if (path.length !== 1 || !inspectedStore._customProperties.has(path[0]) || path[0] in inspectedStore.$state) {
37976
- path.unshift("$state");
37977
- }
37978
- } else {
37979
- path.unshift("state");
37980
- }
37981
- isTimelineActive = false;
37982
- payload.set(inspectedStore, path, payload.state.value);
37983
- isTimelineActive = true;
37984
- }
37985
- });
37986
- api2.on.editComponentState((payload) => {
37987
- if (payload.type.startsWith("\u{1F34D}")) {
37988
- const storeId = payload.type.replace(/^🍍\s*/, "");
37989
- const store = pinia._s.get(storeId);
37990
- if (!store) {
37991
- return toastMessage(`store "${storeId}" not found`, "error");
37992
- }
37993
- const { path } = payload;
37994
- if (path[0] !== "state") {
37995
- return toastMessage(`Invalid path for store "${storeId}":
37996
- ${path}
37997
- Only state can be modified.`);
37998
- }
37999
- path[0] = "$state";
38000
- isTimelineActive = false;
38001
- payload.set(store, path, payload.state.value);
38002
- isTimelineActive = true;
38003
- }
38004
- });
38005
- });
38006
- }
38007
- function addStoreToDevtools(app, store) {
38008
- if (!componentStateTypes.includes(getStoreType(store.$id))) {
38009
- componentStateTypes.push(getStoreType(store.$id));
38010
- }
38011
- setupDevtoolsPlugin({
38012
- id: "dev.esm.pinia",
38013
- label: "Pinia \u{1F34D}",
38014
- logo: "https://pinia.vuejs.org/logo.svg",
38015
- packageName: "pinia",
38016
- homepage: "https://pinia.vuejs.org",
38017
- componentStateTypes,
38018
- app,
38019
- settings: {
38020
- logStoreChanges: {
38021
- label: "Notify about new/deleted stores",
38022
- type: "boolean",
38023
- defaultValue: true
38024
- }
38025
- }
38026
- }, (api2) => {
38027
- const now2 = typeof api2.now === "function" ? api2.now.bind(api2) : Date.now;
38028
- store.$onAction(({ after, onError, name: name2, args }) => {
38029
- const groupId = runningActionId++;
38030
- api2.addTimelineEvent({
38031
- layerId: MUTATIONS_LAYER_ID,
38032
- event: {
38033
- time: now2(),
38034
- title: "\u{1F6EB} " + name2,
38035
- subtitle: "start",
38036
- data: {
38037
- store: formatDisplay(store.$id),
38038
- action: formatDisplay(name2),
38039
- args
38040
- },
38041
- groupId
38042
- }
38043
- });
38044
- after((result2) => {
38045
- activeAction = void 0;
38046
- api2.addTimelineEvent({
38047
- layerId: MUTATIONS_LAYER_ID,
38048
- event: {
38049
- time: now2(),
38050
- title: "\u{1F6EC} " + name2,
38051
- subtitle: "end",
38052
- data: {
38053
- store: formatDisplay(store.$id),
38054
- action: formatDisplay(name2),
38055
- args,
38056
- result: result2
38057
- },
38058
- groupId
38059
- }
38060
- });
38061
- });
38062
- onError((error2) => {
38063
- activeAction = void 0;
38064
- api2.addTimelineEvent({
38065
- layerId: MUTATIONS_LAYER_ID,
38066
- event: {
38067
- time: now2(),
38068
- logType: "error",
38069
- title: "\u{1F4A5} " + name2,
38070
- subtitle: "end",
38071
- data: {
38072
- store: formatDisplay(store.$id),
38073
- action: formatDisplay(name2),
38074
- args,
38075
- error: error2
38076
- },
38077
- groupId
38078
- }
38079
- });
38080
- });
38081
- }, true);
38082
- store._customProperties.forEach((name2) => {
38083
- watch(() => unref(store[name2]), (newValue, oldValue) => {
38084
- api2.notifyComponentUpdate();
38085
- api2.sendInspectorState(INSPECTOR_ID);
38086
- if (isTimelineActive) {
38087
- api2.addTimelineEvent({
38088
- layerId: MUTATIONS_LAYER_ID,
38089
- event: {
38090
- time: now2(),
38091
- title: "Change",
38092
- subtitle: name2,
38093
- data: {
38094
- newValue,
38095
- oldValue
38096
- },
38097
- groupId: activeAction
38098
- }
38099
- });
38100
- }
38101
- }, { deep: true });
38102
- });
38103
- store.$subscribe(({ events, type }, state) => {
38104
- api2.notifyComponentUpdate();
38105
- api2.sendInspectorState(INSPECTOR_ID);
38106
- if (!isTimelineActive)
38107
- return;
38108
- const eventData = {
38109
- time: now2(),
38110
- title: formatMutationType(type),
38111
- data: __spreadValues({
38112
- store: formatDisplay(store.$id)
38113
- }, formatEventData(events)),
38114
- groupId: activeAction
38115
- };
38116
- activeAction = void 0;
38117
- if (type === MutationType.patchFunction) {
38118
- eventData.subtitle = "\u2935\uFE0F";
38119
- } else if (type === MutationType.patchObject) {
38120
- eventData.subtitle = "\u{1F9E9}";
38121
- } else if (events && !Array.isArray(events)) {
38122
- eventData.subtitle = events.type;
38123
- }
38124
- if (events) {
38125
- eventData.data["rawEvent(s)"] = {
38126
- _custom: {
38127
- display: "DebuggerEvent",
38128
- type: "object",
38129
- tooltip: "raw DebuggerEvent[]",
38130
- value: events
38131
- }
38132
- };
38133
- }
38134
- api2.addTimelineEvent({
38135
- layerId: MUTATIONS_LAYER_ID,
38136
- event: eventData
38137
- });
38138
- }, { detached: true, flush: "sync" });
38139
- const hotUpdate = store._hotUpdate;
38140
- store._hotUpdate = markRaw((newStore) => {
38141
- hotUpdate(newStore);
38142
- api2.addTimelineEvent({
38143
- layerId: MUTATIONS_LAYER_ID,
38144
- event: {
38145
- time: now2(),
38146
- title: "\u{1F525} " + store.$id,
38147
- subtitle: "HMR update",
38148
- data: {
38149
- store: formatDisplay(store.$id),
38150
- info: formatDisplay(`HMR update`)
38151
- }
38152
- }
38153
- });
38154
- api2.notifyComponentUpdate();
38155
- api2.sendInspectorTree(INSPECTOR_ID);
38156
- api2.sendInspectorState(INSPECTOR_ID);
38157
- });
38158
- const { $dispose } = store;
38159
- store.$dispose = () => {
38160
- $dispose();
38161
- api2.notifyComponentUpdate();
38162
- api2.sendInspectorTree(INSPECTOR_ID);
38163
- api2.sendInspectorState(INSPECTOR_ID);
38164
- api2.getSettings().logStoreChanges && toastMessage(`Disposed "${store.$id}" store \u{1F5D1}`);
38165
- };
38166
- api2.notifyComponentUpdate();
38167
- api2.sendInspectorTree(INSPECTOR_ID);
38168
- api2.sendInspectorState(INSPECTOR_ID);
38169
- api2.getSettings().logStoreChanges && toastMessage(`"${store.$id}" store installed \u{1F195}`);
38170
- });
38171
- }
38172
- let runningActionId = 0;
38173
- let activeAction;
38174
- function patchActionForGrouping(store, actionNames) {
38175
- const actions = actionNames.reduce((storeActions, actionName) => {
38176
- storeActions[actionName] = toRaw(store)[actionName];
38177
- return storeActions;
38178
- }, {});
38179
- for (const actionName in actions) {
38180
- store[actionName] = function() {
38181
- const _actionId = runningActionId;
38182
- const trackedStore = new Proxy(store, {
38183
- get(...args) {
38184
- activeAction = _actionId;
38185
- return Reflect.get(...args);
38186
- },
38187
- set(...args) {
38188
- activeAction = _actionId;
38189
- return Reflect.set(...args);
38190
- }
38191
- });
38192
- return actions[actionName].apply(trackedStore, arguments);
38193
- };
38194
- }
38195
- }
38196
- function devtoolsPlugin({ app, store, options }) {
38197
- if (store.$id.startsWith("__hot:")) {
38198
- return;
38199
- }
38200
- if (options.state) {
38201
- store._isOptionsAPI = true;
38202
- }
38203
- if (typeof options.state === "function") {
38204
- patchActionForGrouping(store, Object.keys(options.actions));
38205
- const originalHotUpdate = store._hotUpdate;
38206
- toRaw(store)._hotUpdate = function(newStore) {
38207
- originalHotUpdate.apply(this, arguments);
38208
- patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions));
38209
- };
38210
- }
38211
- addStoreToDevtools(app, store);
38212
- }
38213
37312
  function createPinia() {
38214
37313
  const scope = effectScope(true);
38215
37314
  const state = scope.run(() => ref({}));
@@ -38222,9 +37321,6 @@ function createPinia() {
38222
37321
  pinia._a = app;
38223
37322
  app.provide(piniaSymbol, pinia);
38224
37323
  app.config.globalProperties.$pinia = pinia;
38225
- if (IS_CLIENT) {
38226
- registerPiniaDevtools(app, pinia);
38227
- }
38228
37324
  toBeInstalled.forEach((plugin) => _p.push(plugin));
38229
37325
  toBeInstalled = [];
38230
37326
  }
@@ -38243,28 +37339,8 @@ function createPinia() {
38243
37339
  _s: new Map(),
38244
37340
  state
38245
37341
  });
38246
- if (IS_CLIENT && true && typeof Proxy !== "undefined") {
38247
- pinia.use(devtoolsPlugin);
38248
- }
38249
37342
  return pinia;
38250
37343
  }
38251
- function patchObject(newState, oldState) {
38252
- for (const key2 in oldState) {
38253
- const subPatch = oldState[key2];
38254
- if (!(key2 in newState)) {
38255
- continue;
38256
- }
38257
- const targetValue = newState[key2];
38258
- if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) {
38259
- newState[key2] = patchObject(targetValue, subPatch);
38260
- } else {
38261
- {
38262
- newState[key2] = subPatch;
38263
- }
38264
- }
38265
- }
38266
- return newState;
38267
- }
38268
37344
  const noop = () => {
38269
37345
  };
38270
37346
  function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
@@ -38287,6 +37363,12 @@ function triggerSubscriptions(subscriptions, ...args) {
38287
37363
  });
38288
37364
  }
38289
37365
  function mergeReactiveObjects(target, patchToApply) {
37366
+ if (target instanceof Map && patchToApply instanceof Map) {
37367
+ patchToApply.forEach((value2, key2) => target.set(key2, value2));
37368
+ }
37369
+ if (target instanceof Set && patchToApply instanceof Set) {
37370
+ patchToApply.forEach(target.add, target);
37371
+ }
38290
37372
  for (const key2 in patchToApply) {
38291
37373
  if (!patchToApply.hasOwnProperty(key2))
38292
37374
  continue;
@@ -38300,7 +37382,7 @@ function mergeReactiveObjects(target, patchToApply) {
38300
37382
  }
38301
37383
  return target;
38302
37384
  }
38303
- const skipHydrateSymbol = Symbol("pinia:skipHydration");
37385
+ const skipHydrateSymbol = Symbol();
38304
37386
  function shouldHydrate(obj) {
38305
37387
  return !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
38306
37388
  }
@@ -38313,16 +37395,13 @@ function createOptionsStore(id, options, pinia, hot) {
38313
37395
  const initialState2 = pinia.state.value[id];
38314
37396
  let store;
38315
37397
  function setup() {
38316
- if (!initialState2 && !hot) {
37398
+ if (!initialState2 && true) {
38317
37399
  {
38318
37400
  pinia.state.value[id] = state ? state() : {};
38319
37401
  }
38320
37402
  }
38321
- const localState = hot ? toRefs(ref(state ? state() : {}).value) : toRefs(pinia.state.value[id]);
37403
+ const localState = toRefs(pinia.state.value[id]);
38322
37404
  return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name2) => {
38323
- if (name2 in localState) {
38324
- console.warn(`[\u{1F34D}]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name2}" in store "${id}".`);
38325
- }
38326
37405
  computedGetters[name2] = markRaw(computed(() => {
38327
37406
  setActivePinia(pinia);
38328
37407
  const store2 = pinia._s.get(id);
@@ -38343,44 +37422,25 @@ function createOptionsStore(id, options, pinia, hot) {
38343
37422
  function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
38344
37423
  let scope;
38345
37424
  const optionsForPlugin = assign({ actions: {} }, options);
38346
- if (!pinia._e.active) {
38347
- throw new Error("Pinia destroyed");
38348
- }
38349
37425
  const $subscribeOptions = {
38350
37426
  deep: true
38351
37427
  };
38352
- {
38353
- $subscribeOptions.onTrigger = (event) => {
38354
- if (isListening) {
38355
- debuggerEvents = event;
38356
- } else if (isListening == false && !store._hotUpdating) {
38357
- if (Array.isArray(debuggerEvents)) {
38358
- debuggerEvents.push(event);
38359
- } else {
38360
- console.error("\u{1F34D} debuggerEvents should be an array. This is most likely an internal Pinia bug.");
38361
- }
38362
- }
38363
- };
38364
- }
38365
37428
  let isListening;
38366
37429
  let isSyncListening;
38367
37430
  let subscriptions = markRaw([]);
38368
37431
  let actionSubscriptions = markRaw([]);
38369
37432
  let debuggerEvents;
38370
37433
  const initialState2 = pinia.state.value[$id];
38371
- if (!isOptionsStore && !initialState2 && !hot) {
37434
+ if (!isOptionsStore && !initialState2 && true) {
38372
37435
  {
38373
37436
  pinia.state.value[$id] = {};
38374
37437
  }
38375
37438
  }
38376
- const hotState = ref({});
37439
+ ref({});
38377
37440
  let activeListener;
38378
37441
  function $patch(partialStateOrMutator) {
38379
37442
  let subscriptionMutation;
38380
37443
  isListening = isSyncListening = false;
38381
- {
38382
- debuggerEvents = [];
38383
- }
38384
37444
  if (typeof partialStateOrMutator === "function") {
38385
37445
  partialStateOrMutator(pinia.state.value[$id]);
38386
37446
  subscriptionMutation = {
@@ -38406,9 +37466,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
38406
37466
  isSyncListening = true;
38407
37467
  triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
38408
37468
  }
38409
- const $reset = () => {
38410
- throw new Error(`\u{1F34D}: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
38411
- };
37469
+ const $reset = noop;
38412
37470
  function $dispose() {
38413
37471
  scope.stop();
38414
37472
  subscriptions = [];
@@ -38454,12 +37512,6 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
38454
37512
  return ret;
38455
37513
  };
38456
37514
  }
38457
- const _hmrPayload = /* @__PURE__ */ markRaw({
38458
- actions: {},
38459
- getters: {},
38460
- state: [],
38461
- hotState
38462
- });
38463
37515
  const partialStore = {
38464
37516
  _p: pinia,
38465
37517
  $id,
@@ -38481,10 +37533,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
38481
37533
  },
38482
37534
  $dispose
38483
37535
  };
38484
- const store = reactive(assign(IS_CLIENT ? {
38485
- _customProperties: markRaw(new Set()),
38486
- _hmrPayload
38487
- } : {}, partialStore));
37536
+ const store = reactive(assign({}, partialStore));
38488
37537
  pinia._s.set($id, store);
38489
37538
  const setupStore = pinia._e.run(() => {
38490
37539
  scope = effectScope();
@@ -38493,9 +37542,7 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
38493
37542
  for (const key2 in setupStore) {
38494
37543
  const prop = setupStore[key2];
38495
37544
  if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
38496
- if (hot) {
38497
- set(hotState.value, key2, toRef(setupStore, key2));
38498
- } else if (!isOptionsStore) {
37545
+ if (!isOptionsStore) {
38499
37546
  if (initialState2 && shouldHydrate(prop)) {
38500
37547
  if (isRef(prop)) {
38501
37548
  prop.value = initialState2[key2];
@@ -38507,120 +37554,29 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
38507
37554
  pinia.state.value[$id][key2] = prop;
38508
37555
  }
38509
37556
  }
38510
- {
38511
- _hmrPayload.state.push(key2);
38512
- }
38513
37557
  } else if (typeof prop === "function") {
38514
- const actionValue = hot ? prop : wrapAction(key2, prop);
37558
+ const actionValue = wrapAction(key2, prop);
38515
37559
  {
38516
37560
  setupStore[key2] = actionValue;
38517
37561
  }
38518
- {
38519
- _hmrPayload.actions[key2] = prop;
38520
- }
38521
37562
  optionsForPlugin.actions[key2] = prop;
38522
- } else {
38523
- if (isComputed(prop)) {
38524
- _hmrPayload.getters[key2] = isOptionsStore ? options.getters[key2] : prop;
38525
- if (IS_CLIENT) {
38526
- const getters = setupStore._getters || (setupStore._getters = markRaw([]));
38527
- getters.push(key2);
38528
- }
38529
- }
38530
- }
37563
+ } else
37564
+ ;
38531
37565
  }
38532
37566
  {
38533
37567
  assign(store, setupStore);
38534
37568
  assign(toRaw(store), setupStore);
38535
37569
  }
38536
37570
  Object.defineProperty(store, "$state", {
38537
- get: () => hot ? hotState.value : pinia.state.value[$id],
37571
+ get: () => pinia.state.value[$id],
38538
37572
  set: (state) => {
38539
- if (hot) {
38540
- throw new Error("cannot set hotState");
38541
- }
38542
37573
  $patch(($state) => {
38543
37574
  assign($state, state);
38544
37575
  });
38545
37576
  }
38546
37577
  });
38547
- {
38548
- store._hotUpdate = markRaw((newStore) => {
38549
- store._hotUpdating = true;
38550
- newStore._hmrPayload.state.forEach((stateKey) => {
38551
- if (stateKey in store.$state) {
38552
- const newStateTarget = newStore.$state[stateKey];
38553
- const oldStateSource = store.$state[stateKey];
38554
- if (typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
38555
- patchObject(newStateTarget, oldStateSource);
38556
- } else {
38557
- newStore.$state[stateKey] = oldStateSource;
38558
- }
38559
- }
38560
- set(store, stateKey, toRef(newStore.$state, stateKey));
38561
- });
38562
- Object.keys(store.$state).forEach((stateKey) => {
38563
- if (!(stateKey in newStore.$state)) {
38564
- del(store, stateKey);
38565
- }
38566
- });
38567
- isListening = false;
38568
- isSyncListening = false;
38569
- pinia.state.value[$id] = toRef(newStore._hmrPayload, "hotState");
38570
- isSyncListening = true;
38571
- nextTick().then(() => {
38572
- isListening = true;
38573
- });
38574
- for (const actionName in newStore._hmrPayload.actions) {
38575
- const action = newStore[actionName];
38576
- set(store, actionName, wrapAction(actionName, action));
38577
- }
38578
- for (const getterName in newStore._hmrPayload.getters) {
38579
- const getter = newStore._hmrPayload.getters[getterName];
38580
- const getterValue = isOptionsStore ? computed(() => {
38581
- setActivePinia(pinia);
38582
- return getter.call(store, store);
38583
- }) : getter;
38584
- set(store, getterName, getterValue);
38585
- }
38586
- Object.keys(store._hmrPayload.getters).forEach((key2) => {
38587
- if (!(key2 in newStore._hmrPayload.getters)) {
38588
- del(store, key2);
38589
- }
38590
- });
38591
- Object.keys(store._hmrPayload.actions).forEach((key2) => {
38592
- if (!(key2 in newStore._hmrPayload.actions)) {
38593
- del(store, key2);
38594
- }
38595
- });
38596
- store._hmrPayload = newStore._hmrPayload;
38597
- store._getters = newStore._getters;
38598
- store._hotUpdating = false;
38599
- });
38600
- const nonEnumerable = {
38601
- writable: true,
38602
- configurable: true,
38603
- enumerable: false
38604
- };
38605
- if (IS_CLIENT) {
38606
- ["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p2) => {
38607
- Object.defineProperty(store, p2, __spreadValues({
38608
- value: store[p2]
38609
- }, nonEnumerable));
38610
- });
38611
- }
38612
- }
38613
37578
  pinia._p.forEach((extender) => {
38614
- if (IS_CLIENT) {
38615
- const extensions = scope.run(() => extender({
38616
- store,
38617
- app: pinia._a,
38618
- pinia,
38619
- options: optionsForPlugin
38620
- }));
38621
- Object.keys(extensions || {}).forEach((key2) => store._customProperties.add(key2));
38622
- assign(store, extensions);
38623
- } else {
37579
+ {
38624
37580
  assign(store, scope.run(() => extender({
38625
37581
  store,
38626
37582
  app: pinia._a,
@@ -38629,11 +37585,6 @@ function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore)
38629
37585
  })));
38630
37586
  }
38631
37587
  });
38632
- if (store.$state && typeof store.$state === "object" && typeof store.$state.constructor === "function" && !store.$state.constructor.toString().includes("[native code]")) {
38633
- console.warn(`[\u{1F34D}]: The "state" must be a plain object. It cannot be
38634
- state: () => new MyClass()
38635
- Found in store "${store.$id}".`);
38636
- }
38637
37588
  if (initialState2 && isOptionsStore && options.hydrate) {
38638
37589
  options.hydrate(store.$state, initialState2);
38639
37590
  }
@@ -38657,12 +37608,6 @@ function defineStore(idOrOptions, setup, setupOptions) {
38657
37608
  pinia = pinia || currentInstance2 && inject(piniaSymbol);
38658
37609
  if (pinia)
38659
37610
  setActivePinia(pinia);
38660
- if (!activePinia) {
38661
- throw new Error(`[\u{1F34D}]: getActivePinia was called with no active Pinia. Did you forget to install pinia?
38662
- const pinia = createPinia()
38663
- app.use(pinia)
38664
- This will fail in production.`);
38665
- }
38666
37611
  pinia = activePinia;
38667
37612
  if (!pinia._s.has(id)) {
38668
37613
  if (isSetupStore) {
@@ -38670,23 +37615,8 @@ This will fail in production.`);
38670
37615
  } else {
38671
37616
  createOptionsStore(id, options, pinia);
38672
37617
  }
38673
- {
38674
- useStore._pinia = pinia;
38675
- }
38676
37618
  }
38677
37619
  const store = pinia._s.get(id);
38678
- if (hot) {
38679
- const hotId = "__hot:" + id;
38680
- const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
38681
- hot._hotUpdate(newStore);
38682
- delete pinia.state.value[hotId];
38683
- pinia._s.delete(hotId);
38684
- }
38685
- if (IS_CLIENT && currentInstance2 && currentInstance2.proxy && !hot) {
38686
- const vm = currentInstance2.proxy;
38687
- const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
38688
- cache[id] = store;
38689
- }
38690
37620
  return store;
38691
37621
  }
38692
37622
  useStore.$id = id;