diff --git a/dist/pinia-BCiW4L1z.chunk.mjs b/dist/pinia-BCiW4L1z.chunk.mjs new file mode 100644 index 0000000000000..0d4e8bdc93569 --- /dev/null +++ b/dist/pinia-BCiW4L1z.chunk.mjs @@ -0,0 +1,2 @@ +import{y as G,k as H,z as K,A as Z,B as tt,C as nt,D as E,E as C,G as L,H as et,I as st,J as ot,K as ct,L as at,n as N,M as rt}from"./NcSettingsSection-BfK7eHNT-Cvwtv3xC.chunk.mjs";let W;const I=t=>W=t,q=Symbol();function A(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var w;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(w||(w={}));function dt(){const t=G(!0),o=t.run(()=>H({}));let e=[],n=[];const a=K({install(i){I(a),a._a=i,i.provide(q,a),i.config.globalProperties.$pinia=a,n.forEach(r=>e.push(r)),n=[]},use(i){return this._a?e.push(i):n.push(i),this},_p:e,_a:null,_e:t,_s:new Map,state:o});return a}const Q=()=>{};function B(t,o,e,n=Q){t.add(o);const a=()=>{t.delete(o)&&n()};return!e&&et()&&st(a),a}function m(t,...o){t.forEach(e=>{e(...o)})}const it=t=>t(),D=Symbol(),x=Symbol();function k(t,o){t instanceof Map&&o instanceof Map?o.forEach((e,n)=>t.set(n,e)):t instanceof Set&&o instanceof Set&&o.forEach(t.add,t);for(const e in o){if(!o.hasOwnProperty(e))continue;const n=o[e],a=t[e];A(a)&&A(n)&&t.hasOwnProperty(e)&&!E(n)&&!C(n)?t[e]=k(a,n):t[e]=n}return t}const ut=Symbol();function ft(t){return!A(t)||!Object.prototype.hasOwnProperty.call(t,ut)}const{assign:p}=Object;function lt(t){return!!(E(t)&&t.effect)}function pt(t,o,e,n){const{state:a,actions:i,getters:r}=o,j=e.state.value[t];let h;function d(){j||(e.state.value[t]=a?a():{});const y=at(e.state.value[t]);return p(y,i,Object.keys(r||{}).reduce((b,_)=>(b[_]=K(N(()=>{I(e);const v=e._s.get(t);return r[_].call(v,v)})),b),{}))}return h=R(t,d,o,e,n,!0),h}function R(t,o,e={},n,a,i){let r;const j=p({actions:{}},e),h={deep:!0};let d,y,b=new Set,_=new Set,v;const S=n.state.value[t];!i&&!S&&(n.state.value[t]={}),H({});let F;function J(s){let c;d=y=!1,typeof s=="function"?(s(n.state.value[t]),c={type:w.patchFunction,storeId:t,events:v}):(k(n.state.value[t],s),c={type:w.patchObject,payload:s,storeId:t,events:v});const u=F=Symbol();ct().then(()=>{F===u&&(d=!0)}),y=!0,m(b,c,n.state.value[t])}const T=i?function(){const{state:s}=e,c=s?s():{};this.$patch(u=>{p(u,c)})}:Q;function U(){r.stop(),b.clear(),_.clear(),n._s.delete(t)}const z=(s,c="")=>{if(D in s)return s[x]=c,s;const u=function(){I(n);const P=Array.from(arguments),$=new Set,M=new Set;function X(f){$.add(f)}function Y(f){M.add(f)}m(_,{args:P,name:u[x],store:l,after:X,onError:Y});let g;try{g=s.apply(this&&this.$id===t?this:l,P)}catch(f){throw m(M,f),f}return g instanceof Promise?g.then(f=>(m($,f),f)).catch(f=>(m(M,f),Promise.reject(f))):(m($,g),g)};return u[D]=!0,u[x]=c,u},V={_p:n,$id:t,$onAction:B.bind(null,_),$patch:J,$reset:T,$subscribe(s,c={}){const u=B(b,s,c.detached,()=>P()),P=r.run(()=>ot(()=>n.state.value[t],$=>{(c.flush==="sync"?y:d)&&s({storeId:t,type:w.direct,events:v},$)},p({},h,c)));return u},$dispose:U},l=nt(V);n._s.set(t,l);const O=(n._a&&n._a.runWithContext||it)(()=>n._e.run(()=>(r=G()).run(()=>o({action:z}))));for(const s in O){const c=O[s];if(E(c)&&!lt(c)||C(c))i||(S&&ft(c)&&(E(c)?c.value=S[s]:k(c,S[s])),n.state.value[t][s]=c);else if(typeof c=="function"){const u=z(c,s);O[s]=u,j.actions[s]=c}}return p(l,O),p(L(l),O),Object.defineProperty(l,"$state",{get:()=>n.state.value[t],set:s=>{J(c=>{p(c,s)})}}),n._p.forEach(s=>{p(l,r.run(()=>s({store:l,app:n._a,pinia:n,options:j})))}),S&&i&&e.hydrate&&e.hydrate(l.$state,S),d=!0,y=!0,l}function yt(t,o,e){let n;const a=typeof o=="function";n=a?e:o;function i(r,j){const h=tt();return r=r||(h?Z(q,null):null),r&&I(r),r=W,r._s.has(t)||(a?R(t,o,n,r):pt(t,n,r)),r._s.get(t)}return i.$id=t,i}function bt(t){const o=L(t),e={};for(const n in o){const a=o[n];a.effect?e[n]=N({get:()=>t[n],set(i){t[n]=i}}):(E(a)||C(a))&&(e[n]=rt(t,n))}return e}export{dt as c,yt as d,bt as s}; +//# sourceMappingURL=pinia-BCiW4L1z.chunk.mjs.map diff --git a/dist/pinia-Bs-4aixE.chunk.mjs.license b/dist/pinia-BCiW4L1z.chunk.mjs.license similarity index 90% rename from dist/pinia-Bs-4aixE.chunk.mjs.license rename to dist/pinia-BCiW4L1z.chunk.mjs.license index c7aeaa426dd1c..6cb22a7ba03c4 100644 --- a/dist/pinia-Bs-4aixE.chunk.mjs.license +++ b/dist/pinia-BCiW4L1z.chunk.mjs.license @@ -3,5 +3,5 @@ SPDX-FileCopyrightText: Eduardo San Martin Morote This file is generated from multiple sources. Included packages: - pinia - - version: 3.0.3 + - version: 3.0.4 - license: MIT diff --git a/dist/pinia-BCiW4L1z.chunk.mjs.map b/dist/pinia-BCiW4L1z.chunk.mjs.map new file mode 100644 index 0000000000000..6178b9ea6e2d4 --- /dev/null +++ b/dist/pinia-BCiW4L1z.chunk.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"pinia-BCiW4L1z.chunk.mjs","sources":["../node_modules/pinia/dist/pinia.mjs"],"sourcesContent":["/*!\n * pinia v3.0.4\n * (c) 2025 Eduardo San Martin Morote\n * @license MIT\n */\nimport { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope, ref, isRef, isReactive, getCurrentScope, onScopeDispose, getCurrentInstance, reactive, toRef, nextTick, computed, toRefs } from 'vue';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\nconst IS_CLIENT = typeof window !== 'undefined';\n\n/**\n * setActivePinia must be called to handle SSR at the top of functions like\n * `fetch`, `setup`, `serverPrefetch` and others\n */\nlet activePinia;\n/**\n * Sets or unsets the active pinia. Used in SSR and internally when calling\n * actions and getters\n *\n * @param pinia - Pinia instance\n */\n// @ts-expect-error: cannot constrain the type of the return\nconst setActivePinia = (pinia) => (activePinia = pinia);\n/**\n * Get the currently active pinia if there is any.\n */\nconst getActivePinia = (process.env.NODE_ENV !== 'production')\n ? () => {\n const pinia = hasInjectionContext() && inject(piniaSymbol);\n if (!pinia && !IS_CLIENT) {\n console.error(`[๐Ÿ]: Pinia instance not found in context. This falls back to the global activePinia which exposes you to cross-request pollution on the server. Most of the time, it means you are calling \"useStore()\" in the wrong place.\\n` +\n `Read https://vuejs.org/guide/reusability/composables.html to learn more`);\n }\n return pinia || activePinia;\n }\n : () => (hasInjectionContext() && inject(piniaSymbol)) || activePinia;\nconst piniaSymbol = ((process.env.NODE_ENV !== 'production') ? Symbol('pinia') : /* istanbul ignore next */ Symbol());\n\nfunction isPlainObject(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\no) {\n return (o &&\n typeof o === 'object' &&\n Object.prototype.toString.call(o) === '[object Object]' &&\n typeof o.toJSON !== 'function');\n}\n// type DeepReadonly = { readonly [P in keyof T]: DeepReadonly }\n// TODO: can we change these to numbers?\n/**\n * Possible types for SubscriptionCallback\n */\nvar MutationType;\n(function (MutationType) {\n /**\n * Direct mutation of the state:\n *\n * - `store.name = 'new name'`\n * - `store.$state.name = 'new name'`\n * - `store.list.push('new item')`\n */\n MutationType[\"direct\"] = \"direct\";\n /**\n * Mutated the state with `$patch` and an object\n *\n * - `store.$patch({ name: 'newName' })`\n */\n MutationType[\"patchObject\"] = \"patch object\";\n /**\n * Mutated the state with `$patch` and a function\n *\n * - `store.$patch(state => state.name = 'newName')`\n */\n MutationType[\"patchFunction\"] = \"patch function\";\n // maybe reset? for $state = {} and $reset\n})(MutationType || (MutationType = {}));\n\n/*\n * FileSaver.js A saveAs() FileSaver implementation.\n *\n * Originally by Eli Grey, adapted as an ESM module by Eduardo San Martin\n * Morote.\n *\n * License : MIT\n */\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nconst _global = /*#__PURE__*/ (() => typeof window === 'object' && window.window === window\n ? window\n : typeof self === 'object' && self.self === self\n ? self\n : typeof global === 'object' && global.global === global\n ? global\n : typeof globalThis === 'object'\n ? globalThis\n : { HTMLElement: null })();\nfunction bom(blob, { autoBom = false } = {}) {\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (autoBom &&\n /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xfeff), blob], { type: blob.type });\n }\n return blob;\n}\nfunction download(url, name, opts) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.responseType = 'blob';\n xhr.onload = function () {\n saveAs(xhr.response, name, opts);\n };\n xhr.onerror = function () {\n console.error('could not download file');\n };\n xhr.send();\n}\nfunction corsEnabled(url) {\n const xhr = new XMLHttpRequest();\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false);\n try {\n xhr.send();\n }\n catch (e) { }\n return xhr.status >= 200 && xhr.status <= 299;\n}\n// `a.click()` doesn't work for all browsers (#465)\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'));\n }\n catch (e) {\n const evt = new MouseEvent('click', {\n bubbles: true,\n cancelable: true,\n view: window,\n detail: 0,\n screenX: 80,\n screenY: 20,\n clientX: 80,\n clientY: 20,\n ctrlKey: false,\n altKey: false,\n shiftKey: false,\n metaKey: false,\n button: 0,\n relatedTarget: null,\n });\n node.dispatchEvent(evt);\n }\n}\nconst _navigator = typeof navigator === 'object' ? navigator : { userAgent: '' };\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nconst isMacOSWebView = /*#__PURE__*/ (() => /Macintosh/.test(_navigator.userAgent) &&\n /AppleWebKit/.test(_navigator.userAgent) &&\n !/Safari/.test(_navigator.userAgent))();\nconst saveAs = !IS_CLIENT\n ? () => { } // noop\n : // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program\n typeof HTMLAnchorElement !== 'undefined' &&\n 'download' in HTMLAnchorElement.prototype &&\n !isMacOSWebView\n ? downloadSaveAs\n : // Use msSaveOrOpenBlob as a second approach\n 'msSaveOrOpenBlob' in _navigator\n ? msSaveAs\n : // Fallback to using FileReader and a popup\n fileSaverSaveAs;\nfunction downloadSaveAs(blob, name = 'download', opts) {\n const a = document.createElement('a');\n a.download = name;\n a.rel = 'noopener'; // tabnabbing\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob;\n if (a.origin !== location.origin) {\n if (corsEnabled(a.href)) {\n download(blob, name, opts);\n }\n else {\n a.target = '_blank';\n click(a);\n }\n }\n else {\n click(a);\n }\n }\n else {\n // Support blobs\n a.href = URL.createObjectURL(blob);\n setTimeout(function () {\n URL.revokeObjectURL(a.href);\n }, 4e4); // 40s\n setTimeout(function () {\n click(a);\n }, 0);\n }\n}\nfunction msSaveAs(blob, name = 'download', opts) {\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts);\n }\n else {\n const a = document.createElement('a');\n a.href = blob;\n a.target = '_blank';\n setTimeout(function () {\n click(a);\n });\n }\n }\n else {\n // @ts-ignore: works on windows\n navigator.msSaveOrOpenBlob(bom(blob, opts), name);\n }\n}\nfunction fileSaverSaveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank');\n if (popup) {\n popup.document.title = popup.document.body.innerText = 'downloading...';\n }\n if (typeof blob === 'string')\n return download(blob, name, opts);\n const force = blob.type === 'application/octet-stream';\n const isSafari = /constructor/i.test(String(_global.HTMLElement)) || 'safari' in _global;\n const isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent);\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) &&\n typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n const reader = new FileReader();\n reader.onloadend = function () {\n let url = reader.result;\n if (typeof url !== 'string') {\n popup = null;\n throw new Error('Wrong reader.result type');\n }\n url = isChromeIOS\n ? url\n : url.replace(/^data:[^;]*;/, 'data:attachment/file;');\n if (popup) {\n popup.location.href = url;\n }\n else {\n location.assign(url);\n }\n popup = null; // reverse-tabnabbing #460\n };\n reader.readAsDataURL(blob);\n }\n else {\n const url = URL.createObjectURL(blob);\n if (popup)\n popup.location.assign(url);\n else\n location.href = url;\n popup = null; // reverse-tabnabbing #460\n setTimeout(function () {\n URL.revokeObjectURL(url);\n }, 4e4); // 40s\n }\n}\n\n/**\n * Shows a toast or console.log\n *\n * @param message - message to log\n * @param type - different color of the tooltip\n */\nfunction toastMessage(message, type) {\n const piniaMessage = '๐Ÿ ' + message;\n if (typeof __VUE_DEVTOOLS_TOAST__ === 'function') {\n // No longer available :(\n __VUE_DEVTOOLS_TOAST__(piniaMessage, type);\n }\n else if (type === 'error') {\n console.error(piniaMessage);\n }\n else if (type === 'warn') {\n console.warn(piniaMessage);\n }\n else {\n console.log(piniaMessage);\n }\n}\nfunction isPinia(o) {\n return '_a' in o && 'install' in o;\n}\n\n/**\n * This file contain devtools actions, they are not Pinia actions.\n */\n// ---\nfunction checkClipboardAccess() {\n if (!('clipboard' in navigator)) {\n toastMessage(`Your browser doesn't support the Clipboard API`, 'error');\n return true;\n }\n}\nfunction checkNotFocusedError(error) {\n if (error instanceof Error &&\n error.message.toLowerCase().includes('document is not focused')) {\n toastMessage('You need to activate the \"Emulate a focused page\" setting in the \"Rendering\" panel of devtools.', 'warn');\n return true;\n }\n return false;\n}\nasync function actionGlobalCopyState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));\n toastMessage('Global state copied to clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to serialize the state. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalPasteState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));\n toastMessage('Global state pasted from clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalSaveState(pinia) {\n try {\n saveAs(new Blob([JSON.stringify(pinia.state.value)], {\n type: 'text/plain;charset=utf-8',\n }), 'pinia-state.json');\n }\n catch (error) {\n toastMessage(`Failed to export the state as JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nlet fileInput;\nfunction getFileOpener() {\n if (!fileInput) {\n fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = '.json';\n }\n function openFile() {\n return new Promise((resolve, reject) => {\n fileInput.onchange = async () => {\n const files = fileInput.files;\n if (!files)\n return resolve(null);\n const file = files.item(0);\n if (!file)\n return resolve(null);\n return resolve({ text: await file.text(), file });\n };\n // @ts-ignore: TODO: changed from 4.3 to 4.4\n fileInput.oncancel = () => resolve(null);\n fileInput.onerror = reject;\n fileInput.click();\n });\n }\n return openFile;\n}\nasync function actionGlobalOpenStateFile(pinia) {\n try {\n const open = getFileOpener();\n const result = await open();\n if (!result)\n return;\n const { text, file } = result;\n loadStoresState(pinia, JSON.parse(text));\n toastMessage(`Global state imported from \"${file.name}\".`);\n }\n catch (error) {\n toastMessage(`Failed to import the state from JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nfunction loadStoresState(pinia, state) {\n for (const key in state) {\n const storeState = pinia.state.value[key];\n // store is already instantiated, patch it\n if (storeState) {\n Object.assign(storeState, state[key]);\n }\n else {\n // store is not instantiated, set the initial state\n pinia.state.value[key] = state[key];\n }\n }\n}\n\nfunction formatDisplay(display) {\n return {\n _custom: {\n display,\n },\n };\n}\nconst PINIA_ROOT_LABEL = '๐Ÿ Pinia (root)';\nconst PINIA_ROOT_ID = '_root';\nfunction formatStoreForInspectorTree(store) {\n return isPinia(store)\n ? {\n id: PINIA_ROOT_ID,\n label: PINIA_ROOT_LABEL,\n }\n : {\n id: store.$id,\n label: store.$id,\n };\n}\nfunction formatStoreForInspectorState(store) {\n if (isPinia(store)) {\n const storeNames = Array.from(store._s.keys());\n const storeMap = store._s;\n const state = {\n state: storeNames.map((storeId) => ({\n editable: true,\n key: storeId,\n value: store.state.value[storeId],\n })),\n getters: storeNames\n .filter((id) => storeMap.get(id)._getters)\n .map((id) => {\n const store = storeMap.get(id);\n return {\n editable: false,\n key: id,\n value: store._getters.reduce((getters, key) => {\n getters[key] = store[key];\n return getters;\n }, {}),\n };\n }),\n };\n return state;\n }\n const state = {\n state: Object.keys(store.$state).map((key) => ({\n editable: true,\n key,\n value: store.$state[key],\n })),\n };\n // avoid adding empty getters\n if (store._getters && store._getters.length) {\n state.getters = store._getters.map((getterName) => ({\n editable: false,\n key: getterName,\n value: store[getterName],\n }));\n }\n if (store._customProperties.size) {\n state.customProperties = Array.from(store._customProperties).map((key) => ({\n editable: true,\n key,\n value: store[key],\n }));\n }\n return state;\n}\nfunction formatEventData(events) {\n if (!events)\n return {};\n if (Array.isArray(events)) {\n // TODO: handle add and delete for arrays and objects\n return events.reduce((data, event) => {\n data.keys.push(event.key);\n data.operations.push(event.type);\n data.oldValue[event.key] = event.oldValue;\n data.newValue[event.key] = event.newValue;\n return data;\n }, {\n oldValue: {},\n keys: [],\n operations: [],\n newValue: {},\n });\n }\n else {\n return {\n operation: formatDisplay(events.type),\n key: formatDisplay(events.key),\n oldValue: events.oldValue,\n newValue: events.newValue,\n };\n }\n}\nfunction formatMutationType(type) {\n switch (type) {\n case MutationType.direct:\n return 'mutation';\n case MutationType.patchFunction:\n return '$patch';\n case MutationType.patchObject:\n return '$patch';\n default:\n return 'unknown';\n }\n}\n\n// timeline can be paused when directly changing the state\nlet isTimelineActive = true;\nconst componentStateTypes = [];\nconst MUTATIONS_LAYER_ID = 'pinia:mutations';\nconst INSPECTOR_ID = 'pinia';\nconst { assign: assign$1 } = Object;\n/**\n * Gets the displayed name of a store in devtools\n *\n * @param id - id of the store\n * @returns a formatted string\n */\nconst getStoreType = (id) => '๐Ÿ ' + id;\n/**\n * Add the pinia plugin without any store. Allows displaying a Pinia plugin tab\n * as soon as it is added to the application.\n *\n * @param app - Vue application\n * @param pinia - pinia instance\n */\nfunction registerPiniaDevtools(app, pinia) {\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia ๐Ÿ',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n }, (api) => {\n if (typeof api.now !== 'function') {\n 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.');\n }\n api.addTimelineLayer({\n id: MUTATIONS_LAYER_ID,\n label: `Pinia ๐Ÿ`,\n color: 0xe5df88,\n });\n api.addInspector({\n id: INSPECTOR_ID,\n label: 'Pinia ๐Ÿ',\n icon: 'storage',\n treeFilterPlaceholder: 'Search stores',\n actions: [\n {\n icon: 'content_copy',\n action: () => {\n actionGlobalCopyState(pinia);\n },\n tooltip: 'Serialize and copy the state',\n },\n {\n icon: 'content_paste',\n action: async () => {\n await actionGlobalPasteState(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Replace the state with the content of your clipboard',\n },\n {\n icon: 'save',\n action: () => {\n actionGlobalSaveState(pinia);\n },\n tooltip: 'Save the state as a JSON file',\n },\n {\n icon: 'folder_open',\n action: async () => {\n await actionGlobalOpenStateFile(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Import the state from a JSON file',\n },\n ],\n nodeActions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state (with \"$reset\")',\n action: (nodeId) => {\n const store = pinia._s.get(nodeId);\n if (!store) {\n toastMessage(`Cannot reset \"${nodeId}\" store because it wasn't found.`, 'warn');\n }\n else if (typeof store.$reset !== 'function') {\n toastMessage(`Cannot reset \"${nodeId}\" store because it doesn't have a \"$reset\" method implemented.`, 'warn');\n }\n else {\n store.$reset();\n toastMessage(`Store \"${nodeId}\" reset.`);\n }\n },\n },\n ],\n });\n api.on.inspectComponent((payload) => {\n const proxy = (payload.componentInstance &&\n payload.componentInstance.proxy);\n if (proxy && proxy._pStores) {\n const piniaStores = payload.componentInstance.proxy._pStores;\n Object.values(piniaStores).forEach((store) => {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'state',\n editable: true,\n value: store._isOptionsAPI\n ? {\n _custom: {\n value: toRaw(store.$state),\n actions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state of this store',\n action: () => store.$reset(),\n },\n ],\n },\n }\n : // NOTE: workaround to unwrap transferred refs\n Object.keys(store.$state).reduce((state, key) => {\n state[key] = store.$state[key];\n return state;\n }, {}),\n });\n if (store._getters && store._getters.length) {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'getters',\n editable: false,\n value: store._getters.reduce((getters, key) => {\n try {\n getters[key] = store[key];\n }\n catch (error) {\n // @ts-expect-error: we just want to show it in devtools\n getters[key] = error;\n }\n return getters;\n }, {}),\n });\n }\n });\n }\n });\n api.on.getInspectorTree((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n let stores = [pinia];\n stores = stores.concat(Array.from(pinia._s.values()));\n payload.rootNodes = (payload.filter\n ? stores.filter((store) => '$id' in store\n ? store.$id\n .toLowerCase()\n .includes(payload.filter.toLowerCase())\n : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase()))\n : stores).map(formatStoreForInspectorTree);\n }\n });\n // Expose pinia instance as $pinia to window\n globalThis.$pinia = pinia;\n api.on.getInspectorState((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n // this could be the selected store restored for a different project\n // so it's better not to say anything here\n return;\n }\n if (inspectedStore) {\n // Expose selected store as $store to window\n if (payload.nodeId !== PINIA_ROOT_ID)\n globalThis.$store = toRaw(inspectedStore);\n payload.state = formatStoreForInspectorState(inspectedStore);\n }\n }\n });\n api.on.editInspectorState((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n return toastMessage(`store \"${payload.nodeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (!isPinia(inspectedStore)) {\n // access only the state\n if (path.length !== 1 ||\n !inspectedStore._customProperties.has(path[0]) ||\n path[0] in inspectedStore.$state) {\n path.unshift('$state');\n }\n }\n else {\n // Root access, we can omit the `.value` because the devtools API does it for us\n path.unshift('state');\n }\n isTimelineActive = false;\n payload.set(inspectedStore, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n api.on.editComponentState((payload) => {\n if (payload.type.startsWith('๐Ÿ')) {\n const storeId = payload.type.replace(/^๐Ÿ\\s*/, '');\n const store = pinia._s.get(storeId);\n if (!store) {\n return toastMessage(`store \"${storeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (path[0] !== 'state') {\n return toastMessage(`Invalid path for store \"${storeId}\":\\n${path}\\nOnly state can be modified.`);\n }\n // rewrite the first entry to be able to directly set the state as\n // well as any other path\n path[0] = '$state';\n isTimelineActive = false;\n payload.set(store, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n });\n}\nfunction addStoreToDevtools(app, store) {\n if (!componentStateTypes.includes(getStoreType(store.$id))) {\n componentStateTypes.push(getStoreType(store.$id));\n }\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia ๐Ÿ',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n settings: {\n logStoreChanges: {\n label: 'Notify about new/deleted stores',\n type: 'boolean',\n defaultValue: true,\n },\n // useEmojis: {\n // label: 'Use emojis in messages โšก๏ธ',\n // type: 'boolean',\n // defaultValue: true,\n // },\n },\n }, (api) => {\n // gracefully handle errors\n const now = typeof api.now === 'function' ? api.now.bind(api) : Date.now;\n store.$onAction(({ after, onError, name, args }) => {\n const groupId = runningActionId++;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ›ซ ' + name,\n subtitle: 'start',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n },\n groupId,\n },\n });\n after((result) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ›ฌ ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n result,\n },\n groupId,\n },\n });\n });\n onError((error) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n logType: 'error',\n title: '๐Ÿ’ฅ ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n error,\n },\n groupId,\n },\n });\n });\n }, true);\n store._customProperties.forEach((name) => {\n watch(() => unref(store[name]), (newValue, oldValue) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (isTimelineActive) {\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: 'Change',\n subtitle: name,\n data: {\n newValue,\n oldValue,\n },\n groupId: activeAction,\n },\n });\n }\n }, { deep: true });\n });\n store.$subscribe(({ events, type }, state) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (!isTimelineActive)\n return;\n // rootStore.state[store.id] = state\n const eventData = {\n time: now(),\n title: formatMutationType(type),\n data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),\n groupId: activeAction,\n };\n if (type === MutationType.patchFunction) {\n eventData.subtitle = 'โคต๏ธ';\n }\n else if (type === MutationType.patchObject) {\n eventData.subtitle = '๐Ÿงฉ';\n }\n else if (events && !Array.isArray(events)) {\n eventData.subtitle = events.type;\n }\n if (events) {\n eventData.data['rawEvent(s)'] = {\n _custom: {\n display: 'DebuggerEvent',\n type: 'object',\n tooltip: 'raw DebuggerEvent[]',\n value: events,\n },\n };\n }\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: eventData,\n });\n }, { detached: true, flush: 'sync' });\n const hotUpdate = store._hotUpdate;\n store._hotUpdate = markRaw((newStore) => {\n hotUpdate(newStore);\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ”ฅ ' + store.$id,\n subtitle: 'HMR update',\n data: {\n store: formatDisplay(store.$id),\n info: formatDisplay(`HMR update`),\n },\n },\n });\n // update the devtools too\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n });\n const { $dispose } = store;\n store.$dispose = () => {\n $dispose();\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`Disposed \"${store.$id}\" store ๐Ÿ—‘`);\n };\n // trigger an update so it can display new registered stores\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`\"${store.$id}\" store installed ๐Ÿ†•`);\n });\n}\nlet runningActionId = 0;\nlet activeAction;\n/**\n * Patches a store to enable action grouping in devtools by wrapping the store with a Proxy that is passed as the\n * context of all actions, allowing us to set `runningAction` on each access and effectively associating any state\n * mutation to the action.\n *\n * @param store - store to patch\n * @param actionNames - list of actionst to patch\n */\nfunction patchActionForGrouping(store, actionNames, wrapWithProxy) {\n // original actions of the store as they are given by pinia. We are going to override them\n const actions = actionNames.reduce((storeActions, actionName) => {\n // use toRaw to avoid tracking #541\n storeActions[actionName] = toRaw(store)[actionName];\n return storeActions;\n }, {});\n for (const actionName in actions) {\n store[actionName] = function () {\n // the running action id is incremented in a before action hook\n const _actionId = runningActionId;\n const trackedStore = wrapWithProxy\n ? new Proxy(store, {\n get(...args) {\n activeAction = _actionId;\n return Reflect.get(...args);\n },\n set(...args) {\n activeAction = _actionId;\n return Reflect.set(...args);\n },\n })\n : store;\n // For Setup Stores we need https://github.com/tc39/proposal-async-context\n activeAction = _actionId;\n const retValue = actions[actionName].apply(trackedStore, arguments);\n // this is safer as async actions in Setup Stores would associate mutations done outside of the action\n activeAction = undefined;\n return retValue;\n };\n }\n}\n/**\n * pinia.use(devtoolsPlugin)\n */\nfunction devtoolsPlugin({ app, store, options }) {\n // HMR module\n if (store.$id.startsWith('__hot:')) {\n return;\n }\n // detect option api vs setup api\n store._isOptionsAPI = !!options.state;\n // Do not overwrite actions mocked by @pinia/testing (#2298)\n if (!store._p._testing) {\n patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);\n // Upgrade the HMR to also update the new actions\n const originalHotUpdate = store._hotUpdate;\n toRaw(store)._hotUpdate = function (newStore) {\n originalHotUpdate.apply(this, arguments);\n patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);\n };\n }\n addStoreToDevtools(app, \n // FIXME: is there a way to allow the assignment from Store to StoreGeneric?\n store);\n}\n\n/**\n * Creates a Pinia instance to be used by the application\n */\nfunction createPinia() {\n const scope = effectScope(true);\n // NOTE: here we could check the window object for a state and directly set it\n // if there is anything like it with Vue 3 SSR\n const state = scope.run(() => ref({}));\n let _p = [];\n // plugins added before calling app.use(pinia)\n let toBeInstalled = [];\n const pinia = markRaw({\n install(app) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n pinia._a = app;\n app.provide(piniaSymbol, pinia);\n app.config.globalProperties.$pinia = pinia;\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(app, pinia);\n }\n toBeInstalled.forEach((plugin) => _p.push(plugin));\n toBeInstalled = [];\n },\n use(plugin) {\n if (!this._a) {\n toBeInstalled.push(plugin);\n }\n else {\n _p.push(plugin);\n }\n return this;\n },\n _p,\n // it's actually undefined here\n // @ts-expect-error\n _a: null,\n _e: scope,\n _s: new Map(),\n state,\n });\n // pinia devtools rely on dev only features so they cannot be forced unless\n // the dev build of Vue is used. Avoid old browsers like IE11.\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT && typeof Proxy !== 'undefined') {\n pinia.use(devtoolsPlugin);\n }\n return pinia;\n}\n/**\n * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly\n * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.\n * Once disposed, the pinia instance cannot be used anymore.\n *\n * @param pinia - pinia instance\n */\nfunction disposePinia(pinia) {\n pinia._e.stop();\n pinia._s.clear();\n pinia._p.splice(0);\n pinia.state.value = {};\n // @ts-expect-error: non valid\n pinia._a = null;\n}\n\n/**\n * Checks if a function is a `StoreDefinition`.\n *\n * @param fn - object to test\n * @returns true if `fn` is a StoreDefinition\n */\nconst isUseStore = (fn) => {\n return typeof fn === 'function' && typeof fn.$id === 'string';\n};\n/**\n * Mutates in place `newState` with `oldState` to _hot update_ it. It will\n * remove any key not existing in `newState` and recursively merge plain\n * objects.\n *\n * @param newState - new state object to be patched\n * @param oldState - old state that should be used to patch newState\n * @returns - newState\n */\nfunction patchObject(newState, oldState) {\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in oldState) {\n const subPatch = oldState[key];\n // skip the whole sub tree\n if (!(key in newState)) {\n continue;\n }\n const targetValue = newState[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n newState[key] = patchObject(targetValue, subPatch);\n }\n else {\n // objects are either a bit more complex (e.g. refs) or primitives, so we\n // just set the whole thing\n newState[key] = subPatch;\n }\n }\n return newState;\n}\n/**\n * Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.\n *\n * @example\n * ```js\n * const useUser = defineStore(...)\n * if (import.meta.hot) {\n * import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))\n * }\n * ```\n *\n * @param initialUseStore - return of the defineStore to hot update\n * @param hot - `import.meta.hot`\n */\nfunction acceptHMRUpdate(initialUseStore, hot) {\n // strip as much as possible from iife.prod\n if (!(process.env.NODE_ENV !== 'production')) {\n return () => { };\n }\n return (newModule) => {\n const pinia = hot.data.pinia || initialUseStore._pinia;\n if (!pinia) {\n // this store is still not used\n return;\n }\n // preserve the pinia instance across loads\n hot.data.pinia = pinia;\n // console.log('got data', newStore)\n for (const exportName in newModule) {\n const useStore = newModule[exportName];\n // console.log('checking for', exportName)\n if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {\n // console.log('Accepting update for', useStore.$id)\n const id = useStore.$id;\n if (id !== initialUseStore.$id) {\n console.warn(`The id of the store changed from \"${initialUseStore.$id}\" to \"${id}\". Reloading.`);\n // return import.meta.hot.invalidate()\n return hot.invalidate();\n }\n const existingStore = pinia._s.get(id);\n if (!existingStore) {\n console.log(`[Pinia]: skipping hmr because store doesn't exist yet`);\n return;\n }\n useStore(pinia, existingStore);\n }\n }\n };\n}\n\nconst noop = () => { };\nfunction addSubscription(subscriptions, callback, detached, onCleanup = noop) {\n subscriptions.add(callback);\n const removeSubscription = () => {\n const isDel = subscriptions.delete(callback);\n isDel && onCleanup();\n };\n if (!detached && getCurrentScope()) {\n onScopeDispose(removeSubscription);\n }\n return removeSubscription;\n}\nfunction triggerSubscriptions(subscriptions, ...args) {\n subscriptions.forEach((callback) => {\n callback(...args);\n });\n}\n\nconst fallbackRunWithContext = (fn) => fn();\n/**\n * Marks a function as an action for `$onAction`\n * @internal\n */\nconst ACTION_MARKER = Symbol();\n/**\n * Action name symbol. Allows to add a name to an action after defining it\n * @internal\n */\nconst ACTION_NAME = Symbol();\nfunction mergeReactiveObjects(target, patchToApply) {\n // Handle Map instances\n if (target instanceof Map && patchToApply instanceof Map) {\n patchToApply.forEach((value, key) => target.set(key, value));\n }\n else if (target instanceof Set && patchToApply instanceof Set) {\n // Handle Set instances\n patchToApply.forEach(target.add, target);\n }\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in patchToApply) {\n if (!patchToApply.hasOwnProperty(key))\n continue;\n const subPatch = patchToApply[key];\n const targetValue = target[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n target.hasOwnProperty(key) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n // NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might\n // start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that\n // to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.\n target[key] = mergeReactiveObjects(targetValue, subPatch);\n }\n else {\n // @ts-expect-error: subPatch is a valid value\n target[key] = subPatch;\n }\n }\n return target;\n}\nconst skipHydrateSymbol = (process.env.NODE_ENV !== 'production')\n ? Symbol('pinia:skipHydration')\n : /* istanbul ignore next */ Symbol();\n/**\n * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a\n * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.\n *\n * @param obj - target object\n * @returns obj\n */\nfunction skipHydrate(obj) {\n return Object.defineProperty(obj, skipHydrateSymbol, {});\n}\n/**\n * Returns whether a value should be hydrated\n *\n * @param obj - target variable\n * @returns true if `obj` should be hydrated\n */\nfunction shouldHydrate(obj) {\n return (!isPlainObject(obj) ||\n !Object.prototype.hasOwnProperty.call(obj, skipHydrateSymbol));\n}\nconst { assign } = Object;\nfunction isComputed(o) {\n return !!(isRef(o) && o.effect);\n}\nfunction createOptionsStore(id, options, pinia, hot) {\n const { state, actions, getters } = options;\n const initialState = pinia.state.value[id];\n let store;\n function setup() {\n if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n pinia.state.value[id] = state ? state() : {};\n }\n // avoid creating a state in pinia.state.value\n const localState = (process.env.NODE_ENV !== 'production') && hot\n ? // use ref() to unwrap refs inside state TODO: check if this is still necessary\n toRefs(ref(state ? state() : {}).value)\n : toRefs(pinia.state.value[id]);\n return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {\n if ((process.env.NODE_ENV !== 'production') && name in localState) {\n console.warn(`[๐Ÿ]: A getter cannot have the same name as another state property. Rename one of them. Found with \"${name}\" in store \"${id}\".`);\n }\n computedGetters[name] = markRaw(computed(() => {\n setActivePinia(pinia);\n // it was created just before\n const store = pinia._s.get(id);\n // allow cross using stores\n // @ts-expect-error\n // return getters![name].call(context, context)\n // TODO: avoid reading the getter while assigning with a global variable\n return getters[name].call(store, store);\n }));\n return computedGetters;\n }, {}));\n }\n store = createSetupStore(id, setup, options, pinia, hot, true);\n return store;\n}\nfunction createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {\n let scope;\n const optionsForPlugin = assign({ actions: {} }, options);\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && !pinia._e.active) {\n throw new Error('Pinia destroyed');\n }\n // watcher options for $subscribe\n const $subscribeOptions = { deep: true };\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n $subscribeOptions.onTrigger = (event) => {\n /* istanbul ignore else */\n if (isListening) {\n debuggerEvents = event;\n // avoid triggering this while the store is being built and the state is being set in pinia\n }\n else if (isListening == false && !store._hotUpdating) {\n // let patch send all the events together later\n /* istanbul ignore else */\n if (Array.isArray(debuggerEvents)) {\n debuggerEvents.push(event);\n }\n else {\n console.error('๐Ÿ debuggerEvents should be an array. This is most likely an internal Pinia bug.');\n }\n }\n };\n }\n // internal state\n let isListening; // set to true at the end\n let isSyncListening; // set to true at the end\n let subscriptions = new Set();\n let actionSubscriptions = new Set();\n let debuggerEvents;\n const initialState = pinia.state.value[$id];\n // avoid setting the state for option stores if it is set\n // by the setup\n if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n pinia.state.value[$id] = {};\n }\n const hotState = ref({});\n // avoid triggering too many listeners\n // https://github.com/vuejs/pinia/issues/1129\n let activeListener;\n function $patch(partialStateOrMutator) {\n let subscriptionMutation;\n isListening = isSyncListening = false;\n // reset the debugger events since patches are sync\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n debuggerEvents = [];\n }\n if (typeof partialStateOrMutator === 'function') {\n partialStateOrMutator(pinia.state.value[$id]);\n subscriptionMutation = {\n type: MutationType.patchFunction,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n else {\n mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);\n subscriptionMutation = {\n type: MutationType.patchObject,\n payload: partialStateOrMutator,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n const myListenerId = (activeListener = Symbol());\n nextTick().then(() => {\n if (activeListener === myListenerId) {\n isListening = true;\n }\n });\n isSyncListening = true;\n // because we paused the watcher, we need to manually call the subscriptions\n triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);\n }\n const $reset = isOptionsStore\n ? function $reset() {\n const { state } = options;\n const newState = state ? state() : {};\n // we use a patch to group all changes into one single subscription\n this.$patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, newState);\n });\n }\n : /* istanbul ignore next */\n (process.env.NODE_ENV !== 'production')\n ? () => {\n throw new Error(`๐Ÿ: Store \"${$id}\" is built using the setup syntax and does not implement $reset().`);\n }\n : noop;\n function $dispose() {\n scope.stop();\n subscriptions.clear();\n actionSubscriptions.clear();\n pinia._s.delete($id);\n }\n /**\n * Helper that wraps function so it can be tracked with $onAction\n * @param fn - action to wrap\n * @param name - name of the action\n */\n const action = (fn, name = '') => {\n if (ACTION_MARKER in fn) {\n fn[ACTION_NAME] = name;\n return fn;\n }\n const wrappedAction = function () {\n setActivePinia(pinia);\n const args = Array.from(arguments);\n const afterCallbackSet = new Set();\n const onErrorCallbackSet = new Set();\n function after(callback) {\n afterCallbackSet.add(callback);\n }\n function onError(callback) {\n onErrorCallbackSet.add(callback);\n }\n // @ts-expect-error\n triggerSubscriptions(actionSubscriptions, {\n args,\n name: wrappedAction[ACTION_NAME],\n store,\n after,\n onError,\n });\n let ret;\n try {\n ret = fn.apply(this && this.$id === $id ? this : store, args);\n // handle sync errors\n }\n catch (error) {\n triggerSubscriptions(onErrorCallbackSet, error);\n throw error;\n }\n if (ret instanceof Promise) {\n return ret\n .then((value) => {\n triggerSubscriptions(afterCallbackSet, value);\n return value;\n })\n .catch((error) => {\n triggerSubscriptions(onErrorCallbackSet, error);\n return Promise.reject(error);\n });\n }\n // trigger after callbacks\n triggerSubscriptions(afterCallbackSet, ret);\n return ret;\n };\n wrappedAction[ACTION_MARKER] = true;\n wrappedAction[ACTION_NAME] = name; // will be set later\n // @ts-expect-error: we are intentionally limiting the returned type to just Fn\n // because all the added properties are internals that are exposed through `$onAction()` only\n return wrappedAction;\n };\n const _hmrPayload = /*#__PURE__*/ markRaw({\n actions: {},\n getters: {},\n state: [],\n hotState,\n });\n const partialStore = {\n _p: pinia,\n // _s: scope,\n $id,\n $onAction: addSubscription.bind(null, actionSubscriptions),\n $patch,\n $reset,\n $subscribe(callback, options = {}) {\n const removeSubscription = addSubscription(subscriptions, callback, options.detached, () => stopWatcher());\n const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {\n if (options.flush === 'sync' ? isSyncListening : isListening) {\n callback({\n storeId: $id,\n type: MutationType.direct,\n events: debuggerEvents,\n }, state);\n }\n }, assign({}, $subscribeOptions, options)));\n return removeSubscription;\n },\n $dispose,\n };\n const store = reactive((process.env.NODE_ENV !== 'production') || ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT)\n ? assign({\n _hmrPayload,\n _customProperties: markRaw(new Set()), // devtools custom properties\n }, partialStore\n // must be added later\n // setupStore\n )\n : partialStore);\n // store the partial store now so the setup of stores can instantiate each other before they are finished without\n // creating infinite loops.\n pinia._s.set($id, store);\n const runWithContext = (pinia._a && pinia._a.runWithContext) || fallbackRunWithContext;\n // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped\n const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));\n // overwrite existing actions to support $onAction\n for (const key in setupStore) {\n const prop = setupStore[key];\n if ((isRef(prop) && !isComputed(prop)) || isReactive(prop)) {\n // mark it as a piece of state to be serialized\n if ((process.env.NODE_ENV !== 'production') && hot) {\n hotState.value[key] = toRef(setupStore, key);\n // createOptionStore directly sets the state in pinia.state.value so we\n // can just skip that\n }\n else if (!isOptionsStore) {\n // in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created\n if (initialState && shouldHydrate(prop)) {\n if (isRef(prop)) {\n prop.value = initialState[key];\n }\n else {\n // probably a reactive object, lets recursively assign\n // @ts-expect-error: prop is unknown\n mergeReactiveObjects(prop, initialState[key]);\n }\n }\n // transfer the ref to the pinia state to keep everything in sync\n pinia.state.value[$id][key] = prop;\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.state.push(key);\n }\n // action\n }\n else if (typeof prop === 'function') {\n const actionValue = (process.env.NODE_ENV !== 'production') && hot ? prop : action(prop, key);\n // this a hot module replacement store because the hotUpdate method needs\n // to do it with the right context\n // @ts-expect-error\n setupStore[key] = actionValue;\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.actions[key] = prop;\n }\n // list actions so they can be used in plugins\n // @ts-expect-error\n optionsForPlugin.actions[key] = prop;\n }\n else if ((process.env.NODE_ENV !== 'production')) {\n // add getters for devtools\n if (isComputed(prop)) {\n _hmrPayload.getters[key] = isOptionsStore\n ? // @ts-expect-error\n options.getters[key]\n : prop;\n if (IS_CLIENT) {\n const getters = setupStore._getters ||\n // @ts-expect-error: same\n (setupStore._getters = markRaw([]));\n getters.push(key);\n }\n }\n }\n }\n // add the state, getters, and action properties\n /* istanbul ignore if */\n assign(store, setupStore);\n // allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.\n // Make `storeToRefs()` work with `reactive()` #799\n assign(toRaw(store), setupStore);\n // use this instead of a computed with setter to be able to create it anywhere\n // without linking the computed lifespan to wherever the store is first\n // created.\n Object.defineProperty(store, '$state', {\n get: () => ((process.env.NODE_ENV !== 'production') && hot ? hotState.value : pinia.state.value[$id]),\n set: (state) => {\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && hot) {\n throw new Error('cannot set hotState');\n }\n $patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, state);\n });\n },\n });\n // add the hotUpdate before plugins to allow them to override it\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n store._hotUpdate = markRaw((newStore) => {\n store._hotUpdating = true;\n newStore._hmrPayload.state.forEach((stateKey) => {\n if (stateKey in store.$state) {\n const newStateTarget = newStore.$state[stateKey];\n const oldStateSource = store.$state[stateKey];\n if (typeof newStateTarget === 'object' &&\n isPlainObject(newStateTarget) &&\n isPlainObject(oldStateSource)) {\n patchObject(newStateTarget, oldStateSource);\n }\n else {\n // transfer the ref\n newStore.$state[stateKey] = oldStateSource;\n }\n }\n // patch direct access properties to allow store.stateProperty to work as\n // store.$state.stateProperty\n // @ts-expect-error: any type\n store[stateKey] = toRef(newStore.$state, stateKey);\n });\n // remove deleted state properties\n Object.keys(store.$state).forEach((stateKey) => {\n if (!(stateKey in newStore.$state)) {\n // @ts-expect-error: noop if doesn't exist\n delete store[stateKey];\n }\n });\n // avoid devtools logging this as a mutation\n isListening = false;\n isSyncListening = false;\n pinia.state.value[$id] = toRef(newStore._hmrPayload, 'hotState');\n isSyncListening = true;\n nextTick().then(() => {\n isListening = true;\n });\n for (const actionName in newStore._hmrPayload.actions) {\n const actionFn = newStore[actionName];\n // @ts-expect-error: actionName is a string\n store[actionName] =\n //\n action(actionFn, actionName);\n }\n // TODO: does this work in both setup and option store?\n for (const getterName in newStore._hmrPayload.getters) {\n const getter = newStore._hmrPayload.getters[getterName];\n const getterValue = isOptionsStore\n ? // special handling of options api\n computed(() => {\n setActivePinia(pinia);\n return getter.call(store, store);\n })\n : getter;\n // @ts-expect-error: getterName is a string\n store[getterName] =\n //\n getterValue;\n }\n // remove deleted getters\n Object.keys(store._hmrPayload.getters).forEach((key) => {\n if (!(key in newStore._hmrPayload.getters)) {\n // @ts-expect-error: noop if doesn't exist\n delete store[key];\n }\n });\n // remove old actions\n Object.keys(store._hmrPayload.actions).forEach((key) => {\n if (!(key in newStore._hmrPayload.actions)) {\n // @ts-expect-error: noop if doesn't exist\n delete store[key];\n }\n });\n // update the values used in devtools and to allow deleting new properties later on\n store._hmrPayload = newStore._hmrPayload;\n store._getters = newStore._getters;\n store._hotUpdating = false;\n });\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const nonEnumerable = {\n writable: true,\n configurable: true,\n // avoid warning on devtools trying to display this property\n enumerable: false,\n };\n ['_p', '_hmrPayload', '_getters', '_customProperties'].forEach((p) => {\n Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));\n });\n }\n // apply all plugins\n pinia._p.forEach((extender) => {\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const extensions = scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n }));\n Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));\n assign(store, extensions);\n }\n else {\n assign(store, scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n })));\n }\n });\n if ((process.env.NODE_ENV !== 'production') &&\n store.$state &&\n typeof store.$state === 'object' &&\n typeof store.$state.constructor === 'function' &&\n !store.$state.constructor.toString().includes('[native code]')) {\n console.warn(`[๐Ÿ]: The \"state\" must be a plain object. It cannot be\\n` +\n `\\tstate: () => new MyClass()\\n` +\n `Found in store \"${store.$id}\".`);\n }\n // only apply hydrate to option stores with an initial state in pinia\n if (initialState &&\n isOptionsStore &&\n options.hydrate) {\n options.hydrate(store.$state, initialState);\n }\n isListening = true;\n isSyncListening = true;\n return store;\n}\n// allows unused stores to be tree shaken\n/*! #__NO_SIDE_EFFECTS__ */\nfunction defineStore(\n// TODO: add proper types from above\nid, setup, setupOptions) {\n let options;\n const isSetupStore = typeof setup === 'function';\n // the option store setup will contain the actual options in this case\n options = isSetupStore ? setupOptions : setup;\n function useStore(pinia, hot) {\n const hasContext = hasInjectionContext();\n pinia =\n // in test mode, ignore the argument provided as we can always retrieve a\n // pinia instance with getActivePinia()\n ((process.env.NODE_ENV === 'test') && activePinia && activePinia._testing ? null : pinia) ||\n (hasContext ? inject(piniaSymbol, null) : null);\n if (pinia)\n setActivePinia(pinia);\n if ((process.env.NODE_ENV !== 'production') && !activePinia) {\n throw new Error(`[๐Ÿ]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\\n` +\n `See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\\n` +\n `This will fail in production.`);\n }\n pinia = activePinia;\n if (!pinia._s.has(id)) {\n // creating the store registers it in `pinia._s`\n if (isSetupStore) {\n createSetupStore(id, setup, options, pinia);\n }\n else {\n createOptionsStore(id, options, pinia);\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n // @ts-expect-error: not the right inferred type\n useStore._pinia = pinia;\n }\n }\n const store = pinia._s.get(id);\n if ((process.env.NODE_ENV !== 'production') && hot) {\n const hotId = '__hot:' + id;\n const newStore = isSetupStore\n ? createSetupStore(hotId, setup, options, pinia, true)\n : createOptionsStore(hotId, assign({}, options), pinia, true);\n hot._hotUpdate(newStore);\n // cleanup the state properties and the store from the cache\n delete pinia.state.value[hotId];\n pinia._s.delete(hotId);\n }\n if ((process.env.NODE_ENV !== 'production') && IS_CLIENT) {\n const currentInstance = getCurrentInstance();\n // save stores in instances to access them devtools\n if (currentInstance &&\n currentInstance.proxy &&\n // avoid adding stores that are just built for hot module replacement\n !hot) {\n const vm = currentInstance.proxy;\n const cache = '_pStores' in vm ? vm._pStores : (vm._pStores = {});\n cache[id] = store;\n }\n }\n // StoreGeneric cannot be casted towards Store\n return store;\n }\n useStore.$id = id;\n return useStore;\n}\n\nlet mapStoreSuffix = 'Store';\n/**\n * Changes the suffix added by `mapStores()`. Can be set to an empty string.\n * Defaults to `\"Store\"`. Make sure to extend the MapStoresCustomization\n * interface if you are using TypeScript.\n *\n * @param suffix - new suffix\n */\nfunction setMapStoreSuffix(suffix // could be 'Store' but that would be annoying for JS\n) {\n mapStoreSuffix = suffix;\n}\n/**\n * Allows using stores without the composition API (`setup()`) by generating an\n * object to be spread in the `computed` field of a component. It accepts a list\n * of store definitions.\n *\n * @example\n * ```js\n * export default {\n * computed: {\n * // other computed properties\n * ...mapStores(useUserStore, useCartStore)\n * },\n *\n * created() {\n * this.userStore // store with id \"user\"\n * this.cartStore // store with id \"cart\"\n * }\n * }\n * ```\n *\n * @param stores - list of stores to map to an object\n */\nfunction mapStores(...stores) {\n if ((process.env.NODE_ENV !== 'production') && Array.isArray(stores[0])) {\n console.warn(`[๐Ÿ]: Directly pass all stores to \"mapStores()\" without putting them in an array:\\n` +\n `Replace\\n` +\n `\\tmapStores([useAuthStore, useCartStore])\\n` +\n `with\\n` +\n `\\tmapStores(useAuthStore, useCartStore)\\n` +\n `This will fail in production if not fixed.`);\n stores = stores[0];\n }\n return stores.reduce((reduced, useStore) => {\n // @ts-expect-error: $id is added by defineStore\n reduced[useStore.$id + mapStoreSuffix] = function () {\n return useStore(this.$pinia);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = function () {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key];\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function () {\n const store = useStore(this.$pinia);\n const storeKey = keysOrMapper[key];\n // for some reason TS is unable to infer the type of storeKey to be a\n // function\n return typeof storeKey === 'function'\n ? storeKey.call(this, store)\n : // @ts-expect-error: FIXME: should work?\n store[storeKey];\n };\n return reduced;\n }, {});\n}\n/**\n * Alias for `mapState()`. You should use `mapState()` instead.\n * @deprecated use `mapState()` instead.\n */\nconst mapGetters = mapState;\n/**\n * Allows directly using actions from your store without using the composition\n * API (`setup()`) by generating an object to be spread in the `methods` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapActions(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key](...args);\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[keysOrMapper[key]](...args);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapWritableState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[key];\n },\n set(value) {\n return (useStore(this.$pinia)[key] = value);\n },\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[keysOrMapper[key]];\n },\n set(value) {\n return (useStore(this.$pinia)[keysOrMapper[key]] = value);\n },\n };\n return reduced;\n }, {});\n}\n\n/**\n * Creates an object of references with all the state, getters, and plugin-added\n * state properties of the store. Similar to `toRefs()` but specifically\n * designed for Pinia stores so methods and non reactive properties are\n * completely ignored.\n *\n * @param store - store to extract the refs from\n */\nfunction storeToRefs(store) {\n const rawStore = toRaw(store);\n const refs = {};\n for (const key in rawStore) {\n const value = rawStore[key];\n // There is no native method to check for a computed\n // https://github.com/vuejs/core/pull/4165\n if (value.effect) {\n // @ts-expect-error: too hard to type correctly\n refs[key] =\n // ...\n computed({\n get: () => store[key],\n set(value) {\n store[key] = value;\n },\n });\n }\n else if (isRef(value) || isReactive(value)) {\n // @ts-expect-error: the key is state or getter\n refs[key] =\n // ---\n toRef(store, key);\n }\n }\n return refs;\n}\n\nexport { MutationType, acceptHMRUpdate, createPinia, defineStore, disposePinia, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, shouldHydrate, skipHydrate, storeToRefs };\n"],"names":["activePinia","setActivePinia","pinia","piniaSymbol","isPlainObject","o","MutationType","createPinia","scope","effectScope","state","ref","_p","toBeInstalled","markRaw","app","plugin","noop","addSubscription","subscriptions","callback","detached","onCleanup","removeSubscription","getCurrentScope","onScopeDispose","triggerSubscriptions","args","fallbackRunWithContext","fn","ACTION_MARKER","ACTION_NAME","mergeReactiveObjects","target","patchToApply","value","key","subPatch","targetValue","isRef","isReactive","skipHydrateSymbol","shouldHydrate","obj","assign","isComputed","createOptionsStore","id","options","hot","actions","getters","initialState","store","setup","localState","toRefs","computedGetters","name","computed","createSetupStore","$id","isOptionsStore","optionsForPlugin","$subscribeOptions","isListening","isSyncListening","actionSubscriptions","debuggerEvents","activeListener","$patch","partialStateOrMutator","subscriptionMutation","myListenerId","nextTick","$reset","newState","$state","$dispose","action","wrappedAction","afterCallbackSet","onErrorCallbackSet","after","onError","ret","error","partialStore","stopWatcher","watch","reactive","setupStore","prop","actionValue","toRaw","extender","defineStore","setupOptions","isSetupStore","useStore","hasContext","hasInjectionContext","inject","storeToRefs","rawStore","refs","toRef"],"mappings":"qLAcA,IAAIA,EAQJ,MAAMC,EAAkBC,GAAWF,EAAcE,EAc3CC,EAAsG,OAAA,EAE5G,SAASC,EAETC,EAAG,CACC,OAAQA,GACJ,OAAOA,GAAM,UACb,OAAO,UAAU,SAAS,KAAKA,CAAC,IAAM,mBACtC,OAAOA,EAAE,QAAW,UAC5B,CAMA,IAAIC,GACH,SAAUA,EAAc,CAQrBA,EAAa,OAAY,SAMzBA,EAAa,YAAiB,eAM9BA,EAAa,cAAmB,gBAEpC,GAAGA,IAAiBA,EAAe,CAAA,EAAG,EAm5BtC,SAASC,IAAc,CACnB,MAAMC,EAAQC,EAAY,EAAI,EAGxBC,EAAQF,EAAM,IAAI,IAAMG,EAAI,C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EAAKrE,CAAG,EAEJsE,GAAMrD,EAAOjB,CAAG,EAE5B,CACA,OAAOqE,CACX","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/pinia-Bs-4aixE.chunk.mjs.map.license b/dist/pinia-BCiW4L1z.chunk.mjs.map.license similarity index 90% rename from dist/pinia-Bs-4aixE.chunk.mjs.map.license rename to dist/pinia-BCiW4L1z.chunk.mjs.map.license index c7aeaa426dd1c..6cb22a7ba03c4 100644 --- a/dist/pinia-Bs-4aixE.chunk.mjs.map.license +++ b/dist/pinia-BCiW4L1z.chunk.mjs.map.license @@ -3,5 +3,5 @@ SPDX-FileCopyrightText: Eduardo San Martin Morote This file is generated from multiple sources. Included packages: - pinia - - version: 3.0.3 + - version: 3.0.4 - license: MIT diff --git a/dist/pinia-Bs-4aixE.chunk.mjs b/dist/pinia-Bs-4aixE.chunk.mjs deleted file mode 100644 index 0a99466fd3558..0000000000000 --- a/dist/pinia-Bs-4aixE.chunk.mjs +++ /dev/null @@ -1,2 +0,0 @@ -import{y as G,k as H,z as K,A as Z,B as tt,C as nt,D as P,E as k,G as L,H as et,I as st,J as ot,K as ct,L as rt,n as N,M as at}from"./NcSettingsSection-BfK7eHNT-Cvwtv3xC.chunk.mjs";let W;const x=t=>W=t,q=Symbol();function M(t){return t&&typeof t=="object"&&Object.prototype.toString.call(t)==="[object Object]"&&typeof t.toJSON!="function"}var E;(function(t){t.direct="direct",t.patchObject="patch object",t.patchFunction="patch function"})(E||(E={}));function yt(){const t=G(!0),o=t.run(()=>H({}));let e=[],n=[];const r=K({install(a){x(r),r._a=a,a.provide(q,r),a.config.globalProperties.$pinia=r,n.forEach(i=>e.push(i)),n=[]},use(a){return this._a?e.push(a):n.push(a),this},_p:e,_a:null,_e:t,_s:new Map,state:o});return r}const Q=()=>{};function B(t,o,e,n=Q){t.push(o);const r=()=>{const a=t.indexOf(o);a>-1&&(t.splice(a,1),n())};return!e&&et()&&st(r),r}function j(t,...o){t.slice().forEach(e=>{e(...o)})}const it=t=>t(),D=Symbol(),I=Symbol();function A(t,o){t instanceof Map&&o instanceof Map?o.forEach((e,n)=>t.set(n,e)):t instanceof Set&&o instanceof Set&&o.forEach(t.add,t);for(const e in o){if(!o.hasOwnProperty(e))continue;const n=o[e],r=t[e];M(r)&&M(n)&&t.hasOwnProperty(e)&&!P(n)&&!k(n)?t[e]=A(r,n):t[e]=n}return t}const ut=Symbol();function ft(t){return!M(t)||!Object.prototype.hasOwnProperty.call(t,ut)}const{assign:l}=Object;function pt(t){return!!(P(t)&&t.effect)}function lt(t,o,e,n){const{state:r,actions:a,getters:i}=o,m=e.state.value[t];let h;function y(){m||(e.state.value[t]=r?r():{});const d=rt(e.state.value[t]);return l(d,a,Object.keys(i||{}).reduce((b,_)=>(b[_]=K(N(()=>{x(e);const v=e._s.get(t);return i[_].call(v,v)})),b),{}))}return h=R(t,y,o,e,n,!0),h}function R(t,o,e={},n,r,a){let i;const m=l({actions:{}},e),h={deep:!0};let y,d,b=[],_=[],v;const O=n.state.value[t];!a&&!O&&(n.state.value[t]={}),H({});let F;function J(s){let c;y=d=!1,typeof s=="function"?(s(n.state.value[t]),c={type:E.patchFunction,storeId:t,events:v}):(A(n.state.value[t],s),c={type:E.patchObject,payload:s,storeId:t,events:v});const u=F=Symbol();ct().then(()=>{F===u&&(y=!0)}),d=!0,j(b,c,n.state.value[t])}const T=a?function(){const{state:s}=e,c=s?s():{};this.$patch(u=>{l(u,c)})}:Q;function U(){i.stop(),b=[],_=[],n._s.delete(t)}const z=(s,c="")=>{if(D in s)return s[I]=c,s;const u=function(){x(n);const w=Array.from(arguments),g=[],C=[];function X(f){g.push(f)}function Y(f){C.push(f)}j(_,{args:w,name:u[I],store:p,after:X,onError:Y});let S;try{S=s.apply(this&&this.$id===t?this:p,w)}catch(f){throw j(C,f),f}return S instanceof Promise?S.then(f=>(j(g,f),f)).catch(f=>(j(C,f),Promise.reject(f))):(j(g,S),S)};return u[D]=!0,u[I]=c,u},V={_p:n,$id:t,$onAction:B.bind(null,_),$patch:J,$reset:T,$subscribe(s,c={}){const u=B(b,s,c.detached,()=>w()),w=i.run(()=>ot(()=>n.state.value[t],g=>{(c.flush==="sync"?d:y)&&s({storeId:t,type:E.direct,events:v},g)},l({},h,c)));return u},$dispose:U},p=nt(V);n._s.set(t,p);const $=(n._a&&n._a.runWithContext||it)(()=>n._e.run(()=>(i=G()).run(()=>o({action:z}))));for(const s in $){const c=$[s];if(P(c)&&!pt(c)||k(c))a||(O&&ft(c)&&(P(c)?c.value=O[s]:A(c,O[s])),n.state.value[t][s]=c);else if(typeof c=="function"){const u=z(c,s);$[s]=u,m.actions[s]=c}}return l(p,$),l(L(p),$),Object.defineProperty(p,"$state",{get:()=>n.state.value[t],set:s=>{J(c=>{l(c,s)})}}),n._p.forEach(s=>{l(p,i.run(()=>s({store:p,app:n._a,pinia:n,options:m})))}),O&&a&&e.hydrate&&e.hydrate(p.$state,O),y=!0,d=!0,p}function dt(t,o,e){let n;const r=typeof o=="function";n=r?e:o;function a(i,m){const h=tt();return i=i||(h?Z(q,null):null),i&&x(i),i=W,i._s.has(t)||(r?R(t,o,n,i):lt(t,n,i)),i._s.get(t)}return a.$id=t,a}function bt(t){const o=L(t),e={};for(const n in o){const r=o[n];r.effect?e[n]=N({get:()=>t[n],set(a){t[n]=a}}):(P(r)||k(r))&&(e[n]=at(t,n))}return e}export{yt as c,dt as d,bt as s}; -//# sourceMappingURL=pinia-Bs-4aixE.chunk.mjs.map diff --git a/dist/pinia-Bs-4aixE.chunk.mjs.map b/dist/pinia-Bs-4aixE.chunk.mjs.map deleted file mode 100644 index 5e4a3059c18df..0000000000000 --- a/dist/pinia-Bs-4aixE.chunk.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"pinia-Bs-4aixE.chunk.mjs","sources":["../node_modules/pinia/dist/pinia.mjs"],"sourcesContent":["/*!\n * pinia v3.0.3\n * (c) 2025 Eduardo San Martin Morote\n * @license MIT\n */\nimport { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope, ref, isRef, isReactive, getCurrentScope, onScopeDispose, getCurrentInstance, reactive, toRef, nextTick, computed, toRefs } from 'vue';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\n/**\n * setActivePinia must be called to handle SSR at the top of functions like\n * `fetch`, `setup`, `serverPrefetch` and others\n */\nlet activePinia;\n/**\n * Sets or unsets the active pinia. Used in SSR and internally when calling\n * actions and getters\n *\n * @param pinia - Pinia instance\n */\n// @ts-expect-error: cannot constrain the type of the return\nconst setActivePinia = (pinia) => (activePinia = pinia);\n/**\n * Get the currently active pinia if there is any.\n */\nconst getActivePinia = () => (hasInjectionContext() && inject(piniaSymbol)) || activePinia;\nconst piniaSymbol = ((process.env.NODE_ENV !== 'production') ? Symbol('pinia') : /* istanbul ignore next */ Symbol());\n\nfunction isPlainObject(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\no) {\n return (o &&\n typeof o === 'object' &&\n Object.prototype.toString.call(o) === '[object Object]' &&\n typeof o.toJSON !== 'function');\n}\n// type DeepReadonly = { readonly [P in keyof T]: DeepReadonly }\n// TODO: can we change these to numbers?\n/**\n * Possible types for SubscriptionCallback\n */\nvar MutationType;\n(function (MutationType) {\n /**\n * Direct mutation of the state:\n *\n * - `store.name = 'new name'`\n * - `store.$state.name = 'new name'`\n * - `store.list.push('new item')`\n */\n MutationType[\"direct\"] = \"direct\";\n /**\n * Mutated the state with `$patch` and an object\n *\n * - `store.$patch({ name: 'newName' })`\n */\n MutationType[\"patchObject\"] = \"patch object\";\n /**\n * Mutated the state with `$patch` and a function\n *\n * - `store.$patch(state => state.name = 'newName')`\n */\n MutationType[\"patchFunction\"] = \"patch function\";\n // maybe reset? for $state = {} and $reset\n})(MutationType || (MutationType = {}));\n\nconst IS_CLIENT = typeof window !== 'undefined';\n\n/*\n * FileSaver.js A saveAs() FileSaver implementation.\n *\n * Originally by Eli Grey, adapted as an ESM module by Eduardo San Martin\n * Morote.\n *\n * License : MIT\n */\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nconst _global = /*#__PURE__*/ (() => typeof window === 'object' && window.window === window\n ? window\n : typeof self === 'object' && self.self === self\n ? self\n : typeof global === 'object' && global.global === global\n ? global\n : typeof globalThis === 'object'\n ? globalThis\n : { HTMLElement: null })();\nfunction bom(blob, { autoBom = false } = {}) {\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (autoBom &&\n /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xfeff), blob], { type: blob.type });\n }\n return blob;\n}\nfunction download(url, name, opts) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.responseType = 'blob';\n xhr.onload = function () {\n saveAs(xhr.response, name, opts);\n };\n xhr.onerror = function () {\n console.error('could not download file');\n };\n xhr.send();\n}\nfunction corsEnabled(url) {\n const xhr = new XMLHttpRequest();\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false);\n try {\n xhr.send();\n }\n catch (e) { }\n return xhr.status >= 200 && xhr.status <= 299;\n}\n// `a.click()` doesn't work for all browsers (#465)\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'));\n }\n catch (e) {\n const evt = new MouseEvent('click', {\n bubbles: true,\n cancelable: true,\n view: window,\n detail: 0,\n screenX: 80,\n screenY: 20,\n clientX: 80,\n clientY: 20,\n ctrlKey: false,\n altKey: false,\n shiftKey: false,\n metaKey: false,\n button: 0,\n relatedTarget: null,\n });\n node.dispatchEvent(evt);\n }\n}\nconst _navigator = typeof navigator === 'object' ? navigator : { userAgent: '' };\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nconst isMacOSWebView = /*#__PURE__*/ (() => /Macintosh/.test(_navigator.userAgent) &&\n /AppleWebKit/.test(_navigator.userAgent) &&\n !/Safari/.test(_navigator.userAgent))();\nconst saveAs = !IS_CLIENT\n ? () => { } // noop\n : // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program\n typeof HTMLAnchorElement !== 'undefined' &&\n 'download' in HTMLAnchorElement.prototype &&\n !isMacOSWebView\n ? downloadSaveAs\n : // Use msSaveOrOpenBlob as a second approach\n 'msSaveOrOpenBlob' in _navigator\n ? msSaveAs\n : // Fallback to using FileReader and a popup\n fileSaverSaveAs;\nfunction downloadSaveAs(blob, name = 'download', opts) {\n const a = document.createElement('a');\n a.download = name;\n a.rel = 'noopener'; // tabnabbing\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob;\n if (a.origin !== location.origin) {\n if (corsEnabled(a.href)) {\n download(blob, name, opts);\n }\n else {\n a.target = '_blank';\n click(a);\n }\n }\n else {\n click(a);\n }\n }\n else {\n // Support blobs\n a.href = URL.createObjectURL(blob);\n setTimeout(function () {\n URL.revokeObjectURL(a.href);\n }, 4e4); // 40s\n setTimeout(function () {\n click(a);\n }, 0);\n }\n}\nfunction msSaveAs(blob, name = 'download', opts) {\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts);\n }\n else {\n const a = document.createElement('a');\n a.href = blob;\n a.target = '_blank';\n setTimeout(function () {\n click(a);\n });\n }\n }\n else {\n // @ts-ignore: works on windows\n navigator.msSaveOrOpenBlob(bom(blob, opts), name);\n }\n}\nfunction fileSaverSaveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank');\n if (popup) {\n popup.document.title = popup.document.body.innerText = 'downloading...';\n }\n if (typeof blob === 'string')\n return download(blob, name, opts);\n const force = blob.type === 'application/octet-stream';\n const isSafari = /constructor/i.test(String(_global.HTMLElement)) || 'safari' in _global;\n const isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent);\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) &&\n typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n const reader = new FileReader();\n reader.onloadend = function () {\n let url = reader.result;\n if (typeof url !== 'string') {\n popup = null;\n throw new Error('Wrong reader.result type');\n }\n url = isChromeIOS\n ? url\n : url.replace(/^data:[^;]*;/, 'data:attachment/file;');\n if (popup) {\n popup.location.href = url;\n }\n else {\n location.assign(url);\n }\n popup = null; // reverse-tabnabbing #460\n };\n reader.readAsDataURL(blob);\n }\n else {\n const url = URL.createObjectURL(blob);\n if (popup)\n popup.location.assign(url);\n else\n location.href = url;\n popup = null; // reverse-tabnabbing #460\n setTimeout(function () {\n URL.revokeObjectURL(url);\n }, 4e4); // 40s\n }\n}\n\n/**\n * Shows a toast or console.log\n *\n * @param message - message to log\n * @param type - different color of the tooltip\n */\nfunction toastMessage(message, type) {\n const piniaMessage = '๐Ÿ ' + message;\n if (typeof __VUE_DEVTOOLS_TOAST__ === 'function') {\n // No longer available :(\n __VUE_DEVTOOLS_TOAST__(piniaMessage, type);\n }\n else if (type === 'error') {\n console.error(piniaMessage);\n }\n else if (type === 'warn') {\n console.warn(piniaMessage);\n }\n else {\n console.log(piniaMessage);\n }\n}\nfunction isPinia(o) {\n return '_a' in o && 'install' in o;\n}\n\n/**\n * This file contain devtools actions, they are not Pinia actions.\n */\n// ---\nfunction checkClipboardAccess() {\n if (!('clipboard' in navigator)) {\n toastMessage(`Your browser doesn't support the Clipboard API`, 'error');\n return true;\n }\n}\nfunction checkNotFocusedError(error) {\n if (error instanceof Error &&\n error.message.toLowerCase().includes('document is not focused')) {\n toastMessage('You need to activate the \"Emulate a focused page\" setting in the \"Rendering\" panel of devtools.', 'warn');\n return true;\n }\n return false;\n}\nasync function actionGlobalCopyState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));\n toastMessage('Global state copied to clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to serialize the state. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalPasteState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));\n toastMessage('Global state pasted from clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalSaveState(pinia) {\n try {\n saveAs(new Blob([JSON.stringify(pinia.state.value)], {\n type: 'text/plain;charset=utf-8',\n }), 'pinia-state.json');\n }\n catch (error) {\n toastMessage(`Failed to export the state as JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nlet fileInput;\nfunction getFileOpener() {\n if (!fileInput) {\n fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = '.json';\n }\n function openFile() {\n return new Promise((resolve, reject) => {\n fileInput.onchange = async () => {\n const files = fileInput.files;\n if (!files)\n return resolve(null);\n const file = files.item(0);\n if (!file)\n return resolve(null);\n return resolve({ text: await file.text(), file });\n };\n // @ts-ignore: TODO: changed from 4.3 to 4.4\n fileInput.oncancel = () => resolve(null);\n fileInput.onerror = reject;\n fileInput.click();\n });\n }\n return openFile;\n}\nasync function actionGlobalOpenStateFile(pinia) {\n try {\n const open = getFileOpener();\n const result = await open();\n if (!result)\n return;\n const { text, file } = result;\n loadStoresState(pinia, JSON.parse(text));\n toastMessage(`Global state imported from \"${file.name}\".`);\n }\n catch (error) {\n toastMessage(`Failed to import the state from JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nfunction loadStoresState(pinia, state) {\n for (const key in state) {\n const storeState = pinia.state.value[key];\n // store is already instantiated, patch it\n if (storeState) {\n Object.assign(storeState, state[key]);\n }\n else {\n // store is not instantiated, set the initial state\n pinia.state.value[key] = state[key];\n }\n }\n}\n\nfunction formatDisplay(display) {\n return {\n _custom: {\n display,\n },\n };\n}\nconst PINIA_ROOT_LABEL = '๐Ÿ Pinia (root)';\nconst PINIA_ROOT_ID = '_root';\nfunction formatStoreForInspectorTree(store) {\n return isPinia(store)\n ? {\n id: PINIA_ROOT_ID,\n label: PINIA_ROOT_LABEL,\n }\n : {\n id: store.$id,\n label: store.$id,\n };\n}\nfunction formatStoreForInspectorState(store) {\n if (isPinia(store)) {\n const storeNames = Array.from(store._s.keys());\n const storeMap = store._s;\n const state = {\n state: storeNames.map((storeId) => ({\n editable: true,\n key: storeId,\n value: store.state.value[storeId],\n })),\n getters: storeNames\n .filter((id) => storeMap.get(id)._getters)\n .map((id) => {\n const store = storeMap.get(id);\n return {\n editable: false,\n key: id,\n value: store._getters.reduce((getters, key) => {\n getters[key] = store[key];\n return getters;\n }, {}),\n };\n }),\n };\n return state;\n }\n const state = {\n state: Object.keys(store.$state).map((key) => ({\n editable: true,\n key,\n value: store.$state[key],\n })),\n };\n // avoid adding empty getters\n if (store._getters && store._getters.length) {\n state.getters = store._getters.map((getterName) => ({\n editable: false,\n key: getterName,\n value: store[getterName],\n }));\n }\n if (store._customProperties.size) {\n state.customProperties = Array.from(store._customProperties).map((key) => ({\n editable: true,\n key,\n value: store[key],\n }));\n }\n return state;\n}\nfunction formatEventData(events) {\n if (!events)\n return {};\n if (Array.isArray(events)) {\n // TODO: handle add and delete for arrays and objects\n return events.reduce((data, event) => {\n data.keys.push(event.key);\n data.operations.push(event.type);\n data.oldValue[event.key] = event.oldValue;\n data.newValue[event.key] = event.newValue;\n return data;\n }, {\n oldValue: {},\n keys: [],\n operations: [],\n newValue: {},\n });\n }\n else {\n return {\n operation: formatDisplay(events.type),\n key: formatDisplay(events.key),\n oldValue: events.oldValue,\n newValue: events.newValue,\n };\n }\n}\nfunction formatMutationType(type) {\n switch (type) {\n case MutationType.direct:\n return 'mutation';\n case MutationType.patchFunction:\n return '$patch';\n case MutationType.patchObject:\n return '$patch';\n default:\n return 'unknown';\n }\n}\n\n// timeline can be paused when directly changing the state\nlet isTimelineActive = true;\nconst componentStateTypes = [];\nconst MUTATIONS_LAYER_ID = 'pinia:mutations';\nconst INSPECTOR_ID = 'pinia';\nconst { assign: assign$1 } = Object;\n/**\n * Gets the displayed name of a store in devtools\n *\n * @param id - id of the store\n * @returns a formatted string\n */\nconst getStoreType = (id) => '๐Ÿ ' + id;\n/**\n * Add the pinia plugin without any store. Allows displaying a Pinia plugin tab\n * as soon as it is added to the application.\n *\n * @param app - Vue application\n * @param pinia - pinia instance\n */\nfunction registerPiniaDevtools(app, pinia) {\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia ๐Ÿ',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n }, (api) => {\n if (typeof api.now !== 'function') {\n 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.');\n }\n api.addTimelineLayer({\n id: MUTATIONS_LAYER_ID,\n label: `Pinia ๐Ÿ`,\n color: 0xe5df88,\n });\n api.addInspector({\n id: INSPECTOR_ID,\n label: 'Pinia ๐Ÿ',\n icon: 'storage',\n treeFilterPlaceholder: 'Search stores',\n actions: [\n {\n icon: 'content_copy',\n action: () => {\n actionGlobalCopyState(pinia);\n },\n tooltip: 'Serialize and copy the state',\n },\n {\n icon: 'content_paste',\n action: async () => {\n await actionGlobalPasteState(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Replace the state with the content of your clipboard',\n },\n {\n icon: 'save',\n action: () => {\n actionGlobalSaveState(pinia);\n },\n tooltip: 'Save the state as a JSON file',\n },\n {\n icon: 'folder_open',\n action: async () => {\n await actionGlobalOpenStateFile(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Import the state from a JSON file',\n },\n ],\n nodeActions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state (with \"$reset\")',\n action: (nodeId) => {\n const store = pinia._s.get(nodeId);\n if (!store) {\n toastMessage(`Cannot reset \"${nodeId}\" store because it wasn't found.`, 'warn');\n }\n else if (typeof store.$reset !== 'function') {\n toastMessage(`Cannot reset \"${nodeId}\" store because it doesn't have a \"$reset\" method implemented.`, 'warn');\n }\n else {\n store.$reset();\n toastMessage(`Store \"${nodeId}\" reset.`);\n }\n },\n },\n ],\n });\n api.on.inspectComponent((payload) => {\n const proxy = (payload.componentInstance &&\n payload.componentInstance.proxy);\n if (proxy && proxy._pStores) {\n const piniaStores = payload.componentInstance.proxy._pStores;\n Object.values(piniaStores).forEach((store) => {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'state',\n editable: true,\n value: store._isOptionsAPI\n ? {\n _custom: {\n value: toRaw(store.$state),\n actions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state of this store',\n action: () => store.$reset(),\n },\n ],\n },\n }\n : // NOTE: workaround to unwrap transferred refs\n Object.keys(store.$state).reduce((state, key) => {\n state[key] = store.$state[key];\n return state;\n }, {}),\n });\n if (store._getters && store._getters.length) {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'getters',\n editable: false,\n value: store._getters.reduce((getters, key) => {\n try {\n getters[key] = store[key];\n }\n catch (error) {\n // @ts-expect-error: we just want to show it in devtools\n getters[key] = error;\n }\n return getters;\n }, {}),\n });\n }\n });\n }\n });\n api.on.getInspectorTree((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n let stores = [pinia];\n stores = stores.concat(Array.from(pinia._s.values()));\n payload.rootNodes = (payload.filter\n ? stores.filter((store) => '$id' in store\n ? store.$id\n .toLowerCase()\n .includes(payload.filter.toLowerCase())\n : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase()))\n : stores).map(formatStoreForInspectorTree);\n }\n });\n // Expose pinia instance as $pinia to window\n globalThis.$pinia = pinia;\n api.on.getInspectorState((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n // this could be the selected store restored for a different project\n // so it's better not to say anything here\n return;\n }\n if (inspectedStore) {\n // Expose selected store as $store to window\n if (payload.nodeId !== PINIA_ROOT_ID)\n globalThis.$store = toRaw(inspectedStore);\n payload.state = formatStoreForInspectorState(inspectedStore);\n }\n }\n });\n api.on.editInspectorState((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n return toastMessage(`store \"${payload.nodeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (!isPinia(inspectedStore)) {\n // access only the state\n if (path.length !== 1 ||\n !inspectedStore._customProperties.has(path[0]) ||\n path[0] in inspectedStore.$state) {\n path.unshift('$state');\n }\n }\n else {\n // Root access, we can omit the `.value` because the devtools API does it for us\n path.unshift('state');\n }\n isTimelineActive = false;\n payload.set(inspectedStore, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n api.on.editComponentState((payload) => {\n if (payload.type.startsWith('๐Ÿ')) {\n const storeId = payload.type.replace(/^๐Ÿ\\s*/, '');\n const store = pinia._s.get(storeId);\n if (!store) {\n return toastMessage(`store \"${storeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (path[0] !== 'state') {\n return toastMessage(`Invalid path for store \"${storeId}\":\\n${path}\\nOnly state can be modified.`);\n }\n // rewrite the first entry to be able to directly set the state as\n // well as any other path\n path[0] = '$state';\n isTimelineActive = false;\n payload.set(store, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n });\n}\nfunction addStoreToDevtools(app, store) {\n if (!componentStateTypes.includes(getStoreType(store.$id))) {\n componentStateTypes.push(getStoreType(store.$id));\n }\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia ๐Ÿ',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n settings: {\n logStoreChanges: {\n label: 'Notify about new/deleted stores',\n type: 'boolean',\n defaultValue: true,\n },\n // useEmojis: {\n // label: 'Use emojis in messages โšก๏ธ',\n // type: 'boolean',\n // defaultValue: true,\n // },\n },\n }, (api) => {\n // gracefully handle errors\n const now = typeof api.now === 'function' ? api.now.bind(api) : Date.now;\n store.$onAction(({ after, onError, name, args }) => {\n const groupId = runningActionId++;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ›ซ ' + name,\n subtitle: 'start',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n },\n groupId,\n },\n });\n after((result) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ›ฌ ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n result,\n },\n groupId,\n },\n });\n });\n onError((error) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n logType: 'error',\n title: '๐Ÿ’ฅ ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n error,\n },\n groupId,\n },\n });\n });\n }, true);\n store._customProperties.forEach((name) => {\n watch(() => unref(store[name]), (newValue, oldValue) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (isTimelineActive) {\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: 'Change',\n subtitle: name,\n data: {\n newValue,\n oldValue,\n },\n groupId: activeAction,\n },\n });\n }\n }, { deep: true });\n });\n store.$subscribe(({ events, type }, state) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (!isTimelineActive)\n return;\n // rootStore.state[store.id] = state\n const eventData = {\n time: now(),\n title: formatMutationType(type),\n data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),\n groupId: activeAction,\n };\n if (type === MutationType.patchFunction) {\n eventData.subtitle = 'โคต๏ธ';\n }\n else if (type === MutationType.patchObject) {\n eventData.subtitle = '๐Ÿงฉ';\n }\n else if (events && !Array.isArray(events)) {\n eventData.subtitle = events.type;\n }\n if (events) {\n eventData.data['rawEvent(s)'] = {\n _custom: {\n display: 'DebuggerEvent',\n type: 'object',\n tooltip: 'raw DebuggerEvent[]',\n value: events,\n },\n };\n }\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: eventData,\n });\n }, { detached: true, flush: 'sync' });\n const hotUpdate = store._hotUpdate;\n store._hotUpdate = markRaw((newStore) => {\n hotUpdate(newStore);\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ”ฅ ' + store.$id,\n subtitle: 'HMR update',\n data: {\n store: formatDisplay(store.$id),\n info: formatDisplay(`HMR update`),\n },\n },\n });\n // update the devtools too\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n });\n const { $dispose } = store;\n store.$dispose = () => {\n $dispose();\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`Disposed \"${store.$id}\" store ๐Ÿ—‘`);\n };\n // trigger an update so it can display new registered stores\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`\"${store.$id}\" store installed ๐Ÿ†•`);\n });\n}\nlet runningActionId = 0;\nlet activeAction;\n/**\n * Patches a store to enable action grouping in devtools by wrapping the store with a Proxy that is passed as the\n * context of all actions, allowing us to set `runningAction` on each access and effectively associating any state\n * mutation to the action.\n *\n * @param store - store to patch\n * @param actionNames - list of actionst to patch\n */\nfunction patchActionForGrouping(store, actionNames, wrapWithProxy) {\n // original actions of the store as they are given by pinia. We are going to override them\n const actions = actionNames.reduce((storeActions, actionName) => {\n // use toRaw to avoid tracking #541\n storeActions[actionName] = toRaw(store)[actionName];\n return storeActions;\n }, {});\n for (const actionName in actions) {\n store[actionName] = function () {\n // the running action id is incremented in a before action hook\n const _actionId = runningActionId;\n const trackedStore = wrapWithProxy\n ? new Proxy(store, {\n get(...args) {\n activeAction = _actionId;\n return Reflect.get(...args);\n },\n set(...args) {\n activeAction = _actionId;\n return Reflect.set(...args);\n },\n })\n : store;\n // For Setup Stores we need https://github.com/tc39/proposal-async-context\n activeAction = _actionId;\n const retValue = actions[actionName].apply(trackedStore, arguments);\n // this is safer as async actions in Setup Stores would associate mutations done outside of the action\n activeAction = undefined;\n return retValue;\n };\n }\n}\n/**\n * pinia.use(devtoolsPlugin)\n */\nfunction devtoolsPlugin({ app, store, options }) {\n // HMR module\n if (store.$id.startsWith('__hot:')) {\n return;\n }\n // detect option api vs setup api\n store._isOptionsAPI = !!options.state;\n // Do not overwrite actions mocked by @pinia/testing (#2298)\n if (!store._p._testing) {\n patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);\n // Upgrade the HMR to also update the new actions\n const originalHotUpdate = store._hotUpdate;\n toRaw(store)._hotUpdate = function (newStore) {\n originalHotUpdate.apply(this, arguments);\n patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);\n };\n }\n addStoreToDevtools(app, \n // FIXME: is there a way to allow the assignment from Store to StoreGeneric?\n store);\n}\n\n/**\n * Creates a Pinia instance to be used by the application\n */\nfunction createPinia() {\n const scope = effectScope(true);\n // NOTE: here we could check the window object for a state and directly set it\n // if there is anything like it with Vue 3 SSR\n const state = scope.run(() => ref({}));\n let _p = [];\n // plugins added before calling app.use(pinia)\n let toBeInstalled = [];\n const pinia = markRaw({\n install(app) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n pinia._a = app;\n app.provide(piniaSymbol, pinia);\n app.config.globalProperties.$pinia = pinia;\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(app, pinia);\n }\n toBeInstalled.forEach((plugin) => _p.push(plugin));\n toBeInstalled = [];\n },\n use(plugin) {\n if (!this._a) {\n toBeInstalled.push(plugin);\n }\n else {\n _p.push(plugin);\n }\n return this;\n },\n _p,\n // it's actually undefined here\n // @ts-expect-error\n _a: null,\n _e: scope,\n _s: new Map(),\n state,\n });\n // pinia devtools rely on dev only features so they cannot be forced unless\n // the dev build of Vue is used. Avoid old browsers like IE11.\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT && typeof Proxy !== 'undefined') {\n pinia.use(devtoolsPlugin);\n }\n return pinia;\n}\n/**\n * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly\n * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.\n * Once disposed, the pinia instance cannot be used anymore.\n *\n * @param pinia - pinia instance\n */\nfunction disposePinia(pinia) {\n pinia._e.stop();\n pinia._s.clear();\n pinia._p.splice(0);\n pinia.state.value = {};\n // @ts-expect-error: non valid\n pinia._a = null;\n}\n\n/**\n * Checks if a function is a `StoreDefinition`.\n *\n * @param fn - object to test\n * @returns true if `fn` is a StoreDefinition\n */\nconst isUseStore = (fn) => {\n return typeof fn === 'function' && typeof fn.$id === 'string';\n};\n/**\n * Mutates in place `newState` with `oldState` to _hot update_ it. It will\n * remove any key not existing in `newState` and recursively merge plain\n * objects.\n *\n * @param newState - new state object to be patched\n * @param oldState - old state that should be used to patch newState\n * @returns - newState\n */\nfunction patchObject(newState, oldState) {\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in oldState) {\n const subPatch = oldState[key];\n // skip the whole sub tree\n if (!(key in newState)) {\n continue;\n }\n const targetValue = newState[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n newState[key] = patchObject(targetValue, subPatch);\n }\n else {\n // objects are either a bit more complex (e.g. refs) or primitives, so we\n // just set the whole thing\n newState[key] = subPatch;\n }\n }\n return newState;\n}\n/**\n * Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.\n *\n * @example\n * ```js\n * const useUser = defineStore(...)\n * if (import.meta.hot) {\n * import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))\n * }\n * ```\n *\n * @param initialUseStore - return of the defineStore to hot update\n * @param hot - `import.meta.hot`\n */\nfunction acceptHMRUpdate(initialUseStore, hot) {\n // strip as much as possible from iife.prod\n if (!(process.env.NODE_ENV !== 'production')) {\n return () => { };\n }\n return (newModule) => {\n const pinia = hot.data.pinia || initialUseStore._pinia;\n if (!pinia) {\n // this store is still not used\n return;\n }\n // preserve the pinia instance across loads\n hot.data.pinia = pinia;\n // console.log('got data', newStore)\n for (const exportName in newModule) {\n const useStore = newModule[exportName];\n // console.log('checking for', exportName)\n if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {\n // console.log('Accepting update for', useStore.$id)\n const id = useStore.$id;\n if (id !== initialUseStore.$id) {\n console.warn(`The id of the store changed from \"${initialUseStore.$id}\" to \"${id}\". Reloading.`);\n // return import.meta.hot.invalidate()\n return hot.invalidate();\n }\n const existingStore = pinia._s.get(id);\n if (!existingStore) {\n console.log(`[Pinia]: skipping hmr because store doesn't exist yet`);\n return;\n }\n useStore(pinia, existingStore);\n }\n }\n };\n}\n\nconst noop = () => { };\nfunction addSubscription(subscriptions, callback, detached, onCleanup = noop) {\n subscriptions.push(callback);\n const removeSubscription = () => {\n const idx = subscriptions.indexOf(callback);\n if (idx > -1) {\n subscriptions.splice(idx, 1);\n onCleanup();\n }\n };\n if (!detached && getCurrentScope()) {\n onScopeDispose(removeSubscription);\n }\n return removeSubscription;\n}\nfunction triggerSubscriptions(subscriptions, ...args) {\n subscriptions.slice().forEach((callback) => {\n callback(...args);\n });\n}\n\nconst fallbackRunWithContext = (fn) => fn();\n/**\n * Marks a function as an action for `$onAction`\n * @internal\n */\nconst ACTION_MARKER = Symbol();\n/**\n * Action name symbol. Allows to add a name to an action after defining it\n * @internal\n */\nconst ACTION_NAME = Symbol();\nfunction mergeReactiveObjects(target, patchToApply) {\n // Handle Map instances\n if (target instanceof Map && patchToApply instanceof Map) {\n patchToApply.forEach((value, key) => target.set(key, value));\n }\n else if (target instanceof Set && patchToApply instanceof Set) {\n // Handle Set instances\n patchToApply.forEach(target.add, target);\n }\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in patchToApply) {\n if (!patchToApply.hasOwnProperty(key))\n continue;\n const subPatch = patchToApply[key];\n const targetValue = target[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n target.hasOwnProperty(key) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n // NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might\n // start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that\n // to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.\n target[key] = mergeReactiveObjects(targetValue, subPatch);\n }\n else {\n // @ts-expect-error: subPatch is a valid value\n target[key] = subPatch;\n }\n }\n return target;\n}\nconst skipHydrateSymbol = (process.env.NODE_ENV !== 'production')\n ? Symbol('pinia:skipHydration')\n : /* istanbul ignore next */ Symbol();\n/**\n * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a\n * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.\n *\n * @param obj - target object\n * @returns obj\n */\nfunction skipHydrate(obj) {\n return Object.defineProperty(obj, skipHydrateSymbol, {});\n}\n/**\n * Returns whether a value should be hydrated\n *\n * @param obj - target variable\n * @returns true if `obj` should be hydrated\n */\nfunction shouldHydrate(obj) {\n return (!isPlainObject(obj) ||\n !Object.prototype.hasOwnProperty.call(obj, skipHydrateSymbol));\n}\nconst { assign } = Object;\nfunction isComputed(o) {\n return !!(isRef(o) && o.effect);\n}\nfunction createOptionsStore(id, options, pinia, hot) {\n const { state, actions, getters } = options;\n const initialState = pinia.state.value[id];\n let store;\n function setup() {\n if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n pinia.state.value[id] = state ? state() : {};\n }\n // avoid creating a state in pinia.state.value\n const localState = (process.env.NODE_ENV !== 'production') && hot\n ? // use ref() to unwrap refs inside state TODO: check if this is still necessary\n toRefs(ref(state ? state() : {}).value)\n : toRefs(pinia.state.value[id]);\n return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {\n if ((process.env.NODE_ENV !== 'production') && name in localState) {\n console.warn(`[๐Ÿ]: A getter cannot have the same name as another state property. Rename one of them. Found with \"${name}\" in store \"${id}\".`);\n }\n computedGetters[name] = markRaw(computed(() => {\n setActivePinia(pinia);\n // it was created just before\n const store = pinia._s.get(id);\n // allow cross using stores\n // @ts-expect-error\n // return getters![name].call(context, context)\n // TODO: avoid reading the getter while assigning with a global variable\n return getters[name].call(store, store);\n }));\n return computedGetters;\n }, {}));\n }\n store = createSetupStore(id, setup, options, pinia, hot, true);\n return store;\n}\nfunction createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {\n let scope;\n const optionsForPlugin = assign({ actions: {} }, options);\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && !pinia._e.active) {\n throw new Error('Pinia destroyed');\n }\n // watcher options for $subscribe\n const $subscribeOptions = { deep: true };\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n $subscribeOptions.onTrigger = (event) => {\n /* istanbul ignore else */\n if (isListening) {\n debuggerEvents = event;\n // avoid triggering this while the store is being built and the state is being set in pinia\n }\n else if (isListening == false && !store._hotUpdating) {\n // let patch send all the events together later\n /* istanbul ignore else */\n if (Array.isArray(debuggerEvents)) {\n debuggerEvents.push(event);\n }\n else {\n console.error('๐Ÿ debuggerEvents should be an array. This is most likely an internal Pinia bug.');\n }\n }\n };\n }\n // internal state\n let isListening; // set to true at the end\n let isSyncListening; // set to true at the end\n let subscriptions = [];\n let actionSubscriptions = [];\n let debuggerEvents;\n const initialState = pinia.state.value[$id];\n // avoid setting the state for option stores if it is set\n // by the setup\n if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n pinia.state.value[$id] = {};\n }\n const hotState = ref({});\n // avoid triggering too many listeners\n // https://github.com/vuejs/pinia/issues/1129\n let activeListener;\n function $patch(partialStateOrMutator) {\n let subscriptionMutation;\n isListening = isSyncListening = false;\n // reset the debugger events since patches are sync\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n debuggerEvents = [];\n }\n if (typeof partialStateOrMutator === 'function') {\n partialStateOrMutator(pinia.state.value[$id]);\n subscriptionMutation = {\n type: MutationType.patchFunction,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n else {\n mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);\n subscriptionMutation = {\n type: MutationType.patchObject,\n payload: partialStateOrMutator,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n const myListenerId = (activeListener = Symbol());\n nextTick().then(() => {\n if (activeListener === myListenerId) {\n isListening = true;\n }\n });\n isSyncListening = true;\n // because we paused the watcher, we need to manually call the subscriptions\n triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);\n }\n const $reset = isOptionsStore\n ? function $reset() {\n const { state } = options;\n const newState = state ? state() : {};\n // we use a patch to group all changes into one single subscription\n this.$patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, newState);\n });\n }\n : /* istanbul ignore next */\n (process.env.NODE_ENV !== 'production')\n ? () => {\n throw new Error(`๐Ÿ: Store \"${$id}\" is built using the setup syntax and does not implement $reset().`);\n }\n : noop;\n function $dispose() {\n scope.stop();\n subscriptions = [];\n actionSubscriptions = [];\n pinia._s.delete($id);\n }\n /**\n * Helper that wraps function so it can be tracked with $onAction\n * @param fn - action to wrap\n * @param name - name of the action\n */\n const action = (fn, name = '') => {\n if (ACTION_MARKER in fn) {\n fn[ACTION_NAME] = name;\n return fn;\n }\n const wrappedAction = function () {\n setActivePinia(pinia);\n const args = Array.from(arguments);\n const afterCallbackList = [];\n const onErrorCallbackList = [];\n function after(callback) {\n afterCallbackList.push(callback);\n }\n function onError(callback) {\n onErrorCallbackList.push(callback);\n }\n // @ts-expect-error\n triggerSubscriptions(actionSubscriptions, {\n args,\n name: wrappedAction[ACTION_NAME],\n store,\n after,\n onError,\n });\n let ret;\n try {\n ret = fn.apply(this && this.$id === $id ? this : store, args);\n // handle sync errors\n }\n catch (error) {\n triggerSubscriptions(onErrorCallbackList, error);\n throw error;\n }\n if (ret instanceof Promise) {\n return ret\n .then((value) => {\n triggerSubscriptions(afterCallbackList, value);\n return value;\n })\n .catch((error) => {\n triggerSubscriptions(onErrorCallbackList, error);\n return Promise.reject(error);\n });\n }\n // trigger after callbacks\n triggerSubscriptions(afterCallbackList, ret);\n return ret;\n };\n wrappedAction[ACTION_MARKER] = true;\n wrappedAction[ACTION_NAME] = name; // will be set later\n // @ts-expect-error: we are intentionally limiting the returned type to just Fn\n // because all the added properties are internals that are exposed through `$onAction()` only\n return wrappedAction;\n };\n const _hmrPayload = /*#__PURE__*/ markRaw({\n actions: {},\n getters: {},\n state: [],\n hotState,\n });\n const partialStore = {\n _p: pinia,\n // _s: scope,\n $id,\n $onAction: addSubscription.bind(null, actionSubscriptions),\n $patch,\n $reset,\n $subscribe(callback, options = {}) {\n const removeSubscription = addSubscription(subscriptions, callback, options.detached, () => stopWatcher());\n const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {\n if (options.flush === 'sync' ? isSyncListening : isListening) {\n callback({\n storeId: $id,\n type: MutationType.direct,\n events: debuggerEvents,\n }, state);\n }\n }, assign({}, $subscribeOptions, options)));\n return removeSubscription;\n },\n $dispose,\n };\n const store = reactive((process.env.NODE_ENV !== 'production') || ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT)\n ? assign({\n _hmrPayload,\n _customProperties: markRaw(new Set()), // devtools custom properties\n }, partialStore\n // must be added later\n // setupStore\n )\n : partialStore);\n // store the partial store now so the setup of stores can instantiate each other before they are finished without\n // creating infinite loops.\n pinia._s.set($id, store);\n const runWithContext = (pinia._a && pinia._a.runWithContext) || fallbackRunWithContext;\n // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped\n const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));\n // overwrite existing actions to support $onAction\n for (const key in setupStore) {\n const prop = setupStore[key];\n if ((isRef(prop) && !isComputed(prop)) || isReactive(prop)) {\n // mark it as a piece of state to be serialized\n if ((process.env.NODE_ENV !== 'production') && hot) {\n hotState.value[key] = toRef(setupStore, key);\n // createOptionStore directly sets the state in pinia.state.value so we\n // can just skip that\n }\n else if (!isOptionsStore) {\n // in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created\n if (initialState && shouldHydrate(prop)) {\n if (isRef(prop)) {\n prop.value = initialState[key];\n }\n else {\n // probably a reactive object, lets recursively assign\n // @ts-expect-error: prop is unknown\n mergeReactiveObjects(prop, initialState[key]);\n }\n }\n // transfer the ref to the pinia state to keep everything in sync\n pinia.state.value[$id][key] = prop;\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.state.push(key);\n }\n // action\n }\n else if (typeof prop === 'function') {\n const actionValue = (process.env.NODE_ENV !== 'production') && hot ? prop : action(prop, key);\n // this a hot module replacement store because the hotUpdate method needs\n // to do it with the right context\n // @ts-expect-error\n setupStore[key] = actionValue;\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.actions[key] = prop;\n }\n // list actions so they can be used in plugins\n // @ts-expect-error\n optionsForPlugin.actions[key] = prop;\n }\n else if ((process.env.NODE_ENV !== 'production')) {\n // add getters for devtools\n if (isComputed(prop)) {\n _hmrPayload.getters[key] = isOptionsStore\n ? // @ts-expect-error\n options.getters[key]\n : prop;\n if (IS_CLIENT) {\n const getters = setupStore._getters ||\n // @ts-expect-error: same\n (setupStore._getters = markRaw([]));\n getters.push(key);\n }\n }\n }\n }\n // add the state, getters, and action properties\n /* istanbul ignore if */\n assign(store, setupStore);\n // allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.\n // Make `storeToRefs()` work with `reactive()` #799\n assign(toRaw(store), setupStore);\n // use this instead of a computed with setter to be able to create it anywhere\n // without linking the computed lifespan to wherever the store is first\n // created.\n Object.defineProperty(store, '$state', {\n get: () => ((process.env.NODE_ENV !== 'production') && hot ? hotState.value : pinia.state.value[$id]),\n set: (state) => {\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && hot) {\n throw new Error('cannot set hotState');\n }\n $patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, state);\n });\n },\n });\n // add the hotUpdate before plugins to allow them to override it\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n store._hotUpdate = markRaw((newStore) => {\n store._hotUpdating = true;\n newStore._hmrPayload.state.forEach((stateKey) => {\n if (stateKey in store.$state) {\n const newStateTarget = newStore.$state[stateKey];\n const oldStateSource = store.$state[stateKey];\n if (typeof newStateTarget === 'object' &&\n isPlainObject(newStateTarget) &&\n isPlainObject(oldStateSource)) {\n patchObject(newStateTarget, oldStateSource);\n }\n else {\n // transfer the ref\n newStore.$state[stateKey] = oldStateSource;\n }\n }\n // patch direct access properties to allow store.stateProperty to work as\n // store.$state.stateProperty\n // @ts-expect-error: any type\n store[stateKey] = toRef(newStore.$state, stateKey);\n });\n // remove deleted state properties\n Object.keys(store.$state).forEach((stateKey) => {\n if (!(stateKey in newStore.$state)) {\n // @ts-expect-error: noop if doesn't exist\n delete store[stateKey];\n }\n });\n // avoid devtools logging this as a mutation\n isListening = false;\n isSyncListening = false;\n pinia.state.value[$id] = toRef(newStore._hmrPayload, 'hotState');\n isSyncListening = true;\n nextTick().then(() => {\n isListening = true;\n });\n for (const actionName in newStore._hmrPayload.actions) {\n const actionFn = newStore[actionName];\n // @ts-expect-error: actionName is a string\n store[actionName] =\n //\n action(actionFn, actionName);\n }\n // TODO: does this work in both setup and option store?\n for (const getterName in newStore._hmrPayload.getters) {\n const getter = newStore._hmrPayload.getters[getterName];\n const getterValue = isOptionsStore\n ? // special handling of options api\n computed(() => {\n setActivePinia(pinia);\n return getter.call(store, store);\n })\n : getter;\n // @ts-expect-error: getterName is a string\n store[getterName] =\n //\n getterValue;\n }\n // remove deleted getters\n Object.keys(store._hmrPayload.getters).forEach((key) => {\n if (!(key in newStore._hmrPayload.getters)) {\n // @ts-expect-error: noop if doesn't exist\n delete store[key];\n }\n });\n // remove old actions\n Object.keys(store._hmrPayload.actions).forEach((key) => {\n if (!(key in newStore._hmrPayload.actions)) {\n // @ts-expect-error: noop if doesn't exist\n delete store[key];\n }\n });\n // update the values used in devtools and to allow deleting new properties later on\n store._hmrPayload = newStore._hmrPayload;\n store._getters = newStore._getters;\n store._hotUpdating = false;\n });\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const nonEnumerable = {\n writable: true,\n configurable: true,\n // avoid warning on devtools trying to display this property\n enumerable: false,\n };\n ['_p', '_hmrPayload', '_getters', '_customProperties'].forEach((p) => {\n Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));\n });\n }\n // apply all plugins\n pinia._p.forEach((extender) => {\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const extensions = scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n }));\n Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));\n assign(store, extensions);\n }\n else {\n assign(store, scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n })));\n }\n });\n if ((process.env.NODE_ENV !== 'production') &&\n store.$state &&\n typeof store.$state === 'object' &&\n typeof store.$state.constructor === 'function' &&\n !store.$state.constructor.toString().includes('[native code]')) {\n console.warn(`[๐Ÿ]: The \"state\" must be a plain object. It cannot be\\n` +\n `\\tstate: () => new MyClass()\\n` +\n `Found in store \"${store.$id}\".`);\n }\n // only apply hydrate to option stores with an initial state in pinia\n if (initialState &&\n isOptionsStore &&\n options.hydrate) {\n options.hydrate(store.$state, initialState);\n }\n isListening = true;\n isSyncListening = true;\n return store;\n}\n// allows unused stores to be tree shaken\n/*! #__NO_SIDE_EFFECTS__ */\nfunction defineStore(\n// TODO: add proper types from above\nid, setup, setupOptions) {\n let options;\n const isSetupStore = typeof setup === 'function';\n // the option store setup will contain the actual options in this case\n options = isSetupStore ? setupOptions : setup;\n function useStore(pinia, hot) {\n const hasContext = hasInjectionContext();\n pinia =\n // in test mode, ignore the argument provided as we can always retrieve a\n // pinia instance with getActivePinia()\n ((process.env.NODE_ENV === 'test') && activePinia && activePinia._testing ? null : pinia) ||\n (hasContext ? inject(piniaSymbol, null) : null);\n if (pinia)\n setActivePinia(pinia);\n if ((process.env.NODE_ENV !== 'production') && !activePinia) {\n throw new Error(`[๐Ÿ]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\\n` +\n `See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\\n` +\n `This will fail in production.`);\n }\n pinia = activePinia;\n if (!pinia._s.has(id)) {\n // creating the store registers it in `pinia._s`\n if (isSetupStore) {\n createSetupStore(id, setup, options, pinia);\n }\n else {\n createOptionsStore(id, options, pinia);\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n // @ts-expect-error: not the right inferred type\n useStore._pinia = pinia;\n }\n }\n const store = pinia._s.get(id);\n if ((process.env.NODE_ENV !== 'production') && hot) {\n const hotId = '__hot:' + id;\n const newStore = isSetupStore\n ? createSetupStore(hotId, setup, options, pinia, true)\n : createOptionsStore(hotId, assign({}, options), pinia, true);\n hot._hotUpdate(newStore);\n // cleanup the state properties and the store from the cache\n delete pinia.state.value[hotId];\n pinia._s.delete(hotId);\n }\n if ((process.env.NODE_ENV !== 'production') && IS_CLIENT) {\n const currentInstance = getCurrentInstance();\n // save stores in instances to access them devtools\n if (currentInstance &&\n currentInstance.proxy &&\n // avoid adding stores that are just built for hot module replacement\n !hot) {\n const vm = currentInstance.proxy;\n const cache = '_pStores' in vm ? vm._pStores : (vm._pStores = {});\n cache[id] = store;\n }\n }\n // StoreGeneric cannot be casted towards Store\n return store;\n }\n useStore.$id = id;\n return useStore;\n}\n\nlet mapStoreSuffix = 'Store';\n/**\n * Changes the suffix added by `mapStores()`. Can be set to an empty string.\n * Defaults to `\"Store\"`. Make sure to extend the MapStoresCustomization\n * interface if you are using TypeScript.\n *\n * @param suffix - new suffix\n */\nfunction setMapStoreSuffix(suffix // could be 'Store' but that would be annoying for JS\n) {\n mapStoreSuffix = suffix;\n}\n/**\n * Allows using stores without the composition API (`setup()`) by generating an\n * object to be spread in the `computed` field of a component. It accepts a list\n * of store definitions.\n *\n * @example\n * ```js\n * export default {\n * computed: {\n * // other computed properties\n * ...mapStores(useUserStore, useCartStore)\n * },\n *\n * created() {\n * this.userStore // store with id \"user\"\n * this.cartStore // store with id \"cart\"\n * }\n * }\n * ```\n *\n * @param stores - list of stores to map to an object\n */\nfunction mapStores(...stores) {\n if ((process.env.NODE_ENV !== 'production') && Array.isArray(stores[0])) {\n console.warn(`[๐Ÿ]: Directly pass all stores to \"mapStores()\" without putting them in an array:\\n` +\n `Replace\\n` +\n `\\tmapStores([useAuthStore, useCartStore])\\n` +\n `with\\n` +\n `\\tmapStores(useAuthStore, useCartStore)\\n` +\n `This will fail in production if not fixed.`);\n stores = stores[0];\n }\n return stores.reduce((reduced, useStore) => {\n // @ts-expect-error: $id is added by defineStore\n reduced[useStore.$id + mapStoreSuffix] = function () {\n return useStore(this.$pinia);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = function () {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key];\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function () {\n const store = useStore(this.$pinia);\n const storeKey = keysOrMapper[key];\n // for some reason TS is unable to infer the type of storeKey to be a\n // function\n return typeof storeKey === 'function'\n ? storeKey.call(this, store)\n : // @ts-expect-error: FIXME: should work?\n store[storeKey];\n };\n return reduced;\n }, {});\n}\n/**\n * Alias for `mapState()`. You should use `mapState()` instead.\n * @deprecated use `mapState()` instead.\n */\nconst mapGetters = mapState;\n/**\n * Allows directly using actions from your store without using the composition\n * API (`setup()`) by generating an object to be spread in the `methods` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapActions(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key](...args);\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[keysOrMapper[key]](...args);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapWritableState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[key];\n },\n set(value) {\n return (useStore(this.$pinia)[key] = value);\n },\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n reduced[key] = {\n get() {\n return useStore(this.$pinia)[keysOrMapper[key]];\n },\n set(value) {\n return (useStore(this.$pinia)[keysOrMapper[key]] = value);\n },\n };\n return reduced;\n }, {});\n}\n\n/**\n * Creates an object of references with all the state, getters, and plugin-added\n * state properties of the store. Similar to `toRefs()` but specifically\n * designed for Pinia stores so methods and non reactive properties are\n * completely ignored.\n *\n * @param store - store to extract the refs from\n */\nfunction storeToRefs(store) {\n const rawStore = toRaw(store);\n const refs = {};\n for (const key in rawStore) {\n const value = rawStore[key];\n // There is no native method to check for a computed\n // https://github.com/vuejs/core/pull/4165\n if (value.effect) {\n // @ts-expect-error: too hard to type correctly\n refs[key] =\n // ...\n computed({\n get: () => store[key],\n set(value) {\n store[key] = value;\n },\n });\n }\n else if (isRef(value) || isReactive(value)) {\n // @ts-expect-error: the key is state or getter\n refs[key] =\n // ---\n toRef(store, key);\n }\n }\n return refs;\n}\n\nexport { MutationType, acceptHMRUpdate, createPinia, defineStore, disposePinia, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, shouldHydrate, skipHydrate, storeToRefs };\n"],"names":["activePinia","setActivePinia","pinia","piniaSymbol","isPlainObject","o","MutationType","createPinia","scope","effectScope","state","ref","_p","toBeInstalled","markRaw","app","plugin","noop","addSubscription","subscriptions","callback","detached","onCleanup","removeSubscription","idx","getCurrentScope","onScopeDispose","triggerSubscriptions","args","fallbackRunWithContext","fn","ACTION_MARKER","ACTION_NAME","mergeReactiveObjects","target","patchToApply","value","key","subPatch","targetValue","isRef","isReactive","skipHydrateSymbol","shouldHydrate","obj","assign","isComputed","createOptionsStore","id","options","hot","actions","getters","initialState","store","setup","localState","toRefs","computedGetters","name","computed","createSetupStore","$id","isOptionsStore","optionsForPlugin","$subscribeOptions","isListening","isSyncListening","actionSubscriptions","debuggerEvents","activeListener","$patch","partialStateOrMutator","subscriptionMutation","myListenerId","nextTick","$reset","newState","$state","$dispose","action","wrappedAction","afterCallbackList","onErrorCallbackList","after","onError","ret","error","partialStore","stopWatcher","watch","reactive","setupStore","prop","actionValue","toRaw","extender","defineStore","setupOptions","isSetupStore","useStore","hasContext","hasInjectionContext","inject","storeToRefs","rawStore","refs","toRef"],"mappings":"qLAYA,IAAIA,EAQJ,MAAMC,EAAkBC,GAAWF,EAAcE,EAK3CC,EAAsG,OAAA,EAE5G,SAASC,EAETC,EAAG,CACC,OAAQA,GACJ,OAAOA,GAAM,UACb,OAAO,UAAU,SAAS,KAAKA,CAAC,IAAM,mBACtC,OAAOA,EAAE,QAAW,UAC5B,CAMA,IAAIC,GACH,SAAUA,EAAc,CAQrBA,EAAa,OAAY,SAMzBA,EAAa,YAAiB,eAM9BA,EAAa,cAAmB,gBAEpC,GAAGA,IAAiBA,EAAe,CAAA,EAAG,EAq5BtC,SAASC,IAAc,CACnB,MAAMC,EAAQC,EAAY,EAAI,EAGxBC,EAAQF,EAAM,IAAI,IAAMG,EAAI,CAAA,CAAE,CAAC,EACrC,IAAIC,EAAK,CAAA,EAELC,EAAgB,CAAA,EACpB,MAAMX,EAAQY,EAAQ,CAClB,QAAQC,EAAK,CAG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G,EAEJsE,GAAMrD,EAAOjB,CAAG,EAE5B,CACA,OAAOqE,CACX","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/twofactor_backupcodes-settings-personal.mjs b/dist/twofactor_backupcodes-settings-personal.mjs index 6c1bbd34cb1dc..1d07b5a744699 100644 --- a/dist/twofactor_backupcodes-settings-personal.mjs +++ b/dist/twofactor_backupcodes-settings-personal.mjs @@ -1,3 +1,3 @@ -import{d as U,c as A}from"./pinia-Bs-4aixE.chunk.mjs";import{f as t,j as I,e as M,l as R,k as m,m as j,n as x,p as i,o as n,c as E,u as a,w as k,d as p,t as u,q as L,s as q,F as _,i as f,v as B,x as g,b as y,_ as F,h as G}from"./NcSettingsSection-BfK7eHNT-Cvwtv3xC.chunk.mjs";import{g as H,a as $,s as P,N as w}from"./Plus-DJQMY9d_.chunk.mjs";import{c as z}from"./index-Df02w-w7.chunk.mjs";const D=H().detectLogLevel().setApp("twofactor_backupcodes").build();function J(d){const c=$().theming.name||"Nextcloud",e=window.open("",t("twofactor_backupcodes","{name} backup codes",{name:c}));if(!e)throw P(t("twofactor_backupcodes","Unable to open a new tab for printing")),new Error("Unable to open a new tab for printing");const o=e.document.createElement("h1");o.textContent=t("twofactor_backupcodes","{name} backup codes",{name:c});const s=e.document.createElement("pre");for(const b of d){const r=e.document.createTextNode(b);s.appendChild(r),s.appendChild(e.document.createElement("br"))}e.document.body.innerHTML="",e.document.body.appendChild(o),e.document.body.appendChild(s),e.print(),e.close()}async function K(){const d=I("/apps/twofactor_backupcodes/settings/create"),{data:c}=await M.post(d);return c}const v=R("twofactor_backupcodes","state"),O=U("twofactor_backupcodes",()=>{const d=m(v.enabled),c=m(v.total),e=m(v.used),o=m([]);async function s(){d.value=!1;const{codes:b,state:r}=await K();d.value=r.enabled,c.value=r.total,e.value=r.used,o.value=b}return{enabled:d,total:c,used:e,codes:o,generate:s}}),Q=["aria-label"],V=j({__name:"PersonalSettings",setup(d){const c=$().theming.name??"Nextcloud",e=O(),o=m(!1),s=x(()=>e.codes&&e.codes.length>0),b=c+"-backup-codes.txt",r=x(()=>s.value?"data:text/plain,"+encodeURIComponent(e.codes.reduce((l,C)=>l+C+` +import{d as U,c as A}from"./pinia-BCiW4L1z.chunk.mjs";import{f as t,j as I,e as M,l as R,k as m,m as j,n as x,p as i,o as n,c as E,u as a,w as k,d as p,t as u,q as L,s as q,F as _,i as f,v as B,x as g,b as y,_ as F,h as G}from"./NcSettingsSection-BfK7eHNT-Cvwtv3xC.chunk.mjs";import{g as H,a as $,s as P,N as w}from"./Plus-DJQMY9d_.chunk.mjs";import{c as z}from"./index-Df02w-w7.chunk.mjs";const D=H().detectLogLevel().setApp("twofactor_backupcodes").build();function J(d){const c=$().theming.name||"Nextcloud",e=window.open("",t("twofactor_backupcodes","{name} backup codes",{name:c}));if(!e)throw P(t("twofactor_backupcodes","Unable to open a new tab for printing")),new Error("Unable to open a new tab for printing");const o=e.document.createElement("h1");o.textContent=t("twofactor_backupcodes","{name} backup codes",{name:c});const s=e.document.createElement("pre");for(const b of d){const r=e.document.createTextNode(b);s.appendChild(r),s.appendChild(e.document.createElement("br"))}e.document.body.innerHTML="",e.document.body.appendChild(o),e.document.body.appendChild(s),e.print(),e.close()}async function K(){const d=I("/apps/twofactor_backupcodes/settings/create"),{data:c}=await M.post(d);return c}const v=R("twofactor_backupcodes","state"),O=U("twofactor_backupcodes",()=>{const d=m(v.enabled),c=m(v.total),e=m(v.used),o=m([]);async function s(){d.value=!1;const{codes:b,state:r}=await K();d.value=r.enabled,c.value=r.total,e.value=r.used,o.value=b}return{enabled:d,total:c,used:e,codes:o,generate:s}}),Q=["aria-label"],V=j({__name:"PersonalSettings",setup(d){const c=$().theming.name??"Nextcloud",e=O(),o=m(!1),s=x(()=>e.codes&&e.codes.length>0),b=c+"-backup-codes.txt",r=x(()=>s.value?"data:text/plain,"+encodeURIComponent(e.codes.reduce((l,C)=>l+C+` `,"")):"");async function h(){await z(),o.value=!0;try{await e.generate()}catch(l){D.error("Error generating backup codes",{error:l}),P(t("twofactor_backupcodes","An error occurred while generating your backup codes"))}finally{o.value=!1}}function T(){J(!e.codes||e.codes.length===0?[]:e.codes)}return(l,C)=>(n(),i("div",{class:g(l.$style.backupcodesSettings)},[a(e).enabled?(n(),i(_,{key:1},[f("p",null,[s.value?(n(),i(_,{key:1},[p(u(a(t)("twofactor_backupcodes","These are your backup codes. Please save and/or print them as you will not be able to read the codes again later."))+" ",1),f("ul",{"aria-label":a(t)("twofactor_backupcodes","List of backup codes")},[(n(!0),i(_,null,B(a(e).codes,S=>(n(),i("li",{key:S,class:g(l.$style.backupcodesSettings__code)},u(S),3))),128))],8,Q)],64)):(n(),i(_,{key:0},[p(u(a(t)("twofactor_backupcodes","Backup codes have been generated. {used} of {total} codes have been used.",{used:a(e).used,total:a(e).total})),1)],64))]),f("p",{class:g(l.$style.backupcodesSettings__actions)},[y(a(w),{id:"generate-backup-codes",variant:"error",onClick:h},{default:k(()=>[p(u(a(t)("twofactor_backupcodes","Regenerate backup codes")),1)]),_:1}),s.value?(n(),i(_,{key:0},[y(a(w),{onClick:T},{default:k(()=>[p(u(a(t)("twofactor_backupcodes","Print backup codes")),1)]),_:1}),y(a(w),{href:r.value,download:b,variant:"primary"},{default:k(()=>[p(u(a(t)("twofactor_backupcodes","Save backup codes")),1)]),_:1},8,["href"])],64)):L("",!0)],2),f("p",null,[f("em",null,u(a(t)("twofactor_backupcodes","If you regenerate backup codes, you automatically invalidate old codes.")),1)])],64)):(n(),E(a(w),{key:0,disabled:o.value,variant:"primary",onClick:h},{icon:k(()=>[o.value?(n(),E(a(q),{key:0})):L("",!0)]),default:k(()=>[p(" "+u(a(t)("twofactor_backupcodes","Generate backup codes")),1)]),_:1},8,["disabled"]))],2))}}),W="_backupcodesSettings_bnkw8_2",X="_backupcodesSettings__code_bnkw8_7",Y="_backupcodesSettings__actions_bnkw8_13",Z={backupcodesSettings:W,backupcodesSettings__code:X,backupcodesSettings__actions:Y},ee={$style:Z},ae=F(V,[["__cssModules",ee]]),te=A(),N=G(ae);N.use(te),N.mount("#twofactor-backupcodes-settings"); //# sourceMappingURL=twofactor_backupcodes-settings-personal.mjs.map diff --git a/dist/user_ldap-settings-admin.mjs b/dist/user_ldap-settings-admin.mjs index ec0938124fb3a..7e74039c06e47 100644 --- a/dist/user_ldap-settings-admin.mjs +++ b/dist/user_ldap-settings-admin.mjs @@ -1,2 +1,2 @@ -import{e as M,g as S,a1 as te,f as a,k as D,l as X,n as L,m as O,p as A,o as f,i as c,b as o,t as p,u as e,w as m,d as b,a as N,_ as B,c as k,q as z,s as Y,V as ee,a5 as re,J as ie,F as W,x as oe,D as se,v as de,h as ue}from"./NcSettingsSection-BfK7eHNT-Cvwtv3xC.chunk.mjs";import{g as ne,s as E,j as ae,k as pe,a as q,_ as h,q as T,t as R,N as I,u as ce,v as Q,w as ve,P as _e}from"./Plus-DJQMY9d_.chunk.mjs";import{d as ge,s as $,c as fe}from"./pinia-Bs-4aixE.chunk.mjs";const j=ne().setApp("LDAP").detectUser().build();async function me(){const u=await M.post(S("apps/user_ldap/api/v1/config"));return j.debug("Created configuration",{configId:u.data.ocs.data.configID}),u.data.ocs.data.configID}async function he(u){const s=new FormData;s.set("copyConfig",u);const n=await M.post(S("apps/user_ldap/api/v1/config/{configId}/copy",{configId:u}),s);return j.debug("Created configuration",{configId:n.data.ocs.data.configID}),n.data.ocs.data.configID}async function be(u){const s=await M.get(S("apps/user_ldap/api/v1/config/{configId}",{configId:u}));return j.debug("Fetched configuration",{configId:u,config:s.data.ocs.data}),s.data.ocs.data}async function ye(u,s){const n=await M.put(S("apps/user_ldap/api/v1/config/{configId}",{configId:u}),{configData:s});return j.debug("Updated configuration",{configId:u,config:s}),n.data.ocs.data}async function we(u){try{if(!await J(a("user_ldap","Confirm action"),a("user_ldap","Are you sure you want to permanently delete this LDAP configuration? This cannot be undone.")))return!1;await M.delete(S("apps/user_ldap/api/v1/config/{configId}",{configId:u})),j.debug("Deleted configuration",{configId:u})}catch(s){const n=s.response;E(n?.data.ocs.meta.message||a("user_ldap","Failed to delete config"))}return!0}async function Ae(u){const s=new FormData,n=await M.post(S("apps/user_ldap/api/v1/config/{configId}/test",{configId:u}));return j.debug(`Configuration is ${n.data.ocs.data.success?"valide":"invalide"}`,{configId:u,params:s,response:n}),n.data.ocs.data}async function De(u){if(!await J(a("user_ldap","Confirm action"),a("user_ldap","Are you sure you want to permanently clear the LDAP mapping? This cannot be undone.")))return!1;try{const s=await M.post(S("apps/user_ldap/api/v1/wizard/clearMappings"),{subject:u});return j.debug("Cleared mapping",{subject:u,response:s}),ae(a("user_ldap","Mapping cleared")),!0}catch(s){const n=s.response;E(n?.data.ocs.meta.message||a("user_ldap","Failed to clear mapping"))}}async function F(u,s,n={}){const t=new FormData;Object.entries(n).forEach(([i,v])=>{t.set(i,v)});try{const i=await M.post(S("apps/user_ldap/api/v1/wizard/{configId}/{action}",{configId:s,action:u}),t);return j.debug(`Called wizard action: ${u}`,{configId:s,params:t,response:i}),i.data.ocs.data}catch(i){if(te(i)&&i.response?.data.ocs.meta.status==="failure"){const v=i.response.data.ocs.meta.message??a("user_ldap","An error occurred");E(v)}throw i}}async function Z(){return await J(a("user_ldap","Mode switch"),a("user_ldap","Switching the mode will enable automatic LDAP queries. Depending on your LDAP size they may take a while. Do you still want to switch the mode?"))}async function J(u,s){let n=!1;return await pe(u).setText(s).setSeverity("warning").addButton({label:a("user_ldap","Cancel"),callback(){}}).addButton({label:a("user_ldap","Confirm"),variant:"error",callback(){n=!0}}).build().show(),n}const H=ge("ldap-configs",()=>{const u=D(X("user_ldap","ldapConfigs")),s=D(Object.keys(u.value)[0]),n=L(()=>s.value===void 0?void 0:u.value[s.value]),t=D(0);function i(l,w={}){if(u.value[l]===void 0)throw new Error(`Config with id ${l} does not exist`);return new Proxy(u.value[l],{get(x,P){return x[P]},set(x,P,U){return x[P]=U,(async()=>(t.value++,await ye(l,{[P]:U}),t.value--,w[P]!==void 0&&w[P](x[P])))(),!0}})}async function v(){const l=await me();return u.value[l]=await be(l),s.value=l,l}async function g(l){if(u.value[l]===void 0)throw new Error(`Config with id ${l} does not exist`);const w=await he(l);return u.value[w]={...u.value[l]},s.value=w,w}async function r(l){await we(l)===!0&&delete u.value[l],s.value=Object.keys(u.value)[0]??await v()}return{ldapConfigs:u,selectedConfigId:s,selectedConfig:n,updatingConfig:t,getConfigProxy:i,create:v,copyConfig:g,removeConfig:r}}),Ue={class:"ldap-wizard__advanced"},Ce={open:"",name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},Pe={name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},xe={class:"tablecell"},Le={name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},Fe={name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},Ie=O({__name:"AdvancedTab",props:{configId:{}},setup(u){const s=u,n=H(),t=L(()=>n.getConfigProxy(s.configId)),i=q().theming.name,v={uniqueMember:"uniqueMember",memberUid:"memberUid",member:"member (AD)",gidNumber:"gidNumber",zimbraMailForwardingAddress:"zimbraMailForwardingAddress"};return(g,r)=>(f(),A("fieldset",Ue,[c("details",Ce,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","Connection Settings")),1)]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Backup (Replica) Host"),"model-value":t.value.ldapBackupHost,"helper-text":e(a)("user_ldap","Give an optional backup host. It must be a replica of the main LDAP/AD server."),onChange:r[0]||(r[0]=l=>t.value.ldapBackupHost=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{type:"number","model-value":t.value.ldapBackupPort,label:e(a)("user_ldap","Backup (Replica) Port"),onChange:r[1]||(r[1]=l=>t.value.ldapBackupPort=l.target.value)},null,8,["model-value","label"]),o(e(N),{"model-value":t.value.ldapOverrideMainServer==="1",type:"switch","aria-label":e(a)("user_ldap","Only connect to the replica server."),"onUpdate:modelValue":r[2]||(r[2]=l=>t.value.ldapOverrideMainServer=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Disable Main Server")),1)]),_:1},8,["model-value","aria-label"]),o(e(N),{"model-value":t.value.turnOffCertCheck==="1","aria-label":e(a)("user_ldap","Not recommended, use it for testing only! If connection only works with this option, import the LDAP server's SSL certificate in your {instanceName} server.",{instanceName:e(i)}),"onUpdate:modelValue":r[3]||(r[3]=l=>t.value.turnOffCertCheck=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Turn off SSL certificate validation.")),1)]),_:1},8,["model-value","aria-label"]),o(e(h),{type:"number",label:e(a)("user_ldap","Cache Time-To-Live"),"model-value":t.value.ldapCacheTTL,"helper-text":e(a)("user_ldap","in seconds. A change empties the cache."),onChange:r[4]||(r[4]=l=>t.value.ldapCacheTTL=l.target.value)},null,8,["label","model-value","helper-text"])]),c("details",Pe,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","Directory Settings")),1)]),o(e(h),{autocomplete:"off","model-value":t.value.ldapUserDisplayName,label:e(a)("user_ldap","User Display Name Field"),"helper-text":e(a)("user_ldap","The LDAP attribute to use to generate the user's display name."),onChange:r[5]||(r[5]=l=>t.value.ldapUserDisplayName=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapUserDisplayName2,label:e(a)("user_ldap","2nd User Display Name Field"),"helper-text":e(a)("user_ldap","Optional. An LDAP attribute to be added to the display name in brackets. Results in e.g. ยปJohn Doe (john.doe@example.org)ยซ."),onChange:r[6]||(r[6]=l=>t.value.ldapUserDisplayName2=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(T),{"model-value":t.value.ldapBaseUsers,placeholder:e(a)("user_ldap","One User Base DN per line"),label:e(a)("user_ldap","Base User Tree"),onChange:r[7]||(r[7]=l=>t.value.ldapBaseUsers=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(T),{"model-value":t.value.ldapAttributesForUserSearch,placeholder:e(a)("user_ldap","Optional; one attribute per line"),label:e(a)("user_ldap","User Search Attributes"),onChange:r[8]||(r[8]=l=>t.value.ldapAttributesForUserSearch=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(N),{"model-value":t.value.markRemnantsAsDisabled==="1","aria-label":e(a)("user_ldap","When switched on, users imported from LDAP which are then missing will be disabled"),"onUpdate:modelValue":r[9]||(r[9]=l=>t.value.markRemnantsAsDisabled=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Disable users missing from LDAP")),1)]),_:1},8,["model-value","aria-label"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapGroupDisplayName,label:e(a)("user_ldap","Group Display Name Field"),title:e(a)("user_ldap","The LDAP attribute to use to generate the groups's display name."),onChange:r[10]||(r[10]=l=>t.value.ldapGroupDisplayName=l.target.value)},null,8,["model-value","label","title"]),o(e(T),{"model-value":t.value.ldapBaseGroups,placeholder:e(a)("user_ldap","One Group Base DN per line"),label:e(a)("user_ldap","Base Group Tree"),onChange:r[11]||(r[11]=l=>t.value.ldapBaseGroups=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(T),{"model-value":t.value.ldapAttributesForGroupSearch,placeholder:e(a)("user_ldap","Optional; one attribute per line"),label:e(a)("user_ldap","Group Search Attributes"),onChange:r[12]||(r[12]=l=>t.value.ldapAttributesForGroupSearch=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(R),{modelValue:t.value.ldapGroupMemberAssocAttr,"onUpdate:modelValue":r[13]||(r[13]=l=>t.value.ldapGroupMemberAssocAttr=l),options:Object.keys(v),"input-label":e(a)("user_ldap","Group-Member association")},{option:m(({label:l})=>[b(p(v[l]),1)]),"selected-option":m(({label:l})=>[b(p(v[l]),1)]),_:1},8,["modelValue","options","input-label"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Dynamic Group Member URL"),"model-value":t.value.ldapDynamicGroupMemberURL,"helper-text":e(a)("user_ldap","The LDAP attribute that on group objects contains an LDAP search URL that determines what objects belong to the group. (An empty setting disables dynamic group membership functionality.)"),onChange:r[14]||(r[14]=l=>t.value.ldapDynamicGroupMemberURL=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(N),{"model-value":t.value.ldapNestedGroups==="1","aria-label":e(a)("user_ldap","When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)"),"onUpdate:modelValue":r[15]||(r[15]=l=>t.value.ldapNestedGroups=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Nested Groups")),1)]),_:1},8,["model-value","aria-label"]),o(e(h),{type:"number",label:e(a)("user_ldap","Paging chunksize"),"model-value":t.value.ldapPagingSize,"helper-text":e(a)("user_ldap","Chunksize used for paged LDAP searches that may return bulky results like user or group enumeration. (Setting it 0 disables paged LDAP searches in those situations.)"),onChange:r[16]||(r[16]=l=>t.value.ldapPagingSize=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(N),{"model-value":t.value.turnOnPasswordChange==="1","aria-label":e(a)("user_ldap","Allow LDAP users to change their password and allow Super Administrators and Group Administrators to change the password of their LDAP users. Only works when access control policies are configured accordingly on the LDAP server. As passwords are sent in plaintext to the LDAP server, transport encryption must be used and password hashing should be configured on the LDAP server."),"onUpdate:modelValue":r[17]||(r[17]=l=>t.value.turnOnPasswordChange=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Enable LDAP password changes per user")),1)]),_:1},8,["model-value","aria-label"]),c("span",xe,p(e(a)("user_ldap","(New password is sent as plain text to LDAP)")),1),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Default password policy DN"),"model-value":t.value.ldapDefaultPPolicyDN,"helper-text":e(a)("user_ldap","The DN of a default password policy that will be used for password expiry handling. Works only when LDAP password changes per user are enabled and is only supported by OpenLDAP. Leave empty to disable password expiry handling."),onChange:r[18]||(r[18]=l=>t.value.ldapDefaultPPolicyDN=l.target.value)},null,8,["label","model-value","helper-text"])]),c("details",Le,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","Special Attributes")),1)]),o(e(h),{autocomplete:"off","model-value":t.value.ldapQuotaAttribute,label:e(a)("user_ldap","Quota Field"),"helper-text":e(a)("user_ldap","Leave empty for user's default quota. Otherwise, specify an LDAP/AD attribute."),onChange:r[19]||(r[19]=l=>t.value.ldapQuotaAttribute=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapQuotaDefault,label:e(a)("user_ldap","Quota Default"),"helper-text":e(a)("user_ldap","Override default quota for LDAP users who do not have a quota set in the Quota Field."),onChange:r[20]||(r[20]=l=>t.value.ldapQuotaDefault=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapEmailAttribute,label:e(a)("user_ldap","Email Field"),"helper-text":e(a)("user_ldap","Set the user's email from their LDAP attribute. Leave it empty for default behaviour."),onChange:r[21]||(r[21]=l=>t.value.ldapEmailAttribute=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","User Home Folder Naming Rule"),"model-value":t.value.homeFolderNamingRule,"helper-text":e(a)("user_ldap","Leave empty for username (default). Otherwise, specify an LDAP/AD attribute."),onChange:r[22]||(r[22]=l=>t.value.homeFolderNamingRule=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","`$home` Placeholder Field"),"model-value":t.value.ldapExtStorageHomeAttribute,"helper-text":e(a)("user_ldap","$home in an external storage configuration will be replaced with the value of the specified attribute"),onChange:r[23]||(r[23]=l=>t.value.ldapExtStorageHomeAttribute=l.target.value)},null,8,["label","model-value","helper-text"])]),c("details",Fe,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","User Profile Attributes")),1)]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Phone Field"),"model-value":t.value.ldapAttributePhone,"helper-text":e(a)("user_ldap","User profile Phone will be set from the specified attribute"),onChange:r[24]||(r[24]=l=>t.value.ldapAttributePhone=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Website Field"),"model-value":t.value.ldapAttributeWebsite,"helper-text":e(a)("user_ldap","User profile Website will be set from the specified attribute"),onChange:r[25]||(r[25]=l=>t.value.ldapAttributeWebsite=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Address Field"),"model-value":t.value.ldapAttributeAddress,"helper-text":e(a)("user_ldap","User profile Address will be set from the specified attribute"),onChange:r[26]||(r[26]=l=>t.value.ldapAttributeAddress=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Twitter Field"),"model-value":t.value.ldapAttributeTwitter,"helper-text":e(a)("user_ldap","User profile Twitter will be set from the specified attribute"),onChange:r[27]||(r[27]=l=>t.value.ldapAttributeTwitter=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Fediverse Field"),"model-value":t.value.ldapAttributeFediverse,"helper-text":e(a)("user_ldap","User profile Fediverse will be set from the specified attribute"),onChange:r[28]||(r[28]=l=>t.value.ldapAttributeFediverse=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Organisation Field"),"model-value":t.value.ldapAttributeOrganisation,"helper-text":e(a)("user_ldap","User profile Organisation will be set from the specified attribute"),onChange:r[29]||(r[29]=l=>t.value.ldapAttributeOrganisation=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Role Field"),"model-value":t.value.ldapAttributeRole,"helper-text":e(a)("user_ldap","User profile Role will be set from the specified attribute"),onChange:r[30]||(r[30]=l=>t.value.ldapAttributeRole=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Headline Field"),"model-value":t.value.ldapAttributeHeadline,"helper-text":e(a)("user_ldap","User profile Headline will be set from the specified attribute"),onChange:r[31]||(r[31]=l=>t.value.ldapAttributeHeadline=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Biography Field"),"model-value":t.value.ldapAttributeBiography,"helper-text":e(a)("user_ldap","User profile Biography will be set from the specified attribute"),onChange:r[32]||(r[32]=l=>t.value.ldapAttributeBiography=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Birthdate Field"),"model-value":t.value.ldapAttributeBirthDate,"helper-text":e(a)("user_ldap","User profile Date of birth will be set from the specified attribute"),onChange:r[33]||(r[33]=l=>t.value.ldapAttributeBirthDate=l.target.value)},null,8,["label","model-value","helper-text"])])]))}}),ke=B(Ie,[["__scopeId","data-v-67c3dc3f"]]),ze={class:"ldap-wizard__expert"},Ne={class:"ldap-wizard__expert__line"},Ve={id:"ldap_expert_username_attr"},Ge={class:"ldap-wizard__expert__line"},Be={id:"ldap_expert_uuid_user_attr"},Oe=O({__name:"ExpertTab",props:{configId:{}},setup(u){const s=u,n=H(),t=L(()=>n.getConfigProxy(s.configId));return(i,v)=>(f(),A("fieldset",ze,[c("div",Ne,[c("strong",null,p(e(a)("user_ldap","Internal Username")),1),c("p",Ve,p(e(a)("user_ldap","By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [a-zA-Z0-9_.@-]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all DAV services. With this setting, the default behavior can be overridden. Changes will have effect only on newly mapped (added) LDAP users. Leave it empty for default behavior.")),1),o(e(h),{"aria-describedby":"ldap_expert_username_attr",autocomplete:"off",label:e(a)("user_ldap","Internal Username Attribute:"),"model-value":t.value.ldapExpertUsernameAttr,onChange:v[0]||(v[0]=g=>t.value.ldapExpertUsernameAttr=g.target.value)},null,8,["label","model-value"])]),c("div",Ge,[c("strong",null,p(e(a)("user_ldap","Override UUID detection")),1),c("p",Be,p(e(a)("user_ldap","By default, the UUID attribute is automatically detected. The UUID attribute is used to doubtlessly identify LDAP users and groups. Also, the internal username will be created based on the UUID, if not specified otherwise above. You can override the setting and pass an attribute of your choice. You must make sure that the attribute of your choice can be fetched for both users and groups and it is unique. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users and groups.")),1),o(e(h),{"aria-describedby":"ldap_expert_uuid_user_attr",autocomplete:"off",label:e(a)("user_ldap","UUID Attribute for Users"),"model-value":t.value.ldapExpertUUIDUserAttr,onChange:v[1]||(v[1]=g=>t.value.ldapExpertUUIDUserAttr=g.target.value)},null,8,["label","model-value"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","UUID Attribute for Groups"),"model-value":t.value.ldapExpertUUIDGroupAttr,onChange:v[2]||(v[2]=g=>t.value.ldapExpertUUIDGroupAttr=g.target.value)},null,8,["label","model-value"])])]))}}),Te=B(Oe,[["__scopeId","data-v-17498cec"]]),Me={class:"ldap-wizard__groups"},Se={class:"ldap-wizard__groups__line ldap-wizard__groups__filter-selection"},je={class:"ldap-wizard__groups__line ldap-wizard__groups__groups-filter"},He={key:0},Ee={key:1},Re={class:"ldap-wizard__groups__line ldap-wizard__groups__groups-count-check"},$e={key:1},qe=O({__name:"GroupsTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId,{ldapGroupFilterObjectclass:C,ldapGroupFilterGroups:C})),v=q().theming.name,g=D(void 0),r=D([]),l=D([]),w=D(!1),x=L({get(){return i.value.ldapGroupFilterObjectclass.split(";").filter(d=>d!=="")},set(d){i.value.ldapGroupFilterObjectclass=d.join(";")}}),P=L({get(){return i.value.ldapGroupFilterGroups.split(";").filter(d=>d!=="")},set(d){i.value.ldapGroupFilterGroups=d.join(";")}});async function U(){const d=await F("determineGroupObjectClasses",s.configId);r.value=d.options?.ldap_groupfilter_objectclass??[];const _=await F("determineGroupsForGroups",s.configId);l.value=_.options?.ldap_groupfilter_groups??[]}U();async function C(){const d=await F("getGroupFilter",s.configId);t.value[s.configId].ldapGroupFilter=d.changes?.ldap_group_filter??""}async function V(){try{w.value=!0;const d=await F("countGroups",s.configId);g.value=d.changes.ldap_group_count}finally{w.value=!1}}async function y(d){d?i.value.ldapGroupFilterMode="1":i.value.ldapGroupFilterMode=await Z()?"0":"1"}return(d,_)=>(f(),A("fieldset",Me,[c("legend",null,p(e(a)("user_ldap","Groups meeting these criteria are available in {instanceName}:",{instanceName:e(v)})),1),c("div",Se,[o(e(R),{modelValue:x.value,"onUpdate:modelValue":_[0]||(_[0]=G=>x.value=G),class:"ldap-wizard__groups__group-filter-groups__select",options:r.value,disabled:i.value.ldapGroupFilterMode==="1","input-label":e(a)("user_ldap","Only these object classes:"),multiple:!0},null,8,["modelValue","options","disabled","input-label"]),o(e(R),{modelValue:P.value,"onUpdate:modelValue":_[1]||(_[1]=G=>P.value=G),class:"ldap-wizard__groups__group-filter-groups__select",options:l.value,disabled:i.value.ldapGroupFilterMode==="1","input-label":e(a)("user_ldap","Only from these groups:"),multiple:!0},null,8,["modelValue","options","disabled","input-label"])]),c("div",je,[o(e(N),{"model-value":i.value.ldapGroupFilterMode==="1","onUpdate:modelValue":y},{default:m(()=>[b(p(e(a)("user_ldap","Edit LDAP Query")),1)]),_:1},8,["model-value"]),i.value.ldapGroupFilterMode==="1"?(f(),A("div",He,[o(e(T),{modelValue:i.value.ldapGroupFilter,"onUpdate:modelValue":_[2]||(_[2]=G=>i.value.ldapGroupFilter=G),placeholder:e(a)("user_ldap","Edit LDAP Query"),"helper-text":e(a)("user_ldap","The filter specifies which LDAP groups shall have access to the {instanceName} instance.",{instanceName:e(v)})},null,8,["modelValue","placeholder","helper-text"])])):(f(),A("div",Ee,[c("span",null,p(e(a)("user_ldap","LDAP Filter:")),1),c("code",null,p(i.value.ldapGroupFilter),1)]))]),c("div",Re,[o(e(I),{disabled:w.value,onClick:V},{default:m(()=>[b(p(e(a)("user_ldap","Verify settings and count the groups")),1)]),_:1},8,["disabled"]),w.value?(f(),k(e(Y),{key:0,size:20})):z("",!0),g.value!==void 0&&!w.value?(f(),A("span",$e,p(g.value),1)):z("",!0)])]))}}),Qe=B(qe,[["__scopeId","data-v-2fbcc471"]]),We={class:"ldap-wizard__login"},Ye={class:"ldap-wizard__login__line ldap-wizard__login__login-attributes"},Ze={class:"ldap-wizard__login__line ldap-wizard__login__user-login-filter"},Je={key:1},Ke={class:"ldap-wizard__login__line"},Xe=O({__name:"LoginTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId,{ldapLoginFilterAttributes:U,ldapLoginFilterUsername:U,ldapLoginFilterEmail:U})),v=q().theming.name,g=D(""),r=D([]),l=L({get(){return i.value.ldapLoginFilterAttributes.split(";").filter(y=>y!=="")},set(y){i.value.ldapLoginFilterAttributes=y.join(";")}}),w=L(()=>i.value.ldapLoginFilterMode==="1"),x=L(()=>r.value.filter(y=>!l.value.includes(y)));async function P(){const y=await F("determineAttributes",s.configId);r.value=y.options?.ldap_loginfilter_attributes??[]}P();async function U(){if(i.value.ldapLoginFilterMode==="0"){const y=await F("getUserLoginFilter",s.configId);t.value[s.configId].ldapLoginFilter=y.changes?.ldap_login_filter??""}}async function C(){try{const y=await F("testLoginName",s.configId,{loginName:g.value}),d=y.changes.ldap_test_loginname,_=y.changes.ldap_test_effective_filter;d<1?E(a("user_ldap","User not found. Please check your login attributes and username. Effective filter (to copy-and-paste for command-line validation): {filter}",{filter:_})):d===1?ae(a("user_ldap","User found and settings verified.")):d>1&&ce(a("user_ldap","Consider narrowing your search, as it encompassed many users, only the first one of whom will be able to log in."))}catch(y){switch(y??a("user_ldap","An unspecified error occurred. Please check log and settings.")){case"Bad search filter":E(a("user_ldap","The search filter is invalid, probably due to syntax issues like uneven number of opened and closed brackets. Please revise."));break;case"connection error":E(a("user_ldap","A connection error to LDAP/AD occurred. Please check host, port and credentials."));break;case"missing placeholder":E(a("user_ldap",'The "%uid" placeholder is missing. It will be replaced with the login name when querying LDAP/AD.'));break}}}async function V(y){y?i.value.ldapLoginFilterMode="1":i.value.ldapLoginFilterMode=await Z()?"0":"1"}return(y,d)=>(f(),A("fieldset",We,[c("legend",null,p(e(a)("user_ldap","When logging in, {instanceName} will find the user based on the following attributes:",{instanceName:e(v)})),1),o(e(N),{"model-value":i.value.ldapLoginFilterUsername==="1",description:e(a)("user_ldap","Allows login against the LDAP/AD username, which is either 'uid' or 'sAMAccountName' and will be detected."),"onUpdate:modelValue":d[0]||(d[0]=_=>i.value.ldapLoginFilterUsername=_?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","LDAP/AD Username:")),1)]),_:1},8,["model-value","description"]),o(e(N),{"model-value":i.value.ldapLoginFilterEmail==="1",description:e(a)("user_ldap","Allows login against an email attribute. 'mail' and 'mailPrimaryAddress' allowed."),"onUpdate:modelValue":d[1]||(d[1]=_=>i.value.ldapLoginFilterEmail=_?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","LDAP/AD Email Address:")),1)]),_:1},8,["model-value","description"]),c("div",Ye,[o(e(R),{modelValue:l.value,"onUpdate:modelValue":d[2]||(d[2]=_=>l.value=_),"keep-open":"",disabled:w.value,options:x.value,"input-label":e(a)("user_ldap","Other Attributes:"),multiple:!0},null,8,["modelValue","disabled","options","input-label"])]),c("div",Ze,[o(e(N),{"model-value":w.value,"onUpdate:modelValue":V},{default:m(()=>[b(p(e(a)("user_ldap","Edit LDAP Query")),1)]),_:1},8,["model-value"]),w.value?(f(),k(e(T),{key:0,"model-value":i.value.ldapLoginFilter,placeholder:e(a)("user_ldap","Edit LDAP Query"),"helper-text":e(a)("user_ldap","Defines the filter to apply, when login is attempted. `%%uid` replaces the username in the login action. Example: `uid=%%uid`"),onChange:d[3]||(d[3]=_=>i.value.ldapLoginFilter=_.target.value)},null,8,["model-value","placeholder","helper-text"])):(f(),A("div",Je,[c("span",null,p(e(a)("user_ldap","LDAP Filter:")),1),c("code",null,p(i.value.ldapLoginFilter),1)]))]),c("div",Ke,[o(e(h),{modelValue:g.value,"onUpdate:modelValue":d[4]||(d[4]=_=>g.value=_),"helper-text":e(a)("user_ldap","Attempts to receive a DN for the given login name and the current login filter"),label:e(a)("user_ldap","Test Login name"),autocomplete:"off"},null,8,["modelValue","helper-text","label"]),o(e(I),{disabled:g.value.length===0,onClick:C},{default:m(()=>[b(p(e(a)("user_ldap","Verify settings")),1)]),_:1},8,["disabled"])])]))}}),ea=B(Xe,[["__scopeId","data-v-bcb1b43f"]]),aa={name:"ContentCopyIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},la=["aria-hidden","aria-label"],ta=["fill","width","height"],ra={d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"},ia={key:0};function oa(u,s,n,t,i,v){return f(),A("span",ee(u.$attrs,{"aria-hidden":n.title?null:"true","aria-label":n.title,class:"material-design-icon content-copy-icon",role:"img",onClick:s[0]||(s[0]=g=>u.$emit("click",g))}),[(f(),A("svg",{fill:n.fillColor,class:"material-design-icon__svg",width:n.size,height:n.size,viewBox:"0 0 24 24"},[c("path",ra,[n.title?(f(),A("title",ia,p(n.title),1)):z("",!0)])],8,ta))],16,la)}const le=B(aa,[["render",oa]]),sa={name:"DeleteIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},da=["aria-hidden","aria-label"],ua=["fill","width","height"],na={d:"M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z"},pa={key:0};function ca(u,s,n,t,i,v){return f(),A("span",ee(u.$attrs,{"aria-hidden":n.title?null:"true","aria-label":n.title,class:"material-design-icon delete-icon",role:"img",onClick:s[0]||(s[0]=g=>u.$emit("click",g))}),[(f(),A("svg",{fill:n.fillColor,class:"material-design-icon__svg",width:n.size,height:n.size,viewBox:"0 0 24 24"},[c("path",na,[n.title?(f(),A("title",pa,p(n.title),1)):z("",!0)])],8,ua))],16,da)}const va=B(sa,[["render",ca]]),_a={class:"ldap-wizard__server"},ga={class:"ldap-wizard__server__line"},fa={class:"ldap-wizard__server__line"},ma={class:"ldap-wizard__server__host__port"},ha={class:"ldap-wizard__server__line"},ba={class:"ldap-wizard__server__line"},ya={class:"ldap-wizard__server__line"},wa=O({__name:"ServerTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId)),v=D(!1),g=D(!1),r=D(!1),l=D(i.value.ldapAgentName),w=D(i.value.ldapAgentPassword),x=L(()=>i.value.ldapAgentName!==l.value||i.value.ldapAgentPassword!==w.value);function P(){i.value.ldapAgentName=l.value,i.value.ldapAgentPassword=w.value}async function U(){try{v.value=!0;const{changes:y}=await F("guessPortAndTLS",s.configId);t.value[s.configId].ldapPort=y.ldap_port??""}finally{v.value=!1}}async function C(){try{r.value=!0;const{changes:y}=await F("guessBaseDN",s.configId);i.value.ldapBase=y.ldap_base??""}finally{r.value=!1}}async function V(){try{g.value=!0;const{changes:y}=await F("countInBaseDN",s.configId),d=y.ldap_test_base;d<1?Q(a("user_ldap","No object found in the given Base DN. Please revise.")):d>1e3?Q(a("user_ldap","More than 1,000 directory entries available.")):Q(re("user_ldap","{ldapTestBase} entry available within the provided Base DN","{ldapTestBase} entries available within the provided Base DN",d,{ldapTestBase:d}))}finally{g.value=!1}}return(y,d)=>(f(),A("fieldset",_a,[c("div",ga,[o(e(N),{"model-value":i.value.ldapConfigurationActive==="1",type:"switch","aria-label":e(a)("user_ldap","When unchecked, this configuration will be skipped."),"onUpdate:modelValue":d[0]||(d[0]=_=>i.value.ldapConfigurationActive=_?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Configuration Active")),1)]),_:1},8,["model-value","aria-label"]),o(e(I),{title:e(a)("user_ldap","Copy current configuration into new directory binding"),onClick:d[1]||(d[1]=_=>e(n).copyConfig(u.configId))},{icon:m(()=>[o(le,{size:20})]),default:m(()=>[b(" "+p(e(a)("user_ldap","Copy configuration")),1)]),_:1},8,["title"]),o(e(I),{variant:"error",onClick:d[2]||(d[2]=_=>e(n).removeConfig(u.configId))},{icon:m(()=>[o(va,{size:20})]),default:m(()=>[b(" "+p(e(a)("user_ldap","Delete configuration")),1)]),_:1})]),c("div",fa,[o(e(h),{"model-value":i.value.ldapHost,"helper-text":e(a)("user_ldap","You can omit the protocol, unless you require SSL. If so, start with ldaps://"),label:e(a)("user_ldap","Host"),placeholder:e(a)("user_ldap","ldaps://localhost"),autocomplete:"off",onChange:d[3]||(d[3]=_=>i.value.ldapHost=_.target.value)},null,8,["model-value","helper-text","label","placeholder"]),c("div",ma,[o(e(h),{"model-value":i.value.ldapPort,label:e(a)("user_ldap","Port"),placeholder:e(a)("user_ldap","389"),type:"number",autocomplete:"off",onChange:d[4]||(d[4]=_=>i.value.ldapPort=_.target.value)},null,8,["model-value","label","placeholder"]),o(e(I),{disabled:v.value,onClick:U},{default:m(()=>[b(p(e(a)("user_ldap","Detect Port")),1)]),_:1},8,["disabled"])])]),c("div",ha,[o(e(h),{modelValue:l.value,"onUpdate:modelValue":d[5]||(d[5]=_=>l.value=_),"helper-text":e(a)("user_ldap","The DN of the client user with which the bind shall be done. For anonymous access, leave DN and Password empty."),label:e(a)("user_ldap","User DN"),placeholder:e(a)("user_ldap","uid=agent,dc=example,dc=com"),autocomplete:"off"},null,8,["modelValue","helper-text","label","placeholder"])]),c("div",ba,[o(e(h),{modelValue:w.value,"onUpdate:modelValue":d[6]||(d[6]=_=>w.value=_),type:"password","helper-text":e(a)("user_ldap","For anonymous access, leave DN and Password empty."),label:e(a)("user_ldap","Password"),autocomplete:"off"},null,8,["modelValue","helper-text","label"]),o(e(I),{disabled:!x.value,onClick:P},{default:m(()=>[b(p(e(a)("user_ldap","Save Credentials")),1)]),_:1},8,["disabled"])]),c("div",ya,[o(e(T),{label:e(a)("user_ldap","Base DN"),"model-value":i.value.ldapBase,placeholder:e(a)("user_ldap","One Base DN per line"),"helper-text":e(a)("user_ldap","You can specify Base DN for users and groups in the Advanced tab"),onChange:d[7]||(d[7]=_=>i.value.ldapBase=_.target.value)},null,8,["label","model-value","placeholder","helper-text"]),o(e(I),{disabled:r.value,onClick:C},{default:m(()=>[b(p(e(a)("user_ldap","Detect Base DN")),1)]),_:1},8,["disabled"]),o(e(I),{disabled:g.value||i.value.ldapBase==="",onClick:V},{default:m(()=>[b(p(e(a)("user_ldap","Test Base DN")),1)]),_:1},8,["disabled"])])]))}}),Aa=B(wa,[["__scopeId","data-v-98abaf0d"]]),Da={class:"ldap-wizard__users"},Ua={class:"ldap-wizard__users__line ldap-wizard__users__user-filter-object-class"},Ca={class:"ldap-wizard__users__line ldap-wizard__users__user-filter-groups"},Pa={class:"ldap-wizard__users__line ldap-wizard__users__user-filter"},xa={key:0},La={key:1},Fa={class:"ldap-wizard__users__line ldap-wizard__users__user-count-check"},Ia={key:1},ka=O({__name:"UsersTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId,{ldapUserFilterObjectclass:C,ldapUserFilterGroups:C})),v=D(void 0),g=D(!1),r=q().theming.name,l=D([]),w=D([]),x=L({get(){return i.value.ldapUserFilterObjectclass?.split(";").filter(d=>d!=="")??[]},set(d){i.value.ldapUserFilterObjectclass=d.join(";")}}),P=L({get(){return i.value.ldapUserFilterGroups.split(";").filter(d=>d!=="")},set(d){i.value.ldapUserFilterGroups=d.join(";")}});async function U(){const d=await F("determineUserObjectClasses",s.configId);l.value=d.options?.ldap_userfilter_objectclass??[],t.value[s.configId].ldapUserFilterObjectclass=d.changes?.ldap_userfilter_objectclass?.join(";")??"";const _=await F("determineGroupsForUsers",s.configId);w.value=_.options?.ldap_userfilter_groups??[],t.value[s.configId].ldapUserFilterGroups=_.changes?.ldap_userfilter_groups?.join(";")??""}U();async function C(){if(i.value.ldapUserFilterMode==="0"){const d=await F("getUserListFilter",s.configId);t.value[s.configId].ldapUserFilter=d.changes?.ldap_userlist_filter??"";const _=await F("getUserLoginFilter",s.configId);t.value[s.configId].ldapLoginFilter=_.changes?.ldap_login_filter??""}}async function V(){try{g.value=!0;const d=await F("countUsers",s.configId);v.value=d.changes.ldap_user_count}finally{g.value=!1}}async function y(d){d?i.value.ldapUserFilterMode="1":i.value.ldapUserFilterMode=await Z()?"0":"1"}return(d,_)=>(f(),A("fieldset",Da,[b(p(e(a)("user_ldap","Listing and searching for users is constrained by these criteria:"))+" ",1),c("div",Ua,[o(e(R),{modelValue:x.value,"onUpdate:modelValue":_[0]||(_[0]=G=>x.value=G),disabled:i.value.ldapUserFilterMode==="1",class:"ldap-wizard__users__user-filter-object-class__select",options:l.value,"input-label":e(a)("user_ldap","Only these object classes:"),multiple:!0},null,8,["modelValue","disabled","options","input-label"]),b(" "+p(e(a)("user_ldap","The most common object classes for users are organizationalPerson, person, user, and inetOrgPerson. If you are not sure which object class to select, please consult your directory admin.")),1)]),c("div",Ca,[o(e(R),{modelValue:P.value,"onUpdate:modelValue":_[1]||(_[1]=G=>P.value=G),class:"ldap-wizard__users__user-filter-groups__select",disabled:i.value.ldapUserFilterMode==="1",options:w.value,"input-label":e(a)("user_ldap","Only from these groups:"),multiple:!0},null,8,["modelValue","disabled","options","input-label"])]),c("div",Pa,[o(e(N),{"model-value":i.value.ldapUserFilterMode==="1","onUpdate:modelValue":y},{default:m(()=>[b(p(e(a)("user_ldap","Edit LDAP Query")),1)]),_:1},8,["model-value"]),i.value.ldapUserFilterMode==="1"?(f(),A("div",xa,[o(e(T),{modelValue:i.value.ldapUserFilter,"onUpdate:modelValue":_[2]||(_[2]=G=>i.value.ldapUserFilter=G),placeholder:e(a)("user_ldap","Edit LDAP Query"),"helper-text":e(a)("user_ldap","The filter specifies which LDAP users shall have access to the {instanceName} instance.",{instanceName:e(r)})},null,8,["modelValue","placeholder","helper-text"])])):(f(),A("div",La,[c("label",null,p(e(a)("user_ldap","LDAP Filter:")),1),c("code",null,p(i.value.ldapUserFilter),1)]))]),c("div",Fa,[o(e(I),{disabled:g.value,onClick:V},{default:m(()=>[b(p(e(a)("user_ldap","Verify settings and count users")),1)]),_:1},8,["disabled"]),g.value?(f(),k(e(Y),{key:0,size:16})):z("",!0),v.value!==void 0&&!g.value?(f(),A("span",Ia,p(e(a)("user_ldap","User count: {usersCount}",{usersCount:v.value},{escape:!1})),1)):z("",!0)])]))}}),za=B(ka,[["__scopeId","data-v-b5a806d3"]]),Na={class:"ldap-wizard__controls"},Va={class:"ldap-wizard__controls__state_message"},Ga=O({__name:"WizardControls",props:{configId:{}},setup(u){const s=u,n=H(),{updatingConfig:t}=$(n),i=D(!1),v=D(null),g=L(()=>v.value?.success);ie(t,()=>{v.value=null});async function r(){try{i.value=!0,v.value=await Ae(s.configId)}finally{i.value=!1}}return(l,w)=>(f(),A("div",Na,[o(e(I),{variant:"primary",disabled:i.value,onClick:r},{default:m(()=>[b(p(e(a)("user_ldap","Test Configuration")),1)]),_:1},8,["disabled"]),o(e(I),{variant:"tertiary",href:"https://docs.nextcloud.com/server/stable/go.php?to=admin-ldap",target:"_blank",rel:"noreferrer noopener"},{icon:m(()=>[o(le,{size:20})]),default:m(()=>[c("span",null,p(e(a)("user_ldap","Help")),1)]),_:1}),v.value!==null&&!i.value?(f(),A(W,{key:0},[c("span",{class:oe(["ldap-wizard__controls__state_indicator",{"ldap-wizard__controls__state_indicator--valid":g.value}])},null,2),c("span",Va,p(v.value.message),1)],64)):z("",!0),i.value?(f(),k(e(Y),{key:1,size:16})):z("",!0)]))}}),Ba=B(Ga,[["__scopeId","data-v-4518d86f"]]),Oa={class:"ldap-wizard"},Ta={class:"ldap-wizard__config-selection"},Ma={key:0,class:"ldap-wizard__tab-container"},Sa={class:"ldap-wizard__tab-selection-container"},ja={class:"ldap-wizard__tab-selection"},Ha={class:"ldap-wizard__clear-mapping"},Ea={class:"ldap-wizard__clear-mapping__buttons"},Ra=O({__name:"Settings",setup(u){const s=X("user_ldap","ldapModuleInstalled"),n={server:a("user_ldap","Server"),users:a("user_ldap","Users"),login:a("user_ldap","Login Attributes"),groups:a("user_ldap","Groups"),advanced:a("user_ldap","Advanced"),expert:a("user_ldap","Expert")},t=H(),{ldapConfigs:i,selectedConfigId:v,selectedConfig:g}=$(t),r=D("server"),l=D(!1),w=L(()=>g.value.ldapHost!==""&&g.value.ldapPort!==""&&g.value.ldapBase!==""&&g.value.ldapAgentName!==""&&g.value.ldapAgentPassword!=="");async function x(P){try{l.value=!0,await De(P)}finally{l.value=!1}}return(P,U)=>(f(),A("form",Oa,[c("h2",null,p(e(a)("user_ldap","LDAP/AD integration")),1),e(s)?z("",!0):(f(),k(e(ve),{key:0,type:"warning",text:e(a)("user_ldap","The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it.")},null,8,["text"])),e(s)?(f(),A(W,{key:1},[c("div",Ta,[e(v)!==void 0?(f(),k(e(R),{key:0,modelValue:e(v),"onUpdate:modelValue":U[0]||(U[0]=C=>se(v)?v.value=C:null),options:Object.keys(e(i)),"input-label":e(a)("user_ldap","Select LDAP Config")},{option:m(({label:C})=>[b(p(`${C}: ${e(i)[C].ldapHost}`),1)]),"selected-option":m(({label:C})=>[b(p(`${C}: ${e(i)[C].ldapHost}`),1)]),_:1},8,["modelValue","options","input-label"])):z("",!0),o(e(I),{label:e(a)("user_ldap","Create New Config"),class:"ldap-wizard__config-selection__create-button",onClick:e(t).create},{icon:m(()=>[o(_e,{size:20})]),default:m(()=>[b(" "+p(e(a)("user_ldap","Create configuration")),1)]),_:1},8,["label","onClick"])]),e(v)!==void 0?(f(),A("div",Ma,[c("div",Sa,[c("div",ja,[(f(),A(W,null,de(n,(C,V)=>o(e(N),{key:V,modelValue:r.value,"onUpdate:modelValue":U[1]||(U[1]=y=>r.value=y),"button-variant":!0,value:V,type:"radio",disabled:V!=="server"&&!w.value,"button-variant-grouped":"horizontal"},{default:m(()=>[b(p(C),1)]),_:2},1032,["modelValue","value","disabled"])),64))])]),r.value==="server"?(f(),k(Aa,{key:0,"config-id":e(v)},null,8,["config-id"])):r.value==="users"?(f(),k(za,{key:1,"config-id":e(v)},null,8,["config-id"])):r.value==="login"?(f(),k(ea,{key:2,"config-id":e(v)},null,8,["config-id"])):r.value==="groups"?(f(),k(Qe,{key:3,"config-id":e(v)},null,8,["config-id"])):r.value==="expert"?(f(),k(Te,{key:4,"config-id":e(v)},null,8,["config-id"])):r.value==="advanced"?(f(),k(ke,{key:5,"config-id":e(v)},null,8,["config-id"])):z("",!0),o(Ba,{class:"ldap-wizard__controls","config-id":e(v)},null,8,["config-id"])])):z("",!0),c("div",Ha,[c("strong",null,p(e(a)("user_ldap","Username-LDAP User Mapping")),1),b(" "+p(e(a)("user_ldap","Usernames are used to store and assign metadata. In order to precisely identify and recognize users, each LDAP user will have an internal username. This requires a mapping from username to LDAP user. The created username is mapped to the UUID of the LDAP user. Additionally the DN is cached as well to reduce LDAP interaction, but it is not used for identification. If the DN changes, the changes will be found. The internal username is used all over. Clearing the mappings will have leftovers everywhere. Clearing the mappings is not configuration sensitive, it affects all LDAP configurations! Never clear the mappings in a production environment, only in a testing or experimental stage."))+" ",1),c("div",Ea,[o(e(I),{variant:"error",disabled:l.value,onClick:U[2]||(U[2]=C=>x("user"))},{default:m(()=>[b(p(e(a)("user_ldap","Clear Username-LDAP User Mapping")),1)]),_:1},8,["disabled"]),o(e(I),{variant:"error",disabled:l.value,onClick:U[3]||(U[3]=C=>x("group"))},{default:m(()=>[b(p(e(a)("user_ldap","Clear Groupname-LDAP Group Mapping")),1)]),_:1},8,["disabled"])])])],64)):z("",!0)]))}}),$a=B(Ra,[["__scopeId","data-v-18500db6"]]),qa=O({__name:"LDAPSettingsApp",setup(u){return(s,n)=>(f(),k($a))}}),Qa=fe(),K=ue(qa);K.use(Qa),K.mount("#content-ldap-settings"); +import{e as M,g as S,a1 as te,f as a,k as D,l as X,n as L,m as O,p as A,o as f,i as c,b as o,t as p,u as e,w as m,d as b,a as N,_ as B,c as k,q as z,s as Y,V as ee,a5 as re,J as ie,F as W,x as oe,D as se,v as de,h as ue}from"./NcSettingsSection-BfK7eHNT-Cvwtv3xC.chunk.mjs";import{g as ne,s as E,j as ae,k as pe,a as q,_ as h,q as T,t as R,N as I,u as ce,v as Q,w as ve,P as _e}from"./Plus-DJQMY9d_.chunk.mjs";import{d as ge,s as $,c as fe}from"./pinia-BCiW4L1z.chunk.mjs";const j=ne().setApp("LDAP").detectUser().build();async function me(){const u=await M.post(S("apps/user_ldap/api/v1/config"));return j.debug("Created configuration",{configId:u.data.ocs.data.configID}),u.data.ocs.data.configID}async function he(u){const s=new FormData;s.set("copyConfig",u);const n=await M.post(S("apps/user_ldap/api/v1/config/{configId}/copy",{configId:u}),s);return j.debug("Created configuration",{configId:n.data.ocs.data.configID}),n.data.ocs.data.configID}async function be(u){const s=await M.get(S("apps/user_ldap/api/v1/config/{configId}",{configId:u}));return j.debug("Fetched configuration",{configId:u,config:s.data.ocs.data}),s.data.ocs.data}async function ye(u,s){const n=await M.put(S("apps/user_ldap/api/v1/config/{configId}",{configId:u}),{configData:s});return j.debug("Updated configuration",{configId:u,config:s}),n.data.ocs.data}async function we(u){try{if(!await J(a("user_ldap","Confirm action"),a("user_ldap","Are you sure you want to permanently delete this LDAP configuration? This cannot be undone.")))return!1;await M.delete(S("apps/user_ldap/api/v1/config/{configId}",{configId:u})),j.debug("Deleted configuration",{configId:u})}catch(s){const n=s.response;E(n?.data.ocs.meta.message||a("user_ldap","Failed to delete config"))}return!0}async function Ae(u){const s=new FormData,n=await M.post(S("apps/user_ldap/api/v1/config/{configId}/test",{configId:u}));return j.debug(`Configuration is ${n.data.ocs.data.success?"valide":"invalide"}`,{configId:u,params:s,response:n}),n.data.ocs.data}async function De(u){if(!await J(a("user_ldap","Confirm action"),a("user_ldap","Are you sure you want to permanently clear the LDAP mapping? This cannot be undone.")))return!1;try{const s=await M.post(S("apps/user_ldap/api/v1/wizard/clearMappings"),{subject:u});return j.debug("Cleared mapping",{subject:u,response:s}),ae(a("user_ldap","Mapping cleared")),!0}catch(s){const n=s.response;E(n?.data.ocs.meta.message||a("user_ldap","Failed to clear mapping"))}}async function F(u,s,n={}){const t=new FormData;Object.entries(n).forEach(([i,v])=>{t.set(i,v)});try{const i=await M.post(S("apps/user_ldap/api/v1/wizard/{configId}/{action}",{configId:s,action:u}),t);return j.debug(`Called wizard action: ${u}`,{configId:s,params:t,response:i}),i.data.ocs.data}catch(i){if(te(i)&&i.response?.data.ocs.meta.status==="failure"){const v=i.response.data.ocs.meta.message??a("user_ldap","An error occurred");E(v)}throw i}}async function Z(){return await J(a("user_ldap","Mode switch"),a("user_ldap","Switching the mode will enable automatic LDAP queries. Depending on your LDAP size they may take a while. Do you still want to switch the mode?"))}async function J(u,s){let n=!1;return await pe(u).setText(s).setSeverity("warning").addButton({label:a("user_ldap","Cancel"),callback(){}}).addButton({label:a("user_ldap","Confirm"),variant:"error",callback(){n=!0}}).build().show(),n}const H=ge("ldap-configs",()=>{const u=D(X("user_ldap","ldapConfigs")),s=D(Object.keys(u.value)[0]),n=L(()=>s.value===void 0?void 0:u.value[s.value]),t=D(0);function i(l,w={}){if(u.value[l]===void 0)throw new Error(`Config with id ${l} does not exist`);return new Proxy(u.value[l],{get(x,P){return x[P]},set(x,P,U){return x[P]=U,(async()=>(t.value++,await ye(l,{[P]:U}),t.value--,w[P]!==void 0&&w[P](x[P])))(),!0}})}async function v(){const l=await me();return u.value[l]=await be(l),s.value=l,l}async function g(l){if(u.value[l]===void 0)throw new Error(`Config with id ${l} does not exist`);const w=await he(l);return u.value[w]={...u.value[l]},s.value=w,w}async function r(l){await we(l)===!0&&delete u.value[l],s.value=Object.keys(u.value)[0]??await v()}return{ldapConfigs:u,selectedConfigId:s,selectedConfig:n,updatingConfig:t,getConfigProxy:i,create:v,copyConfig:g,removeConfig:r}}),Ue={class:"ldap-wizard__advanced"},Ce={open:"",name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},Pe={name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},xe={class:"tablecell"},Le={name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},Fe={name:"ldap-wizard__advanced__section",class:"ldap-wizard__advanced__section"},Ie=O({__name:"AdvancedTab",props:{configId:{}},setup(u){const s=u,n=H(),t=L(()=>n.getConfigProxy(s.configId)),i=q().theming.name,v={uniqueMember:"uniqueMember",memberUid:"memberUid",member:"member (AD)",gidNumber:"gidNumber",zimbraMailForwardingAddress:"zimbraMailForwardingAddress"};return(g,r)=>(f(),A("fieldset",Ue,[c("details",Ce,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","Connection Settings")),1)]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Backup (Replica) Host"),"model-value":t.value.ldapBackupHost,"helper-text":e(a)("user_ldap","Give an optional backup host. It must be a replica of the main LDAP/AD server."),onChange:r[0]||(r[0]=l=>t.value.ldapBackupHost=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{type:"number","model-value":t.value.ldapBackupPort,label:e(a)("user_ldap","Backup (Replica) Port"),onChange:r[1]||(r[1]=l=>t.value.ldapBackupPort=l.target.value)},null,8,["model-value","label"]),o(e(N),{"model-value":t.value.ldapOverrideMainServer==="1",type:"switch","aria-label":e(a)("user_ldap","Only connect to the replica server."),"onUpdate:modelValue":r[2]||(r[2]=l=>t.value.ldapOverrideMainServer=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Disable Main Server")),1)]),_:1},8,["model-value","aria-label"]),o(e(N),{"model-value":t.value.turnOffCertCheck==="1","aria-label":e(a)("user_ldap","Not recommended, use it for testing only! If connection only works with this option, import the LDAP server's SSL certificate in your {instanceName} server.",{instanceName:e(i)}),"onUpdate:modelValue":r[3]||(r[3]=l=>t.value.turnOffCertCheck=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Turn off SSL certificate validation.")),1)]),_:1},8,["model-value","aria-label"]),o(e(h),{type:"number",label:e(a)("user_ldap","Cache Time-To-Live"),"model-value":t.value.ldapCacheTTL,"helper-text":e(a)("user_ldap","in seconds. A change empties the cache."),onChange:r[4]||(r[4]=l=>t.value.ldapCacheTTL=l.target.value)},null,8,["label","model-value","helper-text"])]),c("details",Pe,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","Directory Settings")),1)]),o(e(h),{autocomplete:"off","model-value":t.value.ldapUserDisplayName,label:e(a)("user_ldap","User Display Name Field"),"helper-text":e(a)("user_ldap","The LDAP attribute to use to generate the user's display name."),onChange:r[5]||(r[5]=l=>t.value.ldapUserDisplayName=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapUserDisplayName2,label:e(a)("user_ldap","2nd User Display Name Field"),"helper-text":e(a)("user_ldap","Optional. An LDAP attribute to be added to the display name in brackets. Results in e.g. ยปJohn Doe (john.doe@example.org)ยซ."),onChange:r[6]||(r[6]=l=>t.value.ldapUserDisplayName2=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(T),{"model-value":t.value.ldapBaseUsers,placeholder:e(a)("user_ldap","One User Base DN per line"),label:e(a)("user_ldap","Base User Tree"),onChange:r[7]||(r[7]=l=>t.value.ldapBaseUsers=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(T),{"model-value":t.value.ldapAttributesForUserSearch,placeholder:e(a)("user_ldap","Optional; one attribute per line"),label:e(a)("user_ldap","User Search Attributes"),onChange:r[8]||(r[8]=l=>t.value.ldapAttributesForUserSearch=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(N),{"model-value":t.value.markRemnantsAsDisabled==="1","aria-label":e(a)("user_ldap","When switched on, users imported from LDAP which are then missing will be disabled"),"onUpdate:modelValue":r[9]||(r[9]=l=>t.value.markRemnantsAsDisabled=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Disable users missing from LDAP")),1)]),_:1},8,["model-value","aria-label"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapGroupDisplayName,label:e(a)("user_ldap","Group Display Name Field"),title:e(a)("user_ldap","The LDAP attribute to use to generate the groups's display name."),onChange:r[10]||(r[10]=l=>t.value.ldapGroupDisplayName=l.target.value)},null,8,["model-value","label","title"]),o(e(T),{"model-value":t.value.ldapBaseGroups,placeholder:e(a)("user_ldap","One Group Base DN per line"),label:e(a)("user_ldap","Base Group Tree"),onChange:r[11]||(r[11]=l=>t.value.ldapBaseGroups=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(T),{"model-value":t.value.ldapAttributesForGroupSearch,placeholder:e(a)("user_ldap","Optional; one attribute per line"),label:e(a)("user_ldap","Group Search Attributes"),onChange:r[12]||(r[12]=l=>t.value.ldapAttributesForGroupSearch=l.target.value)},null,8,["model-value","placeholder","label"]),o(e(R),{modelValue:t.value.ldapGroupMemberAssocAttr,"onUpdate:modelValue":r[13]||(r[13]=l=>t.value.ldapGroupMemberAssocAttr=l),options:Object.keys(v),"input-label":e(a)("user_ldap","Group-Member association")},{option:m(({label:l})=>[b(p(v[l]),1)]),"selected-option":m(({label:l})=>[b(p(v[l]),1)]),_:1},8,["modelValue","options","input-label"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Dynamic Group Member URL"),"model-value":t.value.ldapDynamicGroupMemberURL,"helper-text":e(a)("user_ldap","The LDAP attribute that on group objects contains an LDAP search URL that determines what objects belong to the group. (An empty setting disables dynamic group membership functionality.)"),onChange:r[14]||(r[14]=l=>t.value.ldapDynamicGroupMemberURL=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(N),{"model-value":t.value.ldapNestedGroups==="1","aria-label":e(a)("user_ldap","When switched on, groups that contain groups are supported. (Only works if the group member attribute contains DNs.)"),"onUpdate:modelValue":r[15]||(r[15]=l=>t.value.ldapNestedGroups=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Nested Groups")),1)]),_:1},8,["model-value","aria-label"]),o(e(h),{type:"number",label:e(a)("user_ldap","Paging chunksize"),"model-value":t.value.ldapPagingSize,"helper-text":e(a)("user_ldap","Chunksize used for paged LDAP searches that may return bulky results like user or group enumeration. (Setting it 0 disables paged LDAP searches in those situations.)"),onChange:r[16]||(r[16]=l=>t.value.ldapPagingSize=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(N),{"model-value":t.value.turnOnPasswordChange==="1","aria-label":e(a)("user_ldap","Allow LDAP users to change their password and allow Super Administrators and Group Administrators to change the password of their LDAP users. Only works when access control policies are configured accordingly on the LDAP server. As passwords are sent in plaintext to the LDAP server, transport encryption must be used and password hashing should be configured on the LDAP server."),"onUpdate:modelValue":r[17]||(r[17]=l=>t.value.turnOnPasswordChange=l?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Enable LDAP password changes per user")),1)]),_:1},8,["model-value","aria-label"]),c("span",xe,p(e(a)("user_ldap","(New password is sent as plain text to LDAP)")),1),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Default password policy DN"),"model-value":t.value.ldapDefaultPPolicyDN,"helper-text":e(a)("user_ldap","The DN of a default password policy that will be used for password expiry handling. Works only when LDAP password changes per user are enabled and is only supported by OpenLDAP. Leave empty to disable password expiry handling."),onChange:r[18]||(r[18]=l=>t.value.ldapDefaultPPolicyDN=l.target.value)},null,8,["label","model-value","helper-text"])]),c("details",Le,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","Special Attributes")),1)]),o(e(h),{autocomplete:"off","model-value":t.value.ldapQuotaAttribute,label:e(a)("user_ldap","Quota Field"),"helper-text":e(a)("user_ldap","Leave empty for user's default quota. Otherwise, specify an LDAP/AD attribute."),onChange:r[19]||(r[19]=l=>t.value.ldapQuotaAttribute=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapQuotaDefault,label:e(a)("user_ldap","Quota Default"),"helper-text":e(a)("user_ldap","Override default quota for LDAP users who do not have a quota set in the Quota Field."),onChange:r[20]||(r[20]=l=>t.value.ldapQuotaDefault=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off","model-value":t.value.ldapEmailAttribute,label:e(a)("user_ldap","Email Field"),"helper-text":e(a)("user_ldap","Set the user's email from their LDAP attribute. Leave it empty for default behaviour."),onChange:r[21]||(r[21]=l=>t.value.ldapEmailAttribute=l.target.value)},null,8,["model-value","label","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","User Home Folder Naming Rule"),"model-value":t.value.homeFolderNamingRule,"helper-text":e(a)("user_ldap","Leave empty for username (default). Otherwise, specify an LDAP/AD attribute."),onChange:r[22]||(r[22]=l=>t.value.homeFolderNamingRule=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","`$home` Placeholder Field"),"model-value":t.value.ldapExtStorageHomeAttribute,"helper-text":e(a)("user_ldap","$home in an external storage configuration will be replaced with the value of the specified attribute"),onChange:r[23]||(r[23]=l=>t.value.ldapExtStorageHomeAttribute=l.target.value)},null,8,["label","model-value","helper-text"])]),c("details",Fe,[c("summary",null,[c("h3",null,p(e(a)("user_ldap","User Profile Attributes")),1)]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Phone Field"),"model-value":t.value.ldapAttributePhone,"helper-text":e(a)("user_ldap","User profile Phone will be set from the specified attribute"),onChange:r[24]||(r[24]=l=>t.value.ldapAttributePhone=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Website Field"),"model-value":t.value.ldapAttributeWebsite,"helper-text":e(a)("user_ldap","User profile Website will be set from the specified attribute"),onChange:r[25]||(r[25]=l=>t.value.ldapAttributeWebsite=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Address Field"),"model-value":t.value.ldapAttributeAddress,"helper-text":e(a)("user_ldap","User profile Address will be set from the specified attribute"),onChange:r[26]||(r[26]=l=>t.value.ldapAttributeAddress=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Twitter Field"),"model-value":t.value.ldapAttributeTwitter,"helper-text":e(a)("user_ldap","User profile Twitter will be set from the specified attribute"),onChange:r[27]||(r[27]=l=>t.value.ldapAttributeTwitter=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Fediverse Field"),"model-value":t.value.ldapAttributeFediverse,"helper-text":e(a)("user_ldap","User profile Fediverse will be set from the specified attribute"),onChange:r[28]||(r[28]=l=>t.value.ldapAttributeFediverse=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Organisation Field"),"model-value":t.value.ldapAttributeOrganisation,"helper-text":e(a)("user_ldap","User profile Organisation will be set from the specified attribute"),onChange:r[29]||(r[29]=l=>t.value.ldapAttributeOrganisation=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Role Field"),"model-value":t.value.ldapAttributeRole,"helper-text":e(a)("user_ldap","User profile Role will be set from the specified attribute"),onChange:r[30]||(r[30]=l=>t.value.ldapAttributeRole=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Headline Field"),"model-value":t.value.ldapAttributeHeadline,"helper-text":e(a)("user_ldap","User profile Headline will be set from the specified attribute"),onChange:r[31]||(r[31]=l=>t.value.ldapAttributeHeadline=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Biography Field"),"model-value":t.value.ldapAttributeBiography,"helper-text":e(a)("user_ldap","User profile Biography will be set from the specified attribute"),onChange:r[32]||(r[32]=l=>t.value.ldapAttributeBiography=l.target.value)},null,8,["label","model-value","helper-text"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","Birthdate Field"),"model-value":t.value.ldapAttributeBirthDate,"helper-text":e(a)("user_ldap","User profile Date of birth will be set from the specified attribute"),onChange:r[33]||(r[33]=l=>t.value.ldapAttributeBirthDate=l.target.value)},null,8,["label","model-value","helper-text"])])]))}}),ke=B(Ie,[["__scopeId","data-v-67c3dc3f"]]),ze={class:"ldap-wizard__expert"},Ne={class:"ldap-wizard__expert__line"},Ve={id:"ldap_expert_username_attr"},Ge={class:"ldap-wizard__expert__line"},Be={id:"ldap_expert_uuid_user_attr"},Oe=O({__name:"ExpertTab",props:{configId:{}},setup(u){const s=u,n=H(),t=L(()=>n.getConfigProxy(s.configId));return(i,v)=>(f(),A("fieldset",ze,[c("div",Ne,[c("strong",null,p(e(a)("user_ldap","Internal Username")),1),c("p",Ve,p(e(a)("user_ldap","By default the internal username will be created from the UUID attribute. It makes sure that the username is unique and characters do not need to be converted. The internal username has the restriction that only these characters are allowed: [a-zA-Z0-9_.@-]. Other characters are replaced with their ASCII correspondence or simply omitted. On collisions a number will be added/increased. The internal username is used to identify a user internally. It is also the default name for the user home folder. It is also a part of remote URLs, for instance for all DAV services. With this setting, the default behavior can be overridden. Changes will have effect only on newly mapped (added) LDAP users. Leave it empty for default behavior.")),1),o(e(h),{"aria-describedby":"ldap_expert_username_attr",autocomplete:"off",label:e(a)("user_ldap","Internal Username Attribute:"),"model-value":t.value.ldapExpertUsernameAttr,onChange:v[0]||(v[0]=g=>t.value.ldapExpertUsernameAttr=g.target.value)},null,8,["label","model-value"])]),c("div",Ge,[c("strong",null,p(e(a)("user_ldap","Override UUID detection")),1),c("p",Be,p(e(a)("user_ldap","By default, the UUID attribute is automatically detected. The UUID attribute is used to doubtlessly identify LDAP users and groups. Also, the internal username will be created based on the UUID, if not specified otherwise above. You can override the setting and pass an attribute of your choice. You must make sure that the attribute of your choice can be fetched for both users and groups and it is unique. Leave it empty for default behavior. Changes will have effect only on newly mapped (added) LDAP users and groups.")),1),o(e(h),{"aria-describedby":"ldap_expert_uuid_user_attr",autocomplete:"off",label:e(a)("user_ldap","UUID Attribute for Users"),"model-value":t.value.ldapExpertUUIDUserAttr,onChange:v[1]||(v[1]=g=>t.value.ldapExpertUUIDUserAttr=g.target.value)},null,8,["label","model-value"]),o(e(h),{autocomplete:"off",label:e(a)("user_ldap","UUID Attribute for Groups"),"model-value":t.value.ldapExpertUUIDGroupAttr,onChange:v[2]||(v[2]=g=>t.value.ldapExpertUUIDGroupAttr=g.target.value)},null,8,["label","model-value"])])]))}}),Te=B(Oe,[["__scopeId","data-v-17498cec"]]),Me={class:"ldap-wizard__groups"},Se={class:"ldap-wizard__groups__line ldap-wizard__groups__filter-selection"},je={class:"ldap-wizard__groups__line ldap-wizard__groups__groups-filter"},He={key:0},Ee={key:1},Re={class:"ldap-wizard__groups__line ldap-wizard__groups__groups-count-check"},$e={key:1},qe=O({__name:"GroupsTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId,{ldapGroupFilterObjectclass:C,ldapGroupFilterGroups:C})),v=q().theming.name,g=D(void 0),r=D([]),l=D([]),w=D(!1),x=L({get(){return i.value.ldapGroupFilterObjectclass.split(";").filter(d=>d!=="")},set(d){i.value.ldapGroupFilterObjectclass=d.join(";")}}),P=L({get(){return i.value.ldapGroupFilterGroups.split(";").filter(d=>d!=="")},set(d){i.value.ldapGroupFilterGroups=d.join(";")}});async function U(){const d=await F("determineGroupObjectClasses",s.configId);r.value=d.options?.ldap_groupfilter_objectclass??[];const _=await F("determineGroupsForGroups",s.configId);l.value=_.options?.ldap_groupfilter_groups??[]}U();async function C(){const d=await F("getGroupFilter",s.configId);t.value[s.configId].ldapGroupFilter=d.changes?.ldap_group_filter??""}async function V(){try{w.value=!0;const d=await F("countGroups",s.configId);g.value=d.changes.ldap_group_count}finally{w.value=!1}}async function y(d){d?i.value.ldapGroupFilterMode="1":i.value.ldapGroupFilterMode=await Z()?"0":"1"}return(d,_)=>(f(),A("fieldset",Me,[c("legend",null,p(e(a)("user_ldap","Groups meeting these criteria are available in {instanceName}:",{instanceName:e(v)})),1),c("div",Se,[o(e(R),{modelValue:x.value,"onUpdate:modelValue":_[0]||(_[0]=G=>x.value=G),class:"ldap-wizard__groups__group-filter-groups__select",options:r.value,disabled:i.value.ldapGroupFilterMode==="1","input-label":e(a)("user_ldap","Only these object classes:"),multiple:!0},null,8,["modelValue","options","disabled","input-label"]),o(e(R),{modelValue:P.value,"onUpdate:modelValue":_[1]||(_[1]=G=>P.value=G),class:"ldap-wizard__groups__group-filter-groups__select",options:l.value,disabled:i.value.ldapGroupFilterMode==="1","input-label":e(a)("user_ldap","Only from these groups:"),multiple:!0},null,8,["modelValue","options","disabled","input-label"])]),c("div",je,[o(e(N),{"model-value":i.value.ldapGroupFilterMode==="1","onUpdate:modelValue":y},{default:m(()=>[b(p(e(a)("user_ldap","Edit LDAP Query")),1)]),_:1},8,["model-value"]),i.value.ldapGroupFilterMode==="1"?(f(),A("div",He,[o(e(T),{modelValue:i.value.ldapGroupFilter,"onUpdate:modelValue":_[2]||(_[2]=G=>i.value.ldapGroupFilter=G),placeholder:e(a)("user_ldap","Edit LDAP Query"),"helper-text":e(a)("user_ldap","The filter specifies which LDAP groups shall have access to the {instanceName} instance.",{instanceName:e(v)})},null,8,["modelValue","placeholder","helper-text"])])):(f(),A("div",Ee,[c("span",null,p(e(a)("user_ldap","LDAP Filter:")),1),c("code",null,p(i.value.ldapGroupFilter),1)]))]),c("div",Re,[o(e(I),{disabled:w.value,onClick:V},{default:m(()=>[b(p(e(a)("user_ldap","Verify settings and count the groups")),1)]),_:1},8,["disabled"]),w.value?(f(),k(e(Y),{key:0,size:20})):z("",!0),g.value!==void 0&&!w.value?(f(),A("span",$e,p(g.value),1)):z("",!0)])]))}}),Qe=B(qe,[["__scopeId","data-v-2fbcc471"]]),We={class:"ldap-wizard__login"},Ye={class:"ldap-wizard__login__line ldap-wizard__login__login-attributes"},Ze={class:"ldap-wizard__login__line ldap-wizard__login__user-login-filter"},Je={key:1},Ke={class:"ldap-wizard__login__line"},Xe=O({__name:"LoginTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId,{ldapLoginFilterAttributes:U,ldapLoginFilterUsername:U,ldapLoginFilterEmail:U})),v=q().theming.name,g=D(""),r=D([]),l=L({get(){return i.value.ldapLoginFilterAttributes.split(";").filter(y=>y!=="")},set(y){i.value.ldapLoginFilterAttributes=y.join(";")}}),w=L(()=>i.value.ldapLoginFilterMode==="1"),x=L(()=>r.value.filter(y=>!l.value.includes(y)));async function P(){const y=await F("determineAttributes",s.configId);r.value=y.options?.ldap_loginfilter_attributes??[]}P();async function U(){if(i.value.ldapLoginFilterMode==="0"){const y=await F("getUserLoginFilter",s.configId);t.value[s.configId].ldapLoginFilter=y.changes?.ldap_login_filter??""}}async function C(){try{const y=await F("testLoginName",s.configId,{loginName:g.value}),d=y.changes.ldap_test_loginname,_=y.changes.ldap_test_effective_filter;d<1?E(a("user_ldap","User not found. Please check your login attributes and username. Effective filter (to copy-and-paste for command-line validation): {filter}",{filter:_})):d===1?ae(a("user_ldap","User found and settings verified.")):d>1&&ce(a("user_ldap","Consider narrowing your search, as it encompassed many users, only the first one of whom will be able to log in."))}catch(y){switch(y??a("user_ldap","An unspecified error occurred. Please check log and settings.")){case"Bad search filter":E(a("user_ldap","The search filter is invalid, probably due to syntax issues like uneven number of opened and closed brackets. Please revise."));break;case"connection error":E(a("user_ldap","A connection error to LDAP/AD occurred. Please check host, port and credentials."));break;case"missing placeholder":E(a("user_ldap",'The "%uid" placeholder is missing. It will be replaced with the login name when querying LDAP/AD.'));break}}}async function V(y){y?i.value.ldapLoginFilterMode="1":i.value.ldapLoginFilterMode=await Z()?"0":"1"}return(y,d)=>(f(),A("fieldset",We,[c("legend",null,p(e(a)("user_ldap","When logging in, {instanceName} will find the user based on the following attributes:",{instanceName:e(v)})),1),o(e(N),{"model-value":i.value.ldapLoginFilterUsername==="1",description:e(a)("user_ldap","Allows login against the LDAP/AD username, which is either 'uid' or 'sAMAccountName' and will be detected."),"onUpdate:modelValue":d[0]||(d[0]=_=>i.value.ldapLoginFilterUsername=_?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","LDAP/AD Username:")),1)]),_:1},8,["model-value","description"]),o(e(N),{"model-value":i.value.ldapLoginFilterEmail==="1",description:e(a)("user_ldap","Allows login against an email attribute. 'mail' and 'mailPrimaryAddress' allowed."),"onUpdate:modelValue":d[1]||(d[1]=_=>i.value.ldapLoginFilterEmail=_?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","LDAP/AD Email Address:")),1)]),_:1},8,["model-value","description"]),c("div",Ye,[o(e(R),{modelValue:l.value,"onUpdate:modelValue":d[2]||(d[2]=_=>l.value=_),"keep-open":"",disabled:w.value,options:x.value,"input-label":e(a)("user_ldap","Other Attributes:"),multiple:!0},null,8,["modelValue","disabled","options","input-label"])]),c("div",Ze,[o(e(N),{"model-value":w.value,"onUpdate:modelValue":V},{default:m(()=>[b(p(e(a)("user_ldap","Edit LDAP Query")),1)]),_:1},8,["model-value"]),w.value?(f(),k(e(T),{key:0,"model-value":i.value.ldapLoginFilter,placeholder:e(a)("user_ldap","Edit LDAP Query"),"helper-text":e(a)("user_ldap","Defines the filter to apply, when login is attempted. `%%uid` replaces the username in the login action. Example: `uid=%%uid`"),onChange:d[3]||(d[3]=_=>i.value.ldapLoginFilter=_.target.value)},null,8,["model-value","placeholder","helper-text"])):(f(),A("div",Je,[c("span",null,p(e(a)("user_ldap","LDAP Filter:")),1),c("code",null,p(i.value.ldapLoginFilter),1)]))]),c("div",Ke,[o(e(h),{modelValue:g.value,"onUpdate:modelValue":d[4]||(d[4]=_=>g.value=_),"helper-text":e(a)("user_ldap","Attempts to receive a DN for the given login name and the current login filter"),label:e(a)("user_ldap","Test Login name"),autocomplete:"off"},null,8,["modelValue","helper-text","label"]),o(e(I),{disabled:g.value.length===0,onClick:C},{default:m(()=>[b(p(e(a)("user_ldap","Verify settings")),1)]),_:1},8,["disabled"])])]))}}),ea=B(Xe,[["__scopeId","data-v-bcb1b43f"]]),aa={name:"ContentCopyIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},la=["aria-hidden","aria-label"],ta=["fill","width","height"],ra={d:"M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z"},ia={key:0};function oa(u,s,n,t,i,v){return f(),A("span",ee(u.$attrs,{"aria-hidden":n.title?null:"true","aria-label":n.title,class:"material-design-icon content-copy-icon",role:"img",onClick:s[0]||(s[0]=g=>u.$emit("click",g))}),[(f(),A("svg",{fill:n.fillColor,class:"material-design-icon__svg",width:n.size,height:n.size,viewBox:"0 0 24 24"},[c("path",ra,[n.title?(f(),A("title",ia,p(n.title),1)):z("",!0)])],8,ta))],16,la)}const le=B(aa,[["render",oa]]),sa={name:"DeleteIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},da=["aria-hidden","aria-label"],ua=["fill","width","height"],na={d:"M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z"},pa={key:0};function ca(u,s,n,t,i,v){return f(),A("span",ee(u.$attrs,{"aria-hidden":n.title?null:"true","aria-label":n.title,class:"material-design-icon delete-icon",role:"img",onClick:s[0]||(s[0]=g=>u.$emit("click",g))}),[(f(),A("svg",{fill:n.fillColor,class:"material-design-icon__svg",width:n.size,height:n.size,viewBox:"0 0 24 24"},[c("path",na,[n.title?(f(),A("title",pa,p(n.title),1)):z("",!0)])],8,ua))],16,da)}const va=B(sa,[["render",ca]]),_a={class:"ldap-wizard__server"},ga={class:"ldap-wizard__server__line"},fa={class:"ldap-wizard__server__line"},ma={class:"ldap-wizard__server__host__port"},ha={class:"ldap-wizard__server__line"},ba={class:"ldap-wizard__server__line"},ya={class:"ldap-wizard__server__line"},wa=O({__name:"ServerTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId)),v=D(!1),g=D(!1),r=D(!1),l=D(i.value.ldapAgentName),w=D(i.value.ldapAgentPassword),x=L(()=>i.value.ldapAgentName!==l.value||i.value.ldapAgentPassword!==w.value);function P(){i.value.ldapAgentName=l.value,i.value.ldapAgentPassword=w.value}async function U(){try{v.value=!0;const{changes:y}=await F("guessPortAndTLS",s.configId);t.value[s.configId].ldapPort=y.ldap_port??""}finally{v.value=!1}}async function C(){try{r.value=!0;const{changes:y}=await F("guessBaseDN",s.configId);i.value.ldapBase=y.ldap_base??""}finally{r.value=!1}}async function V(){try{g.value=!0;const{changes:y}=await F("countInBaseDN",s.configId),d=y.ldap_test_base;d<1?Q(a("user_ldap","No object found in the given Base DN. Please revise.")):d>1e3?Q(a("user_ldap","More than 1,000 directory entries available.")):Q(re("user_ldap","{ldapTestBase} entry available within the provided Base DN","{ldapTestBase} entries available within the provided Base DN",d,{ldapTestBase:d}))}finally{g.value=!1}}return(y,d)=>(f(),A("fieldset",_a,[c("div",ga,[o(e(N),{"model-value":i.value.ldapConfigurationActive==="1",type:"switch","aria-label":e(a)("user_ldap","When unchecked, this configuration will be skipped."),"onUpdate:modelValue":d[0]||(d[0]=_=>i.value.ldapConfigurationActive=_?"1":"0")},{default:m(()=>[b(p(e(a)("user_ldap","Configuration Active")),1)]),_:1},8,["model-value","aria-label"]),o(e(I),{title:e(a)("user_ldap","Copy current configuration into new directory binding"),onClick:d[1]||(d[1]=_=>e(n).copyConfig(u.configId))},{icon:m(()=>[o(le,{size:20})]),default:m(()=>[b(" "+p(e(a)("user_ldap","Copy configuration")),1)]),_:1},8,["title"]),o(e(I),{variant:"error",onClick:d[2]||(d[2]=_=>e(n).removeConfig(u.configId))},{icon:m(()=>[o(va,{size:20})]),default:m(()=>[b(" "+p(e(a)("user_ldap","Delete configuration")),1)]),_:1})]),c("div",fa,[o(e(h),{"model-value":i.value.ldapHost,"helper-text":e(a)("user_ldap","You can omit the protocol, unless you require SSL. If so, start with ldaps://"),label:e(a)("user_ldap","Host"),placeholder:e(a)("user_ldap","ldaps://localhost"),autocomplete:"off",onChange:d[3]||(d[3]=_=>i.value.ldapHost=_.target.value)},null,8,["model-value","helper-text","label","placeholder"]),c("div",ma,[o(e(h),{"model-value":i.value.ldapPort,label:e(a)("user_ldap","Port"),placeholder:e(a)("user_ldap","389"),type:"number",autocomplete:"off",onChange:d[4]||(d[4]=_=>i.value.ldapPort=_.target.value)},null,8,["model-value","label","placeholder"]),o(e(I),{disabled:v.value,onClick:U},{default:m(()=>[b(p(e(a)("user_ldap","Detect Port")),1)]),_:1},8,["disabled"])])]),c("div",ha,[o(e(h),{modelValue:l.value,"onUpdate:modelValue":d[5]||(d[5]=_=>l.value=_),"helper-text":e(a)("user_ldap","The DN of the client user with which the bind shall be done. For anonymous access, leave DN and Password empty."),label:e(a)("user_ldap","User DN"),placeholder:e(a)("user_ldap","uid=agent,dc=example,dc=com"),autocomplete:"off"},null,8,["modelValue","helper-text","label","placeholder"])]),c("div",ba,[o(e(h),{modelValue:w.value,"onUpdate:modelValue":d[6]||(d[6]=_=>w.value=_),type:"password","helper-text":e(a)("user_ldap","For anonymous access, leave DN and Password empty."),label:e(a)("user_ldap","Password"),autocomplete:"off"},null,8,["modelValue","helper-text","label"]),o(e(I),{disabled:!x.value,onClick:P},{default:m(()=>[b(p(e(a)("user_ldap","Save Credentials")),1)]),_:1},8,["disabled"])]),c("div",ya,[o(e(T),{label:e(a)("user_ldap","Base DN"),"model-value":i.value.ldapBase,placeholder:e(a)("user_ldap","One Base DN per line"),"helper-text":e(a)("user_ldap","You can specify Base DN for users and groups in the Advanced tab"),onChange:d[7]||(d[7]=_=>i.value.ldapBase=_.target.value)},null,8,["label","model-value","placeholder","helper-text"]),o(e(I),{disabled:r.value,onClick:C},{default:m(()=>[b(p(e(a)("user_ldap","Detect Base DN")),1)]),_:1},8,["disabled"]),o(e(I),{disabled:g.value||i.value.ldapBase==="",onClick:V},{default:m(()=>[b(p(e(a)("user_ldap","Test Base DN")),1)]),_:1},8,["disabled"])])]))}}),Aa=B(wa,[["__scopeId","data-v-98abaf0d"]]),Da={class:"ldap-wizard__users"},Ua={class:"ldap-wizard__users__line ldap-wizard__users__user-filter-object-class"},Ca={class:"ldap-wizard__users__line ldap-wizard__users__user-filter-groups"},Pa={class:"ldap-wizard__users__line ldap-wizard__users__user-filter"},xa={key:0},La={key:1},Fa={class:"ldap-wizard__users__line ldap-wizard__users__user-count-check"},Ia={key:1},ka=O({__name:"UsersTab",props:{configId:{}},setup(u){const s=u,n=H(),{ldapConfigs:t}=$(n),i=L(()=>n.getConfigProxy(s.configId,{ldapUserFilterObjectclass:C,ldapUserFilterGroups:C})),v=D(void 0),g=D(!1),r=q().theming.name,l=D([]),w=D([]),x=L({get(){return i.value.ldapUserFilterObjectclass?.split(";").filter(d=>d!=="")??[]},set(d){i.value.ldapUserFilterObjectclass=d.join(";")}}),P=L({get(){return i.value.ldapUserFilterGroups.split(";").filter(d=>d!=="")},set(d){i.value.ldapUserFilterGroups=d.join(";")}});async function U(){const d=await F("determineUserObjectClasses",s.configId);l.value=d.options?.ldap_userfilter_objectclass??[],t.value[s.configId].ldapUserFilterObjectclass=d.changes?.ldap_userfilter_objectclass?.join(";")??"";const _=await F("determineGroupsForUsers",s.configId);w.value=_.options?.ldap_userfilter_groups??[],t.value[s.configId].ldapUserFilterGroups=_.changes?.ldap_userfilter_groups?.join(";")??""}U();async function C(){if(i.value.ldapUserFilterMode==="0"){const d=await F("getUserListFilter",s.configId);t.value[s.configId].ldapUserFilter=d.changes?.ldap_userlist_filter??"";const _=await F("getUserLoginFilter",s.configId);t.value[s.configId].ldapLoginFilter=_.changes?.ldap_login_filter??""}}async function V(){try{g.value=!0;const d=await F("countUsers",s.configId);v.value=d.changes.ldap_user_count}finally{g.value=!1}}async function y(d){d?i.value.ldapUserFilterMode="1":i.value.ldapUserFilterMode=await Z()?"0":"1"}return(d,_)=>(f(),A("fieldset",Da,[b(p(e(a)("user_ldap","Listing and searching for users is constrained by these criteria:"))+" ",1),c("div",Ua,[o(e(R),{modelValue:x.value,"onUpdate:modelValue":_[0]||(_[0]=G=>x.value=G),disabled:i.value.ldapUserFilterMode==="1",class:"ldap-wizard__users__user-filter-object-class__select",options:l.value,"input-label":e(a)("user_ldap","Only these object classes:"),multiple:!0},null,8,["modelValue","disabled","options","input-label"]),b(" "+p(e(a)("user_ldap","The most common object classes for users are organizationalPerson, person, user, and inetOrgPerson. If you are not sure which object class to select, please consult your directory admin.")),1)]),c("div",Ca,[o(e(R),{modelValue:P.value,"onUpdate:modelValue":_[1]||(_[1]=G=>P.value=G),class:"ldap-wizard__users__user-filter-groups__select",disabled:i.value.ldapUserFilterMode==="1",options:w.value,"input-label":e(a)("user_ldap","Only from these groups:"),multiple:!0},null,8,["modelValue","disabled","options","input-label"])]),c("div",Pa,[o(e(N),{"model-value":i.value.ldapUserFilterMode==="1","onUpdate:modelValue":y},{default:m(()=>[b(p(e(a)("user_ldap","Edit LDAP Query")),1)]),_:1},8,["model-value"]),i.value.ldapUserFilterMode==="1"?(f(),A("div",xa,[o(e(T),{modelValue:i.value.ldapUserFilter,"onUpdate:modelValue":_[2]||(_[2]=G=>i.value.ldapUserFilter=G),placeholder:e(a)("user_ldap","Edit LDAP Query"),"helper-text":e(a)("user_ldap","The filter specifies which LDAP users shall have access to the {instanceName} instance.",{instanceName:e(r)})},null,8,["modelValue","placeholder","helper-text"])])):(f(),A("div",La,[c("label",null,p(e(a)("user_ldap","LDAP Filter:")),1),c("code",null,p(i.value.ldapUserFilter),1)]))]),c("div",Fa,[o(e(I),{disabled:g.value,onClick:V},{default:m(()=>[b(p(e(a)("user_ldap","Verify settings and count users")),1)]),_:1},8,["disabled"]),g.value?(f(),k(e(Y),{key:0,size:16})):z("",!0),v.value!==void 0&&!g.value?(f(),A("span",Ia,p(e(a)("user_ldap","User count: {usersCount}",{usersCount:v.value},{escape:!1})),1)):z("",!0)])]))}}),za=B(ka,[["__scopeId","data-v-b5a806d3"]]),Na={class:"ldap-wizard__controls"},Va={class:"ldap-wizard__controls__state_message"},Ga=O({__name:"WizardControls",props:{configId:{}},setup(u){const s=u,n=H(),{updatingConfig:t}=$(n),i=D(!1),v=D(null),g=L(()=>v.value?.success);ie(t,()=>{v.value=null});async function r(){try{i.value=!0,v.value=await Ae(s.configId)}finally{i.value=!1}}return(l,w)=>(f(),A("div",Na,[o(e(I),{variant:"primary",disabled:i.value,onClick:r},{default:m(()=>[b(p(e(a)("user_ldap","Test Configuration")),1)]),_:1},8,["disabled"]),o(e(I),{variant:"tertiary",href:"https://docs.nextcloud.com/server/stable/go.php?to=admin-ldap",target:"_blank",rel:"noreferrer noopener"},{icon:m(()=>[o(le,{size:20})]),default:m(()=>[c("span",null,p(e(a)("user_ldap","Help")),1)]),_:1}),v.value!==null&&!i.value?(f(),A(W,{key:0},[c("span",{class:oe(["ldap-wizard__controls__state_indicator",{"ldap-wizard__controls__state_indicator--valid":g.value}])},null,2),c("span",Va,p(v.value.message),1)],64)):z("",!0),i.value?(f(),k(e(Y),{key:1,size:16})):z("",!0)]))}}),Ba=B(Ga,[["__scopeId","data-v-4518d86f"]]),Oa={class:"ldap-wizard"},Ta={class:"ldap-wizard__config-selection"},Ma={key:0,class:"ldap-wizard__tab-container"},Sa={class:"ldap-wizard__tab-selection-container"},ja={class:"ldap-wizard__tab-selection"},Ha={class:"ldap-wizard__clear-mapping"},Ea={class:"ldap-wizard__clear-mapping__buttons"},Ra=O({__name:"Settings",setup(u){const s=X("user_ldap","ldapModuleInstalled"),n={server:a("user_ldap","Server"),users:a("user_ldap","Users"),login:a("user_ldap","Login Attributes"),groups:a("user_ldap","Groups"),advanced:a("user_ldap","Advanced"),expert:a("user_ldap","Expert")},t=H(),{ldapConfigs:i,selectedConfigId:v,selectedConfig:g}=$(t),r=D("server"),l=D(!1),w=L(()=>g.value.ldapHost!==""&&g.value.ldapPort!==""&&g.value.ldapBase!==""&&g.value.ldapAgentName!==""&&g.value.ldapAgentPassword!=="");async function x(P){try{l.value=!0,await De(P)}finally{l.value=!1}}return(P,U)=>(f(),A("form",Oa,[c("h2",null,p(e(a)("user_ldap","LDAP/AD integration")),1),e(s)?z("",!0):(f(),k(e(ve),{key:0,type:"warning",text:e(a)("user_ldap","The PHP LDAP module is not installed, the backend will not work. Please ask your system administrator to install it.")},null,8,["text"])),e(s)?(f(),A(W,{key:1},[c("div",Ta,[e(v)!==void 0?(f(),k(e(R),{key:0,modelValue:e(v),"onUpdate:modelValue":U[0]||(U[0]=C=>se(v)?v.value=C:null),options:Object.keys(e(i)),"input-label":e(a)("user_ldap","Select LDAP Config")},{option:m(({label:C})=>[b(p(`${C}: ${e(i)[C].ldapHost}`),1)]),"selected-option":m(({label:C})=>[b(p(`${C}: ${e(i)[C].ldapHost}`),1)]),_:1},8,["modelValue","options","input-label"])):z("",!0),o(e(I),{label:e(a)("user_ldap","Create New Config"),class:"ldap-wizard__config-selection__create-button",onClick:e(t).create},{icon:m(()=>[o(_e,{size:20})]),default:m(()=>[b(" "+p(e(a)("user_ldap","Create configuration")),1)]),_:1},8,["label","onClick"])]),e(v)!==void 0?(f(),A("div",Ma,[c("div",Sa,[c("div",ja,[(f(),A(W,null,de(n,(C,V)=>o(e(N),{key:V,modelValue:r.value,"onUpdate:modelValue":U[1]||(U[1]=y=>r.value=y),"button-variant":!0,value:V,type:"radio",disabled:V!=="server"&&!w.value,"button-variant-grouped":"horizontal"},{default:m(()=>[b(p(C),1)]),_:2},1032,["modelValue","value","disabled"])),64))])]),r.value==="server"?(f(),k(Aa,{key:0,"config-id":e(v)},null,8,["config-id"])):r.value==="users"?(f(),k(za,{key:1,"config-id":e(v)},null,8,["config-id"])):r.value==="login"?(f(),k(ea,{key:2,"config-id":e(v)},null,8,["config-id"])):r.value==="groups"?(f(),k(Qe,{key:3,"config-id":e(v)},null,8,["config-id"])):r.value==="expert"?(f(),k(Te,{key:4,"config-id":e(v)},null,8,["config-id"])):r.value==="advanced"?(f(),k(ke,{key:5,"config-id":e(v)},null,8,["config-id"])):z("",!0),o(Ba,{class:"ldap-wizard__controls","config-id":e(v)},null,8,["config-id"])])):z("",!0),c("div",Ha,[c("strong",null,p(e(a)("user_ldap","Username-LDAP User Mapping")),1),b(" "+p(e(a)("user_ldap","Usernames are used to store and assign metadata. In order to precisely identify and recognize users, each LDAP user will have an internal username. This requires a mapping from username to LDAP user. The created username is mapped to the UUID of the LDAP user. Additionally the DN is cached as well to reduce LDAP interaction, but it is not used for identification. If the DN changes, the changes will be found. The internal username is used all over. Clearing the mappings will have leftovers everywhere. Clearing the mappings is not configuration sensitive, it affects all LDAP configurations! Never clear the mappings in a production environment, only in a testing or experimental stage."))+" ",1),c("div",Ea,[o(e(I),{variant:"error",disabled:l.value,onClick:U[2]||(U[2]=C=>x("user"))},{default:m(()=>[b(p(e(a)("user_ldap","Clear Username-LDAP User Mapping")),1)]),_:1},8,["disabled"]),o(e(I),{variant:"error",disabled:l.value,onClick:U[3]||(U[3]=C=>x("group"))},{default:m(()=>[b(p(e(a)("user_ldap","Clear Groupname-LDAP Group Mapping")),1)]),_:1},8,["disabled"])])])],64)):z("",!0)]))}}),$a=B(Ra,[["__scopeId","data-v-18500db6"]]),qa=O({__name:"LDAPSettingsApp",setup(u){return(s,n)=>(f(),k($a))}}),Qa=fe(),K=ue(qa);K.use(Qa),K.mount("#content-ldap-settings"); //# sourceMappingURL=user_ldap-settings-admin.mjs.map diff --git a/package-lock.json b/package-lock.json index 56bc38c32f511..b08ff8a17169b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,21 +11,33 @@ "license": "AGPL-3.0-or-later", "dependencies": { "@mdi/svg": "^7.4.47", + "@nextcloud/auth": "^2.5.3", "@nextcloud/axios": "^2.5.2", "@nextcloud/calendar-availability-vue": "^3.0.0", + "@nextcloud/capabilities": "^1.2.1", "@nextcloud/dialogs": "^7.1.0", + "@nextcloud/event-bus": "^3.3.3", + "@nextcloud/files": "^3.12.0", + "@nextcloud/initial-state": "^3.0.0", + "@nextcloud/l10n": "^3.4.1", + "@nextcloud/logger": "^3.0.2", "@nextcloud/moment": "^1.3.5", "@nextcloud/password-confirmation": "^6.0.2", "@nextcloud/paths": "^2.3.0", + "@nextcloud/router": "^3.1.0", + "@nextcloud/sharing": "^0.3.0", "@nextcloud/vue": "^9.3.0", - "pinia": "^3.0.3", - "vue": "^3.5.25" + "debounce": "^3.0.0", + "pinia": "^3.0.4", + "vue": "^3.5.25", + "webdav": "^5.8.0" }, "devDependencies": { "@nextcloud/browserslist-config": "^3.1.2", "@nextcloud/e2e-test-server": "^0.4.0", "@nextcloud/eslint-config": "^9.0.0-rc.6", "@nextcloud/stylelint-config": "^3.1.1", + "@nextcloud/typings": "^1.10.0", "@nextcloud/vite-config": "^2.5.2", "@testing-library/cypress": "^10.1.0", "@testing-library/jest-dom": "^6.9.1", @@ -45,6 +57,7 @@ "eslint": "^9.39.1", "eslint-plugin-cypress": "^5.2.0", "eslint-plugin-no-only-tests": "^3.3.0", + "is-svg": "^6.1.0", "jsdom": "^27.2.0", "jsdom-testing-mocks": "^1.16.0", "sass": "^1.94.2", @@ -3776,7 +3789,6 @@ "integrity": "sha512-QoiaXANRkSXK6p0Duvt56W208du4P9Uye9hWLWgGMDTEoKPhuenzNcC4vGUmrNkiOKTlIrBoyNQYNpSwfEZXSg==", "devOptional": true, "license": "MIT", - "peer": true, "dependencies": { "undici-types": "~7.16.0" } @@ -12806,19 +12818,19 @@ } }, "node_modules/pinia": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.3.tgz", - "integrity": "sha512-ttXO/InUULUXkMHpTdp9Fj4hLpD/2AoJdmAbAeW2yu1iy1k+pkFekQXw5VpC0/5p51IOR/jDaDRfRWRnMMsGOA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz", + "integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==", "license": "MIT", "dependencies": { - "@vue/devtools-api": "^7.7.2" + "@vue/devtools-api": "^7.7.7" }, "funding": { "url": "https://github.com/sponsors/posva" }, "peerDependencies": { - "typescript": ">=4.4.4", - "vue": "^2.7.0 || ^3.5.11" + "typescript": ">=4.5.0", + "vue": "^3.5.11" }, "peerDependenciesMeta": { "typescript": { diff --git a/package.json b/package.json index 0671792abbf40..80d83b117af94 100644 --- a/package.json +++ b/package.json @@ -40,21 +40,33 @@ ], "dependencies": { "@mdi/svg": "^7.4.47", + "@nextcloud/auth": "^2.5.3", "@nextcloud/axios": "^2.5.2", "@nextcloud/calendar-availability-vue": "^3.0.0", + "@nextcloud/capabilities": "^1.2.1", "@nextcloud/dialogs": "^7.1.0", + "@nextcloud/event-bus": "^3.3.3", + "@nextcloud/files": "^3.12.0", + "@nextcloud/initial-state": "^3.0.0", + "@nextcloud/l10n": "^3.4.1", + "@nextcloud/logger": "^3.0.2", "@nextcloud/moment": "^1.3.5", "@nextcloud/password-confirmation": "^6.0.2", "@nextcloud/paths": "^2.3.0", + "@nextcloud/router": "^3.1.0", + "@nextcloud/sharing": "^0.3.0", "@nextcloud/vue": "^9.3.0", - "pinia": "^3.0.3", - "vue": "^3.5.25" + "debounce": "^3.0.0", + "pinia": "^3.0.4", + "vue": "^3.5.25", + "webdav": "^5.8.0" }, "devDependencies": { "@nextcloud/browserslist-config": "^3.1.2", "@nextcloud/e2e-test-server": "^0.4.0", "@nextcloud/eslint-config": "^9.0.0-rc.6", "@nextcloud/stylelint-config": "^3.1.1", + "@nextcloud/typings": "^1.10.0", "@nextcloud/vite-config": "^2.5.2", "@testing-library/cypress": "^10.1.0", "@testing-library/jest-dom": "^6.9.1", @@ -74,6 +86,7 @@ "eslint": "^9.39.1", "eslint-plugin-cypress": "^5.2.0", "eslint-plugin-no-only-tests": "^3.3.0", + "is-svg": "^6.1.0", "jsdom": "^27.2.0", "jsdom-testing-mocks": "^1.16.0", "sass": "^1.94.2",