@inpageedit/core 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +55 -55
- package/dist/ActionButton-BgbTKTg7.js.map +1 -1
- package/dist/CheckBox-D3rHnX7I.js.map +1 -1
- package/dist/IconQuickEdit-CAL1HXIb.js.map +1 -1
- package/dist/InputBox-BV4m05Xs.js.map +1 -1
- package/dist/PluginPrefSync-CNCU2DJU.js +171 -0
- package/dist/PluginPrefSync-CNCU2DJU.js.map +1 -0
- package/dist/Preferences-DS4-CFWe.js.map +1 -1
- package/dist/RadioBox-nJqWsxW2.js.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/{index-DxGjTpIn.js → index-2mNdeL-V.js} +27 -27
- package/dist/index-2mNdeL-V.js.map +1 -0
- package/dist/{index-btJ_NMuF.js → index-BR6gK_ki.js} +2 -2
- package/dist/index-BR6gK_ki.js.map +1 -0
- package/dist/index-Bh70Udzi.js.map +1 -1
- package/dist/{index-RFAZzS9C.js → index-BnAhw94L.js} +2 -2
- package/dist/{index-RFAZzS9C.js.map → index-BnAhw94L.js.map} +1 -1
- package/dist/{index-UjgKGkN2.js → index-ByJfEsN8.js} +2 -2
- package/dist/index-ByJfEsN8.js.map +1 -0
- package/dist/{index-CWbHdYKu.js → index-ByzgI28q.js} +2 -2
- package/dist/index-ByzgI28q.js.map +1 -0
- package/dist/{index-C-A3jSMx.js → index-CAiGct8U.js} +2 -2
- package/dist/index-CAiGct8U.js.map +1 -0
- package/dist/index-CvhkVj_L.js.map +1 -1
- package/dist/{index-CaI9BFuB.js → index-Cx-YiN1j.js} +2 -2
- package/dist/{index-CaI9BFuB.js.map → index-Cx-YiN1j.js.map} +1 -1
- package/dist/{index-D6055L55.js → index-DqJUIV2e.js} +151 -143
- package/dist/{index-D6055L55.js.map → index-DqJUIV2e.js.map} +1 -1
- package/dist/{index-Ek5d60jn.js → index-Z-_kjibx.js} +1637 -1453
- package/dist/index-Z-_kjibx.js.map +1 -0
- package/dist/{index-CInRo1qR.js → index-eOIVMf9E.js} +2 -2
- package/dist/index-eOIVMf9E.js.map +1 -0
- package/dist/index-lZkYoUca.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
- package/dist/noop-ClDc6zv4.js.map +1 -1
- package/dist/plugins/preferences-ui/PluginPrefSync.d.ts +25 -0
- package/dist/plugins/preferences-ui/index.d.ts +4 -0
- package/dist/services/PreferencesService.d.ts +7 -0
- package/dist/services/storage/IPEStorageManager.d.ts +25 -0
- package/dist/services/storage/index.d.ts +6 -29
- package/dist/style.css +1 -1
- package/lib/index.umd.js +27 -20
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +2 -1
- package/dist/index-C-A3jSMx.js.map +0 -1
- package/dist/index-CInRo1qR.js.map +0 -1
- package/dist/index-CWbHdYKu.js.map +0 -1
- package/dist/index-DxGjTpIn.js.map +0 -1
- package/dist/index-Ek5d60jn.js.map +0 -1
- package/dist/index-UjgKGkN2.js.map +0 -1
- package/dist/index-btJ_NMuF.js.map +0 -1
- package/dist/services/storage/IDBStorage.d.ts +0 -52
package/lib/index.umd.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(Q,te){typeof exports=="object"&&typeof module<"u"?te(exports):typeof define=="function"&&define.amd?define(["exports"],te):(Q=typeof globalThis<"u"?globalThis:Q||self,te(Q.InPageEditBundle={}))})(this,function(Q){"use strict";var Yy=Object.defineProperty;var Ru=Q=>{throw TypeError(Q)};var Xy=(Q,te,ye)=>te in Q?Yy(Q,te,{enumerable:!0,configurable:!0,writable:!0,value:ye}):Q[te]=ye;var j=(Q,te,ye)=>Xy(Q,typeof te!="symbol"?te+"":te,ye),Ao=(Q,te,ye)=>te.has(Q)||Ru("Cannot "+ye);var Z=(Q,te,ye)=>(Ao(Q,te,"read from private field"),ye?ye.call(Q):te.get(Q)),Ri=(Q,te,ye)=>te.has(Q)?Ru("Cannot add the same private member more than once"):te instanceof WeakSet?te.add(Q):te.set(Q,ye),Ve=(Q,te,ye,z)=>(Ao(Q,te,"write to private field"),z?z.call(Q,ye):te.set(Q,ye),ye),Ge=(Q,te,ye)=>(Ao(Q,te,"access private method"),ye);var Ke,Pi,ri,Ci,Oi,Ai,Ti,me,qe,oe,Me,To,Du,Ro,ju,Uu,qt,mt,Fu,Bu,qu,Hu,mr;const te=()=>{let t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=te);var ye=Object.defineProperty,z=(t,e)=>ye(t,"name",{value:e,configurable:!0});function zu(){}z(zu,"noop");function de(t){return t==null}z(de,"isNullable");function Wu(t){return!de(t)}z(Wu,"isNonNullable");function wr(t){return t&&typeof t=="object"&&!Array.isArray(t)}z(wr,"isPlainObject");function Io(t,e){return Object.fromEntries(Object.entries(t).filter(([i,r])=>e(i,r)))}z(Io,"filterKeys");function vt(t,e){return Object.fromEntries(Object.entries(t).map(([i,r])=>[i,e(r,i)]))}z(vt,"mapValues");function Lo(t,e,i){if(!e)return{...t};const r={};for(const n of e)(i||t[n]!==void 0)&&(r[n]=t[n]);return r}z(Lo,"pick");function Ku(t,e){if(!e)return{...t};const i={...t};for(const r of e)Reflect.deleteProperty(i,r);return i}z(Ku,"omit");function xe(t,e,i){return Object.defineProperty(t,e,{writable:!0,value:i,enumerable:!1})}z(xe,"defineProperty");function Vu(t,e){return e.every(i=>t.includes(i))}z(Vu,"contain");function Gu(t,e){return t.filter(i=>e.includes(i))}z(Gu,"intersection");function Qu(t,e){return t.filter(i=>!e.includes(i))}z(Qu,"difference");function Yu(t,e){return Array.from(new Set([...t,...e]))}z(Yu,"union");function Xu(t){return[...new Set(t)]}z(Xu,"deduplicate");function At(t,e){const i=t?.indexOf(e);return i>=0?(t.splice(i,1),!0):!1}z(At,"remove");function Ju(t){return Array.isArray(t)?t:de(t)?[]:[t]}z(Ju,"makeArray");function Tt(t,e){return arguments.length===1?i=>Tt(t,i):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}z(Tt,"is");function Ii(t){return Tt("ArrayBuffer",t)||Tt("SharedArrayBuffer",t)}z(Ii,"isArrayBufferLike");function No(t){return Ii(t)||ArrayBuffer.isView(t)}z(No,"isArrayBufferSource");var tt;(t=>{t.is=Ii,t.isSource=No;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,z(e,"fromSource");function i(o){if(typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const l=new Uint8Array(o);for(let c=0;c<l.byteLength;c++)a+=String.fromCharCode(l[c]);return btoa(a)}t.toBase64=i,z(i,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,z(r,"fromBase64");function n(o){return typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}t.toHex=n,z(n,"toHex");function s(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),l=[];for(let c=0;c<a.length;c+=2)l.push(parseInt(`${a[c]}${a[c+1]}`,16));return Uint8Array.from(l).buffer}t.fromHex=s,z(s,"fromHex")})(tt||(tt={})),tt.fromBase64,tt.toBase64,tt.fromHex,tt.toHex;function vr(t,e=new Map){if(!t||typeof t!="object")return t;if(Tt("Date",t))return new Date(t.valueOf());if(Tt("RegExp",t))return new RegExp(t.source,t.flags);if(Ii(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const i=e.get(t);if(i)return i;if(Array.isArray(t)){const n=[];return e.set(t,n),t.forEach((s,o)=>{n[o]=Reflect.apply(vr,null,[s,e])}),n}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const n of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,n)};"value"in s&&(s.value=Reflect.apply(vr,null,[s.value,e])),Reflect.defineProperty(r,n,s)}return r}z(vr,"clone");function Kt(t,e,i){if(t===e||!i&&de(t)&&de(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(n,s){return n(t)?n(e)?s(t,e):!1:n(e)?!1:void 0}return z(r,"check"),r(Array.isArray,(n,s)=>n.length===s.length&&n.every((o,a)=>Kt(o,s[a])))??r(Tt("Date"),(n,s)=>n.valueOf()===s.valueOf())??r(Tt("RegExp"),(n,s)=>n.source===s.source&&n.flags===s.flags)??r(Ii,(n,s)=>{if(n.byteLength!==s.byteLength)return!1;const o=new Uint8Array(n),a=new Uint8Array(s);for(let l=0;l<o.length;l++)if(o[l]!==a[l])return!1;return!0})??Object.keys({...t,...e}).every(n=>Kt(t[n],e[n],i))}z(Kt,"deepEqual");function Zu(t){return t.charAt(0).toUpperCase()+t.slice(1)}z(Zu,"capitalize");function ef(t){return t.charAt(0).toLowerCase()+t.slice(1)}z(ef,"uncapitalize");function tf(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}z(tf,"camelCase");function Rn(t,e,i){const r=[];let n=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(n===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(i),r.push(o+32)}else n!==0&&r.push(i),r.push(o+32);n=1}else o>=97&&o<=122?(r.push(o),n=2):e.includes(o)?(n!==0&&r.push(i),n=0):r.push(o)}return String.fromCharCode(...r)}z(Rn,"tokenize");function rf(t){return Rn(t,[45,95],45)}z(rf,"paramCase");function nf(t){return Rn(t,[45,95],95)}z(nf,"snakeCase");function sf(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}z(sf,"formatProperty");function Mo(t){return t.replace(/\/$/,"")}z(Mo,"trimSlash");function of(t){return t.startsWith("/")||(t="/"+t),Mo(t)}z(of,"sanitize");var Do;(t=>{t.millisecond=1,t.second=1e3,t.minute=t.second*60,t.hour=t.minute*60,t.day=t.hour*24,t.week=t.day*7;let e=new Date().getTimezoneOffset();function i(b){e=b}t.setTimezoneOffset=i,z(i,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,z(r,"getTimezoneOffset");function n(b=new Date,g){return typeof b=="number"&&(b=new Date(b)),g===void 0&&(g=e),Math.floor((b.valueOf()/t.minute-g)/1440)}t.getDateNumber=n,z(n,"getDateNumber");function s(b,g){const E=new Date(b*t.day);return g===void 0&&(g=e),new Date(+E+g*t.minute)}t.fromDateNumber=s,z(s,"fromDateNumber");const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(b=>`(${o}${b})?`).join("")}$`);function l(b){const g=a.exec(b);return g?(parseFloat(g[1])*t.week||0)+(parseFloat(g[2])*t.day||0)+(parseFloat(g[3])*t.hour||0)+(parseFloat(g[4])*t.minute||0)+(parseFloat(g[5])*t.second||0):0}t.parseTime=l,z(l,"parseTime");function c(b){const g=l(b);return g?b=Date.now()+g:/^\d{1,2}(:\d{1,2}){1,2}$/.test(b)?b=`${new Date().toLocaleDateString()}-${b}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(b)&&(b=`${new Date().getFullYear()}-${b}`),b?new Date(b):new Date}t.parseDate=c,z(c,"parseDate");function u(b){const g=Math.abs(b);return g>=t.day-t.hour/2?Math.round(b/t.day)+"d":g>=t.hour-t.minute/2?Math.round(b/t.hour)+"h":g>=t.minute-t.second/2?Math.round(b/t.minute)+"m":g>=t.second?Math.round(b/t.second)+"s":b+"ms"}t.format=u,z(u,"format");function f(b,g=2){return b.toString().padStart(g,"0")}t.toDigits=f,z(f,"toDigits");function d(b,g=new Date){return b.replace("yyyy",g.getFullYear().toString()).replace("yy",g.getFullYear().toString().slice(2)).replace("MM",f(g.getMonth()+1)).replace("dd",f(g.getDate())).replace("hh",f(g.getHours())).replace("mm",f(g.getMinutes())).replace("ss",f(g.getSeconds())).replace("SSS",f(g.getMilliseconds(),3))}t.template=d,z(d,"template")})(Do||(Do={}));var af=Object.defineProperty,W=(t,e)=>af(t,"name",{value:e,configurable:!0}),L={shadow:Symbol.for("cordis.shadow"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),store:Symbol.for("cordis.store"),events:Symbol.for("cordis.events"),static:Symbol.for("cordis.static"),filter:Symbol.for("cordis.filter"),expose:Symbol.for("cordis.expose"),isolate:Symbol.for("cordis.isolate"),internal:Symbol.for("cordis.internal"),intercept:Symbol.for("cordis.intercept"),setup:Symbol.for("cordis.setup"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),provide:Symbol.for("cordis.provide"),immediate:Symbol.for("cordis.immediate")},lf=function*(){}.constructor,jo=async function*(){}.constructor;function In(t){return!(!t.prototype||t instanceof lf||jo!==Function&&t instanceof jo)}W(In,"isConstructor");function Li(t,e){const i=t.Config||t.schema;return i&&t.schema!==!1&&(e=i(e)),e??{}}W(Li,"resolveConfig");function Uo(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}W(Uo,"isUnproxyable");function Ln(t,e){if(t===Object.prototype)return e;const i=Object.create(Ln(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r));return i}W(Ln,"joinPrototype");function Nn(t){return t&&(typeof t=="object"||typeof t=="function")}W(Nn,"isObject");function it(t,e,i){if(!Nn(e))return e;if(Object.hasOwn(e,L.shadow))return Object.getPrototypeOf(e);const r=e[L.tracker];return r?xr(t,e,r,i):e}W(it,"getTraceable");function Ni(t,e){return e?new Proxy(t,{get:W((i,r,n)=>r in e&&r!=="constructor"?Reflect.get(e,r,n):Reflect.get(i,r,n),"get"),set:W((i,r,n,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,n,s):Reflect.set(i,r,n,s),"set")}):t}W(Ni,"withProps");function _r(t,e,i){return Ni(t,Object.defineProperty(Object.create(null),e,{value:i,writable:!1}))}W(_r,"withProp");function Mn(t,e,i,r){if(!i)return r;const n=Reflect.getOwnPropertyDescriptor(e,i)?.value;return n?_r(r,i,t.extend({[L.shadow]:n})):r}W(Mn,"createShadow");function Fo(t,e,i,r){return new Proxy(e,{apply:W((n,s,o)=>(s===i&&(s=r),o=o.map(a=>typeof a!="function"||a[L.original]?a:new Proxy(a,{get:W((l,c,u)=>{if(c===L.original)return l;const f=Reflect.get(l,c,u);return c==="toString"&&f===Function.prototype.toString?function(...d){return Reflect.apply(f,this===u?l:this,d)}:f},"get"),apply:W((l,c,u)=>Reflect.apply(l,it(t,c),u.map(f=>it(t,f))),"apply"),construct:W((l,c,u)=>Reflect.construct(l,c.map(f=>it(t,f)),u),"construct")})),it(t,Reflect.apply(n,s,o))),"apply")})}W(Fo,"createShadowMethod");function xr(t,e,i,r){t[L.shadow]&&(t=Object.getPrototypeOf(t));const n=new Proxy(e,{get:W((s,o,a)=>{if(o===L.original)return s;if(o===i.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(i.associate&&t[L.internal][`${i.associate}.${o}`])return Reflect.get(t,`${i.associate}.${o}`,_r(t,L.receiver,a));const l=Mn(t,s,i.property,a),c=Reflect.get(s,o,l),u=c?.[L.tracker];return u?xr(t,c,u):!r&&typeof c=="function"?Fo(t,c,a,l):c},"get"),set:W((s,o,a,l)=>{if(o===L.original||o===i.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(i.associate&&t[L.internal][`${i.associate}.${o}`])return Reflect.set(t,`${i.associate}.${o}`,a,_r(t,L.receiver,l));const c=Mn(t,s,i.property,l);return Reflect.set(s,o,a,c)},"set"),apply:W((s,o,a)=>Dn(n,s,o,a),"apply")});return n}W(xr,"createTraceable");function Dn(t,e,i,r){return e[L.invoke]?e[L.invoke].apply(t,r):Reflect.apply(e,i,r)}W(Dn,"applyTraceable");function jn(t,e,i){const r=W(function(...n){const s=xr(r.ctx,r,i);return Dn(s,r,this,n)},"self");return xe(r,"name",t),Object.setPrototypeOf(r,e)}W(jn,"createCallable");var cf=(Ke=class{constructor(e){this.ctx=e,xe(this,L.tracker,{associate:"reflect",property:"ctx"}),this._mixin("reflect",["get","set","provide","accessor","mixin","alias"]),this._mixin("scope",["config","runtime","effect","collect","accept","decline"]),this._mixin("registry",["using","inject","plugin"]),this._mixin("lifecycle",["on","once","parallel","emit","serial","bail","start","stop"])}static resolveInject(e,i){let r=e[L.internal][i];for(;r?.type==="alias";)i=r.name,r=e[L.internal][i];return[i,r]}static checkInject(e,i,r){if(e=e[L.shadow]??e,["prototype","then","registry","lifecycle"].includes(i)||i[0]==="$"||i[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",i))return;const n=r.stack.split(`
|
|
1
|
+
(function(Y,re){typeof exports=="object"&&typeof module<"u"?re(exports):typeof define=="function"&&define.amd?define(["exports"],re):(Y=typeof globalThis<"u"?globalThis:Y||self,re(Y.InPageEditBundle={}))})(this,function(Y){"use strict";var gb=Object.defineProperty;var ju=Y=>{throw TypeError(Y)};var yb=(Y,re,ve)=>re in Y?gb(Y,re,{enumerable:!0,configurable:!0,writable:!0,value:ve}):Y[re]=ve;var M=(Y,re,ve)=>yb(Y,typeof re!="symbol"?re+"":re,ve),To=(Y,re,ve)=>re.has(Y)||ju("Cannot "+ve);var J=(Y,re,ve)=>(To(Y,re,"read from private field"),ve?ve.call(Y):re.get(Y)),Ii=(Y,re,ve)=>re.has(Y)?ju("Cannot add the same private member more than once"):re instanceof WeakSet?re.add(Y):re.set(Y,ve),ze=(Y,re,ve,z)=>(To(Y,re,"write to private field"),z?z.call(Y,ve):re.set(Y,ve),ve),it=(Y,re,ve)=>(To(Y,re,"access private method"),ve);var et,$i,ni,Pi,Ci,Oi,Ti,we,Ge,ce,Be,Io,Hu,Ao,zu,Wu,vt,Vu,Gu,Qu,Yu,pr;const re=()=>{let t,e;return{promise:new Promise((r,n)=>{t=r,e=n}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=re);var ve=Object.defineProperty,z=(t,e)=>ve(t,"name",{value:e,configurable:!0});function Ju(){}z(Ju,"noop");function me(t){return t==null}z(me,"isNullable");function Xu(t){return!me(t)}z(Xu,"isNonNullable");function br(t){return t&&typeof t=="object"&&!Array.isArray(t)}z(br,"isPlainObject");function Ro(t,e){return Object.fromEntries(Object.entries(t).filter(([i,r])=>e(i,r)))}z(Ro,"filterKeys");function Et(t,e){return Object.fromEntries(Object.entries(t).map(([i,r])=>[i,e(r,i)]))}z(Et,"mapValues");function Lo(t,e,i){if(!e)return{...t};const r={};for(const n of e)(i||t[n]!==void 0)&&(r[n]=t[n]);return r}z(Lo,"pick");function Zu(t,e){if(!e)return{...t};const i={...t};for(const r of e)Reflect.deleteProperty(i,r);return i}z(Zu,"omit");function Ce(t,e,i){return Object.defineProperty(t,e,{writable:!0,value:i,enumerable:!1})}z(Ce,"defineProperty");function ef(t,e){return e.every(i=>t.includes(i))}z(ef,"contain");function tf(t,e){return t.filter(i=>e.includes(i))}z(tf,"intersection");function rf(t,e){return t.filter(i=>!e.includes(i))}z(rf,"difference");function nf(t,e){return Array.from(new Set([...t,...e]))}z(nf,"union");function sf(t){return[...new Set(t)]}z(sf,"deduplicate");function Nt(t,e){const i=t?.indexOf(e);return i>=0?(t.splice(i,1),!0):!1}z(Nt,"remove");function of(t){return Array.isArray(t)?t:me(t)?[]:[t]}z(of,"makeArray");function Mt(t,e){return arguments.length===1?i=>Mt(t,i):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}z(Mt,"is");function Ai(t){return Mt("ArrayBuffer",t)||Mt("SharedArrayBuffer",t)}z(Ai,"isArrayBufferLike");function No(t){return Ai(t)||ArrayBuffer.isView(t)}z(No,"isArrayBufferSource");var lt;(t=>{t.is=Ai,t.isSource=No;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,z(e,"fromSource");function i(o){if(typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const l=new Uint8Array(o);for(let c=0;c<l.byteLength;c++)a+=String.fromCharCode(l[c]);return btoa(a)}t.toBase64=i,z(i,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,z(r,"fromBase64");function n(o){return typeof Buffer<"u"?Buffer.from(o).toString("hex"):Array.from(new Uint8Array(o),a=>a.toString(16).padStart(2,"0")).join("")}t.toHex=n,z(n,"toHex");function s(o){if(typeof Buffer<"u")return e(Buffer.from(o,"hex"));const a=o.length%2===0?o:o.slice(0,o.length-1),l=[];for(let c=0;c<a.length;c+=2)l.push(parseInt(`${a[c]}${a[c+1]}`,16));return Uint8Array.from(l).buffer}t.fromHex=s,z(s,"fromHex")})(lt||(lt={})),lt.fromBase64,lt.toBase64,lt.fromHex,lt.toHex;function wr(t,e=new Map){if(!t||typeof t!="object")return t;if(Mt("Date",t))return new Date(t.valueOf());if(Mt("RegExp",t))return new RegExp(t.source,t.flags);if(Ai(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const i=e.get(t);if(i)return i;if(Array.isArray(t)){const n=[];return e.set(t,n),t.forEach((s,o)=>{n[o]=Reflect.apply(wr,null,[s,e])}),n}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const n of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,n)};"value"in s&&(s.value=Reflect.apply(wr,null,[s.value,e])),Reflect.defineProperty(r,n,s)}return r}z(wr,"clone");function Vt(t,e,i){if(t===e||!i&&me(t)&&me(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(n,s){return n(t)?n(e)?s(t,e):!1:n(e)?!1:void 0}return z(r,"check"),r(Array.isArray,(n,s)=>n.length===s.length&&n.every((o,a)=>Vt(o,s[a])))??r(Mt("Date"),(n,s)=>n.valueOf()===s.valueOf())??r(Mt("RegExp"),(n,s)=>n.source===s.source&&n.flags===s.flags)??r(Ai,(n,s)=>{if(n.byteLength!==s.byteLength)return!1;const o=new Uint8Array(n),a=new Uint8Array(s);for(let l=0;l<o.length;l++)if(o[l]!==a[l])return!1;return!0})??Object.keys({...t,...e}).every(n=>Vt(t[n],e[n],i))}z(Vt,"deepEqual");function af(t){return t.charAt(0).toUpperCase()+t.slice(1)}z(af,"capitalize");function lf(t){return t.charAt(0).toLowerCase()+t.slice(1)}z(lf,"uncapitalize");function cf(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}z(cf,"camelCase");function In(t,e,i){const r=[];let n=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(n===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(i),r.push(o+32)}else n!==0&&r.push(i),r.push(o+32);n=1}else o>=97&&o<=122?(r.push(o),n=2):e.includes(o)?(n!==0&&r.push(i),n=0):r.push(o)}return String.fromCharCode(...r)}z(In,"tokenize");function uf(t){return In(t,[45,95],45)}z(uf,"paramCase");function ff(t){return In(t,[45,95],95)}z(ff,"snakeCase");function hf(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}z(hf,"formatProperty");function Mo(t){return t.replace(/\/$/,"")}z(Mo,"trimSlash");function df(t){return t.startsWith("/")||(t="/"+t),Mo(t)}z(df,"sanitize");var Do;(t=>{t.millisecond=1,t.second=1e3,t.minute=t.second*60,t.hour=t.minute*60,t.day=t.hour*24,t.week=t.day*7;let e=new Date().getTimezoneOffset();function i(y){e=y}t.setTimezoneOffset=i,z(i,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,z(r,"getTimezoneOffset");function n(y=new Date,m){return typeof y=="number"&&(y=new Date(y)),m===void 0&&(m=e),Math.floor((y.valueOf()/t.minute-m)/1440)}t.getDateNumber=n,z(n,"getDateNumber");function s(y,m){const E=new Date(y*t.day);return m===void 0&&(m=e),new Date(+E+m*t.minute)}t.fromDateNumber=s,z(s,"fromDateNumber");const o=/\d+(?:\.\d+)?/.source,a=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(y=>`(${o}${y})?`).join("")}$`);function l(y){const m=a.exec(y);return m?(parseFloat(m[1])*t.week||0)+(parseFloat(m[2])*t.day||0)+(parseFloat(m[3])*t.hour||0)+(parseFloat(m[4])*t.minute||0)+(parseFloat(m[5])*t.second||0):0}t.parseTime=l,z(l,"parseTime");function c(y){const m=l(y);return m?y=Date.now()+m:/^\d{1,2}(:\d{1,2}){1,2}$/.test(y)?y=`${new Date().toLocaleDateString()}-${y}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(y)&&(y=`${new Date().getFullYear()}-${y}`),y?new Date(y):new Date}t.parseDate=c,z(c,"parseDate");function u(y){const m=Math.abs(y);return m>=t.day-t.hour/2?Math.round(y/t.day)+"d":m>=t.hour-t.minute/2?Math.round(y/t.hour)+"h":m>=t.minute-t.second/2?Math.round(y/t.minute)+"m":m>=t.second?Math.round(y/t.second)+"s":y+"ms"}t.format=u,z(u,"format");function f(y,m=2){return y.toString().padStart(m,"0")}t.toDigits=f,z(f,"toDigits");function d(y,m=new Date){return y.replace("yyyy",m.getFullYear().toString()).replace("yy",m.getFullYear().toString().slice(2)).replace("MM",f(m.getMonth()+1)).replace("dd",f(m.getDate())).replace("hh",f(m.getHours())).replace("mm",f(m.getMinutes())).replace("ss",f(m.getSeconds())).replace("SSS",f(m.getMilliseconds(),3))}t.template=d,z(d,"template")})(Do||(Do={}));var pf=Object.defineProperty,W=(t,e)=>pf(t,"name",{value:e,configurable:!0}),L={shadow:Symbol.for("cordis.shadow"),receiver:Symbol.for("cordis.receiver"),original:Symbol.for("cordis.original"),store:Symbol.for("cordis.store"),events:Symbol.for("cordis.events"),static:Symbol.for("cordis.static"),filter:Symbol.for("cordis.filter"),expose:Symbol.for("cordis.expose"),isolate:Symbol.for("cordis.isolate"),internal:Symbol.for("cordis.internal"),intercept:Symbol.for("cordis.intercept"),setup:Symbol.for("cordis.setup"),invoke:Symbol.for("cordis.invoke"),extend:Symbol.for("cordis.extend"),tracker:Symbol.for("cordis.tracker"),provide:Symbol.for("cordis.provide"),immediate:Symbol.for("cordis.immediate")},mf=function*(){}.constructor,jo=async function*(){}.constructor;function An(t){return!(!t.prototype||t instanceof mf||jo!==Function&&t instanceof jo)}W(An,"isConstructor");function Ri(t,e){const i=t.Config||t.schema;return i&&t.schema!==!1&&(e=i(e)),e??{}}W(Ri,"resolveConfig");function Uo(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}W(Uo,"isUnproxyable");function Rn(t,e){if(t===Object.prototype)return e;const i=Object.create(Rn(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r));return i}W(Rn,"joinPrototype");function Ln(t){return t&&(typeof t=="object"||typeof t=="function")}W(Ln,"isObject");function ct(t,e,i){if(!Ln(e))return e;if(Object.hasOwn(e,L.shadow))return Object.getPrototypeOf(e);const r=e[L.tracker];return r?_r(t,e,r,i):e}W(ct,"getTraceable");function Li(t,e){return e?new Proxy(t,{get:W((i,r,n)=>r in e&&r!=="constructor"?Reflect.get(e,r,n):Reflect.get(i,r,n),"get"),set:W((i,r,n,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,n,s):Reflect.set(i,r,n,s),"set")}):t}W(Li,"withProps");function vr(t,e,i){return Li(t,Object.defineProperty(Object.create(null),e,{value:i,writable:!1}))}W(vr,"withProp");function Nn(t,e,i,r){if(!i)return r;const n=Reflect.getOwnPropertyDescriptor(e,i)?.value;return n?vr(r,i,t.extend({[L.shadow]:n})):r}W(Nn,"createShadow");function Fo(t,e,i,r){return new Proxy(e,{apply:W((n,s,o)=>(s===i&&(s=r),o=o.map(a=>typeof a!="function"||a[L.original]?a:new Proxy(a,{get:W((l,c,u)=>{if(c===L.original)return l;const f=Reflect.get(l,c,u);return c==="toString"&&f===Function.prototype.toString?function(...d){return Reflect.apply(f,this===u?l:this,d)}:f},"get"),apply:W((l,c,u)=>Reflect.apply(l,ct(t,c),u.map(f=>ct(t,f))),"apply"),construct:W((l,c,u)=>Reflect.construct(l,c.map(f=>ct(t,f)),u),"construct")})),ct(t,Reflect.apply(n,s,o))),"apply")})}W(Fo,"createShadowMethod");function _r(t,e,i,r){t[L.shadow]&&(t=Object.getPrototypeOf(t));const n=new Proxy(e,{get:W((s,o,a)=>{if(o===L.original)return s;if(o===i.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(i.associate&&t[L.internal][`${i.associate}.${o}`])return Reflect.get(t,`${i.associate}.${o}`,vr(t,L.receiver,a));const l=Nn(t,s,i.property,a),c=Reflect.get(s,o,l),u=c?.[L.tracker];return u?_r(t,c,u):!r&&typeof c=="function"?Fo(t,c,a,l):c},"get"),set:W((s,o,a,l)=>{if(o===L.original||o===i.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(i.associate&&t[L.internal][`${i.associate}.${o}`])return Reflect.set(t,`${i.associate}.${o}`,a,vr(t,L.receiver,l));const c=Nn(t,s,i.property,l);return Reflect.set(s,o,a,c)},"set"),apply:W((s,o,a)=>Mn(n,s,o,a),"apply")});return n}W(_r,"createTraceable");function Mn(t,e,i,r){return e[L.invoke]?e[L.invoke].apply(t,r):Reflect.apply(e,i,r)}W(Mn,"applyTraceable");function Dn(t,e,i){const r=W(function(...n){const s=_r(r.ctx,r,i);return Mn(s,r,this,n)},"self");return Ce(r,"name",t),Object.setPrototypeOf(r,e)}W(Dn,"createCallable");var gf=(et=class{constructor(e){this.ctx=e,Ce(this,L.tracker,{associate:"reflect",property:"ctx"}),this._mixin("reflect",["get","set","provide","accessor","mixin","alias"]),this._mixin("scope",["config","runtime","effect","collect","accept","decline"]),this._mixin("registry",["using","inject","plugin"]),this._mixin("lifecycle",["on","once","parallel","emit","serial","bail","start","stop"])}static resolveInject(e,i){let r=e[L.internal][i];for(;r?.type==="alias";)i=r.name,r=e[L.internal][i];return[i,r]}static checkInject(e,i,r){if(e=e[L.shadow]??e,["prototype","then","registry","lifecycle"].includes(i)||i[0]==="$"||i[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",i))return;const n=r.stack.split(`
|
|
2
2
|
`);n.splice(1,1),r.stack=n.join(`
|
|
3
|
-
`),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[L.internal][e]?.type!=="service")return;const r=this.ctx[L.isolate][e],n=this.ctx[L.store][r]?.value;return it(this.ctx,n)}set(e,i){this.provide(e);const r=this.ctx[L.isolate][e],n=this.ctx[L.store][r]?.value;i??(i=void 0);let s=W(()=>{},"dispose");if(n===i)return s;if(!de(i)&&!de(n))throw new Error(`service ${e} has been registered`);const o=this.ctx;de(i)||(s=o.effect(()=>()=>{o.set(e,void 0)})),Uo(i)&&o.emit(o,"internal/warning",new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));const a=Object.create(o);return a[L.filter]=l=>o[L.isolate][e]===l[L.isolate][e],o.emit(a,"internal/before-service",e,i),o[L.store][r]={value:i,source:o},o.emit(a,"internal/service",e,n),s}provide(e,i,r){const n=this.ctx.root[L.internal];if(e in n)return;const s=Symbol(e);n[e]={type:"service",builtin:r},this.ctx.root[L.isolate][e]=s,Nn(i)&&(this.ctx[L.store][s]={value:i,source:null},xe(i,L.tracker,{associate:e,property:"ctx"}))}_accessor(e,i){const r=this.ctx.root[L.internal];return e in r?()=>{}:(r[e]={type:"accessor",...i},()=>delete this.ctx.root[L.isolate][e])}accessor(e,i){this.ctx.scope.effect(()=>this._accessor(e,i))}alias(e,i){const r=this.ctx.root[L.internal];if(!(e in r))for(const n of i)r[n]||(r[n]={type:"alias",name:e})}_mixin(e,i){const r=Array.isArray(i)?i.map(o=>[o,o]):Object.entries(i),n=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const c=n(this);if(de(c))return c;const u=l?Ni(l,c):c,f=Reflect.get(c,o,u);return typeof f!="function"?f:f.bind(u??c)},set(l,c){const u=n(this),f=c?Ni(c,u):u;return Reflect.set(u,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,i){this.ctx.scope.effect(()=>this._mixin(e,i))}trace(e){return it(this.ctx,e)}bind(e){return new Proxy(e,{apply:W((i,r,n)=>i.apply(this.trace(r),n.map(s=>this.trace(s))),"apply")})}},W(Ke,"ReflectService"),j(Ke,"handler",{get:W((e,i,r)=>{if(typeof i!="string")return Reflect.get(e,i,r);if(Reflect.has(e,i))return it(r,Reflect.get(e,i,r),!0);const[n,s]=Ke.resolveInject(e,i),o=new Error(`property ${n} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[L.receiver]):(s.builtin||Ke.checkInject(r,n,o),r.reflect.get(n)):(Ke.checkInject(r,n,o),Reflect.get(e,n,r))},"get"),set:W((e,i,r,n)=>{if(typeof i!="string")return Reflect.set(e,i,r,n);const[s,o]=Ke.resolveInject(e,i);return o?o.type==="accessor"?o.set?o.set.call(n,r,n[L.receiver]):!1:(n.reflect.set(s,r),!0):Reflect.set(e,s,r,n)},"set"),has:W((e,i)=>{if(typeof i!="string")return Reflect.has(e,i);if(Reflect.has(e,i))return!0;const[,r]=Ke.resolveInject(e,i);return!!r},"has")}),Ke),Un=cf;function Fn(t){return t!==null&&t!==!1&&t!==void 0}W(Fn,"isBailed");var uf=(Pi=class{constructor(e){j(this,"isActive",!1);j(this,"_tasks",new Set);j(this,"_hooks",{});this.ctx=e,xe(this,L.tracker,{associate:"lifecycle",property:"ctx"}),xe(this.on("internal/listener",function(r,n,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>n()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](n),xe(n,"name","event <dispose>"),()=>At(this.scope.disposables,n);if(r==="fork")return this.scope.runtime.forkables[o](n),this.scope.collect("event <fork>",()=>At(this.scope.runtime.forkables,n))}),Ae.static,e.scope);for(const r of["info","error","warning"])xe(this.on(`internal/${r}`,(n,...s)=>{this._hooks[`internal/${r}`].length>1}),Ae.static,e.scope);xe(this.on("internal/before-service",function(r){for(const n of this.registry.values()){if(!n.inject[r]?.required)continue;const s=n.isReusable?n.children:[n];for(const o of s)this[L.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Ae.static,e.scope),xe(this.on("internal/service",function(r){for(const n of this.registry.values()){if(!n.inject[r]?.required)continue;const s=n.isReusable?n.children:[n];for(const o of s)this[L.filter](o.ctx)&&o.start()}},{global:!0}),Ae.static,e.scope);const i=W((r,n)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(n===Un.resolveInject(r.ctx,s)[0])return!0;return i(r.parent.scope,n)},"checkInject");xe(this.on("internal/inject",function(r){return i(this.scope,r)},{global:!0}),Ae.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,i){return i=it(this.ctx,i),e.slice().filter(r=>{const n=i?.[Ae.filter];return r.global||!n||n.call(i,r.ctx)})}*dispatch(e,i){const r=typeof i[0]=="object"||typeof i[0]=="function"?i.shift():null,n=i.shift();n!=="internal/event"&&this.emit("internal/event",e,n,i,r);for(const s of this.filterHooks(this._hooks[n]||[],r))yield s.callback.apply(r,i)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const i of this.dispatch("serial",e))if(Fn(i))return i}bail(...e){for(const i of this.dispatch("bail",e))if(Fn(i))return i}register(e,i,r,n){const s=n.prepend?"unshift":"push";return i[s]({ctx:this.ctx,callback:r,...n}),this.ctx.state.collect(e,()=>this.unregister(i,r))}unregister(e,i){const r=e.findIndex(n=>n.callback===i);if(r>=0)return e.splice(r,1),!0}on(e,i,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),i=this.ctx.reflect.bind(i);const n=this.bail(this.ctx,"internal/listener",e,i,r);if(n)return n;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,i,r)}once(e,i,r){const n=this.on(e,function(...s){return n(),i.apply(this,s)},r);return n}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:i,callback:r}=e.shift();i.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},W(Pi,"Lifecycle"),Pi),ff=uf,Bn=(ri=class extends Error{constructor(e,i){super(i??ri.Code[e]),this.code=e}},W(ri,"CordisError"),ri);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(Bn||(Bn={}));var Bo=(Ci=class{constructor(e,i){j(this,"uid");j(this,"ctx");j(this,"disposables",[]);j(this,"error");j(this,"status",0);j(this,"isActive",!1);j(this,"context");j(this,"proxy");j(this,"acceptors",[]);j(this,"tasks",new Set);j(this,"hasError",!1);this.parent=e,this.config=i,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:W((r,n)=>Reflect.get(this.config,n),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new Bn("INACTIVE_EFFECT")}effect(e,i){this.assertActive();const r=In(e)?new e(this.ctx,i):e(this.ctx,i);let n=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=W((...a)=>{if(!n)return n=!0,At(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,i){const r=xe(()=>(At(this.disposables,r),i()),"name",e);return this.disposables.push(r),r}restart(){this.reset(),this.error=null,this.hasError=!1,this.status=0,this.start()}_getStatus(){return this.uid===null?4:this.hasError?3:this.tasks.size?1:this.ready?2:0}updateStatus(e){const i=this.status;e?.(),this.status=this._getStatus(),i!==this.status&&this.context.emit("internal/status",this,i)}ensure(e){const i=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(i)),this.context.events._tasks.delete(i)});this.updateStatus(()=>this.tasks.add(i)),this.context.events._tasks.add(i)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,i])=>!i.required||!de(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Ae.static]===this)return!0;(async()=>e())().catch(i=>{this.context.emit(this.ctx,"internal/error",i)})})}init(e){this.config?this.start():this.cancel(e)}start(){if(!this.ready||this.isActive||this.uid===null)return!0;this.isActive=!0,this.updateStatus(()=>this.hasError=!1)}accept(...e){const r={keys:Array.isArray(e[0])?e.shift():null,callback:e[0],...e[1]};return this.effect(()=>(this.acceptors.push(r),r.immediate&&r.callback?.(this.config),()=>At(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,i){if(i||!this.config)return[!0,!0];if(i===!1)return[!1,!1];const r=Object.create(null),n=W(c=>{const u=r[c]??(r[c]=!Kt(this.config[c],e[c]));return o||(o=u),u},"checkPropertyUpdate"),s=new Set;let o=!1,a=!1,l=this.runtime.isReactive||null;for(const{keys:c,callback:u,passive:f}of this.acceptors){if(!c)l||(l=!f);else if(f)c?.forEach(b=>s.add(b));else{let b=!1;for(const g of c)b||(b=n(g));if(!b)continue}u?.(e)&&(a=!0)}for(const c in{...this.config,...e})if(l!==!1&&!(c in r)&&!s.has(c)){const u=n(c);l===null&&(a||(a=u))}return[o,a]}},W(Ci,"EffectScope"),Ci),hf=(Oi=class extends Bo{constructor(i,r,n,s){super(i,n);j(this,"dispose");this.runtime=r,this.dispose=xe(i.scope.collect(`fork <${i.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=At(r.disposables,this.dispose);return At(r.children,this)&&!r.children.length&&i.registry.delete(r.plugin),o}),Ae.static,r),r.children.push(this),r.disposables.push(this.dispose),this.context.emit("internal/fork",this),this.init(s)}start(){if(super.start())return!0;for(const i of this.runtime.forkables)this.ensure(async()=>i(this.context,this._config))}update(i,r){const n=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==n)return;let o;try{o=Li(this.runtime.plugin,i)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[a,l]=s.checkUpdate(o,r);this.context.emit("internal/before-update",this,i),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,n),l&&s.restart()}},W(Oi,"ForkScope"),Oi),qo=(Ai=class extends Bo{constructor(i,r,n,s){super(i,n);j(this,"value");j(this,"runtime",this);j(this,"schema");j(this,"name");j(this,"inject",Object.create(null));j(this,"forkables",[]);j(this,"children",[]);j(this,"isReusable",!1);j(this,"isReactive",!1);j(this,"apply",W((i,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(i,r);if(In(this.plugin)){const n=new this.plugin(i,r),s=n[Ae.expose];return s&&i.set(s,n),n.fork&&this.forkables.push(n.fork.bind(n)),n}else return this.plugin(i,r)},"apply"));this.plugin=r,r?(this.setup(),this.init(s)):(this.name="root",this.isActive=!0)}get isForkable(){return this.forkables.length>0}fork(i,r,n){return new hf(i,this,r,n)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:i}=this.plugin;i&&i!=="apply"&&(this.name=i),this.schema=this.plugin.Config||this.plugin.schema,this.inject=Se.resolve(this.plugin.using||this.plugin.inject),this.isReusable=this.plugin.reusable,this.isReactive=this.plugin.reactive,this.context.emit("internal/runtime",this),this.isReusable&&this.forkables.push(this.apply)}reset(){super.reset();for(const i of this.children)i.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const i of this.children)i.start()}update(i,r){if(this.isForkable){const c=new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);this.context.emit(this.ctx,"internal/warning",c)}const n=this.config;let s;try{s=Li(this.runtime.plugin||this.context.constructor,i)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[o,a]=this.checkUpdate(s,r),l=this.children.find(c=>c.config===n);this.config=s,l&&(this.context.emit("internal/before-update",l,i),l.config=s,o&&this.context.emit("internal/update",l,n)),a&&this.restart()}},W(Ai,"MainScope"),Ai);function Ho(t){return t&&typeof t=="object"&&typeof t.apply=="function"}W(Ho,"isApplicable");function Se(t){return function(e,i){if(i.kind==="class")e.inject=t;else if(i.kind==="method")i.addInitializer(function(){const r=this[L.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,n=>{e.call(Ni(this,{[r]:n}))})});else throw new Error("@Inject can only be used on class or class methods")}}W(Se,"Inject"),(t=>{function e(i){if(!i)return{};if(Array.isArray(i))return Object.fromEntries(i.map(o=>[o,{required:!0}]));const{required:r,optional:n,...s}=i;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(n)&&Object.assign(s,Object.fromEntries(n.map(o=>[o,{required:!1}]))),s}t.resolve=e,W(e,"resolve")})(Se||(Se={}));var df=(Ti=class{constructor(e,i){j(this,"_counter",0);j(this,"_internal",new Map);j(this,"context");this.ctx=e,xe(this,L.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new qo(e,null,i);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,i=!1){if(e===null||typeof e=="function")return e;if(Ho(e))return e.apply;if(i)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const i=this.resolve(e);return i&&this._internal.get(i)}has(e){const i=this.resolve(e);return!!i&&this._internal.has(i)}set(e,i){const r=this.resolve(e);this._internal.set(r,i)}delete(e){const i=this.resolve(e),r=i&&this._internal.get(i);if(r)return this._internal.delete(i),r.dispose(),r}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}using(e,i){return this.inject(e,i)}inject(e,i){return this.plugin({inject:e,apply:i,name:i.name})}plugin(e,i,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{i=Li(e,i)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,i=null}let n=this.get(e);return n?(n.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),n.fork(this.ctx,i,r)):(n=new qo(this.ctx,e,i,r),this.set(e,n),n.fork(this.ctx,i,r))}},W(Ti,"Registry"),Ti),pf=df,Ae=(me=class{static is(e){return!!e?.[me.is]}static associate(e,i){return e}constructor(e){e=Li(this.constructor,e),this[L.store]=Object.create(null),this[L.isolate]=Object.create(null),this[L.internal]=Object.create(null),this[L.intercept]=Object.create(null);const i=new Proxy(this,Un.handler);i.root=i,i.reflect=new Un(i),i.registry=new pf(i,e),i.lifecycle=new ff(i);const r=W(n=>{if(n){r(Object.getPrototypeOf(n));for(const s of Object.getOwnPropertyNames(n)){const o=n[s].prototype?.constructor;o&&(i[n[s].key]=new o(i,e),xe(i[n[s].key],"ctx",i))}}},"attach");return r(this[L.internal]),i}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.name}>`}get name(){let e=this.runtime;for(;e&&!e.name;)e=e.parent.runtime;return e?.name}get events(){return this.lifecycle}get state(){return this.scope}extend(e={}){const i=Reflect.getOwnPropertyDescriptor(this,L.shadow)?.value,r=Object.assign(Object.create(it(this,this)),e);return i?Object.assign(Object.create(r),{[L.shadow]:i}):r}isolate(e,i){const r=Object.create(this[L.isolate]);return r[e]=i??Symbol(e),this.extend({[L.isolate]:r})}intercept(e,i){const r=Object.create(this[L.intercept]);return r[e]=i,this.extend({[L.intercept]:r})}},W(me,"Context"),j(me,"store",L.store),j(me,"events",L.events),j(me,"static",L.static),j(me,"filter",L.filter),j(me,"expose",L.expose),j(me,"isolate",L.isolate),j(me,"internal",L.internal),j(me,"intercept",L.intercept),j(me,"origin","ctx"),j(me,"current","ctx"),me.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),me.prototype[me.is]=!0,me);Ae.prototype[Ae.internal]=Object.create(null);var _t=(qe=class{constructor(...e){j(this,"ctx");j(this,"name");j(this,"config");let i,r,n,s;Ae.is(e[0])?(i=e[0],typeof e[1]=="string"?(r=e[1],n=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[L.provide]),n??(n=this.constructor[L.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[L.invoke]&&(o=jn(r,Ln(Object.getPrototypeOf(this),Function.prototype),a)),i?o.ctx=i:o[L.setup](),o.name=r,o.config=s,xe(o,L.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,n&&(i?o[L.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),n||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[L.filter](e){return e[L.isolate][this.name]===this.ctx[L.isolate][this.name]}[L.setup](){this.ctx=new Ae}[L.extend](e){let i;return this[qe.invoke]?i=jn(this.name,this,this[L.tracker]):i=Object.create(this),Object.assign(i,e)}static[Symbol.hasInstance](e){let i=e.constructor;for(;i;){if(i=i.prototype?.constructor,i===this)return!0;i=Object.getPrototypeOf(i)}return!1}},W(qe,"Service"),j(qe,"setup",L.setup),j(qe,"invoke",L.invoke),j(qe,"extend",L.extend),j(qe,"tracker",L.tracker),j(qe,"provide",L.provide),j(qe,"immediate",L.immediate),qe),mf=Object.defineProperty,gf=Object.getOwnPropertyNames,Y=(t,e)=>mf(t,"name",{value:e,configurable:!0}),yf=(t,e)=>function(){return e||(0,t[gf(t)[0]])((e={exports:{}}).exports,e),e.exports},bf=yf({"src/index.ts"(t,e){var B;var i=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var n=(B=class extends TypeError{constructor(m,_){let x="$";for(const P of _.path||[])typeof P=="string"?x+="."+P:typeof P=="number"?x+="["+P+"]":typeof P=="symbol"&&(x+=`[Symbol(${P.toString()})]`);x.startsWith(".")&&(x=x.slice(1));super((x==="$"?"":`${x} `)+m);j(this,"name","ValidationError");this.options=_}static is(m){return!!m?.[r]}},Y(B,"ValidationError"),B);Object.defineProperty(n.prototype,r,{value:!0});var s=Y(function(p){const h=Y(function(m,_={}){return s.resolve(m,h,_)[0]},"schema");if(p.refs){const m=vt(p.refs,x=>new s(x)),_=Y(x=>m[x],"getRef");for(const x in m){const P=m[x];P.sKey=_(P.sKey),P.inner=_(P.inner),P.list=P.list&&P.list.map(_),P.dict=P.dict&&vt(P.dict,_)}return m[p.uid]}if(Object.assign(h,p),typeof h.callback=="string")try{h.callback=new Function("return "+h.callback)()}catch{}return Object.defineProperty(h,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(h,s.prototype),h.meta||(h.meta={}),h.toString=h.toString.bind(h),h},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[i]=!0,s.ValidationError=n;var o;s.prototype.toJSON=Y(function(){var m;if(o)return o[m=this.uid]??(o[m]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const h={uid:this.uid,refs:o};return o=void 0,h},"toJSON"),s.prototype.set=Y(function(h,m){return this.dict[h]=m,this},"set"),s.prototype.push=Y(function(h){return this.list.push(h),this},"push");function a(p,h){const m=typeof p=="string"?{"":p}:{...p};for(const _ in h){const x=h[_];x?.$description||x?.$desc?m[_]=x.$description||x.$desc:typeof x=="string"&&(m[_]=x)}return m}Y(a,"mergeDesc");function l(p){return p?.$value??p?.$inner}Y(l,"getInner");function c(p){return Io(p??{},h=>!h.startsWith("$"))}Y(c,"extractKeys"),s.prototype.i18n=Y(function(h){const m=s(this),_=a(m.meta.description,h);return Object.keys(_).length&&(m.meta.description=_),m.dict&&(m.dict=vt(m.dict,(x,P)=>x.i18n(vt(h,R=>l(R)?.[P]??R?.[P])))),m.list&&(m.list=m.list.map((x,P)=>x.i18n(vt(h,(R={})=>Array.isArray(l(R))?l(R)[P]:Array.isArray(R)?R[P]:c(R))))),m.inner&&(m.inner=m.inner.i18n(vt(h,x=>l(x)?l(x):c(x)))),m.sKey&&(m.sKey=m.sKey.i18n(vt(h,x=>x?.$key))),m},"i18n"),s.prototype.extra=Y(function(h,m){const _=s(this);return _.meta={..._.meta,[h]:m},_},"extra");for(const p of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[p](h=!0){const m=s(this);return m.meta={...m.meta,[p]:h},m}});s.prototype.deprecated=Y(function(){var m;const h=s(this);return(m=h.meta).badges||(m.badges=[]),h.meta.badges.push({text:"deprecated",type:"danger"}),h},"deprecated"),s.prototype.experimental=Y(function(){var m;const h=s(this);return(m=h.meta).badges||(m.badges=[]),h.meta.badges.push({text:"experimental",type:"warning"}),h},"experimental"),s.prototype.pattern=Y(function(h){const m=s(this),_=Lo(h,["source","flags"]);return m.meta={...m.meta,pattern:_},m},"pattern"),s.prototype.simplify=Y(function(h){if(Kt(h,this.meta.default,this.type==="dict"))return null;if(de(h))return h;if(this.type==="object"||this.type==="dict"){const m={};for(const _ in h){const P=(this.type==="object"?this.dict[_]:this.inner)?.simplify(h[_]);(this.type==="dict"||!de(P))&&(m[_]=P)}return Kt(m,this.meta.default,this.type==="dict")?null:m}else if(this.type==="array"||this.type==="tuple"){const m=[];return h.forEach((_,x)=>{const P=this.type==="array"?this.inner:this.list[x],R=P?P.simplify(_):_;m.push(R)}),m}else if(this.type==="intersect"){const m={};for(const _ of this.list)Object.assign(m,_.simplify(h));return m}else if(this.type==="union")for(const m of this.list)try{return s.resolve(h,m,{}),m.simplify(h)}catch{}return h},"simplify"),s.prototype.toString=Y(function(h){return D[this.type]?.(this,h)??`Schema<${this.type}>`},"toString"),s.prototype.role=Y(function(p,h){const m=s(this);return m.meta={...m.meta,role:p,extra:h},m},"role");for(const p of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[p](h){const m=s(this);return m.meta={...m.meta,[p]:h},m}});var u={};s.extend=Y(function(h,m){u[h]=m},"extend"),s.resolve=Y(function(h,m,_={},x=!1){if(!m)return[h];if(_.ignore?.(h,m))return[h];if(de(h)&&m.type!=="lazy"){if(m.meta.required)throw new n("missing required value",_);let R=m,F=m.meta.default;for(;R?.type==="intersect"&&de(F);)R=R.list[0],F=R?.meta.default;if(de(F))return[h];h=vr(F)}const P=u[m.type];if(!P)throw new n(`unsupported type "${m.type}"`,_);try{return P(h,m,_,x)}catch(R){if(!m.meta.loose)throw R;return[m.meta.default]}},"resolve"),s.from=Y(function(h){if(de(h))return s.any();if(["string","number","boolean"].includes(typeof h))return s.const(h).required();if(h[i])return h;if(typeof h=="function")switch(h){case String:return s.string().required();case Number:return s.number().required();case Boolean:return s.boolean().required();case Function:return s.function().required();default:return s.is(h).required()}else throw new TypeError(`cannot infer schema from ${h}`)},"from"),s.lazy=Y(function(h){const m=Y(()=>(_.inner[i]||(_.inner=_.builder(),_.inner.meta={..._.meta,..._.inner.meta}),_.inner.toJSON()),"toJSON"),_=new s({type:"lazy",builder:h,inner:{toJSON:m}});return _},"lazy"),s.natural=Y(function(){return s.number().step(1).min(0)},"natural"),s.percent=Y(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=Y(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(h,m)=>{const _=new Date(h);if(isNaN(+_))throw new n(`invalid date "${h}"`,m);return _},!0)])},"date"),s.regExp=Y(function(h=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:h}),(m,_)=>{try{return new RegExp(m,h)}catch(x){throw new n(x.message,_)}},!0)])},"regExp"),s.arrayBuffer=Y(function(h){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(m,_)=>{if(tt.isSource(m))return tt.fromSource(m);throw new n(`expected ArrayBufferSource but got ${m}`,_)},!0),...h?[s.transform(s.string(),(m,_)=>{try{return h==="base64"?tt.fromBase64(m):tt.fromHex(m)}catch(x){throw new n(x.message,_)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(p,h,m,_)=>(h.inner[i]||(h.inner=h.builder(),h.inner.meta={...h.meta,...h.inner.meta}),s.resolve(p,h.inner,m,_))),s.extend("any",p=>[p]),s.extend("never",(p,h,m)=>{throw new n(`expected nullable but got ${p}`,m)}),s.extend("const",(p,{value:h},m)=>{if(Kt(p,h))return[h];throw new n(`expected ${h} but got ${p}`,m)});function f(p,h,m,_,x=!1){const{max:P=1/0,min:R=-1/0}=h;if(p>P)throw new n(`expected ${m} <= ${P} but got ${p}`,_);if(p<R&&!x)throw new n(`expected ${m} >= ${R} but got ${p}`,_)}Y(f,"checkWithinRange"),s.extend("string",(p,{meta:h},m)=>{if(typeof p!="string")throw new n(`expected string but got ${p}`,m);if(h.pattern){const _=new RegExp(h.pattern.source,h.pattern.flags);if(!_.test(p))throw new n(`expect string to match regexp ${_}`,m)}return f(p.length,h,"string length",m),[p]});function d(p,h){const m=p.toString();if(m.includes("e"))return p*Math.pow(10,h);const _=m.indexOf(".");if(_===-1)return p*Math.pow(10,h);const x=m.slice(_+1),P=m.slice(0,_);return x.length<=h?+(P+x.padEnd(h,"0")):+(P+x.slice(0,h)+"."+x.slice(h))}Y(d,"decimalShift");function b(p,h,m){if(m=Math.abs(m),!/^\d+\.\d+$/.test(m.toString()))return(p-h)%m===0;const _=m.toString().indexOf("."),x=m.toString().slice(_+1).length;return Math.abs(d(p,x)-d(h,x))%d(m,x)===0}Y(b,"isMultipleOf"),s.extend("number",(p,{meta:h},m)=>{if(typeof p!="number")throw new n(`expected number but got ${p}`,m);f(p,h,"number",m);const{step:_}=h;if(_&&!b(p,h.min??0,_))throw new n(`expected number multiple of ${_} but got ${p}`,m);return[p]}),s.extend("boolean",(p,h,m)=>{if(typeof p=="boolean")return[p];throw new n(`expected boolean but got ${p}`,m)}),s.extend("bitset",(p,{bits:h,meta:m},_)=>{let x=0,P=[];if(typeof p=="number"){x=p;for(const R in h)p&h[R]&&P.push(R)}else if(Array.isArray(p)){P=p;for(const R of P){if(typeof R!="string")throw new n(`expected string but got ${R}`,_);R in h&&(x|=h[R])}}else throw new n(`expected number or array but got ${p}`,_);return x===m.default?[x]:[x,P]}),s.extend("function",(p,h,m)=>{if(typeof p=="function")return[p];throw new n(`expected function but got ${p}`,m)}),s.extend("is",(p,{constructor:h},m)=>{if(typeof h=="function"){if(p instanceof h)return[p];throw new n(`expected ${h.name} but got ${p}`,m)}else{if(de(p))throw new n(`expected ${h} but got ${p}`,m);let _=Object.getPrototypeOf(p);for(;_;){if(_.constructor?.name===h)return[p];_=Object.getPrototypeOf(_)}throw new n(`expected ${h} but got ${p}`,m)}});function g(p,h,m,_){try{const[x,P]=s.resolve(p[h],m,{..._,path:[..._.path||[],h]});return P!==void 0&&(p[h]=P),x}catch(x){if(!_?.autofix)throw x;return delete p[h],m.meta.default}}Y(g,"property"),s.extend("array",(p,{inner:h,meta:m},_)=>{if(!Array.isArray(p))throw new n(`expected array but got ${p}`,_);return f(p.length,m,"array length",_,!de(h.meta.default)),[p.map((x,P)=>g(p,P,h,_))]}),s.extend("dict",(p,{inner:h,sKey:m},_,x)=>{if(!wr(p))throw new n(`expected object but got ${p}`,_);const P={};for(const R in p){let F;try{F=s.resolve(R,m,_)[0]}catch(ge){if(x)continue;throw ge}P[F]=g(p,R,h,_),p[F]=p[R],R!==F&&delete p[R]}return[P]}),s.extend("tuple",(p,{list:h},m,_)=>{if(!Array.isArray(p))throw new n(`expected array but got ${p}`,m);const x=h.map((P,R)=>g(p,R,P,m));return _?[x]:(x.push(...p.slice(h.length)),[x])});function E(p,h){for(const m in h)m in p||(p[m]=h[m])}Y(E,"merge"),s.extend("object",(p,{dict:h},m,_)=>{if(!wr(p))throw new n(`expected object but got ${p}`,m);const x={};for(const P in h){const R=g(p,P,h[P],m);(!de(R)||P in p)&&(x[P]=R)}return _||E(x,p),[x]}),s.extend("union",(p,{list:h,toString:m},_,x)=>{for(const P of h)try{return s.resolve(p,P,_,x)}catch{}throw new n(`expected ${m()} but got ${JSON.stringify(p)}`,_)}),s.extend("intersect",(p,{list:h,toString:m},_,x)=>{if(!h.length)return[p];let P;for(const R of h){const F=s.resolve(p,R,_,!0)[0];if(!de(F))if(de(P))P=F;else{if(typeof P!=typeof F)throw new n(`expected ${m()} but got ${JSON.stringify(p)}`,_);if(typeof F=="object")E(P??(P={}),F);else if(P!==F)throw new n(`expected ${m()} but got ${JSON.stringify(p)}`,_)}}return!x&&wr(p)&&E(P,p),[P]}),s.extend("transform",(p,{inner:h,callback:m,preserve:_},x)=>{const[P,R=p]=s.resolve(p,h,x,!0);return _?[m(P)]:[m(P),m(R)]});var D={};function k(p,h,m){D[p]=m,Object.assign(s,{[p](..._){const x=new s({type:p});return h.forEach((P,R)=>{switch(P){case"sKey":x.sKey=_[R]??s.string();break;case"inner":x.inner=s.from(_[R]);break;case"list":x.list=_[R].map(s.from);break;case"dict":x.dict=vt(_[R],s.from);break;case"bits":{x.bits={};for(const F in _[R])typeof _[R][F]=="number"&&(x.bits[F]=_[R][F]);break}case"callback":{const F=x.callback=_[R];F.toJSON||(F.toJSON=()=>F.toString());break}case"constructor":{const F=x.constructor=_[R];typeof F=="function"&&(F.toJSON||(F.toJSON=()=>F.name));break}default:x[P]=_[R]}}),p==="object"||p==="dict"?x.meta.default={}:p==="array"||p==="tuple"?x.meta.default=[]:p==="bitset"&&(x.meta.default=0),x}})}Y(k,"defineMethod"),k("is",["constructor"],({constructor:p})=>typeof p=="function"?p.name:p),k("any",[],()=>"any"),k("never",[],()=>"never"),k("const",["value"],({value:p})=>typeof p=="string"?JSON.stringify(p):p),k("string",[],()=>"string"),k("number",[],()=>"number"),k("boolean",[],()=>"boolean"),k("bitset",["bits"],()=>"bitset"),k("function",[],()=>"function"),k("array",["inner"],({inner:p})=>`${p.toString(!0)}[]`),k("dict",["inner","sKey"],({inner:p,sKey:h})=>`{ [key: ${h.toString()}]: ${p.toString()} }`),k("tuple",["list"],({list:p})=>`[${p.map(h=>h.toString()).join(", ")}]`),k("object",["dict"],({dict:p})=>Object.keys(p).length===0?"{}":`{ ${Object.entries(p).map(([h,m])=>`${h}${m.meta.required?"":"?"}: ${m.toString()}`).join(", ")} }`),k("union",["list"],({list:p},h)=>{const m=p.map(({toString:_})=>_()).join(" | ");return h?`(${m})`:m}),k("intersect",["list"],({list:p})=>`${p.map(h=>h.toString(!0)).join(" & ")}`),k("transform",["inner","callback","preserve"],({inner:p},h)=>p.toString(h)),e.exports=s}});const re=bf();/**
|
|
3
|
+
`),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[L.internal][e]?.type!=="service")return;const r=this.ctx[L.isolate][e],n=this.ctx[L.store][r]?.value;return ct(this.ctx,n)}set(e,i){this.provide(e);const r=this.ctx[L.isolate][e],n=this.ctx[L.store][r]?.value;i??(i=void 0);let s=W(()=>{},"dispose");if(n===i)return s;if(!me(i)&&!me(n))throw new Error(`service ${e} has been registered`);const o=this.ctx;me(i)||(s=o.effect(()=>()=>{o.set(e,void 0)})),Uo(i)&&o.emit(o,"internal/warning",new Error(`service ${e} is an unproxyable object, which may lead to unexpected behavior`));const a=Object.create(o);return a[L.filter]=l=>o[L.isolate][e]===l[L.isolate][e],o.emit(a,"internal/before-service",e,i),o[L.store][r]={value:i,source:o},o.emit(a,"internal/service",e,n),s}provide(e,i,r){const n=this.ctx.root[L.internal];if(e in n)return;const s=Symbol(e);n[e]={type:"service",builtin:r},this.ctx.root[L.isolate][e]=s,Ln(i)&&(this.ctx[L.store][s]={value:i,source:null},Ce(i,L.tracker,{associate:e,property:"ctx"}))}_accessor(e,i){const r=this.ctx.root[L.internal];return e in r?()=>{}:(r[e]={type:"accessor",...i},()=>delete this.ctx.root[L.isolate][e])}accessor(e,i){this.ctx.scope.effect(()=>this._accessor(e,i))}alias(e,i){const r=this.ctx.root[L.internal];if(!(e in r))for(const n of i)r[n]||(r[n]={type:"alias",name:e})}_mixin(e,i){const r=Array.isArray(i)?i.map(o=>[o,o]):Object.entries(i),n=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const c=n(this);if(me(c))return c;const u=l?Li(l,c):c,f=Reflect.get(c,o,u);return typeof f!="function"?f:f.bind(u??c)},set(l,c){const u=n(this),f=c?Li(c,u):u;return Reflect.set(u,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,i){this.ctx.scope.effect(()=>this._mixin(e,i))}trace(e){return ct(this.ctx,e)}bind(e){return new Proxy(e,{apply:W((i,r,n)=>i.apply(this.trace(r),n.map(s=>this.trace(s))),"apply")})}},W(et,"ReflectService"),M(et,"handler",{get:W((e,i,r)=>{if(typeof i!="string")return Reflect.get(e,i,r);if(Reflect.has(e,i))return ct(r,Reflect.get(e,i,r),!0);const[n,s]=et.resolveInject(e,i),o=new Error(`property ${n} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[L.receiver]):(s.builtin||et.checkInject(r,n,o),r.reflect.get(n)):(et.checkInject(r,n,o),Reflect.get(e,n,r))},"get"),set:W((e,i,r,n)=>{if(typeof i!="string")return Reflect.set(e,i,r,n);const[s,o]=et.resolveInject(e,i);return o?o.type==="accessor"?o.set?o.set.call(n,r,n[L.receiver]):!1:(n.reflect.set(s,r),!0):Reflect.set(e,s,r,n)},"set"),has:W((e,i)=>{if(typeof i!="string")return Reflect.has(e,i);if(Reflect.has(e,i))return!0;const[,r]=et.resolveInject(e,i);return!!r},"has")}),et),jn=gf;function Un(t){return t!==null&&t!==!1&&t!==void 0}W(Un,"isBailed");var yf=($i=class{constructor(e){M(this,"isActive",!1);M(this,"_tasks",new Set);M(this,"_hooks",{});this.ctx=e,Ce(this,L.tracker,{associate:"lifecycle",property:"ctx"}),Ce(this.on("internal/listener",function(r,n,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>n()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](n),Ce(n,"name","event <dispose>"),()=>Nt(this.scope.disposables,n);if(r==="fork")return this.scope.runtime.forkables[o](n),this.scope.collect("event <fork>",()=>Nt(this.scope.runtime.forkables,n))}),Ne.static,e.scope);for(const r of["info","error","warning"])Ce(this.on(`internal/${r}`,(n,...s)=>{this._hooks[`internal/${r}`].length>1}),Ne.static,e.scope);Ce(this.on("internal/before-service",function(r){for(const n of this.registry.values()){if(!n.inject[r]?.required)continue;const s=n.isReusable?n.children:[n];for(const o of s)this[L.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Ne.static,e.scope),Ce(this.on("internal/service",function(r){for(const n of this.registry.values()){if(!n.inject[r]?.required)continue;const s=n.isReusable?n.children:[n];for(const o of s)this[L.filter](o.ctx)&&o.start()}},{global:!0}),Ne.static,e.scope);const i=W((r,n)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(n===jn.resolveInject(r.ctx,s)[0])return!0;return i(r.parent.scope,n)},"checkInject");Ce(this.on("internal/inject",function(r){return i(this.scope,r)},{global:!0}),Ne.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,i){return i=ct(this.ctx,i),e.slice().filter(r=>{const n=i?.[Ne.filter];return r.global||!n||n.call(i,r.ctx)})}*dispatch(e,i){const r=typeof i[0]=="object"||typeof i[0]=="function"?i.shift():null,n=i.shift();n!=="internal/event"&&this.emit("internal/event",e,n,i,r);for(const s of this.filterHooks(this._hooks[n]||[],r))yield s.callback.apply(r,i)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const i of this.dispatch("serial",e))if(Un(i))return i}bail(...e){for(const i of this.dispatch("bail",e))if(Un(i))return i}register(e,i,r,n){const s=n.prepend?"unshift":"push";return i[s]({ctx:this.ctx,callback:r,...n}),this.ctx.state.collect(e,()=>this.unregister(i,r))}unregister(e,i){const r=e.findIndex(n=>n.callback===i);if(r>=0)return e.splice(r,1),!0}on(e,i,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),i=this.ctx.reflect.bind(i);const n=this.bail(this.ctx,"internal/listener",e,i,r);if(n)return n;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,i,r)}once(e,i,r){const n=this.on(e,function(...s){return n(),i.apply(this,s)},r);return n}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:i,callback:r}=e.shift();i.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},W($i,"Lifecycle"),$i),bf=yf,Fn=(ni=class extends Error{constructor(e,i){super(i??ni.Code[e]),this.code=e}},W(ni,"CordisError"),ni);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(Fn||(Fn={}));var Bo=(Pi=class{constructor(e,i){M(this,"uid");M(this,"ctx");M(this,"disposables",[]);M(this,"error");M(this,"status",0);M(this,"isActive",!1);M(this,"context");M(this,"proxy");M(this,"acceptors",[]);M(this,"tasks",new Set);M(this,"hasError",!1);this.parent=e,this.config=i,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:W((r,n)=>Reflect.get(this.config,n),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new Fn("INACTIVE_EFFECT")}effect(e,i){this.assertActive();const r=An(e)?new e(this.ctx,i):e(this.ctx,i);let n=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=W((...a)=>{if(!n)return n=!0,Nt(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,i){const r=Ce(()=>(Nt(this.disposables,r),i()),"name",e);return this.disposables.push(r),r}restart(){this.reset(),this.error=null,this.hasError=!1,this.status=0,this.start()}_getStatus(){return this.uid===null?4:this.hasError?3:this.tasks.size?1:this.ready?2:0}updateStatus(e){const i=this.status;e?.(),this.status=this._getStatus(),i!==this.status&&this.context.emit("internal/status",this,i)}ensure(e){const i=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(i)),this.context.events._tasks.delete(i)});this.updateStatus(()=>this.tasks.add(i)),this.context.events._tasks.add(i)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,i])=>!i.required||!me(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Ne.static]===this)return!0;(async()=>e())().catch(i=>{this.context.emit(this.ctx,"internal/error",i)})})}init(e){this.config?this.start():this.cancel(e)}start(){if(!this.ready||this.isActive||this.uid===null)return!0;this.isActive=!0,this.updateStatus(()=>this.hasError=!1)}accept(...e){const r={keys:Array.isArray(e[0])?e.shift():null,callback:e[0],...e[1]};return this.effect(()=>(this.acceptors.push(r),r.immediate&&r.callback?.(this.config),()=>Nt(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,i){if(i||!this.config)return[!0,!0];if(i===!1)return[!1,!1];const r=Object.create(null),n=W(c=>{const u=r[c]??(r[c]=!Vt(this.config[c],e[c]));return o||(o=u),u},"checkPropertyUpdate"),s=new Set;let o=!1,a=!1,l=this.runtime.isReactive||null;for(const{keys:c,callback:u,passive:f}of this.acceptors){if(!c)l||(l=!f);else if(f)c?.forEach(y=>s.add(y));else{let y=!1;for(const m of c)y||(y=n(m));if(!y)continue}u?.(e)&&(a=!0)}for(const c in{...this.config,...e})if(l!==!1&&!(c in r)&&!s.has(c)){const u=n(c);l===null&&(a||(a=u))}return[o,a]}},W(Pi,"EffectScope"),Pi),wf=(Ci=class extends Bo{constructor(i,r,n,s){super(i,n);M(this,"dispose");this.runtime=r,this.dispose=Ce(i.scope.collect(`fork <${i.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=Nt(r.disposables,this.dispose);return Nt(r.children,this)&&!r.children.length&&i.registry.delete(r.plugin),o}),Ne.static,r),r.children.push(this),r.disposables.push(this.dispose),this.context.emit("internal/fork",this),this.init(s)}start(){if(super.start())return!0;for(const i of this.runtime.forkables)this.ensure(async()=>i(this.context,this._config))}update(i,r){const n=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==n)return;let o;try{o=Ri(this.runtime.plugin,i)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[a,l]=s.checkUpdate(o,r);this.context.emit("internal/before-update",this,i),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,n),l&&s.restart()}},W(Ci,"ForkScope"),Ci),qo=(Oi=class extends Bo{constructor(i,r,n,s){super(i,n);M(this,"value");M(this,"runtime",this);M(this,"schema");M(this,"name");M(this,"inject",Object.create(null));M(this,"forkables",[]);M(this,"children",[]);M(this,"isReusable",!1);M(this,"isReactive",!1);M(this,"apply",W((i,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(i,r);if(An(this.plugin)){const n=new this.plugin(i,r),s=n[Ne.expose];return s&&i.set(s,n),n.fork&&this.forkables.push(n.fork.bind(n)),n}else return this.plugin(i,r)},"apply"));this.plugin=r,r?(this.setup(),this.init(s)):(this.name="root",this.isActive=!0)}get isForkable(){return this.forkables.length>0}fork(i,r,n){return new wf(i,this,r,n)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:i}=this.plugin;i&&i!=="apply"&&(this.name=i),this.schema=this.plugin.Config||this.plugin.schema,this.inject=ke.resolve(this.plugin.using||this.plugin.inject),this.isReusable=this.plugin.reusable,this.isReactive=this.plugin.reactive,this.context.emit("internal/runtime",this),this.isReusable&&this.forkables.push(this.apply)}reset(){super.reset();for(const i of this.children)i.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const i of this.children)i.start()}update(i,r){if(this.isForkable){const c=new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);this.context.emit(this.ctx,"internal/warning",c)}const n=this.config;let s;try{s=Ri(this.runtime.plugin||this.context.constructor,i)}catch(c){return this.context.emit("internal/error",c),this.cancel(c)}const[o,a]=this.checkUpdate(s,r),l=this.children.find(c=>c.config===n);this.config=s,l&&(this.context.emit("internal/before-update",l,i),l.config=s,o&&this.context.emit("internal/update",l,n)),a&&this.restart()}},W(Oi,"MainScope"),Oi);function Ho(t){return t&&typeof t=="object"&&typeof t.apply=="function"}W(Ho,"isApplicable");function ke(t){return function(e,i){if(i.kind==="class")e.inject=t;else if(i.kind==="method")i.addInitializer(function(){const r=this[L.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,n=>{e.call(Li(this,{[r]:n}))})});else throw new Error("@Inject can only be used on class or class methods")}}W(ke,"Inject"),(t=>{function e(i){if(!i)return{};if(Array.isArray(i))return Object.fromEntries(i.map(o=>[o,{required:!0}]));const{required:r,optional:n,...s}=i;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(n)&&Object.assign(s,Object.fromEntries(n.map(o=>[o,{required:!1}]))),s}t.resolve=e,W(e,"resolve")})(ke||(ke={}));var vf=(Ti=class{constructor(e,i){M(this,"_counter",0);M(this,"_internal",new Map);M(this,"context");this.ctx=e,Ce(this,L.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new qo(e,null,i);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,i=!1){if(e===null||typeof e=="function")return e;if(Ho(e))return e.apply;if(i)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const i=this.resolve(e);return i&&this._internal.get(i)}has(e){const i=this.resolve(e);return!!i&&this._internal.has(i)}set(e,i){const r=this.resolve(e);this._internal.set(r,i)}delete(e){const i=this.resolve(e),r=i&&this._internal.get(i);if(r)return this._internal.delete(i),r.dispose(),r}keys(){return this._internal.keys()}values(){return this._internal.values()}entries(){return this._internal.entries()}forEach(e){return this._internal.forEach(e)}using(e,i){return this.inject(e,i)}inject(e,i){return this.plugin({inject:e,apply:i,name:i.name})}plugin(e,i,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{i=Ri(e,i)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,i=null}let n=this.get(e);return n?(n.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),n.fork(this.ctx,i,r)):(n=new qo(this.ctx,e,i,r),this.set(e,n),n.fork(this.ctx,i,r))}},W(Ti,"Registry"),Ti),_f=vf,Ne=(we=class{static is(e){return!!e?.[we.is]}static associate(e,i){return e}constructor(e){e=Ri(this.constructor,e),this[L.store]=Object.create(null),this[L.isolate]=Object.create(null),this[L.internal]=Object.create(null),this[L.intercept]=Object.create(null);const i=new Proxy(this,jn.handler);i.root=i,i.reflect=new jn(i),i.registry=new _f(i,e),i.lifecycle=new bf(i);const r=W(n=>{if(n){r(Object.getPrototypeOf(n));for(const s of Object.getOwnPropertyNames(n)){const o=n[s].prototype?.constructor;o&&(i[n[s].key]=new o(i,e),Ce(i[n[s].key],"ctx",i))}}},"attach");return r(this[L.internal]),i}[Symbol.for("nodejs.util.inspect.custom")](){return`Context <${this.name}>`}get name(){let e=this.runtime;for(;e&&!e.name;)e=e.parent.runtime;return e?.name}get events(){return this.lifecycle}get state(){return this.scope}extend(e={}){const i=Reflect.getOwnPropertyDescriptor(this,L.shadow)?.value,r=Object.assign(Object.create(ct(this,this)),e);return i?Object.assign(Object.create(r),{[L.shadow]:i}):r}isolate(e,i){const r=Object.create(this[L.isolate]);return r[e]=i??Symbol(e),this.extend({[L.isolate]:r})}intercept(e,i){const r=Object.create(this[L.intercept]);return r[e]=i,this.extend({[L.intercept]:r})}},W(we,"Context"),M(we,"store",L.store),M(we,"events",L.events),M(we,"static",L.static),M(we,"filter",L.filter),M(we,"expose",L.expose),M(we,"isolate",L.isolate),M(we,"internal",L.internal),M(we,"intercept",L.intercept),M(we,"origin","ctx"),M(we,"current","ctx"),we.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),we.prototype[we.is]=!0,we);Ne.prototype[Ne.internal]=Object.create(null);var $t=(Ge=class{constructor(...e){M(this,"ctx");M(this,"name");M(this,"config");let i,r,n,s;Ne.is(e[0])?(i=e[0],typeof e[1]=="string"?(r=e[1],n=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[L.provide]),n??(n=this.constructor[L.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[L.invoke]&&(o=Dn(r,Rn(Object.getPrototypeOf(this),Function.prototype),a)),i?o.ctx=i:o[L.setup](),o.name=r,o.config=s,Ce(o,L.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,n&&(i?o[L.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),n||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[L.filter](e){return e[L.isolate][this.name]===this.ctx[L.isolate][this.name]}[L.setup](){this.ctx=new Ne}[L.extend](e){let i;return this[Ge.invoke]?i=Dn(this.name,this,this[L.tracker]):i=Object.create(this),Object.assign(i,e)}static[Symbol.hasInstance](e){let i=e.constructor;for(;i;){if(i=i.prototype?.constructor,i===this)return!0;i=Object.getPrototypeOf(i)}return!1}},W(Ge,"Service"),M(Ge,"setup",L.setup),M(Ge,"invoke",L.invoke),M(Ge,"extend",L.extend),M(Ge,"tracker",L.tracker),M(Ge,"provide",L.provide),M(Ge,"immediate",L.immediate),Ge),xf=Object.defineProperty,Sf=Object.getOwnPropertyNames,X=(t,e)=>xf(t,"name",{value:e,configurable:!0}),kf=(t,e)=>function(){return e||(0,t[Sf(t)[0]])((e={exports:{}}).exports,e),e.exports},Ef=kf({"src/index.ts"(t,e){var F;var i=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var n=(F=class extends TypeError{constructor(p,v){let x="$";for(const P of v.path||[])typeof P=="string"?x+="."+P:typeof P=="number"?x+="["+P+"]":typeof P=="symbol"&&(x+=`[Symbol(${P.toString()})]`);x.startsWith(".")&&(x=x.slice(1));super((x==="$"?"":`${x} `)+p);M(this,"name","ValidationError");this.options=v}static is(p){return!!p?.[r]}},X(F,"ValidationError"),F);Object.defineProperty(n.prototype,r,{value:!0});var s=X(function(b){const h=X(function(p,v={}){return s.resolve(p,h,v)[0]},"schema");if(b.refs){const p=Et(b.refs,x=>new s(x)),v=X(x=>p[x],"getRef");for(const x in p){const P=p[x];P.sKey=v(P.sKey),P.inner=v(P.inner),P.list=P.list&&P.list.map(v),P.dict=P.dict&&Et(P.dict,v)}return p[b.uid]}if(Object.assign(h,b),typeof h.callback=="string")try{h.callback=new Function("return "+h.callback)()}catch{}return Object.defineProperty(h,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(h,s.prototype),h.meta||(h.meta={}),h.toString=h.toString.bind(h),h},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[i]=!0,s.ValidationError=n;var o;s.prototype.toJSON=X(function(){var p;if(o)return o[p=this.uid]??(o[p]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const h={uid:this.uid,refs:o};return o=void 0,h},"toJSON"),s.prototype.set=X(function(h,p){return this.dict[h]=p,this},"set"),s.prototype.push=X(function(h){return this.list.push(h),this},"push");function a(b,h){const p=typeof b=="string"?{"":b}:{...b};for(const v in h){const x=h[v];x?.$description||x?.$desc?p[v]=x.$description||x.$desc:typeof x=="string"&&(p[v]=x)}return p}X(a,"mergeDesc");function l(b){return b?.$value??b?.$inner}X(l,"getInner");function c(b){return Ro(b??{},h=>!h.startsWith("$"))}X(c,"extractKeys"),s.prototype.i18n=X(function(h){const p=s(this),v=a(p.meta.description,h);return Object.keys(v).length&&(p.meta.description=v),p.dict&&(p.dict=Et(p.dict,(x,P)=>x.i18n(Et(h,R=>l(R)?.[P]??R?.[P])))),p.list&&(p.list=p.list.map((x,P)=>x.i18n(Et(h,(R={})=>Array.isArray(l(R))?l(R)[P]:Array.isArray(R)?R[P]:c(R))))),p.inner&&(p.inner=p.inner.i18n(Et(h,x=>l(x)?l(x):c(x)))),p.sKey&&(p.sKey=p.sKey.i18n(Et(h,x=>x?.$key))),p},"i18n"),s.prototype.extra=X(function(h,p){const v=s(this);return v.meta={...v.meta,[h]:p},v},"extra");for(const b of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[b](h=!0){const p=s(this);return p.meta={...p.meta,[b]:h},p}});s.prototype.deprecated=X(function(){var p;const h=s(this);return(p=h.meta).badges||(p.badges=[]),h.meta.badges.push({text:"deprecated",type:"danger"}),h},"deprecated"),s.prototype.experimental=X(function(){var p;const h=s(this);return(p=h.meta).badges||(p.badges=[]),h.meta.badges.push({text:"experimental",type:"warning"}),h},"experimental"),s.prototype.pattern=X(function(h){const p=s(this),v=Lo(h,["source","flags"]);return p.meta={...p.meta,pattern:v},p},"pattern"),s.prototype.simplify=X(function(h){if(Vt(h,this.meta.default,this.type==="dict"))return null;if(me(h))return h;if(this.type==="object"||this.type==="dict"){const p={};for(const v in h){const P=(this.type==="object"?this.dict[v]:this.inner)?.simplify(h[v]);(this.type==="dict"||!me(P))&&(p[v]=P)}return Vt(p,this.meta.default,this.type==="dict")?null:p}else if(this.type==="array"||this.type==="tuple"){const p=[];return h.forEach((v,x)=>{const P=this.type==="array"?this.inner:this.list[x],R=P?P.simplify(v):v;p.push(R)}),p}else if(this.type==="intersect"){const p={};for(const v of this.list)Object.assign(p,v.simplify(h));return p}else if(this.type==="union")for(const p of this.list)try{return s.resolve(h,p,{}),p.simplify(h)}catch{}return h},"simplify"),s.prototype.toString=X(function(h){return j[this.type]?.(this,h)??`Schema<${this.type}>`},"toString"),s.prototype.role=X(function(b,h){const p=s(this);return p.meta={...p.meta,role:b,extra:h},p},"role");for(const b of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[b](h){const p=s(this);return p.meta={...p.meta,[b]:h},p}});var u={};s.extend=X(function(h,p){u[h]=p},"extend"),s.resolve=X(function(h,p,v={},x=!1){if(!p)return[h];if(v.ignore?.(h,p))return[h];if(me(h)&&p.type!=="lazy"){if(p.meta.required)throw new n("missing required value",v);let R=p,B=p.meta.default;for(;R?.type==="intersect"&&me(B);)R=R.list[0],B=R?.meta.default;if(me(B))return[h];h=wr(B)}const P=u[p.type];if(!P)throw new n(`unsupported type "${p.type}"`,v);try{return P(h,p,v,x)}catch(R){if(!p.meta.loose)throw R;return[p.meta.default]}},"resolve"),s.from=X(function(h){if(me(h))return s.any();if(["string","number","boolean"].includes(typeof h))return s.const(h).required();if(h[i])return h;if(typeof h=="function")switch(h){case String:return s.string().required();case Number:return s.number().required();case Boolean:return s.boolean().required();case Function:return s.function().required();default:return s.is(h).required()}else throw new TypeError(`cannot infer schema from ${h}`)},"from"),s.lazy=X(function(h){const p=X(()=>(v.inner[i]||(v.inner=v.builder(),v.inner.meta={...v.meta,...v.inner.meta}),v.inner.toJSON()),"toJSON"),v=new s({type:"lazy",builder:h,inner:{toJSON:p}});return v},"lazy"),s.natural=X(function(){return s.number().step(1).min(0)},"natural"),s.percent=X(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=X(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(h,p)=>{const v=new Date(h);if(isNaN(+v))throw new n(`invalid date "${h}"`,p);return v},!0)])},"date"),s.regExp=X(function(h=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:h}),(p,v)=>{try{return new RegExp(p,h)}catch(x){throw new n(x.message,v)}},!0)])},"regExp"),s.arrayBuffer=X(function(h){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(p,v)=>{if(lt.isSource(p))return lt.fromSource(p);throw new n(`expected ArrayBufferSource but got ${p}`,v)},!0),...h?[s.transform(s.string(),(p,v)=>{try{return h==="base64"?lt.fromBase64(p):lt.fromHex(p)}catch(x){throw new n(x.message,v)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(b,h,p,v)=>(h.inner[i]||(h.inner=h.builder(),h.inner.meta={...h.meta,...h.inner.meta}),s.resolve(b,h.inner,p,v))),s.extend("any",b=>[b]),s.extend("never",(b,h,p)=>{throw new n(`expected nullable but got ${b}`,p)}),s.extend("const",(b,{value:h},p)=>{if(Vt(b,h))return[h];throw new n(`expected ${h} but got ${b}`,p)});function f(b,h,p,v,x=!1){const{max:P=1/0,min:R=-1/0}=h;if(b>P)throw new n(`expected ${p} <= ${P} but got ${b}`,v);if(b<R&&!x)throw new n(`expected ${p} >= ${R} but got ${b}`,v)}X(f,"checkWithinRange"),s.extend("string",(b,{meta:h},p)=>{if(typeof b!="string")throw new n(`expected string but got ${b}`,p);if(h.pattern){const v=new RegExp(h.pattern.source,h.pattern.flags);if(!v.test(b))throw new n(`expect string to match regexp ${v}`,p)}return f(b.length,h,"string length",p),[b]});function d(b,h){const p=b.toString();if(p.includes("e"))return b*Math.pow(10,h);const v=p.indexOf(".");if(v===-1)return b*Math.pow(10,h);const x=p.slice(v+1),P=p.slice(0,v);return x.length<=h?+(P+x.padEnd(h,"0")):+(P+x.slice(0,h)+"."+x.slice(h))}X(d,"decimalShift");function y(b,h,p){if(p=Math.abs(p),!/^\d+\.\d+$/.test(p.toString()))return(b-h)%p===0;const v=p.toString().indexOf("."),x=p.toString().slice(v+1).length;return Math.abs(d(b,x)-d(h,x))%d(p,x)===0}X(y,"isMultipleOf"),s.extend("number",(b,{meta:h},p)=>{if(typeof b!="number")throw new n(`expected number but got ${b}`,p);f(b,h,"number",p);const{step:v}=h;if(v&&!y(b,h.min??0,v))throw new n(`expected number multiple of ${v} but got ${b}`,p);return[b]}),s.extend("boolean",(b,h,p)=>{if(typeof b=="boolean")return[b];throw new n(`expected boolean but got ${b}`,p)}),s.extend("bitset",(b,{bits:h,meta:p},v)=>{let x=0,P=[];if(typeof b=="number"){x=b;for(const R in h)b&h[R]&&P.push(R)}else if(Array.isArray(b)){P=b;for(const R of P){if(typeof R!="string")throw new n(`expected string but got ${R}`,v);R in h&&(x|=h[R])}}else throw new n(`expected number or array but got ${b}`,v);return x===p.default?[x]:[x,P]}),s.extend("function",(b,h,p)=>{if(typeof b=="function")return[b];throw new n(`expected function but got ${b}`,p)}),s.extend("is",(b,{constructor:h},p)=>{if(typeof h=="function"){if(b instanceof h)return[b];throw new n(`expected ${h.name} but got ${b}`,p)}else{if(me(b))throw new n(`expected ${h} but got ${b}`,p);let v=Object.getPrototypeOf(b);for(;v;){if(v.constructor?.name===h)return[b];v=Object.getPrototypeOf(v)}throw new n(`expected ${h} but got ${b}`,p)}});function m(b,h,p,v){try{const[x,P]=s.resolve(b[h],p,{...v,path:[...v.path||[],h]});return P!==void 0&&(b[h]=P),x}catch(x){if(!v?.autofix)throw x;return delete b[h],p.meta.default}}X(m,"property"),s.extend("array",(b,{inner:h,meta:p},v)=>{if(!Array.isArray(b))throw new n(`expected array but got ${b}`,v);return f(b.length,p,"array length",v,!me(h.meta.default)),[b.map((x,P)=>m(b,P,h,v))]}),s.extend("dict",(b,{inner:h,sKey:p},v,x)=>{if(!br(b))throw new n(`expected object but got ${b}`,v);const P={};for(const R in b){let B;try{B=s.resolve(R,p,v)[0]}catch(Pe){if(x)continue;throw Pe}P[B]=m(b,R,h,v),b[B]=b[R],R!==B&&delete b[R]}return[P]}),s.extend("tuple",(b,{list:h},p,v)=>{if(!Array.isArray(b))throw new n(`expected array but got ${b}`,p);const x=h.map((P,R)=>m(b,R,P,p));return v?[x]:(x.push(...b.slice(h.length)),[x])});function E(b,h){for(const p in h)p in b||(b[p]=h[p])}X(E,"merge"),s.extend("object",(b,{dict:h},p,v)=>{if(!br(b))throw new n(`expected object but got ${b}`,p);const x={};for(const P in h){const R=m(b,P,h[P],p);(!me(R)||P in b)&&(x[P]=R)}return v||E(x,b),[x]}),s.extend("union",(b,{list:h,toString:p},v,x)=>{for(const P of h)try{return s.resolve(b,P,v,x)}catch{}throw new n(`expected ${p()} but got ${JSON.stringify(b)}`,v)}),s.extend("intersect",(b,{list:h,toString:p},v,x)=>{if(!h.length)return[b];let P;for(const R of h){const B=s.resolve(b,R,v,!0)[0];if(!me(B))if(me(P))P=B;else{if(typeof P!=typeof B)throw new n(`expected ${p()} but got ${JSON.stringify(b)}`,v);if(typeof B=="object")E(P??(P={}),B);else if(P!==B)throw new n(`expected ${p()} but got ${JSON.stringify(b)}`,v)}}return!x&&br(b)&&E(P,b),[P]}),s.extend("transform",(b,{inner:h,callback:p,preserve:v},x)=>{const[P,R=b]=s.resolve(b,h,x,!0);return v?[p(P)]:[p(P),p(R)]});var j={};function k(b,h,p){j[b]=p,Object.assign(s,{[b](...v){const x=new s({type:b});return h.forEach((P,R)=>{switch(P){case"sKey":x.sKey=v[R]??s.string();break;case"inner":x.inner=s.from(v[R]);break;case"list":x.list=v[R].map(s.from);break;case"dict":x.dict=Et(v[R],s.from);break;case"bits":{x.bits={};for(const B in v[R])typeof v[R][B]=="number"&&(x.bits[B]=v[R][B]);break}case"callback":{const B=x.callback=v[R];B.toJSON||(B.toJSON=()=>B.toString());break}case"constructor":{const B=x.constructor=v[R];typeof B=="function"&&(B.toJSON||(B.toJSON=()=>B.name));break}default:x[P]=v[R]}}),b==="object"||b==="dict"?x.meta.default={}:b==="array"||b==="tuple"?x.meta.default=[]:b==="bitset"&&(x.meta.default=0),x}})}X(k,"defineMethod"),k("is",["constructor"],({constructor:b})=>typeof b=="function"?b.name:b),k("any",[],()=>"any"),k("never",[],()=>"never"),k("const",["value"],({value:b})=>typeof b=="string"?JSON.stringify(b):b),k("string",[],()=>"string"),k("number",[],()=>"number"),k("boolean",[],()=>"boolean"),k("bitset",["bits"],()=>"bitset"),k("function",[],()=>"function"),k("array",["inner"],({inner:b})=>`${b.toString(!0)}[]`),k("dict",["inner","sKey"],({inner:b,sKey:h})=>`{ [key: ${h.toString()}]: ${b.toString()} }`),k("tuple",["list"],({list:b})=>`[${b.map(h=>h.toString()).join(", ")}]`),k("object",["dict"],({dict:b})=>Object.keys(b).length===0?"{}":`{ ${Object.entries(b).map(([h,p])=>`${h}${p.meta.required?"":"?"}: ${p.toString()}`).join(", ")} }`),k("union",["list"],({list:b},h)=>{const p=b.map(({toString:v})=>v()).join(" | ");return h?`(${p})`:p}),k("intersect",["list"],({list:b})=>`${b.map(h=>h.toString(!0)).join(" & ")}`),k("transform",["inner","callback","preserve"],({inner:b},h)=>b.toString(h)),e.exports=s}});const te=Ef();/**
|
|
4
4
|
* @inpageedit/logger
|
|
5
5
|
*
|
|
6
6
|
* Flexible, Extensible Console Logger with Colored Labels and Hierarchical Loggers
|
|
7
7
|
*
|
|
8
8
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
9
9
|
* @license MIT
|
|
10
|
-
*/var
|
|
10
|
+
*/var Bn=(t=>(t[t.debug=-1]="debug",t[t.log=0]="log",t[t.info=1]="info",t[t.warn=2]="warn",t[t.error=3]="error",t[t.silent=4]="silent",t))(Bn||{});const qn=globalThis||window,Hn=Symbol.for("__IPE_LOGGER_COLOR_MAP__");qn[Hn]||(qn[Hn]=new Map);const zn=qn[Hn];function xr(t){let e=2166136261;for(let i=0;i<t.length;i++)e^=t.charCodeAt(i),e=(e>>>0)*16777619;return e>>>0}const zo=[[350,360],[0,15],[15,30],[200,230],[230,250],[250,280],[280,310],[310,330],[140,160],[160,180]];function $f(t,e){const i=zo.length,r=xr(t)%i,[n,s]=zo[r],o=s-n,a=xr(t+":"+e),l=n+a%(o||1),c=xr(t+":s"),u=xr(t+":l");let f,d;if(e==="name")f=62+c%18,d=30+u%12;else{const y=l>=0&&l<50||l>330&&l<360,m=l>=200&&l<=300;f=55+c%20,m?d=55+u%8:y?d=48+u%6:d=50+u%8,f<60&&(f+=5)}return`hsl(${l}, ${f}%, ${d}%)`}function Sr(t,e){if(e)return zn.set(t,e),e;const i=zn.get(t);if(i)return i;const r=t.startsWith("name:")?"name":"group",n=$f(t,r);return zn.set(t,n),n}/**
|
|
11
11
|
* @inpageedit/logger
|
|
12
12
|
* Flexible, Extensible Console Logger with Colored Labels and Hierarchical Loggers
|
|
13
13
|
*
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
* logger.defineLevel('success', { level: LoggerLevel.info, label: '✅', method: 'info' })
|
|
27
27
|
* logger.success('User created successfully')
|
|
28
28
|
* ```
|
|
29
|
-
*/let Wo=class Iu{constructor(e={}){this._custom=i=>{if(!this._enabled(i.level))return Ko;const[r,n]=this._prefix(i.label);return this._consoleMethod(i.method).bind(console,r,...n)},this._name=e.name,this._nameColor=e.color,this._groupPath=e._groupPath?[...e._groupPath]:[],this._dynamicLevels={...e._dynamicLevels},this._levelRef=e._levelRef??{value:e.level??1},this._name&&kr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const i of Object.keys(this._dynamicLevels))this._installLevelGetter(i,this._dynamicLevels[i]);return _f(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,i){return e&&kr(`group:${e}`,i?.color),new Iu({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,i){this._dynamicLevels[e]={...i},this._installLevelGetter(e,i)}get debug(){return this._method("debug")}get log(){return this._method("log")}get info(){return this._method("info")}get warn(){return this._method("warn")}get error(){return this._method("error")}_installBuiltinLevels(){}_installLevelGetter(e,i){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(i)})}_method(e){const i=vf[e];if(!this._enabled(i.level))return Ko;const[r,n]=this._prefix(i.label);return this._consoleMethod(e).bind(console,r,...n)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const i=[];let r="";if(this._name){const n=kr(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,i.push(`background:${n}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,Vo)}if(e&&(r+=` ${e}`),this._groupPath.length){const n=this._groupPath.join("/"),s=kr(`group:${n}`);r+=` %c${n}%c`,i.push(`color:${s}; text-decoration: underline;`,Vo)}return[r,i]}};const Ko=()=>{},Vo="color:inherit; background:transparent; text-decoration:none;",vf={debug:{level:-1,label:"",method:"debug"},log:{level:0,label:"",method:"log"},info:{level:1,label:"[I]",method:"info"},warn:{level:2,label:"[W]",method:"warn"},error:{level:3,label:"[E]",method:"error"}};function _f(t){const e=function(i,r){return t.group(i,r)};return new Proxy(e,{get(i,r,n){return t[r]},set(i,r,n){return t[r]=n,!0},apply(i,r,n){return t.group(n[0],n[1])},has(i,r){return r in t}})}function Go(t){return new Wo(t)}var Ue=(t=>(t.BODY_USED="BODY_USED",t.NO_BODY_READER="NO_BODY_READER",t.TIMEOUT="TIMEOUT",t.NETWORK_ERROR="NETWORK_ERROR",t.BODY_NOT_ALLOWED="BODY_NOT_ALLOWED",t.HOOK_CONTEXT_CHANGED="HOOK_CONTEXT_CHANGED",t.ABORTED_BY_HOOK="ABORTED_BY_HOOK",t.INVALID_HOOK_CALLBACK="INVALID_HOOK_CALLBACK",t.UNEXPECTED_HOOK_RETURN="UNEXPECTED_HOOK_RETURN",t))(Ue||{});let Te=class Lu extends Error{constructor(i,r,n,s){super(r,s);j(this,"name","FexiosError");this.code=i,this.context=n}static is(i){return i?.constructor===Lu}},xf=class Nu extends Te{constructor(i,r,n){super(r.statusText,i,void 0,n);j(this,"name","FexiosResponseError");this.response=r}static is(i){return i?.constructor===Nu}};function Sf(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const i=Math.min(Math.max(t.length,256),e),r=t.slice(0,i);if(kf(r))return!1;const n=Ef(r);if(n.nullByteRatio>.05||n.highByteRatio>.95)return!1;const s=["utf-8","utf-16le","utf-16be","iso-8859-1"];let o=-1,a=!1;for(const l of s)try{const c=new TextDecoder(l,{fatal:!0}).decode(r),u=$f(c);u>o&&(o=u,a=u>.7)}catch{continue}return a}function kf(t){if(t.length<4)return!1;const e=[[137,80,78,71],[255,216,255],[71,73,70],[37,80,68,70],[80,75,3,4],[80,75,5,6],[80,75,7,8],[127,69,76,70],[77,90],[202,254,186,190],[0,0,1,0],[82,73,70,70]];for(const i of e)if(t.length>=i.length){let r=!0;for(let n=0;n<i.length;n++)if(t[n]!==i[n]){r=!1;break}if(r)return!0}return!1}function Ef(t){let e=0,i=0,r=0;for(const n of t)n===0&&e++,n>127&&i++,(n<32&&n!==9&&n!==10&&n!==13||n===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:i/t.length,controlCharRatio:r/t.length}}function $f(t){if(t.length===0)return 1;let e=1,i=0;for(let n=0;n<t.length;n++){const s=t[n].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?i++:s>127&&s<65534?!Pf(s)&&!Cf(s)&&i++:e-=.1}const r=i/t.length;return e*=r,Of(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function Pf(t){return t>=0&&t<=31||t>=127&&t<=159}function Cf(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Of(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function Qe(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}const Mi=(t,...e)=>{const i=n=>{if(Array.isArray(n))return n.slice();if(Qe(n)){const s={};for(const o of Reflect.ownKeys(n))s[o]=i(n[o]);return s}return n},r=i(t);for(const n of e)if(n!=null)for(const s of Reflect.ownKeys(n)){const o=n[s];if(typeof o>"u")continue;const a=r[s];Qe(a)&&Qe(o)?r[s]=Mi(a,o):r[s]=i(o)}return r};let Di=class{constructor(e,i,r){j(this,"ok");j(this,"status");j(this,"statusText");j(this,"headers");this.rawResponse=e,this.data=i,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([n,s])=>{this[n]=s})}};async function Qo(t,e,i){if(t.bodyUsed)throw new Te(Ue.BODY_USED,"Response body has already been used or locked");const r=t.headers.get("content-type")||"",n=Number(t.headers.get("content-length"))||0,s=(a,l)=>l==="json"||a.startsWith("application/json"),o=(a,l,c)=>c==="blob"||a.startsWith("image/")&&!a.startsWith("image/svg")||a.startsWith("video/")||a.startsWith("audio/")||!Sf(l);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const a=new WebSocket(t.url);return await new Promise((l,c)=>{a.onopen=l,a.onerror=c}),new Di(t,a,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(r.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const a=new EventSource(t.url);return await new Promise((l,c)=>{a.onopen=l,a.onerror=c}),new Di(t,a)}else{if(e==="stream")return new Di(t,t.body);{const a=t.clone().body?.getReader();if(!a)throw new Te(Ue.NO_BODY_READER,"Failed to get ReadableStream from response body");let l=new Uint8Array;for(;;){const{done:u,value:f}=await a.read();if(u)break;if(f&&(l=new Uint8Array([...l,...f]),i&&n>0)){const d=Math.min(l.length/n,1);i(d,l)}}const c=new Di(t,void 0);if(e==="arrayBuffer")return c.data=l.buffer,c;if(s(r,e))try{const u=new TextDecoder().decode(l);c.data=JSON.parse(u)}catch{}if(typeof c.data!="string"&&o(r,l,e)?c.data=new Blob([l],{type:t.headers.get("content-type")||void 0}):c.data=new TextDecoder().decode(l),typeof c.data=="string"&&e!=="text"){const u=c.data.trim(),f=u[0],d=u[u.length-1];if(f==="{"&&d==="}"||f==="["&&d==="]")try{c.data=JSON.parse(c.data)}catch{}}if(typeof c.data>"u"&&(c.data=l.length>0?l:void 0),c.ok)return c;throw new xf(`Request failed with status code ${t.status}`,c)}}}var Er;(t=>{t.makeSearchParams=n=>{if(!n)return new URLSearchParams;if(n instanceof URLSearchParams)return n;if(typeof n!="object"||n?.constructor!==Object)throw new TypeError("only plain object is supported");const s=new URLSearchParams,o=(c,u)=>{u!=null&&s.append(c,u)},a=(c,u)=>{u!=null&&s.set(c,u)},l=(c,u)=>{if(u!=null){if(Array.isArray(u)){for(const f of u)o(c,f?.toString());return}if(typeof u=="object"&&u.constructor===Object){for(const[f,d]of Object.entries(u)){if(d==null)continue;const b=f.endsWith("[]"),g=b?f.slice(0,-2):f,E=`${c}[${g}]`;if(b){const D=`${E}[]`;if(Array.isArray(d))for(const k of d)o(D,k?.toString());else typeof d=="object"&&d!==null&&d.constructor===Object?l(`${E}[]`,d):o(D,d?.toString())}else if(Array.isArray(d))for(const D of d)o(E,D?.toString());else typeof d=="object"&&d!==null&&d.constructor===Object?l(E,d):a(E,d?.toString())}return}a(c,u?.toString())}};for(const[c,u]of Object.entries(n))l(c,u);return s},t.makeQueryString=n=>(0,t.makeSearchParams)(n).toString(),t.makeURL=(n,s,o,a)=>{const l=typeof window<"u"&&window.location?.origin||"http://localhost",c=typeof n=="string"?new URL(n,a??l):new URL(n),u=(0,t.toQueryRecord)(c.searchParams),f=(0,t.mergeQueries)(u,s||{}),d=(0,t.makeSearchParams)(f);return c.search=d.toString(),c.hash=o||"",c},t.toQueryRecord=n=>{typeof n=="string"&&(n=(0,t.fromString)(n));const s={},o=l=>{if(!l.includes("["))return{path:[l],forceArray:!1};const c=[l.slice(0,l.indexOf("["))],u=/\[([^\]]*)\]/g;let f,d=!1,b=!1;for(;f=u.exec(l);)f[1]===""?(d=!0,b=!0):(c.push(f[1]),b=!1);return d&&b&&(c[c.length-1]=c[c.length-1]+"[]"),{path:c,forceArray:d}},a=(l,c,u,f)=>{let d=l;for(let b=0;b<c.length;b++){const g=c[b];b===c.length-1?f?d[g]===void 0?d[g]=[u]:Array.isArray(d[g])?d[g].push(u):d[g]=[d[g],u]:d[g]===void 0?d[g]=u:Array.isArray(d[g])?d[g].push(u):d[g]=[d[g],u]:((d[g]===void 0||typeof d[g]!="object"||Array.isArray(d[g]))&&(d[g]={}),d=d[g])}};for(const[l,c]of n.entries()){const{path:u,forceArray:f}=o(String(l));a(s,u,c?.toString(),f)}return s},t.fromString=n=>{const s=n.trim();if(!s)return new URLSearchParams;if(s.startsWith("?"))return new URLSearchParams(s.slice(1));const o=s.indexOf("?");if(o>=0){const a=s.indexOf("#",o+1),l=s.slice(o+1,a>=0?a:void 0);return new URLSearchParams(l)}return new URLSearchParams(s)},t.mergeQueries=(n,...s)=>{const o=e(i(n));for(const a of s)a!=null&&r(o,i(a));return o};function e(n){if(Array.isArray(n))return n.map(e);if(Qe(n)){const s={};for(const[o,a]of Object.entries(n))s[o]=e(a);return s}if(n instanceof Map){const s={};for(const[o,a]of n.entries())s[o]=e(a);return s}return n}function i(n){if(!n)return{};if(n instanceof URLSearchParams||n instanceof FormData||n instanceof Map)return(0,t.toQueryRecord)(n);if(typeof n=="string")return(0,t.toQueryRecord)((0,t.fromString)(n));if(Qe(n))return n;throw new TypeError(`unsupported type transformation, got: ${Object.prototype.toString.call(n)}`)}function r(n,s){for(const[o,a]of Object.entries(s)){if(a===void 0)continue;if(a===null){delete n[o];continue}const l=n[o];Qe(l)&&Qe(a)?r(l,a):n[o]=e(a)}}})(Er||(Er={}));const Yo=function(t){const e=this.constructor.prototype,i=Reflect.get(e,t,e);function r(...n){return Reflect.apply(i,r,n)}Reflect.setPrototypeOf(r,e);for(const n of Reflect.ownKeys(i)){const s=Reflect.getOwnPropertyDescriptor(i,n);s&&Reflect.defineProperty(r,n,s)}return r};Yo.prototype=Object.create(Function.prototype);var ji;(t=>{t.makeHeaders=e=>{if(!e)return new Headers;if(e instanceof Headers)return new Headers(e);const i=new Headers;if(e instanceof Map){for(const[r,n]of e.entries())if(n!=null)if(Array.isArray(n))for(const s of n)s!=null&&i.append(r,String(s));else i.append(r,String(n));return i}if(Qe(e)){for(const[r,n]of Object.entries(e))if(n!=null)if(Array.isArray(n))for(const s of n)s!=null&&i.append(r,String(s));else i.append(r,String(n));return i}throw new TypeError("only plain object, Map/ReadonlyMap, or Headers is supported")},t.toHeaderRecord=e=>{if(e instanceof Headers){const i={};return e.forEach((r,n)=>{i[n]=i[n]?[...i[n],r]:[r]}),i}if(e instanceof Map){const i={};for(const[r,n]of e.entries())if(n!=null)if(Array.isArray(n)){const s=n.filter(o=>o!=null).map(o=>String(o));s.length&&(i[r]=(i[r]??[]).concat(s))}else{const s=String(n);i[r]=i[r]?[...i[r],s]:[s]}return i}throw new TypeError(`unsupported type transformation, got: ${Object.prototype.toString.call(e)}`)},t.mergeHeaders=(e,...i)=>{const r=e instanceof Headers?new Headers(e):(0,t.makeHeaders)(e),n=s=>{for(const[o,a]of Object.entries(s))if(a!==void 0){if(a===null){r.delete(o);continue}if(Array.isArray(a)){r.delete(o);for(const l of a)l!=null&&r.append(o,String(l))}else r.set(o,String(a))}};for(const s of i){if(s==null)continue;if(s instanceof Headers){s.forEach((a,l)=>{r.set(l,a)});continue}if(Qe(s)){n(s);continue}const o=(0,t.toHeaderRecord)(s);for(const[a,l]of Object.entries(o)){r.delete(a);for(const c of l)r.append(a,c)}}return r}})(ji||(ji={}));let Kn=(oe=class extends Yo{constructor(i={}){super("request");j(this,"baseConfigs");j(this,"hooks",[]);j(this,"mergeQueries",Er.mergeQueries);j(this,"mergeHeaders",ji.mergeHeaders);j(this,"interceptors",{request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")});j(this,"create",oe.create);j(this,"_plugins",new Map);j(this,"checkIsPlainObject",Qe);j(this,"mergeQuery",this.mergeQueries);this.baseConfigs=Mi(oe.DEFAULT_CONFIGS,i),oe.ALL_METHODS.forEach(r=>this.createMethodShortcut(r.toLowerCase()))}async request(i,r){let n=r=r||{};if(typeof i=="string"||i instanceof URL?n.url=i.toString():typeof i=="object"&&(n=Mi(i,n)),n=await this.emit("beforeInit",n,{shouldAdjustRequestParams:!0,shouldHandleShortCircuitResponse:!0}),n[oe.FINAL_SYMBOL])return n;if(oe.METHODS_WITHOUT_BODY.includes(n.method?.toLocaleLowerCase())&&n.body)throw new Te(Ue.BODY_NOT_ALLOWED,`Request method "${n.method}" does not allow body`);if(n=await this.emit("beforeRequest",n,{shouldAdjustRequestParams:!0,shouldHandleShortCircuitResponse:!0,preAdjust:!0,requestOptionsOverridesURLSearchParams:!0,preRequestOptionsOverridesURLSearchParams:!0,postRequestOptionsOverridesURLSearchParams:!0}),n[oe.FINAL_SYMBOL])return n;let s;const o={};if(typeof n.body<"u"&&n.body!==null&&(n.body instanceof Blob||n.body instanceof FormData||n.body instanceof URLSearchParams?s=n.body:typeof n.body=="object"&&n.body!==null?(s=JSON.stringify(n.body),n.headers=this.mergeHeaders(n.headers,{"Content-Type":"application/json"})):s=n.body),!ji.makeHeaders(r.headers||{}).get("content-type")&&s&&(s instanceof FormData||s instanceof URLSearchParams?o["content-type"]=null:typeof s=="string"&&typeof n.body=="object"?o["content-type"]="application/json":s instanceof Blob&&(o["content-type"]=s.type||"application/octet-stream")),n.body=s,n=await this.emit("afterBodyTransformed",n,{shouldAdjustRequestParams:!0,shouldHandleShortCircuitResponse:!0,preAdjust:!0,postRequestOptionsOverridesURLSearchParams:!0}),n[oe.FINAL_SYMBOL])return n;const a=n.abortController||globalThis.AbortController?new AbortController:void 0,l=n.baseURL||this.baseConfigs.baseURL||globalThis.location?.href||"http://localhost",c=new URL(n.url.toString(),l),u=Er.makeURL(c,n.query,c.hash).toString(),f=new Request(u,{method:n.method||"GET",credentials:n.credentials,cache:n.cache,mode:n.mode,headers:ji.mergeHeaders(this.baseConfigs.headers,n.headers||{},o),body:n.body,signal:a?.signal});if(n.rawRequest=f,n=await this.emit("beforeActualFetch",n,{shouldHandleShortCircuitResponse:!0}),n[oe.FINAL_SYMBOL])return n;const d=n.timeout||this.baseConfigs.timeout||60*1e3;if(n.url.startsWith("ws"))try{const g=new WebSocket(n.url);return await new Promise((E,D)=>{const k=setTimeout(()=>{D(new Te(Ue.TIMEOUT,`WebSocket connection timed out after ${d}ms`,n))},d);g.onopen=()=>{clearTimeout(k),E()},g.onerror=B=>{clearTimeout(k),D(new Te(Ue.NETWORK_ERROR,"WebSocket connection failed",n))},g.onclose=B=>{B.code!==1e3&&(clearTimeout(k),D(new Te(Ue.NETWORK_ERROR,`WebSocket closed with code ${B.code}`,n)))}}),n.rawResponse=new Response,n.response=new Di(n.rawResponse,g,{ok:!0,status:101,statusText:"Switching Protocols"}),n.data=g,n.headers=new Headers,this.emit("afterResponse",n)}catch(g){throw g instanceof Te?g:new Te(Ue.NETWORK_ERROR,`WebSocket creation failed: ${g}`,n)}let b;try{a&&(b=setTimeout(()=>{a.abort()},d));const g=await(r.fetch||this.baseConfigs.fetch||globalThis.fetch)(n.rawRequest).catch(E=>{throw b&&clearTimeout(b),a?.signal.aborted?new Te(Ue.TIMEOUT,`Request timed out after ${d}ms`,n):new Te(Ue.NETWORK_ERROR,E.message,n)});return b&&clearTimeout(b),n.rawResponse=g,n.response=await Qo(g,n.responseType,(E,D)=>{r?.onProgress?.(E,D)}),n.data=n.response.data,n.headers=n.response.headers,this.emit("afterResponse",n)}catch(g){throw b&&clearTimeout(b),g}}normalizeContext(i,r={}){const n=i,s=n.baseURL||this.baseConfigs.baseURL||globalThis.location?.href||"http://localhost",o=new URL(s,globalThis.location?.href||"http://localhost"),a=new URL(n.url.toString(),o),l=!!n[oe.NORMALIZED_SYMBOL];n.baseURL=o?o.origin:a.origin;let c;l?c=r.requestOptionsOverridesURLSearchParams?this.mergeQueries({},a.search,n.query):this.mergeQueries({},n.query,a.search):(c=r.requestOptionsOverridesURLSearchParams?this.mergeQueries(o?.search||"",this.baseConfigs.query,a.search,n.query):this.mergeQueries(o?.search||"",this.baseConfigs.query,n.query,a.search),n[oe.NORMALIZED_SYMBOL]=!0),n.query=c;const u=new URL(a);return u.search="",n.url=u.toString(),n}async emit(i,r,n={}){const s=this.hooks.filter(o=>o.event===i);if(n?.shouldAdjustRequestParams&&n?.preAdjust)try{r=this.normalizeContext(r,{requestOptionsOverridesURLSearchParams:n.preRequestOptionsOverridesURLSearchParams})}catch{}try{let o=0;for(const a of s){const l=`${i}#${a.action.name||`anonymous#${o}`}`,c=Symbol("FEXIOS_HOOK_CONTEXT");r[c]=c;const u=r.url;let f="";try{const b=this.mergeQueries({},r.query||{});f=JSON.stringify(b)}catch{}let d=await a.action.call(this,r);if(d===void 0&&(d=r),d===!1)throw new Te(Ue.ABORTED_BY_HOOK,`Request aborted by hook "${l}"`,r);if(d instanceof Response){const b=d,g={...r,rawResponse:b},E=await Qo(b,r.responseType,(D,k)=>{r.onProgress?.(D,k)});if(g.response=E,g.data=E.data,g.headers=E.headers,i!=="afterResponse"){const D=await this.emit("afterResponse",g);return D[oe.FINAL_SYMBOL]=!0,D}else return g[oe.FINAL_SYMBOL]=!0,g}else if(typeof d=="object"&&d[c]===c)r=d;else{const b=globalThis["".concat("console")];try{throw new Te(Ue.HOOK_CONTEXT_CHANGED,`Hook "${l}" should return the original FexiosContext or return false to abort the request, but got "${d}".`)}catch(g){b.warn(g.stack||g)}}if(n?.shouldAdjustRequestParams)try{const b=r.baseURL||this.baseConfigs.baseURL||globalThis.location?.href||"http://localhost",g=new URL(r.url.toString(),b);let E={};if(f)try{E=JSON.parse(f)}catch{}const D=r.query||{},k=this.mergeQueries(E,g.search,D);r.query=k;const B=new URL(g);B.search="",r.url=B.toString()}catch{}delete r[c],o++}}catch(o){return Promise.reject(o)}return r}on(i,r,n=!1){if(typeof r!="function")throw new Te(Ue.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof r}"`);return this.hooks[n?"unshift":"push"]({event:i,action:r}),this}off(i,r){return i==="*"||!i?this.hooks=this.hooks.filter(n=>n.action!==r):this.hooks=this.hooks.filter(n=>n.event!==i||n.action!==r),this}createInterceptor(i){return{handlers:()=>this.hooks.filter(r=>r.event===i).map(r=>r.action),use:(r,n=!1)=>this.on(i,r,n),clear:()=>{this.hooks=this.hooks.filter(r=>r.event!==i)}}}createMethodShortcut(i){return Reflect.defineProperty(this,i,{get:()=>(r,n,s)=>(oe.METHODS_WITHOUT_BODY.includes(i.toLocaleLowerCase())?s=n:(s=s||{},s.body=n),this.request(r,{...s,method:i}))}),this}extends(i){const r=new oe(Mi(this.baseConfigs,i));return r.hooks=[...this.hooks],r._plugins=new Map(this._plugins),r._plugins.forEach(async n=>{await r.plugin(n)}),r}static create(i){return new oe(i)}async plugin(i){if(typeof i?.name=="string"&&typeof i?.install=="function"){if(this._plugins.has(i.name))return this;const r=await i.install(this);if(this._plugins.set(i.name,i),r instanceof oe)return r}return this}},j(oe,"FINAL_SYMBOL",Symbol("FEXIOS_FINAL_CONTEXT")),j(oe,"NORMALIZED_SYMBOL",Symbol("FEXIOS_NORMALIZED_QUERY")),j(oe,"DEFAULT_CONFIGS",{baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch}),j(oe,"ALL_METHODS",["get","post","put","patch","delete","head","options","trace"]),j(oe,"METHODS_WITHOUT_BODY",["get","head","options","trace"]),oe);/**
|
|
29
|
+
*/let Wo=class Uu{constructor(e={}){this._custom=i=>{if(!this._enabled(i.level))return Ko;const[r,n]=this._prefix(i.label);return this._consoleMethod(i.method).bind(console,r,...n)},this._name=e.name,this._nameColor=e.color,this._groupPath=e._groupPath?[...e._groupPath]:[],this._dynamicLevels={...e._dynamicLevels},this._levelRef=e._levelRef??{value:e.level??1},this._name&&Sr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const i of Object.keys(this._dynamicLevels))this._installLevelGetter(i,this._dynamicLevels[i]);return Cf(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,i){return e&&Sr(`group:${e}`,i?.color),new Uu({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,i){this._dynamicLevels[e]={...i},this._installLevelGetter(e,i)}get debug(){return this._method("debug")}get log(){return this._method("log")}get info(){return this._method("info")}get warn(){return this._method("warn")}get error(){return this._method("error")}_installBuiltinLevels(){}_installLevelGetter(e,i){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(i)})}_method(e){const i=Pf[e];if(!this._enabled(i.level))return Ko;const[r,n]=this._prefix(i.label);return this._consoleMethod(e).bind(console,r,...n)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const i=[];let r="";if(this._name){const n=Sr(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,i.push(`background:${n}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,Vo)}if(e&&(r+=` ${e}`),this._groupPath.length){const n=this._groupPath.join("/"),s=Sr(`group:${n}`);r+=` %c${n}%c`,i.push(`color:${s}; text-decoration: underline;`,Vo)}return[r,i]}};const Ko=()=>{},Vo="color:inherit; background:transparent; text-decoration:none;",Pf={debug:{level:-1,label:"",method:"debug"},log:{level:0,label:"",method:"log"},info:{level:1,label:"[I]",method:"info"},warn:{level:2,label:"[W]",method:"warn"},error:{level:3,label:"[E]",method:"error"}};function Cf(t){const e=function(i,r){return t.group(i,r)};return new Proxy(e,{get(i,r,n){return t[r]},set(i,r,n){return t[r]=n,!0},apply(i,r,n){return t.group(n[0],n[1])},has(i,r){return r in t}})}function Go(t){return new Wo(t)}var We=(t=>(t.BODY_USED="BODY_USED",t.NO_BODY_READER="NO_BODY_READER",t.TIMEOUT="TIMEOUT",t.NETWORK_ERROR="NETWORK_ERROR",t.BODY_NOT_ALLOWED="BODY_NOT_ALLOWED",t.HOOK_CONTEXT_CHANGED="HOOK_CONTEXT_CHANGED",t.ABORTED_BY_HOOK="ABORTED_BY_HOOK",t.INVALID_HOOK_CALLBACK="INVALID_HOOK_CALLBACK",t.UNEXPECTED_HOOK_RETURN="UNEXPECTED_HOOK_RETURN",t))(We||{});let Me=class Fu extends Error{constructor(i,r,n,s){super(r,s);M(this,"name","FexiosError");this.code=i,this.context=n}static is(i){return i?.constructor===Fu}},Of=class Bu extends Me{constructor(i,r,n){super(r.statusText,i,void 0,n);M(this,"name","FexiosResponseError");this.response=r}static is(i){return i?.constructor===Bu}};function Tf(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const i=Math.min(Math.max(t.length,256),e),r=t.slice(0,i);if(If(r))return!1;const n=Af(r);if(n.nullByteRatio>.05||n.highByteRatio>.95)return!1;const s=["utf-8","utf-16le","utf-16be","iso-8859-1"];let o=-1,a=!1;for(const l of s)try{const c=new TextDecoder(l,{fatal:!0}).decode(r),u=Rf(c);u>o&&(o=u,a=u>.7)}catch{continue}return a}function If(t){if(t.length<4)return!1;const e=[[137,80,78,71],[255,216,255],[71,73,70],[37,80,68,70],[80,75,3,4],[80,75,5,6],[80,75,7,8],[127,69,76,70],[77,90],[202,254,186,190],[0,0,1,0],[82,73,70,70]];for(const i of e)if(t.length>=i.length){let r=!0;for(let n=0;n<i.length;n++)if(t[n]!==i[n]){r=!1;break}if(r)return!0}return!1}function Af(t){let e=0,i=0,r=0;for(const n of t)n===0&&e++,n>127&&i++,(n<32&&n!==9&&n!==10&&n!==13||n===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:i/t.length,controlCharRatio:r/t.length}}function Rf(t){if(t.length===0)return 1;let e=1,i=0;for(let n=0;n<t.length;n++){const s=t[n].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?i++:s>127&&s<65534?!Lf(s)&&!Nf(s)&&i++:e-=.1}const r=i/t.length;return e*=r,Mf(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function Lf(t){return t>=0&&t<=31||t>=127&&t<=159}function Nf(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Mf(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function rt(t){if(typeof t!="object"||t===null||Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===Object.prototype||e===null}const Ni=(t,...e)=>{const i=n=>{if(Array.isArray(n))return n.slice();if(rt(n)){const s={};for(const o of Reflect.ownKeys(n))s[o]=i(n[o]);return s}return n},r=i(t);for(const n of e)if(n!=null)for(const s of Reflect.ownKeys(n)){const o=n[s];if(typeof o>"u")continue;const a=r[s];rt(a)&&rt(o)?r[s]=Ni(a,o):r[s]=i(o)}return r};let Mi=class{constructor(e,i,r){M(this,"ok");M(this,"status");M(this,"statusText");M(this,"headers");this.rawResponse=e,this.data=i,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([n,s])=>{this[n]=s})}};async function Qo(t,e,i){if(t.bodyUsed)throw new Me(We.BODY_USED,"Response body has already been used or locked");const r=t.headers.get("content-type")||"",n=Number(t.headers.get("content-length"))||0,s=(a,l)=>l==="json"||a.startsWith("application/json"),o=(a,l,c)=>c==="blob"||a.startsWith("image/")&&!a.startsWith("image/svg")||a.startsWith("video/")||a.startsWith("audio/")||!Tf(l);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const a=new WebSocket(t.url);return await new Promise((l,c)=>{a.onopen=l,a.onerror=c}),new Mi(t,a,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(r.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const a=new EventSource(t.url);return await new Promise((l,c)=>{a.onopen=l,a.onerror=c}),new Mi(t,a)}else{if(e==="stream")return new Mi(t,t.body);{const a=t.clone().body?.getReader();if(!a)throw new Me(We.NO_BODY_READER,"Failed to get ReadableStream from response body");let l=new Uint8Array;for(;;){const{done:u,value:f}=await a.read();if(u)break;if(f&&(l=new Uint8Array([...l,...f]),i&&n>0)){const d=Math.min(l.length/n,1);i(d,l)}}const c=new Mi(t,void 0);if(e==="arrayBuffer")return c.data=l.buffer,c;if(s(r,e))try{const u=new TextDecoder().decode(l);c.data=JSON.parse(u)}catch{}if(typeof c.data!="string"&&o(r,l,e)?c.data=new Blob([l],{type:t.headers.get("content-type")||void 0}):c.data=new TextDecoder().decode(l),typeof c.data=="string"&&e!=="text"){const u=c.data.trim(),f=u[0],d=u[u.length-1];if(f==="{"&&d==="}"||f==="["&&d==="]")try{c.data=JSON.parse(c.data)}catch{}}if(typeof c.data>"u"&&(c.data=l.length>0?l:void 0),c.ok)return c;throw new Of(`Request failed with status code ${t.status}`,c)}}}var kr;(t=>{t.makeSearchParams=n=>{if(!n)return new URLSearchParams;if(n instanceof URLSearchParams)return n;if(typeof n!="object"||n?.constructor!==Object)throw new TypeError("only plain object is supported");const s=new URLSearchParams,o=(c,u)=>{u!=null&&s.append(c,u)},a=(c,u)=>{u!=null&&s.set(c,u)},l=(c,u)=>{if(u!=null){if(Array.isArray(u)){for(const f of u)o(c,f?.toString());return}if(typeof u=="object"&&u.constructor===Object){for(const[f,d]of Object.entries(u)){if(d==null)continue;const y=f.endsWith("[]"),m=y?f.slice(0,-2):f,E=`${c}[${m}]`;if(y){const j=`${E}[]`;if(Array.isArray(d))for(const k of d)o(j,k?.toString());else typeof d=="object"&&d!==null&&d.constructor===Object?l(`${E}[]`,d):o(j,d?.toString())}else if(Array.isArray(d))for(const j of d)o(E,j?.toString());else typeof d=="object"&&d!==null&&d.constructor===Object?l(E,d):a(E,d?.toString())}return}a(c,u?.toString())}};for(const[c,u]of Object.entries(n))l(c,u);return s},t.makeQueryString=n=>(0,t.makeSearchParams)(n).toString(),t.makeURL=(n,s,o,a)=>{const l=typeof window<"u"&&window.location?.origin||"http://localhost",c=typeof n=="string"?new URL(n,a??l):new URL(n),u=(0,t.toQueryRecord)(c.searchParams),f=(0,t.mergeQueries)(u,s||{}),d=(0,t.makeSearchParams)(f);return c.search=d.toString(),c.hash=o||"",c},t.toQueryRecord=n=>{typeof n=="string"&&(n=(0,t.fromString)(n));const s={},o=l=>{if(!l.includes("["))return{path:[l],forceArray:!1};const c=[l.slice(0,l.indexOf("["))],u=/\[([^\]]*)\]/g;let f,d=!1,y=!1;for(;f=u.exec(l);)f[1]===""?(d=!0,y=!0):(c.push(f[1]),y=!1);return d&&y&&(c[c.length-1]=c[c.length-1]+"[]"),{path:c,forceArray:d}},a=(l,c,u,f)=>{let d=l;for(let y=0;y<c.length;y++){const m=c[y];y===c.length-1?f?d[m]===void 0?d[m]=[u]:Array.isArray(d[m])?d[m].push(u):d[m]=[d[m],u]:d[m]===void 0?d[m]=u:Array.isArray(d[m])?d[m].push(u):d[m]=[d[m],u]:((d[m]===void 0||typeof d[m]!="object"||Array.isArray(d[m]))&&(d[m]={}),d=d[m])}};for(const[l,c]of n.entries()){const{path:u,forceArray:f}=o(String(l));a(s,u,c?.toString(),f)}return s},t.fromString=n=>{const s=n.trim();if(!s)return new URLSearchParams;if(s.startsWith("?"))return new URLSearchParams(s.slice(1));const o=s.indexOf("?");if(o>=0){const a=s.indexOf("#",o+1),l=s.slice(o+1,a>=0?a:void 0);return new URLSearchParams(l)}return new URLSearchParams(s)},t.mergeQueries=(n,...s)=>{const o=e(i(n));for(const a of s)a!=null&&r(o,i(a));return o};function e(n){if(Array.isArray(n))return n.map(e);if(rt(n)){const s={};for(const[o,a]of Object.entries(n))s[o]=e(a);return s}if(n instanceof Map){const s={};for(const[o,a]of n.entries())s[o]=e(a);return s}return n}function i(n){if(!n)return{};if(n instanceof URLSearchParams||n instanceof FormData||n instanceof Map)return(0,t.toQueryRecord)(n);if(typeof n=="string")return(0,t.toQueryRecord)((0,t.fromString)(n));if(rt(n))return n;throw new TypeError(`unsupported type transformation, got: ${Object.prototype.toString.call(n)}`)}function r(n,s){for(const[o,a]of Object.entries(s)){if(a===void 0)continue;if(a===null){delete n[o];continue}const l=n[o];rt(l)&&rt(a)?r(l,a):n[o]=e(a)}}})(kr||(kr={}));const Yo=function(t){const e=this.constructor.prototype,i=Reflect.get(e,t,e);function r(...n){return Reflect.apply(i,r,n)}Reflect.setPrototypeOf(r,e);for(const n of Reflect.ownKeys(i)){const s=Reflect.getOwnPropertyDescriptor(i,n);s&&Reflect.defineProperty(r,n,s)}return r};Yo.prototype=Object.create(Function.prototype);var Di;(t=>{t.makeHeaders=e=>{if(!e)return new Headers;if(e instanceof Headers)return new Headers(e);const i=new Headers;if(e instanceof Map){for(const[r,n]of e.entries())if(n!=null)if(Array.isArray(n))for(const s of n)s!=null&&i.append(r,String(s));else i.append(r,String(n));return i}if(rt(e)){for(const[r,n]of Object.entries(e))if(n!=null)if(Array.isArray(n))for(const s of n)s!=null&&i.append(r,String(s));else i.append(r,String(n));return i}throw new TypeError("only plain object, Map/ReadonlyMap, or Headers is supported")},t.toHeaderRecord=e=>{if(e instanceof Headers){const i={};return e.forEach((r,n)=>{i[n]=i[n]?[...i[n],r]:[r]}),i}if(e instanceof Map){const i={};for(const[r,n]of e.entries())if(n!=null)if(Array.isArray(n)){const s=n.filter(o=>o!=null).map(o=>String(o));s.length&&(i[r]=(i[r]??[]).concat(s))}else{const s=String(n);i[r]=i[r]?[...i[r],s]:[s]}return i}throw new TypeError(`unsupported type transformation, got: ${Object.prototype.toString.call(e)}`)},t.mergeHeaders=(e,...i)=>{const r=e instanceof Headers?new Headers(e):(0,t.makeHeaders)(e),n=s=>{for(const[o,a]of Object.entries(s))if(a!==void 0){if(a===null){r.delete(o);continue}if(Array.isArray(a)){r.delete(o);for(const l of a)l!=null&&r.append(o,String(l))}else r.set(o,String(a))}};for(const s of i){if(s==null)continue;if(s instanceof Headers){s.forEach((a,l)=>{r.set(l,a)});continue}if(rt(s)){n(s);continue}const o=(0,t.toHeaderRecord)(s);for(const[a,l]of Object.entries(o)){r.delete(a);for(const c of l)r.append(a,c)}}return r}})(Di||(Di={}));let Wn=(ce=class extends Yo{constructor(i={}){super("request");M(this,"baseConfigs");M(this,"hooks",[]);M(this,"mergeQueries",kr.mergeQueries);M(this,"mergeHeaders",Di.mergeHeaders);M(this,"interceptors",{request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")});M(this,"create",ce.create);M(this,"_plugins",new Map);M(this,"checkIsPlainObject",rt);M(this,"mergeQuery",this.mergeQueries);this.baseConfigs=Ni(ce.DEFAULT_CONFIGS,i),ce.ALL_METHODS.forEach(r=>this.createMethodShortcut(r.toLowerCase()))}async request(i,r){let n=r=r||{};if(typeof i=="string"||i instanceof URL?n.url=i.toString():typeof i=="object"&&(n=Ni(i,n)),n=await this.emit("beforeInit",n,{shouldAdjustRequestParams:!0,shouldHandleShortCircuitResponse:!0}),n[ce.FINAL_SYMBOL])return n;if(ce.METHODS_WITHOUT_BODY.includes(n.method?.toLocaleLowerCase())&&n.body)throw new Me(We.BODY_NOT_ALLOWED,`Request method "${n.method}" does not allow body`);if(n=await this.emit("beforeRequest",n,{shouldAdjustRequestParams:!0,shouldHandleShortCircuitResponse:!0,preAdjust:!0,requestOptionsOverridesURLSearchParams:!0,preRequestOptionsOverridesURLSearchParams:!0,postRequestOptionsOverridesURLSearchParams:!0}),n[ce.FINAL_SYMBOL])return n;let s;const o={};if(typeof n.body<"u"&&n.body!==null&&(n.body instanceof Blob||n.body instanceof FormData||n.body instanceof URLSearchParams?s=n.body:typeof n.body=="object"&&n.body!==null?(s=JSON.stringify(n.body),n.headers=this.mergeHeaders(n.headers,{"Content-Type":"application/json"})):s=n.body),!Di.makeHeaders(r.headers||{}).get("content-type")&&s&&(s instanceof FormData||s instanceof URLSearchParams?o["content-type"]=null:typeof s=="string"&&typeof n.body=="object"?o["content-type"]="application/json":s instanceof Blob&&(o["content-type"]=s.type||"application/octet-stream")),n.body=s,n=await this.emit("afterBodyTransformed",n,{shouldAdjustRequestParams:!0,shouldHandleShortCircuitResponse:!0,preAdjust:!0,postRequestOptionsOverridesURLSearchParams:!0}),n[ce.FINAL_SYMBOL])return n;const a=n.abortController||globalThis.AbortController?new AbortController:void 0,l=n.baseURL||this.baseConfigs.baseURL||globalThis.location?.href||"http://localhost",c=new URL(n.url.toString(),l),u=kr.makeURL(c,n.query,c.hash).toString(),f=new Request(u,{method:n.method||"GET",credentials:n.credentials,cache:n.cache,mode:n.mode,headers:Di.mergeHeaders(this.baseConfigs.headers,n.headers||{},o),body:n.body,signal:a?.signal});if(n.rawRequest=f,n=await this.emit("beforeActualFetch",n,{shouldHandleShortCircuitResponse:!0}),n[ce.FINAL_SYMBOL])return n;const d=n.timeout||this.baseConfigs.timeout||60*1e3;if(n.url.startsWith("ws"))try{const m=new WebSocket(n.url);return await new Promise((E,j)=>{const k=setTimeout(()=>{j(new Me(We.TIMEOUT,`WebSocket connection timed out after ${d}ms`,n))},d);m.onopen=()=>{clearTimeout(k),E()},m.onerror=F=>{clearTimeout(k),j(new Me(We.NETWORK_ERROR,"WebSocket connection failed",n))},m.onclose=F=>{F.code!==1e3&&(clearTimeout(k),j(new Me(We.NETWORK_ERROR,`WebSocket closed with code ${F.code}`,n)))}}),n.rawResponse=new Response,n.response=new Mi(n.rawResponse,m,{ok:!0,status:101,statusText:"Switching Protocols"}),n.data=m,n.headers=new Headers,this.emit("afterResponse",n)}catch(m){throw m instanceof Me?m:new Me(We.NETWORK_ERROR,`WebSocket creation failed: ${m}`,n)}let y;try{a&&(y=setTimeout(()=>{a.abort()},d));const m=await(r.fetch||this.baseConfigs.fetch||globalThis.fetch)(n.rawRequest).catch(E=>{throw y&&clearTimeout(y),a?.signal.aborted?new Me(We.TIMEOUT,`Request timed out after ${d}ms`,n):new Me(We.NETWORK_ERROR,E.message,n)});return y&&clearTimeout(y),n.rawResponse=m,n.response=await Qo(m,n.responseType,(E,j)=>{r?.onProgress?.(E,j)}),n.data=n.response.data,n.headers=n.response.headers,this.emit("afterResponse",n)}catch(m){throw y&&clearTimeout(y),m}}normalizeContext(i,r={}){const n=i,s=n.baseURL||this.baseConfigs.baseURL||globalThis.location?.href||"http://localhost",o=new URL(s,globalThis.location?.href||"http://localhost"),a=new URL(n.url.toString(),o),l=!!n[ce.NORMALIZED_SYMBOL];n.baseURL=o?o.origin:a.origin;let c;l?c=r.requestOptionsOverridesURLSearchParams?this.mergeQueries({},a.search,n.query):this.mergeQueries({},n.query,a.search):(c=r.requestOptionsOverridesURLSearchParams?this.mergeQueries(o?.search||"",this.baseConfigs.query,a.search,n.query):this.mergeQueries(o?.search||"",this.baseConfigs.query,n.query,a.search),n[ce.NORMALIZED_SYMBOL]=!0),n.query=c;const u=new URL(a);return u.search="",n.url=u.toString(),n}async emit(i,r,n={}){const s=this.hooks.filter(o=>o.event===i);if(n?.shouldAdjustRequestParams&&n?.preAdjust)try{r=this.normalizeContext(r,{requestOptionsOverridesURLSearchParams:n.preRequestOptionsOverridesURLSearchParams})}catch{}try{let o=0;for(const a of s){const l=`${i}#${a.action.name||`anonymous#${o}`}`,c=Symbol("FEXIOS_HOOK_CONTEXT");r[c]=c;const u=r.url;let f="";try{const y=this.mergeQueries({},r.query||{});f=JSON.stringify(y)}catch{}let d=await a.action.call(this,r);if(d===void 0&&(d=r),d===!1)throw new Me(We.ABORTED_BY_HOOK,`Request aborted by hook "${l}"`,r);if(d instanceof Response){const y=d,m={...r,rawResponse:y},E=await Qo(y,r.responseType,(j,k)=>{r.onProgress?.(j,k)});if(m.response=E,m.data=E.data,m.headers=E.headers,i!=="afterResponse"){const j=await this.emit("afterResponse",m);return j[ce.FINAL_SYMBOL]=!0,j}else return m[ce.FINAL_SYMBOL]=!0,m}else if(typeof d=="object"&&d[c]===c)r=d;else{const y=globalThis["".concat("console")];try{throw new Me(We.HOOK_CONTEXT_CHANGED,`Hook "${l}" should return the original FexiosContext or return false to abort the request, but got "${d}".`)}catch(m){y.warn(m.stack||m)}}if(n?.shouldAdjustRequestParams)try{const y=r.baseURL||this.baseConfigs.baseURL||globalThis.location?.href||"http://localhost",m=new URL(r.url.toString(),y);let E={};if(f)try{E=JSON.parse(f)}catch{}const j=r.query||{},k=this.mergeQueries(E,m.search,j);r.query=k;const F=new URL(m);F.search="",r.url=F.toString()}catch{}delete r[c],o++}}catch(o){return Promise.reject(o)}return r}on(i,r,n=!1){if(typeof r!="function")throw new Me(We.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof r}"`);return this.hooks[n?"unshift":"push"]({event:i,action:r}),this}off(i,r){return i==="*"||!i?this.hooks=this.hooks.filter(n=>n.action!==r):this.hooks=this.hooks.filter(n=>n.event!==i||n.action!==r),this}createInterceptor(i){return{handlers:()=>this.hooks.filter(r=>r.event===i).map(r=>r.action),use:(r,n=!1)=>this.on(i,r,n),clear:()=>{this.hooks=this.hooks.filter(r=>r.event!==i)}}}createMethodShortcut(i){return Reflect.defineProperty(this,i,{get:()=>(r,n,s)=>(ce.METHODS_WITHOUT_BODY.includes(i.toLocaleLowerCase())?s=n:(s=s||{},s.body=n),this.request(r,{...s,method:i}))}),this}extends(i){const r=new ce(Ni(this.baseConfigs,i));return r.hooks=[...this.hooks],r._plugins=new Map(this._plugins),r._plugins.forEach(async n=>{await r.plugin(n)}),r}static create(i){return new ce(i)}async plugin(i){if(typeof i?.name=="string"&&typeof i?.install=="function"){if(this._plugins.has(i.name))return this;const r=await i.install(this);if(this._plugins.set(i.name,i),r instanceof ce)return r}return this}},M(ce,"FINAL_SYMBOL",Symbol("FEXIOS_FINAL_CONTEXT")),M(ce,"NORMALIZED_SYMBOL",Symbol("FEXIOS_NORMALIZED_QUERY")),M(ce,"DEFAULT_CONFIGS",{baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch}),M(ce,"ALL_METHODS",["get","post","put","patch","delete","head","options","trace"]),M(ce,"METHODS_WITHOUT_BODY",["get","head","options","trace"]),ce);/**
|
|
30
30
|
* Fexios
|
|
31
31
|
* @desc Fetch based HTTP client with similar API to axios for browser and Node.js
|
|
32
32
|
*
|
|
33
33
|
* @license MIT
|
|
34
34
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
35
|
-
*/const
|
|
36
|
-
`),this.code=this.isBadTokenError()?"badtoken":this.errors[0]?.code||"Unknown Error"}get firstError(){return this.errors[0]}isBadTokenError(){return this.errors.some(e=>e.code==="badtoken")||["NeedToken","WrongToken"].includes(this.cause?.data?.login?.result)}toString(){return`[${this.name} ${this.code}]`}static is(e){return e instanceof this}static normalizeErrors(e){return Array.isArray(e)===!1?[]:e.filter(i=>typeof i=="object"&&!!i?.code).map(i=>i.text?i:i.info?{...i,text:i.info}:i["*"]?{...i,text:i["*"]}:{...i,text:""})}};(t=>{function e(s){if(s==null)return;if(s?.response?.data!==void 0)return s.response.data;if(s?.data!==void 0)return s.data;const o=s instanceof Error?s.cause:void 0;return o?.response?.data!==void 0?o.response.data:o?.data!==void 0?o.data:s||void 0}function i(s){return r(s).length>0}t.includesMediaWikiApiError=i,t.normalizeMwApiErrors=
|
|
35
|
+
*/const Df=Wn.create,Jo=Df();/* v8 ignore else -- @preserve */typeof globalThis<"u"?globalThis.fexios=Jo:typeof window<"u"&&(window.fexios=Jo);var Er;(t=>{function e(r){return Array.isArray(r)?r.join("|"):typeof r=="boolean"||r===null?r?"1":void 0:typeof r=="number"?""+r:r}t.normalizeParamValue=e;function i(r){const n=o=>o&&(o instanceof URLSearchParams||o instanceof FormData);if(r==null)return;const s=new FormData;if(n(r))return r.forEach((o,a)=>{const l=e(o);l!=null&&s.append(a,l)}),s;if(rt(r))return Object.entries(r).forEach(([o,a])=>{const l=e(a);l!=null&&s.append(o,l)}),s}t.normalizeBody=i})(Er||(Er={}));var ji=(t=>(t.HTTP_ERROR="HTTP_ERROR",t.LOGIN_FAILED="LOGIN_FAILED",t.LOGIN_RETRY_LIMIT_EXCEEDED="LOGIN_RETRY_LIMIT_EXCEEDED",t.TOKEN_RETRY_LIMIT_EXCEEDED="TOKEN_RETRY_LIMIT_EXCEEDED",t))(ji||{});class De extends Error{constructor(e,i="",r){super(),this.code=e,this.message=i,this.cause=r,this.name="WikiSaikouError"}static is(e,i){return e instanceof this&&(i===void 0||e.code===i)}}let oi=class qu extends Error{constructor(e,i){super(),this.errors=e,this.cause=i,this.name="MediaWikiApiError",this.errors=qu.normalizeErrors(e),this.message=e.map(r=>r.text).filter(Boolean).join(`
|
|
36
|
+
`),this.code=this.isBadTokenError()?"badtoken":this.errors[0]?.code||"Unknown Error"}get firstError(){return this.errors[0]}isBadTokenError(){return this.errors.some(e=>e.code==="badtoken")||["NeedToken","WrongToken"].includes(this.cause?.data?.login?.result)}toString(){return`[${this.name} ${this.code}]`}static is(e){return e instanceof this}static normalizeErrors(e){return Array.isArray(e)===!1?[]:e.filter(i=>typeof i=="object"&&!!i?.code).map(i=>i.text?i:i.info?{...i,text:i.info}:i["*"]?{...i,text:i["*"]}:{...i,text:""})}};(t=>{function e(s){if(s==null)return;if(s?.response?.data!==void 0)return s.response.data;if(s?.data!==void 0)return s.data;const o=s instanceof Error?s.cause:void 0;return o?.response?.data!==void 0?o.response.data:o?.data!==void 0?o.data:s||void 0}function i(s){return r(s).length>0}t.includesMediaWikiApiError=i,t.normalizeMwApiErrors=oi.normalizeErrors;function r(s){let o=e(s);if(typeof o!="object"||o===null)return[];const a=o?.error,l=o?.errors,c=[];return a&&c.push(a),Array.isArray(l)&&c.push(...l),(0,t.normalizeMwApiErrors)(c)}t.extractMediaWikiApiErrors=r;function n(s){if(oi.is(s))return s.isBadTokenError();{const o=r(s);return new oi(o).isBadTokenError()}}t.isBadTokenError=n})(De||(De={}));const Xo=Symbol.for("__FEXIOS_SAIKOU__");/**
|
|
37
37
|
* FexiosSaikou
|
|
38
38
|
*
|
|
39
39
|
* A pre-configured Fexios instance with MediaWiki-friendly defaults:
|
|
@@ -46,17 +46,24 @@
|
|
|
46
46
|
*
|
|
47
47
|
* @param {string|URL} payload create a new FexiosSaikou instance with the given baseURL
|
|
48
48
|
* @param {Fexios} payload or make the given Fexios instance a FexiosSaikou instance
|
|
49
|
-
*/function Zo(t){const e=t instanceof
|
|
49
|
+
*/function Zo(t){const e=t instanceof Wn?t:new Wn({baseURL:t instanceof URL?t.toString():String(t),responseType:"json"});return e[Xo]||(Reflect.defineProperty(e,Xo,{get:()=>!0,enumerable:!1,configurable:!1}),e._tokens=new Map,e.on("afterResponse",i=>{const{data:r,rawRequest:n}=i,s=n?.headers.get("x-mw-token-name");s&&De.isBadTokenError(r)&&e._tokens.delete(s);const o=r?.query?.tokens;o&&typeof o=="object"&&Object.entries(o).forEach(([l,c])=>{typeof c=="string"&&e._tokens.set(l.replace(/token$/i,"").toLowerCase(),c)});const a=r?.login?.token;return typeof a=="string"&&e._tokens.set("login",a),i}),e.on("beforeInit",i=>{if(i.method?.toLowerCase()!=="post")return i;if(i.body===void 0||i.body===null)return i.body=void 0,i;const r=i.body=Er.normalizeBody(i.body),n=new URLSearchParams(i.query);return r.has("format")&&n.delete("format"),r.has("formatversion")&&n.delete("formatversion"),r.has("action")&&n.delete("action"),r.has("origin")&&(n.set("origin",""+r.get("origin")),r.delete("origin")),i.query=Object.fromEntries(n.entries()),i}),e.on("beforeInit",i=>(i.query=Er.normalizeBody(i.query)||{},i)),e.on("beforeRequest",i=>{const r=new URL(i.url),n=r.searchParams;if(globalThis.location&&(!n.has("origin")&&location.origin!==r.origin?(n.set("origin",location.origin),e.baseConfigs.credentials="include",e.baseConfigs.mode="cors"):location.origin===r.origin&&(n.delete("origin"),e.baseConfigs.credentials=void 0,e.baseConfigs.mode=void 0)),r.searchParams.has("origin")){const s=encodeURIComponent(r.searchParams.get("origin")||"").replace(/\./g,"%2E");i.query={},r.searchParams.delete("origin"),i.url=`${r}${r.search?"&":"?"}origin=${s}`}return i})),e}const Gt=(t,...e)=>{const i=s=>Object.prototype.toString.call(s)==="[object Object]",r=s=>{if(Array.isArray(s))return s.slice();if(i(s)){const o={};for(const a of Reflect.ownKeys(s))o[a]=r(s[a]);return o}return s},n=r(t);for(const s of e)if(s!=null)for(const o of Reflect.ownKeys(s)){const a=s[o];if(typeof a>"u")continue;const l=n[o];i(l)&&i(a)?n[o]=Gt(l,a):n[o]=r(a)}return n},jf=(t,e,i)=>{let r={...ea.DEFAULT_CONFIGS};if(typeof t=="string"?r=Gt(r,{baseURL:t,fexiosConfigs:e||{},defaultParams:i||{}}):typeof t=="object"&&t!==null&&(r=Gt(r,t)),!r.baseURL&&typeof window=="object"&&window.mediaWiki){const{wgServer:n,wgScriptPath:s}=window.mediaWiki?.config?.get(["wgServer","wgScriptPath"])||{};typeof n=="string"&&typeof s=="string"&&(r.baseURL=`${n}${s}/api.php`)}if(typeof r.baseURL!="string")throw new Error("baseURL is required");return r},Uf=()=>{},Ff=async(t,e)=>{let i=0;const{retry:r=3,onRetry:n=Uf,shouldRetry:s=()=>!0}=e;let o;do try{return await t()}catch(a){if(o=a,s(a,i))n(a,i),i++;else throw a}while(i<r);throw o||new Error("Retry failed")};/**
|
|
50
50
|
* WikiSaikou Core class
|
|
51
51
|
* @internal You **SHOULD NOT** use this class directly, instead, use the `MediaWikiApi` class.
|
|
52
52
|
* @author dragon-fish <dragon-fish@qq.com>
|
|
53
53
|
* @license MIT
|
|
54
|
-
*/const
|
|
54
|
+
*/const Ui=class{constructor(e,i,r){this.version="7.1.2",this.token=this.getToken;const n=this.config=jf(e,i,r);this.request=Zo(n.baseURL)}setBaseURL(e){return this.config.baseURL=e,this.request.baseConfigs.baseURL=e,this}async get(e,i){return this.runRequestWithApiErrorMapping(()=>this.request.get("",Gt({},this.config.fexiosConfigs,{query:Gt(this.config.defaultParams,e)},i)))}async post(e,i){return this.runRequestWithApiErrorMapping(()=>this.request.post("",e,Gt({},this.config.fexiosConfigs,{query:this.config.defaultParams},i)))}async runRequestWithApiErrorMapping(e){try{const i=await e();return this.handleApiResponse(i)}catch(i){throw this.config.throwOnApiError&&De.includesMediaWikiApiError(i)?new oi(De.extractMediaWikiApiErrors(i),i):i}}throwIfApiError(e){const i=De.extractMediaWikiApiErrors(e);if(i.length>0)throw new oi(i,e)}handleApiResponse(e){return this.config.throwOnApiError&&this.throwIfApiError(e.data),e}get tokens(){return this.request._tokens}async fetchTokens(e=["csrf"]){return this.config.fexiosConfigs.credentials="include",await this.get({action:"query",meta:"tokens",type:e}),this.tokens}async getToken(e="csrf",i=!1){return(!this.tokens.get(e)||i)&&(this.tokens.delete(e),await this.fetchTokens([e])),this.tokens.get(e)}badToken(e){return this.tokens.delete(e),this.tokens}async postWithToken(e,i,r){const{tokenName:n="token",retry:s=3,noCache:o=!1,fexiosOptions:a}=r||{};if(s<1)throw new De(ji.TOKEN_RETRY_LIMIT_EXCEEDED,"The limit of the number of times to automatically re-acquire the token has been exceeded");let l=0;return Ff(async()=>{const c=await this.getToken(e,o||l>0);try{const u=await this.post({[n]:c,...i},Gt(a||{},{headers:{"x-mw-token-name":e}}));if(De.isBadTokenError(u.data))throw u;return u}catch(u){throw De.isBadTokenError(u)||u?.ok===!1||oi.is(u)?u:new De(ji.HTTP_ERROR,"Network/transport or SDK-internal error (not a MediaWiki API error)",u)}},{retry:s,onRetry:(c,u)=>{l=u+1},shouldRetry:c=>De.isBadTokenError(c)||c?.ok===!1}).catch(c=>{throw De.isBadTokenError(c)||c?.ok===!1?new De(ji.TOKEN_RETRY_LIMIT_EXCEEDED,"Retry attempts for acquiring/using token exhausted",c):c})}postWithEditToken(e){return this.postWithToken("csrf",e)}get baseURL(){return this.config.baseURL}get defaultParams(){return this.config.defaultParams}get defaultOptions(){return this.config.fexiosConfigs}};Ui.INIT_DEFAULT_PARAMS={action:"query",errorformat:"plaintext",format:"json",formatversion:2},Ui.DEFAULT_CONFIGS={baseURL:void 0,fexiosConfigs:{responseType:"json"},defaultParams:Ui.INIT_DEFAULT_PARAMS,throwOnApiError:!1},Ui.createRequestHandler=Zo;let ea=Ui;/**
|
|
55
55
|
* WikiSaikou
|
|
56
56
|
* @description Standalone MediaWiki API SDK with `mw.Api`-like API in any environments
|
|
57
57
|
* @author Dragon-Fish <dragon-fish@qq.com>
|
|
58
58
|
* @license MIT
|
|
59
|
-
*/let Lf=class extends ea{async clientLogin(e,i,r){r||(r={}),!r.logincontinue&&!r.loginreturnurl&&(r.loginreturnurl=location?.origin);const n=await this.postWithToken("login",{action:"clientlogin",username:e,password:i,...r},{tokenName:"logintoken"});if(n?.data?.clientlogin?.status==="PASS")return n.data.clientlogin;throw new Re(Ui.LOGIN_FAILED,n.data.clientlogin.message,n)}};class Nf{constructor(e,i={}){this.ctx=e,location?.href&&i?.baseURL?.toString()?.startsWith("/")&&(i.baseURL=new URL(i.baseURL,location.origin));const r=new Lf({baseURL:i.baseURL.toString(),fexiosConfigs:{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`,...i.headers},...i},throwOnApiError:!0});e.set("api",r)}}var Mf=Object.create,Vn=Object.defineProperty,Df=Object.getOwnPropertyDescriptor,ta=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ia=t=>{throw TypeError(t)},jf=(t,e,i)=>e in t?Vn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Uf=(t,e)=>Vn(t,"name",{value:e,configurable:!0}),Ff=t=>[,,,Mf(t?.[ta("metadata")]??null)],Bf=["class","method","getter","setter","accessor","field","value","get","set"],ra=t=>t!==void 0&&typeof t!="function"?ia("Function expected"):t,qf=(t,e,i,r,n)=>({kind:Bf[t],name:e,metadata:r,addInitializer:s=>i._?ia("Already initialized"):n.push(ra(s||null))}),Hf=(t,e)=>jf(e,ta("metadata"),t[3]),zf=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Wf=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&Df(n,i));Uf(n,i);for(var g=r.length-1;g>=0;g--)l=qf(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,ra(o)&&(n=o);return Hf(t,n),b&&Vn(n,i,b),u?c^4?s:b:n},na,Gn,sa;na=[Se(["wiki","wikiTitle"])];class Pr extends(sa=_t){constructor(i){super(i,"currentPage",!1);Ri(this,Me);this.ctx=i,this.url=new URL(window.location.href),this.isMainPage=void 0,this.wikiTitle=void 0}get logger(){return this.ctx.logger("CURRENT_PAGE")}async start(){await Ge(this,Me,To).call(this),Ge(this,Me,Du).call(this),window.addEventListener("popstate",Ge(this,Me,Ro).bind(this)),this.logger.info("initialized",this.wikiTitle)}stop(){window.removeEventListener("popstate",Ge(this,Me,Ro).bind(this))}get params(){return this.url.searchParams}get canonicalUrl(){const i=document.querySelector('link[rel="canonical"]')?.href;let r=null;return i&&(r=new URL(i,location.origin)),Reflect.defineProperty(this,"canonicalUrl",{get:()=>r}),r}get wikiAction(){return this.params.get("action")||"view"}}Me=new WeakSet,To=async function(){await Ge(this,Me,Uu).call(this),await Ge(this,Me,ju).call(this)},Du=function(){const i=Symbol.for("InPageEdit.CurrentPageService.UrlChangeListenerInstalled");if(window[i])return;const r=history.pushState,n=history.replaceState;history.pushState=function(s,o,a){r.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},history.replaceState=function(s,o,a){n.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},window[i]=!0},Ro=async function(i){const r=this.url,n=new URL(window.location.href);this.url=n,(r.pathname!==n.pathname||r.searchParams.get("title")!==n.searchParams.get("title")||r.searchParams.get("curid")!==n.searchParams.get("curid"))&&(await Ge(this,Me,To).call(this),this.logger.info("location changed",n,this.wikiTitle))},ju=async function(){const r=this.wikiTitle?.getMainDBKey()===this.ctx.wiki.mainPageName;return Reflect.defineProperty(this,"isMainPage",{get:()=>r}),r},Uu=async function(){let i=null;return this.canonicalUrl?i=await this.ctx.wikiTitle.newTitleFromUrl(this.canonicalUrl):i=await this.ctx.wikiTitle.newTitleFromUrl(this.url),Object.freeze(i),Reflect.defineProperty(this,"wikiTitle",{get:()=>i}),i},Gn=Ff(sa),Pr=Wf(Gn,0,"CurrentPageService",na,Pr),zf(Gn,1,Pr);class Kf extends _t{constructor(e){super(e,"resourceLoader",!0),this.ctx=e}stop(){}loadScript(e,i){if(!e)return Promise.resolve(null);const r=`script:${e}`,n=document.querySelector(`[data-ipe="${r}"]`);return n?Promise.resolve(n):new Promise((o,a)=>{const l=document.createElement("script");l.src=e,l.dataset.ipe=r,i&&Object.entries(i).forEach(([c,u])=>{typeof u>"u"||u===!1||u===null?l.removeAttribute(c):l.setAttribute(c,u)}),document.body.appendChild(l),l.onload=()=>o(l),l.onerror=c=>a(c)})}loadStyle(e,i){if(!e)return Promise.resolve(null);const r=`style:${e}`,n=document.querySelector(`[data-ipe="${r}"]`);return n?Promise.resolve(n):new Promise((o,a)=>{const l=document.createElement("link");l.rel="stylesheet",l.href=e,l.dataset.ipe=r,i&&Object.entries(i).forEach(([u,f])=>{typeof f>"u"||f===!1||f===null?l.removeAttribute(u):l.setAttribute(u,f)}),(document.querySelector('meta[name="ipe-styles"]')||(()=>{const u=document.createElement("meta");return u.id="ipe-styles",u.name="ipe-styles",document.head.insertAdjacentElement("afterbegin",u),u})()).before(l),l.onload=()=>o(l),l.onerror=u=>a(u)})}resolveImportPath(e){if(e.startsWith("http")||e.startsWith("//"))return e;const i=document.currentScript?.src;if(!i)return`https://unpkg.com/mediawiki-inpageedit@latest/dist/${e}`;const r=new URL(i);return r.pathname.endsWith(".js")||(r.pathname=r.pathname+"/"),new URL(e,r.toString()).toString()}}const Cr=Object.keys;function Vf(t){return typeof t=="boolean"}function Gf(t){return t&&typeof t.nodeType=="number"}function Or(t){return typeof t=="string"}function oa(t){return typeof t=="number"}function Gt(t){return typeof t=="object"?t!==null:Bi(t)}function Bi(t){return typeof t=="function"}function Qf(t){return!!(t&&t.isComponent)}function Yf(t){return Gt(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function Qn(t,e){if(t)for(const i of Cr(t))e(t[i],i)}function Xf(t){return Gt(t)&&"current"in t}const Yn={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function Jf(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Zf=["Webkit","ms","Moz","O"];Cr(Yn).forEach(t=>{Zf.forEach(e=>{Yn[Jf(e,t)]=0})});const eh=Symbol.for("jsx-dom:type");var aa=function(t){return t.ShadowRoot="ShadowRoot",t}(aa||{});function th(t){return t!=null&&t[eh]===aa.ShadowRoot}const ih="http://www.w3.org/2000/svg",rh="http://www.w3.org/1999/xlink",nh="http://www.w3.org/XML/1998/namespace";function la(t){return!Vf(t)&&t!=null}function Xn(t){return Array.isArray(t)?t.map(Xn).filter(Boolean).join(" "):Gt(t)?Symbol.iterator in t?Xn(Array.from(t)):Cr(t).filter(e=>t[e]).join(" "):la(t)?""+t:""}const sh={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},oh=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function xt(t){const e=document.createDocumentFragment();return Ar(t.children,e),e}function ah(t,e,i){e={...e,children:i};const r=new t(e),n=r.render();return"ref"in e&&Jn(e.ref,r),n}function y(t,e){let{children:i,...r}=e;!r.namespaceURI&&sh[t]===0&&(r={...r,namespaceURI:ih});let n;if(Or(t)){if(n=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),fh(r,n),Ar(i,n),n instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));n.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else n.value=r.value;Jn(r.ref,n)}else if(Bi(t))Gt(t.defaultProps)&&(r={...t.defaultProps,...r}),n=Qf(t)?ah(t,r,i):t({...r,children:i});else throw new TypeError(`Invalid JSX element type: ${t}`);return n}function lh(t,e){for(var i=arguments.length,r=new Array(i>2?i-2:0),n=2;n<i;n++)r[n-2]=arguments[n];return(Or(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),y(t,{...e,children:r},e.key)}function Jn(t,e){Xf(t)?t.current=e:Bi(t)&&t(e)}function Ar(t,e){if(Yf(t))ch(t,e);else if(Or(t)||oa(t))Zn(document.createTextNode(t),e);else if(t===null)Zn(document.createComment(""),e);else if(Gf(t))Zn(t,e);else if(th(t)){const i=e.attachShadow(t.attr);Ar(t.children,i),Jn(t.ref,i)}}function ch(t,e){for(const i of[...t])Ar(i,e);return e}function Zn(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Tr(t,e){return t.replace(/[A-Z]/g,i=>e+i.toLowerCase())}function ca(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(i=>ca(t,i)):Or(e)?t.setAttribute("style",e):Gt(e)&&Qn(e,(i,r)=>{r.indexOf("-")===0?t.style.setProperty(r,i):oa(i)&&Yn[r]!==0?t.style[r]=i+"px":t.style[r]=i}))}function uh(t,e,i){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":ua(i,rh,Tr(t,":"),e);return;case"xmlnsXlink":li(i,Tr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":ua(i,nh,Tr(t,":"),e);return}switch(t){case"htmlFor":li(i,"for",e);return;case"dataset":Qn(e,(r,n)=>{r!=null&&(i.dataset[n]=r)});return;case"innerHTML":case"innerText":case"textContent":la(e)&&(i[t]=e);return;case"dangerouslySetInnerHTML":Gt(e)&&(i.innerHTML=e.__html);return;case"value":if(e==null||i instanceof window.HTMLSelectElement)return;if(i instanceof window.HTMLTextAreaElement){i.value=e;return}break;case"spellCheck":i.spellcheck=e;return;case"class":case"className":Bi(e)?e(i):li(i,"class",Xn(e));return;case"ref":case"namespaceURI":return;case"style":ca(i,e);return;case"on":case"onCapture":Qn(e,(r,n)=>{i.addEventListener(n,r,t==="onCapture")});return}if(Bi(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const n=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":n&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!n&&i[r]===null)i[r]=e;else if(n)i.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),i.addEventListener(s,e)}}}else Gt(e)?i[t]=e:e===!0?li(i,t,""):e!==!1&&e!=null&&(i instanceof SVGElement&&!oh.test(t)?li(i,Tr(t,"-"),e):li(i,t,e))}function li(t,e,i){t.setAttribute(e,i)}function ua(t,e,i,r){t.setAttributeNS(e,i,r)}function fh(t,e){for(const i of Cr(t))uh(i,t[i],e);return e}const Rr=Object.keys;function hh(t){return typeof t=="boolean"}function dh(t){return t&&typeof t.nodeType=="number"}function es(t){return typeof t=="string"}function fa(t){return typeof t=="number"}function Qt(t){return typeof t=="object"?t!==null:qi(t)}function qi(t){return typeof t=="function"}function ph(t){return!!(t&&t.isComponent)}function mh(t){return Qt(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function ts(t,e){if(t)for(const i of Rr(t))e(t[i],i)}function gh(t){return Qt(t)&&"current"in t}const is={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function yh(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const bh=["Webkit","ms","Moz","O"];Rr(is).forEach(t=>{bh.forEach(e=>{is[yh(e,t)]=0})});const wh=Symbol.for("jsx-dom:type");var ha=function(t){return t.ShadowRoot="ShadowRoot",t}(ha||{});function vh(t){return t!=null&&t[wh]===ha.ShadowRoot}const _h="http://www.w3.org/2000/svg",xh="http://www.w3.org/1999/xlink",Sh="http://www.w3.org/XML/1998/namespace";function da(t){return!hh(t)&&t!=null}function rs(t){return Array.isArray(t)?t.map(rs).filter(Boolean).join(" "):Qt(t)?Symbol.iterator in t?rs(Array.from(t)):Rr(t).filter(e=>t[e]).join(" "):da(t)?""+t:""}const kh={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Eh=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function $h(t){const e=document.createDocumentFragment();return Ir(t.children,e),e}function Ph(t,e,i){e={...e,children:i};const r=new t(e),n=r.render();return"ref"in e&&ns(e.ref,r),n}function fe(t,e){let{children:i,...r}=e;!r.namespaceURI&&kh[t]===0&&(r={...r,namespaceURI:_h});let n;if(es(t)){if(n=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Ah(r,n),Ir(i,n),n instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));n.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else n.value=r.value;ns(r.ref,n)}else if(qi(t))Qt(t.defaultProps)&&(r={...t.defaultProps,...r}),n=ph(t)?Ph(t,r,i):t({...r,children:i});else throw new TypeError(`Invalid JSX element type: ${t}`);return n}function ns(t,e){gh(t)?t.current=e:qi(t)&&t(e)}function Ir(t,e){if(mh(t))Ch(t,e);else if(es(t)||fa(t))ss(document.createTextNode(t),e);else if(t===null)ss(document.createComment(""),e);else if(dh(t))ss(t,e);else if(vh(t)){const i=e.attachShadow(t.attr);Ir(t.children,i),ns(t.ref,i)}}function Ch(t,e){for(const i of[...t])Ir(i,e);return e}function ss(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Lr(t,e){return t.replace(/[A-Z]/g,i=>e+i.toLowerCase())}function pa(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(i=>pa(t,i)):es(e)?t.setAttribute("style",e):Qt(e)&&ts(e,(i,r)=>{r.indexOf("-")===0?t.style.setProperty(r,i):fa(i)&&is[r]!==0?t.style[r]=i+"px":t.style[r]=i}))}function Oh(t,e,i){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":ma(i,xh,Lr(t,":"),e);return;case"xmlnsXlink":ci(i,Lr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":ma(i,Sh,Lr(t,":"),e);return}switch(t){case"htmlFor":ci(i,"for",e);return;case"dataset":ts(e,(r,n)=>{r!=null&&(i.dataset[n]=r)});return;case"innerHTML":case"innerText":case"textContent":da(e)&&(i[t]=e);return;case"dangerouslySetInnerHTML":Qt(e)&&(i.innerHTML=e.__html);return;case"value":if(e==null||i instanceof window.HTMLSelectElement)return;if(i instanceof window.HTMLTextAreaElement){i.value=e;return}break;case"spellCheck":i.spellcheck=e;return;case"class":case"className":qi(e)?e(i):ci(i,"class",rs(e));return;case"ref":case"namespaceURI":return;case"style":pa(i,e);return;case"on":case"onCapture":ts(e,(r,n)=>{i.addEventListener(n,r,t==="onCapture")});return}if(qi(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const n=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":n&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!n&&i[r]===null)i[r]=e;else if(n)i.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),i.addEventListener(s,e)}}}else Qt(e)?i[t]=e:e===!0?ci(i,t,""):e!==!1&&e!=null&&(i instanceof SVGElement&&!Eh.test(t)?ci(i,Lr(t,"-"),e):ci(i,t,e))}function ci(t,e,i){t.setAttribute(e,i)}function ma(t,e,i,r){t.setAttributeNS(e,i,r)}function Ah(t,e){for(const i of Rr(t))Oh(i,t[i],e);return e}var os=(t=>(t.Init="modal.init",t.BeforeShow="modal.beforeShow",t.Show="modal.show",t.BeforeClose="modal.beforeClose",t.Close="modal.close",t.Destroy="modal.destroy",t.ToastShow="toast.show",t.ToastClose="toast.close",t))(os||{});let Th=0;const ga=t=>`${t}-${++Th}`;function Hi(t){return t instanceof Node?t:document.createTextNode(String(t))}function St(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function ya(t){const e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(i=>!!(i.offsetWidth||i.offsetHeight||i.getClientRects().length))}function Ee(t,e={}){const i=document.createElement(t);if(e.className&&(i.className=e.className),e.html!=null&&(i.innerHTML=e.html),e.text!=null&&(i.textContent=e.text),e.attrs)for(const[r,n]of Object.entries(e.attrs))i.setAttribute(r,n);return i}const Rh=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform),ba=["ctrl","alt","shift","meta"];function Ih(t){if(!t)return null;const e=String(t).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean),i=[];let r=null;const n=o=>{i.includes(o)||i.push(o)};for(const o of e){let a=o;if(a==="control"||a==="ctrl"){n("ctrl");continue}if(a==="alt"||a==="option"){n("alt");continue}if(a==="shift"){n("shift");continue}if(a==="meta"||a==="cmd"||a==="command"||a==="super"){n("meta");continue}if(a==="mod"){n(Rh?"meta":"ctrl");continue}a==="esc"&&(a="escape"),a==="return"&&(a="enter"),(a==="space"||a==="spacebar")&&(a="space"),r=a}const s=ba.filter(o=>i.includes(o));return!r||r===""?s.length?s.join("+"):null:s.length?`${s.join("+")}+${r}`:r}function Lh(t){const e=[];t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta");let i=t.key;i===" "&&(i="space");const r=(i.length,i.toLowerCase()),n=ba.filter(s=>e.includes(s));return n.length?`${n.join("+")}+${r}`:r}class Nh{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(i=>i!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,i){const r=new Set((Array.isArray(i)?i:i?[i]:[]).map(String)),n=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=n.size?n.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()})}removeAll(){[...this.stack].forEach(e=>e.destroy()),this.stack=[]}syncZ(){this.stack.forEach((e,i)=>e.setZIndex(this.zBase+i*2))}lockBodyScroll(){document.body.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.body.classList.remove("ipe-modal-no-scroll")}}const Ie=new Nh;let Mh=(qt=class{constructor(e={}){this.backdropId=ga("ipe-modal-backdrop"),this.modalId=ga("ipe-modal"),this.numberId=this.modalId.split("-")[1],this._isDestroyed=!1,this.pluginName="normalModal",this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap=new Map,this.isOpen=!1,this.isToast=!1,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.modalStartX=0,this.modalStartY=0,this.Event=os,this._hooks=[],this.startCloseTimer=i=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),i)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=i=>{if(!this.isDragging)return;i.preventDefault();const r=i.clientX-this.dragStartX,n=i.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+n;s.style.left=`${o}px`,s.style.top=`${a}px`},this.onDragEnd=()=>{if(!this.isDragging)return;this.isDragging=!1,document.removeEventListener("pointermove",this.onDragMove),document.removeEventListener("pointerup",this.onDragEnd);const i=this.get$modal(),r=this.get$window();i.classList.remove("is-dragging"),r.style.animation="none",requestAnimationFrame(()=>{this.applyAnimation(!0)})},this.options={...qt.DEFAULT_OPTIONS,...e},this.options.backdrop===!1&&e.bodyScroll===void 0&&(this.options.bodyScroll=!0)}get isDestroyed(){return this._isDestroyed}static extends(e={}){return class extends this{constructor(i={}){super({...e,...i})}}}init(){if(this.$modal)return this;const e=this.options.backdrop!==!1;let i;e&&(i=Ee("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=Ee("div",{className:"ipe-modal-modal",attrs:{id:this.modalId,role:"dialog","aria-modal":"true",tabindex:"-1"}});if(r.modal=this,!e){r.classList.add("no-backdrop");const b=window.pageYOffset||document.documentElement.scrollTop,g=window.pageXOffset||document.documentElement.scrollLeft,E=window.innerWidth;r.style.top=`${b+60}px`,this.once("modal.show",()=>{r.style.left=`${g+E/2-r.offsetWidth/2}px`})}const n=Ee("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});n.modal=this;const s=Ee("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=Ee("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=Ee("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const b=Ee("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"×"});b.addEventListener("click",()=>{let g=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(g=!1):this.options.onClickClose===!1&&(g=!1),g&&this.close()}),l.appendChild(b)}s.append(a,l),!e&&this.options.draggable&&(s.style.cursor="move",s.style.userSelect="none",s.addEventListener("pointerdown",this.onDragStart.bind(this)));const c=Ee("div",{className:"ipe-modal-modal__content"}),u=Ee("div",{className:"ipe-modal-modal__footer"}),f=Ee("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),d=Ee("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return u.append(f,d),n.append(s,c,u),r.appendChild(n),this.$backdrop=i,this.$modal=r,this.$window=n,this.$header=s,this.$title=a,this.$icons=l,this.$content=c,this.$footer=u,this.$buttonsLeft=f,this.$buttonsRight=d,this.options.title&&this.setTitle(this.options.title),this.options.content&&this.setContent(this.options.content),this.options.buttons?.length?this.setButtons(this.options.buttons):u.style.display="none",this.options.center&&this.$modal.classList.add("is-centered"),this.options.fitScreen&&this.$modal.classList.add("is-fullscreen"),this.options.iconButtons&&this.$header.classList.add("has-icon-buttons"),this.options.className&&this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)),typeof this.options.fixedHeight=="number"?this.$window.style.height=`${Math.max(0,this.options.fixedHeight)}px`:this.options.fixedHeight===!0&&this.$window.classList.add("is-fixed-height"),i&&i.addEventListener("pointerdown",b=>{this.options.outSideClose&&b.target===i&&this.close()}),this.onKeyDown=this.onKeyDown.bind(this),this.emit("modal.init"),this}show(){if(this.$modal||this.init(),!this.$modal)throw new Error("Failed to initialize modal");if(this.isOpen)return this;{const r=this.emit("modal.beforeShow",!0),n=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!n)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&Ie.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),Ie.push(this),this.isOpen=!0,this.options.onShow?.(this),this.emit("modal.show");const e=typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time,i=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),i&&(this.$window?.addEventListener("mouseenter",this.stopCloseTimer),this.$window?.addEventListener("mouseleave",()=>this.startCloseTimer(e)))),this}close(){if(!this.isOpen)return this;{const s=this.emit("modal.beforeClose",!0),o=this.options.beforeClose?this.options.beforeClose(this)!==!1:!0;if(!s||!o)return this}if(this.isToast){this.applyAnimation(!1),this.emit("modal.close"),this.emit("toast.close");const s=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let o=!1;const a=()=>{o||(o=!0,this.destroy(),this.options.onClose?.(this))},l=(c,u)=>{const f=()=>{c.removeEventListener(u,f),a()};c.addEventListener(u,f,{once:!0})};return s>0&&this.$window?(l(this.$window,"transitionend"),l(this.$window,"animationend"),window.setTimeout(a,s+20)):window.setTimeout(a,s),this}this.applyAnimation(!1),this.$backdrop?.classList.remove("is-open"),this.$modal?.classList.remove("is-open"),this.emit("modal.close");const e=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let i=!1;const r=()=>{i||(i=!0,this.destroy(),this.options.onClose?.(this))},n=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(n(this.$window,"transitionend"),n(this.$window,"animationend"),window.setTimeout(r,e+20)):window.setTimeout(r,e),this}destroy(){if(this._isDestroyed)return this;if(this.stopCloseTimer(),document.removeEventListener("keydown",this.onKeyDown),this.isDragging&&this.onDragEnd(),this.$window?.removeEventListener("mouseenter",this.stopCloseTimer),this.isToast){this.$window?.parentElement&&this.$window.parentElement.removeChild(this.$window);const e=Yt.indexOf(this);e!==-1&&Yt.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),Ie.remove(this),this.shouldUnlockBodyOnClose()&&Ie.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return St(this.$modal,"modal")}get$window(){return St(this.$window,"window")}get$header(){return St(this.$header,"header")}get$title(){return St(this.$title,"title")}get$content(){return St(this.$content,"content")}get$icons(){return St(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?St(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?St(this.$buttonsRight,"rightButtons"):St(this.$footer,"buttons")}setTitle(e){const i=this.get$title();return i.innerHTML="",i.append(Hi(e)),this}setContent(e,i="replace"){const r=this.get$content();return i==="replace"?(r.innerHTML="",r.append(Hi(e))):i==="append"?r.append(Hi(e)):r.prepend(Hi(e)),this}setIcons(e){const i=this.get$icons();i.innerHTML="";for(const r of e){const n=Ee("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});n.addEventListener("click",r.method),i.appendChild(n)}return this}setButtons(e,i){const r=this.$buttonsLeft,n=this.$buttonsRight;[r,n].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=i??this.$footer;if(s===this.$footer)e.forEach(o=>this.addButton(o)),e.length===0&&(this.$footer.style.display="none");else{s.innerHTML="";for(const o of e){const a=this.generateButton(o);s.appendChild(a)}}return this}generateButton(e){const i=e.type??"button",r=i==="link"?Ee("a"):Ee("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const n=Hi(e.label??"OK");if(r.append(n),i==="link"&&e.href&&(r.href=e.href),e.method&&r.addEventListener("click",s=>{if(r._ipe_tmpDisabled){s.preventDefault(),s.stopPropagation();return}e.method.call(r,s,this)}),typeof e.closeAfter=="number"&&e.closeAfter>=0&&r.addEventListener("click",()=>{window.setTimeout(()=>this.close(),e.closeAfter)}),typeof e.enableAfter=="number"&&e.enableAfter>0){i==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{i==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}if(e.keyPress){const s=String(e.keyPress).split(/[\,\|]+/g).map(o=>o.trim()).filter(Boolean);for(const o of s){const a=Ih(o);a&&this.keyMap.set(a,r)}}return r}addButton(e,i){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",n=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(i??s.length,s.length));return a>=n.children.length?n.appendChild(o):n.insertBefore(o,n.children[a]),s.splice(a,0,o),this}removeButton(e){const i=this.buttonElsLeft,r=this.buttonElsRight,n=[...i,...r];let s=null;if(e==="*")return n.forEach(a=>{this.keyMap.delete(a.id),a.parentElement?.removeChild(a)}),this.$footer&&(this.$footer.style.display="none"),this;if(typeof e=="number"?s=n[e]??null:typeof e=="string"?s=n.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=n.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=i.indexOf(s);return o!==-1?(i.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),i.length===0&&r.length===0&&this.$footer&&(this.$footer.style.display="none"),this}changePreviewState(){return this.get$modal().classList.toggle("is-fullscreen"),this}setModalHeight(e,i="height"){const r=this.get$window(),n=Math.max(0,window.innerHeight-e);return r.style[i]=`${n}px`,n}setOptions(e,i){return typeof e=="string"?this.options[e]=i:Object.assign(this.options,e),this}setPluginName(e){return this.$window&&(this.$window.className=this.$window.className.replace(`plugin--${this.pluginName}`,`plugin--${e}`)),this.pluginName=e,this}applyAnimation(e){const i=this.get$modal(),r=this.get$window(),n=this.$backdrop,s=this.options.modalAnimation??this.options.animation,o=typeof s=="string"?s:s&&(e?s.show:s.hide),a=this.options.backdropAnimation??this.options.animation,l=typeof a=="string"?a:a&&(e?a.show:a.hide);!o||o===!1?(i.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(i.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),n&&(!l||l===!1?n.style.transition="none":n.style.removeProperty("transition"))}on(e,i){return this._hooks.push({type:e,listener:i}),()=>this.off(e,i)}off(e,i){return this._hooks=this._hooks.filter(r=>r.type!==e&&(i?r.listener!==i:!0)),this}once(e,i){const r=this.on(e,n=>(r(),i(n)));return r}emit(e,i){const r=this._hooks.filter(a=>a.type===e);let n=!0;for(const a of r){const l=new CustomEvent(e,{detail:this,cancelable:i}),c=a.listener(l);if(l.defaultPrevented&&(n=!1),c===!1&&(n=!1),!n)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:i});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(n=!1),n}focusFirst(){const e=this.get$modal(),i=ya(e);i.length?i[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(Ie.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const i=this.get$modal();if(!i.contains(document.activeElement))return;if(e.key==="Tab"){const a=ya(i);if(!a.length)return;const l=a[0],c=a[a.length-1],u=document.activeElement;e.shiftKey&&u===l?(e.preventDefault(),c.focus()):!e.shiftKey&&u===c&&(e.preventDefault(),l.focus())}const r=e.ctrlKey||e.altKey||e.metaKey,n=e.target;if(!r&&(n&&["INPUT","TEXTAREA"].includes(n.tagName)||n.contentEditable==="true"))return;const s=Lh(e),o=this.keyMap.get(s);if(o){e.preventDefault(),o.click();return}}setZIndex(e){this.$backdrop&&(this.$backdrop.style.zIndex=String(e)),this.$modal&&(this.$modal.style.zIndex=String(e+1))}bringToFront(){return Ie.remove(this),Ie.push(this),this}isAnimationDisabled(){const e=this.options.modalAnimation??this.options.animation;return e===!1||e==null}shouldLockBodyOnOpen(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Ie.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Ie.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}onDragStart(e){if(this.options.backdrop!==!1||!this.options.draggable)return;e.preventDefault(),this.isDragging=!0,this.bringToFront(),this.dragStartX=e.clientX,this.dragStartY=e.clientY;const i=this.get$modal(),r=i.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,i.style.transform="none",i.style.left=`${this.modalStartX}px`,i.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),i.classList.add("is-dragging")}showToast(e){this.$window||this.init();const i=Dh(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),i.appendChild(r);const n=(typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time)??3e3,s=(typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover)??!0;return n>0&&(this.startCloseTimer(n),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(n)))),this.isOpen=!0,this.options.onShow?.(this),Yt.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,i){return new this(e).init().show()}static createObject(e,i){return new this(e)}static close(e){if(!e){const s=Ie.top();return s?.close(),s}const i=typeof e=="string"?e:e.id,r=Ie.stack.find(s=>s.modalId===i);if(r)return r.close(),r;const n=Yt.find(s=>s.modalId===i);return n?.close(),n}static closeAll(e,i){const r=new Set((Array.isArray(i)?i:i?[i]:[]).map(String)),n=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return Ie.closeAll(e,i),[...Yt].forEach(s=>{const o=s.modalId,a=n.size?n.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),Ie.top()??new qt}static removeAll(){Ie.removeAll(),[...Yt].forEach(e=>e.destroy())}static dialog(e,i){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary is-ghost",method:(n,s)=>{i?.(n,s),n.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,i){e.title??(e.title="Confirm"),e.content??(e.content="Are you sure you want to perform this action?");const r=e.okBtn??{label:"OK",className:"is-primary is-ghost"},n=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"};return new this({sizeClass:"dialog",...e,buttons:[{label:n.label,className:n.className,keyPress:"n",method:(s,o)=>{i?.(!1,o,s),o.close()}},{label:r.label,className:r.className,keyPress:"y",method:(s,o)=>{i?.(!0,o,s),s.defaultPrevented||o.close()}}]}).init().show()}static getDefaultNotifyIcon(e){switch(e){case"success":return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-circle-check",children:[fe("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),fe("path",{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"})]});case"error":return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-triangle",children:[fe("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),fe("path",{d:"M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"warning":return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-circle",children:[fe("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),fe("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"info":return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-info-circle",children:[fe("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),fe("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z"})]});case"dialog":return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-message-dots",children:[fe("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),fe("path",{d:"M12 11v.01"}),fe("path",{d:"M8 11v.01"}),fe("path",{d:"M16 11v.01"}),fe("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"})]});case"confirm":return fe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-copy-check",children:[fe("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),fe("path",{d:"M18.333 6a3.667 3.667 0 0 1 3.667 3.667v8.666a3.667 3.667 0 0 1 -3.667 3.667h-8.666a3.667 3.667 0 0 1 -3.667 -3.667v-8.666a3.667 3.667 0 0 1 3.667 -3.667zm-3.333 -4c1.094 0 1.828 .533 2.374 1.514a1 1 0 1 1 -1.748 .972c-.221 -.398 -.342 -.486 -.626 -.486h-10c-.548 0 -1 .452 -1 1v9.998c0 .32 .154 .618 .407 .805l.1 .065a1 1 0 1 1 -.99 1.738a3 3 0 0 1 -1.517 -2.606v-10c0 -1.652 1.348 -3 3 -3zm1.293 9.293l-3.293 3.292l-1.293 -1.292a1 1 0 0 0 -1.414 1.414l2 2a1 1 0 0 0 1.414 0l4 -4a1 1 0 0 0 -1.414 -1.414"})]});default:return null}}static notify(e,i,r){var a,l,c,u;if(i?.overrideOther&&[...Yt].forEach(f=>f.close()),typeof i.title>"u"){const f=e||"Notification";i.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const n=i.icon??this.getDefaultNotifyIcon(e);n&&(n instanceof Element&&n.classList.add("ipe-modal-notify-icon"),i.title=fe($h,{children:[n,i.title]})),e==="confirm"&&(typeof i.closeAfter>"u"&&(i.closeAfter=0),i.okBtn||(i.okBtn={label:"OK"})),i.okBtn&&(typeof i.okBtn!="object"&&(i.okBtn={label:"OK"}),(a=i.okBtn).label??(a.label="OK"),(l=i.okBtn).className??(l.className="is-primary is-text ok-btn"),i.okBtn.method=(f,d)=>{r?.(!0,d,f),d.close()}),i.cancelBtn&&(typeof i.cancelBtn!="object"&&(i.cancelBtn={label:"Cancel"}),(c=i.cancelBtn).label??(c.label="Cancel"),(u=i.cancelBtn).className??(u.className="is-danger is-text cancel-btn"),i.cancelBtn.method=(f,d)=>{r?.(!1,d,f),d.close()}),i.buttons=[i.cancelBtn,i.okBtn,...i.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${i.className??""}`,o=new this({...i,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,buttons:i.buttons??[]});return o.setPluginName("toast"),o.showToast({position:i.position??"top right"})}},qt.DEFAULT_OPTIONS={className:"",sizeClass:"auto",center:!0,fitScreen:!1,closeIcon:!0,bodyScroll:!1,outSideClose:!0,backdrop:!0,animation:{show:"ipe-modal-fade-in",hide:"ipe-modal-fade-out"},animationSpeed:200},qt);const Yt=[];function Dh(t="top right"){const e="ipe-modal-toast-container",i=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(i);return r||(r=Ee("div",{className:`${e} ${t}`,attrs:{id:i,"data-position":t}}),document.body.appendChild(r)),r}const jh={ipe_progress:"_ipe_progress_so6hn_1"},Rt=t=>{const e=t.indeterminate??!0,i=y("div",{class:`${jh.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return i.setProgress=r=>{typeof r=="number"?(i.dataset.indeterminate="false",i.style.setProperty("--progress",`${r}%`)):(i.dataset.indeterminate="true",i.style.setProperty("--progress","0%"))},i};class be extends Mh{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",e.modalAnimation||(e.modalAnimation={show:"ipe-modal-fade-in",hide:"ipe-modal-fade-out"}),super(e)}setLoadingState(e){if(this.get$window().classList.toggle("loading",e),e){const i=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=i,i.forEach(r=>{r.disabled=!0}),this.get$content().append(y("div",{id:"ipe-modalLoadingWrapper",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.5)",zIndex:2e3},children:y(Rt,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const i=this._tmpDisabledActiveInputs;i&&i.forEach(r=>{r.disabled=!1})}}}class Uh{constructor(e){this.ctx=e,this.IPEModal=be,this.IPEModalEvent=os,this.show=be.show.bind(be),this.createObject=be.createObject.bind(be),this.close=be.close.bind(be),this.closeAll=be.closeAll.bind(be),this.removeAll=be.removeAll.bind(be),this.dialog=be.dialog.bind(be),this.confirm=be.confirm.bind(be),this.notify=be.notify.bind(be),e.set("modal",this),e.on("dispose",()=>{be.closeAll()})}}const wa=t=>{if(!t)return new URLSearchParams;if(t instanceof URLSearchParams)return t;if(typeof t!="object"||t?.constructor!==Object)throw new TypeError("only plain object is supported");const e=new URLSearchParams;for(const[i,r]of Object.entries(t))if(r!=null){if(Array.isArray(r)){for(const n of r)e.append(i,n?.toString());continue}if(typeof r=="object"&&r!==null&&r.constructor===Object){for(const[n,s]of Object.entries(r))s!=null&&e.set(`${i}[${n}]`,s?.toString());continue}e.set(i,r?.toString())}return e},va=(t,e,i)=>{const r=typeof t=="string"?new URL(t,window?.location?.origin):new URL(t),n=new URLSearchParams(r.search),s=wa(e);for(const[o,a]of s.entries())n.set(o,a);return r.search=n.toString(),r.hash="",r};var Fh=Object.create,as=Object.defineProperty,Bh=Object.getOwnPropertyDescriptor,_a=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xa=t=>{throw TypeError(t)},qh=(t,e,i)=>e in t?as(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Hh=(t,e)=>as(t,"name",{value:e,configurable:!0}),zh=t=>[,,,Fh(t?.[_a("metadata")]??null)],Wh=["class","method","getter","setter","accessor","field","value","get","set"],Sa=t=>t!==void 0&&typeof t!="function"?xa("Function expected"):t,Kh=(t,e,i,r,n)=>({kind:Wh[t],name:e,metadata:r,addInitializer:s=>i._?xa("Already initialized"):n.push(Sa(s||null))}),Vh=(t,e)=>qh(e,_a("metadata"),t[3]),Gh=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Qh=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&Bh(n,i));Hh(n,i);for(var g=r.length-1;g>=0;g--)l=Kh(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,Sa(o)&&(n=o);return Vh(t,n),b&&as(n,i,b),u?c^4?s:b:n},ka,ls,Ea;ka=[Se(["api","storage"])];class Nr extends(Ea=_t){constructor(e){super(e,"wiki",!1),this.ctx=e,this._data=void 0,this.CACHE_TTL=1e3*60*60*24,this.VERSION=2,this.db=void 0,this.logger=void 0,this.queryData={meta:"siteinfo|userinfo",siprop:"general|specialpagealiases|namespacealiases|namespaces|magicwords",uiprop:"groups|rights|blockinfo|options"},this.mwConfig={get:(i,r)=>window?.mw?.config?.get?.(i,r)??r,has:i=>window?.mw?.config?.exists?.(i)??!1,get values(){return window?.mw?.config?.values||{}}},this.db=e.storage.createDatabse("wiki-metadata",this.CACHE_TTL,this.VERSION),this.logger=e.logger("WIKI_METADATA")}get api(){return this.ctx.api}async start(){const e=await this.fetchFromCache();if(e)this._data=e,this.logger.debug("Using cached");else{const i=await this.fetchFromApi();this.saveToCache(i),this._data=i,this.logger.debug("Fetched from API")}this.logger.info("loaded",this._data),this.ctx.set("getUrl",this.getUrl.bind(this)),this.ctx.set("getSciprtUrl",this.getSciprtUrl.bind(this)),this.ctx.set("getMainpageUrl",this.getMainpageUrl.bind(this)),this.ctx.inject(["preferences"],i=>{i.preferences.registerCustomConfig("WikiMetadataService",re.object({WikiMetadataService:re.const(y("div",{children:[y("h3",{children:"Wiki Informations"}),y("ul",{children:[y("li",{children:[y("strong",{children:"Site:"})," ",this.general.sitename," (",this.landingPageUrl,")"]}),y("li",{children:[y("strong",{children:"User"}),": ",this.userInfo.name," (ID: ",this.userInfo.id,")"]}),y("li",{children:[y("strong",{children:"Groups"}),": ",this.userGroups.join(", ")||"None"]})]}),y("p",{children:y("button",{onClick:r=>{r.preventDefault(),this.invalidateCache().then(()=>{window.location.reload()})},children:"Clear caches and reload page"})})]})).role("raw-html")}).description("WikiMetadataService"),"general")})}get metadataCacheId(){return this.ctx.api.config.baseURL}async fetchFromApi(){return this.api.get({action:"query",...this.queryData}).then(({data:e})=>{if(typeof e?.query?.general>"u")throw new Error("Invalid siteinfo");return e.query}).catch(e=>(this.logger.error("Failed to fetch metadata",e),Promise.reject(e)))}async fetchFromCache(){const e=this.metadataCacheId,i=this.mwConfig.get("wgUserId",0),r=await this.db.get(e);return r&&typeof r=="object"&&r.general&&r.userinfo.id===i?r:(this.logger.info(r?"Cache mis-match":"Missing cache"),this.invalidateCache(),null)}async saveToCache(e){const i=this.metadataCacheId;return this.db.set(i,e)}async invalidateCache(){const e=this.metadataCacheId;return this.db.delete(e)}get _raw(){return this._data}get general(){return this._data.general}get specialPageAliases(){return this._data.specialpagealiases}get namespaceAliases(){return this._data.namespacealiases}get namespaces(){return this._data.namespaces}get namespaceMap(){const e=Object.values(this.namespaces).map(i=>({id:i.id,canonical:i.canonical,aliases:this.namespaceAliases.filter(r=>r.id===i.id).map(r=>r.alias)})).sort((i,r)=>i.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{get:()=>e}),e}get magicWords(){return this._data.magicwords}get userInfo(){return this._data.userinfo}get userOptions(){return this.userInfo.options}get isUserBlocked(){return this.userInfo.blockedbyid&&this.userInfo.blockexpiry&&new Date(this.userInfo.blockexpiry).getTime()>Date.now()}get userGroups(){return this.userInfo.groups}get userRights(){return this.userInfo.rights}get baseUrl(){const e=this.general.server;return e.startsWith("//")?`${window?.location?.protocol||"https:"}//${e.slice(2)}`:e}get landingPageUrl(){return this.general.base}get mainPageName(){return this.general.mainpage}get mainPageUrl(){return this.getUrl(this.mainPageName)}get articlePath(){return this.general.articlepath}get scriptPath(){return this.general.scriptpath}get articleBaseUrl(){return`${this.baseUrl}${this.articlePath}`}get scriptBaseUrl(){return`${this.baseUrl}${this.scriptPath}`}getSciprtUrl(e="index"){return`${this.scriptBaseUrl}/${e.replace(/\.php$/,"")}.php`}getMainpageUrl(e){return va(this._data.general.base,e).toString()}getUrl(e,i){const r=wa(i);let n;return typeof e=="string"&&e!==""?n=new URL(`${this.articleBaseUrl.replace("$1",e)}`):typeof e=="number"?(r.set("curid",e.toString()),n=new URL(this.getSciprtUrl("index"))):n=new URL(this.getSciprtUrl("index")),n.search=r.toString(),n.toString()}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(i=>this.hasRight(i))}hasEveryRights(...e){return e.every(i=>this.hasRight(i))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(i=>e.includes(i))}getBlockInfo(){return this.isUserBlocked?{blockid:this.userInfo.blockid,blockedby:this.userInfo.blockedbyid,blockedbyid:this.userInfo.blockedbyid,blockreason:this.userInfo.blockreason,blockedtimestamp:this.userInfo.blockedtimestamp,blockexpiry:this.userInfo.blockexpiry}:null}}ls=zh(Ea),Nr=Qh(ls,0,"WikiMetadataService",ka,Nr),Gh(ls,1,Nr);var rt;(t=>{function e(p){return new Promise((h,m)=>{p.onsuccess=()=>h(p.result),p.onerror=()=>m(p.error)})}t.promisifyRequest=e;const i=new Map,r=new Map;function n(p,h){const _=(r.get(p)??Promise.resolve()).then(h,h);return r.set(p,_.catch(()=>{})),_}function s(p){if(i.has(p))return i.get(p);const h=new Promise((m,_)=>{const x=indexedDB.open(p);x.onupgradeneeded=()=>{},x.onsuccess=()=>{const P=x.result;P.onversionchange=()=>{try{P.close()}finally{i.delete(p)}},m(P)},x.onerror=()=>_(x.error),x.onblocked=()=>{}});return i.set(p,h),h}t.openDatabase=s;async function o(p){const h=i.get(p);if(h)try{(await h).close()}finally{i.delete(p)}}t.closeDatabase=o;async function a(){const p=Array.from(i.keys());await Promise.all(p.map(o))}t.closeAllDatabases=a;async function l(p,h){return n(p,async()=>{let m=await s(p);if(m.objectStoreNames.contains(h))return m;const _=m.version+1;m.close();const x=new Promise((P,R)=>{const F=indexedDB.open(p,_);F.onupgradeneeded=()=>{const ge=F.result;ge.objectStoreNames.contains(h)||ge.createObjectStore(h)},F.onsuccess=()=>{const ge=F.result;ge.onversionchange=()=>{try{ge.close()}finally{i.delete(p)}},P(ge)},F.onerror=()=>R(F.error),F.onblocked=()=>{}});return i.set(p,x),x})}t.createStore=l;async function c(p,h){return{dbName:p,storeName:h,dbPromise:l(p,h)}}t.openStore=c;async function u(p,h,m){const x=(await p.dbPromise).transaction(p.storeName,h),P=x.objectStore(p.storeName),R=new Promise((F,ge)=>{x.oncomplete=()=>F(),x.onerror=()=>ge(x.error),x.onabort=()=>ge(x.error)});try{const F=await m(P);return await R,F}catch(F){try{x.abort()}catch{}throw F}}t.withObjectStore=u;async function f(p,h){return u(p,"readonly",async m=>{const _=m.get(h);return e(_)})}t.get=f;async function d(p,h,m){return u(p,"readwrite",async _=>{const x=_.put(m,h);await e(x)})}t.set=d;async function b(p,h){return u(p,"readwrite",async m=>{const _=m.delete(h);await e(_)})}t.del=b;async function g(p){return u(p,"readwrite",async h=>{const m=h.clear();await e(m)})}t.clear=g;async function E(p){return u(p,"readonly",async h=>{const m=h;if(typeof m.getAllKeys=="function"){const x=m.getAllKeys();return await e(x)}const _=[];return await new Promise((x,P)=>{const R=h.openKeyCursor();R.onsuccess=()=>{const F=R.result;if(!F)return x();_.push(F.key),F.continue()},R.onerror=()=>P(R.error)}),_})}t.keys=E;async function D(p){return u(p,"readonly",async h=>{const m=[],_=h;if(typeof _.getAll=="function"&&typeof _.getAllKeys=="function"){const[x,P]=await Promise.all([e(_.getAll()),e(_.getAllKeys())]);for(let R=0;R<P.length;R++)m.push([P[R],x[R]]);return m}return await new Promise((x,P)=>{const R=h.openCursor();R.onsuccess=()=>{const F=R.result;if(!F)return x();m.push([F.key,F.value]),F.continue()},R.onerror=()=>P(R.error)}),m})}t.entries=D;function k(p,h=100){return{[Symbol.asyncIterator](){let m=[],_=!1,x;const P=async()=>{_||(m=[],await u(p,"readonly",async R=>{const F=x===void 0?void 0:IDBKeyRange.lowerBound(x,!0);await new Promise((ge,Ht)=>{let ni=0;const zt=R.openCursor(F,"next");zt.onsuccess=()=>{const Wt=zt.result;if(!Wt||ni>=h){ge();return}m.push([Wt.key,Wt.value]),x=Wt.key,ni++,Wt.continue()},zt.onerror=()=>Ht(zt.error)}),m.length===0&&(_=!0)}))};return{async next(){return m.length===0&&!_&&await P(),m.length===0?{value:void 0,done:!0}:{value:m.shift(),done:!1}}}}}}t.entriesIter=k;function B(p,h=200){const m=k(p,h);return{[Symbol.asyncIterator](){const _=m[Symbol.asyncIterator]();return{async next(){const x=await _.next();return x.done?{value:void 0,done:!0}:{value:x.value[0],done:!1}}}}}}t.keysIter=B})(rt||(rt={}));class Yh extends _t{constructor(e){super(e,"storage",!1)}createDatabse(e,i,r){return new cs("InPageEdit",e,i,r)}}const Pn=class Pn{constructor(e,i,r=1/0,n){this.dbName=e,this.storeName=i,this.ttl=r,this.version=n,this.store=Pn.createStore(e,i),rt.set(this.store,"_touched",Date.now())}static createStore(e,i){const r=`${e}:${i}`;if(this._cached_stores.has(r))return this._cached_stores.get(r);const n=rt.createStore(e,i),s={dbName:e,storeName:i,dbPromise:n};return this._cached_stores.set(r,s),s}async keys(){return(await rt.keys(this.store)).map(i=>String(i))}async get(e,i=this.ttl,r){const n=await this.loadFromDB(e),s=this.checkIfExpired(n,i);if(!n||s){if(typeof r=="function"){const o=await r();return await this.set(e,o),o}return null}return n.value}async set(e,i){if(i===null||typeof i>"u")return this.delete(e);const r={time:Date.now(),value:i,version:this.version};return await rt.set(this.store,e,r),r}async has(e,i=this.ttl){const r=await this.loadFromDB(e),n=this.checkIfExpired(r,i);return r!==null&&!n}async delete(e){await rt.del(this.store,e)}async iterate(e){const i=await rt.entries(this.store);for(const[r,n]of i){const s=String(r),o=n;o&&typeof o.value<"u"&&e(o.value,s)}}async loadFromDB(e){const i=await rt.get(this.store,e);if(!i)return null;if(typeof i.time!="number"||typeof i.value>"u"){try{await this.delete(e)}catch{}return null}if(typeof this.version=="number"&&i.version!==this.version){try{await this.delete(e)}catch{}return null}return i}checkIfExpired(e,i=this.ttl){return e?Date.now()-e.time>i:!1}async clear(){return await rt.clear(this.store),this}};Pn._cached_stores=new Map;let cs=Pn;var Ye=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(Ye||{});function Xh(t){const i=class i{constructor(n,s=!0){this._loaded=s,this.api=t,n.revisions?.forEach(o=>{typeof o?.slots?.main=="object"&&Object.assign(o,o.slots.main)}),this.pageInfo={...i.DEFAULT_PAGE_INFO,...n}}static async newFromApi(n){const{data:s}=await this.api.get({...i.DEFAULT_QUERY_PARAMS,...n}),o=s?.query?.pages?.[0];if(!o||!o.title)throw new Error("Invalid page info",{cause:s});return new i(o,!0)}static newBlankPage(n={}){return new i(n,!1)}async parse(n){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...n})}async preview(n,s){return this.parse({action:"parse",page:void 0,title:this.title,text:n,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...s})}async edit(n,s){const{text:o,prependtext:a,appendtext:l,summary:c="",watchlist:u=Ye.preferences,section:f}=n;return this.api.postWithEditToken({action:"edit",title:this.title,starttimestamp:this.pageInfo.touched,basetimestamp:this.revisions[0]?.timestamp,text:o,prependtext:a,appendtext:l,summary:c,watchlist:u,section:f,...s})}async createOnly(n,s){return this.edit(n,{createonly:1,...s})}async delete(n,s){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:n,...s})}async moveTo(n,s,o){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:n,reason:s,movetalk:1,movesubpages:1,...o})}userCan(n){return!!this.pageInfo?.actions?.[n]}userCanEdit(){return this.userCan("edit")}async reloadSelfInfo(){const n=await i.newFromApi({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),s=(this.pageInfo.revisions||[]).concat(n.revisions||[]).sort((o,a)=>o.revid-a.revid).reduce((o,a)=>(o.find(l=>l.revid===a.revid)||o.push(a),o),[]);return this.pageInfo=n.pageInfo,this.pageInfo.revisions=s,this._loaded=!0,this}get pageid(){return this.pageInfo.pageid}get title(){return this.pageInfo.title}get ns(){return this.pageInfo.ns}get contentmodel(){return this.pageInfo.contentmodel}get fullurl(){return this.pageInfo.fullurl}get canonicalurl(){return this.pageInfo.canonicalurl}get editurl(){return this.pageInfo.editurl}get revisions(){return this.pageInfo.revisions||[]}get lastrevid(){return this.pageInfo.lastrevid}get templates(){return this.pageInfo.templates||[]}get images(){return this.pageInfo.images||[]}};i.api=t,i.DEFAULT_QUERY_PARAMS={action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|flags|comment|user|content",rvslots:"main"},i.DEFAULT_PAGE_INFO={pageid:0,ns:0,title:"",contentmodel:"wikitext",pagelanguage:"",pagelanguagehtmlcode:"",pagelanguagedir:"ltr",touched:new Date().toISOString(),lastrevid:0,length:0,protection:[],restrictiontypes:[],fullurl:"",canonicalurl:"",editurl:"",varianttitles:{},actions:{edit:!0,move:!1,delete:!1},revisions:[],templates:[],images:[]};let e=i;return e}const Po=class Po extends _t{constructor(e){super(e,"wikiPage",!0),this.ctx=e,this.WikiPage=Xh(this.ctx.api)}async createInstance(e,i=!1){return await this.WikiPage.newFromApi(e)}async newFromTitle(e,i=!1,r,n=!1){return this.createInstance({titles:e.toString(),converttitles:i,rvsection:r},n)}async newFromPageId(e,i,r=!1){return this.createInstance({pageids:e,rvsection:i},r)}async newFromRevision(e,i,r=!1){return await this.createInstance({revids:e,rvsection:i},r)}newBlankPage(e={}){return this.WikiPage.newBlankPage(e)}};Po.inject=["api"];let us=Po;const $a=new WeakMap,nt={toDBKey:t=>t.replace(/ /g,"_"),toNormalText:t=>t.replace(/_/g," "),ensureCase:(t,e)=>e==="first-letter"?t.charAt(0).toUpperCase()+t.slice(1):t},ui={normalizeSpecialPageName:t=>t.toLowerCase(),buildSpecialPageIndex:t=>{const e=new Map,i=new Map,r=new Map;for(const n of t.specialpagealiases){const s=n.realname;e.set(s,s);const o=ui.normalizeSpecialPageName(s);r.set(o,s);for(const a of n.aliases){i.set(a,s);const l=ui.normalizeSpecialPageName(a);r.set(l,s)}}return{byRealName:e,byAlias:i,byNormalized:r}},findSpecialPageRealName:(t,e)=>{const i=t.split("/")[0];let r=e.byRealName.get(i)??e.byAlias.get(i);if(r!==void 0)return r;const n=ui.normalizeSpecialPageName(i);return e.byNormalized.get(n)??null}},st={normalizeNamespaceText:t=>t.replace(/[_\s]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),buildIndex:t=>{const e=new Map,i=new Map,r=new Map,n=new Map;for(const[s,o]of Object.entries(t.namespaces)){const a=parseInt(s);e.set(o.name,a),i.set(o.canonical??"",a);const l=st.normalizeNamespaceText(o.name),c=st.normalizeNamespaceText(o.canonical??"");n.set(l,a),n.set(c,a)}for(const s of t.namespacealiases){r.set(s.alias,s.id);const o=st.normalizeNamespaceText(s.alias);n.set(o,s.id)}return{byName:e,byCanonical:i,byAlias:r,byNormalized:n}},findNamespaceId:(t,e)=>{let i=e.byName.get(t)??e.byCanonical.get(t)??e.byAlias.get(t);if(i!==void 0)return i;const r=st.normalizeNamespaceText(t);return e.byNormalized.get(r)??null},isTalkPage:t=>t%2===1&&t>0,getDefaultNamespaceInfo:t=>({id:t,name:"",canonical:"",case:"first-letter",content:!1,nonincludable:!1,subpages:!1})};function Jh(t){var s,o;const e=$a.get(t);if(e)return e;const i=st.buildIndex(t),r=ui.buildSpecialPageIndex(t),a=class a{constructor(c,u){Ri(this,s);Ri(this,o);if(this.newTitle=a.create.bind(a),this.toText=this.getPrefixedText.bind(this),this.toString=this.getPrefixedDBKey.bind(this),Ve(this,s,c||""),Ve(this,o,u??0),u===void 0&&this.fixNSByTitle(),this.getMainText()==="")throw new Error("Invalid title")}static create(c,u){return new a(c,u)}fixNSByTitle(){const c=Z(this,s).indexOf(":");if(c===-1)return;if(c===0){Ve(this,s,Z(this,s).substring(1));return}const u=Z(this,s).substring(0,c),f=Z(this,s).substring(c+1),d=st.findNamespaceId(u,a._namespaceIndex);d!==null&&(Ve(this,s,f),Ve(this,o,d))}getNamespaceInfo(){return a._meta.namespaces[Z(this,o)]??st.getDefaultNamespaceInfo(Z(this,o))}getMainDBKey(){const c=this.getNamespaceInfo();if(Z(this,o)===-1){const u=ui.findSpecialPageRealName(Z(this,s),a._specialPageIndex);if(u){const f=Z(this,s).includes("/")?Z(this,s).substring(Z(this,s).indexOf("/")):"",d=u+f;return nt.ensureCase(nt.toDBKey(d),c.case)}}return nt.ensureCase(nt.toDBKey(Z(this,s)),c.case)}getMainText(){const c=this.getNamespaceInfo();if(Z(this,o)===-1){const u=ui.findSpecialPageRealName(Z(this,s),a._specialPageIndex);if(u){const f=Z(this,s).includes("/")?Z(this,s).substring(Z(this,s).indexOf("/")):"",d=u+f;return nt.ensureCase(nt.toNormalText(d),c.case)}}return nt.ensureCase(nt.toNormalText(Z(this,s)),c.case)}getMainRootText(){return this.getMainText().split("/")[0]}getPrefixedDBKey(){return Z(this,o)===0?this.getMainDBKey():`${this.getNamespaceDBKey()}:${this.getMainDBKey()}`}getPrefixedText(){return Z(this,o)===0?this.getMainText():`${this.getNamespaceText()}:${this.getMainText()}`}getNamespaceId(){return Z(this,o)}getNamespaceText(){return this.getNamespaceInfo().name??""}getNamespaceDBKey(){const c=this.getNamespaceInfo();return nt.ensureCase(nt.toDBKey(this.getNamespaceText()),c.case)}getSubjectPage(){if(st.isTalkPage(Z(this,o))){const c=Z(this,o)-1;return new a(Z(this,s),c)}return this}getTalkPage(){if(st.isTalkPage(Z(this,o)))return this;if(Z(this,o)<0)return null;const c=Z(this,o)+1;return a._meta.namespaces[c.toString()]?new a(Z(this,s),c):null}getURL(c){const u=a._meta.general.articlepath,f=this.getPrefixedDBKey(),d=u.replace("$1",f),b=new URL(d,a._meta.general.base);return c&&(c instanceof URLSearchParams?c:new URLSearchParams(c)).forEach((E,D)=>{b.searchParams.set(D,E)}),b}setTitle(c){return Ve(this,s,c),Ve(this,o,0),this.fixNSByTitle(),this}setMainText(c){return Ve(this,s,c),this}setNamespaceText(c){const u=st.findNamespaceId(c,a._namespaceIndex);return u!==null&&Ve(this,o,u),this}setNamespaceId(c){return Ve(this,o,c),this}equals(c){return typeof c=="string"&&(c=new a(c)),this.getPrefixedDBKey()===c.getPrefixedDBKey()}isSpecial(c){if(Z(this,o)!==-1)return!1;const u=new a(c,-1);return this.getMainRootText()===u.getMainRootText()}toJSON(){return{ns:Z(this,o),text:this.getMainText(),title:this.getPrefixedText(),url:this.getURL().toString(),isSpecial:Z(this,o)<0}}};s=new WeakMap,o=new WeakMap,a._meta=t,a._namespaceIndex=i,a._specialPageIndex=r;let n=a;return $a.set(t,n),n}const dr=class dr extends _t{constructor(e){super(e,"wikiTitle",!0),this.ctx=e,this.logger=this.ctx.logger("WikiTitleService"),this._cachedTitles=new Map,this.wiki=this.ctx.wiki,this.wikiBaseUrl=this.wiki.baseUrl,this.wikiArticlePath=this.wiki.articlePath.replace("$1",""),this.wikiArticleBaseUrl=this.wiki.articleBaseUrl.replace("$1",""),this.wikiIndexPhpUrl=this.wiki.getSciprtUrl("index.php"),this.Title=Jh(this.ctx.wiki._raw)}newTitle(e,i){return new this.Title(e,i)}newMainPageTitle(){return this.newTitle(this.ctx.wiki.mainPageName)}async newTitleFromUrl(e){const i=this.parseWikiLink(e);return i?.title?i.title:i?.pageId?this.newTitleFromPageId(i.pageId):null}async newTitleFromAnyId(e,i=!1){const{title:r,pageId:n,revId:s}=e??{};if(typeof r=="string")return this.newTitle(r);let o,a;if(s?(o=parseInt(s.toString(),10),a="revid"):n&&(o=parseInt(n.toString(),10),a="pageid"),!o||!a||isNaN(o)||o<=0)throw new Error("Invalid id or kind",{cause:e});if(!i&&this._cachedTitles.has(`${a}:${o}`))return await this._cachedTitles.get(`${a}:${o}`);const{promise:l,resolve:c,reject:u}=te();this._cachedTitles.set(`${a}:${o}`,l);try{const{wikiPage:f}=await this.ctx.useScope(["wikiPage"]);let d=null;if(a==="pageid")d=await f.newFromPageId(o);else if(a==="revid")d=await f.newFromRevision(o);else throw new Error(`Invalid kind: ${a}`);c(this.newTitle(d.title))}catch(f){this._cachedTitles.delete(`${a}:${o}`),u(f)}return l}async newTitleFromPageId(e){return this.newTitleFromAnyId({pageId:e})}async newTitleFromRevision(e){return this.newTitleFromAnyId({revId:e})}resolveSpecialPageTarget(e){const i=typeof e=="string"?this.newTitle(e):e;if(!i||i.getNamespaceId()!==-1)return null;let r,n,s="view";const o=i.getMainDBKey().split("/").slice(1).join("/")||"";if(i.isSpecial("edit")&&o)r=o,s="edit";else if(i.isSpecial("talkpage")&&o){const a=i.newTitle(o).getTalkPage();if(!a)return null;r=a.getPrefixedDBKey()}else if(i.isSpecial("mypage"))r=i.newTitle(this.ctx.wiki.userInfo.name,2).getPrefixedDBKey()+(o?`/${o}`:"");else if(i.isSpecial("mytalk"))r=i.newTitle(this.ctx.wiki.userInfo.name,3).getPrefixedDBKey()+(o?`/${o}`:"");else if(i.isSpecial("newsection")&&o)r=o,n="new",s="edit";else return null;return{title:new this.Title(r),section:n,action:s}}isWikiLink(e){return e.startsWith(this.wikiArticleBaseUrl)||e.startsWith(this.wikiIndexPhpUrl)||e.startsWith(`${this.wikiBaseUrl}/?`)}validateHrefAttr(e){return typeof e!="string"?!1:!dr.REG_SKIPPED_HREF.test(e)}parseWikiLink(e){if(!e||typeof e=="string"&&!this.validateHrefAttr(e))return null;const i=va(e);if(!this.isWikiLink(i.toString()))return null;const r=i.searchParams,n=i.hash.replace("#",""),s=r.get("action")||"view",o=r.get("title")||"",a=parseInt(r.get("curid")||"0",10),l=parseInt(r.get("oldid")||"0",10);let c=o||(()=>{try{return decodeURIComponent(i.pathname.substring(this.wikiArticlePath.length))}catch(b){return this.logger.error("parseLink",i,b),""}})();c.endsWith("index.php")&&(c="");let u,f,d;if(l)d=l;else if(a)f=a;else if(c)u=this.newTitle(c);else if(i.origin+i.pathname===this.ctx.wiki.landingPageUrl)u=this.newMainPageTitle();else return null;return{title:u,pageId:f,revId:d,url:i,params:r,hash:n,action:s}}};dr.inject=["wiki"],dr.REG_SKIPPED_HREF=/^(#|javascript:|vbscript:|file:)/i;let fs=dr;const Zh=t=>typeof t=="function";async function ed(t){return Zh(t)?await t():t}var td=Object.create,hs=Object.defineProperty,id=Object.getOwnPropertyDescriptor,Pa=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ca=t=>{throw TypeError(t)},rd=(t,e,i)=>e in t?hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,nd=(t,e)=>hs(t,"name",{value:e,configurable:!0}),sd=t=>[,,,td(t?.[Pa("metadata")]??null)],od=["class","method","getter","setter","accessor","field","value","get","set"],Oa=t=>t!==void 0&&typeof t!="function"?Ca("Function expected"):t,ad=(t,e,i,r,n)=>({kind:od[t],name:e,metadata:r,addInitializer:s=>i._?Ca("Already initialized"):n.push(Oa(s||null))}),ld=(t,e)=>rd(e,Pa("metadata"),t[3]),cd=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},ud=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&id(n,i));nd(n,i);for(var g=r.length-1;g>=0;g--)l=ad(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,Oa(o)&&(n=o);return ld(t,n),b&&hs(n,i,b),u?c^4?s:b:n},Aa,ds,Ta;Aa=[Se(["storage"])];class Mr extends(Ta=_t){constructor(e){super(e,"preferences",!0),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0)}get logger(){return this.ctx.logger("PREFERENCES")}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"})}async get(e,i){i??(i=()=>{const n=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${n})`),n});const r=await this.db.get(e,void 0);return r!==null?r:await ed(i)}getDefaultValue(e){var i;return(i=this._defaultPreferences)[e]??(i[e]=this.loadDefaultConfigs()[e])}set(e,i){const r=this.getDefaultValue(e);return i===r?this.db.delete(e):this.db.set(e,i)}async getAll(){const e=this.loadDefaultConfigs();return await this.db.iterate((i,r)=>{e[r]=i}),e}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(i=>{try{const r=i.schema({});Object.entries(r).forEach(([n,s])=>{e[n]=s})}catch{}}),Object.entries(e).forEach(([i,r])=>{this._defaultPreferences[i]=r}),e}registerCustomConfig(e,i,r){return this.customRegistries.push({name:e,schema:i,category:r}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([i])=>i===null?{name:"@root",schema:fi?.PreferencesSchema||null}:{name:i.name,schema:i?.PreferencesSchema||null}).filter(i=>i.schema!==null).map(i=>({...i,category:i.schema.meta.category||"general"})).concat(this.customRegistries).filter(i=>!e||i.category===e)}defineCategory(e){const i=this.categoryDefinitions.findIndex(r=>r.name===e.name);return i<0?this.categoryDefinitions.push(e):this.categoryDefinitions[i]=e,this.categoryDefinitions.sort((r,n)=>(r.index??0)-(n.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}ds=sd(Ta),Mr=ud(ds,0,"PreferencesService",Aa,Mr),cd(ds,1,Mr);var Dr=(t=>(t.ANALYTICS_API_BASE="https://analytics.ipe.wiki/api",t.ANALYTICS_DASH_URL="https://analytics.ipe.wiki",t.GITHUB_URL="https://github.com/inpageedit/inpageedit-next",t.HOME_URL="https://www.ipe.wiki/",t.UPDATE_LOGS_URL="https://www.ipe.wiki/changelogs/",t))(Dr||{});/**
|
|
59
|
+
*/let Bf=class extends ea{async clientLogin(e,i,r){r||(r={}),!r.logincontinue&&!r.loginreturnurl&&(r.loginreturnurl=location?.origin);const n=await this.postWithToken("login",{action:"clientlogin",username:e,password:i,...r},{tokenName:"logintoken"});if(n?.data?.clientlogin?.status==="PASS")return n.data.clientlogin;throw new De(ji.LOGIN_FAILED,n.data.clientlogin.message,n)}};class qf{constructor(e,i={}){this.ctx=e,location?.href&&i?.baseURL?.toString()?.startsWith("/")&&(i.baseURL=new URL(i.baseURL,location.origin));const r=new Bf({baseURL:i.baseURL.toString(),fexiosConfigs:{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`,...i.headers},...i},throwOnApiError:!0});e.set("api",r)}}var Hf=Object.create,Kn=Object.defineProperty,zf=Object.getOwnPropertyDescriptor,ta=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ia=t=>{throw TypeError(t)},Wf=(t,e,i)=>e in t?Kn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Kf=(t,e)=>Kn(t,"name",{value:e,configurable:!0}),Vf=t=>[,,,Hf(t?.[ta("metadata")]??null)],Gf=["class","method","getter","setter","accessor","field","value","get","set"],ra=t=>t!==void 0&&typeof t!="function"?ia("Function expected"):t,Qf=(t,e,i,r,n)=>({kind:Gf[t],name:e,metadata:r,addInitializer:s=>i._?ia("Already initialized"):n.push(ra(s||null))}),Yf=(t,e)=>Wf(e,ta("metadata"),t[3]),Jf=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Xf=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&zf(n,i));Kf(n,i);for(var m=r.length-1;m>=0;m--)l=Qf(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,ra(o)&&(n=o);return Yf(t,n),y&&Kn(n,i,y),u?c^4?s:y:n},na,Vn,sa;na=[ke(["wiki","wikiTitle"])];class $r extends(sa=$t){constructor(i){super(i,"currentPage",!1);Ii(this,Be);this.ctx=i,this.url=new URL(window.location.href),this.isMainPage=void 0,this.wikiTitle=void 0}get logger(){return this.ctx.logger("CURRENT_PAGE")}async start(){await it(this,Be,Io).call(this),it(this,Be,Hu).call(this),window.addEventListener("popstate",it(this,Be,Ao).bind(this)),this.logger.info("initialized",this.wikiTitle)}stop(){window.removeEventListener("popstate",it(this,Be,Ao).bind(this))}get params(){return this.url.searchParams}get canonicalUrl(){const i=document.querySelector('link[rel="canonical"]')?.href;let r=null;return i&&(r=new URL(i,location.origin)),Reflect.defineProperty(this,"canonicalUrl",{get:()=>r}),r}get wikiAction(){return this.params.get("action")||"view"}}Be=new WeakSet,Io=async function(){await it(this,Be,Wu).call(this),await it(this,Be,zu).call(this)},Hu=function(){const i=Symbol.for("InPageEdit.CurrentPageService.UrlChangeListenerInstalled");if(window[i])return;const r=history.pushState,n=history.replaceState;history.pushState=function(s,o,a){r.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},history.replaceState=function(s,o,a){n.apply(this,[s,o,a]),window.dispatchEvent(new PopStateEvent("popstate",{state:s}))},window[i]=!0},Ao=async function(i){const r=this.url,n=new URL(window.location.href);this.url=n,(r.pathname!==n.pathname||r.searchParams.get("title")!==n.searchParams.get("title")||r.searchParams.get("curid")!==n.searchParams.get("curid"))&&(await it(this,Be,Io).call(this),this.logger.info("location changed",n,this.wikiTitle))},zu=async function(){const r=this.wikiTitle?.getMainDBKey()===this.ctx.wiki.mainPageName;return Reflect.defineProperty(this,"isMainPage",{get:()=>r}),r},Wu=async function(){let i=null;return this.canonicalUrl?i=await this.ctx.wikiTitle.newTitleFromUrl(this.canonicalUrl):i=await this.ctx.wikiTitle.newTitleFromUrl(this.url),Object.freeze(i),Reflect.defineProperty(this,"wikiTitle",{get:()=>i}),i},Vn=Vf(sa),$r=Xf(Vn,0,"CurrentPageService",na,$r),Jf(Vn,1,$r);class Zf extends $t{constructor(e){super(e,"resourceLoader",!0),this.ctx=e}stop(){}loadScript(e,i){if(!e)return Promise.resolve(null);const r=`script:${e}`,n=document.querySelector(`[data-ipe="${r}"]`);return n?Promise.resolve(n):new Promise((o,a)=>{const l=document.createElement("script");l.src=e,l.dataset.ipe=r,i&&Object.entries(i).forEach(([c,u])=>{typeof u>"u"||u===!1||u===null?l.removeAttribute(c):l.setAttribute(c,u)}),document.body.appendChild(l),l.onload=()=>o(l),l.onerror=c=>a(c)})}loadStyle(e,i){if(!e)return Promise.resolve(null);const r=`style:${e}`,n=document.querySelector(`[data-ipe="${r}"]`);return n?Promise.resolve(n):new Promise((o,a)=>{const l=document.createElement("link");l.rel="stylesheet",l.href=e,l.dataset.ipe=r,i&&Object.entries(i).forEach(([u,f])=>{typeof f>"u"||f===!1||f===null?l.removeAttribute(u):l.setAttribute(u,f)}),(document.querySelector('meta[name="ipe-styles"]')||(()=>{const u=document.createElement("meta");return u.id="ipe-styles",u.name="ipe-styles",document.head.insertAdjacentElement("afterbegin",u),u})()).before(l),l.onload=()=>o(l),l.onerror=u=>a(u)})}resolveImportPath(e){if(e.startsWith("http")||e.startsWith("//"))return e;const i=document.currentScript?.src;if(!i)return`https://unpkg.com/mediawiki-inpageedit@latest/dist/${e}`;const r=new URL(i);return r.pathname.endsWith(".js")||(r.pathname=r.pathname+"/"),new URL(e,r.toString()).toString()}}const Pr=Object.keys;function eh(t){return typeof t=="boolean"}function th(t){return t&&typeof t.nodeType=="number"}function Cr(t){return typeof t=="string"}function oa(t){return typeof t=="number"}function Qt(t){return typeof t=="object"?t!==null:Fi(t)}function Fi(t){return typeof t=="function"}function ih(t){return!!(t&&t.isComponent)}function rh(t){return Qt(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function Gn(t,e){if(t)for(const i of Pr(t))e(t[i],i)}function nh(t){return Qt(t)&&"current"in t}const Qn={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function sh(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const oh=["Webkit","ms","Moz","O"];Pr(Qn).forEach(t=>{oh.forEach(e=>{Qn[sh(e,t)]=0})});const ah=Symbol.for("jsx-dom:type");var aa=function(t){return t.ShadowRoot="ShadowRoot",t}(aa||{});function lh(t){return t!=null&&t[ah]===aa.ShadowRoot}const ch="http://www.w3.org/2000/svg",uh="http://www.w3.org/1999/xlink",fh="http://www.w3.org/XML/1998/namespace";function la(t){return!eh(t)&&t!=null}function Yn(t){return Array.isArray(t)?t.map(Yn).filter(Boolean).join(" "):Qt(t)?Symbol.iterator in t?Yn(Array.from(t)):Pr(t).filter(e=>t[e]).join(" "):la(t)?""+t:""}const hh={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},dh=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Pt(t){const e=document.createDocumentFragment();return Or(t.children,e),e}function ph(t,e,i){e={...e,children:i};const r=new t(e),n=r.render();return"ref"in e&&Jn(e.ref,r),n}function g(t,e){let{children:i,...r}=e;!r.namespaceURI&&hh[t]===0&&(r={...r,namespaceURI:ch});let n;if(Cr(t)){if(n=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),bh(r,n),Or(i,n),n instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));n.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else n.value=r.value;Jn(r.ref,n)}else if(Fi(t))Qt(t.defaultProps)&&(r={...t.defaultProps,...r}),n=ih(t)?ph(t,r,i):t({...r,children:i});else throw new TypeError(`Invalid JSX element type: ${t}`);return n}function mh(t,e){for(var i=arguments.length,r=new Array(i>2?i-2:0),n=2;n<i;n++)r[n-2]=arguments[n];return(Cr(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),g(t,{...e,children:r},e.key)}function Jn(t,e){nh(t)?t.current=e:Fi(t)&&t(e)}function Or(t,e){if(rh(t))gh(t,e);else if(Cr(t)||oa(t))Xn(document.createTextNode(t),e);else if(t===null)Xn(document.createComment(""),e);else if(th(t))Xn(t,e);else if(lh(t)){const i=e.attachShadow(t.attr);Or(t.children,i),Jn(t.ref,i)}}function gh(t,e){for(const i of[...t])Or(i,e);return e}function Xn(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Tr(t,e){return t.replace(/[A-Z]/g,i=>e+i.toLowerCase())}function ca(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(i=>ca(t,i)):Cr(e)?t.setAttribute("style",e):Qt(e)&&Gn(e,(i,r)=>{r.indexOf("-")===0?t.style.setProperty(r,i):oa(i)&&Qn[r]!==0?t.style[r]=i+"px":t.style[r]=i}))}function yh(t,e,i){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":ua(i,uh,Tr(t,":"),e);return;case"xmlnsXlink":ai(i,Tr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":ua(i,fh,Tr(t,":"),e);return}switch(t){case"htmlFor":ai(i,"for",e);return;case"dataset":Gn(e,(r,n)=>{r!=null&&(i.dataset[n]=r)});return;case"innerHTML":case"innerText":case"textContent":la(e)&&(i[t]=e);return;case"dangerouslySetInnerHTML":Qt(e)&&(i.innerHTML=e.__html);return;case"value":if(e==null||i instanceof window.HTMLSelectElement)return;if(i instanceof window.HTMLTextAreaElement){i.value=e;return}break;case"spellCheck":i.spellcheck=e;return;case"class":case"className":Fi(e)?e(i):ai(i,"class",Yn(e));return;case"ref":case"namespaceURI":return;case"style":ca(i,e);return;case"on":case"onCapture":Gn(e,(r,n)=>{i.addEventListener(n,r,t==="onCapture")});return}if(Fi(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const n=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":n&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!n&&i[r]===null)i[r]=e;else if(n)i.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),i.addEventListener(s,e)}}}else Qt(e)?i[t]=e:e===!0?ai(i,t,""):e!==!1&&e!=null&&(i instanceof SVGElement&&!dh.test(t)?ai(i,Tr(t,"-"),e):ai(i,t,e))}function ai(t,e,i){t.setAttribute(e,i)}function ua(t,e,i,r){t.setAttributeNS(e,i,r)}function bh(t,e){for(const i of Pr(t))yh(i,t[i],e);return e}const Ir=Object.keys;function wh(t){return typeof t=="boolean"}function vh(t){return t&&typeof t.nodeType=="number"}function Zn(t){return typeof t=="string"}function fa(t){return typeof t=="number"}function Yt(t){return typeof t=="object"?t!==null:Bi(t)}function Bi(t){return typeof t=="function"}function _h(t){return!!(t&&t.isComponent)}function xh(t){return Yt(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function es(t,e){if(t)for(const i of Ir(t))e(t[i],i)}function Sh(t){return Yt(t)&&"current"in t}const ts={animationIterationCount:0,borderImageOutset:0,borderImageSlice:0,borderImageWidth:0,boxFlex:0,boxFlexGroup:0,boxOrdinalGroup:0,columnCount:0,columns:0,flex:0,flexGrow:0,flexPositive:0,flexShrink:0,flexNegative:0,flexOrder:0,gridArea:0,gridRow:0,gridRowEnd:0,gridRowSpan:0,gridRowStart:0,gridColumn:0,gridColumnEnd:0,gridColumnSpan:0,gridColumnStart:0,fontWeight:0,lineClamp:0,lineHeight:0,opacity:0,order:0,orphans:0,tabSize:0,widows:0,zIndex:0,zoom:0,fillOpacity:0,floodOpacity:0,stopOpacity:0,strokeDasharray:0,strokeDashoffset:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0};function kh(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Eh=["Webkit","ms","Moz","O"];Ir(ts).forEach(t=>{Eh.forEach(e=>{ts[kh(e,t)]=0})});const $h=Symbol.for("jsx-dom:type");var ha=function(t){return t.ShadowRoot="ShadowRoot",t}(ha||{});function Ph(t){return t!=null&&t[$h]===ha.ShadowRoot}const Ch="http://www.w3.org/2000/svg",Oh="http://www.w3.org/1999/xlink",Th="http://www.w3.org/XML/1998/namespace";function da(t){return!wh(t)&&t!=null}function is(t){return Array.isArray(t)?t.map(is).filter(Boolean).join(" "):Yt(t)?Symbol.iterator in t?is(Array.from(t)):Ir(t).filter(e=>t[e]).join(" "):da(t)?""+t:""}const Ih={animate:0,circle:0,clipPath:0,defs:0,desc:0,ellipse:0,feBlend:0,feColorMatrix:0,feComponentTransfer:0,feComposite:0,feConvolveMatrix:0,feDiffuseLighting:0,feDisplacementMap:0,feDistantLight:0,feFlood:0,feFuncA:0,feFuncB:0,feFuncG:0,feFuncR:0,feGaussianBlur:0,feImage:0,feMerge:0,feMergeNode:0,feMorphology:0,feOffset:0,fePointLight:0,feSpecularLighting:0,feSpotLight:0,feTile:0,feTurbulence:0,filter:0,foreignObject:0,g:0,image:0,line:0,linearGradient:0,marker:0,mask:0,metadata:0,path:0,pattern:0,polygon:0,polyline:0,radialGradient:0,rect:0,stop:0,svg:0,switch:0,symbol:0,text:0,textPath:0,tspan:0,use:0,view:0},Ah=/^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/;function Rh(t){const e=document.createDocumentFragment();return Ar(t.children,e),e}function Lh(t,e,i){e={...e,children:i};const r=new t(e),n=r.render();return"ref"in e&&rs(e.ref,r),n}function de(t,e){let{children:i,...r}=e;!r.namespaceURI&&Ih[t]===0&&(r={...r,namespaceURI:Ch});let n;if(Zn(t)){if(n=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Dh(r,n),Ar(i,n),n instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));n.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else n.value=r.value;rs(r.ref,n)}else if(Bi(t))Yt(t.defaultProps)&&(r={...t.defaultProps,...r}),n=_h(t)?Lh(t,r,i):t({...r,children:i});else throw new TypeError(`Invalid JSX element type: ${t}`);return n}function rs(t,e){Sh(t)?t.current=e:Bi(t)&&t(e)}function Ar(t,e){if(xh(t))Nh(t,e);else if(Zn(t)||fa(t))ns(document.createTextNode(t),e);else if(t===null)ns(document.createComment(""),e);else if(vh(t))ns(t,e);else if(Ph(t)){const i=e.attachShadow(t.attr);Ar(t.children,i),rs(t.ref,i)}}function Nh(t,e){for(const i of[...t])Ar(i,e);return e}function ns(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Rr(t,e){return t.replace(/[A-Z]/g,i=>e+i.toLowerCase())}function pa(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(i=>pa(t,i)):Zn(e)?t.setAttribute("style",e):Yt(e)&&es(e,(i,r)=>{r.indexOf("-")===0?t.style.setProperty(r,i):fa(i)&&ts[r]!==0?t.style[r]=i+"px":t.style[r]=i}))}function Mh(t,e,i){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":ma(i,Oh,Rr(t,":"),e);return;case"xmlnsXlink":li(i,Rr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":ma(i,Th,Rr(t,":"),e);return}switch(t){case"htmlFor":li(i,"for",e);return;case"dataset":es(e,(r,n)=>{r!=null&&(i.dataset[n]=r)});return;case"innerHTML":case"innerText":case"textContent":da(e)&&(i[t]=e);return;case"dangerouslySetInnerHTML":Yt(e)&&(i.innerHTML=e.__html);return;case"value":if(e==null||i instanceof window.HTMLSelectElement)return;if(i instanceof window.HTMLTextAreaElement){i.value=e;return}break;case"spellCheck":i.spellcheck=e;return;case"class":case"className":Bi(e)?e(i):li(i,"class",is(e));return;case"ref":case"namespaceURI":return;case"style":pa(i,e);return;case"on":case"onCapture":es(e,(r,n)=>{i.addEventListener(n,r,t==="onCapture")});return}if(Bi(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const n=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":n&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!n&&i[r]===null)i[r]=e;else if(n)i.addEventListener(r.substring(2,r.length-7),e,!0);else{let s;r in window?s=r.substring(2):s=r[2]+t.slice(3),i.addEventListener(s,e)}}}else Yt(e)?i[t]=e:e===!0?li(i,t,""):e!==!1&&e!=null&&(i instanceof SVGElement&&!Ah.test(t)?li(i,Rr(t,"-"),e):li(i,t,e))}function li(t,e,i){t.setAttribute(e,i)}function ma(t,e,i,r){t.setAttributeNS(e,i,r)}function Dh(t,e){for(const i of Ir(t))Mh(i,t[i],e);return e}var ss=(t=>(t.Init="modal.init",t.BeforeShow="modal.beforeShow",t.Show="modal.show",t.BeforeClose="modal.beforeClose",t.Close="modal.close",t.Destroy="modal.destroy",t.ToastShow="toast.show",t.ToastClose="toast.close",t))(ss||{});let jh=0;const ga=t=>`${t}-${++jh}`;function qi(t){return t instanceof Node?t:document.createTextNode(String(t))}function Ct(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function ya(t){const e=["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])'].join(",");return Array.from(t.querySelectorAll(e)).filter(i=>!!(i.offsetWidth||i.offsetHeight||i.getClientRects().length))}function Te(t,e={}){const i=document.createElement(t);if(e.className&&(i.className=e.className),e.html!=null&&(i.innerHTML=e.html),e.text!=null&&(i.textContent=e.text),e.attrs)for(const[r,n]of Object.entries(e.attrs))i.setAttribute(r,n);return i}const Uh=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform),ba=["ctrl","alt","shift","meta"];function Fh(t){if(!t)return null;const e=String(t).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean),i=[];let r=null;const n=o=>{i.includes(o)||i.push(o)};for(const o of e){let a=o;if(a==="control"||a==="ctrl"){n("ctrl");continue}if(a==="alt"||a==="option"){n("alt");continue}if(a==="shift"){n("shift");continue}if(a==="meta"||a==="cmd"||a==="command"||a==="super"){n("meta");continue}if(a==="mod"){n(Uh?"meta":"ctrl");continue}a==="esc"&&(a="escape"),a==="return"&&(a="enter"),(a==="space"||a==="spacebar")&&(a="space"),r=a}const s=ba.filter(o=>i.includes(o));return!r||r===""?s.length?s.join("+"):null:s.length?`${s.join("+")}+${r}`:r}function Bh(t){const e=[];t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta");let i=t.key;i===" "&&(i="space");const r=(i.length,i.toLowerCase()),n=ba.filter(s=>e.includes(s));return n.length?`${n.join("+")}+${r}`:r}class qh{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(i=>i!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,i){const r=new Set((Array.isArray(i)?i:i?[i]:[]).map(String)),n=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=n.size?n.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()})}removeAll(){[...this.stack].forEach(e=>e.destroy()),this.stack=[]}syncZ(){this.stack.forEach((e,i)=>e.setZIndex(this.zBase+i*2))}lockBodyScroll(){document.body.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.body.classList.remove("ipe-modal-no-scroll")}}const je=new qh;let Hh=class Ku{constructor(e={}){this.backdropId=ga("ipe-modal-backdrop"),this.modalId=ga("ipe-modal"),this.numberId=this.modalId.split("-")[1],this._isDestroyed=!1,this.pluginName="normalModal",this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap=new Map,this.isOpen=!1,this.isToast=!1,this.isDragging=!1,this.dragStartX=0,this.dragStartY=0,this.modalStartX=0,this.modalStartY=0,this.Event=ss,this.DEFAULT_OPTIONS={className:"",sizeClass:"auto",center:!0,fitScreen:!1,closeIcon:!0,bodyScroll:!1,outSideClose:!0,backdrop:!0,animation:!1,animationSpeed:200},this._hooks=[],this.startCloseTimer=i=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),i)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=i=>{if(!this.isDragging)return;i.preventDefault();const r=i.clientX-this.dragStartX,n=i.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+n;s.style.left=`${o}px`,s.style.top=`${a}px`},this.onDragEnd=()=>{if(!this.isDragging)return;this.isDragging=!1,document.removeEventListener("pointermove",this.onDragMove),document.removeEventListener("pointerup",this.onDragEnd);const i=this.get$modal(),r=this.get$window();i.classList.remove("is-dragging"),r.style.animation="none",requestAnimationFrame(()=>{this.applyAnimation(!0)})},this.options={...this.DEFAULT_OPTIONS,...e},this.options.backdrop===!1&&e.bodyScroll===void 0&&(this.options.bodyScroll=!0)}get isDestroyed(){return this._isDestroyed}init(){if(this.$modal)return this;const e=this.options.backdrop!==!1;let i;e&&(i=Te("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=Te("div",{className:"ipe-modal-modal",attrs:{id:this.modalId,role:"dialog","aria-modal":"true",tabindex:"-1"}});if(r.modal=this,!e){r.classList.add("no-backdrop");const y=window.pageYOffset||document.documentElement.scrollTop,m=window.pageXOffset||document.documentElement.scrollLeft,E=window.innerWidth;r.style.top=`${y+60}px`,this.once("modal.show",()=>{r.style.left=`${m+E/2-r.offsetWidth/2}px`})}const n=Te("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});n.modal=this;const s=Te("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=Te("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=Te("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const y=Te("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"×"});y.addEventListener("click",()=>{let m=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(m=!1):this.options.onClickClose===!1&&(m=!1),m&&this.close()}),l.appendChild(y)}s.append(a,l),!e&&this.options.draggable&&(s.style.cursor="move",s.style.userSelect="none",s.addEventListener("pointerdown",this.onDragStart.bind(this)));const c=Te("div",{className:"ipe-modal-modal__content"}),u=Te("div",{className:"ipe-modal-modal__footer"}),f=Te("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),d=Te("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return u.append(f,d),n.append(s,c,u),r.appendChild(n),this.$backdrop=i,this.$modal=r,this.$window=n,this.$header=s,this.$title=a,this.$icons=l,this.$content=c,this.$footer=u,this.$buttonsLeft=f,this.$buttonsRight=d,this.options.title&&this.setTitle(this.options.title),this.options.content&&this.setContent(this.options.content),this.options.buttons?.length?this.setButtons(this.options.buttons):u.style.display="none",this.options.center&&this.$modal.classList.add("is-centered"),this.options.fitScreen&&this.$modal.classList.add("is-fullscreen"),this.options.iconButtons&&this.$header.classList.add("has-icon-buttons"),this.options.className&&this.$window.classList.add(...this.options.className.split(/[\s\.#+]+/g).filter(Boolean)),typeof this.options.fixedHeight=="number"?this.$window.style.height=`${Math.max(0,this.options.fixedHeight)}px`:this.options.fixedHeight===!0&&this.$window.classList.add("is-fixed-height"),i&&i.addEventListener("pointerdown",y=>{this.options.outSideClose&&y.target===i&&this.close()}),this.onKeyDown=this.onKeyDown.bind(this),this.emit("modal.init"),this}show(){if(this.$modal||this.init(),!this.$modal)throw new Error("Failed to initialize modal");if(this.isOpen)return this;{const r=this.emit("modal.beforeShow",!0),n=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!n)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&je.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),je.push(this),this.isOpen=!0,this.options.onShow?.(this),this.emit("modal.show");const e=typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time,i=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),i&&(this.$window?.addEventListener("mouseenter",this.stopCloseTimer),this.$window?.addEventListener("mouseleave",()=>this.startCloseTimer(e)))),this}close(){if(!this.isOpen)return this;{const s=this.emit("modal.beforeClose",!0),o=this.options.beforeClose?this.options.beforeClose(this)!==!1:!0;if(!s||!o)return this}if(this.isToast){this.applyAnimation(!1),this.emit("modal.close"),this.emit("toast.close");const s=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let o=!1;const a=()=>{o||(o=!0,this.destroy(),this.options.onClose?.(this))},l=(c,u)=>{const f=()=>{c.removeEventListener(u,f),a()};c.addEventListener(u,f,{once:!0})};return s>0&&this.$window?(l(this.$window,"transitionend"),l(this.$window,"animationend"),window.setTimeout(a,s+20)):window.setTimeout(a,s),this}this.applyAnimation(!1),this.$backdrop?.classList.remove("is-open"),this.$modal?.classList.remove("is-open"),this.emit("modal.close");const e=this.isAnimationDisabled()?0:this.options.animationSpeed??200;let i=!1;const r=()=>{i||(i=!0,this.destroy(),this.options.onClose?.(this))},n=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(n(this.$window,"transitionend"),n(this.$window,"animationend"),window.setTimeout(r,e+20)):window.setTimeout(r,e),this}destroy(){if(this._isDestroyed)return this;if(this.stopCloseTimer(),document.removeEventListener("keydown",this.onKeyDown),this.isDragging&&this.onDragEnd(),this.$window?.removeEventListener("mouseenter",this.stopCloseTimer),this.isToast){this.$window?.parentElement&&this.$window.parentElement.removeChild(this.$window);const e=Jt.indexOf(this);e!==-1&&Jt.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),je.remove(this),this.shouldUnlockBodyOnClose()&&je.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return Ct(this.$modal,"modal")}get$window(){return Ct(this.$window,"window")}get$header(){return Ct(this.$header,"header")}get$title(){return Ct(this.$title,"title")}get$content(){return Ct(this.$content,"content")}get$icons(){return Ct(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?Ct(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?Ct(this.$buttonsRight,"rightButtons"):Ct(this.$footer,"buttons")}setTitle(e){const i=this.get$title();return i.innerHTML="",i.append(qi(e)),this}setContent(e,i="replace"){const r=this.get$content();return i==="replace"?(r.innerHTML="",r.append(qi(e))):i==="append"?r.append(qi(e)):r.prepend(qi(e)),this}setIcons(e){const i=this.get$icons();i.innerHTML="";for(const r of e){const n=Te("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});n.addEventListener("click",r.method),i.appendChild(n)}return this}setButtons(e,i){const r=this.$buttonsLeft,n=this.$buttonsRight;[r,n].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=i??this.$footer;if(s===this.$footer)e.forEach(o=>this.addButton(o)),e.length===0&&(this.$footer.style.display="none");else{s.innerHTML="";for(const o of e){const a=this.generateButton(o);s.appendChild(a)}}return this}generateButton(e){const i=e.type??"button",r=i==="link"?Te("a"):Te("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const n=qi(e.label??"OK");if(r.append(n),i==="link"&&e.href&&(r.href=e.href),e.method&&r.addEventListener("click",s=>{if(r._ipe_tmpDisabled){s.preventDefault(),s.stopPropagation();return}e.method.call(r,s,this)}),typeof e.closeAfter=="number"&&e.closeAfter>=0&&r.addEventListener("click",()=>{window.setTimeout(()=>this.close(),e.closeAfter)}),typeof e.enableAfter=="number"&&e.enableAfter>0){i==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{i==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}if(e.keyPress){const s=String(e.keyPress).split(/[\,\|]+/g).map(o=>o.trim()).filter(Boolean);for(const o of s){const a=Fh(o);a&&this.keyMap.set(a,r)}}return r}addButton(e,i){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",n=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(i??s.length,s.length));return a>=n.children.length?n.appendChild(o):n.insertBefore(o,n.children[a]),s.splice(a,0,o),this}removeButton(e){const i=this.buttonElsLeft,r=this.buttonElsRight,n=[...i,...r];let s=null;if(e==="*")return n.forEach(a=>{this.keyMap.delete(a.id),a.parentElement?.removeChild(a)}),this.$footer&&(this.$footer.style.display="none"),this;if(typeof e=="number"?s=n[e]??null:typeof e=="string"?s=n.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=n.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=i.indexOf(s);return o!==-1?(i.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),i.length===0&&r.length===0&&this.$footer&&(this.$footer.style.display="none"),this}changePreviewState(){return this.get$modal().classList.toggle("is-fullscreen"),this}setModalHeight(e,i="height"){const r=this.get$window(),n=Math.max(0,window.innerHeight-e);return r.style[i]=`${n}px`,n}setOptions(e,i){return typeof e=="string"?this.options[e]=i:Object.assign(this.options,e),this}setPluginName(e){return this.$window&&(this.$window.className=this.$window.className.replace(`plugin--${this.pluginName}`,`plugin--${e}`)),this.pluginName=e,this}applyAnimation(e){const i=this.get$modal(),r=this.get$window(),n=this.$backdrop,s=this.options.modalAnimation??this.options.animation,o=typeof s=="string"?s:s&&(e?s.show:s.hide),a=this.options.backdropAnimation??this.options.animation,l=typeof a=="string"?a:a&&(e?a.show:a.hide);!o||o===!1?(i.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(i.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),n&&(!l||l===!1?n.style.transition="none":n.style.removeProperty("transition"))}on(e,i){return this._hooks.push({type:e,listener:i}),()=>this.off(e,i)}off(e,i){return this._hooks=this._hooks.filter(r=>r.type!==e&&(i?r.listener!==i:!0)),this}once(e,i){const r=this.on(e,n=>(r(),i(n)));return r}emit(e,i){const r=this._hooks.filter(a=>a.type===e);let n=!0;for(const a of r){const l=new CustomEvent(e,{detail:this,cancelable:i}),c=a.listener(l);if(l.defaultPrevented&&(n=!1),c===!1&&(n=!1),!n)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:i});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(n=!1),n}focusFirst(){const e=this.get$modal(),i=ya(e);i.length?i[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(je.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const i=this.get$modal();if(!i.contains(document.activeElement))return;if(e.key==="Tab"){const a=ya(i);if(!a.length)return;const l=a[0],c=a[a.length-1],u=document.activeElement;e.shiftKey&&u===l?(e.preventDefault(),c.focus()):!e.shiftKey&&u===c&&(e.preventDefault(),l.focus())}const r=e.ctrlKey||e.altKey||e.metaKey,n=e.target;if(!r&&(n&&["INPUT","TEXTAREA"].includes(n.tagName)||n.contentEditable==="true"))return;const s=Bh(e),o=this.keyMap.get(s);if(o){e.preventDefault(),o.click();return}}setZIndex(e){this.$backdrop&&(this.$backdrop.style.zIndex=String(e)),this.$modal&&(this.$modal.style.zIndex=String(e+1))}bringToFront(){return je.remove(this),je.push(this),this}isAnimationDisabled(){const e=this.options.modalAnimation??this.options.animation;return e===!1||e==null}shouldLockBodyOnOpen(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!je.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!je.stack.some(e=>e!==this&&e.options.backdrop!==!1&&e.options.bodyScroll===!1)}onDragStart(e){if(this.options.backdrop!==!1||!this.options.draggable)return;e.preventDefault(),this.isDragging=!0,this.bringToFront(),this.dragStartX=e.clientX,this.dragStartY=e.clientY;const i=this.get$modal(),r=i.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,i.style.transform="none",i.style.left=`${this.modalStartX}px`,i.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),i.classList.add("is-dragging")}showToast(e){this.$window||this.init();const i=zh(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),i.appendChild(r);const n=(typeof this.options.closeAfter=="number"?this.options.closeAfter:this.options.closeAfter?.time)??3e3,s=(typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover)??!0;return n>0&&(this.startCloseTimer(n),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(n)))),this.isOpen=!0,this.options.onShow?.(this),Jt.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,i){return new this(e).init().show()}static createObject(e,i){return new this(e)}static close(e){if(!e){const s=je.top();return s?.close(),s}const i=typeof e=="string"?e:e.id,r=je.stack.find(s=>s.modalId===i);if(r)return r.close(),r;const n=Jt.find(s=>s.modalId===i);return n?.close(),n}static closeAll(e,i){const r=new Set((Array.isArray(i)?i:i?[i]:[]).map(String)),n=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return je.closeAll(e,i),[...Jt].forEach(s=>{const o=s.modalId,a=n.size?n.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),je.top()??new Ku}static removeAll(){je.removeAll(),[...Jt].forEach(e=>e.destroy())}static dialog(e,i){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary is-ghost",method:(n,s)=>{i?.(n,s),n.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,i){e.title??(e.title="Confirm"),e.content??(e.content="Are you sure you want to perform this action?");const r=e.okBtn??{label:"OK",className:"is-primary is-ghost"},n=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"},s=new this({sizeClass:"dialog",...e,buttons:[{label:n.label,className:n.className,keyPress:"n",method:()=>s.close()},{label:r.label,className:r.className,keyPress:"y",method:o=>{i?.(o,s),o.defaultPrevented||s.close()}}]});return s.init().show()}static getDefaultNotifyIcon(e){switch(e){case"success":return de("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-circle-check",children:[de("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),de("path",{d:"M17 3.34a10 10 0 1 1 -14.995 8.984l-.005 -.324l.005 -.324a10 10 0 0 1 14.995 -8.336zm-1.293 5.953a1 1 0 0 0 -1.32 -.083l-.094 .083l-3.293 3.292l-1.293 -1.292l-.094 -.083a1 1 0 0 0 -1.403 1.403l.083 .094l2 2l.094 .083a1 1 0 0 0 1.226 0l.094 -.083l4 -4l.083 -.094a1 1 0 0 0 -.083 -1.32z"})]});case"error":return de("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-triangle",children:[de("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),de("path",{d:"M12 1.67c.955 0 1.845 .467 2.39 1.247l.105 .16l8.114 13.548a2.914 2.914 0 0 1 -2.307 4.363l-.195 .008h-16.225a2.914 2.914 0 0 1 -2.582 -4.2l.099 -.185l8.11 -13.538a2.914 2.914 0 0 1 2.491 -1.403zm.01 13.33l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -7a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"warning":return de("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-alert-circle",children:[de("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),de("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z"})]});case"info":return de("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-info-circle",children:[de("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),de("path",{d:"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm0 9h-1l-.117 .007a1 1 0 0 0 0 1.986l.117 .007v3l.007 .117a1 1 0 0 0 .876 .876l.117 .007h1l.117 -.007a1 1 0 0 0 .876 -.876l.007 -.117l-.007 -.117a1 1 0 0 0 -.764 -.857l-.112 -.02l-.117 -.006v-3l-.007 -.117a1 1 0 0 0 -.876 -.876l-.117 -.007zm.01 -3l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z"})]});case"dialog":return de("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-message-dots",children:[de("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),de("path",{d:"M12 11v.01"}),de("path",{d:"M8 11v.01"}),de("path",{d:"M16 11v.01"}),de("path",{d:"M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z"})]});case"confirm":return de("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-copy-check",children:[de("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),de("path",{d:"M18.333 6a3.667 3.667 0 0 1 3.667 3.667v8.666a3.667 3.667 0 0 1 -3.667 3.667h-8.666a3.667 3.667 0 0 1 -3.667 -3.667v-8.666a3.667 3.667 0 0 1 3.667 -3.667zm-3.333 -4c1.094 0 1.828 .533 2.374 1.514a1 1 0 1 1 -1.748 .972c-.221 -.398 -.342 -.486 -.626 -.486h-10c-.548 0 -1 .452 -1 1v9.998c0 .32 .154 .618 .407 .805l.1 .065a1 1 0 1 1 -.99 1.738a3 3 0 0 1 -1.517 -2.606v-10c0 -1.652 1.348 -3 3 -3zm1.293 9.293l-3.293 3.292l-1.293 -1.292a1 1 0 0 0 -1.414 1.414l2 2a1 1 0 0 0 1.414 0l4 -4a1 1 0 0 0 -1.414 -1.414"})]});default:return null}}static notify(e,i,r){var a,l,c,u;if(i?.overrideOther&&[...Jt].forEach(f=>f.close()),typeof i.title>"u"){const f=e||"Notification";i.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const n=i.icon??this.getDefaultNotifyIcon(e);n&&(n instanceof Element&&n.classList.add("ipe-modal-notify-icon"),i.title=de(Rh,{children:[n,i.title]})),i.okBtn&&((a=i.okBtn).label??(a.label="OK"),(l=i.okBtn).className??(l.className="is-primary is-ghost ok-btn"),i.okBtn.method=()=>{r?.(!0),o.close()}),i.cancelBtn&&((c=i.cancelBtn).label??(c.label="Cancel"),(u=i.cancelBtn).className??(u.className="is-danger is-ghost cancel-btn"),i.cancelBtn.method=()=>{r?.(!1),o.close()}),i.buttons=[i.cancelBtn,i.okBtn,...i.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${i.className??""}`,o=new this({...i,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,animation:i.animation??{show:"fadeIn",hide:"fadeOut"},buttons:i.buttons??[]});return o.setPluginName("toast"),o.showToast({position:i.position??"top right"})}};const Jt=[];function zh(t="top right"){const e="ipe-modal-toast-container",i=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(i);return r||(r=Te("div",{className:`${e} ${t}`,attrs:{id:i,"data-position":t}}),document.body.appendChild(r)),r}const Wh={ipe_progress:"_ipe_progress_so6hn_1"},Dt=t=>{const e=t.indeterminate??!0,i=g("div",{class:`${Wh.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return i.setProgress=r=>{typeof r=="number"?(i.dataset.indeterminate="false",i.style.setProperty("--progress",`${r}%`)):(i.dataset.indeterminate="true",i.style.setProperty("--progress","0%"))},i};class _e extends Hh{constructor(e={}){e.className||(e.className=""),e.className+=" theme-ipe",e.modalAnimation||(e.modalAnimation={show:"ipe-modal-fade-in",hide:"ipe-modal-fade-out"}),super(e)}setLoadingState(e){if(this.get$window().classList.toggle("loading",e),e){const i=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=i,i.forEach(r=>{r.disabled=!0}),this.get$content().append(g("div",{id:"ipe-modalLoadingWrapper",style:{position:"absolute",top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",backgroundColor:"rgba(255, 255, 255, 0.5)",zIndex:2e3},children:g(Dt,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const i=this._tmpDisabledActiveInputs;i&&i.forEach(r=>{r.disabled=!1})}}}class Kh{constructor(e){this.ctx=e,this.IPEModal=_e,this.IPEModalEvent=ss,this.show=_e.show.bind(_e),this.createObject=_e.createObject.bind(_e),this.close=_e.close.bind(_e),this.closeAll=_e.closeAll.bind(_e),this.removeAll=_e.removeAll.bind(_e),this.dialog=_e.dialog.bind(_e),this.confirm=_e.confirm.bind(_e),this.notify=_e.notify.bind(_e),e.set("modal",this),e.on("dispose",()=>{_e.closeAll()})}}const wa=t=>{if(!t)return new URLSearchParams;if(t instanceof URLSearchParams)return t;if(typeof t!="object"||t?.constructor!==Object)throw new TypeError("only plain object is supported");const e=new URLSearchParams;for(const[i,r]of Object.entries(t))if(r!=null){if(Array.isArray(r)){for(const n of r)e.append(i,n?.toString());continue}if(typeof r=="object"&&r!==null&&r.constructor===Object){for(const[n,s]of Object.entries(r))s!=null&&e.set(`${i}[${n}]`,s?.toString());continue}e.set(i,r?.toString())}return e},va=(t,e,i)=>{const r=typeof t=="string"?new URL(t,window?.location?.origin):new URL(t),n=new URLSearchParams(r.search),s=wa(e);for(const[o,a]of s.entries())n.set(o,a);return r.search=n.toString(),r.hash="",r};var Vh=Object.create,os=Object.defineProperty,Gh=Object.getOwnPropertyDescriptor,_a=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),xa=t=>{throw TypeError(t)},Qh=(t,e,i)=>e in t?os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Yh=(t,e)=>os(t,"name",{value:e,configurable:!0}),Jh=t=>[,,,Vh(t?.[_a("metadata")]??null)],Xh=["class","method","getter","setter","accessor","field","value","get","set"],Sa=t=>t!==void 0&&typeof t!="function"?xa("Function expected"):t,Zh=(t,e,i,r,n)=>({kind:Xh[t],name:e,metadata:r,addInitializer:s=>i._?xa("Already initialized"):n.push(Sa(s||null))}),ed=(t,e)=>Qh(e,_a("metadata"),t[3]),td=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},id=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&Gh(n,i));Yh(n,i);for(var m=r.length-1;m>=0;m--)l=Zh(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,Sa(o)&&(n=o);return ed(t,n),y&&os(n,i,y),u?c^4?s:y:n},ka,as,Ea;ka=[ke(["api","storage"])];class Lr extends(Ea=$t){constructor(e){super(e,"wiki",!1),this.ctx=e,this._data=void 0,this.CACHE_TTL=1e3*60*60*24,this.VERSION=2,this.db=void 0,this.logger=void 0,this.queryData={meta:"siteinfo|userinfo",siprop:"general|specialpagealiases|namespacealiases|namespaces|magicwords",uiprop:"groups|rights|blockinfo|options"},this.mwConfig={get:(i,r)=>window?.mw?.config?.get?.(i,r)??r,has:i=>window?.mw?.config?.exists?.(i)??!1,get values(){return window?.mw?.config?.values||{}}},this.db=e.storage.createDatabse("wiki-metadata",this.CACHE_TTL,this.VERSION),this.logger=e.logger("WIKI_METADATA")}get api(){return this.ctx.api}async start(){const e=await this.fetchFromCache();if(e)this._data=e,this.logger.debug("Using cached");else{const i=await this.fetchFromApi();this.saveToCache(i),this._data=i,this.logger.debug("Fetched from API")}this.logger.info("loaded",this._data),this.ctx.set("getUrl",this.getUrl.bind(this)),this.ctx.set("getSciprtUrl",this.getSciprtUrl.bind(this)),this.ctx.set("getMainpageUrl",this.getMainpageUrl.bind(this)),this.ctx.inject(["preferences"],i=>{i.preferences.registerCustomConfig("WikiMetadataService",te.object({WikiMetadataService:te.const(g("div",{children:[g("h3",{children:"Wiki Informations"}),g("ul",{children:[g("li",{children:[g("strong",{children:"Site:"})," ",this.general.sitename," (",this.landingPageUrl,")"]}),g("li",{children:[g("strong",{children:"User"}),": ",this.userInfo.name," (ID: ",this.userInfo.id,")"]}),g("li",{children:[g("strong",{children:"Groups"}),": ",this.userGroups.join(", ")||"None"]})]}),g("p",{children:g("button",{onClick:r=>{r.preventDefault(),this.invalidateCache().then(()=>{window.location.reload()})},children:"Clear caches and reload page"})})]})).role("raw-html")}).description("WikiMetadataService"),"general")})}get metadataCacheId(){return this.ctx.api.config.baseURL}async fetchFromApi(){return this.api.get({action:"query",...this.queryData}).then(({data:e})=>{if(typeof e?.query?.general>"u")throw new Error("Invalid siteinfo");return e.query}).catch(e=>(this.logger.error("Failed to fetch metadata",e),Promise.reject(e)))}async fetchFromCache(){const e=this.metadataCacheId,i=this.mwConfig.get("wgUserId",0),r=await this.db.get(e);return r&&typeof r=="object"&&r.general&&r.userinfo.id===i?r:(this.logger.info(r?"Cache mis-match":"Missing cache"),this.invalidateCache(),null)}async saveToCache(e){const i=this.metadataCacheId;return this.db.set(i,e)}async invalidateCache(){const e=this.metadataCacheId;return this.db.delete(e)}get _raw(){return this._data}get general(){return this._data.general}get specialPageAliases(){return this._data.specialpagealiases}get namespaceAliases(){return this._data.namespacealiases}get namespaces(){return this._data.namespaces}get namespaceMap(){const e=Object.values(this.namespaces).map(i=>({id:i.id,canonical:i.canonical,aliases:this.namespaceAliases.filter(r=>r.id===i.id).map(r=>r.alias)})).sort((i,r)=>i.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{get:()=>e}),e}get magicWords(){return this._data.magicwords}get userInfo(){return this._data.userinfo}get userOptions(){return this.userInfo.options}get isUserBlocked(){return this.userInfo.blockedbyid&&this.userInfo.blockexpiry&&new Date(this.userInfo.blockexpiry).getTime()>Date.now()}get userGroups(){return this.userInfo.groups}get userRights(){return this.userInfo.rights}get baseUrl(){const e=this.general.server;return e.startsWith("//")?`${window?.location?.protocol||"https:"}//${e.slice(2)}`:e}get landingPageUrl(){return this.general.base}get mainPageName(){return this.general.mainpage}get mainPageUrl(){return this.getUrl(this.mainPageName)}get articlePath(){return this.general.articlepath}get scriptPath(){return this.general.scriptpath}get articleBaseUrl(){return`${this.baseUrl}${this.articlePath}`}get scriptBaseUrl(){return`${this.baseUrl}${this.scriptPath}`}getSciprtUrl(e="index"){return`${this.scriptBaseUrl}/${e.replace(/\.php$/,"")}.php`}getMainpageUrl(e){return va(this._data.general.base,e).toString()}getUrl(e,i){const r=wa(i);let n;return typeof e=="string"&&e!==""?n=new URL(`${this.articleBaseUrl.replace("$1",e)}`):typeof e=="number"?(r.set("curid",e.toString()),n=new URL(this.getSciprtUrl("index"))):n=new URL(this.getSciprtUrl("index")),n.search=r.toString(),n.toString()}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(i=>this.hasRight(i))}hasEveryRights(...e){return e.every(i=>this.hasRight(i))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(i=>e.includes(i))}getBlockInfo(){return this.isUserBlocked?{blockid:this.userInfo.blockid,blockedby:this.userInfo.blockedbyid,blockedbyid:this.userInfo.blockedbyid,blockreason:this.userInfo.blockreason,blockedtimestamp:this.userInfo.blockedtimestamp,blockexpiry:this.userInfo.blockexpiry}:null}}as=Jh(Ea),Lr=id(as,0,"WikiMetadataService",ka,Lr),td(as,1,Lr);var ge;(t=>{function e(h){return new Promise((p,v)=>{h.onsuccess=()=>p(h.result),h.onerror=()=>v(h.error)})}t.promisifyRequest=e;const i=new Map,r=new Map;function n(h,p){const v=(r.get(h)??Promise.resolve()).then(p,p);return r.set(h,v.catch(()=>{})),v}function s(h){return new Promise(p=>setTimeout(p,h+Math.floor(Math.random()*8)))}function o(h){if(!(h instanceof DOMException))return!1;const p=h.name,v=String(h?.message??"");return p==="InvalidStateError"||p==="TransactionInactiveError"||p==="NotFoundError"||p==="AbortError"&&/versionchange|closing|internal/i.test(v)}function a(h){const p=i.get(h);if(p)return p;const v=new Promise((x,P)=>{const R=indexedDB.open(h);R.onupgradeneeded=()=>{},R.onsuccess=()=>{const B=R.result;B.onversionchange=()=>{try{B.close()}finally{i.delete(h)}},x(B)},R.onerror=()=>P(R.error),R.onblocked=()=>{}});return i.set(h,v),v}t.openDatabase=a;async function l(h){const p=i.get(h);if(p)try{(await p).close()}finally{i.delete(h)}}t.closeDatabase=l;async function c(){const h=Array.from(i.keys());await Promise.all(h.map(l))}t.closeAllDatabases=c;async function u(h){await l(h),await new Promise((p,v)=>{const x=indexedDB.deleteDatabase(h);x.onsuccess=()=>p(),x.onerror=()=>v(x.error),x.onblocked=()=>{}})}t.deleteDatabase=u;async function f(h,p,v={}){return n(h,async()=>{let x=await a(h);const P=!x.objectStoreNames.contains(p),R=!P&&v.indexes&&v.indexes.length>0;if(!P&&!R)return x;const B=x.version+1;x.close();const Pe=new Promise((Le,Se)=>{const be=indexedDB.open(h,B);be.onupgradeneeded=()=>{const he=be.result;let oe;if(he.objectStoreNames.contains(p)?oe=be.transaction.objectStore(p):oe=he.createObjectStore(p,{keyPath:v.keyPath??void 0,autoIncrement:!!v.autoIncrement}),v.indexes&&v.indexes.length>0)for(const{name:ae,keyPath:Q,options:tt}of v.indexes)oe.indexNames.contains(ae)||oe.createIndex(ae,Q,tt)},be.onsuccess=()=>{const he=be.result;he.onversionchange=()=>{try{he.close()}finally{i.delete(h)}},Le(he)},be.onerror=()=>Se(be.error),be.onblocked=()=>{}});return i.set(h,Pe),Pe})}t.ensureStore=f;async function d(h,p,v={}){return await f(h,p,v),{dbName:h,storeName:p,getDb:()=>a(h)}}t.createStore=d;async function y(h,p,v,x={}){const{dbName:P,storeName:R}=h,B=x.attempts??2,Pe=x.baseDelayMs??16;let Le;for(let Se=0;Se<=B;Se++)try{Se===0&&await f(P,R);const be=await a(P);let he;try{he=be.transaction(R,p)}catch(Q){if(o(Q)&&Se<B){await l(P),await s(Pe*(1<<Se)),Le=Q;continue}throw Q}const oe=he.objectStore(R),ae=new Promise((Q,tt)=>{he.oncomplete=()=>Q(),he.onerror=()=>tt(he.error),he.onabort=()=>tt(he.error)});try{const Q=await v(oe);return await ae,Q}catch(Q){if(o(Q)&&Se<B){try{he.abort()}catch{}await l(P),await s(Pe*(1<<Se)),Le=Q;continue}try{he.abort()}catch{}throw Q}}catch(be){if(o(be)&&Se<B){await l(P),await s(Pe*(1<<Se)),Le=be;continue}throw be}throw Le}t.withObjectStore=y;async function m(h,p){return y(h,"readonly",async v=>{const x=v.get(p);return e(x)})}t.get=m;async function E(h,p,v){return y(h,"readwrite",async x=>{const P=x.put(v,p);await e(P)})}t.set=E;async function j(h,p){return y(h,"readwrite",async v=>{const x=v.delete(p);await e(x)})}t.del=j;async function k(h){return y(h,"readwrite",async p=>{const v=p.clear();await e(v)})}t.clear=k;function F(h,p=100){return{[Symbol.asyncIterator](){let v=[],x=!1,P;const R=async()=>{x||(v=[],await y(h,"readonly",async B=>{const Pe=P===void 0?void 0:IDBKeyRange.lowerBound(P,!0);await new Promise((Le,Se)=>{let be=0;const he=B.openCursor(Pe,"next");he.onsuccess=()=>{const oe=he.result;if(!oe||be>=p){Le();return}v.push([oe.key,oe.value]),P=oe.key,be++,oe.continue()},he.onerror=()=>Se(he.error)}),v.length===0&&(x=!0)}))};return{async next(){return v.length===0&&!x&&await R(),v.length===0?{value:void 0,done:!0}:{value:v.shift(),done:!1}}}}}}t.entries=F;function b(h,p=200){const v=F(h,p);return{[Symbol.asyncIterator](){const x=v[Symbol.asyncIterator]();return{async next(){const P=await x.next();return P.done?{value:void 0,done:!0}:{value:P.value[0],done:!1}}}}}}t.keys=b})(ge||(ge={}));/**
|
|
60
|
+
* IDB Plus
|
|
61
|
+
*
|
|
62
|
+
* 🗄️ Minimal Promise based IndexedDB Wrapper with Map-like API
|
|
63
|
+
*
|
|
64
|
+
* @author dragon-fish <dragon-fish@qq.com>
|
|
65
|
+
* @license MIT
|
|
66
|
+
*/class rd{constructor(e,i,r={}){M(this,"iterBatch");M(this,"retry");M(this,"inlineKey");M(this,"idbStoreHandle");this.dbName=e,this.storeName=i,this.iterBatch=(r.iterBatch??100)|0,this.retry=r.retry,this.inlineKey=!!r.ensure?.keyPath,this.idbStoreHandle=ge.createStore(e,i,r.ensure??{})}async get(e){const i=await this.idbStoreHandle;return ge.get(i,e)}async set(e,i){const r=await this.idbStoreHandle;return this.inlineKey?ge.withObjectStore(r,"readwrite",async n=>{const s=n.put(i);await ge.promisifyRequest(s)},this.retry):ge.set(r,e,i)}async delete(e){const i=await this.idbStoreHandle;return ge.del(i,e)}async clear(){const e=await this.idbStoreHandle;return ge.clear(e)}async has(e){const i=await this.idbStoreHandle;return ge.withObjectStore(i,"readonly",async r=>{const n=r.count(e);return await ge.promisifyRequest(n)>0},this.retry)}async count(){const e=await this.idbStoreHandle;return ge.withObjectStore(e,"readonly",async i=>{const r=i.count();return ge.promisifyRequest(r)},this.retry)}entries(){const e=this;return{[Symbol.asyncIterator](){let i=null;return{async next(){if(!i){const r=await e.idbStoreHandle;i=ge.entries(r,e.iterBatch)[Symbol.asyncIterator]()}return await i.next()}}}}}keys(){const e=this;return{[Symbol.asyncIterator](){let i=null;return{async next(){if(!i){const r=await e.idbStoreHandle;i=ge.keys(r,e.iterBatch)[Symbol.asyncIterator]()}return await i.next()}}}}}values(){const e=this;return{[Symbol.asyncIterator](){const i=e.entries()[Symbol.asyncIterator]();return{async next(){const r=await i.next();return r.done?{value:void 0,done:!0}:{value:r.value[1],done:!1}}}}}}[Symbol.asyncIterator](){return this.entries()[Symbol.asyncIterator]()}async forEach(e){for await(const[i,r]of this.entries())await e(r,i,this)}async setMany(e){const i=await this.idbStoreHandle;await ge.withObjectStore(i,"readwrite",async r=>{for await(const[n,s]of $a(e)){const o=this.inlineKey?r.put(s):r.put(s,n);await ge.promisifyRequest(o)}},this.retry)}async deleteMany(e){const i=await this.idbStoreHandle;await ge.withObjectStore(i,"readwrite",async r=>{for await(const n of $a(e)){const s=r.delete(n);await ge.promisifyRequest(s)}},this.retry)}async tx(e,i){const r=await this.idbStoreHandle;return ge.withObjectStore(r,e,i,this.retry)}async close(){await ge.closeDatabase(this.dbName)}}function $a(t){return t[Symbol.asyncIterator]?t:{async*[Symbol.asyncIterator](){for(const e of t)yield e}}}class nd{constructor(e,i,r=1/0,n){this.dbName=e,this.storeName=i,this.ttl=r,this.version=n,this.db=new rd(e,i),this.keys=this.db.keys.bind(this.db),this.values=this.db.values.bind(this.db),this.entries=this.db.entries.bind(this.db)}async get(e,i=this.ttl,r){const n=await this.loadFromDB(e),s=this.checkIfExpired(n,i);if(!n||s){if(typeof r=="function"){const o=await r();return await this.set(e,o),o}return null}return n.value}async set(e,i){if(i===null||typeof i>"u")return this.delete(e);const r={time:Date.now(),value:i,version:this.version};return await this.db.set(e,r),r}async has(e,i=this.ttl){const r=await this.loadFromDB(e),n=this.checkIfExpired(r,i);return r!==null&&!n}async delete(e){await this.db.delete(e)}async loadFromDB(e){const i=await this.db.get(e);if(i===void 0)return null;if(typeof i.time!="number"||typeof i.value>"u"){try{await this.delete(e)}catch{}return null}if(typeof this.version=="number"&&i.version!==this.version){try{await this.delete(e)}catch{}return null}return i}checkIfExpired(e,i=this.ttl){return e?Date.now()-e.time>i:!1}async clear(){return await this.db.clear(),this}}class sd extends $t{constructor(e){super(e,"storage",!1)}createDatabse(e,i,r){return new nd("InPageEdit",e,i,r)}}var Ye=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(Ye||{});function od(t){const i=class i{constructor(n,s=!0){this._loaded=s,this.api=t,n.revisions?.forEach(o=>{typeof o?.slots?.main=="object"&&Object.assign(o,o.slots.main)}),this.pageInfo={...i.DEFAULT_PAGE_INFO,...n}}static async newFromApi(n){const{data:s}=await this.api.get({...i.DEFAULT_QUERY_PARAMS,...n}),o=s?.query?.pages?.[0];if(!o||!o.title)throw new Error("Invalid page info",{cause:s});return new i(o,!0)}static newBlankPage(n={}){return new i(n,!1)}async parse(n){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...n})}async preview(n,s){return this.parse({action:"parse",page:void 0,title:this.title,text:n,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...s})}async edit(n,s){const{text:o,prependtext:a,appendtext:l,summary:c="",watchlist:u=Ye.preferences,section:f}=n;return this.api.postWithEditToken({action:"edit",title:this.title,starttimestamp:this.pageInfo.touched,basetimestamp:this.revisions[0]?.timestamp,text:o,prependtext:a,appendtext:l,summary:c,watchlist:u,section:f,...s})}async createOnly(n,s){return this.edit(n,{createonly:1,...s})}async delete(n,s){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:n,...s})}async moveTo(n,s,o){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:n,reason:s,movetalk:1,movesubpages:1,...o})}userCan(n){return!!this.pageInfo?.actions?.[n]}userCanEdit(){return this.userCan("edit")}async reloadSelfInfo(){const n=await i.newFromApi({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),s=(this.pageInfo.revisions||[]).concat(n.revisions||[]).sort((o,a)=>o.revid-a.revid).reduce((o,a)=>(o.find(l=>l.revid===a.revid)||o.push(a),o),[]);return this.pageInfo=n.pageInfo,this.pageInfo.revisions=s,this._loaded=!0,this}get pageid(){return this.pageInfo.pageid}get title(){return this.pageInfo.title}get ns(){return this.pageInfo.ns}get contentmodel(){return this.pageInfo.contentmodel}get fullurl(){return this.pageInfo.fullurl}get canonicalurl(){return this.pageInfo.canonicalurl}get editurl(){return this.pageInfo.editurl}get revisions(){return this.pageInfo.revisions||[]}get lastrevid(){return this.pageInfo.lastrevid}get templates(){return this.pageInfo.templates||[]}get images(){return this.pageInfo.images||[]}};i.api=t,i.DEFAULT_QUERY_PARAMS={action:"query",prop:"info|templates|transcludedin|images|pageimages|revisions",inprop:"protection|url|varianttitles",intestactions:"edit|move|delete",tllimit:"max",tilimit:"max",imlimit:"max",piprop:"thumbnail|name|original",pithumbsize:"200",pilimit:"max",rvprop:"ids|timestamp|flags|comment|user|content",rvslots:"main"},i.DEFAULT_PAGE_INFO={pageid:0,ns:0,title:"",contentmodel:"wikitext",pagelanguage:"",pagelanguagehtmlcode:"",pagelanguagedir:"ltr",touched:new Date().toISOString(),lastrevid:0,length:0,protection:[],restrictiontypes:[],fullurl:"",canonicalurl:"",editurl:"",varianttitles:{},actions:{edit:!0,move:!1,delete:!1},revisions:[],templates:[],images:[]};let e=i;return e}const Po=class Po extends $t{constructor(e){super(e,"wikiPage",!0),this.ctx=e,this.WikiPage=od(this.ctx.api)}async createInstance(e,i=!1){return await this.WikiPage.newFromApi(e)}async newFromTitle(e,i=!1,r,n=!1){return this.createInstance({titles:e.toString(),converttitles:i,rvsection:r},n)}async newFromPageId(e,i,r=!1){return this.createInstance({pageids:e,rvsection:i},r)}async newFromRevision(e,i,r=!1){return await this.createInstance({revids:e,rvsection:i},r)}newBlankPage(e={}){return this.WikiPage.newBlankPage(e)}};Po.inject=["api"];let ls=Po;const Pa=new WeakMap,ut={toDBKey:t=>t.replace(/ /g,"_"),toNormalText:t=>t.replace(/_/g," "),ensureCase:(t,e)=>e==="first-letter"?t.charAt(0).toUpperCase()+t.slice(1):t},ci={normalizeSpecialPageName:t=>t.toLowerCase(),buildSpecialPageIndex:t=>{const e=new Map,i=new Map,r=new Map;for(const n of t.specialpagealiases){const s=n.realname;e.set(s,s);const o=ci.normalizeSpecialPageName(s);r.set(o,s);for(const a of n.aliases){i.set(a,s);const l=ci.normalizeSpecialPageName(a);r.set(l,s)}}return{byRealName:e,byAlias:i,byNormalized:r}},findSpecialPageRealName:(t,e)=>{const i=t.split("/")[0];let r=e.byRealName.get(i)??e.byAlias.get(i);if(r!==void 0)return r;const n=ci.normalizeSpecialPageName(i);return e.byNormalized.get(n)??null}},nt={normalizeNamespaceText:t=>t.replace(/[_\s]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),buildIndex:t=>{const e=new Map,i=new Map,r=new Map,n=new Map;for(const[s,o]of Object.entries(t.namespaces)){const a=parseInt(s);e.set(o.name,a),i.set(o.canonical??"",a);const l=nt.normalizeNamespaceText(o.name),c=nt.normalizeNamespaceText(o.canonical??"");n.set(l,a),n.set(c,a)}for(const s of t.namespacealiases){r.set(s.alias,s.id);const o=nt.normalizeNamespaceText(s.alias);n.set(o,s.id)}return{byName:e,byCanonical:i,byAlias:r,byNormalized:n}},findNamespaceId:(t,e)=>{let i=e.byName.get(t)??e.byCanonical.get(t)??e.byAlias.get(t);if(i!==void 0)return i;const r=nt.normalizeNamespaceText(t);return e.byNormalized.get(r)??null},isTalkPage:t=>t%2===1&&t>0,getDefaultNamespaceInfo:t=>({id:t,name:"",canonical:"",case:"first-letter",content:!1,nonincludable:!1,subpages:!1})};function ad(t){var s,o;const e=Pa.get(t);if(e)return e;const i=nt.buildIndex(t),r=ci.buildSpecialPageIndex(t),a=class a{constructor(c,u){Ii(this,s);Ii(this,o);if(this.newTitle=a.create.bind(a),this.toText=this.getPrefixedText.bind(this),this.toString=this.getPrefixedDBKey.bind(this),ze(this,s,c||""),ze(this,o,u??0),u===void 0?this.fixNSByTitle():this.stripNamespaceFromTitle(),this.getMainText()==="")throw new Error("Invalid title")}static create(c,u){return new a(c,u)}fixNSByTitle(){const c=J(this,s).indexOf(":");if(c===-1)return;if(c===0){ze(this,s,J(this,s).substring(1));return}const u=J(this,s).substring(0,c),f=J(this,s).substring(c+1),d=nt.findNamespaceId(u,a._namespaceIndex);d!==null&&(ze(this,s,f),ze(this,o,d))}stripNamespaceFromTitle(){const c=J(this,s).indexOf(":");if(c===-1)return;if(c===0){ze(this,s,J(this,s).substring(1));return}const u=J(this,s).substring(0,c),f=J(this,s).substring(c+1);nt.findNamespaceId(u,a._namespaceIndex)!==null&&ze(this,s,f)}getNamespaceInfo(){return a._meta.namespaces[J(this,o)]??nt.getDefaultNamespaceInfo(J(this,o))}getMainDBKey(){const c=this.getNamespaceInfo();if(J(this,o)===-1){const u=ci.findSpecialPageRealName(J(this,s),a._specialPageIndex);if(u){const f=J(this,s).includes("/")?J(this,s).substring(J(this,s).indexOf("/")):"",d=u+f;return ut.ensureCase(ut.toDBKey(d),c.case)}}return ut.ensureCase(ut.toDBKey(J(this,s)),c.case)}getMainText(){const c=this.getNamespaceInfo();if(J(this,o)===-1){const u=ci.findSpecialPageRealName(J(this,s),a._specialPageIndex);if(u){const f=J(this,s).includes("/")?J(this,s).substring(J(this,s).indexOf("/")):"",d=u+f;return ut.ensureCase(ut.toNormalText(d),c.case)}}return ut.ensureCase(ut.toNormalText(J(this,s)),c.case)}getMainRootText(){return this.getMainText().split("/")[0]}getPrefixedDBKey(){return J(this,o)===0?this.getMainDBKey():`${this.getNamespaceDBKey()}:${this.getMainDBKey()}`}getPrefixedText(){return J(this,o)===0?this.getMainText():`${this.getNamespaceText()}:${this.getMainText()}`}getNamespaceId(){return J(this,o)}getNamespaceText(){return this.getNamespaceInfo().name??""}getNamespaceDBKey(){const c=this.getNamespaceInfo();return ut.ensureCase(ut.toDBKey(this.getNamespaceText()),c.case)}getSubjectPage(){if(nt.isTalkPage(J(this,o))){const c=J(this,o)-1;return new a(J(this,s),c)}return this}getTalkPage(){if(nt.isTalkPage(J(this,o)))return this;if(J(this,o)<0)return null;const c=J(this,o)+1;return a._meta.namespaces[c.toString()]?new a(J(this,s),c):null}getURL(c){const u=a._meta.general.articlepath,f=this.getPrefixedDBKey(),d=u.replace("$1",f),y=new URL(d,location.origin);return c&&(c instanceof URLSearchParams?c:new URLSearchParams(c)).forEach((E,j)=>{y.searchParams.set(j,E)}),y}setTitle(c){return ze(this,s,c),ze(this,o,0),this.fixNSByTitle(),this}setMainText(c){return ze(this,s,c),this}setNamespaceText(c){const u=nt.findNamespaceId(c,a._namespaceIndex);return u!==null&&ze(this,o,u),this}setNamespaceId(c){return ze(this,o,c),this}equals(c){return typeof c=="string"&&(c=new a(c)),this.getPrefixedDBKey()===c.getPrefixedDBKey()}isSpecial(c){if(J(this,o)!==-1)return!1;const u=new a(c,-1);return this.getMainRootText()===u.getMainRootText()}toJSON(){return{ns:J(this,o),text:this.getMainText(),title:this.getPrefixedText(),url:this.getURL().toString(),isSpecial:J(this,o)<0}}};s=new WeakMap,o=new WeakMap,a._meta=t,a._namespaceIndex=i,a._specialPageIndex=r;let n=a;return Pa.set(t,n),n}const hr=class hr extends $t{constructor(e){super(e,"wikiTitle",!0),this.ctx=e,this.logger=this.ctx.logger("WikiTitleService"),this._cachedTitles=new Map,this.wiki=this.ctx.wiki,this.wikiBaseUrl=this.wiki.baseUrl,this.wikiArticlePath=this.wiki.articlePath.replace("$1",""),this.wikiArticleBaseUrl=this.wiki.articleBaseUrl.replace("$1",""),this.wikiIndexPhpUrl=this.wiki.getSciprtUrl("index.php"),this.Title=ad(this.ctx.wiki._raw)}newTitle(e,i){return new this.Title(e,i)}newMainPageTitle(){return this.newTitle(this.ctx.wiki.mainPageName)}async newTitleFromUrl(e){const i=this.parseWikiLink(e);return i?.title?i.title:i?.pageId?this.newTitleFromPageId(i.pageId):null}async newTitleFromAnyId(e,i=!1){const{title:r,pageId:n,revId:s}=e??{};if(typeof r=="string")return this.newTitle(r);let o,a;if(s?(o=parseInt(s.toString(),10),a="revid"):n&&(o=parseInt(n.toString(),10),a="pageid"),!o||!a||isNaN(o)||o<=0)throw new Error("Invalid id or kind",{cause:e});if(!i&&this._cachedTitles.has(`${a}:${o}`))return await this._cachedTitles.get(`${a}:${o}`);const{promise:l,resolve:c,reject:u}=re();this._cachedTitles.set(`${a}:${o}`,l);try{const{wikiPage:f}=await this.ctx.useScope(["wikiPage"]);let d=null;if(a==="pageid")d=await f.newFromPageId(o);else if(a==="revid")d=await f.newFromRevision(o);else throw new Error(`Invalid kind: ${a}`);c(this.newTitle(d.title))}catch(f){this._cachedTitles.delete(`${a}:${o}`),u(f)}return l}async newTitleFromPageId(e){return this.newTitleFromAnyId({pageId:e})}async newTitleFromRevision(e){return this.newTitleFromAnyId({revId:e})}resolveSpecialPageTarget(e){const i=typeof e=="string"?this.newTitle(e):e;if(!i||i.getNamespaceId()!==-1)return null;let r,n,s="view";const o=i.getMainDBKey().split("/").slice(1).join("/")||"";if(i.isSpecial("edit")&&o)r=o,s="edit";else if(i.isSpecial("talkpage")&&o){const a=i.newTitle(o).getTalkPage();if(!a)return null;r=a.getPrefixedDBKey()}else if(i.isSpecial("mypage"))r=i.newTitle(this.ctx.wiki.userInfo.name,2).getPrefixedDBKey()+(o?`/${o}`:"");else if(i.isSpecial("mytalk"))r=i.newTitle(this.ctx.wiki.userInfo.name,3).getPrefixedDBKey()+(o?`/${o}`:"");else if(i.isSpecial("newsection")&&o)r=o,n="new",s="edit";else return null;return{title:new this.Title(r),section:n,action:s}}isWikiLink(e){return e.startsWith(this.wikiArticleBaseUrl)||e.startsWith(this.wikiIndexPhpUrl)||e.startsWith(`${this.wikiBaseUrl}/?`)}validateHrefAttr(e){return typeof e!="string"?!1:!hr.REG_SKIPPED_HREF.test(e)}parseWikiLink(e){if(!e||typeof e=="string"&&!this.validateHrefAttr(e))return null;const i=va(e);if(!this.isWikiLink(i.toString()))return null;const r=i.searchParams,n=i.hash.replace("#",""),s=r.get("action")||"view",o=r.get("title")||"",a=parseInt(r.get("curid")||"0",10),l=parseInt(r.get("oldid")||"0",10);let c=o||(()=>{try{return decodeURIComponent(i.pathname.substring(this.wikiArticlePath.length))}catch(y){return this.logger.error("parseLink",i,y),""}})();c.endsWith("index.php")&&(c="");let u,f,d;if(l)d=l;else if(a)f=a;else if(c)u=this.newTitle(c);else if(i.origin+i.pathname===this.ctx.wiki.landingPageUrl)u=this.newMainPageTitle();else return null;return{title:u,pageId:f,revId:d,url:i,params:r,hash:n,action:s}}};hr.inject=["wiki"],hr.REG_SKIPPED_HREF=/^(#|javascript:|vbscript:|file:)/i;let cs=hr;const ld=t=>typeof t=="function";async function cd(t){return ld(t)?await t():t}var ud=Object.create,us=Object.defineProperty,fd=Object.getOwnPropertyDescriptor,Ca=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Oa=t=>{throw TypeError(t)},hd=(t,e,i)=>e in t?us(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,dd=(t,e)=>us(t,"name",{value:e,configurable:!0}),pd=t=>[,,,ud(t?.[Ca("metadata")]??null)],md=["class","method","getter","setter","accessor","field","value","get","set"],Ta=t=>t!==void 0&&typeof t!="function"?Oa("Function expected"):t,gd=(t,e,i,r,n)=>({kind:md[t],name:e,metadata:r,addInitializer:s=>i._?Oa("Already initialized"):n.push(Ta(s||null))}),yd=(t,e)=>hd(e,Ca("metadata"),t[3]),bd=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},wd=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&fd(n,i));dd(n,i);for(var m=r.length-1;m>=0;m--)l=gd(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,Ta(o)&&(n=o);return yd(t,n),y&&us(n,i,y),u?c^4?s:y:n},Ia,fs,Aa;Ia=[ke(["storage"])];class Nr extends(Aa=$t){constructor(e){super(e,"preferences",!0),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0)}get logger(){return this.ctx.logger("PREFERENCES")}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"})}async get(e,i){i??(i=()=>{const n=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${n})`),n});const r=await this.db.get(e,void 0);return r!==null?r:await cd(i)}getDefaultValue(e){var i;return(i=this._defaultPreferences)[e]??(i[e]=this.loadDefaultConfigs()[e])}set(e,i){const r=this.getDefaultValue(e);return i===r?this.db.delete(e):this.db.set(e,i)}async getAll(){const e=this.loadDefaultConfigs();for await(const[i,r]of this.db.entries())i!=="_touched"&&(e[i]=r.value);return e}async getExportable(){const e=await this.getAll(),i=this.loadDefaultConfigs(),r={};return Object.entries(i).forEach(([n,s])=>{const o=e[n];o!==s&&(r[n]=o)}),r}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(i=>{try{const r=i.schema({});Object.entries(r).forEach(([n,s])=>{e[n]=s})}catch{}}),Object.entries(e).forEach(([i,r])=>{this._defaultPreferences[i]=r}),e}registerCustomConfig(e,i,r){return this.customRegistries.push({name:e,schema:i,category:r}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([i])=>i===null?{name:"@root",schema:ui?.PreferencesSchema||null}:{name:i.name,schema:i?.PreferencesSchema||null}).filter(i=>i.schema!==null).map(i=>({...i,category:i.schema.meta.category||"general"})).concat(this.customRegistries).filter(i=>!e||i.category===e)}defineCategory(e){const i=this.categoryDefinitions.findIndex(r=>r.name===e.name);return i<0?this.categoryDefinitions.push(e):this.categoryDefinitions[i]=e,this.categoryDefinitions.sort((r,n)=>(r.index??0)-(n.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}fs=pd(Aa),Nr=wd(fs,0,"PreferencesService",Ia,Nr),bd(fs,1,Nr);var Mr=(t=>(t.ANALYTICS_API_BASE="https://analytics.ipe.wiki/api",t.ANALYTICS_DASH_URL="https://analytics.ipe.wiki",t.GITHUB_URL="https://github.com/inpageedit/inpageedit-next",t.HOME_URL="https://www.ipe.wiki/",t.UPDATE_LOGS_URL="https://www.ipe.wiki/changelogs/",t))(Mr||{});/**
|
|
60
67
|
* ✏️ InPageEdit NEXT
|
|
61
68
|
*
|
|
62
69
|
* 🚀 Modular, Extensible Supercharged Plugin for MediaWiki
|
|
@@ -65,7 +72,7 @@
|
|
|
65
72
|
* @license MIT
|
|
66
73
|
* @see https://github.com/inpageedit/inpageedit-next
|
|
67
74
|
* @see https://www.ipe.wiki/
|
|
68
|
-
*/const
|
|
75
|
+
*/const dr=class dr extends Ne{constructor(i){super({name:"InPageEdit"});Ii(this,vt);this.version="0.10.0",this.Endpoints=Mr,this.schema=te,this.config=Ni(dr.DEFAULT_CONFIG,i),this.logger=Go({name:"IPE",color:"#33aaff",level:this.config.logLevel}),it(this,vt,Vu).call(this),it(this,vt,Qu).call(this),it(this,vt,Yu).call(this)}async useScope(i){const{promise:r,resolve:n}=re();return this.inject(i,s=>{n(s)}),r}};vt=new WeakSet,Vu=async function(){this.plugin(qf,this.config.apiConfigs),this.plugin($r),this.plugin(Zf),this.plugin(Kh),this.plugin(Nr),this.plugin(sd),this.plugin(Lr),this.plugin(ls),this.plugin(cs),it(this,vt,Gu).call(this,["api","currentPage","resourceLoader","modal","preferences","storage","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},Gu=function(i){if(typeof i=="string"&&(i=[i]),!Array.isArray(i)||i.length===0)return this;for(const r of i){const n=this[dr.internal][r];n?.type==="service"&&(n.builtin=!0)}return this},Qu=async function(){[Promise.resolve().then(()=>Ld).then(({PluginInArticleLinks:r})=>r),Promise.resolve().then(()=>Rg).then(({PluginPreferencesUI:r})=>r),Promise.resolve().then(()=>Gg).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>sy).then(({PluginQuickDelete:r})=>r),Promise.resolve().then(()=>gy).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>Py).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>zy).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>Wy).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>ib).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},Yu=async function(){this.inject(["resourceLoader"],i=>{})},dr.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:Bn.info,autoloadStyles:!0};let ui=dr;function vd(t){return t.charAt(0).toLowerCase()+t.slice(1)}function _d(t){return vd(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}const Pn=class Pn{constructor(e,i=void 0,r){Ii(this,pr);this.ctx=e,this.disposeHandlers=[],this.name=r||"",this.config=i||{};const{promise:n,resolve:s,reject:o}=Promise.withResolvers();queueMicrotask(()=>{this.name||(this.name=this.constructor.name);try{const a=this.start();a&&typeof a.then=="function"?a.then(()=>s()).catch(l=>{this.logger.error("start() returns a rejected promise",l),o(l)}):s()}catch(a){this.logger.error("start() threw synchronously",a),o(a)}n.then(()=>{this.logger.debug("started")}),n.catch(a=>{this.logger.error("start failed",a),this.ctx.scope.dispose()})}),this.ctx.once("dispose",()=>{this.disposeHandlers.forEach(a=>a(this.ctx)),this.stop(),this.logger.debug("disposed")})}start(){}stop(){}addDisposeHandler(e){this.disposeHandlers.push(e)}removeDisposeHandler(e){this.disposeHandlers=this.disposeHandlers.filter(i=>i!==e)}set name(e){ze(this,pr,_d(e).toUpperCase())}get name(){return J(this,pr)}get logger(){return this.ctx.logger(this.name)}};pr=new WeakMap,Pn.inject=[],Pn.reusable=!1;let Je=Pn;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),Sd("InPageEdit#autoload",()=>{const t=Ra();t&&xd({baseURL:t,CoreClass:ui})});async function xd(t={baseURL:Ra(),CoreClass:ui}){const{baseURL:e,CoreClass:i}=t;typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const r=window.InPageEdit||{},n=new i({apiConfigs:{baseURL:e},legacyPreferences:r?.myPreferences||{}});if(window.InPageEdit=i,window.ipe=n,await n.start(),window.RLQ.push(()=>{mw.hook("InPageEdit.ready").fire(n)}),Array.isArray(window.__IPE_MODULES__)){const s=[];for(;window.__IPE_MODULES__.length;)try{const o=window.__IPE_MODULES__.shift();typeof o=="function"&&o?.(n),s.push(o)}catch{}window.__IPE_MODULES__={push:o=>{typeof o=="function"&&o(n),s.push(o)}},n.on("dispose",()=>{window.__IPE_MODULES__=s})}n.logger("AUTOLOAD").info(`
|
|
69
76
|
____ ____ ______ ___ __
|
|
70
77
|
/ _/___ / __ \\____ _____ ____ / ____/___/ (_) /_
|
|
71
78
|
/ // __ \\/ /_/ / __ \`/ __ \`/ _ \\/ __/ / __ / / __/
|
|
@@ -73,27 +80,27 @@
|
|
|
73
80
|
/___/_/ /_/_/ \\__,_/\\__, /\\___/_____/\\__,_/_/\\__/
|
|
74
81
|
/____/ v`+n.version+`
|
|
75
82
|
- Wiki API Endpoint: ${e}
|
|
76
|
-
- Documentation: ${
|
|
77
|
-
- Bug Reports: ${
|
|
83
|
+
- Documentation: ${Mr.HOME_URL}
|
|
84
|
+
- Bug Reports: ${Mr.GITHUB_URL}`)}function Ra(){const t=document.querySelector('meta[name="generator"][content^="MediaWiki"]')!==null,e=document.querySelector('link[rel="EditURI"]')?.href?.split("?")[0];return t&&e?e:void 0}function Sd(t,e){const i=Symbol.for(t);return window[i]?!1:(window[i]=!0,e(),!0)}function fi(t){return function(e){return e.PreferencesSchema=t,e}}const La=t=>g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...t,class:`icon icon-tabler icons-tabler-outline icon-tabler-pencil-bolt ${t.className||""}`,children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),g("path",{d:"M13.5 6.5l4 4"}),g("path",{d:"M19 16l-2 3h4l-2 3"})]});var kd=Object.create,hs=Object.defineProperty,Ed=Object.getOwnPropertyDescriptor,Na=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ma=t=>{throw TypeError(t)},$d=(t,e,i)=>e in t?hs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Pd=(t,e)=>hs(t,"name",{value:e,configurable:!0}),Cd=t=>[,,,kd(t?.[Na("metadata")]??null)],Od=["class","method","getter","setter","accessor","field","value","get","set"],Da=t=>t!==void 0&&typeof t!="function"?Ma("Function expected"):t,Td=(t,e,i,r,n)=>({kind:Od[t],name:e,metadata:r,addInitializer:s=>i._?Ma("Already initialized"):n.push(Da(s||null))}),Id=(t,e)=>$d(e,Na("metadata"),t[3]),Ad=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Rd=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&Ed(n,i));Pd(n,i);for(var m=r.length-1;m>=0;m--)l=Td(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,Da(o)&&(n=o);return Id(t,n),y&&hs(n,i,y),u?c^4?s:y:n},ja,ds,Ua;ja=[ke(["wiki","wikiTitle","preferences"]),fi(te.object({"inArticleLinks.enable":te.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":te.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":te.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":te.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];class Dr extends(Ua=Je){constructor(e){super(e,{linkClassName:"ipe__in-article-link"},"InArticleLinks"),this._cachedAnchorInfo=new WeakMap,this.ctx.set("inArticleLinks",this),this.ctx.preferences.defineCategory({label:"In Article Links",name:"in-article-links",description:"In-article links preferences",index:9})}async start(){await this.ctx.preferences.get("inArticleLinks.quickEdit.enable")&&this.handleQuickEdit(),await this.ctx.preferences.get("inArticleLinks.quickDiff.enable")&&this.handleQuickDiff()}async stop(){Array.from(document.getElementsByClassName(this.config.linkClassName)).forEach(e=>{e.remove()}),document.querySelectorAll("[data-ipe-edit-mounted]").forEach(e=>{e.dataset.ipeEditMounted=void 0})}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const i=this._cachedAnchorInfo.get(e);if(i)return i;const r=e.getAttribute("href")||"";if(!this.ctx.wikiTitle.validateHrefAttr(r))return null;const n=e.href||"",s=this.ctx.wikiTitle.parseWikiLink(n);if(!s)return null;const o={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!r.startsWith("http"),redlink:e.classList.contains("new")||s.params.has("redlink"),...s};return this._cachedAnchorInfo.set(e,o),o}scanAnchors(e,i){const r=e.querySelectorAll("a[href]");return Array.from(r).map(n=>this.parseAnchor(n)).filter(n=>n!==null&&(!i||i(n)))}async handleQuickEdit(){let e=!1;const i=await this.ctx.preferences.get("inArticleLinks.quickEdit.redlinks");this.ctx.inject(["quickEdit"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(n=>{if(!e)return;this.scanAnchors(n.get(0),({action:o,title:a,redlink:l})=>i||!l?["edit","create"].includes(o)?!0:a?.isSpecial("edit")||a?.isSpecial("newsection")?a.getMainText().split("/").length>=2:!1:!1).forEach(({$el:o,title:a,pageId:l,params:c})=>{if(o.dataset.ipeEditMounted)return;if(o.dataset.ipeEditMounted="1",c.has("preload")||c.has("redo"))return this.ctx.logger.debug(o,"Not compatible with quick edit");const f=a?.getPrefixedDBKey()||"",d=c.get("section")?.replace(/^T-/,"")||void 0,y=c.get("oldid"),m=c.has("redlink");let E;d==="new"||a?.isSpecial("newsection")?E="new":d&&/^\d+$/.test(d)&&(E=parseInt(d,10));const j=y?parseInt(y,10):void 0,k={title:f,pageId:l||void 0,section:E,revision:j,createOnly:m},F=g("a",{href:"#ipe://quick-edit/",dataset:k,className:`${this.config.linkClassName} ipe-quick-edit ${m?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:b=>{b.preventDefault(),r.quickEdit.showModal(k)},children:g(La,{className:"ipe-icon"})});o.insertAdjacentElement("afterend",F)})})})}handleQuickDiff(){let e=!1;const i=r=>["prev","next","cur"].includes(r);this.ctx.inject(["quickDiff"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(n=>{if(!e)return;this.scanAnchors(n.get(0),({params:o,title:a})=>!!(o.has("diff")||a?.isSpecial("diff"))).forEach(({$el:o,title:a,params:l})=>{if(o.dataset.ipeDiffMounted)return;o.dataset.ipeDiffMounted="1";let c,u;if(a?.getNamespaceId()===-1?([,u,c]=a.getMainDBKey().split("/"),c||(c="prev")):(c=l.get("diff"),u=l.get("oldid")),!c||!u)return;const f={};i(c)?(f.fromrev=parseInt(u),f.torelative=c):(f.fromrev=parseInt(u),f.torev=parseInt(c));const d=g("a",{href:"#ipe://quick-diff/",dataset:f,className:`${this.config.linkClassName} ipe-quick-diff`,style:{userSelect:"none",marginLeft:"0.2em"},onClick:y=>{y.preventDefault(),r.quickDiff.comparePages(f)},children:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-diff ipe-icon",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),g("path",{d:"M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"}),g("path",{d:"M12 10l0 4"}),g("path",{d:"M10 12l4 0"}),g("path",{d:"M10 17l4 0"})]})});o.insertAdjacentElement("afterend",d)})})})}}ds=Cd(Ua),Dr=Rd(ds,0,"PluginInArticleLinks",ja,Dr),Ad(ds,1,Dr);const Ld=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return Dr}},Symbol.toStringTag,{value:"Module"}));/**
|
|
78
85
|
* @vue/shared v3.5.22
|
|
79
86
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
80
87
|
* @license MIT
|
|
81
|
-
**/function
|
|
88
|
+
**/function ps(t){const e=Object.create(null);for(const i of t.split(","))e[i]=1;return i=>i in e}const ie={},hi=[],ft=()=>{},Fa=()=>!1,jr=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),ms=t=>t.startsWith("onUpdate:"),Ee=Object.assign,gs=(t,e)=>{const i=t.indexOf(e);i>-1&&t.splice(i,1)},Nd=Object.prototype.hasOwnProperty,ne=(t,e)=>Nd.call(t,e),K=Array.isArray,di=t=>Ur(t)==="[object Map]",Ba=t=>Ur(t)==="[object Set]",G=t=>typeof t=="function",ye=t=>typeof t=="string",jt=t=>typeof t=="symbol",fe=t=>t!==null&&typeof t=="object",qa=t=>(fe(t)||G(t))&&G(t.then)&&G(t.catch),Ha=Object.prototype.toString,Ur=t=>Ha.call(t),Md=t=>Ur(t).slice(8,-1),za=t=>Ur(t)==="[object Object]",ys=t=>ye(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,Hi=ps(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Fr=t=>{const e=Object.create(null);return i=>e[i]||(e[i]=t(i))},Dd=/-\w/g,Ot=Fr(t=>t.replace(Dd,e=>e.slice(1).toUpperCase())),jd=/\B([A-Z])/g,Ut=Fr(t=>t.replace(jd,"-$1").toLowerCase()),Wa=Fr(t=>t.charAt(0).toUpperCase()+t.slice(1)),bs=Fr(t=>t?`on${Wa(t)}`:""),Ue=(t,e)=>!Object.is(t,e),ws=(t,...e)=>{for(let i=0;i<t.length;i++)t[i](...e)},Ka=(t,e,i,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:i})},Ud=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let Va;const Br=()=>Va||(Va=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function vs(t){if(K(t)){const e={};for(let i=0;i<t.length;i++){const r=t[i],n=ye(r)?Hd(r):vs(r);if(n)for(const s in n)e[s]=n[s]}return e}else if(ye(t)||fe(t))return t}const Fd=/;(?![^(]*\))/g,Bd=/:([^]+)/,qd=/\/\*[^]*?\*\//g;function Hd(t){const e={};return t.replace(qd,"").split(Fd).forEach(i=>{if(i){const r=i.split(Bd);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function qr(t){let e="";if(ye(t))e=t;else if(K(t))for(let i=0;i<t.length;i++){const r=qr(t[i]);r&&(e+=r+" ")}else if(fe(t))for(const i in t)t[i]&&(e+=i+" ");return e.trim()}const zd=ps("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function Ga(t){return!!t||t===""}const Qa=t=>!!(t&&t.__v_isRef===!0),_s=t=>ye(t)?t:t==null?"":K(t)||fe(t)&&(t.toString===Ha||!G(t.toString))?Qa(t)?_s(t.value):JSON.stringify(t,Ya,2):String(t),Ya=(t,e)=>Qa(e)?Ya(t,e.value):di(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((i,[r,n],s)=>(i[xs(r,s)+" =>"]=n,i),{})}:Ba(e)?{[`Set(${e.size})`]:[...e.values()].map(i=>xs(i))}:jt(e)?xs(e):fe(e)&&!K(e)&&!za(e)?String(e):e,xs=(t,e="")=>{var i;return jt(t)?`Symbol(${(i=t.description)!=null?i:e})`:t};/**
|
|
82
89
|
* @vue/reactivity v3.5.22
|
|
83
90
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
84
91
|
* @license MIT
|
|
85
|
-
**/let Ne;class Md{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Ne,!e&&Ne&&(this.index=(Ne.scopes||(Ne.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].pause();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].resume();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].resume()}}run(e){if(this._active){const i=Ne;try{return Ne=this,e()}finally{Ne=i}}}on(){++this._on===1&&(this.prevScope=Ne,Ne=this)}off(){this._on>0&&--this._on===0&&(Ne=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let i,r;for(i=0,r=this.effects.length;i<r;i++)this.effects[i].stop();for(this.effects.length=0,i=0,r=this.cleanups.length;i<r;i++)this.cleanups[i]();if(this.cleanups.length=0,this.scopes){for(i=0,r=this.scopes.length;i<r;i++)this.scopes[i].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Dd(){return Ne}let se;const Es=new WeakSet;class Ya{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Ne&&Ne.active&&Ne.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Es.has(this)&&(Es.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Ja(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,rl(this),Za(this);const e=se,i=Je;se=this,Je=!0;try{return this.fn()}finally{el(this),se=e,Je=i,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Os(e);this.deps=this.depsTail=void 0,rl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Es.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Cs(this)&&this.run()}get dirty(){return Cs(this)}}let Xa=0,Wi,Ki;function Ja(t,e=!1){if(t.flags|=8,e){t.next=Ki,Ki=t;return}t.next=Wi,Wi=t}function $s(){Xa++}function Ps(){if(--Xa>0)return;if(Ki){let e=Ki;for(Ki=void 0;e;){const i=e.next;e.next=void 0,e.flags&=-9,e=i}}let t;for(;Wi;){let e=Wi;for(Wi=void 0;e;){const i=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=i}}if(t)throw t}function Za(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function el(t){let e,i=t.depsTail,r=i;for(;r;){const n=r.prevDep;r.version===-1?(r===i&&(i=n),Os(r),jd(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}t.deps=e,t.depsTail=i}function Cs(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(tl(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function tl(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Vi)||(t.globalVersion=Vi,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!Cs(t))))return;t.flags|=2;const e=t.dep,i=se,r=Je;se=t,Je=!0;try{Za(t);const n=t.fn(t._value);(e.version===0||Le(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{se=i,Je=r,el(t),t.flags&=-3}}function Os(t,e=!1){const{dep:i,prevSub:r,nextSub:n}=t;if(r&&(r.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=r,t.nextSub=void 0),i.subs===t&&(i.subs=r,!r&&i.computed)){i.computed.flags&=-5;for(let s=i.computed.deps;s;s=s.nextDep)Os(s,!0)}!e&&!--i.sc&&i.map&&i.map.delete(i.key)}function jd(t){const{prevDep:e,nextDep:i}=t;e&&(e.nextDep=i,t.prevDep=void 0),i&&(i.prevDep=e,t.nextDep=void 0)}let Je=!0;const il=[];function at(){il.push(Je),Je=!1}function lt(){const t=il.pop();Je=t===void 0?!0:t}function rl(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const i=se;se=void 0;try{e()}finally{se=i}}}let Vi=0;class Ud{constructor(e,i){this.sub=e,this.dep=i,this.version=i.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class zr{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!se||!Je||se===this.computed)return;let i=this.activeLink;if(i===void 0||i.sub!==se)i=this.activeLink=new Ud(se,this),se.deps?(i.prevDep=se.depsTail,se.depsTail.nextDep=i,se.depsTail=i):se.deps=se.depsTail=i,nl(i);else if(i.version===-1&&(i.version=this.version,i.nextDep)){const r=i.nextDep;r.prevDep=i.prevDep,i.prevDep&&(i.prevDep.nextDep=r),i.prevDep=se.depsTail,i.nextDep=void 0,se.depsTail.nextDep=i,se.depsTail=i,se.deps===i&&(se.deps=r)}return i}trigger(e){this.version++,Vi++,this.notify(e)}notify(e){$s();try{for(let i=this.subs;i;i=i.prevSub)i.sub.notify()&&i.sub.dep.notify()}finally{Ps()}}}function nl(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)nl(r)}const i=t.dep.subs;i!==t&&(t.prevSub=i,i&&(i.nextSub=t)),t.dep.subs=t}}const As=new WeakMap,Xt=Symbol(""),Ts=Symbol(""),Gi=Symbol("");function ke(t,e,i){if(Je&&se){let r=As.get(t);r||As.set(t,r=new Map);let n=r.get(i);n||(r.set(i,n=new zr),n.map=r,n.key=i),n.track()}}function Et(t,e,i,r,n,s){const o=As.get(t);if(!o){Vi++;return}const a=l=>{l&&l.trigger()};if($s(),e==="clear")o.forEach(a);else{const l=K(t),c=l&&ws(i);if(l&&i==="length"){const u=Number(r);o.forEach((f,d)=>{(d==="length"||d===Gi||!It(d)&&d>=u)&&a(f)})}else switch((i!==void 0||o.has(void 0))&&a(o.get(i)),c&&a(o.get(Gi)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Xt)),pi(t)&&a(o.get(Ts)));break;case"delete":l||(a(o.get(Xt)),pi(t)&&a(o.get(Ts)));break;case"set":pi(t)&&a(o.get(Xt));break}}Ps()}function mi(t){const e=J(t);return e===t?e:(ke(e,"iterate",Gi),ze(t)?e:e.map(_e))}function Wr(t){return ke(t=J(t),"iterate",Gi),t}const Fd={__proto__:null,[Symbol.iterator](){return Rs(this,Symbol.iterator,_e)},concat(...t){return mi(this).concat(...t.map(e=>K(e)?mi(e):e))},entries(){return Rs(this,"entries",t=>(t[1]=_e(t[1]),t))},every(t,e){return $t(this,"every",t,e,void 0,arguments)},filter(t,e){return $t(this,"filter",t,e,i=>i.map(_e),arguments)},find(t,e){return $t(this,"find",t,e,_e,arguments)},findIndex(t,e){return $t(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return $t(this,"findLast",t,e,_e,arguments)},findLastIndex(t,e){return $t(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return $t(this,"forEach",t,e,void 0,arguments)},includes(...t){return Is(this,"includes",t)},indexOf(...t){return Is(this,"indexOf",t)},join(t){return mi(this).join(t)},lastIndexOf(...t){return Is(this,"lastIndexOf",t)},map(t,e){return $t(this,"map",t,e,void 0,arguments)},pop(){return Qi(this,"pop")},push(...t){return Qi(this,"push",t)},reduce(t,...e){return sl(this,"reduce",t,e)},reduceRight(t,...e){return sl(this,"reduceRight",t,e)},shift(){return Qi(this,"shift")},some(t,e){return $t(this,"some",t,e,void 0,arguments)},splice(...t){return Qi(this,"splice",t)},toReversed(){return mi(this).toReversed()},toSorted(t){return mi(this).toSorted(t)},toSpliced(...t){return mi(this).toSpliced(...t)},unshift(...t){return Qi(this,"unshift",t)},values(){return Rs(this,"values",_e)}};function Rs(t,e,i){const r=Wr(t),n=r[e]();return r!==t&&!ze(t)&&(n._next=n.next,n.next=()=>{const s=n._next();return s.done||(s.value=i(s.value)),s}),n}const Bd=Array.prototype;function $t(t,e,i,r,n,s){const o=Wr(t),a=o!==t&&!ze(t),l=o[e];if(l!==Bd[e]){const f=l.apply(t,s);return a?_e(f):f}let c=i;o!==t&&(a?c=function(f,d){return i.call(this,_e(f),d,t)}:i.length>2&&(c=function(f,d){return i.call(this,f,d,t)}));const u=l.call(o,c,r);return a&&n?n(u):u}function sl(t,e,i,r){const n=Wr(t);let s=i;return n!==t&&(ze(t)?i.length>3&&(s=function(o,a,l){return i.call(this,o,a,l,t)}):s=function(o,a,l){return i.call(this,o,_e(a),l,t)}),n[e](s,...r)}function Is(t,e,i){const r=J(t);ke(r,"iterate",Gi);const n=r[e](...i);return(n===-1||n===!1)&&Ds(i[0])?(i[0]=J(i[0]),r[e](...i)):n}function Qi(t,e,i=[]){at(),$s();const r=J(t)[e].apply(t,i);return Ps(),lt(),r}const qd=gs("__proto__,__v_isRef,__isVue"),ol=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(It));function Hd(t){It(t)||(t=String(t));const e=J(this);return ke(e,"has",t),e.hasOwnProperty(t)}class al{constructor(e=!1,i=!1){this._isReadonly=e,this._isShallow=i}get(e,i,r){if(i==="__v_skip")return e.__v_skip;const n=this._isReadonly,s=this._isShallow;if(i==="__v_isReactive")return!n;if(i==="__v_isReadonly")return n;if(i==="__v_isShallow")return s;if(i==="__v_raw")return r===(n?s?dl:hl:s?fl:ul).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=K(e);if(!n){let l;if(o&&(l=Fd[i]))return l;if(i==="hasOwnProperty")return Hd}const a=Reflect.get(e,i,we(e)?e:r);if((It(i)?ol.has(i):qd(i))||(n||ke(e,"get",i),s))return a;if(we(a)){const l=o&&ws(i)?a:a.value;return n&&ce(l)?Ms(l):l}return ce(a)?n?Ms(a):Ns(a):a}}class ll extends al{constructor(e=!1){super(!1,e)}set(e,i,r,n){let s=e[i];if(!this._isShallow){const l=Nt(s);if(!ze(r)&&!Nt(r)&&(s=J(s),r=J(r)),!K(e)&&we(s)&&!we(r))return l||(s.value=r),!0}const o=K(e)&&ws(i)?Number(i)<e.length:ie(e,i),a=Reflect.set(e,i,r,we(e)?e:n);return e===J(n)&&(o?Le(r,s)&&Et(e,"set",i,r):Et(e,"add",i,r)),a}deleteProperty(e,i){const r=ie(e,i);e[i];const n=Reflect.deleteProperty(e,i);return n&&r&&Et(e,"delete",i,void 0),n}has(e,i){const r=Reflect.has(e,i);return(!It(i)||!ol.has(i))&&ke(e,"has",i),r}ownKeys(e){return ke(e,"iterate",K(e)?"length":Xt),Reflect.ownKeys(e)}}class cl extends al{constructor(e=!1){super(!0,e)}set(e,i){return!0}deleteProperty(e,i){return!0}}const zd=new ll,Wd=new cl,Kd=new ll(!0),Vd=new cl(!0),Ls=t=>t,Kr=t=>Reflect.getPrototypeOf(t);function Gd(t,e,i){return function(...r){const n=this.__v_raw,s=J(n),o=pi(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...r),u=i?Ls:e?Yr:_e;return!e&&ke(s,"iterate",l?Ts:Xt),{next(){const{value:f,done:d}=c.next();return d?{value:f,done:d}:{value:a?[u(f[0]),u(f[1])]:u(f),done:d}},[Symbol.iterator](){return this}}}}function Vr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function Qd(t,e){const i={get(n){const s=this.__v_raw,o=J(s),a=J(n);t||(Le(n,a)&&ke(o,"get",n),ke(o,"get",a));const{has:l}=Kr(o),c=e?Ls:t?Yr:_e;if(l.call(o,n))return c(s.get(n));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(n)},get size(){const n=this.__v_raw;return!t&&ke(J(n),"iterate",Xt),n.size},has(n){const s=this.__v_raw,o=J(s),a=J(n);return t||(Le(n,a)&&ke(o,"has",n),ke(o,"has",a)),n===a?s.has(n):s.has(n)||s.has(a)},forEach(n,s){const o=this,a=o.__v_raw,l=J(a),c=e?Ls:t?Yr:_e;return!t&&ke(l,"iterate",Xt),a.forEach((u,f)=>n.call(s,c(u),c(f),o))}};return ve(i,t?{add:Vr("add"),set:Vr("set"),delete:Vr("delete"),clear:Vr("clear")}:{add(n){!e&&!ze(n)&&!Nt(n)&&(n=J(n));const s=J(this);return Kr(s).has.call(s,n)||(s.add(n),Et(s,"add",n,n)),this},set(n,s){!e&&!ze(s)&&!Nt(s)&&(s=J(s));const o=J(this),{has:a,get:l}=Kr(o);let c=a.call(o,n);c||(n=J(n),c=a.call(o,n));const u=l.call(o,n);return o.set(n,s),c?Le(s,u)&&Et(o,"set",n,s):Et(o,"add",n,s),this},delete(n){const s=J(this),{has:o,get:a}=Kr(s);let l=o.call(s,n);l||(n=J(n),l=o.call(s,n)),a&&a.call(s,n);const c=s.delete(n);return l&&Et(s,"delete",n,void 0),c},clear(){const n=J(this),s=n.size!==0,o=n.clear();return s&&Et(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{i[n]=Gd(n,t,e)}),i}function Gr(t,e){const i=Qd(t,e);return(r,n,s)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?r:Reflect.get(ie(i,n)&&n in r?i:r,n,s)}const Yd={get:Gr(!1,!1)},Xd={get:Gr(!1,!0)},Jd={get:Gr(!0,!1)},Zd={get:Gr(!0,!0)},ul=new WeakMap,fl=new WeakMap,hl=new WeakMap,dl=new WeakMap;function ep(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function tp(t){return t.__v_skip||!Object.isExtensible(t)?0:ep(Pd(t))}function Ns(t){return Nt(t)?t:Qr(t,!1,zd,Yd,ul)}function ip(t){return Qr(t,!1,Kd,Xd,fl)}function Ms(t){return Qr(t,!0,Wd,Jd,hl)}function eb(t){return Qr(t,!0,Vd,Zd,dl)}function Qr(t,e,i,r,n){if(!ce(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=tp(t);if(s===0)return t;const o=n.get(t);if(o)return o;const a=new Proxy(t,s===2?r:i);return n.set(t,a),a}function gi(t){return Nt(t)?gi(t.__v_raw):!!(t&&t.__v_isReactive)}function Nt(t){return!!(t&&t.__v_isReadonly)}function ze(t){return!!(t&&t.__v_isShallow)}function Ds(t){return t?!!t.__v_raw:!1}function J(t){const e=t&&t.__v_raw;return e?J(e):t}function rp(t){return!ie(t,"__v_skip")&&Object.isExtensible(t)&&Wa(t,"__v_skip",!0),t}const _e=t=>ce(t)?Ns(t):t,Yr=t=>ce(t)?Ms(t):t;function we(t){return t?t.__v_isRef===!0:!1}function pl(t){return ml(t,!1)}function Xr(t){return ml(t,!0)}function ml(t,e){return we(t)?t:new np(t,e)}class np{constructor(e,i){this.dep=new zr,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=i?e:J(e),this._value=i?e:_e(e),this.__v_isShallow=i}get value(){return this.dep.track(),this._value}set value(e){const i=this._rawValue,r=this.__v_isShallow||ze(e)||Nt(e);e=r?e:J(e),Le(e,i)&&(this._rawValue=e,this._value=r?e:_e(e),this.dep.trigger())}}function js(t){return we(t)?t.value:t}const sp={get:(t,e,i)=>e==="__v_raw"?t:js(Reflect.get(t,e,i)),set:(t,e,i,r)=>{const n=t[e];return we(n)&&!we(i)?(n.value=i,!0):Reflect.set(t,e,i,r)}};function gl(t){return gi(t)?t:new Proxy(t,sp)}class op{constructor(e){this.__v_isRef=!0,this._value=void 0;const i=this.dep=new zr,{get:r,set:n}=e(i.track.bind(i),i.trigger.bind(i));this._get=r,this._set=n}get value(){return this._value=this._get()}set value(e){this._set(e)}}function ap(t){return new op(t)}class lp{constructor(e,i,r){this.fn=e,this.setter=i,this._value=void 0,this.dep=new zr(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Vi-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!i,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&se!==this)return Ja(this,!0),!0}get value(){const e=this.dep.track();return tl(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function cp(t,e,i=!1){let r,n;return G(t)?r=t:(r=t.get,n=t.set),new lp(r,n,i)}const Jr={},Zr=new WeakMap;let Jt;function up(t,e=!1,i=Jt){if(i){let r=Zr.get(i);r||Zr.set(i,r=[]),r.push(t)}}function fp(t,e,i=ee){const{immediate:r,deep:n,once:s,scheduler:o,augmentJob:a,call:l}=i,c=h=>n?h:ze(h)||n===!1||n===0?Mt(h,1):Mt(h);let u,f,d,b,g=!1,E=!1;if(we(t)?(f=()=>t.value,g=ze(t)):gi(t)?(f=()=>c(t),g=!0):K(t)?(E=!0,g=t.some(h=>gi(h)||ze(h)),f=()=>t.map(h=>{if(we(h))return h.value;if(gi(h))return c(h);if(G(h))return l?l(h,2):h()})):G(t)?e?f=l?()=>l(t,2):t:f=()=>{if(d){at();try{d()}finally{lt()}}const h=Jt;Jt=u;try{return l?l(t,3,[b]):t(b)}finally{Jt=h}}:f=ot,e&&n){const h=f,m=n===!0?1/0:n;f=()=>Mt(h(),m)}const D=Dd(),k=()=>{u.stop(),D&&D.active&&bs(D.effects,u)};if(s&&e){const h=e;e=(...m)=>{h(...m),k()}}let B=E?new Array(t.length).fill(Jr):Jr;const p=h=>{if(!(!(u.flags&1)||!u.dirty&&!h))if(e){const m=u.run();if(n||g||(E?m.some((_,x)=>Le(_,B[x])):Le(m,B))){d&&d();const _=Jt;Jt=u;try{const x=[m,B===Jr?void 0:E&&B[0]===Jr?[]:B,b];B=m,l?l(e,3,x):e(...x)}finally{Jt=_}}}else u.run()};return a&&a(p),u=new Ya(f),u.scheduler=o?()=>o(p,!1):p,b=h=>up(h,!1,u),d=u.onStop=()=>{const h=Zr.get(u);if(h){if(l)l(h,4);else for(const m of h)m();Zr.delete(u)}},e?r?p(!0):B=u.run():o?o(p.bind(null,!0),!0):u.run(),k.pause=u.pause.bind(u),k.resume=u.resume.bind(u),k.stop=k,k}function Mt(t,e=1/0,i){if(e<=0||!ce(t)||t.__v_skip||(i=i||new Map,(i.get(t)||0)>=e))return t;if(i.set(t,e),e--,we(t))Mt(t.value,e,i);else if(K(t))for(let r=0;r<t.length;r++)Mt(t[r],e,i);else if(Fa(t)||pi(t))t.forEach(r=>{Mt(r,e,i)});else if(Ha(t)){for(const r in t)Mt(t[r],e,i);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Mt(t[r],e,i)}return t}/**
|
|
92
|
+
**/let Fe;class Wd{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=Fe,!e&&Fe&&(this.index=(Fe.scopes||(Fe.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].pause();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,i;if(this.scopes)for(e=0,i=this.scopes.length;e<i;e++)this.scopes[e].resume();for(e=0,i=this.effects.length;e<i;e++)this.effects[e].resume()}}run(e){if(this._active){const i=Fe;try{return Fe=this,e()}finally{Fe=i}}}on(){++this._on===1&&(this.prevScope=Fe,Fe=this)}off(){this._on>0&&--this._on===0&&(Fe=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let i,r;for(i=0,r=this.effects.length;i<r;i++)this.effects[i].stop();for(this.effects.length=0,i=0,r=this.cleanups.length;i<r;i++)this.cleanups[i]();if(this.cleanups.length=0,this.scopes){for(i=0,r=this.scopes.length;i<r;i++)this.scopes[i].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const n=this.parent.scopes.pop();n&&n!==this&&(this.parent.scopes[this.index]=n,n.index=this.index)}this.parent=void 0}}}function Kd(){return Fe}let le;const Ss=new WeakSet;class Ja{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Fe&&Fe.active&&Fe.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Ss.has(this)&&(Ss.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||Za(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,nl(this),el(this);const e=le,i=st;le=this,st=!0;try{return this.fn()}finally{tl(this),le=e,st=i,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ps(e);this.deps=this.depsTail=void 0,nl(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Ss.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){$s(this)&&this.run()}get dirty(){return $s(this)}}let Xa=0,zi,Wi;function Za(t,e=!1){if(t.flags|=8,e){t.next=Wi,Wi=t;return}t.next=zi,zi=t}function ks(){Xa++}function Es(){if(--Xa>0)return;if(Wi){let e=Wi;for(Wi=void 0;e;){const i=e.next;e.next=void 0,e.flags&=-9,e=i}}let t;for(;zi;){let e=zi;for(zi=void 0;e;){const i=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=i}}if(t)throw t}function el(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function tl(t){let e,i=t.depsTail,r=i;for(;r;){const n=r.prevDep;r.version===-1?(r===i&&(i=n),Ps(r),Vd(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=n}t.deps=e,t.depsTail=i}function $s(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(il(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function il(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Ki)||(t.globalVersion=Ki,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!$s(t))))return;t.flags|=2;const e=t.dep,i=le,r=st;le=t,st=!0;try{el(t);const n=t.fn(t._value);(e.version===0||Ue(n,t._value))&&(t.flags|=128,t._value=n,e.version++)}catch(n){throw e.version++,n}finally{le=i,st=r,tl(t),t.flags&=-3}}function Ps(t,e=!1){const{dep:i,prevSub:r,nextSub:n}=t;if(r&&(r.nextSub=n,t.prevSub=void 0),n&&(n.prevSub=r,t.nextSub=void 0),i.subs===t&&(i.subs=r,!r&&i.computed)){i.computed.flags&=-5;for(let s=i.computed.deps;s;s=s.nextDep)Ps(s,!0)}!e&&!--i.sc&&i.map&&i.map.delete(i.key)}function Vd(t){const{prevDep:e,nextDep:i}=t;e&&(e.nextDep=i,t.prevDep=void 0),i&&(i.prevDep=e,t.nextDep=void 0)}let st=!0;const rl=[];function ht(){rl.push(st),st=!1}function dt(){const t=rl.pop();st=t===void 0?!0:t}function nl(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const i=le;le=void 0;try{e()}finally{le=i}}}let Ki=0;class Gd{constructor(e,i){this.sub=e,this.dep=i,this.version=i.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Hr{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!le||!st||le===this.computed)return;let i=this.activeLink;if(i===void 0||i.sub!==le)i=this.activeLink=new Gd(le,this),le.deps?(i.prevDep=le.depsTail,le.depsTail.nextDep=i,le.depsTail=i):le.deps=le.depsTail=i,sl(i);else if(i.version===-1&&(i.version=this.version,i.nextDep)){const r=i.nextDep;r.prevDep=i.prevDep,i.prevDep&&(i.prevDep.nextDep=r),i.prevDep=le.depsTail,i.nextDep=void 0,le.depsTail.nextDep=i,le.depsTail=i,le.deps===i&&(le.deps=r)}return i}trigger(e){this.version++,Ki++,this.notify(e)}notify(e){ks();try{for(let i=this.subs;i;i=i.prevSub)i.sub.notify()&&i.sub.dep.notify()}finally{Es()}}}function sl(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let r=e.deps;r;r=r.nextDep)sl(r)}const i=t.dep.subs;i!==t&&(t.prevSub=i,i&&(i.nextSub=t)),t.dep.subs=t}}const Cs=new WeakMap,Xt=Symbol(""),Os=Symbol(""),Vi=Symbol("");function Oe(t,e,i){if(st&&le){let r=Cs.get(t);r||Cs.set(t,r=new Map);let n=r.get(i);n||(r.set(i,n=new Hr),n.map=r,n.key=i),n.track()}}function Tt(t,e,i,r,n,s){const o=Cs.get(t);if(!o){Ki++;return}const a=l=>{l&&l.trigger()};if(ks(),e==="clear")o.forEach(a);else{const l=K(t),c=l&&ys(i);if(l&&i==="length"){const u=Number(r);o.forEach((f,d)=>{(d==="length"||d===Vi||!jt(d)&&d>=u)&&a(f)})}else switch((i!==void 0||o.has(void 0))&&a(o.get(i)),c&&a(o.get(Vi)),e){case"add":l?c&&a(o.get("length")):(a(o.get(Xt)),di(t)&&a(o.get(Os)));break;case"delete":l||(a(o.get(Xt)),di(t)&&a(o.get(Os)));break;case"set":di(t)&&a(o.get(Xt));break}}Es()}function pi(t){const e=ee(t);return e===t?e:(Oe(e,"iterate",Vi),Xe(t)?e:e.map($e))}function zr(t){return Oe(t=ee(t),"iterate",Vi),t}const Qd={__proto__:null,[Symbol.iterator](){return Ts(this,Symbol.iterator,$e)},concat(...t){return pi(this).concat(...t.map(e=>K(e)?pi(e):e))},entries(){return Ts(this,"entries",t=>(t[1]=$e(t[1]),t))},every(t,e){return It(this,"every",t,e,void 0,arguments)},filter(t,e){return It(this,"filter",t,e,i=>i.map($e),arguments)},find(t,e){return It(this,"find",t,e,$e,arguments)},findIndex(t,e){return It(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return It(this,"findLast",t,e,$e,arguments)},findLastIndex(t,e){return It(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return It(this,"forEach",t,e,void 0,arguments)},includes(...t){return Is(this,"includes",t)},indexOf(...t){return Is(this,"indexOf",t)},join(t){return pi(this).join(t)},lastIndexOf(...t){return Is(this,"lastIndexOf",t)},map(t,e){return It(this,"map",t,e,void 0,arguments)},pop(){return Gi(this,"pop")},push(...t){return Gi(this,"push",t)},reduce(t,...e){return ol(this,"reduce",t,e)},reduceRight(t,...e){return ol(this,"reduceRight",t,e)},shift(){return Gi(this,"shift")},some(t,e){return It(this,"some",t,e,void 0,arguments)},splice(...t){return Gi(this,"splice",t)},toReversed(){return pi(this).toReversed()},toSorted(t){return pi(this).toSorted(t)},toSpliced(...t){return pi(this).toSpliced(...t)},unshift(...t){return Gi(this,"unshift",t)},values(){return Ts(this,"values",$e)}};function Ts(t,e,i){const r=zr(t),n=r[e]();return r!==t&&!Xe(t)&&(n._next=n.next,n.next=()=>{const s=n._next();return s.done||(s.value=i(s.value)),s}),n}const Yd=Array.prototype;function It(t,e,i,r,n,s){const o=zr(t),a=o!==t&&!Xe(t),l=o[e];if(l!==Yd[e]){const f=l.apply(t,s);return a?$e(f):f}let c=i;o!==t&&(a?c=function(f,d){return i.call(this,$e(f),d,t)}:i.length>2&&(c=function(f,d){return i.call(this,f,d,t)}));const u=l.call(o,c,r);return a&&n?n(u):u}function ol(t,e,i,r){const n=zr(t);let s=i;return n!==t&&(Xe(t)?i.length>3&&(s=function(o,a,l){return i.call(this,o,a,l,t)}):s=function(o,a,l){return i.call(this,o,$e(a),l,t)}),n[e](s,...r)}function Is(t,e,i){const r=ee(t);Oe(r,"iterate",Vi);const n=r[e](...i);return(n===-1||n===!1)&&Ns(i[0])?(i[0]=ee(i[0]),r[e](...i)):n}function Gi(t,e,i=[]){ht(),ks();const r=ee(t)[e].apply(t,i);return Es(),dt(),r}const Jd=ps("__proto__,__v_isRef,__isVue"),al=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(jt));function Xd(t){jt(t)||(t=String(t));const e=ee(this);return Oe(e,"has",t),e.hasOwnProperty(t)}class ll{constructor(e=!1,i=!1){this._isReadonly=e,this._isShallow=i}get(e,i,r){if(i==="__v_skip")return e.__v_skip;const n=this._isReadonly,s=this._isShallow;if(i==="__v_isReactive")return!n;if(i==="__v_isReadonly")return n;if(i==="__v_isShallow")return s;if(i==="__v_raw")return r===(n?s?pl:dl:s?hl:fl).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=K(e);if(!n){let l;if(o&&(l=Qd[i]))return l;if(i==="hasOwnProperty")return Xd}const a=Reflect.get(e,i,xe(e)?e:r);if((jt(i)?al.has(i):Jd(i))||(n||Oe(e,"get",i),s))return a;if(xe(a)){const l=o&&ys(i)?a:a.value;return n&&fe(l)?Ls(l):l}return fe(a)?n?Ls(a):Rs(a):a}}class cl extends ll{constructor(e=!1){super(!1,e)}set(e,i,r,n){let s=e[i];if(!this._isShallow){const l=Ft(s);if(!Xe(r)&&!Ft(r)&&(s=ee(s),r=ee(r)),!K(e)&&xe(s)&&!xe(r))return l||(s.value=r),!0}const o=K(e)&&ys(i)?Number(i)<e.length:ne(e,i),a=Reflect.set(e,i,r,xe(e)?e:n);return e===ee(n)&&(o?Ue(r,s)&&Tt(e,"set",i,r):Tt(e,"add",i,r)),a}deleteProperty(e,i){const r=ne(e,i);e[i];const n=Reflect.deleteProperty(e,i);return n&&r&&Tt(e,"delete",i,void 0),n}has(e,i){const r=Reflect.has(e,i);return(!jt(i)||!al.has(i))&&Oe(e,"has",i),r}ownKeys(e){return Oe(e,"iterate",K(e)?"length":Xt),Reflect.ownKeys(e)}}class ul extends ll{constructor(e=!1){super(!0,e)}set(e,i){return!0}deleteProperty(e,i){return!0}}const Zd=new cl,ep=new ul,tp=new cl(!0),ip=new ul(!0),As=t=>t,Wr=t=>Reflect.getPrototypeOf(t);function rp(t,e,i){return function(...r){const n=this.__v_raw,s=ee(n),o=di(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=n[t](...r),u=i?As:e?Qr:$e;return!e&&Oe(s,"iterate",l?Os:Xt),{next(){const{value:f,done:d}=c.next();return d?{value:f,done:d}:{value:a?[u(f[0]),u(f[1])]:u(f),done:d}},[Symbol.iterator](){return this}}}}function Kr(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function np(t,e){const i={get(n){const s=this.__v_raw,o=ee(s),a=ee(n);t||(Ue(n,a)&&Oe(o,"get",n),Oe(o,"get",a));const{has:l}=Wr(o),c=e?As:t?Qr:$e;if(l.call(o,n))return c(s.get(n));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(n)},get size(){const n=this.__v_raw;return!t&&Oe(ee(n),"iterate",Xt),n.size},has(n){const s=this.__v_raw,o=ee(s),a=ee(n);return t||(Ue(n,a)&&Oe(o,"has",n),Oe(o,"has",a)),n===a?s.has(n):s.has(n)||s.has(a)},forEach(n,s){const o=this,a=o.__v_raw,l=ee(a),c=e?As:t?Qr:$e;return!t&&Oe(l,"iterate",Xt),a.forEach((u,f)=>n.call(s,c(u),c(f),o))}};return Ee(i,t?{add:Kr("add"),set:Kr("set"),delete:Kr("delete"),clear:Kr("clear")}:{add(n){!e&&!Xe(n)&&!Ft(n)&&(n=ee(n));const s=ee(this);return Wr(s).has.call(s,n)||(s.add(n),Tt(s,"add",n,n)),this},set(n,s){!e&&!Xe(s)&&!Ft(s)&&(s=ee(s));const o=ee(this),{has:a,get:l}=Wr(o);let c=a.call(o,n);c||(n=ee(n),c=a.call(o,n));const u=l.call(o,n);return o.set(n,s),c?Ue(s,u)&&Tt(o,"set",n,s):Tt(o,"add",n,s),this},delete(n){const s=ee(this),{has:o,get:a}=Wr(s);let l=o.call(s,n);l||(n=ee(n),l=o.call(s,n)),a&&a.call(s,n);const c=s.delete(n);return l&&Tt(s,"delete",n,void 0),c},clear(){const n=ee(this),s=n.size!==0,o=n.clear();return s&&Tt(n,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(n=>{i[n]=rp(n,t,e)}),i}function Vr(t,e){const i=np(t,e);return(r,n,s)=>n==="__v_isReactive"?!t:n==="__v_isReadonly"?t:n==="__v_raw"?r:Reflect.get(ne(i,n)&&n in r?i:r,n,s)}const sp={get:Vr(!1,!1)},op={get:Vr(!1,!0)},ap={get:Vr(!0,!1)},lp={get:Vr(!0,!0)},fl=new WeakMap,hl=new WeakMap,dl=new WeakMap,pl=new WeakMap;function cp(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function up(t){return t.__v_skip||!Object.isExtensible(t)?0:cp(Md(t))}function Rs(t){return Ft(t)?t:Gr(t,!1,Zd,sp,fl)}function fp(t){return Gr(t,!1,tp,op,hl)}function Ls(t){return Gr(t,!0,ep,ap,dl)}function vb(t){return Gr(t,!0,ip,lp,pl)}function Gr(t,e,i,r,n){if(!fe(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=up(t);if(s===0)return t;const o=n.get(t);if(o)return o;const a=new Proxy(t,s===2?r:i);return n.set(t,a),a}function mi(t){return Ft(t)?mi(t.__v_raw):!!(t&&t.__v_isReactive)}function Ft(t){return!!(t&&t.__v_isReadonly)}function Xe(t){return!!(t&&t.__v_isShallow)}function Ns(t){return t?!!t.__v_raw:!1}function ee(t){const e=t&&t.__v_raw;return e?ee(e):t}function hp(t){return!ne(t,"__v_skip")&&Object.isExtensible(t)&&Ka(t,"__v_skip",!0),t}const $e=t=>fe(t)?Rs(t):t,Qr=t=>fe(t)?Ls(t):t;function xe(t){return t?t.__v_isRef===!0:!1}function ml(t){return gl(t,!1)}function Yr(t){return gl(t,!0)}function gl(t,e){return xe(t)?t:new dp(t,e)}class dp{constructor(e,i){this.dep=new Hr,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=i?e:ee(e),this._value=i?e:$e(e),this.__v_isShallow=i}get value(){return this.dep.track(),this._value}set value(e){const i=this._rawValue,r=this.__v_isShallow||Xe(e)||Ft(e);e=r?e:ee(e),Ue(e,i)&&(this._rawValue=e,this._value=r?e:$e(e),this.dep.trigger())}}function Ms(t){return xe(t)?t.value:t}const pp={get:(t,e,i)=>e==="__v_raw"?t:Ms(Reflect.get(t,e,i)),set:(t,e,i,r)=>{const n=t[e];return xe(n)&&!xe(i)?(n.value=i,!0):Reflect.set(t,e,i,r)}};function yl(t){return mi(t)?t:new Proxy(t,pp)}class mp{constructor(e){this.__v_isRef=!0,this._value=void 0;const i=this.dep=new Hr,{get:r,set:n}=e(i.track.bind(i),i.trigger.bind(i));this._get=r,this._set=n}get value(){return this._value=this._get()}set value(e){this._set(e)}}function gp(t){return new mp(t)}class yp{constructor(e,i,r){this.fn=e,this.setter=i,this._value=void 0,this.dep=new Hr(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Ki-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!i,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&le!==this)return Za(this,!0),!0}get value(){const e=this.dep.track();return il(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function bp(t,e,i=!1){let r,n;return G(t)?r=t:(r=t.get,n=t.set),new yp(r,n,i)}const Jr={},Xr=new WeakMap;let Zt;function wp(t,e=!1,i=Zt){if(i){let r=Xr.get(i);r||Xr.set(i,r=[]),r.push(t)}}function vp(t,e,i=ie){const{immediate:r,deep:n,once:s,scheduler:o,augmentJob:a,call:l}=i,c=h=>n?h:Xe(h)||n===!1||n===0?Bt(h,1):Bt(h);let u,f,d,y,m=!1,E=!1;if(xe(t)?(f=()=>t.value,m=Xe(t)):mi(t)?(f=()=>c(t),m=!0):K(t)?(E=!0,m=t.some(h=>mi(h)||Xe(h)),f=()=>t.map(h=>{if(xe(h))return h.value;if(mi(h))return c(h);if(G(h))return l?l(h,2):h()})):G(t)?e?f=l?()=>l(t,2):t:f=()=>{if(d){ht();try{d()}finally{dt()}}const h=Zt;Zt=u;try{return l?l(t,3,[y]):t(y)}finally{Zt=h}}:f=ft,e&&n){const h=f,p=n===!0?1/0:n;f=()=>Bt(h(),p)}const j=Kd(),k=()=>{u.stop(),j&&j.active&&gs(j.effects,u)};if(s&&e){const h=e;e=(...p)=>{h(...p),k()}}let F=E?new Array(t.length).fill(Jr):Jr;const b=h=>{if(!(!(u.flags&1)||!u.dirty&&!h))if(e){const p=u.run();if(n||m||(E?p.some((v,x)=>Ue(v,F[x])):Ue(p,F))){d&&d();const v=Zt;Zt=u;try{const x=[p,F===Jr?void 0:E&&F[0]===Jr?[]:F,y];F=p,l?l(e,3,x):e(...x)}finally{Zt=v}}}else u.run()};return a&&a(b),u=new Ja(f),u.scheduler=o?()=>o(b,!1):b,y=h=>wp(h,!1,u),d=u.onStop=()=>{const h=Xr.get(u);if(h){if(l)l(h,4);else for(const p of h)p();Xr.delete(u)}},e?r?b(!0):F=u.run():o?o(b.bind(null,!0),!0):u.run(),k.pause=u.pause.bind(u),k.resume=u.resume.bind(u),k.stop=k,k}function Bt(t,e=1/0,i){if(e<=0||!fe(t)||t.__v_skip||(i=i||new Map,(i.get(t)||0)>=e))return t;if(i.set(t,e),e--,xe(t))Bt(t.value,e,i);else if(K(t))for(let r=0;r<t.length;r++)Bt(t[r],e,i);else if(Ba(t)||di(t))t.forEach(r=>{Bt(r,e,i)});else if(za(t)){for(const r in t)Bt(t[r],e,i);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Bt(t[r],e,i)}return t}/**
|
|
86
93
|
* @vue/runtime-core v3.5.22
|
|
87
94
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
88
95
|
* @license MIT
|
|
89
|
-
**/const
|
|
96
|
+
**/const Qi=[];let Ds=!1;function _b(t,...e){if(Ds)return;Ds=!0,ht();const i=Qi.length?Qi[Qi.length-1].component:null,r=i&&i.appContext.config.warnHandler,n=_p();if(r)gi(r,i,11,[t+e.map(s=>{var o,a;return(a=(o=s.toString)==null?void 0:o.call(s))!=null?a:JSON.stringify(s)}).join(""),i&&i.proxy,n.map(({vnode:s})=>`at <${yc(i,s.type)}>`).join(`
|
|
90
97
|
`),n]);else{const s=[`[Vue warn]: ${t}`,...e];n.length&&s.push(`
|
|
91
|
-
`,...
|
|
92
|
-
`],...pp(i))}),e}function pp({vnode:t,recurseCount:e}){const i=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,n=` at <${gc(t.component,t.type,r)}`,s=">"+i;return t.props?[n,...mp(t.props),s]:[n+s]}function mp(t){const e=[],i=Object.keys(t);return i.slice(0,3).forEach(r=>{e.push(...yl(r,t[r]))}),i.length>3&&e.push(" ..."),e}function yl(t,e,i){return pe(e)?(e=JSON.stringify(e),i?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?i?e:[`${t}=${e}`]:we(e)?(e=yl(t,J(e.value),!0),i?e:[`${t}=Ref<`,e,">"]):G(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=J(e),i?e:[`${t}=`,e])}function yi(t,e,i,r){try{return r?t(...r):t()}catch(n){en(n,e,i)}}function ct(t,e,i,r){if(G(t)){const n=yi(t,e,i,r);return n&&Ba(n)&&n.catch(s=>{en(s,e,i)}),n}if(K(t)){const n=[];for(let s=0;s<t.length;s++)n.push(ct(t[s],e,i,r));return n}}function en(t,e,i,r=!0){const n=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ee;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${i}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](t,l,c)===!1)return}a=a.parent}if(s){at(),yi(s,null,10,[t,l,c]),lt();return}}gp(t,i,n,r,o)}function gp(t,e,i,r=!0,n=!1){if(n)throw t}const $e=[];let ut=-1;const bi=[];let Dt=null,wi=0;const bl=Promise.resolve();let tn=null;function rn(t){const e=tn||bl;return t?e.then(this?t.bind(this):t):e}function yp(t){let e=ut+1,i=$e.length;for(;e<i;){const r=e+i>>>1,n=$e[r],s=Xi(n);s<t||s===t&&n.flags&2?e=r+1:i=r}return e}function Fs(t){if(!(t.flags&1)){const e=Xi(t),i=$e[$e.length-1];!i||!(t.flags&2)&&e>=Xi(i)?$e.push(t):$e.splice(yp(e),0,t),t.flags|=1,wl()}}function wl(){tn||(tn=bl.then(xl))}function bp(t){K(t)?bi.push(...t):Dt&&t.id===-1?Dt.splice(wi+1,0,t):t.flags&1||(bi.push(t),t.flags|=1),wl()}function vl(t,e,i=ut+1){for(;i<$e.length;i++){const r=$e[i];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;$e.splice(i,1),i--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function _l(t){if(bi.length){const e=[...new Set(bi)].sort((i,r)=>Xi(i)-Xi(r));if(bi.length=0,Dt){Dt.push(...e);return}for(Dt=e,wi=0;wi<Dt.length;wi++){const i=Dt[wi];i.flags&4&&(i.flags&=-2),i.flags&8||i(),i.flags&=-2}Dt=null,wi=0}}const Xi=t=>t.id==null?t.flags&2?-1:1/0:t.id;function xl(t){try{for(ut=0;ut<$e.length;ut++){const e=$e[ut];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),yi(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;ut<$e.length;ut++){const e=$e[ut];e&&(e.flags&=-2)}ut=-1,$e.length=0,_l(),tn=null,($e.length||bi.length)&&xl()}}let ft=null,Sl=null;function nn(t){const e=ft;return ft=t,Sl=t&&t.type.__scopeId||null,e}function wp(t,e=ft,i){if(!e||t._n)return t;const r=(...n)=>{r._d&&oc(-1);const s=nn(e);let o;try{o=t(...n)}finally{nn(s),r._d&&oc(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function Zt(t,e,i,r){const n=t.dirs,s=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(at(),ct(l,i,8,[t.el,a,t,e]),lt())}}const vp=Symbol("_vte"),_p=t=>t.__isTeleport,xp=Symbol("_leaveCb");function Bs(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Bs(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function kl(t,e){return G(t)?ve({name:t.name},e,{setup:t}):t}function El(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Sp(t){const e=eo(),i=Xr(null);if(e){const n=e.refs===ee?e.refs={}:e.refs;Object.defineProperty(n,t,{enumerable:!0,get:()=>i.value,set:s=>i.value=s})}return i}const sn=new WeakMap;function Ji(t,e,i,r,n=!1){if(K(t)){t.forEach((g,E)=>Ji(g,e&&(K(e)?e[E]:e),i,r,n));return}if(Zi(r)&&!n){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Ji(t,e,i,r.component.subTree);return}const s=r.shapeFlag&4?io(r.component):r.el,o=n?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ee?a.refs={}:a.refs,f=a.setupState,d=J(f),b=f===ee?Ua:g=>ie(d,g);if(c!=null&&c!==l){if($l(e),pe(c))u[c]=null,b(c)&&(f[c]=null);else if(we(c)){c.value=null;const g=e;g.k&&(u[g.k]=null)}}if(G(l))yi(l,a,12,[o,u]);else{const g=pe(l),E=we(l);if(g||E){const D=()=>{if(t.f){const k=g?b(l)?f[l]:u[l]:l.value;if(n)K(k)&&bs(k,s);else if(K(k))k.includes(s)||k.push(s);else if(g)u[l]=[s],b(l)&&(f[l]=u[l]);else{const B=[s];l.value=B,t.k&&(u[t.k]=B)}}else g?(u[l]=o,b(l)&&(f[l]=o)):E&&(l.value=o,t.k&&(u[t.k]=o))};if(o){const k=()=>{D(),sn.delete(t)};k.id=-1,sn.set(t,k),Fe(k,i)}else $l(t),D()}}}function $l(t){const e=sn.get(t);e&&(e.flags|=8,sn.delete(t))}qr().requestIdleCallback,qr().cancelIdleCallback;const Zi=t=>!!t.type.__asyncLoader,Pl=t=>t.type.__isKeepAlive;function kp(t,e){Cl(t,"a",e)}function Ep(t,e){Cl(t,"da",e)}function Cl(t,e,i=Ce){const r=t.__wdc||(t.__wdc=()=>{let n=i;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(on(e,r,i),i){let n=i.parent;for(;n&&n.parent;)Pl(n.parent.vnode)&&$p(r,e,i,n),n=n.parent}}function $p(t,e,i,r){const n=on(e,t,r,!0);Tl(()=>{bs(r[e],n)},i)}function on(t,e,i=Ce,r=!1){if(i){const n=i[t]||(i[t]=[]),s=e.__weh||(e.__weh=(...o)=>{at();const a=or(i),l=ct(e,i,t,o);return a(),lt(),l});return r?n.unshift(s):n.push(s),s}}const Pt=t=>(e,i=Ce)=>{(!ar||t==="sp")&&on(t,(...r)=>e(...r),i)},Ol=Pt("bm"),qs=Pt("m"),Pp=Pt("bu"),Cp=Pt("u"),Al=Pt("bum"),Tl=Pt("um"),Op=Pt("sp"),Ap=Pt("rtg"),Tp=Pt("rtc");function Rp(t,e=Ce){on("ec",t,e)}const Ip=Symbol.for("v-ndc");function Rl(t,e,i,r){let n;const s=i,o=K(t);if(o||pe(t)){const a=o&&gi(t);let l=!1,c=!1;a&&(l=!ze(t),c=Nt(t),t=Wr(t)),n=new Array(t.length);for(let u=0,f=t.length;u<f;u++)n[u]=e(l?c?Yr(_e(t[u])):_e(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,s)}else if(ce(t))if(t[Symbol.iterator])n=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);n=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];n[l]=e(t[u],u,l,s)}}else n=[];return n}const Hs=t=>t?dc(t)?io(t):Hs(t.parent):null,er=ve(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Hs(t.parent),$root:t=>Hs(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Ml(t),$forceUpdate:t=>t.f||(t.f=()=>{Fs(t.update)}),$nextTick:t=>t.n||(t.n=rn.bind(t.proxy)),$watch:t=>tm.bind(t)}),zs=(t,e)=>t!==ee&&!t.__isScriptSetup&&ie(t,e),Lp={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:i,setupState:r,data:n,props:s,accessCache:o,type:a,appContext:l}=t;let c;if(e[0]!=="$"){const b=o[e];if(b!==void 0)switch(b){case 1:return r[e];case 2:return n[e];case 4:return i[e];case 3:return s[e]}else{if(zs(r,e))return o[e]=1,r[e];if(n!==ee&&ie(n,e))return o[e]=2,n[e];if((c=t.propsOptions[0])&&ie(c,e))return o[e]=3,s[e];if(i!==ee&&ie(i,e))return o[e]=4,i[e];Ws&&(o[e]=0)}}const u=er[e];let f,d;if(u)return e==="$attrs"&&ke(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(i!==ee&&ie(i,e))return o[e]=4,i[e];if(d=l.config.globalProperties,ie(d,e))return d[e]},set({_:t},e,i){const{data:r,setupState:n,ctx:s}=t;return zs(n,e)?(n[e]=i,!0):r!==ee&&ie(r,e)?(r[e]=i,!0):ie(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:r,appContext:n,propsOptions:s,type:o}},a){let l,c;return!!(i[a]||t!==ee&&a[0]!=="$"&&ie(t,a)||zs(e,a)||(l=s[0])&&ie(l,a)||ie(r,a)||ie(er,a)||ie(n.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,i){return i.get!=null?t._.accessCache[e]=0:ie(i,"value")&&this.set(t,e,i.value,null),Reflect.defineProperty(t,e,i)}};function an(t){return K(t)?t.reduce((e,i)=>(e[i]=null,e),{}):t}function Il(t,e){return!t||!e?t||e:K(t)&&K(e)?t.concat(e):ve({},an(t),an(e))}let Ws=!0;function Np(t){const e=Ml(t),i=t.proxy,r=t.ctx;Ws=!1,e.beforeCreate&&Ll(e.beforeCreate,t,"bc");const{data:n,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:d,beforeUpdate:b,updated:g,activated:E,deactivated:D,beforeDestroy:k,beforeUnmount:B,destroyed:p,unmounted:h,render:m,renderTracked:_,renderTriggered:x,errorCaptured:P,serverPrefetch:R,expose:F,inheritAttrs:ge,components:Ht,directives:ni,filters:zt}=e;if(c&&Mp(c,r,null),o)for(const ue in o){const ae=o[ue];G(ae)&&(r[ue]=ae.bind(i))}if(n){const ue=n.call(i,i);ce(ue)&&(t.data=Ns(ue))}if(Ws=!0,s)for(const ue in s){const ae=s[ue],si=G(ae)?ae.bind(i,i):G(ae.get)?ae.get.bind(i,i):ot,An=!G(ae)&&G(ae.set)?ae.set.bind(i):ot,oi=yc({get:si,set:An});Object.defineProperty(r,ue,{enumerable:!0,configurable:!0,get:()=>oi.value,set:gt=>oi.value=gt})}if(a)for(const ue in a)Nl(a[ue],r,i,ue);if(l){const ue=G(l)?l.call(i):l;Reflect.ownKeys(ue).forEach(ae=>{Fl(ae,ue[ae])})}u&&Ll(u,t,"c");function Oe(ue,ae){K(ae)?ae.forEach(si=>ue(si.bind(i))):ae&&ue(ae.bind(i))}if(Oe(Ol,f),Oe(qs,d),Oe(Pp,b),Oe(Cp,g),Oe(kp,E),Oe(Ep,D),Oe(Rp,P),Oe(Tp,_),Oe(Ap,x),Oe(Al,B),Oe(Tl,h),Oe(Op,R),K(F))if(F.length){const ue=t.exposed||(t.exposed={});F.forEach(ae=>{Object.defineProperty(ue,ae,{get:()=>i[ae],set:si=>i[ae]=si,enumerable:!0})})}else t.exposed||(t.exposed={});m&&t.render===ot&&(t.render=m),ge!=null&&(t.inheritAttrs=ge),Ht&&(t.components=Ht),ni&&(t.directives=ni),R&&El(t)}function Mp(t,e,i=ot){K(t)&&(t=Ks(t));for(const r in t){const n=t[r];let s;ce(n)?"default"in n?s=ir(n.from||r,n.default,!0):s=ir(n.from||r):s=ir(n),we(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Ll(t,e,i){ct(K(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,i)}function Nl(t,e,i,r){let n=r.includes(".")?Zl(i,r):()=>i[r];if(pe(t)){const s=e[t];G(s)&&_i(n,s)}else if(G(t))_i(n,t.bind(i));else if(ce(t))if(K(t))t.forEach(s=>Nl(s,e,i,r));else{const s=G(t.handler)?t.handler.bind(i):e[t.handler];G(s)&&_i(n,s,t)}}function Ml(t){const e=t.type,{mixins:i,extends:r}=e,{mixins:n,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!n.length&&!i&&!r?l=e:(l={},n.length&&n.forEach(c=>ln(l,c,o,!0)),ln(l,e,o)),ce(e)&&s.set(e,l),l}function ln(t,e,i,r=!1){const{mixins:n,extends:s}=e;s&&ln(t,s,i,!0),n&&n.forEach(o=>ln(t,o,i,!0));for(const o in e)if(!(r&&o==="expose")){const a=Dp[o]||i&&i[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Dp={data:Dl,props:jl,emits:jl,methods:tr,computed:tr,beforeCreate:Pe,created:Pe,beforeMount:Pe,mounted:Pe,beforeUpdate:Pe,updated:Pe,beforeDestroy:Pe,beforeUnmount:Pe,destroyed:Pe,unmounted:Pe,activated:Pe,deactivated:Pe,errorCaptured:Pe,serverPrefetch:Pe,components:tr,directives:tr,watch:Up,provide:Dl,inject:jp};function Dl(t,e){return e?t?function(){return ve(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function jp(t,e){return tr(Ks(t),Ks(e))}function Ks(t){if(K(t)){const e={};for(let i=0;i<t.length;i++)e[t[i]]=t[i];return e}return t}function Pe(t,e){return t?[...new Set([].concat(t,e))]:e}function tr(t,e){return t?ve(Object.create(null),t,e):e}function jl(t,e){return t?K(t)&&K(e)?[...new Set([...t,...e])]:ve(Object.create(null),an(t),an(e??{})):e}function Up(t,e){if(!t)return e;if(!e)return t;const i=ve(Object.create(null),t);for(const r in e)i[r]=Pe(t[r],e[r]);return i}function Ul(){return{app:null,config:{isNativeTag:Ua,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Fp=0;function Bp(t,e){return function(r,n=null){G(r)||(r=ve({},r)),n!=null&&!ce(n)&&(n=null);const s=Ul(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:Fp++,_component:r,_props:n,_container:null,_context:s,_instance:null,version:Em,get config(){return s.config},set config(u){},use(u,...f){return o.has(u)||(u&&G(u.install)?(o.add(u),u.install(c,...f)):G(u)&&(o.add(u),u(c,...f))),c},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),c},component(u,f){return f?(s.components[u]=f,c):s.components[u]},directive(u,f){return f?(s.directives[u]=f,c):s.directives[u]},mount(u,f,d){if(!l){const b=c._ceVNode||Ct(r,n);return b.appContext=s,d===!0?d="svg":d===!1&&(d=void 0),t(b,u,d),l=!0,c._container=u,u.__vue_app__=c,io(b.component)}},onUnmount(u){a.push(u)},unmount(){l&&(ct(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,f){return s.provides[u]=f,c},runWithContext(u){const f=vi;vi=c;try{return u()}finally{vi=f}}};return c}}let vi=null;function Fl(t,e){if(Ce){let i=Ce.provides;const r=Ce.parent&&Ce.parent.provides;r===i&&(i=Ce.provides=Object.create(r)),i[t]=e}}function ir(t,e,i=!1){const r=eo();if(r||vi){let n=vi?vi._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return i&&G(e)?e.call(r&&r.proxy):e}}const Bl={},ql=()=>Object.create(Bl),Hl=t=>Object.getPrototypeOf(t)===Bl;function qp(t,e,i,r=!1){const n={},s=ql();t.propsDefaults=Object.create(null),zl(t,e,n,s);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);i?t.props=r?n:ip(n):t.type.props?t.props=n:t.props=s,t.attrs=s}function Hp(t,e,i,r){const{props:n,attrs:s,vnode:{patchFlag:o}}=t,a=J(n),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let d=u[f];if(cn(t.emitsOptions,d))continue;const b=e[d];if(l)if(ie(s,d))b!==s[d]&&(s[d]=b,c=!0);else{const g=kt(d);n[g]=Vs(l,a,g,b,t,!1)}else b!==s[d]&&(s[d]=b,c=!0)}}}else{zl(t,e,n,s)&&(c=!0);let u;for(const f in a)(!e||!ie(e,f)&&((u=Lt(f))===f||!ie(e,u)))&&(l?i&&(i[f]!==void 0||i[u]!==void 0)&&(n[f]=Vs(l,a,f,void 0,t,!0)):delete n[f]);if(s!==a)for(const f in s)(!e||!ie(e,f))&&(delete s[f],c=!0)}c&&Et(t.attrs,"set","")}function zl(t,e,i,r){const[n,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(zi(l))continue;const c=e[l];let u;n&&ie(n,u=kt(l))?!s||!s.includes(u)?i[u]=c:(a||(a={}))[u]=c:cn(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(s){const l=J(i),c=a||ee;for(let u=0;u<s.length;u++){const f=s[u];i[f]=Vs(n,l,f,c[f],t,!ie(c,f))}}return o}function Vs(t,e,i,r,n,s){const o=t[i];if(o!=null){const a=ie(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&G(l)){const{propsDefaults:c}=n;if(i in c)r=c[i];else{const u=or(n);r=c[i]=l.call(null,e),u()}}else r=l;n.ce&&n.ce._setProp(i,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===Lt(i))&&(r=!0))}return r}const zp=new WeakMap;function Wl(t,e,i=!1){const r=i?zp:e.propsCache,n=r.get(t);if(n)return n;const s=t.props,o={},a=[];let l=!1;if(!G(t)){const u=f=>{l=!0;const[d,b]=Wl(f,e,!0);ve(o,d),b&&a.push(...b)};!i&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return ce(t)&&r.set(t,di),di;if(K(s))for(let u=0;u<s.length;u++){const f=kt(s[u]);Kl(f)&&(o[f]=ee)}else if(s)for(const u in s){const f=kt(u);if(Kl(f)){const d=s[u],b=o[f]=K(d)||G(d)?{type:d}:ve({},d),g=b.type;let E=!1,D=!0;if(K(g))for(let k=0;k<g.length;++k){const B=g[k],p=G(B)&&B.name;if(p==="Boolean"){E=!0;break}else p==="String"&&(D=!1)}else E=G(g)&&g.name==="Boolean";b[0]=E,b[1]=D,(E||ie(b,"default"))&&a.push(f)}}const c=[o,a];return ce(t)&&r.set(t,c),c}function Kl(t){return t[0]!=="$"&&!zi(t)}const Gs=t=>t==="_"||t==="_ctx"||t==="$stable",Qs=t=>K(t)?t.map(ht):[ht(t)],Wp=(t,e,i)=>{if(e._n)return e;const r=wp((...n)=>Qs(e(...n)),i);return r._c=!1,r},Vl=(t,e,i)=>{const r=t._ctx;for(const n in t){if(Gs(n))continue;const s=t[n];if(G(s))e[n]=Wp(n,s,r);else if(s!=null){const o=Qs(s);e[n]=()=>o}}},Gl=(t,e)=>{const i=Qs(e);t.slots.default=()=>i},Ql=(t,e,i)=>{for(const r in e)(i||!Gs(r))&&(t[r]=e[r])},Kp=(t,e,i)=>{const r=t.slots=ql();if(t.vnode.shapeFlag&32){const n=e._;n?(Ql(r,e,i),i&&Wa(r,"_",n,!0)):Vl(e,r)}else e&&Gl(t,e)},Vp=(t,e,i)=>{const{vnode:r,slots:n}=t;let s=!0,o=ee;if(r.shapeFlag&32){const a=e._;a?i&&a===1?s=!1:Ql(n,e,i):(s=!e.$stable,Vl(e,n)),o=e}else e&&(Gl(t,e),o={default:1});if(s)for(const a in n)!Gs(a)&&o[a]==null&&delete n[a]},Fe=lm;function Gp(t){return Qp(t)}function Qp(t,e){const i=qr();i.__VUE__=!0;const{insert:r,remove:n,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:d,setScopeId:b=ot,insertStaticContent:g}=t,E=(w,v,S,A=null,C=null,O=null,M=void 0,N=null,I=!!v.dynamicChildren)=>{if(w===v)return;w&&!sr(w,v)&&(A=Tn(w),gt(w,C,O,!0),w=null),v.patchFlag===-2&&(I=!1,v.dynamicChildren=null);const{type:T,ref:H,shapeFlag:U}=v;switch(T){case un:D(w,v,S,A);break;case jt:k(w,v,S,A);break;case Js:w==null&&B(v,S,A,M);break;case Ze:Ht(w,v,S,A,C,O,M,N,I);break;default:U&1?m(w,v,S,A,C,O,M,N,I):U&6?ni(w,v,S,A,C,O,M,N,I):(U&64||U&128)&&T.process(w,v,S,A,C,O,M,N,I,yr)}H!=null&&C?Ji(H,w&&w.ref,O,v||w,!v):H==null&&w&&w.ref!=null&&Ji(w.ref,null,O,w,!0)},D=(w,v,S,A)=>{if(w==null)r(v.el=a(v.children),S,A);else{const C=v.el=w.el;v.children!==w.children&&c(C,v.children)}},k=(w,v,S,A)=>{w==null?r(v.el=l(v.children||""),S,A):v.el=w.el},B=(w,v,S,A)=>{[w.el,w.anchor]=g(w.children,v,S,A,w.el,w.anchor)},p=({el:w,anchor:v},S,A)=>{let C;for(;w&&w!==v;)C=d(w),r(w,S,A),w=C;r(v,S,A)},h=({el:w,anchor:v})=>{let S;for(;w&&w!==v;)S=d(w),n(w),w=S;n(v)},m=(w,v,S,A,C,O,M,N,I)=>{v.type==="svg"?M="svg":v.type==="math"&&(M="mathml"),w==null?_(v,S,A,C,O,M,N,I):R(w,v,C,O,M,N,I)},_=(w,v,S,A,C,O,M,N)=>{let I,T;const{props:H,shapeFlag:U,transition:q,dirs:V}=w;if(I=w.el=o(w.type,O,H&&H.is,H),U&8?u(I,w.children):U&16&&P(w.children,I,null,A,C,Ys(w,O),M,N),V&&Zt(w,null,A,"created"),x(I,w,w.scopeId,M,A),H){for(const le in H)le!=="value"&&!zi(le)&&s(I,le,null,H[le],O,A);"value"in H&&s(I,"value",null,H.value,O),(T=H.onVnodeBeforeMount)&&dt(T,A,w)}V&&Zt(w,null,A,"beforeMount");const X=Yp(C,q);X&&q.beforeEnter(I),r(I,v,S),((T=H&&H.onVnodeMounted)||X||V)&&Fe(()=>{T&&dt(T,A,w),X&&q.enter(I),V&&Zt(w,null,A,"mounted")},C)},x=(w,v,S,A,C)=>{if(S&&b(w,S),A)for(let O=0;O<A.length;O++)b(w,A[O]);if(C){let O=C.subTree;if(v===O||sc(O.type)&&(O.ssContent===v||O.ssFallback===v)){const M=C.vnode;x(w,M,M.scopeId,M.slotScopeIds,C.parent)}}},P=(w,v,S,A,C,O,M,N,I=0)=>{for(let T=I;T<w.length;T++){const H=w[T]=N?Ft(w[T]):ht(w[T]);E(null,H,v,S,A,C,O,M,N)}},R=(w,v,S,A,C,O,M)=>{const N=v.el=w.el;let{patchFlag:I,dynamicChildren:T,dirs:H}=v;I|=w.patchFlag&16;const U=w.props||ee,q=v.props||ee;let V;if(S&&ei(S,!1),(V=q.onVnodeBeforeUpdate)&&dt(V,S,v,w),H&&Zt(v,w,S,"beforeUpdate"),S&&ei(S,!0),(U.innerHTML&&q.innerHTML==null||U.textContent&&q.textContent==null)&&u(N,""),T?F(w.dynamicChildren,T,N,S,A,Ys(v,C),O):M||ae(w,v,N,null,S,A,Ys(v,C),O,!1),I>0){if(I&16)ge(N,U,q,S,C);else if(I&2&&U.class!==q.class&&s(N,"class",null,q.class,C),I&4&&s(N,"style",U.style,q.style,C),I&8){const X=v.dynamicProps;for(let le=0;le<X.length;le++){const ne=X[le],De=U[ne],je=q[ne];(je!==De||ne==="value")&&s(N,ne,De,je,C,S)}}I&1&&w.children!==v.children&&u(N,v.children)}else!M&&T==null&&ge(N,U,q,S,C);((V=q.onVnodeUpdated)||H)&&Fe(()=>{V&&dt(V,S,v,w),H&&Zt(v,w,S,"updated")},A)},F=(w,v,S,A,C,O,M)=>{for(let N=0;N<v.length;N++){const I=w[N],T=v[N],H=I.el&&(I.type===Ze||!sr(I,T)||I.shapeFlag&198)?f(I.el):S;E(I,T,H,null,A,C,O,M,!0)}},ge=(w,v,S,A,C)=>{if(v!==S){if(v!==ee)for(const O in v)!zi(O)&&!(O in S)&&s(w,O,v[O],null,C,A);for(const O in S){if(zi(O))continue;const M=S[O],N=v[O];M!==N&&O!=="value"&&s(w,O,N,M,C,A)}"value"in S&&s(w,"value",v.value,S.value,C)}},Ht=(w,v,S,A,C,O,M,N,I)=>{const T=v.el=w?w.el:a(""),H=v.anchor=w?w.anchor:a("");let{patchFlag:U,dynamicChildren:q,slotScopeIds:V}=v;V&&(N=N?N.concat(V):V),w==null?(r(T,S,A),r(H,S,A),P(v.children||[],S,H,C,O,M,N,I)):U>0&&U&64&&q&&w.dynamicChildren?(F(w.dynamicChildren,q,S,C,O,M,N),(v.key!=null||C&&v===C.subTree)&&Yl(w,v,!0)):ae(w,v,S,H,C,O,M,N,I)},ni=(w,v,S,A,C,O,M,N,I)=>{v.slotScopeIds=N,w==null?v.shapeFlag&512?C.ctx.activate(v,S,A,M,I):zt(v,S,A,C,O,M,I):Wt(w,v,I)},zt=(w,v,S,A,C,O,M)=>{const N=w.component=gm(w,A,C);if(Pl(w)&&(N.ctx.renderer=yr),ym(N,!1,M),N.asyncDep){if(C&&C.registerDep(N,Oe,M),!w.el){const I=N.subTree=Ct(jt);k(null,I,v,S),w.placeholder=I.el}}else Oe(N,w,v,S,C,O,M)},Wt=(w,v,S)=>{const A=v.component=w.component;if(om(w,v,S))if(A.asyncDep&&!A.asyncResolved){ue(A,v,S);return}else A.next=v,A.update();else v.el=w.el,A.vnode=v},Oe=(w,v,S,A,C,O,M)=>{const N=()=>{if(w.isMounted){let{next:U,bu:q,u:V,parent:X,vnode:le}=w;{const bt=Xl(w);if(bt){U&&(U.el=le.el,ue(w,U,M)),bt.asyncDep.then(()=>{w.isUnmounted||N()});return}}let ne=U,De;ei(w,!1),U?(U.el=le.el,ue(w,U,M)):U=le,q&&_s(q),(De=U.props&&U.props.onVnodeBeforeUpdate)&&dt(De,X,U,le),ei(w,!0);const je=rc(w),yt=w.subTree;w.subTree=je,E(yt,je,f(yt.el),Tn(yt),w,C,O),U.el=je.el,ne===null&&am(w,je.el),V&&Fe(V,C),(De=U.props&&U.props.onVnodeUpdated)&&Fe(()=>dt(De,X,U,le),C)}else{let U;const{el:q,props:V}=v,{bm:X,m:le,parent:ne,root:De,type:je}=w,yt=Zi(v);ei(w,!1),X&&_s(X),!yt&&(U=V&&V.onVnodeBeforeMount)&&dt(U,ne,v),ei(w,!0);{De.ce&&De.ce._def.shadowRoot!==!1&&De.ce._injectChildStyle(je);const bt=w.subTree=rc(w);E(null,bt,S,A,w,C,O),v.el=bt.el}if(le&&Fe(le,C),!yt&&(U=V&&V.onVnodeMounted)){const bt=v;Fe(()=>dt(U,ne,bt),C)}(v.shapeFlag&256||ne&&Zi(ne.vnode)&&ne.vnode.shapeFlag&256)&&w.a&&Fe(w.a,C),w.isMounted=!0,v=S=A=null}};w.scope.on();const I=w.effect=new Ya(N);w.scope.off();const T=w.update=I.run.bind(I),H=w.job=I.runIfDirty.bind(I);H.i=w,H.id=w.uid,I.scheduler=()=>Fs(H),ei(w,!0),T()},ue=(w,v,S)=>{v.component=w;const A=w.vnode.props;w.vnode=v,w.next=null,Hp(w,v.props,A,S),Vp(w,v.children,S),at(),vl(w),lt()},ae=(w,v,S,A,C,O,M,N,I=!1)=>{const T=w&&w.children,H=w?w.shapeFlag:0,U=v.children,{patchFlag:q,shapeFlag:V}=v;if(q>0){if(q&128){An(T,U,S,A,C,O,M,N,I);return}else if(q&256){si(T,U,S,A,C,O,M,N,I);return}}V&8?(H&16&&gr(T,C,O),U!==T&&u(S,U)):H&16?V&16?An(T,U,S,A,C,O,M,N,I):gr(T,C,O,!0):(H&8&&u(S,""),V&16&&P(U,S,A,C,O,M,N,I))},si=(w,v,S,A,C,O,M,N,I)=>{w=w||di,v=v||di;const T=w.length,H=v.length,U=Math.min(T,H);let q;for(q=0;q<U;q++){const V=v[q]=I?Ft(v[q]):ht(v[q]);E(w[q],V,S,null,C,O,M,N,I)}T>H?gr(w,C,O,!0,!1,U):P(v,S,A,C,O,M,N,I,U)},An=(w,v,S,A,C,O,M,N,I)=>{let T=0;const H=v.length;let U=w.length-1,q=H-1;for(;T<=U&&T<=q;){const V=w[T],X=v[T]=I?Ft(v[T]):ht(v[T]);if(sr(V,X))E(V,X,S,null,C,O,M,N,I);else break;T++}for(;T<=U&&T<=q;){const V=w[U],X=v[q]=I?Ft(v[q]):ht(v[q]);if(sr(V,X))E(V,X,S,null,C,O,M,N,I);else break;U--,q--}if(T>U){if(T<=q){const V=q+1,X=V<H?v[V].el:A;for(;T<=q;)E(null,v[T]=I?Ft(v[T]):ht(v[T]),S,X,C,O,M,N,I),T++}}else if(T>q)for(;T<=U;)gt(w[T],C,O,!0),T++;else{const V=T,X=T,le=new Map;for(T=X;T<=q;T++){const He=v[T]=I?Ft(v[T]):ht(v[T]);He.key!=null&&le.set(He.key,T)}let ne,De=0;const je=q-X+1;let yt=!1,bt=0;const br=new Array(je);for(T=0;T<je;T++)br[T]=0;for(T=V;T<=U;T++){const He=w[T];if(De>=je){gt(He,C,O,!0);continue}let wt;if(He.key!=null)wt=le.get(He.key);else for(ne=X;ne<=q;ne++)if(br[ne-X]===0&&sr(He,v[ne])){wt=ne;break}wt===void 0?gt(He,C,O,!0):(br[wt-X]=T+1,wt>=bt?bt=wt:yt=!0,E(He,v[wt],S,null,C,O,M,N,I),De++)}const Ou=yt?Xp(br):di;for(ne=Ou.length-1,T=je-1;T>=0;T--){const He=X+T,wt=v[He],Au=v[He+1],Tu=He+1<H?Au.el||Au.placeholder:A;br[T]===0?E(null,wt,S,Tu,C,O,M,N,I):yt&&(ne<0||T!==Ou[ne]?oi(wt,S,Tu,2):ne--)}}},oi=(w,v,S,A,C=null)=>{const{el:O,type:M,transition:N,children:I,shapeFlag:T}=w;if(T&6){oi(w.component.subTree,v,S,A);return}if(T&128){w.suspense.move(v,S,A);return}if(T&64){M.move(w,v,S,yr);return}if(M===Ze){r(O,v,S);for(let U=0;U<I.length;U++)oi(I[U],v,S,A);r(w.anchor,v,S);return}if(M===Js){p(w,v,S);return}if(A!==2&&T&1&&N)if(A===0)N.beforeEnter(O),r(O,v,S),Fe(()=>N.enter(O),C);else{const{leave:U,delayLeave:q,afterLeave:V}=N,X=()=>{w.ctx.isUnmounted?n(O):r(O,v,S)},le=()=>{O._isLeaving&&O[xp](!0),U(O,()=>{X(),V&&V()})};q?q(O,X,le):le()}else r(O,v,S)},gt=(w,v,S,A=!1,C=!1)=>{const{type:O,props:M,ref:N,children:I,dynamicChildren:T,shapeFlag:H,patchFlag:U,dirs:q,cacheIndex:V}=w;if(U===-2&&(C=!1),N!=null&&(at(),Ji(N,null,S,w,!0),lt()),V!=null&&(v.renderCache[V]=void 0),H&256){v.ctx.deactivate(w);return}const X=H&1&&q,le=!Zi(w);let ne;if(le&&(ne=M&&M.onVnodeBeforeUnmount)&&dt(ne,v,w),H&6)Qy(w.component,S,A);else{if(H&128){w.suspense.unmount(S,A);return}X&&Zt(w,null,v,"beforeUnmount"),H&64?w.type.remove(w,v,S,yr,A):T&&!T.hasOnce&&(O!==Ze||U>0&&U&64)?gr(T,v,S,!1,!0):(O===Ze&&U&384||!C&&H&16)&&gr(I,v,S),A&&Pu(w)}(le&&(ne=M&&M.onVnodeUnmounted)||X)&&Fe(()=>{ne&&dt(ne,v,w),X&&Zt(w,null,v,"unmounted")},S)},Pu=w=>{const{type:v,el:S,anchor:A,transition:C}=w;if(v===Ze){Gy(S,A);return}if(v===Js){h(w);return}const O=()=>{n(S),C&&!C.persisted&&C.afterLeave&&C.afterLeave()};if(w.shapeFlag&1&&C&&!C.persisted){const{leave:M,delayLeave:N}=C,I=()=>M(S,O);N?N(w.el,O,I):I()}else O()},Gy=(w,v)=>{let S;for(;w!==v;)S=d(w),n(w),w=S;n(v)},Qy=(w,v,S)=>{const{bum:A,scope:C,job:O,subTree:M,um:N,m:I,a:T}=w;Jl(I),Jl(T),A&&_s(A),C.stop(),O&&(O.flags|=8,gt(M,w,v,S)),N&&Fe(N,v),Fe(()=>{w.isUnmounted=!0},v)},gr=(w,v,S,A=!1,C=!1,O=0)=>{for(let M=O;M<w.length;M++)gt(w[M],v,S,A,C)},Tn=w=>{if(w.shapeFlag&6)return Tn(w.component.subTree);if(w.shapeFlag&128)return w.suspense.next();const v=d(w.anchor||w.el),S=v&&v[vp];return S?d(S):v};let Oo=!1;const Cu=(w,v,S)=>{w==null?v._vnode&>(v._vnode,null,null,!0):E(v._vnode||null,w,v,null,null,null,S),v._vnode=w,Oo||(Oo=!0,vl(),_l(),Oo=!1)},yr={p:E,um:gt,m:oi,r:Pu,mt:zt,mc:P,pc:ae,pbc:F,n:Tn,o:t};return{render:Cu,hydrate:void 0,createApp:Bp(Cu)}}function Ys({type:t,props:e},i){return i==="svg"&&t==="foreignObject"||i==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:i}function ei({effect:t,job:e},i){i?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function Yp(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Yl(t,e,i=!1){const r=t.children,n=e.children;if(K(r)&&K(n))for(let s=0;s<r.length;s++){const o=r[s];let a=n[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[s]=Ft(n[s]),a.el=o.el),!i&&a.patchFlag!==-2&&Yl(o,a)),a.type===un&&a.patchFlag!==-1&&(a.el=o.el),a.type===jt&&!a.el&&(a.el=o.el)}}function Xp(t){const e=t.slice(),i=[0];let r,n,s,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(n=i[i.length-1],t[n]<c){e[r]=n,i.push(r);continue}for(s=0,o=i.length-1;s<o;)a=s+o>>1,t[i[a]]<c?s=a+1:o=a;c<t[i[s]]&&(s>0&&(e[r]=i[s-1]),i[s]=r)}}for(s=i.length,o=i[s-1];s-- >0;)i[s]=o,o=e[o];return i}function Xl(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Xl(e)}function Jl(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const Jp=Symbol.for("v-scx"),Zp=()=>ir(Jp);function em(t,e){return Xs(t,null,{flush:"sync"})}function _i(t,e,i){return Xs(t,e,i)}function Xs(t,e,i=ee){const{immediate:r,deep:n,flush:s,once:o}=i,a=ve({},i),l=e&&r||!e&&s!=="post";let c;if(ar){if(s==="sync"){const b=Zp();c=b.__watcherHandles||(b.__watcherHandles=[])}else if(!l){const b=()=>{};return b.stop=ot,b.resume=ot,b.pause=ot,b}}const u=Ce;a.call=(b,g,E)=>ct(b,u,g,E);let f=!1;s==="post"?a.scheduler=b=>{Fe(b,u&&u.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(b,g)=>{g?b():Fs(b)}),a.augmentJob=b=>{e&&(b.flags|=4),f&&(b.flags|=2,u&&(b.id=u.uid,b.i=u))};const d=fp(t,e,a);return ar&&(c?c.push(d):l&&d()),d}function tm(t,e,i){const r=this.proxy,n=pe(t)?t.includes(".")?Zl(r,t):()=>r[t]:t.bind(r,r);let s;G(e)?s=e:(s=e.handler,i=e);const o=or(this),a=Xs(n,s.bind(r),i);return o(),a}function Zl(t,e){const i=e.split(".");return()=>{let r=t;for(let n=0;n<i.length&&r;n++)r=r[i[n]];return r}}function ec(t,e,i=ee){const r=eo(),n=kt(e),s=Lt(e),o=tc(t,n),a=ap((l,c)=>{let u,f=ee,d;return em(()=>{const b=t[n];Le(u,b)&&(u=b,c())}),{get(){return l(),i.get?i.get(u):u},set(b){const g=i.set?i.set(b):b;if(!Le(g,u)&&!(f!==ee&&Le(b,f)))return;const E=r.vnode.props;E&&(e in E||n in E||s in E)&&(`onUpdate:${e}`in E||`onUpdate:${n}`in E||`onUpdate:${s}`in E)||(u=b,c()),r.emit(`update:${e}`,g),Le(b,g)&&Le(b,f)&&!Le(g,d)&&c(),f=b,d=g}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||ee:a,done:!1}:{done:!0}}}},a}const tc=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${kt(e)}Modifiers`]||t[`${Lt(e)}Modifiers`];function im(t,e,...i){if(t.isUnmounted)return;const r=t.vnode.props||ee;let n=i;const s=e.startsWith("update:"),o=s&&tc(r,e.slice(7));o&&(o.trim&&(n=i.map(u=>pe(u)?u.trim():u)),o.number&&(n=i.map(Ad)));let a,l=r[a=vs(e)]||r[a=vs(kt(e))];!l&&s&&(l=r[a=vs(Lt(e))]),l&&ct(l,t,6,n);const c=r[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,ct(c,t,6,n)}}const rm=new WeakMap;function ic(t,e,i=!1){const r=i?rm:e.emitsCache,n=r.get(t);if(n!==void 0)return n;const s=t.emits;let o={},a=!1;if(!G(t)){const l=c=>{const u=ic(c,e,!0);u&&(a=!0,ve(o,u))};!i&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(ce(t)&&r.set(t,null),null):(K(s)?s.forEach(l=>o[l]=null):ve(o,s),ce(t)&&r.set(t,o),o)}function cn(t,e){return!t||!Ur(e)?!1:(e=e.slice(2).replace(/Once$/,""),ie(t,e[0].toLowerCase()+e.slice(1))||ie(t,Lt(e))||ie(t,e))}function ib(){}function rc(t){const{type:e,vnode:i,proxy:r,withProxy:n,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:d,setupState:b,ctx:g,inheritAttrs:E}=t,D=nn(t);let k,B;try{if(i.shapeFlag&4){const h=n||r,m=h;k=ht(c.call(m,h,u,f,b,d,g)),B=a}else{const h=e;k=ht(h.length>1?h(f,{attrs:a,slots:o,emit:l}):h(f,null)),B=e.props?a:nm(a)}}catch(h){rr.length=0,en(h,t,1),k=Ct(jt)}let p=k;if(B&&E!==!1){const h=Object.keys(B),{shapeFlag:m}=p;h.length&&m&7&&(s&&h.some(ys)&&(B=sm(B,s)),p=Si(p,B,!1,!0))}return i.dirs&&(p=Si(p,null,!1,!0),p.dirs=p.dirs?p.dirs.concat(i.dirs):i.dirs),i.transition&&Bs(p,i.transition),k=p,nn(D),k}const nm=t=>{let e;for(const i in t)(i==="class"||i==="style"||Ur(i))&&((e||(e={}))[i]=t[i]);return e},sm=(t,e)=>{const i={};for(const r in t)(!ys(r)||!(r.slice(9)in e))&&(i[r]=t[r]);return i};function om(t,e,i){const{props:r,children:n,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(i&&l>=0){if(l&1024)return!0;if(l&16)return r?nc(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const d=u[f];if(o[d]!==r[d]&&!cn(c,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?nc(r,o,c):!0:!!o;return!1}function nc(t,e,i){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let n=0;n<r.length;n++){const s=r[n];if(e[s]!==t[s]&&!cn(i,s))return!0}return!1}function am({vnode:t,parent:e},i){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=i,e=e.parent;else break}}const sc=t=>t.__isSuspense;function lm(t,e){e&&e.pendingBranch?K(t)?e.effects.push(...t):e.effects.push(t):bp(t)}const Ze=Symbol.for("v-fgt"),un=Symbol.for("v-txt"),jt=Symbol.for("v-cmt"),Js=Symbol.for("v-stc"),rr=[];let Be=null;function Ut(t=!1){rr.push(Be=t?null:[])}function cm(){rr.pop(),Be=rr[rr.length-1]||null}let nr=1;function oc(t,e=!1){nr+=t,t<0&&Be&&e&&(Be.hasOnce=!0)}function ac(t){return t.dynamicChildren=nr>0?Be||di:null,cm(),nr>0&&Be&&Be.push(t),t}function xi(t,e,i,r,n,s){return ac(hn(t,e,i,r,n,s,!0))}function lc(t,e,i,r,n){return ac(Ct(t,e,i,r,n,!0))}function cc(t){return t?t.__v_isVNode===!0:!1}function sr(t,e){return t.type===e.type&&t.key===e.key}const uc=({key:t})=>t??null,fn=({ref:t,ref_key:e,ref_for:i})=>(typeof t=="number"&&(t=""+t),t!=null?pe(t)||we(t)||G(t)?{i:ft,r:t,k:e,f:!!i}:t:null);function hn(t,e=null,i=null,r=0,n=null,s=t===Ze?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&uc(e),ref:e&&fn(e),scopeId:Sl,slotScopeIds:null,children:i,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:ft};return a?(Zs(l,i),s&128&&t.normalize(l)):i&&(l.shapeFlag|=pe(i)?8:16),nr>0&&!o&&Be&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&Be.push(l),l}const Ct=um;function um(t,e=null,i=null,r=0,n=null,s=!1){if((!t||t===Ip)&&(t=jt),cc(t)){const a=Si(t,e,!0);return i&&Zs(a,i),nr>0&&!s&&Be&&(a.shapeFlag&6?Be[Be.indexOf(t)]=a:Be.push(a)),a.patchFlag=-2,a}if(km(t)&&(t=t.__vccOpts),e){e=fm(e);let{class:a,style:l}=e;a&&!pe(a)&&(e.class=Hr(a)),ce(l)&&(Ds(l)&&!K(l)&&(l=ve({},l)),e.style=xs(l))}const o=pe(t)?1:sc(t)?128:_p(t)?64:ce(t)?4:G(t)?2:0;return hn(t,e,i,r,n,o,s,!0)}function fm(t){return t?Ds(t)||Hl(t)?ve({},t):t:null}function Si(t,e,i=!1,r=!1){const{props:n,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?fc(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&uc(c),ref:e&&e.ref?i&&s?K(s)?s.concat(fn(e)):[s,fn(e)]:fn(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==Ze?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&Si(t.ssContent),ssFallback:t.ssFallback&&Si(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&Bs(u,l.clone(u)),u}function hm(t=" ",e=0){return Ct(un,null,t,e)}function dm(t="",e=!1){return e?(Ut(),lc(jt,null,t)):Ct(jt,null,t)}function ht(t){return t==null||typeof t=="boolean"?Ct(jt):K(t)?Ct(Ze,null,t.slice()):cc(t)?Ft(t):Ct(un,null,String(t))}function Ft(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Si(t)}function Zs(t,e){let i=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(K(e))i=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),Zs(t,n()),n._c&&(n._d=!0));return}else{i=32;const n=e._;!n&&!Hl(e)?e._ctx=ft:n===3&&ft&&(ft.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:ft},i=32):(e=String(e),r&64?(i=16,e=[hm(e)]):i=8);t.children=e,t.shapeFlag|=i}function fc(...t){const e={};for(let i=0;i<t.length;i++){const r=t[i];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=Hr([e.class,r.class]));else if(n==="style")e.style=xs([e.style,r.style]);else if(Ur(n)){const s=e[n],o=r[n];o&&s!==o&&!(K(s)&&s.includes(o))&&(e[n]=s?[].concat(s,o):o)}else n!==""&&(e[n]=r[n])}return e}function dt(t,e,i,r=null){ct(t,e,7,[i,r])}const pm=Ul();let mm=0;function gm(t,e,i){const r=t.type,n=(e?e.appContext:t.appContext)||pm,s={uid:mm++,vnode:t,type:r,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Md(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Wl(r,n),emitsOptions:ic(r,n),emit:null,emitted:null,propsDefaults:ee,inheritAttrs:r.inheritAttrs,ctx:ee,data:ee,props:ee,attrs:ee,slots:ee,refs:ee,setupState:ee,setupContext:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=im.bind(null,s),t.ce&&t.ce(s),s}let Ce=null;const eo=()=>Ce||ft;let dn,to;{const t=qr(),e=(i,r)=>{let n;return(n=t[i])||(n=t[i]=[]),n.push(r),s=>{n.length>1?n.forEach(o=>o(s)):n[0](s)}};dn=e("__VUE_INSTANCE_SETTERS__",i=>Ce=i),to=e("__VUE_SSR_SETTERS__",i=>ar=i)}const or=t=>{const e=Ce;return dn(t),t.scope.on(),()=>{t.scope.off(),dn(e)}},hc=()=>{Ce&&Ce.scope.off(),dn(null)};function dc(t){return t.vnode.shapeFlag&4}let ar=!1;function ym(t,e=!1,i=!1){e&&to(e);const{props:r,children:n}=t.vnode,s=dc(t);qp(t,r,s,e),Kp(t,n,i||e);const o=s?bm(t,e):void 0;return e&&to(!1),o}function bm(t,e){const i=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Lp);const{setup:r}=i;if(r){at();const n=t.setupContext=r.length>1?vm(t):null,s=or(t),o=yi(r,t,0,[t.props,n]),a=Ba(o);if(lt(),s(),(a||t.sp)&&!Zi(t)&&El(t),a){if(o.then(hc,hc),e)return o.then(l=>{pc(t,l)}).catch(l=>{en(l,t,0)});t.asyncDep=o}else pc(t,o)}else mc(t)}function pc(t,e,i){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:ce(e)&&(t.setupState=gl(e)),mc(t)}function mc(t,e,i){const r=t.type;t.render||(t.render=r.render||ot);{const n=or(t);at();try{Np(t)}finally{lt(),n()}}}const wm={get(t,e){return ke(t,"get",""),t[e]}};function vm(t){const e=i=>{t.exposed=i||{}};return{attrs:new Proxy(t.attrs,wm),slots:t.slots,emit:t.emit,expose:e}}function io(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(gl(rp(t.exposed)),{get(e,i){if(i in e)return e[i];if(i in er)return er[i](t)},has(e,i){return i in e||i in er}})):t.proxy}const _m=/(?:^|[-_])\w/g,xm=t=>t.replace(_m,e=>e.toUpperCase()).replace(/[-_]/g,"");function Sm(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function gc(t,e,i=!1){let r=Sm(e);if(!r&&e.__file){const n=e.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&t&&t.parent){const n=s=>{for(const o in s)if(s[o]===e)return o};r=n(t.components||t.parent.type.components)||n(t.appContext.components)}return r?xm(r):i?"App":"Anonymous"}function km(t){return G(t)&&"__vccOpts"in t}const yc=(t,e)=>cp(t,e,ar),Em="3.5.22";/**
|
|
98
|
+
`,...xp(n))}dt(),Ds=!1}function _p(){let t=Qi[Qi.length-1];if(!t)return[];const e=[];for(;t;){const i=e[0];i&&i.vnode===t?i.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function xp(t){const e=[];return t.forEach((i,r)=>{e.push(...r===0?[]:[`
|
|
99
|
+
`],...Sp(i))}),e}function Sp({vnode:t,recurseCount:e}){const i=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,n=` at <${yc(t.component,t.type,r)}`,s=">"+i;return t.props?[n,...kp(t.props),s]:[n+s]}function kp(t){const e=[],i=Object.keys(t);return i.slice(0,3).forEach(r=>{e.push(...bl(r,t[r]))}),i.length>3&&e.push(" ..."),e}function bl(t,e,i){return ye(e)?(e=JSON.stringify(e),i?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?i?e:[`${t}=${e}`]:xe(e)?(e=bl(t,ee(e.value),!0),i?e:[`${t}=Ref<`,e,">"]):G(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=ee(e),i?e:[`${t}=`,e])}function gi(t,e,i,r){try{return r?t(...r):t()}catch(n){Zr(n,e,i)}}function pt(t,e,i,r){if(G(t)){const n=gi(t,e,i,r);return n&&qa(n)&&n.catch(s=>{Zr(s,e,i)}),n}if(K(t)){const n=[];for(let s=0;s<t.length;s++)n.push(pt(t[s],e,i,r));return n}}function Zr(t,e,i,r=!0){const n=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||ie;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${i}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](t,l,c)===!1)return}a=a.parent}if(s){ht(),gi(s,null,10,[t,l,c]),dt();return}}Ep(t,i,n,r,o)}function Ep(t,e,i,r=!0,n=!1){if(n)throw t}const Ie=[];let mt=-1;const yi=[];let qt=null,bi=0;const wl=Promise.resolve();let en=null;function tn(t){const e=en||wl;return t?e.then(this?t.bind(this):t):e}function $p(t){let e=mt+1,i=Ie.length;for(;e<i;){const r=e+i>>>1,n=Ie[r],s=Yi(n);s<t||s===t&&n.flags&2?e=r+1:i=r}return e}function js(t){if(!(t.flags&1)){const e=Yi(t),i=Ie[Ie.length-1];!i||!(t.flags&2)&&e>=Yi(i)?Ie.push(t):Ie.splice($p(e),0,t),t.flags|=1,vl()}}function vl(){en||(en=wl.then(Sl))}function Pp(t){K(t)?yi.push(...t):qt&&t.id===-1?qt.splice(bi+1,0,t):t.flags&1||(yi.push(t),t.flags|=1),vl()}function _l(t,e,i=mt+1){for(;i<Ie.length;i++){const r=Ie[i];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ie.splice(i,1),i--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function xl(t){if(yi.length){const e=[...new Set(yi)].sort((i,r)=>Yi(i)-Yi(r));if(yi.length=0,qt){qt.push(...e);return}for(qt=e,bi=0;bi<qt.length;bi++){const i=qt[bi];i.flags&4&&(i.flags&=-2),i.flags&8||i(),i.flags&=-2}qt=null,bi=0}}const Yi=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Sl(t){try{for(mt=0;mt<Ie.length;mt++){const e=Ie[mt];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),gi(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;mt<Ie.length;mt++){const e=Ie[mt];e&&(e.flags&=-2)}mt=-1,Ie.length=0,xl(),en=null,(Ie.length||yi.length)&&Sl()}}let gt=null,kl=null;function rn(t){const e=gt;return gt=t,kl=t&&t.type.__scopeId||null,e}function Cp(t,e=gt,i){if(!e||t._n)return t;const r=(...n)=>{r._d&&ac(-1);const s=rn(e);let o;try{o=t(...n)}finally{rn(s),r._d&&ac(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function ei(t,e,i,r){const n=t.dirs,s=e&&e.dirs;for(let o=0;o<n.length;o++){const a=n[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(ht(),pt(l,i,8,[t.el,a,t,e]),dt())}}const Op=Symbol("_vte"),Tp=t=>t.__isTeleport,Ip=Symbol("_leaveCb");function Us(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Us(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function El(t,e){return G(t)?Ee({name:t.name},e,{setup:t}):t}function $l(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Ap(t){const e=Xs(),i=Yr(null);if(e){const n=e.refs===ie?e.refs={}:e.refs;Object.defineProperty(n,t,{enumerable:!0,get:()=>i.value,set:s=>i.value=s})}return i}const nn=new WeakMap;function Ji(t,e,i,r,n=!1){if(K(t)){t.forEach((m,E)=>Ji(m,e&&(K(e)?e[E]:e),i,r,n));return}if(Xi(r)&&!n){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&Ji(t,e,i,r.component.subTree);return}const s=r.shapeFlag&4?eo(r.component):r.el,o=n?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===ie?a.refs={}:a.refs,f=a.setupState,d=ee(f),y=f===ie?Fa:m=>ne(d,m);if(c!=null&&c!==l){if(Pl(e),ye(c))u[c]=null,y(c)&&(f[c]=null);else if(xe(c)){c.value=null;const m=e;m.k&&(u[m.k]=null)}}if(G(l))gi(l,a,12,[o,u]);else{const m=ye(l),E=xe(l);if(m||E){const j=()=>{if(t.f){const k=m?y(l)?f[l]:u[l]:l.value;if(n)K(k)&&gs(k,s);else if(K(k))k.includes(s)||k.push(s);else if(m)u[l]=[s],y(l)&&(f[l]=u[l]);else{const F=[s];l.value=F,t.k&&(u[t.k]=F)}}else m?(u[l]=o,y(l)&&(f[l]=o)):E&&(l.value=o,t.k&&(u[t.k]=o))};if(o){const k=()=>{j(),nn.delete(t)};k.id=-1,nn.set(t,k),Ke(k,i)}else Pl(t),j()}}}function Pl(t){const e=nn.get(t);e&&(e.flags|=8,nn.delete(t))}Br().requestIdleCallback,Br().cancelIdleCallback;const Xi=t=>!!t.type.__asyncLoader,Cl=t=>t.type.__isKeepAlive;function Rp(t,e){Ol(t,"a",e)}function Lp(t,e){Ol(t,"da",e)}function Ol(t,e,i=Re){const r=t.__wdc||(t.__wdc=()=>{let n=i;for(;n;){if(n.isDeactivated)return;n=n.parent}return t()});if(sn(e,r,i),i){let n=i.parent;for(;n&&n.parent;)Cl(n.parent.vnode)&&Np(r,e,i,n),n=n.parent}}function Np(t,e,i,r){const n=sn(e,t,r,!0);Al(()=>{gs(r[e],n)},i)}function sn(t,e,i=Re,r=!1){if(i){const n=i[t]||(i[t]=[]),s=e.__weh||(e.__weh=(...o)=>{ht();const a=sr(i),l=pt(e,i,t,o);return a(),dt(),l});return r?n.unshift(s):n.push(s),s}}const At=t=>(e,i=Re)=>{(!or||t==="sp")&&sn(t,(...r)=>e(...r),i)},Tl=At("bm"),Fs=At("m"),Mp=At("bu"),Dp=At("u"),Il=At("bum"),Al=At("um"),jp=At("sp"),Up=At("rtg"),Fp=At("rtc");function Bp(t,e=Re){sn("ec",t,e)}const qp=Symbol.for("v-ndc");function Rl(t,e,i,r){let n;const s=i,o=K(t);if(o||ye(t)){const a=o&&mi(t);let l=!1,c=!1;a&&(l=!Xe(t),c=Ft(t),t=zr(t)),n=new Array(t.length);for(let u=0,f=t.length;u<f;u++)n[u]=e(l?c?Qr($e(t[u])):$e(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){n=new Array(t);for(let a=0;a<t;a++)n[a]=e(a+1,a,void 0,s)}else if(fe(t))if(t[Symbol.iterator])n=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);n=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];n[l]=e(t[u],u,l,s)}}else n=[];return n}const Bs=t=>t?pc(t)?eo(t):Bs(t.parent):null,Zi=Ee(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>Bs(t.parent),$root:t=>Bs(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>Dl(t),$forceUpdate:t=>t.f||(t.f=()=>{js(t.update)}),$nextTick:t=>t.n||(t.n=tn.bind(t.proxy)),$watch:t=>um.bind(t)}),qs=(t,e)=>t!==ie&&!t.__isScriptSetup&&ne(t,e),Hp={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:i,setupState:r,data:n,props:s,accessCache:o,type:a,appContext:l}=t;let c;if(e[0]!=="$"){const y=o[e];if(y!==void 0)switch(y){case 1:return r[e];case 2:return n[e];case 4:return i[e];case 3:return s[e]}else{if(qs(r,e))return o[e]=1,r[e];if(n!==ie&&ne(n,e))return o[e]=2,n[e];if((c=t.propsOptions[0])&&ne(c,e))return o[e]=3,s[e];if(i!==ie&&ne(i,e))return o[e]=4,i[e];Hs&&(o[e]=0)}}const u=Zi[e];let f,d;if(u)return e==="$attrs"&&Oe(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(i!==ie&&ne(i,e))return o[e]=4,i[e];if(d=l.config.globalProperties,ne(d,e))return d[e]},set({_:t},e,i){const{data:r,setupState:n,ctx:s}=t;return qs(n,e)?(n[e]=i,!0):r!==ie&&ne(r,e)?(r[e]=i,!0):ne(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=i,!0)},has({_:{data:t,setupState:e,accessCache:i,ctx:r,appContext:n,propsOptions:s,type:o}},a){let l,c;return!!(i[a]||t!==ie&&a[0]!=="$"&&ne(t,a)||qs(e,a)||(l=s[0])&&ne(l,a)||ne(r,a)||ne(Zi,a)||ne(n.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,i){return i.get!=null?t._.accessCache[e]=0:ne(i,"value")&&this.set(t,e,i.value,null),Reflect.defineProperty(t,e,i)}};function on(t){return K(t)?t.reduce((e,i)=>(e[i]=null,e),{}):t}function Ll(t,e){return!t||!e?t||e:K(t)&&K(e)?t.concat(e):Ee({},on(t),on(e))}let Hs=!0;function zp(t){const e=Dl(t),i=t.proxy,r=t.ctx;Hs=!1,e.beforeCreate&&Nl(e.beforeCreate,t,"bc");const{data:n,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:d,beforeUpdate:y,updated:m,activated:E,deactivated:j,beforeDestroy:k,beforeUnmount:F,destroyed:b,unmounted:h,render:p,renderTracked:v,renderTriggered:x,errorCaptured:P,serverPrefetch:R,expose:B,inheritAttrs:Pe,components:Le,directives:Se,filters:be}=e;if(c&&Wp(c,r,null),o)for(const ae in o){const Q=o[ae];G(Q)&&(r[ae]=Q.bind(i))}if(n){const ae=n.call(i,i);fe(ae)&&(t.data=Rs(ae))}if(Hs=!0,s)for(const ae in s){const Q=s[ae],tt=G(Q)?Q.bind(i,i):G(Q.get)?Q.get.bind(i,i):ft,On=!G(Q)&&G(Q.set)?Q.set.bind(i):ft,si=bc({get:tt,set:On});Object.defineProperty(r,ae,{enumerable:!0,configurable:!0,get:()=>si.value,set:_t=>si.value=_t})}if(a)for(const ae in a)Ml(a[ae],r,i,ae);if(l){const ae=G(l)?l.call(i):l;Reflect.ownKeys(ae).forEach(Q=>{Bl(Q,ae[Q])})}u&&Nl(u,t,"c");function oe(ae,Q){K(Q)?Q.forEach(tt=>ae(tt.bind(i))):Q&&ae(Q.bind(i))}if(oe(Tl,f),oe(Fs,d),oe(Mp,y),oe(Dp,m),oe(Rp,E),oe(Lp,j),oe(Bp,P),oe(Fp,v),oe(Up,x),oe(Il,F),oe(Al,h),oe(jp,R),K(B))if(B.length){const ae=t.exposed||(t.exposed={});B.forEach(Q=>{Object.defineProperty(ae,Q,{get:()=>i[Q],set:tt=>i[Q]=tt,enumerable:!0})})}else t.exposed||(t.exposed={});p&&t.render===ft&&(t.render=p),Pe!=null&&(t.inheritAttrs=Pe),Le&&(t.components=Le),Se&&(t.directives=Se),R&&$l(t)}function Wp(t,e,i=ft){K(t)&&(t=zs(t));for(const r in t){const n=t[r];let s;fe(n)?"default"in n?s=tr(n.from||r,n.default,!0):s=tr(n.from||r):s=tr(n),xe(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Nl(t,e,i){pt(K(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,i)}function Ml(t,e,i,r){let n=r.includes(".")?ec(i,r):()=>i[r];if(ye(t)){const s=e[t];G(s)&&vi(n,s)}else if(G(t))vi(n,t.bind(i));else if(fe(t))if(K(t))t.forEach(s=>Ml(s,e,i,r));else{const s=G(t.handler)?t.handler.bind(i):e[t.handler];G(s)&&vi(n,s,t)}}function Dl(t){const e=t.type,{mixins:i,extends:r}=e,{mixins:n,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!n.length&&!i&&!r?l=e:(l={},n.length&&n.forEach(c=>an(l,c,o,!0)),an(l,e,o)),fe(e)&&s.set(e,l),l}function an(t,e,i,r=!1){const{mixins:n,extends:s}=e;s&&an(t,s,i,!0),n&&n.forEach(o=>an(t,o,i,!0));for(const o in e)if(!(r&&o==="expose")){const a=Kp[o]||i&&i[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Kp={data:jl,props:Ul,emits:Ul,methods:er,computed:er,beforeCreate:Ae,created:Ae,beforeMount:Ae,mounted:Ae,beforeUpdate:Ae,updated:Ae,beforeDestroy:Ae,beforeUnmount:Ae,destroyed:Ae,unmounted:Ae,activated:Ae,deactivated:Ae,errorCaptured:Ae,serverPrefetch:Ae,components:er,directives:er,watch:Gp,provide:jl,inject:Vp};function jl(t,e){return e?t?function(){return Ee(G(t)?t.call(this,this):t,G(e)?e.call(this,this):e)}:e:t}function Vp(t,e){return er(zs(t),zs(e))}function zs(t){if(K(t)){const e={};for(let i=0;i<t.length;i++)e[t[i]]=t[i];return e}return t}function Ae(t,e){return t?[...new Set([].concat(t,e))]:e}function er(t,e){return t?Ee(Object.create(null),t,e):e}function Ul(t,e){return t?K(t)&&K(e)?[...new Set([...t,...e])]:Ee(Object.create(null),on(t),on(e??{})):e}function Gp(t,e){if(!t)return e;if(!e)return t;const i=Ee(Object.create(null),t);for(const r in e)i[r]=Ae(t[r],e[r]);return i}function Fl(){return{app:null,config:{isNativeTag:Fa,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}let Qp=0;function Yp(t,e){return function(r,n=null){G(r)||(r=Ee({},r)),n!=null&&!fe(n)&&(n=null);const s=Fl(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:Qp++,_component:r,_props:n,_container:null,_context:s,_instance:null,version:Lm,get config(){return s.config},set config(u){},use(u,...f){return o.has(u)||(u&&G(u.install)?(o.add(u),u.install(c,...f)):G(u)&&(o.add(u),u(c,...f))),c},mixin(u){return s.mixins.includes(u)||s.mixins.push(u),c},component(u,f){return f?(s.components[u]=f,c):s.components[u]},directive(u,f){return f?(s.directives[u]=f,c):s.directives[u]},mount(u,f,d){if(!l){const y=c._ceVNode||Rt(r,n);return y.appContext=s,d===!0?d="svg":d===!1&&(d=void 0),t(y,u,d),l=!0,c._container=u,u.__vue_app__=c,eo(y.component)}},onUnmount(u){a.push(u)},unmount(){l&&(pt(a,c._instance,16),t(null,c._container),delete c._container.__vue_app__)},provide(u,f){return s.provides[u]=f,c},runWithContext(u){const f=wi;wi=c;try{return u()}finally{wi=f}}};return c}}let wi=null;function Bl(t,e){if(Re){let i=Re.provides;const r=Re.parent&&Re.parent.provides;r===i&&(i=Re.provides=Object.create(r)),i[t]=e}}function tr(t,e,i=!1){const r=Xs();if(r||wi){let n=wi?wi._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(n&&t in n)return n[t];if(arguments.length>1)return i&&G(e)?e.call(r&&r.proxy):e}}const ql={},Hl=()=>Object.create(ql),zl=t=>Object.getPrototypeOf(t)===ql;function Jp(t,e,i,r=!1){const n={},s=Hl();t.propsDefaults=Object.create(null),Wl(t,e,n,s);for(const o in t.propsOptions[0])o in n||(n[o]=void 0);i?t.props=r?n:fp(n):t.type.props?t.props=n:t.props=s,t.attrs=s}function Xp(t,e,i,r){const{props:n,attrs:s,vnode:{patchFlag:o}}=t,a=ee(n),[l]=t.propsOptions;let c=!1;if((r||o>0)&&!(o&16)){if(o&8){const u=t.vnode.dynamicProps;for(let f=0;f<u.length;f++){let d=u[f];if(ln(t.emitsOptions,d))continue;const y=e[d];if(l)if(ne(s,d))y!==s[d]&&(s[d]=y,c=!0);else{const m=Ot(d);n[m]=Ws(l,a,m,y,t,!1)}else y!==s[d]&&(s[d]=y,c=!0)}}}else{Wl(t,e,n,s)&&(c=!0);let u;for(const f in a)(!e||!ne(e,f)&&((u=Ut(f))===f||!ne(e,u)))&&(l?i&&(i[f]!==void 0||i[u]!==void 0)&&(n[f]=Ws(l,a,f,void 0,t,!0)):delete n[f]);if(s!==a)for(const f in s)(!e||!ne(e,f))&&(delete s[f],c=!0)}c&&Tt(t.attrs,"set","")}function Wl(t,e,i,r){const[n,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(Hi(l))continue;const c=e[l];let u;n&&ne(n,u=Ot(l))?!s||!s.includes(u)?i[u]=c:(a||(a={}))[u]=c:ln(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(s){const l=ee(i),c=a||ie;for(let u=0;u<s.length;u++){const f=s[u];i[f]=Ws(n,l,f,c[f],t,!ne(c,f))}}return o}function Ws(t,e,i,r,n,s){const o=t[i];if(o!=null){const a=ne(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&G(l)){const{propsDefaults:c}=n;if(i in c)r=c[i];else{const u=sr(n);r=c[i]=l.call(null,e),u()}}else r=l;n.ce&&n.ce._setProp(i,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===Ut(i))&&(r=!0))}return r}const Zp=new WeakMap;function Kl(t,e,i=!1){const r=i?Zp:e.propsCache,n=r.get(t);if(n)return n;const s=t.props,o={},a=[];let l=!1;if(!G(t)){const u=f=>{l=!0;const[d,y]=Kl(f,e,!0);Ee(o,d),y&&a.push(...y)};!i&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return fe(t)&&r.set(t,hi),hi;if(K(s))for(let u=0;u<s.length;u++){const f=Ot(s[u]);Vl(f)&&(o[f]=ie)}else if(s)for(const u in s){const f=Ot(u);if(Vl(f)){const d=s[u],y=o[f]=K(d)||G(d)?{type:d}:Ee({},d),m=y.type;let E=!1,j=!0;if(K(m))for(let k=0;k<m.length;++k){const F=m[k],b=G(F)&&F.name;if(b==="Boolean"){E=!0;break}else b==="String"&&(j=!1)}else E=G(m)&&m.name==="Boolean";y[0]=E,y[1]=j,(E||ne(y,"default"))&&a.push(f)}}const c=[o,a];return fe(t)&&r.set(t,c),c}function Vl(t){return t[0]!=="$"&&!Hi(t)}const Ks=t=>t==="_"||t==="_ctx"||t==="$stable",Vs=t=>K(t)?t.map(yt):[yt(t)],em=(t,e,i)=>{if(e._n)return e;const r=Cp((...n)=>Vs(e(...n)),i);return r._c=!1,r},Gl=(t,e,i)=>{const r=t._ctx;for(const n in t){if(Ks(n))continue;const s=t[n];if(G(s))e[n]=em(n,s,r);else if(s!=null){const o=Vs(s);e[n]=()=>o}}},Ql=(t,e)=>{const i=Vs(e);t.slots.default=()=>i},Yl=(t,e,i)=>{for(const r in e)(i||!Ks(r))&&(t[r]=e[r])},tm=(t,e,i)=>{const r=t.slots=Hl();if(t.vnode.shapeFlag&32){const n=e._;n?(Yl(r,e,i),i&&Ka(r,"_",n,!0)):Gl(e,r)}else e&&Ql(t,e)},im=(t,e,i)=>{const{vnode:r,slots:n}=t;let s=!0,o=ie;if(r.shapeFlag&32){const a=e._;a?i&&a===1?s=!1:Yl(n,e,i):(s=!e.$stable,Gl(e,n)),o=e}else e&&(Ql(t,e),o={default:1});if(s)for(const a in n)!Ks(a)&&o[a]==null&&delete n[a]},Ke=ym;function rm(t){return nm(t)}function nm(t,e){const i=Br();i.__VUE__=!0;const{insert:r,remove:n,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:d,setScopeId:y=ft,insertStaticContent:m}=t,E=(w,_,S,T=null,C=null,O=null,D=void 0,N=null,A=!!_.dynamicChildren)=>{if(w===_)return;w&&!nr(w,_)&&(T=Tn(w),_t(w,C,O,!0),w=null),_.patchFlag===-2&&(A=!1,_.dynamicChildren=null);const{type:I,ref:H,shapeFlag:U}=_;switch(I){case cn:j(w,_,S,T);break;case Ht:k(w,_,S,T);break;case Ys:w==null&&F(_,S,T,D);break;case ot:Le(w,_,S,T,C,O,D,N,A);break;default:U&1?p(w,_,S,T,C,O,D,N,A):U&6?Se(w,_,S,T,C,O,D,N,A):(U&64||U&128)&&I.process(w,_,S,T,C,O,D,N,A,gr)}H!=null&&C?Ji(H,w&&w.ref,O,_||w,!_):H==null&&w&&w.ref!=null&&Ji(w.ref,null,O,w,!0)},j=(w,_,S,T)=>{if(w==null)r(_.el=a(_.children),S,T);else{const C=_.el=w.el;_.children!==w.children&&c(C,_.children)}},k=(w,_,S,T)=>{w==null?r(_.el=l(_.children||""),S,T):_.el=w.el},F=(w,_,S,T)=>{[w.el,w.anchor]=m(w.children,_,S,T,w.el,w.anchor)},b=({el:w,anchor:_},S,T)=>{let C;for(;w&&w!==_;)C=d(w),r(w,S,T),w=C;r(_,S,T)},h=({el:w,anchor:_})=>{let S;for(;w&&w!==_;)S=d(w),n(w),w=S;n(_)},p=(w,_,S,T,C,O,D,N,A)=>{_.type==="svg"?D="svg":_.type==="math"&&(D="mathml"),w==null?v(_,S,T,C,O,D,N,A):R(w,_,C,O,D,N,A)},v=(w,_,S,T,C,O,D,N)=>{let A,I;const{props:H,shapeFlag:U,transition:q,dirs:V}=w;if(A=w.el=o(w.type,O,H&&H.is,H),U&8?u(A,w.children):U&16&&P(w.children,A,null,T,C,Gs(w,O),D,N),V&&ei(w,null,T,"created"),x(A,w,w.scopeId,D,T),H){for(const ue in H)ue!=="value"&&!Hi(ue)&&s(A,ue,null,H[ue],O,T);"value"in H&&s(A,"value",null,H.value,O),(I=H.onVnodeBeforeMount)&&bt(I,T,w)}V&&ei(w,null,T,"beforeMount");const Z=sm(C,q);Z&&q.beforeEnter(A),r(A,_,S),((I=H&&H.onVnodeMounted)||Z||V)&&Ke(()=>{I&&bt(I,T,w),Z&&q.enter(A),V&&ei(w,null,T,"mounted")},C)},x=(w,_,S,T,C)=>{if(S&&y(w,S),T)for(let O=0;O<T.length;O++)y(w,T[O]);if(C){let O=C.subTree;if(_===O||oc(O.type)&&(O.ssContent===_||O.ssFallback===_)){const D=C.vnode;x(w,D,D.scopeId,D.slotScopeIds,C.parent)}}},P=(w,_,S,T,C,O,D,N,A=0)=>{for(let I=A;I<w.length;I++){const H=w[I]=N?Wt(w[I]):yt(w[I]);E(null,H,_,S,T,C,O,D,N)}},R=(w,_,S,T,C,O,D)=>{const N=_.el=w.el;let{patchFlag:A,dynamicChildren:I,dirs:H}=_;A|=w.patchFlag&16;const U=w.props||ie,q=_.props||ie;let V;if(S&&ti(S,!1),(V=q.onVnodeBeforeUpdate)&&bt(V,S,_,w),H&&ei(_,w,S,"beforeUpdate"),S&&ti(S,!0),(U.innerHTML&&q.innerHTML==null||U.textContent&&q.textContent==null)&&u(N,""),I?B(w.dynamicChildren,I,N,S,T,Gs(_,C),O):D||Q(w,_,N,null,S,T,Gs(_,C),O,!1),A>0){if(A&16)Pe(N,U,q,S,C);else if(A&2&&U.class!==q.class&&s(N,"class",null,q.class,C),A&4&&s(N,"style",U.style,q.style,C),A&8){const Z=_.dynamicProps;for(let ue=0;ue<Z.length;ue++){const se=Z[ue],qe=U[se],He=q[se];(He!==qe||se==="value")&&s(N,se,qe,He,C,S)}}A&1&&w.children!==_.children&&u(N,_.children)}else!D&&I==null&&Pe(N,U,q,S,C);((V=q.onVnodeUpdated)||H)&&Ke(()=>{V&&bt(V,S,_,w),H&&ei(_,w,S,"updated")},T)},B=(w,_,S,T,C,O,D)=>{for(let N=0;N<_.length;N++){const A=w[N],I=_[N],H=A.el&&(A.type===ot||!nr(A,I)||A.shapeFlag&198)?f(A.el):S;E(A,I,H,null,T,C,O,D,!0)}},Pe=(w,_,S,T,C)=>{if(_!==S){if(_!==ie)for(const O in _)!Hi(O)&&!(O in S)&&s(w,O,_[O],null,C,T);for(const O in S){if(Hi(O))continue;const D=S[O],N=_[O];D!==N&&O!=="value"&&s(w,O,N,D,C,T)}"value"in S&&s(w,"value",_.value,S.value,C)}},Le=(w,_,S,T,C,O,D,N,A)=>{const I=_.el=w?w.el:a(""),H=_.anchor=w?w.anchor:a("");let{patchFlag:U,dynamicChildren:q,slotScopeIds:V}=_;V&&(N=N?N.concat(V):V),w==null?(r(I,S,T),r(H,S,T),P(_.children||[],S,H,C,O,D,N,A)):U>0&&U&64&&q&&w.dynamicChildren?(B(w.dynamicChildren,q,S,C,O,D,N),(_.key!=null||C&&_===C.subTree)&&Jl(w,_,!0)):Q(w,_,S,H,C,O,D,N,A)},Se=(w,_,S,T,C,O,D,N,A)=>{_.slotScopeIds=N,w==null?_.shapeFlag&512?C.ctx.activate(_,S,T,D,A):be(_,S,T,C,O,D,A):he(w,_,A)},be=(w,_,S,T,C,O,D)=>{const N=w.component=Em(w,T,C);if(Cl(w)&&(N.ctx.renderer=gr),$m(N,!1,D),N.asyncDep){if(C&&C.registerDep(N,oe,D),!w.el){const A=N.subTree=Rt(Ht);k(null,A,_,S),w.placeholder=A.el}}else oe(N,w,_,S,C,O,D)},he=(w,_,S)=>{const T=_.component=w.component;if(mm(w,_,S))if(T.asyncDep&&!T.asyncResolved){ae(T,_,S);return}else T.next=_,T.update();else _.el=w.el,T.vnode=_},oe=(w,_,S,T,C,O,D)=>{const N=()=>{if(w.isMounted){let{next:U,bu:q,u:V,parent:Z,vnode:ue}=w;{const St=Xl(w);if(St){U&&(U.el=ue.el,ae(w,U,D)),St.asyncDep.then(()=>{w.isUnmounted||N()});return}}let se=U,qe;ti(w,!1),U?(U.el=ue.el,ae(w,U,D)):U=ue,q&&ws(q),(qe=U.props&&U.props.onVnodeBeforeUpdate)&&bt(qe,Z,U,ue),ti(w,!0);const He=nc(w),xt=w.subTree;w.subTree=He,E(xt,He,f(xt.el),Tn(xt),w,C,O),U.el=He.el,se===null&&gm(w,He.el),V&&Ke(V,C),(qe=U.props&&U.props.onVnodeUpdated)&&Ke(()=>bt(qe,Z,U,ue),C)}else{let U;const{el:q,props:V}=_,{bm:Z,m:ue,parent:se,root:qe,type:He}=w,xt=Xi(_);ti(w,!1),Z&&ws(Z),!xt&&(U=V&&V.onVnodeBeforeMount)&&bt(U,se,_),ti(w,!0);{qe.ce&&qe.ce._def.shadowRoot!==!1&&qe.ce._injectChildStyle(He);const St=w.subTree=nc(w);E(null,St,S,T,w,C,O),_.el=St.el}if(ue&&Ke(ue,C),!xt&&(U=V&&V.onVnodeMounted)){const St=_;Ke(()=>bt(U,se,St),C)}(_.shapeFlag&256||se&&Xi(se.vnode)&&se.vnode.shapeFlag&256)&&w.a&&Ke(w.a,C),w.isMounted=!0,_=S=T=null}};w.scope.on();const A=w.effect=new Ja(N);w.scope.off();const I=w.update=A.run.bind(A),H=w.job=A.runIfDirty.bind(A);H.i=w,H.id=w.uid,A.scheduler=()=>js(H),ti(w,!0),I()},ae=(w,_,S)=>{_.component=w;const T=w.vnode.props;w.vnode=_,w.next=null,Xp(w,_.props,T,S),im(w,_.children,S),ht(),_l(w),dt()},Q=(w,_,S,T,C,O,D,N,A=!1)=>{const I=w&&w.children,H=w?w.shapeFlag:0,U=_.children,{patchFlag:q,shapeFlag:V}=_;if(q>0){if(q&128){On(I,U,S,T,C,O,D,N,A);return}else if(q&256){tt(I,U,S,T,C,O,D,N,A);return}}V&8?(H&16&&mr(I,C,O),U!==I&&u(S,U)):H&16?V&16?On(I,U,S,T,C,O,D,N,A):mr(I,C,O,!0):(H&8&&u(S,""),V&16&&P(U,S,T,C,O,D,N,A))},tt=(w,_,S,T,C,O,D,N,A)=>{w=w||hi,_=_||hi;const I=w.length,H=_.length,U=Math.min(I,H);let q;for(q=0;q<U;q++){const V=_[q]=A?Wt(_[q]):yt(_[q]);E(w[q],V,S,null,C,O,D,N,A)}I>H?mr(w,C,O,!0,!1,U):P(_,S,T,C,O,D,N,A,U)},On=(w,_,S,T,C,O,D,N,A)=>{let I=0;const H=_.length;let U=w.length-1,q=H-1;for(;I<=U&&I<=q;){const V=w[I],Z=_[I]=A?Wt(_[I]):yt(_[I]);if(nr(V,Z))E(V,Z,S,null,C,O,D,N,A);else break;I++}for(;I<=U&&I<=q;){const V=w[U],Z=_[q]=A?Wt(_[q]):yt(_[q]);if(nr(V,Z))E(V,Z,S,null,C,O,D,N,A);else break;U--,q--}if(I>U){if(I<=q){const V=q+1,Z=V<H?_[V].el:T;for(;I<=q;)E(null,_[I]=A?Wt(_[I]):yt(_[I]),S,Z,C,O,D,N,A),I++}}else if(I>q)for(;I<=U;)_t(w[I],C,O,!0),I++;else{const V=I,Z=I,ue=new Map;for(I=Z;I<=q;I++){const Qe=_[I]=A?Wt(_[I]):yt(_[I]);Qe.key!=null&&ue.set(Qe.key,I)}let se,qe=0;const He=q-Z+1;let xt=!1,St=0;const yr=new Array(He);for(I=0;I<He;I++)yr[I]=0;for(I=V;I<=U;I++){const Qe=w[I];if(qe>=He){_t(Qe,C,O,!0);continue}let kt;if(Qe.key!=null)kt=ue.get(Qe.key);else for(se=Z;se<=q;se++)if(yr[se-Z]===0&&nr(Qe,_[se])){kt=se;break}kt===void 0?_t(Qe,C,O,!0):(yr[kt-Z]=I+1,kt>=St?St=kt:xt=!0,E(Qe,_[kt],S,null,C,O,D,N,A),qe++)}const Nu=xt?om(yr):hi;for(se=Nu.length-1,I=He-1;I>=0;I--){const Qe=Z+I,kt=_[Qe],Mu=_[Qe+1],Du=Qe+1<H?Mu.el||Mu.placeholder:T;yr[I]===0?E(null,kt,S,Du,C,O,D,N,A):xt&&(se<0||I!==Nu[se]?si(kt,S,Du,2):se--)}}},si=(w,_,S,T,C=null)=>{const{el:O,type:D,transition:N,children:A,shapeFlag:I}=w;if(I&6){si(w.component.subTree,_,S,T);return}if(I&128){w.suspense.move(_,S,T);return}if(I&64){D.move(w,_,S,gr);return}if(D===ot){r(O,_,S);for(let U=0;U<A.length;U++)si(A[U],_,S,T);r(w.anchor,_,S);return}if(D===Ys){b(w,_,S);return}if(T!==2&&I&1&&N)if(T===0)N.beforeEnter(O),r(O,_,S),Ke(()=>N.enter(O),C);else{const{leave:U,delayLeave:q,afterLeave:V}=N,Z=()=>{w.ctx.isUnmounted?n(O):r(O,_,S)},ue=()=>{O._isLeaving&&O[Ip](!0),U(O,()=>{Z(),V&&V()})};q?q(O,Z,ue):ue()}else r(O,_,S)},_t=(w,_,S,T=!1,C=!1)=>{const{type:O,props:D,ref:N,children:A,dynamicChildren:I,shapeFlag:H,patchFlag:U,dirs:q,cacheIndex:V}=w;if(U===-2&&(C=!1),N!=null&&(ht(),Ji(N,null,S,w,!0),dt()),V!=null&&(_.renderCache[V]=void 0),H&256){_.ctx.deactivate(w);return}const Z=H&1&&q,ue=!Xi(w);let se;if(ue&&(se=D&&D.onVnodeBeforeUnmount)&&bt(se,_,w),H&6)mb(w.component,S,T);else{if(H&128){w.suspense.unmount(S,T);return}Z&&ei(w,null,_,"beforeUnmount"),H&64?w.type.remove(w,_,S,gr,T):I&&!I.hasOnce&&(O!==ot||U>0&&U&64)?mr(I,_,S,!1,!0):(O===ot&&U&384||!C&&H&16)&&mr(A,_,S),T&&Ru(w)}(ue&&(se=D&&D.onVnodeUnmounted)||Z)&&Ke(()=>{se&&bt(se,_,w),Z&&ei(w,null,_,"unmounted")},S)},Ru=w=>{const{type:_,el:S,anchor:T,transition:C}=w;if(_===ot){pb(S,T);return}if(_===Ys){h(w);return}const O=()=>{n(S),C&&!C.persisted&&C.afterLeave&&C.afterLeave()};if(w.shapeFlag&1&&C&&!C.persisted){const{leave:D,delayLeave:N}=C,A=()=>D(S,O);N?N(w.el,O,A):A()}else O()},pb=(w,_)=>{let S;for(;w!==_;)S=d(w),n(w),w=S;n(_)},mb=(w,_,S)=>{const{bum:T,scope:C,job:O,subTree:D,um:N,m:A,a:I}=w;Zl(A),Zl(I),T&&ws(T),C.stop(),O&&(O.flags|=8,_t(D,w,_,S)),N&&Ke(N,_),Ke(()=>{w.isUnmounted=!0},_)},mr=(w,_,S,T=!1,C=!1,O=0)=>{for(let D=O;D<w.length;D++)_t(w[D],_,S,T,C)},Tn=w=>{if(w.shapeFlag&6)return Tn(w.component.subTree);if(w.shapeFlag&128)return w.suspense.next();const _=d(w.anchor||w.el),S=_&&_[Op];return S?d(S):_};let Oo=!1;const Lu=(w,_,S)=>{w==null?_._vnode&&_t(_._vnode,null,null,!0):E(_._vnode||null,w,_,null,null,null,S),_._vnode=w,Oo||(Oo=!0,_l(),xl(),Oo=!1)},gr={p:E,um:_t,m:si,r:Ru,mt:be,mc:P,pc:Q,pbc:B,n:Tn,o:t};return{render:Lu,hydrate:void 0,createApp:Yp(Lu)}}function Gs({type:t,props:e},i){return i==="svg"&&t==="foreignObject"||i==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:i}function ti({effect:t,job:e},i){i?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function sm(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function Jl(t,e,i=!1){const r=t.children,n=e.children;if(K(r)&&K(n))for(let s=0;s<r.length;s++){const o=r[s];let a=n[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=n[s]=Wt(n[s]),a.el=o.el),!i&&a.patchFlag!==-2&&Jl(o,a)),a.type===cn&&a.patchFlag!==-1&&(a.el=o.el),a.type===Ht&&!a.el&&(a.el=o.el)}}function om(t){const e=t.slice(),i=[0];let r,n,s,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(n=i[i.length-1],t[n]<c){e[r]=n,i.push(r);continue}for(s=0,o=i.length-1;s<o;)a=s+o>>1,t[i[a]]<c?s=a+1:o=a;c<t[i[s]]&&(s>0&&(e[r]=i[s-1]),i[s]=r)}}for(s=i.length,o=i[s-1];s-- >0;)i[s]=o,o=e[o];return i}function Xl(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:Xl(e)}function Zl(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const am=Symbol.for("v-scx"),lm=()=>tr(am);function cm(t,e){return Qs(t,null,{flush:"sync"})}function vi(t,e,i){return Qs(t,e,i)}function Qs(t,e,i=ie){const{immediate:r,deep:n,flush:s,once:o}=i,a=Ee({},i),l=e&&r||!e&&s!=="post";let c;if(or){if(s==="sync"){const y=lm();c=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=ft,y.resume=ft,y.pause=ft,y}}const u=Re;a.call=(y,m,E)=>pt(y,u,m,E);let f=!1;s==="post"?a.scheduler=y=>{Ke(y,u&&u.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(y,m)=>{m?y():js(y)}),a.augmentJob=y=>{e&&(y.flags|=4),f&&(y.flags|=2,u&&(y.id=u.uid,y.i=u))};const d=vp(t,e,a);return or&&(c?c.push(d):l&&d()),d}function um(t,e,i){const r=this.proxy,n=ye(t)?t.includes(".")?ec(r,t):()=>r[t]:t.bind(r,r);let s;G(e)?s=e:(s=e.handler,i=e);const o=sr(this),a=Qs(n,s.bind(r),i);return o(),a}function ec(t,e){const i=e.split(".");return()=>{let r=t;for(let n=0;n<i.length&&r;n++)r=r[i[n]];return r}}function tc(t,e,i=ie){const r=Xs(),n=Ot(e),s=Ut(e),o=ic(t,n),a=gp((l,c)=>{let u,f=ie,d;return cm(()=>{const y=t[n];Ue(u,y)&&(u=y,c())}),{get(){return l(),i.get?i.get(u):u},set(y){const m=i.set?i.set(y):y;if(!Ue(m,u)&&!(f!==ie&&Ue(y,f)))return;const E=r.vnode.props;E&&(e in E||n in E||s in E)&&(`onUpdate:${e}`in E||`onUpdate:${n}`in E||`onUpdate:${s}`in E)||(u=y,c()),r.emit(`update:${e}`,m),Ue(y,m)&&Ue(y,f)&&!Ue(m,d)&&c(),f=y,d=m}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||ie:a,done:!1}:{done:!0}}}},a}const ic=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ot(e)}Modifiers`]||t[`${Ut(e)}Modifiers`];function fm(t,e,...i){if(t.isUnmounted)return;const r=t.vnode.props||ie;let n=i;const s=e.startsWith("update:"),o=s&&ic(r,e.slice(7));o&&(o.trim&&(n=i.map(u=>ye(u)?u.trim():u)),o.number&&(n=i.map(Ud)));let a,l=r[a=bs(e)]||r[a=bs(Ot(e))];!l&&s&&(l=r[a=bs(Ut(e))]),l&&pt(l,t,6,n);const c=r[a+"Once"];if(c){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,pt(c,t,6,n)}}const hm=new WeakMap;function rc(t,e,i=!1){const r=i?hm:e.emitsCache,n=r.get(t);if(n!==void 0)return n;const s=t.emits;let o={},a=!1;if(!G(t)){const l=c=>{const u=rc(c,e,!0);u&&(a=!0,Ee(o,u))};!i&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(fe(t)&&r.set(t,null),null):(K(s)?s.forEach(l=>o[l]=null):Ee(o,s),fe(t)&&r.set(t,o),o)}function ln(t,e){return!t||!jr(e)?!1:(e=e.slice(2).replace(/Once$/,""),ne(t,e[0].toLowerCase()+e.slice(1))||ne(t,Ut(e))||ne(t,e))}function xb(){}function nc(t){const{type:e,vnode:i,proxy:r,withProxy:n,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:d,setupState:y,ctx:m,inheritAttrs:E}=t,j=rn(t);let k,F;try{if(i.shapeFlag&4){const h=n||r,p=h;k=yt(c.call(p,h,u,f,y,d,m)),F=a}else{const h=e;k=yt(h.length>1?h(f,{attrs:a,slots:o,emit:l}):h(f,null)),F=e.props?a:dm(a)}}catch(h){ir.length=0,Zr(h,t,1),k=Rt(Ht)}let b=k;if(F&&E!==!1){const h=Object.keys(F),{shapeFlag:p}=b;h.length&&p&7&&(s&&h.some(ms)&&(F=pm(F,s)),b=xi(b,F,!1,!0))}return i.dirs&&(b=xi(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(i.dirs):i.dirs),i.transition&&Us(b,i.transition),k=b,rn(j),k}const dm=t=>{let e;for(const i in t)(i==="class"||i==="style"||jr(i))&&((e||(e={}))[i]=t[i]);return e},pm=(t,e)=>{const i={};for(const r in t)(!ms(r)||!(r.slice(9)in e))&&(i[r]=t[r]);return i};function mm(t,e,i){const{props:r,children:n,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(i&&l>=0){if(l&1024)return!0;if(l&16)return r?sc(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const d=u[f];if(o[d]!==r[d]&&!ln(c,d))return!0}}}else return(n||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?sc(r,o,c):!0:!!o;return!1}function sc(t,e,i){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let n=0;n<r.length;n++){const s=r[n];if(e[s]!==t[s]&&!ln(i,s))return!0}return!1}function gm({vnode:t,parent:e},i){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=i,e=e.parent;else break}}const oc=t=>t.__isSuspense;function ym(t,e){e&&e.pendingBranch?K(t)?e.effects.push(...t):e.effects.push(t):Pp(t)}const ot=Symbol.for("v-fgt"),cn=Symbol.for("v-txt"),Ht=Symbol.for("v-cmt"),Ys=Symbol.for("v-stc"),ir=[];let Ve=null;function zt(t=!1){ir.push(Ve=t?null:[])}function bm(){ir.pop(),Ve=ir[ir.length-1]||null}let rr=1;function ac(t,e=!1){rr+=t,t<0&&Ve&&e&&(Ve.hasOnce=!0)}function lc(t){return t.dynamicChildren=rr>0?Ve||hi:null,bm(),rr>0&&Ve&&Ve.push(t),t}function _i(t,e,i,r,n,s){return lc(fn(t,e,i,r,n,s,!0))}function cc(t,e,i,r,n){return lc(Rt(t,e,i,r,n,!0))}function uc(t){return t?t.__v_isVNode===!0:!1}function nr(t,e){return t.type===e.type&&t.key===e.key}const fc=({key:t})=>t??null,un=({ref:t,ref_key:e,ref_for:i})=>(typeof t=="number"&&(t=""+t),t!=null?ye(t)||xe(t)||G(t)?{i:gt,r:t,k:e,f:!!i}:t:null);function fn(t,e=null,i=null,r=0,n=null,s=t===ot?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&fc(e),ref:e&&un(e),scopeId:kl,slotScopeIds:null,children:i,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:s,patchFlag:r,dynamicProps:n,dynamicChildren:null,appContext:null,ctx:gt};return a?(Js(l,i),s&128&&t.normalize(l)):i&&(l.shapeFlag|=ye(i)?8:16),rr>0&&!o&&Ve&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&Ve.push(l),l}const Rt=wm;function wm(t,e=null,i=null,r=0,n=null,s=!1){if((!t||t===qp)&&(t=Ht),uc(t)){const a=xi(t,e,!0);return i&&Js(a,i),rr>0&&!s&&Ve&&(a.shapeFlag&6?Ve[Ve.indexOf(t)]=a:Ve.push(a)),a.patchFlag=-2,a}if(Rm(t)&&(t=t.__vccOpts),e){e=vm(e);let{class:a,style:l}=e;a&&!ye(a)&&(e.class=qr(a)),fe(l)&&(Ns(l)&&!K(l)&&(l=Ee({},l)),e.style=vs(l))}const o=ye(t)?1:oc(t)?128:Tp(t)?64:fe(t)?4:G(t)?2:0;return fn(t,e,i,r,n,o,s,!0)}function vm(t){return t?Ns(t)||zl(t)?Ee({},t):t:null}function xi(t,e,i=!1,r=!1){const{props:n,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?hc(n||{},e):n,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&fc(c),ref:e&&e.ref?i&&s?K(s)?s.concat(un(e)):[s,un(e)]:un(e):s,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==ot?o===-1?16:o|16:o,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:l,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&xi(t.ssContent),ssFallback:t.ssFallback&&xi(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&Us(u,l.clone(u)),u}function _m(t=" ",e=0){return Rt(cn,null,t,e)}function xm(t="",e=!1){return e?(zt(),cc(Ht,null,t)):Rt(Ht,null,t)}function yt(t){return t==null||typeof t=="boolean"?Rt(Ht):K(t)?Rt(ot,null,t.slice()):uc(t)?Wt(t):Rt(cn,null,String(t))}function Wt(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:xi(t)}function Js(t,e){let i=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(K(e))i=16;else if(typeof e=="object")if(r&65){const n=e.default;n&&(n._c&&(n._d=!1),Js(t,n()),n._c&&(n._d=!0));return}else{i=32;const n=e._;!n&&!zl(e)?e._ctx=gt:n===3&>&&(gt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else G(e)?(e={default:e,_ctx:gt},i=32):(e=String(e),r&64?(i=16,e=[_m(e)]):i=8);t.children=e,t.shapeFlag|=i}function hc(...t){const e={};for(let i=0;i<t.length;i++){const r=t[i];for(const n in r)if(n==="class")e.class!==r.class&&(e.class=qr([e.class,r.class]));else if(n==="style")e.style=vs([e.style,r.style]);else if(jr(n)){const s=e[n],o=r[n];o&&s!==o&&!(K(s)&&s.includes(o))&&(e[n]=s?[].concat(s,o):o)}else n!==""&&(e[n]=r[n])}return e}function bt(t,e,i,r=null){pt(t,e,7,[i,r])}const Sm=Fl();let km=0;function Em(t,e,i){const r=t.type,n=(e?e.appContext:t.appContext)||Sm,s={uid:km++,vnode:t,type:r,parent:e,appContext:n,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Wd(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(n.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Kl(r,n),emitsOptions:rc(r,n),emit:null,emitted:null,propsDefaults:ie,inheritAttrs:r.inheritAttrs,ctx:ie,data:ie,props:ie,attrs:ie,slots:ie,refs:ie,setupState:ie,setupContext:null,suspense:i,suspenseId:i?i.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return s.ctx={_:s},s.root=e?e.root:s,s.emit=fm.bind(null,s),t.ce&&t.ce(s),s}let Re=null;const Xs=()=>Re||gt;let hn,Zs;{const t=Br(),e=(i,r)=>{let n;return(n=t[i])||(n=t[i]=[]),n.push(r),s=>{n.length>1?n.forEach(o=>o(s)):n[0](s)}};hn=e("__VUE_INSTANCE_SETTERS__",i=>Re=i),Zs=e("__VUE_SSR_SETTERS__",i=>or=i)}const sr=t=>{const e=Re;return hn(t),t.scope.on(),()=>{t.scope.off(),hn(e)}},dc=()=>{Re&&Re.scope.off(),hn(null)};function pc(t){return t.vnode.shapeFlag&4}let or=!1;function $m(t,e=!1,i=!1){e&&Zs(e);const{props:r,children:n}=t.vnode,s=pc(t);Jp(t,r,s,e),tm(t,n,i||e);const o=s?Pm(t,e):void 0;return e&&Zs(!1),o}function Pm(t,e){const i=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Hp);const{setup:r}=i;if(r){ht();const n=t.setupContext=r.length>1?Om(t):null,s=sr(t),o=gi(r,t,0,[t.props,n]),a=qa(o);if(dt(),s(),(a||t.sp)&&!Xi(t)&&$l(t),a){if(o.then(dc,dc),e)return o.then(l=>{mc(t,l)}).catch(l=>{Zr(l,t,0)});t.asyncDep=o}else mc(t,o)}else gc(t)}function mc(t,e,i){G(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:fe(e)&&(t.setupState=yl(e)),gc(t)}function gc(t,e,i){const r=t.type;t.render||(t.render=r.render||ft);{const n=sr(t);ht();try{zp(t)}finally{dt(),n()}}}const Cm={get(t,e){return Oe(t,"get",""),t[e]}};function Om(t){const e=i=>{t.exposed=i||{}};return{attrs:new Proxy(t.attrs,Cm),slots:t.slots,emit:t.emit,expose:e}}function eo(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(yl(hp(t.exposed)),{get(e,i){if(i in e)return e[i];if(i in Zi)return Zi[i](t)},has(e,i){return i in e||i in Zi}})):t.proxy}const Tm=/(?:^|[-_])\w/g,Im=t=>t.replace(Tm,e=>e.toUpperCase()).replace(/[-_]/g,"");function Am(t,e=!0){return G(t)?t.displayName||t.name:t.name||e&&t.__name}function yc(t,e,i=!1){let r=Am(e);if(!r&&e.__file){const n=e.__file.match(/([^/\\]+)\.\w+$/);n&&(r=n[1])}if(!r&&t&&t.parent){const n=s=>{for(const o in s)if(s[o]===e)return o};r=n(t.components||t.parent.type.components)||n(t.appContext.components)}return r?Im(r):i?"App":"Anonymous"}function Rm(t){return G(t)&&"__vccOpts"in t}const bc=(t,e)=>bp(t,e,or),Lm="3.5.22";/**
|
|
93
100
|
* @vue/runtime-dom v3.5.22
|
|
94
101
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
95
102
|
* @license MIT
|
|
96
|
-
**/let
|
|
103
|
+
**/let to;const wc=typeof window<"u"&&window.trustedTypes;if(wc)try{to=wc.createPolicy("vue",{createHTML:t=>t})}catch{}const vc=to?t=>to.createHTML(t):t=>t,Nm="http://www.w3.org/2000/svg",Mm="http://www.w3.org/1998/Math/MathML",Lt=typeof document<"u"?document:null,_c=Lt&&Lt.createElement("template"),Dm={insert:(t,e,i)=>{e.insertBefore(t,i||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,i,r)=>{const n=e==="svg"?Lt.createElementNS(Nm,t):e==="mathml"?Lt.createElementNS(Mm,t):i?Lt.createElement(t,{is:i}):Lt.createElement(t);return t==="select"&&r&&r.multiple!=null&&n.setAttribute("multiple",r.multiple),n},createText:t=>Lt.createTextNode(t),createComment:t=>Lt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>Lt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,i,r,n,s){const o=i?i.previousSibling:e.lastChild;if(n&&(n===s||n.nextSibling))for(;e.insertBefore(n.cloneNode(!0),i),!(n===s||!(n=n.nextSibling)););else{_c.innerHTML=vc(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=_c.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,i)}return[o?o.nextSibling:e.firstChild,i?i.previousSibling:e.lastChild]}},jm=Symbol("_vtc");function Um(t,e,i){const r=t[jm];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):i?t.setAttribute("class",e):t.className=e}const xc=Symbol("_vod"),Fm=Symbol("_vsh"),Bm=Symbol(""),qm=/(?:^|;)\s*display\s*:/;function Hm(t,e,i){const r=t.style,n=ye(i);let s=!1;if(i&&!n){if(e)if(ye(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();i[a]==null&&dn(r,a,"")}else for(const o in e)i[o]==null&&dn(r,o,"");for(const o in i)o==="display"&&(s=!0),dn(r,o,i[o])}else if(n){if(e!==i){const o=r[Bm];o&&(i+=";"+o),r.cssText=i,s=qm.test(i)}}else e&&t.removeAttribute("style");xc in t&&(t[xc]=s?r.display:"",t[Fm]&&(r.display="none"))}const Sc=/\s*!important$/;function dn(t,e,i){if(K(i))i.forEach(r=>dn(t,e,r));else if(i==null&&(i=""),e.startsWith("--"))t.setProperty(e,i);else{const r=zm(t,e);Sc.test(i)?t.setProperty(Ut(r),i.replace(Sc,""),"important"):t[r]=i}}const kc=["Webkit","Moz","ms"],io={};function zm(t,e){const i=io[e];if(i)return i;let r=Ot(e);if(r!=="filter"&&r in t)return io[e]=r;r=Wa(r);for(let n=0;n<kc.length;n++){const s=kc[n]+r;if(s in t)return io[e]=s}return e}const Ec="http://www.w3.org/1999/xlink";function $c(t,e,i,r,n,s=zd(e)){r&&e.startsWith("xlink:")?i==null?t.removeAttributeNS(Ec,e.slice(6,e.length)):t.setAttributeNS(Ec,e,i):i==null||s&&!Ga(i)?t.removeAttribute(e):t.setAttribute(e,s?"":jt(i)?String(i):i)}function Pc(t,e,i,r,n){if(e==="innerHTML"||e==="textContent"){i!=null&&(t[e]=e==="innerHTML"?vc(i):i);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=i==null?t.type==="checkbox"?"on":"":String(i);(a!==l||!("_value"in t))&&(t.value=l),i==null&&t.removeAttribute(e),t._value=i;return}let o=!1;if(i===""||i==null){const a=typeof t[e];a==="boolean"?i=Ga(i):i==null&&a==="string"?(i="",o=!0):a==="number"&&(i=0,o=!0)}try{t[e]=i}catch{}o&&t.removeAttribute(n||e)}function Wm(t,e,i,r){t.addEventListener(e,i,r)}function Km(t,e,i,r){t.removeEventListener(e,i,r)}const Cc=Symbol("_vei");function Vm(t,e,i,r,n=null){const s=t[Cc]||(t[Cc]={}),o=s[e];if(r&&o)o.value=r;else{const[a,l]=Gm(e);if(r){const c=s[e]=Jm(r,n);Wm(t,a,c,l)}else o&&(Km(t,a,o,l),s[e]=void 0)}}const Oc=/(?:Once|Passive|Capture)$/;function Gm(t){let e;if(Oc.test(t)){e={};let r;for(;r=t.match(Oc);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Ut(t.slice(2)),e]}let ro=0;const Qm=Promise.resolve(),Ym=()=>ro||(Qm.then(()=>ro=0),ro=Date.now());function Jm(t,e){const i=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=i.attached)return;pt(Xm(r,i.value),e,5,[r])};return i.value=t,i.attached=Ym(),i}function Xm(t,e){if(K(e)){const i=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{i.call(t),t._stopped=!0},e.map(r=>n=>!n._stopped&&r&&r(n))}else return e}const Tc=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,Zm=(t,e,i,r,n,s)=>{const o=n==="svg";e==="class"?Um(t,r,o):e==="style"?Hm(t,i,r):jr(e)?ms(e)||Vm(t,e,i,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):eg(t,e,r,o))?(Pc(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&$c(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!ye(r))?Pc(t,Ot(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),$c(t,e,r,o))};function eg(t,e,i,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Tc(e)&&G(i));if(e==="spellcheck"||e==="draggable"||e==="translate"||e==="autocorrect"||e==="form"||e==="list"&&t.tagName==="INPUT"||e==="type"&&t.tagName==="TEXTAREA")return!1;if(e==="width"||e==="height"){const n=t.tagName;if(n==="IMG"||n==="VIDEO"||n==="CANVAS"||n==="SOURCE")return!1}return Tc(e)&&ye(i)?!1:e in t}const tg=Ee({patchProp:Zm},Dm);let Ic;function ig(){return Ic||(Ic=rm(tg))}const rg=(...t)=>{const e=ig().createApp(...t),{mount:i}=e;return e.mount=r=>{const n=sg(r);if(!n)return;const s=e._component;!G(s)&&!s.render&&!s.template&&(s.template=n.innerHTML),n.nodeType===1&&(n.textContent="");const o=i(n,!1,ng(n));return n instanceof Element&&(n.removeAttribute("v-cloak"),n.setAttribute("data-v-app","")),o},e};function ng(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function sg(t){return ye(t)?document.querySelector(t):t}const no=Symbol("IPEInjectKey"),og=(t,e)=>(e?e.provide(no,t):Bl(no,t),t),ag=()=>{const t=tr(no);if(!t)throw new Error("InPageEdit instance is not provided");return t},lg=(t,...e)=>{const i=rg(...e);return og(t,i),i},Ze='@charset "UTF-8";:host{all:initial;font-family:var(--schema-font-family, ui-sans-serif, system-ui, -apple-system)}*,*:before,*:after{box-sizing:border-box}:host{color:var(--schema-color-fg, #111827)}:host{--schema-radius: var(--schema-radius, 10px)}.wrapper{display:block;background:var(--schema-color-bg, #ffffff)}.form{display:grid;gap:12px}.field{display:grid;gap:6px;padding:8px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);border-radius:var(--schema-radius);background:var(--schema-surface, #fff)}.label{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.input,select,textarea{width:100%;padding:8px 10px;border-radius:8px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-input-bg, #fff);color:inherit}.checkbox{display:inline-flex;align-items:center;gap:8px}.helper{font-size:12px;color:var(--schema-color-muted-text, #6b7280)}.row{display:grid;gap:8px}.actions{display:flex;gap:8px}.btn{padding:6px 10px;border:1px solid var(--schema-color-muted, #e5e7eb);background:var(--schema-btn-bg, #f8fafc);border-radius:8px;cursor:pointer}.btn.primary{background:var(--schema-color-primary, #2563eb);color:#fff;border-color:transparent}.btn:disabled{opacity:.5;cursor:not-allowed}.btn.danger{background:var(--schema-color-danger, #dc2626);color:#fff;border-color:transparent}.group{display:grid;gap:10px;border-left:3px solid var(--schema-color-muted, #e5e7eb);padding-left:10px}.kv{display:grid;grid-template-columns:1fr 1fr auto;gap:8px;align-items:center}.badge{display:inline-flex;padding:2px 6px;border-radius:999px;font-size:11px;background:var(--schema-badge-bg, #eef2ff);color:var(--schema-badge-fg, #4f46e5)}.hidden{display:none!important}.toolbar{display:flex;gap:6px}.schema-collection-row{position:relative;transition:transform var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease),opacity var(--schema-collection-transition-duration, .25s) var(--schema-collection-transition-ease, ease)}.schema-collection-row.enter{opacity:0}.schema-collection-row.enter.enter-active{opacity:1}.schema-collection-row.leaving{opacity:0}.field.schema-type-array .group,.field.schema-type-array .group .row{position:relative}';/**
|
|
97
104
|
* SchemaForm
|
|
98
105
|
* 一个基于 Schemastery 的 Web Components 表单生成器
|
|
99
106
|
*
|
|
@@ -110,6 +117,6 @@
|
|
|
110
117
|
* @license MIT
|
|
111
118
|
* @author dragon-fish
|
|
112
119
|
* @author @openai/gpt-5
|
|
113
|
-
*/const Tc={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},he=(t,e)=>{customElements.get(t)||customElements.define(t,e)},eg=(t,e,i)=>{if(!e.length)return;let r=t,n=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let c=r?.[l];c==null?(c=typeof e[a+1]=="number"?[]:{},r[l]=c):typeof c!="object"&&(c=typeof e[a+1]=="number"?[]:{},r[l]=c),n=r,s=l,r=c}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(n)n[s]=a,r=a;else return}try{r[o]=i}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=i,n&&(n[s]=a)}catch{}}},lr=t=>t.map(String).join("."),tg=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),Bt=t=>`schema_${tg(lr(t)||"root")}`,ti=t=>lr(t);function ao(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const i=Number(e);return Number.isNaN(i)?void 0:i}case"boolean":return!!e;case"date":{if(!e)return;const i=new Date(e);return Number.isNaN(+i)?void 0:i}case"const":case"string":default:return e}}function Rc(t){return typeof t=="function"&&!!t?.type}function Ic(t){if(!t)throw new Error("schema is required");if(Rc(t))return t;try{const e=Schema.from(t);if(Rc(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function et(t){return t?.meta??{}}function ig(t){return t.length>0&&t.every(e=>e?.type==="const")}function ki(t){if(!t)return;const e=t,i=e.meta||{};if(Object.prototype.hasOwnProperty.call(i,"default"))return i.default;const r=e.type;try{const n=t();if(n!==void 0)return n}catch{}switch(r){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const n=e.list||[];return n.length?ki(n[0]):void 0}case"const":return e.value;case"date":return;default:return}}class pt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Tc,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=We,this.$root.appendChild(e)}makeFieldContainer(e,i){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",lr(this._path)),this._label){const n=document.createElement("label");n.className="label",n.textContent=this._label,r.appendChild(n)}if(i){const n=document.createElement("div");n.className="helper",n.textContent=i,r.appendChild(n)}return r}set schema(e){this._schema=Ic(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Lc extends pt{render(){if(this.$input&&this.$root.contains(this.$input)){const s=this._value??"";this.$input.value!==s&&document.activeElement!==this.$input&&(this.$input.value=s);return}this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=ti(this._path),r.id=Bt(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(ao("string",r.value));const n=i.querySelector("label.label");n&&(n.htmlFor=r.id),i.appendChild(r),this.$root.appendChild(i)}}he("schema-form-string",Lc);class Nc extends pt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=this._value??"";this.$input.value!==String(o)&&document.activeElement!==this.$input&&(this.$input.value=o);return}this.$root.innerHTML=`<style>${We}</style>`;const e=this._schema?.type??"number",i=et(this._schema),r=this.makeFieldContainer("number",i.description),n=document.createElement("input");this.$input=n,n.className="input",n.name=ti(this._path),n.id=Bt(this._path),i?.min!=null&&(n.min=String(i.min)),i?.max!=null&&(n.max=String(i.max)),i?.step!=null&&(n.step=String(i.step)),e==="percent"&&!n.step&&(n.step="0.01"),n.value=this._value??"",n.oninput=()=>this.emitChange(ao(e,n.value));const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),i.role==="slider"?n.type="range":n.type="number",r.appendChild(n),this.$root.appendChild(r)}}he("schema-form-number",Nc);class Mc extends pt{render(){this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const n=document.createElement("input");n.type="checkbox",n.checked=!!this._value,n.name=ti(this._path),n.id=Bt(this._path);const s=document.createElement("span");s.textContent=e.description??this._label??"",n.onchange=()=>this.emitChange(n.checked);const o=i.querySelector("label.label");o&&(o.htmlFor=n.id),r.append(n,s),i.appendChild(r),this.$root.appendChild(i)}}he("schema-form-boolean",Mc);function mn(t){return String(t).padStart(2,"0")}function cr(t){return`${t.getFullYear()}-${mn(t.getMonth()+1)}-${mn(t.getDate())}`}function lo(t){return`${mn(t.getHours())}:${mn(t.getMinutes())}`}function gn(t){return`${cr(t)}T${lo(t)}`}class Dc extends pt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=et(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=cr(this._value):o==="time"?this.$input.value=lo(this._value):o==="datetime"&&(this.$input.value=gn(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=cr(a):o==="datetime"&&(this.$input.value=gn(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const n=e.role||"date";if(n==="datetime"?r.type="datetime-local":n==="time"?r.type="time":r.type="date",r.name=ti(this._path),r.id=Bt(this._path),this._value instanceof Date)n==="date"?r.value=cr(this._value):n==="time"?r.value=lo(this._value):n==="datetime"&&(r.value=gn(this._value));else if(typeof this._value=="string"&&n!=="time"){const o=new Date(this._value);isNaN(+o)||(n==="date"?r.value=cr(o):n==="datetime"&&(r.value=gn(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=i.querySelector("label.label");s&&(s.htmlFor=r.id),i.appendChild(r),this.$root.appendChild(i)}}he("schema-form-date",Dc);class jc extends pt{render(){this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this._schema.value;if(e.role==="raw-html"){if(i instanceof Node){this.$root.appendChild(i);return}const o=document.createElement("div");o.innerHTML=String(i),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),n=document.createElement("section");n.className="const content",n.textContent=String(i),n.id=Bt(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),r.appendChild(n),this.$root.appendChild(r)}}he("schema-form-const",jc);function rg(t){switch(t.type){case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function Ei(t,e,i,r,n){const s=rg(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,n&&(o.i18n=n),o.setValue?.(i),o}class Uc extends pt{render(){this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(ig(r)){const n=document.createElement("select");n.className="input",n.name=ti(this._path),n.id=Bt(this._path),r.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.value),this._value===o.value&&(a.selected=!0),n.appendChild(a)}),n.onchange=()=>this.emitChange(ao("string",n.value));const s=i.querySelector("label.label");s&&(s.htmlFor=n.id),i.appendChild(n)}else{const n=document.createElement("div");n.className="toolbar";const s=document.createElement("select");s.className="input",s.name=ti(this._path)+".__type",s.id=Bt(this._path)+"__type";let o=0;r.forEach((u,f)=>{const d=document.createElement("option");d.value=String(f),d.textContent=u.type,s.appendChild(d)}),s.onchange=()=>{o=Number(s.value);const u=r[o],f=ki(u);this.emitChange(f),c()};const a=i.querySelector("label.label");a&&(a.htmlFor=s.id),n.appendChild(s),i.appendChild(n);const l=document.createElement("div");l.className="group";const c=()=>{l.innerHTML="";const u=r[o],f=Ei(u,this._path,this._value,this._label);f.addEventListener("change",d=>{d.stopPropagation(),this.emitChange(d.detail.value)}),l.appendChild(f)};c(),i.appendChild(l)}this.$root.appendChild(i)}}he("schema-form-union",Uc);class Fc extends pt{render(){this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const n=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=Ei(s,[...this._path,o],n[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const c=Array.isArray(this._value)?this._value.slice():[];c[o]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}he("schema-form-tuple",Fc);class Bc extends pt{render(){this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const n=this._schema.dict||{};Object.keys(n).forEach(s=>{if(n[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=Ei(n[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const c={...this._value??{}};c[s]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}he("schema-form-object",Bc);const On=class On extends pt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+On._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const i={};return e.querySelectorAll(".row").forEach(r=>{const n=r.dataset.uid;n&&(i[n]=r.getBoundingClientRect())}),i}playFLIP(e,i){Array.from(e.querySelectorAll(".row")).forEach(r=>{const n=r.dataset.uid;if(!n)return;const s=i[n];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const n=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(c,u)=>{r.innerHTML="",s().forEach((f,d)=>{const b=[...this._path,d],g=document.createElement("div");g.className="row schema-collection-row";const E=this._itemIds[d];g.dataset.uid=E,g.setAttribute("data-path",lr(b));const D=Ei(n,b,f,`${this._label??""}[${d}]`);D.addEventListener("change",m=>{m.stopPropagation();const _=s().slice();_[d]=m.detail.value,this._value=_,this.emitChange(_)});const k=document.createElement("div");k.className="actions";const B=document.createElement("button");B.type="button",B.className="btn",B.textContent=this._i18n.arrayMoveUp??"↑",B.onclick=()=>{if(d<=0)return;const m=this.capturePositions(r),_=s().slice();[_[d-1],_[d]]=[_[d],_[d-1]],[this._itemIds[d-1],this._itemIds[d]]=[this._itemIds[d],this._itemIds[d-1]],this._value=_,o(m),this.emitChange(_)};const p=document.createElement("button");p.type="button",p.className="btn",p.textContent=this._i18n.arrayMoveDown??"↓",p.onclick=()=>{const m=s();if(d>=m.length-1)return;const _=this.capturePositions(r),x=m.slice();[x[d+1],x[d]]=[x[d],x[d+1]],[this._itemIds[d+1],this._itemIds[d]]=[this._itemIds[d],this._itemIds[d+1]],this._value=x,o(_),this.emitChange(x)};const h=document.createElement("button");h.type="button",h.className="btn danger",h.textContent=this._i18n.arrayRemove??"×",h.onclick=()=>{g.classList.add("leaving");const m=250;let _=!1;const x=()=>{if(_)return;_=!0,clearTimeout(P);const R=s().filter((ge,Ht)=>Ht!==d);this._itemIds.splice(d,1);const F=this.capturePositions(r);this._value=R,o(F),this.emitChange(R)};g.addEventListener("transitionend",x,{once:!0});const P=setTimeout(x,m+80)},k.append(B,p,h),g.appendChild(D),g.appendChild(k),r.appendChild(g),u&&u===E&&(g.classList.add("enter"),requestAnimationFrame(()=>{g.classList.add("enter-active")}),requestAnimationFrame(()=>{g.classList.remove("enter")}))}),c&&this.playFLIP(r,c)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const c=this.capturePositions(r),u=s().slice(),f=ki(n);u.push(f);const d=this.generateItemId();this._itemIds.push(d),this._value=u,o(c,d),this.emitChange(u)};const l=document.createElement("div");l.className="actions",l.appendChild(a),i.appendChild(r),i.appendChild(l),this.$root.appendChild(i)}};On._idCounter=0;let yn=On;he("schema-form-array",yn);class qc extends pt{render(){this.$root.innerHTML=`<style>${We}</style>`;const e=et(this._schema),i=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const n=this._schema.inner,s=this._value??{},o=d=>`d_${d}`,a=()=>{const d={};return r.querySelectorAll(".kv").forEach(b=>{const g=b.dataset.uid;g&&(d[g]=b.getBoundingClientRect())}),d},l=d=>{r.querySelectorAll(".kv").forEach(b=>{const g=b.dataset.uid;if(!g)return;const E=d[g];if(!E)return;const D=b.getBoundingClientRect(),k=E.left-D.left,B=E.top-D.top;(k||B)&&(b.style.transition="none",b.style.transform=`translate(${k}px, ${B}px)`,requestAnimationFrame(()=>{b.style.transition="transform .25s ease",b.style.transform=""}))})},c=(d,b)=>{r.innerHTML="",Object.keys(s).forEach(g=>{const E=[...this._path,g],D=document.createElement("div");D.className="kv schema-collection-row",D.dataset.uid=o(g),D.setAttribute("data-path",lr(E));const k=document.createElement("input");k.className="input",k.value=g,k.name=ti(E)+".__key",k.id=Bt(E)+"__key";const B=Ei(n,E,s[g],`${this._label??""}[${g}]`),p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.dictRemove??"×",p.onclick=()=>{const h=a();delete s[g];const m={...this._value??{}};delete m[g],this._value=m,c(h),this.emitChange(m)},k.onchange=()=>{const h=k.value.trim();if(!h||h===g||s[h]!==void 0)return;const m=a();s[h]=s[g],delete s[g];const _={...this._value??{}};_[h]=_[g],delete _[g],this._value=_,c(m),this.emitChange(_)},B.addEventListener("change",h=>{h.stopPropagation();const m={...this._value??{}};m[g]=h.detail.value,this._value=m,this.emitChange(m)}),D.append(k,B,p),r.appendChild(D),b===g&&(D.classList.add("enter"),requestAnimationFrame(()=>D.classList.add("enter-active")),requestAnimationFrame(()=>D.classList.remove("enter")))}),d&&l(d)};c();const u=document.createElement("button");u.type="button",u.className="btn primary",u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let d=Object.keys(s).length+1,b=`k${d}`;for(;s[b]!==void 0;)b=`k${++d}`;const g=a();s[b]=ki(n);const E={...this._value??{},[b]:s[b]};this._value=E,c(g,b),this.emitChange(E)};const f=document.createElement("div");f.className="actions",f.appendChild(u),i.appendChild(r),i.appendChild(f),this.$root.appendChild(i)}}he("schema-form-dict",qc);class Hc extends HTMLElement{constructor(){super(),this._i18n={...Tc},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=We,this.$root.appendChild(e);const i=document.createElement("div");i.className="wrapper",i.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(i),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:n,value:s}=r.detail;Array.isArray(n)&&n.length===0?this._state=s:eg(this._state??(this._state={}),n,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:n,value:s,state:this._state}}))})}set schema(e){this._schema=Ic(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=ki(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,i={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=i.validate?this._schema(e??null,{autofix:i.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const i=this._state;return e.validate?this._schema(i??null,{autofix:e.autofix}):i}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=ki(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18n={...this._i18n,...e},this.render()}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const i=Ei(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(i)}}he("schema-form",Hc);function ng(){he("schema-form",Hc),he("schema-form-string",Lc),he("schema-form-number",Nc),he("schema-form-boolean",Mc),he("schema-form-date",Dc),he("schema-form-const",jc),he("schema-form-union",Uc),he("schema-form-tuple",Fc),he("schema-form-object",Bc),he("schema-form-array",yn),he("schema-form-dict",qc)}const sg=kl({__name:"SchemasteryFormVue",props:Il({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Il(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:i}){const r=ec(t,"schema"),n=ec(t,"value"),s=i,o=Sp("elRef");let a=!1,l=!1;const c=u=>{if(l)return;const f=o.value,d=t.validateOnChange?f.getData({validate:!0}):u.detail.state;a=!0,n.value=d,rn(()=>{a=!1}),s("change",u.detail)};return Ol(()=>{ng()}),qs(()=>{const u=o.value;r.value&&(u.schema=r.value),n.value!==void 0&&u.setData(n.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",c)}),Al(()=>{o.value?.removeEventListener("form-change",c)}),_i(()=>r,u=>{a||o.value&&u&&o.value.schema!==u.value&&(l=!0,o.value.schema=u.value,rn(()=>{l=!1}))},{deep:!0,immediate:!0}),_i(()=>n,u=>{if(a||!o.value||u.value===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(u.value)&&(l=!0,o.value.setData(u.value,{validate:!1}),rn(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(u,f){const d=o.value;d.setData(u,{validate:!!f?.validate}),f?.emit&&(n.value=d.getData({validate:!!f?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,f=!0){o.value.schema=u,f&&(r.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,f)=>(Ut(),xi("schema-form",fc({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function ii(t,e=new WeakMap){if(we(t))return ii(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const n=new Map;return e.set(t,n),Array.from(t.entries()).forEach(([s,o])=>{n.set(s,ii(o,e))}),n}if(t instanceof Set){const n=new Set;return e.set(t,n),Array.from(t).forEach(s=>{n.add(ii(s,e))}),n}if(Array.isArray(t)){const n=[];e.set(t,n);for(const s of t)n.push(ii(s,e));return n}const i=J(t),r={};e.set(t,r);for(const n of Object.keys(i))r[n]=ii(i[n],e);for(const n of Object.getOwnPropertySymbols(i))r[n]=ii(i[n],e);return r}const og={class:"preferences-ui-app"},ag={class:"tabs"},lg=["onClick","data-value"],cg={key:0},ug={style:{"max-height":"20em",overflow:"auto"}},fg=((t,e)=>{const i=t.__vccOpts||t;for(const[r,n]of e)i[r]=n;return i})(kl({__name:"PreferencesForm",setup(t,{expose:e}){const i=Jm(),r=!1,n=pl([]),s=pl(""),o=Xr([]),a=yc(()=>o.value.map(u=>u.schema)),l=Xr({}),c=Xr({});return e({getValue(){return ii(c)}}),_i(s,u=>{u&&(l.value=c.value,o.value=i.preferences.getConfigRegistries(u))},{immediate:!0}),qs(async()=>{i.inject(["preferences"],async u=>{const f=await u.preferences.getAll();l.value=c.value=f,n.value=u.preferences.getConfigCategories(),s.value=n.value[0].name})}),(u,f)=>(Ut(),xi("div",og,[hn("div",ag,[(Ut(!0),xi(Ze,null,Rl(n.value,d=>(Ut(),xi("a",{class:Hr(["tab",{active:s.value===d.name}]),key:d.name,onClick:b=>s.value=d.name,"data-value":d.name},Ss(d.label),11,lg))),128))]),(Ut(!0),xi(Ze,null,Rl(a.value,(d,b)=>(Ut(),lc(js(sg),{key:`${s.value}-${b}`,schema:d,value:l.value,"onUpdate:value":f[0]||(f[0]=g=>c.value=g),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),js(r)?(Ut(),xi("details",cg,[hn("pre",ug,Ss(c.value),1)])):dm("",!0)]))}}),[["__scopeId","data-v-cd93309f"]]),hg=window?.location?.origin,dg=({type:t,tag:e,href:i,target:r,children:n,...s})=>(e=e||(i?"a":"button"),typeof r>"u"&&i&&i.startsWith("http")&&!i.startsWith(hg)&&(r="_blank"),lh(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?i:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?i:void 0,...s},n));var pg=Object.create,co=Object.defineProperty,mg=Object.getOwnPropertyDescriptor,zc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Wc=t=>{throw TypeError(t)},gg=(t,e,i)=>e in t?co(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,yg=(t,e)=>co(t,"name",{value:e,configurable:!0}),bg=t=>[,,,pg(t?.[zc("metadata")]??null)],wg=["class","method","getter","setter","accessor","field","value","get","set"],Kc=t=>t!==void 0&&typeof t!="function"?Wc("Function expected"):t,vg=(t,e,i,r,n)=>({kind:wg[t],name:e,metadata:r,addInitializer:s=>i._?Wc("Already initialized"):n.push(Kc(s||null))}),_g=(t,e)=>gg(e,zc("metadata"),t[3]),xg=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Sg=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&mg(n,i));yg(n,i);for(var g=r.length-1;g>=0;g--)l=vg(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,Kc(o)&&(n=o);return _g(t,n),b&&co(n,i,b),u?c^4?s:b:n},Vc,uo,Gc;Vc=[Se(["preferences","modal"])];class bn extends(Gc=Xe){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.preferences.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),e.preferences.registerCustomConfig("about",re.object({about:re.const(y("div",{className:"prose",children:[y("h2",{children:"✏️ InPageEdit NEXT"}),y("i",{children:["v",this.ctx.version]}),y("h2",{children:"Portals"}),y("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[y("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),y(dg,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),y("h2",{children:"Join us"}),y("ul",{children:[y("li",{children:[y("strong",{children:"GitHub"}),":"," ",y("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),y("li",{children:[y("strong",{children:"QQ Group"}),": 1026023666"]})]}),y("hr",{}),y("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),y("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about"),e.inject(["toolbox"],i=>{i.toolbox.addButton({id:"preferences",icon:y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[y("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),y("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:"Configure Preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(r=>{r.toolbox.removeButton("preferences")})})}stop(){}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:`InPageEdit Preferences (${this.ctx.version})`,content:y(xt,{children:y(Rt,{})})});e.get$window().classList.add("dialog");const i=y("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(i);const r=this.createForm(),n=r.mount(i);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=n.getValue();this.logger.info("saving preferences",s);try{Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)})}catch(o){this.logger.error("failed to save preferences",o)}e.close(),this.ctx.modal.notify("success",{title:"Preferences Saved",content:y("p",{children:"Some settings may take effect after reloading the page."})})}}]),e.on(e.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount()})}createForm(){return Zm(this.ctx,fg)}}uo=bg(Gc),bn=Sg(uo,0,"PluginPreferencesUI",Vc,bn),xg(uo,1,bn);const kg=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return bn}},Symbol.toStringTag,{value:"Module"})),Eg=Symbol("@@apply"),$g=Symbol("@@ctor");function fo(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const i=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};i[Eg]=i,i[$g]=t;const r=t?.constructor?.name;return r&&(i[Symbol.toStringTag]=r),new Proxy(i,{get(s,o,a){return o==="prototype"?Reflect.get(i,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const wn={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},ur=t=>{const{type:e="default",title:i,content:r,closeable:n=!0,titleProps:s,contentProps:o,children:a,...l}=t;let c=i;typeof i>"u"&&e!=="default"&&(c=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!f)return Promise.resolve();const{promise:d,resolve:b}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),b()}),d},f=y("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${wn.mbox}`,...l,children:[c&&y("div",{className:`ipe-mbox-title ${wn.title}`,...s,children:c}),y("div",{className:`ipe-mbox-content ${wn.content}`,...o,children:a||r}),n&&y("a",{onClick:u,className:`ipe-mbox-close ${wn.close}`,children:"×"})]});return f.close=u,f},fr=t=>{const{label:e,id:i,name:r,value:n,disabled:s,labelProps:o,inputProps:a,...l}=t;return y("div",{className:"theme-ipe ipe-input-box",...l,children:[y("label",{htmlFor:i,style:{display:"block"},...o,children:e}),y("input",{id:i,name:r,value:n,disabled:s,style:{width:"100%"},...a})]})},Pg=t=>{const{id:e,name:i,value:r,label:n,inputProps:s,labelProps:o,children:a,...l}=t;return y("label",{className:"theme-ipe ipe-radio-box",...l,children:[y("input",{type:"radio",id:e,name:i,value:r,...s}),y("span",{className:"ipe-checkbox-box"}),y("span",{...o,children:n||a})]})},$i=t=>{const{id:e,name:i,label:r,checked:n,inputProps:s,labelProps:o,children:a,...l}=t;return y("label",{className:"theme-ipe ipe-checkbox",...l,children:[y("input",{type:"checkbox",id:e,name:i,checked:n,...s}),y("span",{className:"ipe-checkbox-box"}),y("span",{...o,children:r||a})]})},ho=()=>{},Cg=(t=0)=>new Promise(e=>setTimeout(e,t));var Og=Object.create,po=Object.defineProperty,Ag=Object.getOwnPropertyDescriptor,Qc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Yc=t=>{throw TypeError(t)},Tg=(t,e,i)=>e in t?po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Rg=(t,e)=>po(t,"name",{value:e,configurable:!0}),Ig=t=>[,,,Og(t?.[Qc("metadata")]??null)],Lg=["class","method","getter","setter","accessor","field","value","get","set"],Xc=t=>t!==void 0&&typeof t!="function"?Yc("Function expected"):t,Ng=(t,e,i,r,n)=>({kind:Lg[t],name:e,metadata:r,addInitializer:s=>i._?Yc("Already initialized"):n.push(Xc(s||null))}),Mg=(t,e)=>Tg(e,Qc("metadata"),t[3]),Dg=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},jg=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&Ag(n,i));Rg(n,i);for(var g=r.length-1;g>=0;g--)l=Ng(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,Xc(o)&&(n=o);return Mg(t,n),b&&po(n,i,b),u?c^4?s:b:n},Jc,mo,Zc;Jc=[Se(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),hi(re.object({"quickEdit.editSummary":re.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":re.boolean().description("Whether to mark the edit as minor").default(!1),"quickEdit.outSideClose":re.boolean().description("Whether to close the modal outside").default(!0),"quickEdit.watchList":re.union([re.const(Ye.preferences).description("Follow my preferences"),re.const(Ye.nochange).description("Keep the current watchlist status"),re.const(Ye.watch).description("Add the page to watchlist"),re.const(Ye.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(Ye.preferences),"quickEdit.keyshortcut.save":re.string().default("ctrl-s").description("save button key shortcut (blank to disable)")}).description("Quick edit options").extra("category","edit"))];class vn extends(Zc=Xe){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0},this.ctx.root.set("quickEdit",fo(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const k=new URLSearchParams(window.location.search),B=this.ctx.currentPage.wikiTitle;e={...e,title:B?.getPrefixedDBKey(),revision:k.has("oldid")?Number(k.get("oldid")):void 0,pageId:k.has("curid")?Number(k.get("curid")):void 0}}if(!e.revision&&!e.pageId&&e.title){const k=this.ctx.wikiTitle.resolveSpecialPageTarget(e.title);k&&k.title.getNamespaceId()>=0&&(e.title=k.title.getPrefixedDBKey(),e.section??(e.section=k.section))}const i=await this.ctx.preferences.get("quickEdit.outSideClose"),r=await this.ctx.preferences.get("quickEdit.watchList"),n=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("quickEdit.editSummary"),s=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("quickEdit.editMinor"),o={...this.DEFAULT_OPTIONS,editSummary:n,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:i}).init();a.setTitle(y(xt,{children:["Loading: ",y("u",{children:o.title})]})),a.setContent(y("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:y(Rt,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:a,options:o});let l;try{if(l=await this.getWikiPageFromPayload(o),l.pageInfo.special)throw new Error("Special page is not editable")}catch(k){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:k instanceof Error?k.message:String(k)});return}const c=o.section==="new"?"":l.revisions[0]?.content||"",u=l.revisions[0]?.revid,f=u&&u!==l.lastrevid,d=o.section==="new",b=l.pageid===0;a.setTitle(y(xt,{children:[d?"New section":`Quick ${b?"Create":"Edit"}`,":"," ",y("u",{children:l.pageInfo.title}),f?` (Revision ${u})`:""]}));const g=[];b&&g.push(y(ur,{title:"Attention",type:"important",children:y("p",{children:"This page does not exist."})})),f&&g.push(y(ur,{title:"Attention",type:"warning",children:y("p",{children:["You are editing a ",y("em",{children:"historical version"}),"; the content is not the latest!"]})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:o,modal:a,wikiPage:l,editNotices:g});const E=y("form",{className:"ipe-quickEdit__form",children:[y("div",{className:"ipe-quickEdit__notices",children:g}),y("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.section==="new"&&y(xt,{children:y(fr,{label:"Section title",id:"summary",name:"summary",value:"",inputProps:{placeholder:"Topic for new section, this will be the h2 heading"}})}),y("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:c})]}),y("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[!d&&y(fr,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),y("div",{className:"ipe-input-box",children:[y("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),y("div",{style:{display:"flex",gap:"1rem"},children:[Ye.preferences,Ye.nochange,Ye.watch,Ye.unwatch].map(k=>y(Pg,{name:"watchlist",value:k,inputProps:{checked:r===k},children:k},k))})]}),y("div",{style:{display:"flex",gap:"1rem"},children:[y($i,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),y($i,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(E),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:()=>{const k=new FormData(E);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:k.get("text"),summary:k.get("summary"),minor:k.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:ho}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),k.get("reloadAfterSave")&&(await Cg(500),location.reload())}).catch(B=>{this.ctx.modal.notify("error",{title:"Submission Error",content:B instanceof Error?B.message:String(B)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const k=l.revisions[0]?.content||"";return(E.querySelector("textarea")?.value||"")===k?!0:(this.ctx.modal.confirm({className:"is-primary",title:"Unsaved Changes",content:"All edit contents will be lost after closing the modal. Are you sure you want to close?",center:!0,okBtn:{label:"Give Up",className:"is-danger is-ghost"},cancelBtn:{label:"Continue Editing",className:"is-primary is-ghost"}},p=>(p&&(a.setOptions({beforeClose:ho}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const D=k=>E.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(k.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",D),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",D)})}async handleSubmit(e){const i=e.wikiPage,r=e.summary||"",n=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return i.edit({summary:r,text:n,watchlist:a,section:l},{minor:s,createonly:o})}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}async injectToolbox(e){const i=this.ctx.currentPage.wikiTitle,r=this.ctx.wiki.hasRight("edit")&&i&&i.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[y("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),y("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),y("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),y("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Edit":"Not editable",onClick:()=>{const n=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:i?.getPrefixedText(),revision:n?Number(n):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}mo=Ig(Zc),vn=jg(mo,0,"PluginQuickEdit",Jc,vn),Dg(mo,1,vn);const Ug=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return vn}},Symbol.toStringTag,{value:"Module"}));var Fg=Object.create,go=Object.defineProperty,Bg=Object.getOwnPropertyDescriptor,eu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),tu=t=>{throw TypeError(t)},qg=(t,e,i)=>e in t?go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Hg=(t,e)=>go(t,"name",{value:e,configurable:!0}),zg=t=>[,,,Fg(t?.[eu("metadata")]??null)],Wg=["class","method","getter","setter","accessor","field","value","get","set"],iu=t=>t!==void 0&&typeof t!="function"?tu("Function expected"):t,Kg=(t,e,i,r,n)=>({kind:Wg[t],name:e,metadata:r,addInitializer:s=>i._?tu("Already initialized"):n.push(iu(s||null))}),Vg=(t,e)=>qg(e,eu("metadata"),t[3]),Gg=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Qg=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&Bg(n,i));Hg(n,i);for(var g=r.length-1;g>=0;g--)l=Kg(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,iu(o)&&(n=o);return Vg(t,n),b&&go(n,i,b),u?c^4?s:b:n},ru,yo,nu;ru=[Se(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),hi(re.object({deleteReason:re.string().description("Default delete reason for quick delete").default("[IPE-NEXT] Quick delete")}).description("Quick delete options").extra("category","delete"))];class _n extends(nu=Xe){constructor(e){super(e,{},"quick-delete"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,deleteReason:"",reloadAfterDelete:!0},this.ctx.root.set("quickDelete",fo(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.preferences.defineCategory({label:"Delete",name:"delete",description:"Settings related to deleting pages",index:3})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const l=new URLSearchParams(window.location.search),c=this.ctx.currentPage.wikiTitle;e={...e,title:c?.getPrefixedDBKey(),revision:l.has("oldid")?Number(l.get("oldid")):void 0,pageId:l.has("curid")?Number(l.get("curid")):void 0}}const i=typeof e.deleteReason=="string"?e.deleteReason:await this.ctx.preferences.get("deleteReason"),r={...this.DEFAULT_OPTIONS,deleteReason:i,...e};r.deleteReason||(r.deleteReason=await this.ctx.preferences.get("deleteReason")||""),r||this.ctx.emit("quick-delete/init-options",{ctx:this.ctx,options:r});const n=this.ctx.modal.createObject({className:"ipe-quickDelete",sizeClass:"small",center:!0}).init();n.setTitle(y(xt,{children:["Loading: ",y("u",{children:r.title})]})),n.setContent(y(Rt,{})),n.addButton({side:"right",type:"button",className:"is-ghost",label:"Cancel",method(){n.close()}}),n.show(),this.ctx.emit("quick-delete/show-modal",{ctx:this.ctx,modal:n,options:r});let s;try{if(s=await this.getWikiPageFromPayload(r),s.pageInfo.special)throw new Error("Special page cannot be deleted");if(s.pageInfo.pageid===0)throw new Error("Page does not exist, cannot be deleted")}catch(l){n.off(n.Event.Close),n.close(),this.ctx.modal.notify("error",{content:l instanceof Error?l.message:String(l)});return}n.setTitle(y(xt,{children:["Quick Delete: ",y("u",{children:s.pageInfo.title})]}));const o=[];s.userCan("delete")||o.push(y(ur,{title:"Permission Denied",type:"error",children:y("p",{children:"You do not have permission to delete this page."})})),s.pageInfo.protection&&s.pageInfo.protection.length>0&&o.push(y(ur,{title:"Warning",type:"warning",children:y("p",{children:"This page is protected and may has special use or purpose. Delete it at your own risk."})})),this.ctx.emit("quick-delete/delete-notice",{ctx:this.ctx,options:r,modal:n,wikiPage:s,deleteNotices:o});const a=y("form",{className:"ipe-quickDelete__form",children:[y("div",{className:"ipe-quickDelete__notices",children:o}),y("div",{className:"ipe-quickDelete__content",children:y("div",{className:"ipe-quickDelete__page-info",style:{padding:"1rem",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"1rem"},children:y("ul",{children:[y("li",{children:[y("strong",{children:"Title:"})," ",s.pageInfo.title]}),y("li",{children:[y("strong",{children:"Page ID:"})," ",s.pageInfo.pageid]}),y("li",{children:[y("strong",{children:"Last Revision:"})," ",s.pageInfo.lastrevid]}),y("li",{children:[y("strong",{children:"Length:"})," ",s.pageInfo.length," characters"]})]})})}),y("div",{class:"ipe-quickDelete__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:y(fr,{label:"Delete Reason",id:"reason",name:"reason",value:r.deleteReason,inputProps:{placeholder:"Enter reason for deletion...",required:!0}})}),!1]});n.setContent(a),n.addButton({side:"left",className:"is-danger submit-btn",label:"Delete Page",method:()=>{const c=new FormData(a).get("reason");if(!c||c.trim()===""){this.ctx.modal.notify("error",{title:"Missing Reason",content:"Please provide a reason for deletion."});return}this.ctx.modal.confirm({className:"is-danger",title:"Confirm Deletion",content:y(xt,{children:y("p",{children:y("strong",{children:s.pageInfo.title})})}),center:!0,okBtn:{label:"Delete it now",className:"is-danger"},cancelBtn:{label:"Cancel",className:"is-ghost"}},u=>(u&&(n.setLoadingState(!0),this.handleSubmit({wikiPage:s,reason:c}).then(async()=>{n.setOptions({beforeClose:ho}),n.close(),this.ctx.modal.notify("success",{title:"Deletion Successful",content:`The page "${s.pageInfo.title}" has been deleted.`})}).catch(f=>{this.ctx.modal.notify("error",{title:"Deletion Error",content:f instanceof Error?f.message:String(f)}),n.setLoadingState(!1)})),!0))}},0),this.ctx.emit("quick-delete/wiki-page",{ctx:this.ctx,options:r,modal:n,wikiPage:s})}async handleSubmit(e){const i=e.wikiPage,r=e.reason||"";return i.delete(r)}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1);throw new Error("Invalid payload")}async injectToolbox(e){const i=this.ctx.currentPage.wikiTitle,r=i&&this.ctx.wiki.hasRight("delete")&&i.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-delete",group:"group2",icon:y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash",children:[y("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),y("path",{d:"M4 7l16 0"}),y("path",{d:"M10 11l0 6"}),y("path",{d:"M14 11l0 6"}),y("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),y("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Delete":"Not deletable",onClick:()=>{this.showModal({title:i?.getPrefixedText()})}})}removeToolbox(e){e.toolbox.removeButton("quick-delete")}}yo=zg(nu),_n=Qg(yo,0,"PluginQuickDelete",ru,_n),Gg(yo,1,_n);const Yg=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDelete(){return _n}},Symbol.toStringTag,{value:"Module"})),hr={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},su=t=>{const{inputs:e,enableSwap:i=!0,...r}=t,n=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const c=()=>s.some(g=>g&&g.disabled),u=()=>{if(!s[0]||!s[1]||c())return;const g=s[0],E=s[1],D=g.value,k=E.value;g.value=k,E.value=D,g.dispatchEvent(new Event("change")),E.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=g=>{if(!a)return;const E=g??!a.disabled;a.disabled=!E,E&&s.forEach(D=>{D&&(D.disabled=!1)})},d=y("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:c()||!i,ref:g=>a=g,children:y("svg",{ref:g=>l=g,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[y("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),y("path",{d:"M20 10h-16l5.5 -6"}),y("path",{d:"M4 14h16l-5.5 6"})]})}),b=y("div",{className:`twin-swap-input ${hr.twinSwapInput}`,...r,children:[n.map((g,E)=>{const{label:D,id:k,name:B,value:p,disabled:h,required:m,inputProps:_}=g,x=E===0,P=k||B;return y("div",{className:`${hr.inputWrapper} ${x?hr.inputLeft:hr.inputRight}`,children:[D&&y("label",{htmlFor:P,children:D}),y("input",{ref:R=>s[E]=R,type:"text",id:P,name:B,value:p,disabled:h,required:m,..._})]})}),y("div",{className:hr.swapButton,children:d})]});return b.swap=u,b.toggleEnableSwap=f,b};var Xg=Object.create,bo=Object.defineProperty,Jg=Object.getOwnPropertyDescriptor,ou=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),au=t=>{throw TypeError(t)},Zg=(t,e,i)=>e in t?bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ey=(t,e)=>bo(t,"name",{value:e,configurable:!0}),ty=t=>[,,,Xg(t?.[ou("metadata")]??null)],iy=["class","method","getter","setter","accessor","field","value","get","set"],lu=t=>t!==void 0&&typeof t!="function"?au("Function expected"):t,ry=(t,e,i,r,n)=>({kind:iy[t],name:e,metadata:r,addInitializer:s=>i._?au("Already initialized"):n.push(lu(s||null))}),ny=(t,e)=>Zg(e,ou("metadata"),t[3]),sy=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},oy=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&Jg(n,i));ey(n,i);for(var g=r.length-1;g>=0;g--)l=ry(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,lu(o)&&(n=o);return ny(t,n),b&&bo(n,i,b),u?c^4?s:b:n},cu,wo,uu;cu=[Se(["modal","wiki"])];class xn extends(uu=Xe){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this.quickMove.bind(this)),e.set("movePage",this.movePage.bind(this))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const i=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[y("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),y("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),y("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),y("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),y("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),y("path",{d:"M17 12h.01"}),y("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group1",index:1,onClick:()=>{this.quickMove(r?{lockFromField:!0,from:i}:{})}})}quickMove(e){const i=this.ctx.modal.createObject({title:"Quick Move",content:y(Rt,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return i.setContent(y("form",{ref:n=>r=n,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:n=>{if(n.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",movetalk:s.get("movetalk")==="on",movesubpages:s.get("movesubpages")==="on",noredirect:s.get("noredirect")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to move",content:"From and to are required."});return}i.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{i.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[y(su,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),y("div",{children:y($i,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),y("div",{children:y($i,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.wiki.hasRight("suppressredirect")&&y("div",{children:y($i,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),y(fr,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),i.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),i.show()}async movePage(e){const{from:i,to:r,reason:n="",...s}=e;if(!i||!r)throw new Error("From and to titles are required.");if(i===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(i)).moveTo(r,n,s)}}wo=ty(uu),xn=oy(wo,0,"PluginQuickMove",cu,xn),sy(wo,1,xn);const ay=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return xn}},Symbol.toStringTag,{value:"Module"}));var ly=Object.create,vo=Object.defineProperty,cy=Object.getOwnPropertyDescriptor,fu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),hu=t=>{throw TypeError(t)},uy=(t,e,i)=>e in t?vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,fy=(t,e)=>vo(t,"name",{value:e,configurable:!0}),hy=t=>[,,,ly(t?.[fu("metadata")]??null)],dy=["class","method","getter","setter","accessor","field","value","get","set"],du=t=>t!==void 0&&typeof t!="function"?hu("Function expected"):t,py=(t,e,i,r,n)=>({kind:dy[t],name:e,metadata:r,addInitializer:s=>i._?hu("Already initialized"):n.push(du(s||null))}),my=(t,e)=>uy(e,fu("metadata"),t[3]),gy=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},yy=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&cy(n,i));fy(n,i);for(var g=r.length-1;g>=0;g--)l=py(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,du(o)&&(n=o);return my(t,n),b&&vo(n,i,b),u?c^4?s:b:n},pu,_o,mu;pu=[Se(["api","wikiPage","modal","preferences"]),hi(re.object({"quickPreview.keyshortcut":re.string().default("ctrl-p").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","edit").description("Quick preview options"))];class Sn extends(mu=Xe){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",fo(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.on("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}stop(){}previewWikitext(e,i,r,n,s){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!n||n.isDestroyed)&&(n=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),n.show(),n.setTitle("Preview - Loading..."),n.setContent(y(Rt,{})),n.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:n,wikiPage:r}),r.preview(e,i).then(o=>{const{data:{parse:a}}=o;n.setTitle(`Preview - ${a.title}`);let l=null;n.setContent(y("section",{children:y("div",{ref:c=>l=c,className:"mw-parser-output",innerHTML:a.text})})),window.mw?.hook("wikipage.content").fire($(l)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:n,wikiPage:r,text:e,parseData:a})}).catch(o=>{n.setTitle("Preview - Failed"),n.setContent(y(xt,{children:[y("p",{children:"Failed to preview"}),y("p",{children:o instanceof Error?o.message:String(o)})]}))}),n}async injectQuickEdit({options:e,modal:i,wikiPage:r}){let n;i.addButton({label:"Preview",side:"left",className:"btn btn-secondary",keyPress:await this.ctx.preferences.get("quickPreview.keyshortcut.quickEdit")||void 0,method:()=>{let s=i.get$content().querySelector('textarea[name="text"]')?.value||"";if(e.section==="new"){const o=i.get$content().querySelector('input[name="summary"]')?.value;o&&(s=`==${o}==
|
|
114
|
-
${s}`)}n=this.previewWikitext(s,void 0,r,n,{backdrop:!1,draggable:!0})}},1),i.on(i.Event.Close,()=>{n?.destroy(),n=void 0})}injectQuickDelete({ctx:e,modal:i,wikiPage:r}){i.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{this.logger.warn("To be implemented: preview wikitext for quick delete")}},2)}}_o=hy(mu),Sn=yy(_o,0,"PluginQuickPreview",pu,Sn),gy(_o,1,Sn);const by=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return Sn}},Symbol.toStringTag,{value:"Module"})),wy=t=>{let{user:e,target:i,ctx:r}=t;const n=r.getUrl.bind(r);return y("span",{className:"mw-userlinks",children:[y("a",{href:n(`User:${e}`),className:"mw-userlink",target:i,children:e})," ",y("span",{className:"mw-usertoollinks",children:["(",y("a",{href:n(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:i,children:"talk"})," | ",y("a",{href:n(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:i,children:"contribs"})," | ",y("a",{href:n(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:i,children:"block"}),")"]})]})};var kn=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(kn||{});const vy=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,gu=t=>{let e=["diff-title"];if(t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid)return y("td",{colSpan:2,className:e,children:y("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const i=r=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return y("td",{colSpan:2,className:e,children:[y("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),y("div",{className:"mw-diff-title--actions",children:y("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:i,children:[y(Ia,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),y("div",{className:"mw-diff-title--user",children:t.username&&y(wy,{ctx:t.ctx,user:t.username,target:"_blank"})}),y("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&vy(new Date(t.timestamp))}),y("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&y(xt,{children:["(",y("i",{innerHTML:t.parsedcomment}),")"]})})]})},_y=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const i=(r,n,s)=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:n,torev:s},bubbles:!0}))};return y("tr",{className:"mw-diff-title--navigation",children:[y("td",{colSpan:2,children:e.prev?y("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:r=>i(r,e.prev,e.fromrevid),children:"← Previous"}):y("i",{children:"Oldest version"})}),y("td",{colSpan:2,children:e.next?y("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:r=>i(r,e.torevid,e.next),children:"Next →"}):y("i",{children:"Newest version"})})]})},xy=t=>{const{data:e,...i}=t,r=y("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...i,children:[y("colgroup",{children:[y("col",{className:"diff-marker"}),y("col",{className:"diff-content"}),y("col",{className:"diff-marker"}),y("col",{className:"diff-content"})]}),y("tbody",{children:[y("tr",{children:[y(gu,{ctx:t.ctx,type:"from",pageid:e.fromid,pagetitle:e.fromtitle,revid:e.fromrevid,size:e.fromsize,timestamp:e.fromtimestamp,username:e.fromuser,userid:e.fromuserid,comment:e.fromcomment,parsedcomment:e.fromparsedcomment}),y(gu,{ctx:t.ctx,type:"to",pageid:e.toid,pagetitle:e.totitle,revid:e.torevid,size:e.tosize,timestamp:e.totimestamp,username:e.touser,userid:e.touserid,comment:e.tocomment,parsedcomment:e.toparsedcomment})]}),y(_y,{data:e,ctx:t.ctx}),y("div",{id:"diffbody"}),y("tr",{className:"diff-size",style:{textAlign:"center"},children:[y("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),y("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||y("tr",{children:y("td",{colSpan:4,children:y("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:y("i",{children:"No changes"})})})}).outerHTML,r},Sy=(t,e=document)=>e.querySelector(t),ky=(t,e=document)=>e.querySelectorAll(t);var Ey=Object.create,xo=Object.defineProperty,$y=Object.getOwnPropertyDescriptor,yu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),bu=t=>{throw TypeError(t)},Py=(t,e,i)=>e in t?xo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Cy=(t,e)=>xo(t,"name",{value:e,configurable:!0}),Oy=t=>[,,,Ey(t?.[yu("metadata")]??null)],Ay=["class","method","getter","setter","accessor","field","value","get","set"],wu=t=>t!==void 0&&typeof t!="function"?bu("Function expected"):t,Ty=(t,e,i,r,n)=>({kind:Ay[t],name:e,metadata:r,addInitializer:s=>i._?bu("Already initialized"):n.push(wu(s||null))}),Ry=(t,e)=>Py(e,yu("metadata"),t[3]),Iy=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Ly=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&$y(n,i));Cy(n,i);for(var g=r.length-1;g>=0;g--)l=Ty(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,wu(o)&&(n=o);return Ry(t,n),b&&xo(n,i,b),u?c^4?s:b:n},vu,So,_u;vu=[Se(["wiki","getUrl","preferences"]),hi(re.object({"quickDiff.keyshortcut":re.string().default("ctrl-d").description("Key shortcut to open quick diff in quick edit modal")}).description("Quick diff options").extra("category","edit"))];class En extends(_u=Xe){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.COMPARE_API_DEFAULT_OPTIONS={prop:["comment","diff","diffsize","ids","parsedcomment","size","timestamp","title","user","rel"].join("|"),difftype:"table"}}start(){this.ctx.set("quickDiff",this),this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){}injectHistoryPage(){const e=Sy("#mw-history-compare");if(!e)return;ky(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(y("button",{className:"cdx-button",onClick:n=>{n.preventDefault();const s=new FormData(e),o=Number(s.get("oldid"))||0,a=Number(s.get("diff"))||0;if(!s.get("title")||!o||!a)return this.logger.warn("Missing title or revision IDs");this.comparePages({fromrev:o,torev:a})},children:"Quick Diff"}))})}async injectQuickEdit({modal:e,wikiPage:i,options:r}){if(i.pageid===0||r.section==="new")return;let n;e.addButton({label:"Diff",side:"left",keyPress:await this.ctx.preferences.get("quickDiff.keyshortcut")||void 0,className:"btn btn-secondary",method:()=>{const s=i.title,o=i.revisions?.[0]?.content||"",a=e.get$content().querySelector('textarea[name="text"]')?.value||"";return o===a?this.ctx.modal.notify("info",{title:"Quick Diff",content:"No changes"}):(n=this.comparePages({fromtitle:s,fromtext:o,totitle:s,totext:a,topst:!0},n,{backdrop:!1,draggable:!0}),n)}},2),e.on(e.Event.Close,()=>{n?.destroy(),n=void 0})}comparePages(e,i,r){return!i||i.isDestroyed?i=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",center:!1,...r}).init():i.removeButton("*"),i.setContent(y("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:y(Rt,{})})),i.bringToFront(),window.mw&&mw.loader.getState("mediawiki.diff.styles")!=="ready"&&mw.loader.load(["mediawiki.diff.styles"]),this.ctx.api.post({...this.COMPARE_API_DEFAULT_OPTIONS,...e,action:"compare",format:"json",formatversion:2}).then(n=>{if(!n.data.compare)throw new Error("No compare data received",{cause:n});const{data:{compare:s}}=n;i.setTitle(s.fromtitle&&s.totitle?`${s.fromtitle}${s.fromrevid?` (${s.fromrevid})`:""} ⇔ ${s.totitle}${s.torevid?` (${s.torevid})`:""}`:"Differences");let o;i.setContent(y("section",{style:{minHeight:"70vh"},children:y(xy,{ref:a=>o=a,data:s,ctx:this.ctx})})),o.addEventListener(kn.update,a=>{a.stopPropagation(),this.comparePages({fromrev:a.detail.fromrev,torev:a.detail.torev},i,r)},{once:!0}),this.ctx.inject(["quickEdit"],a=>{const l=c=>{c.stopPropagation(),a.quickEdit({revision:c.detail.revid})};o.addEventListener(kn.edit,l),i.on(i.Event.Close,()=>{o.removeEventListener(kn.edit,l)})}),s.fromrevid&&s.torevid&&i.addButton({label:"Original Compare Page",side:"right",className:"btn btn-secondary",method:()=>{window.location.href=this.ctx.getUrl("",{oldid:s.fromrevid,diff:s.torevid})}})}).catch(n=>{i.setContent(y(ur,{title:"Failed to load diff",type:"error",children:y("pre",{children:n instanceof Error?n.message:String(n)})}))}),i.show()}}So=Oy(_u),En=Ly(So,0,"PluginQuickDiff",vu,En),Iy(So,1,En);const Ny=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDiff(){return En}},Symbol.toStringTag,{value:"Module"})),Co=class Co extends Xe{constructor(e){super(e,{},"quick-redirect"),this.ctx=e}start(){this.ctx.set("quickRedirect",this.quickRedirect.bind(this)),this.ctx.set("redirectPage",this.redirectPage.bind(this));const e=window.mw?.config.get("wgPageName")||"",i=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],r=>{this.ctx=r,r.toolbox.addButton({id:"quick-redirect",icon:y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink",children:[y("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),y("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),y("path",{d:"M9 17l3 -3l-3 -3"}),y("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),y("path",{d:"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5"})]}),tooltip:"Quick Redirect",group:"group1",index:2,onClick:()=>{this.quickRedirect(i?{to:e}:{})}}),this.addDisposeHandler(n=>{n.toolbox.removeButton("quick-redirect")})})}stop(){}quickRedirect(e){const i=this.ctx.modal.createObject({title:"Quick Redirect",content:y(Rt,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return i.setContent(y("form",{ref:n=>r=n,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:n=>{if(n.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",overwrite:s.get("overwrite")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to redirect",content:"From and to are required."});return}i.setLoadingState(!0),this.redirectPage(o).then(a=>{i.close(),this.ctx.modal.notify("success",{title:"Redirect successful",content:"The redirect has been created."})}).catch(a=>{i.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to redirect",content:a instanceof Error?a.message:String(a)})})},children:[y(su,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),y(fr,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),y("div",{children:y($i,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:"Force create redirect even if the from page already exists"})})]})),i.setButtons([{label:"Create Redirect",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),i.show()}async redirectPage(e){const{from:i,to:r,reason:n="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:i}),a=`#REDIRECT [[:${r}]]`;return o.edit({text:a,summary:n},{createonly:!s})}};Co.inject=["api","wikiPage","modal"];let ko=Co;const My=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:ko},Symbol.toStringTag,{value:"Module"}));var Dy=Object.create,Eo=Object.defineProperty,jy=Object.getOwnPropertyDescriptor,xu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Su=t=>{throw TypeError(t)},Uy=(t,e,i)=>e in t?Eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Fy=(t,e)=>Eo(t,"name",{value:e,configurable:!0}),By=t=>[,,,Dy(t?.[xu("metadata")]??null)],qy=["class","method","getter","setter","accessor","field","value","get","set"],ku=t=>t!==void 0&&typeof t!="function"?Su("Function expected"):t,Hy=(t,e,i,r,n)=>({kind:qy[t],name:e,metadata:r,addInitializer:s=>i._?Su("Already initialized"):n.push(ku(s||null))}),zy=(t,e)=>Uy(e,xu("metadata"),t[3]),Wy=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Ky=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),b=c&&(n=n.prototype,c<5&&(c>3||!u)&&jy(n,i));Fy(n,i);for(var g=r.length-1;g>=0;g--)l=Hy(c,i,a={},t[3],d),o=(0,r[g])(n,l),a._=1,ku(o)&&(n=o);return zy(t,n),b&&Eo(n,i,b),u?c^4?s:b:n},Eu,$o,$u;Eu=[hi(re.object({toolboxAlwaysShow:re.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),Se(["preferences"])];class $n extends($u=_t){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0}async start(){this.container=this.createToolbox(),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&this.container.classList.add("is-persistent")}),this.setupHoverLogic(),document.body.appendChild(this.container),this.updateButtonDelays()}stop(){this.container?.remove()}get isPersistent(){return this.container.classList.contains("is-persistent")}setupHoverLogic(){let e=null;this.container.addEventListener("mouseenter",()=>{e&&(clearTimeout(e),e=null),this.isPersistent||this.container.classList.add("is-hovered")}),this.container.addEventListener("mouseleave",()=>{this.isPersistent||(e=window.setTimeout(()=>{this.container.classList.remove("is-hovered")},150))})}calculateButtonDelay(e,i){if(i<=1)return 0;const r=.15,n=e/(i-1),s=r*Math.sqrt(n);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(i=>{const r=i.querySelectorAll(".btn-tip-group"),n=r.length;r.forEach((s,o)=>{const a=this.calculateButtonDelay(o,n);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return y("div",{id:"ipe-edit-toolbox",children:[y("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),y("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),y("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{this.toggle()},children:y("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[y("rect",{width:"448",height:"512",fill:"none"}),y("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32"})]})})]})}normalizeButtonId(e){return e||(e=Math.random().toString(36).substring(2,8)),`ipe-toolbox__${e.trim()}`.replace(/\s\.#/g,"-")}addButton(e){let{id:i,group:r,icon:n,tooltip:s,itemProps:o,buttonProps:a,onClick:l,index:c}=e;i=this.normalizeButtonId(i);const u=this.container.querySelector(`#${i}`);u&&(this.ctx.logger("toolbox").warn(`Button with id ${i} already exists, replacing it.`),u.remove());let f=null;if(typeof r>"u"||r==="auto"){const b=this.container.querySelector(".btn-group.group1"),g=this.container.querySelector(".btn-group.group2"),E=b?.children.length||0,D=g?.children.length||0;f=E<=D?b:g}else f=this.container.querySelector(`.btn-group.${r}`);if(!f)throw new Error(`Button group ${r} not found`);const d=y("li",{class:"btn-tip-group",id:i,onClick:l,...o,children:[y("div",{class:"btn-tip",children:s}),y("button",{id:`${i}-btn`,class:"ipe-toolbox-btn",...a,children:n})]});return typeof c=="number"?c<=0?f.prepend(d):c>=f.children.length?f.appendChild(d):f.children[c]?.before(d):f.appendChild(d),this.ctx.emit("toolbox/button-added",{ctx:this.ctx,button:d}),this.updateButtonDelays(),d}removeButton(e){this.container.querySelector(`.ipe-toolbox-btn#${e}`)?.remove(),this.ctx.emit("toolbox/button-removed",{ctx:this.ctx,id:e}),this.updateButtonDelays()}getContainer(){return this.container}get isOpened(){return this.container.classList.contains("is-persistent")||this.container.classList.contains("is-hovered")}toggle(e){const i=this.isPersistent,r=typeof e=="boolean"?e:!i;this.container.classList.toggle("is-persistent",r),this.container.classList.remove("is-hovered"),this.ctx.preferences.set("toolboxAlwaysShow",r)}}$o=By($u),$n=Ky($o,0,"PluginToolbox",Eu,$n),Wy($o,1,$n);const Vy=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return $n}},Symbol.toStringTag,{value:"Module"}));Q.BasePlugin=Xe,Q.InPageEdit=fi,Q.Inject=Se,Q.Logger=Wo,Q.LoggerLevel=qn,Q.Schema=re,Q.Service=_t,Q.createLogger=Go,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})});
|
|
120
|
+
*/const Ac={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},pe=(t,e)=>{customElements.get(t)||customElements.define(t,e)},cg=(t,e,i)=>{if(!e.length)return;let r=t,n=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let c=r?.[l];c==null?(c=typeof e[a+1]=="number"?[]:{},r[l]=c):typeof c!="object"&&(c=typeof e[a+1]=="number"?[]:{},r[l]=c),n=r,s=l,r=c}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(n)n[s]=a,r=a;else return}try{r[o]=i}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=i,n&&(n[s]=a)}catch{}}},ar=t=>t.map(String).join("."),ug=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),Kt=t=>`schema_${ug(ar(t)||"root")}`,ii=t=>ar(t);function so(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const i=Number(e);return Number.isNaN(i)?void 0:i}case"boolean":return!!e;case"date":{if(!e)return;const i=new Date(e);return Number.isNaN(+i)?void 0:i}case"const":case"string":default:return e}}function Rc(t){return typeof t=="function"&&!!t?.type}function Lc(t){if(!t)throw new Error("schema is required");if(Rc(t))return t;try{const e=Schema.from(t);if(Rc(e))return e}catch{}if(t?.type){const e=t.type;if(Schema[e])return Schema[e](t.inner??t.list??t.dict)}throw new Error("无法从传入对象生成 Schemastery 实例,请传入 schema 或 schema.toJSON() 的结果。")}function at(t){return t?.meta??{}}function fg(t){return t.length>0&&t.every(e=>e?.type==="const")}function Si(t){if(!t)return;const e=t,i=e.meta||{};if(Object.prototype.hasOwnProperty.call(i,"default"))return i.default;const r=e.type;try{const n=t();if(n!==void 0)return n}catch{}switch(r){case"string":return"";case"number":case"natural":case"percent":return 0;case"boolean":return!1;case"array":return[];case"tuple":return[];case"object":return{};case"dict":return{};case"union":{const n=e.list||[];return n.length?Si(n[0]):void 0}case"const":return e.value;case"date":return;default:return}}class wt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Ac,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=Ze,this.$root.appendChild(e)}makeFieldContainer(e,i){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",ar(this._path)),this._label){const n=document.createElement("label");n.className="label",n.textContent=this._label,r.appendChild(n)}if(i){const n=document.createElement("div");n.className="helper",n.textContent=i,r.appendChild(n)}return r}set schema(e){this._schema=Lc(e),this.render()}get schema(){return this._schema}set path(e){this._path=e??[],this.render()}get path(){return this._path}set label(e){this._label=e,this.render()}get label(){return this._label}set i18n(e){e&&(this._i18n={...this._i18n,...e}),this.render()}get i18n(){return this._i18n}setValue(e){this._value=e,this.render()}getValue(){return this._value}emitChange(e){this._value=e,this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{path:this._path,value:e}}))}}class Nc extends wt{render(){if(this.$input&&this.$root.contains(this.$input)){const s=this._value??"";this.$input.value!==s&&document.activeElement!==this.$input&&(this.$input.value=s);return}this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=ii(this._path),r.id=Kt(this._path),e?.pattern?.source&&(r.pattern=e.pattern.source),e?.max!=null&&(r.maxLength=e.max),r.value=this._value??"",r.oninput=()=>this.emitChange(so("string",r.value));const n=i.querySelector("label.label");n&&(n.htmlFor=r.id),i.appendChild(r),this.$root.appendChild(i)}}pe("schema-form-string",Nc);class Mc extends wt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=this._value??"";this.$input.value!==String(o)&&document.activeElement!==this.$input&&(this.$input.value=o);return}this.$root.innerHTML=`<style>${Ze}</style>`;const e=this._schema?.type??"number",i=at(this._schema),r=this.makeFieldContainer("number",i.description),n=document.createElement("input");this.$input=n,n.className="input",n.name=ii(this._path),n.id=Kt(this._path),i?.min!=null&&(n.min=String(i.min)),i?.max!=null&&(n.max=String(i.max)),i?.step!=null&&(n.step=String(i.step)),e==="percent"&&!n.step&&(n.step="0.01"),n.value=this._value??"",n.oninput=()=>this.emitChange(so(e,n.value));const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),i.role==="slider"?n.type="range":n.type="number",r.appendChild(n),this.$root.appendChild(r)}}pe("schema-form-number",Mc);class Dc extends wt{render(){this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const n=document.createElement("input");n.type="checkbox",n.checked=!!this._value,n.name=ii(this._path),n.id=Kt(this._path);const s=document.createElement("span");s.textContent=e.description??this._label??"",n.onchange=()=>this.emitChange(n.checked);const o=i.querySelector("label.label");o&&(o.htmlFor=n.id),r.append(n,s),i.appendChild(r),this.$root.appendChild(i)}}pe("schema-form-boolean",Dc);function pn(t){return String(t).padStart(2,"0")}function lr(t){return`${t.getFullYear()}-${pn(t.getMonth()+1)}-${pn(t.getDate())}`}function oo(t){return`${pn(t.getHours())}:${pn(t.getMinutes())}`}function mn(t){return`${lr(t)}T${oo(t)}`}class jc extends wt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=at(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=lr(this._value):o==="time"?this.$input.value=oo(this._value):o==="datetime"&&(this.$input.value=mn(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=lr(a):o==="datetime"&&(this.$input.value=mn(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const n=e.role||"date";if(n==="datetime"?r.type="datetime-local":n==="time"?r.type="time":r.type="date",r.name=ii(this._path),r.id=Kt(this._path),this._value instanceof Date)n==="date"?r.value=lr(this._value):n==="time"?r.value=oo(this._value):n==="datetime"&&(r.value=mn(this._value));else if(typeof this._value=="string"&&n!=="time"){const o=new Date(this._value);isNaN(+o)||(n==="date"?r.value=lr(o):n==="datetime"&&(r.value=mn(o)))}r.oninput=()=>{e.role;let o;if(!r.value)o=void 0;else{const a=new Date(r.value);o=Number.isNaN(+a)?void 0:a}this.emitChange(o)};const s=i.querySelector("label.label");s&&(s.htmlFor=r.id),i.appendChild(r),this.$root.appendChild(i)}}pe("schema-form-date",jc);class Uc extends wt{render(){this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this._schema.value;if(e.role==="raw-html"){if(i instanceof Node){this.$root.appendChild(i);return}const o=document.createElement("div");o.innerHTML=String(i),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),n=document.createElement("section");n.className="const content",n.textContent=String(i),n.id=Kt(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=n.id),r.appendChild(n),this.$root.appendChild(r)}}pe("schema-form-const",Uc);function hg(t){switch(t.type){case"string":return"schema-form-string";case"number":case"natural":case"percent":return"schema-form-number";case"boolean":return"schema-form-boolean";case"date":return"schema-form-date";case"const":return"schema-form-const";case"array":return"schema-form-array";case"object":return"schema-form-object";case"tuple":return"schema-form-tuple";case"dict":return"schema-form-dict";case"union":{const e=t.list||[];return e.length===2&&e[0]?.type==="is"&&e[0]?.constructor===Date&&e[1]?.type==="transform"&&(e[1]?.inner?.meta?.role==="datetime"||e[1]?.inner?.meta?.role==="date"||e[1]?.inner?.meta?.role==="time")?"schema-form-date":"schema-form-union"}default:return"schema-form-string"}}function ki(t,e,i,r,n){const s=hg(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,n&&(o.i18n=n),o.setValue?.(i),o}class Fc extends wt{render(){this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(fg(r)){const n=document.createElement("select");n.className="input",n.name=ii(this._path),n.id=Kt(this._path),r.forEach(o=>{const a=document.createElement("option");a.value=String(o.value),a.textContent=String(o.value),this._value===o.value&&(a.selected=!0),n.appendChild(a)}),n.onchange=()=>this.emitChange(so("string",n.value));const s=i.querySelector("label.label");s&&(s.htmlFor=n.id),i.appendChild(n)}else{const n=document.createElement("div");n.className="toolbar";const s=document.createElement("select");s.className="input",s.name=ii(this._path)+".__type",s.id=Kt(this._path)+"__type";let o=0;r.forEach((u,f)=>{const d=document.createElement("option");d.value=String(f),d.textContent=u.type,s.appendChild(d)}),s.onchange=()=>{o=Number(s.value);const u=r[o],f=Si(u);this.emitChange(f),c()};const a=i.querySelector("label.label");a&&(a.htmlFor=s.id),n.appendChild(s),i.appendChild(n);const l=document.createElement("div");l.className="group";const c=()=>{l.innerHTML="";const u=r[o],f=ki(u,this._path,this._value,this._label);f.addEventListener("change",d=>{d.stopPropagation(),this.emitChange(d.detail.value)}),l.appendChild(f)};c(),i.appendChild(l)}this.$root.appendChild(i)}}pe("schema-form-union",Fc);class Bc extends wt{render(){this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const n=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=ki(s,[...this._path,o],n[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const c=Array.isArray(this._value)?this._value.slice():[];c[o]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}pe("schema-form-tuple",Bc);class qc extends wt{render(){this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const n=this._schema.dict||{};Object.keys(n).forEach(s=>{if(n[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=ki(n[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const c={...this._value??{}};c[s]=l.detail.value,this.emitChange(c)}),r.appendChild(a)}),i.appendChild(r),this.$root.appendChild(i)}}pe("schema-form-object",qc);const Cn=class Cn extends wt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Cn._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const i={};return e.querySelectorAll(".row").forEach(r=>{const n=r.dataset.uid;n&&(i[n]=r.getBoundingClientRect())}),i}playFLIP(e,i){Array.from(e.querySelectorAll(".row")).forEach(r=>{const n=r.dataset.uid;if(!n)return;const s=i[n];if(!s)return;const o=r.getBoundingClientRect(),a=s.left-o.left,l=s.top-o.top;(a||l)&&(r.style.transition="none",r.style.transform=`translate(${a}px, ${l}px)`,requestAnimationFrame(()=>{r.style.transition="transform .25s ease",r.style.transform=""}))})}render(){this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const n=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(c,u)=>{r.innerHTML="",s().forEach((f,d)=>{const y=[...this._path,d],m=document.createElement("div");m.className="row schema-collection-row";const E=this._itemIds[d];m.dataset.uid=E,m.setAttribute("data-path",ar(y));const j=ki(n,y,f,`${this._label??""}[${d}]`);j.addEventListener("change",p=>{p.stopPropagation();const v=s().slice();v[d]=p.detail.value,this._value=v,this.emitChange(v)});const k=document.createElement("div");k.className="actions";const F=document.createElement("button");F.type="button",F.className="btn",F.textContent=this._i18n.arrayMoveUp??"↑",F.onclick=()=>{if(d<=0)return;const p=this.capturePositions(r),v=s().slice();[v[d-1],v[d]]=[v[d],v[d-1]],[this._itemIds[d-1],this._itemIds[d]]=[this._itemIds[d],this._itemIds[d-1]],this._value=v,o(p),this.emitChange(v)};const b=document.createElement("button");b.type="button",b.className="btn",b.textContent=this._i18n.arrayMoveDown??"↓",b.onclick=()=>{const p=s();if(d>=p.length-1)return;const v=this.capturePositions(r),x=p.slice();[x[d+1],x[d]]=[x[d],x[d+1]],[this._itemIds[d+1],this._itemIds[d]]=[this._itemIds[d],this._itemIds[d+1]],this._value=x,o(v),this.emitChange(x)};const h=document.createElement("button");h.type="button",h.className="btn danger",h.textContent=this._i18n.arrayRemove??"×",h.onclick=()=>{m.classList.add("leaving");const p=250;let v=!1;const x=()=>{if(v)return;v=!0,clearTimeout(P);const R=s().filter((Pe,Le)=>Le!==d);this._itemIds.splice(d,1);const B=this.capturePositions(r);this._value=R,o(B),this.emitChange(R)};m.addEventListener("transitionend",x,{once:!0});const P=setTimeout(x,p+80)},k.append(F,b,h),m.appendChild(j),m.appendChild(k),r.appendChild(m),u&&u===E&&(m.classList.add("enter"),requestAnimationFrame(()=>{m.classList.add("enter-active")}),requestAnimationFrame(()=>{m.classList.remove("enter")}))}),c&&this.playFLIP(r,c)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const c=this.capturePositions(r),u=s().slice(),f=Si(n);u.push(f);const d=this.generateItemId();this._itemIds.push(d),this._value=u,o(c,d),this.emitChange(u)};const l=document.createElement("div");l.className="actions",l.appendChild(a),i.appendChild(r),i.appendChild(l),this.$root.appendChild(i)}};Cn._idCounter=0;let gn=Cn;pe("schema-form-array",gn);class Hc extends wt{render(){this.$root.innerHTML=`<style>${Ze}</style>`;const e=at(this._schema),i=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const n=this._schema.inner,s=this._value??{},o=d=>`d_${d}`,a=()=>{const d={};return r.querySelectorAll(".kv").forEach(y=>{const m=y.dataset.uid;m&&(d[m]=y.getBoundingClientRect())}),d},l=d=>{r.querySelectorAll(".kv").forEach(y=>{const m=y.dataset.uid;if(!m)return;const E=d[m];if(!E)return;const j=y.getBoundingClientRect(),k=E.left-j.left,F=E.top-j.top;(k||F)&&(y.style.transition="none",y.style.transform=`translate(${k}px, ${F}px)`,requestAnimationFrame(()=>{y.style.transition="transform .25s ease",y.style.transform=""}))})},c=(d,y)=>{r.innerHTML="",Object.keys(s).forEach(m=>{const E=[...this._path,m],j=document.createElement("div");j.className="kv schema-collection-row",j.dataset.uid=o(m),j.setAttribute("data-path",ar(E));const k=document.createElement("input");k.className="input",k.value=m,k.name=ii(E)+".__key",k.id=Kt(E)+"__key";const F=ki(n,E,s[m],`${this._label??""}[${m}]`),b=document.createElement("button");b.type="button",b.className="btn danger",b.textContent=this._i18n.dictRemove??"×",b.onclick=()=>{const h=a();delete s[m];const p={...this._value??{}};delete p[m],this._value=p,c(h),this.emitChange(p)},k.onchange=()=>{const h=k.value.trim();if(!h||h===m||s[h]!==void 0)return;const p=a();s[h]=s[m],delete s[m];const v={...this._value??{}};v[h]=v[m],delete v[m],this._value=v,c(p),this.emitChange(v)},F.addEventListener("change",h=>{h.stopPropagation();const p={...this._value??{}};p[m]=h.detail.value,this._value=p,this.emitChange(p)}),j.append(k,F,b),r.appendChild(j),y===m&&(j.classList.add("enter"),requestAnimationFrame(()=>j.classList.add("enter-active")),requestAnimationFrame(()=>j.classList.remove("enter")))}),d&&l(d)};c();const u=document.createElement("button");u.type="button",u.className="btn primary",u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let d=Object.keys(s).length+1,y=`k${d}`;for(;s[y]!==void 0;)y=`k${++d}`;const m=a();s[y]=Si(n);const E={...this._value??{},[y]:s[y]};this._value=E,c(m,y),this.emitChange(E)};const f=document.createElement("div");f.className="actions",f.appendChild(u),i.appendChild(r),i.appendChild(f),this.$root.appendChild(i)}}pe("schema-form-dict",Hc);class zc extends HTMLElement{constructor(){super(),this._i18n={...Ac},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=Ze,this.$root.appendChild(e);const i=document.createElement("div");i.className="wrapper",i.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(i),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:n,value:s}=r.detail;Array.isArray(n)&&n.length===0?this._state=s:cg(this._state??(this._state={}),n,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:n,value:s,state:this._state}}))})}set schema(e){this._schema=Lc(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Si(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,i={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=i.validate?this._schema(e??null,{autofix:i.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const i=this._state;return e.validate?this._schema(i??null,{autofix:e.autofix}):i}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Si(this._schema)}this.render()}refresh(){this.render()}set i18n(e){this._i18n={...this._i18n,...e},this.render()}get i18n(){return this._i18n}render(){if(!this._schema)return;const e=this.$root.querySelector("form");e.innerHTML="";const i=ki(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(i)}}pe("schema-form",zc);function dg(){pe("schema-form",zc),pe("schema-form-string",Nc),pe("schema-form-number",Mc),pe("schema-form-boolean",Dc),pe("schema-form-date",jc),pe("schema-form-const",Uc),pe("schema-form-union",Fc),pe("schema-form-tuple",Bc),pe("schema-form-object",qc),pe("schema-form-array",gn),pe("schema-form-dict",Hc)}const pg=El({__name:"SchemasteryFormVue",props:Ll({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Ll(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:i}){const r=tc(t,"schema"),n=tc(t,"value"),s=i,o=Ap("elRef");let a=!1,l=!1;const c=u=>{if(l)return;const f=o.value,d=t.validateOnChange?f.getData({validate:!0}):u.detail.state;a=!0,n.value=d,tn(()=>{a=!1}),s("change",u.detail)};return Tl(()=>{dg()}),Fs(()=>{const u=o.value;r.value&&(u.schema=r.value),n.value!==void 0&&u.setData(n.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",c)}),Il(()=>{o.value?.removeEventListener("form-change",c)}),vi(()=>r,u=>{a||o.value&&u&&o.value.schema!==u.value&&(l=!0,o.value.schema=u.value,tn(()=>{l=!1}))},{deep:!0,immediate:!0}),vi(()=>n,u=>{if(a||!o.value||u.value===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(u.value)&&(l=!0,o.value.setData(u.value,{validate:!1}),tn(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(u,f){const d=o.value;d.setData(u,{validate:!!f?.validate}),f?.emit&&(n.value=d.getData({validate:!!f?.validate}))},getData(u){return o.value.getData(u)},setSchema(u,f=!0){o.value.schema=u,f&&(r.value=u)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(u,f)=>(zt(),_i("schema-form",hc({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function ri(t,e=new WeakMap){if(xe(t))return ri(t.value,e);if(t===null||typeof t!="object")return t;if(e.has(t))return e.get(t);if(t instanceof Date)return new Date(t);if(t instanceof RegExp)return new RegExp(t);if(t instanceof Map){const n=new Map;return e.set(t,n),Array.from(t.entries()).forEach(([s,o])=>{n.set(s,ri(o,e))}),n}if(t instanceof Set){const n=new Set;return e.set(t,n),Array.from(t).forEach(s=>{n.add(ri(s,e))}),n}if(Array.isArray(t)){const n=[];e.set(t,n);for(const s of t)n.push(ri(s,e));return n}const i=ee(t),r={};e.set(t,r);for(const n of Object.keys(i))r[n]=ri(i[n],e);for(const n of Object.getOwnPropertySymbols(i))r[n]=ri(i[n],e);return r}const mg={class:"preferences-ui-app"},gg={class:"tabs"},yg=["onClick","data-value"],bg={key:0},wg={style:{"max-height":"20em",overflow:"auto"}},vg=((t,e)=>{const i=t.__vccOpts||t;for(const[r,n]of e)i[r]=n;return i})(El({__name:"PreferencesForm",setup(t,{expose:e}){const i=ag(),r=!1,n=ml([]),s=ml(""),o=Yr([]),a=bc(()=>o.value.map(u=>u.schema)),l=Yr({}),c=Yr({});return e({getValue(){return ri(c)}}),vi(s,u=>{u&&(l.value=c.value,o.value=i.preferences.getConfigRegistries(u))},{immediate:!0}),Fs(async()=>{i.inject(["preferences"],async u=>{const f=await u.preferences.getAll();l.value=c.value=f,n.value=u.preferences.getConfigCategories(),s.value=n.value[0].name})}),(u,f)=>(zt(),_i("div",mg,[fn("div",gg,[(zt(!0),_i(ot,null,Rl(n.value,d=>(zt(),_i("a",{class:qr(["tab",{active:s.value===d.name}]),key:d.name,onClick:y=>s.value=d.name,"data-value":d.name},_s(d.label),11,yg))),128))]),(zt(!0),_i(ot,null,Rl(a.value,(d,y)=>(zt(),cc(Ms(pg),{key:`${s.value}-${y}`,schema:d,value:l.value,"onUpdate:value":f[0]||(f[0]=m=>c.value=m),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),Ms(r)?(zt(),_i("details",bg,[fn("pre",wg,_s(c.value),1)])):xm("",!0)]))}}),[["__scopeId","data-v-2a1a9c7e"]]),_g=window?.location?.origin,xg=({type:t,tag:e,href:i,target:r,children:n,...s})=>(e=e||(i?"a":"button"),typeof r>"u"&&i&&i.startsWith("http")&&!i.startsWith(_g)&&(r="_blank"),mh(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?i:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?i:void 0,...s},n));var Sg=Object.create,ao=Object.defineProperty,kg=Object.getOwnPropertyDescriptor,Wc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Kc=t=>{throw TypeError(t)},Eg=(t,e,i)=>e in t?ao(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,$g=(t,e)=>ao(t,"name",{value:e,configurable:!0}),Pg=t=>[,,,Sg(t?.[Wc("metadata")]??null)],Cg=["class","method","getter","setter","accessor","field","value","get","set"],Vc=t=>t!==void 0&&typeof t!="function"?Kc("Function expected"):t,Og=(t,e,i,r,n)=>({kind:Cg[t],name:e,metadata:r,addInitializer:s=>i._?Kc("Already initialized"):n.push(Vc(s||null))}),Tg=(t,e)=>Eg(e,Wc("metadata"),t[3]),Ig=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Ag=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&kg(n,i));$g(n,i);for(var m=r.length-1;m>=0;m--)l=Og(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,Vc(o)&&(n=o);return Tg(t,n),y&&ao(n,i,y),u?c^4?s:y:n},Gc,lo,Qc;Gc=[ke(["preferences","modal"])];class yn extends(Qc=Je){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,this._latestModal=null,e.set("preferencesUI",this),e.preferences.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),e.preferences.registerCustomConfig("about",te.object({about:te.const(g("div",{className:"prose",children:[g("h2",{children:"✏️ InPageEdit NEXT"}),g("i",{children:["v",this.ctx.version]}),g("h2",{children:"Portals"}),g("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[g("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),g(xg,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),g("h2",{children:"Join us"}),g("ul",{children:[g("li",{children:[g("strong",{children:"GitHub"}),":"," ",g("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),g("li",{children:[g("strong",{children:"QQ Group"}),": 1026023666"]})]}),g("hr",{}),g("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),g("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about"),e.inject(["toolbox"],i=>{i.toolbox.addButton({id:"preferences",icon:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",class:"icon icon-tabler icons-tabler-filled icon-tabler-settings",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M14.647 4.081a.724 .724 0 0 0 1.08 .448c2.439 -1.485 5.23 1.305 3.745 3.744a.724 .724 0 0 0 .447 1.08c2.775 .673 2.775 4.62 0 5.294a.724 .724 0 0 0 -.448 1.08c1.485 2.439 -1.305 5.23 -3.744 3.745a.724 .724 0 0 0 -1.08 .447c-.673 2.775 -4.62 2.775 -5.294 0a.724 .724 0 0 0 -1.08 -.448c-2.439 1.485 -5.23 -1.305 -3.745 -3.744a.724 .724 0 0 0 -.447 -1.08c-2.775 -.673 -2.775 -4.62 0 -5.294a.724 .724 0 0 0 .448 -1.08c-1.485 -2.439 1.305 -5.23 3.744 -3.745a.722 .722 0 0 0 1.08 -.447c.673 -2.775 4.62 -2.775 5.294 0zm-2.647 4.919a3 3 0 1 0 0 6a3 3 0 0 0 0 -6z"})]}),tooltip:"Configure Preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(r=>{r.toolbox.removeButton("preferences")})})}async start(){Promise.resolve().then(()=>db).then(({PluginPrefSync:e})=>{this.ctx.plugin(e)}).catch(this.ctx.logger.warn)}stop(){}getExistingModal(){return this._latestModal}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:`InPageEdit Preferences (${this.ctx.version})`,content:g(Pt,{children:g(Dt,{})})});e.get$window().classList.add("dialog");const i=g("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(i);const r=this.createForm(),n=r.mount(i);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=n.getValue();this.logger.info("saving preferences",s);try{Object.entries(s).forEach(([o,a])=>{this.ctx.preferences.set(o,a).catch(console.error)})}catch(o){this.logger.error("failed to save preferences",o)}e.close(),this.ctx.modal.notify("success",{title:"Preferences Saved",content:g("p",{children:"Some settings may take effect after reloading the page."})})}}]),this._latestModal=e,e.on(e.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount(),this._latestModal=null})}createForm(){return lg(this.ctx,vg)}}lo=Pg(Qc),yn=Ag(lo,0,"PluginPreferencesUI",Gc,yn),Ig(lo,1,yn);const Rg=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return yn}},Symbol.toStringTag,{value:"Module"})),Lg=Symbol("@@apply"),Ng=Symbol("@@ctor");function co(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const i=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};i[Lg]=i,i[Ng]=t;const r=t?.constructor?.name;return r&&(i[Symbol.toStringTag]=r),new Proxy(i,{get(s,o,a){return o==="prototype"?Reflect.get(i,o,a):Reflect.get(t,o,t)},set(s,o,a){return Reflect.set(t,o,a)},has(s,o){return Reflect.has(t,o)},deleteProperty(s,o){return Reflect.deleteProperty(t,o)},ownKeys(){return Reflect.ownKeys(t)},getOwnPropertyDescriptor(s,o){return Object.getOwnPropertyDescriptor(t,o)},defineProperty(s,o,a){return Object.defineProperty(t,o,a)}})}const bn={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},cr=t=>{const{type:e="default",title:i,content:r,closeable:n=!0,titleProps:s,contentProps:o,children:a,...l}=t;let c=i;typeof i>"u"&&e!=="default"&&(c=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!f)return Promise.resolve();const{promise:d,resolve:y}=Promise.withResolvers();return f.animate([{opacity:"1",height:f.clientHeight+"px"},{opacity:"0",height:"0px",margin:"0px"}],{duration:300,easing:"ease"}).addEventListener("finish",()=>{f.remove(),y()}),d},f=g("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${bn.mbox}`,...l,children:[c&&g("div",{className:`ipe-mbox-title ${bn.title}`,...s,children:c}),g("div",{className:`ipe-mbox-content ${bn.content}`,...o,children:a||r}),n&&g("a",{onClick:u,className:`ipe-mbox-close ${bn.close}`,children:"×"})]});return f.close=u,f},ur=t=>{const{label:e,id:i,name:r,value:n,disabled:s,labelProps:o,inputProps:a,...l}=t;return g("div",{className:"theme-ipe ipe-input-box",...l,children:[g("label",{htmlFor:i,style:{display:"block"},...o,children:e}),g("input",{id:i,name:r,value:n,disabled:s,style:{width:"100%"},...a})]})},Mg=t=>{const{id:e,name:i,value:r,label:n,inputProps:s,labelProps:o,children:a,...l}=t;return g("label",{className:"theme-ipe ipe-radio-box",...l,children:[g("input",{type:"radio",id:e,name:i,value:r,...s}),g("span",{className:"ipe-checkbox-box"}),g("span",{...o,children:n||a})]})},Ei=t=>{const{id:e,name:i,label:r,checked:n,inputProps:s,labelProps:o,children:a,...l}=t;return g("label",{className:"theme-ipe ipe-checkbox",...l,children:[g("input",{type:"checkbox",id:e,name:i,checked:n,...s}),g("span",{className:"ipe-checkbox-box"}),g("span",{...o,children:r||a})]})},uo=()=>{},Dg=(t=0)=>new Promise(e=>setTimeout(e,t));var jg=Object.create,fo=Object.defineProperty,Ug=Object.getOwnPropertyDescriptor,Yc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Jc=t=>{throw TypeError(t)},Fg=(t,e,i)=>e in t?fo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Bg=(t,e)=>fo(t,"name",{value:e,configurable:!0}),qg=t=>[,,,jg(t?.[Yc("metadata")]??null)],Hg=["class","method","getter","setter","accessor","field","value","get","set"],Xc=t=>t!==void 0&&typeof t!="function"?Jc("Function expected"):t,zg=(t,e,i,r,n)=>({kind:Hg[t],name:e,metadata:r,addInitializer:s=>i._?Jc("Already initialized"):n.push(Xc(s||null))}),Wg=(t,e)=>Fg(e,Yc("metadata"),t[3]),Kg=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Vg=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&Ug(n,i));Bg(n,i);for(var m=r.length-1;m>=0;m--)l=zg(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,Xc(o)&&(n=o);return Wg(t,n),y&&fo(n,i,y),u?c^4?s:y:n},Zc,ho,eu;Zc=[ke(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),fi(te.object({"quickEdit.editSummary":te.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":te.boolean().description("Whether to mark the edit as minor").default(!1),"quickEdit.outSideClose":te.boolean().description("Whether to close the modal outside").default(!0),"quickEdit.watchList":te.union([te.const(Ye.preferences).description("Follow my preferences"),te.const(Ye.nochange).description("Keep the current watchlist status"),te.const(Ye.watch).description("Add the page to watchlist"),te.const(Ye.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(Ye.preferences),"quickEdit.keyshortcut.save":te.string().default("ctrl-s").description("save button key shortcut (blank to disable)")}).description("Quick edit options").extra("category","edit"))];class wn extends(eu=Je){constructor(e){super(e,{},"quick-edit"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,section:void 0,editMinor:!1,editSummary:"",createOnly:!1,reloadAfterSave:!0},this.ctx.root.set("quickEdit",co(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),e?.page&&(e.title=e.page,delete e.page),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const k=new URLSearchParams(window.location.search),F=this.ctx.currentPage.wikiTitle;e={...e,title:F?.getPrefixedDBKey(),revision:k.has("oldid")?Number(k.get("oldid")):void 0,pageId:k.has("curid")?Number(k.get("curid")):void 0}}if(!e.revision&&!e.pageId&&e.title){const k=this.ctx.wikiTitle.resolveSpecialPageTarget(e.title);k&&k.title.getNamespaceId()>=0&&(e.title=k.title.getPrefixedDBKey(),e.section??(e.section=k.section))}const i=await this.ctx.preferences.get("quickEdit.outSideClose"),r=await this.ctx.preferences.get("quickEdit.watchList"),n=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("quickEdit.editSummary"),s=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("quickEdit.editMinor"),o={...this.DEFAULT_OPTIONS,editSummary:n,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),this.ctx.emit("quick-edit/init-options",{ctx:this.ctx,options:o});const a=this.ctx.modal.createObject({className:"ipe-quickEdit",sizeClass:"large",center:!1,outSideClose:i}).init();a.setTitle(g(Pt,{children:["Loading: ",g("u",{children:o.title})]})),a.setContent(g("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:g(Dt,{})})),a.addButton({side:"right",type:"button",className:"is-danger is-ghost",label:"Cancel",method(){a.close()}}),a.show(),this.ctx.emit("quick-edit/show-modal",{ctx:this.ctx,modal:a,options:o});let l;try{if(l=await this.getWikiPageFromPayload(o),l.pageInfo.special)throw new Error("Special page is not editable")}catch(k){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:k instanceof Error?k.message:String(k)});return}const c=o.section==="new"?"":l.revisions[0]?.content||"",u=l.revisions[0]?.revid,f=u&&u!==l.lastrevid,d=o.section==="new",y=l.pageid===0;a.setTitle(g(Pt,{children:[d?"New section":`Quick ${y?"Create":"Edit"}`,":"," ",g("u",{children:l.pageInfo.title}),f?` (Revision ${u})`:""]}));const m=[];y&&m.push(g(cr,{title:"Attention",type:"important",children:g("p",{children:"This page does not exist."})})),f&&m.push(g(cr,{title:"Attention",type:"warning",children:g("p",{children:["You are editing a ",g("em",{children:"historical version"}),"; the content is not the latest!"]})})),this.ctx.emit("quick-edit/edit-notice",{ctx:this.ctx,options:o,modal:a,wikiPage:l,editNotices:m});const E=g("form",{className:"ipe-quickEdit__form",children:[g("div",{className:"ipe-quickEdit__notices",children:m}),g("div",{className:"ipe-quickEdit__content",style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[o.section==="new"&&g(Pt,{children:g(ur,{label:"Section title",id:"summary",name:"summary",value:"",inputProps:{placeholder:"Topic for new section, this will be the h2 heading"}})}),g("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:c})]}),g("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[!d&&g(ur,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),g("div",{className:"ipe-input-box",children:[g("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),g("div",{style:{display:"flex",gap:"1rem"},children:[Ye.preferences,Ye.nochange,Ye.watch,Ye.unwatch].map(k=>g(Mg,{name:"watchlist",value:k,inputProps:{checked:r===k},children:k},k))})]}),g("div",{style:{display:"flex",gap:"1rem"},children:[g(Ei,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),g(Ei,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(E),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:()=>{const k=new FormData(E);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:k.get("text"),summary:k.get("summary"),minor:k.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:uo}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),k.get("reloadAfterSave")&&(await Dg(500),location.reload())}).catch(F=>{this.ctx.modal.notify("error",{title:"Submission Error",content:F instanceof Error?F.message:String(F)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const k=l.revisions[0]?.content||"";return(E.querySelector("textarea")?.value||"")===k?!0:(this.ctx.modal.confirm({className:"is-primary",title:"Unsaved Changes",content:"All edit contents will be lost after closing the modal. Are you sure you want to close?",center:!0,okBtn:{label:"Give Up",className:"is-danger is-ghost"},cancelBtn:{label:"Continue Editing",className:"is-primary is-ghost"}},b=>(b&&(a.setOptions({beforeClose:uo}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const j=k=>E.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(k.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",j),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",j)})}async handleSubmit(e){const i=e.wikiPage,r=e.summary||"",n=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return i.edit({summary:r,text:n,watchlist:a,section:l},{minor:s,createonly:o})}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision,e.section);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId,e.section);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1,e.section);throw new Error("Invalid payload")}async injectToolbox(e){const i=this.ctx.currentPage.wikiTitle,r=this.ctx.wiki.hasRight("edit")&&i&&i.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-edit",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),g("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),g("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Edit":"Not editable",onClick:()=>{const n=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:i?.getPrefixedText(),revision:n?Number(n):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}ho=qg(eu),wn=Vg(ho,0,"PluginQuickEdit",Zc,wn),Kg(ho,1,wn);const Gg=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return wn}},Symbol.toStringTag,{value:"Module"}));var Qg=Object.create,po=Object.defineProperty,Yg=Object.getOwnPropertyDescriptor,tu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),iu=t=>{throw TypeError(t)},Jg=(t,e,i)=>e in t?po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Xg=(t,e)=>po(t,"name",{value:e,configurable:!0}),Zg=t=>[,,,Qg(t?.[tu("metadata")]??null)],ey=["class","method","getter","setter","accessor","field","value","get","set"],ru=t=>t!==void 0&&typeof t!="function"?iu("Function expected"):t,ty=(t,e,i,r,n)=>({kind:ey[t],name:e,metadata:r,addInitializer:s=>i._?iu("Already initialized"):n.push(ru(s||null))}),iy=(t,e)=>Jg(e,tu("metadata"),t[3]),ry=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},ny=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&Yg(n,i));Xg(n,i);for(var m=r.length-1;m>=0;m--)l=ty(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,ru(o)&&(n=o);return iy(t,n),y&&po(n,i,y),u?c^4?s:y:n},nu,mo,su;nu=[ke(["api","wikiPage","wikiTitle","currentPage","wiki","modal","preferences"]),fi(te.object({deleteReason:te.string().description("Default delete reason for quick delete").default("[IPE-NEXT] Quick delete")}).description("Quick delete options").extra("category","delete"))];class vn extends(su=Je){constructor(e){super(e,{},"quick-delete"),this.ctx=e,this.DEFAULT_OPTIONS={title:"",pageId:0,revision:0,deleteReason:"",reloadAfterDelete:!0},this.ctx.root.set("quickDelete",co(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})}),this.ctx.preferences.defineCategory({label:"Delete",name:"delete",description:"Settings related to deleting pages",index:3})}async showModal(e){if(typeof e>"u"?e={}:typeof e=="string"&&(e={title:e}),!e.title&&!e.pageId&&!e.revision){this.logger.warn("None of the title, pageId or revision provided. Using defaults.");const l=new URLSearchParams(window.location.search),c=this.ctx.currentPage.wikiTitle;e={...e,title:c?.getPrefixedDBKey(),revision:l.has("oldid")?Number(l.get("oldid")):void 0,pageId:l.has("curid")?Number(l.get("curid")):void 0}}const i=typeof e.deleteReason=="string"?e.deleteReason:await this.ctx.preferences.get("deleteReason"),r={...this.DEFAULT_OPTIONS,deleteReason:i,...e};r.deleteReason||(r.deleteReason=await this.ctx.preferences.get("deleteReason")||""),r||this.ctx.emit("quick-delete/init-options",{ctx:this.ctx,options:r});const n=this.ctx.modal.createObject({className:"ipe-quickDelete",sizeClass:"small",center:!0}).init();n.setTitle(g(Pt,{children:["Loading: ",g("u",{children:r.title})]})),n.setContent(g(Dt,{})),n.addButton({side:"right",type:"button",className:"is-ghost",label:"Cancel",method(){n.close()}}),n.show(),this.ctx.emit("quick-delete/show-modal",{ctx:this.ctx,modal:n,options:r});let s;try{if(s=await this.getWikiPageFromPayload(r),s.pageInfo.special)throw new Error("Special page cannot be deleted");if(s.pageInfo.pageid===0)throw new Error("Page does not exist, cannot be deleted")}catch(l){n.off(n.Event.Close),n.close(),this.ctx.modal.notify("error",{content:l instanceof Error?l.message:String(l)});return}n.setTitle(g(Pt,{children:["Quick Delete: ",g("u",{children:s.pageInfo.title})]}));const o=[];s.userCan("delete")||o.push(g(cr,{title:"Permission Denied",type:"error",children:g("p",{children:"You do not have permission to delete this page."})})),s.pageInfo.protection&&s.pageInfo.protection.length>0&&o.push(g(cr,{title:"Warning",type:"warning",children:g("p",{children:"This page is protected and may has special use or purpose. Delete it at your own risk."})})),this.ctx.emit("quick-delete/delete-notice",{ctx:this.ctx,options:r,modal:n,wikiPage:s,deleteNotices:o});const a=g("form",{className:"ipe-quickDelete__form",children:[g("div",{className:"ipe-quickDelete__notices",children:o}),g("div",{className:"ipe-quickDelete__content",children:g("div",{className:"ipe-quickDelete__page-info",style:{padding:"1rem",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"1rem"},children:g("ul",{children:[g("li",{children:[g("strong",{children:"Title:"})," ",s.pageInfo.title]}),g("li",{children:[g("strong",{children:"Page ID:"})," ",s.pageInfo.pageid]}),g("li",{children:[g("strong",{children:"Last Revision:"})," ",s.pageInfo.lastrevid]}),g("li",{children:[g("strong",{children:"Length:"})," ",s.pageInfo.length," characters"]})]})})}),g("div",{class:"ipe-quickDelete__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:g(ur,{label:"Delete Reason",id:"reason",name:"reason",value:r.deleteReason,inputProps:{placeholder:"Enter reason for deletion...",required:!0}})}),!1]});n.setContent(a),n.addButton({side:"left",className:"is-danger submit-btn",label:"Delete Page",method:()=>{const c=new FormData(a).get("reason");if(!c||c.trim()===""){this.ctx.modal.notify("error",{title:"Missing Reason",content:"Please provide a reason for deletion."});return}this.ctx.modal.confirm({className:"is-danger",title:"Confirm Deletion",content:g(Pt,{children:g("p",{children:g("strong",{children:s.pageInfo.title})})}),center:!0,okBtn:{label:"Delete it now",className:"is-danger"},cancelBtn:{label:"Cancel",className:"is-ghost"}},u=>(u&&(n.setLoadingState(!0),this.handleSubmit({wikiPage:s,reason:c}).then(async()=>{n.setOptions({beforeClose:uo}),n.close(),this.ctx.modal.notify("success",{title:"Deletion Successful",content:`The page "${s.pageInfo.title}" has been deleted.`})}).catch(f=>{this.ctx.modal.notify("error",{title:"Deletion Error",content:f instanceof Error?f.message:String(f)}),n.setLoadingState(!1)})),!0))}},0),this.ctx.emit("quick-delete/wiki-page",{ctx:this.ctx,options:r,modal:n,wikiPage:s})}async handleSubmit(e){const i=e.wikiPage,r=e.reason||"";return i.delete(r)}async getWikiPageFromPayload(e){if(e.revision)return this.ctx.wikiPage.newFromRevision(e.revision);if(e.pageId)return this.ctx.wikiPage.newFromPageId(e.pageId);if(e.title)return this.ctx.wikiPage.newFromTitle(e.title,!1);throw new Error("Invalid payload")}async injectToolbox(e){const i=this.ctx.currentPage.wikiTitle,r=i&&this.ctx.wiki.hasRight("delete")&&i.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-delete",group:"group2",icon:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 7l16 0"}),g("path",{d:"M10 11l0 6"}),g("path",{d:"M14 11l0 6"}),g("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),g("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Delete":"Not deletable",onClick:()=>{this.showModal({title:i?.getPrefixedText()})}})}removeToolbox(e){e.toolbox.removeButton("quick-delete")}}mo=Zg(su),vn=ny(mo,0,"PluginQuickDelete",nu,vn),ry(mo,1,vn);const sy=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDelete(){return vn}},Symbol.toStringTag,{value:"Module"})),fr={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},ou=t=>{const{inputs:e,enableSwap:i=!0,...r}=t,n=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const c=()=>s.some(m=>m&&m.disabled),u=()=>{if(!s[0]||!s[1]||c())return;const m=s[0],E=s[1],j=m.value,k=E.value;m.value=k,E.value=j,m.dispatchEvent(new Event("change")),E.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=m=>{if(!a)return;const E=m??!a.disabled;a.disabled=!E,E&&s.forEach(j=>{j&&(j.disabled=!1)})},d=g("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:c()||!i,ref:m=>a=m,children:g("svg",{ref:m=>l=m,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon-tabler icons-tabler-outline icon-tabler-transfer",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M20 10h-16l5.5 -6"}),g("path",{d:"M4 14h16l-5.5 6"})]})}),y=g("div",{className:`twin-swap-input ${fr.twinSwapInput}`,...r,children:[n.map((m,E)=>{const{label:j,id:k,name:F,value:b,disabled:h,required:p,inputProps:v}=m,x=E===0,P=k||F;return g("div",{className:`${fr.inputWrapper} ${x?fr.inputLeft:fr.inputRight}`,children:[j&&g("label",{htmlFor:P,children:j}),g("input",{ref:R=>s[E]=R,type:"text",id:P,name:F,value:b,disabled:h,required:p,...v})]})}),g("div",{className:fr.swapButton,children:d})]});return y.swap=u,y.toggleEnableSwap=f,y};var oy=Object.create,go=Object.defineProperty,ay=Object.getOwnPropertyDescriptor,au=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),lu=t=>{throw TypeError(t)},ly=(t,e,i)=>e in t?go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,cy=(t,e)=>go(t,"name",{value:e,configurable:!0}),uy=t=>[,,,oy(t?.[au("metadata")]??null)],fy=["class","method","getter","setter","accessor","field","value","get","set"],cu=t=>t!==void 0&&typeof t!="function"?lu("Function expected"):t,hy=(t,e,i,r,n)=>({kind:fy[t],name:e,metadata:r,addInitializer:s=>i._?lu("Already initialized"):n.push(cu(s||null))}),dy=(t,e)=>ly(e,au("metadata"),t[3]),py=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},my=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&ay(n,i));cy(n,i);for(var m=r.length-1;m>=0;m--)l=hy(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,cu(o)&&(n=o);return dy(t,n),y&&go(n,i,y),u?c^4?s:y:n},uu,yo,fu;uu=[ke(["modal","wiki"])];class _n extends(fu=Je){constructor(e){super(e,{},"quick-move"),this.ctx=e,e.set("quickMove",this.quickMove.bind(this)),e.set("movePage",this.movePage.bind(this))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e)})}injectToolbox(e){const i=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-forms",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),g("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),g("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),g("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),g("path",{d:"M17 12h.01"}),g("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group1",index:1,onClick:()=>{this.quickMove(r?{lockFromField:!0,from:i}:{})}})}quickMove(e){const i=this.ctx.modal.createObject({title:"Quick Move",content:g(Dt,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return i.setContent(g("form",{ref:n=>r=n,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:n=>{if(n.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",movetalk:s.get("movetalk")==="on",movesubpages:s.get("movesubpages")==="on",noredirect:s.get("noredirect")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to move",content:"From and to are required."});return}i.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{i.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[g(ou,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),g("div",{children:g(Ei,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),g("div",{children:g(Ei,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.wiki.hasRight("suppressredirect")&&g("div",{children:g(Ei,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),g(ur,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),i.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),i.show()}async movePage(e){const{from:i,to:r,reason:n="",...s}=e;if(!i||!r)throw new Error("From and to titles are required.");if(i===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(i)).moveTo(r,n,s)}}yo=uy(fu),_n=my(yo,0,"PluginQuickMove",uu,_n),py(yo,1,_n);const gy=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return _n}},Symbol.toStringTag,{value:"Module"}));var yy=Object.create,bo=Object.defineProperty,by=Object.getOwnPropertyDescriptor,hu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),du=t=>{throw TypeError(t)},wy=(t,e,i)=>e in t?bo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,vy=(t,e)=>bo(t,"name",{value:e,configurable:!0}),_y=t=>[,,,yy(t?.[hu("metadata")]??null)],xy=["class","method","getter","setter","accessor","field","value","get","set"],pu=t=>t!==void 0&&typeof t!="function"?du("Function expected"):t,Sy=(t,e,i,r,n)=>({kind:xy[t],name:e,metadata:r,addInitializer:s=>i._?du("Already initialized"):n.push(pu(s||null))}),ky=(t,e)=>wy(e,hu("metadata"),t[3]),Ey=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},$y=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&by(n,i));vy(n,i);for(var m=r.length-1;m>=0;m--)l=Sy(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,pu(o)&&(n=o);return ky(t,n),y&&bo(n,i,y),u?c^4?s:y:n},mu,wo,gu;mu=[ke(["api","wikiPage","modal","preferences"]),fi(te.object({"quickPreview.keyshortcut":te.string().default("ctrl-p").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","edit").description("Quick preview options"))];class xn extends(gu=Je){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",co(this,"previewWikitext"))}start(){this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.on("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}stop(){}previewWikitext(e,i,r,n,s){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!n||n.isDestroyed)&&(n=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),n.show(),n.setTitle("Preview - Loading..."),n.setContent(g(Dt,{})),n.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:n,wikiPage:r}),r.preview(e,i).then(o=>{const{data:{parse:a}}=o;n.setTitle(`Preview - ${a.title}`);let l=null;n.setContent(g("section",{children:g("div",{ref:c=>l=c,className:"mw-parser-output",innerHTML:a.text})})),window.mw?.hook("wikipage.content").fire($(l)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:n,wikiPage:r,text:e,parseData:a})}).catch(o=>{n.setTitle("Preview - Failed"),n.setContent(g(Pt,{children:[g("p",{children:"Failed to preview"}),g("p",{children:o instanceof Error?o.message:String(o)})]}))}),n}async injectQuickEdit({options:e,modal:i,wikiPage:r}){let n;i.addButton({label:"Preview",side:"left",className:"btn btn-secondary",keyPress:await this.ctx.preferences.get("quickPreview.keyshortcut.quickEdit")||void 0,method:()=>{let s=i.get$content().querySelector('textarea[name="text"]')?.value||"";if(e.section==="new"){const o=i.get$content().querySelector('input[name="summary"]')?.value;o&&(s=`==${o}==
|
|
121
|
+
${s}`)}n=this.previewWikitext(s,void 0,r,n,{backdrop:!1,draggable:!0})}},1),i.on(i.Event.Close,()=>{n?.destroy(),n=void 0})}injectQuickDelete({ctx:e,modal:i,wikiPage:r}){i.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{this.logger.warn("To be implemented: preview wikitext for quick delete")}},2)}}wo=_y(gu),xn=$y(wo,0,"PluginQuickPreview",mu,xn),Ey(wo,1,xn);const Py=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return xn}},Symbol.toStringTag,{value:"Module"})),Cy=t=>{let{user:e,target:i,ctx:r}=t;const n=r.getUrl.bind(r);return g("span",{className:"mw-userlinks",children:[g("a",{href:n(`User:${e}`),className:"mw-userlink",target:i,children:e})," ",g("span",{className:"mw-usertoollinks",children:["(",g("a",{href:n(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:i,children:"talk"})," | ",g("a",{href:n(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:i,children:"contribs"})," | ",g("a",{href:n(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:i,children:"block"}),")"]})]})};var Sn=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(Sn||{});const Oy=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,yu=t=>{let e=["diff-title"];if(t.type==="from"?e.push("diff-otitle"):t.type==="to"&&e.push("diff-ntitle"),!t.pageid||!t.userid)return g("td",{colSpan:2,className:e,children:g("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const i=r=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return g("td",{colSpan:2,className:e,children:[g("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),g("div",{className:"mw-diff-title--actions",children:g("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:i,children:[g(La,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),g("div",{className:"mw-diff-title--user",children:t.username&&g(Cy,{ctx:t.ctx,user:t.username,target:"_blank"})}),g("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&Oy(new Date(t.timestamp))}),g("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&g(Pt,{children:["(",g("i",{innerHTML:t.parsedcomment}),")"]})})]})},Ty=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const i=(r,n,s)=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:n,torev:s},bubbles:!0}))};return g("tr",{className:"mw-diff-title--navigation",children:[g("td",{colSpan:2,children:e.prev?g("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:r=>i(r,e.prev,e.fromrevid),children:"← Previous"}):g("i",{children:"Oldest version"})}),g("td",{colSpan:2,children:e.next?g("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:r=>i(r,e.torevid,e.next),children:"Next →"}):g("i",{children:"Newest version"})})]})},Iy=t=>{const{data:e,...i}=t,r=g("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...i,children:[g("colgroup",{children:[g("col",{className:"diff-marker"}),g("col",{className:"diff-content"}),g("col",{className:"diff-marker"}),g("col",{className:"diff-content"})]}),g("tbody",{children:[g("tr",{children:[g(yu,{ctx:t.ctx,type:"from",pageid:e.fromid,pagetitle:e.fromtitle,revid:e.fromrevid,size:e.fromsize,timestamp:e.fromtimestamp,username:e.fromuser,userid:e.fromuserid,comment:e.fromcomment,parsedcomment:e.fromparsedcomment}),g(yu,{ctx:t.ctx,type:"to",pageid:e.toid,pagetitle:e.totitle,revid:e.torevid,size:e.tosize,timestamp:e.totimestamp,username:e.touser,userid:e.touserid,comment:e.tocomment,parsedcomment:e.toparsedcomment})]}),g(Ty,{data:e,ctx:t.ctx}),g("div",{id:"diffbody"}),g("tr",{className:"diff-size",style:{textAlign:"center"},children:[g("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),g("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||g("tr",{children:g("td",{colSpan:4,children:g("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:g("i",{children:"No changes"})})})}).outerHTML,r},Ay=(t,e=document)=>e.querySelector(t),Ry=(t,e=document)=>e.querySelectorAll(t);var Ly=Object.create,vo=Object.defineProperty,Ny=Object.getOwnPropertyDescriptor,bu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),wu=t=>{throw TypeError(t)},My=(t,e,i)=>e in t?vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Dy=(t,e)=>vo(t,"name",{value:e,configurable:!0}),jy=t=>[,,,Ly(t?.[bu("metadata")]??null)],Uy=["class","method","getter","setter","accessor","field","value","get","set"],vu=t=>t!==void 0&&typeof t!="function"?wu("Function expected"):t,Fy=(t,e,i,r,n)=>({kind:Uy[t],name:e,metadata:r,addInitializer:s=>i._?wu("Already initialized"):n.push(vu(s||null))}),By=(t,e)=>My(e,bu("metadata"),t[3]),qy=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},Hy=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&Ny(n,i));Dy(n,i);for(var m=r.length-1;m>=0;m--)l=Fy(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,vu(o)&&(n=o);return By(t,n),y&&vo(n,i,y),u?c^4?s:y:n},_u,_o,xu;_u=[ke(["wiki","getUrl","preferences"]),fi(te.object({"quickDiff.keyshortcut":te.string().default("ctrl-d").description("Key shortcut to open quick diff in quick edit modal")}).description("Quick diff options").extra("category","edit"))];class kn extends(xu=Je){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.COMPARE_API_DEFAULT_OPTIONS={prop:["comment","diff","diffsize","ids","parsedcomment","size","timestamp","title","user","rel"].join("|"),difftype:"table"}}start(){this.ctx.set("quickDiff",this),this.ctx.on("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),window.RLQ.push(this.injectHistoryPage.bind(this))}stop(){}injectHistoryPage(){const e=Ay("#mw-history-compare");if(!e)return;Ry(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(g("button",{className:"cdx-button",onClick:n=>{n.preventDefault();const s=new FormData(e),o=Number(s.get("oldid"))||0,a=Number(s.get("diff"))||0;if(!s.get("title")||!o||!a)return this.logger.warn("Missing title or revision IDs");this.comparePages({fromrev:o,torev:a})},children:"Quick Diff"}))})}async injectQuickEdit({modal:e,wikiPage:i,options:r}){if(i.pageid===0||r.section==="new")return;let n;e.addButton({label:"Diff",side:"left",keyPress:await this.ctx.preferences.get("quickDiff.keyshortcut")||void 0,className:"btn btn-secondary",method:()=>{const s=i.title,o=i.revisions?.[0]?.content||"",a=e.get$content().querySelector('textarea[name="text"]')?.value||"";return o===a?this.ctx.modal.notify("info",{title:"Quick Diff",content:"No changes"}):(n=this.comparePages({fromtitle:s,fromtext:o,totitle:s,totext:a,topst:!0},n,{backdrop:!1,draggable:!0}),n)}},2),e.on(e.Event.Close,()=>{n?.destroy(),n=void 0})}comparePages(e,i,r){return!i||i.isDestroyed?i=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",center:!1,...r}).init():i.removeButton("*"),i.setContent(g("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:g(Dt,{})})),i.bringToFront(),window.mw&&mw.loader.getState("mediawiki.diff.styles")!=="ready"&&mw.loader.load(["mediawiki.diff.styles"]),this.ctx.api.post({...this.COMPARE_API_DEFAULT_OPTIONS,...e,action:"compare",format:"json",formatversion:2}).then(n=>{if(!n.data.compare)throw new Error("No compare data received",{cause:n});const{data:{compare:s}}=n;i.setTitle(s.fromtitle&&s.totitle?`${s.fromtitle}${s.fromrevid?` (${s.fromrevid})`:""} ⇔ ${s.totitle}${s.torevid?` (${s.torevid})`:""}`:"Differences");let o;i.setContent(g("section",{style:{minHeight:"70vh"},children:g(Iy,{ref:a=>o=a,data:s,ctx:this.ctx})})),o.addEventListener(Sn.update,a=>{a.stopPropagation(),this.comparePages({fromrev:a.detail.fromrev,torev:a.detail.torev},i,r)},{once:!0}),this.ctx.inject(["quickEdit"],a=>{const l=c=>{c.stopPropagation(),a.quickEdit({revision:c.detail.revid})};o.addEventListener(Sn.edit,l),i.on(i.Event.Close,()=>{o.removeEventListener(Sn.edit,l)})}),s.fromrevid&&s.torevid&&i.addButton({label:"Original Compare Page",side:"right",className:"btn btn-secondary",method:()=>{window.location.href=this.ctx.getUrl("",{oldid:s.fromrevid,diff:s.torevid})}})}).catch(n=>{i.setContent(g(cr,{title:"Failed to load diff",type:"error",children:g("pre",{children:n instanceof Error?n.message:String(n)})}))}),i.show()}}_o=jy(xu),kn=Hy(_o,0,"PluginQuickDiff",_u,kn),qy(_o,1,kn);const zy=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDiff(){return kn}},Symbol.toStringTag,{value:"Module"})),Co=class Co extends Je{constructor(e){super(e,{},"quick-redirect"),this.ctx=e}start(){this.ctx.set("quickRedirect",this.quickRedirect.bind(this)),this.ctx.set("redirectPage",this.redirectPage.bind(this));const e=window.mw?.config.get("wgPageName")||"",i=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],r=>{this.ctx=r,r.toolbox.addButton({id:"quick-redirect",icon:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-symlink",children:[g("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),g("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),g("path",{d:"M9 17l3 -3l-3 -3"}),g("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),g("path",{d:"M5 11v-6a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-9.5"})]}),tooltip:"Quick Redirect",group:"group1",index:2,onClick:()=>{this.quickRedirect(i?{to:e}:{})}}),this.addDisposeHandler(n=>{n.toolbox.removeButton("quick-redirect")})})}stop(){}quickRedirect(e){const i=this.ctx.modal.createObject({title:"Quick Redirect",content:g(Dt,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return i.setContent(g("form",{ref:n=>r=n,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:n=>{if(n.preventDefault(),r?.checkValidity(),!r?.reportValidity())return;const s=new FormData(r),o={from:s.get("from")?.toString().trim(),to:s.get("to")?.toString().trim(),reason:s.get("reason")||"",overwrite:s.get("overwrite")==="on"};if(!o.from||!o.to){this.ctx.modal.notify("error",{title:"Failed to redirect",content:"From and to are required."});return}i.setLoadingState(!0),this.redirectPage(o).then(a=>{i.close(),this.ctx.modal.notify("success",{title:"Redirect successful",content:"The redirect has been created."})}).catch(a=>{i.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to redirect",content:a instanceof Error?a.message:String(a)})})},children:[g(ou,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),g(ur,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),g("div",{children:g(Ei,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:"Force create redirect even if the from page already exists"})})]})),i.setButtons([{label:"Create Redirect",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),i.show()}async redirectPage(e){const{from:i,to:r,reason:n="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:i}),a=`#REDIRECT [[:${r}]]`;return o.edit({text:a,summary:n},{createonly:!s})}};Co.inject=["api","wikiPage","modal"];let xo=Co;const Wy=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:xo},Symbol.toStringTag,{value:"Module"}));var Ky=Object.create,So=Object.defineProperty,Vy=Object.getOwnPropertyDescriptor,Su=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ku=t=>{throw TypeError(t)},Gy=(t,e,i)=>e in t?So(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,Qy=(t,e)=>So(t,"name",{value:e,configurable:!0}),Yy=t=>[,,,Ky(t?.[Su("metadata")]??null)],Jy=["class","method","getter","setter","accessor","field","value","get","set"],Eu=t=>t!==void 0&&typeof t!="function"?ku("Function expected"):t,Xy=(t,e,i,r,n)=>({kind:Jy[t],name:e,metadata:r,addInitializer:s=>i._?ku("Already initialized"):n.push(Eu(s||null))}),Zy=(t,e)=>Gy(e,Su("metadata"),t[3]),eb=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},tb=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&Vy(n,i));Qy(n,i);for(var m=r.length-1;m>=0;m--)l=Xy(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,Eu(o)&&(n=o);return Zy(t,n),y&&So(n,i,y),u?c^4?s:y:n},$u,ko,Pu;$u=[fi(te.object({toolboxAlwaysShow:te.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),ke(["preferences"])];class En extends(Pu=$t){constructor(e){super(e,"toolbox",!1),this.ctx=e,this.container=void 0}async start(){this.container=this.createToolbox(),this.ctx.preferences.get("toolboxAlwaysShow").then(e=>{e&&this.container.classList.add("is-persistent")}),this.setupHoverLogic(),document.body.appendChild(this.container),this.updateButtonDelays()}stop(){this.container?.remove()}get isPersistent(){return this.container.classList.contains("is-persistent")}setupHoverLogic(){let e=null;this.container.addEventListener("mouseenter",()=>{e&&(clearTimeout(e),e=null),this.isPersistent||this.container.classList.add("is-hovered")}),this.container.addEventListener("mouseleave",()=>{this.isPersistent||(e=window.setTimeout(()=>{this.container.classList.remove("is-hovered")},150))})}calculateButtonDelay(e,i){if(i<=1)return 0;const r=.15,n=e/(i-1),s=r*Math.sqrt(n);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(i=>{const r=i.querySelectorAll(".btn-tip-group"),n=r.length;r.forEach((s,o)=>{const a=this.calculateButtonDelay(o,n);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return g("div",{id:"ipe-edit-toolbox",children:[g("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),g("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),g("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{this.toggle()},children:g("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[g("rect",{width:"448",height:"512",fill:"none"}),g("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32"})]})})]})}normalizeButtonId(e){return e||(e=Math.random().toString(36).substring(2,8)),`ipe-toolbox__${e.trim()}`.replace(/\s\.#/g,"-")}addButton(e){let{id:i,group:r,icon:n,tooltip:s,itemProps:o,buttonProps:a,onClick:l,index:c}=e;i=this.normalizeButtonId(i);const u=this.container.querySelector(`#${i}`);u&&(this.ctx.logger("toolbox").warn(`Button with id ${i} already exists, replacing it.`),u.remove());let f=null;if(typeof r>"u"||r==="auto"){const y=this.container.querySelector(".btn-group.group1"),m=this.container.querySelector(".btn-group.group2"),E=y?.children.length||0,j=m?.children.length||0;f=E<=j?y:m}else f=this.container.querySelector(`.btn-group.${r}`);if(!f)throw new Error(`Button group ${r} not found`);const d=g("li",{class:"btn-tip-group",id:i,onClick:l,...o,children:[g("div",{class:"btn-tip",children:s}),g("button",{id:`${i}-btn`,class:"ipe-toolbox-btn",...a,children:n})]});return typeof c=="number"?c<=0?f.prepend(d):c>=f.children.length?f.appendChild(d):f.children[c]?.before(d):f.appendChild(d),this.ctx.emit("toolbox/button-added",{ctx:this.ctx,button:d}),this.updateButtonDelays(),d}removeButton(e){this.container.querySelector(`.ipe-toolbox-btn#${e}`)?.remove(),this.ctx.emit("toolbox/button-removed",{ctx:this.ctx,id:e}),this.updateButtonDelays()}getContainer(){return this.container}get isOpened(){return this.container.classList.contains("is-persistent")||this.container.classList.contains("is-hovered")}toggle(e){const i=this.isPersistent,r=typeof e=="boolean"?e:!i;this.container.classList.toggle("is-persistent",r),this.container.classList.remove("is-hovered"),this.ctx.preferences.set("toolboxAlwaysShow",r)}}ko=Yy(Pu),En=tb(ko,0,"PluginToolbox",$u,En),eb(ko,1,En);const ib=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return En}},Symbol.toStringTag,{value:"Module"}));var rb=Object.create,Eo=Object.defineProperty,nb=Object.getOwnPropertyDescriptor,Cu=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ou=t=>{throw TypeError(t)},sb=(t,e,i)=>e in t?Eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,ob=(t,e)=>Eo(t,"name",{value:e,configurable:!0}),ab=t=>[,,,rb(t?.[Cu("metadata")]??null)],lb=["class","method","getter","setter","accessor","field","value","get","set"],Tu=t=>t!==void 0&&typeof t!="function"?Ou("Function expected"):t,cb=(t,e,i,r,n)=>({kind:lb[t],name:e,metadata:r,addInitializer:s=>i._?Ou("Already initialized"):n.push(Tu(s||null))}),ub=(t,e)=>sb(e,Cu("metadata"),t[3]),fb=(t,e,i,r)=>{for(var n=0,s=t[e>>1],o=s&&s.length;n<o;n++)s[n].call(i);return r},hb=(t,e,i,r,n,s)=>{var o,a,l,c=e&7,u=!1,f=0,d=t[f]||(t[f]=[]),y=c&&(n=n.prototype,c<5&&(c>3||!u)&&nb(n,i));ob(n,i);for(var m=r.length-1;m>=0;m--)l=cb(c,i,a={},t[3],d),o=(0,r[m])(n,l),a._=1,Tu(o)&&(n=o);return ub(t,n),y&&Eo(n,i,y),u?c^4?s:y:n},Iu,$o,Au;Iu=[ke(["preferences","wikiPage","wikiTitle","modal","preferencesUI"])];class $n extends(Au=Je){constructor(e){super(e,{},"pref-sync"),this.ctx=e,e.set("prefSync",this)}start(){const e=this.ctx;e.preferences.defineCategory({name:"pref-sync",label:"Sync",description:"Import and export preferences",index:98}),e.preferences.registerCustomConfig("pref-sync",te.object({"preferences-ui-pref-sync":te.const(g("section",{children:g("div",{style:{display:"flex",gap:"1rem"},children:[g("button",{onClick:i=>{i.preventDefault();const r=e.preferencesUI.getExistingModal(),n=i.target;n.disabled=!0,r?.setLoadingState(!0),this.importFromUserPage().then(s=>{const o=Object.keys(s??{}).length;this.ctx.modal.notify("success",{title:"Preferences Imported",content:g("div",{children:[g("div",{children:["Successfully imported ",o," ",o>1?"settings":"setting",":"]}),g("ol",{style:{listStyle:"auto",paddingLeft:"1em"},children:Object.entries(s??{}).map(([a,l])=>g("li",{children:[a,": ",l?.toString()]},a))})]})}),r?.close?.()}).finally(()=>{n.disabled=!1,r?.setLoadingState(!1)})},children:"Import"}),g("button",{onClick:i=>{i.preventDefault();const r=i.target;r.disabled=!0;const n=e.preferencesUI.getExistingModal();n?.setLoadingState(!0),this.exportToUserPage().then(s=>{this.ctx.modal.notify("success",{title:"Preferences Exported",content:g("p",{children:["Your preferences have been exported to"," ",g("a",{href:s.getURL().toString(),target:"_blank",children:s.getPrefixedText()}),"."]})}),n?.close?.()}).finally(()=>{r.disabled=!1,n?.setLoadingState(!1)})},children:"Export"})]})})).description("Backup your preferences to user page").role("raw-html")}).description("Backup your preferences to user page"),"pref-sync")}stop(){}getUserPrefsPageTitle(){try{const e=this.ctx.wiki?.userInfo?.name;return e?this.ctx.wikiTitle.newTitle(`User:${e}/ipe-prefs.json`,2):null}catch{return null}}async importFromUserPage(){const e=this.ctx,i=this.getUserPrefsPageTitle();if(!i)return this.logger.debug("Cannot get user page title, skipping load"),{};try{const r=i.getURL({action:"raw",ctype:"application/json"});let n;try{if(n=await fetch(r.toString()),!n.ok){if(n.status===404)return this.logger.debug("User preferences page does not exist"),{};throw new Error(`HTTP ${n.status}: ${n.statusText}`)}}catch(o){if(o instanceof TypeError&&o.message.includes("Failed to fetch"))return this.logger.debug("User preferences page does not exist or network error"),{};throw o}let s;try{s=await n.json()}catch(o){return this.logger.warn("Failed to parse user preferences JSON:",o),{}}for(const[o,a]of Object.entries(s))await e.preferences.set(o,a);return this.logger.info("Loaded preferences from user page:",i),s}catch(r){return this.logger.error("Failed to load preferences from user page:",r),{}}}async exportToUserPage(){const e=this.ctx,i=this.getUserPrefsPageTitle();if(!i)throw new Error("Cannot get user page title");const r=await e.preferences.getExportable(),n=JSON.stringify(r,null,2);try{return await this.ctx.wikiPage.newBlankPage({title:i.toString(),ns:2}).edit({text:n,summary:"Update InPageEdit preferences",watchlist:Ye.nochange}),this.logger.info("Exported preferences to user page:",i),i}catch(s){throw this.logger.error("Failed to export preferences to user page:",s),s}}}$o=ab(Au),$n=hb($o,0,"PluginPrefSync",Iu,$n),fb($o,1,$n);const db=Object.freeze(Object.defineProperty({__proto__:null,get PluginPrefSync(){return $n}},Symbol.toStringTag,{value:"Module"}));Y.BasePlugin=Je,Y.InPageEdit=ui,Y.Inject=ke,Y.Logger=Wo,Y.LoggerLevel=Bn,Y.Schema=te,Y.Service=$t,Y.createLogger=Go,Object.defineProperty(Y,Symbol.toStringTag,{value:"Module"})});
|
|
115
122
|
//# sourceMappingURL=index.umd.js.map
|