@inpageedit/core 0.6.0 → 0.8.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-YVn1ANbm.js +27 -0
- package/dist/IconQuickEdit-YVn1ANbm.js.map +1 -0
- package/dist/InPageEdit.d.ts +7 -5
- package/dist/InputBox-BV4m05Xs.js.map +1 -1
- package/dist/Preferences-Bg3J5Ur9.js.map +1 -1
- package/dist/RadioBox-nJqWsxW2.js.map +1 -1
- package/dist/__test__/utils/constants.d.ts +1 -1
- package/dist/components/Icon/IconEdit.d.ts +2 -0
- package/dist/components/Icon/IconQuickEdit.d.ts +2 -0
- package/dist/components/MwUserLinks.d.ts +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/index--xn9BebC.js +1257 -0
- package/dist/{index-5zB57uWM.js.map → index--xn9BebC.js.map} +1 -1
- package/dist/{index-SDBp__LY.js → index-BT1mN_St.js} +68 -65
- package/dist/{index-SDBp__LY.js.map → index-BT1mN_St.js.map} +1 -1
- package/dist/index-Bh70Udzi.js.map +1 -1
- package/dist/index-C0V2s48o.js +122 -0
- package/dist/index-C0V2s48o.js.map +1 -0
- package/dist/index-CvhkVj_L.js.map +1 -1
- package/dist/{index-clwjxJi5.js → index-DDWds9Jg.js} +77 -74
- package/dist/index-DDWds9Jg.js.map +1 -0
- package/dist/index-DDef1ojx.js +166 -0
- package/dist/index-DDef1ojx.js.map +1 -0
- package/dist/{index-BqqQgaGG.js → index-DTA86mHU.js} +5 -4
- package/dist/index-DTA86mHU.js.map +1 -0
- package/dist/{index-CPCQc37I.js → index-DlgTb4XY.js} +4 -4
- package/dist/index-DlgTb4XY.js.map +1 -0
- package/dist/{index-BnRuHI16.js → index-DpLwTw4C.js} +1967 -1693
- package/dist/index-DpLwTw4C.js.map +1 -0
- package/dist/{index-ClYojws9.js → index-TzKe6Ebm.js} +8 -7
- package/dist/index-TzKe6Ebm.js.map +1 -0
- package/dist/index-VzP81S7B.js +139 -0
- package/dist/index-VzP81S7B.js.map +1 -0
- package/dist/index-lZkYoUca.js.map +1 -1
- package/dist/index-loWqosf7.js +331 -0
- package/dist/index-loWqosf7.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/makeCallable-LDU0xZMJ.js.map +1 -1
- package/dist/models/WikiPage/index.d.ts +42 -47
- package/dist/models/WikiTitle/index.d.ts +3 -2
- package/dist/noop-ClDc6zv4.js.map +1 -1
- package/dist/plugins/in-article-links/index.d.ts +5 -17
- package/dist/plugins/quick-delete/index.d.ts +7 -5
- package/dist/plugins/quick-diff/PluginQuickDiffCore.d.ts +2 -0
- package/dist/plugins/quick-diff/components/DiffTable.d.ts +17 -0
- package/dist/plugins/quick-edit/index.d.ts +12 -10
- package/dist/plugins/quick-move/index.d.ts +3 -1
- package/dist/plugins/quick-preview/index.d.ts +13 -16
- package/dist/plugins/quick-redirect/index.d.ts +3 -1
- package/dist/plugins/toolbox/index.d.ts +7 -2
- package/dist/services/ApiService.d.ts +2 -2
- package/dist/services/ModalService/IPEModal.d.ts +1 -1
- package/dist/services/WikiMetadataService.d.ts +108 -0
- package/dist/services/WikiPageService.d.ts +8 -7
- package/dist/services/WikiTitleService.d.ts +43 -3
- package/dist/style.css +1 -1
- package/dist/types/{SiteMetadata.d.ts → WikiMetadata.d.ts} +17 -17
- package/dist/utils/url.d.ts +24 -0
- package/lib/index.umd.js +28 -28
- package/lib/index.umd.js.map +1 -1
- package/lib/style.css +1 -1
- package/package.json +11 -2
- package/dist/index-5zB57uWM.js +0 -1142
- package/dist/index-B7Ok-t-3.js +0 -128
- package/dist/index-B7Ok-t-3.js.map +0 -1
- package/dist/index-BHruEVsx.js +0 -319
- package/dist/index-BHruEVsx.js.map +0 -1
- package/dist/index-BnRuHI16.js.map +0 -1
- package/dist/index-BqqQgaGG.js.map +0 -1
- package/dist/index-Bs5MFAHs.js +0 -110
- package/dist/index-Bs5MFAHs.js.map +0 -1
- package/dist/index-C9QOZJ8o.js +0 -167
- package/dist/index-C9QOZJ8o.js.map +0 -1
- package/dist/index-CPCQc37I.js.map +0 -1
- package/dist/index-ClYojws9.js.map +0 -1
- package/dist/index-clwjxJi5.js.map +0 -1
- package/dist/services/SiteMetadataService.d.ts +0 -58
package/lib/index.umd.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(le,ve){typeof exports=="object"&&typeof module<"u"?ve(exports):typeof define=="function"&&define.amd?define(["exports"],ve):(le=typeof globalThis<"u"?globalThis:le||self,ve(le.InPageEditBundle={}))})(this,function(le){"use strict";var lb=Object.defineProperty;var bf=le=>{throw TypeError(le)};var cb=(le,ve,Te)=>ve in le?lb(le,ve,{enumerable:!0,configurable:!0,writable:!0,value:Te}):le[ve]=Te;var te=(le,ve,Te)=>cb(le,typeof ve!="symbol"?ve+"":ve,Te),ia=(le,ve,Te)=>ve.has(le)||bf("Cannot "+Te);var _f=(le,ve,Te)=>(ia(le,ve,"read from private field"),Te?Te.call(le):ve.get(le)),sa=(le,ve,Te)=>ve.has(le)?bf("Cannot add the same private member more than once"):ve instanceof WeakSet?ve.add(le):ve.set(le,Te),wf=(le,ve,Te,ne)=>(ia(le,ve,"write to private field"),ne?ne.call(le,Te):ve.set(le,Te),Te),Dr=(le,ve,Te)=>(ia(le,ve,"access private method"),Te);var dt,Fn,vn,Bn,Un,zn,Hn,Oe,ot,At,Sf,Ef,kf,$f,Ir;const ve=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=ve);var Te=Object.defineProperty,ne=(t,e)=>Te(t,"name",{value:e,configurable:!0});function Cf(){}ne(Cf,"noop");function ke(t){return t==null}ne(ke,"isNullable");function Pf(t){return!ke(t)}ne(Pf,"isNonNullable");function Lr(t){return t&&typeof t=="object"&&!Array.isArray(t)}ne(Lr,"isPlainObject");function oa(t,e){return Object.fromEntries(Object.entries(t).filter(([n,r])=>e(n,r)))}ne(oa,"filterKeys");function Nt(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(Nt,"mapValues");function aa(t,e,n){if(!e)return{...t};const r={};for(const i of e)(n||t[i]!==void 0)&&(r[i]=t[i]);return r}ne(aa,"pick");function Of(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(Of,"omit");function ze(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(ze,"defineProperty");function If(t,e){return e.every(n=>t.includes(n))}ne(If,"contain");function Tf(t,e){return t.filter(n=>e.includes(n))}ne(Tf,"intersection");function Af(t,e){return t.filter(n=>!e.includes(n))}ne(Af,"difference");function Nf(t,e){return Array.from(new Set([...t,...e]))}ne(Nf,"union");function Rf(t){return[...new Set(t)]}ne(Rf,"deduplicate");function qt(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(qt,"remove");function Df(t){return Array.isArray(t)?t:ke(t)?[]:[t]}ne(Df,"makeArray");function Wt(t,e){return arguments.length===1?n=>Wt(t,n):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}ne(Wt,"is");function Jn(t){return Wt("ArrayBuffer",t)||Wt("SharedArrayBuffer",t)}ne(Jn,"isArrayBufferLike");function la(t){return Jn(t)||ArrayBuffer.isView(t)}ne(la,"isArrayBufferSource");var bt;(t=>{t.is=Jn,t.isSource=la;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,ne(e,"fromSource");function n(o){if(typeof Buffer<"u")return Buffer.from(o).toString("base64");let a="";const l=new Uint8Array(o);for(let u=0;u<l.byteLength;u++)a+=String.fromCharCode(l[u]);return btoa(a)}t.toBase64=n,ne(n,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,ne(r,"fromBase64");function i(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=i,ne(i,"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 u=0;u<a.length;u+=2)l.push(parseInt(`${a[u]}${a[u+1]}`,16));return Uint8Array.from(l).buffer}t.fromHex=s,ne(s,"fromHex")})(bt||(bt={})),bt.fromBase64,bt.toBase64,bt.fromHex,bt.toHex;function Mr(t,e=new Map){if(!t||typeof t!="object")return t;if(Wt("Date",t))return new Date(t.valueOf());if(Wt("RegExp",t))return new RegExp(t.source,t.flags);if(Jn(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const n=e.get(t);if(n)return n;if(Array.isArray(t)){const i=[];return e.set(t,i),t.forEach((s,o)=>{i[o]=Reflect.apply(Mr,null,[s,e])}),i}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const i of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,i)};"value"in s&&(s.value=Reflect.apply(Mr,null,[s.value,e])),Reflect.defineProperty(r,i,s)}return r}ne(Mr,"clone");function on(t,e,n){if(t===e||!n&&ke(t)&&ke(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(i,s){return i(t)?i(e)?s(t,e):!1:i(e)?!1:void 0}return ne(r,"check"),r(Array.isArray,(i,s)=>i.length===s.length&&i.every((o,a)=>on(o,s[a])))??r(Wt("Date"),(i,s)=>i.valueOf()===s.valueOf())??r(Wt("RegExp"),(i,s)=>i.source===s.source&&i.flags===s.flags)??r(Jn,(i,s)=>{if(i.byteLength!==s.byteLength)return!1;const o=new Uint8Array(i),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(i=>on(t[i],e[i],n))}ne(on,"deepEqual");function Lf(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne(Lf,"capitalize");function Mf(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(Mf,"uncapitalize");function jf(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(jf,"camelCase");function Xi(t,e,n){const r=[];let i=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(i===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(n),r.push(o+32)}else i!==0&&r.push(n),r.push(o+32);i=1}else o>=97&&o<=122?(r.push(o),i=2):e.includes(o)?(i!==0&&r.push(n),i=0):r.push(o)}return String.fromCharCode(...r)}ne(Xi,"tokenize");function Ff(t){return Xi(t,[45,95],45)}ne(Ff,"paramCase");function Bf(t){return Xi(t,[45,95],95)}ne(Bf,"snakeCase");function Uf(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(Uf,"formatProperty");function ca(t){return t.replace(/\/$/,"")}ne(ca,"trimSlash");function zf(t){return t.startsWith("/")||(t="/"+t),ca(t)}ne(zf,"sanitize");var ua;(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 n(y){e=y}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(y=new Date,b){return typeof y=="number"&&(y=new Date(y)),b===void 0&&(b=e),Math.floor((y.valueOf()/t.minute-b)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(y,b){const I=new Date(y*t.day);return b===void 0&&(b=e),new Date(+I+b*t.minute)}t.fromDateNumber=s,ne(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 b=a.exec(y);return b?(parseFloat(b[1])*t.week||0)+(parseFloat(b[2])*t.day||0)+(parseFloat(b[3])*t.hour||0)+(parseFloat(b[4])*t.minute||0)+(parseFloat(b[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function u(y){const b=l(y);return b?y=Date.now()+b:/^\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=u,ne(u,"parseDate");function c(y){const b=Math.abs(y);return b>=t.day-t.hour/2?Math.round(y/t.day)+"d":b>=t.hour-t.minute/2?Math.round(y/t.hour)+"h":b>=t.minute-t.second/2?Math.round(y/t.minute)+"m":b>=t.second?Math.round(y/t.second)+"s":y+"ms"}t.format=c,ne(c,"format");function f(y,b=2){return y.toString().padStart(b,"0")}t.toDigits=f,ne(f,"toDigits");function v(y,b=new Date){return y.replace("yyyy",b.getFullYear().toString()).replace("yy",b.getFullYear().toString().slice(2)).replace("MM",f(b.getMonth()+1)).replace("dd",f(b.getDate())).replace("hh",f(b.getHours())).replace("mm",f(b.getMinutes())).replace("ss",f(b.getSeconds())).replace("SSS",f(b.getMilliseconds(),3))}t.template=v,ne(v,"template")})(ua||(ua={}));var Hf=Object.defineProperty,ie=(t,e)=>Hf(t,"name",{value:e,configurable:!0}),Y={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")},qf=function*(){}.constructor,fa=async function*(){}.constructor;function Zi(t){return!(!t.prototype||t instanceof qf||fa!==Function&&t instanceof fa)}ie(Zi,"isConstructor");function Qn(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(Qn,"resolveConfig");function da(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(da,"isUnproxyable");function es(t,e){if(t===Object.prototype)return e;const n=Object.create(es(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(es,"joinPrototype");function ts(t){return t&&(typeof t=="object"||typeof t=="function")}ie(ts,"isObject");function _t(t,e,n){if(!ts(e))return e;if(Object.hasOwn(e,Y.shadow))return Object.getPrototypeOf(e);const r=e[Y.tracker];return r?Fr(t,e,r,n):e}ie(_t,"getTraceable");function Xn(t,e){return e?new Proxy(t,{get:ie((n,r,i)=>r in e&&r!=="constructor"?Reflect.get(e,r,i):Reflect.get(n,r,i),"get"),set:ie((n,r,i,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,i,s):Reflect.set(n,r,i,s),"set")}):t}ie(Xn,"withProps");function jr(t,e,n){return Xn(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(jr,"withProp");function ns(t,e,n,r){if(!n)return r;const i=Reflect.getOwnPropertyDescriptor(e,n)?.value;return i?jr(r,n,t.extend({[Y.shadow]:i})):r}ie(ns,"createShadow");function ha(t,e,n,r){return new Proxy(e,{apply:ie((i,s,o)=>(s===n&&(s=r),o=o.map(a=>typeof a!="function"||a[Y.original]?a:new Proxy(a,{get:ie((l,u,c)=>{if(u===Y.original)return l;const f=Reflect.get(l,u,c);return u==="toString"&&f===Function.prototype.toString?function(...v){return Reflect.apply(f,this===c?l:this,v)}:f},"get"),apply:ie((l,u,c)=>Reflect.apply(l,_t(t,u),c.map(f=>_t(t,f))),"apply"),construct:ie((l,u,c)=>Reflect.construct(l,u.map(f=>_t(t,f)),c),"construct")})),_t(t,Reflect.apply(i,s,o))),"apply")})}ie(ha,"createShadowMethod");function Fr(t,e,n,r){t[Y.shadow]&&(t=Object.getPrototypeOf(t));const i=new Proxy(e,{get:ie((s,o,a)=>{if(o===Y.original)return s;if(o===n.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.get(t,`${n.associate}.${o}`,jr(t,Y.receiver,a));const l=ns(t,s,n.property,a),u=Reflect.get(s,o,l),c=u?.[Y.tracker];return c?Fr(t,u,c):!r&&typeof u=="function"?ha(t,u,a,l):u},"get"),set:ie((s,o,a,l)=>{if(o===Y.original||o===n.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.set(t,`${n.associate}.${o}`,a,jr(t,Y.receiver,l));const u=ns(t,s,n.property,l);return Reflect.set(s,o,a,u)},"set"),apply:ie((s,o,a)=>rs(i,s,o,a),"apply")});return i}ie(Fr,"createTraceable");function rs(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(rs,"applyTraceable");function is(t,e,n){const r=ie(function(...i){const s=Fr(r.ctx,r,n);return rs(s,r,this,i)},"self");return ze(r,"name",t),Object.setPrototypeOf(r,e)}ie(is,"createCallable");var Wf=(dt=class{constructor(e){this.ctx=e,ze(this,Y.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,n){let r=e[Y.internal][n];for(;r?.type==="alias";)n=r.name,r=e[Y.internal][n];return[n,r]}static checkInject(e,n,r){if(e=e[Y.shadow]??e,["prototype","then","registry","lifecycle"].includes(n)||n[0]==="$"||n[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",n))return;const i=r.stack.split(`
|
|
1
|
+
(function(le,be){typeof exports=="object"&&typeof module<"u"?be(exports):typeof define=="function"&&define.amd?define(["exports"],be):(le=typeof globalThis<"u"?globalThis:le||self,be(le.InPageEditBundle={}))})(this,function(le){"use strict";var gb=Object.defineProperty;var Sf=le=>{throw TypeError(le)};var vb=(le,be,Ae)=>be in le?gb(le,be,{enumerable:!0,configurable:!0,writable:!0,value:Ae}):le[be]=Ae;var te=(le,be,Ae)=>vb(le,typeof be!="symbol"?be+"":be,Ae),oa=(le,be,Ae)=>be.has(le)||Sf("Cannot "+Ae);var me=(le,be,Ae)=>(oa(le,be,"read from private field"),Ae?Ae.call(le):be.get(le)),jr=(le,be,Ae)=>be.has(le)?Sf("Cannot add the same private member more than once"):be instanceof WeakSet?be.add(le):be.set(le,Ae),gt=(le,be,Ae,ne)=>(oa(le,be,"write to private field"),ne?ne.call(le,Ae):be.set(le,Ae),Ae),Fr=(le,be,Ae)=>(oa(le,be,"access private method"),Ae);var ht,qn,bn,zn,Hn,Wn,Kn,Te,at,Rt,kf,Pf,$f,Cf,Nr;const be=()=>{let t,e;return{promise:new Promise((r,i)=>{t=r,e=i}),resolve:t,reject:e}};Promise.withResolvers||(Promise.withResolvers=be);var Ae=Object.defineProperty,ne=(t,e)=>Ae(t,"name",{value:e,configurable:!0});function Of(){}ne(Of,"noop");function Pe(t){return t==null}ne(Pe,"isNullable");function Tf(t){return!Pe(t)}ne(Tf,"isNonNullable");function Br(t){return t&&typeof t=="object"&&!Array.isArray(t)}ne(Br,"isPlainObject");function aa(t,e){return Object.fromEntries(Object.entries(t).filter(([n,r])=>e(n,r)))}ne(aa,"filterKeys");function Dt(t,e){return Object.fromEntries(Object.entries(t).map(([n,r])=>[n,e(r,n)]))}ne(Dt,"mapValues");function la(t,e,n){if(!e)return{...t};const r={};for(const i of e)(n||t[i]!==void 0)&&(r[i]=t[i]);return r}ne(la,"pick");function If(t,e){if(!e)return{...t};const n={...t};for(const r of e)Reflect.deleteProperty(n,r);return n}ne(If,"omit");function ze(t,e,n){return Object.defineProperty(t,e,{writable:!0,value:n,enumerable:!1})}ne(ze,"defineProperty");function Af(t,e){return e.every(n=>t.includes(n))}ne(Af,"contain");function Nf(t,e){return t.filter(n=>e.includes(n))}ne(Nf,"intersection");function Rf(t,e){return t.filter(n=>!e.includes(n))}ne(Rf,"difference");function Df(t,e){return Array.from(new Set([...t,...e]))}ne(Df,"union");function Lf(t){return[...new Set(t)]}ne(Lf,"deduplicate");function Kt(t,e){const n=t?.indexOf(e);return n>=0?(t.splice(n,1),!0):!1}ne(Kt,"remove");function Mf(t){return Array.isArray(t)?t:Pe(t)?[]:[t]}ne(Mf,"makeArray");function Vt(t,e){return arguments.length===1?n=>Vt(t,n):t in globalThis&&e instanceof globalThis[t]||Object.prototype.toString.call(e).slice(8,-1)===t}ne(Vt,"is");function Zn(t){return Vt("ArrayBuffer",t)||Vt("SharedArrayBuffer",t)}ne(Zn,"isArrayBufferLike");function ca(t){return Zn(t)||ArrayBuffer.isView(t)}ne(ca,"isArrayBufferSource");var _t;(t=>{t.is=Zn,t.isSource=ca;function e(o){return ArrayBuffer.isView(o)?o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength):o}t.fromSource=e,ne(e,"fromSource");function n(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=n,ne(n,"toBase64");function r(o){return typeof Buffer<"u"?e(Buffer.from(o,"base64")):Uint8Array.from(atob(o),a=>a.charCodeAt(0))}t.fromBase64=r,ne(r,"fromBase64");function i(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=i,ne(i,"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,ne(s,"fromHex")})(_t||(_t={})),_t.fromBase64,_t.toBase64,_t.fromHex,_t.toHex;function Ur(t,e=new Map){if(!t||typeof t!="object")return t;if(Vt("Date",t))return new Date(t.valueOf());if(Vt("RegExp",t))return new RegExp(t.source,t.flags);if(Zn(t))return t.slice(0);if(ArrayBuffer.isView(t))return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);const n=e.get(t);if(n)return n;if(Array.isArray(t)){const i=[];return e.set(t,i),t.forEach((s,o)=>{i[o]=Reflect.apply(Ur,null,[s,e])}),i}const r=Object.create(Object.getPrototypeOf(t));e.set(t,r);for(const i of Reflect.ownKeys(t)){const s={...Reflect.getOwnPropertyDescriptor(t,i)};"value"in s&&(s.value=Reflect.apply(Ur,null,[s.value,e])),Reflect.defineProperty(r,i,s)}return r}ne(Ur,"clone");function ln(t,e,n){if(t===e||!n&&Pe(t)&&Pe(e))return!0;if(typeof t!=typeof e||typeof t!="object"||!t||!e)return!1;function r(i,s){return i(t)?i(e)?s(t,e):!1:i(e)?!1:void 0}return ne(r,"check"),r(Array.isArray,(i,s)=>i.length===s.length&&i.every((o,a)=>ln(o,s[a])))??r(Vt("Date"),(i,s)=>i.valueOf()===s.valueOf())??r(Vt("RegExp"),(i,s)=>i.source===s.source&&i.flags===s.flags)??r(Zn,(i,s)=>{if(i.byteLength!==s.byteLength)return!1;const o=new Uint8Array(i),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(i=>ln(t[i],e[i],n))}ne(ln,"deepEqual");function jf(t){return t.charAt(0).toUpperCase()+t.slice(1)}ne(jf,"capitalize");function Ff(t){return t.charAt(0).toLowerCase()+t.slice(1)}ne(Ff,"uncapitalize");function Bf(t){return t.replace(/[_-][a-z]/g,e=>e.slice(1).toUpperCase())}ne(Bf,"camelCase");function ts(t,e,n){const r=[];let i=0;for(let s=0;s<t.length;s++){const o=t.charCodeAt(s);if(o>=65&&o<=90){if(i===1){const a=t.charCodeAt(s+1);a>=97&&a<=122&&r.push(n),r.push(o+32)}else i!==0&&r.push(n),r.push(o+32);i=1}else o>=97&&o<=122?(r.push(o),i=2):e.includes(o)?(i!==0&&r.push(n),i=0):r.push(o)}return String.fromCharCode(...r)}ne(ts,"tokenize");function Uf(t){return ts(t,[45,95],45)}ne(Uf,"paramCase");function qf(t){return ts(t,[45,95],95)}ne(qf,"snakeCase");function zf(t){return typeof t!="string"?`[${t.toString()}]`:/^[a-z_$][\w$]*$/i.test(t)?`.${t}`:`[${JSON.stringify(t)}]`}ne(zf,"formatProperty");function ua(t){return t.replace(/\/$/,"")}ne(ua,"trimSlash");function Hf(t){return t.startsWith("/")||(t="/"+t),ua(t)}ne(Hf,"sanitize");var fa;(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 n(y){e=y}t.setTimezoneOffset=n,ne(n,"setTimezoneOffset");function r(){return e}t.getTimezoneOffset=r,ne(r,"getTimezoneOffset");function i(y=new Date,b){return typeof y=="number"&&(y=new Date(y)),b===void 0&&(b=e),Math.floor((y.valueOf()/t.minute-b)/1440)}t.getDateNumber=i,ne(i,"getDateNumber");function s(y,b){const I=new Date(y*t.day);return b===void 0&&(b=e),new Date(+I+b*t.minute)}t.fromDateNumber=s,ne(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 b=a.exec(y);return b?(parseFloat(b[1])*t.week||0)+(parseFloat(b[2])*t.day||0)+(parseFloat(b[3])*t.hour||0)+(parseFloat(b[4])*t.minute||0)+(parseFloat(b[5])*t.second||0):0}t.parseTime=l,ne(l,"parseTime");function c(y){const b=l(y);return b?y=Date.now()+b:/^\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,ne(c,"parseDate");function u(y){const b=Math.abs(y);return b>=t.day-t.hour/2?Math.round(y/t.day)+"d":b>=t.hour-t.minute/2?Math.round(y/t.hour)+"h":b>=t.minute-t.second/2?Math.round(y/t.minute)+"m":b>=t.second?Math.round(y/t.second)+"s":y+"ms"}t.format=u,ne(u,"format");function f(y,b=2){return y.toString().padStart(b,"0")}t.toDigits=f,ne(f,"toDigits");function m(y,b=new Date){return y.replace("yyyy",b.getFullYear().toString()).replace("yy",b.getFullYear().toString().slice(2)).replace("MM",f(b.getMonth()+1)).replace("dd",f(b.getDate())).replace("hh",f(b.getHours())).replace("mm",f(b.getMinutes())).replace("ss",f(b.getSeconds())).replace("SSS",f(b.getMilliseconds(),3))}t.template=m,ne(m,"template")})(fa||(fa={}));var Wf=Object.defineProperty,ie=(t,e)=>Wf(t,"name",{value:e,configurable:!0}),Y={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")},Kf=function*(){}.constructor,da=async function*(){}.constructor;function ns(t){return!(!t.prototype||t instanceof Kf||da!==Function&&t instanceof da)}ie(ns,"isConstructor");function er(t,e){const n=t.Config||t.schema;return n&&t.schema!==!1&&(e=n(e)),e??{}}ie(er,"resolveConfig");function ha(t){return[Map,Set,Date,Promise].some(e=>t instanceof e)}ie(ha,"isUnproxyable");function rs(t,e){if(t===Object.prototype)return e;const n=Object.create(rs(Object.getPrototypeOf(t),e));for(const r of Reflect.ownKeys(t))Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r));return n}ie(rs,"joinPrototype");function is(t){return t&&(typeof t=="object"||typeof t=="function")}ie(is,"isObject");function xt(t,e,n){if(!is(e))return e;if(Object.hasOwn(e,Y.shadow))return Object.getPrototypeOf(e);const r=e[Y.tracker];return r?zr(t,e,r,n):e}ie(xt,"getTraceable");function tr(t,e){return e?new Proxy(t,{get:ie((n,r,i)=>r in e&&r!=="constructor"?Reflect.get(e,r,i):Reflect.get(n,r,i),"get"),set:ie((n,r,i,s)=>r in e&&r!=="constructor"?Reflect.set(e,r,i,s):Reflect.set(n,r,i,s),"set")}):t}ie(tr,"withProps");function qr(t,e,n){return tr(t,Object.defineProperty(Object.create(null),e,{value:n,writable:!1}))}ie(qr,"withProp");function ss(t,e,n,r){if(!n)return r;const i=Reflect.getOwnPropertyDescriptor(e,n)?.value;return i?qr(r,n,t.extend({[Y.shadow]:i})):r}ie(ss,"createShadow");function pa(t,e,n,r){return new Proxy(e,{apply:ie((i,s,o)=>(s===n&&(s=r),o=o.map(a=>typeof a!="function"||a[Y.original]?a:new Proxy(a,{get:ie((l,c,u)=>{if(c===Y.original)return l;const f=Reflect.get(l,c,u);return c==="toString"&&f===Function.prototype.toString?function(...m){return Reflect.apply(f,this===u?l:this,m)}:f},"get"),apply:ie((l,c,u)=>Reflect.apply(l,xt(t,c),u.map(f=>xt(t,f))),"apply"),construct:ie((l,c,u)=>Reflect.construct(l,c.map(f=>xt(t,f)),u),"construct")})),xt(t,Reflect.apply(i,s,o))),"apply")})}ie(pa,"createShadowMethod");function zr(t,e,n,r){t[Y.shadow]&&(t=Object.getPrototypeOf(t));const i=new Proxy(e,{get:ie((s,o,a)=>{if(o===Y.original)return s;if(o===n.property)return t;if(typeof o=="symbol")return Reflect.get(s,o,a);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.get(t,`${n.associate}.${o}`,qr(t,Y.receiver,a));const l=ss(t,s,n.property,a),c=Reflect.get(s,o,l),u=c?.[Y.tracker];return u?zr(t,c,u):!r&&typeof c=="function"?pa(t,c,a,l):c},"get"),set:ie((s,o,a,l)=>{if(o===Y.original||o===n.property)return!1;if(typeof o=="symbol")return Reflect.set(s,o,a,l);if(n.associate&&t[Y.internal][`${n.associate}.${o}`])return Reflect.set(t,`${n.associate}.${o}`,a,qr(t,Y.receiver,l));const c=ss(t,s,n.property,l);return Reflect.set(s,o,a,c)},"set"),apply:ie((s,o,a)=>os(i,s,o,a),"apply")});return i}ie(zr,"createTraceable");function os(t,e,n,r){return e[Y.invoke]?e[Y.invoke].apply(t,r):Reflect.apply(e,n,r)}ie(os,"applyTraceable");function as(t,e,n){const r=ie(function(...i){const s=zr(r.ctx,r,n);return os(s,r,this,i)},"self");return ze(r,"name",t),Object.setPrototypeOf(r,e)}ie(as,"createCallable");var Vf=(ht=class{constructor(e){this.ctx=e,ze(this,Y.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,n){let r=e[Y.internal][n];for(;r?.type==="alias";)n=r.name,r=e[Y.internal][n];return[n,r]}static checkInject(e,n,r){if(e=e[Y.shadow]??e,["prototype","then","registry","lifecycle"].includes(n)||n[0]==="$"||n[0]==="_"||!e.runtime.plugin||e.bail(e,"internal/inject",n))return;const i=r.stack.split(`
|
|
2
2
|
`);i.splice(1,1),r.stack=i.join(`
|
|
3
|
-
`),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[Y.internal][e]?.type!=="service")return;const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;return _t(this.ctx,i)}set(e,n){this.provide(e);const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;n??(n=void 0);let s=ie(()=>{},"dispose");if(i===n)return s;if(!ke(n)&&!ke(i))throw new Error(`service ${e} has been registered`);const o=this.ctx;ke(n)||(s=o.effect(()=>()=>{o.set(e,void 0)})),da(n)&&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[Y.filter]=l=>o[Y.isolate][e]===l[Y.isolate][e],o.emit(a,"internal/before-service",e,n),o[Y.store][r]={value:n,source:o},o.emit(a,"internal/service",e,i),s}provide(e,n,r){const i=this.ctx.root[Y.internal];if(e in i)return;const s=Symbol(e);i[e]={type:"service",builtin:r},this.ctx.root[Y.isolate][e]=s,ts(n)&&(this.ctx[Y.store][s]={value:n,source:null},ze(n,Y.tracker,{associate:e,property:"ctx"}))}_accessor(e,n){const r=this.ctx.root[Y.internal];return e in r?()=>{}:(r[e]={type:"accessor",...n},()=>delete this.ctx.root[Y.isolate][e])}accessor(e,n){this.ctx.scope.effect(()=>this._accessor(e,n))}alias(e,n){const r=this.ctx.root[Y.internal];if(!(e in r))for(const i of n)r[i]||(r[i]={type:"alias",name:e})}_mixin(e,n){const r=Array.isArray(n)?n.map(o=>[o,o]):Object.entries(n),i=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const u=i(this);if(ke(u))return u;const c=l?Xn(l,u):u,f=Reflect.get(u,o,c);return typeof f!="function"?f:f.bind(c??u)},set(l,u){const c=i(this),f=u?Xn(u,c):c;return Reflect.set(c,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,n){this.ctx.scope.effect(()=>this._mixin(e,n))}trace(e){return _t(this.ctx,e)}bind(e){return new Proxy(e,{apply:ie((n,r,i)=>n.apply(this.trace(r),i.map(s=>this.trace(s))),"apply")})}},ie(dt,"ReflectService"),te(dt,"handler",{get:ie((e,n,r)=>{if(typeof n!="string")return Reflect.get(e,n,r);if(Reflect.has(e,n))return _t(r,Reflect.get(e,n,r),!0);const[i,s]=dt.resolveInject(e,n),o=new Error(`property ${i} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[Y.receiver]):(s.builtin||dt.checkInject(r,i,o),r.reflect.get(i)):(dt.checkInject(r,i,o),Reflect.get(e,i,r))},"get"),set:ie((e,n,r,i)=>{if(typeof n!="string")return Reflect.set(e,n,r,i);const[s,o]=dt.resolveInject(e,n);return o?o.type==="accessor"?o.set?o.set.call(i,r,i[Y.receiver]):!1:(i.reflect.set(s,r),!0):Reflect.set(e,s,r,i)},"set"),has:ie((e,n)=>{if(typeof n!="string")return Reflect.has(e,n);if(Reflect.has(e,n))return!0;const[,r]=dt.resolveInject(e,n);return!!r},"has")}),dt),ss=Wf;function os(t){return t!==null&&t!==!1&&t!==void 0}ie(os,"isBailed");var Vf=(Fn=class{constructor(e){te(this,"isActive",!1);te(this,"_tasks",new Set);te(this,"_hooks",{});this.ctx=e,ze(this,Y.tracker,{associate:"lifecycle",property:"ctx"}),ze(this.on("internal/listener",function(r,i,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>i()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](i),ze(i,"name","event <dispose>"),()=>qt(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>qt(this.scope.runtime.forkables,i))}),Je.static,e.scope);for(const r of["info","error","warning"])ze(this.on(`internal/${r}`,(i,...s)=>{this._hooks[`internal/${r}`].length>1}),Je.static,e.scope);ze(this.on("internal/before-service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Je.static,e.scope),ze(this.on("internal/service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&o.start()}},{global:!0}),Je.static,e.scope);const n=ie((r,i)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(i===ss.resolveInject(r.ctx,s)[0])return!0;return n(r.parent.scope,i)},"checkInject");ze(this.on("internal/inject",function(r){return n(this.scope,r)},{global:!0}),Je.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,n){return n=_t(this.ctx,n),e.slice().filter(r=>{const i=n?.[Je.filter];return r.global||!i||i.call(n,r.ctx)})}*dispatch(e,n){const r=typeof n[0]=="object"||typeof n[0]=="function"?n.shift():null,i=n.shift();i!=="internal/event"&&this.emit("internal/event",e,i,n,r);for(const s of this.filterHooks(this._hooks[i]||[],r))yield s.callback.apply(r,n)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const n of this.dispatch("serial",e))if(os(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(os(n))return n}register(e,n,r,i){const s=i.prepend?"unshift":"push";return n[s]({ctx:this.ctx,callback:r,...i}),this.ctx.state.collect(e,()=>this.unregister(n,r))}unregister(e,n){const r=e.findIndex(i=>i.callback===n);if(r>=0)return e.splice(r,1),!0}on(e,n,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),n=this.ctx.reflect.bind(n);const i=this.bail(this.ctx,"internal/listener",e,n,r);if(i)return i;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,n,r)}once(e,n,r){const i=this.on(e,function(...s){return i(),n.apply(this,s)},r);return i}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:n,callback:r}=e.shift();n.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},ie(Fn,"Lifecycle"),Fn),Kf=Vf,as=(vn=class extends Error{constructor(e,n){super(n??vn.Code[e]),this.code=e}},ie(vn,"CordisError"),vn);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(as||(as={}));var pa=(Bn=class{constructor(e,n){te(this,"uid");te(this,"ctx");te(this,"disposables",[]);te(this,"error");te(this,"status",0);te(this,"isActive",!1);te(this,"context");te(this,"proxy");te(this,"acceptors",[]);te(this,"tasks",new Set);te(this,"hasError",!1);this.parent=e,this.config=n,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:ie((r,i)=>Reflect.get(this.config,i),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new as("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=Zi(e)?new e(this.ctx,n):e(this.ctx,n);let i=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=ie((...a)=>{if(!i)return i=!0,qt(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,n){const r=ze(()=>(qt(this.disposables,r),n()),"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 n=this.status;e?.(),this.status=this._getStatus(),n!==this.status&&this.context.emit("internal/status",this,n)}ensure(e){const n=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(n)),this.context.events._tasks.delete(n)});this.updateStatus(()=>this.tasks.add(n)),this.context.events._tasks.add(n)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,n])=>!n.required||!ke(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Je.static]===this)return!0;(async()=>e())().catch(n=>{this.context.emit(this.ctx,"internal/error",n)})})}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),()=>qt(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,n){if(n||!this.config)return[!0,!0];if(n===!1)return[!1,!1];const r=Object.create(null),i=ie(u=>{const c=r[u]??(r[u]=!on(this.config[u],e[u]));return o||(o=c),c},"checkPropertyUpdate"),s=new Set;let o=!1,a=!1,l=this.runtime.isReactive||null;for(const{keys:u,callback:c,passive:f}of this.acceptors){if(!u)l||(l=!f);else if(f)u?.forEach(y=>s.add(y));else{let y=!1;for(const b of u)y||(y=i(b));if(!y)continue}c?.(e)&&(a=!0)}for(const u in{...this.config,...e})if(l!==!1&&!(u in r)&&!s.has(u)){const c=i(u);l===null&&(a||(a=c))}return[o,a]}},ie(Bn,"EffectScope"),Bn),Yf=(Un=class extends pa{constructor(n,r,i,s){super(n,i);te(this,"dispose");this.runtime=r,this.dispose=ze(n.scope.collect(`fork <${n.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=qt(r.disposables,this.dispose);return qt(r.children,this)&&!r.children.length&&n.registry.delete(r.plugin),o}),Je.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 n of this.runtime.forkables)this.ensure(async()=>n(this.context,this._config))}update(n,r){const i=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==i)return;let o;try{o=Qn(this.runtime.plugin,n)}catch(u){return this.context.emit("internal/error",u),this.cancel(u)}const[a,l]=s.checkUpdate(o,r);this.context.emit("internal/before-update",this,n),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,i),l&&s.restart()}},ie(Un,"ForkScope"),Un),ma=(zn=class extends pa{constructor(n,r,i,s){super(n,i);te(this,"value");te(this,"runtime",this);te(this,"schema");te(this,"name");te(this,"inject",Object.create(null));te(this,"forkables",[]);te(this,"children",[]);te(this,"isReusable",!1);te(this,"isReactive",!1);te(this,"apply",ie((n,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(n,r);if(Zi(this.plugin)){const i=new this.plugin(n,r),s=i[Je.expose];return s&&n.set(s,i),i.fork&&this.forkables.push(i.fork.bind(i)),i}else return this.plugin(n,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(n,r,i){return new Yf(n,this,r,i)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:n}=this.plugin;n&&n!=="apply"&&(this.name=n),this.schema=this.plugin.Config||this.plugin.schema,this.inject=qe.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 n of this.children)n.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const n of this.children)n.start()}update(n,r){if(this.isForkable){const u=new Error(`attempting to update forkable plugin "${this.plugin.name}", which may lead to unexpected behavior`);this.context.emit(this.ctx,"internal/warning",u)}const i=this.config;let s;try{s=Qn(this.runtime.plugin||this.context.constructor,n)}catch(u){return this.context.emit("internal/error",u),this.cancel(u)}const[o,a]=this.checkUpdate(s,r),l=this.children.find(u=>u.config===i);this.config=s,l&&(this.context.emit("internal/before-update",l,n),l.config=s,o&&this.context.emit("internal/update",l,i)),a&&this.restart()}},ie(zn,"MainScope"),zn);function ga(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(ga,"isApplicable");function qe(t){return function(e,n){if(n.kind==="class")e.inject=t;else if(n.kind==="method")n.addInitializer(function(){const r=this[Y.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,i=>{e.call(Xn(this,{[r]:i}))})});else throw new Error("@Inject can only be used on class or class methods")}}ie(qe,"Inject"),(t=>{function e(n){if(!n)return{};if(Array.isArray(n))return Object.fromEntries(n.map(o=>[o,{required:!0}]));const{required:r,optional:i,...s}=n;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(i)&&Object.assign(s,Object.fromEntries(i.map(o=>[o,{required:!1}]))),s}t.resolve=e,ie(e,"resolve")})(qe||(qe={}));var Gf=(Hn=class{constructor(e,n){te(this,"_counter",0);te(this,"_internal",new Map);te(this,"context");this.ctx=e,ze(this,Y.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new ma(e,null,n);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,n=!1){if(e===null||typeof e=="function")return e;if(ga(e))return e.apply;if(n)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const n=this.resolve(e);return n&&this._internal.get(n)}has(e){const n=this.resolve(e);return!!n&&this._internal.has(n)}set(e,n){const r=this.resolve(e);this._internal.set(r,n)}delete(e){const n=this.resolve(e),r=n&&this._internal.get(n);if(r)return this._internal.delete(n),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,n){return this.inject(e,n)}inject(e,n){return this.plugin({inject:e,apply:n,name:n.name})}plugin(e,n,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{n=Qn(e,n)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,n=null}let i=this.get(e);return i?(i.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),i.fork(this.ctx,n,r)):(i=new ma(this.ctx,e,n,r),this.set(e,i),i.fork(this.ctx,n,r))}},ie(Hn,"Registry"),Hn),Jf=Gf,Je=(Oe=class{static is(e){return!!e?.[Oe.is]}static associate(e,n){return e}constructor(e){e=Qn(this.constructor,e),this[Y.store]=Object.create(null),this[Y.isolate]=Object.create(null),this[Y.internal]=Object.create(null),this[Y.intercept]=Object.create(null);const n=new Proxy(this,ss.handler);n.root=n,n.reflect=new ss(n),n.registry=new Jf(n,e),n.lifecycle=new Kf(n);const r=ie(i=>{if(i){r(Object.getPrototypeOf(i));for(const s of Object.getOwnPropertyNames(i)){const o=i[s].prototype?.constructor;o&&(n[i[s].key]=new o(n,e),ze(n[i[s].key],"ctx",n))}}},"attach");return r(this[Y.internal]),n}[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 n=Reflect.getOwnPropertyDescriptor(this,Y.shadow)?.value,r=Object.assign(Object.create(_t(this,this)),e);return n?Object.assign(Object.create(r),{[Y.shadow]:n}):r}isolate(e,n){const r=Object.create(this[Y.isolate]);return r[e]=n??Symbol(e),this.extend({[Y.isolate]:r})}intercept(e,n){const r=Object.create(this[Y.intercept]);return r[e]=n,this.extend({[Y.intercept]:r})}},ie(Oe,"Context"),te(Oe,"store",Y.store),te(Oe,"events",Y.events),te(Oe,"static",Y.static),te(Oe,"filter",Y.filter),te(Oe,"expose",Y.expose),te(Oe,"isolate",Y.isolate),te(Oe,"internal",Y.internal),te(Oe,"intercept",Y.intercept),te(Oe,"origin","ctx"),te(Oe,"current","ctx"),Oe.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),Oe.prototype[Oe.is]=!0,Oe);Je.prototype[Je.internal]=Object.create(null);var an=(ot=class{constructor(...e){te(this,"ctx");te(this,"name");te(this,"config");let n,r,i,s;Je.is(e[0])?(n=e[0],typeof e[1]=="string"?(r=e[1],i=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[Y.provide]),i??(i=this.constructor[Y.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[Y.invoke]&&(o=is(r,es(Object.getPrototypeOf(this),Function.prototype),a)),n?o.ctx=n:o[Y.setup](),o.name=r,o.config=s,ze(o,Y.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,i&&(n?o[Y.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),i||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[Y.filter](e){return e[Y.isolate][this.name]===this.ctx[Y.isolate][this.name]}[Y.setup](){this.ctx=new Je}[Y.extend](e){let n;return this[ot.invoke]?n=is(this.name,this,this[Y.tracker]):n=Object.create(this),Object.assign(n,e)}static[Symbol.hasInstance](e){let n=e.constructor;for(;n;){if(n=n.prototype?.constructor,n===this)return!0;n=Object.getPrototypeOf(n)}return!1}},ie(ot,"Service"),te(ot,"setup",Y.setup),te(ot,"invoke",Y.invoke),te(ot,"extend",Y.extend),te(ot,"tracker",Y.tracker),te(ot,"provide",Y.provide),te(ot,"immediate",Y.immediate),ot),Qf=Object.defineProperty,Xf=Object.getOwnPropertyNames,ue=(t,e)=>Qf(t,"name",{value:e,configurable:!0}),Zf=(t,e)=>function(){return e||(0,t[Xf(t)[0]])((e={exports:{}}).exports,e),e.exports},ed=Zf({"src/index.ts"(t,e){var T;var n=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var i=(T=class extends TypeError{constructor(h,S){let O="$";for(const N of S.path||[])typeof N=="string"?O+="."+N:typeof N=="number"?O+="["+N+"]":typeof N=="symbol"&&(O+=`[Symbol(${N.toString()})]`);O.startsWith(".")&&(O=O.slice(1));super((O==="$"?"":`${O} `)+h);te(this,"name","ValidationError");this.options=S}static is(h){return!!h?.[r]}},ue(T,"ValidationError"),T);Object.defineProperty(i.prototype,r,{value:!0});var s=ue(function(g){const p=ue(function(h,S={}){return s.resolve(h,p,S)[0]},"schema");if(g.refs){const h=Nt(g.refs,O=>new s(O)),S=ue(O=>h[O],"getRef");for(const O in h){const N=h[O];N.sKey=S(N.sKey),N.inner=S(N.inner),N.list=N.list&&N.list.map(S),N.dict=N.dict&&Nt(N.dict,S)}return h[g.uid]}if(Object.assign(p,g),typeof p.callback=="string")try{p.callback=new Function("return "+p.callback)()}catch{}return Object.defineProperty(p,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(p,s.prototype),p.meta||(p.meta={}),p.toString=p.toString.bind(p),p},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[n]=!0,s.ValidationError=i;var o;s.prototype.toJSON=ue(function(){var h;if(o)return o[h=this.uid]??(o[h]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const p={uid:this.uid,refs:o};return o=void 0,p},"toJSON"),s.prototype.set=ue(function(p,h){return this.dict[p]=h,this},"set"),s.prototype.push=ue(function(p){return this.list.push(p),this},"push");function a(g,p){const h=typeof g=="string"?{"":g}:{...g};for(const S in p){const O=p[S];O?.$description||O?.$desc?h[S]=O.$description||O.$desc:typeof O=="string"&&(h[S]=O)}return h}ue(a,"mergeDesc");function l(g){return g?.$value??g?.$inner}ue(l,"getInner");function u(g){return oa(g??{},p=>!p.startsWith("$"))}ue(u,"extractKeys"),s.prototype.i18n=ue(function(p){const h=s(this),S=a(h.meta.description,p);return Object.keys(S).length&&(h.meta.description=S),h.dict&&(h.dict=Nt(h.dict,(O,N)=>O.i18n(Nt(p,q=>l(q)?.[N]??q?.[N])))),h.list&&(h.list=h.list.map((O,N)=>O.i18n(Nt(p,(q={})=>Array.isArray(l(q))?l(q)[N]:Array.isArray(q)?q[N]:u(q))))),h.inner&&(h.inner=h.inner.i18n(Nt(p,O=>l(O)?l(O):u(O)))),h.sKey&&(h.sKey=h.sKey.i18n(Nt(p,O=>O?.$key))),h},"i18n"),s.prototype.extra=ue(function(p,h){const S=s(this);return S.meta={...S.meta,[p]:h},S},"extra");for(const g of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[g](p=!0){const h=s(this);return h.meta={...h.meta,[g]:p},h}});s.prototype.deprecated=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"deprecated",type:"danger"}),p},"deprecated"),s.prototype.experimental=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"experimental",type:"warning"}),p},"experimental"),s.prototype.pattern=ue(function(p){const h=s(this),S=aa(p,["source","flags"]);return h.meta={...h.meta,pattern:S},h},"pattern"),s.prototype.simplify=ue(function(p){if(on(p,this.meta.default,this.type==="dict"))return null;if(ke(p))return p;if(this.type==="object"||this.type==="dict"){const h={};for(const S in p){const N=(this.type==="object"?this.dict[S]:this.inner)?.simplify(p[S]);(this.type==="dict"||!ke(N))&&(h[S]=N)}return on(h,this.meta.default,this.type==="dict")?null:h}else if(this.type==="array"||this.type==="tuple"){const h=[];return p.forEach((S,O)=>{const N=this.type==="array"?this.inner:this.list[O],q=N?N.simplify(S):S;h.push(q)}),h}else if(this.type==="intersect"){const h={};for(const S of this.list)Object.assign(h,S.simplify(p));return h}else if(this.type==="union")for(const h of this.list)try{return s.resolve(p,h,{}),h.simplify(p)}catch{}return p},"simplify"),s.prototype.toString=ue(function(p){return U[this.type]?.(this,p)??`Schema<${this.type}>`},"toString"),s.prototype.role=ue(function(g,p){const h=s(this);return h.meta={...h.meta,role:g,extra:p},h},"role");for(const g of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[g](p){const h=s(this);return h.meta={...h.meta,[g]:p},h}});var c={};s.extend=ue(function(p,h){c[p]=h},"extend"),s.resolve=ue(function(p,h,S={},O=!1){if(!h)return[p];if(S.ignore?.(p,h))return[p];if(ke(p)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",S);let q=h,X=h.meta.default;for(;q?.type==="intersect"&&ke(X);)q=q.list[0],X=q?.meta.default;if(ke(X))return[p];p=Mr(X)}const N=c[h.type];if(!N)throw new i(`unsupported type "${h.type}"`,S);try{return N(p,h,S,O)}catch(q){if(!h.meta.loose)throw q;return[h.meta.default]}},"resolve"),s.from=ue(function(p){if(ke(p))return s.any();if(["string","number","boolean"].includes(typeof p))return s.const(p).required();if(p[n])return p;if(typeof p=="function")switch(p){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(p).required()}else throw new TypeError(`cannot infer schema from ${p}`)},"from"),s.lazy=ue(function(p){const h=ue(()=>(S.inner[n]||(S.inner=S.builder(),S.inner.meta={...S.meta,...S.inner.meta}),S.inner.toJSON()),"toJSON"),S=new s({type:"lazy",builder:p,inner:{toJSON:h}});return S},"lazy"),s.natural=ue(function(){return s.number().step(1).min(0)},"natural"),s.percent=ue(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=ue(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(p,h)=>{const S=new Date(p);if(isNaN(+S))throw new i(`invalid date "${p}"`,h);return S},!0)])},"date"),s.regExp=ue(function(p=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:p}),(h,S)=>{try{return new RegExp(h,p)}catch(O){throw new i(O.message,S)}},!0)])},"regExp"),s.arrayBuffer=ue(function(p){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,S)=>{if(bt.isSource(h))return bt.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,S)},!0),...p?[s.transform(s.string(),(h,S)=>{try{return p==="base64"?bt.fromBase64(h):bt.fromHex(h)}catch(O){throw new i(O.message,S)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(g,p,h,S)=>(p.inner[n]||(p.inner=p.builder(),p.inner.meta={...p.meta,...p.inner.meta}),s.resolve(g,p.inner,h,S))),s.extend("any",g=>[g]),s.extend("never",(g,p,h)=>{throw new i(`expected nullable but got ${g}`,h)}),s.extend("const",(g,{value:p},h)=>{if(on(g,p))return[p];throw new i(`expected ${p} but got ${g}`,h)});function f(g,p,h,S,O=!1){const{max:N=1/0,min:q=-1/0}=p;if(g>N)throw new i(`expected ${h} <= ${N} but got ${g}`,S);if(g<q&&!O)throw new i(`expected ${h} >= ${q} but got ${g}`,S)}ue(f,"checkWithinRange"),s.extend("string",(g,{meta:p},h)=>{if(typeof g!="string")throw new i(`expected string but got ${g}`,h);if(p.pattern){const S=new RegExp(p.pattern.source,p.pattern.flags);if(!S.test(g))throw new i(`expect string to match regexp ${S}`,h)}return f(g.length,p,"string length",h),[g]});function v(g,p){const h=g.toString();if(h.includes("e"))return g*Math.pow(10,p);const S=h.indexOf(".");if(S===-1)return g*Math.pow(10,p);const O=h.slice(S+1),N=h.slice(0,S);return O.length<=p?+(N+O.padEnd(p,"0")):+(N+O.slice(0,p)+"."+O.slice(p))}ue(v,"decimalShift");function y(g,p,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(g-p)%h===0;const S=h.toString().indexOf("."),O=h.toString().slice(S+1).length;return Math.abs(v(g,O)-v(p,O))%v(h,O)===0}ue(y,"isMultipleOf"),s.extend("number",(g,{meta:p},h)=>{if(typeof g!="number")throw new i(`expected number but got ${g}`,h);f(g,p,"number",h);const{step:S}=p;if(S&&!y(g,p.min??0,S))throw new i(`expected number multiple of ${S} but got ${g}`,h);return[g]}),s.extend("boolean",(g,p,h)=>{if(typeof g=="boolean")return[g];throw new i(`expected boolean but got ${g}`,h)}),s.extend("bitset",(g,{bits:p,meta:h},S)=>{let O=0,N=[];if(typeof g=="number"){O=g;for(const q in p)g&p[q]&&N.push(q)}else if(Array.isArray(g)){N=g;for(const q of N){if(typeof q!="string")throw new i(`expected string but got ${q}`,S);q in p&&(O|=p[q])}}else throw new i(`expected number or array but got ${g}`,S);return O===h.default?[O]:[O,N]}),s.extend("function",(g,p,h)=>{if(typeof g=="function")return[g];throw new i(`expected function but got ${g}`,h)}),s.extend("is",(g,{constructor:p},h)=>{if(typeof p=="function"){if(g instanceof p)return[g];throw new i(`expected ${p.name} but got ${g}`,h)}else{if(ke(g))throw new i(`expected ${p} but got ${g}`,h);let S=Object.getPrototypeOf(g);for(;S;){if(S.constructor?.name===p)return[g];S=Object.getPrototypeOf(S)}throw new i(`expected ${p} but got ${g}`,h)}});function b(g,p,h,S){try{const[O,N]=s.resolve(g[p],h,{...S,path:[...S.path||[],p]});return N!==void 0&&(g[p]=N),O}catch(O){if(!S?.autofix)throw O;return delete g[p],h.meta.default}}ue(b,"property"),s.extend("array",(g,{inner:p,meta:h},S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,S);return f(g.length,h,"array length",S,!ke(p.meta.default)),[g.map((O,N)=>b(g,N,p,S))]}),s.extend("dict",(g,{inner:p,sKey:h},S,O)=>{if(!Lr(g))throw new i(`expected object but got ${g}`,S);const N={};for(const q in g){let X;try{X=s.resolve(q,h,S)[0]}catch(Ce){if(O)continue;throw Ce}N[X]=b(g,q,p,S),g[X]=g[q],q!==X&&delete g[q]}return[N]}),s.extend("tuple",(g,{list:p},h,S)=>{if(!Array.isArray(g))throw new i(`expected array but got ${g}`,h);const O=p.map((N,q)=>b(g,q,N,h));return S?[O]:(O.push(...g.slice(p.length)),[O])});function I(g,p){for(const h in p)h in g||(g[h]=p[h])}ue(I,"merge"),s.extend("object",(g,{dict:p},h,S)=>{if(!Lr(g))throw new i(`expected object but got ${g}`,h);const O={};for(const N in p){const q=b(g,N,p[N],h);(!ke(q)||N in g)&&(O[N]=q)}return S||I(O,g),[O]}),s.extend("union",(g,{list:p,toString:h},S,O)=>{for(const N of p)try{return s.resolve(g,N,S,O)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}),s.extend("intersect",(g,{list:p,toString:h},S,O)=>{if(!p.length)return[g];let N;for(const q of p){const X=s.resolve(g,q,S,!0)[0];if(!ke(X))if(ke(N))N=X;else{if(typeof N!=typeof X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S);if(typeof X=="object")I(N??(N={}),X);else if(N!==X)throw new i(`expected ${h()} but got ${JSON.stringify(g)}`,S)}}return!O&&Lr(g)&&I(N,g),[N]}),s.extend("transform",(g,{inner:p,callback:h,preserve:S},O)=>{const[N,q=g]=s.resolve(g,p,O,!0);return S?[h(N)]:[h(N),h(q)]});var U={};function D(g,p,h){U[g]=h,Object.assign(s,{[g](...S){const O=new s({type:g});return p.forEach((N,q)=>{switch(N){case"sKey":O.sKey=S[q]??s.string();break;case"inner":O.inner=s.from(S[q]);break;case"list":O.list=S[q].map(s.from);break;case"dict":O.dict=Nt(S[q],s.from);break;case"bits":{O.bits={};for(const X in S[q])typeof S[q][X]=="number"&&(O.bits[X]=S[q][X]);break}case"callback":{const X=O.callback=S[q];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=O.constructor=S[q];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:O[N]=S[q]}}),g==="object"||g==="dict"?O.meta.default={}:g==="array"||g==="tuple"?O.meta.default=[]:g==="bitset"&&(O.meta.default=0),O}})}ue(D,"defineMethod"),D("is",["constructor"],({constructor:g})=>typeof g=="function"?g.name:g),D("any",[],()=>"any"),D("never",[],()=>"never"),D("const",["value"],({value:g})=>typeof g=="string"?JSON.stringify(g):g),D("string",[],()=>"string"),D("number",[],()=>"number"),D("boolean",[],()=>"boolean"),D("bitset",["bits"],()=>"bitset"),D("function",[],()=>"function"),D("array",["inner"],({inner:g})=>`${g.toString(!0)}[]`),D("dict",["inner","sKey"],({inner:g,sKey:p})=>`{ [key: ${p.toString()}]: ${g.toString()} }`),D("tuple",["list"],({list:g})=>`[${g.map(p=>p.toString()).join(", ")}]`),D("object",["dict"],({dict:g})=>Object.keys(g).length===0?"{}":`{ ${Object.entries(g).map(([p,h])=>`${p}${h.meta.required?"":"?"}: ${h.toString()}`).join(", ")} }`),D("union",["list"],({list:g},p)=>{const h=g.map(({toString:S})=>S()).join(" | ");return p?`(${h})`:h}),D("intersect",["list"],({list:g})=>`${g.map(p=>p.toString(!0)).join(" & ")}`),D("transform",["inner","callback","preserve"],({inner:g},p)=>g.toString(p)),e.exports=s}});const Se=ed();/**
|
|
3
|
+
`),e.emit(e,"internal/warning",r)}get(e){if(this.ctx[Y.internal][e]?.type!=="service")return;const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;return xt(this.ctx,i)}set(e,n){this.provide(e);const r=this.ctx[Y.isolate][e],i=this.ctx[Y.store][r]?.value;n??(n=void 0);let s=ie(()=>{},"dispose");if(i===n)return s;if(!Pe(n)&&!Pe(i))throw new Error(`service ${e} has been registered`);const o=this.ctx;Pe(n)||(s=o.effect(()=>()=>{o.set(e,void 0)})),ha(n)&&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[Y.filter]=l=>o[Y.isolate][e]===l[Y.isolate][e],o.emit(a,"internal/before-service",e,n),o[Y.store][r]={value:n,source:o},o.emit(a,"internal/service",e,i),s}provide(e,n,r){const i=this.ctx.root[Y.internal];if(e in i)return;const s=Symbol(e);i[e]={type:"service",builtin:r},this.ctx.root[Y.isolate][e]=s,is(n)&&(this.ctx[Y.store][s]={value:n,source:null},ze(n,Y.tracker,{associate:e,property:"ctx"}))}_accessor(e,n){const r=this.ctx.root[Y.internal];return e in r?()=>{}:(r[e]={type:"accessor",...n},()=>delete this.ctx.root[Y.isolate][e])}accessor(e,n){this.ctx.scope.effect(()=>this._accessor(e,n))}alias(e,n){const r=this.ctx.root[Y.internal];if(!(e in r))for(const i of n)r[i]||(r[i]={type:"alias",name:e})}_mixin(e,n){const r=Array.isArray(n)?n.map(o=>[o,o]):Object.entries(n),i=typeof e=="string"?o=>o[e]:()=>e,s=r.map(([o,a])=>this._accessor(a,{get(l){const c=i(this);if(Pe(c))return c;const u=l?tr(l,c):c,f=Reflect.get(c,o,u);return typeof f!="function"?f:f.bind(u??c)},set(l,c){const u=i(this),f=c?tr(c,u):u;return Reflect.set(u,o,l,f)}}));return()=>s.forEach(o=>o())}mixin(e,n){this.ctx.scope.effect(()=>this._mixin(e,n))}trace(e){return xt(this.ctx,e)}bind(e){return new Proxy(e,{apply:ie((n,r,i)=>n.apply(this.trace(r),i.map(s=>this.trace(s))),"apply")})}},ie(ht,"ReflectService"),te(ht,"handler",{get:ie((e,n,r)=>{if(typeof n!="string")return Reflect.get(e,n,r);if(Reflect.has(e,n))return xt(r,Reflect.get(e,n,r),!0);const[i,s]=ht.resolveInject(e,n),o=new Error(`property ${i} is not registered, declare it as \`inject\` to suppress this warning`);return s?s.type==="accessor"?s.get.call(r,r[Y.receiver]):(s.builtin||ht.checkInject(r,i,o),r.reflect.get(i)):(ht.checkInject(r,i,o),Reflect.get(e,i,r))},"get"),set:ie((e,n,r,i)=>{if(typeof n!="string")return Reflect.set(e,n,r,i);const[s,o]=ht.resolveInject(e,n);return o?o.type==="accessor"?o.set?o.set.call(i,r,i[Y.receiver]):!1:(i.reflect.set(s,r),!0):Reflect.set(e,s,r,i)},"set"),has:ie((e,n)=>{if(typeof n!="string")return Reflect.has(e,n);if(Reflect.has(e,n))return!0;const[,r]=ht.resolveInject(e,n);return!!r},"has")}),ht),ls=Vf;function cs(t){return t!==null&&t!==!1&&t!==void 0}ie(cs,"isBailed");var Yf=(qn=class{constructor(e){te(this,"isActive",!1);te(this,"_tasks",new Set);te(this,"_hooks",{});this.ctx=e,ze(this,Y.tracker,{associate:"lifecycle",property:"ctx"}),ze(this.on("internal/listener",function(r,i,s){const o=s.prepend?"unshift":"push";if(r==="ready")return this.lifecycle.isActive?(this.scope.ensure(async()=>i()),()=>!1):void 0;if(r==="dispose")return this.scope.disposables[o](i),ze(i,"name","event <dispose>"),()=>Kt(this.scope.disposables,i);if(r==="fork")return this.scope.runtime.forkables[o](i),this.scope.collect("event <fork>",()=>Kt(this.scope.runtime.forkables,i))}),Je.static,e.scope);for(const r of["info","error","warning"])ze(this.on(`internal/${r}`,(i,...s)=>{this._hooks[`internal/${r}`].length>1}),Je.static,e.scope);ze(this.on("internal/before-service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&(o.updateStatus(),o.reset())}},{global:!0}),Je.static,e.scope),ze(this.on("internal/service",function(r){for(const i of this.registry.values()){if(!i.inject[r]?.required)continue;const s=i.isReusable?i.children:[i];for(const o of s)this[Y.filter](o.ctx)&&o.start()}},{global:!0}),Je.static,e.scope);const n=ie((r,i)=>{if(!r.runtime.plugin)return!1;for(const s in r.runtime.inject)if(i===ls.resolveInject(r.ctx,s)[0])return!0;return n(r.parent.scope,i)},"checkInject");ze(this.on("internal/inject",function(r){return n(this.scope,r)},{global:!0}),Je.static,e.scope)}async flush(){for(;this._tasks.size;)await Promise.all(Array.from(this._tasks))}filterHooks(e,n){return n=xt(this.ctx,n),e.slice().filter(r=>{const i=n?.[Je.filter];return r.global||!i||i.call(n,r.ctx)})}*dispatch(e,n){const r=typeof n[0]=="object"||typeof n[0]=="function"?n.shift():null,i=n.shift();i!=="internal/event"&&this.emit("internal/event",e,i,n,r);for(const s of this.filterHooks(this._hooks[i]||[],r))yield s.callback.apply(r,n)}async parallel(...e){await Promise.all(this.dispatch("emit",e))}emit(...e){Array.from(this.dispatch("emit",e))}async serial(...e){for await(const n of this.dispatch("serial",e))if(cs(n))return n}bail(...e){for(const n of this.dispatch("bail",e))if(cs(n))return n}register(e,n,r,i){const s=i.prepend?"unshift":"push";return n[s]({ctx:this.ctx,callback:r,...i}),this.ctx.state.collect(e,()=>this.unregister(n,r))}unregister(e,n){const r=e.findIndex(i=>i.callback===n);if(r>=0)return e.splice(r,1),!0}on(e,n,r){var a;typeof r!="object"&&(r={prepend:r}),this.ctx.scope.assertActive(),n=this.ctx.reflect.bind(n);const i=this.bail(this.ctx,"internal/listener",e,n,r);if(i)return i;const s=(a=this._hooks)[e]||(a[e]=[]),o=typeof e=="string"?`event <${e}>`:"event (Symbol)";return this.register(o,s,n,r)}once(e,n,r){const i=this.on(e,function(...s){return i(),n.apply(this,s)},r);return i}async start(){this.isActive=!0;const e=this._hooks.ready||[];for(;e.length;){const{ctx:n,callback:r}=e.shift();n.scope.ensure(async()=>r())}await this.flush()}async stop(){this.isActive=!1,this.ctx.scope.reset()}},ie(qn,"Lifecycle"),qn),Gf=Yf,us=(bn=class extends Error{constructor(e,n){super(n??bn.Code[e]),this.code=e}},ie(bn,"CordisError"),bn);(t=>{t.Code={INACTIVE_EFFECT:"cannot create effect on inactive context"}})(us||(us={}));var ma=(zn=class{constructor(e,n){te(this,"uid");te(this,"ctx");te(this,"disposables",[]);te(this,"error");te(this,"status",0);te(this,"isActive",!1);te(this,"context");te(this,"proxy");te(this,"acceptors",[]);te(this,"tasks",new Set);te(this,"hasError",!1);this.parent=e,this.config=n,this.uid=e.registry?e.registry.counter:0,this.ctx=this.context=e.extend({scope:this}),this.proxy=new Proxy({},{get:ie((r,i)=>Reflect.get(this.config,i),"get")})}get _config(){return this.runtime.isReactive?this.proxy:this.config}assertActive(){if(!(this.uid!==null||this.isActive))throw new us("INACTIVE_EFFECT")}effect(e,n){this.assertActive();const r=ns(e)?new e(this.ctx,n):e(this.ctx,n);let i=!1;const s=typeof r=="function"?r:r.dispose.bind(r),o=ie((...a)=>{if(!i)return i=!0,Kt(this.disposables,o),s(...a)},"wrapped");return this.disposables.push(o),typeof r=="function"?o:(r.dispose=o,r)}collect(e,n){const r=ze(()=>(Kt(this.disposables,r),n()),"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 n=this.status;e?.(),this.status=this._getStatus(),n!==this.status&&this.context.emit("internal/status",this,n)}ensure(e){const n=e().catch(r=>{this.context.emit(this.ctx,"internal/error",r),this.cancel(r)}).finally(()=>{this.updateStatus(()=>this.tasks.delete(n)),this.context.events._tasks.delete(n)});this.updateStatus(()=>this.tasks.add(n)),this.context.events._tasks.add(n)}cancel(e){this.error=e,this.updateStatus(()=>this.hasError=!0),this.reset()}get ready(){return Object.entries(this.runtime.inject).every(([e,n])=>!n.required||!Pe(this.ctx.get(e)))}reset(){this.isActive=!1,this.disposables=this.disposables.splice(0).filter(e=>{if(this.uid!==null&&e[Je.static]===this)return!0;(async()=>e())().catch(n=>{this.context.emit(this.ctx,"internal/error",n)})})}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),()=>Kt(this.acceptors,r)))}decline(e){return this.accept(e,()=>!0)}checkUpdate(e,n){if(n||!this.config)return[!0,!0];if(n===!1)return[!1,!1];const r=Object.create(null),i=ie(c=>{const u=r[c]??(r[c]=!ln(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 b of c)y||(y=i(b));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=i(c);l===null&&(a||(a=u))}return[o,a]}},ie(zn,"EffectScope"),zn),Qf=(Hn=class extends ma{constructor(n,r,i,s){super(n,i);te(this,"dispose");this.runtime=r,this.dispose=ze(n.scope.collect(`fork <${n.runtime.name}>`,()=>{this.uid=null,this.reset(),this.context.emit("internal/fork",this);const o=Kt(r.disposables,this.dispose);return Kt(r.children,this)&&!r.children.length&&n.registry.delete(r.plugin),o}),Je.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 n of this.runtime.forkables)this.ensure(async()=>n(this.context,this._config))}update(n,r){const i=this.config,s=this.runtime.isForkable?this:this.runtime;if(s.config!==i)return;let o;try{o=er(this.runtime.plugin,n)}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,n),this.config=o,s.config=o,a&&this.context.emit("internal/update",this,i),l&&s.restart()}},ie(Hn,"ForkScope"),Hn),ga=(Wn=class extends ma{constructor(n,r,i,s){super(n,i);te(this,"value");te(this,"runtime",this);te(this,"schema");te(this,"name");te(this,"inject",Object.create(null));te(this,"forkables",[]);te(this,"children",[]);te(this,"isReusable",!1);te(this,"isReactive",!1);te(this,"apply",ie((n,r)=>{if(typeof this.plugin!="function")return this.plugin.apply(n,r);if(ns(this.plugin)){const i=new this.plugin(n,r),s=i[Je.expose];return s&&n.set(s,i),i.fork&&this.forkables.push(i.fork.bind(i)),i}else return this.plugin(n,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(n,r,i){return new Qf(n,this,r,i)}dispose(){return this.uid=null,this.reset(),this.context.emit("internal/runtime",this),!0}setup(){const{name:n}=this.plugin;n&&n!=="apply"&&(this.name=n),this.schema=this.plugin.Config||this.plugin.schema,this.inject=We.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 n of this.children)n.reset()}start(){if(super.start())return!0;!this.isReusable&&this.plugin&&this.ensure(async()=>this.value=this.apply(this.ctx,this._config));for(const n of this.children)n.start()}update(n,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 i=this.config;let s;try{s=er(this.runtime.plugin||this.context.constructor,n)}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===i);this.config=s,l&&(this.context.emit("internal/before-update",l,n),l.config=s,o&&this.context.emit("internal/update",l,i)),a&&this.restart()}},ie(Wn,"MainScope"),Wn);function va(t){return t&&typeof t=="object"&&typeof t.apply=="function"}ie(va,"isApplicable");function We(t){return function(e,n){if(n.kind==="class")e.inject=t;else if(n.kind==="method")n.addInitializer(function(){const r=this[Y.tracker]?.property;if(!r)throw new Error("missing context tracker");this[r].inject(t,i=>{e.call(tr(this,{[r]:i}))})});else throw new Error("@Inject can only be used on class or class methods")}}ie(We,"Inject"),(t=>{function e(n){if(!n)return{};if(Array.isArray(n))return Object.fromEntries(n.map(o=>[o,{required:!0}]));const{required:r,optional:i,...s}=n;return Array.isArray(r)&&Object.assign(s,Object.fromEntries(r.map(o=>[o,{required:!0}]))),Array.isArray(i)&&Object.assign(s,Object.fromEntries(i.map(o=>[o,{required:!1}]))),s}t.resolve=e,ie(e,"resolve")})(We||(We={}));var Jf=(Kn=class{constructor(e,n){te(this,"_counter",0);te(this,"_internal",new Map);te(this,"context");this.ctx=e,ze(this,Y.tracker,{associate:"registry",property:"ctx"}),this.context=e;const r=new ga(e,null,n);e.scope=r,r.ctx=e,this.set(null,r)}get counter(){return++this._counter}get size(){return this._internal.size}resolve(e,n=!1){if(e===null||typeof e=="function")return e;if(va(e))return e.apply;if(n)throw new Error('invalid plugin, expect function or object with an "apply" method, received '+typeof e)}get(e){const n=this.resolve(e);return n&&this._internal.get(n)}has(e){const n=this.resolve(e);return!!n&&this._internal.has(n)}set(e,n){const r=this.resolve(e);this._internal.set(r,n)}delete(e){const n=this.resolve(e),r=n&&this._internal.get(n);if(r)return this._internal.delete(n),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,n){return this.inject(e,n)}inject(e,n){return this.plugin({inject:e,apply:n,name:n.name})}plugin(e,n,r){if(this.resolve(e,!0),this.ctx.scope.assertActive(),!r)try{n=er(e,n)}catch(s){this.context.emit(this.ctx,"internal/error",s),r=s,n=null}let i=this.get(e);return i?(i.isForkable||this.context.emit(this.ctx,"internal/warning",new Error(`duplicate plugin detected: ${e.name}`)),i.fork(this.ctx,n,r)):(i=new ga(this.ctx,e,n,r),this.set(e,i),i.fork(this.ctx,n,r))}},ie(Kn,"Registry"),Kn),Xf=Jf,Je=(Te=class{static is(e){return!!e?.[Te.is]}static associate(e,n){return e}constructor(e){e=er(this.constructor,e),this[Y.store]=Object.create(null),this[Y.isolate]=Object.create(null),this[Y.internal]=Object.create(null),this[Y.intercept]=Object.create(null);const n=new Proxy(this,ls.handler);n.root=n,n.reflect=new ls(n),n.registry=new Xf(n,e),n.lifecycle=new Gf(n);const r=ie(i=>{if(i){r(Object.getPrototypeOf(i));for(const s of Object.getOwnPropertyNames(i)){const o=i[s].prototype?.constructor;o&&(n[i[s].key]=new o(n,e),ze(n[i[s].key],"ctx",n))}}},"attach");return r(this[Y.internal]),n}[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 n=Reflect.getOwnPropertyDescriptor(this,Y.shadow)?.value,r=Object.assign(Object.create(xt(this,this)),e);return n?Object.assign(Object.create(r),{[Y.shadow]:n}):r}isolate(e,n){const r=Object.create(this[Y.isolate]);return r[e]=n??Symbol(e),this.extend({[Y.isolate]:r})}intercept(e,n){const r=Object.create(this[Y.intercept]);return r[e]=n,this.extend({[Y.intercept]:r})}},ie(Te,"Context"),te(Te,"store",Y.store),te(Te,"events",Y.events),te(Te,"static",Y.static),te(Te,"filter",Y.filter),te(Te,"expose",Y.expose),te(Te,"isolate",Y.isolate),te(Te,"internal",Y.internal),te(Te,"intercept",Y.intercept),te(Te,"origin","ctx"),te(Te,"current","ctx"),Te.is[Symbol.toPrimitive]=()=>Symbol.for("cordis.is"),Te.prototype[Te.is]=!0,Te);Je.prototype[Je.internal]=Object.create(null);var cn=(at=class{constructor(...e){te(this,"ctx");te(this,"name");te(this,"config");let n,r,i,s;Je.is(e[0])?(n=e[0],typeof e[1]=="string"?(r=e[1],i=e[2]):s=e[1]):s=e[0],r??(r=this.constructor[Y.provide]),i??(i=this.constructor[Y.immediate]);let o=this;const a={associate:r,property:"ctx"};return o[Y.invoke]&&(o=as(r,rs(Object.getPrototypeOf(this),Function.prototype),a)),n?o.ctx=n:o[Y.setup](),o.name=r,o.config=s,ze(o,Y.tracker,a),o.ctx.provide(r),o.ctx.runtime.name=r,i&&(n?o[Y.expose]=r:o.ctx.set(r,o)),o.ctx.on("ready",async()=>{await Promise.resolve(),await o.start(),i||o.ctx.set(r,o)}),o.ctx.on("dispose",()=>o.stop()),o}start(){}stop(){}[Y.filter](e){return e[Y.isolate][this.name]===this.ctx[Y.isolate][this.name]}[Y.setup](){this.ctx=new Je}[Y.extend](e){let n;return this[at.invoke]?n=as(this.name,this,this[Y.tracker]):n=Object.create(this),Object.assign(n,e)}static[Symbol.hasInstance](e){let n=e.constructor;for(;n;){if(n=n.prototype?.constructor,n===this)return!0;n=Object.getPrototypeOf(n)}return!1}},ie(at,"Service"),te(at,"setup",Y.setup),te(at,"invoke",Y.invoke),te(at,"extend",Y.extend),te(at,"tracker",Y.tracker),te(at,"provide",Y.provide),te(at,"immediate",Y.immediate),at),Zf=Object.defineProperty,ed=Object.getOwnPropertyNames,ue=(t,e)=>Zf(t,"name",{value:e,configurable:!0}),td=(t,e)=>function(){return e||(0,t[ed(t)[0]])((e={exports:{}}).exports,e),e.exports},nd=td({"src/index.ts"(t,e){var T;var n=Symbol.for("schemastery"),r=Symbol.for("ValidationError");globalThis.__schemastery_index__??(globalThis.__schemastery_index__=0);var i=(T=class extends TypeError{constructor(h,S){let O="$";for(const N of S.path||[])typeof N=="string"?O+="."+N:typeof N=="number"?O+="["+N+"]":typeof N=="symbol"&&(O+=`[Symbol(${N.toString()})]`);O.startsWith(".")&&(O=O.slice(1));super((O==="$"?"":`${O} `)+h);te(this,"name","ValidationError");this.options=S}static is(h){return!!h?.[r]}},ue(T,"ValidationError"),T);Object.defineProperty(i.prototype,r,{value:!0});var s=ue(function(v){const p=ue(function(h,S={}){return s.resolve(h,p,S)[0]},"schema");if(v.refs){const h=Dt(v.refs,O=>new s(O)),S=ue(O=>h[O],"getRef");for(const O in h){const N=h[O];N.sKey=S(N.sKey),N.inner=S(N.inner),N.list=N.list&&N.list.map(S),N.dict=N.dict&&Dt(N.dict,S)}return h[v.uid]}if(Object.assign(p,v),typeof p.callback=="string")try{p.callback=new Function("return "+p.callback)()}catch{}return Object.defineProperty(p,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(p,s.prototype),p.meta||(p.meta={}),p.toString=p.toString.bind(p),p},"Schema");s.prototype=Object.create(Function.prototype),s.prototype[n]=!0,s.ValidationError=i;var o;s.prototype.toJSON=ue(function(){var h;if(o)return o[h=this.uid]??(o[h]=JSON.parse(JSON.stringify({...this}))),this.uid;o={[this.uid]:{...this}},o[this.uid]=JSON.parse(JSON.stringify({...this}));const p={uid:this.uid,refs:o};return o=void 0,p},"toJSON"),s.prototype.set=ue(function(p,h){return this.dict[p]=h,this},"set"),s.prototype.push=ue(function(p){return this.list.push(p),this},"push");function a(v,p){const h=typeof v=="string"?{"":v}:{...v};for(const S in p){const O=p[S];O?.$description||O?.$desc?h[S]=O.$description||O.$desc:typeof O=="string"&&(h[S]=O)}return h}ue(a,"mergeDesc");function l(v){return v?.$value??v?.$inner}ue(l,"getInner");function c(v){return aa(v??{},p=>!p.startsWith("$"))}ue(c,"extractKeys"),s.prototype.i18n=ue(function(p){const h=s(this),S=a(h.meta.description,p);return Object.keys(S).length&&(h.meta.description=S),h.dict&&(h.dict=Dt(h.dict,(O,N)=>O.i18n(Dt(p,H=>l(H)?.[N]??H?.[N])))),h.list&&(h.list=h.list.map((O,N)=>O.i18n(Dt(p,(H={})=>Array.isArray(l(H))?l(H)[N]:Array.isArray(H)?H[N]:c(H))))),h.inner&&(h.inner=h.inner.i18n(Dt(p,O=>l(O)?l(O):c(O)))),h.sKey&&(h.sKey=h.sKey.i18n(Dt(p,O=>O?.$key))),h},"i18n"),s.prototype.extra=ue(function(p,h){const S=s(this);return S.meta={...S.meta,[p]:h},S},"extra");for(const v of["required","disabled","collapse","hidden","loose"])Object.assign(s.prototype,{[v](p=!0){const h=s(this);return h.meta={...h.meta,[v]:p},h}});s.prototype.deprecated=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"deprecated",type:"danger"}),p},"deprecated"),s.prototype.experimental=ue(function(){var h;const p=s(this);return(h=p.meta).badges||(h.badges=[]),p.meta.badges.push({text:"experimental",type:"warning"}),p},"experimental"),s.prototype.pattern=ue(function(p){const h=s(this),S=la(p,["source","flags"]);return h.meta={...h.meta,pattern:S},h},"pattern"),s.prototype.simplify=ue(function(p){if(ln(p,this.meta.default,this.type==="dict"))return null;if(Pe(p))return p;if(this.type==="object"||this.type==="dict"){const h={};for(const S in p){const N=(this.type==="object"?this.dict[S]:this.inner)?.simplify(p[S]);(this.type==="dict"||!Pe(N))&&(h[S]=N)}return ln(h,this.meta.default,this.type==="dict")?null:h}else if(this.type==="array"||this.type==="tuple"){const h=[];return p.forEach((S,O)=>{const N=this.type==="array"?this.inner:this.list[O],H=N?N.simplify(S):S;h.push(H)}),h}else if(this.type==="intersect"){const h={};for(const S of this.list)Object.assign(h,S.simplify(p));return h}else if(this.type==="union")for(const h of this.list)try{return s.resolve(p,h,{}),h.simplify(p)}catch{}return p},"simplify"),s.prototype.toString=ue(function(p){return F[this.type]?.(this,p)??`Schema<${this.type}>`},"toString"),s.prototype.role=ue(function(v,p){const h=s(this);return h.meta={...h.meta,role:v,extra:p},h},"role");for(const v of["default","link","comment","description","max","min","step"])Object.assign(s.prototype,{[v](p){const h=s(this);return h.meta={...h.meta,[v]:p},h}});var u={};s.extend=ue(function(p,h){u[p]=h},"extend"),s.resolve=ue(function(p,h,S={},O=!1){if(!h)return[p];if(S.ignore?.(p,h))return[p];if(Pe(p)&&h.type!=="lazy"){if(h.meta.required)throw new i("missing required value",S);let H=h,X=h.meta.default;for(;H?.type==="intersect"&&Pe(X);)H=H.list[0],X=H?.meta.default;if(Pe(X))return[p];p=Ur(X)}const N=u[h.type];if(!N)throw new i(`unsupported type "${h.type}"`,S);try{return N(p,h,S,O)}catch(H){if(!h.meta.loose)throw H;return[h.meta.default]}},"resolve"),s.from=ue(function(p){if(Pe(p))return s.any();if(["string","number","boolean"].includes(typeof p))return s.const(p).required();if(p[n])return p;if(typeof p=="function")switch(p){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(p).required()}else throw new TypeError(`cannot infer schema from ${p}`)},"from"),s.lazy=ue(function(p){const h=ue(()=>(S.inner[n]||(S.inner=S.builder(),S.inner.meta={...S.meta,...S.inner.meta}),S.inner.toJSON()),"toJSON"),S=new s({type:"lazy",builder:p,inner:{toJSON:h}});return S},"lazy"),s.natural=ue(function(){return s.number().step(1).min(0)},"natural"),s.percent=ue(function(){return s.number().step(.01).min(0).max(1).role("slider")},"percent"),s.date=ue(function(){return s.union([s.is(Date),s.transform(s.string().role("datetime"),(p,h)=>{const S=new Date(p);if(isNaN(+S))throw new i(`invalid date "${p}"`,h);return S},!0)])},"date"),s.regExp=ue(function(p=""){return s.union([s.is(RegExp),s.transform(s.string().role("regexp",{flag:p}),(h,S)=>{try{return new RegExp(h,p)}catch(O){throw new i(O.message,S)}},!0)])},"regExp"),s.arrayBuffer=ue(function(p){return s.union([s.is(ArrayBuffer),s.is(SharedArrayBuffer),s.transform(s.any(),(h,S)=>{if(_t.isSource(h))return _t.fromSource(h);throw new i(`expected ArrayBufferSource but got ${h}`,S)},!0),...p?[s.transform(s.string(),(h,S)=>{try{return p==="base64"?_t.fromBase64(h):_t.fromHex(h)}catch(O){throw new i(O.message,S)}},!0)]:[]])},"arrayBuffer"),s.extend("lazy",(v,p,h,S)=>(p.inner[n]||(p.inner=p.builder(),p.inner.meta={...p.meta,...p.inner.meta}),s.resolve(v,p.inner,h,S))),s.extend("any",v=>[v]),s.extend("never",(v,p,h)=>{throw new i(`expected nullable but got ${v}`,h)}),s.extend("const",(v,{value:p},h)=>{if(ln(v,p))return[p];throw new i(`expected ${p} but got ${v}`,h)});function f(v,p,h,S,O=!1){const{max:N=1/0,min:H=-1/0}=p;if(v>N)throw new i(`expected ${h} <= ${N} but got ${v}`,S);if(v<H&&!O)throw new i(`expected ${h} >= ${H} but got ${v}`,S)}ue(f,"checkWithinRange"),s.extend("string",(v,{meta:p},h)=>{if(typeof v!="string")throw new i(`expected string but got ${v}`,h);if(p.pattern){const S=new RegExp(p.pattern.source,p.pattern.flags);if(!S.test(v))throw new i(`expect string to match regexp ${S}`,h)}return f(v.length,p,"string length",h),[v]});function m(v,p){const h=v.toString();if(h.includes("e"))return v*Math.pow(10,p);const S=h.indexOf(".");if(S===-1)return v*Math.pow(10,p);const O=h.slice(S+1),N=h.slice(0,S);return O.length<=p?+(N+O.padEnd(p,"0")):+(N+O.slice(0,p)+"."+O.slice(p))}ue(m,"decimalShift");function y(v,p,h){if(h=Math.abs(h),!/^\d+\.\d+$/.test(h.toString()))return(v-p)%h===0;const S=h.toString().indexOf("."),O=h.toString().slice(S+1).length;return Math.abs(m(v,O)-m(p,O))%m(h,O)===0}ue(y,"isMultipleOf"),s.extend("number",(v,{meta:p},h)=>{if(typeof v!="number")throw new i(`expected number but got ${v}`,h);f(v,p,"number",h);const{step:S}=p;if(S&&!y(v,p.min??0,S))throw new i(`expected number multiple of ${S} but got ${v}`,h);return[v]}),s.extend("boolean",(v,p,h)=>{if(typeof v=="boolean")return[v];throw new i(`expected boolean but got ${v}`,h)}),s.extend("bitset",(v,{bits:p,meta:h},S)=>{let O=0,N=[];if(typeof v=="number"){O=v;for(const H in p)v&p[H]&&N.push(H)}else if(Array.isArray(v)){N=v;for(const H of N){if(typeof H!="string")throw new i(`expected string but got ${H}`,S);H in p&&(O|=p[H])}}else throw new i(`expected number or array but got ${v}`,S);return O===h.default?[O]:[O,N]}),s.extend("function",(v,p,h)=>{if(typeof v=="function")return[v];throw new i(`expected function but got ${v}`,h)}),s.extend("is",(v,{constructor:p},h)=>{if(typeof p=="function"){if(v instanceof p)return[v];throw new i(`expected ${p.name} but got ${v}`,h)}else{if(Pe(v))throw new i(`expected ${p} but got ${v}`,h);let S=Object.getPrototypeOf(v);for(;S;){if(S.constructor?.name===p)return[v];S=Object.getPrototypeOf(S)}throw new i(`expected ${p} but got ${v}`,h)}});function b(v,p,h,S){try{const[O,N]=s.resolve(v[p],h,{...S,path:[...S.path||[],p]});return N!==void 0&&(v[p]=N),O}catch(O){if(!S?.autofix)throw O;return delete v[p],h.meta.default}}ue(b,"property"),s.extend("array",(v,{inner:p,meta:h},S)=>{if(!Array.isArray(v))throw new i(`expected array but got ${v}`,S);return f(v.length,h,"array length",S,!Pe(p.meta.default)),[v.map((O,N)=>b(v,N,p,S))]}),s.extend("dict",(v,{inner:p,sKey:h},S,O)=>{if(!Br(v))throw new i(`expected object but got ${v}`,S);const N={};for(const H in v){let X;try{X=s.resolve(H,h,S)[0]}catch(Ce){if(O)continue;throw Ce}N[X]=b(v,H,p,S),v[X]=v[H],H!==X&&delete v[H]}return[N]}),s.extend("tuple",(v,{list:p},h,S)=>{if(!Array.isArray(v))throw new i(`expected array but got ${v}`,h);const O=p.map((N,H)=>b(v,H,N,h));return S?[O]:(O.push(...v.slice(p.length)),[O])});function I(v,p){for(const h in p)h in v||(v[h]=p[h])}ue(I,"merge"),s.extend("object",(v,{dict:p},h,S)=>{if(!Br(v))throw new i(`expected object but got ${v}`,h);const O={};for(const N in p){const H=b(v,N,p[N],h);(!Pe(H)||N in v)&&(O[N]=H)}return S||I(O,v),[O]}),s.extend("union",(v,{list:p,toString:h},S,O)=>{for(const N of p)try{return s.resolve(v,N,S,O)}catch{}throw new i(`expected ${h()} but got ${JSON.stringify(v)}`,S)}),s.extend("intersect",(v,{list:p,toString:h},S,O)=>{if(!p.length)return[v];let N;for(const H of p){const X=s.resolve(v,H,S,!0)[0];if(!Pe(X))if(Pe(N))N=X;else{if(typeof N!=typeof X)throw new i(`expected ${h()} but got ${JSON.stringify(v)}`,S);if(typeof X=="object")I(N??(N={}),X);else if(N!==X)throw new i(`expected ${h()} but got ${JSON.stringify(v)}`,S)}}return!O&&Br(v)&&I(N,v),[N]}),s.extend("transform",(v,{inner:p,callback:h,preserve:S},O)=>{const[N,H=v]=s.resolve(v,p,O,!0);return S?[h(N)]:[h(N),h(H)]});var F={};function D(v,p,h){F[v]=h,Object.assign(s,{[v](...S){const O=new s({type:v});return p.forEach((N,H)=>{switch(N){case"sKey":O.sKey=S[H]??s.string();break;case"inner":O.inner=s.from(S[H]);break;case"list":O.list=S[H].map(s.from);break;case"dict":O.dict=Dt(S[H],s.from);break;case"bits":{O.bits={};for(const X in S[H])typeof S[H][X]=="number"&&(O.bits[X]=S[H][X]);break}case"callback":{const X=O.callback=S[H];X.toJSON||(X.toJSON=()=>X.toString());break}case"constructor":{const X=O.constructor=S[H];typeof X=="function"&&(X.toJSON||(X.toJSON=()=>X.name));break}default:O[N]=S[H]}}),v==="object"||v==="dict"?O.meta.default={}:v==="array"||v==="tuple"?O.meta.default=[]:v==="bitset"&&(O.meta.default=0),O}})}ue(D,"defineMethod"),D("is",["constructor"],({constructor:v})=>typeof v=="function"?v.name:v),D("any",[],()=>"any"),D("never",[],()=>"never"),D("const",["value"],({value:v})=>typeof v=="string"?JSON.stringify(v):v),D("string",[],()=>"string"),D("number",[],()=>"number"),D("boolean",[],()=>"boolean"),D("bitset",["bits"],()=>"bitset"),D("function",[],()=>"function"),D("array",["inner"],({inner:v})=>`${v.toString(!0)}[]`),D("dict",["inner","sKey"],({inner:v,sKey:p})=>`{ [key: ${p.toString()}]: ${v.toString()} }`),D("tuple",["list"],({list:v})=>`[${v.map(p=>p.toString()).join(", ")}]`),D("object",["dict"],({dict:v})=>Object.keys(v).length===0?"{}":`{ ${Object.entries(v).map(([p,h])=>`${p}${h.meta.required?"":"?"}: ${h.toString()}`).join(", ")} }`),D("union",["list"],({list:v},p)=>{const h=v.map(({toString:S})=>S()).join(" | ");return p?`(${h})`:h}),D("intersect",["list"],({list:v})=>`${v.map(p=>p.toString(!0)).join(" & ")}`),D("transform",["inner","callback","preserve"],({inner:v},p)=>v.toString(p)),e.exports=s}});const fe=nd();/**
|
|
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 fs=(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))(fs||{});const ds=globalThis||window,hs=Symbol.for("__IPE_LOGGER_COLOR_MAP__");ds[hs]||(ds[hs]=new Map);const ps=ds[hs];function Hr(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=(e>>>0)*16777619;return e>>>0}const ya=[[350,360],[0,15],[15,30],[200,230],[230,250],[250,280],[280,310],[310,330],[140,160],[160,180]];function rd(t,e){const n=ya.length,r=Hr(t)%n,[i,s]=ya[r],o=s-i,a=Hr(t+":"+e),l=i+a%(o||1),c=Hr(t+":s"),u=Hr(t+":l");let f,m;if(e==="name")f=62+c%18,m=30+u%12;else{const y=l>=0&&l<50||l>330&&l<360,b=l>=200&&l<=300;f=55+c%20,b?m=55+u%8:y?m=48+u%6:m=50+u%8,f<60&&(f+=5)}return`hsl(${l}, ${f}%, ${m}%)`}function Wr(t,e){if(e)return ps.set(t,e),e;const n=ps.get(t);if(n)return n;const r=t.startsWith("name:")?"name":"group",i=rd(t,r);return ps.set(t,i),i}/**
|
|
11
11
|
* @inpageedit/logger
|
|
12
12
|
* Flexible, Extensible Console Logger with Colored Labels and Hierarchical Loggers
|
|
13
13
|
*
|
|
@@ -26,30 +26,30 @@
|
|
|
26
26
|
* logger.defineLevel('success', { level: LoggerLevel.info, label: '✅', method: 'info' })
|
|
27
27
|
* logger.success('User created successfully')
|
|
28
28
|
* ```
|
|
29
|
-
*/let ya=class xf{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return ba;const[r,i]=this._prefix(n.label);return this._consoleMethod(n.method).bind(console,r,...i)},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&&Ur(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const n of Object.keys(this._dynamicLevels))this._installLevelGetter(n,this._dynamicLevels[n]);return rd(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,n){return e&&Ur(`group:${e}`,n?.color),new xf({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,n){this._dynamicLevels[e]={...n},this._installLevelGetter(e,n)}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,n){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(n)})}_method(e){const n=nd[e];if(!this._enabled(n.level))return ba;const[r,i]=this._prefix(n.label);return this._consoleMethod(e).bind(console,r,...i)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const n=[];let r="";if(this._name){const i=Ur(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,n.push(`background:${i}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,_a)}if(e&&(r+=` ${e}`),this._groupPath.length){const i=this._groupPath.join("/"),s=Ur(`group:${i}`);r+=` %c${i}%c`,n.push(`color:${s}; text-decoration: underline;`,_a)}return[r,n]}};const ba=()=>{},_a="color:inherit; background:transparent; text-decoration:none;",nd={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 rd(t){const e=function(n,r){return t.group(n,r)};return new Proxy(e,{get(n,r,i){return t[r]},set(n,r,i){return t[r]=i,!0},apply(n,r,i){return t.group(i[0],i[1])},has(n,r){return r in t}})}function wa(t){return new ya(t)}var nt=(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))(nt||{});class Qe extends Error{constructor(e,n,r,i){super(n,i),this.code=e,this.context=r,this.name="FexiosError"}}let id=class extends Qe{constructor(e,n,r){super(n.statusText,e,void 0,r),this.response=n,this.name="FexiosResponseError"}};function sd(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const n=Math.min(Math.max(t.length,256),e),r=t.slice(0,n);if(od(r))return!1;const i=ad(r);if(i.nullByteRatio>.05||i.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 u=new TextDecoder(l,{fatal:!0}).decode(r),c=ld(u);c>o&&(o=c,a=c>.7)}catch{continue}return a}function od(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 n of e)if(t.length>=n.length){let r=!0;for(let i=0;i<n.length;i++)if(t[i]!==n[i]){r=!1;break}if(r)return!0}return!1}function ad(t){let e=0,n=0,r=0;for(const i of t)i===0&&e++,i>127&&n++,(i<32&&i!==9&&i!==10&&i!==13||i===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:n/t.length,controlCharRatio:r/t.length}}function ld(t){if(t.length===0)return 1;let e=1,n=0;for(let i=0;i<t.length;i++){const s=t[i].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?n++:s>127&&s<65534?!cd(s)&&!ud(s)&&n++:e-=.1}const r=n/t.length;return e*=r,fd(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function cd(t){return t>=0&&t<=31||t>=127&&t<=159}function ud(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function fd(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function zr(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}function xa(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}let Zn=class{constructor(e,n,r){this.rawResponse=e,this.data=n,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([i,s])=>{this[i]=s})}};async function dd(t,e,n){var r;if(t.bodyUsed)throw new Qe(nt.BODY_USED,"Response body has already been used or locked");const i=t.headers.get("content-type")||"",s=Number(t.headers.get("content-length"))||0,o=(l,u)=>u==="json"||l.startsWith("application/json"),a=(l,u,c)=>c==="blob"||l.startsWith("image/")&&!l.startsWith("image/svg")||l.startsWith("video/")||l.startsWith("audio/")||!sd(u);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const l=new WebSocket(t.url);return await new Promise((u,c)=>{l.onopen=u,l.onerror=c}),new Zn(t,l,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(i.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const l=new EventSource(t.url);return await new Promise((u,c)=>{l.onopen=u,l.onerror=c}),new Zn(t,l)}else{if(e==="stream")return new Zn(t,t.body);{const l=(r=t.clone().body)==null?void 0:r.getReader();if(!l)throw new Qe(nt.NO_BODY_READER,"Failed to get ReadableStream from response body");let u=new Uint8Array;for(;;){const{done:f,value:v}=await l.read();if(f)break;if(v&&(u=new Uint8Array([...u,...v]),n&&s>0)){const y=Math.min(u.length/s,1);n(y,u)}}const c=new Zn(t,void 0);if(e==="arrayBuffer")return c.data=u.buffer,c;if(o(i,e))try{const f=new TextDecoder().decode(u);c.data=JSON.parse(f)}catch{}if(typeof c.data!="string"&&a(i,u,e)?c.data=new Blob([u],{type:t.headers.get("content-type")||void 0}):c.data=new TextDecoder().decode(u),typeof c.data=="string"&&e!=="text"){const f=c.data.trim(),v=f[0],y=f[f.length-1];if(v==="{"&&y==="}"||v==="["&&y==="]")try{c.data=JSON.parse(c.data)}catch{}}if(typeof c.data>"u"&&(c.data=u.length>0?u:void 0),c.ok)return c;throw new id(`Request failed with status code ${t.status}`,c)}}}let hd=class{static makeSearchParams(e){const n=new URLSearchParams;return Object.entries(e).forEach(([r,i])=>{Array.isArray(i)?i.forEach(s=>n.append(r,String(s))):n.set(r,String(i))}),n}static makeQueryString(e){return this.makeSearchParams(e).toString()}};function pd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ds,Sa;function md(){if(Sa)return ds;Sa=1;function t(e){var n=this.constructor.prototype[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,this.constructor.prototype),Object.getOwnPropertyNames(n).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(n,i))}),r}return t.prototype=Object.create(Function.prototype),ds=t,ds}var gd=md();const vd=pd(gd),Hr=class sn extends vd{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=sn.create,this.dropUndefinedAndNull=xa,this.checkIsPlainObject=zr,e={...sn.DEFAULT_CONFIGS,...e},sn.ALL_METHODS.forEach(this.createMethodShortcut.bind(this))}async request(e,n){var r,i,s,o;let a=n=n||{};typeof e=="string"||e instanceof URL?a.url=e.toString():typeof e=="object"&&(a={...e,...a}),a=await this.emit("beforeInit",a);const l=n.baseURL||this.baseConfigs.baseURL||((r=globalThis.location)==null?void 0:r.href),u=l?new URL(l,(i=globalThis.location)==null?void 0:i.href):void 0,c=new URL(a.url.toString(),u);a.url=c.href,a.baseURL=u?u.href:c.origin,a.headers=this.mergeHeaders(this.baseConfigs.headers,n.headers);const f=u?.searchParams,v=new URLSearchParams(c.searchParams);if(c.search="",a.url=c.href,a.query=this.mergeQuery(f,this.baseConfigs.query,v,n.query),c.search=hd.makeQueryString(a.query),a.url=c.toString(),sn.METHODS_WITHOUT_BODY.includes((s=a.method)==null?void 0:s.toLocaleLowerCase())&&a.body)throw new Qe(nt.BODY_NOT_ALLOWED,`Request method "${a.method}" does not allow body`);a=await this.emit("beforeRequest",a);let y;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?y=a.body:typeof a.body=="object"&&a.body!==null?(y=JSON.stringify(a.body),a.headers["content-type"]="application/json"):y=a.body),!((o=n.headers)!=null&&o["content-type"])&&y&&(y instanceof FormData||y instanceof URLSearchParams?delete a.headers["content-type"]:typeof y=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":y instanceof Blob&&(a.headers["content-type"]=y.type)),a.body=y,a=await this.emit("afterBodyTransformed",a);const b=a.abortController||globalThis.AbortController?new AbortController:void 0,I=new Request(a.url,{method:a.method||"GET",credentials:a.credentials,cache:a.cache,mode:a.mode,headers:a.headers,body:a.body,signal:b?.signal});a.rawRequest=I,a=await this.emit("beforeActualFetch",a);const U=a.timeout||this.baseConfigs.timeout||60*1e3;if(a.url.startsWith("ws"))try{const T=new WebSocket(a.url);return await new Promise((g,p)=>{const h=setTimeout(()=>{p(new Qe(nt.TIMEOUT,`WebSocket connection timed out after ${U}ms`,a))},U);T.onopen=()=>{clearTimeout(h),g()},T.onerror=S=>{clearTimeout(h),p(new Qe(nt.NETWORK_ERROR,"WebSocket connection failed",a))},T.onclose=S=>{S.code!==1e3&&(clearTimeout(h),p(new Qe(nt.NETWORK_ERROR,`WebSocket closed with code ${S.code}`,a)))}}),a.rawResponse=new Response,a.response=new Zn(a.rawResponse,T,{ok:!0,status:101,statusText:"Switching Protocols"}),a.data=T,a.headers=new Headers,this.emit("afterResponse",a)}catch(T){throw T instanceof Qe?T:new Qe(nt.NETWORK_ERROR,`WebSocket creation failed: ${T}`,a)}let D;try{b&&(D=setTimeout(()=>{b.abort()},U));const T=await(n.fetch||this.baseConfigs.fetch||globalThis.fetch)(a.rawRequest).catch(g=>{throw D&&clearTimeout(D),b!=null&&b.signal.aborted?new Qe(nt.TIMEOUT,`Request timed out after ${U}ms`,a):new Qe(nt.NETWORK_ERROR,g.message,a)});return D&&clearTimeout(D),a.rawResponse=T,a.response=await dd(T,a.responseType,(g,p)=>{var h;(h=n?.onProgress)==null||h.call(n,g,p)}),a.data=a.response.data,a.headers=a.response.headers,this.emit("afterResponse",a)}catch(T){throw D&&clearTimeout(D),T}}mergeQuery(e,...n){const r={},i=s=>{s&&(zr(s)?Object.entries(s).forEach(([o,a])=>{a==null?delete r[o]:Array.isArray(a)?(o.endsWith("[]"),r[o]=a.map(String)):r[o]=String(a)}):new URLSearchParams(s).forEach((o,a)=>{r[a]=o}))};return i(e),n.forEach(i),r}mergeHeaders(e,...n){const r={},i=new Headers(e);for(const s of n)if(s!=null)if(zr(s)){const o=xa(s);if(Object.keys(o).length===0)continue;new Headers(o).forEach((a,l)=>{i.set(l,a)})}else new Headers(s).forEach((o,a)=>{i.set(a,o)});return i.forEach((s,o)=>{r[o]=s}),r}async emit(e,n){const r=this.hooks.filter(i=>i.event===e);try{let i=0;for(const s of r){const o=`${e}#${s.action.name||`anonymous#${i}`}`,a=Symbol("FexiosHookContext");n[a]=a;let l=await s.action.call(this,n);if(l===void 0&&(l=n),l===!1)throw new Qe(nt.ABORTED_BY_HOOK,`Request aborted by hook "${o}"`,n);if(typeof l=="object"&&l[a]===a)n=l;else{const u=globalThis["".concat("console")];try{throw new Qe(nt.HOOK_CONTEXT_CHANGED,`Hook "${o}" should return the original FexiosContext or return false to abort the request, but got "${l}".`)}catch(c){u.warn(c.stack||c)}}delete n[a],i++}}catch(i){return Promise.reject(i)}return n}on(e,n,r=!1){if(typeof n!="function")throw new Qe(nt.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof n}"`);return this.hooks[r?"unshift":"push"]({event:e,action:n}),this}off(e,n){return e==="*"||!e?this.hooks=this.hooks.filter(r=>r.action!==n):this.hooks=this.hooks.filter(r=>r.event!==e||r.action!==n),this}createInterceptor(e){return{handlers:()=>this.hooks.filter(n=>n.event===e).map(n=>n.action),use:(n,r=!1)=>this.on(e,n,r),clear:()=>{this.hooks=this.hooks.filter(n=>n.event!==e)}}}createMethodShortcut(e){return Object.defineProperty(this,e,{value:(n,r,i)=>(sn.METHODS_WITHOUT_BODY.includes(e.toLocaleLowerCase())?i=r:(i=i||{},i.body=r),this.request(n,{...i,method:e}))}),this}extends(e){const n=new sn({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new sn(e)}};Hr.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch},Hr.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],Hr.METHODS_WITHOUT_BODY=["get","head","options","trace"];let Ea=Hr;/**
|
|
29
|
+
*/let ba=class Ef{constructor(e={}){this._custom=n=>{if(!this._enabled(n.level))return wa;const[r,i]=this._prefix(n.label);return this._consoleMethod(n.method).bind(console,r,...i)},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&&Wr(`name:${this._name}`,this._nameColor),this._installBuiltinLevels();for(const n of Object.keys(this._dynamicLevels))this._installLevelGetter(n,this._dynamicLevels[n]);return sd(this)}get level(){return this._levelRef.value}set level(e){this._levelRef.value=e}group(e,n){return e&&Wr(`group:${e}`,n?.color),new Ef({name:this._name,color:this._nameColor,_groupPath:[...this._groupPath,e],_dynamicLevels:this._dynamicLevels,_levelRef:this._levelRef})}defineLevel(e,n){this._dynamicLevels[e]={...n},this._installLevelGetter(e,n)}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,n){Object.defineProperty(this,e,{configurable:!0,enumerable:!1,get:()=>this._custom(n)})}_method(e){const n=id[e];if(!this._enabled(n.level))return wa;const[r,i]=this._prefix(n.label);return this._consoleMethod(e).bind(console,r,...i)}_consoleMethod(e){return(console[e]||console.log).bind(console)}_enabled(e){return e>=this._levelRef.value&&this._levelRef.value!==4}_prefix(e){const n=[];let r="";if(this._name){const i=Wr(`name:${this._name}`,this._nameColor);r+=`%c${this._name}%c`,n.push(`background:${i}; color:#fff; padding:1px 4px; border-radius:2px; font-weight:700;`,_a)}if(e&&(r+=` ${e}`),this._groupPath.length){const i=this._groupPath.join("/"),s=Wr(`group:${i}`);r+=` %c${i}%c`,n.push(`color:${s}; text-decoration: underline;`,_a)}return[r,n]}};const wa=()=>{},_a="color:inherit; background:transparent; text-decoration:none;",id={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 sd(t){const e=function(n,r){return t.group(n,r)};return new Proxy(e,{get(n,r,i){return t[r]},set(n,r,i){return t[r]=i,!0},apply(n,r,i){return t.group(i[0],i[1])},has(n,r){return r in t}})}function xa(t){return new ba(t)}var rt=(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))(rt||{});class Xe extends Error{constructor(e,n,r,i){super(n,i),this.code=e,this.context=r,this.name="FexiosError"}}let od=class extends Xe{constructor(e,n,r){super(n.statusText,e,void 0,r),this.response=n,this.name="FexiosResponseError"}};function ad(t,e=2048){if(!(t instanceof Uint8Array))throw new TypeError("Input must be a Uint8Array");if(t.length===0)return!0;const n=Math.min(Math.max(t.length,256),e),r=t.slice(0,n);if(ld(r))return!1;const i=cd(r);if(i.nullByteRatio>.05||i.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=ud(c);u>o&&(o=u,a=u>.7)}catch{continue}return a}function ld(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 n of e)if(t.length>=n.length){let r=!0;for(let i=0;i<n.length;i++)if(t[i]!==n[i]){r=!1;break}if(r)return!0}return!1}function cd(t){let e=0,n=0,r=0;for(const i of t)i===0&&e++,i>127&&n++,(i<32&&i!==9&&i!==10&&i!==13||i===127)&&r++;return{nullByteRatio:e/t.length,highByteRatio:n/t.length,controlCharRatio:r/t.length}}function ud(t){if(t.length===0)return 1;let e=1,n=0;for(let i=0;i<t.length;i++){const s=t[i].charCodeAt(0);s>=32&&s<=126||s===9||s===10||s===13||s===32?n++:s>127&&s<65534?!fd(s)&&!dd(s)&&n++:e-=.1}const r=n/t.length;return e*=r,hd(t)&&(e*=1.1),Math.max(0,Math.min(1,e))}function fd(t){return t>=0&&t<=31||t>=127&&t<=159}function dd(t){return t>=57344&&t<=63743||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function hd(t){return[/\b\w+\b/,/[.!?]+\s/,/\s+/,/[a-zA-Z]{3,}/,/[\u4e00-\u9fa5]+/,/\d+/].some(e=>e.test(t))}function Kr(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}function Sa(t,e={}){const n={};return Object.entries(t).forEach(([r,i])=>{i!=null&&(e.dropEmptyString&&i===""||(n[r]=i))}),n}let nr=class{constructor(e,n,r){this.rawResponse=e,this.data=n,this.ok=e.ok,this.status=e.status,this.statusText=e.statusText,this.headers=e.headers,Object.entries(r||{}).forEach(([i,s])=>{this[i]=s})}};async function pd(t,e,n){var r;if(t.bodyUsed)throw new Xe(rt.BODY_USED,"Response body has already been used or locked");const i=t.headers.get("content-type")||"",s=Number(t.headers.get("content-length"))||0,o=(l,c)=>c==="json"||l.startsWith("application/json"),a=(l,c,u)=>u==="blob"||l.startsWith("image/")&&!l.startsWith("image/svg")||l.startsWith("video/")||l.startsWith("audio/")||!ad(c);if((t.status===101||t.status===426||t.headers.get("upgrade"))&&typeof globalThis.WebSocket<"u"){const l=new WebSocket(t.url);return await new Promise((c,u)=>{l.onopen=c,l.onerror=u}),new nr(t,l,{ok:!0,status:101,statusText:"Switching Protocols"})}else if(i.startsWith("text/event-stream")&&!["text","json"].includes(e||"")&&typeof globalThis.EventSource<"u"){const l=new EventSource(t.url);return await new Promise((c,u)=>{l.onopen=c,l.onerror=u}),new nr(t,l)}else{if(e==="stream")return new nr(t,t.body);{const l=(r=t.clone().body)==null?void 0:r.getReader();if(!l)throw new Xe(rt.NO_BODY_READER,"Failed to get ReadableStream from response body");let c=new Uint8Array;for(;;){const{done:f,value:m}=await l.read();if(f)break;if(m&&(c=new Uint8Array([...c,...m]),n&&s>0)){const y=Math.min(c.length/s,1);n(y,c)}}const u=new nr(t,void 0);if(e==="arrayBuffer")return u.data=c.buffer,u;if(o(i,e))try{const f=new TextDecoder().decode(c);u.data=JSON.parse(f)}catch{}if(typeof u.data!="string"&&a(i,c,e)?u.data=new Blob([c],{type:t.headers.get("content-type")||void 0}):u.data=new TextDecoder().decode(c),typeof u.data=="string"&&e!=="text"){const f=u.data.trim(),m=f[0],y=f[f.length-1];if(m==="{"&&y==="}"||m==="["&&y==="]")try{u.data=JSON.parse(u.data)}catch{}}if(typeof u.data>"u"&&(u.data=c.length>0?c:void 0),u.ok)return u;throw new od(`Request failed with status code ${t.status}`,u)}}}let md=class{static makeSearchParams(e){const n=new URLSearchParams;return Object.entries(e).forEach(([r,i])=>{Array.isArray(i)?i.forEach(s=>n.append(r,String(s))):n.set(r,String(i))}),n}static makeQueryString(e){return this.makeSearchParams(e).toString()}};function gd(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ms,Ea;function vd(){if(Ea)return ms;Ea=1;function t(e){var n=this.constructor.prototype[e],r=function(){return n.apply(r,arguments)};return Object.setPrototypeOf(r,this.constructor.prototype),Object.getOwnPropertyNames(n).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(n,i))}),r}return t.prototype=Object.create(Function.prototype),ms=t,ms}var yd=vd();const bd=gd(yd),Vr=class an extends bd{constructor(e={}){super("request"),this.baseConfigs=e,this.hooks=[],this.interceptors={request:this.createInterceptor("beforeRequest"),response:this.createInterceptor("afterResponse")},this.create=an.create,this.dropUndefinedAndNull=Sa,this.checkIsPlainObject=Kr,e={...an.DEFAULT_CONFIGS,...e},an.ALL_METHODS.forEach(this.createMethodShortcut.bind(this))}async request(e,n){var r,i,s,o;let a=n=n||{};typeof e=="string"||e instanceof URL?a.url=e.toString():typeof e=="object"&&(a={...e,...a}),a=await this.emit("beforeInit",a);const l=n.baseURL||this.baseConfigs.baseURL||((r=globalThis.location)==null?void 0:r.href),c=l?new URL(l,(i=globalThis.location)==null?void 0:i.href):void 0,u=new URL(a.url.toString(),c);a.url=u.href,a.baseURL=c?c.href:u.origin,a.headers=this.mergeHeaders(this.baseConfigs.headers,n.headers);const f=c?.searchParams,m=new URLSearchParams(u.searchParams);if(u.search="",a.url=u.href,a.query=this.mergeQuery(f,this.baseConfigs.query,m,n.query),u.search=md.makeQueryString(a.query),a.url=u.toString(),an.METHODS_WITHOUT_BODY.includes((s=a.method)==null?void 0:s.toLocaleLowerCase())&&a.body)throw new Xe(rt.BODY_NOT_ALLOWED,`Request method "${a.method}" does not allow body`);a=await this.emit("beforeRequest",a);let y;typeof a.body<"u"&&a.body!==null&&(a.body instanceof Blob||a.body instanceof FormData||a.body instanceof URLSearchParams?y=a.body:typeof a.body=="object"&&a.body!==null?(y=JSON.stringify(a.body),a.headers["content-type"]="application/json"):y=a.body),!((o=n.headers)!=null&&o["content-type"])&&y&&(y instanceof FormData||y instanceof URLSearchParams?delete a.headers["content-type"]:typeof y=="string"&&typeof a.body=="object"?a.headers["content-type"]="application/json":y instanceof Blob&&(a.headers["content-type"]=y.type)),a.body=y,a=await this.emit("afterBodyTransformed",a);const b=a.abortController||globalThis.AbortController?new AbortController:void 0,I=new Request(a.url,{method:a.method||"GET",credentials:a.credentials,cache:a.cache,mode:a.mode,headers:a.headers,body:a.body,signal:b?.signal});a.rawRequest=I,a=await this.emit("beforeActualFetch",a);const F=a.timeout||this.baseConfigs.timeout||60*1e3;if(a.url.startsWith("ws"))try{const T=new WebSocket(a.url);return await new Promise((v,p)=>{const h=setTimeout(()=>{p(new Xe(rt.TIMEOUT,`WebSocket connection timed out after ${F}ms`,a))},F);T.onopen=()=>{clearTimeout(h),v()},T.onerror=S=>{clearTimeout(h),p(new Xe(rt.NETWORK_ERROR,"WebSocket connection failed",a))},T.onclose=S=>{S.code!==1e3&&(clearTimeout(h),p(new Xe(rt.NETWORK_ERROR,`WebSocket closed with code ${S.code}`,a)))}}),a.rawResponse=new Response,a.response=new nr(a.rawResponse,T,{ok:!0,status:101,statusText:"Switching Protocols"}),a.data=T,a.headers=new Headers,this.emit("afterResponse",a)}catch(T){throw T instanceof Xe?T:new Xe(rt.NETWORK_ERROR,`WebSocket creation failed: ${T}`,a)}let D;try{b&&(D=setTimeout(()=>{b.abort()},F));const T=await(n.fetch||this.baseConfigs.fetch||globalThis.fetch)(a.rawRequest).catch(v=>{throw D&&clearTimeout(D),b!=null&&b.signal.aborted?new Xe(rt.TIMEOUT,`Request timed out after ${F}ms`,a):new Xe(rt.NETWORK_ERROR,v.message,a)});return D&&clearTimeout(D),a.rawResponse=T,a.response=await pd(T,a.responseType,(v,p)=>{var h;(h=n?.onProgress)==null||h.call(n,v,p)}),a.data=a.response.data,a.headers=a.response.headers,this.emit("afterResponse",a)}catch(T){throw D&&clearTimeout(D),T}}mergeQuery(e,...n){const r={},i=s=>{s&&(Kr(s)?Object.entries(s).forEach(([o,a])=>{a==null?delete r[o]:Array.isArray(a)?(o.endsWith("[]"),r[o]=a.map(String)):r[o]=String(a)}):new URLSearchParams(s).forEach((o,a)=>{r[a]=o}))};return i(e),n.forEach(i),r}mergeHeaders(e,...n){const r={},i=new Headers(e);for(const s of n)if(s!=null)if(Kr(s)){const o=Sa(s);if(Object.keys(o).length===0)continue;new Headers(o).forEach((a,l)=>{i.set(l,a)})}else new Headers(s).forEach((o,a)=>{i.set(a,o)});return i.forEach((s,o)=>{r[o]=s}),r}async emit(e,n){const r=this.hooks.filter(i=>i.event===e);try{let i=0;for(const s of r){const o=`${e}#${s.action.name||`anonymous#${i}`}`,a=Symbol("FexiosHookContext");n[a]=a;let l=await s.action.call(this,n);if(l===void 0&&(l=n),l===!1)throw new Xe(rt.ABORTED_BY_HOOK,`Request aborted by hook "${o}"`,n);if(typeof l=="object"&&l[a]===a)n=l;else{const c=globalThis["".concat("console")];try{throw new Xe(rt.HOOK_CONTEXT_CHANGED,`Hook "${o}" should return the original FexiosContext or return false to abort the request, but got "${l}".`)}catch(u){c.warn(u.stack||u)}}delete n[a],i++}}catch(i){return Promise.reject(i)}return n}on(e,n,r=!1){if(typeof n!="function")throw new Xe(rt.INVALID_HOOK_CALLBACK,`Hook should be a function, but got "${typeof n}"`);return this.hooks[r?"unshift":"push"]({event:e,action:n}),this}off(e,n){return e==="*"||!e?this.hooks=this.hooks.filter(r=>r.action!==n):this.hooks=this.hooks.filter(r=>r.event!==e||r.action!==n),this}createInterceptor(e){return{handlers:()=>this.hooks.filter(n=>n.event===e).map(n=>n.action),use:(n,r=!1)=>this.on(e,n,r),clear:()=>{this.hooks=this.hooks.filter(n=>n.event!==e)}}}createMethodShortcut(e){return Object.defineProperty(this,e,{value:(n,r,i)=>(an.METHODS_WITHOUT_BODY.includes(e.toLocaleLowerCase())?i=r:(i=i||{},i.body=r),this.request(n,{...i,method:e}))}),this}extends(e){const n=new an({...this.baseConfigs,...e});return n.hooks=[...this.hooks],n}static create(e){return new an(e)}};Vr.DEFAULT_CONFIGS={baseURL:"",timeout:60*1e3,credentials:"same-origin",headers:{},query:{},responseType:void 0,fetch:globalThis.fetch},Vr.ALL_METHODS=["get","post","put","patch","delete","head","options","trace"],Vr.METHODS_WITHOUT_BODY=["get","head","options","trace"];let ka=Vr;/**
|
|
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
|
|
35
|
+
*/const wd=ka.create,Pa=wd();typeof globalThis<"u"?globalThis.fexios=Pa:typeof window<"u"&&(window.fexios=Pa);/**
|
|
36
36
|
* MediaWiki Api
|
|
37
37
|
* Provides the API call methods similar to `mw.Api` at non-mw environments
|
|
38
38
|
*
|
|
39
39
|
* @author Dragon-Fish <dragon-fish@qq.com>
|
|
40
40
|
* @license MIT
|
|
41
|
-
*/const $a=class
|
|
41
|
+
*/const $a=class qe{constructor(e,n,r){if(this.baseURL=e,this.version="5.2.0",this.normalizeParamValue=qe.normalizeParamValue,this.normalizeBody=qe.normalizeBody,this.isMediaWikiApiError=qe.isMediaWikiApiError,this.extractMediaWikiErrors=qe.extractMediaWikiErrors,this.isBadTokenError=qe.isBadTokenError,!e&&typeof window=="object"&&window.mediaWiki){const{wgServer:i,wgScriptPath:s}=window.mediaWiki?.config?.get(["wgServer","wgScriptPath"])||{};typeof i=="string"&&typeof s=="string"&&(e=`${i}${s}/api.php`)}if(typeof e!="string")throw new Error("baseURL is undefined");this.baseURL=e,this.tokens={},this.defaultParams={...qe.INIT_DEFAULT_PARAMS,...r},this.defaultOptions={responseType:"json",...n},this.request=qe.createRequestHandler(this.baseURL)}setBaseURL(e){return this.request.baseConfigs.baseURL=e,this}static normalizeParamValue(e){return Array.isArray(e)?e.join("|"):typeof e=="boolean"||e===null?e?"1":void 0:typeof e=="number"?""+e:e}static normalizeBody(e){const n=r=>r&&(r instanceof URLSearchParams||r instanceof FormData);if(e!=null){if(n(e))return e.forEach((r,i)=>{const s=qe.normalizeParamValue(r);s==null?e.delete(i):s!==r&&e.set(i,s)}),e;if(Kr(e))return e=Object.fromEntries(Object.entries(e).map(([r,i])=>[r,qe.normalizeParamValue(i)]).filter(([r,i])=>i!=null)),Object.values(e).some(r=>r instanceof File||r instanceof Blob)?(e=new FormData,Object.entries(e).forEach(([r,i])=>{e.append(r,i)})):e=new URLSearchParams(e),e}}static createRequestHandler(e){const n=new ka({baseURL:e,responseType:"json"});return n.on("beforeInit",r=>{if(r.method?.toLowerCase()!=="post")return r;if(r.body===void 0||r.body===null)return r.body=void 0,r;const i=r.body=qe.normalizeBody(r.body),s=new URLSearchParams(r.query);return i.has("format")&&s.delete("format"),i.has("formatversion")&&s.delete("formatversion"),i.has("action")&&s.delete("action"),i.has("origin")&&(s.set("origin",""+i.get("origin")),i.delete("origin")),r.query=Object.fromEntries(s.entries()),r}),n.on("beforeInit",r=>(r.query=qe.normalizeBody(r.query)||{},r)),n.on("beforeRequest",r=>{const i=new URL(r.url),s=i.searchParams;if(globalThis.location&&(!s.has("origin")&&location.origin!==new URL(e).origin?(s.set("origin",location.origin),n.baseConfigs.credentials="include",n.baseConfigs.mode="cors"):location.origin===new URL(e).origin&&(s.delete("origin"),n.baseConfigs.credentials=void 0,n.baseConfigs.mode=void 0)),i.searchParams.has("origin")){const o=encodeURIComponent(i.searchParams.get("origin")||"").replace(/\./g,"%2E");r.query={},i.searchParams.delete("origin"),r.url=`${i}${i.search?"&":"?"}origin=${o}`}return r}),n}get(e,n){return this.request.get("",{...this.defaultOptions,query:{...this.defaultParams,...this.defaultOptions.query,...e},...n})}post(e,n){return this.request.post("",e,{...this.defaultOptions,query:{...this.defaultParams,...this.defaultOptions.query},...n})}async login(e,n,r,i){if(this.defaultOptions.credentials="include",i=i||{},i.retry??(i.retry=3),i.retry<1)throw new Sn("LOGIN_RETRY_LIMIT_EXCEEDED","The limit of the number of times to automatically re-login has been exceeded");let s;try{const o=await this.postWithToken("login",{action:"login",lgname:e,lgpassword:n,...r},{tokenName:"lgtoken",...i});if(o?.data?.login)s=o.data;else throw o}catch(o){if(o instanceof Sn)throw o;if(o?.ok===!1)return this.login(e,n,r,{...i,noCache:!0,retry:i.retry-1});throw new Sn("HTTP_ERROR","The server returns an error, but it doesn't seem to be caused by MediaWiki",o)}if(s?.login?.result!=="Success")throw new Sn("LOGIN_FAILED",s?.login?.reason?.text||s?.login?.result||"Login failed with unknown reason",s);return s.login}async getUserInfo(){const{data:e}=await this.get({action:"query",meta:"userinfo",uiprop:["groups","rights","blockinfo"]});return e?.query?.userinfo}async getTokens(e=["csrf"]){this.defaultOptions.credentials="include";const{data:n}=await this.get({action:"query",meta:"tokens",type:e});return this.tokens={...this.tokens,...n.query.tokens},this.tokens}async token(e="csrf",n=!1){return(!this.tokens[`${e}token`]||n)&&(delete this.tokens[`${e}token`],await this.getTokens([e])),this.tokens[`${e}token`]}async postWithToken(e,n,r){const{tokenName:i="token",retry:s=3,noCache:o=!1}=r||{};if(s<1)throw new Sn("TOKEN_RETRY_LIMIT_EXCEEDED","The limit of the number of times to automatically re-acquire the token has been exceeded");const a=await this.token(e,o),l=()=>this.postWithToken(e,n,{tokenName:i,retry:s-1,noCache:!0});return this.post({[i]:a,...n}).then(c=>{const u=c.data;return qe.isBadTokenError(u)?l():c}).catch(c=>{const u=c.data;if(qe.isBadTokenError(u)||c?.ok===!1)return l();if(typeof u=="object"&&u!==null)return Promise.reject(u);throw new Sn("HTTP_ERROR","The server returns an error, but it doesn’t seem to be caused by MediaWiki",c)})}postWithEditToken(e){return this.postWithToken("csrf",e)}async getMessages(e,n="zh",r){const{data:i}=await this.get({action:"query",meta:"allmessages",ammessages:e,amlang:n,...r}),s={};return i.query.allmessages.forEach(function(o){o.missing||(s[o.name]=o.content)}),s}async parseWikitext(e,n,r,i){const{data:s}=await this.post({action:"parse",title:n,text:e,...r},i);return s.parse.text}static extractResponseDataFromAny(e){return e?.response?.data||e?.data||e||void 0}static isMediaWikiApiError(e){const n=qe.extractResponseDataFromAny(e);return typeof n=="object"&&n!==null&&("error"in n||"errors"in n)}static extractMediaWikiErrors(e){const n=qe.extractResponseDataFromAny(e);if(typeof n!="object"||n===null)return[];const r=n?.error,i=n?.errors,s=[];return r&&s.push(r),Array.isArray(i)&&s.push(...i),s}static isBadTokenError(e){return qe.extractMediaWikiErrors(e).some(n=>n.code==="badtoken")||["NeedToken","WrongToken"].includes(e?.login?.result)}};$a.INIT_DEFAULT_PARAMS={action:"query",errorformat:"plaintext",format:"json",formatversion:2};let _d=$a,Sn=class extends Error{constructor(e,n="",r){super(),this.code=e,this.message=n,this.cause=r,this.name="WikiSaikouError"}};/**
|
|
42
42
|
* MediaWiki Api
|
|
43
43
|
* Provides the API call methods similar to `mw.Api` at non-mw environments
|
|
44
44
|
*
|
|
45
45
|
* @author Dragon-Fish <dragon-fish@qq.com>
|
|
46
46
|
* @license MIT
|
|
47
|
-
*/let Ca=class extends bd{};class _d{constructor(e,n){this.ctx=e;let r=typeof n?.baseURL=="string"?n.baseURL:n?.baseURL?.toString();r?.startsWith("/")&&(r=new URL(r,location.origin).href);const i=new Ca(r,{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`}});e.set("api",i)}}class wd extends an{constructor(e){super(e,"resourceLoader",!0),this.ctx=e}stop(){}loadScript(e,n){if(!e)return Promise.resolve(null);const r=`script:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("script");l.src=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([u,c])=>{typeof c>"u"||c===!1||c===null?l.removeAttribute(u):l.setAttribute(u,c)}),document.body.appendChild(l),l.onload=()=>o(l),l.onerror=u=>a(u)})}loadStyle(e,n){if(!e)return Promise.resolve(null);const r=`style:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("link");l.rel="stylesheet",l.href=e,l.dataset.ipe=r,n&&Object.entries(n).forEach(([c,f])=>{typeof f>"u"||f===!1||f===null?l.removeAttribute(c):l.setAttribute(c,f)}),(document.querySelector('meta[name="ipe-styles"]')||(()=>{const c=document.createElement("meta");return c.id="ipe-styles",c.name="ipe-styles",document.head.insertAdjacentElement("afterbegin",c),c})()).before(l),l.onload=()=>o(l),l.onerror=c=>a(c)})}resolveImportPath(e){if(e.startsWith("http")||e.startsWith("//"))return e;const n=document.currentScript?.src;if(!n)return`https://unpkg.com/mediawiki-inpageedit@latest/dist/${e}`;const r=new URL(n);return r.pathname.endsWith(".js")||(r.pathname=r.pathname+"/"),new URL(e,r.toString()).toString()}}const qr=Object.keys;function xd(t){return typeof t=="boolean"}function Sd(t){return t&&typeof t.nodeType=="number"}function Wr(t){return typeof t=="string"}function Pa(t){return typeof t=="number"}function ln(t){return typeof t=="object"?t!==null:er(t)}function er(t){return typeof t=="function"}function Ed(t){return!!(t&&t.isComponent)}function kd(t){return ln(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function hs(t,e){if(t)for(const n of qr(t))e(t[n],n)}function $d(t){return ln(t)&&"current"in t}const ps={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 Cd(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Pd=["Webkit","ms","Moz","O"];qr(ps).forEach(t=>{Pd.forEach(e=>{ps[Cd(e,t)]=0})});const Od=Symbol.for("jsx-dom:type");var Oa=function(t){return t.ShadowRoot="ShadowRoot",t}(Oa||{});function Id(t){return t!=null&&t[Od]===Oa.ShadowRoot}const Td="http://www.w3.org/2000/svg",Ad="http://www.w3.org/1999/xlink",Nd="http://www.w3.org/XML/1998/namespace";function Ia(t){return!xd(t)&&t!=null}function ms(t){return Array.isArray(t)?t.map(ms).filter(Boolean).join(" "):ln(t)?Symbol.iterator in t?ms(Array.from(t)):qr(t).filter(e=>t[e]).join(" "):Ia(t)?""+t:""}const Rd={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},Dd=/^(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 Rt(t){const e=document.createDocumentFragment();return Vr(t.children,e),e}function Ld(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&gs(e.ref,r),i}function _(t,e){let{children:n,...r}=e;!r.namespaceURI&&Rd[t]===0&&(r={...r,namespaceURI:Td});let i;if(Wr(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),Bd(r,i),Vr(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;gs(r.ref,i)}else if(er(t))ln(t.defaultProps)&&(r={...t.defaultProps,...r}),i=Ed(t)?Ld(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Md(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return(Wr(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),_(t,{...e,children:r},e.key)}function gs(t,e){$d(t)?t.current=e:er(t)&&t(e)}function Vr(t,e){if(kd(t))jd(t,e);else if(Wr(t)||Pa(t))vs(document.createTextNode(t),e);else if(t===null)vs(document.createComment(""),e);else if(Sd(t))vs(t,e);else if(Id(t)){const n=e.attachShadow(t.attr);Vr(t.children,n),gs(t.ref,n)}}function jd(t,e){for(const n of[...t])Vr(n,e);return e}function vs(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Kr(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function Ta(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>Ta(t,n)):Wr(e)?t.setAttribute("style",e):ln(e)&&hs(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):Pa(n)&&ps[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function Fd(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":Aa(n,Ad,Kr(t,":"),e);return;case"xmlnsXlink":xn(n,Kr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":Aa(n,Nd,Kr(t,":"),e);return}switch(t){case"htmlFor":xn(n,"for",e);return;case"dataset":hs(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":Ia(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":ln(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":er(e)?e(n):xn(n,"class",ms(e));return;case"ref":case"namespaceURI":return;case"style":Ta(n,e);return;case"on":case"onCapture":hs(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(er(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.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),n.addEventListener(s,e)}}}else ln(e)?n[t]=e:e===!0?xn(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!Dd.test(t)?xn(n,Kr(t,"-"),e):xn(n,t,e))}function xn(t,e,n){t.setAttribute(e,n)}function Aa(t,e,n,r){t.setAttributeNS(e,n,r)}function Bd(t,e){for(const n of qr(t))Fd(n,t[n],e);return e}var ys=(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))(ys||{});let Ud=0;const Na=t=>`${t}-${++Ud}`;function tr(t){return t instanceof Node?t:document.createTextNode(String(t))}function Dt(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function Ra(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(n=>!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length))}function We(t,e={}){const n=document.createElement(t);if(e.className&&(n.className=e.className),e.html!=null&&(n.innerHTML=e.html),e.text!=null&&(n.textContent=e.text),e.attrs)for(const[r,i]of Object.entries(e.attrs))n.setAttribute(r,i);return n}class zd{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(n=>n!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=i.size?i.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,n)=>e.setZIndex(this.zBase+n*2))}lockBodyScroll(){document.documentElement.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.documentElement.classList.remove("ipe-modal-no-scroll")}}const Xe=new zd;class bs{constructor(e={}){this.backdropId=Na("ipe-modal-backdrop"),this.modalId=Na("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=ys,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=n=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),n)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=n=>{if(!this.isDragging)return;n.preventDefault();const r=n.clientX-this.dragStartX,i=n.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+i;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 n=this.get$modal(),r=this.get$window();n.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 n;e&&(n=We("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=We("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,b=window.pageXOffset||document.documentElement.scrollLeft,I=window.innerWidth;r.style.top=`${y+60}px`,this.once("modal.show",()=>{r.style.left=`${b+I/2-r.offsetWidth/2}px`})}const i=We("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});i.modal=this;const s=We("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=We("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=We("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const y=We("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"×"});y.addEventListener("click",()=>{let b=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(b=!1):this.options.onClickClose===!1&&(b=!1),b&&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 u=We("div",{className:"ipe-modal-modal__content"}),c=We("div",{className:"ipe-modal-modal__footer"}),f=We("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),v=We("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return c.append(f,v),i.append(s,u,c),r.appendChild(i),this.$backdrop=n,this.$modal=r,this.$window=i,this.$header=s,this.$title=a,this.$icons=l,this.$content=u,this.$footer=c,this.$buttonsLeft=f,this.$buttonsRight=v,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):c.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"),n&&n.addEventListener("pointerdown",y=>{this.options.outSideClose&&y.target===n&&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),i=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!i)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&Xe.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),Xe.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,n=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),n&&(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=(u,c)=>{const f=()=>{u.removeEventListener(c,f),a()};u.addEventListener(c,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 n=!1;const r=()=>{n||(n=!0,this.destroy(),this.options.onClose?.(this))},i=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(i(this.$window,"transitionend"),i(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=cn.indexOf(this);e!==-1&&cn.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),Xe.remove(this),this.shouldUnlockBodyOnClose()&&Xe.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return Dt(this.$modal,"modal")}get$window(){return Dt(this.$window,"window")}get$header(){return Dt(this.$header,"header")}get$title(){return Dt(this.$title,"title")}get$content(){return Dt(this.$content,"content")}get$icons(){return Dt(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?Dt(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?Dt(this.$buttonsRight,"rightButtons"):Dt(this.$footer,"buttons")}setTitle(e){const n=this.get$title();return n.innerHTML="",n.append(tr(e)),this}setContent(e,n="replace"){const r=this.get$content();return n==="replace"?(r.innerHTML="",r.append(tr(e))):n==="append"?r.append(tr(e)):r.prepend(tr(e)),this}setIcons(e){const n=this.get$icons();n.innerHTML="";for(const r of e){const i=We("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});i.addEventListener("click",r.method),n.appendChild(i)}return this}setButtons(e,n){const r=this.$buttonsLeft,i=this.$buttonsRight;[r,i].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=n??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 n=e.type??"button",r=n==="link"?We("a"):We("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const i=tr(e.label??"OK");if(r.append(i),n==="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){n==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{n==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}return e.keyPress&&this.keyMap.set(String(e.keyPress).toLowerCase(),r),r}addButton(e,n){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",i=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(n??s.length,s.length));return a>=i.children.length?i.appendChild(o):i.insertBefore(o,i.children[a]),s.splice(a,0,o),this}removeButton(e){const n=this.buttonElsLeft,r=this.buttonElsRight,i=[...n,...r];let s=null;if(typeof e=="number"?s=i[e]??null:typeof e=="string"?s=i.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=i.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=n.indexOf(s);return o!==-1?(n.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),n.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,n="height"){const r=this.get$window(),i=Math.max(0,window.innerHeight-e);return r.style[n]=`${i}px`,i}setOptions(e,n){return typeof e=="string"?this.options[e]=n: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 n=this.get$modal(),r=this.get$window(),i=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?(n.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(n.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),i&&(!l||l===!1?i.style.transition="none":i.style.removeProperty("transition"))}on(e,n){return this._hooks.push({type:e,listener:n}),()=>this.off(e,n)}off(e,n){return this._hooks=this._hooks.filter(r=>r.type!==e&&(n?r.listener!==n:!0)),this}once(e,n){const r=this.on(e,i=>(r(),n(i)));return r}emit(e,n){const r=this._hooks.filter(l=>l.type===e);let i=!0;for(const l of r){const u=new CustomEvent(e,{detail:this,cancelable:n}),c=l.listener(u);if(u.defaultPrevented&&(i=!1),c===!1&&(i=!1),!i)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:n});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(i=!1),i}focusFirst(){const e=this.get$modal(),n=Ra(e);n.length?n[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(Xe.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const n=this.get$modal();if(!n.contains(document.activeElement))return;if(e.key==="Tab"){const i=Ra(n);if(!i.length)return;const s=i[0],o=i[i.length-1],a=document.activeElement;e.shiftKey&&a===s?(e.preventDefault(),o.focus()):!e.shiftKey&&a===o&&(e.preventDefault(),s.focus())}const r=this.keyMap.get(e.key.toLowerCase());r&&r.click()}setZIndex(e){this.$backdrop&&(this.$backdrop.style.zIndex=String(e)),this.$modal&&(this.$modal.style.zIndex=String(e+1))}bringToFront(){return Xe.remove(this),Xe.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:!Xe.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Xe.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.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 n=this.get$modal(),r=n.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,n.style.transform="none",n.style.left=`${this.modalStartX}px`,n.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),n.classList.add("is-dragging")}showToast(e){this.$window||this.init();const n=Hd(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),n.appendChild(r);const i=(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 i>0&&(this.startCloseTimer(i),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(i)))),this.isOpen=!0,this.options.onShow?.(this),cn.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,n){return new this(e).init().show()}static createObject(e,n){return new this(e)}static close(e){if(!e){const s=Xe.top();return s?.close(),s}const n=typeof e=="string"?e:e.id,r=Xe.stack.find(s=>s.modalId===n);if(r)return r.close(),r;const i=cn.find(s=>s.modalId===n);return i?.close(),i}static closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return Xe.closeAll(e,n),[...cn].forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),Xe.top()??new bs}static removeAll(){Xe.removeAll(),[...cn].forEach(e=>e.destroy())}static dialog(e,n){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary",method:(i,s)=>{n?.(i,s),i.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,n){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"},i=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"},s=new this({sizeClass:"dialog",...e,buttons:[{label:i.label,className:i.className,keyPress:"n",method:()=>s.close()},{label:r.label,className:r.className,keyPress:"y",method:o=>{n?.(o,s),o.defaultPrevented||s.close()}}]});return s.init().show()}static getDefaultNotifyIcon(e){switch(e){case"success":return _("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("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 _("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("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 _("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("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 _("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("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 _("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("path",{d:"M12 11v.01"}),_("path",{d:"M8 11v.01"}),_("path",{d:"M16 11v.01"}),_("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 _("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("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,n,r){var a,l,u,c;if(n?.overrideOther&&[...cn].forEach(f=>f.close()),typeof n.title>"u"){const f=e||"Notification";n.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const i=n.icon??this.getDefaultNotifyIcon(e);i&&(i instanceof Element&&i.classList.add("ipe-modal-notify-icon"),n.title=_(Rt,{children:[i,n.title]})),n.okBtn&&((a=n.okBtn).label??(a.label="OK"),(l=n.okBtn).className??(l.className="is-primary is-ghost ok-btn"),n.okBtn.method=()=>{r?.(!0),o.close()}),n.cancelBtn&&((u=n.cancelBtn).label??(u.label="Cancel"),(c=n.cancelBtn).className??(c.className="is-danger is-ghost cancel-btn"),n.cancelBtn.method=()=>{r?.(!1),o.close()}),n.buttons=[n.cancelBtn,n.okBtn,...n.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${n.className??""}`,o=new this({...n,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,animation:n.animation??{show:"fadeIn",hide:"fadeOut"},buttons:n.buttons??[]});return o.setPluginName("toast"),o.showToast({position:n.position??"top right"})}}const cn=[];function Hd(t="top right"){const e="ipe-modal-toast-container",n=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(n);return r||(r=We("div",{className:`${e} ${t}`,attrs:{id:n,"data-position":t}}),document.body.appendChild(r)),r}const qd={ipe_progress:"_ipe_progress_so6hn_1"},Vt=t=>{const e=t.indeterminate??!0,n=_("div",{class:`${qd.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return n.setProgress=r=>{typeof r=="number"?(n.dataset.indeterminate="false",n.style.setProperty("--progress",`${r}%`)):(n.dataset.indeterminate="true",n.style.setProperty("--progress","0%"))},n};class De extends bs{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 n=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=n,n.forEach(r=>{r.disabled=!0}),this.get$content().append(_("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:_(Vt,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const n=this._tmpDisabledActiveInputs;n&&n.forEach(r=>{r.disabled=!1})}}}class Wd{constructor(e){this.ctx=e,this.IPEModal=De,this.IPEModalEvent=ys,this.show=De.show.bind(De),this.createObject=De.createObject.bind(De),this.close=De.close.bind(De),this.closeAll=De.closeAll.bind(De),this.removeAll=De.removeAll.bind(De),this.dialog=De.dialog.bind(De),this.confirm=De.confirm.bind(De),this.notify=De.notify.bind(De),e.set("modal",this)}}var Vd=Object.create,_s=Object.defineProperty,Kd=Object.getOwnPropertyDescriptor,Da=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),La=t=>{throw TypeError(t)},Yd=(t,e,n)=>e in t?_s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Gd=(t,e)=>_s(t,"name",{value:e,configurable:!0}),Jd=t=>[,,,Vd(t?.[Da("metadata")]??null)],Qd=["class","method","getter","setter","accessor","field","value","get","set"],Ma=t=>t!==void 0&&typeof t!="function"?La("Function expected"):t,Xd=(t,e,n,r,i)=>({kind:Qd[t],name:e,metadata:r,addInitializer:s=>n._?La("Already initialized"):i.push(Ma(s||null))}),Zd=(t,e)=>Yd(e,Da("metadata"),t[3]),eh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},th=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Kd(i,n));Gd(i,n);for(var b=r.length-1;b>=0;b--)l=Xd(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,Ma(o)&&(i=o);return Zd(t,i),y&&_s(i,n,y),c?u^4?s:y:i},ja,ws,Fa;ja=[qe(["api","storage"])];class Yr extends(Fa=an){constructor(e){super(e,"sitemeta",!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:(n,r)=>window?.mw?.config?.get?.(n,r)??r,has:n=>window?.mw?.config?.exists?.(n)??!1,get values(){return window?.mw?.config?.values||{}}},this.db=e.storage.createDatabse("sitemeta",this.CACHE_TTL,this.VERSION),this.logger=e.logger("SiteMetadataService")}get api(){return this.ctx.api}async start(){const e=await this.fetchFromCache();if(e){this.logger.info("Using cached metadata",e),this._data=e;return}const n=await this.fetchFromApi();this.saveToCache(n),this._data=n}computeSiteIdentity(){let e;if(!window.mw?.config)e=new URL(location.href).origin;else{const{wgServer:n,wgArticlePath:r}=window.mw.config.get();e=`${n}${r}`}return Reflect.defineProperty(this,"computeSiteIdentity",{value:()=>e,writable:!1,configurable:!1,enumerable:!0}),e}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.ctx.logger.error("[InPageEdit]","fetchMetadata error",e),Promise.reject(e)))}async fetchFromCache(){const e=this.computeSiteIdentity(),n=this.mwConfig.get("wgUserId",0),r=await this.db.get(e);return r&&r.userinfo.id===n?r:(this.logger.info("UserID changed, invalidating cache"),this.invalidateCache(),null)}async saveToCache(e){const n=this.computeSiteIdentity();return this.db.set(n,e)}async invalidateCache(){const e=this.computeSiteIdentity();return this.db.delete(e)}get _raw(){return this._data}get siteInfo(){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(n=>({id:n.id,canonical:n.canonical,aliases:this.namespaceAliases.filter(r=>r.id===n.id).map(r=>r.alias)})).sort((n,r)=>n.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{value:e,writable:!1,configurable:!1,enumerable:!0}),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}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(n=>this.hasRight(n))}hasEveryRights(...e){return e.every(n=>this.hasRight(n))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(n=>e.includes(n))}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}}ws=Jd(Fa),Yr=th(ws,0,"SiteMetadataService",ja,Yr),eh(ws,1,Yr);var Gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function nh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Jr(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var xs={exports:{}};/*!
|
|
47
|
+
*/let xd=class extends _d{};class Sd{constructor(e,n={}){this.ctx=e,n?.baseURL?.startsWith("/")&&(n.baseURL=new URL(n.baseURL,location.origin).href);const r=new xd(n.baseURL,{headers:{"x-api-user-agent":`InPageEdit-NEXT ${e.version}`,...n.headers},...n});e.set("api",r)}}class Ed extends cn{constructor(e){super(e,"resourceLoader",!0),this.ctx=e}stop(){}loadScript(e,n){if(!e)return Promise.resolve(null);const r=`script:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("script");l.src=e,l.dataset.ipe=r,n&&Object.entries(n).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,n){if(!e)return Promise.resolve(null);const r=`style:${e}`,i=document.querySelector(`[data-ipe="${r}"]`);return i?Promise.resolve(i):new Promise((o,a)=>{const l=document.createElement("link");l.rel="stylesheet",l.href=e,l.dataset.ipe=r,n&&Object.entries(n).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 n=document.currentScript?.src;if(!n)return`https://unpkg.com/mediawiki-inpageedit@latest/dist/${e}`;const r=new URL(n);return r.pathname.endsWith(".js")||(r.pathname=r.pathname+"/"),new URL(e,r.toString()).toString()}}const Yr=Object.keys;function kd(t){return typeof t=="boolean"}function Pd(t){return t&&typeof t.nodeType=="number"}function Gr(t){return typeof t=="string"}function Ca(t){return typeof t=="number"}function un(t){return typeof t=="object"?t!==null:rr(t)}function rr(t){return typeof t=="function"}function $d(t){return!!(t&&t.isComponent)}function Cd(t){return un(t)&&typeof t.length=="number"&&typeof t.nodeType!="number"}function gs(t,e){if(t)for(const n of Yr(t))e(t[n],n)}function Od(t){return un(t)&&"current"in t}const vs={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 Td(t,e){return t+e.charAt(0).toUpperCase()+e.substring(1)}const Id=["Webkit","ms","Moz","O"];Yr(vs).forEach(t=>{Id.forEach(e=>{vs[Td(e,t)]=0})});const Ad=Symbol.for("jsx-dom:type");var Oa=function(t){return t.ShadowRoot="ShadowRoot",t}(Oa||{});function Nd(t){return t!=null&&t[Ad]===Oa.ShadowRoot}const Rd="http://www.w3.org/2000/svg",Dd="http://www.w3.org/1999/xlink",Ld="http://www.w3.org/XML/1998/namespace";function Ta(t){return!kd(t)&&t!=null}function ys(t){return Array.isArray(t)?t.map(ys).filter(Boolean).join(" "):un(t)?Symbol.iterator in t?ys(Array.from(t)):Yr(t).filter(e=>t[e]).join(" "):Ta(t)?""+t:""}const Md={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},jd=/^(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 Lt(t){const e=document.createDocumentFragment();return Qr(t.children,e),e}function Fd(t,e,n){e={...e,children:n};const r=new t(e),i=r.render();return"ref"in e&&bs(e.ref,r),i}function w(t,e){let{children:n,...r}=e;!r.namespaceURI&&Md[t]===0&&(r={...r,namespaceURI:Rd});let i;if(Gr(t)){if(i=r.namespaceURI?document.createElementNS(r.namespaceURI,t):document.createElement(t),zd(r,i),Qr(n,i),i instanceof window.HTMLSelectElement&&r.value!=null)if(r.multiple===!0&&Array.isArray(r.value)){const s=r.value.map(o=>String(o));i.querySelectorAll("option").forEach(o=>o.selected=s.includes(o.value))}else i.value=r.value;bs(r.ref,i)}else if(rr(t))un(t.defaultProps)&&(r={...t.defaultProps,...r}),i=$d(t)?Fd(t,r,n):t({...r,children:n});else throw new TypeError(`Invalid JSX element type: ${t}`);return i}function Bd(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return(Gr(e)||Array.isArray(e))&&(r.unshift(e),e={}),e=e||{},e.children!=null&&!r.length&&({children:r,...e}=e),w(t,{...e,children:r},e.key)}function bs(t,e){Od(t)?t.current=e:rr(t)&&t(e)}function Qr(t,e){if(Cd(t))Ud(t,e);else if(Gr(t)||Ca(t))ws(document.createTextNode(t),e);else if(t===null)ws(document.createComment(""),e);else if(Pd(t))ws(t,e);else if(Nd(t)){const n=e.attachShadow(t.attr);Qr(t.children,n),bs(t.ref,n)}}function Ud(t,e){for(const n of[...t])Qr(n,e);return e}function ws(t,e){e instanceof window.HTMLTemplateElement?e.content.appendChild(t):e.appendChild(t)}function Jr(t,e){return t.replace(/[A-Z]/g,n=>e+n.toLowerCase())}function Ia(t,e){e==null||e===!1||(Array.isArray(e)?e.forEach(n=>Ia(t,n)):Gr(e)?t.setAttribute("style",e):un(e)&&gs(e,(n,r)=>{r.indexOf("-")===0?t.style.setProperty(r,n):Ca(n)&&vs[r]!==0?t.style[r]=n+"px":t.style[r]=n}))}function qd(t,e,n){switch(t){case"xlinkActuate":case"xlinkArcrole":case"xlinkHref":case"xlinkRole":case"xlinkShow":case"xlinkTitle":case"xlinkType":Aa(n,Dd,Jr(t,":"),e);return;case"xmlnsXlink":En(n,Jr(t,":"),e);return;case"xmlBase":case"xmlLang":case"xmlSpace":Aa(n,Ld,Jr(t,":"),e);return}switch(t){case"htmlFor":En(n,"for",e);return;case"dataset":gs(e,(r,i)=>{r!=null&&(n.dataset[i]=r)});return;case"innerHTML":case"innerText":case"textContent":Ta(e)&&(n[t]=e);return;case"dangerouslySetInnerHTML":un(e)&&(n.innerHTML=e.__html);return;case"value":if(e==null||n instanceof window.HTMLSelectElement)return;if(n instanceof window.HTMLTextAreaElement){n.value=e;return}break;case"spellCheck":n.spellcheck=e;return;case"class":case"className":rr(e)?e(n):En(n,"class",ys(e));return;case"ref":case"namespaceURI":return;case"style":Ia(n,e);return;case"on":case"onCapture":gs(e,(r,i)=>{n.addEventListener(i,r,t==="onCapture")});return}if(rr(e)){if(t[0]==="o"&&t[1]==="n"){let r=t.toLowerCase();const i=r.endsWith("capture");if(r==="ondoubleclick"?r="ondblclick":i&&r==="ondoubleclickcapture"&&(r="ondblclickcapture"),!i&&n[r]===null)n[r]=e;else if(i)n.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),n.addEventListener(s,e)}}}else un(e)?n[t]=e:e===!0?En(n,t,""):e!==!1&&e!=null&&(n instanceof SVGElement&&!jd.test(t)?En(n,Jr(t,"-"),e):En(n,t,e))}function En(t,e,n){t.setAttribute(e,n)}function Aa(t,e,n,r){t.setAttributeNS(e,n,r)}function zd(t,e){for(const n of Yr(t))qd(n,t[n],e);return e}var _s=(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))(_s||{});let Hd=0;const Na=t=>`${t}-${++Hd}`;function ir(t){return t instanceof Node?t:document.createTextNode(String(t))}function Mt(t,e){if(!t)throw new Error(`${e??"Element"} not found`);return t}function Ra(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(n=>!!(n.offsetWidth||n.offsetHeight||n.getClientRects().length))}function Ke(t,e={}){const n=document.createElement(t);if(e.className&&(n.className=e.className),e.html!=null&&(n.innerHTML=e.html),e.text!=null&&(n.textContent=e.text),e.attrs)for(const[r,i]of Object.entries(e.attrs))n.setAttribute(r,i);return n}const Wd=typeof navigator<"u"&&/Mac|iPhone|iPad|iPod/i.test(navigator.platform),Da=["ctrl","alt","shift","meta"];function Kd(t){if(!t)return null;const e=String(t).trim().toLowerCase().split(/[+\-\s]+/g).filter(Boolean),n=[];let r=null;const i=o=>{n.includes(o)||n.push(o)};for(const o of e){let a=o;if(a==="control"||a==="ctrl"){i("ctrl");continue}if(a==="alt"||a==="option"){i("alt");continue}if(a==="shift"){i("shift");continue}if(a==="meta"||a==="cmd"||a==="command"||a==="super"){i("meta");continue}if(a==="mod"){i(Wd?"meta":"ctrl");continue}a==="esc"&&(a="escape"),a==="return"&&(a="enter"),(a==="space"||a==="spacebar")&&(a="space"),r=a}const s=Da.filter(o=>n.includes(o));return!r||r===""?s.length?s.join("+"):null:s.length?`${s.join("+")}+${r}`:r}function Vd(t){const e=[];t.ctrlKey&&e.push("ctrl"),t.altKey&&e.push("alt"),t.shiftKey&&e.push("shift"),t.metaKey&&e.push("meta");let n=t.key;n===" "&&(n="space");const r=(n.length===1,n.toLowerCase()),i=Da.filter(s=>e.includes(s));return i.length?`${i.join("+")}+${r}`:r}class Yd{constructor(){this.zBase=1e3,this.stack=[]}push(e){this.stack.push(e),this.syncZ()}remove(e){this.stack=this.stack.filter(n=>n!==e),this.syncZ()}top(){return this.stack[this.stack.length-1]}closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));[...this.stack].reverse().forEach(s=>{const o=s.modalId,a=i.size?i.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,n)=>e.setZIndex(this.zBase+n*2))}lockBodyScroll(){document.body.classList.add("ipe-modal-no-scroll")}unlockBodyScroll(){document.body.classList.remove("ipe-modal-no-scroll")}}const Ze=new Yd;class xs{constructor(e={}){this.backdropId=Na("ipe-modal-backdrop"),this.modalId=Na("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=_s,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=n=>{this.stopCloseTimer(),this.closeTimer=window.setTimeout(()=>this.close(),n)},this.stopCloseTimer=()=>{this.closeTimer&&window.clearTimeout(this.closeTimer),this.closeTimer=void 0},this.onDragMove=n=>{if(!this.isDragging)return;n.preventDefault();const r=n.clientX-this.dragStartX,i=n.clientY-this.dragStartY,s=this.get$modal(),o=this.modalStartX+r,a=this.modalStartY+i;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 n=this.get$modal(),r=this.get$window();n.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 n;e&&(n=Ke("div",{className:"ipe-modal-backdrop",attrs:{id:this.backdropId,"data-modal-id":this.modalId}}));const r=Ke("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,b=window.pageXOffset||document.documentElement.scrollLeft,I=window.innerWidth;r.style.top=`${y+60}px`,this.once("modal.show",()=>{r.style.left=`${b+I/2-r.offsetWidth/2}px`})}const i=Ke("div",{className:`ipe-modal-modal__window size--${this.options.sizeClass||"auto"} plugin--${this.pluginName}`});i.modal=this;const s=Ke("div",{className:"ipe-modal-modal__header"}),o=`${this.modalId}-title`,a=Ke("h2",{className:"ipe-modal-modal__title",attrs:{id:o,role:"heading","aria-level":"2"}});r.setAttribute("aria-labelledby",o);const l=Ke("div",{className:"ipe-modal-modal__icons"});if(this.options.closeIcon){const y=Ke("button",{className:"ipe-modal-modal__close",attrs:{type:"button","aria-label":"Close"},html:"×"});y.addEventListener("click",()=>{let b=!0;typeof this.options.onClickClose=="function"?this.options.onClickClose(this)===!1&&(b=!1):this.options.onClickClose===!1&&(b=!1),b&&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=Ke("div",{className:"ipe-modal-modal__content"}),u=Ke("div",{className:"ipe-modal-modal__footer"}),f=Ke("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--left"}),m=Ke("div",{className:"ipe-modal-modal__buttons ipe-modal-modal__buttons--right"});return u.append(f,m),i.append(s,c,u),r.appendChild(i),this.$backdrop=n,this.$modal=r,this.$window=i,this.$header=s,this.$title=a,this.$icons=l,this.$content=c,this.$footer=u,this.$buttonsLeft=f,this.$buttonsRight=m,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"),n&&n.addEventListener("pointerdown",y=>{this.options.outSideClose&&y.target===n&&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),i=this.options.beforeShow?this.options.beforeShow(this)!==!1:!0;if(!r||!i)return this}this.lastFocused=document.activeElement??null,this.$backdrop&&document.body.appendChild(this.$backdrop),document.body.appendChild(this.$modal),this.shouldLockBodyOnOpen()&&Ze.lockBodyScroll(),requestAnimationFrame(()=>{this.$backdrop?.classList.add("is-open"),this.$modal.classList.add("is-open"),this.applyAnimation(!0),this.focusFirst()}),document.addEventListener("keydown",this.onKeyDown),Ze.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,n=typeof this.options.closeAfter=="number"?!0:this.options.closeAfter?.resetOnHover;return e&&(this.startCloseTimer(e),n&&(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 n=!1;const r=()=>{n||(n=!0,this.destroy(),this.options.onClose?.(this))},i=(s,o)=>{const a=()=>{s.removeEventListener(o,a),r()};s.addEventListener(o,a,{once:!0})};return e>0&&this.$window?(i(this.$window,"transitionend"),i(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=fn.indexOf(this);e!==-1&&fn.splice(e,1)}else this.$backdrop?.parentElement&&this.$backdrop.parentElement.removeChild(this.$backdrop),this.$modal?.parentElement&&this.$modal.parentElement.removeChild(this.$modal),Ze.remove(this),this.shouldUnlockBodyOnClose()&&Ze.unlockBodyScroll();return this.isOpen=!1,this.lastFocused?.focus?.(),this.emit("modal.destroy"),this._isDestroyed=!0,this}get$backdrop(){return this.$backdrop}get$modal(){return Mt(this.$modal,"modal")}get$window(){return Mt(this.$window,"window")}get$header(){return Mt(this.$header,"header")}get$title(){return Mt(this.$title,"title")}get$content(){return Mt(this.$content,"content")}get$icons(){return Mt(this.$icons,"icons")}get$buttons(e){return e==="leftButtons"?Mt(this.$buttonsLeft,"leftButtons"):e==="rightButtons"?Mt(this.$buttonsRight,"rightButtons"):Mt(this.$footer,"buttons")}setTitle(e){const n=this.get$title();return n.innerHTML="",n.append(ir(e)),this}setContent(e,n="replace"){const r=this.get$content();return n==="replace"?(r.innerHTML="",r.append(ir(e))):n==="append"?r.append(ir(e)):r.prepend(ir(e)),this}setIcons(e){const n=this.get$icons();n.innerHTML="";for(const r of e){const i=Ke("button",{className:`ipe-modal-modal__icon ${r.className}`,attrs:{type:"button"}});i.addEventListener("click",r.method),n.appendChild(i)}return this}setButtons(e,n){const r=this.$buttonsLeft,i=this.$buttonsRight;[r,i].forEach(o=>o.innerHTML=""),this.buttonElsLeft=[],this.buttonElsRight=[],this.keyMap.clear();const s=n??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 n=e.type??"button",r=n==="link"?Ke("a"):Ke("button",{attrs:{type:"button"}});e.id&&(r.id=e.id),r.className=`ipe-modal-btn ${e.className??""}`.trim();const i=ir(e.label??"OK");if(r.append(i),n==="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){n==="button"&&r.setAttribute("disabled","true"),r._ipe_tmpDisabled=!0,r.setAttribute("aria-disabled","true");const s=()=>{n==="button"&&r.removeAttribute("disabled"),delete r._ipe_tmpDisabled,r.removeAttribute("aria-disabled")};window.setTimeout(s,e.enableAfter)}if(e.keyPress){const o=String(e.keyPress).split(/[\,\|]+/g).map(a=>a.trim()).filter(Boolean);for(const a of o){const l=Kd(a);l&&this.keyMap.set(l,r)}}return r}addButton(e,n){this.$footer&&(this.$footer.style.display="");const r=e.side??"right",i=r==="left"?this.$buttonsLeft:this.$buttonsRight,s=r==="left"?this.buttonElsLeft:this.buttonElsRight,o=this.generateButton(e),a=Math.max(0,Math.min(n??s.length,s.length));return a>=i.children.length?i.appendChild(o):i.insertBefore(o,i.children[a]),s.splice(a,0,o),this}removeButton(e){const n=this.buttonElsLeft,r=this.buttonElsRight,i=[...n,...r];let s=null;if(e==="*")return i.forEach(a=>{this.keyMap.delete(a.id),a.parentElement?.removeChild(a)}),this.$footer&&(this.$footer.style.display="none"),this;if(typeof e=="number"?s=i[e]??null:typeof e=="string"?s=i.find(a=>a.id===e)??null:e instanceof HTMLElement&&(s=i.find(a=>a===e)??null),!s)return this;for(const[a,l]of this.keyMap.entries())l===s&&this.keyMap.delete(a);let o=n.indexOf(s);return o!==-1?(n.splice(o,1),s.parentElement?.removeChild(s)):(o=r.indexOf(s),o!==-1&&(r.splice(o,1),s.parentElement?.removeChild(s))),n.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,n="height"){const r=this.get$window(),i=Math.max(0,window.innerHeight-e);return r.style[n]=`${i}px`,i}setOptions(e,n){return typeof e=="string"?this.options[e]=n: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 n=this.get$modal(),r=this.get$window(),i=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?(n.style.transition="none",r.style.animation="none",r.style.removeProperty("--ipe-modal-anim")):(n.style.removeProperty("transition"),r.style.setProperty("--ipe-modal-anim",o)),i&&(!l||l===!1?i.style.transition="none":i.style.removeProperty("transition"))}on(e,n){return this._hooks.push({type:e,listener:n}),()=>this.off(e,n)}off(e,n){return this._hooks=this._hooks.filter(r=>r.type!==e&&(n?r.listener!==n:!0)),this}once(e,n){const r=this.on(e,i=>(r(),n(i)));return r}emit(e,n){const r=this._hooks.filter(l=>l.type===e);let i=!0;for(const l of r){const c=new CustomEvent(e,{detail:this,cancelable:n}),u=l.listener(c);if(c.defaultPrevented&&(i=!1),u===!1&&(i=!1),!i)break}const s=this.$modal??document.body,o=new CustomEvent(e,{detail:this,cancelable:n});return(!s.dispatchEvent(o)||o.defaultPrevented)&&(i=!1),i}focusFirst(){const e=this.get$modal(),n=Ra(e);n.length?n[0].focus():e.focus({preventScroll:!0})}onKeyDown(e){if(Ze.top()!==this)return;if(e.key==="Escape"){e.preventDefault(),this.close();return}const n=this.get$modal();if(!n.contains(document.activeElement))return;if(e.key==="Tab"){const a=Ra(n);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,i=e.target;if(!r&&(i&&["INPUT","TEXTAREA"].includes(i.tagName)||i.contentEditable==="true"))return;const s=Vd(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 Ze.remove(this),Ze.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:!Ze.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.options.bodyScroll===!1)}shouldUnlockBodyOnClose(){return this.options.backdrop===!1||this.options.bodyScroll!==!1?!1:!Ze.stack.some(n=>n!==this&&n.options.backdrop!==!1&&n.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 n=this.get$modal(),r=n.getBoundingClientRect();this.modalStartX=r.left+window.pageXOffset,this.modalStartY=r.top+window.pageYOffset,n.style.transform="none",n.style.left=`${this.modalStartX}px`,n.style.top=`${this.modalStartY}px`,document.addEventListener("pointermove",this.onDragMove),document.addEventListener("pointerup",this.onDragEnd),n.classList.add("is-dragging")}showToast(e){this.$window||this.init();const n=Gd(e.position??"top right"),r=this.get$window();this.isToast=!0,r.style.pointerEvents="auto",this.applyAnimation(!0),n.appendChild(r);const i=(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 i>0&&(this.startCloseTimer(i),s&&(r.addEventListener("mouseenter",this.stopCloseTimer),r.addEventListener("mouseleave",()=>this.startCloseTimer(i)))),this.isOpen=!0,this.options.onShow?.(this),fn.push(this),this.emit("toast.show"),this.emit("modal.show"),this}static show(e,n){return new this(e).init().show()}static createObject(e,n){return new this(e)}static close(e){if(!e){const s=Ze.top();return s?.close(),s}const n=typeof e=="string"?e:e.id,r=Ze.stack.find(s=>s.modalId===n);if(r)return r.close(),r;const i=fn.find(s=>s.modalId===n);return i?.close(),i}static closeAll(e,n){const r=new Set((Array.isArray(n)?n:n?[n]:[]).map(String)),i=new Set((Array.isArray(e)?e:e?[e]:[]).map(String));return Ze.closeAll(e,n),[...fn].forEach(s=>{const o=s.modalId,a=i.size?i.has(s.pluginName):!0,l=r.has(o);a&&!l&&s.close()}),Ze.top()??new xs}static removeAll(){Ze.removeAll(),[...fn].forEach(e=>e.destroy())}static dialog(e,n){const r=new this({sizeClass:"dialog",buttons:[{label:"OK",className:"is-primary",method:(i,s)=>{n?.(i,s),i.defaultPrevented||r.close()},keyPress:"Enter"}],...e});return r.init().show()}static confirm(e,n){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"},i=e.cancelBtn??{label:"Cancel",className:"is-danger is-ghost"},s=new this({sizeClass:"dialog",...e,buttons:[{label:i.label,className:i.className,keyPress:"n",method:()=>s.close()},{label:r.label,className:r.className,keyPress:"y",method:o=>{n?.(o,s),o.defaultPrevented||s.close()}}]});return s.init().show()}static getDefaultNotifyIcon(e){switch(e){case"success":return w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("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 w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("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 w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("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 w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("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 w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 11v.01"}),w("path",{d:"M8 11v.01"}),w("path",{d:"M16 11v.01"}),w("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 w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("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,n,r){var a,l,c,u;if(n?.overrideOther&&[...fn].forEach(f=>f.close()),typeof n.title>"u"){const f=e||"Notification";n.title=f[0].toUpperCase()+f.slice(1).toLowerCase()}const i=n.icon??this.getDefaultNotifyIcon(e);i&&(i instanceof Element&&i.classList.add("ipe-modal-notify-icon"),n.title=w(Lt,{children:[i,n.title]})),n.okBtn&&((a=n.okBtn).label??(a.label="OK"),(l=n.okBtn).className??(l.className="is-primary is-ghost ok-btn"),n.okBtn.method=()=>{r?.(!0),o.close()}),n.cancelBtn&&((c=n.cancelBtn).label??(c.label="Cancel"),(u=n.cancelBtn).className??(u.className="is-danger is-ghost cancel-btn"),n.cancelBtn.method=()=>{r?.(!1),o.close()}),n.buttons=[n.cancelBtn,n.okBtn,...n.buttons??[]].filter(Boolean);const s=`is-notify type-${e||"default"} ${n.className??""}`,o=new this({...n,className:s,sizeClass:"auto",center:!1,fitScreen:!1,closeIcon:!0,outSideClose:!1,bodyScroll:!0,animation:n.animation??{show:"fadeIn",hide:"fadeOut"},buttons:n.buttons??[]});return o.setPluginName("toast"),o.showToast({position:n.position??"top right"})}}const fn=[];function Gd(t="top right"){const e="ipe-modal-toast-container",n=`${e}-${t.replace(/[\s-\.|\/]+/g,"-")}`;let r=document.getElementById(n);return r||(r=Ke("div",{className:`${e} ${t}`,attrs:{id:n,"data-position":t}}),document.body.appendChild(r)),r}const Qd={ipe_progress:"_ipe_progress_so6hn_1"},Yt=t=>{const e=t.indeterminate??!0,n=w("div",{class:`${Qd.ipe_progress}`,"data-indeterminate":`${e}`,style:{width:"100%","--progress":t.progress?`${t.progress}%`:"0%"},...t});return n.setProgress=r=>{typeof r=="number"?(n.dataset.indeterminate="false",n.style.setProperty("--progress",`${r}%`)):(n.dataset.indeterminate="true",n.style.setProperty("--progress","0%"))},n};class Le extends xs{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 n=this.get$window().querySelectorAll("input:not([disabled]),button:not([disabled])");this._tmpDisabledActiveInputs=n,n.forEach(r=>{r.disabled=!0}),this.get$content().append(w("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:w(Yt,{style:{width:"80%",maxWidth:"800px"}})}))}else{this.get$window().querySelector("#ipe-modalLoadingWrapper")?.remove();const n=this._tmpDisabledActiveInputs;n&&n.forEach(r=>{r.disabled=!1})}}}class Jd{constructor(e){this.ctx=e,this.IPEModal=Le,this.IPEModalEvent=_s,this.show=Le.show.bind(Le),this.createObject=Le.createObject.bind(Le),this.close=Le.close.bind(Le),this.closeAll=Le.closeAll.bind(Le),this.removeAll=Le.removeAll.bind(Le),this.dialog=Le.dialog.bind(Le),this.confirm=Le.confirm.bind(Le),this.notify=Le.notify.bind(Le),e.set("modal",this)}}const La=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[n,r]of Object.entries(t))if(r!=null){if(Array.isArray(r)){for(const i of r)e.append(n,i?.toString());continue}if(typeof r=="object"&&r!==null&&r.constructor===Object){for(const[i,s]of Object.entries(r))s!=null&&e.set(`${n}[${i}]`,s?.toString());continue}e.set(n,r?.toString())}return e},Ma=(t,e,n)=>{const r=typeof t=="string"?new URL(t,window?.location?.origin):new URL(t),i=new URLSearchParams(r.search),s=La(e);for(const[o,a]of s.entries())i.set(o,a);return r.search=i.toString(),r.hash="",r};var Xd=Object.create,Ss=Object.defineProperty,Zd=Object.getOwnPropertyDescriptor,ja=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Fa=t=>{throw TypeError(t)},eh=(t,e,n)=>e in t?Ss(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,th=(t,e)=>Ss(t,"name",{value:e,configurable:!0}),nh=t=>[,,,Xd(t?.[ja("metadata")]??null)],rh=["class","method","getter","setter","accessor","field","value","get","set"],Ba=t=>t!==void 0&&typeof t!="function"?Fa("Function expected"):t,ih=(t,e,n,r,i)=>({kind:rh[t],name:e,metadata:r,addInitializer:s=>n._?Fa("Already initialized"):i.push(Ba(s||null))}),sh=(t,e)=>eh(e,ja("metadata"),t[3]),oh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},ah=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&Zd(i,n));th(i,n);for(var b=r.length-1;b>=0;b--)l=ih(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,Ba(o)&&(i=o);return sh(t,i),y&&Ss(i,n,y),u?c^4?s:y:i},Ua,Es,qa;Ua=[We(["api","storage"])];class Xr extends(qa=cn){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:(n,r)=>window?.mw?.config?.get?.(n,r)??r,has:n=>window?.mw?.config?.exists?.(n)??!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 n=await this.fetchFromApi();this.saveToCache(n),this._data=n,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"],n=>{n.preferences.registerCustomConfig("WikiMetadataService",fe.object({WikiMetadataService:fe.const(w("div",{children:[w("h3",{children:"Wiki Informations"}),w("ul",{children:[w("li",{children:[w("strong",{children:"Site:"})," ",this.general.sitename," (",this.landingPageUrl,")"]}),w("li",{children:[w("strong",{children:"User"}),": ",this.userInfo.name," (ID: ",this.userInfo.id,")"]}),w("li",{children:[w("strong",{children:"Groups"}),": ",this.userGroups.join(", ")||"None"]})]}),w("p",{children:w("button",{onClick:r=>{r.preventDefault(),this.invalidateCache().then(()=>{window.location.reload()})},children:"Clear caches and reload page"})})]})).role("raw-html")}).description("WikiMetadataService"),"general",{})})}computeSiteIdentity(){let e;if(!window.mw?.config)e=new URL(location.href).origin;else{const{wgServer:n,wgArticlePath:r}=window.mw.config.get();e=`${n}${r}`}return Reflect.defineProperty(this,"computeSiteIdentity",{value:()=>e,writable:!1,configurable:!1,enumerable:!0}),e}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.computeSiteIdentity(),n=this.mwConfig.get("wgUserId",0),r=await this.db.get(e);return r&&typeof r=="object"&&r.general&&r.userinfo.id===n?r:(this.logger.info(r?"Cache mis-match":"Missing cache"),this.invalidateCache(),null)}async saveToCache(e){const n=this.computeSiteIdentity();return this.db.set(n,e)}async invalidateCache(){const e=this.computeSiteIdentity();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(n=>({id:n.id,canonical:n.canonical,aliases:this.namespaceAliases.filter(r=>r.id===n.id).map(r=>r.alias)})).sort((n,r)=>n.id-r.id);return Reflect.defineProperty(this,"namespaceMap",{value:e,writable:!1,configurable:!1,enumerable:!0}),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 Ma(this._data.general.base,e).toString()}getUrl(e,n){const r=La(n);let i;return typeof e=="string"&&e!==""?i=new URL(`${this.articleBaseUrl.replace("$1",e)}`):typeof e=="number"?(r.set("curid",e.toString()),i=new URL(this.getSciprtUrl("index"))):i=new URL(this.getSciprtUrl("index")),i.search=r.toString(),i.toString()}hasRight(e){return this.userRights.includes(e)}hasAnyRight(...e){return e.some(n=>this.hasRight(n))}hasEveryRights(...e){return e.every(n=>this.hasRight(n))}inGroup(e){return this.userGroups.includes(e)}inAnyGroup(...e){return this.userGroups.some(n=>e.includes(n))}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}}Es=nh(qa),Xr=ah(Es,0,"WikiMetadataService",Ua,Xr),oh(Es,1,Xr);var Zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function lh(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function ei(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ks={exports:{}};/*!
|
|
48
48
|
localForage -- Offline Storage, Improved
|
|
49
49
|
Version 1.10.0
|
|
50
50
|
https://localforage.github.io/localForage
|
|
51
51
|
(c) 2013-2017 Mozilla, Apache License 2.0
|
|
52
|
-
*/var Ba;function rh(){return Ba||(Ba=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(u,c){if(!i[u]){if(!r[u]){var f=typeof Jr=="function"&&Jr;if(!c&&f)return f(u,!0);if(a)return a(u,!0);var v=new Error("Cannot find module '"+u+"'");throw v.code="MODULE_NOT_FOUND",v}var y=i[u]={exports:{}};r[u][0].call(y.exports,function(b){var I=r[u][1][b];return o(I||b)},y,y.exports,n,r,i,s)}return i[u].exports}for(var a=typeof Jr=="function"&&Jr,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var l=0,u=new o(b),c=s.document.createTextNode("");u.observe(c,{characterData:!0}),a=function(){c.data=l=++l%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var U=s.document.createElement("script");U.onreadystatechange=function(){b(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},s.document.documentElement.appendChild(U)}:a=function(){setTimeout(b,0)};var v,y=[];function b(){v=!0;for(var U,D,T=y.length;T;){for(D=y,y=[],U=-1;++U<T;)D[U]();T=y.length}v=!1}r.exports=I;function I(U){y.push(U)===1&&!v&&a()}}).call(this,typeof Gr<"u"?Gr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var s=n(1);function o(){}var a={},l=["REJECTED"],u=["FULFILLED"],c=["PENDING"];r.exports=f;function f(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,h!==o&&I(this,h)}f.prototype.catch=function(h){return this.then(null,h)},f.prototype.then=function(h,S){if(typeof h!="function"&&this.state===u||typeof S!="function"&&this.state===l)return this;var O=new this.constructor(o);if(this.state!==c){var N=this.state===u?h:S;y(O,N,this.outcome)}else this.queue.push(new v(O,h,S));return O};function v(h,S,O){this.promise=h,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof O=="function"&&(this.onRejected=O,this.callRejected=this.otherCallRejected)}v.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},v.prototype.otherCallFulfilled=function(h){y(this.promise,this.onFulfilled,h)},v.prototype.callRejected=function(h){a.reject(this.promise,h)},v.prototype.otherCallRejected=function(h){y(this.promise,this.onRejected,h)};function y(h,S,O){s(function(){var N;try{N=S(O)}catch(q){return a.reject(h,q)}N===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,N)})}a.resolve=function(h,S){var O=U(b,S);if(O.status==="error")return a.reject(h,O.value);var N=O.value;if(N)I(h,N);else{h.state=u,h.outcome=S;for(var q=-1,X=h.queue.length;++q<X;)h.queue[q].callFulfilled(S)}return h},a.reject=function(h,S){h.state=l,h.outcome=S;for(var O=-1,N=h.queue.length;++O<N;)h.queue[O].callRejected(S);return h};function b(h){var S=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof S=="function")return function(){S.apply(h,arguments)}}function I(h,S){var O=!1;function N(Ae){O||(O=!0,a.reject(h,Ae))}function q(Ae){O||(O=!0,a.resolve(h,Ae))}function X(){S(q,N)}var Ce=U(X);Ce.status==="error"&&N(Ce.value)}function U(h,S){var O={};try{O.value=h(S),O.status="success"}catch(N){O.status="error",O.value=N}return O}f.resolve=D;function D(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=T;function T(h){var S=new this(o);return a.reject(S,h)}f.all=g;function g(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var O=h.length,N=!1;if(!O)return this.resolve([]);for(var q=new Array(O),X=0,Ce=-1,Ae=new this(o);++Ce<O;)tt(h[Ce],Ce);return Ae;function tt(zt,yn){S.resolve(zt).then(Ne,function(me){N||(N=!0,a.reject(Ae,me))});function Ne(me){q[yn]=me,++X===O&&!N&&(N=!0,a.resolve(Ae,q))}}}f.race=p;function p(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var O=h.length,N=!1;if(!O)return this.resolve([]);for(var q=-1,X=new this(o);++q<O;)Ce(h[q]);return X;function Ce(Ae){S.resolve(Ae).then(function(tt){N||(N=!0,a.resolve(X,tt))},function(tt){N||(N=!0,a.reject(X,tt))})}}},{1:1}],3:[function(n,r,i){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof Gr<"u"?Gr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function o(d,x){if(!(d instanceof x))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=a();function u(){try{if(!l||!l.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),x=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||x)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function c(d,x){d=d||[],x=x||{};try{return new Blob(d,x)}catch(E){if(E.name!=="TypeError")throw E;for(var m=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,C=new m,P=0;P<d.length;P+=1)C.append(d[P]);return C.getBlob(x.type)}}typeof Promise>"u"&&n(3);var f=Promise;function v(d,x){x&&d.then(function(m){x(null,m)},function(m){x(m)})}function y(d,x,m){typeof x=="function"&&d.then(x),typeof m=="function"&&d.catch(m)}function b(d){return typeof d!="string"&&(d=String(d)),d}function I(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var U="local-forage-detect-blob-support",D=void 0,T={},g=Object.prototype.toString,p="readonly",h="readwrite";function S(d){for(var x=d.length,m=new ArrayBuffer(x),C=new Uint8Array(m),P=0;P<x;P++)C[P]=d.charCodeAt(P);return m}function O(d){return new f(function(x){var m=d.transaction(U,h),C=c([""]);m.objectStore(U).put(C,"key"),m.onabort=function(P){P.preventDefault(),P.stopPropagation(),x(!1)},m.oncomplete=function(){var P=navigator.userAgent.match(/Chrome\/(\d+)/),E=navigator.userAgent.match(/Edge\//);x(E||!P||parseInt(P[1],10)>=43)}}).catch(function(){return!1})}function N(d){return typeof D=="boolean"?f.resolve(D):O(d).then(function(x){return D=x,D})}function q(d){var x=T[d.name],m={};m.promise=new f(function(C,P){m.resolve=C,m.reject=P}),x.deferredOperations.push(m),x.dbReady?x.dbReady=x.dbReady.then(function(){return m.promise}):x.dbReady=m.promise}function X(d){var x=T[d.name],m=x.deferredOperations.pop();if(m)return m.resolve(),m.promise}function Ce(d,x){var m=T[d.name],C=m.deferredOperations.pop();if(C)return C.reject(x),C.promise}function Ae(d,x){return new f(function(m,C){if(T[d.name]=T[d.name]||at(),d.db)if(x)q(d),d.db.close();else return m(d.db);var P=[d.name];x&&P.push(d.version);var E=l.open.apply(l,P);x&&(E.onupgradeneeded=function(R){var F=E.result;try{F.createObjectStore(d.storeName),R.oldVersion<=1&&F.createObjectStore(U)}catch(z){if(z.name!=="ConstraintError")throw z}}),E.onerror=function(R){R.preventDefault(),C(E.error)},E.onsuccess=function(){var R=E.result;R.onversionchange=function(F){F.target.close()},m(R),X(d)}})}function tt(d){return Ae(d,!1)}function zt(d){return Ae(d,!0)}function yn(d,x){if(!d.db)return!0;var m=!d.db.objectStoreNames.contains(d.storeName),C=d.version<d.db.version,P=d.version>d.db.version;if(C&&(d.version,d.version=d.db.version),P||m){if(m){var E=d.db.version+1;E>d.version&&(d.version=E)}return!0}return!1}function Ne(d){return new f(function(x,m){var C=new FileReader;C.onerror=m,C.onloadend=function(P){var E=btoa(P.target.result||"");x({__local_forage_encoded_blob:!0,data:E,type:d.type})},C.readAsBinaryString(d)})}function me(d){var x=S(atob(d.data));return c([x],{type:d.type})}function ye(d){return d&&d.__local_forage_encoded_blob}function Ht(d){var x=this,m=x._initReady().then(function(){var C=T[x._dbInfo.name];if(C&&C.dbReady)return C.dbReady});return y(m,d,d),m}function Wn(d){q(d);for(var x=T[d.name],m=x.forages,C=0;C<m.length;C++){var P=m[C];P._dbInfo.db&&(P._dbInfo.db.close(),P._dbInfo.db=null)}return d.db=null,tt(d).then(function(E){return d.db=E,yn(d)?zt(d):E}).then(function(E){d.db=x.db=E;for(var R=0;R<m.length;R++)m[R]._dbInfo.db=E}).catch(function(E){throw Ce(d,E),E})}function je(d,x,m,C){C===void 0&&(C=1);try{var P=d.db.transaction(d.storeName,x);m(null,P)}catch(E){if(C>0&&(!d.db||E.name==="InvalidStateError"||E.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||E.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),zt(d)}).then(function(){return Wn(d).then(function(){je(d,x,m,C-1)})}).catch(m);m(E)}}function at(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Gi(d){var x=this,m={db:null};if(d)for(var C in d)m[C]=d[C];var P=T[m.name];P||(P=at(),T[m.name]=P),P.forages.push(x),x._initReady||(x._initReady=x.ready,x.ready=Ht);var E=[];function R(){return f.resolve()}for(var F=0;F<P.forages.length;F++){var z=P.forages[F];z!==x&&E.push(z._initReady().catch(R))}var H=P.forages.slice(0);return f.all(E).then(function(){return m.db=P.db,tt(m)}).then(function(V){return m.db=V,yn(m,x._defaultConfig.version)?zt(m):V}).then(function(V){m.db=P.db=V,x._dbInfo=m;for(var Q=0;Q<H.length;Q++){var ae=H[Q];ae!==x&&(ae._dbInfo.db=m.db,ae._dbInfo.version=m.version)}})}function Xo(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){je(m._dbInfo,p,function(R,F){if(R)return E(R);try{var z=F.objectStore(m._dbInfo.storeName),H=z.get(d);H.onsuccess=function(){var V=H.result;V===void 0&&(V=null),ye(V)&&(V=me(V)),P(V)},H.onerror=function(){E(H.error)}}catch(V){E(V)}})}).catch(E)});return v(C,x),C}function Zo(d,x){var m=this,C=new f(function(P,E){m.ready().then(function(){je(m._dbInfo,p,function(R,F){if(R)return E(R);try{var z=F.objectStore(m._dbInfo.storeName),H=z.openCursor(),V=1;H.onsuccess=function(){var Q=H.result;if(Q){var ae=Q.value;ye(ae)&&(ae=me(ae));var ge=d(ae,Q.key,V++);ge!==void 0?P(ge):Q.continue()}else P()},H.onerror=function(){E(H.error)}}catch(Q){E(Q)}})}).catch(E)});return v(C,x),C}function bn(d,x,m){var C=this;d=b(d);var P=new f(function(E,R){var F;C.ready().then(function(){return F=C._dbInfo,g.call(x)==="[object Blob]"?N(F.db).then(function(z){return z?x:Ne(x)}):x}).then(function(z){je(C._dbInfo,h,function(H,V){if(H)return R(H);try{var Q=V.objectStore(C._dbInfo.storeName);z===null&&(z=void 0);var ae=Q.put(z,d);V.oncomplete=function(){z===void 0&&(z=null),E(z)},V.onabort=V.onerror=function(){var ge=ae.error?ae.error:ae.transaction.error;R(ge)}}catch(ge){R(ge)}})}).catch(R)});return v(P,m),P}function Vn(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){je(m._dbInfo,h,function(R,F){if(R)return E(R);try{var z=F.objectStore(m._dbInfo.storeName),H=z.delete(d);F.oncomplete=function(){P()},F.onerror=function(){E(H.error)},F.onabort=function(){var V=H.error?H.error:H.transaction.error;E(V)}}catch(V){E(V)}})}).catch(E)});return v(C,x),C}function Tr(d){var x=this,m=new f(function(C,P){x.ready().then(function(){je(x._dbInfo,h,function(E,R){if(E)return P(E);try{var F=R.objectStore(x._dbInfo.storeName),z=F.clear();R.oncomplete=function(){C()},R.onabort=R.onerror=function(){var H=z.error?z.error:z.transaction.error;P(H)}}catch(H){P(H)}})}).catch(P)});return v(m,d),m}function Ji(d){var x=this,m=new f(function(C,P){x.ready().then(function(){je(x._dbInfo,p,function(E,R){if(E)return P(E);try{var F=R.objectStore(x._dbInfo.storeName),z=F.count();z.onsuccess=function(){C(z.result)},z.onerror=function(){P(z.error)}}catch(H){P(H)}})}).catch(P)});return v(m,d),m}function _n(d,x){var m=this,C=new f(function(P,E){if(d<0){P(null);return}m.ready().then(function(){je(m._dbInfo,p,function(R,F){if(R)return E(R);try{var z=F.objectStore(m._dbInfo.storeName),H=!1,V=z.openKeyCursor();V.onsuccess=function(){var Q=V.result;if(!Q){P(null);return}d===0||H?P(Q.key):(H=!0,Q.advance(d))},V.onerror=function(){E(V.error)}}catch(Q){E(Q)}})}).catch(E)});return v(C,x),C}function hf(d){var x=this,m=new f(function(C,P){x.ready().then(function(){je(x._dbInfo,p,function(E,R){if(E)return P(E);try{var F=R.objectStore(x._dbInfo.storeName),z=F.openKeyCursor(),H=[];z.onsuccess=function(){var V=z.result;if(!V){C(H);return}H.push(V.key),V.continue()},z.onerror=function(){P(z.error)}}catch(V){P(V)}})}).catch(P)});return v(m,d),m}function w(d,x){x=I.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var C=this,P;if(!d.name)P=f.reject("Invalid arguments");else{var E=d.name===m.name&&C._dbInfo.db,R=E?f.resolve(C._dbInfo.db):tt(d).then(function(F){var z=T[d.name],H=z.forages;z.db=F;for(var V=0;V<H.length;V++)H[V]._dbInfo.db=F;return F});d.storeName?P=R.then(function(F){if(F.objectStoreNames.contains(d.storeName)){var z=F.version+1;q(d);var H=T[d.name],V=H.forages;F.close();for(var Q=0;Q<V.length;Q++){var ae=V[Q];ae._dbInfo.db=null,ae._dbInfo.version=z}var ge=new f(function(_e,Ie){var Pe=l.open(d.name,z);Pe.onerror=function(pt){var Rr=Pe.result;Rr.close(),Ie(pt)},Pe.onupgradeneeded=function(){var pt=Pe.result;pt.deleteObjectStore(d.storeName)},Pe.onsuccess=function(){var pt=Pe.result;pt.close(),_e(pt)}});return ge.then(function(_e){H.db=_e;for(var Ie=0;Ie<V.length;Ie++){var Pe=V[Ie];Pe._dbInfo.db=_e,X(Pe._dbInfo)}}).catch(function(_e){throw(Ce(d,_e)||f.resolve()).catch(function(){}),_e})}}):P=R.then(function(F){q(d);var z=T[d.name],H=z.forages;F.close();for(var V=0;V<H.length;V++){var Q=H[V];Q._dbInfo.db=null}var ae=new f(function(ge,_e){var Ie=l.deleteDatabase(d.name);Ie.onerror=function(){var Pe=Ie.result;Pe&&Pe.close(),_e(Ie.error)},Ie.onblocked=function(){},Ie.onsuccess=function(){var Pe=Ie.result;Pe&&Pe.close(),ge(Pe)}});return ae.then(function(ge){z.db=ge;for(var _e=0;_e<H.length;_e++){var Ie=H[_e];X(Ie._dbInfo)}}).catch(function(ge){throw(Ce(d,ge)||f.resolve()).catch(function(){}),ge})})}return v(P,x),P}var k={_driver:"asyncStorage",_initStorage:Gi,_support:u(),iterate:Zo,getItem:Xo,setItem:bn,removeItem:Vn,clear:Tr,length:Ji,key:_n,keys:hf,dropInstance:w};function A(){return typeof openDatabase=="function"}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",K=G.length,W="arbf",B="blob",ee="si08",J="ui08",Z="uic8",re="si16",ce="si32",be="ur16",de="ui32",Fe="fl32",Be="fl64",lt=K+W.length,ct=Object.prototype.toString;function nn(d){var x=d.length*.75,m=d.length,C,P=0,E,R,F,z;d[d.length-1]==="="&&(x--,d[d.length-2]==="="&&x--);var H=new ArrayBuffer(x),V=new Uint8Array(H);for(C=0;C<m;C+=4)E=L.indexOf(d[C]),R=L.indexOf(d[C+1]),F=L.indexOf(d[C+2]),z=L.indexOf(d[C+3]),V[P++]=E<<2|R>>4,V[P++]=(R&15)<<4|F>>2,V[P++]=(F&3)<<6|z&63;return H}function Kn(d){var x=new Uint8Array(d),m="",C;for(C=0;C<x.length;C+=3)m+=L[x[C]>>2],m+=L[(x[C]&3)<<4|x[C+1]>>4],m+=L[(x[C+1]&15)<<2|x[C+2]>>6],m+=L[x[C+2]&63];return x.length%3===2?m=m.substring(0,m.length-1)+"=":x.length%3===1&&(m=m.substring(0,m.length-2)+"=="),m}function Ge(d,x){var m="";if(d&&(m=ct.call(d)),d&&(m==="[object ArrayBuffer]"||d.buffer&&ct.call(d.buffer)==="[object ArrayBuffer]")){var C,P=G;d instanceof ArrayBuffer?(C=d,P+=W):(C=d.buffer,m==="[object Int8Array]"?P+=ee:m==="[object Uint8Array]"?P+=J:m==="[object Uint8ClampedArray]"?P+=Z:m==="[object Int16Array]"?P+=re:m==="[object Uint16Array]"?P+=be:m==="[object Int32Array]"?P+=ce:m==="[object Uint32Array]"?P+=de:m==="[object Float32Array]"?P+=Fe:m==="[object Float64Array]"?P+=Be:x(new Error("Failed to get type for BinaryArray"))),x(P+Kn(C))}else if(m==="[object Blob]"){var E=new FileReader;E.onload=function(){var R=M+d.type+"~"+Kn(this.result);x(G+B+R)},E.readAsArrayBuffer(d)}else try{x(JSON.stringify(d))}catch(R){x(null,R)}}function ht(d){if(d.substring(0,K)!==G)return JSON.parse(d);var x=d.substring(lt),m=d.substring(K,lt),C;if(m===B&&j.test(x)){var P=x.match(j);C=P[1],x=x.substring(P[0].length)}var E=nn(x);switch(m){case W:return E;case B:return c([E],{type:C});case ee:return new Int8Array(E);case J:return new Uint8Array(E);case Z:return new Uint8ClampedArray(E);case re:return new Int16Array(E);case be:return new Uint16Array(E);case ce:return new Int32Array(E);case de:return new Uint32Array(E);case Fe:return new Float32Array(E);case Be:return new Float64Array(E);default:throw new Error("Unkown type: "+m)}}var Yn={serialize:Ge,deserialize:ht,stringToBuffer:nn,bufferToString:Kn};function Ar(d,x,m,C){d.executeSql("CREATE TABLE IF NOT EXISTS "+x.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],m,C)}function $y(d){var x=this,m={db:null};if(d)for(var C in d)m[C]=typeof d[C]!="string"?d[C].toString():d[C];var P=new f(function(E,R){try{m.db=openDatabase(m.name,String(m.version),m.description,m.size)}catch(F){return R(F)}m.db.transaction(function(F){Ar(F,m,function(){x._dbInfo=m,E()},function(z,H){R(H)})},R)});return m.serializer=Yn,P}function rn(d,x,m,C,P,E){d.executeSql(m,C,P,function(R,F){F.code===F.SYNTAX_ERR?R.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[x.storeName],function(z,H){H.rows.length?E(z,F):Ar(z,x,function(){z.executeSql(m,C,P,E)},E)},E):E(R,F)},E)}function Cy(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){var R=m._dbInfo;R.db.transaction(function(F){rn(F,R,"SELECT * FROM "+R.storeName+" WHERE key = ? LIMIT 1",[d],function(z,H){var V=H.rows.length?H.rows.item(0).value:null;V&&(V=R.serializer.deserialize(V)),P(V)},function(z,H){E(H)})})}).catch(E)});return v(C,x),C}function Py(d,x){var m=this,C=new f(function(P,E){m.ready().then(function(){var R=m._dbInfo;R.db.transaction(function(F){rn(F,R,"SELECT * FROM "+R.storeName,[],function(z,H){for(var V=H.rows,Q=V.length,ae=0;ae<Q;ae++){var ge=V.item(ae),_e=ge.value;if(_e&&(_e=R.serializer.deserialize(_e)),_e=d(_e,ge.key,ae+1),_e!==void 0){P(_e);return}}P()},function(z,H){E(H)})})}).catch(E)});return v(C,x),C}function pf(d,x,m,C){var P=this;d=b(d);var E=new f(function(R,F){P.ready().then(function(){x===void 0&&(x=null);var z=x,H=P._dbInfo;H.serializer.serialize(x,function(V,Q){Q?F(Q):H.db.transaction(function(ae){rn(ae,H,"INSERT OR REPLACE INTO "+H.storeName+" (key, value) VALUES (?, ?)",[d,V],function(){R(z)},function(ge,_e){F(_e)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(C>0){R(pf.apply(P,[d,z,m,C-1]));return}F(ae)}})})}).catch(F)});return v(E,m),E}function Oy(d,x,m){return pf.apply(this,[d,x,m,1])}function Iy(d,x){var m=this;d=b(d);var C=new f(function(P,E){m.ready().then(function(){var R=m._dbInfo;R.db.transaction(function(F){rn(F,R,"DELETE FROM "+R.storeName+" WHERE key = ?",[d],function(){P()},function(z,H){E(H)})})}).catch(E)});return v(C,x),C}function Ty(d){var x=this,m=new f(function(C,P){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(R){rn(R,E,"DELETE FROM "+E.storeName,[],function(){C()},function(F,z){P(z)})})}).catch(P)});return v(m,d),m}function Ay(d){var x=this,m=new f(function(C,P){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(R){rn(R,E,"SELECT COUNT(key) as c FROM "+E.storeName,[],function(F,z){var H=z.rows.item(0).c;C(H)},function(F,z){P(z)})})}).catch(P)});return v(m,d),m}function Ny(d,x){var m=this,C=new f(function(P,E){m.ready().then(function(){var R=m._dbInfo;R.db.transaction(function(F){rn(F,R,"SELECT key FROM "+R.storeName+" WHERE id = ? LIMIT 1",[d+1],function(z,H){var V=H.rows.length?H.rows.item(0).key:null;P(V)},function(z,H){E(H)})})}).catch(E)});return v(C,x),C}function Ry(d){var x=this,m=new f(function(C,P){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(R){rn(R,E,"SELECT key FROM "+E.storeName,[],function(F,z){for(var H=[],V=0;V<z.rows.length;V++)H.push(z.rows.item(V).key);C(H)},function(F,z){P(z)})})}).catch(P)});return v(m,d),m}function Dy(d){return new f(function(x,m){d.transaction(function(C){C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(P,E){for(var R=[],F=0;F<E.rows.length;F++)R.push(E.rows.item(F).name);x({db:d,storeNames:R})},function(P,E){m(E)})},function(C){m(C)})})}function Ly(d,x){x=I.apply(this,arguments);var m=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||m.name,d.storeName=d.storeName||m.storeName);var C=this,P;return d.name?P=new f(function(E){var R;d.name===m.name?R=C._dbInfo.db:R=openDatabase(d.name,"","",0),d.storeName?E({db:R,storeNames:[d.storeName]}):E(Dy(R))}).then(function(E){return new f(function(R,F){E.db.transaction(function(z){function H(ge){return new f(function(_e,Ie){z.executeSql("DROP TABLE IF EXISTS "+ge,[],function(){_e()},function(Pe,pt){Ie(pt)})})}for(var V=[],Q=0,ae=E.storeNames.length;Q<ae;Q++)V.push(H(E.storeNames[Q]));f.all(V).then(function(){R()}).catch(function(ge){F(ge)})},function(z){F(z)})})}):P=f.reject("Invalid arguments"),v(P,x),P}var My={_driver:"webSQLStorage",_initStorage:$y,_support:A(),iterate:Py,getItem:Cy,setItem:Oy,removeItem:Iy,clear:Ty,length:Ay,key:Ny,keys:Ry,dropInstance:Ly};function jy(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function mf(d,x){var m=d.name+"/";return d.storeName!==x.storeName&&(m+=d.storeName+"/"),m}function Fy(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function By(){return!Fy()||localStorage.length>0}function Uy(d){var x=this,m={};if(d)for(var C in d)m[C]=d[C];return m.keyPrefix=mf(d,x._defaultConfig),By()?(x._dbInfo=m,m.serializer=Yn,f.resolve()):f.reject()}function zy(d){var x=this,m=x.ready().then(function(){for(var C=x._dbInfo.keyPrefix,P=localStorage.length-1;P>=0;P--){var E=localStorage.key(P);E.indexOf(C)===0&&localStorage.removeItem(E)}});return v(m,d),m}function Hy(d,x){var m=this;d=b(d);var C=m.ready().then(function(){var P=m._dbInfo,E=localStorage.getItem(P.keyPrefix+d);return E&&(E=P.serializer.deserialize(E)),E});return v(C,x),C}function qy(d,x){var m=this,C=m.ready().then(function(){for(var P=m._dbInfo,E=P.keyPrefix,R=E.length,F=localStorage.length,z=1,H=0;H<F;H++){var V=localStorage.key(H);if(V.indexOf(E)===0){var Q=localStorage.getItem(V);if(Q&&(Q=P.serializer.deserialize(Q)),Q=d(Q,V.substring(R),z++),Q!==void 0)return Q}}});return v(C,x),C}function Wy(d,x){var m=this,C=m.ready().then(function(){var P=m._dbInfo,E;try{E=localStorage.key(d)}catch{E=null}return E&&(E=E.substring(P.keyPrefix.length)),E});return v(C,x),C}function Vy(d){var x=this,m=x.ready().then(function(){for(var C=x._dbInfo,P=localStorage.length,E=[],R=0;R<P;R++){var F=localStorage.key(R);F.indexOf(C.keyPrefix)===0&&E.push(F.substring(C.keyPrefix.length))}return E});return v(m,d),m}function Ky(d){var x=this,m=x.keys().then(function(C){return C.length});return v(m,d),m}function Yy(d,x){var m=this;d=b(d);var C=m.ready().then(function(){var P=m._dbInfo;localStorage.removeItem(P.keyPrefix+d)});return v(C,x),C}function Gy(d,x,m){var C=this;d=b(d);var P=C.ready().then(function(){x===void 0&&(x=null);var E=x;return new f(function(R,F){var z=C._dbInfo;z.serializer.serialize(x,function(H,V){if(V)F(V);else try{localStorage.setItem(z.keyPrefix+d,H),R(E)}catch(Q){(Q.name==="QuotaExceededError"||Q.name==="NS_ERROR_DOM_QUOTA_REACHED")&&F(Q),F(Q)}})})});return v(P,m),P}function Jy(d,x){if(x=I.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var m=this.config();d.name=d.name||m.name,d.storeName=d.storeName||m.storeName}var C=this,P;return d.name?P=new f(function(E){d.storeName?E(mf(d,C._defaultConfig)):E(d.name+"/")}).then(function(E){for(var R=localStorage.length-1;R>=0;R--){var F=localStorage.key(R);F.indexOf(E)===0&&localStorage.removeItem(F)}}):P=f.reject("Invalid arguments"),v(P,x),P}var Qy={_driver:"localStorageWrapper",_initStorage:Uy,_support:jy(),iterate:qy,getItem:Hy,setItem:Gy,removeItem:Yy,clear:zy,length:Ky,key:Wy,keys:Vy,dropInstance:Jy},Xy=function(x,m){return x===m||typeof x=="number"&&typeof m=="number"&&isNaN(x)&&isNaN(m)},Zy=function(x,m){for(var C=x.length,P=0;P<C;){if(Xy(x[P],m))return!0;P++}return!1},gf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Nr={},vf={},Gn={INDEXEDDB:k,WEBSQL:My,LOCALSTORAGE:Qy},eb=[Gn.INDEXEDDB._driver,Gn.WEBSQL._driver,Gn.LOCALSTORAGE._driver],Qi=["dropInstance"],ea=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Qi),tb={description:"",driver:eb.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function nb(d,x){d[x]=function(){var m=arguments;return d.ready().then(function(){return d[x].apply(d,m)})}}function ta(){for(var d=1;d<arguments.length;d++){var x=arguments[d];if(x)for(var m in x)x.hasOwnProperty(m)&&(gf(x[m])?arguments[0][m]=x[m].slice():arguments[0][m]=x[m])}return arguments[0]}var rb=function(){function d(x){o(this,d);for(var m in Gn)if(Gn.hasOwnProperty(m)){var C=Gn[m],P=C._driver;this[m]=P,Nr[P]||this.defineDriver(C)}this._defaultConfig=ta({},tb),this._config=ta({},this._defaultConfig,x),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(m){if((typeof m>"u"?"undefined":s(m))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var C in m){if(C==="storeName"&&(m[C]=m[C].replace(/\W/g,"_")),C==="version"&&typeof m[C]!="number")return new Error("Database version must be a number.");this._config[C]=m[C]}return"driver"in m&&m.driver?this.setDriver(this._config.driver):!0}else return typeof m=="string"?this._config[m]:this._config},d.prototype.defineDriver=function(m,C,P){var E=new f(function(R,F){try{var z=m._driver,H=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!m._driver){F(H);return}for(var V=ea.concat("_initStorage"),Q=0,ae=V.length;Q<ae;Q++){var ge=V[Q],_e=!Zy(Qi,ge);if((_e||m[ge])&&typeof m[ge]!="function"){F(H);return}}var Ie=function(){for(var Rr=function(ob){return function(){var ab=new Error("Method "+ob+" is not implemented by the current driver"),yf=f.reject(ab);return v(yf,arguments[arguments.length-1]),yf}},na=0,sb=Qi.length;na<sb;na++){var ra=Qi[na];m[ra]||(m[ra]=Rr(ra))}};Ie();var Pe=function(Rr){Nr[z],Nr[z]=m,vf[z]=Rr,R()};"_support"in m?m._support&&typeof m._support=="function"?m._support().then(Pe,F):Pe(!!m._support):Pe(!0)}catch(pt){F(pt)}});return y(E,C,P),E},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(m,C,P){var E=Nr[m]?f.resolve(Nr[m]):f.reject(new Error("Driver not found."));return y(E,C,P),E},d.prototype.getSerializer=function(m){var C=f.resolve(Yn);return y(C,m),C},d.prototype.ready=function(m){var C=this,P=C._driverSet.then(function(){return C._ready===null&&(C._ready=C._initDriver()),C._ready});return y(P,m,m),P},d.prototype.setDriver=function(m,C,P){var E=this;gf(m)||(m=[m]);var R=this._getSupportedDrivers(m);function F(){E._config.driver=E.driver()}function z(Q){return E._extend(Q),F(),E._ready=E._initStorage(E._config),E._ready}function H(Q){return function(){var ae=0;function ge(){for(;ae<Q.length;){var _e=Q[ae];return ae++,E._dbInfo=null,E._ready=null,E.getDriver(_e).then(z).catch(ge)}F();var Ie=new Error("No available storage method found.");return E._driverSet=f.reject(Ie),E._driverSet}return ge()}}var V=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=V.then(function(){var Q=R[0];return E._dbInfo=null,E._ready=null,E.getDriver(Q).then(function(ae){E._driver=ae._driver,F(),E._wrapLibraryMethodsWithReady(),E._initDriver=H(R)})}).catch(function(){F();var Q=new Error("No available storage method found.");return E._driverSet=f.reject(Q),E._driverSet}),y(this._driverSet,C,P),this._driverSet},d.prototype.supports=function(m){return!!vf[m]},d.prototype._extend=function(m){ta(this,m)},d.prototype._getSupportedDrivers=function(m){for(var C=[],P=0,E=m.length;P<E;P++){var R=m[P];this.supports(R)&&C.push(R)}return C},d.prototype._wrapLibraryMethodsWithReady=function(){for(var m=0,C=ea.length;m<C;m++)nb(this,ea[m])},d.prototype.createInstance=function(m){return new d(m)},d}(),ib=new rb;r.exports=ib},{3:3}]},{},[4])(4)})}(xs)),xs.exports}var ih=rh();const Ua=nh(ih);class sh extends an{constructor(e){super(e,"storage",!1),e.set("localforage",Ua)}get StorageManager(){return Qr}createDatabse(e,n,r){return new Qr("InPageEdit",e,n,r)}}const qn=class qn{constructor(e,n,r=qn.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=qn.createDatabase(e,n),this.keys=this.db.keys.bind(this.db)}static createDatabase(e,n){const r=`${e}:${n}`;if(this._cached_db_instances.has(r))return this._cached_db_instances.get(r);const i=Ua.createInstance({name:e,storeName:n});return this._cached_db_instances.set(r,i),i}async get(e,n=this.ttl,r){const i=await this.loadFromDB(e),s=this.checkIfExpired(i,n);if(!i||s){if(typeof r=="function"){const o=await r();return this.set(e,o).then(()=>o)}return null}return i.value}async set(e,n){return n===null||typeof n>"u"?this.delete(e):this.db.setItem(e,{time:Date.now(),value:n,version:this.version})}async has(e,n=this.ttl){const r=await this.loadFromDB(e),i=this.checkIfExpired(r,n);return r!==null&&!i}async delete(e){return this.db.removeItem(e)}async iterate(e){return await this.db.iterate((n,r)=>{e(n.value,r)})}async loadFromDB(e){const n=await this.db.getItem(e);if(!n)return null;if(typeof n.time!="number"||typeof n.value>"u"){try{this.delete(e)}catch{}return null}if(typeof this.version=="number"&&n.version!==this.version){try{this.delete(e)}catch{}return null}return n}checkIfExpired(e,n=this.ttl){return e?Date.now()-e.time>n:!1}async clear(){return await this.db.clear(),this}};qn.DEFAULT_TTL=1/0,qn._cached_db_instances=new Map;let Qr=qn;var mt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(mt||{});const Vi=class Vi{constructor(e,n){this.pageInfo={...Vi.DEFAULT_PAGE_INFO,...e},this.api=n||new Ca}async fetchPageInfo(e){const{data:{query:{pages:[n]}}}=await this.api.get({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",...e});return n.revisions?.forEach(r=>{if(typeof r.slots=="object"){const i=r.slots.main;i&&(r.content=i.content,r.contentmodel=i.contentmodel,r.contentformat=i.contentformat)}}),n}async parse(e){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...e})}async preview(e,n){return this.parse({action:"parse",page:void 0,title:this.title,text:e,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...n})}async edit(e,n){const{text:r,prependtext:i,appendtext:s,summary:o="",watchlist:a=mt.preferences,section:l}=e;return this.api.postWithEditToken({action:"edit",title:this.title,starttimestamp:this.pageInfo.touched,basetimestamp:this.revisions[0]?.timestamp,text:r,prependtext:i,appendtext:s,summary:o,watchlist:a,section:l,...n})}async createOnly(e,n){return this.edit(e,{createonly:1,...n})}async delete(e,n){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:e,...n})}async moveTo(e,n,r){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:e,reason:n,movetalk:1,movesubpages:1,...r})}userCan(e){return this.pageInfo?.actions?.[e]}userCanEdit(){return this.userCan("edit")}async reloadSelfInfo(){const e=await this.fetchPageInfo({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),n=(this.pageInfo.revisions||[]).concat(e.revisions||[]).sort((r,i)=>r.revid-i.revid).reduce((r,i)=>(r.find(s=>s.revid===i.revid)||r.push(i),r),[]);return this.pageInfo=e,this.pageInfo.revisions=n,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 templates(){return this.pageInfo.templates||[]}get images(){return this.pageInfo.images||[]}};Vi.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 nr=Vi;const Yo=class Yo extends an{constructor(e){super(e,"wikiPage",!0),this.ctx=e}get WikiPage(){return nr}async createInstance(e){const{data:{query:{pages:[n]}}}=await this.ctx.api.get({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|user|userid|content",...e});return new nr(n,this.ctx.api)}async newFromTitle(e,n=!1,r){return this.createInstance({titles:e,converttitles:n,rvsection:r})}async newFromPageId(e,n){return this.createInstance({pageids:e,rvsection:n})}async newFromRevision(e,n){return this.createInstance({revids:e,rvsection:n})}newBlankPage(e={}){return new nr(e,this.ctx.api)}};Yo.inject=["api"];let Ss=Yo;const za=new WeakMap,wt={toDBKey:t=>t.replace(/ /g,"_"),toNormalText:t=>t.replace(/_/g," "),ensureCase:(t,e)=>e==="first-letter"?t.charAt(0).toUpperCase()+t.slice(1):t},Sn={normalizeSpecialPageName:t=>t.toLowerCase(),buildSpecialPageIndex:t=>{const e=new Map,n=new Map,r=new Map;for(const i of t.specialpagealiases){const s=i.realname;e.set(s,s);const o=Sn.normalizeSpecialPageName(s);r.set(o,s);for(const a of i.aliases){n.set(a,s);const l=Sn.normalizeSpecialPageName(a);r.set(l,s)}}return{byRealName:e,byAlias:n,byNormalized:r}},findSpecialPageRealName:(t,e)=>{const n=t.split("/")[0];let r=e.byRealName.get(n)??e.byAlias.get(n);if(r!==void 0)return r;const i=Sn.normalizeSpecialPageName(n);return e.byNormalized.get(i)??null}},xt={normalizeNamespaceText:t=>t.replace(/[_\s]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),buildIndex:t=>{const e=new Map,n=new Map,r=new Map,i=new Map;for(const[s,o]of Object.entries(t.namespaces)){const a=parseInt(s);e.set(o.name,a),n.set(o.canonical??"",a);const l=xt.normalizeNamespaceText(o.name),u=xt.normalizeNamespaceText(o.canonical??"");i.set(l,a),i.set(u,a)}for(const s of t.namespacealiases){r.set(s.alias,s.id);const o=xt.normalizeNamespaceText(s.alias);i.set(o,s.id)}return{byName:e,byCanonical:n,byAlias:r,byNormalized:i}},findNamespaceId:(t,e)=>{let n=e.byName.get(t)??e.byCanonical.get(t)??e.byAlias.get(t);if(n!==void 0)return n;const r=xt.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 oh(t){const e=za.get(t);if(e)return e;const n=xt.buildIndex(t),r=Sn.buildSpecialPageIndex(t),s=class s{constructor(a,l){this.toText=this.getPrefixedText.bind(this),this.toString=this.getPrefixedDBKey.bind(this),this._title=a||"",this._ns=l??0,l===void 0&&this.fixNSByTitle()}fixNSByTitle(){const a=this._title.indexOf(":");if(a===-1)return;if(a===0){this._title=this._title.substring(1);return}const l=this._title.substring(0,a),u=this._title.substring(a+1),c=xt.findNamespaceId(l,s._namespaceIndex);c!==null&&(this._title=u,this._ns=c)}getNamespaceInfo(){return s._meta.namespaces[this._ns]??xt.getDefaultNamespaceInfo(this._ns)}getMainDBKey(){const a=this.getNamespaceInfo();if(this._ns===-1){const l=Sn.findSpecialPageRealName(this._title,s._specialPageIndex);if(l){const u=this._title.includes("/")?this._title.substring(this._title.indexOf("/")):"",c=l+u;return wt.ensureCase(wt.toDBKey(c),a.case)}}return wt.ensureCase(wt.toDBKey(this._title),a.case)}getMainText(){const a=this.getNamespaceInfo();if(this._ns===-1){const l=Sn.findSpecialPageRealName(this._title,s._specialPageIndex);if(l){const u=this._title.includes("/")?this._title.substring(this._title.indexOf("/")):"",c=l+u;return wt.ensureCase(wt.toNormalText(c),a.case)}}return wt.ensureCase(wt.toNormalText(this._title),a.case)}getMainRootText(){return this.getMainText().split("/")[0]}getPrefixedDBKey(){return this._ns===0?this.getMainDBKey():`${this.getNamespaceDBKey()}:${this.getMainDBKey()}`}getPrefixedText(){return this._ns===0?this.getMainText():`${this.getNamespaceText()}:${this.getMainText()}`}getNamespaceId(){return this._ns}getNamespaceText(){return this.getNamespaceInfo().name??""}getNamespaceDBKey(){const a=this.getNamespaceInfo();return wt.ensureCase(wt.toDBKey(this.getNamespaceText()),a.case)}getSubjectPage(){if(xt.isTalkPage(this._ns)){const a=this._ns-1;return new s(this._title,a)}return this}getTalkPage(){if(xt.isTalkPage(this._ns))return this;if(this._ns<0)return null;const a=this._ns+1;return s._meta.namespaces[a.toString()]?new s(this._title,a):null}getURL(a){const l=s._meta.general.articlepath,u=this.getPrefixedDBKey(),c=l.replace("$1",u),f=new URL(c,s._meta.general.base);return a&&(a instanceof URLSearchParams?a:new URLSearchParams(a)).forEach((y,b)=>{f.searchParams.set(b,y)}),f}setTitle(a){return this._title=a,this._ns=0,this.fixNSByTitle(),this}setMainText(a){return this._title=a,this}setNamespaceText(a){const l=xt.findNamespaceId(a,s._namespaceIndex);return l!==null&&(this._ns=l),this}setNamespaceId(a){return this._ns=a,this}equals(a){return typeof a=="string"&&(a=new s(a)),this.getPrefixedDBKey()===a.getPrefixedDBKey()}isSpecial(a){if(this._ns!==-1)return!1;const l=new s(a,-1);return this.getMainRootText()===l.getMainRootText()}};s._meta=t,s._namespaceIndex=n,s._specialPageIndex=r;let i=s;return za.set(t,i),i}const Go=class Go extends an{constructor(e){super(e,"wikiTitle",!0),this.ctx=e,this.WikiTitle=oh(this.ctx.sitemeta._raw)}create(e,n){return new this.WikiTitle(e,n)}};Go.inject=["sitemeta"];let Es=Go;var ks=(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))(ks||{});/**
|
|
52
|
+
*/var za;function ch(){return za||(za=1,function(t,e){(function(n){t.exports=n()})(function(){return function n(r,i,s){function o(c,u){if(!i[c]){if(!r[c]){var f=typeof ei=="function"&&ei;if(!u&&f)return f(c,!0);if(a)return a(c,!0);var m=new Error("Cannot find module '"+c+"'");throw m.code="MODULE_NOT_FOUND",m}var y=i[c]={exports:{}};r[c][0].call(y.exports,function(b){var I=r[c][1][b];return o(I||b)},y,y.exports,n,r,i,s)}return i[c].exports}for(var a=typeof ei=="function"&&ei,l=0;l<s.length;l++)o(s[l]);return o}({1:[function(n,r,i){(function(s){var o=s.MutationObserver||s.WebKitMutationObserver,a;if(o){var l=0,c=new o(b),u=s.document.createTextNode("");c.observe(u,{characterData:!0}),a=function(){u.data=l=++l%2}}else if(!s.setImmediate&&typeof s.MessageChannel<"u"){var f=new s.MessageChannel;f.port1.onmessage=b,a=function(){f.port2.postMessage(0)}}else"document"in s&&"onreadystatechange"in s.document.createElement("script")?a=function(){var F=s.document.createElement("script");F.onreadystatechange=function(){b(),F.onreadystatechange=null,F.parentNode.removeChild(F),F=null},s.document.documentElement.appendChild(F)}:a=function(){setTimeout(b,0)};var m,y=[];function b(){m=!0;for(var F,D,T=y.length;T;){for(D=y,y=[],F=-1;++F<T;)D[F]();T=y.length}m=!1}r.exports=I;function I(F){y.push(F)===1&&!m&&a()}}).call(this,typeof Zr<"u"?Zr:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(n,r,i){var s=n(1);function o(){}var a={},l=["REJECTED"],c=["FULFILLED"],u=["PENDING"];r.exports=f;function f(h){if(typeof h!="function")throw new TypeError("resolver must be a function");this.state=u,this.queue=[],this.outcome=void 0,h!==o&&I(this,h)}f.prototype.catch=function(h){return this.then(null,h)},f.prototype.then=function(h,S){if(typeof h!="function"&&this.state===c||typeof S!="function"&&this.state===l)return this;var O=new this.constructor(o);if(this.state!==u){var N=this.state===c?h:S;y(O,N,this.outcome)}else this.queue.push(new m(O,h,S));return O};function m(h,S,O){this.promise=h,typeof S=="function"&&(this.onFulfilled=S,this.callFulfilled=this.otherCallFulfilled),typeof O=="function"&&(this.onRejected=O,this.callRejected=this.otherCallRejected)}m.prototype.callFulfilled=function(h){a.resolve(this.promise,h)},m.prototype.otherCallFulfilled=function(h){y(this.promise,this.onFulfilled,h)},m.prototype.callRejected=function(h){a.reject(this.promise,h)},m.prototype.otherCallRejected=function(h){y(this.promise,this.onRejected,h)};function y(h,S,O){s(function(){var N;try{N=S(O)}catch(H){return a.reject(h,H)}N===h?a.reject(h,new TypeError("Cannot resolve promise with itself")):a.resolve(h,N)})}a.resolve=function(h,S){var O=F(b,S);if(O.status==="error")return a.reject(h,O.value);var N=O.value;if(N)I(h,N);else{h.state=c,h.outcome=S;for(var H=-1,X=h.queue.length;++H<X;)h.queue[H].callFulfilled(S)}return h},a.reject=function(h,S){h.state=l,h.outcome=S;for(var O=-1,N=h.queue.length;++O<N;)h.queue[O].callRejected(S);return h};function b(h){var S=h&&h.then;if(h&&(typeof h=="object"||typeof h=="function")&&typeof S=="function")return function(){S.apply(h,arguments)}}function I(h,S){var O=!1;function N(Ne){O||(O=!0,a.reject(h,Ne))}function H(Ne){O||(O=!0,a.resolve(h,Ne))}function X(){S(H,N)}var Ce=F(X);Ce.status==="error"&&N(Ce.value)}function F(h,S){var O={};try{O.value=h(S),O.status="success"}catch(N){O.status="error",O.value=N}return O}f.resolve=D;function D(h){return h instanceof this?h:a.resolve(new this(o),h)}f.reject=T;function T(h){var S=new this(o);return a.reject(S,h)}f.all=v;function v(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var O=h.length,N=!1;if(!O)return this.resolve([]);for(var H=new Array(O),X=0,Ce=-1,Ne=new this(o);++Ce<O;)nt(h[Ce],Ce);return Ne;function nt(Ht,wn){S.resolve(Ht).then(Re,function(ve){N||(N=!0,a.reject(Ne,ve))});function Re(ve){H[wn]=ve,++X===O&&!N&&(N=!0,a.resolve(Ne,H))}}}f.race=p;function p(h){var S=this;if(Object.prototype.toString.call(h)!=="[object Array]")return this.reject(new TypeError("must be an array"));var O=h.length,N=!1;if(!O)return this.resolve([]);for(var H=-1,X=new this(o);++H<O;)Ce(h[H]);return X;function Ce(Ne){S.resolve(Ne).then(function(nt){N||(N=!0,a.resolve(X,nt))},function(nt){N||(N=!0,a.reject(X,nt))})}}},{1:1}],3:[function(n,r,i){(function(s){typeof s.Promise!="function"&&(s.Promise=n(2))}).call(this,typeof Zr<"u"?Zr:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(n,r,i){var s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(d){return typeof d}:function(d){return d&&typeof Symbol=="function"&&d.constructor===Symbol&&d!==Symbol.prototype?"symbol":typeof d};function o(d,x){if(!(d instanceof x))throw new TypeError("Cannot call a class as a function")}function a(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch{return}}var l=a();function c(){try{if(!l||!l.open)return!1;var d=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),x=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!d||x)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch{return!1}}function u(d,x){d=d||[],x=x||{};try{return new Blob(d,x)}catch(E){if(E.name!=="TypeError")throw E;for(var g=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,P=new g,C=0;C<d.length;C+=1)P.append(d[C]);return P.getBlob(x.type)}}typeof Promise>"u"&&n(3);var f=Promise;function m(d,x){x&&d.then(function(g){x(null,g)},function(g){x(g)})}function y(d,x,g){typeof x=="function"&&d.then(x),typeof g=="function"&&d.catch(g)}function b(d){return typeof d!="string"&&(d=String(d)),d}function I(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var F="local-forage-detect-blob-support",D=void 0,T={},v=Object.prototype.toString,p="readonly",h="readwrite";function S(d){for(var x=d.length,g=new ArrayBuffer(x),P=new Uint8Array(g),C=0;C<x;C++)P[C]=d.charCodeAt(C);return g}function O(d){return new f(function(x){var g=d.transaction(F,h),P=u([""]);g.objectStore(F).put(P,"key"),g.onabort=function(C){C.preventDefault(),C.stopPropagation(),x(!1)},g.oncomplete=function(){var C=navigator.userAgent.match(/Chrome\/(\d+)/),E=navigator.userAgent.match(/Edge\//);x(E||!C||parseInt(C[1],10)>=43)}}).catch(function(){return!1})}function N(d){return typeof D=="boolean"?f.resolve(D):O(d).then(function(x){return D=x,D})}function H(d){var x=T[d.name],g={};g.promise=new f(function(P,C){g.resolve=P,g.reject=C}),x.deferredOperations.push(g),x.dbReady?x.dbReady=x.dbReady.then(function(){return g.promise}):x.dbReady=g.promise}function X(d){var x=T[d.name],g=x.deferredOperations.pop();if(g)return g.resolve(),g.promise}function Ce(d,x){var g=T[d.name],P=g.deferredOperations.pop();if(P)return P.reject(x),P.promise}function Ne(d,x){return new f(function(g,P){if(T[d.name]=T[d.name]||lt(),d.db)if(x)H(d),d.db.close();else return g(d.db);var C=[d.name];x&&C.push(d.version);var E=l.open.apply(l,C);x&&(E.onupgradeneeded=function(R){var B=E.result;try{B.createObjectStore(d.storeName),R.oldVersion<=1&&B.createObjectStore(F)}catch(q){if(q.name!=="ConstraintError")throw q}}),E.onerror=function(R){R.preventDefault(),P(E.error)},E.onsuccess=function(){var R=E.result;R.onversionchange=function(B){B.target.close()},g(R),X(d)}})}function nt(d){return Ne(d,!1)}function Ht(d){return Ne(d,!0)}function wn(d,x){if(!d.db)return!0;var g=!d.db.objectStoreNames.contains(d.storeName),P=d.version<d.db.version,C=d.version>d.db.version;if(P&&(d.version,d.version=d.db.version),C||g){if(g){var E=d.db.version+1;E>d.version&&(d.version=E)}return!0}return!1}function Re(d){return new f(function(x,g){var P=new FileReader;P.onerror=g,P.onloadend=function(C){var E=btoa(C.target.result||"");x({__local_forage_encoded_blob:!0,data:E,type:d.type})},P.readAsBinaryString(d)})}function ve(d){var x=S(atob(d.data));return u([x],{type:d.type})}function we(d){return d&&d.__local_forage_encoded_blob}function Wt(d){var x=this,g=x._initReady().then(function(){var P=T[x._dbInfo.name];if(P&&P.dbReady)return P.dbReady});return y(g,d,d),g}function Yn(d){H(d);for(var x=T[d.name],g=x.forages,P=0;P<g.length;P++){var C=g[P];C._dbInfo.db&&(C._dbInfo.db.close(),C._dbInfo.db=null)}return d.db=null,nt(d).then(function(E){return d.db=E,wn(d)?Ht(d):E}).then(function(E){d.db=x.db=E;for(var R=0;R<g.length;R++)g[R]._dbInfo.db=E}).catch(function(E){throw Ce(d,E),E})}function Fe(d,x,g,P){P===void 0&&(P=1);try{var C=d.db.transaction(d.storeName,x);g(null,C)}catch(E){if(P>0&&(!d.db||E.name==="InvalidStateError"||E.name==="NotFoundError"))return f.resolve().then(function(){if(!d.db||E.name==="NotFoundError"&&!d.db.objectStoreNames.contains(d.storeName)&&d.version<=d.db.version)return d.db&&(d.version=d.db.version+1),Ht(d)}).then(function(){return Yn(d).then(function(){Fe(d,x,g,P-1)})}).catch(g);g(E)}}function lt(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Xi(d){var x=this,g={db:null};if(d)for(var P in d)g[P]=d[P];var C=T[g.name];C||(C=lt(),T[g.name]=C),C.forages.push(x),x._initReady||(x._initReady=x.ready,x.ready=Wt);var E=[];function R(){return f.resolve()}for(var B=0;B<C.forages.length;B++){var q=C.forages[B];q!==x&&E.push(q._initReady().catch(R))}var z=C.forages.slice(0);return f.all(E).then(function(){return g.db=C.db,nt(g)}).then(function(K){return g.db=K,wn(g,x._defaultConfig.version)?Ht(g):K}).then(function(K){g.db=C.db=K,x._dbInfo=g;for(var J=0;J<z.length;J++){var ae=z[J];ae!==x&&(ae._dbInfo.db=g.db,ae._dbInfo.version=g.version)}})}function ea(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){Fe(g._dbInfo,p,function(R,B){if(R)return E(R);try{var q=B.objectStore(g._dbInfo.storeName),z=q.get(d);z.onsuccess=function(){var K=z.result;K===void 0&&(K=null),we(K)&&(K=ve(K)),C(K)},z.onerror=function(){E(z.error)}}catch(K){E(K)}})}).catch(E)});return m(P,x),P}function ta(d,x){var g=this,P=new f(function(C,E){g.ready().then(function(){Fe(g._dbInfo,p,function(R,B){if(R)return E(R);try{var q=B.objectStore(g._dbInfo.storeName),z=q.openCursor(),K=1;z.onsuccess=function(){var J=z.result;if(J){var ae=J.value;we(ae)&&(ae=ve(ae));var ye=d(ae,J.key,K++);ye!==void 0?C(ye):J.continue()}else C()},z.onerror=function(){E(z.error)}}catch(J){E(J)}})}).catch(E)});return m(P,x),P}function _n(d,x,g){var P=this;d=b(d);var C=new f(function(E,R){var B;P.ready().then(function(){return B=P._dbInfo,v.call(x)==="[object Blob]"?N(B.db).then(function(q){return q?x:Re(x)}):x}).then(function(q){Fe(P._dbInfo,h,function(z,K){if(z)return R(z);try{var J=K.objectStore(P._dbInfo.storeName);q===null&&(q=void 0);var ae=J.put(q,d);K.oncomplete=function(){q===void 0&&(q=null),E(q)},K.onabort=K.onerror=function(){var ye=ae.error?ae.error:ae.transaction.error;R(ye)}}catch(ye){R(ye)}})}).catch(R)});return m(C,g),C}function Gn(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){Fe(g._dbInfo,h,function(R,B){if(R)return E(R);try{var q=B.objectStore(g._dbInfo.storeName),z=q.delete(d);B.oncomplete=function(){C()},B.onerror=function(){E(z.error)},B.onabort=function(){var K=z.error?z.error:z.transaction.error;E(K)}}catch(K){E(K)}})}).catch(E)});return m(P,x),P}function Rr(d){var x=this,g=new f(function(P,C){x.ready().then(function(){Fe(x._dbInfo,h,function(E,R){if(E)return C(E);try{var B=R.objectStore(x._dbInfo.storeName),q=B.clear();R.oncomplete=function(){P()},R.onabort=R.onerror=function(){var z=q.error?q.error:q.transaction.error;C(z)}}catch(z){C(z)}})}).catch(C)});return m(g,d),g}function Zi(d){var x=this,g=new f(function(P,C){x.ready().then(function(){Fe(x._dbInfo,p,function(E,R){if(E)return C(E);try{var B=R.objectStore(x._dbInfo.storeName),q=B.count();q.onsuccess=function(){P(q.result)},q.onerror=function(){C(q.error)}}catch(z){C(z)}})}).catch(C)});return m(g,d),g}function xn(d,x){var g=this,P=new f(function(C,E){if(d<0){C(null);return}g.ready().then(function(){Fe(g._dbInfo,p,function(R,B){if(R)return E(R);try{var q=B.objectStore(g._dbInfo.storeName),z=!1,K=q.openKeyCursor();K.onsuccess=function(){var J=K.result;if(!J){C(null);return}d===0||z?C(J.key):(z=!0,J.advance(d))},K.onerror=function(){E(K.error)}}catch(J){E(J)}})}).catch(E)});return m(P,x),P}function vf(d){var x=this,g=new f(function(P,C){x.ready().then(function(){Fe(x._dbInfo,p,function(E,R){if(E)return C(E);try{var B=R.objectStore(x._dbInfo.storeName),q=B.openKeyCursor(),z=[];q.onsuccess=function(){var K=q.result;if(!K){P(z);return}z.push(K.key),K.continue()},q.onerror=function(){C(q.error)}}catch(K){C(K)}})}).catch(C)});return m(g,d),g}function _(d,x){x=I.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var P=this,C;if(!d.name)C=f.reject("Invalid arguments");else{var E=d.name===g.name&&P._dbInfo.db,R=E?f.resolve(P._dbInfo.db):nt(d).then(function(B){var q=T[d.name],z=q.forages;q.db=B;for(var K=0;K<z.length;K++)z[K]._dbInfo.db=B;return B});d.storeName?C=R.then(function(B){if(B.objectStoreNames.contains(d.storeName)){var q=B.version+1;H(d);var z=T[d.name],K=z.forages;B.close();for(var J=0;J<K.length;J++){var ae=K[J];ae._dbInfo.db=null,ae._dbInfo.version=q}var ye=new f(function(xe,Ie){var Oe=l.open(d.name,q);Oe.onerror=function(mt){var Mr=Oe.result;Mr.close(),Ie(mt)},Oe.onupgradeneeded=function(){var mt=Oe.result;mt.deleteObjectStore(d.storeName)},Oe.onsuccess=function(){var mt=Oe.result;mt.close(),xe(mt)}});return ye.then(function(xe){z.db=xe;for(var Ie=0;Ie<K.length;Ie++){var Oe=K[Ie];Oe._dbInfo.db=xe,X(Oe._dbInfo)}}).catch(function(xe){throw(Ce(d,xe)||f.resolve()).catch(function(){}),xe})}}):C=R.then(function(B){H(d);var q=T[d.name],z=q.forages;B.close();for(var K=0;K<z.length;K++){var J=z[K];J._dbInfo.db=null}var ae=new f(function(ye,xe){var Ie=l.deleteDatabase(d.name);Ie.onerror=function(){var Oe=Ie.result;Oe&&Oe.close(),xe(Ie.error)},Ie.onblocked=function(){},Ie.onsuccess=function(){var Oe=Ie.result;Oe&&Oe.close(),ye(Oe)}});return ae.then(function(ye){q.db=ye;for(var xe=0;xe<z.length;xe++){var Ie=z[xe];X(Ie._dbInfo)}}).catch(function(ye){throw(Ce(d,ye)||f.resolve()).catch(function(){}),ye})})}return m(C,x),C}var k={_driver:"asyncStorage",_initStorage:Xi,_support:c(),iterate:ta,getItem:ea,setItem:_n,removeItem:Gn,clear:Rr,length:Zi,key:xn,keys:vf,dropInstance:_};function A(){return typeof openDatabase=="function"}var L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",M="~~local_forage_type~",j=/^~~local_forage_type~([^~]+)~/,G="__lfsc__:",V=G.length,W="arbf",U="blob",ee="si08",Q="ui08",Z="uic8",re="si16",ce="si32",_e="ur16",he="ui32",Be="fl32",Ue="fl64",ct=V+W.length,ut=Object.prototype.toString;function sn(d){var x=d.length*.75,g=d.length,P,C=0,E,R,B,q;d[d.length-1]==="="&&(x--,d[d.length-2]==="="&&x--);var z=new ArrayBuffer(x),K=new Uint8Array(z);for(P=0;P<g;P+=4)E=L.indexOf(d[P]),R=L.indexOf(d[P+1]),B=L.indexOf(d[P+2]),q=L.indexOf(d[P+3]),K[C++]=E<<2|R>>4,K[C++]=(R&15)<<4|B>>2,K[C++]=(B&3)<<6|q&63;return z}function Qn(d){var x=new Uint8Array(d),g="",P;for(P=0;P<x.length;P+=3)g+=L[x[P]>>2],g+=L[(x[P]&3)<<4|x[P+1]>>4],g+=L[(x[P+1]&15)<<2|x[P+2]>>6],g+=L[x[P+2]&63];return x.length%3===2?g=g.substring(0,g.length-1)+"=":x.length%3===1&&(g=g.substring(0,g.length-2)+"=="),g}function Qe(d,x){var g="";if(d&&(g=ut.call(d)),d&&(g==="[object ArrayBuffer]"||d.buffer&&ut.call(d.buffer)==="[object ArrayBuffer]")){var P,C=G;d instanceof ArrayBuffer?(P=d,C+=W):(P=d.buffer,g==="[object Int8Array]"?C+=ee:g==="[object Uint8Array]"?C+=Q:g==="[object Uint8ClampedArray]"?C+=Z:g==="[object Int16Array]"?C+=re:g==="[object Uint16Array]"?C+=_e:g==="[object Int32Array]"?C+=ce:g==="[object Uint32Array]"?C+=he:g==="[object Float32Array]"?C+=Be:g==="[object Float64Array]"?C+=Ue:x(new Error("Failed to get type for BinaryArray"))),x(C+Qn(P))}else if(g==="[object Blob]"){var E=new FileReader;E.onload=function(){var R=M+d.type+"~"+Qn(this.result);x(G+U+R)},E.readAsArrayBuffer(d)}else try{x(JSON.stringify(d))}catch(R){x(null,R)}}function pt(d){if(d.substring(0,V)!==G)return JSON.parse(d);var x=d.substring(ct),g=d.substring(V,ct),P;if(g===U&&j.test(x)){var C=x.match(j);P=C[1],x=x.substring(C[0].length)}var E=sn(x);switch(g){case W:return E;case U:return u([E],{type:P});case ee:return new Int8Array(E);case Q:return new Uint8Array(E);case Z:return new Uint8ClampedArray(E);case re:return new Int16Array(E);case _e:return new Uint16Array(E);case ce:return new Int32Array(E);case he:return new Uint32Array(E);case Be:return new Float32Array(E);case Ue:return new Float64Array(E);default:throw new Error("Unkown type: "+g)}}var Jn={serialize:Qe,deserialize:pt,stringToBuffer:sn,bufferToString:Qn};function Dr(d,x,g,P){d.executeSql("CREATE TABLE IF NOT EXISTS "+x.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],g,P)}function Ry(d){var x=this,g={db:null};if(d)for(var P in d)g[P]=typeof d[P]!="string"?d[P].toString():d[P];var C=new f(function(E,R){try{g.db=openDatabase(g.name,String(g.version),g.description,g.size)}catch(B){return R(B)}g.db.transaction(function(B){Dr(B,g,function(){x._dbInfo=g,E()},function(q,z){R(z)})},R)});return g.serializer=Jn,C}function on(d,x,g,P,C,E){d.executeSql(g,P,C,function(R,B){B.code===B.SYNTAX_ERR?R.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[x.storeName],function(q,z){z.rows.length?E(q,B):Dr(q,x,function(){q.executeSql(g,P,C,E)},E)},E):E(R,B)},E)}function Dy(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){var R=g._dbInfo;R.db.transaction(function(B){on(B,R,"SELECT * FROM "+R.storeName+" WHERE key = ? LIMIT 1",[d],function(q,z){var K=z.rows.length?z.rows.item(0).value:null;K&&(K=R.serializer.deserialize(K)),C(K)},function(q,z){E(z)})})}).catch(E)});return m(P,x),P}function Ly(d,x){var g=this,P=new f(function(C,E){g.ready().then(function(){var R=g._dbInfo;R.db.transaction(function(B){on(B,R,"SELECT * FROM "+R.storeName,[],function(q,z){for(var K=z.rows,J=K.length,ae=0;ae<J;ae++){var ye=K.item(ae),xe=ye.value;if(xe&&(xe=R.serializer.deserialize(xe)),xe=d(xe,ye.key,ae+1),xe!==void 0){C(xe);return}}C()},function(q,z){E(z)})})}).catch(E)});return m(P,x),P}function yf(d,x,g,P){var C=this;d=b(d);var E=new f(function(R,B){C.ready().then(function(){x===void 0&&(x=null);var q=x,z=C._dbInfo;z.serializer.serialize(x,function(K,J){J?B(J):z.db.transaction(function(ae){on(ae,z,"INSERT OR REPLACE INTO "+z.storeName+" (key, value) VALUES (?, ?)",[d,K],function(){R(q)},function(ye,xe){B(xe)})},function(ae){if(ae.code===ae.QUOTA_ERR){if(P>0){R(yf.apply(C,[d,q,g,P-1]));return}B(ae)}})})}).catch(B)});return m(E,g),E}function My(d,x,g){return yf.apply(this,[d,x,g,1])}function jy(d,x){var g=this;d=b(d);var P=new f(function(C,E){g.ready().then(function(){var R=g._dbInfo;R.db.transaction(function(B){on(B,R,"DELETE FROM "+R.storeName+" WHERE key = ?",[d],function(){C()},function(q,z){E(z)})})}).catch(E)});return m(P,x),P}function Fy(d){var x=this,g=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(R){on(R,E,"DELETE FROM "+E.storeName,[],function(){P()},function(B,q){C(q)})})}).catch(C)});return m(g,d),g}function By(d){var x=this,g=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(R){on(R,E,"SELECT COUNT(key) as c FROM "+E.storeName,[],function(B,q){var z=q.rows.item(0).c;P(z)},function(B,q){C(q)})})}).catch(C)});return m(g,d),g}function Uy(d,x){var g=this,P=new f(function(C,E){g.ready().then(function(){var R=g._dbInfo;R.db.transaction(function(B){on(B,R,"SELECT key FROM "+R.storeName+" WHERE id = ? LIMIT 1",[d+1],function(q,z){var K=z.rows.length?z.rows.item(0).key:null;C(K)},function(q,z){E(z)})})}).catch(E)});return m(P,x),P}function qy(d){var x=this,g=new f(function(P,C){x.ready().then(function(){var E=x._dbInfo;E.db.transaction(function(R){on(R,E,"SELECT key FROM "+E.storeName,[],function(B,q){for(var z=[],K=0;K<q.rows.length;K++)z.push(q.rows.item(K).key);P(z)},function(B,q){C(q)})})}).catch(C)});return m(g,d),g}function zy(d){return new f(function(x,g){d.transaction(function(P){P.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(C,E){for(var R=[],B=0;B<E.rows.length;B++)R.push(E.rows.item(B).name);x({db:d,storeNames:R})},function(C,E){g(E)})},function(P){g(P)})})}function Hy(d,x){x=I.apply(this,arguments);var g=this.config();d=typeof d!="function"&&d||{},d.name||(d.name=d.name||g.name,d.storeName=d.storeName||g.storeName);var P=this,C;return d.name?C=new f(function(E){var R;d.name===g.name?R=P._dbInfo.db:R=openDatabase(d.name,"","",0),d.storeName?E({db:R,storeNames:[d.storeName]}):E(zy(R))}).then(function(E){return new f(function(R,B){E.db.transaction(function(q){function z(ye){return new f(function(xe,Ie){q.executeSql("DROP TABLE IF EXISTS "+ye,[],function(){xe()},function(Oe,mt){Ie(mt)})})}for(var K=[],J=0,ae=E.storeNames.length;J<ae;J++)K.push(z(E.storeNames[J]));f.all(K).then(function(){R()}).catch(function(ye){B(ye)})},function(q){B(q)})})}):C=f.reject("Invalid arguments"),m(C,x),C}var Wy={_driver:"webSQLStorage",_initStorage:Ry,_support:A(),iterate:Ly,getItem:Dy,setItem:My,removeItem:jy,clear:Fy,length:By,key:Uy,keys:qy,dropInstance:Hy};function Ky(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch{return!1}}function bf(d,x){var g=d.name+"/";return d.storeName!==x.storeName&&(g+=d.storeName+"/"),g}function Vy(){var d="_localforage_support_test";try{return localStorage.setItem(d,!0),localStorage.removeItem(d),!1}catch{return!0}}function Yy(){return!Vy()||localStorage.length>0}function Gy(d){var x=this,g={};if(d)for(var P in d)g[P]=d[P];return g.keyPrefix=bf(d,x._defaultConfig),Yy()?(x._dbInfo=g,g.serializer=Jn,f.resolve()):f.reject()}function Qy(d){var x=this,g=x.ready().then(function(){for(var P=x._dbInfo.keyPrefix,C=localStorage.length-1;C>=0;C--){var E=localStorage.key(C);E.indexOf(P)===0&&localStorage.removeItem(E)}});return m(g,d),g}function Jy(d,x){var g=this;d=b(d);var P=g.ready().then(function(){var C=g._dbInfo,E=localStorage.getItem(C.keyPrefix+d);return E&&(E=C.serializer.deserialize(E)),E});return m(P,x),P}function Xy(d,x){var g=this,P=g.ready().then(function(){for(var C=g._dbInfo,E=C.keyPrefix,R=E.length,B=localStorage.length,q=1,z=0;z<B;z++){var K=localStorage.key(z);if(K.indexOf(E)===0){var J=localStorage.getItem(K);if(J&&(J=C.serializer.deserialize(J)),J=d(J,K.substring(R),q++),J!==void 0)return J}}});return m(P,x),P}function Zy(d,x){var g=this,P=g.ready().then(function(){var C=g._dbInfo,E;try{E=localStorage.key(d)}catch{E=null}return E&&(E=E.substring(C.keyPrefix.length)),E});return m(P,x),P}function eb(d){var x=this,g=x.ready().then(function(){for(var P=x._dbInfo,C=localStorage.length,E=[],R=0;R<C;R++){var B=localStorage.key(R);B.indexOf(P.keyPrefix)===0&&E.push(B.substring(P.keyPrefix.length))}return E});return m(g,d),g}function tb(d){var x=this,g=x.keys().then(function(P){return P.length});return m(g,d),g}function nb(d,x){var g=this;d=b(d);var P=g.ready().then(function(){var C=g._dbInfo;localStorage.removeItem(C.keyPrefix+d)});return m(P,x),P}function rb(d,x,g){var P=this;d=b(d);var C=P.ready().then(function(){x===void 0&&(x=null);var E=x;return new f(function(R,B){var q=P._dbInfo;q.serializer.serialize(x,function(z,K){if(K)B(K);else try{localStorage.setItem(q.keyPrefix+d,z),R(E)}catch(J){(J.name==="QuotaExceededError"||J.name==="NS_ERROR_DOM_QUOTA_REACHED")&&B(J),B(J)}})})});return m(C,g),C}function ib(d,x){if(x=I.apply(this,arguments),d=typeof d!="function"&&d||{},!d.name){var g=this.config();d.name=d.name||g.name,d.storeName=d.storeName||g.storeName}var P=this,C;return d.name?C=new f(function(E){d.storeName?E(bf(d,P._defaultConfig)):E(d.name+"/")}).then(function(E){for(var R=localStorage.length-1;R>=0;R--){var B=localStorage.key(R);B.indexOf(E)===0&&localStorage.removeItem(B)}}):C=f.reject("Invalid arguments"),m(C,x),C}var sb={_driver:"localStorageWrapper",_initStorage:Gy,_support:Ky(),iterate:Xy,getItem:Jy,setItem:rb,removeItem:nb,clear:Qy,length:tb,key:Zy,keys:eb,dropInstance:ib},ob=function(x,g){return x===g||typeof x=="number"&&typeof g=="number"&&isNaN(x)&&isNaN(g)},ab=function(x,g){for(var P=x.length,C=0;C<P;){if(ob(x[C],g))return!0;C++}return!1},wf=Array.isArray||function(d){return Object.prototype.toString.call(d)==="[object Array]"},Lr={},_f={},Xn={INDEXEDDB:k,WEBSQL:Wy,LOCALSTORAGE:sb},lb=[Xn.INDEXEDDB._driver,Xn.WEBSQL._driver,Xn.LOCALSTORAGE._driver],es=["dropInstance"],na=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(es),cb={description:"",driver:lb.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function ub(d,x){d[x]=function(){var g=arguments;return d.ready().then(function(){return d[x].apply(d,g)})}}function ra(){for(var d=1;d<arguments.length;d++){var x=arguments[d];if(x)for(var g in x)x.hasOwnProperty(g)&&(wf(x[g])?arguments[0][g]=x[g].slice():arguments[0][g]=x[g])}return arguments[0]}var fb=function(){function d(x){o(this,d);for(var g in Xn)if(Xn.hasOwnProperty(g)){var P=Xn[g],C=P._driver;this[g]=C,Lr[C]||this.defineDriver(P)}this._defaultConfig=ra({},cb),this._config=ra({},this._defaultConfig,x),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return d.prototype.config=function(g){if((typeof g>"u"?"undefined":s(g))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var P in g){if(P==="storeName"&&(g[P]=g[P].replace(/\W/g,"_")),P==="version"&&typeof g[P]!="number")return new Error("Database version must be a number.");this._config[P]=g[P]}return"driver"in g&&g.driver?this.setDriver(this._config.driver):!0}else return typeof g=="string"?this._config[g]:this._config},d.prototype.defineDriver=function(g,P,C){var E=new f(function(R,B){try{var q=g._driver,z=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!g._driver){B(z);return}for(var K=na.concat("_initStorage"),J=0,ae=K.length;J<ae;J++){var ye=K[J],xe=!ab(es,ye);if((xe||g[ye])&&typeof g[ye]!="function"){B(z);return}}var Ie=function(){for(var Mr=function(pb){return function(){var mb=new Error("Method "+pb+" is not implemented by the current driver"),xf=f.reject(mb);return m(xf,arguments[arguments.length-1]),xf}},ia=0,hb=es.length;ia<hb;ia++){var sa=es[ia];g[sa]||(g[sa]=Mr(sa))}};Ie();var Oe=function(Mr){Lr[q],Lr[q]=g,_f[q]=Mr,R()};"_support"in g?g._support&&typeof g._support=="function"?g._support().then(Oe,B):Oe(!!g._support):Oe(!0)}catch(mt){B(mt)}});return y(E,P,C),E},d.prototype.driver=function(){return this._driver||null},d.prototype.getDriver=function(g,P,C){var E=Lr[g]?f.resolve(Lr[g]):f.reject(new Error("Driver not found."));return y(E,P,C),E},d.prototype.getSerializer=function(g){var P=f.resolve(Jn);return y(P,g),P},d.prototype.ready=function(g){var P=this,C=P._driverSet.then(function(){return P._ready===null&&(P._ready=P._initDriver()),P._ready});return y(C,g,g),C},d.prototype.setDriver=function(g,P,C){var E=this;wf(g)||(g=[g]);var R=this._getSupportedDrivers(g);function B(){E._config.driver=E.driver()}function q(J){return E._extend(J),B(),E._ready=E._initStorage(E._config),E._ready}function z(J){return function(){var ae=0;function ye(){for(;ae<J.length;){var xe=J[ae];return ae++,E._dbInfo=null,E._ready=null,E.getDriver(xe).then(q).catch(ye)}B();var Ie=new Error("No available storage method found.");return E._driverSet=f.reject(Ie),E._driverSet}return ye()}}var K=this._driverSet!==null?this._driverSet.catch(function(){return f.resolve()}):f.resolve();return this._driverSet=K.then(function(){var J=R[0];return E._dbInfo=null,E._ready=null,E.getDriver(J).then(function(ae){E._driver=ae._driver,B(),E._wrapLibraryMethodsWithReady(),E._initDriver=z(R)})}).catch(function(){B();var J=new Error("No available storage method found.");return E._driverSet=f.reject(J),E._driverSet}),y(this._driverSet,P,C),this._driverSet},d.prototype.supports=function(g){return!!_f[g]},d.prototype._extend=function(g){ra(this,g)},d.prototype._getSupportedDrivers=function(g){for(var P=[],C=0,E=g.length;C<E;C++){var R=g[C];this.supports(R)&&P.push(R)}return P},d.prototype._wrapLibraryMethodsWithReady=function(){for(var g=0,P=na.length;g<P;g++)ub(this,na[g])},d.prototype.createInstance=function(g){return new d(g)},d}(),db=new fb;r.exports=db},{3:3}]},{},[4])(4)})}(ks)),ks.exports}var uh=ch();const Ha=lh(uh);class fh extends cn{constructor(e){super(e,"storage",!1),e.set("localforage",Ha)}get StorageManager(){return ti}createDatabse(e,n,r){return new ti("InPageEdit",e,n,r)}}const Vn=class Vn{constructor(e,n,r=Vn.DEFAULT_TTL,i){this.dbName=e,this.storeName=n,this.ttl=r,this.version=i,this.db=Vn.createDatabase(e,n),this.keys=this.db.keys.bind(this.db)}static createDatabase(e,n){const r=`${e}:${n}`;if(this._cached_db_instances.has(r))return this._cached_db_instances.get(r);const i=Ha.createInstance({name:e,storeName:n});return this._cached_db_instances.set(r,i),i}async get(e,n=this.ttl,r){const i=await this.loadFromDB(e),s=this.checkIfExpired(i,n);if(!i||s){if(typeof r=="function"){const o=await r();return this.set(e,o).then(()=>o)}return null}return i.value}async set(e,n){return n===null||typeof n>"u"?this.delete(e):this.db.setItem(e,{time:Date.now(),value:n,version:this.version})}async has(e,n=this.ttl){const r=await this.loadFromDB(e),i=this.checkIfExpired(r,n);return r!==null&&!i}async delete(e){return this.db.removeItem(e)}async iterate(e){return await this.db.iterate((n,r)=>{e(n.value,r)})}async loadFromDB(e){const n=await this.db.getItem(e);if(!n)return null;if(typeof n.time!="number"||typeof n.value>"u"){try{this.delete(e)}catch{}return null}if(typeof this.version=="number"&&n.version!==this.version){try{this.delete(e)}catch{}return null}return n}checkIfExpired(e,n=this.ttl){return e?Date.now()-e.time>n:!1}async clear(){return await this.db.clear(),this}};Vn.DEFAULT_TTL=1/0,Vn._cached_db_instances=new Map;let ti=Vn;var vt=(t=>(t.preferences="preferences",t.watch="watch",t.unwatch="unwatch",t.nochange="nochange",t))(vt||{});function dh(t){const n=class n{constructor(i,s=!0){this._loaded=s,this.api=t,i.revisions?.forEach(o=>{typeof o?.slots?.main=="object"&&Object.assign(o,o.slots.main)}),this.pageInfo={...n.DEFAULT_PAGE_INFO,...i}}static async newFromApi(i){const{data:s}=await this.api.get({...n.DEFAULT_QUERY_PARAMS,...i}),o=s?.query?.pages?.[0];if(!o)throw new Error("Invalid page info",{cause:s});return new n(o,!0)}static newBlankPage(i={}){return new n(i,!1)}async parse(i){return this.api.post({action:"parse",page:this.pageInfo.title,prop:"text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties|parsewarnings",...i})}async preview(i,s){return this.parse({action:"parse",page:void 0,title:this.title,text:i,pst:1,preview:1,disableeditsection:1,disablelimitreport:1,...s})}async edit(i,s){const{text:o,prependtext:a,appendtext:l,summary:c="",watchlist:u=vt.preferences,section:f}=i;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(i,s){return this.edit(i,{createonly:1,...s})}async delete(i,s){return this.api.postWithEditToken({action:"delete",pageid:this.pageInfo.pageid,reason:i,...s})}async moveTo(i,s,o){return this.api.postWithEditToken({action:"move",from:this.pageInfo.title,to:i,reason:s,movetalk:1,movesubpages:1,...o})}userCan(i){return!!this.pageInfo?.actions?.[i]}userCanEdit(){return this.userCan("edit")}async reloadSelfInfo(){const i=await n.newFromApi({pageids:this.pageInfo.pageid,titles:this.pageInfo.title}),s=(this.pageInfo.revisions||[]).concat(i.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=i.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||[]}};n.api=t,n.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"},n.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=n;return e}const Jo=class Jo extends cn{constructor(e){super(e,"wikiPage",!0),this.ctx=e,this.logger=this.ctx.logger("WIKI_PAGE"),this.WikiPage=dh(this.ctx.api)}async createInstance(e,n=!1){return await this.WikiPage.newFromApi(e)}async newFromTitle(e,n=!1,r,i=!1){return this.createInstance({titles:e,converttitles:n,rvsection:r},i)}async newFromPageId(e,n,r=!1){return this.createInstance({pageids:e,rvsection:n},r)}async newFromRevision(e,n,r=!1){return await this.createInstance({revids:e,rvsection:n},r)}newBlankPage(e={}){return this.WikiPage.newBlankPage(e)}};Jo.inject=["api"];let Ps=Jo;const Wa=new WeakMap,St={toDBKey:t=>t.replace(/ /g,"_"),toNormalText:t=>t.replace(/_/g," "),ensureCase:(t,e)=>e==="first-letter"?t.charAt(0).toUpperCase()+t.slice(1):t},kn={normalizeSpecialPageName:t=>t.toLowerCase(),buildSpecialPageIndex:t=>{const e=new Map,n=new Map,r=new Map;for(const i of t.specialpagealiases){const s=i.realname;e.set(s,s);const o=kn.normalizeSpecialPageName(s);r.set(o,s);for(const a of i.aliases){n.set(a,s);const l=kn.normalizeSpecialPageName(a);r.set(l,s)}}return{byRealName:e,byAlias:n,byNormalized:r}},findSpecialPageRealName:(t,e)=>{const n=t.split("/")[0];let r=e.byRealName.get(n)??e.byAlias.get(n);if(r!==void 0)return r;const i=kn.normalizeSpecialPageName(n);return e.byNormalized.get(i)??null}},Et={normalizeNamespaceText:t=>t.replace(/[_\s]+/g,"_").toLowerCase().replace(/^_+|_+$/g,""),buildIndex:t=>{const e=new Map,n=new Map,r=new Map,i=new Map;for(const[s,o]of Object.entries(t.namespaces)){const a=parseInt(s);e.set(o.name,a),n.set(o.canonical??"",a);const l=Et.normalizeNamespaceText(o.name),c=Et.normalizeNamespaceText(o.canonical??"");i.set(l,a),i.set(c,a)}for(const s of t.namespacealiases){r.set(s.alias,s.id);const o=Et.normalizeNamespaceText(s.alias);i.set(o,s.id)}return{byName:e,byCanonical:n,byAlias:r,byNormalized:i}},findNamespaceId:(t,e)=>{let n=e.byName.get(t)??e.byCanonical.get(t)??e.byAlias.get(t);if(n!==void 0)return n;const r=Et.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 hh(t){var s,o;const e=Wa.get(t);if(e)return e;const n=Et.buildIndex(t),r=kn.buildSpecialPageIndex(t),a=class a{constructor(c,u){jr(this,s);jr(this,o);this.newTitle=a.create.bind(a),this.toText=this.getPrefixedText.bind(this),this.toString=this.getPrefixedDBKey.bind(this),gt(this,s,c||""),gt(this,o,u??0),u===void 0&&this.fixNSByTitle()}static create(c,u){return new a(c,u)}fixNSByTitle(){const c=me(this,s).indexOf(":");if(c===-1)return;if(c===0){gt(this,s,me(this,s).substring(1));return}const u=me(this,s).substring(0,c),f=me(this,s).substring(c+1),m=Et.findNamespaceId(u,a._namespaceIndex);m!==null&&(gt(this,s,f),gt(this,o,m))}getNamespaceInfo(){return a._meta.namespaces[me(this,o)]??Et.getDefaultNamespaceInfo(me(this,o))}getMainDBKey(){const c=this.getNamespaceInfo();if(me(this,o)===-1){const u=kn.findSpecialPageRealName(me(this,s),a._specialPageIndex);if(u){const f=me(this,s).includes("/")?me(this,s).substring(me(this,s).indexOf("/")):"",m=u+f;return St.ensureCase(St.toDBKey(m),c.case)}}return St.ensureCase(St.toDBKey(me(this,s)),c.case)}getMainText(){const c=this.getNamespaceInfo();if(me(this,o)===-1){const u=kn.findSpecialPageRealName(me(this,s),a._specialPageIndex);if(u){const f=me(this,s).includes("/")?me(this,s).substring(me(this,s).indexOf("/")):"",m=u+f;return St.ensureCase(St.toNormalText(m),c.case)}}return St.ensureCase(St.toNormalText(me(this,s)),c.case)}getMainRootText(){return this.getMainText().split("/")[0]}getPrefixedDBKey(){return me(this,o)===0?this.getMainDBKey():`${this.getNamespaceDBKey()}:${this.getMainDBKey()}`}getPrefixedText(){return me(this,o)===0?this.getMainText():`${this.getNamespaceText()}:${this.getMainText()}`}getNamespaceId(){return me(this,o)}getNamespaceText(){return this.getNamespaceInfo().name??""}getNamespaceDBKey(){const c=this.getNamespaceInfo();return St.ensureCase(St.toDBKey(this.getNamespaceText()),c.case)}getSubjectPage(){if(Et.isTalkPage(me(this,o))){const c=me(this,o)-1;return new a(me(this,s),c)}return this}getTalkPage(){if(Et.isTalkPage(me(this,o)))return this;if(me(this,o)<0)return null;const c=me(this,o)+1;return a._meta.namespaces[c.toString()]?new a(me(this,s),c):null}getURL(c){const u=a._meta.general.articlepath,f=this.getPrefixedDBKey(),m=u.replace("$1",f),y=new URL(m,a._meta.general.base);return c&&(c instanceof URLSearchParams?c:new URLSearchParams(c)).forEach((I,F)=>{y.searchParams.set(F,I)}),y}setTitle(c){return gt(this,s,c),gt(this,o,0),this.fixNSByTitle(),this}setMainText(c){return gt(this,s,c),this}setNamespaceText(c){const u=Et.findNamespaceId(c,a._namespaceIndex);return u!==null&>(this,o,u),this}setNamespaceId(c){return gt(this,o,c),this}equals(c){return typeof c=="string"&&(c=new a(c)),this.getPrefixedDBKey()===c.getPrefixedDBKey()}isSpecial(c){if(me(this,o)!==-1)return!1;const u=new a(c,-1);return this.getMainRootText()===u.getMainRootText()}};s=new WeakMap,o=new WeakMap,a._meta=t,a._namespaceIndex=n,a._specialPageIndex=r;let i=a;return Wa.set(t,i),i}const Ir=class Ir extends cn{constructor(e){super(e,"wikiTitle",!0),this.ctx=e,this.logger=this.ctx.logger("WikiTitleService"),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=hh(this.ctx.wiki._raw)}newTitle(e,n){return new this.Title(e,n)}newTitleFromUrl(e){return this.parseWikiLink(e)?.title||null}get currentIsMainPage(){let e=!1;const n=window?.location?.origin+window?.location?.pathname;let r=new URLSearchParams(window?.location?.search||"").get("title");return r&&(r=r[0].toUpperCase()+r.slice(1),r=r.replace(/_/g," ")),n===this.wiki.getSciprtUrl("index.php")&&this.wiki.mainPageName,e=[this.wiki.mainPageUrl,this.wiki.landingPageUrl].includes(n),Reflect.defineProperty(this,"currentIsMainPage",{value:e,writable:!1,configurable:!1,enumerable:!0}),e}get currentTitle(){const e=this.currentIsMainPage?this.newTitle(this.wiki.mainPageName):this.newTitleFromUrl(window?.location?.href);return e?(Object.freeze(e),Reflect.defineProperty(this,"currentTitle",{value:e,writable:!1,configurable:!1,enumerable:!0}),e):this.newTitle(this.wiki.mainPageName)}get currentAction(){const n=new URLSearchParams(window?.location?.search||"").get("action")||"view";return Reflect.defineProperty(this,"currentAction",{value:()=>n,writable:!1,configurable:!1,enumerable:!0}),n}isWikiLink(e){return e.startsWith(this.wikiArticleBaseUrl)||e.startsWith(this.wikiIndexPhpUrl)}validateHrefAttr(e){return typeof e!="string"?!1:!Ir.REG_SKIPPED_HREF.test(e)}parseWikiLink(e){if(!e||typeof e=="string"&&!this.validateHrefAttr(e))return null;const n=Ma(e);if(!this.isWikiLink(n.toString()))return null;const r=n.searchParams,i=n.hash.replace("#",""),s=r.get("action")||"view",o=n.pathname.endsWith(".php")?r.get("title"):(()=>{try{return decodeURI(n.pathname.substring(this.wikiArticlePath.length))}catch(a){return this.logger.error("parseLink",n,a),null}})();return o?{url:n,params:r,hash:i,action:s,title:this.newTitle(o)}:null}};Ir.inject=["wiki"],Ir.REG_SKIPPED_HREF=/^(#|javascript:|vbscript:|file:)/i;let $s=Ir;var Cs=(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))(Cs||{});/**
|
|
53
53
|
* ✏️ InPageEdit NEXT
|
|
54
54
|
*
|
|
55
55
|
* 🚀 Modular, Extensible Supercharged Plugin for MediaWiki
|
|
@@ -58,53 +58,53 @@
|
|
|
58
58
|
* @license MIT
|
|
59
59
|
* @see https://github.com/inpageedit/inpageedit-next
|
|
60
60
|
* @see https://www.ipe.wiki/
|
|
61
|
-
*/const
|
|
61
|
+
*/const Ar=class Ar extends Je{constructor(n){super({name:"InPageEdit"});jr(this,Rt);this.version="0.8.0",this.Endpoints=Cs,this.schema=fe,this.config={...Ar.DEFAULT_CONFIG,...n},this.logger=xa({name:"IPE",color:"#33aaff",level:this.config.logLevel}),Fr(this,Rt,kf).call(this),Fr(this,Rt,$f).call(this),Fr(this,Rt,Cf).call(this)}async useScope(n){const{promise:r,resolve:i}=be();return this.inject(n,s=>{i(s)}),r}};Rt=new WeakSet,kf=async function(){this.plugin(Sd,this.config.apiConfigs),this.plugin(Ed),this.plugin(Jd),this.plugin(fh),this.plugin(Xr),this.plugin(Ps),this.plugin($s),Fr(this,Rt,Pf).call(this,["api","resourceLoader","modal","storage","wikiPage","wikiTitle","wiki","getUrl","getSciprtUrl","getMainpageUrl"])},Pf=function(n){if(typeof n=="string"&&(n=[n]),!Array.isArray(n)||n.length===0)return this;for(const r of n){const i=this[Ar.internal][r];i?.type==="service"&&(i.builtin=!0)}return this},$f=async function(){[Promise.resolve().then(()=>Ch).then(({PluginInArticleLinks:r})=>r),Promise.resolve().then(()=>zh).then(({PluginPreferences:r})=>r),Promise.resolve().then(()=>rp).then(({PluginQuickEdit:r})=>r),Promise.resolve().then(()=>pp).then(({PluginQuickDelete:r})=>r),Promise.resolve().then(()=>kp).then(({PluginQuickMove:r})=>r),Promise.resolve().then(()=>Lp).then(({PluginQuickPreview:r})=>r),Promise.resolve().then(()=>Pm).then(({PluginQuickDiff:r})=>r),Promise.resolve().then(()=>$m).then(({PluginQuickRedirect:r})=>r),Promise.resolve().then(()=>jm).then(({PluginToolbox:r})=>r)].forEach(async r=>{this.plugin(await r)})},Cf=async function(){this.inject(["resourceLoader"],n=>{})},Ar.DEFAULT_CONFIG={apiConfigs:{},legacyPreferences:{},logLevel:fs.info,autoloadStyles:!0};let dn=Ar;function ph(t){return t.charAt(0).toLowerCase()+t.slice(1)}function mh(t){return ph(t).replace(/-/g,"_").replace(/.[A-Z]+/g,e=>e[0]+"_"+e.slice(1).toLowerCase())}const Qi=class Qi{constructor(e,n=void 0,r){jr(this,Nr);this.ctx=e,this.disposeHandlers=[],this.name=r||this.constructor.name,this.config=n||{};const{promise:i,resolve:s,reject:o}=Promise.withResolvers();queueMicrotask(()=>{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)}i.then(()=>{this.logger.debug("started")}),i.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(n=>n!==e)}set name(e){gt(this,Nr,mh(e).toUpperCase())}get name(){return me(this,Nr)}get logger(){return this.ctx.logger(this.name)}};Nr=new WeakMap,Qi.inject=[],Qi.reusable=!1;let it=Qi;window.RLQ||(window.RLQ=[]),window.__IPE_MODULES__||(window.__IPE_MODULES__=[]),vh("InPageEdit#autoload",()=>{window.RLQ.push(gh)});async function gh(){typeof window?.ipe?.stop=="function"&&await window.ipe.stop();const t=window.InPageEdit||{},e=new dn({apiConfigs:{baseURL:window.mw?.util.wikiScript("api")},legacyPreferences:t?.myPreferences||{}});if(window.InPageEdit=dn,window.ipe=e,await e.start(),typeof window?.mw?.hook=="function"&&window.mw.hook("InPageEdit.ready").fire(e),Array.isArray(window.__IPE_MODULES__)){const n=[];for(;window.__IPE_MODULES__.length;)try{const r=window.__IPE_MODULES__.shift();typeof r=="function"&&r?.(e),n.push(r)}catch{}window.__IPE_MODULES__={push:r=>{typeof r=="function"&&r(e),n.push(r)}},e.on("dispose",()=>{window.__IPE_MODULES__=n})}e.logger("AUTOLOAD").info(`${Cs.HOME_URL}
|
|
62
62
|
____ ____ ______ ___ __
|
|
63
63
|
/ _/___ / __ \\____ _____ ____ / ____/___/ (_) /_
|
|
64
64
|
/ // __ \\/ /_/ / __ \`/ __ \`/ _ \\/ __/ / __ / / __/
|
|
65
65
|
_/ // / / / ____/ /_/ / /_/ / __/ /___/ /_/ / / /_
|
|
66
66
|
/___/_/ /_/_/ \\__,_/\\__, /\\___/_____/\\__,_/_/\\__/
|
|
67
|
-
/____/ v`+e.version)}function uh(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}var fh=Object.create,$s=Object.defineProperty,dh=Object.getOwnPropertyDescriptor,Ha=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),qa=t=>{throw TypeError(t)},hh=(t,e,n)=>e in t?$s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ph=(t,e)=>$s(t,"name",{value:e,configurable:!0}),mh=t=>[,,,fh(t?.[Ha("metadata")]??null)],gh=["class","method","getter","setter","accessor","field","value","get","set"],Wa=t=>t!==void 0&&typeof t!="function"?qa("Function expected"):t,vh=(t,e,n,r,i)=>({kind:gh[t],name:e,metadata:r,addInitializer:s=>n._?qa("Already initialized"):i.push(Wa(s||null))}),yh=(t,e)=>hh(e,Ha("metadata"),t[3]),bh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},_h=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&dh(i,n));ph(i,n);for(var b=r.length-1;b>=0;b--)l=vh(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,Wa(o)&&(i=o);return yh(t,i),y&&$s(i,n,y),c?u^4?s:y:i},Va,Cs,Ka;Va=[qe(["sitemeta","wikiTitle"])];class Xr extends(Ka=rt){constructor(e){const n=e.sitemeta.mwConfig,r=n.get("wgArticlePath","").replace("$1",""),i=`${location.protocol}//${n.get("wgServer","").split("//")[1]}`;super(e,{wikiBaseUrl:i,wikiArticlePath:r,wikiArticleBaseUrl:`${i}${r}`,wikiScriptBaseUrl:`${i}${n.get("wgScriptPath","")}`,linkClassName:"ipe__in-article-link"},"InArticleLinks"),this._cachedAnchorInfo=new WeakMap,this.ctx.set("inArticleLinks",this)}async start(){this.handleQuickEdit(),this.handleQuickDiff()}async stop(){}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const n=this._cachedAnchorInfo.get(e);if(n)return n;const r=e.href||"",i=this.parseLink(r);if(!i)return null;const s={$el:e,kind:e.closest('[typeof^="mw:File"]')?"mw:File":"normal",external:e.classList.contains("external")||!!e.getAttribute("href")?.startsWith("http"),redlink:e.classList.contains("new")||i.params.has("redlink"),...i};return this._cachedAnchorInfo.set(e,s),s}parseLink(e){if(!e)return null;const n=typeof e=="string"?new URL(e,location.origin):e,r=n.searchParams,i=n.hash.replace("#",""),s=r.get("action")||"view",o=r.get("title")||decodeURI(n.pathname.substring(this.config.wikiArticlePath.length))||"";return!o||o.endsWith(".php")?null:{url:n,params:r,hash:i,action:s,title:this.ctx.wikiTitle.create(o)}}scanAnchors(e){const n=e.querySelectorAll("a[href]");return Array.from(n).map(r=>this.parseAnchor(r)).filter(r=>r!==null)}handleQuickEdit(){let e=!1;this.ctx.inject(["quickEdit"],n=>{e=!0,n.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(r=>{if(!e)return;this.scanAnchors(r.get(0)).filter(({action:s,title:o})=>["edit","create"].includes(s)||o.isSpecial("edit")).forEach(({$el:s,title:o,params:a})=>{if(s.dataset.ipeEditMounted)return;s.dataset.ipeEditMounted="1";const l=o.getNamespaceId()===-1?o.getMainDBKey().split("/").slice(1).join("/"):o.getPrefixedDBKey(),u=a.get("section")?.replace(/^T-/,"")||void 0,c=a.get("oldid"),f=a.has("redlink");let v;u==="new"?v="new":u&&/^\d+$/.test(u)&&(v=parseInt(u,10));const y=c?parseInt(c,10):void 0,b={title:l,section:v,revision:y,createOnly:f},I=_("a",{href:`#ipe://quick-edit?${new URLSearchParams(b).toString()}`,className:`${this.config.linkClassName} ipe-quick-edit ${f?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em",verticalAlign:"middle"},onClick:U=>{U.preventDefault(),this.ctx.quickEdit.showModal(b)},children:_("svg",{style:"width: 1em; height: 1em",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-pencil-bolt",children:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),_("path",{d:"M13.5 6.5l4 4"}),_("path",{d:"M19 16l-2 3h4l-2 3"})]})});s.insertAdjacentElement("afterend",I)})})})}handleQuickDiff(){let e=!1;const n=r=>["prev","next","cur"].includes(r);this.ctx.inject(["quickDiff"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0)).filter(({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 u,c;if(a.getNamespaceId()===-1?[,u,c]=a.getMainDBKey().split("/"):(u=l.get("diff"),c=l.get("oldid")),!u||!c)return;const f={};n(u)?(f.fromrev=parseInt(c),f.torelative=u):(f.fromrev=parseInt(c),f.torev=parseInt(u)),o.addEventListener("click",v=>{v.preventDefault(),r.quickDiff.comparePages(f,void 0,{backdrop:!0,draggable:!1,center:!1})})})})})}}Cs=mh(Ka),Xr=_h(Cs,0,"PluginInArticleLinks",Va,Xr),bh(Cs,1,Xr);const wh=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return Xr}},Symbol.toStringTag,{value:"Module"})),xh=t=>typeof t=="function";async function Sh(t){return xh(t)?await t():t}const Eh=window?.location?.origin,kh=({type:t,tag:e,href:n,target:r,children:i,...s})=>(e=e||(n?"a":"button"),typeof r>"u"&&n&&n.startsWith("http")&&!n.startsWith(Eh)&&(r="_blank"),Md(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?n:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?n:void 0,...s},i));var $h=Object.create,Ps=Object.defineProperty,Ch=Object.getOwnPropertyDescriptor,Ya=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ga=t=>{throw TypeError(t)},Ph=(t,e,n)=>e in t?Ps(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Oh=(t,e)=>Ps(t,"name",{value:e,configurable:!0}),Ih=t=>[,,,$h(t?.[Ya("metadata")]??null)],Th=["class","method","getter","setter","accessor","field","value","get","set"],Ja=t=>t!==void 0&&typeof t!="function"?Ga("Function expected"):t,Ah=(t,e,n,r,i)=>({kind:Th[t],name:e,metadata:r,addInitializer:s=>n._?Ga("Already initialized"):i.push(Ja(s||null))}),Nh=(t,e)=>Ph(e,Ya("metadata"),t[3]),Rh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Dh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Ch(i,n));Oh(i,n);for(var b=r.length-1;b>=0;b--)l=Ah(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,Ja(o)&&(i=o);return Nh(t,i),y&&Ps(i,n,y),c?u^4?s:y:i},Qa,Os,Xa;Qa=[qe(["sitemeta","storage"])];class Zr extends(Xa=rt){constructor(e){super(e,{},"preferences"),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0),this.ctx.set("preferences",this)}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"}),this.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),this.registerCustomConfig("about",Se.object({about:Se.const(_("div",{className:"prose",children:[_("h2",{children:"✏️ InPageEdit NEXT"}),_("i",{children:["v",this.ctx.version]}),_("h2",{children:"Portals"}),_("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[_("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),_(kh,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),_("h2",{children:"Join us"}),_("ul",{children:[_("li",{children:[_("strong",{children:"GitHub"}),":"," ",_("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),_("li",{children:[_("strong",{children:"QQ Group"}),": 1026023666"]})]}),_("hr",{}),_("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),_("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>ky).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}async get(e,n){n??(n=()=>{const i=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${i})`),i});const r=await this.db.get(e,void 0);return r!==null?r:await Sh(n)}getDefaultValue(e){var n;return(n=this._defaultPreferences)[e]??(n[e]=this.loadDefaultConfigs()[e])}set(e,n){const r=this.getDefaultValue(e);return n===r?this.db.delete(e):this.db.set(e,n)}async getAll(){const e=this.loadDefaultConfigs();return await this.db.iterate((n,r)=>{e[r]=n}),e}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(n=>{try{const r=n.schema({});Object.entries(r).forEach(([i,s])=>{e[i]=s})}catch{}n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i})}),Object.entries(e).forEach(([n,r])=>{this._defaultPreferences[n]=r}),e}registerCustomConfig(e,n,r,i){return this.customRegistries.push({name:e,schema:n,category:r,defaults:i}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([n,r])=>n===null?{name:"@root",schema:un?.PreferencesSchema||null,defaults:un?.PreferencesDefaults||{}}:{name:n.name,schema:n?.PreferencesSchema||null,defaults:n?.PreferencesDefaults||{}}).filter(n=>n.schema!==null).map(n=>({...n,category:n.schema.meta.category||"general"})).concat(this.customRegistries).filter(n=>!e||n.category===e)}defineCategory(e){const n=this.categoryDefinitions.findIndex(r=>r.name===e.name);return n<0?this.categoryDefinitions.push(e):this.categoryDefinitions[n]=e,this.categoryDefinitions.sort((r,i)=>(r.index??0)-(i.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}Os=Ih(Xa),Zr=Dh(Os,0,"PluginPreferences",Qa,Zr),Rh(Os,1,Zr);const Lh=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return Zr}},Symbol.toStringTag,{value:"Module"})),Mh=Symbol("@@apply"),jh=Symbol("@@ctor");function Is(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const n=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};n[Mh]=n,n[jh]=t;const r=t?.constructor?.name;return r&&(n[Symbol.toStringTag]=r),new Proxy(n,{get(s,o,a){return o==="prototype"?Reflect.get(n,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)}})}function ei(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}const ti={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},rr=t=>{const{type:e="default",title:n,content:r,closeable:i=!0,titleProps:s,contentProps:o,children:a,...l}=t;let u=n;typeof n>"u"&&e!=="default"&&(u=e[0].toUpperCase()+e.slice(1).toLowerCase());const c=async()=>{if(!f)return Promise.resolve();const{promise:v,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()}),v},f=_("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${ti.mbox}`,...l,children:[u&&_("div",{className:`ipe-mbox-title ${ti.title}`,...s,children:u}),_("div",{className:`ipe-mbox-content ${ti.content}`,...o,children:a||r}),i&&_("a",{onClick:c,className:`ipe-mbox-close ${ti.close}`,children:"×"})]});return f.close=c,f},ni=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return _("div",{className:"theme-ipe ipe-input-box",...l,children:[_("label",{htmlFor:n,style:{display:"block"},...o,children:e}),_("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},Za=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return _("label",{className:"theme-ipe ipe-radio-box",...l,children:[_("input",{type:"radio",id:e,name:n,value:r,...s}),_("span",{className:"ipe-checkbox-box"}),_("span",{...o,children:i||a})]})},En=t=>{const{id:e,name:n,label:r,checked:i,inputProps:s,labelProps:o,children:a,...l}=t;return _("label",{className:"theme-ipe ipe-checkbox",...l,children:[_("input",{type:"checkbox",id:e,name:n,checked:i,...s}),_("span",{className:"ipe-checkbox-box"}),_("span",{...o,children:r||a})]})},Ts=()=>{},Fh=(t=0)=>new Promise(e=>setTimeout(e,t));var Bh=Object.create,As=Object.defineProperty,Uh=Object.getOwnPropertyDescriptor,el=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),tl=t=>{throw TypeError(t)},zh=(t,e,n)=>e in t?As(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Hh=(t,e)=>As(t,"name",{value:e,configurable:!0}),qh=t=>[,,,Bh(t?.[el("metadata")]??null)],Wh=["class","method","getter","setter","accessor","field","value","get","set"],nl=t=>t!==void 0&&typeof t!="function"?tl("Function expected"):t,Vh=(t,e,n,r,i)=>({kind:Wh[t],name:e,metadata:r,addInitializer:s=>n._?tl("Already initialized"):i.push(nl(s||null))}),Kh=(t,e)=>zh(e,el("metadata"),t[3]),Yh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Gh=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Uh(i,n));Hh(i,n);for(var b=r.length-1;b>=0;b--)l=Vh(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,nl(o)&&(i=o);return Kh(t,i),y&&As(i,n,y),c?u^4?s:y:i},rl,Ns,il;rl=[qe(["api","wikiPage","sitemeta","modal","preferences"]),ei(Se.object({editSummary:Se.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),editMinor:Se.boolean().description("Whether to mark the edit as minor").default(!1),outSideClose:Se.boolean().description("Whether to close the modal outside").default(!0),watchList:Se.union([Se.const(mt.preferences).description("Follow my preferences"),Se.const(mt.nochange).description("Keep the current watchlist status"),Se.const(mt.watch).description("Add the page to watchlist"),Se.const(mt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(mt.preferences)}).description("Quick edit options").extra("category","edit"))];class ri extends(il=rt){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",Is(this,"showModal"))}start(){this.ctx.inject(["toolbox"],e=>{this.injectToolbox(e),e.on("dispose",()=>{this.removeToolbox(e)})})}async showModal(e){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."),e={...e,title:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.get("wgRevisionId")});const n=await this.ctx.preferences.get("outSideClose"),r=await this.ctx.preferences.get("watchList"),i=typeof e.editSummary=="string"?e.editSummary:await this.ctx.preferences.get("editSummary"),s=typeof e.editMinor=="boolean"?e.editMinor:await this.ctx.preferences.get("editMinor"),o={...this.DEFAULT_OPTIONS,editSummary:i,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("editSummary")||""),o||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:n}).init();a.setTitle(_(Rt,{children:["Loading: ",_("u",{children:o.title})]})),a.setContent(_("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:_(Vt,{})})),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(v){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:v instanceof Error?v.message:String(v)});return}a.setTitle(_(Rt,{children:["Quick ",l.pageInfo.pageid===0?"Create":"Edit",":"," ",_("u",{children:l.pageInfo.title})]}));const u=[];l.pageInfo.pageid===0&&u.push(_(rr,{title:"Attention",type:"important",children:_("p",{children:"This page does not exist."})})),l.pageInfo.pageid&&l.pageInfo.lastrevid!==l.revisions[0]?.revid&&u.push(_(rr,{title:"Attention",type:"warning",children:_("p",{children:["You are editing a ",_("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:u});const c=_("form",{className:"ipe-quickEdit__form",children:[_("div",{className:"ipe-quickEdit__notices",children:u}),_("div",{className:"ipe-quickEdit__content",children:_("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:l.revisions[0]?.content||""})}),_("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[_(ni,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),_("div",{className:"ipe-input-box",children:[_("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),_("div",{style:{display:"flex",gap:"1rem"},children:[mt.preferences,mt.nochange,mt.watch,mt.unwatch].map(v=>_(Za,{name:"watchlist",value:v,inputProps:{checked:r===v},children:v},v))})]}),_("div",{style:{display:"flex",gap:"1rem"},children:[_(En,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),_(En,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(c),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",method:()=>{const v=new FormData(c);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:v.get("text"),summary:v.get("summary"),minor:v.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:Ts}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),v.get("reloadAfterSave")&&(await Fh(500),location.reload())}).catch(y=>{this.ctx.modal.notify("error",{title:"Submission Error",content:y instanceof Error?y.message:String(y)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const v=l.revisions[0]?.content||"";return(c.querySelector("textarea")?.value||"")===v?!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:Ts}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const f=v=>c.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(v.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",f),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",f)})}async handleSubmit(e){const n=e.wikiPage,r=e.summary||"",i=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return n.edit({summary:r,text:i,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")}injectToolbox(e){e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:_("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),_("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),_("path",{d:"M16 5l3 3"})]}),tooltip:"Edit this page quickly",onClick:()=>this.showModal({title:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.get("wgRevisionId")})})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}Ns=qh(il),ri=Gh(Ns,0,"PluginQuickEdit",rl,ri),Yh(Ns,1,ri);const Jh=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return ri}},Symbol.toStringTag,{value:"Module"}));var Qh=Object.create,Rs=Object.defineProperty,Xh=Object.getOwnPropertyDescriptor,sl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ol=t=>{throw TypeError(t)},Zh=(t,e,n)=>e in t?Rs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ep=(t,e)=>Rs(t,"name",{value:e,configurable:!0}),tp=t=>[,,,Qh(t?.[sl("metadata")]??null)],np=["class","method","getter","setter","accessor","field","value","get","set"],al=t=>t!==void 0&&typeof t!="function"?ol("Function expected"):t,rp=(t,e,n,r,i)=>({kind:np[t],name:e,metadata:r,addInitializer:s=>n._?ol("Already initialized"):i.push(al(s||null))}),ip=(t,e)=>Zh(e,sl("metadata"),t[3]),sp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},op=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&Xh(i,n));ep(i,n);for(var b=r.length-1;b>=0;b--)l=rp(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,al(o)&&(i=o);return ip(t,i),y&&Rs(i,n,y),c?u^4?s:y:i},ll,Ds,cl;ll=[qe(["api","wikiPage","sitemeta","modal","preferences"]),ei(Se.object({deleteReason:Se.string().description("Default delete reason for quick delete").default("[IPE-NEXT] Quick delete")}).description("Quick delete options").extra("category","delete"))];class ii extends(cl=rt){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",Is(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){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."),e={...e,title:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.get("wgRevisionId")});const n=typeof e.deleteReason=="string"?e.deleteReason:await this.ctx.preferences.get("deleteReason"),r={...this.DEFAULT_OPTIONS,deleteReason:n,...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 i=this.ctx.modal.createObject({className:"ipe-quickDelete",sizeClass:"small",center:!0}).init();i.setTitle(_(Rt,{children:["Loading: ",_("u",{children:r.title})]})),i.setContent(_(Vt,{})),i.addButton({side:"right",type:"button",className:"is-ghost",label:"Cancel",method(){i.close()}}),i.show(),this.ctx.emit("quick-delete/show-modal",{ctx:this.ctx,modal:i,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){i.off(i.Event.Close),i.close(),this.ctx.modal.notify("error",{content:l instanceof Error?l.message:String(l)});return}i.setTitle(_(Rt,{children:["Quick Delete: ",_("u",{children:s.pageInfo.title})]}));const o=[];s.userCan("delete")||o.push(_(rr,{title:"Permission Denied",type:"error",children:_("p",{children:"You do not have permission to delete this page."})})),s.pageInfo.protection&&s.pageInfo.protection.length>0&&o.push(_(rr,{title:"Warning",type:"warning",children:_("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:i,wikiPage:s,deleteNotices:o});const a=_("form",{className:"ipe-quickDelete__form",children:[_("div",{className:"ipe-quickDelete__notices",children:o}),_("div",{className:"ipe-quickDelete__content",children:_("div",{className:"ipe-quickDelete__page-info",style:{padding:"1rem",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"1rem"},children:_("ul",{children:[_("li",{children:[_("strong",{children:"Title:"})," ",s.pageInfo.title]}),_("li",{children:[_("strong",{children:"Page ID:"})," ",s.pageInfo.pageid]}),_("li",{children:[_("strong",{children:"Last Revision:"})," ",s.pageInfo.lastrevid]}),_("li",{children:[_("strong",{children:"Length:"})," ",s.pageInfo.length," characters"]})]})})}),_("div",{class:"ipe-quickDelete__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:_(ni,{label:"Delete Reason",id:"reason",name:"reason",value:r.deleteReason,inputProps:{placeholder:"Enter reason for deletion...",required:!0}})}),!1]});i.setContent(a),i.addButton({side:"left",className:"is-danger submit-btn",label:"Delete Page",method:()=>{const u=new FormData(a).get("reason");if(!u||u.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:_(Rt,{children:_("p",{children:_("strong",{children:s.pageInfo.title})})}),center:!0,okBtn:{label:"Delete it now",className:"is-danger"},cancelBtn:{label:"Cancel",className:"is-ghost"}},c=>(c&&(i.setLoadingState(!0),this.handleSubmit({wikiPage:s,reason:u}).then(async()=>{i.setOptions({beforeClose:Ts}),i.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)}),i.setLoadingState(!1)})),!0))}},0),this.ctx.emit("quick-delete/wiki-page",{ctx:this.ctx,options:r,modal:i,wikiPage:s})}async handleSubmit(e){const n=e.wikiPage,r=e.reason||"";return n.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")}injectToolbox(e){e.toolbox.addButton({id:"quick-delete",group:"group2",icon:_("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("path",{d:"M4 7l16 0"}),_("path",{d:"M10 11l0 6"}),_("path",{d:"M14 11l0 6"}),_("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),_("path",{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"})]}),tooltip:"Delete this page",onClick:()=>{this.ctx.sitemeta.hasAnyRight("delete")?this.showModal({title:this.ctx.sitemeta.mwConfig.get("wgPageName"),pageId:this.ctx.sitemeta.mwConfig.get("wgArticleId"),revision:this.ctx.sitemeta.mwConfig.get("wgRevisionId")}):this.ctx.modal.notify("error",{title:"Permission Denied",content:"You do not have permission to delete pages."})}})}removeToolbox(e){e.toolbox.removeButton("quick-delete")}}Ds=tp(cl),ii=op(Ds,0,"PluginQuickDelete",ll,ii),sp(Ds,1,ii);const ap=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDelete(){return ii}},Symbol.toStringTag,{value:"Module"})),ir={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},ul=t=>{const{inputs:e,enableSwap:n=!0,...r}=t,i=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const u=()=>s.some(b=>b&&b.disabled),c=()=>{if(!s[0]||!s[1]||u())return;const b=s[0],I=s[1],U=b.value,D=I.value;b.value=D,I.value=U,b.dispatchEvent(new Event("change")),I.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=b=>{if(!a)return;const I=b??!a.disabled;a.disabled=!I,I&&s.forEach(U=>{U&&(U.disabled=!1)})},v=_("button",{type:"button","aria-label":"Swap values",onClick:c,disabled:u()||!n,ref:b=>a=b,children:_("svg",{ref:b=>l=b,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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("path",{d:"M20 10h-16l5.5 -6"}),_("path",{d:"M4 14h16l-5.5 6"})]})}),y=_("div",{className:`twin-swap-input ${ir.twinSwapInput}`,...r,children:[i.map((b,I)=>{const{label:U,id:D,name:T,value:g,disabled:p,required:h,inputProps:S}=b,O=I===0,N=D||T;return _("div",{className:`${ir.inputWrapper} ${O?ir.inputLeft:ir.inputRight}`,children:[U&&_("label",{htmlFor:N,children:U}),_("input",{ref:q=>s[I]=q,type:"text",id:N,name:T,value:g,disabled:p,required:h,...S})]})}),_("div",{className:ir.swapButton,children:v})]});return y.swap=c,y.toggleEnableSwap=f,y};var lp=Object.create,Ls=Object.defineProperty,cp=Object.getOwnPropertyDescriptor,fl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),dl=t=>{throw TypeError(t)},up=(t,e,n)=>e in t?Ls(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,fp=(t,e)=>Ls(t,"name",{value:e,configurable:!0}),dp=t=>[,,,lp(t?.[fl("metadata")]??null)],hp=["class","method","getter","setter","accessor","field","value","get","set"],hl=t=>t!==void 0&&typeof t!="function"?dl("Function expected"):t,pp=(t,e,n,r,i)=>({kind:hp[t],name:e,metadata:r,addInitializer:s=>n._?dl("Already initialized"):i.push(hl(s||null))}),mp=(t,e)=>up(e,fl("metadata"),t[3]),gp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},vp=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&cp(i,n));fp(i,n);for(var b=r.length-1;b>=0;b--)l=pp(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,hl(o)&&(i=o);return mp(t,i),y&&Ls(i,n,y),c?u^4?s:y:i},pl,Ms,ml;pl=[qe(["modal","sitemeta"])];class si extends(ml=rt){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 n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:_("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),_("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),_("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),_("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),_("path",{d:"M17 12h.01"}),_("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group1",onClick:()=>{this.quickMove(r?{lockFromField:!0,from:n}:{})}})}quickMove(e){const n=this.ctx.modal.createObject({title:"Quick Move",content:_(Vt,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(_("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.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}n.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[_(ul,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),_("div",{children:_(En,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),_("div",{children:_(En,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.sitemeta.hasRight("suppressredirect")&&_("div",{children:_(En,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),_(ni,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),n.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:n,to:r,reason:i="",...s}=e;if(!n||!r)throw new Error("From and to titles are required.");if(n===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(n)).moveTo(r,i,s)}}Ms=dp(ml),si=vp(Ms,0,"PluginQuickMove",pl,si),gp(Ms,1,si);const yp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return si}},Symbol.toStringTag,{value:"Module"}));var bp=Object.create,js=Object.defineProperty,_p=Object.getOwnPropertyDescriptor,gl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),vl=t=>{throw TypeError(t)},wp=(t,e,n)=>e in t?js(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,xp=(t,e)=>js(t,"name",{value:e,configurable:!0}),Sp=t=>[,,,bp(t?.[gl("metadata")]??null)],Ep=["class","method","getter","setter","accessor","field","value","get","set"],yl=t=>t!==void 0&&typeof t!="function"?vl("Function expected"):t,kp=(t,e,n,r,i)=>({kind:Ep[t],name:e,metadata:r,addInitializer:s=>n._?vl("Already initialized"):i.push(yl(s||null))}),$p=(t,e)=>wp(e,gl("metadata"),t[3]),Cp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Pp=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&_p(i,n));xp(i,n);for(var b=r.length-1;b>=0;b--)l=kp(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,yl(o)&&(i=o);return $p(t,i),y&&js(i,n,y),c?u^4?s:y:i},bl,Fs,_l;bl=[qe(["api","wikiPage","modal"])];class oi extends(_l=rt){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",Is(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(){this.ctx.off("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.off("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}previewWikitext(e,n,r,i){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!i||i.isDestroyed)&&(i=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",backdrop:!1,draggable:!0}).init()),i.show(),i.setTitle("Preview - Loading..."),i.setContent(_(Vt,{})),i.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:i,wikiPage:r}),r.preview(e,n).then(s=>{const{data:{parse:o}}=s;i.setTitle(`Preview - ${o.title}`);let a=null;i.setContent(_("section",{children:_("div",{ref:l=>a=l,className:"mw-parser-output",innerHTML:o.text})})),window.mw?.hook("wikipage.content").fire($(a)),this.ctx.emit("quick-preview/loaded",{ctx:this.ctx,modal:i,wikiPage:r,text:e,parseData:o})}).catch(s=>{i.setTitle("Preview - Failed"),i.setContent(_(Rt,{children:[_("p",{children:"Failed to preview"}),_("p",{children:s instanceof Error?s.message:String(s)})]}))}),i}injectQuickEdit({ctx:e,modal:n,wikiPage:r}){let i;n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{i=this.previewWikitext(n.get$content().querySelector('textarea[name="text"]')?.value||"",void 0,r,i)}},2)}injectQuickDelete({ctx:e,modal:n,wikiPage:r}){n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{this.logger.warn("To be implemented: preview wikitext for quick delete")}},2)}}Fs=Sp(_l),oi=Pp(Fs,0,"PluginQuickPreview",bl,oi),Cp(Fs,1,oi);const Op=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return oi}},Symbol.toStringTag,{value:"Module"}));class Lt{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=T=>{if(T=this.postProcess(T,r),i){setTimeout(function(){i(T)},0);return}else return T},a=n.length,l=e.length;let u=1,c=a+l;r.maxEditLength!=null&&(c=Math.min(c,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,v=Date.now()+f,y=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(y[0],n,e,0,r);if(y[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(y[0].lastComponent,n,e));let I=-1/0,U=1/0;const D=()=>{for(let T=Math.max(I,-u);T<=Math.min(U,u);T+=2){let g;const p=y[T-1],h=y[T+1];p&&(y[T-1]=void 0);let S=!1;if(h){const N=h.oldPos-T;S=h&&0<=N&&N<a}const O=p&&p.oldPos+1<l;if(!S&&!O){y[T]=void 0;continue}if(!O||S&&p.oldPos<h.oldPos?g=this.addToPath(h,!0,!1,0,r):g=this.addToPath(p,!1,!0,1,r),b=this.extractCommon(g,n,e,T,r),g.oldPos+1>=l&&b+1>=a)return o(this.buildValues(g.lastComponent,n,e))||!0;y[T]=g,g.oldPos+1>=l&&(U=Math.min(U,T-1)),b+1>=a&&(I=Math.max(I,T+1))}u++};if(i)(function T(){setTimeout(function(){if(u>c||Date.now()>v)return i(void 0);D()||T()},0)})();else for(;u<=c&&Date.now()<=v;){const T=D();if(T)return T}}addToPath(e,n,r,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,u=l-i,c=0;for(;u+1<o&&l+1<a&&this.equals(r[l+1],n[u+1],s);)u++,l++,c++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return c&&!s.oneChangePerToken&&(e.lastComponent={count:c,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,u}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,u=0;for(;a<o;a++){const c=i[a];if(c.removed)c.value=this.join(r.slice(u,u+c.count)),u+=c.count;else{if(!c.added&&this.useLongestToken){let f=n.slice(l,l+c.count);f=f.map(function(v,y){const b=r[u+y];return b.length>v.length?b:v}),c.value=this.join(f)}else c.value=this.join(n.slice(l,l+c.count));l+=c.count,c.added||(u+=c.count)}}return i}}class Ip extends Lt{}const wl=new Ip;function xl(t,e,n){return wl.diff(t,e,n)}function Sl(t,e){let n;for(n=0;n<t.length&&n<e.length;n++)if(t[n]!=e[n])return t.slice(0,n);return t.slice(0,n)}function El(t,e){let n;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(n=0;n<t.length&&n<e.length;n++)if(t[t.length-(n+1)]!=e[e.length-(n+1)])return t.slice(-n);return t.slice(-n)}function Bs(t,e,n){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return n+t.slice(e.length)}function Us(t,e,n){if(!e)return t+n;if(t.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return t.slice(0,-e.length)+n}function sr(t,e){return Bs(t,e,"")}function ai(t,e){return Us(t,e,"")}function kl(t,e){return e.slice(0,Tp(t,e))}function Tp(t,e){let n=0;t.length>e.length&&(n=t.length-e.length);let r=e.length;t.length<e.length&&(r=t.length);const i=Array(r);let s=0;i[0]=0;for(let o=1;o<r;o++){for(e[o]==e[s]?i[o]=i[s]:i[o]=s;s>0&&e[o]!=e[s];)s=i[s];e[o]==e[s]&&s++}s=0;for(let o=n;o<t.length;o++){for(;s>0&&t[o]!=e[s];)s=i[s];t[o]==e[s]&&s++}return s}function Ap(t){return t.includes(`\r
|
|
67
|
+
/____/ v`+e.version)}function vh(t,e){const n=Symbol.for(t);return window[n]?!1:(window[n]=!0,e(),!0)}function Pn(t,e){return function(n){return n.PreferencesSchema=t,n.PreferencesDefaults=e,n}}const Ka=t=>w("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-pencil-bolt",...t,children:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"}),w("path",{d:"M13.5 6.5l4 4"}),w("path",{d:"M19 16l-2 3h4l-2 3"})]});var yh=Object.create,Os=Object.defineProperty,bh=Object.getOwnPropertyDescriptor,Va=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ya=t=>{throw TypeError(t)},wh=(t,e,n)=>e in t?Os(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_h=(t,e)=>Os(t,"name",{value:e,configurable:!0}),xh=t=>[,,,yh(t?.[Va("metadata")]??null)],Sh=["class","method","getter","setter","accessor","field","value","get","set"],Ga=t=>t!==void 0&&typeof t!="function"?Ya("Function expected"):t,Eh=(t,e,n,r,i)=>({kind:Sh[t],name:e,metadata:r,addInitializer:s=>n._?Ya("Already initialized"):i.push(Ga(s||null))}),kh=(t,e)=>wh(e,Va("metadata"),t[3]),Ph=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},$h=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&bh(i,n));_h(i,n);for(var b=r.length-1;b>=0;b--)l=Eh(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,Ga(o)&&(i=o);return kh(t,i),y&&Os(i,n,y),u?c^4?s:y:i},Qa,Ts,Ja;Qa=[We(["wiki","wikiTitle","preferences"]),Pn(fe.object({"inArticleLinks.enable":fe.boolean().description("Whether to enable in-article links").default(!0),"inArticleLinks.quickDiff.enable":fe.boolean().description("Whether to enable in-article links for quick diff").default(!0),"inArticleLinks.quickEdit.enable":fe.boolean().description("Whether to enable in-article links for quick edit").default(!0),"inArticleLinks.quickEdit.redlinks":fe.boolean().description("Whether to show quick edit button for redlinks").default(!0)}).description("In-article links preferences").extra("category","in-article-links"))];class ni extends(Ja=it){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(){}parseAnchor(e){if(!(e instanceof HTMLAnchorElement))return null;const n=this._cachedAnchorInfo.get(e);if(n)return n;const r=e.getAttribute("href")||"";if(!this.ctx.wikiTitle.validateHrefAttr(r))return null;const i=e.href||"",s=this.ctx.wikiTitle.parseWikiLink(i);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){const n=e.querySelectorAll("a[href]");return Array.from(n).map(r=>this.parseAnchor(r)).filter(r=>r!==null)}async handleQuickEdit(){let e=!1;const n=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(i=>{if(!e)return;this.scanAnchors(i.get(0)).filter(({action:o,title:a,redlink:l})=>(["edit","create"].includes(o)||a.isSpecial("edit"))&&(n||!l)).forEach(({$el:o,title:a,params:l})=>{if(o.dataset.ipeEditMounted)return;if(o.dataset.ipeEditMounted="1",l.has("preload")||l.has("redo"))return this.ctx.logger.debug(o,"Not compatible with quick edit");let u;if(a.getNamespaceId()===-1){const T=a.getMainDBKey().split("/").slice(1).join("/")||"";if(a.isSpecial("edit"))u=T;else if(a.isSpecial("talkpage")){const v=a.newTitle(T).getTalkPage();if(!v)return this.ctx.logger.debug(o,"Talk page not found.");u=v.getPrefixedDBKey()}else if(a.isSpecial("mypage"))u=a.newTitle(this.ctx.wiki.userInfo.name,2).getPrefixedDBKey()+(T?`/${T}`:"");else if(a.isSpecial("mytalk"))u=a.newTitle(this.ctx.wiki.userInfo.name,3).getPrefixedDBKey()+(T?`/${T}`:"");else return this.ctx.logger.debug(o,"Special page cannot be edited")}else u=a.getPrefixedDBKey();const f=l.get("section")?.replace(/^T-/,"")||void 0,m=l.get("oldid"),y=l.has("redlink");let b;f==="new"?b="new":f&&/^\d+$/.test(f)&&(b=parseInt(f,10));const I=m?parseInt(m,10):void 0,F={title:u,section:b,revision:I,createOnly:y},D=w("a",{href:"#ipe://quick-edit/",dataset:F,className:`${this.config.linkClassName} ipe-quick-edit ${y?"ipe-quick-edit--create-only":""}`,style:{userSelect:"none",marginLeft:"0.2em",verticalAlign:"middle"},onClick:T=>{T.preventDefault(),r.quickEdit.showModal(F)},children:w(Ka,{style:"width: 1em; height: 1em"})});o.insertAdjacentElement("afterend",D)})})})}handleQuickDiff(){let e=!1;const n=r=>["prev","next","cur"].includes(r);this.ctx.inject(["quickDiff"],r=>{e=!0,r.on("dispose",()=>{e=!1}),window?.mw?.hook?.("wikipage.content").add(i=>{if(!e)return;this.scanAnchors(i.get(0)).filter(({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?[,c,u]=a.getMainDBKey().split("/"):(c=l.get("diff"),u=l.get("oldid")),!c||!u)return;const f={};n(c)?(f.fromrev=parseInt(u),f.torelative=c):(f.fromrev=parseInt(u),f.torev=parseInt(c)),o.addEventListener("click",m=>{m.preventDefault(),r.quickDiff.comparePages(f)})})})})}}Ts=xh(Ja),ni=$h(Ts,0,"PluginInArticleLinks",Qa,ni),Ph(Ts,1,ni);const Ch=Object.freeze(Object.defineProperty({__proto__:null,get PluginInArticleLinks(){return ni}},Symbol.toStringTag,{value:"Module"})),Oh=t=>typeof t=="function";async function Th(t){return Oh(t)?await t():t}const Ih=window?.location?.origin,Ah=({type:t,tag:e,href:n,target:r,children:i,...s})=>(e=e||(n?"a":"button"),typeof r>"u"&&n&&n.startsWith("http")&&!n.startsWith(Ih)&&(r="_blank"),Bd(e,{className:`theme-ipe ipe-action-button ipe-modal-btn is-${t||"default"}`,href:e==="a"?n:void 0,target:e==="a"?r:void 0,"data-href":e!=="a"?n:void 0,...s},i));var Nh=Object.create,Is=Object.defineProperty,Rh=Object.getOwnPropertyDescriptor,Xa=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Za=t=>{throw TypeError(t)},Dh=(t,e,n)=>e in t?Is(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Lh=(t,e)=>Is(t,"name",{value:e,configurable:!0}),Mh=t=>[,,,Nh(t?.[Xa("metadata")]??null)],jh=["class","method","getter","setter","accessor","field","value","get","set"],el=t=>t!==void 0&&typeof t!="function"?Za("Function expected"):t,Fh=(t,e,n,r,i)=>({kind:jh[t],name:e,metadata:r,addInitializer:s=>n._?Za("Already initialized"):i.push(el(s||null))}),Bh=(t,e)=>Dh(e,Xa("metadata"),t[3]),Uh=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},qh=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&Rh(i,n));Lh(i,n);for(var b=r.length-1;b>=0;b--)l=Fh(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,el(o)&&(i=o);return Bh(t,i),y&&Is(i,n,y),u?c^4?s:y:i},tl,As,nl;tl=[We(["storage"])];class ri extends(nl=it){constructor(e){super(e,{},"preferences"),this.ctx=e,this.db=void 0,this.customRegistries=[],this.categoryDefinitions=[],this._defaultPreferences={},this.db=e.storage.createDatabse("preferences",1/0),this.ctx.set("preferences",this)}async start(){this.defineCategory({name:"general",label:"General",description:"General settings"}),this.defineCategory({name:"edit",label:"Editing",description:"Settings related to editing content"}),this.defineCategory({name:"about",label:"About",description:"About InPageEdit",index:99}),this.registerCustomConfig("about",fe.object({about:fe.const(w("div",{className:"prose",children:[w("h2",{children:"✏️ InPageEdit NEXT"}),w("i",{children:["v",this.ctx.version]}),w("h2",{children:"Portals"}),w("div",{style:"display: flex; flex-direction: column; gap: 1rem",children:[w("a",{href:this.ctx.Endpoints.HOME_URL,target:"_blank",style:{display:"block",width:"100%"},children:"Official Website & Help Center"}),w(Ah,{href:`${this.ctx.Endpoints.UPDATE_LOGS_URL}#${this.ctx.version}`,style:{display:"block",width:"100%"},children:"Update Logs"})]}),w("h2",{children:"Join us"}),w("ul",{children:[w("li",{children:[w("strong",{children:"GitHub"}),":"," ",w("a",{href:this.ctx.Endpoints.GITHUB_URL,target:"_blank",children:"inpageedit/inpageedit-next"})]}),w("li",{children:[w("strong",{children:"QQ Group"}),": 1026023666"]})]}),w("hr",{}),w("p",{children:"🚀 Modular, Extensible Supercharged Plugin for MediaWiki."}),w("p",{children:"InPageEdit-NEXT Copyright © 2025-present dragon-fish"})]})).role("raw-html")}).description(""),"about",{}),Promise.resolve().then(()=>Ny).then(e=>{const n=this.ctx.plugin(e.PluginPreferencesUI);this.addDisposeHandler(()=>{n.dispose()})})}async get(e,n){n??(n=()=>{const i=this.getDefaultValue(e);return this.logger.debug(e,`(fallback value: ${i})`),i});const r=await this.db.get(e,void 0);return r!==null?r:await Th(n)}getDefaultValue(e){var n;return(n=this._defaultPreferences)[e]??(n[e]=this.loadDefaultConfigs()[e])}set(e,n){const r=this.getDefaultValue(e);return n===r?this.db.delete(e):this.db.set(e,n)}async getAll(){const e=this.loadDefaultConfigs();return await this.db.iterate((n,r)=>{e[r]=n}),e}loadDefaultConfigs(){const e={};return this.getConfigRegistries().forEach(n=>{try{const r=n.schema({});Object.entries(r).forEach(([i,s])=>{e[i]=s})}catch{}n.defaults&&Object.entries(n.defaults).forEach(([r,i])=>{e[r]=i})}),Object.entries(e).forEach(([n,r])=>{this._defaultPreferences[n]=r}),e}registerCustomConfig(e,n,r,i){return this.customRegistries.push({name:e,schema:n,category:r,defaults:i}),this}getConfigRegistries(e){return Array.from(this.ctx.registry.entries()).map(([n,r])=>n===null?{name:"@root",schema:dn?.PreferencesSchema||null,defaults:dn?.PreferencesDefaults||{}}:{name:n.name,schema:n?.PreferencesSchema||null,defaults:n?.PreferencesDefaults||{}}).filter(n=>n.schema!==null).map(n=>({...n,category:n.schema.meta.category||"general"})).concat(this.customRegistries).filter(n=>!e||n.category===e)}defineCategory(e){const n=this.categoryDefinitions.findIndex(r=>r.name===e.name);return n<0?this.categoryDefinitions.push(e):this.categoryDefinitions[n]=e,this.categoryDefinitions.sort((r,i)=>(r.index??0)-(i.index??0)),this}getConfigCategories(){return this.categoryDefinitions}}As=Mh(nl),ri=qh(As,0,"PluginPreferences",tl,ri),Uh(As,1,ri);const zh=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferences(){return ri}},Symbol.toStringTag,{value:"Module"})),Hh=Symbol("@@apply"),Wh=Symbol("@@ctor");function Ns(t,e){if(typeof t!="object"||t===null||Array.isArray(t))throw new TypeError("instance is not an object");const n=(...s)=>{const o=t[e];if(typeof o!="function")throw new TypeError(`Property "${String(e)}" is not a function`);return o.apply(t,s)};n[Hh]=n,n[Wh]=t;const r=t?.constructor?.name;return r&&(n[Symbol.toStringTag]=r),new Proxy(n,{get(s,o,a){return o==="prototype"?Reflect.get(n,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 ii={mbox:"_mbox_5x43w_1",title:"_title_5x43w_12",content:"_content_5x43w_19",close:"_close_5x43w_27"},sr=t=>{const{type:e="default",title:n,content:r,closeable:i=!0,titleProps:s,contentProps:o,children:a,...l}=t;let c=n;typeof n>"u"&&e!=="default"&&(c=e[0].toUpperCase()+e.slice(1).toLowerCase());const u=async()=>{if(!f)return Promise.resolve();const{promise:m,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()}),m},f=w("div",{className:`theme-ipe ipe-mbox mbox-type-${e||"default"} ${ii.mbox}`,...l,children:[c&&w("div",{className:`ipe-mbox-title ${ii.title}`,...s,children:c}),w("div",{className:`ipe-mbox-content ${ii.content}`,...o,children:a||r}),i&&w("a",{onClick:u,className:`ipe-mbox-close ${ii.close}`,children:"×"})]});return f.close=u,f},si=t=>{const{label:e,id:n,name:r,value:i,disabled:s,labelProps:o,inputProps:a,...l}=t;return w("div",{className:"theme-ipe ipe-input-box",...l,children:[w("label",{htmlFor:n,style:{display:"block"},...o,children:e}),w("input",{id:n,name:r,value:i,disabled:s,style:{width:"100%"},...a})]})},rl=t=>{const{id:e,name:n,value:r,label:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-radio-box",...l,children:[w("input",{type:"radio",id:e,name:n,value:r,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:i||a})]})},$n=t=>{const{id:e,name:n,label:r,checked:i,inputProps:s,labelProps:o,children:a,...l}=t;return w("label",{className:"theme-ipe ipe-checkbox",...l,children:[w("input",{type:"checkbox",id:e,name:n,checked:i,...s}),w("span",{className:"ipe-checkbox-box"}),w("span",{...o,children:r||a})]})},Rs=()=>{},Kh=(t=0)=>new Promise(e=>setTimeout(e,t));var Vh=Object.create,Ds=Object.defineProperty,Yh=Object.getOwnPropertyDescriptor,il=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),sl=t=>{throw TypeError(t)},Gh=(t,e,n)=>e in t?Ds(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Qh=(t,e)=>Ds(t,"name",{value:e,configurable:!0}),Jh=t=>[,,,Vh(t?.[il("metadata")]??null)],Xh=["class","method","getter","setter","accessor","field","value","get","set"],ol=t=>t!==void 0&&typeof t!="function"?sl("Function expected"):t,Zh=(t,e,n,r,i)=>({kind:Xh[t],name:e,metadata:r,addInitializer:s=>n._?sl("Already initialized"):i.push(ol(s||null))}),ep=(t,e)=>Gh(e,il("metadata"),t[3]),tp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},np=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&Yh(i,n));Qh(i,n);for(var b=r.length-1;b>=0;b--)l=Zh(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,ol(o)&&(i=o);return ep(t,i),y&&Ds(i,n,y),u?c^4?s:y:i},al,Ls,ll;al=[We(["api","wikiPage","wikiTitle","wiki","modal","preferences"]),Pn(fe.object({"quickEdit.editSummary":fe.string().description("Default edit summary for quick edits").default("[IPE-NEXT] Quick edit"),"quickEdit.editMinor":fe.boolean().description("Whether to mark the edit as minor").default(!1),"quickEdit.outSideClose":fe.boolean().description("Whether to close the modal outside").default(!0),"quickEdit.watchList":fe.union([fe.const(vt.preferences).description("Follow my preferences"),fe.const(vt.nochange).description("Keep the current watchlist status"),fe.const(vt.watch).description("Add the page to watchlist"),fe.const(vt.unwatch).description("Remove the page from watchlist")]).description("Watchlist options").default(vt.preferences),"quickEdit.keyshortcut.save":fe.string().default("ctrl-s").description("save button key shortcut (blank to disable)")}).description("Quick edit options").extra("category","edit"))];class oi extends(ll=it){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",Ns(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 m=new URLSearchParams(window.location.search);e={...e,title:this.ctx.wikiTitle.currentTitle.getPrefixedDBKey(),revision:m.has("oldid")?Number(m.get("oldid")):void 0,pageId:m.has("curid")?Number(m.get("curid")):void 0}}const n=await this.ctx.preferences.get("quickEdit.outSideClose"),r=await this.ctx.preferences.get("quickEdit.watchList"),i=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:i,editMinor:s,...e};o.editSummary||(o.editSummary=await this.ctx.preferences.get("quickEdit.editSummary")||""),o||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:n}).init();a.setTitle(w(Lt,{children:["Loading: ",w("u",{children:o.title})]})),a.setContent(w("section",{className:"ipe-quickEdit-loading",style:{height:"70vh",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:w(Yt,{})})),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(m){a.off(a.Event.Close),a.close(),this.ctx.modal.notify("error",{content:m instanceof Error?m.message:String(m)});return}a.setTitle(w(Lt,{children:["Quick ",l.pageInfo.pageid===0?"Create":"Edit",":"," ",w("u",{children:l.pageInfo.title})]}));const c=[];l.pageInfo.pageid===0&&c.push(w(sr,{title:"Attention",type:"important",children:w("p",{children:"This page does not exist."})})),l.pageInfo.pageid&&l.pageInfo.lastrevid!==l.revisions[0]?.revid&&c.push(w(sr,{title:"Attention",type:"warning",children:w("p",{children:["You are editing a ",w("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:c});const u=w("form",{className:"ipe-quickEdit__form",children:[w("div",{className:"ipe-quickEdit__notices",children:c}),w("div",{className:"ipe-quickEdit__content",children:w("textarea",{className:"ipe-quickEdit__textarea",name:"text",id:"wpTextbox1",children:l.revisions[0]?.content||""})}),w("div",{class:"ipe-quickEdit__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:[w(si,{label:"Summary",id:"summary",name:"summary",value:o.editSummary}),w("div",{className:"ipe-input-box",children:[w("label",{htmlFor:"watchlist",style:{display:"block"},children:"Watchlist"}),w("div",{style:{display:"flex",gap:"1rem"},children:[vt.preferences,vt.nochange,vt.watch,vt.unwatch].map(m=>w(rl,{name:"watchlist",value:m,inputProps:{checked:r===m},children:m},m))})]}),w("div",{style:{display:"flex",gap:"1rem"},children:[w($n,{name:"minor",id:"minor",checked:o.editMinor,children:"Minor edit"}),w($n,{name:"reloadAfterSave",id:"reloadAfterSave",checked:o.reloadAfterSave,children:"Reload after save"})]})]}),!1]});a.setContent(u),a.addButton({side:"left",className:"is-primary submit-btn",label:"Submit",keyPress:await this.ctx.preferences.get("quickEdit.keyshortcut.save")||void 0,method:()=>{const m=new FormData(u);a.setLoadingState(!0),this.handleSubmit({wikiPage:l,text:m.get("text"),summary:m.get("summary"),minor:m.get("minor")==="on",section:o.section,createonly:l.pageid===0,watchlist:r}).then(async()=>{a.setOptions({beforeClose:Rs}),a.close(),this.ctx.modal.notify("success",{title:"Submission Successful",content:"Your changes have been saved."}),m.get("reloadAfterSave")&&(await Kh(500),location.reload())}).catch(y=>{this.ctx.modal.notify("error",{title:"Submission Error",content:y instanceof Error?y.message:String(y)}),a.setLoadingState(!1)})}},0),a.setOptions({beforeClose:()=>{const m=l.revisions[0]?.content||"";return(u.querySelector("textarea")?.value||"")===m?!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:Rs}),a.close()),!0)),!1)}}),this.ctx.emit("quick-edit/wiki-page",{ctx:this.ctx,options:o,modal:a,wikiPage:l});const f=m=>u.querySelector("textarea")?.value===l.revisions[0]?.content?!0:(m.preventDefault(),"You have unsaved changes. Are you sure you want to leave?");window.addEventListener("beforeunload",f),a.on(a.Event.Close,()=>{window.removeEventListener("beforeunload",f)})}async handleSubmit(e){const n=e.wikiPage,r=e.summary||"",i=e.text||"",s=e.minor,o=e.createonly,a=e.watchlist,l=e.section;return n.edit({summary:r,text:i,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")}injectToolbox(e){const n=this.ctx.wikiTitle.currentTitle,r=this.ctx.wiki.hasRight("edit")&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-edit",group:"group1",index:0,icon:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1"}),w("path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z"}),w("path",{d:"M16 5l3 3"})]}),buttonProps:{disabled:!r},tooltip:r?"Quick Edit":"Not editable",onClick:()=>{const i=new URLSearchParams(window.location.search).get("oldid");this.showModal({title:n.getPrefixedText(),revision:i?Number(i):void 0})}})}removeToolbox(e){e.toolbox.removeButton("quick-edit")}}Ls=Jh(ll),oi=np(Ls,0,"PluginQuickEdit",al,oi),tp(Ls,1,oi);const rp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickEdit(){return oi}},Symbol.toStringTag,{value:"Module"}));var ip=Object.create,Ms=Object.defineProperty,sp=Object.getOwnPropertyDescriptor,cl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),ul=t=>{throw TypeError(t)},op=(t,e,n)=>e in t?Ms(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ap=(t,e)=>Ms(t,"name",{value:e,configurable:!0}),lp=t=>[,,,ip(t?.[cl("metadata")]??null)],cp=["class","method","getter","setter","accessor","field","value","get","set"],fl=t=>t!==void 0&&typeof t!="function"?ul("Function expected"):t,up=(t,e,n,r,i)=>({kind:cp[t],name:e,metadata:r,addInitializer:s=>n._?ul("Already initialized"):i.push(fl(s||null))}),fp=(t,e)=>op(e,cl("metadata"),t[3]),dp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},hp=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&sp(i,n));ap(i,n);for(var b=r.length-1;b>=0;b--)l=up(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,fl(o)&&(i=o);return fp(t,i),y&&Ms(i,n,y),u?c^4?s:y:i},dl,js,hl;dl=[We(["api","wikiPage","wikiTitle","wiki","modal","preferences"]),Pn(fe.object({deleteReason:fe.string().description("Default delete reason for quick delete").default("[IPE-NEXT] Quick delete")}).description("Quick delete options").extra("category","delete"))];class ai extends(hl=it){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",Ns(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);e={...e,title:this.ctx.wikiTitle.currentTitle.getPrefixedDBKey(),revision:l.has("oldid")?Number(l.get("oldid")):void 0,pageId:l.has("curid")?Number(l.get("curid")):void 0}}const n=typeof e.deleteReason=="string"?e.deleteReason:await this.ctx.preferences.get("deleteReason"),r={...this.DEFAULT_OPTIONS,deleteReason:n,...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 i=this.ctx.modal.createObject({className:"ipe-quickDelete",sizeClass:"small",center:!0}).init();i.setTitle(w(Lt,{children:["Loading: ",w("u",{children:r.title})]})),i.setContent(w(Yt,{})),i.addButton({side:"right",type:"button",className:"is-ghost",label:"Cancel",method(){i.close()}}),i.show(),this.ctx.emit("quick-delete/show-modal",{ctx:this.ctx,modal:i,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){i.off(i.Event.Close),i.close(),this.ctx.modal.notify("error",{content:l instanceof Error?l.message:String(l)});return}i.setTitle(w(Lt,{children:["Quick Delete: ",w("u",{children:s.pageInfo.title})]}));const o=[];s.userCan("delete")||o.push(w(sr,{title:"Permission Denied",type:"error",children:w("p",{children:"You do not have permission to delete this page."})})),s.pageInfo.protection&&s.pageInfo.protection.length>0&&o.push(w(sr,{title:"Warning",type:"warning",children:w("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:i,wikiPage:s,deleteNotices:o});const a=w("form",{className:"ipe-quickDelete__form",children:[w("div",{className:"ipe-quickDelete__notices",children:o}),w("div",{className:"ipe-quickDelete__content",children:w("div",{className:"ipe-quickDelete__page-info",style:{padding:"1rem",backgroundColor:"#f8f9fa",border:"1px solid #dee2e6",borderRadius:"4px",marginBottom:"1rem"},children:w("ul",{children:[w("li",{children:[w("strong",{children:"Title:"})," ",s.pageInfo.title]}),w("li",{children:[w("strong",{children:"Page ID:"})," ",s.pageInfo.pageid]}),w("li",{children:[w("strong",{children:"Last Revision:"})," ",s.pageInfo.lastrevid]}),w("li",{children:[w("strong",{children:"Length:"})," ",s.pageInfo.length," characters"]})]})})}),w("div",{class:"ipe-quickDelete__options",style:{display:"flex",flexDirection:"column",gap:"1rem",marginTop:"1rem"},children:w(si,{label:"Delete Reason",id:"reason",name:"reason",value:r.deleteReason,inputProps:{placeholder:"Enter reason for deletion...",required:!0}})}),!1]});i.setContent(a),i.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:w(Lt,{children:w("p",{children:w("strong",{children:s.pageInfo.title})})}),center:!0,okBtn:{label:"Delete it now",className:"is-danger"},cancelBtn:{label:"Cancel",className:"is-ghost"}},u=>(u&&(i.setLoadingState(!0),this.handleSubmit({wikiPage:s,reason:c}).then(async()=>{i.setOptions({beforeClose:Rs}),i.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)}),i.setLoadingState(!1)})),!0))}},0),this.ctx.emit("quick-delete/wiki-page",{ctx:this.ctx,options:r,modal:i,wikiPage:s})}async handleSubmit(e){const n=e.wikiPage,r=e.reason||"";return n.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")}injectToolbox(e){const n=this.ctx.wikiTitle.currentTitle,r=this.ctx.wiki.hasRight("delete")&&n.getNamespaceId()>=0;e.toolbox.addButton({id:"quick-delete",group:"group2",icon:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 7l16 0"}),w("path",{d:"M10 11l0 6"}),w("path",{d:"M14 11l0 6"}),w("path",{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"}),w("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:n.getPrefixedText()})}})}removeToolbox(e){e.toolbox.removeButton("quick-delete")}}js=lp(hl),ai=hp(js,0,"PluginQuickDelete",dl,ai),dp(js,1,ai);const pp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickDelete(){return ai}},Symbol.toStringTag,{value:"Module"})),or={twinSwapInput:"_twinSwapInput_1gdgl_9",inputWrapper:"_inputWrapper_1gdgl_23",inputLeft:"_inputLeft_1gdgl_27",inputRight:"_inputRight_1gdgl_30",swapButton:"_swapButton_1gdgl_46"},pl=t=>{const{inputs:e,enableSwap:n=!0,...r}=t,i=e?.length===2?e:[e?.[0]??{},e?.[1]??{}],s=[null,null];let o=0,a=null,l=null;const c=()=>s.some(b=>b&&b.disabled),u=()=>{if(!s[0]||!s[1]||c())return;const b=s[0],I=s[1],F=b.value,D=I.value;b.value=D,I.value=F,b.dispatchEvent(new Event("change")),I.dispatchEvent(new Event("change")),o++,l&&(l.style.transform=`rotateY(${o*-180}deg)`,l.style.transition="transform 200ms ease")},f=b=>{if(!a)return;const I=b??!a.disabled;a.disabled=!I,I&&s.forEach(F=>{F&&(F.disabled=!1)})},m=w("button",{type:"button","aria-label":"Swap values",onClick:u,disabled:c()||!n,ref:b=>a=b,children:w("svg",{ref:b=>l=b,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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M20 10h-16l5.5 -6"}),w("path",{d:"M4 14h16l-5.5 6"})]})}),y=w("div",{className:`twin-swap-input ${or.twinSwapInput}`,...r,children:[i.map((b,I)=>{const{label:F,id:D,name:T,value:v,disabled:p,required:h,inputProps:S}=b,O=I===0,N=D||T;return w("div",{className:`${or.inputWrapper} ${O?or.inputLeft:or.inputRight}`,children:[F&&w("label",{htmlFor:N,children:F}),w("input",{ref:H=>s[I]=H,type:"text",id:N,name:T,value:v,disabled:p,required:h,...S})]})}),w("div",{className:or.swapButton,children:m})]});return y.swap=u,y.toggleEnableSwap=f,y};var mp=Object.create,Fs=Object.defineProperty,gp=Object.getOwnPropertyDescriptor,ml=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),gl=t=>{throw TypeError(t)},vp=(t,e,n)=>e in t?Fs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yp=(t,e)=>Fs(t,"name",{value:e,configurable:!0}),bp=t=>[,,,mp(t?.[ml("metadata")]??null)],wp=["class","method","getter","setter","accessor","field","value","get","set"],vl=t=>t!==void 0&&typeof t!="function"?gl("Function expected"):t,_p=(t,e,n,r,i)=>({kind:wp[t],name:e,metadata:r,addInitializer:s=>n._?gl("Already initialized"):i.push(vl(s||null))}),xp=(t,e)=>vp(e,ml("metadata"),t[3]),Sp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Ep=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&gp(i,n));yp(i,n);for(var b=r.length-1;b>=0;b--)l=_p(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,vl(o)&&(i=o);return xp(t,i),y&&Fs(i,n,y),u?c^4?s:y:i},yl,Bs,bl;yl=[We(["modal","wiki"])];class li extends(bl=it){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 n=window.mw?.config.get("wgPageName")||"",r=window.mw?.config.get("wgIsProbablyEditable");e.toolbox.addButton({id:"quick-move",icon:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M12 3a3 3 0 0 0 -3 3v12a3 3 0 0 0 3 3"}),w("path",{d:"M6 3a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3"}),w("path",{d:"M13 7h7a1 1 0 0 1 1 1v8a1 1 0 0 1 -1 1h-7"}),w("path",{d:"M5 7h-1a1 1 0 0 0 -1 1v8a1 1 0 0 0 1 1h1"}),w("path",{d:"M17 12h.01"}),w("path",{d:"M13 12h.01"})]}),tooltip:"Quick Move",group:"group1",index:1,onClick:()=>{this.quickMove(r?{lockFromField:!0,from:n}:{})}})}quickMove(e){const n=this.ctx.modal.createObject({title:"Quick Move",content:w(Yt,{}),className:"quick-move compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.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}n.setLoadingState(!0),this.movePage(o).then(()=>{location.reload()}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to move",content:a instanceof Error?a.message:String(a)})})},children:[w(pl,{inputs:[{label:"Move from",name:"from",value:e?.from,required:!0},{label:"Move to",name:"to",value:e?.to,required:!0}]}),w("div",{children:w($n,{name:"movetalk",id:"movetalk",checked:e?.movetalk,children:"Move talk page"})}),w("div",{children:w($n,{name:"movesubpages",id:"movesubpages",checked:e?.movesubpages,children:"Move subpage(s) (up to 100)"})}),this.ctx.wiki.hasRight("suppressredirect")&&w("div",{children:w($n,{name:"noredirect",id:"noredirect",checked:e?.noredirect,children:"Move without leaving a redirect"})}),w(si,{label:"Reason",id:"reason",name:"reason",value:e?.reason})]})),n.setButtons([{label:"Move",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async movePage(e){const{from:n,to:r,reason:i="",...s}=e;if(!n||!r)throw new Error("From and to titles are required.");if(n===r)throw new Error("From and to titles cannot be the same.");return(await this.ctx.wikiPage.newFromTitle(n)).moveTo(r,i,s)}}Bs=bp(bl),li=Ep(Bs,0,"PluginQuickMove",yl,li),Sp(Bs,1,li);const kp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickMove(){return li}},Symbol.toStringTag,{value:"Module"}));var Pp=Object.create,Us=Object.defineProperty,$p=Object.getOwnPropertyDescriptor,wl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),_l=t=>{throw TypeError(t)},Cp=(t,e,n)=>e in t?Us(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Op=(t,e)=>Us(t,"name",{value:e,configurable:!0}),Tp=t=>[,,,Pp(t?.[wl("metadata")]??null)],Ip=["class","method","getter","setter","accessor","field","value","get","set"],xl=t=>t!==void 0&&typeof t!="function"?_l("Function expected"):t,Ap=(t,e,n,r,i)=>({kind:Ip[t],name:e,metadata:r,addInitializer:s=>n._?_l("Already initialized"):i.push(xl(s||null))}),Np=(t,e)=>Cp(e,wl("metadata"),t[3]),Rp=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Dp=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&$p(i,n));Op(i,n);for(var b=r.length-1;b>=0;b--)l=Ap(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,xl(o)&&(i=o);return Np(t,i),y&&Us(i,n,y),u?c^4?s:y:i},Sl,qs,El;Sl=[We(["api","wikiPage","modal"]),Pn(fe.object({"quickPreview.keyshortcut":fe.string().default("ctrl-p").description("Key shortcut to open quick preview in quick edit modal")}).extra("category","edit").description("Quick preview options"))];class ci extends(El=it){constructor(e){super(e,{},"quickPreview"),this.ctx=e,this.ctx.set("quickPreview",Ns(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(){this.ctx.off("quick-edit/wiki-page",this.injectQuickEdit.bind(this)),this.ctx.off("quick-delete/wiki-page",this.injectQuickDelete.bind(this))}previewWikitext(e,n,r,i,s){return r||(r=this.ctx.wikiPage.newBlankPage({title:"API"})),(!i||i.isDestroyed)&&(i=this.ctx.modal.createObject({className:"in-page-edit ipe-quickPreview",sizeClass:"large",center:!1,...s}).init()),i.show(),i.setTitle("Preview - Loading..."),i.setContent(w(Yt,{})),i.bringToFront(),this.ctx.emit("quick-preview/show-modal",{ctx:this.ctx,text:e,modal:i,wikiPage:r}),r.preview(e,n).then(o=>{const{data:{parse:a}}=o;i.setTitle(`Preview - ${a.title}`);let l=null;i.setContent(w("section",{children:w("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:i,wikiPage:r,text:e,parseData:a})}).catch(o=>{i.setTitle("Preview - Failed"),i.setContent(w(Lt,{children:[w("p",{children:"Failed to preview"}),w("p",{children:o instanceof Error?o.message:String(o)})]}))}),i}async injectQuickEdit({ctx:e,modal:n,wikiPage:r}){let i;n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",keyPress:await this.ctx.preferences.get("quickPreview.keyshortcut.quickEdit")||void 0,method:()=>{i=this.previewWikitext(n.get$content().querySelector('textarea[name="text"]')?.value||"",void 0,r,i,{backdrop:!1,draggable:!0})}},1),n.on(n.Event.Close,()=>{i?.destroy(),i=void 0})}injectQuickDelete({ctx:e,modal:n,wikiPage:r}){n.addButton({label:"Preview",side:"left",className:"btn btn-secondary",method:()=>{this.logger.warn("To be implemented: preview wikitext for quick delete")}},2)}}qs=Tp(El),ci=Dp(qs,0,"PluginQuickPreview",Sl,ci),Rp(qs,1,ci);const Lp=Object.freeze(Object.defineProperty({__proto__:null,get PluginQuickPreview(){return ci}},Symbol.toStringTag,{value:"Module"}));class jt{diff(e,n,r={}){let i;typeof r=="function"?(i=r,r={}):"callback"in r&&(i=r.callback);const s=this.castInput(e,r),o=this.castInput(n,r),a=this.removeEmpty(this.tokenize(s,r)),l=this.removeEmpty(this.tokenize(o,r));return this.diffWithOptionsObj(a,l,r,i)}diffWithOptionsObj(e,n,r,i){var s;const o=T=>{if(T=this.postProcess(T,r),i){setTimeout(function(){i(T)},0);return}else return T},a=n.length,l=e.length;let c=1,u=a+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(s=r.timeout)!==null&&s!==void 0?s:1/0,m=Date.now()+f,y=[{oldPos:-1,lastComponent:void 0}];let b=this.extractCommon(y[0],n,e,0,r);if(y[0].oldPos+1>=l&&b+1>=a)return o(this.buildValues(y[0].lastComponent,n,e));let I=-1/0,F=1/0;const D=()=>{for(let T=Math.max(I,-c);T<=Math.min(F,c);T+=2){let v;const p=y[T-1],h=y[T+1];p&&(y[T-1]=void 0);let S=!1;if(h){const N=h.oldPos-T;S=h&&0<=N&&N<a}const O=p&&p.oldPos+1<l;if(!S&&!O){y[T]=void 0;continue}if(!O||S&&p.oldPos<h.oldPos?v=this.addToPath(h,!0,!1,0,r):v=this.addToPath(p,!1,!0,1,r),b=this.extractCommon(v,n,e,T,r),v.oldPos+1>=l&&b+1>=a)return o(this.buildValues(v.lastComponent,n,e))||!0;y[T]=v,v.oldPos+1>=l&&(F=Math.min(F,T-1)),b+1>=a&&(I=Math.max(I,T+1))}c++};if(i)(function T(){setTimeout(function(){if(c>u||Date.now()>m)return i(void 0);D()||T()},0)})();else for(;c<=u&&Date.now()<=m;){const T=D();if(T)return T}}addToPath(e,n,r,i,s){const o=e.lastComponent;return o&&!s.oneChangePerToken&&o.added===n&&o.removed===r?{oldPos:e.oldPos+i,lastComponent:{count:o.count+1,added:n,removed:r,previousComponent:o.previousComponent}}:{oldPos:e.oldPos+i,lastComponent:{count:1,added:n,removed:r,previousComponent:o}}}extractCommon(e,n,r,i,s){const o=n.length,a=r.length;let l=e.oldPos,c=l-i,u=0;for(;c+1<o&&l+1<a&&this.equals(r[l+1],n[c+1],s);)c++,l++,u++,s.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!s.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const i=[];let s;for(;e;)i.push(e),s=e.previousComponent,delete e.previousComponent,e=s;i.reverse();const o=i.length;let a=0,l=0,c=0;for(;a<o;a++){const u=i[a];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(l,l+u.count);f=f.map(function(m,y){const b=r[c+y];return b.length>m.length?b:m}),u.value=this.join(f)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return i}}class Mp extends jt{}const kl=new Mp;function Pl(t,e,n){return kl.diff(t,e,n)}function $l(t,e){let n;for(n=0;n<t.length&&n<e.length;n++)if(t[n]!=e[n])return t.slice(0,n);return t.slice(0,n)}function Cl(t,e){let n;if(!t||!e||t[t.length-1]!=e[e.length-1])return"";for(n=0;n<t.length&&n<e.length;n++)if(t[t.length-(n+1)]!=e[e.length-(n+1)])return t.slice(-n);return t.slice(-n)}function zs(t,e,n){if(t.slice(0,e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't start with prefix ${JSON.stringify(e)}; this is a bug`);return n+t.slice(e.length)}function Hs(t,e,n){if(!e)return t+n;if(t.slice(-e.length)!=e)throw Error(`string ${JSON.stringify(t)} doesn't end with suffix ${JSON.stringify(e)}; this is a bug`);return t.slice(0,-e.length)+n}function ar(t,e){return zs(t,e,"")}function ui(t,e){return Hs(t,e,"")}function Ol(t,e){return e.slice(0,jp(t,e))}function jp(t,e){let n=0;t.length>e.length&&(n=t.length-e.length);let r=e.length;t.length<e.length&&(r=t.length);const i=Array(r);let s=0;i[0]=0;for(let o=1;o<r;o++){for(e[o]==e[s]?i[o]=i[s]:i[o]=s;s>0&&e[o]!=e[s];)s=i[s];e[o]==e[s]&&s++}s=0;for(let o=n;o<t.length;o++){for(;s>0&&t[o]!=e[s];)s=i[s];t[o]==e[s]&&s++}return s}function Fp(t){return t.includes(`\r
|
|
68
68
|
`)&&!t.startsWith(`
|
|
69
|
-
`)&&!t.match(/[^\r]\n/)}function
|
|
69
|
+
`)&&!t.match(/[^\r]\n/)}function Bp(t){return!t.includes(`\r
|
|
70
70
|
`)&&t.includes(`
|
|
71
|
-
`)}function
|
|
71
|
+
`)}function lr(t){let e;for(e=t.length-1;e>=0&&t[e].match(/\s/);e--);return t.substring(e+1)}function Gt(t){const e=t.match(/^\s*/);return e?e[0]:""}const fi="a-zA-Z0-9_\\u{C0}-\\u{FF}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}",Up=new RegExp(`[${fi}]+|\\s+|[^${fi}]`,"ug");class qp extends jt{equals(e,n,r){return r.ignoreCase&&(e=e.toLowerCase(),n=n.toLowerCase()),e.trim()===n.trim()}tokenize(e,n={}){let r;if(n.intlSegmenter){const o=n.intlSegmenter;if(o.resolvedOptions().granularity!="word")throw new Error('The segmenter passed must have a granularity of "word"');r=Array.from(o.segment(e),a=>a.segment)}else r=e.match(Up)||[];const i=[];let s=null;return r.forEach(o=>{/\s/.test(o)?s==null?i.push(o):i.push(i.pop()+o):s!=null&&/\s/.test(s)?i[i.length-1]==s?i.push(i.pop()+o):i.push(s+o):i.push(o),s=o}),i}join(e){return e.map((n,r)=>r==0?n:n.replace(/^\s+/,"")).join("")}postProcess(e,n){if(!e||n.oneChangePerToken)return e;let r=null,i=null,s=null;return e.forEach(o=>{o.added?i=o:o.removed?s=o:((i||s)&&Al(r,s,i,o),r=o,i=null,s=null)}),(i||s)&&Al(r,s,i,null),e}}const Tl=new qp;function Il(t,e,n){return n?.ignoreWhitespace!=null&&!n.ignoreWhitespace?Ws(t,e,n):Tl.diff(t,e,n)}function Al(t,e,n,r){if(e&&n){const i=Gt(e.value),s=lr(e.value),o=Gt(n.value),a=lr(n.value);if(t){const l=$l(i,o);t.value=Hs(t.value,o,l),e.value=ar(e.value,l),n.value=ar(n.value,l)}if(r){const l=Cl(s,a);r.value=zs(r.value,a,l),e.value=ui(e.value,l),n.value=ui(n.value,l)}}else if(n){if(t){const i=Gt(n.value);n.value=n.value.substring(i.length)}if(r){const i=Gt(r.value);r.value=r.value.substring(i.length)}}else if(t&&r){const i=Gt(r.value),s=Gt(e.value),o=lr(e.value),a=$l(i,s);e.value=ar(e.value,a);const l=Cl(ar(i,a),o);e.value=ui(e.value,l),r.value=zs(r.value,i,l),t.value=Hs(t.value,i,i.slice(0,i.length-l.length))}else if(r){const i=Gt(r.value),s=lr(e.value),o=Ol(s,i);e.value=ui(e.value,o)}else if(t){const i=lr(t.value),s=Gt(e.value),o=Ol(i,s);e.value=ar(e.value,o)}}class zp extends jt{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${fi}]+|[^\\S\\n\\r]+|[^${fi}]`,"ug");return e.match(n)||[]}}const Nl=new zp;function Ws(t,e,n){return Nl.diff(t,e,n)}function Hp(t,e){if(typeof t=="function")e.callback=t;else if(t)for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}class Wp extends jt{constructor(){super(...arguments),this.tokenize=Dl}equals(e,n,r){return r.ignoreWhitespace?((!r.newlineIsToken||!e.includes(`
|
|
72
72
|
`))&&(e=e.trim()),(!r.newlineIsToken||!n.includes(`
|
|
73
73
|
`))&&(n=n.trim())):r.ignoreNewlineAtEof&&!r.newlineIsToken&&(e.endsWith(`
|
|
74
74
|
`)&&(e=e.slice(0,-1)),n.endsWith(`
|
|
75
|
-
`)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const
|
|
76
|
-
`));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function
|
|
77
|
-
`),i=e.hunks,s=n.compareLine||((b,I,
|
|
78
|
-
`)}function
|
|
79
|
-
`)?T.lines[
|
|
75
|
+
`)&&(n=n.slice(0,-1))),super.equals(e,n,r)}}const Ks=new Wp;function di(t,e,n){return Ks.diff(t,e,n)}function Rl(t,e,n){return n=Hp(n,{ignoreWhitespace:!0}),Ks.diff(t,e,n)}function Dl(t,e){e.stripTrailingCr&&(t=t.replace(/\r\n/g,`
|
|
76
|
+
`));const n=[],r=t.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let i=0;i<r.length;i++){const s=r[i];i%2&&!e.newlineIsToken?n[n.length-1]+=s:n.push(s)}return n}function Kp(t){return t=="."||t=="!"||t=="?"}class Vp extends jt{tokenize(e){var n;const r=[];let i=0;for(let s=0;s<e.length;s++){if(s==e.length-1){r.push(e.slice(i));break}if(Kp(e[s])&&e[s+1].match(/\s/)){for(r.push(e.slice(i,s+1)),s=i=s+1;!((n=e[s+1])===null||n===void 0)&&n.match(/\s/);)s++;r.push(e.slice(i,s+1)),i=s+1}}return r}}const Ll=new Vp;function Ml(t,e,n){return Ll.diff(t,e,n)}class Yp extends jt{tokenize(e){return e.split(/([{}:;,]|\s+)/)}}const jl=new Yp;function Fl(t,e,n){return jl.diff(t,e,n)}class Gp extends jt{constructor(){super(...arguments),this.tokenize=Dl}get useLongestToken(){return!0}castInput(e,n){const{undefinedReplacement:r,stringifyReplacer:i=(s,o)=>typeof o>"u"?r:o}=n;return typeof e=="string"?e:JSON.stringify(hi(e,null,null,i),null," ")}equals(e,n,r){return super.equals(e.replace(/,([\r\n])/g,"$1"),n.replace(/,([\r\n])/g,"$1"),r)}}const Bl=new Gp;function Ul(t,e,n){return Bl.diff(t,e,n)}function hi(t,e,n,r,i){e=e||[],n=n||[],r&&(t=r(i===void 0?"":i,t));let s;for(s=0;s<e.length;s+=1)if(e[s]===t)return n[s];let o;if(Object.prototype.toString.call(t)==="[object Array]"){for(e.push(t),o=new Array(t.length),n.push(o),s=0;s<t.length;s+=1)o[s]=hi(t[s],e,n,r,String(s));return e.pop(),n.pop(),o}if(t&&t.toJSON&&(t=t.toJSON()),typeof t=="object"&&t!==null){e.push(t),o={},n.push(o);const a=[];let l;for(l in t)Object.prototype.hasOwnProperty.call(t,l)&&a.push(l);for(a.sort(),s=0;s<a.length;s+=1)l=a[s],o[l]=hi(t[l],e,n,r,l);e.pop(),n.pop()}else o=t;return o}class Qp extends jt{tokenize(e){return e.slice()}join(e){return e}removeEmpty(e){return e}}const ql=new Qp;function zl(t,e,n){return ql.diff(t,e,n)}function Hl(t){return Array.isArray(t)?t.map(e=>Hl(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map((n,r)=>{var i;return n.startsWith("\\")||n.endsWith("\r")||!((i=e.lines[r+1])===null||i===void 0)&&i.startsWith("\\")?n:n+"\r"})}))})}function Wl(t){return Array.isArray(t)?t.map(e=>Wl(e)):Object.assign(Object.assign({},t),{hunks:t.hunks.map(e=>Object.assign(Object.assign({},e),{lines:e.lines.map(n=>n.endsWith("\r")?n.substring(0,n.length-1):n)}))})}function Jp(t){return Array.isArray(t)||(t=[t]),!t.some(e=>e.hunks.some(n=>n.lines.some(r=>!r.startsWith("\\")&&r.endsWith("\r"))))}function Xp(t){return Array.isArray(t)||(t=[t]),t.some(e=>e.hunks.some(n=>n.lines.some(r=>r.endsWith("\r"))))&&t.every(e=>e.hunks.every(n=>n.lines.every((r,i)=>{var s;return r.startsWith("\\")||r.endsWith("\r")||((s=n.lines[i+1])===null||s===void 0?void 0:s.startsWith("\\"))})))}function Vs(t){const e=t.split(/\n/),n=[];let r=0;function i(){const a={};for(n.push(a);r<e.length;){const l=e[r];if(/^(---|\+\+\+|@@)\s/.test(l))break;const c=/^(?:Index:|diff(?: -r \w+)+)\s+(.+?)\s*$/.exec(l);c&&(a.index=c[1]),r++}for(s(a),s(a),a.hunks=[];r<e.length;){const l=e[r];if(/^(Index:\s|diff\s|---\s|\+\+\+\s|===================================================================)/.test(l))break;if(/^@@/.test(l))a.hunks.push(o());else{if(l)throw new Error("Unknown line "+(r+1)+" "+JSON.stringify(l));r++}}}function s(a){const l=/^(---|\+\+\+)\s+(.*)\r?$/.exec(e[r]);if(l){const c=l[2].split(" ",2),u=(c[1]||"").trim();let f=c[0].replace(/\\\\/g,"\\");/^".*"$/.test(f)&&(f=f.substr(1,f.length-2)),l[1]==="---"?(a.oldFileName=f,a.oldHeader=u):(a.newFileName=f,a.newHeader=u),r++}}function o(){var a;const l=r,c=e[r++],u=c.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/),f={oldStart:+u[1],oldLines:typeof u[2]>"u"?1:+u[2],newStart:+u[3],newLines:typeof u[4]>"u"?1:+u[4],lines:[]};f.oldLines===0&&(f.oldStart+=1),f.newLines===0&&(f.newStart+=1);let m=0,y=0;for(;r<e.length&&(y<f.oldLines||m<f.newLines||!((a=e[r])===null||a===void 0)&&a.startsWith("\\"));r++){const b=e[r].length==0&&r!=e.length-1?" ":e[r][0];if(b==="+"||b==="-"||b===" "||b==="\\")f.lines.push(e[r]),b==="+"?m++:b==="-"?y++:b===" "&&(m++,y++);else throw new Error(`Hunk at line ${l+1} contained invalid line ${e[r]}`)}if(!m&&f.newLines===1&&(f.newLines=0),!y&&f.oldLines===1&&(f.oldLines=0),m!==f.newLines)throw new Error("Added line count did not match for hunk at line "+(l+1));if(y!==f.oldLines)throw new Error("Removed line count did not match for hunk at line "+(l+1));return f}for(;r<e.length;)i();return n}function Zp(t,e,n){let r=!0,i=!1,s=!1,o=1;return function a(){if(r&&!s){if(i?o++:r=!1,t+o<=n)return t+o;s=!0}if(!i)return s||(r=!0),e<=t-o?t-o++:(i=!0,a())}}function Kl(t,e,n={}){let r;if(typeof e=="string"?r=Vs(e):Array.isArray(e)?r=e:r=[e],r.length>1)throw new Error("applyPatch only works with a single input.");return em(t,r[0],n)}function em(t,e,n={}){(n.autoConvertLineEndings||n.autoConvertLineEndings==null)&&(Fp(t)&&Jp(e)?e=Hl(e):Bp(t)&&Xp(e)&&(e=Wl(e)));const r=t.split(`
|
|
77
|
+
`),i=e.hunks,s=n.compareLine||((b,I,F,D)=>I===D),o=n.fuzzFactor||0;let a=0;if(o<0||!Number.isInteger(o))throw new Error("fuzzFactor must be a non-negative integer");if(!i.length)return t;let l="",c=!1,u=!1;for(let b=0;b<i[i.length-1].lines.length;b++){const I=i[i.length-1].lines[b];I[0]=="\\"&&(l[0]=="+"?c=!0:l[0]=="-"&&(u=!0)),l=I}if(c){if(u){if(!o&&r[r.length-1]=="")return!1}else if(r[r.length-1]=="")r.pop();else if(!o)return!1}else if(u){if(r[r.length-1]!="")r.push("");else if(!o)return!1}function f(b,I,F,D=0,T=!0,v=[],p=0){let h=0,S=!1;for(;D<b.length;D++){const O=b[D],N=O.length>0?O[0]:" ",H=O.length>0?O.substr(1):O;if(N==="-")if(s(I+1,r[I],N,H))I++,h=0;else return!F||r[I]==null?null:(v[p]=r[I],f(b,I+1,F-1,D,!1,v,p+1));if(N==="+"){if(!T)return null;v[p]=H,p++,h=0,S=!0}if(N===" ")if(h++,v[p]=r[I],s(I+1,r[I],N,H))p++,T=!0,S=!1,I++;else return S||!F?null:r[I]&&(f(b,I+1,F-1,D+1,!1,v,p+1)||f(b,I+1,F-1,D,!1,v,p+1))||f(b,I,F-1,D+1,!1,v,p)}return p-=h,I-=h,v.length=p,{patchedLines:v,oldLineLastI:I-1}}const m=[];let y=0;for(let b=0;b<i.length;b++){const I=i[b];let F;const D=r.length-I.oldLines+o;let T;for(let v=0;v<=o;v++){T=I.oldStart+y-1;const p=Zp(T,a,D);for(;T!==void 0&&(F=f(I.lines,T,v),!F);T=p());if(F)break}if(!F)return!1;for(let v=a;v<T;v++)m.push(r[v]);for(let v=0;v<F.patchedLines.length;v++){const p=F.patchedLines[v];m.push(p)}a=F.oldLineLastI+1,y=T+1-I.oldStart}for(let b=a;b<r.length;b++)m.push(r[b]);return m.join(`
|
|
78
|
+
`)}function tm(t,e){const n=typeof t=="string"?Vs(t):t;let r=0;function i(){const s=n[r++];if(!s)return e.complete();e.loadFile(s,function(o,a){if(o)return e.complete(o);const l=Kl(a,s,e);e.patched(s,l,function(c){if(c)return e.complete(c);i()})})}i()}function Vl(t){return Array.isArray(t)?t.map(e=>Vl(e)).reverse():Object.assign(Object.assign({},t),{oldFileName:t.newFileName,oldHeader:t.newHeader,newFileName:t.oldFileName,newHeader:t.oldHeader,hunks:t.hunks.map(e=>({oldLines:e.newLines,oldStart:e.newStart,newLines:e.oldLines,newStart:e.oldStart,lines:e.lines.map(n=>n.startsWith("-")?`+${n.slice(1)}`:n.startsWith("+")?`-${n.slice(1)}`:n)}))})}function Ys(t,e,n,r,i,s,o){let a;o?typeof o=="function"?a={callback:o}:a=o:a={},typeof a.context>"u"&&(a.context=4);const l=a.context;if(a.newlineIsToken)throw new Error("newlineIsToken may not be used with patch-generation functions, only with diffing functions");if(a.callback){const{callback:u}=a;di(n,r,Object.assign(Object.assign({},a),{callback:f=>{const m=c(f);u(m)}}))}else return c(di(n,r,a));function c(u){if(!u)return;u.push({value:"",lines:[]});function f(T){return T.map(function(v){return" "+v})}const m=[];let y=0,b=0,I=[],F=1,D=1;for(let T=0;T<u.length;T++){const v=u[T],p=v.lines||rm(v.value);if(v.lines=p,v.added||v.removed){if(!y){const h=u[T-1];y=F,b=D,h&&(I=l>0?f(h.lines.slice(-l)):[],y-=I.length,b-=I.length)}for(const h of p)I.push((v.added?"+":"-")+h);v.added?D+=p.length:F+=p.length}else{if(y)if(p.length<=l*2&&T<u.length-2)for(const h of f(p))I.push(h);else{const h=Math.min(p.length,l);for(const O of f(p.slice(0,h)))I.push(O);const S={oldStart:y,oldLines:F-y+h,newStart:b,newLines:D-b+h,lines:I};m.push(S),y=0,b=0,I=[]}F+=p.length,D+=p.length}}for(const T of m)for(let v=0;v<T.lines.length;v++)T.lines[v].endsWith(`
|
|
79
|
+
`)?T.lines[v]=T.lines[v].slice(0,-1):(T.lines.splice(v+1,0,"\"),v++);return{oldFileName:t,newFileName:e,oldHeader:i,newHeader:s,hunks:m}}}function pi(t){if(Array.isArray(t))return t.map(pi).join(`
|
|
80
80
|
`);const e=[];t.oldFileName==t.newFileName&&e.push("Index: "+t.oldFileName),e.push("==================================================================="),e.push("--- "+t.oldFileName+(typeof t.oldHeader>"u"?"":" "+t.oldHeader)),e.push("+++ "+t.newFileName+(typeof t.newHeader>"u"?"":" "+t.newHeader));for(let n=0;n<t.hunks.length;n++){const r=t.hunks[n];r.oldLines===0&&(r.oldStart-=1),r.newLines===0&&(r.newStart-=1),e.push("@@ -"+r.oldStart+","+r.oldLines+" +"+r.newStart+","+r.newLines+" @@");for(const i of r.lines)e.push(i)}return e.join(`
|
|
81
81
|
`)+`
|
|
82
|
-
`}function
|
|
82
|
+
`}function Gs(t,e,n,r,i,s,o){if(typeof o=="function"&&(o={callback:o}),o?.callback){const{callback:a}=o;Ys(t,e,n,r,i,s,Object.assign(Object.assign({},o),{callback:l=>{a(l?pi(l):void 0)}}))}else{const a=Ys(t,e,n,r,i,s,o);return a?pi(a):void 0}}function nm(t,e,n,r,i,s){return Gs(t,t,e,n,r,i,s)}function rm(t){const e=t.endsWith(`
|
|
83
83
|
`),n=t.split(`
|
|
84
84
|
`).map(r=>r+`
|
|
85
|
-
`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function
|
|
85
|
+
`);return e?n.pop():n.push(n.pop().slice(0,-1)),n}function im(t){const e=[];let n,r;for(let i=0;i<t.length;i++)n=t[i],n.added?r=1:n.removed?r=-1:r=0,e.push([r,n.value]);return e}function sm(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];r.added?e.push("<ins>"):r.removed&&e.push("<del>"),e.push(om(r.value)),r.added?e.push("</ins>"):r.removed&&e.push("</del>")}return e.join("")}function om(t){let e=t;return e=e.replace(/&/g,"&"),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/"/g,"""),e}const am=Object.freeze(Object.defineProperty({__proto__:null,Diff:jt,applyPatch:Kl,applyPatches:tm,arrayDiff:ql,canonicalize:hi,characterDiff:kl,convertChangesToDMP:im,convertChangesToXML:sm,createPatch:nm,createTwoFilesPatch:Gs,cssDiff:jl,diffArrays:zl,diffChars:Pl,diffCss:Fl,diffJson:Ul,diffLines:di,diffSentences:Ml,diffTrimmedLines:Rl,diffWords:Il,diffWordsWithSpace:Ws,formatPatch:pi,jsonDiff:Bl,lineDiff:Ks,parsePatch:Vs,reversePatch:Vl,sentenceDiff:Ll,structuredPatch:Ys,wordDiff:Tl,wordsWithSpaceDiff:Nl},Symbol.toStringTag,{value:"Module"}));class lm{constructor(e){this.ctx=e,this.JsDiff=am,this.diffChars=Pl,this.diffWords=Il,this.diffWordsWithSpace=Ws,this.diffLines=di,this.diffTrimmedLines=Rl,this.diffSentences=Ml,this.diffCss=Fl,this.diffJson=Ul,this.diffArrays=zl,this.createTwoFilesPatch=Gs,this.ctx.set("jsdiff",this)}}const cm={"diff-container":"_diff-container_lq0si_2"},um=t=>{let{user:e,target:n,ctx:r}=t;const i=r.getUrl.bind(r);return w("span",{className:"mw-userlinks",children:[w("a",{href:i(`User:${e}`),className:"mw-userlink",target:n,children:e})," ",w("span",{className:"mw-usertoollinks",children:["(",w("a",{href:i(`User_talk:${e}`),className:"mw-usertoollinks-talk",target:n,children:"talk"})," | ",w("a",{href:i(`Special:Contributions/${e}`),className:"mw-usertoollinks-contribs",target:n,children:"contribs"})," | ",w("a",{href:i(`Special:Block/${e}`),className:"mw-usertoollinks-block",target:n,children:"block"}),")"]})]})};var mi=(t=>(t.update="ipe:diff-table/update",t.edit="ipe:diff-table/edit",t))(mi||{});const fm=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"medium"}).format,Yl=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 w("td",{colSpan:2,className:e,children:w("div",{className:"mw-diff-title--title",children:t.type==="from"?"Original content":t.type==="to"?"Your content":""})});const n=r=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/edit",{detail:{revid:t.revid},bubbles:!0}))};return w("td",{colSpan:2,className:e,children:[w("div",{className:"mw-diff-title--title",children:[t.pagetitle||t.timestamp,t.revid?` (rev#${t.revid})`:""]}),w("div",{className:"mw-diff-title--actions",children:w("a",{href:t.ctx.getUrl("",{action:"edit",oldid:t.revid}),onClick:n,children:[w(Ka,{style:"width: 1em; height: 1em"}),"Quick edit"]})}),w("div",{className:"mw-diff-title--user",children:t.username&&w(um,{ctx:t.ctx,user:t.username,target:"_blank"})}),w("div",{className:"mw-diff-title--timestamp",children:t.timestamp&&fm(new Date(t.timestamp))}),w("div",{className:"mw-diff-title--comment",children:t.parsedcomment&&w(Lt,{children:["(",w("i",{innerHTML:t.parsedcomment}),")"]})})]})},dm=t=>{const e=t.data;if(!e.prev&&!e.next)return null;const n=(r,i,s)=>{r.preventDefault(),r.target.dispatchEvent(new CustomEvent("ipe:diff-table/update",{detail:{fromrev:i,torev:s},bubbles:!0}))};return w("tr",{className:"mw-diff-title--navigation",children:[w("td",{colSpan:2,children:e.prev?w("a",{href:t.ctx.getUrl("",{diff:e.prev,oldid:e.fromrevid}),onClick:r=>n(r,e.prev,e.fromrevid),children:"← Previous"}):w("i",{children:"Oldest version"})}),w("td",{colSpan:2,children:e.next?w("a",{href:t.ctx.getUrl("",{diff:e.next,oldid:e.torevid}),onClick:r=>n(r,e.torevid,e.next),children:"Next →"}):w("i",{children:"Newest version"})})]})},hm=t=>{const{data:e,...n}=t,r=w("table",{className:"theme-ipe diff diff-type-table","data-mw":"interface",...n,children:[w("colgroup",{children:[w("col",{className:"diff-marker"}),w("col",{className:"diff-content"}),w("col",{className:"diff-marker"}),w("col",{className:"diff-content"})]}),w("tbody",{children:[w("tr",{children:[w(Yl,{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}),w(Yl,{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})]}),w(dm,{data:e,ctx:t.ctx}),w("div",{id:"diffbody"}),w("tr",{className:"diff-size",style:{textAlign:"center"},children:[w("td",{colSpan:2,className:"diff-size-old",children:e.fromsize!==void 0&&`${e.fromsize} bytes`}),w("td",{colSpan:2,className:"diff-size-new",children:e.tosize!==void 0&&`${e.tosize} bytes`})]})]})]});return r.querySelector("#diffbody").outerHTML=e.body||w("tr",{children:w("td",{colSpan:4,children:w("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"5rem"},children:w("i",{children:"No changes"})})})}).outerHTML,r},pm=(t,e=document)=>e.querySelector(t),mm=(t,e=document)=>e.querySelectorAll(t);var gm=Object.create,Qs=Object.defineProperty,vm=Object.getOwnPropertyDescriptor,Gl=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ql=t=>{throw TypeError(t)},ym=(t,e,n)=>e in t?Qs(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bm=(t,e)=>Qs(t,"name",{value:e,configurable:!0}),wm=t=>[,,,gm(t?.[Gl("metadata")]??null)],_m=["class","method","getter","setter","accessor","field","value","get","set"],Jl=t=>t!==void 0&&typeof t!="function"?Ql("Function expected"):t,xm=(t,e,n,r,i)=>({kind:_m[t],name:e,metadata:r,addInitializer:s=>n._?Ql("Already initialized"):i.push(Jl(s||null))}),Sm=(t,e)=>ym(e,Gl("metadata"),t[3]),Em=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},km=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&vm(i,n));bm(i,n);for(var b=r.length-1;b>=0;b--)l=xm(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,Jl(o)&&(i=o);return Sm(t,i),y&&Qs(i,n,y),u?c^4?s:y:i},Xl,Js,Zl;const ec=["diffChars","diffWords","diffSentences","diffLines","createTwoFilesPatch"];Xl=[We(["jsdiff","wiki","getUrl"]),Pn(fe.object({"quickDiff.preferredCompareMode":fe.union([fe.const("jsDiff"),fe.const("mwApi")]).description("The preferred comparison mode for quick diff").default("mwApi"),"quickDiff.jsDiff.defaultType":fe.union(ec.map(t=>fe.const(t))).description("The default diff type for JsDiff").default("diffSentences")}).description("Quick Diff Preferences"),{"quickDiff.preferredCompareMode":"mwApi","quickDiff.jsDiff.defaultType":"diffSentences"})];class gi extends(Zl=it){constructor(e){super(e,{},"quick-diff"),this.ctx=e,this.VALID_DIFF_TYPES=ec,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(){this.ctx.off("quick-edit/wiki-page",this.injectQuickEdit.bind(this))}injectHistoryPage(){const e=pm("#mw-history-compare");if(!e)return;mm(".mw-history-compareselectedversions-button",e).forEach(r=>{r.after(w("button",{className:"cdx-button",onClick:i=>{i.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"}))})}injectQuickEdit({modal:e,wikiPage:n}){if(n.pageid===0)return;let r;e.addButton({label:"Diff",side:"left",keyPress:"ctrl-d",className:"btn btn-secondary",method:()=>{const i=n.title,s=n.revisions?.[0]?.content||"",o=e.get$content().querySelector('textarea[name="text"]')?.value||"";return s===o?this.ctx.modal.notify("info",{title:"Quick Diff",content:"No changes"}):(r=this.comparePages({fromtitle:i,fromtext:s,totitle:i,totext:o,topst:!0},r,{backdrop:!1,draggable:!0}),r)}},2),e.on(e.Event.Close,()=>{r?.destroy(),r=void 0})}simpleTextDiff(e,n){const r=this.ctx.modal.show({title:"Quick Diff",className:"in-page-edit ipe-quickDiff"});r.show();const i=w("pre",{className:cm["diff-container"]}),s=w("div",{style:{display:"flex",gap:"1em"},children:this.VALID_DIFF_TYPES.map((o,a)=>w(rl,{name:"diffType",value:o,label:o,inputProps:{checked:a===0}}))});r.setContent(w("section",{children:[s,i]})),s.querySelectorAll('input[name="diffType"]').forEach(o=>{o.addEventListener("change",()=>{const a=this.renderJsDiff(e,n,o.value);i.textContent="",i.appendChild(a)})}),s.querySelector('input[name="diffType"]').dispatchEvent(new Event("change"))}renderJsDiff(e,n,r="diffSentences"){const i=document.createDocumentFragment();let s;if(r==="createTwoFilesPatch"){let o=!1;s=this.ctx.jsdiff.createTwoFilesPatch("original.txt","modified.txt",e,n).split(`
|
|
86
86
|
`).map(function(a){const l={value:a+`
|
|
87
|
-
`};return a.startsWith("@@")?(l.chunkHeader=!0,o=!0):o&&(a.startsWith("-")?l.removed=!0:a.startsWith("+")&&(l.added=!0)),l})}else{const o=this.ctx.jsdiff[r];if(!o)throw new Error(`Missing DiffEngine for ${r}`);s=o(e,n)}if(!Array.isArray(s))throw new Error("Missing diff result");for(let o=0;o<s.length;o++){if(s[o].added&&s[o+1]&&s[o+1].removed){const l=s[o];s[o]=s[o+1],s[o+1]=l}let a;s[o].removed?(a=document.createElement("del"),a.appendChild(document.createTextNode(s[o].value))):s[o].added?(a=document.createElement("ins"),a.appendChild(document.createTextNode(s[o].value))):s[o].chunkHeader?(a=document.createElement("span"),a.setAttribute("class","chunk-header"),a.appendChild(document.createTextNode(s[o].value))):a=document.createTextNode(s[o].value),i.appendChild(a)}return i}comparePages(e,n,r){return
|
|
88
|
-
`),{cause:i})}if(!i.data.compare)throw new Error("No compare data received",{cause:i});const{data:{compare:s}}=i;n.setTitle(s.fromtitle&&s.totitle?`${s.fromtitle} ⇔ ${s.totitle}`:"Differences")
|
|
87
|
+
`};return a.startsWith("@@")?(l.chunkHeader=!0,o=!0):o&&(a.startsWith("-")?l.removed=!0:a.startsWith("+")&&(l.added=!0)),l})}else{const o=this.ctx.jsdiff[r];if(!o)throw new Error(`Missing DiffEngine for ${r}`);s=o(e,n)}if(!Array.isArray(s))throw new Error("Missing diff result");for(let o=0;o<s.length;o++){if(s[o].added&&s[o+1]&&s[o+1].removed){const l=s[o];s[o]=s[o+1],s[o+1]=l}let a;s[o].removed?(a=document.createElement("del"),a.appendChild(document.createTextNode(s[o].value))):s[o].added?(a=document.createElement("ins"),a.appendChild(document.createTextNode(s[o].value))):s[o].chunkHeader?(a=document.createElement("span"),a.setAttribute("class","chunk-header"),a.appendChild(document.createTextNode(s[o].value))):a=document.createTextNode(s[o].value),i.appendChild(a)}return i}comparePages(e,n,r){return!n||n.isDestroyed?n=this.ctx.modal.createObject({title:"Loading diff...",content:"",className:"quick-diff",center:!1,...r}).init():n.removeButton("*"),n.setContent(w("section",{style:{height:"70vh",display:"flex",justifyContent:"center",alignItems:"center"},children:w(Yt,{})})),n.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(i=>{if(i.data?.error||i.data?.errors){const a=[i.data?.error,...i.data?.errors||[]].filter(Boolean);throw new Error(a.map(l=>l.info).join(`
|
|
88
|
+
`),{cause:i})}if(!i.data.compare)throw new Error("No compare data received",{cause:i});const{data:{compare:s}}=i;n.setTitle(s.fromtitle&&s.totitle?`${s.fromtitle}${s.fromrevid?` (${s.fromrevid})`:""} ⇔ ${s.totitle}${s.torevid?` (${s.torevid})`:""}`:"Differences");let o;n.setContent(w("section",{style:{minHeight:"70vh"},children:w(hm,{ref:a=>o=a,data:s,ctx:this.ctx})})),o.addEventListener(mi.update,a=>{a.stopPropagation(),this.comparePages({fromrev:a.detail.fromrev,torev:a.detail.torev},n,r)},{once:!0}),this.ctx.inject(["quickEdit"],a=>{const l=c=>{c.stopPropagation(),a.quickEdit({revision:c.detail.revid})};o.addEventListener(mi.edit,l),n.on(n.Event.Close,()=>{o.removeEventListener(mi.edit,l)})}),s.fromrevid&&s.torevid&&n.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(i=>{n.setContent(w(sr,{title:"Failed to load diff",type:"error",children:w("pre",{children:i instanceof Error?i.message:String(i)})}))}),n.show()}}Js=wm(Zl),gi=km(Js,0,"PluginQuickDiffCore",Xl,gi),Em(Js,1,gi);const Xo=class Xo extends it{constructor(e){super(e,{},"quick-diff-loader"),this.ctx=e,e.plugin(lm),e.plugin(gi)}};Xo.inject=["api","wikiPage","modal"];let Xs=Xo;const Pm=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickDiff:Xs},Symbol.toStringTag,{value:"Module"})),Zo=class Zo extends it{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")||"",n=window.mw?.config.get("wgIsProbablyEditable");this.ctx.inject(["toolbox"],r=>{this.ctx=r,r.toolbox.addButton({id:"quick-redirect",icon:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("path",{d:"M4 21v-4a3 3 0 0 1 3 -3h5"}),w("path",{d:"M9 17l3 -3l-3 -3"}),w("path",{d:"M14 3v4a1 1 0 0 0 1 1h4"}),w("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(n?{to:e}:{})}}),this.addDisposeHandler(i=>{i.toolbox.removeButton("quick-redirect")})})}stop(){}quickRedirect(e){const n=this.ctx.modal.createObject({title:"Quick Redirect",content:w(Yt,{}),className:"quick-redirect compact-buttons",sizeClass:"smallToMedium",center:!0}).init();let r=null;return n.setContent(w("form",{ref:i=>r=i,style:{display:"flex",flexDirection:"column",gap:"1rem"},onSubmit:i=>{if(i.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}n.setLoadingState(!0),this.redirectPage(o).then(a=>{n.close(),this.ctx.modal.notify("success",{title:"Redirect successful",content:"The redirect has been created."})}).catch(a=>{n.setLoadingState(!1),this.ctx.modal.notify("error",{title:"Failed to redirect",content:a instanceof Error?a.message:String(a)})})},children:[w(pl,{inputs:[{label:"From",name:"from",value:e?.from,required:!0},{label:"To",name:"to",value:e?.to,required:!0}]}),w(si,{label:"Reason",id:"reason",name:"reason",value:e?.reason}),w("div",{children:w($n,{name:"overwrite",id:"overwrite",checked:e?.overwrite,children:"Force create redirect even if the from page already exists"})})]})),n.setButtons([{label:"Create Redirect",className:"is-primary is-ghost",method:()=>{r?.dispatchEvent(new Event("submit"))}}]),n.show()}async redirectPage(e){const{from:n,to:r,reason:i="",overwrite:s=!1}=e,o=await this.ctx.wikiPage.newBlankPage({title:n}),a=`#REDIRECT [[:${r}]]`,l=await o.edit({text:a,summary:i},{createonly:!s});if(l.data?.errors)throw new Error(l.data.errors[0].text,{cause:l});return l}};Zo.inject=["api","wikiPage","modal"];let Zs=Zo;const $m=Object.freeze(Object.defineProperty({__proto__:null,PluginQuickRedirect:Zs},Symbol.toStringTag,{value:"Module"}));var Cm=Object.create,eo=Object.defineProperty,Om=Object.getOwnPropertyDescriptor,tc=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),nc=t=>{throw TypeError(t)},Tm=(t,e,n)=>e in t?eo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Im=(t,e)=>eo(t,"name",{value:e,configurable:!0}),Am=t=>[,,,Cm(t?.[tc("metadata")]??null)],Nm=["class","method","getter","setter","accessor","field","value","get","set"],rc=t=>t!==void 0&&typeof t!="function"?nc("Function expected"):t,Rm=(t,e,n,r,i)=>({kind:Nm[t],name:e,metadata:r,addInitializer:s=>n._?nc("Already initialized"):i.push(rc(s||null))}),Dm=(t,e)=>Tm(e,tc("metadata"),t[3]),Lm=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Mm=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&Om(i,n));Im(i,n);for(var b=r.length-1;b>=0;b--)l=Rm(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,rc(o)&&(i=o);return Dm(t,i),y&&eo(i,n,y),u?c^4?s:y:i},ic,to,sc;ic=[Pn(fe.object({toolboxAlwaysShow:fe.boolean().description("Make the toolbox opened by default").default(!1)}).description("Toolbox preferences")),We(["preferences"])];class vi extends(sc=cn){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,n){if(n<=1)return 0;const r=.15,i=e/(n-1),s=r*Math.sqrt(i);return Math.round(s*1e3)/1e3}updateButtonDelays(){this.container.querySelectorAll(".btn-group").forEach(n=>{const r=n.querySelectorAll(".btn-tip-group"),i=r.length;r.forEach((s,o)=>{const a=this.calculateButtonDelay(o,i);s.style.setProperty("--transition-delay",`${a}s`),s.style.setProperty("--max-transition-delay","0.15s")})})}createToolbox(){return w("div",{id:"ipe-edit-toolbox",children:[w("ul",{className:"btn-group group1",style:{display:"flex",flexDirection:"column"}}),w("ul",{className:"btn-group group2",style:{display:"flex",flexDirection:"row"}}),w("button",{className:"ipe-toolbox-btn",id:"toolbox-toggler",onClick:()=>{this.toggle()},children:w("svg",{xmlns:"http://www.w3.org/2000/svg",width:"448",height:"512",viewBox:"0 0 448 512",children:[w("rect",{width:"448",height:"512",fill:"none"}),w("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:n,group:r,icon:i,tooltip:s,itemProps:o,buttonProps:a,onClick:l,index:c}=e;n=this.normalizeButtonId(n);const u=this.container.querySelector(`#${n}`);u&&(this.ctx.logger("toolbox").warn(`Button with id ${n} already exists, replacing it.`),u.remove());let f=null;if(typeof r>"u"||r==="auto"){const y=this.container.querySelector(".btn-group.group1"),b=this.container.querySelector(".btn-group.group2"),I=y?.children.length||0,F=b?.children.length||0;f=I<=F?y:b}else f=this.container.querySelector(`.btn-group.${r}`);if(!f)throw new Error(`Button group ${r} not found`);const m=w("li",{class:"btn-tip-group",id:n,onClick:l,...o,children:[w("div",{class:"btn-tip",children:s}),w("button",{id:`${n}-btn`,class:"ipe-toolbox-btn",...a,children:i})]});return typeof c=="number"?c<=0?f.prepend(m):c>=f.children.length?f.appendChild(m):f.children[c]?.before(m):f.appendChild(m),this.ctx.emit("toolbox/button-added",{ctx:this.ctx,button:m}),this.updateButtonDelays(),m}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 n=this.isPersistent,r=typeof e=="boolean"?e:!n;this.container.classList.toggle("is-persistent",r),this.container.classList.remove("is-hovered"),this.ctx.preferences.set("toolboxAlwaysShow",r)}}to=Am(sc),vi=Mm(to,0,"PluginToolbox",ic,vi),Lm(to,1,vi);const jm=Object.freeze(Object.defineProperty({__proto__:null,get PluginToolbox(){return vi}},Symbol.toStringTag,{value:"Module"}));/**
|
|
89
89
|
* @vue/shared v3.5.22
|
|
90
90
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
91
91
|
* @license MIT
|
|
92
|
-
**/function
|
|
92
|
+
**/function no(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const pe={},Cn=[],kt=()=>{},oc=()=>!1,yi=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),ro=t=>t.startsWith("onUpdate:"),Me=Object.assign,io=(t,e)=>{const n=t.indexOf(e);n>-1&&t.splice(n,1)},Fm=Object.prototype.hasOwnProperty,ge=(t,e)=>Fm.call(t,e),se=Array.isArray,On=t=>bi(t)==="[object Map]",ac=t=>bi(t)==="[object Set]",oe=t=>typeof t=="function",$e=t=>typeof t=="string",Qt=t=>typeof t=="symbol",Ee=t=>t!==null&&typeof t=="object",lc=t=>(Ee(t)||oe(t))&&oe(t.then)&&oe(t.catch),cc=Object.prototype.toString,bi=t=>cc.call(t),Bm=t=>bi(t).slice(8,-1),uc=t=>bi(t)==="[object Object]",so=t=>$e(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,cr=no(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),wi=t=>{const e=Object.create(null);return n=>e[n]||(e[n]=t(n))},Um=/-\w/g,Ft=wi(t=>t.replace(Um,e=>e.slice(1).toUpperCase())),qm=/\B([A-Z])/g,Jt=wi(t=>t.replace(qm,"-$1").toLowerCase()),fc=wi(t=>t.charAt(0).toUpperCase()+t.slice(1)),oo=wi(t=>t?`on${fc(t)}`:""),et=(t,e)=>!Object.is(t,e),ao=(t,...e)=>{for(let n=0;n<t.length;n++)t[n](...e)},dc=(t,e,n,r=!1)=>{Object.defineProperty(t,e,{configurable:!0,enumerable:!1,writable:r,value:n})},zm=t=>{const e=parseFloat(t);return isNaN(e)?t:e};let hc;const _i=()=>hc||(hc=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function lo(t){if(se(t)){const e={};for(let n=0;n<t.length;n++){const r=t[n],i=$e(r)?Vm(r):lo(r);if(i)for(const s in i)e[s]=i[s]}return e}else if($e(t)||Ee(t))return t}const Hm=/;(?![^(]*\))/g,Wm=/:([^]+)/,Km=/\/\*[^]*?\*\//g;function Vm(t){const e={};return t.replace(Km,"").split(Hm).forEach(n=>{if(n){const r=n.split(Wm);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}function xi(t){let e="";if($e(t))e=t;else if(se(t))for(let n=0;n<t.length;n++){const r=xi(t[n]);r&&(e+=r+" ")}else if(Ee(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}const Ym=no("itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly");function pc(t){return!!t||t===""}const mc=t=>!!(t&&t.__v_isRef===!0),co=t=>$e(t)?t:t==null?"":se(t)||Ee(t)&&(t.toString===cc||!oe(t.toString))?mc(t)?co(t.value):JSON.stringify(t,gc,2):String(t),gc=(t,e)=>mc(e)?gc(t,e.value):On(e)?{[`Map(${e.size})`]:[...e.entries()].reduce((n,[r,i],s)=>(n[uo(r,s)+" =>"]=i,n),{})}:ac(e)?{[`Set(${e.size})`]:[...e.values()].map(n=>uo(n))}:Qt(e)?uo(e):Ee(e)&&!se(e)&&!uc(e)?String(e):e,uo=(t,e="")=>{var n;return Qt(t)?`Symbol(${(n=t.description)!=null?n:e})`:t};/**
|
|
93
93
|
* @vue/reactivity v3.5.22
|
|
94
94
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
95
95
|
* @license MIT
|
|
96
|
-
**/let et;class Um{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=et,!e&&et&&(this.index=(et.scopes||(et.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=et;try{return et=this,e()}finally{et=n}}}on(){++this._on===1&&(this.prevScope=et,et=this)}off(){this._on>0&&--this._on===0&&(et=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function zm(){return et}let we;const lo=new WeakSet;class hc{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,et&&et.active&&et.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,lo.has(this)&&(lo.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||mc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,_c(this),gc(this);const e=we,n=gt;we=this,gt=!0;try{return this.fn()}finally{vc(this),we=e,gt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)ho(e);this.deps=this.depsTail=void 0,_c(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?lo.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){fo(this)&&this.run()}get dirty(){return fo(this)}}let pc=0,lr,cr;function mc(t,e=!1){if(t.flags|=8,e){t.next=cr,cr=t;return}t.next=lr,lr=t}function co(){pc++}function uo(){if(--pc>0)return;if(cr){let e=cr;for(cr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;lr;){let e=lr;for(lr=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function gc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function vc(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),ho(r),Hm(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function fo(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(yc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function yc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===ur)||(t.globalVersion=ur,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!fo(t))))return;t.flags|=2;const e=t.dep,n=we,r=gt;we=t,gt=!0;try{gc(t);const i=t.fn(t._value);(e.version===0||Ze(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{we=n,gt=r,vc(t),t.flags&=-3}}function ho(t,e=!1){const{dep:n,prevSub:r,nextSub:i}=t;if(r&&(r.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)ho(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function Hm(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let gt=!0;const bc=[];function Et(){bc.push(gt),gt=!1}function kt(){const t=bc.pop();gt=t===void 0?!0:t}function _c(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=we;we=void 0;try{e()}finally{we=n}}}let ur=0;class qm{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class bi{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(!we||!gt||we===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==we)n=this.activeLink=new qm(we,this),we.deps?(n.prevDep=we.depsTail,we.depsTail.nextDep=n,we.depsTail=n):we.deps=we.depsTail=n,wc(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=we.depsTail,n.nextDep=void 0,we.depsTail.nextDep=n,we.depsTail=n,we.deps===n&&(we.deps=r)}return n}trigger(e){this.version++,ur++,this.notify(e)}notify(e){co();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{uo()}}}function wc(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)wc(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const po=new WeakMap,fn=Symbol(""),mo=Symbol(""),fr=Symbol("");function He(t,e,n){if(gt&&we){let r=po.get(t);r||po.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new bi),i.map=r,i.key=n),i.track()}}function jt(t,e,n,r,i,s){const o=po.get(t);if(!o){ur++;return}const a=l=>{l&&l.trigger()};if(co(),e==="clear")o.forEach(a);else{const l=se(t),u=l&&no(n);if(l&&n==="length"){const c=Number(r);o.forEach((f,v)=>{(v==="length"||v===fr||!Yt(v)&&v>=c)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),u&&a(o.get(fr)),e){case"add":l?u&&a(o.get("length")):(a(o.get(fn)),$n(t)&&a(o.get(mo)));break;case"delete":l||(a(o.get(fn)),$n(t)&&a(o.get(mo)));break;case"set":$n(t)&&a(o.get(fn));break}}uo()}function Cn(t){const e=fe(t);return e===t?e:(He(e,"iterate",fr),ut(t)?e:e.map(Me))}function _i(t){return He(t=fe(t),"iterate",fr),t}const Wm={__proto__:null,[Symbol.iterator](){return go(this,Symbol.iterator,Me)},concat(...t){return Cn(this).concat(...t.map(e=>se(e)?Cn(e):e))},entries(){return go(this,"entries",t=>(t[1]=Me(t[1]),t))},every(t,e){return Ft(this,"every",t,e,void 0,arguments)},filter(t,e){return Ft(this,"filter",t,e,n=>n.map(Me),arguments)},find(t,e){return Ft(this,"find",t,e,Me,arguments)},findIndex(t,e){return Ft(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ft(this,"findLast",t,e,Me,arguments)},findLastIndex(t,e){return Ft(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ft(this,"forEach",t,e,void 0,arguments)},includes(...t){return vo(this,"includes",t)},indexOf(...t){return vo(this,"indexOf",t)},join(t){return Cn(this).join(t)},lastIndexOf(...t){return vo(this,"lastIndexOf",t)},map(t,e){return Ft(this,"map",t,e,void 0,arguments)},pop(){return dr(this,"pop")},push(...t){return dr(this,"push",t)},reduce(t,...e){return xc(this,"reduce",t,e)},reduceRight(t,...e){return xc(this,"reduceRight",t,e)},shift(){return dr(this,"shift")},some(t,e){return Ft(this,"some",t,e,void 0,arguments)},splice(...t){return dr(this,"splice",t)},toReversed(){return Cn(this).toReversed()},toSorted(t){return Cn(this).toSorted(t)},toSpliced(...t){return Cn(this).toSpliced(...t)},unshift(...t){return dr(this,"unshift",t)},values(){return go(this,"values",Me)}};function go(t,e,n){const r=_i(t),i=r[e]();return r!==t&&!ut(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const Vm=Array.prototype;function Ft(t,e,n,r,i,s){const o=_i(t),a=o!==t&&!ut(t),l=o[e];if(l!==Vm[e]){const f=l.apply(t,s);return a?Me(f):f}let u=n;o!==t&&(a?u=function(f,v){return n.call(this,Me(f),v,t)}:n.length>2&&(u=function(f,v){return n.call(this,f,v,t)}));const c=l.call(o,u,r);return a&&i?i(c):c}function xc(t,e,n,r){const i=_i(t);let s=n;return i!==t&&(ut(t)?n.length>3&&(s=function(o,a,l){return n.call(this,o,a,l,t)}):s=function(o,a,l){return n.call(this,o,Me(a),l,t)}),i[e](s,...r)}function vo(t,e,n){const r=fe(t);He(r,"iterate",fr);const i=r[e](...n);return(i===-1||i===!1)&&wo(n[0])?(n[0]=fe(n[0]),r[e](...n)):i}function dr(t,e,n=[]){Et(),co();const r=fe(t)[e].apply(t,n);return uo(),kt(),r}const Km=Zs("__proto__,__v_isRef,__isVue"),Sc=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Yt));function Ym(t){Yt(t)||(t=String(t));const e=fe(this);return He(e,"has",t),e.hasOwnProperty(t)}class Ec{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(i?s?Ic:Oc:s?Pc:Cc).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=Wm[n]))return l;if(n==="hasOwnProperty")return Ym}const a=Reflect.get(e,n,Re(e)?e:r);if((Yt(n)?Sc.has(n):Km(n))||(i||He(e,"get",n),s))return a;if(Re(a)){const l=o&&no(n)?a:a.value;return i&&xe(l)?_o(l):l}return xe(a)?i?_o(a):bo(a):a}}class kc extends Ec{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=Jt(s);if(!ut(r)&&!Jt(r)&&(s=fe(s),r=fe(r)),!se(e)&&Re(s)&&!Re(r))return l||(s.value=r),!0}const o=se(e)&&no(n)?Number(n)<e.length:pe(e,n),a=Reflect.set(e,n,r,Re(e)?e:i);return e===fe(i)&&(o?Ze(r,s)&&jt(e,"set",n,r):jt(e,"add",n,r)),a}deleteProperty(e,n){const r=pe(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&jt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!Yt(n)||!Sc.has(n))&&He(e,"has",n),r}ownKeys(e){return He(e,"iterate",se(e)?"length":fn),Reflect.ownKeys(e)}}class $c extends Ec{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const Gm=new kc,Jm=new $c,Qm=new kc(!0),Xm=new $c(!0),yo=t=>t,wi=t=>Reflect.getPrototypeOf(t);function Zm(t,e,n){return function(...r){const i=this.__v_raw,s=fe(i),o=$n(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,u=i[t](...r),c=n?yo:e?ki:Me;return!e&&He(s,"iterate",l?mo:fn),{next(){const{value:f,done:v}=u.next();return v?{value:f,done:v}:{value:a?[c(f[0]),c(f[1])]:c(f),done:v}},[Symbol.iterator](){return this}}}}function xi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function eg(t,e){const n={get(i){const s=this.__v_raw,o=fe(s),a=fe(i);t||(Ze(i,a)&&He(o,"get",i),He(o,"get",a));const{has:l}=wi(o),u=e?yo:t?ki:Me;if(l.call(o,i))return u(s.get(i));if(l.call(o,a))return u(s.get(a));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!t&&He(fe(i),"iterate",fn),i.size},has(i){const s=this.__v_raw,o=fe(s),a=fe(i);return t||(Ze(i,a)&&He(o,"has",i),He(o,"has",a)),i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){const o=this,a=o.__v_raw,l=fe(a),u=e?yo:t?ki:Me;return!t&&He(l,"iterate",fn),a.forEach((c,f)=>i.call(s,u(c),u(f),o))}};return Le(n,t?{add:xi("add"),set:xi("set"),delete:xi("delete"),clear:xi("clear")}:{add(i){!e&&!ut(i)&&!Jt(i)&&(i=fe(i));const s=fe(this);return wi(s).has.call(s,i)||(s.add(i),jt(s,"add",i,i)),this},set(i,s){!e&&!ut(s)&&!Jt(s)&&(s=fe(s));const o=fe(this),{has:a,get:l}=wi(o);let u=a.call(o,i);u||(i=fe(i),u=a.call(o,i));const c=l.call(o,i);return o.set(i,s),u?Ze(s,c)&&jt(o,"set",i,s):jt(o,"add",i,s),this},delete(i){const s=fe(this),{has:o,get:a}=wi(s);let l=o.call(s,i);l||(i=fe(i),l=o.call(s,i)),a&&a.call(s,i);const u=s.delete(i);return l&&jt(s,"delete",i,void 0),u},clear(){const i=fe(this),s=i.size!==0,o=i.clear();return s&&jt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=Zm(i,t,e)}),n}function Si(t,e){const n=eg(t,e);return(r,i,s)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(pe(n,i)&&i in r?n:r,i,s)}const tg={get:Si(!1,!1)},ng={get:Si(!1,!0)},rg={get:Si(!0,!1)},ig={get:Si(!0,!0)},Cc=new WeakMap,Pc=new WeakMap,Oc=new WeakMap,Ic=new WeakMap;function sg(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function og(t){return t.__v_skip||!Object.isExtensible(t)?0:sg(Am(t))}function bo(t){return Jt(t)?t:Ei(t,!1,Gm,tg,Cc)}function ag(t){return Ei(t,!1,Qm,ng,Pc)}function _o(t){return Ei(t,!0,Jm,rg,Oc)}function wb(t){return Ei(t,!0,Xm,ig,Ic)}function Ei(t,e,n,r,i){if(!xe(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=og(t);if(s===0)return t;const o=i.get(t);if(o)return o;const a=new Proxy(t,s===2?r:n);return i.set(t,a),a}function Pn(t){return Jt(t)?Pn(t.__v_raw):!!(t&&t.__v_isReactive)}function Jt(t){return!!(t&&t.__v_isReadonly)}function ut(t){return!!(t&&t.__v_isShallow)}function wo(t){return t?!!t.__v_raw:!1}function fe(t){const e=t&&t.__v_raw;return e?fe(e):t}function lg(t){return!pe(t,"__v_skip")&&Object.isExtensible(t)&&lc(t,"__v_skip",!0),t}const Me=t=>xe(t)?bo(t):t,ki=t=>xe(t)?_o(t):t;function Re(t){return t?t.__v_isRef===!0:!1}function Tc(t){return Ac(t,!1)}function $i(t){return Ac(t,!0)}function Ac(t,e){return Re(t)?t:new cg(t,e)}class cg{constructor(e,n){this.dep=new bi,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:fe(e),this._value=n?e:Me(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||ut(e)||Jt(e);e=r?e:fe(e),Ze(e,n)&&(this._rawValue=e,this._value=r?e:Me(e),this.dep.trigger())}}function Nc(t){return Re(t)?t.value:t}const ug={get:(t,e,n)=>e==="__v_raw"?t:Nc(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return Re(i)&&!Re(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function Rc(t){return Pn(t)?t:new Proxy(t,ug)}class fg{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new bi,{get:r,set:i}=e(n.track.bind(n),n.trigger.bind(n));this._get=r,this._set=i}get value(){return this._value=this._get()}set value(e){this._set(e)}}function dg(t){return new fg(t)}class hg{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new bi(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ur-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&we!==this)return mc(this,!0),!0}get value(){const e=this.dep.track();return yc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function pg(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new hg(r,i,n)}const Ci={},Pi=new WeakMap;let dn;function mg(t,e=!1,n=dn){if(n){let r=Pi.get(n);r||Pi.set(n,r=[]),r.push(t)}}function gg(t,e,n=he){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,u=p=>i?p:ut(p)||i===!1||i===0?Qt(p,1):Qt(p);let c,f,v,y,b=!1,I=!1;if(Re(t)?(f=()=>t.value,b=ut(t)):Pn(t)?(f=()=>u(t),b=!0):se(t)?(I=!0,b=t.some(p=>Pn(p)||ut(p)),f=()=>t.map(p=>{if(Re(p))return p.value;if(Pn(p))return u(p);if(oe(p))return l?l(p,2):p()})):oe(t)?e?f=l?()=>l(t,2):t:f=()=>{if(v){Et();try{v()}finally{kt()}}const p=dn;dn=c;try{return l?l(t,3,[y]):t(y)}finally{dn=p}}:f=St,e&&i){const p=f,h=i===!0?1/0:i;f=()=>Qt(p(),h)}const U=zm(),D=()=>{c.stop(),U&&U.active&&to(U.effects,c)};if(s&&e){const p=e;e=(...h)=>{p(...h),D()}}let T=I?new Array(t.length).fill(Ci):Ci;const g=p=>{if(!(!(c.flags&1)||!c.dirty&&!p))if(e){const h=c.run();if(i||b||(I?h.some((S,O)=>Ze(S,T[O])):Ze(h,T))){v&&v();const S=dn;dn=c;try{const O=[h,T===Ci?void 0:I&&T[0]===Ci?[]:T,y];T=h,l?l(e,3,O):e(...O)}finally{dn=S}}}else c.run()};return a&&a(g),c=new hc(f),c.scheduler=o?()=>o(g,!1):g,y=p=>mg(p,!1,c),v=c.onStop=()=>{const p=Pi.get(c);if(p){if(l)l(p,4);else for(const h of p)h();Pi.delete(c)}},e?r?g(!0):T=c.run():o?o(g.bind(null,!0),!0):c.run(),D.pause=c.pause.bind(c),D.resume=c.resume.bind(c),D.stop=D,D}function Qt(t,e=1/0,n){if(e<=0||!xe(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,Re(t))Qt(t.value,e,n);else if(se(t))for(let r=0;r<t.length;r++)Qt(t[r],e,n);else if(rc(t)||$n(t))t.forEach(r=>{Qt(r,e,n)});else if(oc(t)){for(const r in t)Qt(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Qt(t[r],e,n)}return t}/**
|
|
96
|
+
**/let tt;class Gm{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this.parent=tt,!e&&tt&&(this.index=(tt.scopes||(tt.scopes=[])).push(this)-1)}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].pause();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,n;if(this.scopes)for(e=0,n=this.scopes.length;e<n;e++)this.scopes[e].resume();for(e=0,n=this.effects.length;e<n;e++)this.effects[e].resume()}}run(e){if(this._active){const n=tt;try{return tt=this,e()}finally{tt=n}}}on(){++this._on===1&&(this.prevScope=tt,tt=this)}off(){this._on>0&&--this._on===0&&(tt=this.prevScope,this.prevScope=void 0)}stop(e){if(this._active){this._active=!1;let n,r;for(n=0,r=this.effects.length;n<r;n++)this.effects[n].stop();for(this.effects.length=0,n=0,r=this.cleanups.length;n<r;n++)this.cleanups[n]();if(this.cleanups.length=0,this.scopes){for(n=0,r=this.scopes.length;n<r;n++)this.scopes[n].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){const i=this.parent.scopes.pop();i&&i!==this&&(this.parent.scopes[this.index]=i,i.index=this.index)}this.parent=void 0}}}function Qm(){return tt}let Se;const fo=new WeakSet;class vc{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,tt&&tt.active&&tt.effects.push(this)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,fo.has(this)&&(fo.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||bc(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Ec(this),wc(this);const e=Se,n=yt;Se=this,yt=!0;try{return this.fn()}finally{_c(this),Se=e,yt=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)go(e);this.deps=this.depsTail=void 0,Ec(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?fo.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){mo(this)&&this.run()}get dirty(){return mo(this)}}let yc=0,ur,fr;function bc(t,e=!1){if(t.flags|=8,e){t.next=fr,fr=t;return}t.next=ur,ur=t}function ho(){yc++}function po(){if(--yc>0)return;if(fr){let e=fr;for(fr=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;ur;){let e=ur;for(ur=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(r){t||(t=r)}e=n}}if(t)throw t}function wc(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function _c(t){let e,n=t.depsTail,r=n;for(;r;){const i=r.prevDep;r.version===-1?(r===n&&(n=i),go(r),Jm(r)):e=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=i}t.deps=e,t.depsTail=n}function mo(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(xc(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function xc(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===dr)||(t.globalVersion=dr,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!mo(t))))return;t.flags|=2;const e=t.dep,n=Se,r=yt;Se=t,yt=!0;try{wc(t);const i=t.fn(t._value);(e.version===0||et(i,t._value))&&(t.flags|=128,t._value=i,e.version++)}catch(i){throw e.version++,i}finally{Se=n,yt=r,_c(t),t.flags&=-3}}function go(t,e=!1){const{dep:n,prevSub:r,nextSub:i}=t;if(r&&(r.nextSub=i,t.prevSub=void 0),i&&(i.prevSub=r,t.nextSub=void 0),n.subs===t&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let s=n.computed.deps;s;s=s.nextDep)go(s,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function Jm(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let yt=!0;const Sc=[];function Pt(){Sc.push(yt),yt=!1}function $t(){const t=Sc.pop();yt=t===void 0?!0:t}function Ec(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=Se;Se=void 0;try{e()}finally{Se=n}}}let dr=0;class Xm{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Si{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||!yt||Se===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==Se)n=this.activeLink=new Xm(Se,this),Se.deps?(n.prevDep=Se.depsTail,Se.depsTail.nextDep=n,Se.depsTail=n):Se.deps=Se.depsTail=n,kc(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const r=n.nextDep;r.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=r),n.prevDep=Se.depsTail,n.nextDep=void 0,Se.depsTail.nextDep=n,Se.depsTail=n,Se.deps===n&&(Se.deps=r)}return n}trigger(e){this.version++,dr++,this.notify(e)}notify(e){ho();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{po()}}}function kc(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)kc(r)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const vo=new WeakMap,hn=Symbol(""),yo=Symbol(""),hr=Symbol("");function He(t,e,n){if(yt&&Se){let r=vo.get(t);r||vo.set(t,r=new Map);let i=r.get(n);i||(r.set(n,i=new Si),i.map=r,i.key=n),i.track()}}function Bt(t,e,n,r,i,s){const o=vo.get(t);if(!o){dr++;return}const a=l=>{l&&l.trigger()};if(ho(),e==="clear")o.forEach(a);else{const l=se(t),c=l&&so(n);if(l&&n==="length"){const u=Number(r);o.forEach((f,m)=>{(m==="length"||m===hr||!Qt(m)&&m>=u)&&a(f)})}else switch((n!==void 0||o.has(void 0))&&a(o.get(n)),c&&a(o.get(hr)),e){case"add":l?c&&a(o.get("length")):(a(o.get(hn)),On(t)&&a(o.get(yo)));break;case"delete":l||(a(o.get(hn)),On(t)&&a(o.get(yo)));break;case"set":On(t)&&a(o.get(hn));break}}po()}function Tn(t){const e=de(t);return e===t?e:(He(e,"iterate",hr),ft(t)?e:e.map(je))}function Ei(t){return He(t=de(t),"iterate",hr),t}const Zm={__proto__:null,[Symbol.iterator](){return bo(this,Symbol.iterator,je)},concat(...t){return Tn(this).concat(...t.map(e=>se(e)?Tn(e):e))},entries(){return bo(this,"entries",t=>(t[1]=je(t[1]),t))},every(t,e){return Ut(this,"every",t,e,void 0,arguments)},filter(t,e){return Ut(this,"filter",t,e,n=>n.map(je),arguments)},find(t,e){return Ut(this,"find",t,e,je,arguments)},findIndex(t,e){return Ut(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Ut(this,"findLast",t,e,je,arguments)},findLastIndex(t,e){return Ut(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Ut(this,"forEach",t,e,void 0,arguments)},includes(...t){return wo(this,"includes",t)},indexOf(...t){return wo(this,"indexOf",t)},join(t){return Tn(this).join(t)},lastIndexOf(...t){return wo(this,"lastIndexOf",t)},map(t,e){return Ut(this,"map",t,e,void 0,arguments)},pop(){return pr(this,"pop")},push(...t){return pr(this,"push",t)},reduce(t,...e){return Pc(this,"reduce",t,e)},reduceRight(t,...e){return Pc(this,"reduceRight",t,e)},shift(){return pr(this,"shift")},some(t,e){return Ut(this,"some",t,e,void 0,arguments)},splice(...t){return pr(this,"splice",t)},toReversed(){return Tn(this).toReversed()},toSorted(t){return Tn(this).toSorted(t)},toSpliced(...t){return Tn(this).toSpliced(...t)},unshift(...t){return pr(this,"unshift",t)},values(){return bo(this,"values",je)}};function bo(t,e,n){const r=Ei(t),i=r[e]();return r!==t&&!ft(t)&&(i._next=i.next,i.next=()=>{const s=i._next();return s.done||(s.value=n(s.value)),s}),i}const eg=Array.prototype;function Ut(t,e,n,r,i,s){const o=Ei(t),a=o!==t&&!ft(t),l=o[e];if(l!==eg[e]){const f=l.apply(t,s);return a?je(f):f}let c=n;o!==t&&(a?c=function(f,m){return n.call(this,je(f),m,t)}:n.length>2&&(c=function(f,m){return n.call(this,f,m,t)}));const u=l.call(o,c,r);return a&&i?i(u):u}function Pc(t,e,n,r){const i=Ei(t);let s=n;return i!==t&&(ft(t)?n.length>3&&(s=function(o,a,l){return n.call(this,o,a,l,t)}):s=function(o,a,l){return n.call(this,o,je(a),l,t)}),i[e](s,...r)}function wo(t,e,n){const r=de(t);He(r,"iterate",hr);const i=r[e](...n);return(i===-1||i===!1)&&Eo(n[0])?(n[0]=de(n[0]),r[e](...n)):i}function pr(t,e,n=[]){Pt(),ho();const r=de(t)[e].apply(t,n);return po(),$t(),r}const tg=no("__proto__,__v_isRef,__isVue"),$c=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Qt));function ng(t){Qt(t)||(t=String(t));const e=de(this);return He(e,"has",t),e.hasOwnProperty(t)}class Cc{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,r){if(n==="__v_skip")return e.__v_skip;const i=this._isReadonly,s=this._isShallow;if(n==="__v_isReactive")return!i;if(n==="__v_isReadonly")return i;if(n==="__v_isShallow")return s;if(n==="__v_raw")return r===(i?s?Rc:Nc:s?Ac:Ic).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(r)?e:void 0;const o=se(e);if(!i){let l;if(o&&(l=Zm[n]))return l;if(n==="hasOwnProperty")return ng}const a=Reflect.get(e,n,De(e)?e:r);if((Qt(n)?$c.has(n):tg(n))||(i||He(e,"get",n),s))return a;if(De(a)){const l=o&&so(n)?a:a.value;return i&&Ee(l)?So(l):l}return Ee(a)?i?So(a):xo(a):a}}class Oc extends Cc{constructor(e=!1){super(!1,e)}set(e,n,r,i){let s=e[n];if(!this._isShallow){const l=Xt(s);if(!ft(r)&&!Xt(r)&&(s=de(s),r=de(r)),!se(e)&&De(s)&&!De(r))return l||(s.value=r),!0}const o=se(e)&&so(n)?Number(n)<e.length:ge(e,n),a=Reflect.set(e,n,r,De(e)?e:i);return e===de(i)&&(o?et(r,s)&&Bt(e,"set",n,r):Bt(e,"add",n,r)),a}deleteProperty(e,n){const r=ge(e,n);e[n];const i=Reflect.deleteProperty(e,n);return i&&r&&Bt(e,"delete",n,void 0),i}has(e,n){const r=Reflect.has(e,n);return(!Qt(n)||!$c.has(n))&&He(e,"has",n),r}ownKeys(e){return He(e,"iterate",se(e)?"length":hn),Reflect.ownKeys(e)}}class Tc extends Cc{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const rg=new Oc,ig=new Tc,sg=new Oc(!0),og=new Tc(!0),_o=t=>t,ki=t=>Reflect.getPrototypeOf(t);function ag(t,e,n){return function(...r){const i=this.__v_raw,s=de(i),o=On(s),a=t==="entries"||t===Symbol.iterator&&o,l=t==="keys"&&o,c=i[t](...r),u=n?_o:e?Oi:je;return!e&&He(s,"iterate",l?yo:hn),{next(){const{value:f,done:m}=c.next();return m?{value:f,done:m}:{value:a?[u(f[0]),u(f[1])]:u(f),done:m}},[Symbol.iterator](){return this}}}}function Pi(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function lg(t,e){const n={get(i){const s=this.__v_raw,o=de(s),a=de(i);t||(et(i,a)&&He(o,"get",i),He(o,"get",a));const{has:l}=ki(o),c=e?_o:t?Oi:je;if(l.call(o,i))return c(s.get(i));if(l.call(o,a))return c(s.get(a));s!==o&&s.get(i)},get size(){const i=this.__v_raw;return!t&&He(de(i),"iterate",hn),i.size},has(i){const s=this.__v_raw,o=de(s),a=de(i);return t||(et(i,a)&&He(o,"has",i),He(o,"has",a)),i===a?s.has(i):s.has(i)||s.has(a)},forEach(i,s){const o=this,a=o.__v_raw,l=de(a),c=e?_o:t?Oi:je;return!t&&He(l,"iterate",hn),a.forEach((u,f)=>i.call(s,c(u),c(f),o))}};return Me(n,t?{add:Pi("add"),set:Pi("set"),delete:Pi("delete"),clear:Pi("clear")}:{add(i){!e&&!ft(i)&&!Xt(i)&&(i=de(i));const s=de(this);return ki(s).has.call(s,i)||(s.add(i),Bt(s,"add",i,i)),this},set(i,s){!e&&!ft(s)&&!Xt(s)&&(s=de(s));const o=de(this),{has:a,get:l}=ki(o);let c=a.call(o,i);c||(i=de(i),c=a.call(o,i));const u=l.call(o,i);return o.set(i,s),c?et(s,u)&&Bt(o,"set",i,s):Bt(o,"add",i,s),this},delete(i){const s=de(this),{has:o,get:a}=ki(s);let l=o.call(s,i);l||(i=de(i),l=o.call(s,i)),a&&a.call(s,i);const c=s.delete(i);return l&&Bt(s,"delete",i,void 0),c},clear(){const i=de(this),s=i.size!==0,o=i.clear();return s&&Bt(i,"clear",void 0,void 0),o}}),["keys","values","entries",Symbol.iterator].forEach(i=>{n[i]=ag(i,t,e)}),n}function $i(t,e){const n=lg(t,e);return(r,i,s)=>i==="__v_isReactive"?!t:i==="__v_isReadonly"?t:i==="__v_raw"?r:Reflect.get(ge(n,i)&&i in r?n:r,i,s)}const cg={get:$i(!1,!1)},ug={get:$i(!1,!0)},fg={get:$i(!0,!1)},dg={get:$i(!0,!0)},Ic=new WeakMap,Ac=new WeakMap,Nc=new WeakMap,Rc=new WeakMap;function hg(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function pg(t){return t.__v_skip||!Object.isExtensible(t)?0:hg(Bm(t))}function xo(t){return Xt(t)?t:Ci(t,!1,rg,cg,Ic)}function mg(t){return Ci(t,!1,sg,ug,Ac)}function So(t){return Ci(t,!0,ig,fg,Nc)}function Ob(t){return Ci(t,!0,og,dg,Rc)}function Ci(t,e,n,r,i){if(!Ee(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const s=pg(t);if(s===0)return t;const o=i.get(t);if(o)return o;const a=new Proxy(t,s===2?r:n);return i.set(t,a),a}function In(t){return Xt(t)?In(t.__v_raw):!!(t&&t.__v_isReactive)}function Xt(t){return!!(t&&t.__v_isReadonly)}function ft(t){return!!(t&&t.__v_isShallow)}function Eo(t){return t?!!t.__v_raw:!1}function de(t){const e=t&&t.__v_raw;return e?de(e):t}function gg(t){return!ge(t,"__v_skip")&&Object.isExtensible(t)&&dc(t,"__v_skip",!0),t}const je=t=>Ee(t)?xo(t):t,Oi=t=>Ee(t)?So(t):t;function De(t){return t?t.__v_isRef===!0:!1}function Dc(t){return Lc(t,!1)}function Ti(t){return Lc(t,!0)}function Lc(t,e){return De(t)?t:new vg(t,e)}class vg{constructor(e,n){this.dep=new Si,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:de(e),this._value=n?e:je(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,r=this.__v_isShallow||ft(e)||Xt(e);e=r?e:de(e),et(e,n)&&(this._rawValue=e,this._value=r?e:je(e),this.dep.trigger())}}function Mc(t){return De(t)?t.value:t}const yg={get:(t,e,n)=>e==="__v_raw"?t:Mc(Reflect.get(t,e,n)),set:(t,e,n,r)=>{const i=t[e];return De(i)&&!De(n)?(i.value=n,!0):Reflect.set(t,e,n,r)}};function jc(t){return In(t)?t:new Proxy(t,yg)}class bg{constructor(e){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new Si,{get:r,set:i}=e(n.track.bind(n),n.trigger.bind(n));this._get=r,this._set=i}get value(){return this._value=this._get()}set value(e){this._set(e)}}function wg(t){return new bg(t)}class _g{constructor(e,n,r){this.fn=e,this.setter=n,this._value=void 0,this.dep=new Si(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=dr-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=r}notify(){if(this.flags|=16,!(this.flags&8)&&Se!==this)return bc(this,!0),!0}get value(){const e=this.dep.track();return xc(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function xg(t,e,n=!1){let r,i;return oe(t)?r=t:(r=t.get,i=t.set),new _g(r,i,n)}const Ii={},Ai=new WeakMap;let pn;function Sg(t,e=!1,n=pn){if(n){let r=Ai.get(n);r||Ai.set(n,r=[]),r.push(t)}}function Eg(t,e,n=pe){const{immediate:r,deep:i,once:s,scheduler:o,augmentJob:a,call:l}=n,c=p=>i?p:ft(p)||i===!1||i===0?Zt(p,1):Zt(p);let u,f,m,y,b=!1,I=!1;if(De(t)?(f=()=>t.value,b=ft(t)):In(t)?(f=()=>c(t),b=!0):se(t)?(I=!0,b=t.some(p=>In(p)||ft(p)),f=()=>t.map(p=>{if(De(p))return p.value;if(In(p))return c(p);if(oe(p))return l?l(p,2):p()})):oe(t)?e?f=l?()=>l(t,2):t:f=()=>{if(m){Pt();try{m()}finally{$t()}}const p=pn;pn=u;try{return l?l(t,3,[y]):t(y)}finally{pn=p}}:f=kt,e&&i){const p=f,h=i===!0?1/0:i;f=()=>Zt(p(),h)}const F=Qm(),D=()=>{u.stop(),F&&F.active&&io(F.effects,u)};if(s&&e){const p=e;e=(...h)=>{p(...h),D()}}let T=I?new Array(t.length).fill(Ii):Ii;const v=p=>{if(!(!(u.flags&1)||!u.dirty&&!p))if(e){const h=u.run();if(i||b||(I?h.some((S,O)=>et(S,T[O])):et(h,T))){m&&m();const S=pn;pn=u;try{const O=[h,T===Ii?void 0:I&&T[0]===Ii?[]:T,y];T=h,l?l(e,3,O):e(...O)}finally{pn=S}}}else u.run()};return a&&a(v),u=new vc(f),u.scheduler=o?()=>o(v,!1):v,y=p=>Sg(p,!1,u),m=u.onStop=()=>{const p=Ai.get(u);if(p){if(l)l(p,4);else for(const h of p)h();Ai.delete(u)}},e?r?v(!0):T=u.run():o?o(v.bind(null,!0),!0):u.run(),D.pause=u.pause.bind(u),D.resume=u.resume.bind(u),D.stop=D,D}function Zt(t,e=1/0,n){if(e<=0||!Ee(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,De(t))Zt(t.value,e,n);else if(se(t))for(let r=0;r<t.length;r++)Zt(t[r],e,n);else if(ac(t)||On(t))t.forEach(r=>{Zt(r,e,n)});else if(uc(t)){for(const r in t)Zt(t[r],e,n);for(const r of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,r)&&Zt(t[r],e,n)}return t}/**
|
|
97
97
|
* @vue/runtime-core v3.5.22
|
|
98
98
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
99
99
|
* @license MIT
|
|
100
|
-
**/const
|
|
100
|
+
**/const mr=[];let ko=!1;function Tb(t,...e){if(ko)return;ko=!0,Pt();const n=mr.length?mr[mr.length-1].component:null,r=n&&n.appContext.config.warnHandler,i=kg();if(r)An(r,n,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(""),n&&n.proxy,i.map(({vnode:s})=>`at <${Mu(n,s.type)}>`).join(`
|
|
101
101
|
`),i]);else{const s=[`[Vue warn]: ${t}`,...e];i.length&&s.push(`
|
|
102
|
-
`,...
|
|
103
|
-
`],...bg(n))}),e}function bg({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${Nu(t.component,t.type,r)}`,s=">"+n;return t.props?[i,..._g(t.props),s]:[i+s]}function _g(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...Dc(r,t[r]))}),n.length>3&&e.push(" ..."),e}function Dc(t,e,n){return $e(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:Re(e)?(e=Dc(t,fe(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):oe(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=fe(e),n?e:[`${t}=`,e])}function On(t,e,n,r){try{return r?t(...r):t()}catch(i){Oi(i,e,n)}}function $t(t,e,n,r){if(oe(t)){const i=On(t,e,n,r);return i&&ic(i)&&i.catch(s=>{Oi(s,e,n)}),i}if(se(t)){const i=[];for(let s=0;s<t.length;s++)i.push($t(t[s],e,n,r));return i}}function Oi(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||he;if(e){let a=e.parent;const l=e.proxy,u=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const c=a.ec;if(c){for(let f=0;f<c.length;f++)if(c[f](t,l,u)===!1)return}a=a.parent}if(s){Et(),On(s,null,10,[t,l,u]),kt();return}}wg(t,n,i,r,o)}function wg(t,e,n,r=!0,i=!1){if(i)throw t}const Ve=[];let Ct=-1;const In=[];let Xt=null,Tn=0;const Lc=Promise.resolve();let Ii=null;function Ti(t){const e=Ii||Lc;return t?e.then(this?t.bind(this):t):e}function xg(t){let e=Ct+1,n=Ve.length;for(;e<n;){const r=e+n>>>1,i=Ve[r],s=pr(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function So(t){if(!(t.flags&1)){const e=pr(t),n=Ve[Ve.length-1];!n||!(t.flags&2)&&e>=pr(n)?Ve.push(t):Ve.splice(xg(e),0,t),t.flags|=1,Mc()}}function Mc(){Ii||(Ii=Lc.then(Bc))}function Sg(t){se(t)?In.push(...t):Xt&&t.id===-1?Xt.splice(Tn+1,0,t):t.flags&1||(In.push(t),t.flags|=1),Mc()}function jc(t,e,n=Ct+1){for(;n<Ve.length;n++){const r=Ve[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ve.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function Fc(t){if(In.length){const e=[...new Set(In)].sort((n,r)=>pr(n)-pr(r));if(In.length=0,Xt){Xt.push(...e);return}for(Xt=e,Tn=0;Tn<Xt.length;Tn++){const n=Xt[Tn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}Xt=null,Tn=0}}const pr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Bc(t){try{for(Ct=0;Ct<Ve.length;Ct++){const e=Ve[Ct];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),On(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Ct<Ve.length;Ct++){const e=Ve[Ct];e&&(e.flags&=-2)}Ct=-1,Ve.length=0,Fc(),Ii=null,(Ve.length||In.length)&&Bc()}}let Pt=null,Uc=null;function Ai(t){const e=Pt;return Pt=t,Uc=t&&t.type.__scopeId||null,e}function Eg(t,e=Pt,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&Eu(-1);const s=Ai(e);let o;try{o=t(...i)}finally{Ai(s),r._d&&Eu(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function hn(t,e,n,r){const i=t.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(Et(),$t(l,n,8,[t.el,a,t,e]),kt())}}const kg=Symbol("_vte"),$g=t=>t.__isTeleport,Cg=Symbol("_leaveCb");function Eo(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Eo(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 zc(t,e){return oe(t)?Le({name:t.name},e,{setup:t}):t}function Hc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Pg(t){const e=Mo(),n=$i(null);if(e){const i=e.refs===he?e.refs={}:e.refs;Object.defineProperty(i,t,{enumerable:!0,get:()=>n.value,set:s=>n.value=s})}return n}const Ni=new WeakMap;function mr(t,e,n,r,i=!1){if(se(t)){t.forEach((b,I)=>mr(b,e&&(se(e)?e[I]:e),n,r,i));return}if(gr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&mr(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?Fo(r.component):r.el,o=i?null:s,{i:a,r:l}=t,u=e&&e.r,c=a.refs===he?a.refs={}:a.refs,f=a.setupState,v=fe(f),y=f===he?nc:b=>pe(v,b);if(u!=null&&u!==l){if(qc(e),$e(u))c[u]=null,y(u)&&(f[u]=null);else if(Re(u)){u.value=null;const b=e;b.k&&(c[b.k]=null)}}if(oe(l))On(l,a,12,[o,c]);else{const b=$e(l),I=Re(l);if(b||I){const U=()=>{if(t.f){const D=b?y(l)?f[l]:c[l]:l.value;if(i)se(D)&&to(D,s);else if(se(D))D.includes(s)||D.push(s);else if(b)c[l]=[s],y(l)&&(f[l]=c[l]);else{const T=[s];l.value=T,t.k&&(c[t.k]=T)}}else b?(c[l]=o,y(l)&&(f[l]=o)):I&&(l.value=o,t.k&&(c[t.k]=o))};if(o){const D=()=>{U(),Ni.delete(t)};D.id=-1,Ni.set(t,D),it(D,n)}else qc(t),U()}}}function qc(t){const e=Ni.get(t);e&&(e.flags|=8,Ni.delete(t))}vi().requestIdleCallback,vi().cancelIdleCallback;const gr=t=>!!t.type.__asyncLoader,Wc=t=>t.type.__isKeepAlive;function Og(t,e){Vc(t,"a",e)}function Ig(t,e){Vc(t,"da",e)}function Vc(t,e,n=Ye){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(Ri(e,r,n),n){let i=n.parent;for(;i&&i.parent;)Wc(i.parent.vnode)&&Tg(r,e,n,i),i=i.parent}}function Tg(t,e,n,r){const i=Ri(e,t,r,!0);Gc(()=>{to(r[e],i)},n)}function Ri(t,e,n=Ye,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{Et();const a=kr(n),l=$t(e,n,t,o);return a(),kt(),l});return r?i.unshift(s):i.push(s),s}}const Bt=t=>(e,n=Ye)=>{(!$r||t==="sp")&&Ri(t,(...r)=>e(...r),n)},Kc=Bt("bm"),ko=Bt("m"),Ag=Bt("bu"),Ng=Bt("u"),Yc=Bt("bum"),Gc=Bt("um"),Rg=Bt("sp"),Dg=Bt("rtg"),Lg=Bt("rtc");function Mg(t,e=Ye){Ri("ec",t,e)}const jg=Symbol.for("v-ndc");function Jc(t,e,n,r){let i;const s=n,o=se(t);if(o||$e(t)){const a=o&&Pn(t);let l=!1,u=!1;a&&(l=!ut(t),u=Jt(t),t=_i(t)),i=new Array(t.length);for(let c=0,f=t.length;c<f;c++)i[c]=e(l?u?ki(Me(t[c])):Me(t[c]):t[c],c,void 0,s)}else if(typeof t=="number"){i=new Array(t);for(let a=0;a<t;a++)i[a]=e(a+1,a,void 0,s)}else if(xe(t))if(t[Symbol.iterator])i=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);i=new Array(a.length);for(let l=0,u=a.length;l<u;l++){const c=a[l];i[l]=e(t[c],c,l,s)}}else i=[];return i}const $o=t=>t?Iu(t)?Fo(t):$o(t.parent):null,vr=Le(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=>$o(t.parent),$root:t=>$o(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>eu(t),$forceUpdate:t=>t.f||(t.f=()=>{So(t.update)}),$nextTick:t=>t.n||(t.n=Ti.bind(t.proxy)),$watch:t=>ov.bind(t)}),Co=(t,e)=>t!==he&&!t.__isScriptSetup&&pe(t,e),Fg={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:i,props:s,accessCache:o,type:a,appContext:l}=t;let u;if(e[0]!=="$"){const y=o[e];if(y!==void 0)switch(y){case 1:return r[e];case 2:return i[e];case 4:return n[e];case 3:return s[e]}else{if(Co(r,e))return o[e]=1,r[e];if(i!==he&&pe(i,e))return o[e]=2,i[e];if((u=t.propsOptions[0])&&pe(u,e))return o[e]=3,s[e];if(n!==he&&pe(n,e))return o[e]=4,n[e];Po&&(o[e]=0)}}const c=vr[e];let f,v;if(c)return e==="$attrs"&&He(t.attrs,"get",""),c(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==he&&pe(n,e))return o[e]=4,n[e];if(v=l.config.globalProperties,pe(v,e))return v[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return Co(i,e)?(i[e]=n,!0):r!==he&&pe(r,e)?(r[e]=n,!0):pe(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:i,propsOptions:s,type:o}},a){let l,u;return!!(n[a]||t!==he&&a[0]!=="$"&&pe(t,a)||Co(e,a)||(l=s[0])&&pe(l,a)||pe(r,a)||pe(vr,a)||pe(i.config.globalProperties,a)||(u=o.__cssModules)&&u[a])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:pe(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Di(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function Qc(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Le({},Di(t),Di(e))}let Po=!0;function Bg(t){const e=eu(t),n=t.proxy,r=t.ctx;Po=!1,e.beforeCreate&&Xc(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:u,created:c,beforeMount:f,mounted:v,beforeUpdate:y,updated:b,activated:I,deactivated:U,beforeDestroy:D,beforeUnmount:T,destroyed:g,unmounted:p,render:h,renderTracked:S,renderTriggered:O,errorCaptured:N,serverPrefetch:q,expose:X,inheritAttrs:Ce,components:Ae,directives:tt,filters:zt}=e;if(u&&Ug(u,r,null),o)for(const me in o){const ye=o[me];oe(ye)&&(r[me]=ye.bind(n))}if(i){const me=i.call(n,n);xe(me)&&(t.data=bo(me))}if(Po=!0,s)for(const me in s){const ye=s[me],Ht=oe(ye)?ye.bind(n,n):oe(ye.get)?ye.get.bind(n,n):St,Wn=!oe(ye)&&oe(ye.set)?ye.set.bind(n):St,je=Ru({get:Ht,set:Wn});Object.defineProperty(r,me,{enumerable:!0,configurable:!0,get:()=>je.value,set:at=>je.value=at})}if(a)for(const me in a)Zc(a[me],r,n,me);if(l){const me=oe(l)?l.call(n):l;Reflect.ownKeys(me).forEach(ye=>{iu(ye,me[ye])})}c&&Xc(c,t,"c");function Ne(me,ye){se(ye)?ye.forEach(Ht=>me(Ht.bind(n))):ye&&me(ye.bind(n))}if(Ne(Kc,f),Ne(ko,v),Ne(Ag,y),Ne(Ng,b),Ne(Og,I),Ne(Ig,U),Ne(Mg,N),Ne(Lg,S),Ne(Dg,O),Ne(Yc,T),Ne(Gc,p),Ne(Rg,q),se(X))if(X.length){const me=t.exposed||(t.exposed={});X.forEach(ye=>{Object.defineProperty(me,ye,{get:()=>n[ye],set:Ht=>n[ye]=Ht,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===St&&(t.render=h),Ce!=null&&(t.inheritAttrs=Ce),Ae&&(t.components=Ae),tt&&(t.directives=tt),q&&Hc(t)}function Ug(t,e,n=St){se(t)&&(t=Oo(t));for(const r in t){const i=t[r];let s;xe(i)?"default"in i?s=br(i.from||r,i.default,!0):s=br(i.from||r):s=br(i),Re(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function Xc(t,e,n){$t(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function Zc(t,e,n,r){let i=r.includes(".")?vu(n,r):()=>n[r];if($e(t)){const s=e[t];oe(s)&&Nn(i,s)}else if(oe(t))Nn(i,t.bind(n));else if(xe(t))if(se(t))t.forEach(s=>Zc(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&Nn(i,s,t)}}function eu(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:i,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!i.length&&!n&&!r?l=e:(l={},i.length&&i.forEach(u=>Li(l,u,o,!0)),Li(l,e,o)),xe(e)&&s.set(e,l),l}function Li(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&Li(t,s,n,!0),i&&i.forEach(o=>Li(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=zg[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const zg={data:tu,props:nu,emits:nu,methods:yr,computed:yr,beforeCreate:Ke,created:Ke,beforeMount:Ke,mounted:Ke,beforeUpdate:Ke,updated:Ke,beforeDestroy:Ke,beforeUnmount:Ke,destroyed:Ke,unmounted:Ke,activated:Ke,deactivated:Ke,errorCaptured:Ke,serverPrefetch:Ke,components:yr,directives:yr,watch:qg,provide:tu,inject:Hg};function tu(t,e){return e?t?function(){return Le(oe(t)?t.call(this,this):t,oe(e)?e.call(this,this):e)}:e:t}function Hg(t,e){return yr(Oo(t),Oo(e))}function Oo(t){if(se(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Ke(t,e){return t?[...new Set([].concat(t,e))]:e}function yr(t,e){return t?Le(Object.create(null),t,e):e}function nu(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Le(Object.create(null),Di(t),Di(e??{})):e}function qg(t,e){if(!t)return e;if(!e)return t;const n=Le(Object.create(null),t);for(const r in e)n[r]=Ke(t[r],e[r]);return n}function ru(){return{app:null,config:{isNativeTag:nc,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 Wg=0;function Vg(t,e){return function(r,i=null){oe(r)||(r=Le({},r)),i!=null&&!xe(i)&&(i=null);const s=ru(),o=new WeakSet,a=[];let l=!1;const u=s.app={_uid:Wg++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:Iv,get config(){return s.config},set config(c){},use(c,...f){return o.has(c)||(c&&oe(c.install)?(o.add(c),c.install(u,...f)):oe(c)&&(o.add(c),c(u,...f))),u},mixin(c){return s.mixins.includes(c)||s.mixins.push(c),u},component(c,f){return f?(s.components[c]=f,u):s.components[c]},directive(c,f){return f?(s.directives[c]=f,u):s.directives[c]},mount(c,f,v){if(!l){const y=u._ceVNode||Zt(r,i);return y.appContext=s,v===!0?v="svg":v===!1&&(v=void 0),t(y,c,v),l=!0,u._container=c,c.__vue_app__=u,Fo(y.component)}},onUnmount(c){a.push(c)},unmount(){l&&($t(a,u._instance,16),t(null,u._container),delete u._container.__vue_app__)},provide(c,f){return s.provides[c]=f,u},runWithContext(c){const f=An;An=u;try{return c()}finally{An=f}}};return u}}let An=null;function iu(t,e){if(Ye){let n=Ye.provides;const r=Ye.parent&&Ye.parent.provides;r===n&&(n=Ye.provides=Object.create(r)),n[t]=e}}function br(t,e,n=!1){const r=Mo();if(r||An){let i=An?An._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&t in i)return i[t];if(arguments.length>1)return n&&oe(e)?e.call(r&&r.proxy):e}}const su={},ou=()=>Object.create(su),au=t=>Object.getPrototypeOf(t)===su;function Kg(t,e,n,r=!1){const i={},s=ou();t.propsDefaults=Object.create(null),lu(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:ag(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function Yg(t,e,n,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=t,a=fe(i),[l]=t.propsOptions;let u=!1;if((r||o>0)&&!(o&16)){if(o&8){const c=t.vnode.dynamicProps;for(let f=0;f<c.length;f++){let v=c[f];if(Mi(t.emitsOptions,v))continue;const y=e[v];if(l)if(pe(s,v))y!==s[v]&&(s[v]=y,u=!0);else{const b=Mt(v);i[b]=Io(l,a,b,y,t,!1)}else y!==s[v]&&(s[v]=y,u=!0)}}}else{lu(t,e,i,s)&&(u=!0);let c;for(const f in a)(!e||!pe(e,f)&&((c=Gt(f))===f||!pe(e,c)))&&(l?n&&(n[f]!==void 0||n[c]!==void 0)&&(i[f]=Io(l,a,f,void 0,t,!0)):delete i[f]);if(s!==a)for(const f in s)(!e||!pe(e,f))&&(delete s[f],u=!0)}u&&jt(t.attrs,"set","")}function lu(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(ar(l))continue;const u=e[l];let c;i&&pe(i,c=Mt(l))?!s||!s.includes(c)?n[c]=u:(a||(a={}))[c]=u:Mi(t.emitsOptions,l)||(!(l in r)||u!==r[l])&&(r[l]=u,o=!0)}if(s){const l=fe(n),u=a||he;for(let c=0;c<s.length;c++){const f=s[c];n[f]=Io(i,l,f,u[f],t,!pe(u,f))}}return o}function Io(t,e,n,r,i,s){const o=t[n];if(o!=null){const a=pe(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&oe(l)){const{propsDefaults:u}=i;if(n in u)r=u[n];else{const c=kr(i);r=u[n]=l.call(null,e),c()}}else r=l;i.ce&&i.ce._setProp(n,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===Gt(n))&&(r=!0))}return r}const Gg=new WeakMap;function cu(t,e,n=!1){const r=n?Gg:e.propsCache,i=r.get(t);if(i)return i;const s=t.props,o={},a=[];let l=!1;if(!oe(t)){const c=f=>{l=!0;const[v,y]=cu(f,e,!0);Le(o,v),y&&a.push(...y)};!n&&e.mixins.length&&e.mixins.forEach(c),t.extends&&c(t.extends),t.mixins&&t.mixins.forEach(c)}if(!s&&!l)return xe(t)&&r.set(t,kn),kn;if(se(s))for(let c=0;c<s.length;c++){const f=Mt(s[c]);uu(f)&&(o[f]=he)}else if(s)for(const c in s){const f=Mt(c);if(uu(f)){const v=s[c],y=o[f]=se(v)||oe(v)?{type:v}:Le({},v),b=y.type;let I=!1,U=!0;if(se(b))for(let D=0;D<b.length;++D){const T=b[D],g=oe(T)&&T.name;if(g==="Boolean"){I=!0;break}else g==="String"&&(U=!1)}else I=oe(b)&&b.name==="Boolean";y[0]=I,y[1]=U,(I||pe(y,"default"))&&a.push(f)}}const u=[o,a];return xe(t)&&r.set(t,u),u}function uu(t){return t[0]!=="$"&&!ar(t)}const To=t=>t==="_"||t==="_ctx"||t==="$stable",Ao=t=>se(t)?t.map(Ot):[Ot(t)],Jg=(t,e,n)=>{if(e._n)return e;const r=Eg((...i)=>Ao(e(...i)),n);return r._c=!1,r},fu=(t,e,n)=>{const r=t._ctx;for(const i in t){if(To(i))continue;const s=t[i];if(oe(s))e[i]=Jg(i,s,r);else if(s!=null){const o=Ao(s);e[i]=()=>o}}},du=(t,e)=>{const n=Ao(e);t.slots.default=()=>n},hu=(t,e,n)=>{for(const r in e)(n||!To(r))&&(t[r]=e[r])},Qg=(t,e,n)=>{const r=t.slots=ou();if(t.vnode.shapeFlag&32){const i=e._;i?(hu(r,e,n),n&&lc(r,"_",i,!0)):fu(e,r)}else e&&du(t,e)},Xg=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=he;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:hu(i,e,n):(s=!e.$stable,fu(e,i)),o=e}else e&&(du(t,e),o={default:1});if(s)for(const a in i)!To(a)&&o[a]==null&&delete i[a]},it=hv;function Zg(t){return ev(t)}function ev(t,e){const n=vi();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:u,setElementText:c,parentNode:f,nextSibling:v,setScopeId:y=St,insertStaticContent:b}=t,I=(w,k,A,L=null,M=null,j=null,G=void 0,K=null,W=!!k.dynamicChildren)=>{if(w===k)return;w&&!Sr(w,k)&&(L=Vn(w),at(w,M,j,!0),w=null),k.patchFlag===-2&&(W=!1,k.dynamicChildren=null);const{type:B,ref:ee,shapeFlag:J}=k;switch(B){case ji:U(w,k,A,L);break;case Rn:D(w,k,A,L);break;case Do:w==null&&T(k,A,L,G);break;case vt:Ae(w,k,A,L,M,j,G,K,W);break;default:J&1?h(w,k,A,L,M,j,G,K,W):J&6?tt(w,k,A,L,M,j,G,K,W):(J&64||J&128)&&B.process(w,k,A,L,M,j,G,K,W,_n)}ee!=null&&M?mr(ee,w&&w.ref,j,k||w,!k):ee==null&&w&&w.ref!=null&&mr(w.ref,null,j,w,!0)},U=(w,k,A,L)=>{if(w==null)r(k.el=a(k.children),A,L);else{const M=k.el=w.el;k.children!==w.children&&u(M,k.children)}},D=(w,k,A,L)=>{w==null?r(k.el=l(k.children||""),A,L):k.el=w.el},T=(w,k,A,L)=>{[w.el,w.anchor]=b(w.children,k,A,L,w.el,w.anchor)},g=({el:w,anchor:k},A,L)=>{let M;for(;w&&w!==k;)M=v(w),r(w,A,L),w=M;r(k,A,L)},p=({el:w,anchor:k})=>{let A;for(;w&&w!==k;)A=v(w),i(w),w=A;i(k)},h=(w,k,A,L,M,j,G,K,W)=>{k.type==="svg"?G="svg":k.type==="math"&&(G="mathml"),w==null?S(k,A,L,M,j,G,K,W):q(w,k,M,j,G,K,W)},S=(w,k,A,L,M,j,G,K)=>{let W,B;const{props:ee,shapeFlag:J,transition:Z,dirs:re}=w;if(W=w.el=o(w.type,j,ee&&ee.is,ee),J&8?c(W,w.children):J&16&&N(w.children,W,null,L,M,No(w,j),G,K),re&&hn(w,null,L,"created"),O(W,w,w.scopeId,G,L),ee){for(const be in ee)be!=="value"&&!ar(be)&&s(W,be,null,ee[be],j,L);"value"in ee&&s(W,"value",null,ee.value,j),(B=ee.onVnodeBeforeMount)&&It(B,L,w)}re&&hn(w,null,L,"beforeMount");const ce=tv(M,Z);ce&&Z.beforeEnter(W),r(W,k,A),((B=ee&&ee.onVnodeMounted)||ce||re)&&it(()=>{B&&It(B,L,w),ce&&Z.enter(W),re&&hn(w,null,L,"mounted")},M)},O=(w,k,A,L,M)=>{if(A&&y(w,A),L)for(let j=0;j<L.length;j++)y(w,L[j]);if(M){let j=M.subTree;if(k===j||Su(j.type)&&(j.ssContent===k||j.ssFallback===k)){const G=M.vnode;O(w,G,G.scopeId,G.slotScopeIds,M.parent)}}},N=(w,k,A,L,M,j,G,K,W=0)=>{for(let B=W;B<w.length;B++){const ee=w[B]=K?en(w[B]):Ot(w[B]);I(null,ee,k,A,L,M,j,G,K)}},q=(w,k,A,L,M,j,G)=>{const K=k.el=w.el;let{patchFlag:W,dynamicChildren:B,dirs:ee}=k;W|=w.patchFlag&16;const J=w.props||he,Z=k.props||he;let re;if(A&&pn(A,!1),(re=Z.onVnodeBeforeUpdate)&&It(re,A,k,w),ee&&hn(k,w,A,"beforeUpdate"),A&&pn(A,!0),(J.innerHTML&&Z.innerHTML==null||J.textContent&&Z.textContent==null)&&c(K,""),B?X(w.dynamicChildren,B,K,A,L,No(k,M),j):G||ye(w,k,K,null,A,L,No(k,M),j,!1),W>0){if(W&16)Ce(K,J,Z,A,M);else if(W&2&&J.class!==Z.class&&s(K,"class",null,Z.class,M),W&4&&s(K,"style",J.style,Z.style,M),W&8){const ce=k.dynamicProps;for(let be=0;be<ce.length;be++){const de=ce[be],Fe=J[de],Be=Z[de];(Be!==Fe||de==="value")&&s(K,de,Fe,Be,M,A)}}W&1&&w.children!==k.children&&c(K,k.children)}else!G&&B==null&&Ce(K,J,Z,A,M);((re=Z.onVnodeUpdated)||ee)&&it(()=>{re&&It(re,A,k,w),ee&&hn(k,w,A,"updated")},L)},X=(w,k,A,L,M,j,G)=>{for(let K=0;K<k.length;K++){const W=w[K],B=k[K],ee=W.el&&(W.type===vt||!Sr(W,B)||W.shapeFlag&198)?f(W.el):A;I(W,B,ee,null,L,M,j,G,!0)}},Ce=(w,k,A,L,M)=>{if(k!==A){if(k!==he)for(const j in k)!ar(j)&&!(j in A)&&s(w,j,k[j],null,M,L);for(const j in A){if(ar(j))continue;const G=A[j],K=k[j];G!==K&&j!=="value"&&s(w,j,K,G,M,L)}"value"in A&&s(w,"value",k.value,A.value,M)}},Ae=(w,k,A,L,M,j,G,K,W)=>{const B=k.el=w?w.el:a(""),ee=k.anchor=w?w.anchor:a("");let{patchFlag:J,dynamicChildren:Z,slotScopeIds:re}=k;re&&(K=K?K.concat(re):re),w==null?(r(B,A,L),r(ee,A,L),N(k.children||[],A,ee,M,j,G,K,W)):J>0&&J&64&&Z&&w.dynamicChildren?(X(w.dynamicChildren,Z,A,M,j,G,K),(k.key!=null||M&&k===M.subTree)&&pu(w,k,!0)):ye(w,k,A,ee,M,j,G,K,W)},tt=(w,k,A,L,M,j,G,K,W)=>{k.slotScopeIds=K,w==null?k.shapeFlag&512?M.ctx.activate(k,A,L,G,W):zt(k,A,L,M,j,G,W):yn(w,k,W)},zt=(w,k,A,L,M,j,G)=>{const K=w.component=wv(w,L,M);if(Wc(w)&&(K.ctx.renderer=_n),xv(K,!1,G),K.asyncDep){if(M&&M.registerDep(K,Ne,G),!w.el){const W=K.subTree=Zt(Rn);D(null,W,k,A),w.placeholder=W.el}}else Ne(K,w,k,A,M,j,G)},yn=(w,k,A)=>{const L=k.component=w.component;if(fv(w,k,A))if(L.asyncDep&&!L.asyncResolved){me(L,k,A);return}else L.next=k,L.update();else k.el=w.el,L.vnode=k},Ne=(w,k,A,L,M,j,G)=>{const K=()=>{if(w.isMounted){let{next:J,bu:Z,u:re,parent:ce,vnode:be}=w;{const ct=mu(w);if(ct){J&&(J.el=be.el,me(w,J,G)),ct.asyncDep.then(()=>{w.isUnmounted||K()});return}}let de=J,Fe;pn(w,!1),J?(J.el=be.el,me(w,J,G)):J=be,Z&&io(Z),(Fe=J.props&&J.props.onVnodeBeforeUpdate)&&It(Fe,ce,J,be),pn(w,!0);const Be=wu(w),lt=w.subTree;w.subTree=Be,I(lt,Be,f(lt.el),Vn(lt),w,M,j),J.el=Be.el,de===null&&dv(w,Be.el),re&&it(re,M),(Fe=J.props&&J.props.onVnodeUpdated)&&it(()=>It(Fe,ce,J,be),M)}else{let J;const{el:Z,props:re}=k,{bm:ce,m:be,parent:de,root:Fe,type:Be}=w,lt=gr(k);pn(w,!1),ce&&io(ce),!lt&&(J=re&&re.onVnodeBeforeMount)&&It(J,de,k),pn(w,!0);{Fe.ce&&Fe.ce._def.shadowRoot!==!1&&Fe.ce._injectChildStyle(Be);const ct=w.subTree=wu(w);I(null,ct,A,L,w,M,j),k.el=ct.el}if(be&&it(be,M),!lt&&(J=re&&re.onVnodeMounted)){const ct=k;it(()=>It(J,de,ct),M)}(k.shapeFlag&256||de&&gr(de.vnode)&&de.vnode.shapeFlag&256)&&w.a&&it(w.a,M),w.isMounted=!0,k=A=L=null}};w.scope.on();const W=w.effect=new hc(K);w.scope.off();const B=w.update=W.run.bind(W),ee=w.job=W.runIfDirty.bind(W);ee.i=w,ee.id=w.uid,W.scheduler=()=>So(ee),pn(w,!0),B()},me=(w,k,A)=>{k.component=w;const L=w.vnode.props;w.vnode=k,w.next=null,Yg(w,k.props,L,A),Xg(w,k.children,A),Et(),jc(w),kt()},ye=(w,k,A,L,M,j,G,K,W=!1)=>{const B=w&&w.children,ee=w?w.shapeFlag:0,J=k.children,{patchFlag:Z,shapeFlag:re}=k;if(Z>0){if(Z&128){Wn(B,J,A,L,M,j,G,K,W);return}else if(Z&256){Ht(B,J,A,L,M,j,G,K,W);return}}re&8?(ee&16&&bn(B,M,j),J!==B&&c(A,J)):ee&16?re&16?Wn(B,J,A,L,M,j,G,K,W):bn(B,M,j,!0):(ee&8&&c(A,""),re&16&&N(J,A,L,M,j,G,K,W))},Ht=(w,k,A,L,M,j,G,K,W)=>{w=w||kn,k=k||kn;const B=w.length,ee=k.length,J=Math.min(B,ee);let Z;for(Z=0;Z<J;Z++){const re=k[Z]=W?en(k[Z]):Ot(k[Z]);I(w[Z],re,A,null,M,j,G,K,W)}B>ee?bn(w,M,j,!0,!1,J):N(k,A,L,M,j,G,K,W,J)},Wn=(w,k,A,L,M,j,G,K,W)=>{let B=0;const ee=k.length;let J=w.length-1,Z=ee-1;for(;B<=J&&B<=Z;){const re=w[B],ce=k[B]=W?en(k[B]):Ot(k[B]);if(Sr(re,ce))I(re,ce,A,null,M,j,G,K,W);else break;B++}for(;B<=J&&B<=Z;){const re=w[J],ce=k[Z]=W?en(k[Z]):Ot(k[Z]);if(Sr(re,ce))I(re,ce,A,null,M,j,G,K,W);else break;J--,Z--}if(B>J){if(B<=Z){const re=Z+1,ce=re<ee?k[re].el:L;for(;B<=Z;)I(null,k[B]=W?en(k[B]):Ot(k[B]),A,ce,M,j,G,K,W),B++}}else if(B>Z)for(;B<=J;)at(w[B],M,j,!0),B++;else{const re=B,ce=B,be=new Map;for(B=ce;B<=Z;B++){const Ge=k[B]=W?en(k[B]):Ot(k[B]);Ge.key!=null&&be.set(Ge.key,B)}let de,Fe=0;const Be=Z-ce+1;let lt=!1,ct=0;const nn=new Array(Be);for(B=0;B<Be;B++)nn[B]=0;for(B=re;B<=J;B++){const Ge=w[B];if(Fe>=Be){at(Ge,M,j,!0);continue}let ht;if(Ge.key!=null)ht=be.get(Ge.key);else for(de=ce;de<=Z;de++)if(nn[de-ce]===0&&Sr(Ge,k[de])){ht=de;break}ht===void 0?at(Ge,M,j,!0):(nn[ht-ce]=B+1,ht>=ct?ct=ht:lt=!0,I(Ge,k[ht],A,null,M,j,G,K,W),Fe++)}const Kn=lt?nv(nn):kn;for(de=Kn.length-1,B=Be-1;B>=0;B--){const Ge=ce+B,ht=k[Ge],Yn=k[Ge+1],Ar=Ge+1<ee?Yn.el||Yn.placeholder:L;nn[B]===0?I(null,ht,A,Ar,M,j,G,K,W):lt&&(de<0||B!==Kn[de]?je(ht,A,Ar,2):de--)}}},je=(w,k,A,L,M=null)=>{const{el:j,type:G,transition:K,children:W,shapeFlag:B}=w;if(B&6){je(w.component.subTree,k,A,L);return}if(B&128){w.suspense.move(k,A,L);return}if(B&64){G.move(w,k,A,_n);return}if(G===vt){r(j,k,A);for(let J=0;J<W.length;J++)je(W[J],k,A,L);r(w.anchor,k,A);return}if(G===Do){g(w,k,A);return}if(L!==2&&B&1&&K)if(L===0)K.beforeEnter(j),r(j,k,A),it(()=>K.enter(j),M);else{const{leave:J,delayLeave:Z,afterLeave:re}=K,ce=()=>{w.ctx.isUnmounted?i(j):r(j,k,A)},be=()=>{j._isLeaving&&j[Cg](!0),J(j,()=>{ce(),re&&re()})};Z?Z(j,ce,be):be()}else r(j,k,A)},at=(w,k,A,L=!1,M=!1)=>{const{type:j,props:G,ref:K,children:W,dynamicChildren:B,shapeFlag:ee,patchFlag:J,dirs:Z,cacheIndex:re}=w;if(J===-2&&(M=!1),K!=null&&(Et(),mr(K,null,A,w,!0),kt()),re!=null&&(k.renderCache[re]=void 0),ee&256){k.ctx.deactivate(w);return}const ce=ee&1&&Z,be=!gr(w);let de;if(be&&(de=G&&G.onVnodeBeforeUnmount)&&It(de,k,w),ee&6)Zo(w.component,A,L);else{if(ee&128){w.suspense.unmount(A,L);return}ce&&hn(w,null,k,"beforeUnmount"),ee&64?w.type.remove(w,k,A,_n,L):B&&!B.hasOnce&&(j!==vt||J>0&&J&64)?bn(B,k,A,!1,!0):(j===vt&&J&384||!M&&ee&16)&&bn(W,k,A),L&&Gi(w)}(be&&(de=G&&G.onVnodeUnmounted)||ce)&&it(()=>{de&&It(de,k,w),ce&&hn(w,null,k,"unmounted")},A)},Gi=w=>{const{type:k,el:A,anchor:L,transition:M}=w;if(k===vt){Xo(A,L);return}if(k===Do){p(w);return}const j=()=>{i(A),M&&!M.persisted&&M.afterLeave&&M.afterLeave()};if(w.shapeFlag&1&&M&&!M.persisted){const{leave:G,delayLeave:K}=M,W=()=>G(A,j);K?K(w.el,j,W):W()}else j()},Xo=(w,k)=>{let A;for(;w!==k;)A=v(w),i(w),w=A;i(k)},Zo=(w,k,A)=>{const{bum:L,scope:M,job:j,subTree:G,um:K,m:W,a:B}=w;gu(W),gu(B),L&&io(L),M.stop(),j&&(j.flags|=8,at(G,w,k,A)),K&&it(K,k),it(()=>{w.isUnmounted=!0},k)},bn=(w,k,A,L=!1,M=!1,j=0)=>{for(let G=j;G<w.length;G++)at(w[G],k,A,L,M)},Vn=w=>{if(w.shapeFlag&6)return Vn(w.component.subTree);if(w.shapeFlag&128)return w.suspense.next();const k=v(w.anchor||w.el),A=k&&k[kg];return A?v(A):k};let Tr=!1;const Ji=(w,k,A)=>{w==null?k._vnode&&at(k._vnode,null,null,!0):I(k._vnode||null,w,k,null,null,null,A),k._vnode=w,Tr||(Tr=!0,jc(),Fc(),Tr=!1)},_n={p:I,um:at,m:je,r:Gi,mt:zt,mc:N,pc:ye,pbc:X,n:Vn,o:t};return{render:Ji,hydrate:void 0,createApp:Vg(Ji)}}function No({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function pn({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function tv(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function pu(t,e,n=!1){const r=t.children,i=e.children;if(se(r)&&se(i))for(let s=0;s<r.length;s++){const o=r[s];let a=i[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[s]=en(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&pu(o,a)),a.type===ji&&a.patchFlag!==-1&&(a.el=o.el),a.type===Rn&&!a.el&&(a.el=o.el)}}function nv(t){const e=t.slice(),n=[0];let r,i,s,o,a;const l=t.length;for(r=0;r<l;r++){const u=t[r];if(u!==0){if(i=n[n.length-1],t[i]<u){e[r]=i,n.push(r);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,t[n[a]]<u?s=a+1:o=a;u<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r)}}for(s=n.length,o=n[s-1];s-- >0;)n[s]=o,o=e[o];return n}function mu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:mu(e)}function gu(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const rv=Symbol.for("v-scx"),iv=()=>br(rv);function sv(t,e){return Ro(t,null,{flush:"sync"})}function Nn(t,e,n){return Ro(t,e,n)}function Ro(t,e,n=he){const{immediate:r,deep:i,flush:s,once:o}=n,a=Le({},n),l=e&&r||!e&&s!=="post";let u;if($r){if(s==="sync"){const y=iv();u=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=St,y.resume=St,y.pause=St,y}}const c=Ye;a.call=(y,b,I)=>$t(y,c,b,I);let f=!1;s==="post"?a.scheduler=y=>{it(y,c&&c.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(y,b)=>{b?y():So(y)}),a.augmentJob=y=>{e&&(y.flags|=4),f&&(y.flags|=2,c&&(y.id=c.uid,y.i=c))};const v=gg(t,e,a);return $r&&(u?u.push(v):l&&v()),v}function ov(t,e,n){const r=this.proxy,i=$e(t)?t.includes(".")?vu(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=kr(this),a=Ro(i,s.bind(r),n);return o(),a}function vu(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i<n.length&&r;i++)r=r[n[i]];return r}}function yu(t,e,n=he){const r=Mo(),i=Mt(e),s=Gt(e),o=bu(t,i),a=dg((l,u)=>{let c,f=he,v;return sv(()=>{const y=t[i];Ze(c,y)&&(c=y,u())}),{get(){return l(),n.get?n.get(c):c},set(y){const b=n.set?n.set(y):y;if(!Ze(b,c)&&!(f!==he&&Ze(y,f)))return;const I=r.vnode.props;I&&(e in I||i in I||s in I)&&(`onUpdate:${e}`in I||`onUpdate:${i}`in I||`onUpdate:${s}`in I)||(c=y,u()),r.emit(`update:${e}`,b),Ze(y,b)&&Ze(y,f)&&!Ze(b,v)&&u(),f=y,v=b}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||he:a,done:!1}:{done:!0}}}},a}const bu=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Mt(e)}Modifiers`]||t[`${Gt(e)}Modifiers`];function av(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||he;let i=n;const s=e.startsWith("update:"),o=s&&bu(r,e.slice(7));o&&(o.trim&&(i=n.map(c=>$e(c)?c.trim():c)),o.number&&(i=n.map(Dm)));let a,l=r[a=ro(e)]||r[a=ro(Mt(e))];!l&&s&&(l=r[a=ro(Gt(e))]),l&&$t(l,t,6,i);const u=r[a+"Once"];if(u){if(!t.emitted)t.emitted={};else if(t.emitted[a])return;t.emitted[a]=!0,$t(u,t,6,i)}}const lv=new WeakMap;function _u(t,e,n=!1){const r=n?lv:e.emitsCache,i=r.get(t);if(i!==void 0)return i;const s=t.emits;let o={},a=!1;if(!oe(t)){const l=u=>{const c=_u(u,e,!0);c&&(a=!0,Le(o,c))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(xe(t)&&r.set(t,null),null):(se(s)?s.forEach(l=>o[l]=null):Le(o,s),xe(t)&&r.set(t,o),o)}function Mi(t,e){return!t||!pi(e)?!1:(e=e.slice(2).replace(/Once$/,""),pe(t,e[0].toLowerCase()+e.slice(1))||pe(t,Gt(e))||pe(t,e))}function Sb(){}function wu(t){const{type:e,vnode:n,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:a,emit:l,render:u,renderCache:c,props:f,data:v,setupState:y,ctx:b,inheritAttrs:I}=t,U=Ai(t);let D,T;try{if(n.shapeFlag&4){const p=i||r,h=p;D=Ot(u.call(h,p,c,f,y,v,b)),T=a}else{const p=e;D=Ot(p.length>1?p(f,{attrs:a,slots:o,emit:l}):p(f,null)),T=e.props?a:cv(a)}}catch(p){_r.length=0,Oi(p,t,1),D=Zt(Rn)}let g=D;if(T&&I!==!1){const p=Object.keys(T),{shapeFlag:h}=g;p.length&&h&7&&(s&&p.some(eo)&&(T=uv(T,s)),g=Ln(g,T,!1,!0))}return n.dirs&&(g=Ln(g,null,!1,!0),g.dirs=g.dirs?g.dirs.concat(n.dirs):n.dirs),n.transition&&Eo(g,n.transition),D=g,Ai(U),D}const cv=t=>{let e;for(const n in t)(n==="class"||n==="style"||pi(n))&&((e||(e={}))[n]=t[n]);return e},uv=(t,e)=>{const n={};for(const r in t)(!eo(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function fv(t,e,n){const{props:r,children:i,component:s}=t,{props:o,children:a,patchFlag:l}=e,u=s.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?xu(r,o,u):!!o;if(l&8){const c=e.dynamicProps;for(let f=0;f<c.length;f++){const v=c[f];if(o[v]!==r[v]&&!Mi(u,v))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?xu(r,o,u):!0:!!o;return!1}function xu(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==t[s]&&!Mi(n,s))return!0}return!1}function dv({vnode:t,parent:e},n){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=n,e=e.parent;else break}}const Su=t=>t.__isSuspense;function hv(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):Sg(t)}const vt=Symbol.for("v-fgt"),ji=Symbol.for("v-txt"),Rn=Symbol.for("v-cmt"),Do=Symbol.for("v-stc"),_r=[];let st=null;function Dn(t=!1){_r.push(st=t?null:[])}function pv(){_r.pop(),st=_r[_r.length-1]||null}let wr=1;function Eu(t,e=!1){wr+=t,t<0&&st&&e&&(st.hasOnce=!0)}function ku(t){return t.dynamicChildren=wr>0?st||kn:null,pv(),wr>0&&st&&st.push(t),t}function xr(t,e,n,r,i,s){return ku(Er(t,e,n,r,i,s,!0))}function mv(t,e,n,r,i){return ku(Zt(t,e,n,r,i,!0))}function $u(t){return t?t.__v_isVNode===!0:!1}function Sr(t,e){return t.type===e.type&&t.key===e.key}const Cu=({key:t})=>t??null,Fi=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?$e(t)||Re(t)||oe(t)?{i:Pt,r:t,k:e,f:!!n}:t:null);function Er(t,e=null,n=null,r=0,i=null,s=t===vt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Cu(e),ref:e&&Fi(e),scopeId:Uc,slotScopeIds:null,children:n,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:i,dynamicChildren:null,appContext:null,ctx:Pt};return a?(Lo(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=$e(n)?8:16),wr>0&&!o&&st&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&st.push(l),l}const Zt=gv;function gv(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===jg)&&(t=Rn),$u(t)){const a=Ln(t,e,!0);return n&&Lo(a,n),wr>0&&!s&&st&&(a.shapeFlag&6?st[st.indexOf(t)]=a:st.push(a)),a.patchFlag=-2,a}if(Ov(t)&&(t=t.__vccOpts),e){e=vv(e);let{class:a,style:l}=e;a&&!$e(a)&&(e.class=yi(a)),xe(l)&&(wo(l)&&!se(l)&&(l=Le({},l)),e.style=so(l))}const o=$e(t)?1:Su(t)?128:$g(t)?64:xe(t)?4:oe(t)?2:0;return Er(t,e,n,r,i,o,s,!0)}function vv(t){return t?wo(t)||au(t)?Le({},t):t:null}function Ln(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,u=e?Pu(i||{},e):i,c={__v_isVNode:!0,__v_skip:!0,type:t.type,props:u,key:u&&Cu(u),ref:e&&e.ref?n&&s?se(s)?s.concat(Fi(e)):[s,Fi(e)]:Fi(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!==vt?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&&Ln(t.ssContent),ssFallback:t.ssFallback&&Ln(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&Eo(c,l.clone(c)),c}function yv(t=" ",e=0){return Zt(ji,null,t,e)}function Ot(t){return t==null||typeof t=="boolean"?Zt(Rn):se(t)?Zt(vt,null,t.slice()):$u(t)?en(t):Zt(ji,null,String(t))}function en(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Ln(t)}function Lo(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(se(e))n=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Lo(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!au(e)?e._ctx=Pt:i===3&&Pt&&(Pt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:Pt},n=32):(e=String(e),r&64?(n=16,e=[yv(e)]):n=8);t.children=e,t.shapeFlag|=n}function Pu(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=yi([e.class,r.class]));else if(i==="style")e.style=so([e.style,r.style]);else if(pi(i)){const s=e[i],o=r[i];o&&s!==o&&!(se(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function It(t,e,n,r=null){$t(t,e,7,[n,r])}const bv=ru();let _v=0;function wv(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||bv,s={uid:_v++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Um(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:cu(r,i),emitsOptions:_u(r,i),emit:null,emitted:null,propsDefaults:he,inheritAttrs:r.inheritAttrs,ctx:he,data:he,props:he,attrs:he,slots:he,refs:he,setupState:he,setupContext:null,suspense:n,suspenseId:n?n.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=av.bind(null,s),t.ce&&t.ce(s),s}let Ye=null;const Mo=()=>Ye||Pt;let Bi,jo;{const t=vi(),e=(n,r)=>{let i;return(i=t[n])||(i=t[n]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};Bi=e("__VUE_INSTANCE_SETTERS__",n=>Ye=n),jo=e("__VUE_SSR_SETTERS__",n=>$r=n)}const kr=t=>{const e=Ye;return Bi(t),t.scope.on(),()=>{t.scope.off(),Bi(e)}},Ou=()=>{Ye&&Ye.scope.off(),Bi(null)};function Iu(t){return t.vnode.shapeFlag&4}let $r=!1;function xv(t,e=!1,n=!1){e&&jo(e);const{props:r,children:i}=t.vnode,s=Iu(t);Kg(t,r,s,e),Qg(t,i,n||e);const o=s?Sv(t,e):void 0;return e&&jo(!1),o}function Sv(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Fg);const{setup:r}=n;if(r){Et();const i=t.setupContext=r.length>1?kv(t):null,s=kr(t),o=On(r,t,0,[t.props,i]),a=ic(o);if(kt(),s(),(a||t.sp)&&!gr(t)&&Hc(t),a){if(o.then(Ou,Ou),e)return o.then(l=>{Tu(t,l)}).catch(l=>{Oi(l,t,0)});t.asyncDep=o}else Tu(t,o)}else Au(t)}function Tu(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:xe(e)&&(t.setupState=Rc(e)),Au(t)}function Au(t,e,n){const r=t.type;t.render||(t.render=r.render||St);{const i=kr(t);Et();try{Bg(t)}finally{kt(),i()}}}const Ev={get(t,e){return He(t,"get",""),t[e]}};function kv(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Ev),slots:t.slots,emit:t.emit,expose:e}}function Fo(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(Rc(lg(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in vr)return vr[n](t)},has(e,n){return n in e||n in vr}})):t.proxy}const $v=/(?:^|[-_])\w/g,Cv=t=>t.replace($v,e=>e.toUpperCase()).replace(/[-_]/g,"");function Pv(t,e=!0){return oe(t)?t.displayName||t.name:t.name||e&&t.__name}function Nu(t,e,n=!1){let r=Pv(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&t&&t.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(t.components||t.parent.type.components)||i(t.appContext.components)}return r?Cv(r):n?"App":"Anonymous"}function Ov(t){return oe(t)&&"__vccOpts"in t}const Ru=(t,e)=>pg(t,e,$r),Iv="3.5.22";/**
|
|
102
|
+
`,...Pg(i))}$t(),ko=!1}function kg(){let t=mr[mr.length-1];if(!t)return[];const e=[];for(;t;){const n=e[0];n&&n.vnode===t?n.recurseCount++:e.push({vnode:t,recurseCount:0});const r=t.component&&t.component.parent;t=r&&r.vnode}return e}function Pg(t){const e=[];return t.forEach((n,r)=>{e.push(...r===0?[]:[`
|
|
103
|
+
`],...$g(n))}),e}function $g({vnode:t,recurseCount:e}){const n=e>0?`... (${e} recursive calls)`:"",r=t.component?t.component.parent==null:!1,i=` at <${Mu(t.component,t.type,r)}`,s=">"+n;return t.props?[i,...Cg(t.props),s]:[i+s]}function Cg(t){const e=[],n=Object.keys(t);return n.slice(0,3).forEach(r=>{e.push(...Fc(r,t[r]))}),n.length>3&&e.push(" ..."),e}function Fc(t,e,n){return $e(e)?(e=JSON.stringify(e),n?e:[`${t}=${e}`]):typeof e=="number"||typeof e=="boolean"||e==null?n?e:[`${t}=${e}`]:De(e)?(e=Fc(t,de(e.value),!0),n?e:[`${t}=Ref<`,e,">"]):oe(e)?[`${t}=fn${e.name?`<${e.name}>`:""}`]:(e=de(e),n?e:[`${t}=`,e])}function An(t,e,n,r){try{return r?t(...r):t()}catch(i){Ni(i,e,n)}}function Ct(t,e,n,r){if(oe(t)){const i=An(t,e,n,r);return i&&lc(i)&&i.catch(s=>{Ni(s,e,n)}),i}if(se(t)){const i=[];for(let s=0;s<t.length;s++)i.push(Ct(t[s],e,n,r));return i}}function Ni(t,e,n,r=!0){const i=e?e.vnode:null,{errorHandler:s,throwUnhandledErrorInProduction:o}=e&&e.appContext.config||pe;if(e){let a=e.parent;const l=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;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){Pt(),An(s,null,10,[t,l,c]),$t();return}}Og(t,n,i,r,o)}function Og(t,e,n,r=!0,i=!1){if(i)throw t}const Ve=[];let Ot=-1;const Nn=[];let en=null,Rn=0;const Bc=Promise.resolve();let Ri=null;function Di(t){const e=Ri||Bc;return t?e.then(this?t.bind(this):t):e}function Tg(t){let e=Ot+1,n=Ve.length;for(;e<n;){const r=e+n>>>1,i=Ve[r],s=gr(i);s<t||s===t&&i.flags&2?e=r+1:n=r}return e}function Po(t){if(!(t.flags&1)){const e=gr(t),n=Ve[Ve.length-1];!n||!(t.flags&2)&&e>=gr(n)?Ve.push(t):Ve.splice(Tg(e),0,t),t.flags|=1,Uc()}}function Uc(){Ri||(Ri=Bc.then(Hc))}function Ig(t){se(t)?Nn.push(...t):en&&t.id===-1?en.splice(Rn+1,0,t):t.flags&1||(Nn.push(t),t.flags|=1),Uc()}function qc(t,e,n=Ot+1){for(;n<Ve.length;n++){const r=Ve[n];if(r&&r.flags&2){if(t&&r.id!==t.uid)continue;Ve.splice(n,1),n--,r.flags&4&&(r.flags&=-2),r(),r.flags&4||(r.flags&=-2)}}}function zc(t){if(Nn.length){const e=[...new Set(Nn)].sort((n,r)=>gr(n)-gr(r));if(Nn.length=0,en){en.push(...e);return}for(en=e,Rn=0;Rn<en.length;Rn++){const n=en[Rn];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}en=null,Rn=0}}const gr=t=>t.id==null?t.flags&2?-1:1/0:t.id;function Hc(t){try{for(Ot=0;Ot<Ve.length;Ot++){const e=Ve[Ot];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),An(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;Ot<Ve.length;Ot++){const e=Ve[Ot];e&&(e.flags&=-2)}Ot=-1,Ve.length=0,zc(),Ri=null,(Ve.length||Nn.length)&&Hc()}}let Tt=null,Wc=null;function Li(t){const e=Tt;return Tt=t,Wc=t&&t.type.__scopeId||null,e}function Ag(t,e=Tt,n){if(!e||t._n)return t;const r=(...i)=>{r._d&&Cu(-1);const s=Li(e);let o;try{o=t(...i)}finally{Li(s),r._d&&Cu(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function mn(t,e,n,r){const i=t.dirs,s=e&&e.dirs;for(let o=0;o<i.length;o++){const a=i[o];s&&(a.oldValue=s[o].value);let l=a.dir[r];l&&(Pt(),Ct(l,n,8,[t.el,a,t,e]),$t())}}const Ng=Symbol("_vte"),Rg=t=>t.__isTeleport,Dg=Symbol("_leaveCb");function $o(t,e){t.shapeFlag&6&&t.component?(t.transition=e,$o(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 Kc(t,e){return oe(t)?Me({name:t.name},e,{setup:t}):t}function Vc(t){t.ids=[t.ids[0]+t.ids[2]+++"-",0,0]}function Lg(t){const e=Bo(),n=Ti(null);if(e){const i=e.refs===pe?e.refs={}:e.refs;Object.defineProperty(i,t,{enumerable:!0,get:()=>n.value,set:s=>n.value=s})}return n}const Mi=new WeakMap;function vr(t,e,n,r,i=!1){if(se(t)){t.forEach((b,I)=>vr(b,e&&(se(e)?e[I]:e),n,r,i));return}if(yr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&vr(t,e,n,r.component.subTree);return}const s=r.shapeFlag&4?qo(r.component):r.el,o=i?null:s,{i:a,r:l}=t,c=e&&e.r,u=a.refs===pe?a.refs={}:a.refs,f=a.setupState,m=de(f),y=f===pe?oc:b=>ge(m,b);if(c!=null&&c!==l){if(Yc(e),$e(c))u[c]=null,y(c)&&(f[c]=null);else if(De(c)){c.value=null;const b=e;b.k&&(u[b.k]=null)}}if(oe(l))An(l,a,12,[o,u]);else{const b=$e(l),I=De(l);if(b||I){const F=()=>{if(t.f){const D=b?y(l)?f[l]:u[l]:l.value;if(i)se(D)&&io(D,s);else if(se(D))D.includes(s)||D.push(s);else if(b)u[l]=[s],y(l)&&(f[l]=u[l]);else{const T=[s];l.value=T,t.k&&(u[t.k]=T)}}else b?(u[l]=o,y(l)&&(f[l]=o)):I&&(l.value=o,t.k&&(u[t.k]=o))};if(o){const D=()=>{F(),Mi.delete(t)};D.id=-1,Mi.set(t,D),st(D,n)}else Yc(t),F()}}}function Yc(t){const e=Mi.get(t);e&&(e.flags|=8,Mi.delete(t))}_i().requestIdleCallback,_i().cancelIdleCallback;const yr=t=>!!t.type.__asyncLoader,Gc=t=>t.type.__isKeepAlive;function Mg(t,e){Qc(t,"a",e)}function jg(t,e){Qc(t,"da",e)}function Qc(t,e,n=Ge){const r=t.__wdc||(t.__wdc=()=>{let i=n;for(;i;){if(i.isDeactivated)return;i=i.parent}return t()});if(ji(e,r,n),n){let i=n.parent;for(;i&&i.parent;)Gc(i.parent.vnode)&&Fg(r,e,n,i),i=i.parent}}function Fg(t,e,n,r){const i=ji(e,t,r,!0);Zc(()=>{io(r[e],i)},n)}function ji(t,e,n=Ge,r=!1){if(n){const i=n[t]||(n[t]=[]),s=e.__weh||(e.__weh=(...o)=>{Pt();const a=$r(n),l=Ct(e,n,t,o);return a(),$t(),l});return r?i.unshift(s):i.push(s),s}}const qt=t=>(e,n=Ge)=>{(!Cr||t==="sp")&&ji(t,(...r)=>e(...r),n)},Jc=qt("bm"),Co=qt("m"),Bg=qt("bu"),Ug=qt("u"),Xc=qt("bum"),Zc=qt("um"),qg=qt("sp"),zg=qt("rtg"),Hg=qt("rtc");function Wg(t,e=Ge){ji("ec",t,e)}const Kg=Symbol.for("v-ndc");function eu(t,e,n,r){let i;const s=n,o=se(t);if(o||$e(t)){const a=o&&In(t);let l=!1,c=!1;a&&(l=!ft(t),c=Xt(t),t=Ei(t)),i=new Array(t.length);for(let u=0,f=t.length;u<f;u++)i[u]=e(l?c?Oi(je(t[u])):je(t[u]):t[u],u,void 0,s)}else if(typeof t=="number"){i=new Array(t);for(let a=0;a<t;a++)i[a]=e(a+1,a,void 0,s)}else if(Ee(t))if(t[Symbol.iterator])i=Array.from(t,(a,l)=>e(a,l,void 0,s));else{const a=Object.keys(t);i=new Array(a.length);for(let l=0,c=a.length;l<c;l++){const u=a[l];i[l]=e(t[u],u,l,s)}}else i=[];return i}const Oo=t=>t?Ru(t)?qo(t):Oo(t.parent):null,br=Me(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=>Oo(t.parent),$root:t=>Oo(t.root),$host:t=>t.ce,$emit:t=>t.emit,$options:t=>iu(t),$forceUpdate:t=>t.f||(t.f=()=>{Po(t.update)}),$nextTick:t=>t.n||(t.n=Di.bind(t.proxy)),$watch:t=>pv.bind(t)}),To=(t,e)=>t!==pe&&!t.__isScriptSetup&&ge(t,e),Vg={get({_:t},e){if(e==="__v_skip")return!0;const{ctx:n,setupState:r,data:i,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 i[e];case 4:return n[e];case 3:return s[e]}else{if(To(r,e))return o[e]=1,r[e];if(i!==pe&&ge(i,e))return o[e]=2,i[e];if((c=t.propsOptions[0])&&ge(c,e))return o[e]=3,s[e];if(n!==pe&&ge(n,e))return o[e]=4,n[e];Io&&(o[e]=0)}}const u=br[e];let f,m;if(u)return e==="$attrs"&&He(t.attrs,"get",""),u(t);if((f=a.__cssModules)&&(f=f[e]))return f;if(n!==pe&&ge(n,e))return o[e]=4,n[e];if(m=l.config.globalProperties,ge(m,e))return m[e]},set({_:t},e,n){const{data:r,setupState:i,ctx:s}=t;return To(i,e)?(i[e]=n,!0):r!==pe&&ge(r,e)?(r[e]=n,!0):ge(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(s[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:i,propsOptions:s,type:o}},a){let l,c;return!!(n[a]||t!==pe&&a[0]!=="$"&&ge(t,a)||To(e,a)||(l=s[0])&&ge(l,a)||ge(r,a)||ge(br,a)||ge(i.config.globalProperties,a)||(c=o.__cssModules)&&c[a])},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:ge(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function Fi(t){return se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function tu(t,e){return!t||!e?t||e:se(t)&&se(e)?t.concat(e):Me({},Fi(t),Fi(e))}let Io=!0;function Yg(t){const e=iu(t),n=t.proxy,r=t.ctx;Io=!1,e.beforeCreate&&nu(e.beforeCreate,t,"bc");const{data:i,computed:s,methods:o,watch:a,provide:l,inject:c,created:u,beforeMount:f,mounted:m,beforeUpdate:y,updated:b,activated:I,deactivated:F,beforeDestroy:D,beforeUnmount:T,destroyed:v,unmounted:p,render:h,renderTracked:S,renderTriggered:O,errorCaptured:N,serverPrefetch:H,expose:X,inheritAttrs:Ce,components:Ne,directives:nt,filters:Ht}=e;if(c&&Gg(c,r,null),o)for(const ve in o){const we=o[ve];oe(we)&&(r[ve]=we.bind(n))}if(i){const ve=i.call(n,n);Ee(ve)&&(t.data=xo(ve))}if(Io=!0,s)for(const ve in s){const we=s[ve],Wt=oe(we)?we.bind(n,n):oe(we.get)?we.get.bind(n,n):kt,Yn=!oe(we)&&oe(we.set)?we.set.bind(n):kt,Fe=ju({get:Wt,set:Yn});Object.defineProperty(r,ve,{enumerable:!0,configurable:!0,get:()=>Fe.value,set:lt=>Fe.value=lt})}if(a)for(const ve in a)ru(a[ve],r,n,ve);if(l){const ve=oe(l)?l.call(n):l;Reflect.ownKeys(ve).forEach(we=>{lu(we,ve[we])})}u&&nu(u,t,"c");function Re(ve,we){se(we)?we.forEach(Wt=>ve(Wt.bind(n))):we&&ve(we.bind(n))}if(Re(Jc,f),Re(Co,m),Re(Bg,y),Re(Ug,b),Re(Mg,I),Re(jg,F),Re(Wg,N),Re(Hg,S),Re(zg,O),Re(Xc,T),Re(Zc,p),Re(qg,H),se(X))if(X.length){const ve=t.exposed||(t.exposed={});X.forEach(we=>{Object.defineProperty(ve,we,{get:()=>n[we],set:Wt=>n[we]=Wt,enumerable:!0})})}else t.exposed||(t.exposed={});h&&t.render===kt&&(t.render=h),Ce!=null&&(t.inheritAttrs=Ce),Ne&&(t.components=Ne),nt&&(t.directives=nt),H&&Vc(t)}function Gg(t,e,n=kt){se(t)&&(t=Ao(t));for(const r in t){const i=t[r];let s;Ee(i)?"default"in i?s=_r(i.from||r,i.default,!0):s=_r(i.from||r):s=_r(i),De(s)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>s.value,set:o=>s.value=o}):e[r]=s}}function nu(t,e,n){Ct(se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function ru(t,e,n,r){let i=r.includes(".")?_u(n,r):()=>n[r];if($e(t)){const s=e[t];oe(s)&&Ln(i,s)}else if(oe(t))Ln(i,t.bind(n));else if(Ee(t))if(se(t))t.forEach(s=>ru(s,e,n,r));else{const s=oe(t.handler)?t.handler.bind(n):e[t.handler];oe(s)&&Ln(i,s,t)}}function iu(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:i,optionsCache:s,config:{optionMergeStrategies:o}}=t.appContext,a=s.get(e);let l;return a?l=a:!i.length&&!n&&!r?l=e:(l={},i.length&&i.forEach(c=>Bi(l,c,o,!0)),Bi(l,e,o)),Ee(e)&&s.set(e,l),l}function Bi(t,e,n,r=!1){const{mixins:i,extends:s}=e;s&&Bi(t,s,n,!0),i&&i.forEach(o=>Bi(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const a=Qg[o]||n&&n[o];t[o]=a?a(t[o],e[o]):e[o]}return t}const Qg={data:su,props:ou,emits:ou,methods:wr,computed:wr,beforeCreate:Ye,created:Ye,beforeMount:Ye,mounted:Ye,beforeUpdate:Ye,updated:Ye,beforeDestroy:Ye,beforeUnmount:Ye,destroyed:Ye,unmounted:Ye,activated:Ye,deactivated:Ye,errorCaptured:Ye,serverPrefetch:Ye,components:wr,directives:wr,watch:Xg,provide:su,inject:Jg};function su(t,e){return e?t?function(){return Me(oe(t)?t.call(this,this):t,oe(e)?e.call(this,this):e)}:e:t}function Jg(t,e){return wr(Ao(t),Ao(e))}function Ao(t){if(se(t)){const e={};for(let n=0;n<t.length;n++)e[t[n]]=t[n];return e}return t}function Ye(t,e){return t?[...new Set([].concat(t,e))]:e}function wr(t,e){return t?Me(Object.create(null),t,e):e}function ou(t,e){return t?se(t)&&se(e)?[...new Set([...t,...e])]:Me(Object.create(null),Fi(t),Fi(e??{})):e}function Xg(t,e){if(!t)return e;if(!e)return t;const n=Me(Object.create(null),t);for(const r in e)n[r]=Ye(t[r],e[r]);return n}function au(){return{app:null,config:{isNativeTag:oc,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 Zg=0;function ev(t,e){return function(r,i=null){oe(r)||(r=Me({},r)),i!=null&&!Ee(i)&&(i=null);const s=au(),o=new WeakSet,a=[];let l=!1;const c=s.app={_uid:Zg++,_component:r,_props:i,_container:null,_context:s,_instance:null,version:jv,get config(){return s.config},set config(u){},use(u,...f){return o.has(u)||(u&&oe(u.install)?(o.add(u),u.install(c,...f)):oe(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,m){if(!l){const y=c._ceVNode||tn(r,i);return y.appContext=s,m===!0?m="svg":m===!1&&(m=void 0),t(y,u,m),l=!0,c._container=u,u.__vue_app__=c,qo(y.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=Dn;Dn=c;try{return u()}finally{Dn=f}}};return c}}let Dn=null;function lu(t,e){if(Ge){let n=Ge.provides;const r=Ge.parent&&Ge.parent.provides;r===n&&(n=Ge.provides=Object.create(r)),n[t]=e}}function _r(t,e,n=!1){const r=Bo();if(r||Dn){let i=Dn?Dn._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&t in i)return i[t];if(arguments.length>1)return n&&oe(e)?e.call(r&&r.proxy):e}}const cu={},uu=()=>Object.create(cu),fu=t=>Object.getPrototypeOf(t)===cu;function tv(t,e,n,r=!1){const i={},s=uu();t.propsDefaults=Object.create(null),du(t,e,i,s);for(const o in t.propsOptions[0])o in i||(i[o]=void 0);n?t.props=r?i:mg(i):t.type.props?t.props=i:t.props=s,t.attrs=s}function nv(t,e,n,r){const{props:i,attrs:s,vnode:{patchFlag:o}}=t,a=de(i),[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 m=u[f];if(Ui(t.emitsOptions,m))continue;const y=e[m];if(l)if(ge(s,m))y!==s[m]&&(s[m]=y,c=!0);else{const b=Ft(m);i[b]=No(l,a,b,y,t,!1)}else y!==s[m]&&(s[m]=y,c=!0)}}}else{du(t,e,i,s)&&(c=!0);let u;for(const f in a)(!e||!ge(e,f)&&((u=Jt(f))===f||!ge(e,u)))&&(l?n&&(n[f]!==void 0||n[u]!==void 0)&&(i[f]=No(l,a,f,void 0,t,!0)):delete i[f]);if(s!==a)for(const f in s)(!e||!ge(e,f))&&(delete s[f],c=!0)}c&&Bt(t.attrs,"set","")}function du(t,e,n,r){const[i,s]=t.propsOptions;let o=!1,a;if(e)for(let l in e){if(cr(l))continue;const c=e[l];let u;i&&ge(i,u=Ft(l))?!s||!s.includes(u)?n[u]=c:(a||(a={}))[u]=c:Ui(t.emitsOptions,l)||(!(l in r)||c!==r[l])&&(r[l]=c,o=!0)}if(s){const l=de(n),c=a||pe;for(let u=0;u<s.length;u++){const f=s[u];n[f]=No(i,l,f,c[f],t,!ge(c,f))}}return o}function No(t,e,n,r,i,s){const o=t[n];if(o!=null){const a=ge(o,"default");if(a&&r===void 0){const l=o.default;if(o.type!==Function&&!o.skipFactory&&oe(l)){const{propsDefaults:c}=i;if(n in c)r=c[n];else{const u=$r(i);r=c[n]=l.call(null,e),u()}}else r=l;i.ce&&i.ce._setProp(n,r)}o[0]&&(s&&!a?r=!1:o[1]&&(r===""||r===Jt(n))&&(r=!0))}return r}const rv=new WeakMap;function hu(t,e,n=!1){const r=n?rv:e.propsCache,i=r.get(t);if(i)return i;const s=t.props,o={},a=[];let l=!1;if(!oe(t)){const u=f=>{l=!0;const[m,y]=hu(f,e,!0);Me(o,m),y&&a.push(...y)};!n&&e.mixins.length&&e.mixins.forEach(u),t.extends&&u(t.extends),t.mixins&&t.mixins.forEach(u)}if(!s&&!l)return Ee(t)&&r.set(t,Cn),Cn;if(se(s))for(let u=0;u<s.length;u++){const f=Ft(s[u]);pu(f)&&(o[f]=pe)}else if(s)for(const u in s){const f=Ft(u);if(pu(f)){const m=s[u],y=o[f]=se(m)||oe(m)?{type:m}:Me({},m),b=y.type;let I=!1,F=!0;if(se(b))for(let D=0;D<b.length;++D){const T=b[D],v=oe(T)&&T.name;if(v==="Boolean"){I=!0;break}else v==="String"&&(F=!1)}else I=oe(b)&&b.name==="Boolean";y[0]=I,y[1]=F,(I||ge(y,"default"))&&a.push(f)}}const c=[o,a];return Ee(t)&&r.set(t,c),c}function pu(t){return t[0]!=="$"&&!cr(t)}const Ro=t=>t==="_"||t==="_ctx"||t==="$stable",Do=t=>se(t)?t.map(It):[It(t)],iv=(t,e,n)=>{if(e._n)return e;const r=Ag((...i)=>Do(e(...i)),n);return r._c=!1,r},mu=(t,e,n)=>{const r=t._ctx;for(const i in t){if(Ro(i))continue;const s=t[i];if(oe(s))e[i]=iv(i,s,r);else if(s!=null){const o=Do(s);e[i]=()=>o}}},gu=(t,e)=>{const n=Do(e);t.slots.default=()=>n},vu=(t,e,n)=>{for(const r in e)(n||!Ro(r))&&(t[r]=e[r])},sv=(t,e,n)=>{const r=t.slots=uu();if(t.vnode.shapeFlag&32){const i=e._;i?(vu(r,e,n),n&&dc(r,"_",i,!0)):mu(e,r)}else e&&gu(t,e)},ov=(t,e,n)=>{const{vnode:r,slots:i}=t;let s=!0,o=pe;if(r.shapeFlag&32){const a=e._;a?n&&a===1?s=!1:vu(i,e,n):(s=!e.$stable,mu(e,i)),o=e}else e&&(gu(t,e),o={default:1});if(s)for(const a in i)!Ro(a)&&o[a]==null&&delete i[a]},st=_v;function av(t){return lv(t)}function lv(t,e){const n=_i();n.__VUE__=!0;const{insert:r,remove:i,patchProp:s,createElement:o,createText:a,createComment:l,setText:c,setElementText:u,parentNode:f,nextSibling:m,setScopeId:y=kt,insertStaticContent:b}=t,I=(_,k,A,L=null,M=null,j=null,G=void 0,V=null,W=!!k.dynamicChildren)=>{if(_===k)return;_&&!kr(_,k)&&(L=Gn(_),lt(_,M,j,!0),_=null),k.patchFlag===-2&&(W=!1,k.dynamicChildren=null);const{type:U,ref:ee,shapeFlag:Q}=k;switch(U){case qi:F(_,k,A,L);break;case Mn:D(_,k,A,L);break;case jo:_==null&&T(k,A,L,G);break;case bt:Ne(_,k,A,L,M,j,G,V,W);break;default:Q&1?h(_,k,A,L,M,j,G,V,W):Q&6?nt(_,k,A,L,M,j,G,V,W):(Q&64||Q&128)&&U.process(_,k,A,L,M,j,G,V,W,xn)}ee!=null&&M?vr(ee,_&&_.ref,j,k||_,!k):ee==null&&_&&_.ref!=null&&vr(_.ref,null,j,_,!0)},F=(_,k,A,L)=>{if(_==null)r(k.el=a(k.children),A,L);else{const M=k.el=_.el;k.children!==_.children&&c(M,k.children)}},D=(_,k,A,L)=>{_==null?r(k.el=l(k.children||""),A,L):k.el=_.el},T=(_,k,A,L)=>{[_.el,_.anchor]=b(_.children,k,A,L,_.el,_.anchor)},v=({el:_,anchor:k},A,L)=>{let M;for(;_&&_!==k;)M=m(_),r(_,A,L),_=M;r(k,A,L)},p=({el:_,anchor:k})=>{let A;for(;_&&_!==k;)A=m(_),i(_),_=A;i(k)},h=(_,k,A,L,M,j,G,V,W)=>{k.type==="svg"?G="svg":k.type==="math"&&(G="mathml"),_==null?S(k,A,L,M,j,G,V,W):H(_,k,M,j,G,V,W)},S=(_,k,A,L,M,j,G,V)=>{let W,U;const{props:ee,shapeFlag:Q,transition:Z,dirs:re}=_;if(W=_.el=o(_.type,j,ee&&ee.is,ee),Q&8?u(W,_.children):Q&16&&N(_.children,W,null,L,M,Lo(_,j),G,V),re&&mn(_,null,L,"created"),O(W,_,_.scopeId,G,L),ee){for(const _e in ee)_e!=="value"&&!cr(_e)&&s(W,_e,null,ee[_e],j,L);"value"in ee&&s(W,"value",null,ee.value,j),(U=ee.onVnodeBeforeMount)&&At(U,L,_)}re&&mn(_,null,L,"beforeMount");const ce=cv(M,Z);ce&&Z.beforeEnter(W),r(W,k,A),((U=ee&&ee.onVnodeMounted)||ce||re)&&st(()=>{U&&At(U,L,_),ce&&Z.enter(W),re&&mn(_,null,L,"mounted")},M)},O=(_,k,A,L,M)=>{if(A&&y(_,A),L)for(let j=0;j<L.length;j++)y(_,L[j]);if(M){let j=M.subTree;if(k===j||$u(j.type)&&(j.ssContent===k||j.ssFallback===k)){const G=M.vnode;O(_,G,G.scopeId,G.slotScopeIds,M.parent)}}},N=(_,k,A,L,M,j,G,V,W=0)=>{for(let U=W;U<_.length;U++){const ee=_[U]=V?nn(_[U]):It(_[U]);I(null,ee,k,A,L,M,j,G,V)}},H=(_,k,A,L,M,j,G)=>{const V=k.el=_.el;let{patchFlag:W,dynamicChildren:U,dirs:ee}=k;W|=_.patchFlag&16;const Q=_.props||pe,Z=k.props||pe;let re;if(A&&gn(A,!1),(re=Z.onVnodeBeforeUpdate)&&At(re,A,k,_),ee&&mn(k,_,A,"beforeUpdate"),A&&gn(A,!0),(Q.innerHTML&&Z.innerHTML==null||Q.textContent&&Z.textContent==null)&&u(V,""),U?X(_.dynamicChildren,U,V,A,L,Lo(k,M),j):G||we(_,k,V,null,A,L,Lo(k,M),j,!1),W>0){if(W&16)Ce(V,Q,Z,A,M);else if(W&2&&Q.class!==Z.class&&s(V,"class",null,Z.class,M),W&4&&s(V,"style",Q.style,Z.style,M),W&8){const ce=k.dynamicProps;for(let _e=0;_e<ce.length;_e++){const he=ce[_e],Be=Q[he],Ue=Z[he];(Ue!==Be||he==="value")&&s(V,he,Be,Ue,M,A)}}W&1&&_.children!==k.children&&u(V,k.children)}else!G&&U==null&&Ce(V,Q,Z,A,M);((re=Z.onVnodeUpdated)||ee)&&st(()=>{re&&At(re,A,k,_),ee&&mn(k,_,A,"updated")},L)},X=(_,k,A,L,M,j,G)=>{for(let V=0;V<k.length;V++){const W=_[V],U=k[V],ee=W.el&&(W.type===bt||!kr(W,U)||W.shapeFlag&198)?f(W.el):A;I(W,U,ee,null,L,M,j,G,!0)}},Ce=(_,k,A,L,M)=>{if(k!==A){if(k!==pe)for(const j in k)!cr(j)&&!(j in A)&&s(_,j,k[j],null,M,L);for(const j in A){if(cr(j))continue;const G=A[j],V=k[j];G!==V&&j!=="value"&&s(_,j,V,G,M,L)}"value"in A&&s(_,"value",k.value,A.value,M)}},Ne=(_,k,A,L,M,j,G,V,W)=>{const U=k.el=_?_.el:a(""),ee=k.anchor=_?_.anchor:a("");let{patchFlag:Q,dynamicChildren:Z,slotScopeIds:re}=k;re&&(V=V?V.concat(re):re),_==null?(r(U,A,L),r(ee,A,L),N(k.children||[],A,ee,M,j,G,V,W)):Q>0&&Q&64&&Z&&_.dynamicChildren?(X(_.dynamicChildren,Z,A,M,j,G,V),(k.key!=null||M&&k===M.subTree)&&yu(_,k,!0)):we(_,k,A,ee,M,j,G,V,W)},nt=(_,k,A,L,M,j,G,V,W)=>{k.slotScopeIds=V,_==null?k.shapeFlag&512?M.ctx.activate(k,A,L,G,W):Ht(k,A,L,M,j,G,W):wn(_,k,W)},Ht=(_,k,A,L,M,j,G)=>{const V=_.component=Ov(_,L,M);if(Gc(_)&&(V.ctx.renderer=xn),Tv(V,!1,G),V.asyncDep){if(M&&M.registerDep(V,Re,G),!_.el){const W=V.subTree=tn(Mn);D(null,W,k,A),_.placeholder=W.el}}else Re(V,_,k,A,M,j,G)},wn=(_,k,A)=>{const L=k.component=_.component;if(bv(_,k,A))if(L.asyncDep&&!L.asyncResolved){ve(L,k,A);return}else L.next=k,L.update();else k.el=_.el,L.vnode=k},Re=(_,k,A,L,M,j,G)=>{const V=()=>{if(_.isMounted){let{next:Q,bu:Z,u:re,parent:ce,vnode:_e}=_;{const ut=bu(_);if(ut){Q&&(Q.el=_e.el,ve(_,Q,G)),ut.asyncDep.then(()=>{_.isUnmounted||V()});return}}let he=Q,Be;gn(_,!1),Q?(Q.el=_e.el,ve(_,Q,G)):Q=_e,Z&&ao(Z),(Be=Q.props&&Q.props.onVnodeBeforeUpdate)&&At(Be,ce,Q,_e),gn(_,!0);const Ue=ku(_),ct=_.subTree;_.subTree=Ue,I(ct,Ue,f(ct.el),Gn(ct),_,M,j),Q.el=Ue.el,he===null&&wv(_,Ue.el),re&&st(re,M),(Be=Q.props&&Q.props.onVnodeUpdated)&&st(()=>At(Be,ce,Q,_e),M)}else{let Q;const{el:Z,props:re}=k,{bm:ce,m:_e,parent:he,root:Be,type:Ue}=_,ct=yr(k);gn(_,!1),ce&&ao(ce),!ct&&(Q=re&&re.onVnodeBeforeMount)&&At(Q,he,k),gn(_,!0);{Be.ce&&Be.ce._def.shadowRoot!==!1&&Be.ce._injectChildStyle(Ue);const ut=_.subTree=ku(_);I(null,ut,A,L,_,M,j),k.el=ut.el}if(_e&&st(_e,M),!ct&&(Q=re&&re.onVnodeMounted)){const ut=k;st(()=>At(Q,he,ut),M)}(k.shapeFlag&256||he&&yr(he.vnode)&&he.vnode.shapeFlag&256)&&_.a&&st(_.a,M),_.isMounted=!0,k=A=L=null}};_.scope.on();const W=_.effect=new vc(V);_.scope.off();const U=_.update=W.run.bind(W),ee=_.job=W.runIfDirty.bind(W);ee.i=_,ee.id=_.uid,W.scheduler=()=>Po(ee),gn(_,!0),U()},ve=(_,k,A)=>{k.component=_;const L=_.vnode.props;_.vnode=k,_.next=null,nv(_,k.props,L,A),ov(_,k.children,A),Pt(),qc(_),$t()},we=(_,k,A,L,M,j,G,V,W=!1)=>{const U=_&&_.children,ee=_?_.shapeFlag:0,Q=k.children,{patchFlag:Z,shapeFlag:re}=k;if(Z>0){if(Z&128){Yn(U,Q,A,L,M,j,G,V,W);return}else if(Z&256){Wt(U,Q,A,L,M,j,G,V,W);return}}re&8?(ee&16&&_n(U,M,j),Q!==U&&u(A,Q)):ee&16?re&16?Yn(U,Q,A,L,M,j,G,V,W):_n(U,M,j,!0):(ee&8&&u(A,""),re&16&&N(Q,A,L,M,j,G,V,W))},Wt=(_,k,A,L,M,j,G,V,W)=>{_=_||Cn,k=k||Cn;const U=_.length,ee=k.length,Q=Math.min(U,ee);let Z;for(Z=0;Z<Q;Z++){const re=k[Z]=W?nn(k[Z]):It(k[Z]);I(_[Z],re,A,null,M,j,G,V,W)}U>ee?_n(_,M,j,!0,!1,Q):N(k,A,L,M,j,G,V,W,Q)},Yn=(_,k,A,L,M,j,G,V,W)=>{let U=0;const ee=k.length;let Q=_.length-1,Z=ee-1;for(;U<=Q&&U<=Z;){const re=_[U],ce=k[U]=W?nn(k[U]):It(k[U]);if(kr(re,ce))I(re,ce,A,null,M,j,G,V,W);else break;U++}for(;U<=Q&&U<=Z;){const re=_[Q],ce=k[Z]=W?nn(k[Z]):It(k[Z]);if(kr(re,ce))I(re,ce,A,null,M,j,G,V,W);else break;Q--,Z--}if(U>Q){if(U<=Z){const re=Z+1,ce=re<ee?k[re].el:L;for(;U<=Z;)I(null,k[U]=W?nn(k[U]):It(k[U]),A,ce,M,j,G,V,W),U++}}else if(U>Z)for(;U<=Q;)lt(_[U],M,j,!0),U++;else{const re=U,ce=U,_e=new Map;for(U=ce;U<=Z;U++){const Qe=k[U]=W?nn(k[U]):It(k[U]);Qe.key!=null&&_e.set(Qe.key,U)}let he,Be=0;const Ue=Z-ce+1;let ct=!1,ut=0;const sn=new Array(Ue);for(U=0;U<Ue;U++)sn[U]=0;for(U=re;U<=Q;U++){const Qe=_[U];if(Be>=Ue){lt(Qe,M,j,!0);continue}let pt;if(Qe.key!=null)pt=_e.get(Qe.key);else for(he=ce;he<=Z;he++)if(sn[he-ce]===0&&kr(Qe,k[he])){pt=he;break}pt===void 0?lt(Qe,M,j,!0):(sn[pt-ce]=U+1,pt>=ut?ut=pt:ct=!0,I(Qe,k[pt],A,null,M,j,G,V,W),Be++)}const Qn=ct?uv(sn):Cn;for(he=Qn.length-1,U=Ue-1;U>=0;U--){const Qe=ce+U,pt=k[Qe],Jn=k[Qe+1],Dr=Qe+1<ee?Jn.el||Jn.placeholder:L;sn[U]===0?I(null,pt,A,Dr,M,j,G,V,W):ct&&(he<0||U!==Qn[he]?Fe(pt,A,Dr,2):he--)}}},Fe=(_,k,A,L,M=null)=>{const{el:j,type:G,transition:V,children:W,shapeFlag:U}=_;if(U&6){Fe(_.component.subTree,k,A,L);return}if(U&128){_.suspense.move(k,A,L);return}if(U&64){G.move(_,k,A,xn);return}if(G===bt){r(j,k,A);for(let Q=0;Q<W.length;Q++)Fe(W[Q],k,A,L);r(_.anchor,k,A);return}if(G===jo){v(_,k,A);return}if(L!==2&&U&1&&V)if(L===0)V.beforeEnter(j),r(j,k,A),st(()=>V.enter(j),M);else{const{leave:Q,delayLeave:Z,afterLeave:re}=V,ce=()=>{_.ctx.isUnmounted?i(j):r(j,k,A)},_e=()=>{j._isLeaving&&j[Dg](!0),Q(j,()=>{ce(),re&&re()})};Z?Z(j,ce,_e):_e()}else r(j,k,A)},lt=(_,k,A,L=!1,M=!1)=>{const{type:j,props:G,ref:V,children:W,dynamicChildren:U,shapeFlag:ee,patchFlag:Q,dirs:Z,cacheIndex:re}=_;if(Q===-2&&(M=!1),V!=null&&(Pt(),vr(V,null,A,_,!0),$t()),re!=null&&(k.renderCache[re]=void 0),ee&256){k.ctx.deactivate(_);return}const ce=ee&1&&Z,_e=!yr(_);let he;if(_e&&(he=G&&G.onVnodeBeforeUnmount)&&At(he,k,_),ee&6)ta(_.component,A,L);else{if(ee&128){_.suspense.unmount(A,L);return}ce&&mn(_,null,k,"beforeUnmount"),ee&64?_.type.remove(_,k,A,xn,L):U&&!U.hasOnce&&(j!==bt||Q>0&&Q&64)?_n(U,k,A,!1,!0):(j===bt&&Q&384||!M&&ee&16)&&_n(W,k,A),L&&Xi(_)}(_e&&(he=G&&G.onVnodeUnmounted)||ce)&&st(()=>{he&&At(he,k,_),ce&&mn(_,null,k,"unmounted")},A)},Xi=_=>{const{type:k,el:A,anchor:L,transition:M}=_;if(k===bt){ea(A,L);return}if(k===jo){p(_);return}const j=()=>{i(A),M&&!M.persisted&&M.afterLeave&&M.afterLeave()};if(_.shapeFlag&1&&M&&!M.persisted){const{leave:G,delayLeave:V}=M,W=()=>G(A,j);V?V(_.el,j,W):W()}else j()},ea=(_,k)=>{let A;for(;_!==k;)A=m(_),i(_),_=A;i(k)},ta=(_,k,A)=>{const{bum:L,scope:M,job:j,subTree:G,um:V,m:W,a:U}=_;wu(W),wu(U),L&&ao(L),M.stop(),j&&(j.flags|=8,lt(G,_,k,A)),V&&st(V,k),st(()=>{_.isUnmounted=!0},k)},_n=(_,k,A,L=!1,M=!1,j=0)=>{for(let G=j;G<_.length;G++)lt(_[G],k,A,L,M)},Gn=_=>{if(_.shapeFlag&6)return Gn(_.component.subTree);if(_.shapeFlag&128)return _.suspense.next();const k=m(_.anchor||_.el),A=k&&k[Ng];return A?m(A):k};let Rr=!1;const Zi=(_,k,A)=>{_==null?k._vnode&<(k._vnode,null,null,!0):I(k._vnode||null,_,k,null,null,null,A),k._vnode=_,Rr||(Rr=!0,qc(),zc(),Rr=!1)},xn={p:I,um:lt,m:Fe,r:Xi,mt:Ht,mc:N,pc:we,pbc:X,n:Gn,o:t};return{render:Zi,hydrate:void 0,createApp:ev(Zi)}}function Lo({type:t,props:e},n){return n==="svg"&&t==="foreignObject"||n==="mathml"&&t==="annotation-xml"&&e&&e.encoding&&e.encoding.includes("html")?void 0:n}function gn({effect:t,job:e},n){n?(t.flags|=32,e.flags|=4):(t.flags&=-33,e.flags&=-5)}function cv(t,e){return(!t||t&&!t.pendingBranch)&&e&&!e.persisted}function yu(t,e,n=!1){const r=t.children,i=e.children;if(se(r)&&se(i))for(let s=0;s<r.length;s++){const o=r[s];let a=i[s];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[s]=nn(i[s]),a.el=o.el),!n&&a.patchFlag!==-2&&yu(o,a)),a.type===qi&&a.patchFlag!==-1&&(a.el=o.el),a.type===Mn&&!a.el&&(a.el=o.el)}}function uv(t){const e=t.slice(),n=[0];let r,i,s,o,a;const l=t.length;for(r=0;r<l;r++){const c=t[r];if(c!==0){if(i=n[n.length-1],t[i]<c){e[r]=i,n.push(r);continue}for(s=0,o=n.length-1;s<o;)a=s+o>>1,t[n[a]]<c?s=a+1:o=a;c<t[n[s]]&&(s>0&&(e[r]=n[s-1]),n[s]=r)}}for(s=n.length,o=n[s-1];s-- >0;)n[s]=o,o=e[o];return n}function bu(t){const e=t.subTree.component;if(e)return e.asyncDep&&!e.asyncResolved?e:bu(e)}function wu(t){if(t)for(let e=0;e<t.length;e++)t[e].flags|=8}const fv=Symbol.for("v-scx"),dv=()=>_r(fv);function hv(t,e){return Mo(t,null,{flush:"sync"})}function Ln(t,e,n){return Mo(t,e,n)}function Mo(t,e,n=pe){const{immediate:r,deep:i,flush:s,once:o}=n,a=Me({},n),l=e&&r||!e&&s!=="post";let c;if(Cr){if(s==="sync"){const y=dv();c=y.__watcherHandles||(y.__watcherHandles=[])}else if(!l){const y=()=>{};return y.stop=kt,y.resume=kt,y.pause=kt,y}}const u=Ge;a.call=(y,b,I)=>Ct(y,u,b,I);let f=!1;s==="post"?a.scheduler=y=>{st(y,u&&u.suspense)}:s!=="sync"&&(f=!0,a.scheduler=(y,b)=>{b?y():Po(y)}),a.augmentJob=y=>{e&&(y.flags|=4),f&&(y.flags|=2,u&&(y.id=u.uid,y.i=u))};const m=Eg(t,e,a);return Cr&&(c?c.push(m):l&&m()),m}function pv(t,e,n){const r=this.proxy,i=$e(t)?t.includes(".")?_u(r,t):()=>r[t]:t.bind(r,r);let s;oe(e)?s=e:(s=e.handler,n=e);const o=$r(this),a=Mo(i,s.bind(r),n);return o(),a}function _u(t,e){const n=e.split(".");return()=>{let r=t;for(let i=0;i<n.length&&r;i++)r=r[n[i]];return r}}function xu(t,e,n=pe){const r=Bo(),i=Ft(e),s=Jt(e),o=Su(t,i),a=wg((l,c)=>{let u,f=pe,m;return hv(()=>{const y=t[i];et(u,y)&&(u=y,c())}),{get(){return l(),n.get?n.get(u):u},set(y){const b=n.set?n.set(y):y;if(!et(b,u)&&!(f!==pe&&et(y,f)))return;const I=r.vnode.props;I&&(e in I||i in I||s in I)&&(`onUpdate:${e}`in I||`onUpdate:${i}`in I||`onUpdate:${s}`in I)||(u=y,c()),r.emit(`update:${e}`,b),et(y,b)&&et(y,f)&&!et(b,m)&&c(),f=y,m=b}}});return a[Symbol.iterator]=()=>{let l=0;return{next(){return l<2?{value:l++?o||pe:a,done:!1}:{done:!0}}}},a}const Su=(t,e)=>e==="modelValue"||e==="model-value"?t.modelModifiers:t[`${e}Modifiers`]||t[`${Ft(e)}Modifiers`]||t[`${Jt(e)}Modifiers`];function mv(t,e,...n){if(t.isUnmounted)return;const r=t.vnode.props||pe;let i=n;const s=e.startsWith("update:"),o=s&&Su(r,e.slice(7));o&&(o.trim&&(i=n.map(u=>$e(u)?u.trim():u)),o.number&&(i=n.map(zm)));let a,l=r[a=oo(e)]||r[a=oo(Ft(e))];!l&&s&&(l=r[a=oo(Jt(e))]),l&&Ct(l,t,6,i);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,i)}}const gv=new WeakMap;function Eu(t,e,n=!1){const r=n?gv:e.emitsCache,i=r.get(t);if(i!==void 0)return i;const s=t.emits;let o={},a=!1;if(!oe(t)){const l=c=>{const u=Eu(c,e,!0);u&&(a=!0,Me(o,u))};!n&&e.mixins.length&&e.mixins.forEach(l),t.extends&&l(t.extends),t.mixins&&t.mixins.forEach(l)}return!s&&!a?(Ee(t)&&r.set(t,null),null):(se(s)?s.forEach(l=>o[l]=null):Me(o,s),Ee(t)&&r.set(t,o),o)}function Ui(t,e){return!t||!yi(e)?!1:(e=e.slice(2).replace(/Once$/,""),ge(t,e[0].toLowerCase()+e.slice(1))||ge(t,Jt(e))||ge(t,e))}function Ib(){}function ku(t){const{type:e,vnode:n,proxy:r,withProxy:i,propsOptions:[s],slots:o,attrs:a,emit:l,render:c,renderCache:u,props:f,data:m,setupState:y,ctx:b,inheritAttrs:I}=t,F=Li(t);let D,T;try{if(n.shapeFlag&4){const p=i||r,h=p;D=It(c.call(h,p,u,f,y,m,b)),T=a}else{const p=e;D=It(p.length>1?p(f,{attrs:a,slots:o,emit:l}):p(f,null)),T=e.props?a:vv(a)}}catch(p){xr.length=0,Ni(p,t,1),D=tn(Mn)}let v=D;if(T&&I!==!1){const p=Object.keys(T),{shapeFlag:h}=v;p.length&&h&7&&(s&&p.some(ro)&&(T=yv(T,s)),v=Fn(v,T,!1,!0))}return n.dirs&&(v=Fn(v,null,!1,!0),v.dirs=v.dirs?v.dirs.concat(n.dirs):n.dirs),n.transition&&$o(v,n.transition),D=v,Li(F),D}const vv=t=>{let e;for(const n in t)(n==="class"||n==="style"||yi(n))&&((e||(e={}))[n]=t[n]);return e},yv=(t,e)=>{const n={};for(const r in t)(!ro(r)||!(r.slice(9)in e))&&(n[r]=t[r]);return n};function bv(t,e,n){const{props:r,children:i,component:s}=t,{props:o,children:a,patchFlag:l}=e,c=s.emitsOptions;if(e.dirs||e.transition)return!0;if(n&&l>=0){if(l&1024)return!0;if(l&16)return r?Pu(r,o,c):!!o;if(l&8){const u=e.dynamicProps;for(let f=0;f<u.length;f++){const m=u[f];if(o[m]!==r[m]&&!Ui(c,m))return!0}}}else return(i||a)&&(!a||!a.$stable)?!0:r===o?!1:r?o?Pu(r,o,c):!0:!!o;return!1}function Pu(t,e,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!0;for(let i=0;i<r.length;i++){const s=r[i];if(e[s]!==t[s]&&!Ui(n,s))return!0}return!1}function wv({vnode:t,parent:e},n){for(;e;){const r=e.subTree;if(r.suspense&&r.suspense.activeBranch===t&&(r.el=t.el),r===t)(t=e.vnode).el=n,e=e.parent;else break}}const $u=t=>t.__isSuspense;function _v(t,e){e&&e.pendingBranch?se(t)?e.effects.push(...t):e.effects.push(t):Ig(t)}const bt=Symbol.for("v-fgt"),qi=Symbol.for("v-txt"),Mn=Symbol.for("v-cmt"),jo=Symbol.for("v-stc"),xr=[];let ot=null;function jn(t=!1){xr.push(ot=t?null:[])}function xv(){xr.pop(),ot=xr[xr.length-1]||null}let Sr=1;function Cu(t,e=!1){Sr+=t,t<0&&ot&&e&&(ot.hasOnce=!0)}function Ou(t){return t.dynamicChildren=Sr>0?ot||Cn:null,xv(),Sr>0&&ot&&ot.push(t),t}function Er(t,e,n,r,i,s){return Ou(Pr(t,e,n,r,i,s,!0))}function Sv(t,e,n,r,i){return Ou(tn(t,e,n,r,i,!0))}function Tu(t){return t?t.__v_isVNode===!0:!1}function kr(t,e){return t.type===e.type&&t.key===e.key}const Iu=({key:t})=>t??null,zi=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?$e(t)||De(t)||oe(t)?{i:Tt,r:t,k:e,f:!!n}:t:null);function Pr(t,e=null,n=null,r=0,i=null,s=t===bt?0:1,o=!1,a=!1){const l={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&Iu(e),ref:e&&zi(e),scopeId:Wc,slotScopeIds:null,children:n,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:i,dynamicChildren:null,appContext:null,ctx:Tt};return a?(Fo(l,n),s&128&&t.normalize(l)):n&&(l.shapeFlag|=$e(n)?8:16),Sr>0&&!o&&ot&&(l.patchFlag>0||s&6)&&l.patchFlag!==32&&ot.push(l),l}const tn=Ev;function Ev(t,e=null,n=null,r=0,i=null,s=!1){if((!t||t===Kg)&&(t=Mn),Tu(t)){const a=Fn(t,e,!0);return n&&Fo(a,n),Sr>0&&!s&&ot&&(a.shapeFlag&6?ot[ot.indexOf(t)]=a:ot.push(a)),a.patchFlag=-2,a}if(Mv(t)&&(t=t.__vccOpts),e){e=kv(e);let{class:a,style:l}=e;a&&!$e(a)&&(e.class=xi(a)),Ee(l)&&(Eo(l)&&!se(l)&&(l=Me({},l)),e.style=lo(l))}const o=$e(t)?1:$u(t)?128:Rg(t)?64:Ee(t)?4:oe(t)?2:0;return Pr(t,e,n,r,i,o,s,!0)}function kv(t){return t?Eo(t)||fu(t)?Me({},t):t:null}function Fn(t,e,n=!1,r=!1){const{props:i,ref:s,patchFlag:o,children:a,transition:l}=t,c=e?Au(i||{},e):i,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&Iu(c),ref:e&&e.ref?n&&s?se(s)?s.concat(zi(e)):[s,zi(e)]:zi(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!==bt?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&&Fn(t.ssContent),ssFallback:t.ssFallback&&Fn(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return l&&r&&$o(u,l.clone(u)),u}function Pv(t=" ",e=0){return tn(qi,null,t,e)}function It(t){return t==null||typeof t=="boolean"?tn(Mn):se(t)?tn(bt,null,t.slice()):Tu(t)?nn(t):tn(qi,null,String(t))}function nn(t){return t.el===null&&t.patchFlag!==-1||t.memo?t:Fn(t)}function Fo(t,e){let n=0;const{shapeFlag:r}=t;if(e==null)e=null;else if(se(e))n=16;else if(typeof e=="object")if(r&65){const i=e.default;i&&(i._c&&(i._d=!1),Fo(t,i()),i._c&&(i._d=!0));return}else{n=32;const i=e._;!i&&!fu(e)?e._ctx=Tt:i===3&&Tt&&(Tt.slots._===1?e._=1:(e._=2,t.patchFlag|=1024))}else oe(e)?(e={default:e,_ctx:Tt},n=32):(e=String(e),r&64?(n=16,e=[Pv(e)]):n=8);t.children=e,t.shapeFlag|=n}function Au(...t){const e={};for(let n=0;n<t.length;n++){const r=t[n];for(const i in r)if(i==="class")e.class!==r.class&&(e.class=xi([e.class,r.class]));else if(i==="style")e.style=lo([e.style,r.style]);else if(yi(i)){const s=e[i],o=r[i];o&&s!==o&&!(se(s)&&s.includes(o))&&(e[i]=s?[].concat(s,o):o)}else i!==""&&(e[i]=r[i])}return e}function At(t,e,n,r=null){Ct(t,e,7,[n,r])}const $v=au();let Cv=0;function Ov(t,e,n){const r=t.type,i=(e?e.appContext:t.appContext)||$v,s={uid:Cv++,vnode:t,type:r,parent:e,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Gm(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:e?e.provides:Object.create(i.provides),ids:e?e.ids:["",0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:hu(r,i),emitsOptions:Eu(r,i),emit:null,emitted:null,propsDefaults:pe,inheritAttrs:r.inheritAttrs,ctx:pe,data:pe,props:pe,attrs:pe,slots:pe,refs:pe,setupState:pe,setupContext:null,suspense:n,suspenseId:n?n.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=mv.bind(null,s),t.ce&&t.ce(s),s}let Ge=null;const Bo=()=>Ge||Tt;let Hi,Uo;{const t=_i(),e=(n,r)=>{let i;return(i=t[n])||(i=t[n]=[]),i.push(r),s=>{i.length>1?i.forEach(o=>o(s)):i[0](s)}};Hi=e("__VUE_INSTANCE_SETTERS__",n=>Ge=n),Uo=e("__VUE_SSR_SETTERS__",n=>Cr=n)}const $r=t=>{const e=Ge;return Hi(t),t.scope.on(),()=>{t.scope.off(),Hi(e)}},Nu=()=>{Ge&&Ge.scope.off(),Hi(null)};function Ru(t){return t.vnode.shapeFlag&4}let Cr=!1;function Tv(t,e=!1,n=!1){e&&Uo(e);const{props:r,children:i}=t.vnode,s=Ru(t);tv(t,r,s,e),sv(t,i,n||e);const o=s?Iv(t,e):void 0;return e&&Uo(!1),o}function Iv(t,e){const n=t.type;t.accessCache=Object.create(null),t.proxy=new Proxy(t.ctx,Vg);const{setup:r}=n;if(r){Pt();const i=t.setupContext=r.length>1?Nv(t):null,s=$r(t),o=An(r,t,0,[t.props,i]),a=lc(o);if($t(),s(),(a||t.sp)&&!yr(t)&&Vc(t),a){if(o.then(Nu,Nu),e)return o.then(l=>{Du(t,l)}).catch(l=>{Ni(l,t,0)});t.asyncDep=o}else Du(t,o)}else Lu(t)}function Du(t,e,n){oe(e)?t.type.__ssrInlineRender?t.ssrRender=e:t.render=e:Ee(e)&&(t.setupState=jc(e)),Lu(t)}function Lu(t,e,n){const r=t.type;t.render||(t.render=r.render||kt);{const i=$r(t);Pt();try{Yg(t)}finally{$t(),i()}}}const Av={get(t,e){return He(t,"get",""),t[e]}};function Nv(t){const e=n=>{t.exposed=n||{}};return{attrs:new Proxy(t.attrs,Av),slots:t.slots,emit:t.emit,expose:e}}function qo(t){return t.exposed?t.exposeProxy||(t.exposeProxy=new Proxy(jc(gg(t.exposed)),{get(e,n){if(n in e)return e[n];if(n in br)return br[n](t)},has(e,n){return n in e||n in br}})):t.proxy}const Rv=/(?:^|[-_])\w/g,Dv=t=>t.replace(Rv,e=>e.toUpperCase()).replace(/[-_]/g,"");function Lv(t,e=!0){return oe(t)?t.displayName||t.name:t.name||e&&t.__name}function Mu(t,e,n=!1){let r=Lv(e);if(!r&&e.__file){const i=e.__file.match(/([^/\\]+)\.\w+$/);i&&(r=i[1])}if(!r&&t&&t.parent){const i=s=>{for(const o in s)if(s[o]===e)return o};r=i(t.components||t.parent.type.components)||i(t.appContext.components)}return r?Dv(r):n?"App":"Anonymous"}function Mv(t){return oe(t)&&"__vccOpts"in t}const ju=(t,e)=>xg(t,e,Cr),jv="3.5.22";/**
|
|
104
104
|
* @vue/runtime-dom v3.5.22
|
|
105
105
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
106
106
|
* @license MIT
|
|
107
|
-
**/let
|
|
107
|
+
**/let zo;const Fu=typeof window<"u"&&window.trustedTypes;if(Fu)try{zo=Fu.createPolicy("vue",{createHTML:t=>t})}catch{}const Bu=zo?t=>zo.createHTML(t):t=>t,Fv="http://www.w3.org/2000/svg",Bv="http://www.w3.org/1998/Math/MathML",zt=typeof document<"u"?document:null,Uu=zt&&zt.createElement("template"),Uv={insert:(t,e,n)=>{e.insertBefore(t,n||null)},remove:t=>{const e=t.parentNode;e&&e.removeChild(t)},createElement:(t,e,n,r)=>{const i=e==="svg"?zt.createElementNS(Fv,t):e==="mathml"?zt.createElementNS(Bv,t):n?zt.createElement(t,{is:n}):zt.createElement(t);return t==="select"&&r&&r.multiple!=null&&i.setAttribute("multiple",r.multiple),i},createText:t=>zt.createTextNode(t),createComment:t=>zt.createComment(t),setText:(t,e)=>{t.nodeValue=e},setElementText:(t,e)=>{t.textContent=e},parentNode:t=>t.parentNode,nextSibling:t=>t.nextSibling,querySelector:t=>zt.querySelector(t),setScopeId(t,e){t.setAttribute(e,"")},insertStaticContent(t,e,n,r,i,s){const o=n?n.previousSibling:e.lastChild;if(i&&(i===s||i.nextSibling))for(;e.insertBefore(i.cloneNode(!0),n),!(i===s||!(i=i.nextSibling)););else{Uu.innerHTML=Bu(r==="svg"?`<svg>${t}</svg>`:r==="mathml"?`<math>${t}</math>`:t);const a=Uu.content;if(r==="svg"||r==="mathml"){const l=a.firstChild;for(;l.firstChild;)a.appendChild(l.firstChild);a.removeChild(l)}e.insertBefore(a,n)}return[o?o.nextSibling:e.firstChild,n?n.previousSibling:e.lastChild]}},qv=Symbol("_vtc");function zv(t,e,n){const r=t[qv];r&&(e=(e?[e,...r]:[...r]).join(" ")),e==null?t.removeAttribute("class"):n?t.setAttribute("class",e):t.className=e}const qu=Symbol("_vod"),Hv=Symbol("_vsh"),Wv=Symbol(""),Kv=/(?:^|;)\s*display\s*:/;function Vv(t,e,n){const r=t.style,i=$e(n);let s=!1;if(n&&!i){if(e)if($e(e))for(const o of e.split(";")){const a=o.slice(0,o.indexOf(":")).trim();n[a]==null&&Wi(r,a,"")}else for(const o in e)n[o]==null&&Wi(r,o,"");for(const o in n)o==="display"&&(s=!0),Wi(r,o,n[o])}else if(i){if(e!==n){const o=r[Wv];o&&(n+=";"+o),r.cssText=n,s=Kv.test(n)}}else e&&t.removeAttribute("style");qu in t&&(t[qu]=s?r.display:"",t[Hv]&&(r.display="none"))}const zu=/\s*!important$/;function Wi(t,e,n){if(se(n))n.forEach(r=>Wi(t,e,r));else if(n==null&&(n=""),e.startsWith("--"))t.setProperty(e,n);else{const r=Yv(t,e);zu.test(n)?t.setProperty(Jt(r),n.replace(zu,""),"important"):t[r]=n}}const Hu=["Webkit","Moz","ms"],Ho={};function Yv(t,e){const n=Ho[e];if(n)return n;let r=Ft(e);if(r!=="filter"&&r in t)return Ho[e]=r;r=fc(r);for(let i=0;i<Hu.length;i++){const s=Hu[i]+r;if(s in t)return Ho[e]=s}return e}const Wu="http://www.w3.org/1999/xlink";function Ku(t,e,n,r,i,s=Ym(e)){r&&e.startsWith("xlink:")?n==null?t.removeAttributeNS(Wu,e.slice(6,e.length)):t.setAttributeNS(Wu,e,n):n==null||s&&!pc(n)?t.removeAttribute(e):t.setAttribute(e,s?"":Qt(n)?String(n):n)}function Vu(t,e,n,r,i){if(e==="innerHTML"||e==="textContent"){n!=null&&(t[e]=e==="innerHTML"?Bu(n):n);return}const s=t.tagName;if(e==="value"&&s!=="PROGRESS"&&!s.includes("-")){const a=s==="OPTION"?t.getAttribute("value")||"":t.value,l=n==null?t.type==="checkbox"?"on":"":String(n);(a!==l||!("_value"in t))&&(t.value=l),n==null&&t.removeAttribute(e),t._value=n;return}let o=!1;if(n===""||n==null){const a=typeof t[e];a==="boolean"?n=pc(n):n==null&&a==="string"?(n="",o=!0):a==="number"&&(n=0,o=!0)}try{t[e]=n}catch{}o&&t.removeAttribute(i||e)}function Gv(t,e,n,r){t.addEventListener(e,n,r)}function Qv(t,e,n,r){t.removeEventListener(e,n,r)}const Yu=Symbol("_vei");function Jv(t,e,n,r,i=null){const s=t[Yu]||(t[Yu]={}),o=s[e];if(r&&o)o.value=r;else{const[a,l]=Xv(e);if(r){const c=s[e]=ty(r,i);Gv(t,a,c,l)}else o&&(Qv(t,a,o,l),s[e]=void 0)}}const Gu=/(?:Once|Passive|Capture)$/;function Xv(t){let e;if(Gu.test(t)){e={};let r;for(;r=t.match(Gu);)t=t.slice(0,t.length-r[0].length),e[r[0].toLowerCase()]=!0}return[t[2]===":"?t.slice(3):Jt(t.slice(2)),e]}let Wo=0;const Zv=Promise.resolve(),ey=()=>Wo||(Zv.then(()=>Wo=0),Wo=Date.now());function ty(t,e){const n=r=>{if(!r._vts)r._vts=Date.now();else if(r._vts<=n.attached)return;Ct(ny(r,n.value),e,5,[r])};return n.value=t,n.attached=ey(),n}function ny(t,e){if(se(e)){const n=t.stopImmediatePropagation;return t.stopImmediatePropagation=()=>{n.call(t),t._stopped=!0},e.map(r=>i=>!i._stopped&&r&&r(i))}else return e}const Qu=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&t.charCodeAt(2)>96&&t.charCodeAt(2)<123,ry=(t,e,n,r,i,s)=>{const o=i==="svg";e==="class"?zv(t,r,o):e==="style"?Vv(t,n,r):yi(e)?ro(e)||Jv(t,e,n,r,s):(e[0]==="."?(e=e.slice(1),!0):e[0]==="^"?(e=e.slice(1),!1):iy(t,e,r,o))?(Vu(t,e,r),!t.tagName.includes("-")&&(e==="value"||e==="checked"||e==="selected")&&Ku(t,e,r,o,s,e!=="value")):t._isVueCE&&(/[A-Z]/.test(e)||!$e(r))?Vu(t,Ft(e),r,s,e):(e==="true-value"?t._trueValue=r:e==="false-value"&&(t._falseValue=r),Ku(t,e,r,o))};function iy(t,e,n,r){if(r)return!!(e==="innerHTML"||e==="textContent"||e in t&&Qu(e)&&oe(n));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 i=t.tagName;if(i==="IMG"||i==="VIDEO"||i==="CANVAS"||i==="SOURCE")return!1}return Qu(e)&&$e(n)?!1:e in t}const sy=Me({patchProp:ry},Uv);let Ju;function oy(){return Ju||(Ju=av(sy))}const ay=(...t)=>{const e=oy().createApp(...t),{mount:n}=e;return e.mount=r=>{const i=cy(r);if(!i)return;const s=e._component;!oe(s)&&!s.render&&!s.template&&(s.template=i.innerHTML),i.nodeType===1&&(i.textContent="");const o=n(i,!1,ly(i));return i instanceof Element&&(i.removeAttribute("v-cloak"),i.setAttribute("data-v-app","")),o},e};function ly(t){if(t instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&t instanceof MathMLElement)return"mathml"}function cy(t){return $e(t)?document.querySelector(t):t}const Ko=Symbol("IPEInjectKey"),uy=(t,e)=>(e?e.provide(Ko,t):lu(Ko,t),t),fy=()=>{const t=_r(Ko);if(!t)throw new Error("InPageEdit instance is not provided");return t},dt='@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}';/**
|
|
108
108
|
* SchemaForm
|
|
109
109
|
* 一个基于 Schemastery 的 Web Components 表单生成器
|
|
110
110
|
*
|
|
@@ -121,5 +121,5 @@
|
|
|
121
121
|
* @license MIT
|
|
122
122
|
* @author dragon-fish
|
|
123
123
|
* @author @openai/gpt-5
|
|
124
|
-
*/const Yu={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},Ee=(t,e)=>{customElements.get(t)||customElements.define(t,e)},iy=(t,e,n)=>{if(!e.length)return;let r=t,i=null,s=null;for(let a=0;a<e.length-1;a++){const l=e[a];let u=r?.[l];u==null?(u=typeof e[a+1]=="number"?[]:{},r[l]=u):typeof u!="object"&&(u=typeof e[a+1]=="number"?[]:{},r[l]=u),i=r,s=l,r=u}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(i)i[s]=a,r=a;else return}try{r[o]=n}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=n,i&&(i[s]=a)}catch{}}},Cr=t=>t.map(String).join("."),sy=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),tn=t=>`schema_${sy(Cr(t)||"root")}`,mn=t=>Cr(t);function qo(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const n=Number(e);return Number.isNaN(n)?void 0:n}case"boolean":return!!e;case"date":{if(!e)return;const n=new Date(e);return Number.isNaN(+n)?void 0:n}case"const":case"string":default:return e}}function Gu(t){return typeof t=="function"&&!!t?.type}function Ju(t){if(!t)throw new Error("schema is required");if(Gu(t))return t;try{const e=Schema.from(t);if(Gu(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 yt(t){return t?.meta??{}}function oy(t){return t.length>0&&t.every(e=>e?.type==="const")}function Mn(t){if(!t)return;const e=t,n=e.meta||{};if(Object.prototype.hasOwnProperty.call(n,"default"))return n.default;const r=e.type;try{const i=t();if(i!==void 0)return i}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 i=e.list||[];return i.length?Mn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class Tt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Yu,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ft,this.$root.appendChild(e)}makeFieldContainer(e,n){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",Cr(this._path)),this._label){const i=document.createElement("label");i.className="label",i.textContent=this._label,r.appendChild(i)}if(n){const i=document.createElement("div");i.className="helper",i.textContent=n,r.appendChild(i)}return r}set schema(e){this._schema=Ju(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 Qu extends Tt{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>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=mn(this._path),r.id=tn(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(qo("string",r.value));const i=n.querySelector("label.label");i&&(i.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-string",Qu);class Xu extends Tt{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>${ft}</style>`;const e=this._schema?.type??"number",n=yt(this._schema),r=this.makeFieldContainer("number",n.description),i=document.createElement("input");this.$input=i,i.className="input",i.name=mn(this._path),i.id=tn(this._path),n?.min!=null&&(i.min=String(n.min)),n?.max!=null&&(i.max=String(n.max)),n?.step!=null&&(i.step=String(n.step)),e==="percent"&&!i.step&&(i.step="0.01"),i.value=this._value??"",i.oninput=()=>this.emitChange(qo(e,i.value));const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),n.role==="slider"?i.type="range":i.type="number",r.appendChild(i),this.$root.appendChild(r)}}Ee("schema-form-number",Xu);class Zu extends Tt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const i=document.createElement("input");i.type="checkbox",i.checked=!!this._value,i.name=mn(this._path),i.id=tn(this._path);const s=document.createElement("span");s.textContent=this._label??"",i.onchange=()=>this.emitChange(i.checked);const o=n.querySelector("label.label");o&&(o.htmlFor=i.id),r.append(i,s),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-boolean",Zu);function zi(t){return String(t).padStart(2,"0")}function Pr(t){return`${t.getFullYear()}-${zi(t.getMonth()+1)}-${zi(t.getDate())}`}function Wo(t){return`${zi(t.getHours())}:${zi(t.getMinutes())}`}function Hi(t){return`${Pr(t)}T${Wo(t)}`}class ef extends Tt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=yt(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=Pr(this._value):o==="time"?this.$input.value=Wo(this._value):o==="datetime"&&(this.$input.value=Hi(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=Pr(a):o==="datetime"&&(this.$input.value=Hi(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const i=e.role||"date";if(i==="datetime"?r.type="datetime-local":i==="time"?r.type="time":r.type="date",r.name=mn(this._path),r.id=tn(this._path),this._value instanceof Date)i==="date"?r.value=Pr(this._value):i==="time"?r.value=Wo(this._value):i==="datetime"&&(r.value=Hi(this._value));else if(typeof this._value=="string"&&i!=="time"){const o=new Date(this._value);isNaN(+o)||(i==="date"?r.value=Pr(o):i==="datetime"&&(r.value=Hi(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=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-date",ef);class tf extends Tt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this._schema.value;if(e.role==="raw-html"){if(n instanceof Node){this.$root.appendChild(n);return}const o=document.createElement("div");o.innerHTML=String(n),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),i=document.createElement("section");i.className="const content",i.textContent=String(n),i.id=tn(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),r.appendChild(i),this.$root.appendChild(r)}}Ee("schema-form-const",tf);function ay(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 jn(t,e,n,r,i){const s=ay(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class nf extends Tt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(oy(r)){const i=document.createElement("select");i.className="input",i.name=mn(this._path),i.id=tn(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),i.appendChild(a)}),i.onchange=()=>this.emitChange(qo("string",i.value));const s=n.querySelector("label.label");s&&(s.htmlFor=i.id),n.appendChild(i)}else{const i=document.createElement("div");i.className="toolbar";const s=document.createElement("select");s.className="input",s.name=mn(this._path)+".__type",s.id=tn(this._path)+"__type";let o=0;r.forEach((c,f)=>{const v=document.createElement("option");v.value=String(f),v.textContent=c.type,s.appendChild(v)}),s.onchange=()=>{o=Number(s.value);const c=r[o],f=Mn(c);this.emitChange(f),u()};const a=n.querySelector("label.label");a&&(a.htmlFor=s.id),i.appendChild(s),n.appendChild(i);const l=document.createElement("div");l.className="group";const u=()=>{l.innerHTML="";const c=r[o],f=jn(c,this._path,this._value,this._label);f.addEventListener("change",v=>{v.stopPropagation(),this.emitChange(v.detail.value)}),l.appendChild(f)};u(),n.appendChild(l)}this.$root.appendChild(n)}}Ee("schema-form-union",nf);class rf extends Tt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const i=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=jn(s,[...this._path,o],i[o],`${this._label??""}[${o}]`);a.addEventListener("change",l=>{l.stopPropagation();const u=Array.isArray(this._value)?this._value.slice():[];u[o]=l.detail.value,this.emitChange(u)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-tuple",rf);class sf extends Tt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const i=this._schema.dict||{};Object.keys(i).forEach(s=>{if(i[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=jn(i[s],[...this._path,s],o,s);a.addEventListener("change",l=>{l.stopPropagation();const u={...this._value??{}};u[s]=l.detail.value,this.emitChange(u)}),r.appendChild(a)}),n.appendChild(r),this.$root.appendChild(n)}}Ee("schema-form-object",sf);const Yi=class Yi extends Tt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Yi._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const n={};return e.querySelectorAll(".row").forEach(r=>{const i=r.dataset.uid;i&&(n[i]=r.getBoundingClientRect())}),n}playFLIP(e,n){Array.from(e.querySelectorAll(".row")).forEach(r=>{const i=r.dataset.uid;if(!i)return;const s=n[i];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>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(u,c)=>{r.innerHTML="",s().forEach((f,v)=>{const y=[...this._path,v],b=document.createElement("div");b.className="row schema-collection-row";const I=this._itemIds[v];b.dataset.uid=I,b.setAttribute("data-path",Cr(y));const U=jn(i,y,f,`${this._label??""}[${v}]`);U.addEventListener("change",h=>{h.stopPropagation();const S=s().slice();S[v]=h.detail.value,this._value=S,this.emitChange(S)});const D=document.createElement("div");D.className="actions";const T=document.createElement("button");T.type="button",T.className="btn",T.textContent=this._i18n.arrayMoveUp??"↑",T.onclick=()=>{if(v<=0)return;const h=this.capturePositions(r),S=s().slice();[S[v-1],S[v]]=[S[v],S[v-1]],[this._itemIds[v-1],this._itemIds[v]]=[this._itemIds[v],this._itemIds[v-1]],this._value=S,o(h),this.emitChange(S)};const g=document.createElement("button");g.type="button",g.className="btn",g.textContent=this._i18n.arrayMoveDown??"↓",g.onclick=()=>{const h=s();if(v>=h.length-1)return;const S=this.capturePositions(r),O=h.slice();[O[v+1],O[v]]=[O[v],O[v+1]],[this._itemIds[v+1],this._itemIds[v]]=[this._itemIds[v],this._itemIds[v+1]],this._value=O,o(S),this.emitChange(O)};const p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.arrayRemove??"×",p.onclick=()=>{b.classList.add("leaving");const h=250;let S=!1;const O=()=>{if(S)return;S=!0,clearTimeout(N);const q=s().filter((Ce,Ae)=>Ae!==v);this._itemIds.splice(v,1);const X=this.capturePositions(r);this._value=q,o(X),this.emitChange(q)};b.addEventListener("transitionend",O,{once:!0});const N=setTimeout(O,h+80)},D.append(T,g,p),b.appendChild(U),b.appendChild(D),r.appendChild(b),c&&c===I&&(b.classList.add("enter"),requestAnimationFrame(()=>{b.classList.add("enter-active")}),requestAnimationFrame(()=>{b.classList.remove("enter")}))}),u&&this.playFLIP(r,u)};o();const a=document.createElement("button");a.type="button",a.className="btn primary",a.textContent=this._i18n.arrayAdd??"+",a.onclick=()=>{const u=this.capturePositions(r),c=s().slice(),f=Mn(i);c.push(f);const v=this.generateItemId();this._itemIds.push(v),this._value=c,o(u,v),this.emitChange(c)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};Yi._idCounter=0;let qi=Yi;Ee("schema-form-array",qi);class of extends Tt{render(){this.$root.innerHTML=`<style>${ft}</style>`;const e=yt(this._schema),n=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=this._value??{},o=v=>`d_${v}`,a=()=>{const v={};return r.querySelectorAll(".kv").forEach(y=>{const b=y.dataset.uid;b&&(v[b]=y.getBoundingClientRect())}),v},l=v=>{r.querySelectorAll(".kv").forEach(y=>{const b=y.dataset.uid;if(!b)return;const I=v[b];if(!I)return;const U=y.getBoundingClientRect(),D=I.left-U.left,T=I.top-U.top;(D||T)&&(y.style.transition="none",y.style.transform=`translate(${D}px, ${T}px)`,requestAnimationFrame(()=>{y.style.transition="transform .25s ease",y.style.transform=""}))})},u=(v,y)=>{r.innerHTML="",Object.keys(s).forEach(b=>{const I=[...this._path,b],U=document.createElement("div");U.className="kv schema-collection-row",U.dataset.uid=o(b),U.setAttribute("data-path",Cr(I));const D=document.createElement("input");D.className="input",D.value=b,D.name=mn(I)+".__key",D.id=tn(I)+"__key";const T=jn(i,I,s[b],`${this._label??""}[${b}]`),g=document.createElement("button");g.type="button",g.className="btn danger",g.textContent=this._i18n.dictRemove??"×",g.onclick=()=>{const p=a();delete s[b];const h={...this._value??{}};delete h[b],this._value=h,u(p),this.emitChange(h)},D.onchange=()=>{const p=D.value.trim();if(!p||p===b||s[p]!==void 0)return;const h=a();s[p]=s[b],delete s[b];const S={...this._value??{}};S[p]=S[b],delete S[b],this._value=S,u(h),this.emitChange(S)},T.addEventListener("change",p=>{p.stopPropagation();const h={...this._value??{}};h[b]=p.detail.value,this._value=h,this.emitChange(h)}),U.append(D,T,g),r.appendChild(U),y===b&&(U.classList.add("enter"),requestAnimationFrame(()=>U.classList.add("enter-active")),requestAnimationFrame(()=>U.classList.remove("enter")))}),v&&l(v)};u();const c=document.createElement("button");c.type="button",c.className="btn primary",c.textContent=this._i18n.dictAdd??"+",c.onclick=()=>{let v=Object.keys(s).length+1,y=`k${v}`;for(;s[y]!==void 0;)y=`k${++v}`;const b=a();s[y]=Mn(i);const I={...this._value??{},[y]:s[y]};this._value=I,u(b,y),this.emitChange(I)};const f=document.createElement("div");f.className="actions",f.appendChild(c),n.appendChild(r),n.appendChild(f),this.$root.appendChild(n)}}Ee("schema-form-dict",of);class af extends HTMLElement{constructor(){super(),this._i18n={...Yu},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=ft,this.$root.appendChild(e);const n=document.createElement("div");n.className="wrapper",n.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(n),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:i,value:s}=r.detail;Array.isArray(i)&&i.length===0?this._state=s:iy(this._state??(this._state={}),i,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:i,value:s,state:this._state}}))})}set schema(e){this._schema=Ju(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Mn(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,n={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=n.validate?this._schema(e??null,{autofix:n.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=this._state;return e.validate?this._schema(n??null,{autofix:e.autofix}):n}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Mn(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 n=jn(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}Ee("schema-form",af);function ly(){Ee("schema-form",af),Ee("schema-form-string",Qu),Ee("schema-form-number",Xu),Ee("schema-form-boolean",Zu),Ee("schema-form-date",ef),Ee("schema-form-const",tf),Ee("schema-form-union",nf),Ee("schema-form-tuple",rf),Ee("schema-form-object",sf),Ee("schema-form-array",qi),Ee("schema-form-dict",of)}const cy=zc({__name:"SchemasteryFormVue",props:Qc({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:Qc(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=yu(t,"schema"),i=yu(t,"value"),s=n,o=Pg("elRef");let a=!1,l=!1;const u=c=>{if(l)return;const f=o.value,v=t.validateOnChange?f.getData({validate:!0}):c.detail.state;a=!0,i.value=v,Ti(()=>{a=!1}),s("change",c.detail)};return Kc(()=>{ly()}),ko(()=>{const c=o.value;r.value&&(c.schema=r.value),i.value!==void 0&&c.setData(i.value,{validate:!1,autofix:!0}),c.addEventListener("form-change",u)}),Yc(()=>{o.value?.removeEventListener("form-change",u)}),Nn(()=>r,c=>{a||o.value&&c&&o.value.schema!==c.value&&(l=!0,o.value.schema=c.value,Ti(()=>{l=!1}))},{deep:!0,immediate:!0}),Nn(()=>i,c=>{if(a||!o.value||c.value===void 0)return;const f=o.value.getData({validate:!1});JSON.stringify(f)!==JSON.stringify(c.value)&&(l=!0,o.value.setData(c.value,{validate:!1}),Ti(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(c,f){const v=o.value;v.setData(c,{validate:!!f?.validate}),f?.emit&&(i.value=v.getData({validate:!!f?.validate}))},getData(c){return o.value.getData(c)},setSchema(c,f=!0){o.value.schema=c,f&&(r.value=c)},refresh(){o.value.refresh()},reset(){o.value.reset()},el:o}),(c,f)=>(Dn(),xr("schema-form",Pu({ref_key:"elRef",ref:o},c.$attrs),null,16))}});function gn(t,e=new WeakMap){if(Re(t))return gn(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 i=new Map;return e.set(t,i),Array.from(t.entries()).forEach(([s,o])=>{i.set(s,gn(o,e))}),i}if(t instanceof Set){const i=new Set;return e.set(t,i),Array.from(t).forEach(s=>{i.add(gn(s,e))}),i}if(Array.isArray(t)){const i=[];e.set(t,i);for(const s of t)i.push(gn(s,e));return i}const n=fe(t),r={};e.set(t,r);for(const i of Object.keys(n))r[i]=gn(n[i],e);for(const i of Object.getOwnPropertySymbols(n))r[i]=gn(n[i],e);return r}const uy={class:"preferences-ui-app"},fy={class:"tabs"},dy=["onClick","data-value"],hy={style:{"max-height":"20em",overflow:"auto"}},py=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(zc({__name:"PreferencesForm",setup(t,{expose:e}){const n=ry(),r=Tc([]),i=Tc(""),s=$i([]),o=Ru(()=>s.value.map(u=>u.schema)),a=$i({}),l=$i({});return e({getValue(){return gn(l)}}),Nn(i,u=>{u&&(a.value=l.value,s.value=n.preferences.getConfigRegistries(u))},{immediate:!0}),ko(async()=>{n.inject(["preferences"],async u=>{const c=await u.preferences.getAll();a.value=l.value=c,r.value=u.preferences.getConfigCategories(),i.value=r.value[0].name})}),(u,c)=>(Dn(),xr("div",uy,[Er("div",fy,[(Dn(!0),xr(vt,null,Jc(r.value,f=>(Dn(),xr("a",{class:yi(["tab",{active:i.value===f.name}]),key:f.name,onClick:v=>i.value=f.name,"data-value":f.name},oo(f.label),11,dy))),128))]),(Dn(!0),xr(vt,null,Jc(o.value,(f,v)=>(Dn(),mv(Nc(cy),{key:`${i.value}-${v}`,schema:f,value:a.value,"onUpdate:value":c[0]||(c[0]=y=>l.value=y),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),Er("details",null,[Er("pre",hy,oo(l.value),1)])]))}}),[["__scopeId","data-v-e89c782f"]]);var my=Object.create,Vo=Object.defineProperty,gy=Object.getOwnPropertyDescriptor,lf=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),cf=t=>{throw TypeError(t)},vy=(t,e,n)=>e in t?Vo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yy=(t,e)=>Vo(t,"name",{value:e,configurable:!0}),by=t=>[,,,my(t?.[lf("metadata")]??null)],_y=["class","method","getter","setter","accessor","field","value","get","set"],uf=t=>t!==void 0&&typeof t!="function"?cf("Function expected"):t,wy=(t,e,n,r,i)=>({kind:_y[t],name:e,metadata:r,addInitializer:s=>n._?cf("Already initialized"):i.push(uf(s||null))}),xy=(t,e)=>vy(e,lf("metadata"),t[3]),Sy=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Ey=(t,e,n,r,i,s)=>{var o,a,l,u=e&7,c=!1,f=0,v=t[f]||(t[f]=[]),y=u&&(i=i.prototype,u<5&&(u>3||!c)&&gy(i,n));yy(i,n);for(var b=r.length-1;b>=0;b--)l=wy(u,n,a={},t[3],v),o=(0,r[b])(i,l),a._=1,uf(o)&&(i=o);return xy(t,i),y&&Vo(i,n,y),c?u^4?s:y:i},ff,Ko,df;ff=[qe(["preferences","modal"])];class Wi extends(df=rt){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:_("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:[_("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),_("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:"Open preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(()=>{n.toolbox.removeButton("preferences")})})}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:"InPageEdit Prefrences",content:_(Rt,{children:_(Vt,{})})});e.get$window().classList.add("dialog");const n=_("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.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()}}]),e.on(e.Event.Close,()=>{this.logger.debug("preferences modal closed, vue app unmounting"),r.unmount()})}createFormApp(){const e=Zv(py);return ny(this.ctx,e),e}}Ko=by(df),Wi=Ey(Ko,0,"PluginPreferencesUI",ff,Wi),Sy(Ko,1,Wi);const ky=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Wi}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=rt,le.InPageEdit=un,le.Inject=qe,le.Logger=ya,le.LoggerLevel=ls,le.Schema=Se,le.Service=an,le.createLogger=wa,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|
|
124
|
+
*/const Xu={arrayAdd:"+",arrayMoveUp:"↑",arrayMoveDown:"↓",arrayRemove:"×",dictAdd:"+",dictRemove:"×",rootLabel:"root"},ke=(t,e)=>{customElements.get(t)||customElements.define(t,e)},dy=(t,e,n)=>{if(!e.length)return;let r=t,i=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),i=r,s=l,r=c}const o=e[e.length-1];if(r==null||typeof r!="object"){const a=typeof o=="number"?[]:{};if(i)i[s]=a,r=a;else return}try{r[o]=n}catch{try{const a=Array.isArray(r)?r.slice():{...r};a[o]=n,i&&(i[s]=a)}catch{}}},Or=t=>t.map(String).join("."),hy=t=>t.replace(/[^a-zA-Z0-9_-]/g,"_"),rn=t=>`schema_${hy(Or(t)||"root")}`,vn=t=>Or(t);function Vo(t,e){if(e==null)return e;switch(t){case"number":case"natural":case"percent":{if(e==="")return;const n=Number(e);return Number.isNaN(n)?void 0:n}case"boolean":return!!e;case"date":{if(!e)return;const n=new Date(e);return Number.isNaN(+n)?void 0:n}case"const":case"string":default:return e}}function Zu(t){return typeof t=="function"&&!!t?.type}function ef(t){if(!t)throw new Error("schema is required");if(Zu(t))return t;try{const e=Schema.from(t);if(Zu(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 wt(t){return t?.meta??{}}function py(t){return t.length>0&&t.every(e=>e?.type==="const")}function Bn(t){if(!t)return;const e=t,n=e.meta||{};if(Object.prototype.hasOwnProperty.call(n,"default"))return n.default;const r=e.type;try{const i=t();if(i!==void 0)return i}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 i=e.list||[];return i.length?Bn(i[0]):void 0}case"const":return e.value;case"date":return;default:return}}class Nt extends HTMLElement{constructor(){super(),this._path=[],this._i18n=Xu,this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=dt,this.$root.appendChild(e)}makeFieldContainer(e,n){const r=document.createElement("div");if(r.className=`field schema-form-item schema-type-${e}`,r.setAttribute("data-path",Or(this._path)),this._label){const i=document.createElement("label");i.className="label",i.textContent=this._label,r.appendChild(i)}if(n){const i=document.createElement("div");i.className="helper",i.textContent=n,r.appendChild(i)}return r}set schema(e){this._schema=ef(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 tf extends Nt{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>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("string",e.description),r=document.createElement("input");this.$input=r,r.className="input",r.type="text",r.name=vn(this._path),r.id=rn(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(Vo("string",r.value));const i=n.querySelector("label.label");i&&(i.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}ke("schema-form-string",tf);class nf extends Nt{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>${dt}</style>`;const e=this._schema?.type??"number",n=wt(this._schema),r=this.makeFieldContainer("number",n.description),i=document.createElement("input");this.$input=i,i.className="input",i.name=vn(this._path),i.id=rn(this._path),n?.min!=null&&(i.min=String(n.min)),n?.max!=null&&(i.max=String(n.max)),n?.step!=null&&(i.step=String(n.step)),e==="percent"&&!i.step&&(i.step="0.01"),i.value=this._value??"",i.oninput=()=>this.emitChange(Vo(e,i.value));const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),n.role==="slider"?i.type="range":i.type="number",r.appendChild(i),this.$root.appendChild(r)}}ke("schema-form-number",nf);class rf extends Nt{render(){this.$root.innerHTML=`<style>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("boolean",e.description),r=document.createElement("label");r.className="checkbox";const i=document.createElement("input");i.type="checkbox",i.checked=!!this._value,i.name=vn(this._path),i.id=rn(this._path);const s=document.createElement("span");s.textContent=e.description??this._label??"",i.onchange=()=>this.emitChange(i.checked);const o=n.querySelector("label.label");o&&(o.htmlFor=i.id),r.append(i,s),n.appendChild(r),this.$root.appendChild(n)}}ke("schema-form-boolean",rf);function Ki(t){return String(t).padStart(2,"0")}function Tr(t){return`${t.getFullYear()}-${Ki(t.getMonth()+1)}-${Ki(t.getDate())}`}function Yo(t){return`${Ki(t.getHours())}:${Ki(t.getMinutes())}`}function Vi(t){return`${Tr(t)}T${Yo(t)}`}class sf extends Nt{render(){if(this.$input&&this.$root.contains(this.$input)){const o=wt(this._schema).role||"date";if(document.activeElement!==this.$input)if(this._value instanceof Date)o==="date"?this.$input.value=Tr(this._value):o==="time"?this.$input.value=Yo(this._value):o==="datetime"&&(this.$input.value=Vi(this._value));else if(typeof this._value=="string"&&o!=="time"){const a=new Date(this._value);isNaN(+a)||(o==="date"?this.$input.value=Tr(a):o==="datetime"&&(this.$input.value=Vi(a)))}else this._value||(this.$input.value="");return}this.$root.innerHTML=`<style>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("date",e.description),r=document.createElement("input");this.$input=r,r.className="input";const i=e.role||"date";if(i==="datetime"?r.type="datetime-local":i==="time"?r.type="time":r.type="date",r.name=vn(this._path),r.id=rn(this._path),this._value instanceof Date)i==="date"?r.value=Tr(this._value):i==="time"?r.value=Yo(this._value):i==="datetime"&&(r.value=Vi(this._value));else if(typeof this._value=="string"&&i!=="time"){const o=new Date(this._value);isNaN(+o)||(i==="date"?r.value=Tr(o):i==="datetime"&&(r.value=Vi(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=n.querySelector("label.label");s&&(s.htmlFor=r.id),n.appendChild(r),this.$root.appendChild(n)}}ke("schema-form-date",sf);class of extends Nt{render(){this.$root.innerHTML=`<style>${dt}</style>`;const e=wt(this._schema),n=this._schema.value;if(e.role==="raw-html"){if(n instanceof Node){this.$root.appendChild(n);return}const o=document.createElement("div");o.innerHTML=String(n),this.$root.appendChild(o);return}const r=this.makeFieldContainer("const",e.description),i=document.createElement("section");i.className="const content",i.textContent=String(n),i.id=rn(this._path);const s=r.querySelector("label.label");s&&(s.htmlFor=i.id),r.appendChild(i),this.$root.appendChild(r)}}ke("schema-form-const",of);function my(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 Un(t,e,n,r,i){const s=my(t),o=document.createElement(s);return o.schema=t,o.path=e,o.label=r,i&&(o.i18n=i),o.setValue?.(n),o}class af extends Nt{render(){this.$root.innerHTML=`<style>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("union",e.description),r=this._schema.list||[];if(py(r)){const i=document.createElement("select");i.className="input",i.name=vn(this._path),i.id=rn(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),i.appendChild(a)}),i.onchange=()=>this.emitChange(Vo("string",i.value));const s=n.querySelector("label.label");s&&(s.htmlFor=i.id),n.appendChild(i)}else{const i=document.createElement("div");i.className="toolbar";const s=document.createElement("select");s.className="input",s.name=vn(this._path)+".__type",s.id=rn(this._path)+"__type";let o=0;r.forEach((u,f)=>{const m=document.createElement("option");m.value=String(f),m.textContent=u.type,s.appendChild(m)}),s.onchange=()=>{o=Number(s.value);const u=r[o],f=Bn(u);this.emitChange(f),c()};const a=n.querySelector("label.label");a&&(a.htmlFor=s.id),i.appendChild(s),n.appendChild(i);const l=document.createElement("div");l.className="group";const c=()=>{l.innerHTML="";const u=r[o],f=Un(u,this._path,this._value,this._label);f.addEventListener("change",m=>{m.stopPropagation(),this.emitChange(m.detail.value)}),l.appendChild(f)};c(),n.appendChild(l)}this.$root.appendChild(n)}}ke("schema-form-union",af);class lf extends Nt{render(){this.$root.innerHTML=`<style>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("tuple",e.description),r=document.createElement("div");r.className="group";const i=Array.isArray(this._value)?this._value:[];(this._schema.list||[]).forEach((s,o)=>{const a=Un(s,[...this._path,o],i[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)}),n.appendChild(r),this.$root.appendChild(n)}}ke("schema-form-tuple",lf);class cf extends Nt{render(){this.$root.innerHTML=`<style>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("object",e.description),r=document.createElement("div");r.className="group";const i=this._schema.dict||{};Object.keys(i).forEach(s=>{if(i[s]?.meta?.hidden)return;const o=(this._value??{})[s],a=Un(i[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)}),n.appendChild(r),this.$root.appendChild(n)}}ke("schema-form-object",cf);const Ji=class Ji extends Nt{constructor(){super(...arguments),this._itemIds=[]}generateItemId(){try{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}return"i"+Ji._idCounter++}ensureItemIds(e){for(;this._itemIds.length<e;)this._itemIds.push(this.generateItemId());this._itemIds.length>e&&(this._itemIds.length=e)}capturePositions(e){const n={};return e.querySelectorAll(".row").forEach(r=>{const i=r.dataset.uid;i&&(n[i]=r.getBoundingClientRect())}),n}playFLIP(e,n){Array.from(e.querySelectorAll(".row")).forEach(r=>{const i=r.dataset.uid;if(!i)return;const s=n[i];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>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("array",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=()=>Array.isArray(this._value)?this._value:[];this.ensureItemIds(s().length);const o=(c,u)=>{r.innerHTML="",s().forEach((f,m)=>{const y=[...this._path,m],b=document.createElement("div");b.className="row schema-collection-row";const I=this._itemIds[m];b.dataset.uid=I,b.setAttribute("data-path",Or(y));const F=Un(i,y,f,`${this._label??""}[${m}]`);F.addEventListener("change",h=>{h.stopPropagation();const S=s().slice();S[m]=h.detail.value,this._value=S,this.emitChange(S)});const D=document.createElement("div");D.className="actions";const T=document.createElement("button");T.type="button",T.className="btn",T.textContent=this._i18n.arrayMoveUp??"↑",T.onclick=()=>{if(m<=0)return;const h=this.capturePositions(r),S=s().slice();[S[m-1],S[m]]=[S[m],S[m-1]],[this._itemIds[m-1],this._itemIds[m]]=[this._itemIds[m],this._itemIds[m-1]],this._value=S,o(h),this.emitChange(S)};const v=document.createElement("button");v.type="button",v.className="btn",v.textContent=this._i18n.arrayMoveDown??"↓",v.onclick=()=>{const h=s();if(m>=h.length-1)return;const S=this.capturePositions(r),O=h.slice();[O[m+1],O[m]]=[O[m],O[m+1]],[this._itemIds[m+1],this._itemIds[m]]=[this._itemIds[m],this._itemIds[m+1]],this._value=O,o(S),this.emitChange(O)};const p=document.createElement("button");p.type="button",p.className="btn danger",p.textContent=this._i18n.arrayRemove??"×",p.onclick=()=>{b.classList.add("leaving");const h=250;let S=!1;const O=()=>{if(S)return;S=!0,clearTimeout(N);const H=s().filter((Ce,Ne)=>Ne!==m);this._itemIds.splice(m,1);const X=this.capturePositions(r);this._value=H,o(X),this.emitChange(H)};b.addEventListener("transitionend",O,{once:!0});const N=setTimeout(O,h+80)},D.append(T,v,p),b.appendChild(F),b.appendChild(D),r.appendChild(b),u&&u===I&&(b.classList.add("enter"),requestAnimationFrame(()=>{b.classList.add("enter-active")}),requestAnimationFrame(()=>{b.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=Bn(i);u.push(f);const m=this.generateItemId();this._itemIds.push(m),this._value=u,o(c,m),this.emitChange(u)};const l=document.createElement("div");l.className="actions",l.appendChild(a),n.appendChild(r),n.appendChild(l),this.$root.appendChild(n)}};Ji._idCounter=0;let Yi=Ji;ke("schema-form-array",Yi);class uf extends Nt{render(){this.$root.innerHTML=`<style>${dt}</style>`;const e=wt(this._schema),n=this.makeFieldContainer("dict",e.description),r=document.createElement("div");r.className="group";const i=this._schema.inner,s=this._value??{},o=m=>`d_${m}`,a=()=>{const m={};return r.querySelectorAll(".kv").forEach(y=>{const b=y.dataset.uid;b&&(m[b]=y.getBoundingClientRect())}),m},l=m=>{r.querySelectorAll(".kv").forEach(y=>{const b=y.dataset.uid;if(!b)return;const I=m[b];if(!I)return;const F=y.getBoundingClientRect(),D=I.left-F.left,T=I.top-F.top;(D||T)&&(y.style.transition="none",y.style.transform=`translate(${D}px, ${T}px)`,requestAnimationFrame(()=>{y.style.transition="transform .25s ease",y.style.transform=""}))})},c=(m,y)=>{r.innerHTML="",Object.keys(s).forEach(b=>{const I=[...this._path,b],F=document.createElement("div");F.className="kv schema-collection-row",F.dataset.uid=o(b),F.setAttribute("data-path",Or(I));const D=document.createElement("input");D.className="input",D.value=b,D.name=vn(I)+".__key",D.id=rn(I)+"__key";const T=Un(i,I,s[b],`${this._label??""}[${b}]`),v=document.createElement("button");v.type="button",v.className="btn danger",v.textContent=this._i18n.dictRemove??"×",v.onclick=()=>{const p=a();delete s[b];const h={...this._value??{}};delete h[b],this._value=h,c(p),this.emitChange(h)},D.onchange=()=>{const p=D.value.trim();if(!p||p===b||s[p]!==void 0)return;const h=a();s[p]=s[b],delete s[b];const S={...this._value??{}};S[p]=S[b],delete S[b],this._value=S,c(h),this.emitChange(S)},T.addEventListener("change",p=>{p.stopPropagation();const h={...this._value??{}};h[b]=p.detail.value,this._value=h,this.emitChange(h)}),F.append(D,T,v),r.appendChild(F),y===b&&(F.classList.add("enter"),requestAnimationFrame(()=>F.classList.add("enter-active")),requestAnimationFrame(()=>F.classList.remove("enter")))}),m&&l(m)};c();const u=document.createElement("button");u.type="button",u.className="btn primary",u.textContent=this._i18n.dictAdd??"+",u.onclick=()=>{let m=Object.keys(s).length+1,y=`k${m}`;for(;s[y]!==void 0;)y=`k${++m}`;const b=a();s[y]=Bn(i);const I={...this._value??{},[y]:s[y]};this._value=I,c(b,y),this.emitChange(I)};const f=document.createElement("div");f.className="actions",f.appendChild(u),n.appendChild(r),n.appendChild(f),this.$root.appendChild(n)}}ke("schema-form-dict",uf);class ff extends HTMLElement{constructor(){super(),this._i18n={...Xu},this.$root=this.attachShadow({mode:"open"});const e=document.createElement("style");e.textContent=dt,this.$root.appendChild(e);const n=document.createElement("div");n.className="wrapper",n.innerHTML='<form class="form" part="form"></form>',this.$root.appendChild(n),this.addEventListener("change",r=>{if(!r?.detail)return;const{path:i,value:s}=r.detail;Array.isArray(i)&&i.length===0?this._state=s:dy(this._state??(this._state={}),i,s),this.dispatchEvent(new CustomEvent("form-change",{detail:{path:i,value:s,state:this._state}}))})}set schema(e){this._schema=ef(e);try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Bn(this._schema)}this.render()}get schema(){return this._schema}set schemaJSON(e){this.schema=e}get schemaJSON(){return this._schema?.toJSON?.()}setData(e,n={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const r=n.validate?this._schema(e??null,{autofix:n.autofix}):e;this._state=r,this.render()}getData(e={validate:!0,autofix:!0}){if(!this._schema)throw new Error("请先设置 schema");const n=this._state;return e.validate?this._schema(n??null,{autofix:e.autofix}):n}reset(){try{this._state=this._schema(null,{autofix:!0})}catch{this._state=Bn(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 n=Un(this._schema,[],this._state,this._i18n.rootLabel,this._i18n);e.appendChild(n)}}ke("schema-form",ff);function gy(){ke("schema-form",ff),ke("schema-form-string",tf),ke("schema-form-number",nf),ke("schema-form-boolean",rf),ke("schema-form-date",sf),ke("schema-form-const",of),ke("schema-form-union",af),ke("schema-form-tuple",lf),ke("schema-form-object",cf),ke("schema-form-array",Yi),ke("schema-form-dict",uf)}const vy=Kc({__name:"SchemasteryFormVue",props:tu({schema:{},value:{},validateOnChange:{type:Boolean,default:!1}},{schema:{required:!0},schemaModifiers:{},value:{required:!1,default:{}},valueModifiers:{}}),emits:tu(["change"],["update:schema","update:value"]),setup(t,{expose:e,emit:n}){const r=xu(t,"schema"),i=xu(t,"value"),s=n,o=Lg("elRef");let a=!1,l=!1;const c=u=>{if(l)return;const f=o.value,m=t.validateOnChange?f.getData({validate:!0}):u.detail.state;a=!0,i.value=m,Di(()=>{a=!1}),s("change",u.detail)};return Jc(()=>{gy()}),Co(()=>{const u=o.value;r.value&&(u.schema=r.value),i.value!==void 0&&u.setData(i.value,{validate:!1,autofix:!0}),u.addEventListener("form-change",c)}),Xc(()=>{o.value?.removeEventListener("form-change",c)}),Ln(()=>r,u=>{a||o.value&&u&&o.value.schema!==u.value&&(l=!0,o.value.schema=u.value,Di(()=>{l=!1}))},{deep:!0,immediate:!0}),Ln(()=>i,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}),Di(()=>{l=!1}))},{deep:!0,immediate:!0}),e({setData(u,f){const m=o.value;m.setData(u,{validate:!!f?.validate}),f?.emit&&(i.value=m.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)=>(jn(),Er("schema-form",Au({ref_key:"elRef",ref:o},u.$attrs),null,16))}});function yn(t,e=new WeakMap){if(De(t))return yn(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 i=new Map;return e.set(t,i),Array.from(t.entries()).forEach(([s,o])=>{i.set(s,yn(o,e))}),i}if(t instanceof Set){const i=new Set;return e.set(t,i),Array.from(t).forEach(s=>{i.add(yn(s,e))}),i}if(Array.isArray(t)){const i=[];e.set(t,i);for(const s of t)i.push(yn(s,e));return i}const n=de(t),r={};e.set(t,r);for(const i of Object.keys(n))r[i]=yn(n[i],e);for(const i of Object.getOwnPropertySymbols(n))r[i]=yn(n[i],e);return r}const yy={class:"preferences-ui-app"},by={class:"tabs"},wy=["onClick","data-value"],_y={style:{"max-height":"20em",overflow:"auto"}},xy=((t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n})(Kc({__name:"PreferencesForm",setup(t,{expose:e}){const n=fy(),r=Dc([]),i=Dc(""),s=Ti([]),o=ju(()=>s.value.map(c=>c.schema)),a=Ti({}),l=Ti({});return e({getValue(){return yn(l)}}),Ln(i,c=>{c&&(a.value=l.value,s.value=n.preferences.getConfigRegistries(c))},{immediate:!0}),Co(async()=>{n.inject(["preferences"],async c=>{const u=await c.preferences.getAll();a.value=l.value=u,r.value=c.preferences.getConfigCategories(),i.value=r.value[0].name})}),(c,u)=>(jn(),Er("div",yy,[Pr("div",by,[(jn(!0),Er(bt,null,eu(r.value,f=>(jn(),Er("a",{class:xi(["tab",{active:i.value===f.name}]),key:f.name,onClick:m=>i.value=f.name,"data-value":f.name},co(f.label),11,wy))),128))]),(jn(!0),Er(bt,null,eu(o.value,(f,m)=>(jn(),Sv(Mc(vy),{key:`${i.value}-${m}`,schema:f,value:a.value,"onUpdate:value":u[0]||(u[0]=y=>l.value=y),"validate-on-change":!1,i18n:{rootLabel:""}},null,8,["schema","value"]))),128)),Pr("details",null,[Pr("pre",_y,co(l.value),1)])]))}}),[["__scopeId","data-v-571b939a"]]);var Sy=Object.create,Go=Object.defineProperty,Ey=Object.getOwnPropertyDescriptor,df=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),hf=t=>{throw TypeError(t)},ky=(t,e,n)=>e in t?Go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Py=(t,e)=>Go(t,"name",{value:e,configurable:!0}),$y=t=>[,,,Sy(t?.[df("metadata")]??null)],Cy=["class","method","getter","setter","accessor","field","value","get","set"],pf=t=>t!==void 0&&typeof t!="function"?hf("Function expected"):t,Oy=(t,e,n,r,i)=>({kind:Cy[t],name:e,metadata:r,addInitializer:s=>n._?hf("Already initialized"):i.push(pf(s||null))}),Ty=(t,e)=>ky(e,df("metadata"),t[3]),Iy=(t,e,n,r)=>{for(var i=0,s=t[e>>1],o=s&&s.length;i<o;i++)s[i].call(n);return r},Ay=(t,e,n,r,i,s)=>{var o,a,l,c=e&7,u=!1,f=0,m=t[f]||(t[f]=[]),y=c&&(i=i.prototype,c<5&&(c>3||!u)&&Ey(i,n));Py(i,n);for(var b=r.length-1;b>=0;b--)l=Oy(c,n,a={},t[3],m),o=(0,r[b])(i,l),a._=1,pf(o)&&(i=o);return Ty(t,i),y&&Go(i,n,y),u?c^4?s:y:i},mf,Qo,gf;mf=[We(["preferences","modal"])];class Gi extends(gf=it){constructor(e){super(e,{},"preferences-ui"),this.ctx=e,e.set("preferencesUI",this),e.inject(["toolbox"],n=>{n.toolbox.addButton({id:"preferences",icon:w("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:[w("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),w("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:"Open preferences",group:"group2",index:1/0,onClick:()=>this.showModal()}),this.addDisposeHandler(()=>{n.toolbox.removeButton("preferences")})})}showModal(){const e=this.ctx.modal.show({className:"ipe-preference compact-buttons",sizeClass:"small",outSideClose:!1,center:!0,title:"InPageEdit Preferences",content:w(Lt,{children:w(Yt,{})})});e.get$window().classList.add("dialog");const n=w("div",{id:"ipe-preferences-app",style:{minHeight:"65vh"}});e.setContent(n);const r=this.createFormApp(),i=r.mount(n);e.setButtons([{label:"Cancel",className:"is-danger is-ghost",method:()=>{e.close()}},{label:"Save",className:"is-primary is-ghost",method:()=>{const s=i.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:w("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()})}createFormApp(){const e=ay(xy);return uy(this.ctx,e),e}}Qo=$y(gf),Gi=Ay(Qo,0,"PluginPreferencesUI",mf,Gi),Iy(Qo,1,Gi);const Ny=Object.freeze(Object.defineProperty({__proto__:null,get PluginPreferencesUI(){return Gi}},Symbol.toStringTag,{value:"Module"}));le.BasePlugin=it,le.InPageEdit=dn,le.Inject=We,le.Logger=ba,le.LoggerLevel=fs,le.Schema=fe,le.Service=cn,le.createLogger=xa,Object.defineProperty(le,Symbol.toStringTag,{value:"Module"})});
|
|
125
125
|
//# sourceMappingURL=index.umd.js.map
|