create-caspian-app 0.5.0-rc.2 → 0.5.0-rc.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=class{static states=new Map;static scopes=new Map;static instances=new Map;static parents=new Map;static templates=new Map;static ownedTemplateData=new Map;static contextValues=new Map;static consumerContexts=new Map;static contextConsumers=new Map;static saveState(e,t){e&&this.states.set(e,t)}static getState(e){return this.states.get(e)}static removeState(e){this.states.delete(e)}static saveScope(e,t){this.scopes.set(e,t)}static getScope(e){return this.scopes.get(e)}static getRootAncestor(e){let t=e,r=new Set;for(;t&&!r.has(t);){r.add(t);let e=this.parents.get(t);if(!e)return t;t=e}return null}static resolveComponentId(e,t=null){if(!e)return null;if("app"!==e){if(t){let r=new Set,i=t;for(;i&&!r.has(i);){r.add(i);let t=this.instances.get(i);if((t?.el?.__ppBaseComponentId??t?.el?.getAttribute?.("pp-component")??null)===e)return i;i=this.parents.get(i)??null}}return e}let r=new Set,i=t,n=null;for(;i&&!r.has(i);){if(r.add(i),i.startsWith("page_"))return i;let e=this.parents.get(i)??null;if(!e){n=i;break}i=e}if(n)return n;for(let[e,t]of this.parents.entries())if(null===t&&this.scopes.has(e))return e;let s=this.scopes.keys().next().value;return"string"==typeof s?s:null}static getResolvedScope(e,t=null){let r=this.resolveComponentId(e,t);return r?this.scopes.get(r):void 0}static getResolvedScopeWithAncestors(e,t=null){let r=this.resolveComponentId(e,t);if(!r)return;let i=new Set,n=[],s=r;for(;s&&!i.has(s);){i.add(s);let e=this.scopes.get(s);e&&n.push(e),s=this.parents.get(s)??null}return 0!==n.length?Object.assign({},...n.reverse()):void 0}static removeScope(e){this.scopes.delete(e)}static registerInstance(e,t){let r=this.instances.get(e);r&&r!==t&&r.destroy?.(),this.instances.set(e,t)}static getInstance(e){return this.instances.get(e)}static removeInstance(e){this.instances.delete(e)}static saveParent(e,t){e&&this.parents.set(e,t)}static getParent(e){return this.parents.get(e)}static removeParent(e){if(!this.parents.has(e))return;let t=this.parents.get(e)??null;this.parents.forEach((r,i)=>{r===e&&this.parents.set(i,t)}),this.parents.delete(e)}static getDescendantIds(e){let t=[];return this.parents.forEach((r,i)=>{i!==e&&this.isAncestor(e,i)&&t.push(i)}),t.sort((e,t)=>this.getAncestorDepth(t)-this.getAncestorDepth(e))}static saveContextValues(e,t){let r=this.contextValues.get(e)??new Map,i=new Set;return r.forEach((e,r)=>{t.has(r)||i.add(r)}),t.forEach((e,t)=>{r.has(t)&&Object.is(r.get(t),e)||i.add(t)}),t.size>0?this.contextValues.set(e,new Map(t)):this.contextValues.delete(e),Array.from(i)}static resolveContext(e,t){let r=e;for(;r;){let e=this.contextValues.get(r);if(e?.has(t))return{providerId:r,value:e.get(t)};r=this.parents.get(r)??null}return{providerId:null,value:t.defaultValue}}static updateContextDependencies(e,t){let r=new Set(t),i=this.consumerContexts.get(e)??new Set;i.forEach(t=>{r.has(t)||this.removeContextConsumer(t,e)}),r.forEach(t=>{i.has(t)||this.addContextConsumer(t,e)}),r.size>0?this.consumerContexts.set(e,r):this.consumerContexts.delete(e)}static getConsumersForContextsInSubtree(e,t){let r=new Set;for(let i of t){let t=this.contextConsumers.get(i);t&&t.forEach(t=>{t!==e&&this.isAncestor(e,t)&&r.add(t)})}return r}static removeContextTracking(e){let t=this.contextValues.get(e),r=t?this.getConsumersForContextsInSubtree(e,t.keys()):new Set;this.contextValues.delete(e);let i=this.consumerContexts.get(e);return i&&(i.forEach(t=>{this.removeContextConsumer(t,e)}),this.consumerContexts.delete(e)),this.removeParent(e),r}static saveTemplate(e,t){this.templates.has(e)||this.templates.set(e,t)}static getTemplate(e){return this.templates.get(e)}static removeTemplate(e){this.templates.delete(e)}static saveOwnedTemplates(e,t){this.ownedTemplateData.has(e)||this.ownedTemplateData.set(e,t)}static getOwnedTemplates(e){return this.ownedTemplateData.get(e)}static removeOwnedTemplates(e){this.ownedTemplateData.delete(e)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.parents.clear(),this.templates.clear(),this.ownedTemplateData.clear(),this.contextValues.clear(),this.consumerContexts.clear(),this.contextConsumers.clear()}static destroyAll(){let e=Array.from(this.instances.values()),t=new Set;for(let r of e)if(r&&!t.has(r)){t.add(r);try{r.destroy?.()}catch(e){console.warn("[PP-WARN] Failed to destroy component instance",e)}}}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,parents:this.parents.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size,contextValues:this.contextValues.size,contextConsumers:this.contextConsumers.size}}static addContextConsumer(e,t){let r=this.contextConsumers.get(e)??new Set;r.add(t),this.contextConsumers.set(e,r)}static removeContextConsumer(e,t){let r=this.contextConsumers.get(e);r&&(r.delete(t),0===r.size&&this.contextConsumers.delete(e))}static isAncestor(e,t){let r=this.parents.get(t)??null;for(;r;){if(r===e)return!0;r=this.parents.get(r)??null}return!1}static getAncestorDepth(e){let t=0,r=this.parents.get(e)??null,i=new Set;for(;r&&!i.has(r);)i.add(r),t+=1,r=this.parents.get(r)??null;return t}},t=new Set("class.for.while.if.else.return.function.var.let.const.import.export.this.debugger.delete.typeof.void.new.in.instanceof.do.try.catch.finally.switch.case.default.break.continue.yield.await.with.super.enum.extends.implements.interface.package.private.protected.public.static".split(".")),n=new Set("Array.Object.String.Number.Boolean.Math.JSON.Date.RegExp.Error.Map.Set.WeakMap.WeakSet.Promise.Symbol.BigInt.parseInt.parseFloat.isNaN.isFinite.encodeURI.decodeURI.encodeURIComponent.decodeURIComponent.console.window.document.undefined.null.NaN.Infinity.pp.true.false.setTimeout.setInterval.clearTimeout.clearInterval.requestAnimationFrame.cancelAnimationFrame.fetch.alert.confirm.prompt".split(".")),r=new Set("hidden.disabled.checked.selected.readonly.required.open.autofocus.multiple.ismap.noValidate.defer.async.autoplay.controls.loop.muted.default.reversed.scoped.seamless.sortable.translate.draggable.contenteditable.spellcheck".split("."));function i(e){return e.includes("-")?e.replace(/-([a-z])/g,e=>e[1].toUpperCase()):e}var a=new WeakMap,o=/^[A-Za-z_$][\w$]*$/;function s(e){return o.test(e)&&!t.has(e)}function c(e){let t=a.get(e);if(t)return t;let r=Object.keys(e).filter(s),i={keys:r,keySig:r.join("\0")};return a.set(e,i),i}function l(e,t){let r=Array(t.length);for(let i=0;i<t.length;i++)r[i]=e[t[i]];return r}var u=new Map,d=500,f=null,p=null;function m(e){p||=document.createElement("template"),p.innerHTML=e;let t=Array.from(p.content.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE?(e.textContent??"").trim().length>0:e.nodeType===Node.ELEMENT_NODE);if(1!==t.length)return null;let r=t[0];return r instanceof HTMLTemplateElement&&r.hasAttribute("pp-owner")?r.innerHTML:null}function h(e){let t=_(e),r=!1;for(;;){let e=m(t);if(null===e)break;t=e,r=!0}return r?t:null}function g(e){if(!e.includes("<textarea"))return e;let t=e.includes("pp-owner"),r=document.createElement("template");r.innerHTML=e;let i=!1;return r.content.querySelectorAll("textarea").forEach(e=>{let r=e;if(t){let e=h(r.value);if(null!==e)return r.textContent=e,void(i=!0)}r.value.length>0&&0===r.value.trim().length&&(r.textContent="",i=!0)}),i?r.innerHTML:e}function _(e){if(!e.includes("&"))return e;if(u.has(e))return u.get(e);f||=document.createElement("textarea");let t=f;t.innerHTML=e;let r=t.value,i=0;for(;r.includes("&")&&i++<10;){t.innerHTML=r;let e=t.value;if(e===r)break;r=e}if(u.size>=d){let e=u.keys().next().value;void 0!==e&&u.delete(e)}return u.set(e,r),r}var v="data-pp-fragment-root";function ee(e,t){let r=0,i=t-1;for(;i>=0&&"\\"===e[i];)r++,i--;return r%2!=0}function y(e,t){if("{"!==e[t])return-1;let r=0,i=null;for(let n=t;n<e.length;n++){let t=e[n],s=ee(e,n);if(i)t===i&&!s&&(i=null);else if(s||'"'!==t&&"'"!==t&&"`"!==t)if("{"!==t||s){if("}"===t&&!s&&(r--,0===r))return n}else r++;else i=t}return-1}function te(e,t){return e.startsWith("{{",t)||e.startsWith("{%",t)||e.startsWith("{#",t)}function ne(e,t){let r=e.startsWith("{{",t)?"}}":e.startsWith("{%",t)?"%}":e.startsWith("{#",t)?"#}":"";if(!r)return-1;let i=e.indexOf(r,t+2);return-1===i?-1:i+r.length}function b(e){let t=0;for(;t<e.length&&/\s/.test(e[t]);)t++;if("{"!==e[t]||te(e,t))return null;let r=y(e,t);if(-1===r)return null;let i=r+1;for(;i<e.length&&/\s/.test(e[i]);)i++;return i===e.length?{expression:e.slice(t+1,r).trim(),start:t,end:r}:null}function re(e,t){let r="",i=0;for(;i<e.length;){if("{"!==e[i]){r+=e[i],i++;continue}if(te(e,i)){let t=ne(e,i);if(-1===t){r+=e.slice(i);break}r+=e.slice(i,t),i=t;continue}let n=y(e,i);if(-1===n){r+=e.slice(i);break}let s=e.slice(i+1,n);r+=t(s.trim(),s),i=n+1}return r}function ie(e){let t=String(e??"").trim().toLowerCase();switch(t){case"table":return{prefix:`<table ${v}="">`,suffix:"</table>",rootSelector:`table[${v}]`};case"caption":return{prefix:`<table><caption ${v}="">`,suffix:"</caption></table>",rootSelector:`caption[${v}]`};case"thead":case"tbody":case"tfoot":return{prefix:`<table><${t} ${v}="">`,suffix:`</${t}></table>`,rootSelector:`${t}[${v}]`};case"tr":return{prefix:`<table><tbody><tr ${v}="">`,suffix:"</tr></tbody></table>",rootSelector:`tr[${v}]`};case"td":case"th":return{prefix:`<table><tbody><tr><${t} ${v}="">`,suffix:`</${t}></tr></tbody></table>`,rootSelector:`${t}[${v}]`};case"colgroup":return{prefix:`<table><colgroup ${v}="">`,suffix:"</colgroup></table>",rootSelector:`colgroup[${v}]`};case"select":return{prefix:`<select ${v}="">`,suffix:"</select>",rootSelector:`select[${v}]`};case"optgroup":return{prefix:`<select><optgroup ${v}="">`,suffix:"</optgroup></select>",rootSelector:`optgroup[${v}]`};case"option":return{prefix:`<select><option ${v}="">`,suffix:"</option></select>",rootSelector:`option[${v}]`};default:return{prefix:"",suffix:"",rootSelector:null}}}function ae(e){let t=ie(e);return{wrap:e=>`${t.prefix}${e}${t.suffix}`,unwrap:e=>{if(!t.prefix&&!t.suffix)return e;let r=document.createElement("template");if(r.innerHTML=e,t.rootSelector){let e=r.content.querySelector(t.rootSelector);if(e)return e.innerHTML}return e}}}function oe(e,t){let r=ie(t),i=document.createElement("template");if(i.innerHTML=g(`${r.prefix}${e}${r.suffix}`),!r.rootSelector)return{root:i.content,toHtml:()=>i.innerHTML};let n=i.content.querySelector(r.rootSelector);return n?(n.removeAttribute(v),{root:n,toHtml:()=>n.innerHTML}):{root:i.content,toHtml:()=>i.innerHTML}}function se(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;let r=Object.keys(e),i=r.length,n=0;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(n++,n>i))return!1;if(n!==i)return!1;for(let n=0;n<i;n++){let i=r[n];if(e[i]!==t[i])return!1}return!0}var ce=class t{static DATE_LIKE_INPUT_TYPES=new Set(["date","datetime-local","month","time","week"]);root;getScope;canBindElement;handlerCache=new Map;cachedRootElementCount=null;static VALUE_EDIT_INPUT_TYPES=new Set(["email","number","password","search","tel","text","url"]);static LARGE_INPUT_RENDER_DEFER_THRESHOLD=100;static deferredNativeInputEventDepth=0;static deferredNativeInputCallbacks=new Set;static deferredNativeInputFrameHandle=null;static deferredNativeInputTimerHandle=null;constructor(e,t,r){this.root=e,this.getScope=t,this.canBindElement=r??(e=>this.isRootOwnedElement(e))}clearCache(){this.handlerCache.clear()}invalidateElementCountCache(){this.cachedRootElementCount=null}resolveEventOwnerScope(t){let r=this.root.getAttribute("pp-component");return e.getResolvedScopeWithAncestors(t,r)}bindEvents(e){(e||this.fallbackCollectEventElements()).forEach(e=>{this.canBindElement(e)&&this.bindElementEvents(e)})}isRootOwnedElement(e){if(e===this.root)return!0;let t=e.closest("[pp-component]");return e===t&&(t=e.parentElement?.closest("[pp-component]")??null),t===this.root}bindElementEvents(e){let r=e.getAttribute("pp-event-owner");r&&e.removeAttribute("pp-event-owner");let i=[];Array.from(e.attributes).forEach(n=>{if(n.name.startsWith("on")&&!n.name.includes("-")){let s=n.name.slice(2).toLowerCase(),a=n.value.trim(),o=a.match(/^\{([\s\S]*)\}$/);o&&(a=o[1].trim()),i.push(n.name),this.getNativeEventNames(e,s).forEach(i=>{let s=`__pp_bound_${i}`;if((e.__ppBoundEventBindings??=new Map).set(i,n.name),e[s]===a)return;e[s]=a;let o=e[`__pp_handler_${i}`];o&&e.removeEventListener(i,o);let l=n=>{let s=this.shouldPreserveNativeEdit(e,i),o=s&&this.shouldDeferNativeInputRender(),l=e;if(s&&(l.__ppPreserveNativeSelectionOnNextRender=!0),this.runWithNativeInputRenderPolicy(o,()=>{if(r){let t=this.resolveEventOwnerScope(r);if(t)return void this.executeHandlerWithScope(a,n,t,e)}let t=e.closest("[pp-component]");t===e&&(t=e.parentElement?.closest("[pp-component]")??null);let i=t?.getAttribute("pp-component")||null;if(i){let t=this.resolveEventOwnerScope(i);if(t)return void this.executeHandlerWithScope(a,n,t,e)}this.executeHandler(a,n,e)}),s){let r=()=>{l.__ppPreserveNativeSelectionOnNextRender&&delete l.__ppPreserveNativeSelectionOnNextRender};o?(t.enqueueDeferredNativeInputUpdate(r),this.ensureDeferredNativeInputBlurFlush(e)):queueMicrotask(r)}};e[`__pp_handler_${i}`]=l,e.addEventListener(i,l)})}}),i.forEach(t=>{e.removeAttribute(t)})}static unbindRemovedEventHandlers(e,t){let r=e.__ppBoundEventBindings;if(r&&0!==r.size){for(let[i,n]of Array.from(r)){if(t.hasAttribute(n))continue;let s=`__pp_handler_${i}`,a=e[s];a&&(e.removeEventListener(i,a),delete e[s]),delete e[`__pp_bound_${i}`],r.delete(i)}0===r.size&&delete e.__ppBoundEventBindings}}getNativeEventNames(e,t){return"input"===t&&e instanceof HTMLInputElement&&this.isDateLikeInput(e)?["change","blur"]:[t]}isDateLikeInput(e){return t.DATE_LIKE_INPUT_TYPES.has(e.type)}static shouldDeferStateUpdatesForNativeInput(){return t.deferredNativeInputEventDepth>0}static enqueueDeferredNativeInputUpdate(e){t.deferredNativeInputCallbacks.add(e),t.scheduleDeferredNativeInputFlushOnNextFrame()}static flushDeferredNativeInputUpdates(){t.cancelScheduledDeferredNativeInputFlush();let e=Array.from(t.deferredNativeInputCallbacks);t.deferredNativeInputCallbacks.clear(),e.forEach(e=>e())}static scheduleDeferredNativeInputFlushOnNextFrame(){if(null!==t.deferredNativeInputFrameHandle||null!==t.deferredNativeInputTimerHandle)return;let e=()=>{t.deferredNativeInputFrameHandle=null,t.deferredNativeInputTimerHandle=null,t.flushDeferredNativeInputUpdates()};"function"!=typeof requestAnimationFrame?t.deferredNativeInputTimerHandle=setTimeout(e,0):t.deferredNativeInputFrameHandle=requestAnimationFrame(e)}static cancelScheduledDeferredNativeInputFlush(){null!==t.deferredNativeInputFrameHandle&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(t.deferredNativeInputFrameHandle),t.deferredNativeInputFrameHandle=null,null!==t.deferredNativeInputTimerHandle&&(clearTimeout(t.deferredNativeInputTimerHandle),t.deferredNativeInputTimerHandle=null)}runWithNativeInputRenderPolicy(e,r){e&&t.deferredNativeInputEventDepth++;try{r()}finally{e&&t.deferredNativeInputEventDepth--}}shouldDeferNativeInputRender(){return null===this.cachedRootElementCount&&(this.cachedRootElementCount=this.root.getElementsByTagName("*").length+1),this.cachedRootElementCount>=t.LARGE_INPUT_RENDER_DEFER_THRESHOLD}ensureDeferredNativeInputBlurFlush(e){let r=e;if(r.__ppDeferredNativeInputBlurFlush)return;let i=()=>{delete r.__ppDeferredNativeInputBlurFlush,t.flushDeferredNativeInputUpdates()};r.__ppDeferredNativeInputBlurFlush=i,e.addEventListener("blur",i,{once:!0})}shouldPreserveNativeEdit(e,r){return"input"===r&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&t.VALUE_EDIT_INPUT_TYPES.has(e.type))}fallbackCollectEventElements(){let e=new Set,t=this.root.attributes;for(let r=0;r<t.length;r++)if(t[r].name.startsWith("on")&&!t[r].name.includes("-")){e.add(this.root);break}let r=this.root.querySelectorAll("*");for(let t=0;t<r.length;t++){let i=r[t],n=i.attributes;for(let t=0;t<n.length;t++)if(n[t].name.startsWith("on")&&!n[t].name.includes("-")){e.add(i);break}}return e}executeHandler(e,t,r){let i=this.root.getAttribute("pp-component"),n=this.resolveEventOwnerScope(i)||this.getScope();this.executeHandlerWithScope(e,t,n,r)}executeHandlerWithScope(e,t,r,i){let n=c(r),s=n.keys,a=l(r,s);try{let r=this.getCompiledHandler(e,s,n.keySig).call(i??t.currentTarget??null,...a,t);"function"==typeof r&&r(t)}catch(t){console.error("[PP-ERROR] Handler failed:",t),console.error("Code:",e)}}getCompiledHandler(e,t,r){let i=e+"|"+r,n=this.handlerCache.get(i);if(!n){if(this.handlerCache.size>=500){let e=this.handlerCache.keys().next().value;e&&this.handlerCache.delete(e)}let r,n="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";try{r=Function(...t,"event",`"use strict";${n} return (${e})`)}catch{r=Function(...t,"event",`"use strict";${n} ${e}`)}return this.handlerCache.set(i,r),r}return n}},le=class e{static strictDiagnostics=!1;hooks=[];currentIndex=0;onStateChange;componentLabel;pendingLayoutEffects=[];pendingEffects=[];currentEffectPhase=null;pendingSynchronousRenderUpdate=!1;pendingSynchronousLayoutUpdate=!1;pendingUpdate=!1;hasScheduledRender=!1;batchedUpdates=new Set;portalRegistrations=[];isRenderWindowOpen=!1;warnedHookOutsideRender=!1;warnedHookAfterDispose=!1;currentHookTypes=[];committedHookTypes=null;disposed=!1;constructor(e,t="unknown"){this.onStateChange=e,this.componentLabel=t}static setStrictDiagnostics(e){this.strictDiagnostics=e}static getStrictDiagnostics(){return this.strictDiagnostics}loadState(e){this.hooks=[...e]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.isRenderWindowOpen=!0,this.warnedHookOutsideRender=!1,this.currentHookTypes=[],this.pendingLayoutEffects=[],this.pendingEffects=[],this.currentEffectPhase=null,this.portalRegistrations=[])}startRenderPhase(){this.disposed||(this.currentEffectPhase="render")}finishRenderPhase(){"render"===this.currentEffectPhase&&(this.currentEffectPhase=null),this.isRenderWindowOpen=!1;let e=this.pendingSynchronousRenderUpdate;return this.pendingSynchronousRenderUpdate=!1,e?(this.batchedUpdates.clear(),!0):(this.validateHookSignature(),!1)}recordHook(e){if(this.disposed)return this.warnedHookAfterDispose||(this.warnedHookAfterDispose=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called after the component was disposed. Hooks cannot be used after destroy.`)),this.currentIndex++;!this.isRenderWindowOpen&&!this.warnedHookOutsideRender&&(this.warnedHookOutsideRender=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called outside an active render. Hooks must be called while the component script is rendering.`));let t=this.currentIndex++;return this.currentHookTypes[t]=e,t}validateHookSignature(){if(null===this.committedHookTypes)return void(this.committedHookTypes=this.currentHookTypes.slice());let e=this.committedHookTypes,t=this.currentHookTypes;e.length===t.length&&e.every((e,r)=>e===t[r])||this.emitDiagnostic(`[PP-WARN] Hook order changed for component "${this.componentLabel}". Previous: [${e.join(", ")}]. Current: [${t.join(", ")}]. Hooks must be called in the same order on every render.`)}runLayoutEffects(){if(this.disposed)return this.pendingLayoutEffects=[],!1;let e=this.pendingLayoutEffects;this.pendingLayoutEffects=[],this.currentEffectPhase="layout";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"layout cleanup")}),e.forEach(e=>{let t=this.runEffectCallback(e.callback,"layout effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"layout"}})}finally{this.currentEffectPhase=null}let t=this.pendingSynchronousLayoutUpdate;return this.pendingSynchronousLayoutUpdate=!1,t&&this.batchedUpdates.clear(),t}runEffects(){if(this.disposed)return void(this.pendingEffects=[]);let e=this.pendingEffects;this.pendingEffects=[],this.currentEffectPhase="effect";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"effect cleanup")}),e.forEach(e=>{let t=this.runEffectCallback(e.callback,"effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"effect"}})}finally{this.currentEffectPhase=null}}runEffectCleanup(e,t){if(e)try{e()}catch(e){console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}runEffectCallback(e,t){try{return e()}catch(e){return void console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}dispose(){if(this.disposed)return;this.disposed=!0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[];let e=e=>{let t=e.cleanup;if("function"==typeof t)try{t()}finally{e.cleanup=void 0}};this.hooks.forEach(t=>{!t||"object"!=typeof t||"layout"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||"effect"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||t.effectType||e(t)}),this.hooks=[],this.currentIndex=0}usePortal(e,t){let r=this.recordHook("portal");void 0===this.hooks[r]&&(this.hooks[r]={sourceParent:null});let i=this.hooks[r];return this.portalRegistrations.push({ref:e,target:t??null,info:i}),i}getPortalRegistrations(){return this.portalRegistrations}useState(e){let t=this.recordHook("state");void 0===this.hooks[t]&&(this.hooks[t]={__state:this.resolveInitialState(e),__setter:this.createStateSetter(t)});let r=this.hooks[t];("object"!=typeof r||!r||!("__state"in r))&&(this.hooks[t]={__state:r,__setter:this.createStateSetter(t)});let i=this.hooks[t];return[i.__state,i.__setter]}resolveInitialState(e){return"function"==typeof e?e():e}createStateSetter(e){return t=>{let r=this.hooks[e];if(this.disposed||void 0===r)return;let i="function"==typeof t?t(r.__state):t;Object.is(r.__state,i)||(r.__state=i,this.batchedUpdates.add(e),this.scheduleUpdate())}}scheduleUpdate(){if(!this.disposed){if("render"===this.currentEffectPhase)return void(this.pendingSynchronousRenderUpdate=!0);if("layout"===this.currentEffectPhase)return void(this.pendingSynchronousLayoutUpdate=!0);this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,(ce.shouldDeferStateUpdatesForNativeInput()?ce.enqueueDeferredNativeInputUpdate:queueMicrotask)(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())}))}}useRef(e=null){let t=this.recordHook("ref");return void 0===this.hooks[t]&&(this.hooks[t]={current:e}),this.hooks[t]}useMemo(e,t){let r=this.recordHook("memo"),i=this.hooks[r],n=this.normalizeDeps("memo",t);if(!i||!n||!i.deps||this.areDepsDifferent(i.deps,n)){let t=e();return this.hooks[r]={value:t,deps:n},t}return i.value}useCallback(e,t){let r=this.recordHook("callback"),i=this.hooks[r],n=this.normalizeDeps("callback",t);return i&&n&&i.deps&&!this.areDepsDifferent(i.deps,n)?i.callback:(this.hooks[r]={callback:e,deps:n},e)}useReducer(e,t,r){let i=this.recordHook("reducer");if(void 0===this.hooks[i]){let n={state:r?r(t):t,reducer:e,dispatch:null};n.dispatch=e=>{if(this.disposed)return;let t=n.reducer(n.state,e);Object.is(n.state,t)||(n.state=t,this.scheduleUpdate())},this.hooks[i]=n}let n=this.hooks[i];return n.reducer=e,[n.state,n.dispatch]}useEffect(e,t){let r=this.recordHook("effect"),i=this.hooks[r],n=this.normalizeDeps("effect",t);(!i||!n||!i.deps||this.areDepsDifferent(i.deps,n))&&this.pendingEffects.push({hookIndex:r,deps:n,callback:e,previousCleanup:"function"==typeof i?.cleanup?i.cleanup:void 0})}useLayoutEffect(e,t){let r=this.recordHook("layoutEffect"),i=this.hooks[r],n=this.normalizeDeps("layoutEffect",t);(!i||!n||!i.deps||this.areDepsDifferent(i.deps,n))&&this.pendingLayoutEffects.push({hookIndex:r,deps:n,callback:e,previousCleanup:"function"==typeof i?.cleanup?i.cleanup:void 0})}normalizeDeps(e,t){if(void 0!==t){if(Array.isArray(t))return t;this.emitDiagnostic(`[PP-WARN] ${e} dependencies for component "${this.componentLabel}" must be an array or omitted. Received ${this.describeDeps(t)}.`)}}describeDeps(e){return null===e?"null":"object"==typeof e?e.constructor?.name??"object":typeof e}emitDiagnostic(t){if(e.strictDiagnostics)throw Error(t);console.warn(t)}areDepsDifferent(e,t){return e.length!==t.length||t.some((t,r)=>!Object.is(t,e[r]))}},ue=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],de=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],fe="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",pe="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",me={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},he="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",ge={5:he,"5module":he+" export import",6:he+" const class extends export import super"},x=/^in(stanceof)?$/,_e=RegExp("["+pe+"]"),S=RegExp("["+pe+fe+"]");function C(e,t){for(var r=65536,i=0;i<t.length;i+=2){if((r+=t[i])>e)return!1;if((r+=t[i+1])>=e)return!0}return!1}function w(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&_e.test(String.fromCharCode(e)):!1!==t&&C(e,de)))}function T(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&S.test(String.fromCharCode(e)):!1!==t&&(C(e,de)||C(e,ue)))))}var E=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function D(e,t){return new E(e,{beforeExpr:!0,binop:t})}var O={beforeExpr:!0},k={startsExpr:!0},ve={};function A(e,t){return void 0===t&&(t={}),t.keyword=e,ve[e]=new E(e,t)}var j={num:new E("num",k),regexp:new E("regexp",k),string:new E("string",k),name:new E("name",k),privateId:new E("privateId",k),eof:new E("eof"),bracketL:new E("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new E("]"),braceL:new E("{",{beforeExpr:!0,startsExpr:!0}),braceR:new E("}"),parenL:new E("(",{beforeExpr:!0,startsExpr:!0}),parenR:new E(")"),comma:new E(",",O),semi:new E(";",O),colon:new E(":",O),dot:new E("."),question:new E("?",O),questionDot:new E("?."),arrow:new E("=>",O),template:new E("template"),invalidTemplate:new E("invalidTemplate"),ellipsis:new E("...",O),backQuote:new E("`",k),dollarBraceL:new E("${",{beforeExpr:!0,startsExpr:!0}),eq:new E("=",{beforeExpr:!0,isAssign:!0}),assign:new E("_=",{beforeExpr:!0,isAssign:!0}),incDec:new E("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new E("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:D("||",1),logicalAND:D("&&",2),bitwiseOR:D("|",3),bitwiseXOR:D("^",4),bitwiseAND:D("&",5),equality:D("==/!=/===/!==",6),relational:D("</>/<=/>=",7),bitShift:D("<</>>/>>>",8),plusMin:new E("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:D("%",10),star:D("*",10),slash:D("/",10),starstar:new E("**",{beforeExpr:!0}),coalesce:D("??",1),_break:A("break"),_case:A("case",O),_catch:A("catch"),_continue:A("continue"),_debugger:A("debugger"),_default:A("default",O),_do:A("do",{isLoop:!0,beforeExpr:!0}),_else:A("else",O),_finally:A("finally"),_for:A("for",{isLoop:!0}),_function:A("function",k),_if:A("if"),_return:A("return",O),_switch:A("switch"),_throw:A("throw",O),_try:A("try"),_var:A("var"),_const:A("const"),_while:A("while",{isLoop:!0}),_with:A("with"),_new:A("new",{beforeExpr:!0,startsExpr:!0}),_this:A("this",k),_super:A("super",k),_class:A("class",k),_extends:A("extends",O),_export:A("export"),_import:A("import",k),_null:A("null",k),_true:A("true",k),_false:A("false",k),_in:A("in",{beforeExpr:!0,binop:7}),_instanceof:A("instanceof",{beforeExpr:!0,binop:7}),_typeof:A("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:A("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:A("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},M=/\r\n?|\n|\u2028|\u2029/,ye=new RegExp(M.source,"g");function be(e){return 10===e||13===e||8232===e||8233===e}function xe(e,t,r){void 0===r&&(r=e.length);for(var i=t;i<r;i++){var n=e.charCodeAt(i);if(be(n))return i<r-1&&13===n&&10===e.charCodeAt(i+1)?i+2:i+1}return-1}var Se=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,N=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,Ce=Object.prototype,we=Ce.hasOwnProperty,Te=Ce.toString,Ee=Object.hasOwn||function(e,t){return we.call(e,t)},De=Array.isArray||function(e){return"[object Array]"===Te.call(e)},Oe=Object.create(null);function P(e){return Oe[e]||(Oe[e]=RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function F(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var ke=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,Ae=function(e,t){this.line=e,this.column=t};Ae.prototype.offset=function(e){return new Ae(this.line,this.column+e)};var je=function(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)};function Me(e,t){for(var r=1,i=0;;){var n=xe(e,i,t);if(n<0)return new Ae(r,t-i);++r,i=n}}var Ne={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Pe=!1;function Fe(e){var t={};for(var r in Ne)t[r]=e&&Ee(e,r)?e[r]:Ne[r];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Pe&&"object"==typeof console&&console.warn&&(Pe=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||null==e.allowHashBang)&&(t.allowHashBang=t.ecmaVersion>=14),De(t.onToken)){var i=t.onToken;t.onToken=function(e){return i.push(e)}}if(De(t.onComment)&&(t.onComment=Ie(t,t.onComment)),"commonjs"===t.sourceType&&t.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function Ie(e,t){return function(r,i,n,s,a,o){var l={type:r?"Block":"Line",value:i,start:n,end:s};e.locations&&(l.loc=new je(this,a,o)),e.ranges&&(l.range=[n,s]),t.push(l)}}var I=1,Le=2,Re=4,ze=8,Be=16,Ve=32,He=64,Ue=128,We=256,Ge=512,Ke=1024,qe=I|Le|We;function Je(e,t){return Le|(e?Re:0)|(t?ze:0)}var Ye=0,Xe=1,L=2,Ze=3,Qe=4,$e=5,R=function(e,t,r){this.options=e=Fe(e),this.sourceFile=e.sourceFile,this.keywords=P(ge[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var i="";!0!==e.allowReserved&&(i=me[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(i+=" await")),this.reservedWords=P(i);var n=(i?i+" ":"")+me.strict;this.reservedWordsStrict=P(n),this.reservedWordsStrictBind=P(n+" "+me.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(M).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=j.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||!0===e.strict||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope("commonjs"===this.options.sourceType?Le:I),this.regexpState=null,this.privateNameStack=[]},z={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};R.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},z.inFunction.get=function(){return(this.currentVarScope().flags&Le)>0},z.inGenerator.get=function(){return(this.currentVarScope().flags&ze)>0},z.inAsync.get=function(){return(this.currentVarScope().flags&Re)>0},z.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(We|Ge))return!1;if(t&Le)return(t&Re)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},z.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&I)},z.allowSuper.get=function(){return(this.currentThisScope().flags&He)>0||this.options.allowSuperOutsideMethod},z.allowDirectSuper.get=function(){return(this.currentThisScope().flags&Ue)>0},z.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},z.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(We|Ge)||t&Le&&!(t&Be))return!0}return!1},z.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&Ke||!this.inModule&&e&I)},z.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&We)>0},R.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,i=0;i<e.length;i++)r=e[i](r);return r},R.parse=function(e,t){return new this(t,e).parse()},R.parseExpressionAt=function(e,t,r){var i=new this(r,e,t);return i.nextToken(),i.parseExpression()},R.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(R.prototype,z);var B=R.prototype,et=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;B.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){N.lastIndex=e,e+=N.exec(this.input)[0].length;var t=et.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){N.lastIndex=e+t[0].length;var r=N.exec(this.input),i=r.index+r[0].length,n=this.input.charAt(i);return";"===n||"}"===n||M.test(r[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(n)||"!"===n&&"="===this.input.charAt(i+1))}e+=t[0].length,N.lastIndex=e,e+=N.exec(this.input)[0].length,";"===this.input[e]&&e++}},B.eat=function(e){return this.type===e&&(this.next(),!0)},B.isContextual=function(e){return this.type===j.name&&this.value===e&&!this.containsEsc},B.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},B.catchStackOverflow=function(e){try{return e()}catch(e){if(!(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message))))throw e;this.raise(this.start,"Not enough stack space to parse input")}},B.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},B.canInsertSemicolon=function(){return this.type===j.eof||this.type===j.braceR||M.test(this.input.slice(this.lastTokEnd,this.start))},B.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},B.semicolon=function(){!this.eat(j.semi)&&!this.insertSemicolon()&&this.unexpected()},B.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},B.expect=function(e){this.eat(e)||this.unexpected()},B.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var tt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};B.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}},B.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,i=e.doubleProto;if(!t)return r>=0||i>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},B.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},B.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var V=R.prototype;V.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==j.eof;){var r=this.parseStatement(null,!0,t);e.body.push(r)}if(this.inModule)for(var i=0,n=Object.keys(this.undefinedExports);i<n.length;i+=1){var s=n[i];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType="commonjs"===this.options.sourceType?"script":this.options.sourceType,this.finishNode(e,"Program")};var nt={kind:"loop"},rt={kind:"switch"};V.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;N.lastIndex=this.pos;var t=N.exec(this.input),r=this.pos+t[0].length,i=this.fullCharCodeAt(r);if(91===i||92===i)return!0;if(e)return!1;if(123===i)return!0;if(w(i)){var n=r;do{r+=i<=65535?1:2}while(T(i=this.fullCharCodeAt(r)));if(92===i)return!0;var s=this.input.slice(n,r);if(!x.test(s))return!0}return!1},V.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;N.lastIndex=this.pos;var e,t=N.exec(this.input),r=this.pos+t[0].length;return!(M.test(this.input.slice(this.pos,r))||"function"!==this.input.slice(r,r+8)||r+8!==this.input.length&&(T(e=this.fullCharCodeAt(r+8))||92===e))},V.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;N.lastIndex=this.pos;var r=N.exec(this.input),i=this.pos+r[0].length;if(M.test(this.input.slice(this.pos,i)))return!1;if(e){var n,s=i+5;if("using"!==this.input.slice(i,s)||s===this.input.length||T(n=this.fullCharCodeAt(s))||92===n)return!1;N.lastIndex=s;var a=N.exec(this.input);if(i=s+a[0].length,a&&M.test(this.input.slice(s,i)))return!1}var o=this.fullCharCodeAt(i);if(!w(o)&&92!==o)return!1;var l=i;do{i+=o<=65535?1:2}while(T(o=this.fullCharCodeAt(i)));if(92===o)return!0;var c=this.input.slice(l,i);if(x.test(c))return!1;if(t&&!e&&"of"===c&&(N.lastIndex=i,i+=N.exec(this.input)[0].length,61!==this.input.charCodeAt(i)||61===(o=this.input.charCodeAt(i+1))||62===o))return!1;return!0},V.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},V.isUsing=function(e){return this.isUsingKeyword(!1,e)},V.parseStatement=function(e,t,r){var i,n=this.type,s=this.startNode();switch(this.isLet(e)&&(n=j._var,i="let"),n){case j._break:case j._continue:return this.parseBreakContinueStatement(s,n.keyword);case j._debugger:return this.parseDebuggerStatement(s);case j._do:return this.parseDoStatement(s);case j._for:return this.parseForStatement(s);case j._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case j._class:return e&&this.unexpected(),this.parseClass(s,!0);case j._if:return this.parseIfStatement(s);case j._return:return this.parseReturnStatement(s);case j._switch:return this.parseSwitchStatement(s);case j._throw:return this.parseThrowStatement(s);case j._try:return this.parseTryStatement(s);case j._const:case j._var:return i||=this.value,e&&"var"!==i&&this.unexpected(),this.parseVarStatement(s,i);case j._while:return this.parseWhileStatement(s);case j._with:return this.parseWithStatement(s);case j.braceL:return this.parseBlock(!0,s);case j.semi:return this.parseEmptyStatement(s);case j._export:case j._import:if(this.options.ecmaVersion>10&&n===j._import){N.lastIndex=this.pos;var a=N.exec(this.input),o=this.pos+a[0].length,l=this.input.charCodeAt(o);if(40===l||46===l)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),n===j._import?this.parseImport(s):this.parseExport(s,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var c=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(c)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),"await using"===c&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,c),this.semicolon(),this.finishNode(s,"VariableDeclaration");var p=this.value,h=this.parseExpression();return n===j.name&&"Identifier"===h.type&&this.eat(j.colon)?this.parseLabeledStatement(s,p,h,e):this.parseExpressionStatement(s,h)}},V.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(j.semi)||this.insertSemicolon()?e.label=null:this.type===j.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var i=0;i<this.labels.length;++i){var n=this.labels[i];if((null==e.label||n.name===e.label.name)&&(null!=n.kind&&(r||"loop"===n.kind)||e.label&&r))break}return i===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},V.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},V.parseDoStatement=function(e){return this.next(),this.labels.push(nt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(j._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(j.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},V.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(nt),this.enterScope(0),this.expect(j.parenL),this.type===j.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===j._var||this.type===j._const||r){var i=this.startNode(),n=r?"let":this.value;return this.next(),this.parseVar(i,!0,n),this.finishNode(i,"VariableDeclaration"),this.parseForAfterInit(e,i,t)}var s=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var l=this.startNode();return this.next(),"await using"===o&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(l,!0,o),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(e,l,t)}var c=this.containsEsc,p=new tt,h=this.start,u=t>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===j._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===j._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(u.start!==h||c||"Identifier"!==u.type||"async"!==u.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),s&&a&&this.raise(u.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(u,!1,p),this.checkLValPattern(u),this.parseForIn(e,u)):(this.checkExpressionErrors(p,!0),t>-1&&this.unexpected(t),this.parseFor(e,u))},V.parseForAfterInit=function(e,t,r){return(this.type===j._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.type===j._in?(("using"===t.kind||"await using"===t.kind)&&!t.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&r>-1&&this.unexpected(r)):this.options.ecmaVersion>=9&&(e.await=r>-1),this.parseForIn(e,t)):(r>-1&&this.unexpected(r),this.parseFor(e,t))},V.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,at|(r?0:ot),!1,t)},V.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(j._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},V.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(j.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},V.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(j.braceL),this.labels.push(rt),this.enterScope(Ke);for(var t,r=!1;this.type!==j.braceR;)if(this.type===j._case||this.type===j._default){var i=this.type===j._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),i?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(j.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},V.parseThrowStatement=function(e){return this.next(),M.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var it=[];V.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?Ve:0),this.checkLValPattern(e,t?Qe:L),this.expect(j.parenR),e},V.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===j._catch){var t=this.startNode();this.next(),this.eat(j.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(j._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},V.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")},V.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(nt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},V.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},V.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},V.parseLabeledStatement=function(e,t,r,i){for(var n=0,s=this.labels;n<s.length;n+=1)s[n].name===t&&this.raise(r.start,"Label '"+t+"' is already declared");for(var a=this.type.isLoop?"loop":this.type===j._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var l=this.labels[o];if(l.statementStart!==e.start)break;l.statementStart=this.start,l.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},V.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},V.parseBlock=function(e,t,r){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(j.braceL),e&&this.enterScope(0);this.type!==j.braceR;){var i=this.parseStatement(null);t.body.push(i)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},V.parseFor=function(e,t){return e.init=t,this.expect(j.semi),e.test=this.type===j.semi?null:this.parseExpression(),this.expect(j.semi),e.update=this.type===j.parenR?null:this.parseExpression(),this.expect(j.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},V.parseForIn=function(e,t){var r=this.type===j._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!r||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(j.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")},V.parseVar=function(e,t,r,i){for(e.declarations=[],e.kind=r;;){var n=this.startNode();if(this.parseVarId(n,r),this.eat(j.eq)?n.init=this.parseMaybeAssign(t):i||"const"!==r||this.type===j._in||this.options.ecmaVersion>=6&&this.isContextual("of")?i||"using"!==r&&"await using"!==r||!(this.options.ecmaVersion>=17)||this.type===j._in||this.isContextual("of")?i||"Identifier"===n.id.type||t&&(this.type===j._in||this.isContextual("of"))?n.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+r+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(j.comma))break}return e},V.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?Xe:L,!1)};var at=1,ot=2,st=4;function ct(e,t){var r=t.key.name,i=e[r],n="true";return"MethodDefinition"===t.type&&("get"===t.kind||"set"===t.kind)&&(n=(t.static?"s":"i")+t.kind),"iget"===i&&"iset"===n||"iset"===i&&"iget"===n||"sget"===i&&"sset"===n||"sset"===i&&"sget"===n?(e[r]="true",!1):!!i||(e[r]=n,!1)}function lt(e,t){var r=e.computed,i=e.key;return!r&&("Identifier"===i.type&&i.name===t||"Literal"===i.type&&i.value===t)}V.parseFunction=function(e,t,r,i,n){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===j.star&&t&ot&&this.unexpected(),e.generator=this.eat(j.star)),this.options.ecmaVersion>=8&&(e.async=!!i),t&at&&(e.id=t&st&&this.type!==j.name?null:this.parseIdent(),e.id&&!(t&ot)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Xe:L:Ze));var s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Je(e.async,e.generator)),t&at||(e.id=this.type===j.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,n),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&at?"FunctionDeclaration":"FunctionExpression")},V.parseFunctionParams=function(e){this.expect(j.parenL),e.params=this.parseBindingList(j.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},V.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var i=this.enterClassBody(),n=this.startNode(),s=!1;for(n.body=[],this.expect(j.braceL);this.type!==j.braceR;){var a=this.parseClassElement(null!==e.superClass);a&&(n.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(s&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),s=!0):a.key&&"PrivateIdentifier"===a.key.type&&ct(i,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(n,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},V.parseClassElement=function(e){if(this.eat(j.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),i="",n=!1,s=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(j.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===j.star?o=!0:i="static"}if(r.static=o,!i&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==j.star||this.canInsertSemicolon()?i="async":s=!0),!i&&(t>=9||!s)&&this.eat(j.star)&&(n=!0),!i&&!s&&!n){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=l:i=l)}if(i?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=i,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===j.parenL||"method"!==a||n||s){var c=!r.static&<(r,"constructor"),p=c&&e;c&&"method"!==a&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=c?"constructor":a,this.parseClassMethod(r,n,s,p)}else this.parseClassField(r);return r},V.isClassElementNameStart=function(){return this.type===j.name||this.type===j.privateId||this.type===j.num||this.type===j.string||this.type===j.bracketL||this.type.keyword},V.parseClassElementName=function(e){this.type===j.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},V.parseClassMethod=function(e,t,r,i){var n=e.key;"constructor"===e.kind?(t&&this.raise(n.start,"Constructor can't be a generator"),r&&this.raise(n.start,"Constructor can't be an async method")):e.static&<(e,"prototype")&&this.raise(n.start,"Classes may not have a static property named prototype");var s=e.value=this.parseMethod(t,r,i);return"get"===e.kind&&0!==s.params.length&&this.raiseRecoverable(s.start,"getter should have no params"),"set"===e.kind&&1!==s.params.length&&this.raiseRecoverable(s.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===s.params[0].type&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},V.parseClassField=function(e){return lt(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&<(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(j.eq)?(this.enterScope(Ge|He),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},V.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(We|He);this.type!==j.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},V.parseClassId=function(e,t){this.type===j.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,L,!1)):(!0===t&&this.unexpected(),e.id=null)},V.parseClassSuper=function(e){e.superClass=this.eat(j._extends)?this.parseExprSubscripts(null,!1):null},V.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},V.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(this.options.checkPrivateFields)for(var i=this.privateNameStack.length,n=0===i?null:this.privateNameStack[i-1],s=0;s<r.length;++s){var a=r[s];Ee(t,a.name)||(n?n.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},V.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==j.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},V.parseExport=function(e,t){if(this.next(),this.eat(j.star))return this.parseExportAllDeclaration(e,t);if(this.eat(j._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==j.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var r=0,i=e.specifiers;r<i.length;r+=1){var n=i[r];this.checkUnreserved(n.local),this.checkLocalExport(n.local),"Literal"===n.local.type&&this.raise(n.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},V.parseExportDeclaration=function(e){return this.parseStatement(null)},V.parseExportDefaultDeclaration=function(){var e;if(this.type===j._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,at|st,!1,e)}if(this.type===j._class){var r=this.startNode();return this.parseClass(r,"nullableID")}var i=this.parseMaybeAssign();return this.semicolon(),i},V.checkExport=function(e,t,r){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),Ee(e,t)&&this.raiseRecoverable(r,"Duplicate export '"+t+"'"),e[t]=!0)},V.checkPatternExport=function(e,t){var r=t.type;if("Identifier"===r)this.checkExport(e,t,t.start);else if("ObjectPattern"===r)for(var i=0,n=t.properties;i<n.length;i+=1){var s=n[i];this.checkPatternExport(e,s)}else if("ArrayPattern"===r)for(var a=0,o=t.elements;a<o.length;a+=1){var l=o[a];l&&this.checkPatternExport(e,l)}else"Property"===r?this.checkPatternExport(e,t.value):"AssignmentPattern"===r?this.checkPatternExport(e,t.left):"RestElement"===r&&this.checkPatternExport(e,t.argument)},V.checkVariableExport=function(e,t){if(e)for(var r=0,i=t;r<i.length;r+=1){var n=i[r];this.checkPatternExport(e,n.id)}},V.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},V.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},V.parseExportSpecifiers=function(e){var t=[],r=!0;for(this.expect(j.braceL);!this.eat(j.braceR);){if(r)r=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;t.push(this.parseExportSpecifier(e))}return t},V.parseImport=function(e){return this.next(),this.type===j.string?(e.specifiers=it,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===j.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},V.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,L),this.finishNode(e,"ImportSpecifier")},V.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,L),this.finishNode(e,"ImportDefaultSpecifier")},V.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,L),this.finishNode(e,"ImportNamespaceSpecifier")},V.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===j.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(j.comma)))return e;if(this.type===j.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(j.braceL);!this.eat(j.braceR);){if(t)t=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;e.push(this.parseImportSpecifier())}return e},V.parseWithClause=function(){var e=[];if(!this.eat(j._with))return e;this.expect(j.braceL);for(var t={},r=!0;!this.eat(j.braceR);){if(r)r=!1;else if(this.expect(j.comma),this.afterTrailingComma(j.braceR))break;var i=this.parseImportAttribute(),n="Identifier"===i.key.type?i.key.name:i.key.value;Ee(t,n)&&this.raiseRecoverable(i.key.start,"Duplicate attribute key '"+n+"'"),t[n]=!0,e.push(i)}return e},V.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===j.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(j.colon),this.type!==j.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},V.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===j.string){var e=this.parseLiteral(this.value);return ke.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},V.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},V.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var H=R.prototype;H.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var i=0,n=e.properties;i<n.length;i+=1){var s=n[i];this.toAssignable(s,t),"RestElement"===s.type&&("ArrayPattern"===s.argument.type||"ObjectPattern"===s.argument.type)&&this.raise(s.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",r&&this.checkPatternErrors(r,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,r);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else r&&this.checkPatternErrors(r,!0);return e},H.toAssignableList=function(e,t){for(var r=e.length,i=0;i<r;i++){var n=e[i];n&&this.toAssignable(n,t)}if(r){var s=e[r-1];6===this.options.ecmaVersion&&t&&s&&"RestElement"===s.type&&"Identifier"!==s.argument.type&&this.unexpected(s.argument.start)}return e},H.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},H.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==j.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},H.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case j.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(j.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case j.braceL:return this.parseObj(!0)}return this.parseIdent()},H.parseBindingList=function(e,t,r,i){for(var n=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(j.comma),t&&this.type===j.comma)n.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===j.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),n.push(a),this.type===j.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}n.push(this.parseAssignableListItem(i))}return n},H.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},H.parseBindingListItem=function(e){return e},H.parseMaybeDefault=function(e,t,r){if(r||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(j.eq))return r;var i=this.startNodeAt(e,t);return i.left=r,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},H.checkLValSimple=function(e,t,r){void 0===t&&(t=Ye);var i=t!==Ye;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(i?"Binding ":"Assigning to ")+e.name+" in strict mode"),i&&(t===L&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),r&&(Ee(r,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),r[e.name]=!0),t!==$e&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":i&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return i&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,r);default:this.raise(e.start,(i?"Binding":"Assigning to")+" rvalue")}},H.checkLValPattern=function(e,t,r){switch(void 0===t&&(t=Ye),e.type){case"ObjectPattern":for(var i=0,n=e.properties;i<n.length;i+=1){var s=n[i];this.checkLValInnerPattern(s,t,r)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var l=o[a];l&&this.checkLValInnerPattern(l,t,r)}break;default:this.checkLValSimple(e,t,r)}},H.checkLValInnerPattern=function(e,t,r){switch(void 0===t&&(t=Ye),e.type){case"Property":this.checkLValInnerPattern(e.value,t,r);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,r);break;case"RestElement":this.checkLValPattern(e.argument,t,r);break;default:this.checkLValPattern(e,t,r)}};var U=function(e,t,r,i,n){this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=i,this.generator=!!n},W={b_stat:new U("{",!1),b_expr:new U("{",!0),b_tmpl:new U("${",!1),p_stat:new U("(",!1),p_expr:new U("(",!0),q_tmpl:new U("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new U("function",!1),f_expr:new U("function",!0),f_expr_gen:new U("function",!0,!1,null,!0),f_gen:new U("function",!1,!1,null,!0)},ut=R.prototype;ut.initialContext=function(){return[W.b_stat]},ut.curContext=function(){return this.context[this.context.length-1]},ut.braceIsBlock=function(e){var t=this.curContext();return t===W.f_expr||t===W.f_stat||(e!==j.colon||t!==W.b_stat&&t!==W.b_expr?e===j._return||e===j.name&&this.exprAllowed?M.test(this.input.slice(this.lastTokEnd,this.start)):e===j._else||e===j.semi||e===j.eof||e===j.parenR||e===j.arrow||(e===j.braceL?t===W.b_stat:e!==j._var&&e!==j._const&&e!==j.name&&!this.exprAllowed):!t.isExpr)},ut.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},ut.updateContext=function(e){var t,r=this.type;r.keyword&&e===j.dot?this.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.exprAllowed=r.beforeExpr},ut.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},j.parenR.updateContext=j.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===W.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},j.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?W.b_stat:W.b_expr),this.exprAllowed=!0},j.dollarBraceL.updateContext=function(){this.context.push(W.b_tmpl),this.exprAllowed=!0},j.parenL.updateContext=function(e){var t=e===j._if||e===j._for||e===j._with||e===j._while;this.context.push(t?W.p_stat:W.p_expr),this.exprAllowed=!0},j.incDec.updateContext=function(){},j._function.updateContext=j._class.updateContext=function(e){!e.beforeExpr||e===j._else||e===j.semi&&this.curContext()!==W.p_stat||e===j._return&&M.test(this.input.slice(this.lastTokEnd,this.start))||(e===j.colon||e===j.braceL)&&this.curContext()===W.b_stat?this.context.push(W.f_stat):this.context.push(W.f_expr),this.exprAllowed=!1},j.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},j.backQuote.updateContext=function(){this.curContext()===W.q_tmpl?this.context.pop():this.context.push(W.q_tmpl),this.exprAllowed=!1},j.star.updateContext=function(e){if(e===j._function){var t=this.context.length-1;this.context[t]===W.f_expr?this.context[t]=W.f_expr_gen:this.context[t]=W.f_gen}this.exprAllowed=!0},j.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==j.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var G=R.prototype;function dt(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&dt(e.expression)}function ft(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&ft(e.expression)||"ParenthesizedExpression"===e.type&&ft(e.expression)}G.checkPropClash=function(e,t,r){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var i,n=e.key;switch(n.type){case"Identifier":i=n.name;break;case"Literal":i=String(n.value);break;default:return}var s=e.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===i&&"init"===s&&(t.proto&&(r?r.doubleProto<0&&(r.doubleProto=n.start):this.raiseRecoverable(n.start,"Redefinition of __proto__ property")),t.proto=!0));var a=t[i="$"+i];a?("init"===s?this.strict&&a.init||a.get||a.set:a.init||a[s])&&this.raiseRecoverable(n.start,"Redefinition of property"):a=t[i]={init:!1,get:!1,set:!1},a[s]=!0}},G.parseExpression=function(e,t){var r=this;return this.catchStackOverflow(function(){var i=r.start,n=r.startLoc,s=r.parseMaybeAssign(e,t);if(r.type===j.comma){var a=r.startNodeAt(i,n);for(a.expressions=[s];r.eat(j.comma);)a.expressions.push(r.parseMaybeAssign(e,t));return r.finishNode(a,"SequenceExpression")}return s})},G.parseMaybeAssign=function(e,t,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var i=!1,n=-1,s=-1,a=-1;t?(n=t.parenthesizedAssign,s=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new tt,i=!0);var o=this.start,l=this.startLoc;(this.type===j.parenL||this.type===j.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var c=this.parseMaybeConditional(e,t);if(r&&(c=r.call(this,c,o,l)),this.type.isAssign){var p=this.startNodeAt(o,l);return p.operator=this.value,this.type===j.eq&&(c=this.toAssignable(c,!1,t)),i||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=c.start&&(t.shorthandAssign=-1),this.type===j.eq?this.checkLValPattern(c):this.checkLValSimple(c),p.left=c,this.next(),p.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(p,"AssignmentExpression")}return i&&this.checkExpressionErrors(t,!0),n>-1&&(t.parenthesizedAssign=n),s>-1&&(t.trailingComma=s),c},G.parseMaybeConditional=function(e,t){var r=this.start,i=this.startLoc,n=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return n;if(("ArrowFunctionExpression"!==n.type||n.start!==r)&&this.eat(j.question)){var s=this.startNodeAt(r,i);return s.test=n,s.consequent=this.parseMaybeAssign(),this.expect(j.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return n},G.parseExprOps=function(e,t){var r=this.start,i=this.startLoc,n=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||n.start===r&&"ArrowFunctionExpression"===n.type?n:this.parseExprOp(n,r,i,-1,e)},G.parseExprOp=function(e,t,r,i,n){var s=this.type.binop;if(null!=s&&(!n||this.type!==j._in)&&s>i){var a=this.type===j.logicalOR||this.type===j.logicalAND,o=this.type===j.coalesce;o&&(s=j.logicalAND.binop);var l=this.value;this.next();var c=this.start,p=this.startLoc,h=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,n),c,p,s,n),u=this.buildBinary(t,r,e,h,l,a||o);return(a&&this.type===j.coalesce||o&&(this.type===j.logicalOR||this.type===j.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(u,t,r,i,n)}return e},G.buildBinary=function(e,t,r,i,n,s){"PrivateIdentifier"===i.type&&this.raise(i.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=r,a.operator=n,a.right=i,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")},G.parseMaybeUnary=function(e,t,r,i){var n,s=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)n=this.parseAwait(i),t=!0;else if(this.type.prefix){var o=this.startNode(),l=this.type===j.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,l,i),this.checkExpressionErrors(e,!0),l?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&dt(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&ft(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,n=this.finishNode(o,l?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==j.privateId){if(n=this.parseExprSubscripts(e,i),this.checkExpressionErrors(e))return n;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(s,a);c.operator=this.value,c.prefix=!1,c.argument=n,this.checkLValSimple(n),this.next(),n=this.finishNode(c,"UpdateExpression")}}else(i||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),n=this.parsePrivateIdent(),this.type!==j._in&&this.unexpected();return r||!this.eat(j.starstar)?n:t?void this.unexpected(this.lastTokStart):this.buildBinary(s,a,n,this.parseMaybeUnary(null,!1,!1,i),"**",!1)},G.parseExprSubscripts=function(e,t){var r=this.start,i=this.startLoc,n=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===n.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return n;var s=this.parseSubscripts(n,r,i,!1,t);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1),e.trailingComma>=s.start&&(e.trailingComma=-1)),s},G.parseSubscripts=function(e,t,r,i,n){for(var s=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,r,i,s,a,n);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var l=this.startNodeAt(t,r);l.expression=o,o=this.finishNode(l,"ChainExpression")}return o}e=o}},G.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(j.arrow)},G.parseSubscriptAsyncArrow=function(e,t,r,i){return this.parseArrowExpression(this.startNodeAt(e,t),r,!0,i)},G.parseSubscript=function(e,t,r,i,n,s,a){var o=this.options.ecmaVersion>=11,l=o&&this.eat(j.questionDot);i&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(j.bracketL);if(c||l&&this.type!==j.parenL&&this.type!==j.backQuote||this.eat(j.dot)){var p=this.startNodeAt(t,r);p.object=e,c?(p.property=this.parseExpression(),this.expect(j.bracketR)):this.type===j.privateId&&"Super"!==e.type?p.property=this.parsePrivateIdent():p.property=this.parseIdent("never"!==this.options.allowReserved),p.computed=!!c,o&&(p.optional=l),e=this.finishNode(p,"MemberExpression")}else if(!i&&this.eat(j.parenL)){var h=new tt,u=this.yieldPos,d=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(j.parenR,this.options.ecmaVersion>=8,!1,h);if(n&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=u,this.awaitPos=d,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,r,m,a);this.checkExpressionErrors(h,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var g=this.startNodeAt(t,r);g.callee=e,g.arguments=m,o&&(g.optional=l),e=this.finishNode(g,"CallExpression")}else if(this.type===j.backQuote){(l||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var _=this.startNodeAt(t,r);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,"TaggedTemplateExpression")}return e},G.parseExprAtom=function(e,t,r){this.type===j.slash&&this.readRegexp();var i,n=this.potentialArrowAt===this.start;switch(this.type){case j._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),i=this.startNode(),this.next(),this.type===j.parenL&&!this.allowDirectSuper&&this.raise(i.start,"super() call outside constructor of a subclass"),this.type!==j.dot&&this.type!==j.bracketL&&this.type!==j.parenL&&this.unexpected(),this.finishNode(i,"Super");case j._this:return i=this.startNode(),this.next(),this.finishNode(i,"ThisExpression");case j.name:var s=this.start,a=this.startLoc,o=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===l.name&&!this.canInsertSemicolon()&&this.eat(j._function))return this.overrideContext(W.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,t);if(n&&!this.canInsertSemicolon()){if(this.eat(j.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[l],!1,t);if(this.options.ecmaVersion>=8&&"async"===l.name&&this.type===j.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(j.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[l],!0,t)}return l;case j.regexp:var c=this.value;return(i=this.parseLiteral(c.value)).regex={pattern:c.pattern,flags:c.flags},i;case j.num:case j.string:return this.parseLiteral(this.value);case j._null:case j._true:case j._false:return(i=this.startNode()).value=this.type===j._null?null:this.type===j._true,i.raw=this.type.keyword,this.next(),this.finishNode(i,"Literal");case j.parenL:var p=this.start,h=this.parseParenAndDistinguishExpression(n,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(h)&&(e.parenthesizedAssign=p),e.parenthesizedBind<0&&(e.parenthesizedBind=p)),h;case j.bracketL:return i=this.startNode(),this.next(),i.elements=this.parseExprList(j.bracketR,!0,!0,e),this.finishNode(i,"ArrayExpression");case j.braceL:return this.overrideContext(W.b_expr),this.parseObj(!1,e);case j._function:return i=this.startNode(),this.next(),this.parseFunction(i,0);case j._class:return this.parseClass(this.startNode(),!1);case j._new:return this.parseNew();case j.backQuote:return this.parseTemplate();case j._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}},G.parseExprAtomDefault=function(){this.unexpected()},G.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===j.parenL&&!e)return this.parseDynamicImport(t);if(this.type===j.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}this.unexpected()},G.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(j.parenR)?e.options=null:(this.expect(j.comma),this.afterTrailingComma(j.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(j.parenR)||(this.expect(j.comma),this.afterTrailingComma(j.parenR)||this.unexpected())));else if(!this.eat(j.parenR)){var t=this.start;this.eat(j.comma)&&this.eat(j.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},G.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},G.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=null==t.value?t.raw.slice(0,-1).replace(/_/g,""):t.value.toString()),this.next(),this.finishNode(t,"Literal")},G.parseParenExpression=function(){this.expect(j.parenL);var e=this.parseExpression();return this.expect(j.parenR),e},G.shouldParseArrow=function(e){return!this.canInsertSemicolon()},G.parseParenAndDistinguishExpression=function(e,t){var r,i=this.start,n=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,l=this.startLoc,c=[],p=!0,h=!1,u=new tt,d=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==j.parenR;){if(p?p=!1:this.expect(j.comma),s&&this.afterTrailingComma(j.parenR,!0)){h=!0;break}if(this.type===j.ellipsis){a=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===j.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}c.push(this.parseMaybeAssign(!1,u,this.parseParenItem))}var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(j.parenR),e&&this.shouldParseArrow(c)&&this.eat(j.arrow))return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=f,this.parseParenArrowList(i,n,c,t);(!c.length||h)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,c.length>1?((r=this.startNodeAt(o,l)).expressions=c,this.finishNodeAt(r,"SequenceExpression",m,g)):r=c[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(i,n);return _.expression=r,this.finishNode(_,"ParenthesizedExpression")}return r},G.parseParenItem=function(e){return e},G.parseParenArrowList=function(e,t,r,i){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,i)};var pt=[];G.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===j.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var i=this.start,n=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),i,n,!0,!1),"Super"===e.callee.type&&this.raiseRecoverable(i,"Invalid use of 'super'"),this.eat(j.parenL)?e.arguments=this.parseExprList(j.parenR,this.options.ecmaVersion>=8,!1):e.arguments=pt,this.finishNode(e,"NewExpression")},G.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===j.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),r.tail=this.type===j.backQuote,this.finishNode(r,"TemplateElement")},G.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var i=this.parseTemplateElement({isTagged:t});for(r.quasis=[i];!i.tail;)this.type===j.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(j.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(j.braceR),r.quasis.push(i=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")},G.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===j.name||this.type===j.num||this.type===j.string||this.type===j.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===j.star)&&!M.test(this.input.slice(this.lastTokEnd,this.start))},G.parseObj=function(e,t){var r=this.startNode(),i=!0,n={};for(r.properties=[],this.next();!this.eat(j.braceR);){if(i)i=!1;else if(this.expect(j.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(j.braceR))break;var s=this.parseProperty(e,t);e||this.checkPropClash(s,n,t),r.properties.push(s)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},G.parseProperty=function(e,t){var r,i,n,s,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(j.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===j.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,t),this.type===j.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(e||t)&&(n=this.start,s=this.startLoc),e||(r=this.eat(j.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(a)?(i=!0,r=this.options.ecmaVersion>=9&&this.eat(j.star),this.parsePropertyName(a)):i=!1,this.parsePropertyValue(a,e,r,i,n,s,t,o),this.finishNode(a,"Property")},G.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var r="get"===e.kind?0:1;if(e.value.params.length!==r){var i=e.value.start;"get"===e.kind?this.raiseRecoverable(i,"getter should have no params"):this.raiseRecoverable(i,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},G.parsePropertyValue=function(e,t,r,i,n,s,a,o){(r||i)&&this.type===j.colon&&this.unexpected(),this.eat(j.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===j.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(r,i),e.kind="init"):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===j.comma||this.type===j.braceR||this.type===j.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((r||i)&&this.unexpected(),this.checkUnreserved(e.key),"await"===e.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=n),t?e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key)):this.type===j.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(n,s,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected():((r||i)&&this.unexpected(),this.parseGetterSetter(e))},G.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(j.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(j.bracketR),e.key;e.computed=!1}return e.key=this.type===j.num||this.type===j.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},G.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},G.parseMethod=function(e,t,r){var i=this.startNode(),n=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=e),this.options.ecmaVersion>=8&&(i.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Je(t,i.generator)|He|(r?Ue:0)),this.expect(j.parenL),i.params=this.parseBindingList(j.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0,!1),this.yieldPos=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(i,"FunctionExpression")},G.parseArrowExpression=function(e,t,r,i){var n=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Je(r,!1)|Be),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,i),this.yieldPos=n,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},G.parseFunctionBody=function(e,t,r,i){var n=t&&this.type!==j.braceL,s=this.strict,a=!1;if(n)e.body=this.parseMaybeAssign(i),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!s||o)&&((a=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!s&&!a&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,$e),e.body=this.parseBlock(!1,void 0,a&&!s),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()},G.isSimpleParamList=function(e){for(var t=0,r=e;t<r.length;t+=1)if("Identifier"!==r[t].type)return!1;return!0},G.checkParams=function(e,t){for(var r=Object.create(null),i=0,n=e.params;i<n.length;i+=1){var s=n[i];this.checkLValInnerPattern(s,Xe,t?null:r)}},G.parseExprList=function(e,t,r,i){for(var n=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(j.comma),t&&this.afterTrailingComma(e))break;var a=void 0;r&&this.type===j.comma?a=null:this.type===j.ellipsis?(a=this.parseSpread(i),i&&this.type===j.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):a=this.parseMaybeAssign(!1,i),n.push(a)}return n},G.checkUnreserved=function(e){var t=e.start,r=e.end,i=e.name;this.inGenerator&&"yield"===i&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&qe)&&"arguments"===i&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===i||"await"===i)&&this.raise(t,"Cannot use "+i+" in class static initialization block"),this.keywords.test(i)&&this.raise(t,"Unexpected keyword '"+i+"'"),!(this.options.ecmaVersion<6&&-1!==this.input.slice(t,r).indexOf("\\"))&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(!this.inAsync&&"await"===i&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+i+"' is reserved"))},G.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"===t.name&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},G.parseIdentNode=function(){var e=this.startNode();return this.type===j.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,("class"===e.name||"function"===e.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=j.name):this.unexpected(),e},G.parsePrivateIdent=function(){var e=this.startNode();return this.type===j.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},G.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===j.semi||this.canInsertSemicolon()||this.type!==j.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(j.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},G.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var mt=R.prototype;mt.raise=function(e,t){var r=Me(this.input,e);t+=" ("+r.line+":"+r.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var i=SyntaxError(t);throw i.pos=e,i.loc=r,i.raisedAt=this.pos,i},mt.raiseRecoverable=mt.raise,mt.curPosition=function(){if(this.options.locations)return new Ae(this.curLine,this.pos-this.lineStart)};var K=R.prototype,ht=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};K.enterScope=function(e){this.scopeStack.push(new ht(e))},K.exitScope=function(){this.scopeStack.pop()},K.treatFunctionsAsVarInScope=function(e){return e.flags&Le||!this.inModule&&e.flags&I},K.declareName=function(e,t,r){var i=!1;if(t===L){var n=this.currentScope();i=n.lexical.indexOf(e)>-1||n.functions.indexOf(e)>-1||n.var.indexOf(e)>-1,n.lexical.push(e),this.inModule&&n.flags&I&&delete this.undefinedExports[e]}else if(t===Qe)this.currentScope().lexical.push(e);else if(t===Ze){var s=this.currentScope();i=this.treatFunctionsAsVar?s.lexical.indexOf(e)>-1:s.lexical.indexOf(e)>-1||s.var.indexOf(e)>-1,s.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(e)>-1&&!(o.flags&Ve&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){i=!0;break}if(o.var.push(e),this.inModule&&o.flags&I&&delete this.undefinedExports[e],o.flags&qe)break}i&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")},K.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},K.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},K.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(qe|Ge|We))return t}},K.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(qe|Ge|We)&&!(t.flags&Be))return t}};var gt=function(e,t,r){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new je(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},_t=R.prototype;function vt(e,t,r,i){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=i),this.options.ranges&&(e.range[1]=r),e}_t.startNode=function(){return new gt(this,this.start,this.startLoc)},_t.startNodeAt=function(e,t){return new gt(this,e,t)},_t.finishNode=function(e,t){return vt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},_t.finishNodeAt=function(e,t,r,i){return vt.call(this,e,t,r,i)},_t.copyNode=function(e){var t=new gt(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var yt="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",bt="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",xt=bt+" Extended_Pictographic",St=xt,Ct=xt+" EBase EComp EMod EPres ExtPict",wt=Ct,Tt={9:bt,10:xt,11:xt,12:Ct,13:Ct,14:Ct},Et={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},Dt="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Ot="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",kt=Ot+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",At=kt+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",jt=At+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Mt=jt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Nt={9:Ot,10:kt,11:At,12:jt,13:Mt,14:Mt+" "+yt},Pt={};function Ft(e){var t=Pt[e]={binary:P(Tt[e]+" "+Dt),binaryOfStrings:P(Et[e]),nonBinary:{General_Category:P(Dt),Script:P(Nt[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var It=0,Lt=[9,10,11,12,13,14];It<Lt.length;It+=1){var Rt=Lt[It];Ft(Rt)}var q=R.prototype,zt=function(e,t){this.parent=e,this.base=t||this};zt.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var r=e;r;r=r.parent)if(t.base===r.base&&t!==r)return!0;return!1},zt.prototype.sibling=function(){return new zt(this.parent,this.base)};var J=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Pt[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function Bt(e){for(var t in e)return!0;return!1}function Vt(e){return 105===e||109===e||115===e}function Ht(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Ut(e){return w(e,!0)||36===e||95===e}function Wt(e){return T(e,!0)||36===e||95===e||8204===e||8205===e}function Gt(e){return e>=65&&e<=90||e>=97&&e<=122}function Kt(e){return e>=0&&e<=1114111}J.prototype.reset=function(e,t,r){var i=-1!==r.indexOf("v"),n=-1!==r.indexOf("u");this.start=0|e,this.source=t+"",this.flags=r,i&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=n&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=n&&this.parser.options.ecmaVersion>=9)},J.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},J.prototype.at=function(e,t){void 0===t&&(t=!1);var r=this.source,i=r.length;if(e>=i)return-1;var n=r.charCodeAt(e);if(!t&&!this.switchU||n<=55295||n>=57344||e+1>=i)return n;var s=r.charCodeAt(e+1);return s>=56320&&s<=57343?(n<<10)+s-56613888:n},J.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var r=this.source,i=r.length;if(e>=i)return i;var n,s=r.charCodeAt(e);return!t&&!this.switchU||s<=55295||s>=57344||e+1>=i||(n=r.charCodeAt(e+1))<56320||n>57343?e+1:e+2},J.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},J.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},J.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},J.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},J.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var r=this.pos,i=0,n=e;i<n.length;i+=1){var s=n[i],a=this.at(r,t);if(-1===a||a!==s)return!1;r=this.nextIndex(r,t)}return this.pos=r,!0},q.validateRegExpFlags=function(e){for(var t=e.validFlags,r=e.flags,i=!1,n=!1,s=0;s<r.length;s++){var a=r.charAt(s);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),r.indexOf(a,s+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(i=!0),"v"===a&&(n=!0)}this.options.ecmaVersion>=15&&i&&n&&this.raise(e.start,"Invalid regular expression flag")},q.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Bt(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},q.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t<r.length;t+=1){var i=r[t];e.groupNames[i]||e.raise("Invalid named capture referenced")}},q.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new zt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},q.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},q.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},q.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var r=!1;if(this.options.ecmaVersion>=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1},q.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},q.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},q.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var i=0,n=-1;if(this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue),e.eat(125)))return-1!==n&&n<i&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=r}return!1},q.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},q.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},q.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var r=this.regexp_eatModifiers(e),i=e.eat(45);if(r||i){for(var n=0;n<r.length;n++){var s=r.charAt(n);r.indexOf(s,n+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(i){var a=this.regexp_eatModifiers(e);!r&&!a&&58===e.current()&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var l=a.charAt(o);(a.indexOf(l,o+1)>-1||r.indexOf(l)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},q.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},q.regexp_eatModifiers=function(e){for(var t="",r=0;-1!==(r=e.current())&&Vt(r);)t+=F(r),e.advance();return t},q.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},q.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},q.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!Ht(t)&&(e.lastIntValue=t,e.advance(),!0)},q.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;-1!==(r=e.current())&&!Ht(r);)e.advance();return e.pos!==t},q.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t)&&(e.advance(),!0)},q.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,r=e.groupNames[e.lastStringValue];if(r)if(t)for(var i=0,n=r;i<n.length;i+=1)n[i].separatedFrom(e.branchID)||e.raise("Duplicate capture group name");else e.raise("Duplicate capture group name");t?(r||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},q.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},q.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=F(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=F(e.lastIntValue);return!0}return!1},q.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,i=e.current(r);return e.advance(r),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(i=e.lastIntValue),Ut(i)?(e.lastIntValue=i,!0):(e.pos=t,!1)},q.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,i=e.current(r);return e.advance(r),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(i=e.lastIntValue),Wt(i)?(e.lastIntValue=i,!0):(e.pos=t,!1)},q.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},q.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1},q.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},q.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},q.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},q.regexp_eatZero=function(e){return 48===e.current()&&!en(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},q.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},q.regexp_eatControlLetter=function(e){var t=e.current();return!!Gt(t)&&(e.lastIntValue=t%32,e.advance(),!0)},q.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var r=e.pos,i=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var n=e.lastIntValue;if(i&&n>=55296&&n<=56319){var s=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=1024*(n-55296)+(a-56320)+65536,!0}e.pos=s,e.lastIntValue=n}return!0}if(i&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&Kt(e.lastIntValue))return!0;i&&e.raise("Invalid unicode escape"),e.pos=r}return!1},q.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t)&&(e.lastIntValue=t,e.advance(),!0)},q.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};var qt=0,Y=1,X=2;function Jt(e){return 100===e||68===e||115===e||83===e||119===e||87===e}function Yt(e){return Gt(e)||95===e}function Xt(e){return Yt(e)||en(e)}function Zt(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}function Qt(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}function $t(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}function en(e){return e>=48&&e<=57}function tn(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function nn(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function rn(e){return e>=48&&e<=55}q.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Jt(t))return e.lastIntValue=-1,e.advance(),Y;var r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=80===t)||112===t)){var i;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(i=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&i===X&&e.raise("Invalid property name"),i;e.raise("Invalid property name")}return qt},q.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,i),Y}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,n)}return qt},q.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){Ee(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")},q.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?Y:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?X:void e.raise("Invalid property name")},q.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Yt(t=e.current());)e.lastStringValue+=F(t),e.advance();return""!==e.lastStringValue},q.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Xt(t=e.current());)e.lastStringValue+=F(t),e.advance();return""!==e.lastStringValue},q.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},q.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&r===X&&e.raise("Negated character class may contain strings"),!0}return!1},q.regexp_classContents=function(e){return 93===e.current()?Y:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),Y)},q.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;e.switchU&&(-1===t||-1===r)&&e.raise("Invalid character class"),-1!==t&&-1!==r&&t>r&&e.raise("Range out of order in character class")}}},q.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(99===r||rn(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var i=e.current();return 93!==i&&(e.lastIntValue=i,e.advance(),!0)},q.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},q.regexp_classSetExpression=function(e){var t,r=Y;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===X&&(r=X);for(var i=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?t!==X&&(r=Y):e.raise("Invalid character in character class");if(i!==e.pos)return r;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(i!==e.pos)return r}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return r;t===X&&(r=X)}},q.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var i=e.lastIntValue;return-1!==r&&-1!==i&&r>i&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},q.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?Y:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},q.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),i=this.regexp_classContents(e);if(e.eat(93))return r&&i===X&&e.raise("Negated character class may contain strings"),i;e.pos=t}if(e.eat(92)){var n=this.regexp_eatCharacterClassEscape(e);if(n)return n;e.pos=t}return null},q.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null},q.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===X&&(t=X);return t},q.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?Y:X},q.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var r=e.current();return!(r<0||r===e.lookahead()&&Zt(r)||Qt(r))&&(e.advance(),e.lastIntValue=r,!0)},q.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!$t(t)&&(e.lastIntValue=t,e.advance(),!0)},q.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!en(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},q.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},q.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;en(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t},q.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;tn(r=e.current());)e.lastIntValue=16*e.lastIntValue+nn(r),e.advance();return e.pos!==t},q.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*r+e.lastIntValue:e.lastIntValue=8*t+r}else e.lastIntValue=t;return!0}return!1},q.regexp_eatOctalDigit=function(e){var t=e.current();return rn(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},q.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var i=0;i<t;++i){var n=e.current();if(!tn(n))return e.pos=r,!1;e.lastIntValue=16*e.lastIntValue+nn(n),e.advance()}return!0};var an=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new je(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},Z=R.prototype;function on(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function sn(e){return"function"==typeof BigInt?BigInt(e.replace(/_/g,"")):null}Z.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new an(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},Z.getToken=function(){return this.next(),new an(this)},typeof Symbol<"u"&&(Z[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===j.eof,value:t}}}}),Z.nextToken=function(){var e=this.curContext();return(!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(j.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},Z.readToken=function(e){return w(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},Z.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var r=this.input.charCodeAt(e+1);return r<=56319||r>=57344?t:(t<<10)+r-56613888},Z.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},Z.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var i=void 0,n=t;(i=xe(this.input,n,this.pos))>-1;)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())},Z.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!be(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,r,this.curPosition())},Z.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&Se.test(String.fromCharCode(e))))break e;++this.pos}}},Z.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)},Z.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(j.ellipsis)):(++this.pos,this.finishToken(j.dot))},Z.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(j.assign,2):this.finishOp(j.slash,1)},Z.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,i=42===e?j.star:j.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++r,i=j.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(j.assign,r+1):this.finishOp(i,r)},Z.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(j.assign,3):this.finishOp(124===e?j.logicalOR:j.logicalAND,2):61===t?this.finishOp(j.assign,2):this.finishOp(124===e?j.bitwiseOR:j.bitwiseAND,1)},Z.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(j.assign,2):this.finishOp(j.bitwiseXOR,1)},Z.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!M.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(j.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(j.assign,2):this.finishOp(j.plusMin,1)},Z.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+r)?this.finishOp(j.assign,r+1):this.finishOp(j.bitShift,r)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(r=2),this.finishOp(j.relational,r)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},Z.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(j.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(j.arrow)):this.finishOp(61===e?j.eq:j.prefix,1)},Z.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(j.questionDot,2)}if(63===t)return e>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(j.assign,3):this.finishOp(j.coalesce,2)}return this.finishOp(j.question,1)},Z.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,w(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(j.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+F(e)+"'")},Z.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(j.parenL);case 41:return++this.pos,this.finishToken(j.parenR);case 59:return++this.pos,this.finishToken(j.semi);case 44:return++this.pos,this.finishToken(j.comma);case 91:return++this.pos,this.finishToken(j.bracketL);case 93:return++this.pos,this.finishToken(j.bracketR);case 123:return++this.pos,this.finishToken(j.braceL);case 125:return++this.pos,this.finishToken(j.braceR);case 58:return++this.pos,this.finishToken(j.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(j.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(j.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+F(e)+"'")},Z.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)},Z.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(M.test(i)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++this.pos}var n=this.input.slice(r,this.pos);++this.pos;var s=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(s);var o=this.regexpState||=new J(this);o.reset(r,n,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var l=null;try{l=new RegExp(n,a)}catch{}return this.finishToken(j.regexp,{pattern:n,flags:a,value:l})},Z.readInt=function(e,t,r){for(var i=this.options.ecmaVersion>=12&&void 0===t,n=r&&48===this.input.charCodeAt(this.pos),s=this.pos,a=0,o=0,l=0,c=t??1/0;l<c;++l,++this.pos){var p,h=this.input.charCodeAt(this.pos);if(i&&95===h)n&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===l&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;else{if((p=h>=97?h-97+10:h>=65?h-65+10:h>=48&&h<=57?h-48:1/0)>=e)break;o=h,a=a*e+p}}return i&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===s||null!=t&&this.pos-s!==t?null:a},Z.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return r??this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(r=sn(this.input.slice(t,this.pos)),++this.pos):w(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(j.num,r)},Z.readNumber=function(e){var t=this.pos;!e&&null===this.readInt(10,void 0,!0)&&this.raise(t,"Invalid number");var r=this.pos-t>=2&&48===this.input.charCodeAt(t);r&&this.strict&&this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&110===i){var n=sn(this.input.slice(t,this.pos));return++this.pos,w(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(j.num,n)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),46===i&&!r&&(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),(69===i||101===i)&&!r&&((43===(i=this.input.charCodeAt(++this.pos))||45===i)&&++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),w(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=on(this.input.slice(t,this.pos),r);return this.finishToken(j.num,s)},Z.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},Z.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===e)break;92===i?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(be(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(j.string,t)};var cn={};function ln(e,t){return R.parse(e,t)}function un(e,t,r){return R.parseExpressionAt(e,t,r)}function dn(e,t,r,i,n){var s=[];r||=Q,function e(i,n,a){var o=a||i.type,l=i!==s[s.length-1];l&&s.push(i),mn(r,o,i,n,e),t[o]&&t[o](i,n||s,s),l&&s.pop()}(e,i,n)}function fn(e,t,r){r(e,t)}function pn(e,t,r){}function mn(e,t,r,i,n){if(null==e[t])throw Error("No walker function defined for node type "+t);e[t](r,i,n)}Z.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==cn)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},Z.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw cn;this.raise(e,t)},Z.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==j.template&&this.type!==j.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(j.template,e)):36===r?(this.pos+=2,this.finishToken(j.dollarBraceL)):(++this.pos,this.finishToken(j.backQuote));if(92===r)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(be(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},Z.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(j.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},Z.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return F(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var r=this.pos-1;this.invalidStringToken(r,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(i,8);return n>255&&(i=i.slice(0,-1),n=parseInt(i,8)),this.pos+=i.length-1,t=this.input.charCodeAt(this.pos),("0"!==i||56===t||57===t)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-i.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(n)}return be(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},Z.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return null===r&&this.invalidStringToken(t,"Bad character escape sequence"),r},Z.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(T(n,i))this.pos+=n<=65535?1:2;else{if(92!==n)break;this.containsEsc=!0,e+=this.input.slice(r,this.pos);var s=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?w:T)(a,i)||this.invalidStringToken(s,"Invalid Unicode escape"),e+=F(a),r=this.pos}t=!1}return e+this.input.slice(r,this.pos)},Z.readWord=function(){var e=this.readWord1(),t=j.name;return this.keywords.test(e)&&(t=ve[e]),this.finishToken(t,e)},R.acorn={Parser:R,version:"8.17.0",defaultOptions:Ne,Position:Ae,SourceLocation:je,getLineInfo:Me,Node:gt,TokenType:E,tokTypes:j,keywordTypes:ve,TokContext:U,tokContexts:W,isIdentifierChar:T,isIdentifierStart:w,Token:an,isNewLine:be,lineBreak:M,lineBreakG:ye,nonASCIIwhitespace:Se};var Q={};Q.Program=Q.BlockStatement=Q.StaticBlock=function(e,t,r){for(var i=0,n=e.body;i<n.length;i+=1){r(n[i],t,"Statement")}},Q.Statement=fn,Q.EmptyStatement=pn,Q.ExpressionStatement=Q.ParenthesizedExpression=Q.ChainExpression=function(e,t,r){return r(e.expression,t,"Expression")},Q.IfStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Statement"),e.alternate&&r(e.alternate,t,"Statement")},Q.LabeledStatement=function(e,t,r){return r(e.body,t,"Statement")},Q.BreakStatement=Q.ContinueStatement=pn,Q.WithStatement=function(e,t,r){r(e.object,t,"Expression"),r(e.body,t,"Statement")},Q.SwitchStatement=function(e,t,r){r(e.discriminant,t,"Expression");for(var i=0,n=e.cases;i<n.length;i+=1){r(n[i],t)}},Q.SwitchCase=function(e,t,r){e.test&&r(e.test,t,"Expression");for(var i=0,n=e.consequent;i<n.length;i+=1){r(n[i],t,"Statement")}},Q.ReturnStatement=Q.YieldExpression=Q.AwaitExpression=function(e,t,r){e.argument&&r(e.argument,t,"Expression")},Q.ThrowStatement=Q.SpreadElement=function(e,t,r){return r(e.argument,t,"Expression")},Q.TryStatement=function(e,t,r){r(e.block,t,"Statement"),e.handler&&r(e.handler,t),e.finalizer&&r(e.finalizer,t,"Statement")},Q.CatchClause=function(e,t,r){e.param&&r(e.param,t,"Pattern"),r(e.body,t,"Statement")},Q.WhileStatement=Q.DoWhileStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.body,t,"Statement")},Q.ForStatement=function(e,t,r){e.init&&r(e.init,t,"ForInit"),e.test&&r(e.test,t,"Expression"),e.update&&r(e.update,t,"Expression"),r(e.body,t,"Statement")},Q.ForInStatement=Q.ForOfStatement=function(e,t,r){r(e.left,t,"ForInit"),r(e.right,t,"Expression"),r(e.body,t,"Statement")},Q.ForInit=function(e,t,r){"VariableDeclaration"===e.type?r(e,t):r(e,t,"Expression")},Q.DebuggerStatement=pn,Q.FunctionDeclaration=function(e,t,r){return r(e,t,"Function")},Q.VariableDeclaration=function(e,t,r){for(var i=0,n=e.declarations;i<n.length;i+=1){r(n[i],t)}},Q.VariableDeclarator=function(e,t,r){r(e.id,t,"Pattern"),e.init&&r(e.init,t,"Expression")},Q.Function=function(e,t,r){e.id&&r(e.id,t,"Pattern");for(var i=0,n=e.params;i<n.length;i+=1){r(n[i],t,"Pattern")}r(e.body,t,e.expression?"Expression":"Statement")},Q.Pattern=function(e,t,r){"Identifier"===e.type?r(e,t,"VariablePattern"):"MemberExpression"===e.type?r(e,t,"MemberPattern"):r(e,t)},Q.VariablePattern=pn,Q.MemberPattern=fn,Q.RestElement=function(e,t,r){return r(e.argument,t,"Pattern")},Q.ArrayPattern=function(e,t,r){for(var i=0,n=e.elements;i<n.length;i+=1){var s=n[i];s&&r(s,t,"Pattern")}},Q.ObjectPattern=function(e,t,r){for(var i=0,n=e.properties;i<n.length;i+=1){var s=n[i];"Property"===s.type?(s.computed&&r(s.key,t,"Expression"),r(s.value,t,"Pattern")):"RestElement"===s.type&&r(s.argument,t,"Pattern")}},Q.Expression=fn,Q.ThisExpression=Q.Super=Q.MetaProperty=pn,Q.ArrayExpression=function(e,t,r){for(var i=0,n=e.elements;i<n.length;i+=1){var s=n[i];s&&r(s,t,"Expression")}},Q.ObjectExpression=function(e,t,r){for(var i=0,n=e.properties;i<n.length;i+=1){r(n[i],t)}},Q.FunctionExpression=Q.ArrowFunctionExpression=Q.FunctionDeclaration,Q.SequenceExpression=function(e,t,r){for(var i=0,n=e.expressions;i<n.length;i+=1){r(n[i],t,"Expression")}},Q.TemplateLiteral=function(e,t,r){for(var i=0,n=e.quasis;i<n.length;i+=1){r(n[i],t)}for(var s=0,a=e.expressions;s<a.length;s+=1){r(a[s],t,"Expression")}},Q.TemplateElement=pn,Q.UnaryExpression=Q.UpdateExpression=function(e,t,r){r(e.argument,t,"Expression")},Q.BinaryExpression=Q.LogicalExpression=function(e,t,r){r(e.left,t,"Expression"),r(e.right,t,"Expression")},Q.AssignmentExpression=Q.AssignmentPattern=function(e,t,r){r(e.left,t,"Pattern"),r(e.right,t,"Expression")},Q.ConditionalExpression=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Expression"),r(e.alternate,t,"Expression")},Q.NewExpression=Q.CallExpression=function(e,t,r){if(r(e.callee,t,"Expression"),e.arguments)for(var i=0,n=e.arguments;i<n.length;i+=1){r(n[i],t,"Expression")}},Q.MemberExpression=function(e,t,r){r(e.object,t,"Expression"),e.computed&&r(e.property,t,"Expression")},Q.ExportNamedDeclaration=Q.ExportDefaultDeclaration=function(e,t,r){if(e.declaration&&r(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&r(e.source,t,"Expression"),e.attributes)for(var i=0,n=e.attributes;i<n.length;i+=1){r(n[i],t)}},Q.ExportAllDeclaration=function(e,t,r){if(e.exported&&r(e.exported,t),r(e.source,t,"Expression"),e.attributes)for(var i=0,n=e.attributes;i<n.length;i+=1){r(n[i],t)}},Q.ImportAttribute=function(e,t,r){r(e.value,t,"Expression")},Q.ImportDeclaration=function(e,t,r){for(var i=0,n=e.specifiers;i<n.length;i+=1){r(n[i],t)}if(r(e.source,t,"Expression"),e.attributes)for(var s=0,a=e.attributes;s<a.length;s+=1){r(a[s],t)}},Q.ImportExpression=function(e,t,r){r(e.source,t,"Expression"),e.options&&r(e.options,t,"Expression")},Q.ImportSpecifier=Q.ImportDefaultSpecifier=Q.ImportNamespaceSpecifier=Q.Identifier=Q.PrivateIdentifier=Q.Literal=pn,Q.TaggedTemplateExpression=function(e,t,r){r(e.tag,t,"Expression"),r(e.quasi,t,"Expression")},Q.ClassDeclaration=Q.ClassExpression=function(e,t,r){return r(e,t,"Class")},Q.Class=function(e,t,r){e.id&&r(e.id,t,"Pattern"),e.superClass&&r(e.superClass,t,"Expression"),r(e.body,t)},Q.ClassBody=function(e,t,r){for(var i=0,n=e.body;i<n.length;i+=1){r(n[i],t)}},Q.MethodDefinition=Q.PropertyDefinition=Q.Property=function(e,t,r){e.computed&&r(e.key,t,"Expression"),e.value&&r(e.value,t,"Expression")};var $=class e{static expressionCache=new Map;static variableCache=new Map;static bindingsCache=new Map;static loopVariableCache=new Map;static MAX_CACHE_SIZE=1e3;static pruneCache(e){e.size>this.MAX_CACHE_SIZE&&Array.from(e.keys()).slice(0,e.size-this.MAX_CACHE_SIZE/2).forEach(t=>e.delete(t))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static addPatternBindings(e,t){if(e){if("Identifier"===e.type)return void t.add(e.name);if("AssignmentPattern"===e.type)return void this.addPatternBindings(e.left,t);if("RestElement"===e.type)return void this.addPatternBindings(e.argument,t);"ObjectPattern"===e.type&&e.properties.forEach(e=>{"Property"===e.type?this.addPatternBindings(e.value,t):"RestElement"===e.type&&this.addPatternBindings(e.argument,t)})}}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];let r=new Set;try{dn(ln(t,{ecmaVersion:2020}),{FunctionDeclaration(e,t){t.length<=2&&e.id&&e.id.name&&r.add(e.id.name)},VariableDeclaration(t,i){i.length>2||t.declarations.forEach(t=>{"CallExpression"!==t.init?.type||"pp"!==t.init.callee?.object?.name||"state"!==t.init.callee?.property?.name&&"reducer"!==t.init.callee?.property?.name?("Identifier"===t.id.type&&r.add(t.id.name),"ObjectPattern"===t.id.type&&e.addPatternBindings(t.id,r)):"ArrayPattern"===t.id.type&&t.id.elements.forEach(e=>{"Identifier"===e?.type&&r.add(e.name)})})}})}catch(e){console.error("[PP-ERROR] AstParser Failed",e)}let i=Array.from(r);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,i),i}static extractUsedVariables(e,t){let r=e+"|"+Array.from(t).sort().join(",");if(this.variableCache.has(r))return new Set(this.variableCache.get(r));let i=new Set;try{dn(ln(`(${e})`,{ecmaVersion:2020}),{Identifier(e,r){if(!t.has(e.name)){if(r.length>1){let t=r[r.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return}i.add(e.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(r,i),new Set(i)}static isValidExpression(e){if(!e.trim())return!1;if(this.expressionCache.has(e))return this.expressionCache.get(e);let t=!1;try{un(`(${e})`,0,{ecmaVersion:2020}),t=!0}catch{t=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(e,t),t}static analyzeLoopVariableUsage(e,t){let r=e+"|"+t;if(this.loopVariableCache.has(r))return[...this.loopVariableCache.get(r)];let i=[];try{dn(ln(e,{ecmaVersion:2020}),{Identifier(e,r){if(e.name!==t)return;let n=!1,s=!1,a=e.start,o=e.end;if(r.length>=2){let t=r[r.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return;if("Property"===t.type&&t.shorthand&&(n=!0,r.length>=3)){let e=r[r.length-3];"ObjectExpression"===e.type&&1===e.properties.length&&(s=!0,a=e.start,o=e.end)}}i.push({start:a,end:o,isShorthand:n,isUnwrap:s})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(r,i),[...i]}},hn=class{static cache=new Map;static MAX_CACHE_SIZE=200;static CONTEXT_PROVIDER_TAG_PATTERN=/<\/?([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b[^>]*>/gi;static LITERAL_CODE_TAG_PATTERN=/(<code\b[^>]*>)([\s\S]*?)(<\/code\s*>)/gi;static ESCAPED_BRACE_ENTITY_PATTERN=/&(lbrace|rbrace|#123|#125|#x7b|#x7d);/gi;static escapeTemplateLiteralText(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}static getRuntimeEscaperSource(){return"\nconst __pp_escape_html = (value) => String(value)\n .split('&').join('&')\n .split('<').join('<')\n .split('>').join('>')\n .split('\"').join('"')\n .split(\"'\").join(''');\nconst __pp_raw_html = (value) => ({ __ppRawHtml: String(value) });\nconst __pp_render_value = (value) => {\n if (typeof value === 'boolean' || value == null) return '';\n if (value && typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, '__ppRawHtml')) return value.__ppRawHtml;\n if (Array.isArray(value)) return value.map(__pp_render_value).join('');\n return __pp_escape_html(value);\n};\nconst __pp_decode_html_entities = (value) => String(value)\n .split('"').join('\"')\n .split('"').join('\"')\n .split(''').join(\"'\")\n .split('<').join('<')\n .split('>').join('>')\n .split('&').join('&');\nconst __pp_find_dynamic_closing_brace = (value, start) => {\n let depth = 0;\n let quote = null;\n let escaped = false;\n for (let index = start; index < value.length; index++) {\n const char = value[index];\n if (escaped) {\n escaped = false;\n continue;\n }\n if (char === String.fromCharCode(92)) {\n escaped = true;\n continue;\n }\n if (quote) {\n if (char === quote) quote = null;\n continue;\n }\n if (char === '\"' || char === \"'\" || char === String.fromCharCode(96)) {\n quote = char;\n continue;\n }\n if (char === '{') depth++;\n if (char === '}') {\n depth--;\n if (depth === 0) return index;\n }\n }\n return -1;\n};\nconst __pp_interpolate_dynamic_html = (value) => {\n const source = String(value);\n let result = '';\n let cursor = 0;\n while (cursor < source.length) {\n if (source[cursor] !== '{') {\n result += source[cursor++];\n continue;\n }\n const closing = __pp_find_dynamic_closing_brace(source, cursor);\n if (closing === -1) {\n result += source[cursor++];\n continue;\n }\n const expression = __pp_decode_html_entities(source.slice(cursor + 1, closing));\n try {\n result += __pp_render_value(eval(expression));\n } catch {\n result += source.slice(cursor, closing + 1);\n }\n cursor = closing + 1;\n }\n return result;\n};\nconst __pp_dynamic_component = (value) => {\n const renderOne = (entry) => {\n let resolved = entry;\n if (typeof resolved === 'function') resolved = resolved();\n if (typeof resolved === 'boolean' || resolved == null) return '';\n if (resolved && typeof resolved === 'object' && Object.prototype.hasOwnProperty.call(resolved, '__ppRawHtml')) {\n return __pp_interpolate_dynamic_html(resolved.__ppRawHtml);\n }\n return __pp_interpolate_dynamic_html(resolved);\n };\n return __pp_raw_html(Array.isArray(value) ? value.map(renderOne).join('') : renderOne(value));\n};\n"}static escapeTemplateLiteralTextPreservingInterpolations(e){let t="",r=0,i=0;for(;r<e.length;){if("$"===e[r]&&"{"===e[r+1]){let n=this.findClosingBrace(e,r+1);if(-1!==n){t+=this.escapeTemplateLiteralText(e.slice(i,r)),t+=e.slice(r,n+1),r=n+1,i=r;continue}}r++}return t+=this.escapeTemplateLiteralText(e.slice(i)),t}static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2),t=0;for(let r of this.cache.keys()){if(t>=e)break;this.cache.delete(r),t++}}}static maskEscapedBraceEntities(e){let t=new Map,r=0;return{maskedHtml:e.replace(this.ESCAPED_BRACE_ENTITY_PATTERN,e=>{let i=`__PP_ESCAPED_BRACE_${r++}__`;return t.set(i,_(e)),i}),placeholders:t}}static transformSpreadAttributes(e){let t=new Map,r=0,i=document.createElement("template");i.innerHTML=e;let n=e=>{if(e.nodeType===Node.ELEMENT_NODE){let i=e;if(Array.from(i.childNodes).forEach(n),i.hasAttribute("pp-spread")){let e=i.getAttribute("pp-spread")||"";i.removeAttribute("pp-spread");let n=b(e)?.expression.trim()??"";if(n.startsWith("...")){let e=_(n.slice(3).trim()),s=`___pp_spread_${r++}___`,a=`\${ (() => {\n const __obj = ${e};\n if (!__obj || typeof __obj !== 'object') return '';\n return Object.entries(__obj)\n .map(([k, v]) => {\n if (v == null) return '';\n const __attrName = String(k);\n if (!/^[^\\s"'<>/=]+$/.test(__attrName) || /^on/i.test(__attrName)) return '';\n const __escapedValue = String(v)\n .split('&').join('&')\n .split('"').join('"')\n .split("'").join(''')\n .split('<').join('<')\n .split('>').join('>');\n return __attrName + '="' + __escapedValue + '"';\n })\n .filter(Boolean)\n .join(' ');\n })() }`;t.set(s,a),i.setAttribute(s,"")}}}};return Array.from(i.content.childNodes).forEach(n),{html:i.innerHTML,spreadReplacements:t}}static expandSpreadPlaceholders(e,t){let r=e;return t.forEach((e,t)=>{r=r.split(`${t}=""`).join(e),r=r.split(t).join(e)}),r}static transformRefAttributes(e){if(!e.includes("pp-ref"))return e;let t=document.createElement("template");t.innerHTML=e;let r=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),i=r.nextNode();for(;i;){let e=i;if(e.hasAttribute("pp-ref")){let t=b(e.getAttribute("pp-ref")||"");if(t){let r=_(t.expression);e.removeAttribute("pp-ref"),e.setAttribute("data-pp-ref",`{ __pp_ref(${r}) }`)}}i=r.nextNode()}return t.innerHTML}static transformComponentTags(e){let t=document.createElement("template");t.innerHTML=e;let r=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;let t=e,i=t.tagName.toLowerCase();if(Array.from(t.childNodes).forEach(r),i.includes(".")&&!i.endsWith(".provider")){let e=document.createDocumentFragment();for(e.appendChild(document.createTextNode(`{__pp_dynamic_component(${i})}`));t.firstChild;)e.appendChild(t.firstChild);t.replaceWith(e)}};return Array.from(t.content.childNodes).forEach(r),t.innerHTML}static transformContextProviderTags(e){if(!/\.provider\b/i.test(e))return e;let t="",r=0;for(;r<e.length;){let i=e.slice(r).match(/^<([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b/i);if(!i){t+=e[r],r+=1;continue}let n=i[1],s=this.findOpeningTagEnd(e,r);if(-1===s){t+=e[r],r+=1;continue}let a=e.slice(r+i[0].length,s),o=s+1,l=this.findMatchingContextProviderClose(e,o);if(!l){t+=e[r],r+=1;continue}let c=this.transformContextProviderTags(e.slice(o,l.start));t+=`<pp-context-provider data-pp-context-token="{ __pp_context_token(__pp_context_lookup(${`'${n.replace(/\.Provider$/i,"").replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`})) }" data-pp-context-value="{ __pp_context_value(${this.extractContextProviderValueExpression(a)}) }">`+c+"</pp-context-provider>",r=l.end}return t}static findOpeningTagEnd(e,t){let r=null,i=0;for(let n=t;n<e.length;n++){let t=e[n],s=this.isEscaped(e,n);if(r){if("{"===t&&!s){i++;continue}if("}"===t&&!s&&i>0){i--;continue}t===r&&!s&&0===i&&(r=null)}else if(s||'"'!==t&&"'"!==t){if(">"===t)return n}else r=t,i=0}return-1}static findMatchingContextProviderClose(e,t){this.CONTEXT_PROVIDER_TAG_PATTERN.lastIndex=t;let r,i=1;for(;r=this.CONTEXT_PROVIDER_TAG_PATTERN.exec(e);){let e=r[0];if(i+=e.startsWith("</")?-1:1,0===i)return{start:r.index,end:r.index+e.length}}return null}static extractContextProviderValueExpression(e){let t=e.match(/\bvalue\s*=\s*(?:"([\s\S]*?)"|'([\s\S]*?)'|([^\s>]+))/i);if(!t)return"undefined";let r=t[1]??t[2]??t[3]??"",i=b(_(r.trim()));return i?i.expression:JSON.stringify(r)}static normalizeTextareaValueAttributes(e){if(!e.includes("<textarea")||!e.includes("value="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("textarea").forEach(e=>{let t=e,r=t.getAttribute("value");null!==r&&(t.textContent=r,t.removeAttribute("value"))}),t.innerHTML}static transformStyleAliasAttributes(e){if(!e.includes("pp-style"))return e;let t=document.createElement("template");t.innerHTML=e;let r=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),i=r.nextNode();for(;i;){let e=i;if(e.hasAttribute("pp-style")){let t=e.getAttribute("pp-style")??"",r=e.getAttribute("style")??"";e.removeAttribute("pp-style");let i=this.mergeStyleAttributeValues(r,t);i.length>0&&e.setAttribute("style",i)}i=r.nextNode()}return t.innerHTML}static mergeStyleAttributeValues(e,t){let r=e.trim(),i=t.trim().replace(/^;+\s*/,"");return r?i?`${r.endsWith(";")?r:`${r};`} ${i}`:r:i}static transformSelectValueAttributes(e){if(!e.includes("<select")||!e.includes("value="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("select").forEach(e=>{let t=e,r=t.getAttribute("value");if(null===r)return;let i=b(r);if(!i)return;let n=_(i.expression);t.removeAttribute("value"),t.setAttribute("data-pp-select-value",`{ __pp_select_value(${n}) }`)}),t.innerHTML}static transformInputValueAttributes(e){if(!e.includes("<input")||!e.includes("value="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{let t=e,r=t.getAttribute("value");if(null===r)return;let i=b(r);if(!i)return;let n=_(i.expression);t.removeAttribute("value"),t.setAttribute("data-pp-input-value",`{ __pp_input_value(${n}) }`)}),t.innerHTML}static transformCheckedValueAttributes(e){if(!e.includes("<input")||!e.includes("checked="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{let t=e,r=t.getAttribute("checked");if(null===r)return;let i=b(r);if(!i)return;let n=_(i.expression);t.removeAttribute("checked"),t.setAttribute("data-pp-checked-value",`{ __pp_checked_value(${n}) }`)}),t.innerHTML}static transformDefaultValueAttributes(e){if(!e.includes("default"))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input, textarea, select").forEach(e=>{let t=e,r=t.getAttribute("defaultvalue");if(null===r)return;let i=b(r);if(!i)return;let n=_(i.expression);t.removeAttribute("defaultvalue"),t.setAttribute("data-pp-default-value",`{ __pp_default_value(${n}) }`)}),t.innerHTML}static transformDefaultCheckedAttributes(e){if(!e.includes("default"))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{let t=e,r=t.getAttribute("defaultchecked");if(null===r)return;let i=b(r);if(!i)return;let n=_(i.expression);t.removeAttribute("defaultchecked"),t.setAttribute("data-pp-default-checked",`{ __pp_default_checked(${n}) }`)}),t.innerHTML}static transformComponentBoundaryBindings(e,t={}){if(!e.includes("pp-component=")||!e.includes("{"))return{html:e,boundaryReplacements:new Map};let r=document.createElement("template");r.innerHTML=e;let i=new Map,n=0;return r.content.querySelectorAll("[pp-component]").forEach(e=>{let r=e;Array.from(r.attributes).forEach(e=>{let s=e.name;if("pp-component"===s||s.startsWith("on"))return;let a=b(e.value);if(!a)return;let o=this.expandEmbeddedBindingsInStringLiterals(_(a.expression)),l=t.rewriteExpression?.(o),c=l?.evalExpression??o,p=(l?.evalExpression??o).replace(/\\/g,"\\\\").replace(/'/g,"\\'"),h=l?.rawExpressionCode??JSON.stringify(p),u=`___PP_BOUNDARY_ATTR_${n++}___`;i.set(`${s}="${u}"`,`\${__pp_render_value((() => { const __ppAttr = (${c}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${s}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${s}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${s}="{' + ${h} + '}"'); })())}`),r.setAttribute(s,u)})}),{html:r.innerHTML,boundaryReplacements:i}}static expandEmbeddedBindingsInStringLiterals(e){let t="",r=0;for(;r<e.length;){let i=e[r];if('"'!==i&&"'"!==i){t+=e[r],r++;continue}let n=r;r++;let s="";for(;r<e.length;){let t=e[r];if(s+=t,r++,t===i&&!this.isEscaped(s,s.length-1)){s=s.slice(0,-1);break}}s.includes("{")?t+=this.expandEmbeddedBindingsInStringLiteral(s,i)??e.slice(n,r):t+=e.slice(n,r)}return t}static expandEmbeddedBindingsInStringLiteral(e,t){let r=[],i=0,n=0,s=e=>{e.length>0&&r.push(`${t}${e}${t}`)};for(;i<e.length;){if("{"!==e[i]||this.isEscaped(e,i)||this.isServerTemplateBlockStart(e,i)){i++;continue}let t=this.findClosingBrace(e,i);if(-1===t){i++;continue}s(e.slice(n,i));let a=e.slice(i+1,t).trim();a&&r.push(this.stringifyEmbeddedBindingExpression(a)),i=t+1,n=i}return 0===r.length?null:(s(e.slice(n)),`(${r.length>0?r.join(" + "):`${t}${t}`})`)}static stringifyEmbeddedBindingExpression(e){return`((__ppVal) => { if (typeof __ppVal === 'boolean' || __ppVal == null) return ''; if (Array.isArray(__ppVal)) return __ppVal.map((__ppItem) => __ppItem == null || typeof __ppItem === 'boolean' ? '' : String(__ppItem)).join(''); return String(__ppVal); })(${e})`}static compile(e,t){let r=(e||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),i=e=>{let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(16).padStart(8,"0")},s=t.join("\0"),a=`t${i(r)}|k${i(s)}|n${t.length}`;if(this.cache.has(a))return this.cache.get(a);let o=this.transformContextProviderTags(r),{maskedHtml:l,placeholders:c}=this.maskEscapedBraceEntities(o),p=this.escapeLiteralCodeProcessingInstructionOpeners(l),{maskedHtml:h,placeholders:u}=this.maskLiteralHtmlTextNodes(p),{maskedTemplate:d,placeholders:f}=this.maskComplexComponents(h),{maskedHtml:m,placeholders:v}=this.maskLiteralElements(d,"style","STYLE"),{maskedHtml:y,placeholders:x}=this.maskLiteralElements(m,"code","CODE",e=>!this.isPureBindingLiteral(e.innerHTML)),{maskedHtml:C,placeholders:E}=this.maskLiteralElements(y,"script","SCRIPT"),b=this.transformComponentTags(C),S=this.transformStyleAliasAttributes(b),k=this.normalizeTextareaValueAttributes(g(S)),w=t.includes("__pp_input_value")?this.transformInputValueAttributes(k):k,A=t.includes("__pp_checked_value")?this.transformCheckedValueAttributes(w):w,T=this.transformSelectValueAttributes(A),I=this.transformDefaultValueAttributes(T),P=this.transformDefaultCheckedAttributes(I),{html:R,boundaryReplacements:N}=this.transformComponentBoundaryBindings(P),{html:V,spreadReplacements:L}=this.transformSpreadAttributes(R),M=this.transformRefAttributes(V),{html:j,loopReplacements:D}=this.processStructuralDirectives(M),O=this.transformBooleanAttributes(j);(()=>{let e=!0;for(;e;)e=!1,D.forEach((t,r)=>{let i=O;O=O.split("${"+r+"}").join("${"+t+"}"),O=O.split(r).join("{ __pp_raw_html("+t+") }"),O!==i&&(e=!0)})})();let B=new Set,H=this.getRuntimeEscaperSource()+"return `",F=0,U="";for(;F<O.length;){let e=O[F];if("o"===e||"O"===e){let e=O.slice(F,F+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(e){let t=O.slice(F,F+e[0].length),r=t[t.length-1],i=F+e[0].length;for(;i<O.length&&(O[i]!==r||"\\"===O[i-1]);)i++;U+=O.slice(F,i+1),F=i+1;continue}}if("{"===e){if(this.isServerTemplateBlockStart(O,F)){let e=this.findServerTemplateBlockEnd(O,F);if(-1!==e){U+=O.slice(F,e),F=e;continue}}let e=this.findClosingBrace(O,F);if(-1!==e){let t=_(O.slice(F+1,e));if($.isValidExpression(t)){H+=this.escapeTemplateLiteralText(U),U="";let r=$.extractUsedVariables(t,n);for(let e of r)/^___PP_LOOP_\d+___$/.test(e)||B.add(e);let i=t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");H+=`\${ (() => {\n try {\n const __res = (${t});\n return __pp_render_value(__res);\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${i}\\"", e);\n return '';\n }\n })() }`,F=e+1;continue}}}U+=e,F++}H+=this.escapeTemplateLiteralText(U),H+="`;",H=this.expandSpreadPlaceholders(H,L),N.forEach((e,t)=>{H=H.split(t).join(e)});let q=t.slice();try{let e=Function(...q,H),t=(...t)=>{let r=e(...t);return r=this.restorePlaceholders(r,E),r=this.restorePlaceholders(r,x),r=this.restorePlaceholders(r,v),f.forEach((e,t)=>{r=r.split(t).join(e)}),r=this.restorePlaceholders(r,u),r=this.restorePlaceholders(r,c),r};return this.pruneCache(),this.cache.set(a,t),t}catch(e){return console.error("[PP-ERROR] Compilation Failed",e),()=>"Error in Template"}}static maskLiteralElements(e,t,r,i=()=>!0){let n=document.createElement("template");n.innerHTML=e;let s=new Map,a=0;return n.content.querySelectorAll(t).forEach(e=>{if(!i(e))return;let t=`__PP_${r}_${a++}__`;s.set(t,e.outerHTML),e.replaceWith(document.createTextNode(t))}),{maskedHtml:n.innerHTML,placeholders:s}}static maskLiteralHtmlTextNodes(e){let t=document.createElement("template");t.innerHTML=e;let r=new Map,i={value:0},n=document.createTreeWalker(t.content,NodeFilter.SHOW_TEXT),s=[];for(;n.nextNode();)s.push(n.currentNode);return s.forEach(e=>{if(this.isWithinLiteralTextContainer(e))return;let t=e.textContent??"";if(!t.includes("{")&&!t.includes("}"))return;let n=this.splitLiteralHtmlTextSegments(t);if(!n)return;let s="";n.forEach(e=>{s+=e.literalHtml?this.maskLiteralBraces(e.text,r,i):e.text}),e.textContent=s}),{maskedHtml:t.innerHTML,placeholders:r}}static escapeLiteralCodeProcessingInstructionOpeners(e){return e.includes("<?")?e.replace(this.LITERAL_CODE_TAG_PATTERN,(e,t,r,i)=>!r.includes("<?")||this.isPureBindingLiteral(r.trim())?e:`${t}${r.replace(/<\?/g,"<?")}${i}`):e}static isWithinLiteralTextContainer(e){let t=e.parentNode;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){let e=t.tagName.toLowerCase();if("code"===e||"pre"===e||"script"===e||"style"===e)return!0}t=t.parentNode}return!1}static splitLiteralHtmlTextSegments(e){if(!e.includes("<")||!e.includes(">"))return null;let t=document.createElement("template");t.innerHTML=e;let r=Array.from(t.content.childNodes).map(e=>({text:e.nodeType===Node.TEXT_NODE?e.textContent??"":this.serializeNodeHtml(e),literalHtml:e.nodeType!==Node.TEXT_NODE}));return r.some(e=>e.literalHtml)?r:null}static serializeNodeHtml(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";let t=document.createElement("template");return t.content.appendChild(e.cloneNode(!0)),t.innerHTML}static maskLiteralBraces(e,t,r){let i="";for(let n of e){if("{"===n||"}"===n){let e=`__PP_LITERAL_HTML_BRACE_${r.value++}__`;t.set(e,n),i+=e;continue}i+=n}return i}static isPureBindingLiteral(e){return null!==b(e)}static restorePlaceholders(e,t){let r=e;return t.forEach((e,t)=>{r.includes(t)&&(r=r.split(t).join(e))}),r}static transformBooleanAttributes(e){let t="",i=0;for(;i<e.length;){let n=!1;for(let s of r){let r=`${s}="{`,a=`${s}='{`;if(e.startsWith(r,i)){if("checked"===s&&this.isAttributeOnComponentBoundary(e,i))continue;let a=i+r.length-1;if(this.isServerTemplateBlockStart(e,a))continue;n=!0;let o=this.findClosingBrace(e,a);if(-1!==o&&'"'===e[o+1]){let r=_(e.slice(a+1,o)),n=r.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${r}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${s}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${s}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${s}="{${n}}"'); })() }`,i=o+2;break}}else if(e.startsWith(a,i)){if("checked"===s&&this.isAttributeOnComponentBoundary(e,i))continue;let r=i+a.length-1;if(this.isServerTemplateBlockStart(e,r))continue;n=!0;let o=this.findClosingBrace(e,r);if(-1!==o&&"'"===e[o+1]){let n=_(e.slice(r+1,o)),a=n.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${n}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${s}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${s}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${s}="{${a}}"'); })() }`,i=o+2;break}}}n||(t+=e[i],i++)}return t}static isAttributeOnComponentBoundary(e,t){let r=e.lastIndexOf("<",t);if(-1===r||e.lastIndexOf(">",t)>r)return!1;let i=this.findOpeningTagEnd(e,r);if(-1===i||t>i)return!1;let n=e.slice(r,r+2);if("</"===n||"<!"===n||"<?"===n)return!1;let s=e.slice(r,i+1);return/\spp-component(?:\s|=|>)/i.test(s)}static captureLoopVariablesInEventHandlers(e,t,r,i,n=!1,s=[]){let a="",o=0;for(;o<e.length;){let l=e.slice(o,o+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(l){let c=l[0].length,p=e.slice(o,o+c),h=p[p.length-1],u=o+c,d=u;for(;d<e.length&&(e[d]!==h||"\\"===e[d-1]);)d++;let f=p.slice(0,-2).trim(),m=e.slice(u,d);m=this.rewriteLoopEventHandlerCode(m,t,r,i,n,s),a+=`${f}=${h}${m}${h}`,o=d+1;continue}a+=e[o],o++}return a}static rewriteLoopEventHandlerCode(e,t,r,i,n,s=[]){let a=b(e),o=_(a?a.expression:e),l=r,c=o;s.forEach(e=>{l=this.applyLoopContextRewrites(l,e),c=this.applyLoopContextRewrites(c,e)});let p={iterator:t,collectionName:l,indexVar:i,userDefinedIndex:n};return c=this.applyLoopContextRewrites(c,p),[...s,p].forEach(e=>{let t=this.getLoopIndexToken(e.indexVar);c=c.split(t).join(`\${${e.indexVar}}`)}),a?`{${c}}`:c}static getLoopIndexToken(e){return`__PP_LOOP_IDX_${e}__`}static applyLoopContextRewrites(e,t){let r=this.getLoopIndexToken(t.indexVar),i=e;return t.userDefinedIndex&&(i=this.replaceLoopIdentifierUsages(i,t.indexVar,r)),this.replaceLoopIdentifierUsages(i,t.iterator,`(${t.collectionName})[${r}]`)}static replaceLoopIdentifierUsages(e,t,r){let i=$.analyzeLoopVariableUsage(e,t).slice().sort((e,t)=>t.start-e.start);if(0===i.length)return e;let n=e;return i.forEach(e=>{let i=e.isShorthand?this.buildShorthandReplacement(t,r,e.isUnwrap):r;n=n.slice(0,e.start)+i+n.slice(e.end)}),n}static buildShorthandReplacement(e,t,r){return r?`{ ${e}: ${t} }`:`${e}: ${t}`}static createLoopBoundaryBindingRewrite(e,t,r,i,n=[]){return s=>{let a=t,o=s;n.forEach(e=>{a=this.applyLoopContextRewrites(a,e),o=this.applyLoopContextRewrites(o,e)});let l={iterator:e,collectionName:a,indexVar:r,userDefinedIndex:i},c=[...n,l];return o=this.applyLoopContextRewrites(o,l),{evalExpression:this.replaceLoopIndexTokensForEvaluation(o,c),rawExpressionCode:this.buildLoopRawExpressionCode(o,c)}}}static replaceLoopIndexTokensForEvaluation(e,t){let r=e;return t.forEach(e=>{r=r.split(this.getLoopIndexToken(e.indexVar)).join(e.indexVar)}),r}static buildLoopRawExpressionCode(e,t){let r=JSON.stringify(e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"));return t.forEach(e=>{r=r.split(this.getLoopIndexToken(e.indexVar)).join(`" + ${e.indexVar} + "`)}),r}static isIdentifier(e){return/^[A-Za-z_$][\w$]*$/.test(e)}static stripBalancedParens(e){let t=e.trim();return t.startsWith("(")&&this.findMatchingToken(t,0,"(",")")===t.length-1?t.slice(1,-1).trim():null}static parseLoopDirective(e){let t=this.findTopLevelInSeparator(e);if(-1===t)return null;let r=e.slice(0,t).trim(),i=e.slice(t+2).trim();if(!r||!i)return null;let n=this.stripBalancedParens(r);if(null!==n){let e=this.findTopLevelToken(n,",");if(-1===e)return null;let t=n.slice(0,e).trim(),r=n.slice(e+1).trim();return t&&r?{iterator:t,indexVar:r,collection:i}:null}return{iterator:r,indexVar:null,collection:i}}static findTopLevelInSeparator(e){let t={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let r=0;r<e.length;r++){let i=e[r];if(!this.advanceScannerState(t,e,r)&&0===t.parenDepth&&0===t.bracketDepth&&0===t.braceDepth&&"i"===i&&"n"===e[r+1]&&/\s/.test(e[r-1]??"")&&/\s/.test(e[r+2]??""))return r}return-1}static findTopLevelToken(e,t){let r={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let i=0;i<e.length;i++)if(!this.advanceScannerState(r,e,i)&&0===r.parenDepth&&0===r.bracketDepth&&0===r.braceDepth&&e[i]===t)return i;return-1}static findMatchingToken(e,t,r,i){let n=0,s=null;for(let a=t;a<e.length;a++){let t=e[a],o=this.isEscaped(e,a);if(s)t===s&&!o&&(s=null);else if(o||'"'!==t&&"'"!==t&&"`"!==t)if(t!==r||o){if(t===i&&!o&&(n--,0===n))return a}else n++;else s=t}return-1}static advanceScannerState(e,t,r){let i=t[r],n=this.isEscaped(t,r);return e.quote?(i===e.quote&&!n&&(e.quote=null),!0):n||'"'!==i&&"'"!==i&&"`"!==i?(n||("("===i?e.parenDepth++:")"===i?e.parenDepth--:"["===i?e.bracketDepth++:"]"===i?e.bracketDepth--:"{"===i?e.braceDepth++:"}"===i&&e.braceDepth--),!1):(e.quote=i,!0)}static isEscaped(e,t){let r=0,i=t-1;for(;i>=0&&"\\"===e[i];)r++,i--;return r%2!=0}static processStructuralDirectives(e){if(!e.includes("pp-for"))return{html:e,loopReplacements:new Map};let t=document.createElement("template");t.innerHTML=e;let r=new Map,i=0,n=0,s=(e,t=[])=>{let a=Array.from(e.childNodes);for(let e of a){if(e.nodeType!==Node.ELEMENT_NODE)continue;let a=e,o="TEMPLATE"===a.tagName,l="template"===a.tagName&&"template"===a.localName;if(o||l){let e=a,o=e.getAttribute("pp-for")||"",l=null;if(e.hasAttribute("pp-for")){let e,t,r,i=this.parseLoopDirective(o),s=!1;if(!i){console.warn(`[PP-WARN] Invalid pp-for directive skipped: "${o}"`);continue}if(e=i.iterator,r=i.collection,t=i.indexVar??"__pp_idx_"+n++,s=null!==i.indexVar,!this.isIdentifier(e)||s&&!this.isIdentifier(t)){console.warn(`[PP-WARN] pp-for currently expects identifier loop variables: "${o}"`);continue}if(!$.isValidExpression(r)){console.warn(`[PP-WARN] Invalid pp-for collection expression skipped: "${r}"`);continue}l={iterator:e,collectionName:r,indexVar:t,userDefinedIndex:s}}if(s(e.content??e,l?[...t,l]:t),l){let{iterator:n,collectionName:s,indexVar:a,userDefinedIndex:o}=l,c=e.innerHTML;c=this.transformContextProviderTags(c),c=this.transformComponentTags(c),c=this.transformRefAttributes(c),c=this.transformStyleAliasAttributes(c);let{html:p,boundaryReplacements:h}=this.transformComponentBoundaryBindings(c,{rewriteExpression:this.createLoopBoundaryBindingRewrite(n,s,a,o,t)});c=p,c=this.captureLoopVariablesInEventHandlers(c,n,s,a,o,t),c=c.replace(/___PP_LOOP_\d+___/g,e=>"${"+e+"}"),c=c.replace(/\r/g,""),c=this.transformBooleanAttributes(c),c=this.transformInterpolations(c),c=this.escapeTemplateLiteralTextPreservingInterpolations(c),h.forEach((e,t)=>{c=c.split(t).join(e)});let u=`(Array.isArray(${s}) ? ${s} : []).map((${n}, ${a}) => \`${c}\`).join('')`,d=`___PP_LOOP_${i++}___`;r.set(d,u),e.replaceWith(document.createTextNode(d));continue}continue}s(a,t)}};return s(t.content),{html:t.innerHTML,loopReplacements:r}}static transformInterpolations(e){let t="",r=0;for(;r<e.length;){if("o"===e[r]||"O"===e[r]){let i=e.slice(r,r+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(i){let n=e.slice(r,r+i[0].length),s=n[n.length-1],a=r+i[0].length;for(;a<e.length&&(e[a]!==s||"\\"===e[a-1]);)a++;t+=e.slice(r,a+1),r=a+1;continue}}if("{"===e[r]){if(r>0&&"$"===e[r-1]){t+="{",r++;continue}if(this.isServerTemplateBlockStart(e,r)){let i=this.findServerTemplateBlockEnd(e,r);if(-1!==i){t+=e.slice(r,i),r=i;continue}}let i=this.findClosingBrace(e,r);if(-1!==i){let n=_(e.slice(r+1,i));if($.isValidExpression(n)){t+="${__pp_render_value("+n+")}",r=i+1;continue}}}t+=e[r],r++}return t}static maskComplexComponents(e){if(!e.includes("pp-component="))return{maskedTemplate:e,placeholders:new Map};let t=document.createElement("template");t.innerHTML=e;let r=new Map,i=0,n=e=>e.replace(/&/g,"&").replace(/"/g,"""),s=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),a=(e,t)=>{if(!e.includes("{"))return e;let n="",s=0;for(;s<e.length;){let a=e[s];if("{"===a&&"$"!==e[s-1]){let a=y(e,s);if(-1!==a){let o=`__PP_CHILD_${i++}__`;r.set(o,t(e.slice(s,a+1))),n+=o,s=a+1;continue}}n+=a,s++}return n},o=e=>{Array.from(e.attributes).forEach(t=>{t.value.includes("{")&&e.setAttribute(t.name,a(t.value,n))})},l=(e,t)=>{Array.from(e.childNodes).forEach(e=>{if(e.nodeType===Node.TEXT_NODE){if(!t){let t=e.textContent??"";t.includes("{")&&(e.textContent=a(t,s))}return}if(e.nodeType!==Node.ELEMENT_NODE)return;let n=e;if("script"===n.tagName.toLowerCase()){let e=`__PP_CHILD_${i++}__`;return r.set(e,n.outerHTML),void n.replaceWith(document.createTextNode(e))}if(!(n instanceof HTMLTemplateElement&&n.hasAttribute("pp-owner")))return n.hasAttribute("pp-component")?(t||o(n),void l(n,!1)):(t||o(n),void l(n instanceof HTMLTemplateElement?n.content:n,t));l(n.content,!0)})},c=(e,t=!1)=>{if(e instanceof Element){if(e.hasAttribute("pp-component")){let n=!!e.querySelector("script"),s=!!e.querySelector("template[pp-owner]");if(n||s){if(t)n&&l(e,!1);else{let t=`__PP_CHILD_${i++}__`;r.set(t,e.outerHTML),e.replaceWith(document.createTextNode(t))}return}}if(e instanceof HTMLTemplateElement)return void c(e.content,!0)}Array.from(e.children).forEach(e=>c(e,t))};return c(t.content),{maskedTemplate:t.innerHTML,placeholders:r}}static findClosingBrace(e,t){return y(e,t)}static isServerTemplateBlockStart(e,t){return te(e,t)}static findServerTemplateBlockEnd(e,t){return ne(e,t)}},gn=class{componentId;bindingSeq=0;activeBindings=new Map;constructor(e){this.componentId=e}ensureBindingId(e,t){let r="captured"===t?"__ppCapturedRefBindingId":"__ppPlainRefBindingId";return e[r]||(e[r]=`pprefbind_${this.componentId}_${t}_${++this.bindingSeq}`),e[r]}commit(e){for(let[t,r]of this.activeBindings.entries()){let i=e.get(t);i?(r.value!==i.value||r.element!==i.element)&&this.clearValue(r.value,"[PP-WARN] Ref cleanup failed"):this.clearValue(r.value,"[PP-WARN] Ref cleanup failed")}for(let[t,r]of e.entries()){let e=this.activeBindings.get(t);e&&e.value===r.value&&e.element===r.element||this.attachValue(r.value,r.element,"[PP-WARN] Ref attachment failed")}this.activeBindings=e}clearAll(){for(let e of this.activeBindings.values())this.clearValue(e.value,"[PP-WARN] Ref cleanup failed");this.activeBindings.clear()}attachValue(e,t,r){this.updateValue(e,t,r)}clearValue(e,t){this.updateValue(e,null,t)}updateValue(e,t,r){try{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)}catch(e){console.warn(r,e)}}},_n=class{componentId;trackedPortals=new Map;constructor(e){this.componentId=e}get size(){return this.trackedPortals.size}has(e){return this.trackedPortals.has(e)}get(e){return this.trackedPortals.get(e)}getPlaceholderText(e){return this.trackedPortals.get(e)?.placeholder.data||`pp-portal:${this.componentId}`}apply(e){let t=new Set,r=!1;for(let i of e){let e=i.ref.current;if(!e)continue;let n=i.target??document.body;t.add(e);let s=this.trackedPortals.get(e);if(s?.placeholder.parentNode){s.target!==n&&(n.appendChild(e),s.target=n,r=!0);continue}null===i.info.sourceParent&&e.parentNode instanceof Element&&(i.info.sourceParent=e.parentNode);let a=document.createComment(`pp-portal:${this.componentId}`);e.parentNode&&e.parentNode.insertBefore(a,e),n.appendChild(e),this.trackedPortals.set(e,{element:e,placeholder:a,target:n}),r=!0}for(let[e,i]of this.trackedPortals)t.has(e)||(i.placeholder.parentNode?(i.placeholder.parentNode.insertBefore(e,i.placeholder),i.placeholder.remove()):e.parentNode&&e.remove(),this.trackedPortals.delete(e),r=!0);return r}replaceElement(e,t){let r=this.trackedPortals.get(e);r&&(this.trackedPortals.delete(e),this.trackedPortals.set(t,{...r,element:t}))}contains(e){for(let[t]of this.trackedPortals)if(t===e||t.contains(e))return!0;return!1}elements(){return Array.from(this.trackedPortals.keys())}values(){return Array.from(this.trackedPortals.values())}destroyAll(){for(let[,e]of this.trackedPortals)e.element.parentNode&&e.element.remove(),e.placeholder.parentNode&&e.placeholder.remove();this.trackedPortals.clear()}},vn=class t{static DATE_LIKE_INPUT_TYPES=new Set(["date","datetime-local","month","time","week"]);static TEXT_SELECTION_INPUT_TYPES=new Set(["text","search","url","tel","password"]);registeredResetForms=new Set;applyControlledSelectValue(e,t){if(e.multiple){let r=new Set(this.normalizeControlledSelectValues(t));for(let t=0;t<e.options.length;t++){let i=e.options[t],n=r.has(i.value);i.selected!==n&&(i.selected=n)}return}let r=null==t?"":String(t);e.value!==r&&(e.value=r)}applyControlledInputValue(e,t){let r=null==t?"":String(t);this.shouldDeferFocusedDateLikeInputValue(e,r)?this.deferFocusedControlledInputValue(e,t):this.shouldDeferActiveNativeTextInputValue(e,r)||e.value!==r&&(e.value=r)}bindControlledSelectValues(e,t){for(let r=0;r<e.length;r++){let i=e[r];if(!(i instanceof HTMLSelectElement))continue;let n=this.resolveControlledSelectCaptureId(i,t);n&&(this.trackValueControlMode(i,"controlled"),this.applyControlledSelectValue(i,t.get(n)))}}bindControlledInputValues(e,t){for(let r=0;r<e.length;r++){let i=e[r];if(!(i instanceof HTMLInputElement))continue;let n=this.resolveControlledInputValue(i,t);n.hasValue&&(this.trackValueControlMode(i,"controlled"),this.applyControlledInputValue(i,n.value))}}bindControlledCheckedValues(e,t){for(let r=0;r<e.length;r++){let i=e[r];if(!(i instanceof HTMLInputElement))continue;let n=this.resolveControlledCheckedValue(i,t);if(!n.hasValue)continue;this.trackCheckedControlMode(i,"controlled");let s=!!n.value;i.checked!==s&&(i.checked=s)}}applyUncontrolledDefaultValue(e,t){if(e instanceof HTMLSelectElement)return void this.applyUncontrolledDefaultSelectValue(e,t);let r=null==t?"":String(t);this.trackValueControlMode(e,"uncontrolled"),e.defaultValue!==r&&(e.defaultValue=r),e.value!==r&&(e.value=r),e.__ppHasUncontrolledDefaultValue=!0}applyUncontrolledDefaultChecked(e,t){let r=this.normalizeDefaultCheckedValue(t);this.trackCheckedControlMode(e,"uncontrolled"),e.defaultChecked!==r&&(e.defaultChecked=r),e.checked!==r&&(e.checked=r),e.__ppHasUncontrolledDefaultChecked=!0}restoreUncontrolledSelectState(e){let t=Array.from(e.options);if(e.multiple)return void t.forEach(e=>{e.selected=e.defaultSelected});let r=t.find(e=>e.defaultSelected);r?e.value=r.value:t.length>0&&(e.selectedIndex=0)}isUncontrolledResetManagedElement(e){let t=e;return!(!t.__ppHasUncontrolledDefaultValue&&!t.__ppHasUncontrolledDefaultChecked)||e instanceof HTMLSelectElement&&Array.from(e.options).some(e=>e.defaultSelected)}syncUncontrolledFormResets(e,t,r){let i=new Set;for(let n=0;n<t.length;n++){let s=t[n];if(!(s.__ppHasUncontrolledDefaultValue||s.__ppHasUncontrolledDefaultChecked||s instanceof HTMLSelectElement))continue;let a=s.closest("form");a instanceof HTMLFormElement&&this.isUncontrolledResetManagedElement(s)&&(i.add(a),this.registerResetHandler(a,e,()=>{this.restoreUncontrolledFormDefaults(a,r())}))}for(let t of this.registeredResetForms)i.has(t)||this.unregisterResetHandler(t,e);this.registeredResetForms=i}clearResetHandlers(e){for(let t of this.registeredResetForms)this.unregisterResetHandler(t,e);this.registeredResetForms.clear()}restoreUncontrolledFormDefaults(e,t){for(let r=0;r<t.length;r++){let i=t[r],n=i;if(i.closest("form")===e){if(i instanceof HTMLSelectElement){this.restoreUncontrolledSelectState(i);continue}(i instanceof HTMLInputElement||i instanceof HTMLTextAreaElement)&&n.__ppHasUncontrolledDefaultValue&&(i.value=i.defaultValue),i instanceof HTMLInputElement&&n.__ppHasUncontrolledDefaultChecked&&(i.checked=i.defaultChecked)}}}resolveDefaultValueBinding(e,t){let r=e.getAttribute("data-pp-default-value");if(r){if(e.removeAttribute("data-pp-default-value"),e.__ppDefaultValueCaptureId=r,t.has(r))return t.get(r)}else if(e.__ppDefaultValueCaptureId){if(t.has(e.__ppDefaultValueCaptureId))return t.get(e.__ppDefaultValueCaptureId);delete e.__ppDefaultValueCaptureId}return"__ppResolvedDefaultValue"in e?e.__ppResolvedDefaultValue:e.hasAttribute("defaultvalue")?e.getAttribute("defaultvalue"):void 0}resolveDefaultCheckedBinding(e,t){let r=e.getAttribute("data-pp-default-checked");if(r){if(e.removeAttribute("data-pp-default-checked"),e.__ppDefaultCheckedCaptureId=r,t.has(r))return t.get(r)}else if(e.__ppDefaultCheckedCaptureId){if(t.has(e.__ppDefaultCheckedCaptureId))return t.get(e.__ppDefaultCheckedCaptureId);delete e.__ppDefaultCheckedCaptureId}return"__ppResolvedDefaultChecked"in e?e.__ppResolvedDefaultChecked:e.hasAttribute("defaultchecked")?e.getAttribute("defaultchecked"):void 0}materializeNestedBoundaryFormDefaults(e,t){let r=e,i=e.getAttribute("data-pp-input-value")??r.__ppInputValueCaptureId;if(i&&t.inputValueStore.has(i)){let n=t.inputValueStore.get(i);if(e.removeAttribute("data-pp-input-value"),r.__ppInputValueCaptureId=i,r.__ppResolvedInputValue=n,e instanceof HTMLInputElement)this.applyControlledInputValue(e,n);else if(e instanceof HTMLSelectElement)this.applyControlledSelectValue(e,n);else if(e instanceof HTMLTextAreaElement){let t=null==n?"":String(n);e.value!==t&&(e.value=t)}}let n=e.getAttribute("data-pp-default-value");if(n&&t.defaultValueStore.has(n)&&(e.removeAttribute("data-pp-default-value"),e.__ppResolvedDefaultValue=t.defaultValueStore.get(n)),!(e instanceof HTMLInputElement))return;let s=e,a=e.getAttribute("data-pp-checked-value")??s.__ppCheckedValueCaptureId;if(a&&t.checkedValueStore.has(a)){let r=t.checkedValueStore.get(a);e.removeAttribute("data-pp-checked-value"),s.__ppCheckedValueCaptureId=a;let i=!!r;e.checked!==i&&(e.checked=i)}let o=e.getAttribute("data-pp-default-checked");o&&t.defaultCheckedStore.has(o)&&(e.removeAttribute("data-pp-default-checked"),e.__ppResolvedDefaultChecked=t.defaultCheckedStore.get(o))}normalizeControlledSelectValues(e){return null==e?[]:Array.isArray(e)?e.filter(e=>null!=e).map(e=>String(e)):[String(e)]}applyUncontrolledDefaultSelectValue(e,t){this.trackValueControlMode(e,"uncontrolled");let r=this.normalizeControlledSelectValues(t),i=e.multiple?new Set(r):new Set(r.length>0?[r[0]]:[]);for(let t=0;t<e.options.length;t++){let r=e.options[t],n=r,s=i.has(r.value);r.defaultSelected!==s&&(r.defaultSelected=s),r.selected!==s&&(r.selected=s),s?n.__ppHasUncontrolledDefaultSelected=!0:delete n.__ppHasUncontrolledDefaultSelected}if(!e.multiple){let t=r.length>0?r[0]:"";e.value!==t&&(e.value=t)}}resolveControlledSelectCaptureId(e,t){let r=e.getAttribute("data-pp-select-value"),i=null;return r?(e.removeAttribute("data-pp-select-value"),e.__ppSelectValueCaptureId=r,i=r):e.__ppSelectValueCaptureId&&t.has(e.__ppSelectValueCaptureId)?i=e.__ppSelectValueCaptureId:e.__ppSelectValueCaptureId&&delete e.__ppSelectValueCaptureId,i}resolveControlledInputValue(e,t){let r,i=e.getAttribute("data-pp-input-value"),n=!1;return i?(e.removeAttribute("data-pp-input-value"),e.__ppInputValueCaptureId=i,t.has(i)&&(r=t.get(i),n=!0)):e.__ppInputValueCaptureId&&t.has(e.__ppInputValueCaptureId)?(r=t.get(e.__ppInputValueCaptureId),n=!0):"__ppResolvedInputValue"in e?(r=e.__ppResolvedInputValue,n=!0):e.__ppInputValueCaptureId&&delete e.__ppInputValueCaptureId,{hasValue:n,value:r}}resolveControlledCheckedValue(e,t){let r,i=e.getAttribute("data-pp-checked-value"),n=!1;if(i)e.removeAttribute("data-pp-checked-value"),e.__ppCheckedValueCaptureId=i,t.has(i)&&(r=t.get(i),n=null!=r);else{let i=e.__ppCheckedValueCaptureId;i&&t.has(i)?(r=t.get(i),n=null!=r):i&&delete e.__ppCheckedValueCaptureId}return{hasValue:n,value:r}}trackValueControlMode(e,t){let r=e,i=r.__ppValueControlMode;i?i!==t&&(r.__ppWarnedValueControlModeSwitch||(r.__ppWarnedValueControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${i} to ${t}. Choose either a controlled value binding or an uncontrolled defaultValue for the lifetime of the element.`)),r.__ppValueControlMode=t):r.__ppValueControlMode=t}describeControl(e){let t=e.tagName.toLowerCase(),r=e.id?`#${e.id}`:"",i=e.getAttribute("name");return`${t}${r}${!r&&i?`[name="${i}"]`:""}`}trackCheckedControlMode(e,t){let r=e,i=r.__ppCheckedControlMode;i?i!==t&&(r.__ppWarnedCheckedControlModeSwitch||(r.__ppWarnedCheckedControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${i} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)),r.__ppCheckedControlMode=t):r.__ppCheckedControlMode=t}registerResetHandler(t,r,i){let n=t;n.__ppResetCallbacks||=new Map,n.__ppResetCallbacks.set(r,i),!n.__ppOriginalReset&&(n.__ppOriginalReset=t.reset,t.reset=function(){n.__ppOriginalReset?.call(this),n.__ppResetCallbacks?.forEach((t,i)=>{e.getInstance(i)||i===r?t():n.__ppResetCallbacks?.delete(i)})})}unregisterResetHandler(e,t){let r=e;r.__ppResetCallbacks?.delete(t),!(r.__ppResetCallbacks&&r.__ppResetCallbacks.size>0)&&(r.__ppOriginalReset&&(e.reset=r.__ppOriginalReset,delete r.__ppOriginalReset),delete r.__ppResetCallbacks)}normalizeDefaultCheckedValue(e){if("string"==typeof e){let t=e.trim().toLowerCase();if(""===t||"true"===t)return!0;if("false"===t||"0"===t||"off"===t||"no"===t)return!1}return!!e}isDateLikeInput(e){return t.DATE_LIKE_INPUT_TYPES.has(e.type)}shouldDeferFocusedDateLikeInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!this.isDateLikeInput(e))&&e.value!==t}shouldDeferActiveNativeTextInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!e.__ppPreserveNativeSelectionOnNextRender)&&(this.isTextSelectionControl(e)&&e.value!==t)}isTextSelectionControl(e){return t.TEXT_SELECTION_INPUT_TYPES.has(e.type)}deferFocusedControlledInputValue(e,t){if(e.__ppDeferredControlledValue=t,e.__ppDeferredControlledBlurHandler)return;let r=()=>{let t=e.__ppDeferredControlledValue;if(delete e.__ppDeferredControlledValue,delete e.__ppDeferredControlledBlurHandler,!e.isConnected)return;let r=null==t?"":String(t);e.value!==r&&(e.value=r)};e.__ppDeferredControlledBlurHandler=r,e.addEventListener("blur",r,{once:!0})}},yn=class{componentId;getParentId;isCurrentInstance;isRendering;forceUpdate;pendingProvidedContexts=new Map;pendingContextTokens=new Set;activeProviderBoundaryIds=new Set;refreshPending=!1;warnedContextOutsideRender=!1;constructor(e,t,r,i,n){this.componentId=e,this.getParentId=t,this.isCurrentInstance=r,this.isRendering=i,this.forceUpdate=n}prepareRender(){this.pendingProvidedContexts=new Map,this.pendingContextTokens=new Set}consume(t){return!this.isRendering()&&!this.warnedContextOutsideRender&&(this.warnedContextOutsideRender=!0,console.warn(`[PP-WARN] pp.context(...) should be called while component "${this.componentId}" is rendering. Move context reads to the component script body and pass values to event handlers through closure state.`)),this.pendingContextTokens.add(t),e.resolveContext(this.getParentId(),t).value}provide(e,t){this.pendingProvidedContexts.set(e,t)}commitRenderContexts(){let t=e.saveContextValues(this.componentId,this.pendingProvidedContexts);return e.updateContextDependencies(this.componentId,this.pendingContextTokens),t.length>0?e.getConsumersForContextsInSubtree(this.componentId,t):null}syncProviderBoundary(t,r,i,n){e.saveParent(t,r);let s=e.saveContextValues(t,new Map([[i,n]]));return s.length>0?e.getConsumersForContextsInSubtree(t,s):new Set}replaceActiveProviderBoundaries(t){let r=new Set;return this.activeProviderBoundaryIds.forEach(i=>{t.has(i)||e.removeContextTracking(i).forEach(e=>r.add(e))}),this.activeProviderBoundaryIds=t,r}requestRefresh(){this.refreshPending||(this.refreshPending=!0,queueMicrotask(()=>{if(this.refreshPending=!1,this.isCurrentInstance()){if(this.isRendering())return void this.requestRefresh();this.forceUpdate()}}))}refreshConsumers(t){for(let r of t)e.getInstance(r)?.requestContextRefresh?.()}destroy(){return this.activeProviderBoundaryIds.forEach(t=>{e.removeContextTracking(t)}),this.activeProviderBoundaryIds.clear(),e.removeContextTracking(this.componentId)}},bn=new Set(["text","search","url","tel","password"]),xn=class{getRoot;containsPortalElement;collectManagedInputs;isDateLikeInput;constructor(e,t,r,i){this.getRoot=e,this.containsPortalElement=t,this.collectManagedInputs=r,this.isDateLikeInput=i}save(e){let t=document.activeElement;if(!t)return null;let r=this.getRoot().contains(t),i=!r&&this.containsPortalElement(t);if(!r&&!i)return null;let n=(e??this.collectManagedInputs()).indexOf(t);if(-1===n)return null;let s=this.getTextSelectionState(t);return{element:t,index:n,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd}}restore(e,t){if(!e)return;let r=e.element,i=this.getRoot(),n=r&&r.isConnected&&(i.contains(r)||this.containsPortalElement(r))?r:(t??this.collectManagedInputs())[e.index];if(!n)return;let s=n===document.activeElement,a=n;if(!(s&&n instanceof HTMLInputElement&&this.isDateLikeInput(n))&&(s||n.focus(),null!==e.selectionStart&&null!==e.selectionEnd&&this.isTextSelectionControl(n))){if(s&&a.__ppPreserveNativeSelectionOnNextRender)return void delete a.__ppPreserveNativeSelectionOnNextRender;if(s&&n.selectionStart===e.selectionStart&&n.selectionEnd===e.selectionEnd)return;try{n.setSelectionRange(e.selectionStart,e.selectionEnd)}catch(e){console.warn("Could not restore cursor position",e)}}}isTextSelectionControl(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&bn.has(e.type)}getTextSelectionState(e){if(!this.isTextSelectionControl(e))return{selectionStart:null,selectionEnd:null};try{return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd}}catch{return{selectionStart:null,selectionEnd:null}}}},Sn=class{options;constructor(e){this.options=e}morphChildren(e,t){if(this.hasKeyedDirectChildren(e)||this.hasKeyedDirectChildren(t))return void this.morphKeyedChildren(e,t);let r=e.firstChild,i=t.firstChild;for(;r||i;){let t=r?.nextSibling??null,n=i?.nextSibling??null;if(i){if(!r){let t=i.cloneNode(!0);e.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(t),i=n;continue}if(r.nodeType!==i.nodeType){let s=i.cloneNode(!0);e.replaceChild(s,r),s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s),r=t,i=n;continue}r.nodeType!==Node.TEXT_NODE?(r.nodeType===Node.ELEMENT_NODE&&this.morphCompatibleElement(e,r,i),r=t,i=n):(r.textContent!==i.textContent&&(r.textContent=i.textContent),r=t,i=n)}else r&&e.removeChild(r),r=t}}morphCompatibleElement(e,t,r){if(t.tagName!==r.tagName){let i=r.cloneNode(!0);return e.replaceChild(i,t),void(i.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(i))}if(t.hasAttribute("pp-component")&&t!==this.options.root){if(!this.options.syncNestedBoundaryAttributes(t,r)){let i=r.cloneNode(!0);return e.replaceChild(i,t),void(i.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(i))}this.options.hasEventAttributes(t)&&this.options.collectEventElements(t)}else this.options.syncAttributes(t,r),this.options.hasEventAttributes(t)&&this.options.collectEventElements(t),!(t instanceof HTMLTextAreaElement)&&this.morphChildren(t,r)}hasKeyedDirectChildren(e){let t=e.childNodes;for(let e=0;e<t.length;e++){let r=t[e];if(null!==this.getNodeKey(r))return!0}return!1}getNodeKey(e){if(e.nodeType!==Node.ELEMENT_NODE)return null;let t=e.getAttribute("key");return t&&t.length>0?t:null}areNodesCompatible(e,t){if(e.nodeType!==t.nodeType)return!1;if(e.nodeType!==Node.ELEMENT_NODE)return!0;let r=t;if(e.tagName!==r.tagName)return!1;let i=this.getNodeKey(e),n=this.getNodeKey(t);return null===i&&null===n||null!==i&&i===n}morphKeyedChildren(e,t){let r=Array.from(e.childNodes),i=Array.from(t.childNodes),n=this.collectDuplicateKeys(i),s=new Map,a=new Set,o=new Map;n.length>0&&console.warn(`[PP-WARN] Duplicate key values detected: ${n.join(", ")}`);let l=e=>{a.add(e);let t=this.getUnkeyedNodeSignature(e),r=o.get(t);r?r.push(e):o.set(t,[e])},c=e=>{let t=this.getUnkeyedNodeSignature(e),r=o.get(t);for(;r&&r.length>0;){let i=r.shift();if(a.delete(i),this.areNodesCompatible(i,e))return 0===r.length&&o.delete(t),i}o.delete(t)};r.forEach(e=>{let t=this.getNodeKey(e);if(null===t)return void l(e);let r=s.get(t);r?r.push(e):s.set(t,[e])});let p=e.firstChild;i.forEach(t=>{let r,i=this.getNodeKey(t);if(null!==i){let e=s.get(i);for(;e&&e.length>0;){let i=e.shift();if(this.areNodesCompatible(i,t)){r=i;break}l(i)}}else r=c(t);if(r)r!==p&&e.insertBefore(r,p);else{let i=t.cloneNode(!0);e.insertBefore(i,p),i.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(i),r=i}this.morphNode(r,t),p=r.nextSibling}),a.forEach(t=>{t.parentNode===e&&e.removeChild(t)}),s.forEach(t=>{t.forEach(t=>{t.parentNode===e&&e.removeChild(t)})})}collectDuplicateKeys(e){let t=new Set,r=new Set;return e.forEach(e=>{let i=this.getNodeKey(e);if(null!==i){if(t.has(i))return void r.add(i);t.add(i)}}),Array.from(r.values())}getUnkeyedNodeSignature(e){return e.nodeType===Node.ELEMENT_NODE?`element:${e.tagName}`:`node:${e.nodeType}`}morphNode(e,t){if(e.nodeType!==t.nodeType){let r=e.parentNode;if(!r)return;let i=t.cloneNode(!0);return r.replaceChild(i,e),void(i.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(i))}if(e.nodeType===Node.TEXT_NODE)return void(e.textContent!==t.textContent&&(e.textContent=t.textContent));if(e.nodeType!==Node.ELEMENT_NODE)return;let r=e,i=t,n=r.parentNode;n&&this.morphCompatibleElement(n,r,i)}},Cn=class t{componentId;constructor(e){this.componentId=e}extractOwnedTemplates(e){let t=new Map,r=e.querySelectorAll("template[pp-owner]"),i=0;return r.forEach(r=>{if(r.parentElement?.closest("[pp-component]")!==e)return;let n=r.getAttribute("pp-owner");if(!n)return;let s=`__PP_OWNED_${this.componentId}_${i++}__`;t.set(s,{ownerId:n,content:r.innerHTML,contextTag:r.parentElement?.tagName.toLowerCase()??null}),r.replaceWith(document.createComment(s))}),t}resolveOwnedChildren(t,r){if(!t.includes("__PP_OWNED_"))return t;r.forEach((e,r)=>{let i=this.resolveOwnedTemplateOwner(e.ownerId);if(i){let n=this.renderOwnedContent(e,i.ownerId,i.scope);t=this.replaceOwnedPlaceholder(t,r,n)}else t=this.replaceOwnedPlaceholder(t,r,e.content)});let i,n=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;for(;null!==(i=n.exec(t));){let r=i[0],s=i[1],a=e.getOwnedTemplates(s);if(a&&a.has(r)){let e=a.get(r),i=this.resolveOwnedTemplateOwner(e.ownerId,s);if(i){let n=this.renderOwnedContent(e,i.ownerId,i.scope);t=this.replaceOwnedPlaceholder(t,r,n)}else t=this.replaceOwnedPlaceholder(t,r,e.content);n.lastIndex=0}}return t}maskNestedOwnedTemplates(e,t=null){if(!e.includes("pp-owner"))return{content:e,placeholders:new Map};let r=new Map,i=oe(e,t),n=0,s=i.root.querySelectorAll("[pp-component] > template[pp-owner]");for(let e of Array.from(s)){let t=`__PP_NESTED_TPL_${n++}__`;r.set(t,e.outerHTML),e.replaceWith(document.createComment(t))}return{content:i.toHtml(),placeholders:r}}restoreMaskedOwnedTemplates(e,t){if(0===t.size)return;let r=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),i=[],n=r.nextNode();for(;n;){let e=n,s=t.get(e.data||"");if(s){let t=document.createElement("template");t.innerHTML=s;let r=t.content.firstChild;r&&i.push({node:e,replacement:r})}n=r.nextNode()}i.forEach(({node:e,replacement:t})=>{e.replaceWith(t)})}materializeTemplateComponentBoundaries(e){t.materializeTemplateComponentBoundaries(e)}static materializeTemplateComponentBoundaries(e){let t=[];e instanceof HTMLTemplateElement&&e.hasAttribute("pp-component")&&t.push(e),e.querySelectorAll("template[pp-component]").forEach(e=>t.push(e)),t.forEach(e=>{let t=e.content.cloneNode(!0),r=t.firstElementChild;r?(Array.from(e.attributes).forEach(e=>{"pp-owner"!==e.name&&r.setAttribute(e.name,e.value)}),e.replaceWith(t)):e.replaceWith(document.createComment("pp-empty-template-component"))})}replaceOwnedPlaceholder(e,t,r){let i=`\x3c!--${t}--\x3e`,n=e.includes(i)?i:t,s=e.indexOf(n);return-1===s?e:e.slice(0,s)+r+e.slice(s+n.length)}renderOwnedContent(e,t,r){let{content:i,placeholders:n}=this.maskNestedOwnedTemplates(e.content,e.contextTag),s=this.createOwnedRenderScope(r),a=c(s).keys,o=l(s,a),p=ae(e.contextTag),h=hn.compile(p.wrap(i),a),u=p.unwrap(h(...o));for(let[e,t]of n)u=this.replaceOwnedPlaceholder(u,e,t);return this.markOwnedBindings(u,t,e.contextTag)}createOwnedRenderScope(t){let r=e.getScope(this.componentId);if(!r)return t;let i={...t};return["__pp_input_value","__pp_select_value","__pp_checked_value","__pp_default_value","__pp_default_checked"].forEach(e=>{"function"==typeof r[e]&&(i[e]=r[e])}),i}resolveOwnedTemplateOwner(t,r=this.componentId){let i=e.resolveComponentId(t,r);if(!i)return null;let n=e.getResolvedScopeWithAncestors(t,r);return n?{ownerId:i,scope:n}:null}markOwnedBindings(e,t,r=null){let i=oe(e,r),n=[...i.root instanceof DocumentFragment?Array.from(i.root.children):[i.root]].reverse();for(;n.length>0;){let e=n.pop();if(Array.from(e.attributes).some(e=>e.name.startsWith("on"))&&e.setAttribute("pp-event-owner",t),e.hasAttribute("data-pp-ref")&&e.setAttribute("pp-ref-owner",t),e.hasAttribute("pp-component"))continue;let r=Array.from(e.children);for(let e=r.length-1;e>=0;--e)n.push(r[e])}return i.toHtml()}},wn=class{componentId;interpolationCache;scopeEvalCache;propEvalCache;getCachedFunction;constructor(e,t,r,i,n){this.componentId=e,this.interpolationCache=t,this.scopeEvalCache=r,this.propEvalCache=i,this.getCachedFunction=n}interpolateAttrString(e,t){let r=c(t),i=r.keys,n=l(t,i),s=r.keySig;return re(e,e=>{let t=_(e);try{let e=this.getCachedFunction(this.interpolationCache,t,i,s,300)(...n);return"boolean"==typeof e||null==e?"":Array.isArray(e)?e.join(""):String(e)}catch(e){return console.warn(`[PP-WARN] Failed attribute interpolation for {${t}}`,e),""}})}applyAttributeInterpolations(e,t){let i=c(t),n=i.keys,s=l(t,n),a=i.keySig;for(let i of Array.from(e.attributes)){let o=i.name;if("pp-component"===o||o.startsWith("on"))continue;let l=i.value;if(!l.includes("{"))continue;let c=b(l);if(!c){let r=this.interpolateAttrString(l,t);r!==l&&e.setAttribute(o,r);continue}let p,h=_(c.expression);if(!$.isValidExpression(h))continue;try{p=this.getCachedFunction(this.scopeEvalCache,h,n,a,300)(...s)}catch(e){console.error(`[PP-ERROR] Failed to eval "${h}"`,e);continue}if(r.has(o.toLowerCase())&&"boolean"==typeof p){p?e.setAttribute(o,""):e.removeAttribute(o);continue}let u=typeof p;null==p?e.removeAttribute(o):("string"===u||"number"===u||"boolean"===u||"bigint"===u)&&e.setAttribute(o,String(p))}}computePropsFromAttributes(r,n){let s=n?e.getResolvedScopeWithAncestors(n,this.componentId):void 0,a=s?c(s):null,o=a?.keys??[],p=s?l(s,o):[],h=r.__ppRawBindings,u=new Set([...Array.from(r.attributes).map(e=>e.name),...h?Object.keys(h):[]]),d=a?.keySig??"",f=e=>{if(s)try{return this.getCachedFunction(this.propEvalCache,e,o,d,200)(...p)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${e}}" for component "${this.componentId}"`,t)}};return Array.from(u).reduce((e,n)=>{if(n.startsWith("on")&&!n.includes("-")||"pp-component"===n)return e;let a=i(n);if(t.has(a))return e;let o=r.attributes.getNamedItem(n),l=h?.[n]??o?.value;if(void 0===l)return e;if(""===l)return e[a]=!0,e;if(s){let t=b(l);if(t){let r=_(t.expression);if($.isValidExpression(r))return e[a]=f(r),e}if(l.includes("{"))return e[a]=this.interpolateAttrString(l,s),e}return e[a]=l,e},{})}},Tn=class{getRoot;getPortalElements;refCaptureIdsByElement;refExprsByElement;cache=null;constructor(e,t,r,i){this.getRoot=e,this.getPortalElements=t,this.refCaptureIdsByElement=r,this.refExprsByElement=i}invalidate(){this.cache=null}getCache(){if(this.cache)return this.cache;let e=this.getRoot(),t=[],r=[],i=[],n=[],s=new Set,a=[],o=(e,t)=>{if(t)a.push(e);else for(let t=e.children.length-1;t>=0;t--)a.push(e.children[t])};o(e,!0);for(let e of this.getPortalElements())o(e,!0);for(;a.length>0;){let o=a.pop();if(s.has(o))continue;s.add(o);let l=o,c=o!==e&&o.hasAttribute("pp-component");if(t.push(l),(o.hasAttribute("data-pp-ref")||o.hasAttribute("pp-ref")||this.refCaptureIdsByElement.has(l)||this.refExprsByElement.has(l))&&n.push(l),!c&&(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLSelectElement)&&i.push(l),c)r.push(l);else for(let e=o.children.length-1;e>=0;e--)a.push(o.children[e])}return this.cache={ownedElements:t,childBoundaries:r,managedInputs:i,refElements:n},this.cache}collectManagedInputs(){return this.getCache().managedInputs}collectEventElements(e,t){if(e!==this.getRoot()&&e.hasAttribute("pp-component"))this.hasEventAttributes(e)&&t.add(e);else{this.hasEventAttributes(e)&&t.add(e);for(let r=0;r<e.children.length;r++)this.collectEventElements(e.children[r],t)}}hasEventAttributes(e){let t=e.attributes;for(let e=0;e<t.length;e++)if(t[e].name.startsWith("on")&&!t[e].name.includes("-"))return!0;return!1}isManagedEventElement(e){if(this.isElementOwnedByTree(e,this.getRoot()))return!0;for(let t of this.getPortalElements())if(this.isElementOwnedByTree(e,t))return!0;return!1}isElementOwnedByTree(e,t){if(e===t)return!0;if(!t.contains(e))return!1;let r=e,i=!0;for(;r&&r!==t;){if(!i&&r.hasAttribute("pp-component"))return!1;r=r.parentElement,i=!1}return r===t}},En=class{options;boundaryOccurrencesByBaseId=new Map;constructor(e){this.options=e}bootstrap(){this.boundaryOccurrencesByBaseId.clear();let e=new Set,t=new Set,r=new Set,i=(n,s)=>{let a=n.children;for(let n=0;n<a.length;n++){let o=a[n];if(o.hasAttribute("pp-component")){let t=this.bootstrapComponentBoundary(o,s);t&&e.add(t);continue}i(o,this.syncContextProviderBoundary(o,s,t,r)??s)}};i(this.options.getRoot(),this.options.componentId);for(let e of this.options.getPortalElements())i(e,this.options.componentId);this.options.contextManager.replaceActiveProviderBoundaries(t).forEach(e=>r.add(e)),r.size>0&&this.options.refreshContextConsumers(r),this.destroyDisconnectedDescendants(e)}syncNestedBoundaryAttributes(e,t){let r=t.getAttribute("pp-component"),i=this.getBoundaryBaseId(e);if(!r||i&&r!==i)return!1;this.options.syncAttributes(e,t,!1,!0),e.__ppRawBindings=this.collectRawBindings(t);let n=e;return n.__ppRuntimeComponentId&&e.getAttribute("pp-component")!==n.__ppRuntimeComponentId&&e.setAttribute("pp-component",n.__ppRuntimeComponentId),this.refreshNestedOwnedChildren(e,t),!0}refreshNestedOwnedChildren(t,r){let i=t.__ppRuntimeComponentId??t.getAttribute("pp-component");i&&e.getInstance(i)?.refreshOwnedChildrenFromElement?.(r)}createBoundaryId(e,t,r){let i=(this.boundaryOccurrencesByBaseId.get(e)??0)+1;return this.boundaryOccurrencesByBaseId.set(e,i),1===i?{id:e,occurrence:i}:{id:`${e}__pp${this.hashScope(this.getBoundaryScopeSignature(t,r))}`,occurrence:i}}getBoundaryScopeSignature(e,t){let r=[],i=e;for(;i;){let e=i.getAttribute("key");e&&e.length>0?r.unshift(`k:${e}`):r.unshift(`i:${this.getElementIndexWithinParent(i)}`);let t=i.parentElement;if(!t||t.hasAttribute("pp-component"))break;i=t}return`${t}|${r.join("/")}`}getElementIndexWithinParent(e){let t=e.parentElement;if(!t)return 0;let r=t.children;for(let t=0;t<r.length;t++)if(r[t]===e)return t;return 0}hashScope(e){let t=5381;for(let r=0;r<e.length;r++)t=33*t^e.charCodeAt(r);return(t>>>0).toString(36)}getBoundaryBaseId(e){let t=e,r=e.getAttribute("pp-component");return!t.__ppBaseComponentId&&r&&(t.__ppBaseComponentId=r),t.__ppBaseComponentId??r}ensureBoundaryIdentity(t,r){let i=t,n=t.getAttribute("pp-component")||"",s=n?this.createBoundaryId(n,t,r):null,a=s?.id??"";if(i.__ppRuntimeComponentId)return n!==i.__ppRuntimeComponentId&&t.setAttribute("pp-component",i.__ppRuntimeComponentId),i.__ppBaseComponentId||=n||i.__ppRuntimeComponentId,i.__ppRuntimeComponentId;if(!n)return"";n.includes("{")&&!i.__ppWarnedDynamicComponentId&&(i.__ppWarnedDynamicComponentId=!0,console.warn(`[PP-WARN] Dynamic pp-component values are not supported. Component boundary ids are static; received "${n}". Use a stable pp-component id and pass dynamic values through props instead.`)),i.__ppBaseComponentId=n;let o=e.getInstance(a);if(o&&o.el&&o.el!==t){if(o.el.isConnected){let e=s?this.createUniqueCollisionId(a,s.occurrence,t):`${n}__ppcollision`;return i.__ppRuntimeComponentId=e,t.setAttribute("pp-component",e),e}o.destroy?.()}return i.__ppRuntimeComponentId=a,n!==a&&t.setAttribute("pp-component",a),a}createUniqueCollisionId(t,r,i){let n=Math.max(r,1);for(;;){let r=1===n?`${t}_1`:`${t}_${n.toString(36)}`,s=e.getInstance(r);if(!s||!s.el||s.el===i)return r;if(!s.el.isConnected)return s.destroy?.(),r;n+=1}}bootstrapComponentBoundary(t,r){let i=t,n=this.ensureBoundaryIdentity(t,r);if(!n)return null;if(i.__ppRawBindings){let e=this.options.isEffectManagedSurfaceElement(t),r=i.__ppRawBindings;for(let[i,n]of Object.entries(r))e&&this.options.shouldSkipEffectManagedAttr(i)||t.setAttribute(i,n)}else i.__ppRawBindings=this.collectRawBindings(t);let s=e.getResolvedScopeWithAncestors(r,this.options.componentId)??this.options.getLatestScope();this.options.applyAttributeInterpolations(t,s),this.options.materializeFormDefaults(t);let a=e.getInstance(n);if(a?.refreshPropsFromParent){let s=a.parentId!==r;if(a.parentId=r,e.saveParent(n,r),a.el!==t){let e=a.el;!i.__ppRawBindings&&e.__ppRawBindings&&(i.__ppRawBindings=e.__ppRawBindings),a.el=t}return a.refreshPropsFromParent(s),n}if(!e.getState(n)){i.__ppRuntimeParentId=r;try{this.options.createComponent(t)}finally{delete i.__ppRuntimeParentId}}return n}collectRawBindings(e){let t={};for(let r of Array.from(e.attributes))r.value.includes("{")&&"pp-component"!==r.name&&!r.name.startsWith("on")&&(t[r.name]=r.value);return t}destroyDisconnectedDescendants(t){let r=e.getDescendantIds(this.options.componentId);for(let i of r){if(t.has(i))continue;let r=e.getInstance(i);!r?.el||r.el.isConnected||r.destroy?.()}}syncContextProviderBoundary(e,t,r,i){if("pp-context-provider"!==e.tagName.toLowerCase())return null;let n=this.resolveContextProviderBoundary(e);return n?(r.add(n.boundaryId),this.options.contextManager.syncProviderBoundary(n.boundaryId,t,n.context,n.value).forEach(e=>i.add(e)),n.boundaryId):null}resolveContextProviderBoundary(e){let t=e,r=e.getAttribute("data-pp-context-token")??t.__ppContextTokenCaptureId??null,i=e.getAttribute("data-pp-context-value")??t.__ppContextValueCaptureId??null;if(!r||!i)return null;t.__ppContextTokenCaptureId=r,t.__ppContextValueCaptureId=i,e.removeAttribute("data-pp-context-token"),e.removeAttribute("data-pp-context-value");let n=this.options.getContextTokenStore().get(r);return n?{boundaryId:this.ensureContextProviderBoundaryId(t),context:n,value:this.options.getContextValueStore().get(i)}:null}ensureContextProviderBoundaryId(e){return e.__ppContextBoundaryId||=`ppctx_${this.options.componentId}_${Math.random().toString(36).slice(2,10)}`,e.__ppContextBoundaryId}},Dn=new Set(["data-state","data-open","style","aria-hidden","aria-checked","hidden","inert"]),On=new Set(["alert-dialog-content","alert-dialog-overlay","alert-dialog-portal","checkbox","dialog-content","dialog-overlay","dialog-portal","popover-content","sheet-content","sheet-overlay","sheet-portal","tooltip-content"]),kn=class{refCaptureIdsByElement;refExprsByElement;constructor(e,t){this.refCaptureIdsByElement=e,this.refExprsByElement=t}isEffectManagedAttr(e){return Dn.has(e)}isEffectManagedSurfaceElement(e,t){let r=e.getAttribute("data-slot");if(r&&On.has(r))return!0;let i=t?.getAttribute("data-slot");return!!i&&On.has(i)}syncAttributes(e,t,r=!1,i=!1){let n=r||this.isEffectManagedSurfaceElement(e,t),s=e,a=e.attributes;for(let r=a.length-1;r>=0;r--){let o=a[r].name;if(!(i&&"pp-component"===o||t.hasAttribute(o))){if(n&&Dn.has(o)||"value"===o&&e instanceof HTMLInputElement&&s.__ppHasUncontrolledDefaultValue||"checked"===o&&e instanceof HTMLInputElement&&s.__ppHasUncontrolledDefaultChecked||"selected"===o&&e instanceof HTMLOptionElement&&s.__ppHasUncontrolledDefaultSelected)continue;e.removeAttribute(o),"data-pp-ref"===o&&this.refCaptureIdsByElement.delete(e),"pp-ref"===o&&this.refExprsByElement.delete(e)}}ce.unbindRemovedEventHandlers(e,t);let o=t.attributes;for(let t=0;t<o.length;t++){let r=o[t];n&&Dn.has(r.name)||i&&"pp-component"===r.name||(e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value),"checked"===r.name&&e instanceof HTMLInputElement&&(this.trackCheckedControlMode(e,"controlled"),e.checked=!0),"value"===r.name&&(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&e.value!=r.value&&(e.value=r.value))}if(e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement&&!s.__ppHasUncontrolledDefaultValue){let r=t.getAttribute("value"),i=r??t.value,n=r??t.defaultValue;e.value!==i&&(e.value=i),e.defaultValue!==n&&(e.defaultValue=n)}}trackCheckedControlMode(e,t){let r=e,i=r.__ppCheckedControlMode;if(i){if(i!==t){if(!r.__ppWarnedCheckedControlModeSwitch){r.__ppWarnedCheckedControlModeSwitch=!0;let n=e.id?`#${e.id}`:"",s=e.getAttribute("name"),a=!n&&s?`[name="${s}"]`:"";console.warn(`[PP-WARN] input${n}${a} changed from ${i} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)}r.__ppCheckedControlMode=t}}else r.__ppCheckedControlMode=t}},An=Symbol.for("pp.context"),jn=null;function Mn(e){if(!e||"object"!=typeof e||!("value"in e))throw Error("Context.Provider expects an object like { value, children? }.");return e}function Nn(e,t){let r=jn;jn=e;try{return t()}finally{jn=r}}function Pn(e){let t={$$typeof:An,defaultValue:e,Provider:e=>{let r=Mn(e),i=jn;if(!i)throw Error("Context.Provider() can only be used while a component is rendering.");return i(t,r.value),r.children??null}};return t}var Fn=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","layoutEffects","effects","total"];function In(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}var Ln=class t{static MAX_SYNC_RERENDERS=25;el;id;rawTemplate;renderFunction;templateFn=null;hooksSystem;eventManager;latestScope={};__ppRefStore=new Map;__ppRefSeq=0;__ppRefCaptureIdsByElement=new WeakMap;__ppRefExprsByElement=new WeakMap;refBindingManager;__ppInputValueStore=new Map;__ppInputValueSeq=0;__ppSelectValueStore=new Map;__ppSelectValueSeq=0;__ppCheckedValueStore=new Map;__ppCheckedValueSeq=0;__ppContextTokenStore=new Map;__ppContextTokenSeq=0;__ppContextValueStore=new Map;__ppContextValueSeq=0;__ppDefaultValueStore=new Map;__ppDefaultValueSeq=0;__ppDefaultCheckedStore=new Map;__ppDefaultCheckedSeq=0;formControlManager=new vn;passiveEffectsVersion=0;isRendering=!1;props={};ownedChildren=new Map;lastRenderedHtml="";renderCount=0;portalManager;parentId=null;initialChildrenHtml="";pendingEventElements=new Set;traversalManager;contextManager;focusManager;domMorpher;ownedTemplateManager;propBindingManager;nestedBoundaryManager;attributeSyncManager;_lastRawScopeKeySig="";_lastSortedKeys=[];_lastSortedScopeKeySig="";_cachedHooksAPI=null;_cachedRuntimeAPI=null;_propFnCache=new Map;_interpolationFnCache=new Map;_scopeEvalFnCache=new Map;_refEvalFnCache=new Map;static perfEnabled=!1;static perfStats=new Map;constructor(r){this.el=r,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),e.registerInstance(this.id,this),this.ownedTemplateManager=new Cn(this.id),this.propBindingManager=new wn(this.id,this._interpolationFnCache,this._scopeEvalFnCache,this._propFnCache,(e,t,r,i,n)=>this.getCachedFunction(e,t,r,i,n)),this.refBindingManager=new gn(this.id),this.portalManager=new _n(this.id),this.attributeSyncManager=new kn(this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.traversalManager=new Tn(()=>this.el,()=>this.portalManager.elements(),this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.contextManager=new yn(this.id,()=>this.parentId,()=>e.getInstance(this.id)===this,()=>this.isRendering,()=>this.forceUpdate()),this.nestedBoundaryManager=new En({componentId:this.id,getRoot:()=>this.el,getPortalElements:()=>this.portalManager.elements(),getLatestScope:()=>this.latestScope,getContextTokenStore:()=>this.__ppContextTokenStore,getContextValueStore:()=>this.__ppContextValueStore,contextManager:this.contextManager,isEffectManagedSurfaceElement:e=>this.isEffectManagedSurfaceElement(e),shouldSkipEffectManagedAttr:e=>this.attributeSyncManager.isEffectManagedAttr(e),syncAttributes:(e,t,r,i)=>this.syncAttributes(e,t,r,i),applyAttributeInterpolations:(e,t)=>this.applyAttributeInterpolations(e,t),materializeFormDefaults:e=>this.materializeNestedBoundaryFormDefaults(e),createComponent:e=>{new t(e)},refreshContextConsumers:e=>this.refreshContextConsumers(e)}),this.focusManager=new xn(()=>this.el,e=>this.portalManager.contains(e),()=>this.collectManagedInputs(),e=>this.formControlManager.isDateLikeInput(e)),this.domMorpher=new Sn({root:this.el,collectEventElements:e=>this.collectEventElements(e),hasEventAttributes:e=>this.hasEventAttributes(e),isInsideTrackedPortal:e=>this.isInsideTrackedPortal(e),syncAttributes:(e,t,r,i)=>this.syncAttributes(e,t,r,i),syncNestedBoundaryAttributes:(e,t)=>this.nestedBoundaryManager.syncNestedBoundaryAttributes(e,t)}),this.syncParentId(),this.props=this.computePropsFromAttributes(),this.ownedChildren=this.ownedTemplateManager.extractOwnedTemplates(this.el);let i=this.el.innerHTML;e.removeTemplate(this.id),e.removeOwnedTemplates(this.id),e.saveTemplate(this.id,i),e.saveOwnedTemplates(this.id,this.ownedChildren),this.initialChildrenHtml=i,this.props.children=this.initialChildrenHtml,this.hooksSystem=new le(()=>{this.isRendering||this.render()},this.id);let n=e.getState(this.id);n&&this.hooksSystem.loadState(n);let s=oe(this.initialChildrenHtml,this.el.tagName.toLowerCase()),a=this.findOwnScript(s.root),o=a?.textContent||"";a&&a.remove(),this.rawTemplate=s.toHtml(),this.renderFunction=this.createRenderFunction(o),this.eventManager=new ce(this.el,()=>this.latestScope,e=>this.traversalManager.isManagedEventElement(e)),this.render()}syncParentId(){let t=this.el.__ppRuntimeParentId,r=this.el.parentElement?.closest("[pp-component]");this.parentId=void 0===t?r?r.getAttribute("pp-component"):null:t,e.saveParent(this.id,this.parentId)}static setPerfEnabled(e){this.perfEnabled=e}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){let e={};return Fn.forEach(t=>{e[t]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:e}}recordPerfPhase(e,r){if(!t.perfEnabled)return;let i=t.perfStats.get(this.id);i||(i=t.createEmptyPerfEntry(),t.perfStats.set(this.id,i));let n=i.phases[e];n.count++,n.totalMs+=r,n.maxMs=Math.max(n.maxMs,r)}startPerfTimer(){return t.perfEnabled?In():0}endPerfTimer(e,r){t.perfEnabled&&this.recordPerfPhase(e,In()-r)}findOwnScript(e){let t=Array.from(e.children);for(let e of t){if("script"===e.tagName.toLowerCase()&&(!e.hasAttribute("type")||"text/pp"===e.getAttribute("type")))return e;if(e.hasAttribute("pp-component"))continue;let t=this.findOwnScript(e);if(t)return t}return null}applyAttributeInterpolations(e,t){this.propBindingManager.applyAttributeInterpolations(e,t)}computePropsFromAttributes(){return this.propBindingManager.computePropsFromAttributes(this.el,this.parentId)}refreshPropsFromParent(e=!1){let t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,e||!se(this.props,t)||0!==this.ownedChildren.size?(this.props=t,this.isRendering||this.render()):this.bootstrapNestedComponents()}refreshOwnedChildrenFromElement(t){if(0===this.ownedChildren.size)return!1;let r=t.cloneNode(!0),i=this.ownedTemplateManager.extractOwnedTemplates(r);if(0===i.size)return!1;let n=!1;return i.forEach((e,t)=>{let r=this.ownedChildren.get(t);(!r||r.content!==e.content||r.ownerId!==e.ownerId)&&(n=!0)}),!!n&&(this.ownedChildren=i,e.saveOwnedTemplates(this.id,i),this.forceUpdate(),!0)}getCachedFunction(e,t,r,i,n){let s=t+"|"+i,a=e.get(s);if(!a){if(a=Function(...r,`"use strict"; return (${t});`),e.size>=n){let t=e.keys().next().value;void 0!==t&&e.delete(t)}e.set(s,a)}return a}createRenderFunction(e){let t=$.extractStateBindings(e);return Function("pp",`\n "use strict";\n ${e}\n return { ${t.join(", ")} };\n `)}resolveCapturedRefValue(t,r){if(this.__ppRefStore.has(t))return this.__ppRefStore.get(t);if(!r||r===this.id)return;let i=e.getInstance(r);return i&&i.__ppRefStore.has(t)?i.__ppRefStore.get(t):void 0}resolvePlainRefValue(e,t,r,i){let n=this.latestScope[e];if("function"==typeof n||n&&"object"==typeof n&&"current"in n)return n;try{return this.getCachedFunction(this._refEvalFnCache,e,t,i,200)(...r)}catch{return}}__ppRefCaptureFn=e=>{let t=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(t,e),t};__ppSelectValueCaptureFn=e=>{let t=`ppselect_${this.id}_${++this.__ppSelectValueSeq}`;return this.__ppSelectValueStore.set(t,e),t};__ppCheckedValueCaptureFn=e=>{let t=`ppchecked_${this.id}_${++this.__ppCheckedValueSeq}`;return this.__ppCheckedValueStore.set(t,e),t};__ppInputValueCaptureFn=e=>{let t=`ppinput_${this.id}_${++this.__ppInputValueSeq}`;return this.__ppInputValueStore.set(t,e),t};__ppContextTokenCaptureFn=e=>{let t=`ppcontexttoken_${this.id}_${++this.__ppContextTokenSeq}`;return this.__ppContextTokenStore.set(t,e),t};__ppContextValueCaptureFn=e=>{let t=`ppcontextvalue_${this.id}_${++this.__ppContextValueSeq}`;return this.__ppContextValueStore.set(t,e),t};createRefCaptureFunction(){return this.__ppRefStore.clear(),this.__ppRefSeq=0,this.__ppRefCaptureFn}createSelectValueCaptureFunction(){return this.__ppSelectValueStore.clear(),this.__ppSelectValueSeq=0,this.__ppSelectValueCaptureFn}createCheckedValueCaptureFunction(){return this.__ppCheckedValueStore.clear(),this.__ppCheckedValueSeq=0,this.__ppCheckedValueCaptureFn}createInputValueCaptureFunction(){return this.__ppInputValueStore.clear(),this.__ppInputValueSeq=0,this.__ppInputValueCaptureFn}createContextTokenCaptureFunction(){return this.__ppContextTokenStore.clear(),this.__ppContextTokenSeq=0,this.__ppContextTokenCaptureFn}createContextValueCaptureFunction(){return this.__ppContextValueStore.clear(),this.__ppContextValueSeq=0,this.__ppContextValueCaptureFn}__ppContextLookupFn=null;createContextLookupFunction(){if(this.__ppContextLookupFn)return this.__ppContextLookupFn;let e=(e,t)=>{if(null==e)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let r=Object.keys(Object(e)).find(e=>e.toLowerCase()===t.toLowerCase());return r?e[r]:void 0};return this.__ppContextLookupFn=t=>{let r=String(t).split(".").map(e=>e.trim()).filter(Boolean);if(0===r.length)return;let i,[n,...s]=r;"globalthis"===n.toLowerCase()?i=globalThis:"window"===n.toLowerCase()?i=typeof window<"u"?window:globalThis:(i=e(this.latestScope,n),void 0===i&&(i=e(globalThis,n)));for(let t of s)i=e(i,t);return i},this.__ppContextLookupFn}__ppDefaultValueCaptureFn=e=>{let t=`ppdefaultvalue_${this.id}_${++this.__ppDefaultValueSeq}`;return this.__ppDefaultValueStore.set(t,e),t};__ppDefaultCheckedCaptureFn=e=>{let t=`ppdefaultchecked_${this.id}_${++this.__ppDefaultCheckedSeq}`;return this.__ppDefaultCheckedStore.set(t,e),t};createDefaultValueCaptureFunction(){return this.__ppDefaultValueStore.clear(),this.__ppDefaultValueSeq=0,this.__ppDefaultValueCaptureFn}createDefaultCheckedCaptureFunction(){return this.__ppDefaultCheckedStore.clear(),this.__ppDefaultCheckedSeq=0,this.__ppDefaultCheckedCaptureFn}consumeContext(e){return this.contextManager.consume(e)}registerProvidedContext(e,t){this.contextManager.provide(e,t)}requestContextRefresh(){this.contextManager.requestRefresh()}refreshContextConsumers(e){this.contextManager.refreshConsumers(e)}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:e=>this.hooksSystem.useState(e),effect:(e,t)=>this.hooksSystem.useEffect(e,t),layoutEffect:(e,t)=>this.hooksSystem.useLayoutEffect(e,t),ref:(e=null)=>this.hooksSystem.useRef(e),memo:(e,t)=>this.hooksSystem.useMemo(e,t),callback:(e,t)=>this.hooksSystem.useCallback(e,t),reducer:(e,t,r)=>r?this.hooksSystem.useReducer(e,t,r):this.hooksSystem.useReducer(e,t),context:e=>this.consumeContext(e),portal:(e,t)=>this.hooksSystem.usePortal(e,t),props:this.props},this._cachedHooksAPI}makeRuntimeAPI(e){if(!this._cachedRuntimeAPI){let t=globalThis.pp;return this._cachedRuntimeAPI=t?.createComponentRuntime?.(e)??e,this._cachedRuntimeAPI}return this._cachedRuntimeAPI.props=e.props,this._cachedRuntimeAPI}syncTrackedPortals(e){if(0===this.portalManager.size)return;let t=this.hooksSystem.getPortalRegistrations();if(0===t.length)return;let r=new Map,i=new Map;e.querySelectorAll("*").forEach(e=>{let t=e,n=t.getAttribute("data-pp-ref");if(n){let e=r.get(n);e?e.push(t):r.set(n,[t])}let s=t.getAttribute("pp-ref");if(s){let e=i.get(s);e?e.push(t):i.set(s,[t])}});let n=new Map;for(let[e,t]of this.__ppRefStore.entries()){if(!t||"object"!=typeof t||!("current"in t))continue;let r=t,i=n.get(r);i?i.push(e):n.set(r,[e])}let s=new Map;for(let[e,t]of Object.entries(this.latestScope)){if(!t||"object"!=typeof t||!("current"in t))continue;let r=t,i=s.get(r);i?i.push(e):s.set(r,[e])}let a=(e,t)=>{for(let r of t){let t=e.get(r);if(!t||0===t.length)continue;let i=t.shift()??null;if(0===t.length&&e.delete(r),i)return i}return null},o=[];for(let e of t){let t=e.ref.current;if(!t||!this.portalManager.has(t))continue;let l=a(r,n.get(e.ref)??[]);l||=a(i,s.get(e.ref)??[]),l&&o.push({liveElement:t,sourceElement:l,placeholderText:this.portalManager.getPlaceholderText(t)})}0!==o.length&&(o.forEach(({sourceElement:e,placeholderText:t})=>{e.replaceWith(document.createComment(t))}),o.forEach(({liveElement:e,sourceElement:t})=>{this.morphTrackedPortalRoot(e,t)}))}morphTrackedPortalRoot(e,t){if(e.tagName!==t.tagName){let r=e.parentNode;if(!r)return;let i=t.cloneNode(!0);return r.replaceChild(i,e),this.collectEventElements(i),void this.portalManager.replaceElement(e,i)}this.syncAttributes(e,t,!0),this.hasEventAttributes(e)&&this.pendingEventElements.add(e),this.domMorpher.morphChildren(e,t)}applyPortals(){let e=this.hooksSystem.getPortalRegistrations();this.portalManager.apply(e)&&this.invalidateTraversalCache()}render(r=0){if(r>t.MAX_SYNC_RERENDERS)return void console.warn(`[PP-WARN] Synchronous rerender limit exceeded for component "${this.id}". Check for state updates during render or layout effects.`);if(this.isRendering)return;this.isRendering=!0,this.renderCount++;let i=this.startPerfTimer();if(t.perfEnabled){let e=t.perfStats.get(this.id);e||(e=t.createEmptyPerfEntry(),t.perfStats.set(this.id,e)),e.renderCount++}try{this.contextManager.prepareRender(),this.hooksSystem.prepareRender();let t=this.makeHooksAPI(),i=this.makeRuntimeAPI(t),n=this.startPerfTimer();this.hooksSystem.startRenderPhase();let s,a=!1;try{s=Nn((e,t)=>this.registerProvidedContext(e,t),()=>this.renderFunction(i))}finally{a=this.hooksSystem.finishRenderPhase()}if(this.endPerfTimer("script",n),a)return this.isRendering=!1,void this.render(r+1);e.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...s},this.latestScope.__pp_ref=this.createRefCaptureFunction(),this.latestScope.__pp_input_value=this.createInputValueCaptureFunction(),this.latestScope.__pp_select_value=this.createSelectValueCaptureFunction(),this.latestScope.__pp_checked_value=this.createCheckedValueCaptureFunction(),this.latestScope.__pp_context_token=this.createContextTokenCaptureFunction(),this.latestScope.__pp_context_value=this.createContextValueCaptureFunction(),this.latestScope.__pp_context_lookup=this.createContextLookupFunction(),this.latestScope.__pp_default_value=this.createDefaultValueCaptureFunction(),this.latestScope.__pp_default_checked=this.createDefaultCheckedCaptureFunction(),e.saveScope(this.id,this.latestScope);let o,p,h=c(this.latestScope),u=h.keys,d=h.keySig;d===this._lastRawScopeKeySig?(o=this._lastSortedKeys,p=this._lastSortedScopeKeySig):(o=u.length>1?[...u].sort():u.slice(),p=o.join("\0"),this._lastRawScopeKeySig=d,this._lastSortedKeys=o,this._lastSortedScopeKeySig=p);let f=l(this.latestScope,o);this.templateFn||=hn.compile(this.rawTemplate,o);let m=this.templateFn(...f);m=this.ownedTemplateManager.resolveOwnedChildren(m,this.ownedChildren);let g=this.collectManagedInputs(),_=this.focusManager.save(g),v=this.lastRenderedHtml!==m;if(v){let e=this.startPerfTimer();this.applyDomDiff(m),this.endPerfTimer("domDiff",e),this.lastRenderedHtml=m}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){let e=this.pendingEventElements;this.pendingEventElements=new Set;let t=this.startPerfTimer();this.eventManager.bindEvents(e),this.endPerfTimer("bindEvents",t)}let y=this.startPerfTimer();this.bindRefs(o,f,p),this.endPerfTimer("bindRefs",y);let x=v?this.collectManagedInputs():g,C=this.contextManager.commitRenderContexts(),E=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",E);let b=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",b),this.bindControlledInputValues(x),this.bindUncontrolledInputDefaults(x),this.bindUncontrolledFormResets(x),this.bindControlledSelectValues(x),this.bindControlledCheckedValues(x);let S=this.startPerfTimer();this.focusManager.restore(_,x),this.endPerfTimer("restoreFocus",S);let k=this.startPerfTimer(),w=this.hooksSystem.runLayoutEffects();if(this.endPerfTimer("layoutEffects",k),w)return this.isRendering=!1,void this.render(r+1);this.schedulePassiveEffects(),C?.size&&this.refreshContextConsumers(C)}catch(e){console.error("[PP-ERROR] Render Cycle Failed",e)}finally{this.endPerfTimer("total",i),this.isRendering=!1}}schedulePassiveEffects(){let t=++this.passiveEffectsVersion;queueMicrotask(()=>{if(this.passiveEffectsVersion!==t||e.getInstance(this.id)!==this)return;let r=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",r)})}applyDomDiff(e){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){let t=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,"image/svg+xml").documentElement,r=document.createDocumentFragment();return Array.from(t.childNodes).forEach(e=>{r.appendChild(document.importNode(e,!0))}),this.domMorpher.morphChildren(this.el,r),void this.invalidateTraversalCache()}let{content:t,placeholders:r}=this.ownedTemplateManager.maskNestedOwnedTemplates(e,this.el.tagName.toLowerCase()),i=oe(t,this.el.tagName.toLowerCase()).root;this.ownedTemplateManager.restoreMaskedOwnedTemplates(i,r),this.ownedTemplateManager.materializeTemplateComponentBoundaries(i),this.syncTrackedPortals(i),this.domMorpher.morphChildren(this.el,i),this.invalidateTraversalCache()}isInsideTrackedPortal(e){return this.portalManager.contains(e)}isEffectManagedSurfaceElement(e,t){return this.attributeSyncManager.isEffectManagedSurfaceElement(e,t)}collectEventElements(e){this.traversalManager.collectEventElements(e,this.pendingEventElements)}hasEventAttributes(e){return this.traversalManager.hasEventAttributes(e)}invalidateTraversalCache(){this.traversalManager.invalidate(),this.eventManager.invalidateElementCountCache()}getTraversalCache(){return this.traversalManager.getCache()}collectManagedInputs(){return this.traversalManager.collectManagedInputs()}syncAttributes(e,t,r=!1,i=!1){this.attributeSyncManager.syncAttributes(e,t,r,i)}bindRefs(e,t,r){let i=this.getTraversalCache(),n=new Map;for(let s=0;s<i.refElements.length;s++){let a=i.refElements[s],o=a,l=a!==this.el&&a.hasAttribute("pp-component"),c=a.getAttribute("data-pp-ref"),p=a.getAttribute("pp-ref-owner"),h=null;if(c)this.__ppRefStore.has(c)?(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,c),h=c):l||(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,c),h=c);else{let e=this.__ppRefCaptureIdsByElement.get(a);e&&this.__ppRefStore.has(e)?h=e:e&&this.__ppRefCaptureIdsByElement.delete(a)}if(h){let e=this.resolveCapturedRefValue(h,p);if("function"==typeof e||e&&"object"==typeof e&&"current"in e){let t=this.refBindingManager.ensureBindingId(o,"captured");n.set(t,{element:a,value:e})}else c&&h.startsWith(`ppref_${this.id}_`)&&console.warn(`[PP-WARN] Missing captured ref for id="${h}"`)}let u=a.getAttribute("pp-ref"),d=u;if(d=u||this.__ppRefExprsByElement.get(a)||null,!d)continue;let f=this.resolvePlainRefValue(d,e,t,r);if("function"==typeof f||f&&"object"==typeof f&&"current"in f){u&&a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d);let e=this.refBindingManager.ensureBindingId(o,"plain");n.set(e,{element:a,value:f});continue}u&&l||(u&&(a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d)),Object.prototype.hasOwnProperty.call(this.latestScope,d)||console.warn(`[PP-WARN] Could not resolve pp-ref="${d}"`))}this.refBindingManager.commit(n)}bindControlledSelectValues(e){this.formControlManager.bindControlledSelectValues(e,this.__ppSelectValueStore)}bindControlledCheckedValues(e){this.formControlManager.bindControlledCheckedValues(e,this.__ppCheckedValueStore)}bindControlledInputValues(e){this.formControlManager.bindControlledInputValues(e,this.__ppInputValueStore)}bindUncontrolledInputDefaults(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.__ppManagedInputMounted)this.formControlManager.resolveDefaultValueBinding(r,this.__ppDefaultValueStore),r instanceof HTMLInputElement&&this.formControlManager.resolveDefaultCheckedBinding(r,this.__ppDefaultCheckedStore);else{let e=this.formControlManager.resolveDefaultValueBinding(r,this.__ppDefaultValueStore);if(void 0!==e&&this.formControlManager.applyUncontrolledDefaultValue(r,e),r instanceof HTMLInputElement){let e=this.formControlManager.resolveDefaultCheckedBinding(r,this.__ppDefaultCheckedStore);void 0!==e&&this.formControlManager.applyUncontrolledDefaultChecked(r,e)}}r.__ppManagedInputMounted=!0}}bindUncontrolledFormResets(e){this.formControlManager.syncUncontrolledFormResets(this.id,e,()=>this.collectManagedInputs())}bootstrapNestedComponents(){this.nestedBoundaryManager.bootstrap()}materializeNestedBoundaryFormDefaults(e){this.formControlManager.materializeNestedBoundaryFormDefaults(e,{inputValueStore:this.__ppInputValueStore,checkedValueStore:this.__ppCheckedValueStore,defaultValueStore:this.__ppDefaultValueStore,defaultCheckedStore:this.__ppDefaultCheckedStore})}forceUpdate(){this.lastRenderedHtml="",this.render()}destroyNestedComponents(){let t=e.getDescendantIds(this.id),r=new Set;t.forEach(t=>{if(r.has(t))return;r.add(t);let i=e.getInstance(t);i&&i!==this&&i.destroy?.()})}destroy(){this.destroyNestedComponents(),this.formControlManager.clearResetHandlers(this.id),this.hooksSystem.dispose(),this.refBindingManager.clearAll(),this.portalManager.destroyAll();let t=this.contextManager.destroy();this.eventManager.clearCache(),e.removeState(this.id),e.removeScope(this.id),e.removeTemplate(this.id),e.removeOwnedTemplates(this.id),e.removeInstance(this.id),this.contextManager.refreshConsumers(t)}},Rn="opacity 0.18s ease-out",zn=15e3,Bn={bootstrap:()=>{Cn.materializeTemplateComponentBoundaries(document.body),Array.from(document.querySelectorAll("[pp-component]")).filter(e=>!e.parentElement?.closest("[pp-component]")).forEach(e=>{new Ln(e)})}},Vn=class t{static instance=null;activeAbortController=null;navigationEnabled=!1;boundHandleLinkClick=null;boundHandlePopState=null;boundHandleTrackedScroll=null;isNavigating=!1;pendingHistoryStateSaveTimer=null;lastHistoryStateSaveAt=0;pendingProgrammaticScrollPersistenceTimer=null;RESET_SCROLL_ATTR="pp-reset-scroll";HISTORY_SCROLL_STATE_KEY="__ppScrollPositions";TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS=150;PROGRAMMATIC_SCROLL_SETTLE_MS=120;mounted=!1;suppressTrackedScrollPersistence=!1;transitionLockCount=0;pendingRevealFrame=null;pendingTransitionUnlockFrame=null;hydrationBodySnapshot=null;previousHistoryScrollRestoration=null;static PUBLIC_METHODS=["createContext","mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"];constructor(){}mount(){this.mounted||(this.mounted=!0,this.warnAboutOrphanPulsePointScripts(),this.disableTransitions(),this.hideBodyForHydration(!0),Bn.bootstrap(),this.scheduleHydrationReveal(),this.enableSPANavigation())}createComponentRuntime(e){let r={};for(let e of t.PUBLIC_METHODS){let t=this[e];"function"==typeof t?r[e]=t.bind(this):void 0!==t&&(r[e]=t)}return Object.assign({},r,e)}warnAboutOrphanPulsePointScripts(){let e=Array.from(document.querySelectorAll('script[type="text/pp"]')).filter(e=>!e.closest("[pp-component]"));0!==e.length&&console.warn(`[PP-WARN] Found ${e.length} PulsePoint script${1===e.length?"":"s"} outside a pp-component root. Keep component scripts inside the single component root so they can participate in render scope.`)}createContext(e){return Pn(e)}enablePerf(){Ln.setPerfEnabled(!0)}disablePerf(){Ln.setPerfEnabled(!1)}getPerfStats(){return Ln.getPerfStats()}resetPerfStats(){Ln.resetPerfStats()}getCsrfToken(){let e=window.location.port?[`pp_csrf_${window.location.port}`,"pp_csrf"]:["pp_csrf"];for(let t of e){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=document.cookie.match(RegExp(`(?:^|;\\s*)${e}=([^;]*)`));if(r)return decodeURIComponent(r[1])}return""}resolveRpcUrl(e){let t=window.location.pathname.replace(/\/+$/,"")||"/";return new URL(e??t,window.location.origin)}resolveRpcCredentials(e,t){return t||(e.origin===window.location.origin?"same-origin":"include")}async ensureCsrfToken(e,t,r){let i=this.getCsrfToken();if(""!==i||"omit"===t)return i;let n=new URL(r??e.toString(),window.location.origin);return await fetch(n.toString(),{method:"GET",credentials:t,cache:"no-store",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/html, application/json, */*"}}),i=this.getCsrfToken(),i}disableTransitions(){if(this.transitionLockCount+=1,document.getElementById("pp-disable-transitions"))return;let e=document.createElement("style");e.id="pp-disable-transitions",e.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(e,document.head.firstChild)}enableTransitions(e=!1){if(e?this.transitionLockCount=0:this.transitionLockCount>0&&--this.transitionLockCount,this.transitionLockCount>0)return;let t=document.getElementById("pp-disable-transitions");t&&t.remove()}requestFrame(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):window.setTimeout(()=>e(performance.now()),16)}cancelFrame(e){"function"!=typeof cancelAnimationFrame?window.clearTimeout(e):cancelAnimationFrame(e)}cancelScheduledHydrationReveal(){null!==this.pendingRevealFrame&&(this.cancelFrame(this.pendingRevealFrame),this.pendingRevealFrame=null),null!==this.pendingTransitionUnlockFrame&&(this.cancelFrame(this.pendingTransitionUnlockFrame),this.pendingTransitionUnlockFrame=null)}cancelPendingProgrammaticScrollPersistence(){null!==this.pendingProgrammaticScrollPersistenceTimer&&(window.clearTimeout(this.pendingProgrammaticScrollPersistenceTimer),this.pendingProgrammaticScrollPersistenceTimer=null)}beginProgrammaticScrollPersistencePause(){this.suppressTrackedScrollPersistence=!0,this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence()}scheduleProgrammaticScrollPersistence(){this.suppressTrackedScrollPersistence&&(this.cancelPendingProgrammaticScrollPersistence(),this.pendingProgrammaticScrollPersistenceTimer=window.setTimeout(()=>{this.pendingProgrammaticScrollPersistenceTimer=null,this.suppressTrackedScrollPersistence=!1,this.persistCurrentHistoryScrollState()},this.PROGRAMMATIC_SCROLL_SETTLE_MS))}scrollElementIntoView(e){this.beginProgrammaticScrollPersistencePause(),e.scrollIntoView({behavior:"smooth"}),this.scheduleProgrammaticScrollPersistence()}normalizeHydrationBodySnapshotStyle(e){if(null===e)return null;let t=document.createElement("div");t.setAttribute("style",e),"0"===t.style.opacity&&t.style.removeProperty("opacity"),"none"===t.style.pointerEvents&&t.style.removeProperty("pointer-events"),"none"===t.style.userSelect&&t.style.removeProperty("user-select"),t.style.transition.replace(/\s+/g," ").trim().toLowerCase()===Rn&&t.style.removeProperty("transition");let r=t.getAttribute("style")?.trim()??"";return""===r?null:r}hideBodyForHydration(e=!1){if(!this.hydrationBodySnapshot){let t=document.body.getAttribute("style");this.hydrationBodySnapshot={style:e?this.normalizeHydrationBodySnapshotStyle(t):t,hadAriaBusy:document.body.hasAttribute("aria-busy"),ariaBusy:document.body.getAttribute("aria-busy"),hadInert:document.body.hasAttribute("inert"),inert:document.body.getAttribute("inert")}}document.body.style.opacity="0",document.body.style.pointerEvents="none",document.body.style.userSelect="none",document.body.setAttribute("aria-busy","true"),document.body.setAttribute("inert","")}scheduleHydrationReveal(e){this.cancelScheduledHydrationReveal(),this.pendingRevealFrame=this.requestFrame(()=>{this.pendingRevealFrame=null,this.restoreBodyAccessibility(),e?.(),this.pendingTransitionUnlockFrame=this.requestFrame(()=>{this.pendingTransitionUnlockFrame=null,this.enableTransitions(!0)})})}restoreBodyAccessibility(){let e=this.hydrationBodySnapshot;if(!e)return document.body.style.removeProperty("transition"),document.body.style.removeProperty("opacity"),document.body.style.removeProperty("pointer-events"),document.body.style.removeProperty("user-select"),document.body.removeAttribute("inert"),void document.body.removeAttribute("aria-busy");null===e.style?document.body.removeAttribute("style"):document.body.setAttribute("style",e.style),e.hadInert?document.body.setAttribute("inert",e.inert??""):document.body.removeAttribute("inert"),e.hadAriaBusy?document.body.setAttribute("aria-busy",e.ariaBusy??""):document.body.removeAttribute("aria-busy"),this.hydrationBodySnapshot=null}static resetInstance(){this.instance&&=(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.cancelScheduledHydrationReveal(),this.instance.restoreBodyAccessibility(),this.instance.enableTransitions(!0),this.instance.mounted=!1,this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),null)}static getInstance(){return this.instance||=new t,this.instance}enableSPANavigation(){this.navigationEnabled||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),this.boundHandleTrackedScroll=this.handleTrackedScroll.bind(this),"scrollRestoration"in history&&(this.previousHistoryScrollRestoration=history.scrollRestoration,history.scrollRestoration="manual"),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState),document.addEventListener("scroll",this.boundHandleTrackedScroll,!0),window.addEventListener("scroll",this.boundHandleTrackedScroll,{passive:!0}),this.persistCurrentHistoryScrollState())}disableSPANavigation(){this.navigationEnabled=!1,this.suppressTrackedScrollPersistence=!1,this.boundHandleLinkClick&&=(document.removeEventListener("click",this.boundHandleLinkClick),null),this.boundHandlePopState&&=(window.removeEventListener("popstate",this.boundHandlePopState),null),this.boundHandleTrackedScroll&&=(document.removeEventListener("scroll",this.boundHandleTrackedScroll,!0),window.removeEventListener("scroll",this.boundHandleTrackedScroll),null),this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),null!==this.previousHistoryScrollRestoration&&"scrollRestoration"in history&&(history.scrollRestoration=this.previousHistoryScrollRestoration,this.previousHistoryScrollRestoration=null)}handleLinkClick(e){if(!this.navigationEnabled)return;let t=this.getNavigationTarget(e.target);if(!t)return;let r=t.closest("a");if(r&&r.href)try{let t=new URL(r.href),i=t.origin!==window.location.origin,n=t.pathname===window.location.pathname&&t.search===window.location.search,s="false"===r.getAttribute("pp-spa");if(i||"_blank"===r.target||r.hasAttribute("download")||s||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;if(e.preventDefault(),n){let r=t.hash;if(r){e.preventDefault(),this.persistCurrentHistoryScrollState(),history.pushState(this.buildHistoryState(),"",t.pathname+t.search+r);let i=document.querySelector(r);return void(i&&this.scrollElementIntoView(i))}}this.navigateTo(t.pathname+t.search+t.hash)}catch(e){console.error("Link click navigation error:",e)}}getNavigationTarget(e){return e instanceof Element?e:e instanceof Node?e.parentElement:null}handleTrackedScroll(){if(!this.navigationEnabled||this.isNavigating)return;if(this.suppressTrackedScrollPersistence)return void this.scheduleProgrammaticScrollPersistence();let e=Date.now()-this.lastHistoryStateSaveAt;if(e>=this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS)return this.cancelPendingHistoryStateSave(),void this.persistCurrentHistoryScrollState();null===this.pendingHistoryStateSaveTimer&&(this.pendingHistoryStateSaveTimer=window.setTimeout(()=>{this.pendingHistoryStateSaveTimer=null,this.persistCurrentHistoryScrollState()},this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS-e))}async handlePopState(e){let t=this.getCurrentUrl(),r=this.getScrollPositionsFromHistoryState(e.state);await this.navigateTo(t,!1,r)}async navigateTo(e,t=!0,r=null){this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),this.suppressTrackedScrollPersistence=!1,this.isNavigating=!0;try{this.dispatchNavigationEvent("start",e),await this.showLoadingTransition();let i=await this.fetchPageContent(e);if("hardReload"in i)return void(window.location.href=i.hardReload);if("redirect"in i)return void await this.navigateTo(i.redirect,t,r);let n=i,s=t?this.saveScrollPositions():null;this.updateBrowserHistory(e,t,s),this.disableTransitions(),this.hideBodyForHydration();let a=document.getElementById("loading-file-1B87E"),o="startViewTransition"in document,l=this.getResetScrollConfig(n);!a&&o?await this.updatePageContentWithViewTransition(n):await this.updatePageContent(n),this.resetGlobalCaches(),Bn.bootstrap(),this.handleScrollRestoration(t?s:r,l,t?"push":"history"),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",e)}catch(t){this.handleNavigationError(e,t)}finally{this.isNavigating=!1}}resetGlobalCaches(){e.clear(),$.clearCaches(),hn.clearCache()}getResetScrollConfig(e){if("true"===e.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};let t=e.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),r=new Set,i=!1;if(t.length>0)for(let e of Array.from(t))if("true"===e.getAttribute(this.RESET_SCROLL_ATTR)){let t=this.getElementKeyFromElement(e);r.add(t),i=!0}return i||r.size>0?{mode:"none",resetElementKeys:r,resetWindow:i}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(e){return e.id?e.id:e.className?e.className:e.tagName}handleScrollRestoration(e,t,r){requestAnimationFrame(()=>{if("global"===t.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft)&&(e.scrollTop=0,e.scrollLeft=0)});if("history"!==r||t.resetWindow||!e?.window)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{let t=e?.window;t&&window.scrollTo(t.scrollLeft,t.scrollTop)}document.querySelectorAll("*").forEach(i=>{let n=i.tagName.toLowerCase();if("html"===n||"body"===n)return;let s=this.getElementKey(i),a="history"===r||"push"===r&&!t.resetElementKeys.has(s)?e?.[s]:null;t.resetElementKeys.has(s)?(i.scrollTop=0,i.scrollLeft=0):a&&(i.scrollTop=a.scrollTop,i.scrollLeft=a.scrollLeft)})})}saveScrollPositions(){let e={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return document.querySelectorAll("*").forEach(t=>{(t.scrollTop||t.scrollLeft)&&(e[this.getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})}),e}getElementKey(e){return e.id||e.className||e.tagName}cancelPendingHistoryStateSave(){null!==this.pendingHistoryStateSaveTimer&&(window.clearTimeout(this.pendingHistoryStateSaveTimer),this.pendingHistoryStateSaveTimer=null)}buildHistoryState(e){let t=history.state,r=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{};return e?r[this.HISTORY_SCROLL_STATE_KEY]=e:delete r[this.HISTORY_SCROLL_STATE_KEY],r}getScrollPositionsFromHistoryState(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t=e[this.HISTORY_SCROLL_STATE_KEY];return!t||"object"!=typeof t||Array.isArray(t)?null:t}persistCurrentHistoryScrollState(e=this.saveScrollPositions()){this.lastHistoryStateSaveAt=Date.now(),history.replaceState(this.buildHistoryState(e),"",this.getCurrentUrl())}getCurrentUrl(){return window.location.pathname+window.location.search+window.location.hash}teardownCurrentPageComponents(){e.destroyAll()}async updatePageContentWithViewTransition(e){e.title&&(document.title=e.title);let t=e.body.innerHTML;if(this.syncBodyAttributes(e.body),this.teardownCurrentPageComponents(),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=t);let r=document.startViewTransition(()=>{document.body.innerHTML=t});try{await r.finished}catch(e){console.warn("View transition failed, continuing anyway:",e)}}dispatchNavigationEvent(e,t,r){let i=`pp:navigation:${e}`,n=r?{url:t,error:r}:{url:t};document.dispatchEvent(new CustomEvent(i,{detail:n}))}async showLoadingTransition(){let e=document.getElementById("loading-file-1B87E");if(e){let t=this.findLoadingElement(e,window.location.pathname);if(t)return void await this.updateContentWithTransition(t)}let t=document.querySelector("[pp-loading-content='true']")||document.body;t&&!("startViewTransition"in document)&&await this.fadeOut(t,250)}async fetchPageContent(e){let t,r=new URL(e,window.location.origin).hash,i=new AbortController,n=window.setTimeout(()=>{i.abort()},zn);try{t=await fetch(e,{signal:i.signal,headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}})}catch(r){throw r instanceof Error&&"AbortError"===r.name?Error(`Navigation timed out after ${Math.round(zn/1e3)}s: ${e}`):r}finally{window.clearTimeout(n)}if(!t.ok)throw Error(`Navigation failed: ${t.status} ${t.statusText}`);let s=t.headers.get("X-PP-Root-Layout"),a=document.querySelector('meta[name="pp-root-layout"]'),o=a?a.getAttribute("content"):null;if(s&&o&&s!==o)return{hardReload:e};if(t.redirected){let i=this.normalizeServerRedirectTarget(t.url);if(!i)return{hardReload:e};let n=new URL(i,window.location.origin);if(r&&n.searchParams.has("next")){let e=n.searchParams.get("next");e&&!e.includes("#")&&n.searchParams.set("next",e+r)}return{redirect:n.pathname+n.search+n.hash}}let l=this.getRedirectUrlFromResponse(t);if(l)return{redirect:l};let c=await t.text();return(new DOMParser).parseFromString(c,"text/html")}normalizeServerRedirectTarget(e){if(!e)return null;try{let t=new URL(e,window.location.href);return t.origin===window.location.origin?t.pathname+t.search+t.hash:(console.warn("Ignoring cross-origin redirect target from server response:",e),null)}catch(t){return console.warn("Ignoring invalid redirect target from server response:",e,t),null}}getRedirectUrlFromResponse(e){let t=e.headers.get("X-PP-Redirect"),r=this.normalizeServerRedirectTarget(t);if(r)return r;let i=e.headers.get("Location"),n=e.status;return i&&n>=300&&n<400?this.normalizeServerRedirectTarget(i):null}updateBrowserHistory(e,t,r=null){t&&(this.persistCurrentHistoryScrollState(r??void 0),history.pushState(this.buildHistoryState(),"",e))}async updatePageContent(e){e.title&&(document.title=e.title);let t=e.body;this.syncBodyAttributes(t),this.teardownCurrentPageComponents(),document.body.innerHTML=t.innerHTML}syncBodyAttributes(e){e&&(Array.from(document.body.attributes).forEach(e=>{"style"!==e.name&&document.body.removeAttribute(e.name)}),Array.from(e.attributes).forEach(e=>{"style"!==e.name&&document.body.setAttribute(e.name,e.value)}))}async handleNavigationCompletion(){let e=document.querySelector("[pp-loading-content='true']")||document.body,t=window.location.hash;this.scheduleHydrationReveal(()=>{if(this.fadeIn(e,150),t){let e=document.querySelector(t);e&&this.scrollElementIntoView(e)}})}handleNavigationError(e,t){console.error("Navigation error:",t),this.restoreBodyAccessibility(),this.enableTransitions(!0),this.dispatchNavigationEvent("error",e,t),window.location.href=e}findLoadingElement(e,t){let r=t;for(;;){let t=e.querySelector(`div[pp-loading-url='${r}']`);if(t)return t;if("/"===r)break;let i=r.lastIndexOf("/");r=i<=0?"/":r.substring(0,i)}return e.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(e){let t=document.querySelector("[pp-loading-content='true']")||document.body;if(!t)return;let{fadeIn:r,fadeOut:i}=this.parseTransition(e);await this.fadeOut(t,i),t.innerHTML=e.innerHTML,this.fadeIn(t,r)}parseTransition(e){let t=250,r=250,i=e.querySelector("[pp-loading-transition]")?.getAttribute("pp-loading-transition");if(i){let e=JSON.parse(i);e&&"object"==typeof e?(t=this.parseTime(e.fadeIn??t),r=this.parseTime(e.fadeOut??r)):console.warn("pp-loading-transition is not valid JSON → default values (250 ms) will be used. String:",i)}return{fadeIn:t,fadeOut:r}}fadeOut(e,t){return new Promise(r=>{e.style.transition=`opacity ${t}ms ease-out`,setTimeout(()=>{e.style.transition="",r()},t)})}fadeIn(e,t){e.style.transition=`opacity ${t}ms ease-in`,setTimeout(()=>{e.style.transition=""},t)}parseTime(e){if("number"==typeof e)return e;let t=e.match(/^(\d+)(ms|s|m)?$/);if(t){let e=parseInt(t[1],10);switch(t[2]||"ms"){case"ms":default:return e;case"s":return 1e3*e;case"m":return 60*e*1e3}}return 0}async redirect(e){if(e)try{let t=new URL(e,window.location.origin);t.origin===window.location.origin&&this.navigationEnabled?await this.navigateTo(t.pathname+t.search+t.hash):window.location.href=e}catch(e){console.error("Redirect error:",e)}}async rpc(e,t={},r=!1){let i=null,n="boolean"==typeof r?{abortPrevious:r}:r;try{n.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),i=new AbortController,n.abortPrevious&&(this.activeAbortController=i);let r,s=this.resolveRpcUrl(n.url),a=this.resolveRpcCredentials(s,n.credentials),o={"X-CSRF-Token":await this.ensureCsrfToken(s,a,n.csrfUrl),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":e,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"},l=Object.values(t).some(e=>e instanceof File||e instanceof FileList&&e.length>0);if(l){let e=new FormData;for(let[r,i]of Object.entries(t))i instanceof File?e.append(r,i):i instanceof FileList?Array.from(i).forEach(t=>e.append(r,t)):null!=i&&e.append(r,"object"==typeof i?JSON.stringify(i):String(i));if(n.onUploadProgress)return await this.xhrFunction({url:s.toString(),headers:o,body:e,controller:i,credentials:a,options:n});r={method:"POST",headers:o,body:e,credentials:a,signal:i.signal}}else r={method:"POST",headers:{...o,"Content-Type":"application/json"},body:JSON.stringify(t),credentials:a,signal:i.signal};let c=await fetch(s.toString(),r);if(401===c.status)throw Error("Authentication required");if(403===c.status)throw Error("Permission denied");if(!c.ok){let e=await c.json().catch(()=>null);throw e||415!==c.status?Error(e?.error||`Request failed: ${c.status} ${c.statusText}`):Error("Server rejected data format (415).")}let p=this.getRedirectUrlFromResponse(c);return p?(await this.redirect(p),{redirected:!0,to:p}):(this.activeAbortController===i&&(this.activeAbortController=null),(c.headers.get("Content-Type")||"").includes("text/event-stream")&&c.body?(n.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(c.body,n)):await c.json())}catch(e){if(this.activeAbortController===i&&(this.activeAbortController=null),e instanceof Error&&"AbortError"===e.name)return console.log("Request was cancelled"),{cancelled:!0};if(n.onStreamError)return void n.onStreamError(e);throw console.error("RPC error:",e),e}}xhrFunction(e){let{url:t,headers:r,body:i,controller:n,credentials:s,options:a}=e;return new Promise((e,o)=>{let l=new XMLHttpRequest;l.open("POST",t,!0),l.withCredentials="include"===s;for(let[e,t]of Object.entries(r))l.setRequestHeader(e,t);let c=()=>{try{l.abort()}catch{}};n.signal.addEventListener("abort",c,{once:!0}),l.upload&&a.onUploadProgress&&(l.upload.onprogress=e=>{let t=e.lengthComputable?e.total:null,r=e.lengthComputable&&e.total>0?Math.min(100,Math.max(0,e.loaded/e.total*100)):null;a.onUploadProgress?.({loaded:e.loaded,total:t,percent:r})}),l.onerror=()=>{n.signal.removeEventListener("abort",c),o(Error("Network error (XHR upload)."))},l.onload=async()=>{if(n.signal.removeEventListener("abort",c),401===l.status)return o(Error("Authentication required"));if(403===l.status)return o(Error("Permission denied"));if(l.status<200||l.status>=300){let e=`Request failed: ${l.status} ${l.statusText}`;try{let t=JSON.parse(l.responseText||"{}");e=t?.error||t?.message||e}catch{}return o(Error(e))}let t=this.normalizeServerRedirectTarget(l.getResponseHeader("X-PP-Redirect")||(l.status>=300&&l.status<400?l.getResponseHeader("Location"):null));if(t)try{return await this.redirect(t),a.onUploadComplete?.(),e({redirected:!0,to:t})}catch(e){return o(e)}let r=l.responseText??"",i=r;try{i=JSON.parse(r)}catch{}a.onUploadComplete?.(),e(i)};try{l.send(i)}catch(e){n.signal.removeEventListener("abort",c),o(e)}})}async handleStream(e,t){let r=e.getReader(),i=new TextDecoder,n="";try{for(;;){let{done:e,value:s}=await r.read();if(e){t.onStreamComplete&&t.onStreamComplete();break}n+=i.decode(s,{stream:!0});let a=n.split("\n");n=a.pop()||"";for(let e of a)if(""!==e.trim()&&e.startsWith("data: ")){let r=e.slice(6),i=r;try{("true"===r||"false"===r||"null"===r||!isNaN(Number(r))||r.startsWith("{")||r.startsWith("[")||r.startsWith('"'))&&(i=JSON.parse(r))}catch{}t.onStream&&t.onStream(i)}}}catch(e){if(!t.onStreamError)throw e;t.onStreamError(e)}finally{r.releaseLock()}}};function Hn(e,t,r=(typeof window<"u"?window:globalThis),i=!0){let n=null;if(Object.defineProperty(r,e,{get(){if(null!==n)return n;if(t&&"object"==typeof t&&!Array.isArray(t)&&"getInstance"in t&&"function"==typeof t.getInstance)return n=t.getInstance(),n;if("function"!=typeof t)return n=t,n;try{return n=t.getInstance(),n}catch{return n=t,n}},set(t){null===t?n=null:console.warn(`Cannot override global ${e}`)},configurable:!0,enumerable:!0}),i)try{r[e]}catch(t){console.error(`Failed to initialize ${e}:`,t)}}Hn("pp",{getInstance:()=>Vn.getInstance()});export{Bn as ComponentInit,Vn as PPUtilities};
|
|
1
|
+
var e=class{static states=new Map;static scopes=new Map;static instances=new Map;static parents=new Map;static childrenByParent=new Map;static templates=new Map;static ownedTemplateData=new Map;static contextValues=new Map;static consumerContexts=new Map;static contextConsumers=new Map;static saveState(e,t){e&&this.states.set(e,t)}static getState(e){return this.states.get(e)}static removeState(e){this.states.delete(e)}static saveScope(e,t){this.scopes.set(e,t)}static getScope(e){return this.scopes.get(e)}static getRootAncestor(e){let t=e,r=new Set;for(;t&&!r.has(t);){r.add(t);let e=this.parents.get(t);if(!e)return t;t=e}return null}static resolveComponentId(e,t=null){if(!e)return null;if("app"!==e){if(t){let r=new Set,n=t;for(;n&&!r.has(n);){r.add(n);let t=this.instances.get(n);if((t?.el?.__ppBaseComponentId??t?.el?.getAttribute?.("pp-component")??null)===e)return n;n=this.parents.get(n)??null}}return e}let r=new Set,n=t,i=null;for(;n&&!r.has(n);){if(r.add(n),n.startsWith("page_"))return n;let e=this.parents.get(n)??null;if(!e){i=n;break}n=e}if(i)return i;for(let[e,t]of this.parents.entries())if(null===t&&this.scopes.has(e))return e;let s=this.scopes.keys().next().value;return"string"==typeof s?s:null}static getResolvedScope(e,t=null){let r=this.resolveComponentId(e,t);return r?this.scopes.get(r):void 0}static getResolvedScopeWithAncestors(e,t=null){let r=this.resolveComponentId(e,t);if(!r)return;let n=new Set,i=[],s=r;for(;s&&!n.has(s);){n.add(s);let e=this.scopes.get(s);e&&i.push(e),s=this.parents.get(s)??null}return 0!==i.length?Object.assign({},...i.reverse()):void 0}static removeScope(e){this.scopes.delete(e)}static registerInstance(e,t){let r=this.instances.get(e);r&&r!==t&&r.destroy?.(),this.instances.set(e,t)}static getInstance(e){return this.instances.get(e)}static removeInstance(e){this.instances.delete(e)}static saveParent(e,t){if(!e)return;let r=this.parents.get(e);if(r===t&&this.parents.has(e))return;if(this.parents.has(e)){let t=this.childrenByParent.get(r??null);t?.delete(e),0===t?.size&&this.childrenByParent.delete(r??null)}this.parents.set(e,t);let n=this.childrenByParent.get(t)??new Set;n.add(e),this.childrenByParent.set(t,n)}static getParent(e){return this.parents.get(e)}static removeParent(e){if(!this.parents.has(e))return;let t=this.parents.get(e)??null;Array.from(this.childrenByParent.get(e)??[]).forEach(e=>this.saveParent(e,t));let r=this.childrenByParent.get(t);r?.delete(e),0===r?.size&&this.childrenByParent.delete(t),this.childrenByParent.delete(e),this.parents.delete(e)}static getDescendantIds(e){let t=[],r=new Set,n=i=>{let s=this.childrenByParent.get(i);s&&s.forEach(i=>{i!==e&&(r.has(i)||(r.add(i),n(i),t.push(i)))})};return n(e),t}static saveContextValues(e,t){let r=this.contextValues.get(e)??new Map,n=new Set;return r.forEach((e,r)=>{t.has(r)||n.add(r)}),t.forEach((e,t)=>{r.has(t)&&Object.is(r.get(t),e)||n.add(t)}),t.size>0?this.contextValues.set(e,new Map(t)):this.contextValues.delete(e),Array.from(n)}static resolveContext(e,t){let r=e;for(;r;){let e=this.contextValues.get(r);if(e?.has(t))return{providerId:r,value:e.get(t)};r=this.parents.get(r)??null}return{providerId:null,value:t.defaultValue}}static updateContextDependencies(e,t){let r=new Set(t),n=this.consumerContexts.get(e)??new Set;n.forEach(t=>{r.has(t)||this.removeContextConsumer(t,e)}),r.forEach(t=>{n.has(t)||this.addContextConsumer(t,e)}),r.size>0?this.consumerContexts.set(e,r):this.consumerContexts.delete(e)}static getConsumersForContextsInSubtree(e,t){let r=new Set;for(let n of t){let t=this.contextConsumers.get(n);t&&t.forEach(t=>{t!==e&&this.isAncestor(e,t)&&r.add(t)})}return r}static removeContextTracking(e){let t=this.contextValues.get(e),r=t?this.getConsumersForContextsInSubtree(e,t.keys()):new Set;this.contextValues.delete(e);let n=this.consumerContexts.get(e);return n&&(n.forEach(t=>{this.removeContextConsumer(t,e)}),this.consumerContexts.delete(e)),this.removeParent(e),r}static saveTemplate(e,t){this.templates.has(e)||this.templates.set(e,t)}static getTemplate(e){return this.templates.get(e)}static removeTemplate(e){this.templates.delete(e)}static saveOwnedTemplates(e,t){this.ownedTemplateData.has(e)||this.ownedTemplateData.set(e,t)}static getOwnedTemplates(e){return this.ownedTemplateData.get(e)}static removeOwnedTemplates(e){this.ownedTemplateData.delete(e)}static clear(){this.states.clear(),this.scopes.clear(),this.instances.clear(),this.parents.clear(),this.childrenByParent.clear(),this.templates.clear(),this.ownedTemplateData.clear(),this.contextValues.clear(),this.consumerContexts.clear(),this.contextConsumers.clear()}static destroyAll(){let e=Array.from(this.instances.values()),t=new Set;for(let r of e)if(r&&!t.has(r)){t.add(r);try{r.destroy?.()}catch(e){console.warn("[PP-WARN] Failed to destroy component instance",e)}}}static getStats(){return{states:this.states.size,scopes:this.scopes.size,instances:this.instances.size,parents:this.parents.size,templates:this.templates.size,ownedData:this.ownedTemplateData.size,contextValues:this.contextValues.size,contextConsumers:this.contextConsumers.size}}static addContextConsumer(e,t){let r=this.contextConsumers.get(e)??new Set;r.add(t),this.contextConsumers.set(e,r)}static removeContextConsumer(e,t){let r=this.contextConsumers.get(e);r&&(r.delete(t),0===r.size&&this.contextConsumers.delete(e))}static isAncestor(e,t){let r=this.parents.get(t)??null;for(;r;){if(r===e)return!0;r=this.parents.get(r)??null}return!1}},t=new Set("class.for.while.if.else.return.function.var.let.const.import.export.this.debugger.delete.typeof.void.new.in.instanceof.do.try.catch.finally.switch.case.default.break.continue.yield.await.with.super.enum.extends.implements.interface.package.private.protected.public.static".split(".")),n=new Set("Array.Object.String.Number.Boolean.Math.JSON.Date.RegExp.Error.Map.Set.WeakMap.WeakSet.Promise.Symbol.BigInt.parseInt.parseFloat.isNaN.isFinite.encodeURI.decodeURI.encodeURIComponent.decodeURIComponent.console.window.document.undefined.null.NaN.Infinity.pp.true.false.setTimeout.setInterval.clearTimeout.clearInterval.requestAnimationFrame.cancelAnimationFrame.fetch.alert.confirm.prompt".split(".")),r=new Set("hidden.disabled.checked.selected.readonly.required.open.autofocus.multiple.ismap.noValidate.defer.async.autoplay.controls.loop.muted.default.reversed.scoped.seamless.sortable.translate.draggable.contenteditable.spellcheck".split("."));function i(e){return e.includes("-")?e.replace(/-([a-z])/g,e=>e[1].toUpperCase()):e}var a=new WeakMap,o=/^[A-Za-z_$][\w$]*$/;function s(e){return o.test(e)&&!t.has(e)}function c(e){let t=a.get(e);if(t)return t;let r=Object.keys(e).filter(s),n={keys:r,keySig:r.join("\0")};return a.set(e,n),n}function l(e,t){let r=Array(t.length);for(let n=0;n<t.length;n++)r[n]=e[t[n]];return r}var u=new Map,d=500,f=null,p=null;function m(e){p||=document.createElement("template"),p.innerHTML=e;let t=Array.from(p.content.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE?(e.textContent??"").trim().length>0:e.nodeType===Node.ELEMENT_NODE);if(1!==t.length)return null;let r=t[0];return r instanceof HTMLTemplateElement&&r.hasAttribute("pp-owner")?r.innerHTML:null}function h(e){let t=_(e),r=!1;for(;;){let e=m(t);if(null===e)break;t=e,r=!0}return r?t:null}function g(e){if(!e.includes("<textarea"))return e;let t=e.includes("pp-owner"),r=document.createElement("template");r.innerHTML=e;let n=!1;return r.content.querySelectorAll("textarea").forEach(e=>{let r=e;if(t){let e=h(r.value);if(null!==e)return r.textContent=e,void(n=!0)}r.value.length>0&&0===r.value.trim().length&&(r.textContent="",n=!0)}),n?r.innerHTML:e}function _(e){if(!e.includes("&"))return e;if(u.has(e))return u.get(e);f||=document.createElement("textarea");let t=f;t.innerHTML=e;let r=t.value,n=0;for(;r.includes("&")&&n++<10;){t.innerHTML=r;let e=t.value;if(e===r)break;r=e}if(u.size>=d){let e=u.keys().next().value;void 0!==e&&u.delete(e)}return u.set(e,r),r}var v="data-pp-fragment-root";function ee(e,t){let r=0,n=t-1;for(;n>=0&&"\\"===e[n];)r++,n--;return r%2!=0}function te(e,t){if("{"!==e[t])return-1;let r=0,n=null;for(let i=t;i<e.length;i++){let t=e[i],s=ee(e,i);if(n)t===n&&!s&&(n=null);else if(s||'"'!==t&&"'"!==t&&"`"!==t)if("{"!==t||s){if("}"===t&&!s&&(r--,0===r))return i}else r++;else n=t}return-1}function ne(e,t){return e.startsWith("{{",t)||e.startsWith("{%",t)||e.startsWith("{#",t)}function re(e,t){let r=e.startsWith("{{",t)?"}}":e.startsWith("{%",t)?"%}":e.startsWith("{#",t)?"#}":"";if(!r)return-1;let n=e.indexOf(r,t+2);return-1===n?-1:n+r.length}function y(e){let t=0;for(;t<e.length&&/\s/.test(e[t]);)t++;if("{"!==e[t]||ne(e,t))return null;let r=te(e,t);if(-1===r)return null;let n=r+1;for(;n<e.length&&/\s/.test(e[n]);)n++;return n===e.length?{expression:e.slice(t+1,r).trim(),start:t,end:r}:null}function ie(e,t){let r="",n=0;for(;n<e.length;){if("{"!==e[n]){r+=e[n],n++;continue}if(ne(e,n)){let t=re(e,n);if(-1===t){r+=e.slice(n);break}r+=e.slice(n,t),n=t;continue}let i=te(e,n);if(-1===i){r+=e.slice(n);break}let s=e.slice(n+1,i);r+=t(s.trim(),s),n=i+1}return r}function ae(e){let t=String(e??"").trim().toLowerCase();switch(t){case"table":return{prefix:`<table ${v}="">`,suffix:"</table>",rootSelector:`table[${v}]`};case"caption":return{prefix:`<table><caption ${v}="">`,suffix:"</caption></table>",rootSelector:`caption[${v}]`};case"thead":case"tbody":case"tfoot":return{prefix:`<table><${t} ${v}="">`,suffix:`</${t}></table>`,rootSelector:`${t}[${v}]`};case"tr":return{prefix:`<table><tbody><tr ${v}="">`,suffix:"</tr></tbody></table>",rootSelector:`tr[${v}]`};case"td":case"th":return{prefix:`<table><tbody><tr><${t} ${v}="">`,suffix:`</${t}></tr></tbody></table>`,rootSelector:`${t}[${v}]`};case"colgroup":return{prefix:`<table><colgroup ${v}="">`,suffix:"</colgroup></table>",rootSelector:`colgroup[${v}]`};case"select":return{prefix:`<select ${v}="">`,suffix:"</select>",rootSelector:`select[${v}]`};case"optgroup":return{prefix:`<select><optgroup ${v}="">`,suffix:"</optgroup></select>",rootSelector:`optgroup[${v}]`};case"option":return{prefix:`<select><option ${v}="">`,suffix:"</option></select>",rootSelector:`option[${v}]`};default:return{prefix:"",suffix:"",rootSelector:null}}}function oe(e){let t=ae(e);return{wrap:e=>`${t.prefix}${e}${t.suffix}`,unwrap:e=>{if(!t.prefix&&!t.suffix)return e;let r=document.createElement("template");if(r.innerHTML=e,t.rootSelector){let e=r.content.querySelector(t.rootSelector);if(e)return e.innerHTML}return e}}}function se(e,t){let r=ae(t),n=document.createElement("template");if(n.innerHTML=g(`${r.prefix}${e}${r.suffix}`),!r.rootSelector)return{root:n.content,toHtml:()=>n.innerHTML};let i=n.content.querySelector(r.rootSelector);return i?(i.removeAttribute(v),{root:i,toHtml:()=>i.innerHTML}):{root:n.content,toHtml:()=>n.innerHTML}}function ce(e,t){if(e===t)return!0;if(!e||!t||"object"!=typeof e||"object"!=typeof t)return!1;let r=Object.keys(e),n=r.length,i=0;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&(i++,i>n))return!1;if(i!==n)return!1;for(let i=0;i<n;i++){let n=r[i];if(e[n]!==t[n])return!1}return!0}var le=class t{static DATE_LIKE_INPUT_TYPES=new Set(["date","datetime-local","month","time","week"]);root;getScope;canBindElement;handlerCache=new Map;cachedRootElementCount=null;static VALUE_EDIT_INPUT_TYPES=new Set(["email","number","password","search","tel","text","url"]);static LARGE_INPUT_RENDER_DEFER_THRESHOLD=100;static deferredNativeInputEventDepth=0;static deferredNativeInputCallbacks=new Set;static deferredNativeInputFrameHandle=null;static deferredNativeInputTimerHandle=null;constructor(e,t,r){this.root=e,this.getScope=t,this.canBindElement=r??(e=>this.isRootOwnedElement(e))}clearCache(){this.handlerCache.clear()}static hasSameDirectBoundHandler(e,r,n,i){if(!r.startsWith("on")||r.includes("-"))return!1;let s=r.slice(2).toLowerCase();return!("input"===s&&e instanceof HTMLInputElement&&t.DATE_LIKE_INPUT_TYPES.has(e.type))&&(e[`__pp_bound_${s}`]===t.normalizeHandlerCode(n)&&e[`__pp_event_owner_${s}`]===(i??""))}static normalizeHandlerCode(e){let t=e.trim(),r=t.match(/^\{([\s\S]*)\}$/);return r?r[1].trim():t}invalidateElementCountCache(){this.cachedRootElementCount=null}resolveEventOwnerScope(t){let r=this.root.getAttribute("pp-component");return e.getResolvedScopeWithAncestors(t,r)}bindEvents(e){(e||this.fallbackCollectEventElements()).forEach(e=>{this.canBindElement(e)&&this.bindElementEvents(e)})}isRootOwnedElement(e){if(e===this.root)return!0;let t=e.closest("[pp-component]");return e===t&&(t=e.parentElement?.closest("[pp-component]")??null),t===this.root}bindElementEvents(e){let r=e.getAttribute("pp-event-owner");r&&e.removeAttribute("pp-event-owner");let n=[];Array.from(e.attributes).forEach(i=>{if(i.name.startsWith("on")&&!i.name.includes("-")){let s=i.name.slice(2).toLowerCase(),a=i.value,o=t.normalizeHandlerCode(a);n.push(i.name),this.getNativeEventNames(e,s).forEach(n=>{let s=`__pp_bound_${n}`,a=`__pp_event_owner_${n}`;if((e.__ppBoundEventBindings??=new Map).set(n,i.name),e[s]===o&&e[a]===(r??""))return;e[s]=o,e[a]=r??"";let l=e[`__pp_handler_${n}`];l&&e.removeEventListener(n,l);let c=i=>{let s=this.shouldPreserveNativeEdit(e,n),a=s&&this.shouldDeferNativeInputRender(),l=e;if(s&&(l.__ppPreserveNativeSelectionOnNextRender=!0),this.runWithNativeInputRenderPolicy(a,()=>{if(r){let t=this.resolveEventOwnerScope(r);if(t)return void this.executeHandlerWithScope(o,i,t,e)}let t=e.closest("[pp-component]");t===e&&(t=e.parentElement?.closest("[pp-component]")??null);let n=t?.getAttribute("pp-component")||null;if(n){let t=this.resolveEventOwnerScope(n);if(t)return void this.executeHandlerWithScope(o,i,t,e)}this.executeHandler(o,i,e)}),s){let r=()=>{l.__ppPreserveNativeSelectionOnNextRender&&delete l.__ppPreserveNativeSelectionOnNextRender};a?(t.enqueueDeferredNativeInputUpdate(r),this.ensureDeferredNativeInputBlurFlush(e)):queueMicrotask(r)}};e[`__pp_handler_${n}`]=c,e.addEventListener(n,c)})}}),n.forEach(t=>{e.removeAttribute(t)})}static unbindRemovedEventHandlers(e,t){let r=e.__ppBoundEventBindings;if(r&&0!==r.size){for(let[n,i]of Array.from(r)){if(t.hasAttribute(i))continue;let s=`__pp_handler_${n}`,a=e[s];a&&(e.removeEventListener(n,a),delete e[s]),delete e[`__pp_bound_${n}`],delete e[`__pp_event_owner_${n}`],r.delete(n)}0===r.size&&delete e.__ppBoundEventBindings}}getNativeEventNames(e,t){return"input"===t&&e instanceof HTMLInputElement&&this.isDateLikeInput(e)?["change","blur"]:[t]}isDateLikeInput(e){return t.DATE_LIKE_INPUT_TYPES.has(e.type)}static shouldDeferStateUpdatesForNativeInput(){return t.deferredNativeInputEventDepth>0}static enqueueDeferredNativeInputUpdate(e){t.deferredNativeInputCallbacks.add(e),t.scheduleDeferredNativeInputFlushOnNextFrame()}static flushDeferredNativeInputUpdates(){t.cancelScheduledDeferredNativeInputFlush();let e=Array.from(t.deferredNativeInputCallbacks);t.deferredNativeInputCallbacks.clear(),e.forEach(e=>e())}static scheduleDeferredNativeInputFlushOnNextFrame(){if(null!==t.deferredNativeInputFrameHandle||null!==t.deferredNativeInputTimerHandle)return;let e=()=>{t.deferredNativeInputFrameHandle=null,t.deferredNativeInputTimerHandle=null,t.flushDeferredNativeInputUpdates()};"function"!=typeof requestAnimationFrame?t.deferredNativeInputTimerHandle=setTimeout(e,0):t.deferredNativeInputFrameHandle=requestAnimationFrame(e)}static cancelScheduledDeferredNativeInputFlush(){null!==t.deferredNativeInputFrameHandle&&"function"==typeof cancelAnimationFrame&&cancelAnimationFrame(t.deferredNativeInputFrameHandle),t.deferredNativeInputFrameHandle=null,null!==t.deferredNativeInputTimerHandle&&(clearTimeout(t.deferredNativeInputTimerHandle),t.deferredNativeInputTimerHandle=null)}runWithNativeInputRenderPolicy(e,r){e&&t.deferredNativeInputEventDepth++;try{r()}finally{e&&t.deferredNativeInputEventDepth--}}shouldDeferNativeInputRender(){return null===this.cachedRootElementCount&&(this.cachedRootElementCount=this.root.getElementsByTagName("*").length+1),this.cachedRootElementCount>=t.LARGE_INPUT_RENDER_DEFER_THRESHOLD}ensureDeferredNativeInputBlurFlush(e){let r=e;if(r.__ppDeferredNativeInputBlurFlush)return;let n=()=>{delete r.__ppDeferredNativeInputBlurFlush,t.flushDeferredNativeInputUpdates()};r.__ppDeferredNativeInputBlurFlush=n,e.addEventListener("blur",n,{once:!0})}shouldPreserveNativeEdit(e,r){return"input"===r&&(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&t.VALUE_EDIT_INPUT_TYPES.has(e.type))}fallbackCollectEventElements(){let e=new Set,t=this.root.attributes;for(let r=0;r<t.length;r++)if(t[r].name.startsWith("on")&&!t[r].name.includes("-")){e.add(this.root);break}let r=this.root.querySelectorAll("*");for(let t=0;t<r.length;t++){let n=r[t],i=n.attributes;for(let t=0;t<i.length;t++)if(i[t].name.startsWith("on")&&!i[t].name.includes("-")){e.add(n);break}}return e}executeHandler(e,t,r){let n=this.root.getAttribute("pp-component"),i=this.resolveEventOwnerScope(n)||this.getScope();this.executeHandlerWithScope(e,t,i,r)}executeHandlerWithScope(e,t,r,n){let i=c(r),s=i.keys,a=l(r,s);try{let r=this.getCompiledHandler(e,s,i.keySig).call(n??t.currentTarget??null,...a,t);"function"==typeof r&&r(t)}catch(t){console.error("[PP-ERROR] Handler failed:",t),console.error("Code:",e)}}getCompiledHandler(e,t,r){let n=e+"|"+r,i=this.handlerCache.get(n);if(!i){if(this.handlerCache.size>=500){let e=this.handlerCache.keys().next().value;e&&this.handlerCache.delete(e)}let r,i="\n const e = event;\n const $event = event;\n const target = event?.target;\n const currentTarget = event?.currentTarget;\n const el = event?.currentTarget;\n ";try{r=Function(...t,"event",`"use strict";${i} return (${e})`)}catch{r=Function(...t,"event",`"use strict";${i} ${e}`)}return this.handlerCache.set(n,r),r}return i}},ue=class e{static strictDiagnostics=!1;hooks=[];currentIndex=0;onStateChange;componentLabel;pendingLayoutEffects=[];pendingEffects=[];currentEffectPhase=null;pendingSynchronousRenderUpdate=!1;pendingSynchronousLayoutUpdate=!1;pendingUpdate=!1;hasScheduledRender=!1;batchedUpdates=new Set;portalRegistrations=[];isRenderWindowOpen=!1;warnedHookOutsideRender=!1;warnedHookAfterDispose=!1;currentHookTypes=[];committedHookTypes=null;disposed=!1;constructor(e,t="unknown"){this.onStateChange=e,this.componentLabel=t}static setStrictDiagnostics(e){this.strictDiagnostics=e}static getStrictDiagnostics(){return this.strictDiagnostics}loadState(e){this.hooks=[...e]}getHooks(){return this.hooks}prepareRender(){this.disposed||(this.currentIndex=0,this.isRenderWindowOpen=!0,this.warnedHookOutsideRender=!1,this.currentHookTypes=[],this.pendingLayoutEffects=[],this.pendingEffects=[],this.currentEffectPhase=null,this.portalRegistrations=[])}startRenderPhase(){this.disposed||(this.currentEffectPhase="render")}finishRenderPhase(){"render"===this.currentEffectPhase&&(this.currentEffectPhase=null),this.isRenderWindowOpen=!1;let e=this.pendingSynchronousRenderUpdate;return this.pendingSynchronousRenderUpdate=!1,e?(this.batchedUpdates.clear(),!0):(this.validateHookSignature(),!1)}recordHook(e){if(this.disposed)return this.warnedHookAfterDispose||(this.warnedHookAfterDispose=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called after the component was disposed. Hooks cannot be used after destroy.`)),this.currentIndex++;!this.isRenderWindowOpen&&!this.warnedHookOutsideRender&&(this.warnedHookOutsideRender=!0,this.emitDiagnostic(`[PP-WARN] ${e} hook for component "${this.componentLabel}" was called outside an active render. Hooks must be called while the component script is rendering.`));let t=this.currentIndex++;return this.currentHookTypes[t]=e,t}validateHookSignature(){if(null===this.committedHookTypes)return void(this.committedHookTypes=this.currentHookTypes.slice());let e=this.committedHookTypes,t=this.currentHookTypes;e.length===t.length&&e.every((e,r)=>e===t[r])||this.emitDiagnostic(`[PP-WARN] Hook order changed for component "${this.componentLabel}". Previous: [${e.join(", ")}]. Current: [${t.join(", ")}]. Hooks must be called in the same order on every render.`)}runLayoutEffects(){if(this.disposed)return this.pendingLayoutEffects=[],!1;let e=this.pendingLayoutEffects;this.pendingLayoutEffects=[],this.currentEffectPhase="layout";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"layout cleanup")}),e.forEach(e=>{let t=this.runEffectCallback(e.callback,"layout effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"layout"}})}finally{this.currentEffectPhase=null}let t=this.pendingSynchronousLayoutUpdate;return this.pendingSynchronousLayoutUpdate=!1,t&&this.batchedUpdates.clear(),t}runEffects(){if(this.disposed)return void(this.pendingEffects=[]);let e=this.pendingEffects;this.pendingEffects=[],this.currentEffectPhase="effect";try{e.forEach(e=>{this.runEffectCleanup(e.previousCleanup,"effect cleanup")}),e.forEach(e=>{let t=this.runEffectCallback(e.callback,"effect");this.hooks[e.hookIndex]={deps:e.deps,cleanup:"function"==typeof t?t:void 0,effectType:"effect"}})}finally{this.currentEffectPhase=null}}runEffectCleanup(e,t){if(e)try{e()}catch(e){console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}runEffectCallback(e,t){try{let r=e();return r&&"object"==typeof r&&"then"in r&&"function"==typeof r.then?void console.warn(`[PP-WARN] ${t} for component "${this.componentLabel}" returned a Promise. Effects must return only a cleanup function; run async work inside the effect instead.`):r}catch(e){return void console.error(`[PP-ERROR] ${t} failed for component "${this.componentLabel}"`,e)}}dispose(){if(this.disposed)return;this.disposed=!0,this.pendingLayoutEffects=[],this.pendingEffects=[],this.pendingUpdate=!1,this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.portalRegistrations=[];let e=e=>{let t=e.cleanup;if("function"==typeof t)try{t()}finally{e.cleanup=void 0}};this.hooks.forEach(t=>{!t||"object"!=typeof t||"layout"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||"effect"===t.effectType&&e(t)}),this.hooks.forEach(t=>{!t||"object"!=typeof t||t.effectType||e(t)}),this.hooks=[],this.currentIndex=0}usePortal(e,t){let r=this.recordHook("portal");void 0===this.hooks[r]&&(this.hooks[r]={sourceParent:null});let n=this.hooks[r];return this.portalRegistrations.push({ref:e,target:t??null,info:n}),n}getPortalRegistrations(){return this.portalRegistrations}useState(e){let t=this.recordHook("state");void 0===this.hooks[t]&&(this.hooks[t]={__state:this.resolveInitialState(e),__setter:this.createStateSetter(t)});let r=this.hooks[t];("object"!=typeof r||!r||!("__state"in r))&&(this.hooks[t]={__state:r,__setter:this.createStateSetter(t)});let n=this.hooks[t];return[n.__state,n.__setter]}resolveInitialState(e){return"function"==typeof e?e():e}createStateSetter(e){return t=>{let r=this.hooks[e];if(this.disposed||void 0===r)return;let n="function"==typeof t?t(r.__state):t;Object.is(r.__state,n)||(r.__state=n,this.batchedUpdates.add(e),this.scheduleUpdate())}}scheduleUpdate(){if(!this.disposed){if("render"===this.currentEffectPhase)return void(this.pendingSynchronousRenderUpdate=!0);if("layout"===this.currentEffectPhase)return void(this.pendingSynchronousLayoutUpdate=!0);this.hasScheduledRender=!0,this.pendingUpdate||(this.pendingUpdate=!0,(le.shouldDeferStateUpdatesForNativeInput()?le.enqueueDeferredNativeInputUpdate:queueMicrotask)(()=>{if(this.pendingUpdate=!1,this.disposed)return this.hasScheduledRender=!1,void this.batchedUpdates.clear();this.hasScheduledRender&&(this.hasScheduledRender=!1,this.batchedUpdates.clear(),this.onStateChange())}))}}useRef(e=null){let t=this.recordHook("ref");return void 0===this.hooks[t]&&(this.hooks[t]={current:e}),this.hooks[t]}useMemo(e,t){let r=this.recordHook("memo"),n=this.hooks[r],i=this.normalizeDeps("memo",t);if(!n||!i||!n.deps||this.areDepsDifferent(n.deps,i)){let t=e();return this.hooks[r]={value:t,deps:i},t}return n.value}useCallback(e,t){let r=this.recordHook("callback"),n=this.hooks[r],i=this.normalizeDeps("callback",t);return n&&i&&n.deps&&!this.areDepsDifferent(n.deps,i)?n.callback:(this.hooks[r]={callback:e,deps:i},e)}useReducer(e,t,r){let n=this.recordHook("reducer");if(void 0===this.hooks[n]){let i={state:r?r(t):t,reducer:e,dispatch:null};i.dispatch=e=>{if(this.disposed)return;let t=i.reducer(i.state,e);Object.is(i.state,t)||(i.state=t,this.scheduleUpdate())},this.hooks[n]=i}let i=this.hooks[n];return i.reducer=e,[i.state,i.dispatch]}useEffect(e,t){let r=this.recordHook("effect"),n=this.hooks[r],i=this.normalizeDeps("effect",t);(!n||!i||!n.deps||this.areDepsDifferent(n.deps,i))&&this.pendingEffects.push({hookIndex:r,deps:i,callback:e,previousCleanup:"function"==typeof n?.cleanup?n.cleanup:void 0})}useLayoutEffect(e,t){let r=this.recordHook("layoutEffect"),n=this.hooks[r],i=this.normalizeDeps("layoutEffect",t);(!n||!i||!n.deps||this.areDepsDifferent(n.deps,i))&&this.pendingLayoutEffects.push({hookIndex:r,deps:i,callback:e,previousCleanup:"function"==typeof n?.cleanup?n.cleanup:void 0})}normalizeDeps(e,t){if(void 0!==t){if(Array.isArray(t))return t;this.emitDiagnostic(`[PP-WARN] ${e} dependencies for component "${this.componentLabel}" must be an array or omitted. Received ${this.describeDeps(t)}.`)}}describeDeps(e){return null===e?"null":"object"==typeof e?e.constructor?.name??"object":typeof e}emitDiagnostic(t){if(e.strictDiagnostics)throw Error(t);console.warn(t)}areDepsDifferent(e,t){return e.length!==t.length||t.some((t,r)=>!Object.is(t,e[r]))}},de=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,7,9,32,4,318,1,78,5,71,10,50,3,123,2,54,14,32,10,3,1,11,3,46,10,8,0,46,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,3,0,158,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,68,8,2,0,3,0,2,3,2,4,2,0,15,1,83,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,7,19,58,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,199,7,137,9,54,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,55,9,266,3,10,1,2,0,49,6,4,4,14,10,5350,0,7,14,11465,27,2343,9,87,9,39,4,60,6,26,9,535,9,470,0,2,54,8,3,82,0,12,1,19628,1,4178,9,519,45,3,22,543,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,101,0,161,6,10,9,357,0,62,13,499,13,245,1,2,9,233,0,3,0,8,1,6,0,475,6,110,6,6,9,4759,9,787719,239],fe=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,13,10,2,14,2,6,2,1,2,10,2,14,2,6,2,1,4,51,13,310,10,21,11,7,25,5,2,41,2,8,70,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,7,25,39,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,39,27,10,22,251,41,7,1,17,5,57,28,11,0,9,21,43,17,47,20,28,22,13,52,58,1,3,0,14,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,20,1,64,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,31,9,2,0,3,0,2,37,2,0,26,0,2,0,45,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,38,6,186,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,19,72,200,32,32,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,24,43,261,18,16,0,2,12,2,33,125,0,80,921,103,110,18,195,2637,96,16,1071,18,5,26,3994,6,582,6842,29,1763,568,8,30,18,78,18,29,19,47,17,3,32,20,6,18,433,44,212,63,33,24,3,24,45,74,6,0,67,12,65,1,2,0,15,4,10,7381,42,31,98,114,8702,3,2,6,2,1,2,290,16,0,30,2,3,0,15,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,1845,30,7,5,262,61,147,44,11,6,17,0,322,29,19,43,485,27,229,29,3,0,208,30,2,2,2,1,2,6,3,4,10,1,225,6,2,3,2,1,2,14,2,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42719,33,4381,3,5773,3,7472,16,621,2467,541,1507,4938,6,8489],pe="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛-࢟࣊-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄ఼ా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ೳഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-໎໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜕ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠏-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿ--ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯・꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_・",me="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࡰ-ࢇࢉ-ࢠ-ࣉऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౝౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽ-ೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜑᜟ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭌᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-Ა-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ--ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",he={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},b="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",ge={5:b,"5module":b+" export import",6:b+" const class extends export import super"},x=/^in(stanceof)?$/,S=RegExp("["+me+"]"),_e=RegExp("["+me+pe+"]");function ve(e,t){for(var r=65536,n=0;n<t.length;n+=2){if((r+=t[n])>e)return!1;if((r+=t[n+1])>=e)return!0}return!1}function C(e,t){return e<65?36===e:e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&S.test(String.fromCharCode(e)):!1!==t&&ve(e,fe)))}function w(e,t){return e<48?36===e:e<58||!(e<65)&&(e<91||(e<97?95===e:e<123||(e<=65535?e>=170&&_e.test(String.fromCharCode(e)):!1!==t&&(ve(e,fe)||ve(e,de)))))}var T=function(e,t){void 0===t&&(t={}),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};function E(e,t){return new T(e,{beforeExpr:!0,binop:t})}var D={beforeExpr:!0},O={startsExpr:!0},ye={};function k(e,t){return void 0===t&&(t={}),t.keyword=e,ye[e]=new T(e,t)}var A={num:new T("num",O),regexp:new T("regexp",O),string:new T("string",O),name:new T("name",O),privateId:new T("privateId",O),eof:new T("eof"),bracketL:new T("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new T("]"),braceL:new T("{",{beforeExpr:!0,startsExpr:!0}),braceR:new T("}"),parenL:new T("(",{beforeExpr:!0,startsExpr:!0}),parenR:new T(")"),comma:new T(",",D),semi:new T(";",D),colon:new T(":",D),dot:new T("."),question:new T("?",D),questionDot:new T("?."),arrow:new T("=>",D),template:new T("template"),invalidTemplate:new T("invalidTemplate"),ellipsis:new T("...",D),backQuote:new T("`",O),dollarBraceL:new T("${",{beforeExpr:!0,startsExpr:!0}),eq:new T("=",{beforeExpr:!0,isAssign:!0}),assign:new T("_=",{beforeExpr:!0,isAssign:!0}),incDec:new T("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new T("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:E("||",1),logicalAND:E("&&",2),bitwiseOR:E("|",3),bitwiseXOR:E("^",4),bitwiseAND:E("&",5),equality:E("==/!=/===/!==",6),relational:E("</>/<=/>=",7),bitShift:E("<</>>/>>>",8),plusMin:new T("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:E("%",10),star:E("*",10),slash:E("/",10),starstar:new T("**",{beforeExpr:!0}),coalesce:E("??",1),_break:k("break"),_case:k("case",D),_catch:k("catch"),_continue:k("continue"),_debugger:k("debugger"),_default:k("default",D),_do:k("do",{isLoop:!0,beforeExpr:!0}),_else:k("else",D),_finally:k("finally"),_for:k("for",{isLoop:!0}),_function:k("function",O),_if:k("if"),_return:k("return",D),_switch:k("switch"),_throw:k("throw",D),_try:k("try"),_var:k("var"),_const:k("const"),_while:k("while",{isLoop:!0}),_with:k("with"),_new:k("new",{beforeExpr:!0,startsExpr:!0}),_this:k("this",O),_super:k("super",O),_class:k("class",O),_extends:k("extends",D),_export:k("export"),_import:k("import",O),_null:k("null",O),_true:k("true",O),_false:k("false",O),_in:k("in",{beforeExpr:!0,binop:7}),_instanceof:k("instanceof",{beforeExpr:!0,binop:7}),_typeof:k("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:k("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:k("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},j=/\r\n?|\n|\u2028|\u2029/,be=new RegExp(j.source,"g");function xe(e){return 10===e||13===e||8232===e||8233===e}function Se(e,t,r){void 0===r&&(r=e.length);for(var n=t;n<r;n++){var i=e.charCodeAt(n);if(xe(i))return n<r-1&&13===i&&10===e.charCodeAt(n+1)?n+2:n+1}return-1}var Ce=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,M=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,we=Object.prototype,Te=we.hasOwnProperty,Ee=we.toString,De=Object.hasOwn||function(e,t){return Te.call(e,t)},Oe=Array.isArray||function(e){return"[object Array]"===Ee.call(e)},ke=Object.create(null);function N(e){return ke[e]||(ke[e]=RegExp("^(?:"+e.replace(/ /g,"|")+")$"))}function P(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}var Ae=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/,je=function(e,t){this.line=e,this.column=t};je.prototype.offset=function(e){return new je(this.line,this.column+e)};var Me=function(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)};function Ne(e,t){for(var r=1,n=0;;){var i=Se(e,n,t);if(i<0)return new je(r,t-n);++r,n=i}}var Pe={ecmaVersion:null,sourceType:"script",strict:!1,onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Fe=!1;function Ie(e){var t={};for(var r in Pe)t[r]=e&&De(e,r)?e[r]:Pe[r];if("latest"===t.ecmaVersion?t.ecmaVersion=1e8:null==t.ecmaVersion?(!Fe&&"object"==typeof console&&console.warn&&(Fe=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),t.ecmaVersion=11):t.ecmaVersion>=2015&&(t.ecmaVersion-=2009),t.allowReserved??=t.ecmaVersion<5,(!e||null==e.allowHashBang)&&(t.allowHashBang=t.ecmaVersion>=14),Oe(t.onToken)){var n=t.onToken;t.onToken=function(e){return n.push(e)}}if(Oe(t.onComment)&&(t.onComment=Le(t,t.onComment)),"commonjs"===t.sourceType&&t.allowAwaitOutsideFunction)throw Error("Cannot use allowAwaitOutsideFunction with sourceType: commonjs");return t}function Le(e,t){return function(r,n,i,s,a,o){var l={type:r?"Block":"Line",value:n,start:i,end:s};e.locations&&(l.loc=new Me(this,a,o)),e.ranges&&(l.range=[i,s]),t.push(l)}}var Re=1,F=2,ze=4,Be=8,Ve=16,He=32,Ue=64,We=128,Ge=256,Ke=512,qe=1024,Je=Re|F|Ge;function Ye(e,t){return F|(e?ze:0)|(t?Be:0)}var Xe=0,Ze=1,I=2,Qe=3,$e=4,et=5,L=function(e,t,r){this.options=e=Ie(e),this.sourceFile=e.sourceFile,this.keywords=N(ge[e.ecmaVersion>=6?6:"module"===e.sourceType?"5module":5]);var n="";!0!==e.allowReserved&&(n=he[e.ecmaVersion>=6?6:5===e.ecmaVersion?5:3],"module"===e.sourceType&&(n+=" await")),this.reservedWords=N(n);var i=(n?n+" ":"")+he.strict;this.reservedWordsStrict=N(i),this.reservedWordsStrictBind=N(i+" "+he.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(j).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=A.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||!0===e.strict||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope("commonjs"===this.options.sourceType?F:Re),this.regexpState=null,this.privateNameStack=[]},R={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowReturn:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},allowUsing:{configurable:!0},inClassStaticBlock:{configurable:!0}};L.prototype.parse=function(){var e=this,t=this.options.program||this.startNode();return this.nextToken(),this.catchStackOverflow(function(){return e.parseTopLevel(t)})},R.inFunction.get=function(){return(this.currentVarScope().flags&F)>0},R.inGenerator.get=function(){return(this.currentVarScope().flags&Be)>0},R.inAsync.get=function(){return(this.currentVarScope().flags&ze)>0},R.canAwait.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Ge|Ke))return!1;if(t&F)return(t&ze)>0}return this.inModule&&this.options.ecmaVersion>=13||this.options.allowAwaitOutsideFunction},R.allowReturn.get=function(){return!!(this.inFunction||this.options.allowReturnOutsideFunction&&this.currentVarScope().flags&Re)},R.allowSuper.get=function(){return(this.currentThisScope().flags&Ue)>0||this.options.allowSuperOutsideMethod},R.allowDirectSuper.get=function(){return(this.currentThisScope().flags&We)>0},R.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},R.allowNewDotTarget.get=function(){for(var e=this.scopeStack.length-1;e>=0;e--){var t=this.scopeStack[e].flags;if(t&(Ge|Ke)||t&F&&!(t&Ve))return!0}return!1},R.allowUsing.get=function(){var e=this.currentScope().flags;return!(e&qe||!this.inModule&&e&Re)},R.inClassStaticBlock.get=function(){return(this.currentVarScope().flags&Ge)>0},L.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,n=0;n<e.length;n++)r=e[n](r);return r},L.parse=function(e,t){return new this(t,e).parse()},L.parseExpressionAt=function(e,t,r){var n=new this(r,e,t);return n.nextToken(),n.parseExpression()},L.tokenizer=function(e,t){return new this(t,e)},Object.defineProperties(L.prototype,R);var z=L.prototype,tt=/^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;z.strictDirective=function(e){if(this.options.ecmaVersion<5)return!1;for(;;){M.lastIndex=e,e+=M.exec(this.input)[0].length;var t=tt.exec(this.input.slice(e));if(!t)return!1;if("use strict"===(t[1]||t[2])){M.lastIndex=e+t[0].length;var r=M.exec(this.input),n=r.index+r[0].length,i=this.input.charAt(n);return";"===i||"}"===i||j.test(r[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(n+1))}e+=t[0].length,M.lastIndex=e,e+=M.exec(this.input)[0].length,";"===this.input[e]&&e++}},z.eat=function(e){return this.type===e&&(this.next(),!0)},z.isContextual=function(e){return this.type===A.name&&this.value===e&&!this.containsEsc},z.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},z.catchStackOverflow=function(e){try{return e()}catch(e){if(!(e instanceof Error&&(/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message)||/\btoo much recursion\b/i.test(e.message))))throw e;this.raise(this.start,"Not enough stack space to parse input")}},z.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},z.canInsertSemicolon=function(){return this.type===A.eof||this.type===A.braceR||j.test(this.input.slice(this.lastTokEnd,this.start))},z.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},z.semicolon=function(){!this.eat(A.semi)&&!this.insertSemicolon()&&this.unexpected()},z.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},z.expect=function(e){this.eat(e)||this.unexpected()},z.unexpected=function(e){this.raise(e??this.start,"Unexpected token")};var nt=function(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1};z.checkPatternErrors=function(e,t){if(e){e.trailingComma>-1&&this.raiseRecoverable(e.trailingComma,"Comma is not permitted after the rest element");var r=t?e.parenthesizedAssign:e.parenthesizedBind;r>-1&&this.raiseRecoverable(r,t?"Assigning to rvalue":"Parenthesized pattern")}},z.checkExpressionErrors=function(e,t){if(!e)return!1;var r=e.shorthandAssign,n=e.doubleProto;if(!t)return r>=0||n>=0;r>=0&&this.raise(r,"Shorthand property assignments are valid only in destructuring patterns"),n>=0&&this.raiseRecoverable(n,"Redefinition of __proto__ property")},z.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},z.isSimpleAssignTarget=function(e){return"ParenthesizedExpression"===e.type?this.isSimpleAssignTarget(e.expression):"Identifier"===e.type||"MemberExpression"===e.type};var B=L.prototype;B.parseTopLevel=function(e){var t=Object.create(null);for(e.body||=[];this.type!==A.eof;){var r=this.parseStatement(null,!0,t);e.body.push(r)}if(this.inModule)for(var n=0,i=Object.keys(this.undefinedExports);n<i.length;n+=1){var s=i[n];this.raiseRecoverable(this.undefinedExports[s].start,"Export '"+s+"' is not defined")}return this.adaptDirectivePrologue(e.body),this.next(),e.sourceType="commonjs"===this.options.sourceType?"script":this.options.sourceType,this.finishNode(e,"Program")};var rt={kind:"loop"},it={kind:"switch"};B.isLet=function(e){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;M.lastIndex=this.pos;var t=M.exec(this.input),r=this.pos+t[0].length,n=this.fullCharCodeAt(r);if(91===n||92===n)return!0;if(e)return!1;if(123===n)return!0;if(C(n)){var i=r;do{r+=n<=65535?1:2}while(w(n=this.fullCharCodeAt(r)));if(92===n)return!0;var s=this.input.slice(i,r);if(!x.test(s))return!0}return!1},B.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;M.lastIndex=this.pos;var e,t=M.exec(this.input),r=this.pos+t[0].length;return!(j.test(this.input.slice(this.pos,r))||"function"!==this.input.slice(r,r+8)||r+8!==this.input.length&&(w(e=this.fullCharCodeAt(r+8))||92===e))},B.isUsingKeyword=function(e,t){if(this.options.ecmaVersion<17||!this.isContextual(e?"await":"using"))return!1;M.lastIndex=this.pos;var r=M.exec(this.input),n=this.pos+r[0].length;if(j.test(this.input.slice(this.pos,n)))return!1;if(e){var i,s=n+5;if("using"!==this.input.slice(n,s)||s===this.input.length||w(i=this.fullCharCodeAt(s))||92===i)return!1;M.lastIndex=s;var a=M.exec(this.input);if(n=s+a[0].length,a&&j.test(this.input.slice(s,n)))return!1}var o=this.fullCharCodeAt(n);if(!C(o)&&92!==o)return!1;var l=n;do{n+=o<=65535?1:2}while(w(o=this.fullCharCodeAt(n)));if(92===o)return!0;var c=this.input.slice(l,n);if(x.test(c))return!1;if(t&&!e&&"of"===c&&(M.lastIndex=n,n+=M.exec(this.input)[0].length,61!==this.input.charCodeAt(n)||61===(o=this.input.charCodeAt(n+1))||62===o))return!1;return!0},B.isAwaitUsing=function(e){return this.isUsingKeyword(!0,e)},B.isUsing=function(e){return this.isUsingKeyword(!1,e)},B.parseStatement=function(e,t,r){var n,i=this.type,s=this.startNode();switch(this.isLet(e)&&(i=A._var,n="let"),i){case A._break:case A._continue:return this.parseBreakContinueStatement(s,i.keyword);case A._debugger:return this.parseDebuggerStatement(s);case A._do:return this.parseDoStatement(s);case A._for:return this.parseForStatement(s);case A._function:return e&&(this.strict||"if"!==e&&"label"!==e)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(s,!1,!e);case A._class:return e&&this.unexpected(),this.parseClass(s,!0);case A._if:return this.parseIfStatement(s);case A._return:return this.parseReturnStatement(s);case A._switch:return this.parseSwitchStatement(s);case A._throw:return this.parseThrowStatement(s);case A._try:return this.parseTryStatement(s);case A._const:case A._var:return n||=this.value,e&&"var"!==n&&this.unexpected(),this.parseVarStatement(s,n);case A._while:return this.parseWhileStatement(s);case A._with:return this.parseWithStatement(s);case A.braceL:return this.parseBlock(!0,s);case A.semi:return this.parseEmptyStatement(s);case A._export:case A._import:if(this.options.ecmaVersion>10&&i===A._import){M.lastIndex=this.pos;var a=M.exec(this.input),o=this.pos+a[0].length,l=this.input.charCodeAt(o);if(40===l||46===l)return this.parseExpressionStatement(s,this.parseExpression())}return this.options.allowImportExportEverywhere||(t||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),i===A._import?this.parseImport(s):this.parseExport(s,r);default:if(this.isAsyncFunction())return e&&this.unexpected(),this.next(),this.parseFunctionStatement(s,!0,!e);var c=this.isAwaitUsing(!1)?"await using":this.isUsing(!1)?"using":null;if(c)return this.allowUsing||this.raise(this.start,"Using declaration cannot appear in the top level when source type is `script` or in the bare case statement"),e&&this.raise(this.start,"Using declaration is not allowed in single-statement positions"),"await using"===c&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.next(),this.parseVar(s,!1,c),this.semicolon(),this.finishNode(s,"VariableDeclaration");var p=this.value,h=this.parseExpression();return i===A.name&&"Identifier"===h.type&&this.eat(A.colon)?this.parseLabeledStatement(s,p,h,e):this.parseExpressionStatement(s,h)}},B.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(A.semi)||this.insertSemicolon()?e.label=null:this.type===A.name?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var n=0;n<this.labels.length;++n){var i=this.labels[n];if((null==e.label||i.name===e.label.name)&&(null!=i.kind&&(r||"loop"===i.kind)||e.label&&r))break}return n===this.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},B.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},B.parseDoStatement=function(e){return this.next(),this.labels.push(rt),e.body=this.parseStatement("do"),this.labels.pop(),this.expect(A._while),e.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat(A.semi):this.semicolon(),this.finishNode(e,"DoWhileStatement")},B.parseForStatement=function(e){this.next();var t=this.options.ecmaVersion>=9&&this.canAwait&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(rt),this.enterScope(0),this.expect(A.parenL),this.type===A.semi)return t>-1&&this.unexpected(t),this.parseFor(e,null);var r=this.isLet();if(this.type===A._var||this.type===A._const||r){var n=this.startNode(),i=r?"let":this.value;return this.next(),this.parseVar(n,!0,i),this.finishNode(n,"VariableDeclaration"),this.parseForAfterInit(e,n,t)}var s=this.isContextual("let"),a=!1,o=this.isUsing(!0)?"using":this.isAwaitUsing(!0)?"await using":null;if(o){var l=this.startNode();return this.next(),"await using"===o&&(this.canAwait||this.raise(this.start,"Await using cannot appear outside of async function"),this.next()),this.parseVar(l,!0,o),this.finishNode(l,"VariableDeclaration"),this.parseForAfterInit(e,l,t)}var c=this.containsEsc,p=new nt,h=this.start,u=t>-1?this.parseExprSubscripts(p,"await"):this.parseExpression(!0,p);return this.type===A._in||(a=this.options.ecmaVersion>=6&&this.isContextual("of"))?(t>-1?(this.type===A._in&&this.unexpected(t),e.await=!0):a&&this.options.ecmaVersion>=8&&(u.start!==h||c||"Identifier"!==u.type||"async"!==u.name?this.options.ecmaVersion>=9&&(e.await=!1):this.unexpected()),s&&a&&this.raise(u.start,"The left-hand side of a for-of loop may not start with 'let'."),this.toAssignable(u,!1,p),this.checkLValPattern(u),this.parseForIn(e,u)):(this.checkExpressionErrors(p,!0),t>-1&&this.unexpected(t),this.parseFor(e,u))},B.parseForAfterInit=function(e,t,r){return(this.type===A._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===t.declarations.length?(this.type===A._in?(("using"===t.kind||"await using"===t.kind)&&!t.declarations[0].init&&this.raise(this.start,"Using declaration is not allowed in for-in loops"),this.options.ecmaVersion>=9&&r>-1&&this.unexpected(r)):this.options.ecmaVersion>=9&&(e.await=r>-1),this.parseForIn(e,t)):(r>-1&&this.unexpected(r),this.parseFor(e,t))},B.parseFunctionStatement=function(e,t,r){return this.next(),this.parseFunction(e,ot|(r?0:st),!1,t)},B.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement("if"),e.alternate=this.eat(A._else)?this.parseStatement("if"):null,this.finishNode(e,"IfStatement")},B.parseReturnStatement=function(e){return this.allowReturn||this.raise(this.start,"'return' outside of function"),this.next(),this.eat(A.semi)||this.insertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},B.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(A.braceL),this.labels.push(it),this.enterScope(qe);for(var t,r=!1;this.type!==A.braceR;)if(this.type===A._case||this.type===A._default){var n=this.type===A._case;t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(A.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(null));return this.exitScope(),t&&this.finishNode(t,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(e,"SwitchStatement")},B.parseThrowStatement=function(e){return this.next(),j.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var at=[];B.parseCatchClauseParam=function(){var e=this.parseBindingAtom(),t="Identifier"===e.type;return this.enterScope(t?He:0),this.checkLValPattern(e,t?$e:I),this.expect(A.parenR),e},B.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.type===A._catch){var t=this.startNode();this.next(),this.eat(A.parenL)?t.param=this.parseCatchClauseParam():(this.options.ecmaVersion<10&&this.unexpected(),t.param=null,this.enterScope(0)),t.body=this.parseBlock(!1),this.exitScope(),e.handler=this.finishNode(t,"CatchClause")}return e.finalizer=this.eat(A._finally)?this.parseBlock():null,!e.handler&&!e.finalizer&&this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},B.parseVarStatement=function(e,t,r){return this.next(),this.parseVar(e,!1,t,r),this.semicolon(),this.finishNode(e,"VariableDeclaration")},B.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.labels.push(rt),e.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(e,"WhileStatement")},B.parseWithStatement=function(e){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement("with"),this.finishNode(e,"WithStatement")},B.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},B.parseLabeledStatement=function(e,t,r,n){for(var i=0,s=this.labels;i<s.length;i+=1)s[i].name===t&&this.raise(r.start,"Label '"+t+"' is already declared");for(var a=this.type.isLoop?"loop":this.type===A._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var l=this.labels[o];if(l.statementStart!==e.start)break;l.statementStart=this.start,l.kind=a}return this.labels.push({name:t,kind:a,statementStart:this.start}),e.body=this.parseStatement(n?-1===n.indexOf("label")?n+"label":n:"label"),this.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},B.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},B.parseBlock=function(e,t,r){for(void 0===e&&(e=!0),void 0===t&&(t=this.startNode()),t.body=[],this.expect(A.braceL),e&&this.enterScope(0);this.type!==A.braceR;){var n=this.parseStatement(null);t.body.push(n)}return r&&(this.strict=!1),this.next(),e&&this.exitScope(),this.finishNode(t,"BlockStatement")},B.parseFor=function(e,t){return e.init=t,this.expect(A.semi),e.test=this.type===A.semi?null:this.parseExpression(),this.expect(A.semi),e.update=this.type===A.parenR?null:this.parseExpression(),this.expect(A.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,"ForStatement")},B.parseForIn=function(e,t){var r=this.type===A._in;return this.next(),"VariableDeclaration"===t.type&&null!=t.declarations[0].init&&(!r||this.options.ecmaVersion<8||this.strict||"var"!==t.kind||"Identifier"!==t.declarations[0].id.type)&&this.raise(t.start,(r?"for-in":"for-of")+" loop variable declaration may not have an initializer"),e.left=t,e.right=r?this.parseExpression():this.parseMaybeAssign(),this.expect(A.parenR),e.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(e,r?"ForInStatement":"ForOfStatement")},B.parseVar=function(e,t,r,n){for(e.declarations=[],e.kind=r;;){var i=this.startNode();if(this.parseVarId(i,r),this.eat(A.eq)?i.init=this.parseMaybeAssign(t):n||"const"!==r||this.type===A._in||this.options.ecmaVersion>=6&&this.isContextual("of")?n||"using"!==r&&"await using"!==r||!(this.options.ecmaVersion>=17)||this.type===A._in||this.isContextual("of")?n||"Identifier"===i.id.type||t&&(this.type===A._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.raise(this.lastTokEnd,"Missing initializer in "+r+" declaration"):this.unexpected(),e.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat(A.comma))break}return e},B.parseVarId=function(e,t){e.id="using"===t||"await using"===t?this.parseIdent():this.parseBindingAtom(),this.checkLValPattern(e.id,"var"===t?Ze:I,!1)};var ot=1,st=2,ct=4;function lt(e,t){var r=t.key.name,n=e[r],i="true";return"MethodDefinition"===t.type&&("get"===t.kind||"set"===t.kind)&&(i=(t.static?"s":"i")+t.kind),"iget"===n&&"iset"===i||"iset"===n&&"iget"===i||"sget"===n&&"sset"===i||"sset"===n&&"sget"===i?(e[r]="true",!1):!!n||(e[r]=i,!1)}function ut(e,t){var r=e.computed,n=e.key;return!r&&("Identifier"===n.type&&n.name===t||"Literal"===n.type&&n.value===t)}B.parseFunction=function(e,t,r,n,i){this.initFunction(e),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!n)&&(this.type===A.star&&t&st&&this.unexpected(),e.generator=this.eat(A.star)),this.options.ecmaVersion>=8&&(e.async=!!n),t&ot&&(e.id=t&ct&&this.type!==A.name?null:this.parseIdent(),e.id&&!(t&st)&&this.checkLValSimple(e.id,this.strict||e.generator||e.async?this.treatFunctionsAsVar?Ze:I:Qe));var s=this.yieldPos,a=this.awaitPos,o=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ye(e.async,e.generator)),t&ot||(e.id=this.type===A.name?this.parseIdent():null),this.parseFunctionParams(e),this.parseFunctionBody(e,r,!1,i),this.yieldPos=s,this.awaitPos=a,this.awaitIdentPos=o,this.finishNode(e,t&ot?"FunctionDeclaration":"FunctionExpression")},B.parseFunctionParams=function(e){this.expect(A.parenL),e.params=this.parseBindingList(A.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},B.parseClass=function(e,t){this.next();var r=this.strict;this.strict=!0,this.parseClassId(e,t),this.parseClassSuper(e);var n=this.enterClassBody(),i=this.startNode(),s=!1;for(i.body=[],this.expect(A.braceL);this.type!==A.braceR;){var a=this.parseClassElement(null!==e.superClass);a&&(i.body.push(a),"MethodDefinition"===a.type&&"constructor"===a.kind?(s&&this.raiseRecoverable(a.start,"Duplicate constructor in the same class"),s=!0):a.key&&"PrivateIdentifier"===a.key.type&<(n,a)&&this.raiseRecoverable(a.key.start,"Identifier '#"+a.key.name+"' has already been declared"))}return this.strict=r,this.next(),e.body=this.finishNode(i,"ClassBody"),this.exitClassBody(),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},B.parseClassElement=function(e){if(this.eat(A.semi))return null;var t=this.options.ecmaVersion,r=this.startNode(),n="",i=!1,s=!1,a="method",o=!1;if(this.eatContextual("static")){if(t>=13&&this.eat(A.braceL))return this.parseClassStaticBlock(r),r;this.isClassElementNameStart()||this.type===A.star?o=!0:n="static"}if(r.static=o,!n&&t>=8&&this.eatContextual("async")&&(!this.isClassElementNameStart()&&this.type!==A.star||this.canInsertSemicolon()?n="async":s=!0),!n&&(t>=9||!s)&&this.eat(A.star)&&(i=!0),!n&&!s&&!i){var l=this.value;(this.eatContextual("get")||this.eatContextual("set"))&&(this.isClassElementNameStart()?a=l:n=l)}if(n?(r.computed=!1,r.key=this.startNodeAt(this.lastTokStart,this.lastTokStartLoc),r.key.name=n,this.finishNode(r.key,"Identifier")):this.parseClassElementName(r),t<13||this.type===A.parenL||"method"!==a||i||s){var c=!r.static&&ut(r,"constructor"),p=c&&e;c&&"method"!==a&&this.raise(r.key.start,"Constructor can't have get/set modifier"),r.kind=c?"constructor":a,this.parseClassMethod(r,i,s,p)}else this.parseClassField(r);return r},B.isClassElementNameStart=function(){return this.type===A.name||this.type===A.privateId||this.type===A.num||this.type===A.string||this.type===A.bracketL||this.type.keyword},B.parseClassElementName=function(e){this.type===A.privateId?("constructor"===this.value&&this.raise(this.start,"Classes can't have an element named '#constructor'"),e.computed=!1,e.key=this.parsePrivateIdent()):this.parsePropertyName(e)},B.parseClassMethod=function(e,t,r,n){var i=e.key;"constructor"===e.kind?(t&&this.raise(i.start,"Constructor can't be a generator"),r&&this.raise(i.start,"Constructor can't be an async method")):e.static&&ut(e,"prototype")&&this.raise(i.start,"Classes may not have a static property named prototype");var s=e.value=this.parseMethod(t,r,n);return"get"===e.kind&&0!==s.params.length&&this.raiseRecoverable(s.start,"getter should have no params"),"set"===e.kind&&1!==s.params.length&&this.raiseRecoverable(s.start,"setter should have exactly one param"),"set"===e.kind&&"RestElement"===s.params[0].type&&this.raiseRecoverable(s.params[0].start,"Setter cannot use rest params"),this.finishNode(e,"MethodDefinition")},B.parseClassField=function(e){return ut(e,"constructor")?this.raise(e.key.start,"Classes can't have a field named 'constructor'"):e.static&&ut(e,"prototype")&&this.raise(e.key.start,"Classes can't have a static field named 'prototype'"),this.eat(A.eq)?(this.enterScope(Ke|Ue),e.value=this.parseMaybeAssign(),this.exitScope()):e.value=null,this.semicolon(),this.finishNode(e,"PropertyDefinition")},B.parseClassStaticBlock=function(e){e.body=[];var t=this.labels;for(this.labels=[],this.enterScope(Ge|Ue);this.type!==A.braceR;){var r=this.parseStatement(null);e.body.push(r)}return this.next(),this.exitScope(),this.labels=t,this.finishNode(e,"StaticBlock")},B.parseClassId=function(e,t){this.type===A.name?(e.id=this.parseIdent(),t&&this.checkLValSimple(e.id,I,!1)):(!0===t&&this.unexpected(),e.id=null)},B.parseClassSuper=function(e){e.superClass=this.eat(A._extends)?this.parseExprSubscripts(null,!1):null},B.enterClassBody=function(){var e={declared:Object.create(null),used:[]};return this.privateNameStack.push(e),e.declared},B.exitClassBody=function(){var e=this.privateNameStack.pop(),t=e.declared,r=e.used;if(this.options.checkPrivateFields)for(var n=this.privateNameStack.length,i=0===n?null:this.privateNameStack[n-1],s=0;s<r.length;++s){var a=r[s];De(t,a.name)||(i?i.used.push(a):this.raiseRecoverable(a.start,"Private field '#"+a.name+"' must be declared in an enclosing class"))}},B.parseExportAllDeclaration=function(e,t){return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(e.exported=this.parseModuleExportName(),this.checkExport(t,e.exported,this.lastTokStart)):e.exported=null),this.expectContextual("from"),this.type!==A.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ExportAllDeclaration")},B.parseExport=function(e,t){if(this.next(),this.eat(A.star))return this.parseExportAllDeclaration(e,t);if(this.eat(A._default))return this.checkExport(t,"default",this.lastTokStart),e.declaration=this.parseExportDefaultDeclaration(),this.finishNode(e,"ExportDefaultDeclaration");if(this.shouldParseExportStatement())e.declaration=this.parseExportDeclaration(e),"VariableDeclaration"===e.declaration.type?this.checkVariableExport(t,e.declaration.declarations):this.checkExport(t,e.declaration.id,e.declaration.id.start),e.specifiers=[],e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[]);else{if(e.declaration=null,e.specifiers=this.parseExportSpecifiers(t),this.eatContextual("from"))this.type!==A.string&&this.unexpected(),e.source=this.parseExprAtom(),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause());else{for(var r=0,n=e.specifiers;r<n.length;r+=1){var i=n[r];this.checkUnreserved(i.local),this.checkLocalExport(i.local),"Literal"===i.local.type&&this.raise(i.local.start,"A string literal cannot be used as an exported binding without `from`.")}e.source=null,this.options.ecmaVersion>=16&&(e.attributes=[])}this.semicolon()}return this.finishNode(e,"ExportNamedDeclaration")},B.parseExportDeclaration=function(e){return this.parseStatement(null)},B.parseExportDefaultDeclaration=function(){var e;if(this.type===A._function||(e=this.isAsyncFunction())){var t=this.startNode();return this.next(),e&&this.next(),this.parseFunction(t,ot|ct,!1,e)}if(this.type===A._class){var r=this.startNode();return this.parseClass(r,"nullableID")}var n=this.parseMaybeAssign();return this.semicolon(),n},B.checkExport=function(e,t,r){e&&("string"!=typeof t&&(t="Identifier"===t.type?t.name:t.value),De(e,t)&&this.raiseRecoverable(r,"Duplicate export '"+t+"'"),e[t]=!0)},B.checkPatternExport=function(e,t){var r=t.type;if("Identifier"===r)this.checkExport(e,t,t.start);else if("ObjectPattern"===r)for(var n=0,i=t.properties;n<i.length;n+=1){var s=i[n];this.checkPatternExport(e,s)}else if("ArrayPattern"===r)for(var a=0,o=t.elements;a<o.length;a+=1){var l=o[a];l&&this.checkPatternExport(e,l)}else"Property"===r?this.checkPatternExport(e,t.value):"AssignmentPattern"===r?this.checkPatternExport(e,t.left):"RestElement"===r&&this.checkPatternExport(e,t.argument)},B.checkVariableExport=function(e,t){if(e)for(var r=0,n=t;r<n.length;r+=1){var i=n[r];this.checkPatternExport(e,i.id)}},B.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},B.parseExportSpecifier=function(e){var t=this.startNode();return t.local=this.parseModuleExportName(),t.exported=this.eatContextual("as")?this.parseModuleExportName():t.local,this.checkExport(e,t.exported,t.exported.start),this.finishNode(t,"ExportSpecifier")},B.parseExportSpecifiers=function(e){var t=[],r=!0;for(this.expect(A.braceL);!this.eat(A.braceR);){if(r)r=!1;else if(this.expect(A.comma),this.afterTrailingComma(A.braceR))break;t.push(this.parseExportSpecifier(e))}return t},B.parseImport=function(e){return this.next(),this.type===A.string?(e.specifiers=at,e.source=this.parseExprAtom()):(e.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),e.source=this.type===A.string?this.parseExprAtom():this.unexpected()),this.options.ecmaVersion>=16&&(e.attributes=this.parseWithClause()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},B.parseImportSpecifier=function(){var e=this.startNode();return e.imported=this.parseModuleExportName(),this.eatContextual("as")?e.local=this.parseIdent():(this.checkUnreserved(e.imported),e.local=e.imported),this.checkLValSimple(e.local,I),this.finishNode(e,"ImportSpecifier")},B.parseImportDefaultSpecifier=function(){var e=this.startNode();return e.local=this.parseIdent(),this.checkLValSimple(e.local,I),this.finishNode(e,"ImportDefaultSpecifier")},B.parseImportNamespaceSpecifier=function(){var e=this.startNode();return this.next(),this.expectContextual("as"),e.local=this.parseIdent(),this.checkLValSimple(e.local,I),this.finishNode(e,"ImportNamespaceSpecifier")},B.parseImportSpecifiers=function(){var e=[],t=!0;if(this.type===A.name&&(e.push(this.parseImportDefaultSpecifier()),!this.eat(A.comma)))return e;if(this.type===A.star)return e.push(this.parseImportNamespaceSpecifier()),e;for(this.expect(A.braceL);!this.eat(A.braceR);){if(t)t=!1;else if(this.expect(A.comma),this.afterTrailingComma(A.braceR))break;e.push(this.parseImportSpecifier())}return e},B.parseWithClause=function(){var e=[];if(!this.eat(A._with))return e;this.expect(A.braceL);for(var t={},r=!0;!this.eat(A.braceR);){if(r)r=!1;else if(this.expect(A.comma),this.afterTrailingComma(A.braceR))break;var n=this.parseImportAttribute(),i="Identifier"===n.key.type?n.key.name:n.key.value;De(t,i)&&this.raiseRecoverable(n.key.start,"Duplicate attribute key '"+i+"'"),t[i]=!0,e.push(n)}return e},B.parseImportAttribute=function(){var e=this.startNode();return e.key=this.type===A.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved),this.expect(A.colon),this.type!==A.string&&this.unexpected(),e.value=this.parseExprAtom(),this.finishNode(e,"ImportAttribute")},B.parseModuleExportName=function(){if(this.options.ecmaVersion>=13&&this.type===A.string){var e=this.parseLiteral(this.value);return Ae.test(e.value)&&this.raise(e.start,"An export name cannot include a lone surrogate."),e}return this.parseIdent(!0)},B.adaptDirectivePrologue=function(e){for(var t=0;t<e.length&&this.isDirectiveCandidate(e[t]);++t)e[t].directive=e[t].expression.raw.slice(1,-1)},B.isDirectiveCandidate=function(e){return this.options.ecmaVersion>=5&&"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"string"==typeof e.expression.value&&('"'===this.input[e.start]||"'"===this.input[e.start])};var V=L.prototype;V.toAssignable=function(e,t,r){if(this.options.ecmaVersion>=6&&e)switch(e.type){case"Identifier":this.inAsync&&"await"===e.name&&this.raise(e.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":case"RestElement":break;case"ObjectExpression":e.type="ObjectPattern",r&&this.checkPatternErrors(r,!0);for(var n=0,i=e.properties;n<i.length;n+=1){var s=i[n];this.toAssignable(s,t),"RestElement"===s.type&&("ArrayPattern"===s.argument.type||"ObjectPattern"===s.argument.type)&&this.raise(s.argument.start,"Unexpected token")}break;case"Property":"init"!==e.kind&&this.raise(e.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(e.value,t);break;case"ArrayExpression":e.type="ArrayPattern",r&&this.checkPatternErrors(r,!0),this.toAssignableList(e.elements,t);break;case"SpreadElement":e.type="RestElement",this.toAssignable(e.argument,t),"AssignmentPattern"===e.argument.type&&this.raise(e.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==e.operator&&this.raise(e.left.end,"Only '=' operator can be used for specifying default value."),e.type="AssignmentPattern",delete e.operator,this.toAssignable(e.left,t);break;case"ParenthesizedExpression":this.toAssignable(e.expression,t,r);break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}else r&&this.checkPatternErrors(r,!0);return e},V.toAssignableList=function(e,t){for(var r=e.length,n=0;n<r;n++){var i=e[n];i&&this.toAssignable(i,t)}if(r){var s=e[r-1];6===this.options.ecmaVersion&&t&&s&&"RestElement"===s.type&&"Identifier"!==s.argument.type&&this.unexpected(s.argument.start)}return e},V.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(!1,e),this.finishNode(t,"SpreadElement")},V.parseRestBinding=function(){var e=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==A.name&&this.unexpected(),e.argument=this.parseBindingAtom(),this.finishNode(e,"RestElement")},V.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case A.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(A.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case A.braceL:return this.parseObj(!0)}return this.parseIdent()},V.parseBindingList=function(e,t,r,n){for(var i=[],s=!0;!this.eat(e);)if(s?s=!1:this.expect(A.comma),t&&this.type===A.comma)i.push(null);else{if(r&&this.afterTrailingComma(e))break;if(this.type===A.ellipsis){var a=this.parseRestBinding();this.parseBindingListItem(a),i.push(a),this.type===A.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.expect(e);break}i.push(this.parseAssignableListItem(n))}return i},V.parseAssignableListItem=function(e){var t=this.parseMaybeDefault(this.start,this.startLoc);return this.parseBindingListItem(t),t},V.parseBindingListItem=function(e){return e},V.parseMaybeDefault=function(e,t,r){if(r||=this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat(A.eq))return r;var n=this.startNodeAt(e,t);return n.left=r,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},V.checkLValSimple=function(e,t,r){void 0===t&&(t=Xe);var n=t!==Xe;switch(e.type){case"Identifier":this.strict&&this.reservedWordsStrictBind.test(e.name)&&this.raiseRecoverable(e.start,(n?"Binding ":"Assigning to ")+e.name+" in strict mode"),n&&(t===I&&"let"===e.name&&this.raiseRecoverable(e.start,"let is disallowed as a lexically bound name"),r&&(De(r,e.name)&&this.raiseRecoverable(e.start,"Argument name clash"),r[e.name]=!0),t!==et&&this.declareName(e.name,t,e.start));break;case"ChainExpression":this.raiseRecoverable(e.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":n&&this.raiseRecoverable(e.start,"Binding member expression");break;case"ParenthesizedExpression":return n&&this.raiseRecoverable(e.start,"Binding parenthesized expression"),this.checkLValSimple(e.expression,t,r);default:this.raise(e.start,(n?"Binding":"Assigning to")+" rvalue")}},V.checkLValPattern=function(e,t,r){switch(void 0===t&&(t=Xe),e.type){case"ObjectPattern":for(var n=0,i=e.properties;n<i.length;n+=1){var s=i[n];this.checkLValInnerPattern(s,t,r)}break;case"ArrayPattern":for(var a=0,o=e.elements;a<o.length;a+=1){var l=o[a];l&&this.checkLValInnerPattern(l,t,r)}break;default:this.checkLValSimple(e,t,r)}},V.checkLValInnerPattern=function(e,t,r){switch(void 0===t&&(t=Xe),e.type){case"Property":this.checkLValInnerPattern(e.value,t,r);break;case"AssignmentPattern":this.checkLValPattern(e.left,t,r);break;case"RestElement":this.checkLValPattern(e.argument,t,r);break;default:this.checkLValPattern(e,t,r)}};var H=function(e,t,r,n,i){this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=n,this.generator=!!i},U={b_stat:new H("{",!1),b_expr:new H("{",!0),b_tmpl:new H("${",!1),p_stat:new H("(",!1),p_expr:new H("(",!0),q_tmpl:new H("`",!0,!0,function(e){return e.tryReadTemplateToken()}),f_stat:new H("function",!1),f_expr:new H("function",!0),f_expr_gen:new H("function",!0,!1,null,!0),f_gen:new H("function",!1,!1,null,!0)},dt=L.prototype;dt.initialContext=function(){return[U.b_stat]},dt.curContext=function(){return this.context[this.context.length-1]},dt.braceIsBlock=function(e){var t=this.curContext();return t===U.f_expr||t===U.f_stat||(e!==A.colon||t!==U.b_stat&&t!==U.b_expr?e===A._return||e===A.name&&this.exprAllowed?j.test(this.input.slice(this.lastTokEnd,this.start)):e===A._else||e===A.semi||e===A.eof||e===A.parenR||e===A.arrow||(e===A.braceL?t===U.b_stat:e!==A._var&&e!==A._const&&e!==A.name&&!this.exprAllowed):!t.isExpr)},dt.inGeneratorContext=function(){for(var e=this.context.length-1;e>=1;e--){var t=this.context[e];if("function"===t.token)return t.generator}return!1},dt.updateContext=function(e){var t,r=this.type;r.keyword&&e===A.dot?this.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.exprAllowed=r.beforeExpr},dt.overrideContext=function(e){this.curContext()!==e&&(this.context[this.context.length-1]=e)},A.parenR.updateContext=A.braceR.updateContext=function(){if(1!==this.context.length){var e=this.context.pop();e===U.b_stat&&"function"===this.curContext().token&&(e=this.context.pop()),this.exprAllowed=!e.isExpr}else this.exprAllowed=!0},A.braceL.updateContext=function(e){this.context.push(this.braceIsBlock(e)?U.b_stat:U.b_expr),this.exprAllowed=!0},A.dollarBraceL.updateContext=function(){this.context.push(U.b_tmpl),this.exprAllowed=!0},A.parenL.updateContext=function(e){var t=e===A._if||e===A._for||e===A._with||e===A._while;this.context.push(t?U.p_stat:U.p_expr),this.exprAllowed=!0},A.incDec.updateContext=function(){},A._function.updateContext=A._class.updateContext=function(e){!e.beforeExpr||e===A._else||e===A.semi&&this.curContext()!==U.p_stat||e===A._return&&j.test(this.input.slice(this.lastTokEnd,this.start))||(e===A.colon||e===A.braceL)&&this.curContext()===U.b_stat?this.context.push(U.f_stat):this.context.push(U.f_expr),this.exprAllowed=!1},A.colon.updateContext=function(){"function"===this.curContext().token&&this.context.pop(),this.exprAllowed=!0},A.backQuote.updateContext=function(){this.curContext()===U.q_tmpl?this.context.pop():this.context.push(U.q_tmpl),this.exprAllowed=!1},A.star.updateContext=function(e){if(e===A._function){var t=this.context.length-1;this.context[t]===U.f_expr?this.context[t]=U.f_expr_gen:this.context[t]=U.f_gen}this.exprAllowed=!0},A.name.updateContext=function(e){var t=!1;this.options.ecmaVersion>=6&&e!==A.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(t=!0),this.exprAllowed=t};var W=L.prototype;function ft(e){return"Identifier"===e.type||"ParenthesizedExpression"===e.type&&ft(e.expression)}function pt(e){return"MemberExpression"===e.type&&"PrivateIdentifier"===e.property.type||"ChainExpression"===e.type&&pt(e.expression)||"ParenthesizedExpression"===e.type&&pt(e.expression)}W.checkPropClash=function(e,t,r){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===e.type||this.options.ecmaVersion>=6&&(e.computed||e.method||e.shorthand))){var n,i=e.key;switch(i.type){case"Identifier":n=i.name;break;case"Literal":n=String(i.value);break;default:return}var s=e.kind;if(this.options.ecmaVersion>=6)return void("__proto__"===n&&"init"===s&&(t.proto&&(r?r.doubleProto<0&&(r.doubleProto=i.start):this.raiseRecoverable(i.start,"Redefinition of __proto__ property")),t.proto=!0));var a=t[n="$"+n];a?("init"===s?this.strict&&a.init||a.get||a.set:a.init||a[s])&&this.raiseRecoverable(i.start,"Redefinition of property"):a=t[n]={init:!1,get:!1,set:!1},a[s]=!0}},W.parseExpression=function(e,t){var r=this;return this.catchStackOverflow(function(){var n=r.start,i=r.startLoc,s=r.parseMaybeAssign(e,t);if(r.type===A.comma){var a=r.startNodeAt(n,i);for(a.expressions=[s];r.eat(A.comma);)a.expressions.push(r.parseMaybeAssign(e,t));return r.finishNode(a,"SequenceExpression")}return s})},W.parseMaybeAssign=function(e,t,r){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(e);this.exprAllowed=!1}var n=!1,i=-1,s=-1,a=-1;t?(i=t.parenthesizedAssign,s=t.trailingComma,a=t.doubleProto,t.parenthesizedAssign=t.trailingComma=-1):(t=new nt,n=!0);var o=this.start,l=this.startLoc;(this.type===A.parenL||this.type===A.name)&&(this.potentialArrowAt=this.start,this.potentialArrowInForAwait="await"===e);var c=this.parseMaybeConditional(e,t);if(r&&(c=r.call(this,c,o,l)),this.type.isAssign){var p=this.startNodeAt(o,l);return p.operator=this.value,this.type===A.eq&&(c=this.toAssignable(c,!1,t)),n||(t.parenthesizedAssign=t.trailingComma=t.doubleProto=-1),t.shorthandAssign>=c.start&&(t.shorthandAssign=-1),this.type===A.eq?this.checkLValPattern(c):this.checkLValSimple(c),p.left=c,this.next(),p.right=this.parseMaybeAssign(e),a>-1&&(t.doubleProto=a),this.finishNode(p,"AssignmentExpression")}return n&&this.checkExpressionErrors(t,!0),i>-1&&(t.parenthesizedAssign=i),s>-1&&(t.trailingComma=s),c},W.parseMaybeConditional=function(e,t){var r=this.start,n=this.startLoc,i=this.parseExprOps(e,t);if(this.checkExpressionErrors(t))return i;if(("ArrowFunctionExpression"!==i.type||i.start!==r)&&this.eat(A.question)){var s=this.startNodeAt(r,n);return s.test=i,s.consequent=this.parseMaybeAssign(),this.expect(A.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return i},W.parseExprOps=function(e,t){var r=this.start,n=this.startLoc,i=this.parseMaybeUnary(t,!1,!1,e);return this.checkExpressionErrors(t)||i.start===r&&"ArrowFunctionExpression"===i.type?i:this.parseExprOp(i,r,n,-1,e)},W.parseExprOp=function(e,t,r,n,i){var s=this.type.binop;if(null!=s&&(!i||this.type!==A._in)&&s>n){var a=this.type===A.logicalOR||this.type===A.logicalAND,o=this.type===A.coalesce;o&&(s=A.logicalAND.binop);var l=this.value;this.next();var c=this.start,p=this.startLoc,h=this.parseExprOp(this.parseMaybeUnary(null,!1,!1,i),c,p,s,i),u=this.buildBinary(t,r,e,h,l,a||o);return(a&&this.type===A.coalesce||o&&(this.type===A.logicalOR||this.type===A.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(u,t,r,n,i)}return e},W.buildBinary=function(e,t,r,n,i,s){"PrivateIdentifier"===n.type&&this.raise(n.start,"Private identifier can only be left side of binary expression");var a=this.startNodeAt(e,t);return a.left=r,a.operator=i,a.right=n,this.finishNode(a,s?"LogicalExpression":"BinaryExpression")},W.parseMaybeUnary=function(e,t,r,n){var i,s=this.start,a=this.startLoc;if(this.isContextual("await")&&this.canAwait)i=this.parseAwait(n),t=!0;else if(this.type.prefix){var o=this.startNode(),l=this.type===A.incDec;o.operator=this.value,o.prefix=!0,this.next(),o.argument=this.parseMaybeUnary(null,!0,l,n),this.checkExpressionErrors(e,!0),l?this.checkLValSimple(o.argument):this.strict&&"delete"===o.operator&&ft(o.argument)?this.raiseRecoverable(o.start,"Deleting local variable in strict mode"):"delete"===o.operator&&pt(o.argument)?this.raiseRecoverable(o.start,"Private fields can not be deleted"):t=!0,i=this.finishNode(o,l?"UpdateExpression":"UnaryExpression")}else if(t||this.type!==A.privateId){if(i=this.parseExprSubscripts(e,n),this.checkExpressionErrors(e))return i;for(;this.type.postfix&&!this.canInsertSemicolon();){var c=this.startNodeAt(s,a);c.operator=this.value,c.prefix=!1,c.argument=i,this.checkLValSimple(i),this.next(),i=this.finishNode(c,"UpdateExpression")}}else(n||0===this.privateNameStack.length)&&this.options.checkPrivateFields&&this.unexpected(),i=this.parsePrivateIdent(),this.type!==A._in&&this.unexpected();return r||!this.eat(A.starstar)?i:t?void this.unexpected(this.lastTokStart):this.buildBinary(s,a,i,this.parseMaybeUnary(null,!1,!1,n),"**",!1)},W.parseExprSubscripts=function(e,t){var r=this.start,n=this.startLoc,i=this.parseExprAtom(e,t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var s=this.parseSubscripts(i,r,n,!1,t);return e&&"MemberExpression"===s.type&&(e.parenthesizedAssign>=s.start&&(e.parenthesizedAssign=-1),e.parenthesizedBind>=s.start&&(e.parenthesizedBind=-1),e.trailingComma>=s.start&&(e.trailingComma=-1)),s},W.parseSubscripts=function(e,t,r,n,i){for(var s=this.options.ecmaVersion>=8&&"Identifier"===e.type&&"async"===e.name&&this.lastTokEnd===e.end&&!this.canInsertSemicolon()&&e.end-e.start===5&&this.potentialArrowAt===e.start,a=!1;;){var o=this.parseSubscript(e,t,r,n,s,a,i);if(o.optional&&(a=!0),o===e||"ArrowFunctionExpression"===o.type){if(a){var l=this.startNodeAt(t,r);l.expression=o,o=this.finishNode(l,"ChainExpression")}return o}e=o}},W.shouldParseAsyncArrow=function(){return!this.canInsertSemicolon()&&this.eat(A.arrow)},W.parseSubscriptAsyncArrow=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!0,n)},W.parseSubscript=function(e,t,r,n,i,s,a){var o=this.options.ecmaVersion>=11,l=o&&this.eat(A.questionDot);n&&l&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var c=this.eat(A.bracketL);if(c||l&&this.type!==A.parenL&&this.type!==A.backQuote||this.eat(A.dot)){var p=this.startNodeAt(t,r);p.object=e,c?(p.property=this.parseExpression(),this.expect(A.bracketR)):this.type===A.privateId&&"Super"!==e.type?p.property=this.parsePrivateIdent():p.property=this.parseIdent("never"!==this.options.allowReserved),p.computed=!!c,o&&(p.optional=l),e=this.finishNode(p,"MemberExpression")}else if(!n&&this.eat(A.parenL)){var h=new nt,u=this.yieldPos,d=this.awaitPos,f=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var m=this.parseExprList(A.parenR,this.options.ecmaVersion>=8,!1,h);if(i&&!l&&this.shouldParseAsyncArrow())return this.checkPatternErrors(h,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=u,this.awaitPos=d,this.awaitIdentPos=f,this.parseSubscriptAsyncArrow(t,r,m,a);this.checkExpressionErrors(h,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=d||this.awaitPos,this.awaitIdentPos=f||this.awaitIdentPos;var g=this.startNodeAt(t,r);g.callee=e,g.arguments=m,o&&(g.optional=l),e=this.finishNode(g,"CallExpression")}else if(this.type===A.backQuote){(l||s)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var _=this.startNodeAt(t,r);_.tag=e,_.quasi=this.parseTemplate({isTagged:!0}),e=this.finishNode(_,"TaggedTemplateExpression")}return e},W.parseExprAtom=function(e,t,r){this.type===A.slash&&this.readRegexp();var n,i=this.potentialArrowAt===this.start;switch(this.type){case A._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),n=this.startNode(),this.next(),this.type===A.parenL&&!this.allowDirectSuper&&this.raise(n.start,"super() call outside constructor of a subclass"),this.type!==A.dot&&this.type!==A.bracketL&&this.type!==A.parenL&&this.unexpected(),this.finishNode(n,"Super");case A._this:return n=this.startNode(),this.next(),this.finishNode(n,"ThisExpression");case A.name:var s=this.start,a=this.startLoc,o=this.containsEsc,l=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!o&&"async"===l.name&&!this.canInsertSemicolon()&&this.eat(A._function))return this.overrideContext(U.f_expr),this.parseFunction(this.startNodeAt(s,a),0,!1,!0,t);if(i&&!this.canInsertSemicolon()){if(this.eat(A.arrow))return this.parseArrowExpression(this.startNodeAt(s,a),[l],!1,t);if(this.options.ecmaVersion>=8&&"async"===l.name&&this.type===A.name&&!o&&(!this.potentialArrowInForAwait||"of"!==this.value||this.containsEsc))return l=this.parseIdent(!1),(this.canInsertSemicolon()||!this.eat(A.arrow))&&this.unexpected(),this.parseArrowExpression(this.startNodeAt(s,a),[l],!0,t)}return l;case A.regexp:var c=this.value;return(n=this.parseLiteral(c.value)).regex={pattern:c.pattern,flags:c.flags},n;case A.num:case A.string:return this.parseLiteral(this.value);case A._null:case A._true:case A._false:return(n=this.startNode()).value=this.type===A._null?null:this.type===A._true,n.raw=this.type.keyword,this.next(),this.finishNode(n,"Literal");case A.parenL:var p=this.start,h=this.parseParenAndDistinguishExpression(i,t);return e&&(e.parenthesizedAssign<0&&!this.isSimpleAssignTarget(h)&&(e.parenthesizedAssign=p),e.parenthesizedBind<0&&(e.parenthesizedBind=p)),h;case A.bracketL:return n=this.startNode(),this.next(),n.elements=this.parseExprList(A.bracketR,!0,!0,e),this.finishNode(n,"ArrayExpression");case A.braceL:return this.overrideContext(U.b_expr),this.parseObj(!1,e);case A._function:return n=this.startNode(),this.next(),this.parseFunction(n,0);case A._class:return this.parseClass(this.startNode(),!1);case A._new:return this.parseNew();case A.backQuote:return this.parseTemplate();case A._import:return this.options.ecmaVersion>=11?this.parseExprImport(r):this.unexpected();default:return this.parseExprAtomDefault()}},W.parseExprAtomDefault=function(){this.unexpected()},W.parseExprImport=function(e){var t=this.startNode();if(this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import"),this.next(),this.type===A.parenL&&!e)return this.parseDynamicImport(t);if(this.type===A.dot){var r=this.startNodeAt(t.start,t.loc&&t.loc.start);return r.name="import",t.meta=this.finishNode(r,"Identifier"),this.parseImportMeta(t)}this.unexpected()},W.parseDynamicImport=function(e){if(this.next(),e.source=this.parseMaybeAssign(),this.options.ecmaVersion>=16)this.eat(A.parenR)?e.options=null:(this.expect(A.comma),this.afterTrailingComma(A.parenR)?e.options=null:(e.options=this.parseMaybeAssign(),this.eat(A.parenR)||(this.expect(A.comma),this.afterTrailingComma(A.parenR)||this.unexpected())));else if(!this.eat(A.parenR)){var t=this.start;this.eat(A.comma)&&this.eat(A.parenR)?this.raiseRecoverable(t,"Trailing comma is not allowed in import()"):this.unexpected(t)}return this.finishNode(e,"ImportExpression")},W.parseImportMeta=function(e){this.next();var t=this.containsEsc;return e.property=this.parseIdent(!0),"meta"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for import is 'import.meta'"),t&&this.raiseRecoverable(e.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&!this.options.allowImportExportEverywhere&&this.raiseRecoverable(e.start,"Cannot use 'import.meta' outside a module"),this.finishNode(e,"MetaProperty")},W.parseLiteral=function(e){var t=this.startNode();return t.value=e,t.raw=this.input.slice(this.start,this.end),110===t.raw.charCodeAt(t.raw.length-1)&&(t.bigint=null==t.value?t.raw.slice(0,-1).replace(/_/g,""):t.value.toString()),this.next(),this.finishNode(t,"Literal")},W.parseParenExpression=function(){this.expect(A.parenL);var e=this.parseExpression();return this.expect(A.parenR),e},W.shouldParseArrow=function(e){return!this.canInsertSemicolon()},W.parseParenAndDistinguishExpression=function(e,t){var r,n=this.start,i=this.startLoc,s=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var a,o=this.start,l=this.startLoc,c=[],p=!0,h=!1,u=new nt,d=this.yieldPos,f=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==A.parenR;){if(p?p=!1:this.expect(A.comma),s&&this.afterTrailingComma(A.parenR,!0)){h=!0;break}if(this.type===A.ellipsis){a=this.start,c.push(this.parseParenItem(this.parseRestBinding())),this.type===A.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element");break}c.push(this.parseMaybeAssign(!1,u,this.parseParenItem))}var m=this.lastTokEnd,g=this.lastTokEndLoc;if(this.expect(A.parenR),e&&this.shouldParseArrow(c)&&this.eat(A.arrow))return this.checkPatternErrors(u,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=d,this.awaitPos=f,this.parseParenArrowList(n,i,c,t);(!c.length||h)&&this.unexpected(this.lastTokStart),a&&this.unexpected(a),this.checkExpressionErrors(u,!0),this.yieldPos=d||this.yieldPos,this.awaitPos=f||this.awaitPos,c.length>1?((r=this.startNodeAt(o,l)).expressions=c,this.finishNodeAt(r,"SequenceExpression",m,g)):r=c[0]}else r=this.parseParenExpression();if(this.options.preserveParens){var _=this.startNodeAt(n,i);return _.expression=r,this.finishNode(_,"ParenthesizedExpression")}return r},W.parseParenItem=function(e){return e},W.parseParenArrowList=function(e,t,r,n){return this.parseArrowExpression(this.startNodeAt(e,t),r,!1,n)};var mt=[];W.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var e=this.startNode();if(this.next(),this.options.ecmaVersion>=6&&this.type===A.dot){var t=this.startNodeAt(e.start,e.loc&&e.loc.start);t.name="new",e.meta=this.finishNode(t,"Identifier"),this.next();var r=this.containsEsc;return e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raiseRecoverable(e.property.start,"The only valid meta property for new is 'new.target'"),r&&this.raiseRecoverable(e.start,"'new.target' must not contain escaped characters"),this.allowNewDotTarget||this.raiseRecoverable(e.start,"'new.target' can only be used in functions and class static block"),this.finishNode(e,"MetaProperty")}var n=this.start,i=this.startLoc;return e.callee=this.parseSubscripts(this.parseExprAtom(null,!1,!0),n,i,!0,!1),"Super"===e.callee.type&&this.raiseRecoverable(n,"Invalid use of 'super'"),this.eat(A.parenL)?e.arguments=this.parseExprList(A.parenR,this.options.ecmaVersion>=8,!1):e.arguments=mt,this.finishNode(e,"NewExpression")},W.parseTemplateElement=function(e){var t=e.isTagged,r=this.startNode();return this.type===A.invalidTemplate?(t||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),r.value={raw:this.value.replace(/\r\n?/g,"\n"),cooked:null}):r.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),r.tail=this.type===A.backQuote,this.finishNode(r,"TemplateElement")},W.parseTemplate=function(e){void 0===e&&(e={});var t=e.isTagged;void 0===t&&(t=!1);var r=this.startNode();this.next(),r.expressions=[];var n=this.parseTemplateElement({isTagged:t});for(r.quasis=[n];!n.tail;)this.type===A.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect(A.dollarBraceL),r.expressions.push(this.parseExpression()),this.expect(A.braceR),r.quasis.push(n=this.parseTemplateElement({isTagged:t}));return this.next(),this.finishNode(r,"TemplateLiteral")},W.isAsyncProp=function(e){return!e.computed&&"Identifier"===e.key.type&&"async"===e.key.name&&(this.type===A.name||this.type===A.num||this.type===A.string||this.type===A.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===A.star)&&!j.test(this.input.slice(this.lastTokEnd,this.start))},W.parseObj=function(e,t){var r=this.startNode(),n=!0,i={};for(r.properties=[],this.next();!this.eat(A.braceR);){if(n)n=!1;else if(this.expect(A.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma(A.braceR))break;var s=this.parseProperty(e,t);e||this.checkPropClash(s,i,t),r.properties.push(s)}return this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},W.parseProperty=function(e,t){var r,n,i,s,a=this.startNode();if(this.options.ecmaVersion>=9&&this.eat(A.ellipsis))return e?(a.argument=this.parseIdent(!1),this.type===A.comma&&this.raiseRecoverable(this.start,"Comma is not permitted after the rest element"),this.finishNode(a,"RestElement")):(a.argument=this.parseMaybeAssign(!1,t),this.type===A.comma&&t&&t.trailingComma<0&&(t.trailingComma=this.start),this.finishNode(a,"SpreadElement"));this.options.ecmaVersion>=6&&(a.method=!1,a.shorthand=!1,(e||t)&&(i=this.start,s=this.startLoc),e||(r=this.eat(A.star)));var o=this.containsEsc;return this.parsePropertyName(a),!e&&!o&&this.options.ecmaVersion>=8&&!r&&this.isAsyncProp(a)?(n=!0,r=this.options.ecmaVersion>=9&&this.eat(A.star),this.parsePropertyName(a)):n=!1,this.parsePropertyValue(a,e,r,n,i,s,t,o),this.finishNode(a,"Property")},W.parseGetterSetter=function(e){var t=e.key.name;this.parsePropertyName(e),e.value=this.parseMethod(!1),e.kind=t;var r="get"===e.kind?0:1;if(e.value.params.length!==r){var n=e.value.start;"get"===e.kind?this.raiseRecoverable(n,"getter should have no params"):this.raiseRecoverable(n,"setter should have exactly one param")}else"set"===e.kind&&"RestElement"===e.value.params[0].type&&this.raiseRecoverable(e.value.params[0].start,"Setter cannot use rest params")},W.parsePropertyValue=function(e,t,r,n,i,s,a,o){(r||n)&&this.type===A.colon&&this.unexpected(),this.eat(A.colon)?(e.value=t?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,a),e.kind="init"):this.options.ecmaVersion>=6&&this.type===A.parenL?(t&&this.unexpected(),e.method=!0,e.value=this.parseMethod(r,n),e.kind="init"):t||o||!(this.options.ecmaVersion>=5)||e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.type===A.comma||this.type===A.braceR||this.type===A.eq?this.options.ecmaVersion>=6&&!e.computed&&"Identifier"===e.key.type?((r||n)&&this.unexpected(),this.checkUnreserved(e.key),"await"===e.key.name&&!this.awaitIdentPos&&(this.awaitIdentPos=i),t?e.value=this.parseMaybeDefault(i,s,this.copyNode(e.key)):this.type===A.eq&&a?(a.shorthandAssign<0&&(a.shorthandAssign=this.start),e.value=this.parseMaybeDefault(i,s,this.copyNode(e.key))):e.value=this.copyNode(e.key),e.kind="init",e.shorthand=!0):this.unexpected():((r||n)&&this.unexpected(),this.parseGetterSetter(e))},W.parsePropertyName=function(e){if(this.options.ecmaVersion>=6){if(this.eat(A.bracketL))return e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(A.bracketR),e.key;e.computed=!1}return e.key=this.type===A.num||this.type===A.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},W.initFunction=function(e){e.id=null,this.options.ecmaVersion>=6&&(e.generator=e.expression=!1),this.options.ecmaVersion>=8&&(e.async=!1)},W.parseMethod=function(e,t,r){var n=this.startNode(),i=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.initFunction(n),this.options.ecmaVersion>=6&&(n.generator=e),this.options.ecmaVersion>=8&&(n.async=!!t),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(Ye(t,n.generator)|Ue|(r?We:0)),this.expect(A.parenL),n.params=this.parseBindingList(A.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(n,!1,!0,!1),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(n,"FunctionExpression")},W.parseArrowExpression=function(e,t,r,n){var i=this.yieldPos,s=this.awaitPos,a=this.awaitIdentPos;return this.enterScope(Ye(r,!1)|Ve),this.initFunction(e),this.options.ecmaVersion>=8&&(e.async=!!r),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0,!1,n),this.yieldPos=i,this.awaitPos=s,this.awaitIdentPos=a,this.finishNode(e,"ArrowFunctionExpression")},W.parseFunctionBody=function(e,t,r,n){var i=t&&this.type!==A.braceL,s=this.strict,a=!1;if(i)e.body=this.parseMaybeAssign(n),e.expression=!0,this.checkParams(e,!1);else{var o=this.options.ecmaVersion>=7&&!this.isSimpleParamList(e.params);(!s||o)&&((a=this.strictDirective(this.end))&&o&&this.raiseRecoverable(e.start,"Illegal 'use strict' directive in function with non-simple parameter list"));var l=this.labels;this.labels=[],a&&(this.strict=!0),this.checkParams(e,!s&&!a&&!t&&!r&&this.isSimpleParamList(e.params)),this.strict&&e.id&&this.checkLValSimple(e.id,et),e.body=this.parseBlock(!1,void 0,a&&!s),e.expression=!1,this.adaptDirectivePrologue(e.body.body),this.labels=l}this.exitScope()},W.isSimpleParamList=function(e){for(var t=0,r=e;t<r.length;t+=1)if("Identifier"!==r[t].type)return!1;return!0},W.checkParams=function(e,t){for(var r=Object.create(null),n=0,i=e.params;n<i.length;n+=1){var s=i[n];this.checkLValInnerPattern(s,Ze,t?null:r)}},W.parseExprList=function(e,t,r,n){for(var i=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(A.comma),t&&this.afterTrailingComma(e))break;var a=void 0;r&&this.type===A.comma?a=null:this.type===A.ellipsis?(a=this.parseSpread(n),n&&this.type===A.comma&&n.trailingComma<0&&(n.trailingComma=this.start)):a=this.parseMaybeAssign(!1,n),i.push(a)}return i},W.checkUnreserved=function(e){var t=e.start,r=e.end,n=e.name;this.inGenerator&&"yield"===n&&this.raiseRecoverable(t,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===n&&this.raiseRecoverable(t,"Cannot use 'await' as identifier inside an async function"),!(this.currentThisScope().flags&Je)&&"arguments"===n&&this.raiseRecoverable(t,"Cannot use 'arguments' in class field initializer"),this.inClassStaticBlock&&("arguments"===n||"await"===n)&&this.raise(t,"Cannot use "+n+" in class static initialization block"),this.keywords.test(n)&&this.raise(t,"Unexpected keyword '"+n+"'"),!(this.options.ecmaVersion<6&&-1!==this.input.slice(t,r).indexOf("\\"))&&(this.strict?this.reservedWordsStrict:this.reservedWords).test(n)&&(!this.inAsync&&"await"===n&&this.raiseRecoverable(t,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(t,"The keyword '"+n+"' is reserved"))},W.parseIdent=function(e){var t=this.parseIdentNode();return this.next(!!e),this.finishNode(t,"Identifier"),e||(this.checkUnreserved(t),"await"===t.name&&!this.awaitIdentPos&&(this.awaitIdentPos=t.start)),t},W.parseIdentNode=function(){var e=this.startNode();return this.type===A.name?e.name=this.value:this.type.keyword?(e.name=this.type.keyword,("class"===e.name||"function"===e.name)&&(this.lastTokEnd!==this.lastTokStart+1||46!==this.input.charCodeAt(this.lastTokStart))&&this.context.pop(),this.type=A.name):this.unexpected(),e},W.parsePrivateIdent=function(){var e=this.startNode();return this.type===A.privateId?e.name=this.value:this.unexpected(),this.next(),this.finishNode(e,"PrivateIdentifier"),this.options.checkPrivateFields&&(0===this.privateNameStack.length?this.raise(e.start,"Private field '#"+e.name+"' must be declared in an enclosing class"):this.privateNameStack[this.privateNameStack.length-1].used.push(e)),e},W.parseYield=function(e){this.yieldPos||=this.start;var t=this.startNode();return this.next(),this.type===A.semi||this.canInsertSemicolon()||this.type!==A.star&&!this.type.startsExpr?(t.delegate=!1,t.argument=null):(t.delegate=this.eat(A.star),t.argument=this.parseMaybeAssign(e)),this.finishNode(t,"YieldExpression")},W.parseAwait=function(e){this.awaitPos||=this.start;var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!0,!1,e),this.finishNode(t,"AwaitExpression")};var ht=L.prototype;ht.raise=function(e,t){var r=Ne(this.input,e);t+=" ("+r.line+":"+r.column+")",this.sourceFile&&(t+=" in "+this.sourceFile);var n=SyntaxError(t);throw n.pos=e,n.loc=r,n.raisedAt=this.pos,n},ht.raiseRecoverable=ht.raise,ht.curPosition=function(){if(this.options.locations)return new je(this.curLine,this.pos-this.lineStart)};var G=L.prototype,gt=function(e){this.flags=e,this.var=[],this.lexical=[],this.functions=[]};G.enterScope=function(e){this.scopeStack.push(new gt(e))},G.exitScope=function(){this.scopeStack.pop()},G.treatFunctionsAsVarInScope=function(e){return e.flags&F||!this.inModule&&e.flags&Re},G.declareName=function(e,t,r){var n=!1;if(t===I){var i=this.currentScope();n=i.lexical.indexOf(e)>-1||i.functions.indexOf(e)>-1||i.var.indexOf(e)>-1,i.lexical.push(e),this.inModule&&i.flags&Re&&delete this.undefinedExports[e]}else if(t===$e)this.currentScope().lexical.push(e);else if(t===Qe){var s=this.currentScope();n=this.treatFunctionsAsVar?s.lexical.indexOf(e)>-1:s.lexical.indexOf(e)>-1||s.var.indexOf(e)>-1,s.functions.push(e)}else for(var a=this.scopeStack.length-1;a>=0;--a){var o=this.scopeStack[a];if(o.lexical.indexOf(e)>-1&&!(o.flags&He&&o.lexical[0]===e)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(e)>-1){n=!0;break}if(o.var.push(e),this.inModule&&o.flags&Re&&delete this.undefinedExports[e],o.flags&Je)break}n&&this.raiseRecoverable(r,"Identifier '"+e+"' has already been declared")},G.checkLocalExport=function(e){-1===this.scopeStack[0].lexical.indexOf(e.name)&&-1===this.scopeStack[0].var.indexOf(e.name)&&(this.undefinedExports[e.name]=e)},G.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},G.currentVarScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Je|Ke|Ge))return t}},G.currentThisScope=function(){for(var e=this.scopeStack.length-1;;e--){var t=this.scopeStack[e];if(t.flags&(Je|Ke|Ge)&&!(t.flags&Ve))return t}};var _t=function(e,t,r){this.type="",this.start=t,this.end=0,e.options.locations&&(this.loc=new Me(e,r)),e.options.directSourceFile&&(this.sourceFile=e.options.directSourceFile),e.options.ranges&&(this.range=[t,0])},vt=L.prototype;function yt(e,t,r,n){return e.type=t,e.end=r,this.options.locations&&(e.loc.end=n),this.options.ranges&&(e.range[1]=r),e}vt.startNode=function(){return new _t(this,this.start,this.startLoc)},vt.startNodeAt=function(e,t){return new _t(this,e,t)},vt.finishNode=function(e,t){return yt.call(this,e,t,this.lastTokEnd,this.lastTokEndLoc)},vt.finishNodeAt=function(e,t,r,n){return yt.call(this,e,t,r,n)},vt.copyNode=function(e){var t=new _t(this,e.start,this.startLoc);for(var r in e)t[r]=e[r];return t};var bt="Berf Beria_Erfe Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sidetic Sidt Sunu Sunuwar Tai_Yo Tayo Todhri Todr Tolong_Siki Tols Tulu_Tigalari Tutg Unknown Zzzz",xt="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",St=xt+" Extended_Pictographic",Ct=St,wt=St+" EBase EComp EMod EPres ExtPict",Tt=wt,Et={9:xt,10:St,11:St,12:wt,13:wt,14:wt},Dt={9:"",10:"",11:"",12:"",13:"",14:"Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji"},Ot="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",kt="Adlam Adlm Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",At=kt+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",jt=At+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho",Mt=jt+" Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi",Nt=Mt+" Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith",Pt={9:kt,10:At,11:jt,12:Mt,13:Nt,14:Nt+" "+bt},Ft={};function It(e){var t=Ft[e]={binary:N(Et[e]+" "+Ot),binaryOfStrings:N(Dt[e]),nonBinary:{General_Category:N(Ot),Script:N(Pt[e])}};t.nonBinary.Script_Extensions=t.nonBinary.Script,t.nonBinary.gc=t.nonBinary.General_Category,t.nonBinary.sc=t.nonBinary.Script,t.nonBinary.scx=t.nonBinary.Script_Extensions}for(var Lt=0,Rt=[9,10,11,12,13,14];Lt<Rt.length;Lt+=1){var zt=Rt[Lt];It(zt)}var K=L.prototype,Bt=function(e,t){this.parent=e,this.base=t||this};Bt.prototype.separatedFrom=function(e){for(var t=this;t;t=t.parent)for(var r=e;r;r=r.parent)if(t.base===r.base&&t!==r)return!0;return!1},Bt.prototype.sibling=function(){return new Bt(this.parent,this.base)};var q=function(e){this.parser=e,this.validFlags="gim"+(e.options.ecmaVersion>=6?"uy":"")+(e.options.ecmaVersion>=9?"s":"")+(e.options.ecmaVersion>=13?"d":"")+(e.options.ecmaVersion>=15?"v":""),this.unicodeProperties=Ft[e.options.ecmaVersion>=14?14:e.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchV=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=Object.create(null),this.backReferenceNames=[],this.branchID=null};function Vt(e){for(var t in e)return!0;return!1}function Ht(e){return 105===e||109===e||115===e}function Ut(e){return 36===e||e>=40&&e<=43||46===e||63===e||e>=91&&e<=94||e>=123&&e<=125}function Wt(e){return C(e,!0)||36===e||95===e}function Gt(e){return w(e,!0)||36===e||95===e||8204===e||8205===e}function Kt(e){return e>=65&&e<=90||e>=97&&e<=122}function qt(e){return e>=0&&e<=1114111}q.prototype.reset=function(e,t,r){var n=-1!==r.indexOf("v"),i=-1!==r.indexOf("u");this.start=0|e,this.source=t+"",this.flags=r,n&&this.parser.options.ecmaVersion>=15?(this.switchU=!0,this.switchV=!0,this.switchN=!0):(this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchV=!1,this.switchN=i&&this.parser.options.ecmaVersion>=9)},q.prototype.raise=function(e){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+e)},q.prototype.at=function(e,t){void 0===t&&(t=!1);var r=this.source,n=r.length;if(e>=n)return-1;var i=r.charCodeAt(e);if(!t&&!this.switchU||i<=55295||i>=57344||e+1>=n)return i;var s=r.charCodeAt(e+1);return s>=56320&&s<=57343?(i<<10)+s-56613888:i},q.prototype.nextIndex=function(e,t){void 0===t&&(t=!1);var r=this.source,n=r.length;if(e>=n)return n;var i,s=r.charCodeAt(e);return!t&&!this.switchU||s<=55295||s>=57344||e+1>=n||(i=r.charCodeAt(e+1))<56320||i>57343?e+1:e+2},q.prototype.current=function(e){return void 0===e&&(e=!1),this.at(this.pos,e)},q.prototype.lookahead=function(e){return void 0===e&&(e=!1),this.at(this.nextIndex(this.pos,e),e)},q.prototype.advance=function(e){void 0===e&&(e=!1),this.pos=this.nextIndex(this.pos,e)},q.prototype.eat=function(e,t){return void 0===t&&(t=!1),this.current(t)===e&&(this.advance(t),!0)},q.prototype.eatChars=function(e,t){void 0===t&&(t=!1);for(var r=this.pos,n=0,i=e;n<i.length;n+=1){var s=i[n],a=this.at(r,t);if(-1===a||a!==s)return!1;r=this.nextIndex(r,t)}return this.pos=r,!0},K.validateRegExpFlags=function(e){for(var t=e.validFlags,r=e.flags,n=!1,i=!1,s=0;s<r.length;s++){var a=r.charAt(s);-1===t.indexOf(a)&&this.raise(e.start,"Invalid regular expression flag"),r.indexOf(a,s+1)>-1&&this.raise(e.start,"Duplicate regular expression flag"),"u"===a&&(n=!0),"v"===a&&(i=!0)}this.options.ecmaVersion>=15&&n&&i&&this.raise(e.start,"Invalid regular expression flag")},K.validateRegExpPattern=function(e){this.regexp_pattern(e),!e.switchN&&this.options.ecmaVersion>=9&&Vt(e.groupNames)&&(e.switchN=!0,this.regexp_pattern(e))},K.regexp_pattern=function(e){e.pos=0,e.lastIntValue=0,e.lastStringValue="",e.lastAssertionIsQuantifiable=!1,e.numCapturingParens=0,e.maxBackReference=0,e.groupNames=Object.create(null),e.backReferenceNames.length=0,e.branchID=null,this.regexp_disjunction(e),e.pos!==e.source.length&&(e.eat(41)&&e.raise("Unmatched ')'"),(e.eat(93)||e.eat(125))&&e.raise("Lone quantifier brackets")),e.maxBackReference>e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;t<r.length;t+=1){var n=r[t];e.groupNames[n]||e.raise("Invalid named capture referenced")}},K.regexp_disjunction=function(e){var t=this.options.ecmaVersion>=16;for(t&&(e.branchID=new Bt(e.branchID,null)),this.regexp_alternative(e);e.eat(124);)t&&(e.branchID=e.branchID.sibling()),this.regexp_alternative(e);t&&(e.branchID=e.branchID.parent),this.regexp_eatQuantifier(e,!0)&&e.raise("Nothing to repeat"),e.eat(123)&&e.raise("Lone quantifier brackets")},K.regexp_alternative=function(e){for(;e.pos<e.source.length&&this.regexp_eatTerm(e););},K.regexp_eatTerm=function(e){return this.regexp_eatAssertion(e)?(e.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(e)&&e.switchU&&e.raise("Invalid quantifier"),!0):!!(e.switchU?this.regexp_eatAtom(e):this.regexp_eatExtendedAtom(e))&&(this.regexp_eatQuantifier(e),!0)},K.regexp_eatAssertion=function(e){var t=e.pos;if(e.lastAssertionIsQuantifiable=!1,e.eat(94)||e.eat(36))return!0;if(e.eat(92)){if(e.eat(66)||e.eat(98))return!0;e.pos=t}if(e.eat(40)&&e.eat(63)){var r=!1;if(this.options.ecmaVersion>=9&&(r=e.eat(60)),e.eat(61)||e.eat(33))return this.regexp_disjunction(e),e.eat(41)||e.raise("Unterminated group"),e.lastAssertionIsQuantifiable=!r,!0}return e.pos=t,!1},K.regexp_eatQuantifier=function(e,t){return void 0===t&&(t=!1),!!this.regexp_eatQuantifierPrefix(e,t)&&(e.eat(63),!0)},K.regexp_eatQuantifierPrefix=function(e,t){return e.eat(42)||e.eat(43)||e.eat(63)||this.regexp_eatBracedQuantifier(e,t)},K.regexp_eatBracedQuantifier=function(e,t){var r=e.pos;if(e.eat(123)){var n=0,i=-1;if(this.regexp_eatDecimalDigits(e)&&(n=e.lastIntValue,e.eat(44)&&this.regexp_eatDecimalDigits(e)&&(i=e.lastIntValue),e.eat(125)))return-1!==i&&i<n&&!t&&e.raise("numbers out of order in {} quantifier"),!0;e.switchU&&!t&&e.raise("Incomplete quantifier"),e.pos=r}return!1},K.regexp_eatAtom=function(e){return this.regexp_eatPatternCharacters(e)||e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)},K.regexp_eatReverseSolidusAtomEscape=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatAtomEscape(e))return!0;e.pos=t}return!1},K.regexp_eatUncapturingGroup=function(e){var t=e.pos;if(e.eat(40)){if(e.eat(63)){if(this.options.ecmaVersion>=16){var r=this.regexp_eatModifiers(e),n=e.eat(45);if(r||n){for(var i=0;i<r.length;i++){var s=r.charAt(i);r.indexOf(s,i+1)>-1&&e.raise("Duplicate regular expression modifiers")}if(n){var a=this.regexp_eatModifiers(e);!r&&!a&&58===e.current()&&e.raise("Invalid regular expression modifiers");for(var o=0;o<a.length;o++){var l=a.charAt(o);(a.indexOf(l,o+1)>-1||r.indexOf(l)>-1)&&e.raise("Duplicate regular expression modifiers")}}}}if(e.eat(58)){if(this.regexp_disjunction(e),e.eat(41))return!0;e.raise("Unterminated group")}}e.pos=t}return!1},K.regexp_eatCapturingGroup=function(e){if(e.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(e):63===e.current()&&e.raise("Invalid group"),this.regexp_disjunction(e),e.eat(41))return e.numCapturingParens+=1,!0;e.raise("Unterminated group")}return!1},K.regexp_eatModifiers=function(e){for(var t="",r=0;-1!==(r=e.current())&&Ht(r);)t+=P(r),e.advance();return t},K.regexp_eatExtendedAtom=function(e){return e.eat(46)||this.regexp_eatReverseSolidusAtomEscape(e)||this.regexp_eatCharacterClass(e)||this.regexp_eatUncapturingGroup(e)||this.regexp_eatCapturingGroup(e)||this.regexp_eatInvalidBracedQuantifier(e)||this.regexp_eatExtendedPatternCharacter(e)},K.regexp_eatInvalidBracedQuantifier=function(e){return this.regexp_eatBracedQuantifier(e,!0)&&e.raise("Nothing to repeat"),!1},K.regexp_eatSyntaxCharacter=function(e){var t=e.current();return!!Ut(t)&&(e.lastIntValue=t,e.advance(),!0)},K.regexp_eatPatternCharacters=function(e){for(var t=e.pos,r=0;-1!==(r=e.current())&&!Ut(r);)e.advance();return e.pos!==t},K.regexp_eatExtendedPatternCharacter=function(e){var t=e.current();return!(-1===t||36===t||t>=40&&t<=43||46===t||63===t||91===t||94===t||124===t)&&(e.advance(),!0)},K.regexp_groupSpecifier=function(e){if(e.eat(63)){this.regexp_eatGroupName(e)||e.raise("Invalid group");var t=this.options.ecmaVersion>=16,r=e.groupNames[e.lastStringValue];if(r)if(t)for(var n=0,i=r;n<i.length;n+=1)i[n].separatedFrom(e.branchID)||e.raise("Duplicate capture group name");else e.raise("Duplicate capture group name");t?(r||(e.groupNames[e.lastStringValue]=[])).push(e.branchID):e.groupNames[e.lastStringValue]=!0}},K.regexp_eatGroupName=function(e){if(e.lastStringValue="",e.eat(60)){if(this.regexp_eatRegExpIdentifierName(e)&&e.eat(62))return!0;e.raise("Invalid capture group name")}return!1},K.regexp_eatRegExpIdentifierName=function(e){if(e.lastStringValue="",this.regexp_eatRegExpIdentifierStart(e)){for(e.lastStringValue+=P(e.lastIntValue);this.regexp_eatRegExpIdentifierPart(e);)e.lastStringValue+=P(e.lastIntValue);return!0}return!1},K.regexp_eatRegExpIdentifierStart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),Wt(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)},K.regexp_eatRegExpIdentifierPart=function(e){var t=e.pos,r=this.options.ecmaVersion>=11,n=e.current(r);return e.advance(r),92===n&&this.regexp_eatRegExpUnicodeEscapeSequence(e,r)&&(n=e.lastIntValue),Gt(n)?(e.lastIntValue=n,!0):(e.pos=t,!1)},K.regexp_eatAtomEscape=function(e){return!!(this.regexp_eatBackReference(e)||this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)||e.switchN&&this.regexp_eatKGroupName(e))||(e.switchU&&(99===e.current()&&e.raise("Invalid unicode escape"),e.raise("Invalid escape")),!1)},K.regexp_eatBackReference=function(e){var t=e.pos;if(this.regexp_eatDecimalEscape(e)){var r=e.lastIntValue;if(e.switchU)return r>e.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1},K.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},K.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},K.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},K.regexp_eatZero=function(e){return 48===e.current()&&!tn(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},K.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},K.regexp_eatControlLetter=function(e){var t=e.current();return!!Kt(t)&&(e.lastIntValue=t%32,e.advance(),!0)},K.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){void 0===t&&(t=!1);var r=e.pos,n=t||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(n&&i>=55296&&i<=56319){var s=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var a=e.lastIntValue;if(a>=56320&&a<=57343)return e.lastIntValue=1024*(i-55296)+(a-56320)+65536,!0}e.pos=s,e.lastIntValue=i}return!0}if(n&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&qt(e.lastIntValue))return!0;n&&e.raise("Invalid unicode escape"),e.pos=r}return!1},K.regexp_eatIdentityEscape=function(e){if(e.switchU)return!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0);var t=e.current();return!(99===t||e.switchN&&107===t)&&(e.lastIntValue=t,e.advance(),!0)},K.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(t>=49&&t<=57){do{e.lastIntValue=10*e.lastIntValue+(t-48),e.advance()}while((t=e.current())>=48&&t<=57);return!0}return!1};var Jt=0,J=1,Y=2;function Yt(e){return 100===e||68===e||115===e||83===e||119===e||87===e}function Xt(e){return Kt(e)||95===e}function Zt(e){return Xt(e)||tn(e)}function Qt(e){return 33===e||e>=35&&e<=38||e>=42&&e<=44||46===e||e>=58&&e<=64||94===e||96===e||126===e}function $t(e){return 40===e||41===e||45===e||47===e||e>=91&&e<=93||e>=123&&e<=125}function en(e){return 33===e||35===e||37===e||38===e||44===e||45===e||e>=58&&e<=62||64===e||96===e||126===e}function tn(e){return e>=48&&e<=57}function nn(e){return e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102}function rn(e){return e>=65&&e<=70?e-65+10:e>=97&&e<=102?e-97+10:e-48}function an(e){return e>=48&&e<=55}K.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(Yt(t))return e.lastIntValue=-1,e.advance(),J;var r=!1;if(e.switchU&&this.options.ecmaVersion>=9&&((r=80===t)||112===t)){var n;if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(n=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return r&&n===Y&&e.raise("Invalid property name"),n;e.raise("Invalid property name")}return Jt},K.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e)){var n=e.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(e,r,n),J}}if(e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)){var i=e.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(e,i)}return Jt},K.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){De(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")},K.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?J:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?Y:void e.raise("Invalid property name")},K.regexp_eatUnicodePropertyName=function(e){var t=0;for(e.lastStringValue="";Xt(t=e.current());)e.lastStringValue+=P(t),e.advance();return""!==e.lastStringValue},K.regexp_eatUnicodePropertyValue=function(e){var t=0;for(e.lastStringValue="";Zt(t=e.current());)e.lastStringValue+=P(t),e.advance();return""!==e.lastStringValue},K.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},K.regexp_eatCharacterClass=function(e){if(e.eat(91)){var t=e.eat(94),r=this.regexp_classContents(e);return e.eat(93)||e.raise("Unterminated character class"),t&&r===Y&&e.raise("Negated character class may contain strings"),!0}return!1},K.regexp_classContents=function(e){return 93===e.current()?J:e.switchV?this.regexp_classSetExpression(e):(this.regexp_nonEmptyClassRanges(e),J)},K.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassAtom(e)){var r=e.lastIntValue;e.switchU&&(-1===t||-1===r)&&e.raise("Invalid character class"),-1!==t&&-1!==r&&t>r&&e.raise("Range out of order in character class")}}},K.regexp_eatClassAtom=function(e){var t=e.pos;if(e.eat(92)){if(this.regexp_eatClassEscape(e))return!0;if(e.switchU){var r=e.current();(99===r||an(r))&&e.raise("Invalid class escape"),e.raise("Invalid escape")}e.pos=t}var n=e.current();return 93!==n&&(e.lastIntValue=n,e.advance(),!0)},K.regexp_eatClassEscape=function(e){var t=e.pos;if(e.eat(98))return e.lastIntValue=8,!0;if(e.switchU&&e.eat(45))return e.lastIntValue=45,!0;if(!e.switchU&&e.eat(99)){if(this.regexp_eatClassControlLetter(e))return!0;e.pos=t}return this.regexp_eatCharacterClassEscape(e)||this.regexp_eatCharacterEscape(e)},K.regexp_classSetExpression=function(e){var t,r=J;if(!this.regexp_eatClassSetRange(e))if(t=this.regexp_eatClassSetOperand(e)){t===Y&&(r=Y);for(var n=e.pos;e.eatChars([38,38]);)38!==e.current()&&(t=this.regexp_eatClassSetOperand(e))?t!==Y&&(r=J):e.raise("Invalid character in character class");if(n!==e.pos)return r;for(;e.eatChars([45,45]);)this.regexp_eatClassSetOperand(e)||e.raise("Invalid character in character class");if(n!==e.pos)return r}else e.raise("Invalid character in character class");for(;;)if(!this.regexp_eatClassSetRange(e)){if(!(t=this.regexp_eatClassSetOperand(e)))return r;t===Y&&(r=Y)}},K.regexp_eatClassSetRange=function(e){var t=e.pos;if(this.regexp_eatClassSetCharacter(e)){var r=e.lastIntValue;if(e.eat(45)&&this.regexp_eatClassSetCharacter(e)){var n=e.lastIntValue;return-1!==r&&-1!==n&&r>n&&e.raise("Range out of order in character class"),!0}e.pos=t}return!1},K.regexp_eatClassSetOperand=function(e){return this.regexp_eatClassSetCharacter(e)?J:this.regexp_eatClassStringDisjunction(e)||this.regexp_eatNestedClass(e)},K.regexp_eatNestedClass=function(e){var t=e.pos;if(e.eat(91)){var r=e.eat(94),n=this.regexp_classContents(e);if(e.eat(93))return r&&n===Y&&e.raise("Negated character class may contain strings"),n;e.pos=t}if(e.eat(92)){var i=this.regexp_eatCharacterClassEscape(e);if(i)return i;e.pos=t}return null},K.regexp_eatClassStringDisjunction=function(e){var t=e.pos;if(e.eatChars([92,113])){if(e.eat(123)){var r=this.regexp_classStringDisjunctionContents(e);if(e.eat(125))return r}else e.raise("Invalid escape");e.pos=t}return null},K.regexp_classStringDisjunctionContents=function(e){for(var t=this.regexp_classString(e);e.eat(124);)this.regexp_classString(e)===Y&&(t=Y);return t},K.regexp_classString=function(e){for(var t=0;this.regexp_eatClassSetCharacter(e);)t++;return 1===t?J:Y},K.regexp_eatClassSetCharacter=function(e){var t=e.pos;if(e.eat(92))return!(!this.regexp_eatCharacterEscape(e)&&!this.regexp_eatClassSetReservedPunctuator(e))||(e.eat(98)?(e.lastIntValue=8,!0):(e.pos=t,!1));var r=e.current();return!(r<0||r===e.lookahead()&&Qt(r)||$t(r))&&(e.advance(),e.lastIntValue=r,!0)},K.regexp_eatClassSetReservedPunctuator=function(e){var t=e.current();return!!en(t)&&(e.lastIntValue=t,e.advance(),!0)},K.regexp_eatClassControlLetter=function(e){var t=e.current();return!(!tn(t)&&95!==t)&&(e.lastIntValue=t%32,e.advance(),!0)},K.regexp_eatHexEscapeSequence=function(e){var t=e.pos;if(e.eat(120)){if(this.regexp_eatFixedHexDigits(e,2))return!0;e.switchU&&e.raise("Invalid escape"),e.pos=t}return!1},K.regexp_eatDecimalDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;tn(r=e.current());)e.lastIntValue=10*e.lastIntValue+(r-48),e.advance();return e.pos!==t},K.regexp_eatHexDigits=function(e){var t=e.pos,r=0;for(e.lastIntValue=0;nn(r=e.current());)e.lastIntValue=16*e.lastIntValue+rn(r),e.advance();return e.pos!==t},K.regexp_eatLegacyOctalEscapeSequence=function(e){if(this.regexp_eatOctalDigit(e)){var t=e.lastIntValue;if(this.regexp_eatOctalDigit(e)){var r=e.lastIntValue;t<=3&&this.regexp_eatOctalDigit(e)?e.lastIntValue=64*t+8*r+e.lastIntValue:e.lastIntValue=8*t+r}else e.lastIntValue=t;return!0}return!1},K.regexp_eatOctalDigit=function(e){var t=e.current();return an(t)?(e.lastIntValue=t-48,e.advance(),!0):(e.lastIntValue=0,!1)},K.regexp_eatFixedHexDigits=function(e,t){var r=e.pos;e.lastIntValue=0;for(var n=0;n<t;++n){var i=e.current();if(!nn(i))return e.pos=r,!1;e.lastIntValue=16*e.lastIntValue+rn(i),e.advance()}return!0};var on=function(e){this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,e.options.locations&&(this.loc=new Me(e,e.startLoc,e.endLoc)),e.options.ranges&&(this.range=[e.start,e.end])},X=L.prototype;function sn(e,t){return t?parseInt(e,8):parseFloat(e.replace(/_/g,""))}function cn(e){return"function"==typeof BigInt?BigInt(e.replace(/_/g,"")):null}X.next=function(e){!e&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new on(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},X.getToken=function(){return this.next(),new on(this)},typeof Symbol<"u"&&(X[Symbol.iterator]=function(){var e=this;return{next:function(){var t=e.getToken();return{done:t.type===A.eof,value:t}}}}),X.nextToken=function(){var e=this.curContext();return(!e||!e.preserveSpace)&&this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken(A.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},X.readToken=function(e){return C(e,this.options.ecmaVersion>=6)||92===e?this.readWord():this.getTokenFromCode(e)},X.fullCharCodeAt=function(e){var t=this.input.charCodeAt(e);if(t<=55295||t>=56320)return t;var r=this.input.charCodeAt(e+1);return r<=56319||r>=57344?t:(t<<10)+r-56613888},X.fullCharCodeAtPos=function(){return this.fullCharCodeAt(this.pos)},X.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var n=void 0,i=t;(n=Se(this.input,i,this.pos))>-1;)++this.curLine,i=this.lineStart=n;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())},X.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),n=this.input.charCodeAt(this.pos+=e);this.pos<this.input.length&&!xe(n);)n=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(t+e,this.pos),t,this.pos,r,this.curPosition())},X.skipSpace=function(){e:for(;this.pos<this.input.length;){var e=this.input.charCodeAt(this.pos);switch(e){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&e<14||e>=5760&&Ce.test(String.fromCharCode(e))))break e;++this.pos}}},X.finishToken=function(e,t){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var r=this.type;this.type=e,this.value=t,this.updateContext(r)},X.readToken_dot=function(){var e=this.input.charCodeAt(this.pos+1);if(e>=48&&e<=57)return this.readNumber(!0);var t=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===e&&46===t?(this.pos+=3,this.finishToken(A.ellipsis)):(++this.pos,this.finishToken(A.dot))},X.readToken_slash=function(){var e=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===e?this.finishOp(A.assign,2):this.finishOp(A.slash,1)},X.readToken_mult_modulo_exp=function(e){var t=this.input.charCodeAt(this.pos+1),r=1,n=42===e?A.star:A.modulo;return this.options.ecmaVersion>=7&&42===e&&42===t&&(++r,n=A.starstar,t=this.input.charCodeAt(this.pos+2)),61===t?this.finishOp(A.assign,r+1):this.finishOp(n,r)},X.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?this.options.ecmaVersion>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(A.assign,3):this.finishOp(124===e?A.logicalOR:A.logicalAND,2):61===t?this.finishOp(A.assign,2):this.finishOp(124===e?A.bitwiseOR:A.bitwiseAND,1)},X.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp(A.assign,2):this.finishOp(A.bitwiseXOR,1)},X.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.pos+1);return t===e?45!==t||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!j.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp(A.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===t?this.finishOp(A.assign,2):this.finishOp(A.plusMin,1)},X.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+r)?this.finishOp(A.assign,r+1):this.finishOp(A.bitShift,r)):33!==t||60!==e||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===t&&(r=2),this.finishOp(A.relational,r)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},X.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.pos+1);return 61===t?this.finishOp(A.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===e&&62===t&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken(A.arrow)):this.finishOp(61===e?A.eq:A.prefix,1)},X.readToken_question=function(){var e=this.options.ecmaVersion;if(e>=11){var t=this.input.charCodeAt(this.pos+1);if(46===t){var r=this.input.charCodeAt(this.pos+2);if(r<48||r>57)return this.finishOp(A.questionDot,2)}if(63===t)return e>=12&&61===this.input.charCodeAt(this.pos+2)?this.finishOp(A.assign,3):this.finishOp(A.coalesce,2)}return this.finishOp(A.question,1)},X.readToken_numberSign=function(){var e=35;if(this.options.ecmaVersion>=13&&(++this.pos,C(e=this.fullCharCodeAtPos(),!0)||92===e))return this.finishToken(A.privateId,this.readWord1());this.raise(this.pos,"Unexpected character '"+P(e)+"'")},X.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken(A.parenL);case 41:return++this.pos,this.finishToken(A.parenR);case 59:return++this.pos,this.finishToken(A.semi);case 44:return++this.pos,this.finishToken(A.comma);case 91:return++this.pos,this.finishToken(A.bracketL);case 93:return++this.pos,this.finishToken(A.bracketR);case 123:return++this.pos,this.finishToken(A.braceL);case 125:return++this.pos,this.finishToken(A.braceR);case 58:return++this.pos,this.finishToken(A.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken(A.backQuote);case 48:var t=this.input.charCodeAt(this.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 63:return this.readToken_question();case 126:return this.finishOp(A.prefix,1);case 35:return this.readToken_numberSign()}this.raise(this.pos,"Unexpected character '"+P(e)+"'")},X.finishOp=function(e,t){var r=this.input.slice(this.pos,this.pos+t);return this.pos+=t,this.finishToken(e,r)},X.readRegexp=function(){for(var e,t,r=this.pos;;){this.pos>=this.input.length&&this.raise(r,"Unterminated regular expression");var n=this.input.charAt(this.pos);if(j.test(n)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===n)t=!0;else if("]"===n&&t)t=!1;else if("/"===n&&!t)break;e="\\"===n}++this.pos}var i=this.input.slice(r,this.pos);++this.pos;var s=this.pos,a=this.readWord1();this.containsEsc&&this.unexpected(s);var o=this.regexpState||=new q(this);o.reset(r,i,a),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var l=null;try{l=new RegExp(i,a)}catch{}return this.finishToken(A.regexp,{pattern:i,flags:a,value:l})},X.readInt=function(e,t,r){for(var n=this.options.ecmaVersion>=12&&void 0===t,i=r&&48===this.input.charCodeAt(this.pos),s=this.pos,a=0,o=0,l=0,c=t??1/0;l<c;++l,++this.pos){var p,h=this.input.charCodeAt(this.pos);if(n&&95===h)i&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===l&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=h;else{if((p=h>=97?h-97+10:h>=65?h-65+10:h>=48&&h<=57?h-48:1/0)>=e)break;o=h,a=a*e+p}}return n&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===s||null!=t&&this.pos-s!==t?null:a},X.readRadixNumber=function(e){var t=this.pos;this.pos+=2;var r=this.readInt(e);return r??this.raise(this.start+2,"Expected number in radix "+e),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(r=cn(this.input.slice(t,this.pos)),++this.pos):C(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(A.num,r)},X.readNumber=function(e){var t=this.pos;!e&&null===this.readInt(10,void 0,!0)&&this.raise(t,"Invalid number");var r=this.pos-t>=2&&48===this.input.charCodeAt(t);r&&this.strict&&this.raise(t,"Invalid number");var n=this.input.charCodeAt(this.pos);if(!r&&!e&&this.options.ecmaVersion>=11&&110===n){var i=cn(this.input.slice(t,this.pos));return++this.pos,C(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken(A.num,i)}r&&/[89]/.test(this.input.slice(t,this.pos))&&(r=!1),46===n&&!r&&(++this.pos,this.readInt(10),n=this.input.charCodeAt(this.pos)),(69===n||101===n)&&!r&&((43===(n=this.input.charCodeAt(++this.pos))||45===n)&&++this.pos,null===this.readInt(10)&&this.raise(t,"Invalid number")),C(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var s=sn(this.input.slice(t,this.pos),r);return this.finishToken(A.num,s)},X.readCodePoint=function(){var e;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var t=++this.pos;e=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,e>1114111&&this.invalidStringToken(t,"Code point out of bounds")}else e=this.readHexChar(4);return e},X.readString=function(e){for(var t="",r=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var n=this.input.charCodeAt(this.pos);if(n===e)break;92===n?(t+=this.input.slice(r,this.pos),t+=this.readEscapedChar(!1),r=this.pos):8232===n||8233===n?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(xe(n)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(A.string,t)};var ln={};function un(e,t){return L.parse(e,t)}function dn(e,t,r){return L.parseExpressionAt(e,t,r)}function fn(e,t,r,n,i){var s=[];r||=Q,function e(n,i,a){var o=a||n.type,l=n!==s[s.length-1];l&&s.push(n),mn(r,o,n,i,e),t[o]&&t[o](n,i||s,s),l&&s.pop()}(e,n,i)}function pn(e,t,r){r(e,t)}function Z(e,t,r){}function mn(e,t,r,n,i){if(null==e[t])throw Error("No walker function defined for node type "+t);e[t](r,n,i)}X.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==ln)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},X.invalidStringToken=function(e,t){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw ln;this.raise(e,t)},X.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==A.template&&this.type!==A.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(A.template,e)):36===r?(this.pos+=2,this.finishToken(A.dollarBraceL)):(++this.pos,this.finishToken(A.backQuote));if(92===r)e+=this.input.slice(t,this.pos),e+=this.readEscapedChar(!0),t=this.pos;else if(xe(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},X.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken(A.invalidTemplate,this.input.slice(this.start,this.pos));case"\r":"\n"===this.input[this.pos+1]&&++this.pos;case"\n":case"\u2028":case"\u2029":++this.curLine,this.lineStart=this.pos+1}this.raise(this.start,"Unterminated template")},X.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.pos);switch(++this.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return P(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(this.strict&&this.invalidStringToken(this.pos-1,"Invalid escape sequence"),e){var r=this.pos-1;this.invalidStringToken(r,"Invalid escape sequence in template string")}default:if(t>=48&&t<=55){var n=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],i=parseInt(n,8);return i>255&&(n=n.slice(0,-1),i=parseInt(n,8)),this.pos+=n.length-1,t=this.input.charCodeAt(this.pos),("0"!==n||56===t||57===t)&&(this.strict||e)&&this.invalidStringToken(this.pos-1-n.length,e?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(i)}return xe(t)?(this.options.locations&&(this.lineStart=this.pos,++this.curLine),""):String.fromCharCode(t)}},X.readHexChar=function(e){var t=this.pos,r=this.readInt(16,e);return null===r&&this.invalidStringToken(t,"Bad character escape sequence"),r},X.readWord1=function(){this.containsEsc=!1;for(var e="",t=!0,r=this.pos,n=this.options.ecmaVersion>=6;this.pos<this.input.length;){var i=this.fullCharCodeAtPos();if(w(i,n))this.pos+=i<=65535?1:2;else{if(92!==i)break;this.containsEsc=!0,e+=this.input.slice(r,this.pos);var s=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var a=this.readCodePoint();(t?C:w)(a,n)||this.invalidStringToken(s,"Invalid Unicode escape"),e+=P(a),r=this.pos}t=!1}return e+this.input.slice(r,this.pos)},X.readWord=function(){var e=this.readWord1(),t=A.name;return this.keywords.test(e)&&(t=ye[e]),this.finishToken(t,e)},L.acorn={Parser:L,version:"8.17.0",defaultOptions:Pe,Position:je,SourceLocation:Me,getLineInfo:Ne,Node:_t,TokenType:T,tokTypes:A,keywordTypes:ye,TokContext:H,tokContexts:U,isIdentifierChar:w,isIdentifierStart:C,Token:on,isNewLine:xe,lineBreak:j,lineBreakG:be,nonASCIIwhitespace:Ce};var Q={};Q.Program=Q.BlockStatement=Q.StaticBlock=function(e,t,r){for(var n=0,i=e.body;n<i.length;n+=1){r(i[n],t,"Statement")}},Q.Statement=pn,Q.EmptyStatement=Z,Q.ExpressionStatement=Q.ParenthesizedExpression=Q.ChainExpression=function(e,t,r){return r(e.expression,t,"Expression")},Q.IfStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Statement"),e.alternate&&r(e.alternate,t,"Statement")},Q.LabeledStatement=function(e,t,r){return r(e.body,t,"Statement")},Q.BreakStatement=Q.ContinueStatement=Z,Q.WithStatement=function(e,t,r){r(e.object,t,"Expression"),r(e.body,t,"Statement")},Q.SwitchStatement=function(e,t,r){r(e.discriminant,t,"Expression");for(var n=0,i=e.cases;n<i.length;n+=1){r(i[n],t)}},Q.SwitchCase=function(e,t,r){e.test&&r(e.test,t,"Expression");for(var n=0,i=e.consequent;n<i.length;n+=1){r(i[n],t,"Statement")}},Q.ReturnStatement=Q.YieldExpression=Q.AwaitExpression=function(e,t,r){e.argument&&r(e.argument,t,"Expression")},Q.ThrowStatement=Q.SpreadElement=function(e,t,r){return r(e.argument,t,"Expression")},Q.TryStatement=function(e,t,r){r(e.block,t,"Statement"),e.handler&&r(e.handler,t),e.finalizer&&r(e.finalizer,t,"Statement")},Q.CatchClause=function(e,t,r){e.param&&r(e.param,t,"Pattern"),r(e.body,t,"Statement")},Q.WhileStatement=Q.DoWhileStatement=function(e,t,r){r(e.test,t,"Expression"),r(e.body,t,"Statement")},Q.ForStatement=function(e,t,r){e.init&&r(e.init,t,"ForInit"),e.test&&r(e.test,t,"Expression"),e.update&&r(e.update,t,"Expression"),r(e.body,t,"Statement")},Q.ForInStatement=Q.ForOfStatement=function(e,t,r){r(e.left,t,"ForInit"),r(e.right,t,"Expression"),r(e.body,t,"Statement")},Q.ForInit=function(e,t,r){"VariableDeclaration"===e.type?r(e,t):r(e,t,"Expression")},Q.DebuggerStatement=Z,Q.FunctionDeclaration=function(e,t,r){return r(e,t,"Function")},Q.VariableDeclaration=function(e,t,r){for(var n=0,i=e.declarations;n<i.length;n+=1){r(i[n],t)}},Q.VariableDeclarator=function(e,t,r){r(e.id,t,"Pattern"),e.init&&r(e.init,t,"Expression")},Q.Function=function(e,t,r){e.id&&r(e.id,t,"Pattern");for(var n=0,i=e.params;n<i.length;n+=1){r(i[n],t,"Pattern")}r(e.body,t,e.expression?"Expression":"Statement")},Q.Pattern=function(e,t,r){"Identifier"===e.type?r(e,t,"VariablePattern"):"MemberExpression"===e.type?r(e,t,"MemberPattern"):r(e,t)},Q.VariablePattern=Z,Q.MemberPattern=pn,Q.RestElement=function(e,t,r){return r(e.argument,t,"Pattern")},Q.ArrayPattern=function(e,t,r){for(var n=0,i=e.elements;n<i.length;n+=1){var s=i[n];s&&r(s,t,"Pattern")}},Q.ObjectPattern=function(e,t,r){for(var n=0,i=e.properties;n<i.length;n+=1){var s=i[n];"Property"===s.type?(s.computed&&r(s.key,t,"Expression"),r(s.value,t,"Pattern")):"RestElement"===s.type&&r(s.argument,t,"Pattern")}},Q.Expression=pn,Q.ThisExpression=Q.Super=Q.MetaProperty=Z,Q.ArrayExpression=function(e,t,r){for(var n=0,i=e.elements;n<i.length;n+=1){var s=i[n];s&&r(s,t,"Expression")}},Q.ObjectExpression=function(e,t,r){for(var n=0,i=e.properties;n<i.length;n+=1){r(i[n],t)}},Q.FunctionExpression=Q.ArrowFunctionExpression=Q.FunctionDeclaration,Q.SequenceExpression=function(e,t,r){for(var n=0,i=e.expressions;n<i.length;n+=1){r(i[n],t,"Expression")}},Q.TemplateLiteral=function(e,t,r){for(var n=0,i=e.quasis;n<i.length;n+=1){r(i[n],t)}for(var s=0,a=e.expressions;s<a.length;s+=1){r(a[s],t,"Expression")}},Q.TemplateElement=Z,Q.UnaryExpression=Q.UpdateExpression=function(e,t,r){r(e.argument,t,"Expression")},Q.BinaryExpression=Q.LogicalExpression=function(e,t,r){r(e.left,t,"Expression"),r(e.right,t,"Expression")},Q.AssignmentExpression=Q.AssignmentPattern=function(e,t,r){r(e.left,t,"Pattern"),r(e.right,t,"Expression")},Q.ConditionalExpression=function(e,t,r){r(e.test,t,"Expression"),r(e.consequent,t,"Expression"),r(e.alternate,t,"Expression")},Q.NewExpression=Q.CallExpression=function(e,t,r){if(r(e.callee,t,"Expression"),e.arguments)for(var n=0,i=e.arguments;n<i.length;n+=1){r(i[n],t,"Expression")}},Q.MemberExpression=function(e,t,r){r(e.object,t,"Expression"),e.computed&&r(e.property,t,"Expression")},Q.ExportNamedDeclaration=Q.ExportDefaultDeclaration=function(e,t,r){if(e.declaration&&r(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&r(e.source,t,"Expression"),e.attributes)for(var n=0,i=e.attributes;n<i.length;n+=1){r(i[n],t)}},Q.ExportAllDeclaration=function(e,t,r){if(e.exported&&r(e.exported,t),r(e.source,t,"Expression"),e.attributes)for(var n=0,i=e.attributes;n<i.length;n+=1){r(i[n],t)}},Q.ImportAttribute=function(e,t,r){r(e.value,t,"Expression")},Q.ImportDeclaration=function(e,t,r){for(var n=0,i=e.specifiers;n<i.length;n+=1){r(i[n],t)}if(r(e.source,t,"Expression"),e.attributes)for(var s=0,a=e.attributes;s<a.length;s+=1){r(a[s],t)}},Q.ImportExpression=function(e,t,r){r(e.source,t,"Expression"),e.options&&r(e.options,t,"Expression")},Q.ImportSpecifier=Q.ImportDefaultSpecifier=Q.ImportNamespaceSpecifier=Q.Identifier=Q.PrivateIdentifier=Q.Literal=Z,Q.TaggedTemplateExpression=function(e,t,r){r(e.tag,t,"Expression"),r(e.quasi,t,"Expression")},Q.ClassDeclaration=Q.ClassExpression=function(e,t,r){return r(e,t,"Class")},Q.Class=function(e,t,r){e.id&&r(e.id,t,"Pattern"),e.superClass&&r(e.superClass,t,"Expression"),r(e.body,t)},Q.ClassBody=function(e,t,r){for(var n=0,i=e.body;n<i.length;n+=1){r(i[n],t)}},Q.MethodDefinition=Q.PropertyDefinition=Q.Property=function(e,t,r){e.computed&&r(e.key,t,"Expression"),e.value&&r(e.value,t,"Expression")};var $=class e{static expressionCache=new Map;static variableCache=new Map;static bindingsCache=new Map;static loopVariableCache=new Map;static MAX_CACHE_SIZE=1e3;static pruneCache(e){e.size>this.MAX_CACHE_SIZE&&Array.from(e.keys()).slice(0,e.size-this.MAX_CACHE_SIZE/2).forEach(t=>e.delete(t))}static clearCaches(){this.expressionCache.clear(),this.variableCache.clear(),this.bindingsCache.clear(),this.loopVariableCache.clear()}static addPatternBindings(e,t){if(e){if("Identifier"===e.type)return void t.add(e.name);if("AssignmentPattern"===e.type)return void this.addPatternBindings(e.left,t);if("RestElement"===e.type)return void this.addPatternBindings(e.argument,t);"ObjectPattern"===e.type&&e.properties.forEach(e=>{"Property"===e.type?this.addPatternBindings(e.value,t):"RestElement"===e.type&&this.addPatternBindings(e.argument,t)})}}static extractStateBindings(t){if(this.bindingsCache.has(t))return[...this.bindingsCache.get(t)];let r=new Set;try{fn(un(t,{ecmaVersion:2020}),{FunctionDeclaration(e,t){t.length<=2&&e.id&&e.id.name&&r.add(e.id.name)},VariableDeclaration(t,n){n.length>2||t.declarations.forEach(t=>{"CallExpression"!==t.init?.type||"pp"!==t.init.callee?.object?.name||"state"!==t.init.callee?.property?.name&&"reducer"!==t.init.callee?.property?.name?("Identifier"===t.id.type&&r.add(t.id.name),"ObjectPattern"===t.id.type&&e.addPatternBindings(t.id,r)):"ArrayPattern"===t.id.type&&t.id.elements.forEach(e=>{"Identifier"===e?.type&&r.add(e.name)})})}})}catch(e){console.error("[PP-ERROR] AstParser Failed",e)}let n=Array.from(r);return this.pruneCache(this.bindingsCache),this.bindingsCache.set(t,n),n}static extractUsedVariables(e,t){let r=e+"|"+Array.from(t).sort().join(",");if(this.variableCache.has(r))return new Set(this.variableCache.get(r));let n=new Set;try{fn(un(`(${e})`,{ecmaVersion:2020}),{Identifier(e,r){if(!t.has(e.name)){if(r.length>1){let t=r[r.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return}n.add(e.name)}}})}catch{}return this.pruneCache(this.variableCache),this.variableCache.set(r,n),new Set(n)}static isValidExpression(e){if(!e.trim())return!1;if(this.expressionCache.has(e))return this.expressionCache.get(e);let t=!1;try{dn(`(${e})`,0,{ecmaVersion:2020}),t=!0}catch{t=!1}return this.pruneCache(this.expressionCache),this.expressionCache.set(e,t),t}static analyzeLoopVariableUsage(e,t){let r=e+"|"+t;if(this.loopVariableCache.has(r))return[...this.loopVariableCache.get(r)];let n=[];try{fn(un(e,{ecmaVersion:2020}),{Identifier(e,r){if(e.name!==t)return;let i=!1,s=!1,a=e.start,o=e.end;if(r.length>=2){let t=r[r.length-2];if("MemberExpression"===t.type&&t.property===e&&!t.computed||"Property"===t.type&&t.key===e&&!t.computed&&!t.shorthand)return;if("Property"===t.type&&t.shorthand&&(i=!0,r.length>=3)){let e=r[r.length-3];"ObjectExpression"===e.type&&1===e.properties.length&&(s=!0,a=e.start,o=e.end)}}n.push({start:a,end:o,isShorthand:i,isUnwrap:s})}})}catch{}return this.pruneCache(this.loopVariableCache),this.loopVariableCache.set(r,n),[...n]}},hn=class{static cache=new Map;static MAX_CACHE_SIZE=200;static CONTEXT_PROVIDER_TAG_PATTERN=/<\/?([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b[^>]*>/gi;static LITERAL_CODE_TAG_PATTERN=/(<code\b[^>]*>)([\s\S]*?)(<\/code\s*>)/gi;static ESCAPED_BRACE_ENTITY_PATTERN=/&(lbrace|rbrace|#123|#125|#x7b|#x7d);/gi;static INTERNAL_LOOP_NAMES=new Set(["__pp_loop_capture","__pp_loop_read","__pp_render_value","__pp_raw_html","__pp_escape_html","__pp_to_loop_items"]);static SPREAD_BOOLEAN_ATTRS=new Set(["allowfullscreen","async","autofocus","autoplay","checked","controls","default","defer","disabled","formnovalidate","hidden","inert","ismap","itemscope","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","selected"]);static escapeTemplateLiteralText(e){return e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${")}static getRuntimeEscaperSource(){return"\nconst __pp_escape_html = (value) => String(value)\n .split('&').join('&')\n .split('<').join('<')\n .split('>').join('>')\n .split('\"').join('"')\n .split(\"'\").join(''');\nconst __pp_raw_html = (value) => ({ __ppRawHtml: String(value) });\nconst __pp_warn_invalid_child = (value) => {\n const kind = value === null ? 'null' : typeof value;\n console.warn('[PP-WARN] Invalid template child of type \"' + kind + '\" was omitted. Render a primitive, an array of renderable values, or explicit trusted HTML instead.', value);\n return '';\n};\nconst __pp_render_value = (value) => {\n if (typeof value === 'boolean' || value == null) return '';\n if (value && typeof value === 'object' && Object.prototype.hasOwnProperty.call(value, '__ppRawHtml')) return value.__ppRawHtml;\n if (Array.isArray(value)) return value.map(__pp_render_value).join('');\n if (typeof value === 'object' || typeof value === 'function' || typeof value === 'symbol') return __pp_warn_invalid_child(value);\n return __pp_escape_html(value);\n};\nconst __pp_to_loop_items = (value) => {\n if (Array.isArray(value)) return value;\n if (value == null) return [];\n try {\n if (typeof value[Symbol.iterator] === 'function') return Array.from(value);\n } catch (error) {\n console.warn('[PP-WARN] pp-for iterable could not be consumed:', value, error);\n return [];\n }\n console.warn('[PP-WARN] pp-for collection is not an array or iterable:', value);\n return [];\n};\nconst __pp_decode_html_entities = (value) => String(value)\n .split('"').join('\"')\n .split('"').join('\"')\n .split(''').join(\"'\")\n .split('<').join('<')\n .split('>').join('>')\n .split('&').join('&');\nconst __pp_find_dynamic_closing_brace = (value, start) => {\n let depth = 0;\n let quote = null;\n let escaped = false;\n for (let index = start; index < value.length; index++) {\n const char = value[index];\n if (escaped) {\n escaped = false;\n continue;\n }\n if (char === String.fromCharCode(92)) {\n escaped = true;\n continue;\n }\n if (quote) {\n if (char === quote) quote = null;\n continue;\n }\n if (char === '\"' || char === \"'\" || char === String.fromCharCode(96)) {\n quote = char;\n continue;\n }\n if (char === '{') depth++;\n if (char === '}') {\n depth--;\n if (depth === 0) return index;\n }\n }\n return -1;\n};\nconst __pp_interpolate_dynamic_html = (value) => {\n const source = String(value);\n let result = '';\n let cursor = 0;\n while (cursor < source.length) {\n if (source[cursor] !== '{') {\n result += source[cursor++];\n continue;\n }\n const closing = __pp_find_dynamic_closing_brace(source, cursor);\n if (closing === -1) {\n result += source[cursor++];\n continue;\n }\n const expression = __pp_decode_html_entities(source.slice(cursor + 1, closing));\n try {\n result += __pp_render_value(eval(expression));\n } catch {\n result += source.slice(cursor, closing + 1);\n }\n cursor = closing + 1;\n }\n return result;\n};\nconst __pp_dynamic_component = (value) => {\n const renderOne = (entry) => {\n let resolved = entry;\n if (typeof resolved === 'function') resolved = resolved();\n if (typeof resolved === 'boolean' || resolved == null) return '';\n if (resolved && typeof resolved === 'object' && Object.prototype.hasOwnProperty.call(resolved, '__ppRawHtml')) {\n return __pp_interpolate_dynamic_html(resolved.__ppRawHtml);\n }\n return __pp_interpolate_dynamic_html(resolved);\n };\n return __pp_raw_html(Array.isArray(value) ? value.map(renderOne).join('') : renderOne(value));\n};\n"}static escapeTemplateLiteralTextPreservingInterpolations(e){let t="",r=0,n=0;for(;r<e.length;){if("$"===e[r]&&"{"===e[r+1]){let i=this.findClosingBrace(e,r+1);if(-1!==i){t+=this.escapeTemplateLiteralText(e.slice(n,r)),t+=e.slice(r,i+1),r=i+1,n=r;continue}}r++}return t+=this.escapeTemplateLiteralText(e.slice(n)),t}static clearCache(){this.cache.clear()}static pruneCache(){if(this.cache.size>this.MAX_CACHE_SIZE){let e=this.cache.size-Math.floor(this.MAX_CACHE_SIZE/2),t=0;for(let r of this.cache.keys()){if(t>=e)break;this.cache.delete(r),t++}}}static maskEscapedBraceEntities(e){let t=new Map,r=0;return{maskedHtml:e.replace(this.ESCAPED_BRACE_ENTITY_PATTERN,e=>{let n=`__PP_ESCAPED_BRACE_${r++}__`;return t.set(n,_(e)),n}),placeholders:t}}static transformSpreadAttributes(e){let t=new Map,r=0,n=document.createElement("template");n.innerHTML=e;let i=e=>{if(e.nodeType===Node.ELEMENT_NODE){let n=e;if(Array.from(n.childNodes).forEach(i),n.hasAttribute("pp-spread")){let e=n.getAttribute("pp-spread")||"";n.removeAttribute("pp-spread");let i=y(e)?.expression.trim()??"";if(i.startsWith("...")){let e=_(i.slice(3).trim()),s=`___pp_spread_${r++}___`,a=`\${ (() => {\n const __obj = ${e};\n if (!__obj || typeof __obj !== 'object') return '';\n const __booleanAttrs = ${JSON.stringify(Array.from(this.SPREAD_BOOLEAN_ATTRS))};\n return Object.entries(__obj)\n .map(([k, v]) => {\n if (v == null) return '';\n const __attrName = String(k);\n if (!/^[^\\s"'<>/=]+$/.test(__attrName) || /^on/i.test(__attrName)) return '';\n if (__booleanAttrs.includes(__attrName.toLowerCase())) {\n if (v === false) return '';\n if (v === true) return __attrName;\n }\n const __escapedValue = String(v)\n .split('&').join('&')\n .split('"').join('"')\n .split("'").join(''')\n .split('<').join('<')\n .split('>').join('>');\n return __attrName + '="' + __escapedValue + '"';\n })\n .filter(Boolean)\n .join(' ');\n })() }`;t.set(s,a),n.setAttribute(s,"")}}}};return Array.from(n.content.childNodes).forEach(i),{html:n.innerHTML,spreadReplacements:t}}static expandSpreadPlaceholders(e,t){let r=e;return t.forEach((e,t)=>{r=r.split(`${t}=""`).join(e),r=r.split(t).join(e)}),r}static transformRefAttributes(e){if(!e.includes("pp-ref"))return e;let t=document.createElement("template");t.innerHTML=e;let r=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),n=r.nextNode();for(;n;){let e=n;if(e.hasAttribute("pp-ref")){let t=y(e.getAttribute("pp-ref")||"");if(t){let r=_(t.expression);e.removeAttribute("pp-ref"),e.setAttribute("data-pp-ref",`{ __pp_ref(${r}) }`)}}n=r.nextNode()}return t.innerHTML}static transformComponentTags(e){let t=document.createElement("template");t.innerHTML=e;let r=e=>{if(e.nodeType!==Node.ELEMENT_NODE)return;let t=e,n=t.tagName.toLowerCase();if(Array.from(t.childNodes).forEach(r),n.includes(".")&&!n.endsWith(".provider")){let e=document.createDocumentFragment();for(e.appendChild(document.createTextNode(`{__pp_dynamic_component(${n})}`));t.firstChild;)e.appendChild(t.firstChild);t.replaceWith(e)}};return Array.from(t.content.childNodes).forEach(r),t.innerHTML}static transformContextProviderTags(e){if(!/\.provider\b/i.test(e))return e;let t="",r=0;for(;r<e.length;){let n=e.slice(r).match(/^<([A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*\.Provider)\b/i);if(!n){t+=e[r],r+=1;continue}let i=n[1],s=this.findOpeningTagEnd(e,r);if(-1===s){t+=e[r],r+=1;continue}let a=e.slice(r+n[0].length,s),o=s+1,l=this.findMatchingContextProviderClose(e,o);if(!l){t+=e[r],r+=1;continue}let c=this.transformContextProviderTags(e.slice(o,l.start));t+=`<pp-context-provider data-pp-context-token="{ __pp_context_token(__pp_context_lookup(${`'${i.replace(/\.Provider$/i,"").replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`})) }" data-pp-context-value="{ __pp_context_value(${this.extractContextProviderValueExpression(a)}) }">`+c+"</pp-context-provider>",r=l.end}return t}static findOpeningTagEnd(e,t){let r=null,n=0;for(let i=t;i<e.length;i++){let t=e[i],s=this.isEscaped(e,i);if(r){if("{"===t&&!s){n++;continue}if("}"===t&&!s&&n>0){n--;continue}t===r&&!s&&0===n&&(r=null)}else if(s||'"'!==t&&"'"!==t){if(">"===t)return i}else r=t,n=0}return-1}static findMatchingContextProviderClose(e,t){this.CONTEXT_PROVIDER_TAG_PATTERN.lastIndex=t;let r,n=1;for(;r=this.CONTEXT_PROVIDER_TAG_PATTERN.exec(e);){let e=r[0];if(n+=e.startsWith("</")?-1:1,0===n)return{start:r.index,end:r.index+e.length}}return null}static extractContextProviderValueExpression(e){let t=e.match(/\bvalue\s*=\s*(?:"([\s\S]*?)"|'([\s\S]*?)'|([^\s>]+))/i);if(!t)return"undefined";let r=t[1]??t[2]??t[3]??"",n=y(_(r.trim()));return n?n.expression:JSON.stringify(r)}static normalizeTextareaValueAttributes(e){if(!e.includes("<textarea")||!e.includes("value="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("textarea").forEach(e=>{let t=e,r=t.getAttribute("value");null!==r&&(t.textContent=r,t.removeAttribute("value"))}),t.innerHTML}static transformStyleAliasAttributes(e){if(!e.includes("pp-style"))return e;let t=document.createElement("template");t.innerHTML=e;let r=document.createTreeWalker(t.content,NodeFilter.SHOW_ELEMENT),n=r.nextNode();for(;n;){let e=n;if(e.hasAttribute("pp-style")){let t=e.getAttribute("pp-style")??"",r=e.getAttribute("style")??"";e.removeAttribute("pp-style");let n=this.mergeStyleAttributeValues(r,t);n.length>0&&e.setAttribute("style",n)}n=r.nextNode()}return t.innerHTML}static mergeStyleAttributeValues(e,t){let r=e.trim(),n=t.trim().replace(/^;+\s*/,"");return r?n?`${r.endsWith(";")?r:`${r};`} ${n}`:r:n}static transformSelectValueAttributes(e){if(!e.includes("<select")||!e.includes("value="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("select").forEach(e=>{let t=e,r=t.getAttribute("value");if(null===r)return;let n=y(r);if(!n)return;let i=_(n.expression);t.removeAttribute("value"),t.setAttribute("data-pp-select-value",`{ __pp_select_value(${i}) }`)}),t.innerHTML}static transformInputValueAttributes(e){if(!e.includes("<input")||!e.includes("value="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{let t=e,r=t.getAttribute("value");if(null===r)return;let n=y(r);if(!n)return;let i=_(n.expression);t.removeAttribute("value"),t.setAttribute("data-pp-input-value",`{ __pp_input_value(${i}) }`)}),t.innerHTML}static transformCheckedValueAttributes(e){if(!e.includes("<input")||!e.includes("checked="))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{let t=e,r=t.getAttribute("checked");if(null===r)return;let n=y(r);if(!n)return;let i=_(n.expression);t.removeAttribute("checked"),t.setAttribute("data-pp-checked-value",`{ __pp_checked_value(${i}) }`)}),t.innerHTML}static transformDefaultValueAttributes(e){if(!e.includes("default"))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input, textarea, select").forEach(e=>{let t=e,r=t.getAttribute("defaultvalue");if(null===r)return;let n=y(r);if(!n)return;let i=_(n.expression);t.removeAttribute("defaultvalue"),t.setAttribute("data-pp-default-value",`{ __pp_default_value(${i}) }`)}),t.innerHTML}static transformDefaultCheckedAttributes(e){if(!e.includes("default"))return e;let t=document.createElement("template");return t.innerHTML=e,t.content.querySelectorAll("input").forEach(e=>{let t=e,r=t.getAttribute("defaultchecked");if(null===r)return;let n=y(r);if(!n)return;let i=_(n.expression);t.removeAttribute("defaultchecked"),t.setAttribute("data-pp-default-checked",`{ __pp_default_checked(${i}) }`)}),t.innerHTML}static transformComponentBoundaryBindings(e,t={}){if(!e.includes("pp-component=")||!e.includes("{"))return{html:e,boundaryReplacements:new Map};let r=document.createElement("template");r.innerHTML=e;let n=new Map,i=0;return r.content.querySelectorAll("[pp-component]").forEach(e=>{let r=e;Array.from(r.attributes).forEach(e=>{let s=e.name;if("pp-component"===s||s.startsWith("on"))return;let a=y(e.value);if(!a){if(t.rewriteExpression&&e.value.includes("{")){let n=this.rewriteMixedBoundaryAttributeExpressions(e.value,t.rewriteExpression);n!==e.value&&r.setAttribute(s,n)}return}let o=this.expandEmbeddedBindingsInStringLiterals(_(a.expression)),l=t.rewriteExpression?.(o),c=l?.evalExpression??o,p=(l?.evalExpression??o).replace(/\\/g,"\\\\").replace(/'/g,"\\'"),h=l?.rawExpressionCode??JSON.stringify(p),u=`___PP_BOUNDARY_ATTR_${i++}___`;n.set(`${s}="${u}"`,`\${__pp_render_value((() => { const __ppAttr = (${c}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${s}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${s}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${s}="{' + ${h} + '}"'); })())}`),r.setAttribute(s,u)})}),{html:r.innerHTML,boundaryReplacements:n}}static rewriteMixedBoundaryAttributeExpressions(e,t){let r="",n=0;for(;n<e.length;){if("{"!==e[n]){r+=e[n],n++;continue}if(n>0&&"$"===e[n-1]){r+="{",n++;continue}let i=this.findClosingBrace(e,n);if(-1===i){r+=e[n],n++;continue}let s=this.expandEmbeddedBindingsInStringLiterals(_(e.slice(n+1,i)));$.isValidExpression(s)?(r+=`{${t(s).evalExpression}}`,n=i+1):(r+=e.slice(n,i+1),n=i+1)}return r}static transformLoopAttributeEmbeddedBindings(e,t){if(!e.includes("{"))return e;let r=document.createElement("template");r.innerHTML=e;let n=!1,i=e=>{Array.from(e.attributes).forEach(r=>{if(r.name.startsWith("on")||!r.value.includes("{"))return;let i=y(r.value);if(!i)return;let s=_(i.expression),a=this.expandEmbeddedBindingsInStringLiterals(s);a!==s&&$.isValidExpression(a)&&(e.setAttribute(r.name,`{${t(a).evalExpression}}`),n=!0)})},s=e=>{Array.from(e.children).forEach(e=>{i(e),e instanceof HTMLTemplateElement?s(e.content):s(e)})};return s(r.content),n?r.innerHTML:e}static expandEmbeddedBindingsInStringLiterals(e){let t="",r=0;for(;r<e.length;){let n=e[r];if('"'!==n&&"'"!==n){t+=e[r],r++;continue}let i=r;r++;let s="";for(;r<e.length;){let t=e[r];if(s+=t,r++,t===n&&!this.isEscaped(s,s.length-1)){s=s.slice(0,-1);break}}s.includes("{")?t+=this.expandEmbeddedBindingsInStringLiteral(s,n)??e.slice(i,r):t+=e.slice(i,r)}return t}static expandEmbeddedBindingsInStringLiteral(e,t){let r=[],n=0,i=0,s=e=>{e.length>0&&r.push(`${t}${e}${t}`)};for(;n<e.length;){if("{"!==e[n]||"$"===e[n-1]||this.isEscaped(e,n)||this.isServerTemplateBlockStart(e,n)){n++;continue}let t=this.findClosingBrace(e,n);if(-1===t){n++;continue}s(e.slice(i,n));let a=e.slice(n+1,t).trim();a&&r.push(this.stringifyEmbeddedBindingExpression(a)),n=t+1,i=n}return 0===r.length?null:(s(e.slice(i)),`(${r.length>0?r.join(" + "):`${t}${t}`})`)}static stringifyEmbeddedBindingExpression(e){return`((__ppVal) => { if (typeof __ppVal === 'boolean' || __ppVal == null) return ''; if (Array.isArray(__ppVal)) return __ppVal.map((__ppItem) => __ppItem == null || typeof __ppItem === 'boolean' ? '' : String(__ppItem)).join(''); return String(__ppVal); })(${e})`}static compile(e,t){let r=(e||"").replace(/\r\n/g,"\n").replace(/\r/g,"\n"),i=`${r}${t.join("\0")}`;if(this.cache.has(i))return this.cache.get(i);let s=this.transformContextProviderTags(r),{maskedHtml:a,placeholders:o}=this.maskEscapedBraceEntities(s),l=this.escapeLiteralCodeProcessingInstructionOpeners(a),{maskedHtml:c,placeholders:p}=this.maskLiteralHtmlTextNodes(l),{maskedTemplate:h,placeholders:u}=this.maskComplexComponents(c),{maskedHtml:d,placeholders:f}=this.maskLiteralElements(h,"style","STYLE"),{maskedHtml:m,placeholders:v}=this.maskLiteralElements(d,"code","CODE",e=>!this.isPureBindingLiteral(e.innerHTML)),{maskedHtml:y,placeholders:x}=this.maskLiteralElements(m,"script","SCRIPT"),E=this.transformComponentTags(y),C=this.transformStyleAliasAttributes(E),S=this.normalizeTextareaValueAttributes(g(C)),b=t.includes("__pp_input_value")?this.transformInputValueAttributes(S):S,A=t.includes("__pp_checked_value")?this.transformCheckedValueAttributes(b):b,k=this.transformSelectValueAttributes(A),w=this.transformDefaultValueAttributes(k),T=this.transformDefaultCheckedAttributes(w),{html:P,boundaryReplacements:I}=this.transformComponentBoundaryBindings(T),{html:R,spreadReplacements:N}=this.transformSpreadAttributes(P),L=this.transformRefAttributes(R),{html:V,loopReplacements:M}=this.processStructuralDirectives(L),D=this.transformBooleanAttributes(V);(()=>{let e=!0;for(;e;)e=!1,M.forEach((t,r)=>{let n=D;D=D.split("${"+r+"}").join("${"+t+"}"),D=D.split(r).join("{ __pp_raw_html("+t+") }"),D!==n&&(e=!0)})})();let B=new Set,O=this.getRuntimeEscaperSource()+"return `",H=0,F="";for(;H<D.length;){let e=D[H];if("o"===e||"O"===e){let e=D.slice(H,H+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(e){let t=D.slice(H,H+e[0].length),r=t[t.length-1],n=H+e[0].length;for(;n<D.length&&(D[n]!==r||"\\"===D[n-1]);)n++;F+=D.slice(H,n+1),H=n+1;continue}}if("{"===e){if(this.isServerTemplateBlockStart(D,H)){let e=this.findServerTemplateBlockEnd(D,H);if(-1!==e){F+=D.slice(H,e),H=e;continue}}let e=this.findClosingBrace(D,H);if(-1!==e){let t=_(D.slice(H+1,e));if($.isValidExpression(t)){O+=this.escapeTemplateLiteralText(F),F="";let r=$.extractUsedVariables(t,n);for(let e of r)/^___PP_LOOP_\d+___$/.test(e)||B.add(e);let i=t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g," ");O+=`\${ (() => {\n try {\n const __res = (${t});\n return __pp_render_value(__res);\n } catch(e) {\n console.error("[PP-ERROR] Template Expression Failed: \\"${i}\\"", e);\n return '';\n }\n })() }`,H=e+1;continue}}}F+=e,H++}O+=this.escapeTemplateLiteralText(F),O+="`;",O=this.expandSpreadPlaceholders(O,N),I.forEach((e,t)=>{O=O.split(t).join(e)});let U=t.slice();try{let e=U.slice(),t=!e.includes("__pp_loop_capture"),r=!e.includes("__pp_loop_read");t&&e.push("__pp_loop_capture"),r&&e.push("__pp_loop_read");let n=Function(...e,O),s=(...e)=>{let i=new Map,s=0,a=e.slice();t&&a.push(e=>{let t="ppv_"+ ++s;return i.set(t,e),t}),r&&a.push(e=>i.get(e));let l=n(...a);return l=this.restorePlaceholders(l,x),l=this.restorePlaceholders(l,v),l=this.restorePlaceholders(l,f),u.forEach((e,t)=>{l=l.split(t).join(e)}),l=this.restorePlaceholders(l,p),l=this.restorePlaceholders(l,o),l};return this.pruneCache(),this.cache.set(i,s),s}catch(e){return console.error("[PP-ERROR] Compilation Failed",e),()=>"Error in Template"}}static maskLiteralElements(e,t,r,n=()=>!0){let i=document.createElement("template");i.innerHTML=e;let s=new Map,a=0;return i.content.querySelectorAll(t).forEach(e=>{if(!n(e))return;let t=`__PP_${r}_${a++}__`;s.set(t,e.outerHTML),e.replaceWith(document.createTextNode(t))}),{maskedHtml:i.innerHTML,placeholders:s}}static maskLiteralHtmlTextNodes(e){let t=document.createElement("template");t.innerHTML=e;let r=new Map,n={value:0},i=document.createTreeWalker(t.content,NodeFilter.SHOW_TEXT),s=[];for(;i.nextNode();)s.push(i.currentNode);return s.forEach(e=>{if(this.isWithinLiteralTextContainer(e))return;let t=e.textContent??"";if(!t.includes("{")&&!t.includes("}"))return;let i=this.splitLiteralHtmlTextSegments(t);if(!i)return;let s="";i.forEach(e=>{s+=e.literalHtml?this.maskLiteralBraces(e.text,r,n):e.text}),e.textContent=s}),{maskedHtml:t.innerHTML,placeholders:r}}static escapeLiteralCodeProcessingInstructionOpeners(e){return e.includes("<?")?e.replace(this.LITERAL_CODE_TAG_PATTERN,(e,t,r,n)=>!r.includes("<?")||this.isPureBindingLiteral(r.trim())?e:`${t}${r.replace(/<\?/g,"<?")}${n}`):e}static isWithinLiteralTextContainer(e){let t=e.parentNode;for(;t;){if(t.nodeType===Node.ELEMENT_NODE){let e=t.tagName.toLowerCase();if("code"===e||"pre"===e||"script"===e||"style"===e)return!0}t=t.parentNode}return!1}static splitLiteralHtmlTextSegments(e){if(!e.includes("<")||!e.includes(">"))return null;let t=document.createElement("template");t.innerHTML=e;let r=Array.from(t.content.childNodes).map(e=>({text:e.nodeType===Node.TEXT_NODE?e.textContent??"":this.serializeNodeHtml(e),literalHtml:e.nodeType!==Node.TEXT_NODE}));return r.some(e=>e.literalHtml)?r:null}static serializeNodeHtml(e){if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";let t=document.createElement("template");return t.content.appendChild(e.cloneNode(!0)),t.innerHTML}static maskLiteralBraces(e,t,r){let n="";for(let i of e){if("{"===i||"}"===i){let e=`__PP_LITERAL_HTML_BRACE_${r.value++}__`;t.set(e,i),n+=e;continue}n+=i}return n}static isPureBindingLiteral(e){return null!==y(e)}static restorePlaceholders(e,t){let r=e;return t.forEach((e,t)=>{r.includes(t)&&(r=r.split(t).join(e))}),r}static transformBooleanAttributes(e){let t="",n=0;for(;n<e.length;){let i=!1;for(let s of r){let r=`${s}="{`,a=`${s}='{`;if(e.startsWith(r,n)){if("checked"===s&&this.isAttributeOnComponentBoundary(e,n))continue;let a=n+r.length-1;if(this.isServerTemplateBlockStart(e,a))continue;i=!0;let o=this.findClosingBrace(e,a);if(-1!==o&&'"'===e[o+1]){let r=_(e.slice(a+1,o)),i=r.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${r}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${s}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${s}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${s}="{${i}}"'); })() }`,n=o+2;break}}else if(e.startsWith(a,n)){if("checked"===s&&this.isAttributeOnComponentBoundary(e,n))continue;let r=n+a.length-1;if(this.isServerTemplateBlockStart(e,r))continue;i=!0;let o=this.findClosingBrace(e,r);if(-1!==o&&"'"===e[o+1]){let i=_(e.slice(r+1,o)),a=i.replace(/\\/g,"\\\\").replace(/'/g,"\\'");t+=`{ (() => { const __ppAttr = (${i}); if (typeof __ppAttr === 'boolean') return __pp_raw_html(__ppAttr ? '${s}' : ''); if (__ppAttr == null) return ''; if (typeof __ppAttr === 'string' || typeof __ppAttr === 'number' || typeof __ppAttr === 'bigint') return __pp_raw_html('${s}="' + __pp_escape_html(__ppAttr) + '"'); return __pp_raw_html('${s}="{${a}}"'); })() }`,n=o+2;break}}}i||(t+=e[n],n++)}return t}static isAttributeOnComponentBoundary(e,t){let r=e.lastIndexOf("<",t);if(-1===r||e.lastIndexOf(">",t)>r)return!1;let n=this.findOpeningTagEnd(e,r);if(-1===n||t>n)return!1;let i=e.slice(r,r+2);if("</"===i||"<!"===i||"<?"===i)return!1;let s=e.slice(r,n+1);return/\spp-component(?:\s|=|>)/i.test(s)}static captureLoopVariablesInEventHandlers(e,t,r,n=!1,i=[]){let s="",a=0;for(;a<e.length;){let o=e.slice(a,a+40).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(o){let l=o[0].length,c=e.slice(a,a+l),p=c[c.length-1],h=a+l,u=h;for(;u<e.length&&(e[u]!==p||"\\"===e[u-1]);)u++;let d=c.slice(0,-2).trim(),f=e.slice(h,u);f=this.rewriteLoopEventHandlerCode(f,t,r,n,i),s+=`${d}=${p}${f}${p}`,a=u+1;continue}s+=e[a],a++}return s}static rewriteLoopEventHandlerCode(e,t,r,n,i=[]){let s=y(e),a=_(s?s.expression:e);i.forEach(e=>{a=this.applyLoopEventCaptureRewrites(a,e)});let o={iterator:t,collectionName:"",indexVar:r,userDefinedIndex:n};return a=this.applyLoopEventCaptureRewrites(a,o),[...i,o].forEach(e=>{let t=this.getLoopIndexToken(e.indexVar);a=a.split(t).join(`\${${e.indexVar}}`)}),s?`{${a}}`:a}static applyLoopEventCaptureRewrites(e,t){let r=this.getLoopIndexToken(t.indexVar),n=e;return t.userDefinedIndex&&(n=this.replaceLoopIdentifierUsages(n,t.indexVar,r)),this.replaceLoopIdentifierUsages(n,t.iterator,`__pp_loop_read('\${__pp_loop_capture(${t.iterator})}')`)}static getLoopIndexToken(e){return`__PP_LOOP_IDX_${e}__`}static replaceLoopIdentifierUsages(e,t,r){let n=$.analyzeLoopVariableUsage(e,t).slice().sort((e,t)=>t.start-e.start);if(0===n.length)return e;let i=e;return n.forEach(e=>{let n=e.isShorthand?this.buildShorthandReplacement(t,r,e.isUnwrap):r;i=i.slice(0,e.start)+n+i.slice(e.end)}),i}static buildShorthandReplacement(e,t,r){return r?`{ ${e}: ${t} }`:`${e}: ${t}`}static createLoopBoundaryBindingRewrite(){return e=>({evalExpression:e,rawExpressionCode:'("__pp_loop_read(\'" + __pp_loop_capture(__ppAttr) + "\')")'})}static isIdentifier(e){return/^[A-Za-z_$][\w$]*$/.test(e)&&!t.has(e)&&!this.INTERNAL_LOOP_NAMES.has(e)}static stripBalancedParens(e){let t=e.trim();return t.startsWith("(")&&this.findMatchingToken(t,0,"(",")")===t.length-1?t.slice(1,-1).trim():null}static parseLoopDirective(e){let t=this.findTopLevelInSeparator(e);if(-1===t)return null;let r=e.slice(0,t).trim(),n=e.slice(t+2).trim();if(!r||!n)return null;let i=this.stripBalancedParens(r);if(null!==i){let e=this.findTopLevelToken(i,",");if(-1===e)return null;let t=i.slice(0,e).trim(),r=i.slice(e+1).trim();return t&&r?{iterator:t,indexVar:r,collection:n}:null}return{iterator:r,indexVar:null,collection:n}}static findTopLevelInSeparator(e){let t={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let r=0;r<e.length;r++){let n=e[r];if(!this.advanceScannerState(t,e,r)&&0===t.parenDepth&&0===t.bracketDepth&&0===t.braceDepth&&"i"===n&&"n"===e[r+1]&&/\s/.test(e[r-1]??"")&&/\s/.test(e[r+2]??""))return r}return-1}static findTopLevelToken(e,t){let r={parenDepth:0,bracketDepth:0,braceDepth:0,quote:null};for(let n=0;n<e.length;n++)if(!this.advanceScannerState(r,e,n)&&0===r.parenDepth&&0===r.bracketDepth&&0===r.braceDepth&&e[n]===t)return n;return-1}static findMatchingToken(e,t,r,n){let i=0,s=null;for(let a=t;a<e.length;a++){let t=e[a],o=this.isEscaped(e,a);if(s)t===s&&!o&&(s=null);else if(o||'"'!==t&&"'"!==t&&"`"!==t)if(t!==r||o){if(t===n&&!o&&(i--,0===i))return a}else i++;else s=t}return-1}static advanceScannerState(e,t,r){let n=t[r],i=this.isEscaped(t,r);return e.quote?(n===e.quote&&!i&&(e.quote=null),!0):i||'"'!==n&&"'"!==n&&"`"!==n?(i||("("===n?e.parenDepth++:")"===n?e.parenDepth--:"["===n?e.bracketDepth++:"]"===n?e.bracketDepth--:"{"===n?e.braceDepth++:"}"===n&&e.braceDepth--),!1):(e.quote=n,!0)}static isEscaped(e,t){let r=0,n=t-1;for(;n>=0&&"\\"===e[n];)r++,n--;return r%2!=0}static processStructuralDirectives(e){if(!e.includes("pp-for"))return{html:e,loopReplacements:new Map};let t=document.createElement("template");t.innerHTML=e;let r=new Map,n=0,i=0,s=(e,t=[])=>{let a=Array.from(e.childNodes);for(let e of a){if(e.nodeType!==Node.ELEMENT_NODE)continue;let a=e,o="TEMPLATE"===a.tagName,l="template"===a.tagName&&"template"===a.localName;if(o||l){let e=a,o=e.getAttribute("pp-for")||"",l=null;if(e.hasAttribute("pp-for")){let t,r,n,s=this.parseLoopDirective(o),a=!1;if(!s){console.warn(`[PP-WARN] Invalid pp-for directive skipped: "${o}"`),e.replaceWith(document.createComment("invalid-loop"));continue}if(t=s.iterator,n=s.collection,r=s.indexVar??"__pp_idx_"+i++,a=null!==s.indexVar,!this.isIdentifier(t)||a&&!this.isIdentifier(r)||a&&t===r){console.warn(`[PP-WARN] pp-for currently expects identifier loop variables: "${o}"`),e.replaceWith(document.createComment("invalid-loop"));continue}if(!$.isValidExpression(n)){console.warn(`[PP-WARN] Invalid pp-for collection expression skipped: "${n}"`),e.replaceWith(document.createComment("invalid-loop"));continue}l={iterator:t,collectionName:n,indexVar:r,userDefinedIndex:a}}if(s(e.content??e,l?[...t,l]:t),l){let{iterator:i,collectionName:s,indexVar:a,userDefinedIndex:o}=l,c=e.innerHTML;c=this.transformContextProviderTags(c),c=this.transformComponentTags(c),c=this.transformRefAttributes(c),c=this.transformStyleAliasAttributes(c);let p=this.createLoopBoundaryBindingRewrite(),{html:h,boundaryReplacements:u}=this.transformComponentBoundaryBindings(c,{rewriteExpression:p});c=h,c=this.captureLoopVariablesInEventHandlers(c,i,a,o,t),c=this.transformLoopAttributeEmbeddedBindings(c,p),c=c.replace(/___PP_LOOP_\d+___/g,e=>"${"+e+"}"),c=c.replace(/\r/g,""),c=this.transformBooleanAttributes(c),c=this.transformInterpolations(c),c=this.escapeTemplateLiteralTextPreservingInterpolations(c),u.forEach((e,t)=>{c=c.split(t).join(e)});let d=`__pp_collection_${n}`,f=`__pp_items_${n}`,m=`(() => { const ${d} = (${s}); const ${f} = __pp_to_loop_items(${d}); return ${f}.map(${`(${i}, ${a})`} => \`${c}\`).join(''); })()`,g=`___PP_LOOP_${n++}___`;r.set(g,m),e.replaceWith(document.createTextNode(g));continue}continue}s(a,t)}};return s(t.content),{html:t.innerHTML,loopReplacements:r}}static transformInterpolations(e){let t="",r=0;for(;r<e.length;){if("o"===e[r]||"O"===e[r]){let n=e.slice(r,r+20).toLowerCase().match(/^on\w+\s*=\s*(["'])/);if(n){let i=e.slice(r,r+n[0].length),s=i[i.length-1],a=r+n[0].length;for(;a<e.length&&(e[a]!==s||"\\"===e[a-1]);)a++;t+=e.slice(r,a+1),r=a+1;continue}}if("{"===e[r]){if(r>0&&"$"===e[r-1]){t+="{",r++;continue}if(this.isServerTemplateBlockStart(e,r)){let n=this.findServerTemplateBlockEnd(e,r);if(-1!==n){t+=e.slice(r,n),r=n;continue}}let n=this.findClosingBrace(e,r);if(-1!==n){let i=_(e.slice(r+1,n));if($.isValidExpression(i)){t+="${__pp_render_value("+i+")}",r=n+1;continue}}}t+=e[r],r++}return t}static maskComplexComponents(e){if(!e.includes("pp-component="))return{maskedTemplate:e,placeholders:new Map};let t=document.createElement("template");t.innerHTML=e;let r=new Map,n=0,i=e=>e.replace(/&/g,"&").replace(/"/g,"""),s=e=>e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">"),a=(e,t)=>{if(!e.includes("{"))return e;let i="",s=0;for(;s<e.length;){let a=e[s];if("{"===a&&"$"!==e[s-1]){let a=te(e,s);if(-1!==a){let o=`__PP_CHILD_${n++}__`;r.set(o,t(e.slice(s,a+1))),i+=o,s=a+1;continue}}i+=a,s++}return i},o=e=>{Array.from(e.attributes).forEach(t=>{t.value.includes("{")&&e.setAttribute(t.name,a(t.value,i))})},l=(e,t)=>{Array.from(e.childNodes).forEach(e=>{if(e.nodeType===Node.TEXT_NODE){if(!t){let t=e.textContent??"";t.includes("{")&&(e.textContent=a(t,s))}return}if(e.nodeType!==Node.ELEMENT_NODE)return;let i=e;if("script"===i.tagName.toLowerCase()){let e=`__PP_CHILD_${n++}__`;return r.set(e,i.outerHTML),void i.replaceWith(document.createTextNode(e))}if(!(i instanceof HTMLTemplateElement&&i.hasAttribute("pp-owner")))return i.hasAttribute("pp-component")?(t||o(i),void l(i,!1)):(t||o(i),void l(i instanceof HTMLTemplateElement?i.content:i,t));l(i.content,!0)})},c=(e,t=!1)=>{if(e instanceof Element){if(e.hasAttribute("pp-component")){let i=!!e.querySelector("script"),s=!!e.querySelector("template[pp-owner]");if(i||s){if(t)i&&l(e,!1);else{let t=`__PP_CHILD_${n++}__`;r.set(t,e.outerHTML),e.replaceWith(document.createTextNode(t))}return}}if(e instanceof HTMLTemplateElement)return void c(e.content,!0)}Array.from(e.children).forEach(e=>c(e,t))};return c(t.content),{maskedTemplate:t.innerHTML,placeholders:r}}static findClosingBrace(e,t){return te(e,t)}static isServerTemplateBlockStart(e,t){return ne(e,t)}static findServerTemplateBlockEnd(e,t){return re(e,t)}},gn=class{componentId;bindingSeq=0;activeBindings=new Map;constructor(e){this.componentId=e}hasActiveBindings(){return this.activeBindings.size>0}ensureBindingId(e,t){let r="captured"===t?"__ppCapturedRefBindingId":"__ppPlainRefBindingId";return e[r]||(e[r]=`pprefbind_${this.componentId}_${t}_${++this.bindingSeq}`),e[r]}commit(e){for(let[t,r]of this.activeBindings.entries()){let n=e.get(t);n?(r.value!==n.value||r.element!==n.element)&&this.clearValue(r.value,"[PP-WARN] Ref cleanup failed"):this.clearValue(r.value,"[PP-WARN] Ref cleanup failed")}for(let[t,r]of e.entries()){let e=this.activeBindings.get(t);e&&e.value===r.value&&e.element===r.element||this.attachValue(r.value,r.element,"[PP-WARN] Ref attachment failed")}this.activeBindings=e}clearAll(){for(let e of this.activeBindings.values())this.clearValue(e.value,"[PP-WARN] Ref cleanup failed");this.activeBindings.clear()}attachValue(e,t,r){this.updateValue(e,t,r)}clearValue(e,t){this.updateValue(e,null,t)}updateValue(e,t,r){try{"function"==typeof e?e(t):e&&"object"==typeof e&&"current"in e&&(e.current=t)}catch(e){console.warn(r,e)}}},_n=class{componentId;trackedPortals=new Map;constructor(e){this.componentId=e}get size(){return this.trackedPortals.size}has(e){return this.trackedPortals.has(e)}get(e){return this.trackedPortals.get(e)}getPlaceholderText(e){return this.trackedPortals.get(e)?.placeholder.data||`pp-portal:${this.componentId}`}apply(e){let t=new Set,r=!1;for(let n of e){let e=n.ref.current;if(!e)continue;let i=n.target??document.body;t.add(e);let s=this.trackedPortals.get(e);if(s?.placeholder.parentNode){s.target!==i&&(i.appendChild(e),s.target=i,r=!0);continue}null===n.info.sourceParent&&e.parentNode instanceof Element&&(n.info.sourceParent=e.parentNode);let a=document.createComment(`pp-portal:${this.componentId}`);e.parentNode&&e.parentNode.insertBefore(a,e),i.appendChild(e),this.trackedPortals.set(e,{element:e,placeholder:a,target:i}),r=!0}for(let[e,n]of this.trackedPortals)t.has(e)||(n.placeholder.parentNode?(n.placeholder.parentNode.insertBefore(e,n.placeholder),n.placeholder.remove()):e.parentNode&&e.remove(),this.trackedPortals.delete(e),r=!0);return r}replaceElement(e,t){let r=this.trackedPortals.get(e);r&&(this.trackedPortals.delete(e),this.trackedPortals.set(t,{...r,element:t}))}contains(e){for(let[t]of this.trackedPortals)if(t===e||t.contains(e))return!0;return!1}elements(){return Array.from(this.trackedPortals.keys())}values(){return Array.from(this.trackedPortals.values())}destroyAll(){for(let[,e]of this.trackedPortals)e.element.parentNode&&e.element.remove(),e.placeholder.parentNode&&e.placeholder.remove();this.trackedPortals.clear()}},vn=class t{static DATE_LIKE_INPUT_TYPES=new Set(["date","datetime-local","month","time","week"]);static TEXT_SELECTION_INPUT_TYPES=new Set(["text","search","url","tel","password"]);registeredResetForms=new Set;applyControlledSelectValue(e,t){if(e.multiple){let r=new Set(this.normalizeControlledSelectValues(t));for(let t=0;t<e.options.length;t++){let n=e.options[t],i=r.has(n.value);n.selected!==i&&(n.selected=i)}return}let r=null==t?"":String(t);e.value!==r&&(e.value=r)}applyControlledInputValue(e,t){let r=null==t?"":String(t);this.shouldDeferFocusedDateLikeInputValue(e,r)?this.deferFocusedControlledInputValue(e,t):this.shouldDeferActiveNativeTextInputValue(e,r)||e.value!==r&&(e.value=r)}bindControlledSelectValues(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(!(n instanceof HTMLSelectElement))continue;let i=this.resolveControlledSelectCaptureId(n,t);i&&(this.trackValueControlMode(n,"controlled"),this.applyControlledSelectValue(n,t.get(i)))}}bindControlledInputValues(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(!(n instanceof HTMLInputElement))continue;let i=this.resolveControlledInputValue(n,t);i.hasValue&&(this.trackValueControlMode(n,"controlled"),this.applyControlledInputValue(n,i.value))}}bindControlledCheckedValues(e,t){for(let r=0;r<e.length;r++){let n=e[r];if(!(n instanceof HTMLInputElement))continue;let i=this.resolveControlledCheckedValue(n,t);if(!i.hasValue)continue;this.trackCheckedControlMode(n,"controlled");let s=!!i.value;n.checked!==s&&(n.checked=s)}}applyUncontrolledDefaultValue(e,t){if(e instanceof HTMLSelectElement)return void this.applyUncontrolledDefaultSelectValue(e,t);let r=null==t?"":String(t);this.trackValueControlMode(e,"uncontrolled"),e.defaultValue!==r&&(e.defaultValue=r),e.value!==r&&(e.value=r),e.__ppHasUncontrolledDefaultValue=!0}applyUncontrolledDefaultChecked(e,t){let r=this.normalizeDefaultCheckedValue(t);this.trackCheckedControlMode(e,"uncontrolled"),e.defaultChecked!==r&&(e.defaultChecked=r),e.checked!==r&&(e.checked=r),e.__ppHasUncontrolledDefaultChecked=!0}restoreUncontrolledSelectState(e){let t=Array.from(e.options);if(e.multiple)return void t.forEach(e=>{e.selected=e.defaultSelected});let r=t.find(e=>e.defaultSelected);r?e.value=r.value:t.length>0&&(e.selectedIndex=0)}isUncontrolledResetManagedElement(e){let t=e;return!(!t.__ppHasUncontrolledDefaultValue&&!t.__ppHasUncontrolledDefaultChecked)||e instanceof HTMLSelectElement&&Array.from(e.options).some(e=>e.defaultSelected)}syncUncontrolledFormResets(e,t,r){let n=new Set;for(let i=0;i<t.length;i++){let s=t[i];if(!(s.__ppHasUncontrolledDefaultValue||s.__ppHasUncontrolledDefaultChecked||s instanceof HTMLSelectElement))continue;let a=s.closest("form");a instanceof HTMLFormElement&&this.isUncontrolledResetManagedElement(s)&&(n.add(a),this.registerResetHandler(a,e,()=>{this.restoreUncontrolledFormDefaults(a,r())}))}for(let t of this.registeredResetForms)n.has(t)||this.unregisterResetHandler(t,e);this.registeredResetForms=n}clearResetHandlers(e){for(let t of this.registeredResetForms)this.unregisterResetHandler(t,e);this.registeredResetForms.clear()}restoreUncontrolledFormDefaults(e,t){for(let r=0;r<t.length;r++){let n=t[r],i=n;if(n.closest("form")===e){if(n instanceof HTMLSelectElement){this.restoreUncontrolledSelectState(n);continue}(n instanceof HTMLInputElement||n instanceof HTMLTextAreaElement)&&i.__ppHasUncontrolledDefaultValue&&(n.value=n.defaultValue),n instanceof HTMLInputElement&&i.__ppHasUncontrolledDefaultChecked&&(n.checked=n.defaultChecked)}}}resolveDefaultValueBinding(e,t){let r=e.getAttribute("data-pp-default-value");if(r){if(e.removeAttribute("data-pp-default-value"),e.__ppDefaultValueCaptureId=r,t.has(r))return t.get(r)}else if(e.__ppDefaultValueCaptureId){if(t.has(e.__ppDefaultValueCaptureId))return t.get(e.__ppDefaultValueCaptureId);delete e.__ppDefaultValueCaptureId}return"__ppResolvedDefaultValue"in e?e.__ppResolvedDefaultValue:e.hasAttribute("defaultvalue")?e.getAttribute("defaultvalue"):void 0}resolveDefaultCheckedBinding(e,t){let r=e.getAttribute("data-pp-default-checked");if(r){if(e.removeAttribute("data-pp-default-checked"),e.__ppDefaultCheckedCaptureId=r,t.has(r))return t.get(r)}else if(e.__ppDefaultCheckedCaptureId){if(t.has(e.__ppDefaultCheckedCaptureId))return t.get(e.__ppDefaultCheckedCaptureId);delete e.__ppDefaultCheckedCaptureId}return"__ppResolvedDefaultChecked"in e?e.__ppResolvedDefaultChecked:e.hasAttribute("defaultchecked")?e.getAttribute("defaultchecked"):void 0}materializeNestedBoundaryFormDefaults(e,t){let r=e,n=e.getAttribute("data-pp-input-value")??r.__ppInputValueCaptureId;if(n&&t.inputValueStore.has(n)){let i=t.inputValueStore.get(n);if(e.removeAttribute("data-pp-input-value"),r.__ppInputValueCaptureId=n,r.__ppResolvedInputValue=i,e instanceof HTMLInputElement)this.applyControlledInputValue(e,i);else if(e instanceof HTMLSelectElement)this.applyControlledSelectValue(e,i);else if(e instanceof HTMLTextAreaElement){let t=null==i?"":String(i);e.value!==t&&(e.value=t)}}let i=e.getAttribute("data-pp-default-value");if(i&&t.defaultValueStore.has(i)&&(e.removeAttribute("data-pp-default-value"),e.__ppResolvedDefaultValue=t.defaultValueStore.get(i)),!(e instanceof HTMLInputElement))return;let s=e,a=e.getAttribute("data-pp-checked-value")??s.__ppCheckedValueCaptureId;if(a&&t.checkedValueStore.has(a)){let r=t.checkedValueStore.get(a);e.removeAttribute("data-pp-checked-value"),s.__ppCheckedValueCaptureId=a;let n=!!r;e.checked!==n&&(e.checked=n)}let o=e.getAttribute("data-pp-default-checked");o&&t.defaultCheckedStore.has(o)&&(e.removeAttribute("data-pp-default-checked"),e.__ppResolvedDefaultChecked=t.defaultCheckedStore.get(o))}normalizeControlledSelectValues(e){return null==e?[]:Array.isArray(e)?e.filter(e=>null!=e).map(e=>String(e)):[String(e)]}applyUncontrolledDefaultSelectValue(e,t){this.trackValueControlMode(e,"uncontrolled");let r=this.normalizeControlledSelectValues(t),n=e.multiple?new Set(r):new Set(r.length>0?[r[0]]:[]);for(let t=0;t<e.options.length;t++){let r=e.options[t],i=r,s=n.has(r.value);r.defaultSelected!==s&&(r.defaultSelected=s),r.selected!==s&&(r.selected=s),s?i.__ppHasUncontrolledDefaultSelected=!0:delete i.__ppHasUncontrolledDefaultSelected}if(!e.multiple){let t=r.length>0?r[0]:"";e.value!==t&&(e.value=t)}}resolveControlledSelectCaptureId(e,t){let r=e.getAttribute("data-pp-select-value"),n=null;return r?(e.removeAttribute("data-pp-select-value"),e.__ppSelectValueCaptureId=r,n=r):e.__ppSelectValueCaptureId&&t.has(e.__ppSelectValueCaptureId)?n=e.__ppSelectValueCaptureId:e.__ppSelectValueCaptureId&&delete e.__ppSelectValueCaptureId,n}resolveControlledInputValue(e,t){let r,n=e.getAttribute("data-pp-input-value"),i=!1;return n?(e.removeAttribute("data-pp-input-value"),e.__ppInputValueCaptureId=n,t.has(n)&&(r=t.get(n),i=!0)):e.__ppInputValueCaptureId&&t.has(e.__ppInputValueCaptureId)?(r=t.get(e.__ppInputValueCaptureId),i=!0):"__ppResolvedInputValue"in e?(r=e.__ppResolvedInputValue,i=!0):e.__ppInputValueCaptureId&&delete e.__ppInputValueCaptureId,{hasValue:i,value:r}}resolveControlledCheckedValue(e,t){let r,n=e.getAttribute("data-pp-checked-value"),i=!1;if(n)e.removeAttribute("data-pp-checked-value"),e.__ppCheckedValueCaptureId=n,t.has(n)&&(r=t.get(n),i=null!=r);else{let n=e.__ppCheckedValueCaptureId;n&&t.has(n)?(r=t.get(n),i=null!=r):n&&delete e.__ppCheckedValueCaptureId}return{hasValue:i,value:r}}trackValueControlMode(e,t){let r=e,n=r.__ppValueControlMode;n?n!==t&&(r.__ppWarnedValueControlModeSwitch||(r.__ppWarnedValueControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${n} to ${t}. Choose either a controlled value binding or an uncontrolled defaultValue for the lifetime of the element.`)),r.__ppValueControlMode=t):r.__ppValueControlMode=t}describeControl(e){let t=e.tagName.toLowerCase(),r=e.id?`#${e.id}`:"",n=e.getAttribute("name");return`${t}${r}${!r&&n?`[name="${n}"]`:""}`}trackCheckedControlMode(e,t){let r=e,n=r.__ppCheckedControlMode;n?n!==t&&(r.__ppWarnedCheckedControlModeSwitch||(r.__ppWarnedCheckedControlModeSwitch=!0,console.warn(`[PP-WARN] ${this.describeControl(e)} changed from ${n} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)),r.__ppCheckedControlMode=t):r.__ppCheckedControlMode=t}registerResetHandler(t,r,n){let i=t;i.__ppResetCallbacks||=new Map,i.__ppResetCallbacks.set(r,n),!i.__ppOriginalReset&&(i.__ppOriginalReset=t.reset,t.reset=function(){i.__ppOriginalReset?.call(this),i.__ppResetCallbacks?.forEach((t,n)=>{e.getInstance(n)||n===r?t():i.__ppResetCallbacks?.delete(n)})})}unregisterResetHandler(e,t){let r=e;r.__ppResetCallbacks?.delete(t),!(r.__ppResetCallbacks&&r.__ppResetCallbacks.size>0)&&(r.__ppOriginalReset&&(e.reset=r.__ppOriginalReset,delete r.__ppOriginalReset),delete r.__ppResetCallbacks)}normalizeDefaultCheckedValue(e){if("string"==typeof e){let t=e.trim().toLowerCase();if(""===t||"true"===t)return!0;if("false"===t||"0"===t||"off"===t||"no"===t)return!1}return!!e}isDateLikeInput(e){return t.DATE_LIKE_INPUT_TYPES.has(e.type)}shouldDeferFocusedDateLikeInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!this.isDateLikeInput(e))&&e.value!==t}shouldDeferActiveNativeTextInputValue(e,t){return!(typeof document>"u"||document.activeElement!==e||!e.__ppPreserveNativeSelectionOnNextRender)&&(this.isTextSelectionControl(e)&&e.value!==t)}isTextSelectionControl(e){return t.TEXT_SELECTION_INPUT_TYPES.has(e.type)}deferFocusedControlledInputValue(e,t){if(e.__ppDeferredControlledValue=t,e.__ppDeferredControlledBlurHandler)return;let r=()=>{let t=e.__ppDeferredControlledValue;if(delete e.__ppDeferredControlledValue,delete e.__ppDeferredControlledBlurHandler,!e.isConnected)return;let r=null==t?"":String(t);e.value!==r&&(e.value=r)};e.__ppDeferredControlledBlurHandler=r,e.addEventListener("blur",r,{once:!0})}},yn=class{componentId;getParentId;isCurrentInstance;isRendering;forceUpdate;pendingProvidedContexts=new Map;pendingContextTokens=new Set;activeProviderBoundaryIds=new Set;refreshPending=!1;warnedContextOutsideRender=!1;constructor(e,t,r,n,i){this.componentId=e,this.getParentId=t,this.isCurrentInstance=r,this.isRendering=n,this.forceUpdate=i}prepareRender(){this.pendingProvidedContexts=new Map,this.pendingContextTokens=new Set}consume(t){return!this.isRendering()&&!this.warnedContextOutsideRender&&(this.warnedContextOutsideRender=!0,console.warn(`[PP-WARN] pp.context(...) should be called while component "${this.componentId}" is rendering. Move context reads to the component script body and pass values to event handlers through closure state.`)),this.pendingContextTokens.add(t),e.resolveContext(this.getParentId(),t).value}provide(e,t){this.pendingProvidedContexts.set(e,t)}commitRenderContexts(){let t=e.saveContextValues(this.componentId,this.pendingProvidedContexts);return e.updateContextDependencies(this.componentId,this.pendingContextTokens),t.length>0?e.getConsumersForContextsInSubtree(this.componentId,t):null}syncProviderBoundary(t,r,n,i){e.saveParent(t,r);let s=e.saveContextValues(t,new Map([[n,i]]));return s.length>0?e.getConsumersForContextsInSubtree(t,s):new Set}replaceActiveProviderBoundaries(t){let r=new Set;return this.activeProviderBoundaryIds.forEach(n=>{t.has(n)||e.removeContextTracking(n).forEach(e=>r.add(e))}),this.activeProviderBoundaryIds=t,r}requestRefresh(){this.refreshPending||(this.refreshPending=!0,queueMicrotask(()=>{if(this.refreshPending=!1,this.isCurrentInstance()){if(this.isRendering())return void this.requestRefresh();this.forceUpdate()}}))}refreshConsumers(t){for(let r of t)e.getInstance(r)?.requestContextRefresh?.()}destroy(){return this.activeProviderBoundaryIds.forEach(t=>{e.removeContextTracking(t)}),this.activeProviderBoundaryIds.clear(),e.removeContextTracking(this.componentId)}},bn=new Set(["text","search","url","tel","password"]),xn=class{getRoot;containsPortalElement;collectManagedInputs;isDateLikeInput;constructor(e,t,r,n){this.getRoot=e,this.containsPortalElement=t,this.collectManagedInputs=r,this.isDateLikeInput=n}save(e){let t=document.activeElement;if(!t)return null;let r=this.getRoot().contains(t),n=!r&&this.containsPortalElement(t);if(!r&&!n)return null;let i=(e??this.collectManagedInputs()).indexOf(t);if(-1===i)return null;let s=this.getTextSelectionState(t);return{element:t,index:i,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd}}restore(e,t){if(!e)return;let r=e.element,n=this.getRoot(),i=r&&r.isConnected&&(n.contains(r)||this.containsPortalElement(r))?r:(t??this.collectManagedInputs())[e.index];if(!i)return;let s=i===document.activeElement,a=i;if(!(s&&i instanceof HTMLInputElement&&this.isDateLikeInput(i))&&(s||i.focus(),null!==e.selectionStart&&null!==e.selectionEnd&&this.isTextSelectionControl(i))){if(s&&a.__ppPreserveNativeSelectionOnNextRender)return void delete a.__ppPreserveNativeSelectionOnNextRender;if(s&&i.selectionStart===e.selectionStart&&i.selectionEnd===e.selectionEnd)return;try{i.setSelectionRange(e.selectionStart,e.selectionEnd)}catch(e){console.warn("Could not restore cursor position",e)}}}isTextSelectionControl(e){return e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement&&bn.has(e.type)}getTextSelectionState(e){if(!this.isTextSelectionControl(e))return{selectionStart:null,selectionEnd:null};try{return{selectionStart:e.selectionStart,selectionEnd:e.selectionEnd}}catch{return{selectionStart:null,selectionEnd:null}}}},Sn=class{options;constructor(e){this.options=e}morphChildren(e,t){if(this.hasKeyedDirectChildren(e)||this.hasKeyedDirectChildren(t))return void this.morphKeyedChildren(e,t);let r=e.firstChild,n=t.firstChild;for(;r||n;){let t=r?.nextSibling??null,i=n?.nextSibling??null;if(n){if(!r){let t=n.cloneNode(!0);e.appendChild(t),t.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(t),n=i;continue}if(r.nodeType!==n.nodeType){let s=n.cloneNode(!0);e.replaceChild(s,r),s.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(s),r=t,n=i;continue}r.nodeType!==Node.TEXT_NODE?(r.nodeType===Node.ELEMENT_NODE&&this.morphCompatibleElement(e,r,n),r=t,n=i):(r.textContent!==n.textContent&&(r.textContent=n.textContent),r=t,n=i)}else r&&e.removeChild(r),r=t}}morphCompatibleElement(e,t,r){if(t.tagName!==r.tagName){let n=r.cloneNode(!0);return e.replaceChild(n,t),void(n.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(n))}if(t.hasAttribute("pp-component")&&t!==this.options.root){if(!this.options.syncNestedBoundaryAttributes(t,r)){let n=r.cloneNode(!0);return e.replaceChild(n,t),void(n.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(n))}this.options.hasEventAttributes(t)&&this.options.collectEventElements(t)}else this.options.syncAttributes(t,r),this.options.hasEventAttributes(t)&&this.options.collectEventElements(t),!(t instanceof HTMLTextAreaElement)&&this.morphChildren(t,r)}hasKeyedDirectChildren(e){let t=e.childNodes;for(let e=0;e<t.length;e++){let r=t[e];if(null!==this.getNodeKey(r))return!0}return!1}getNodeKey(e){if(e.nodeType!==Node.ELEMENT_NODE)return null;let t=e.getAttribute("key");return t&&t.length>0?t:null}areNodesCompatible(e,t){if(e.nodeType!==t.nodeType)return!1;if(e.nodeType!==Node.ELEMENT_NODE)return!0;let r=t;if(e.tagName!==r.tagName)return!1;let n=this.getNodeKey(e),i=this.getNodeKey(t);return null===n&&null===i||null!==n&&n===i}morphKeyedChildren(e,t){let r=Array.from(e.childNodes),n=Array.from(t.childNodes),i=this.collectDuplicateKeys(n),s=new Map,a=new Set,o=new Map;i.length>0&&console.warn(`[PP-WARN] Duplicate key values detected: ${i.join(", ")}`);let l=e=>{a.add(e);let t=this.getUnkeyedNodeSignature(e),r=o.get(t);r?r.push(e):o.set(t,[e])},c=e=>{let t=this.getUnkeyedNodeSignature(e),r=o.get(t);for(;r&&r.length>0;){let n=r.shift();if(a.delete(n),this.areNodesCompatible(n,e))return 0===r.length&&o.delete(t),n}o.delete(t)};r.forEach(e=>{let t=this.getNodeKey(e);if(null===t)return void l(e);let r=s.get(t);r?r.push(e):s.set(t,[e])});let p=e.firstChild;n.forEach(t=>{let r,n=this.getNodeKey(t);if(null!==n){let e=s.get(n);for(;e&&e.length>0;){let n=e.shift();if(this.areNodesCompatible(n,t)){r=n;break}l(n)}}else r=c(t);if(r)r!==p&&e.insertBefore(r,p);else{let n=t.cloneNode(!0);e.insertBefore(n,p),n.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(n),r=n}this.morphNode(r,t),p=r.nextSibling}),a.forEach(t=>{t.parentNode===e&&e.removeChild(t)}),s.forEach(t=>{t.forEach(t=>{t.parentNode===e&&e.removeChild(t)})})}collectDuplicateKeys(e){let t=new Set,r=new Set;return e.forEach(e=>{let n=this.getNodeKey(e);if(null!==n){if(t.has(n))return void r.add(n);t.add(n)}}),Array.from(r.values())}getUnkeyedNodeSignature(e){return e.nodeType===Node.ELEMENT_NODE?`element:${e.tagName}`:`node:${e.nodeType}`}morphNode(e,t){if(e.nodeType!==t.nodeType){let r=e.parentNode;if(!r)return;let n=t.cloneNode(!0);return r.replaceChild(n,e),void(n.nodeType===Node.ELEMENT_NODE&&this.options.collectEventElements(n))}if(e.nodeType===Node.TEXT_NODE)return void(e.textContent!==t.textContent&&(e.textContent=t.textContent));if(e.nodeType!==Node.ELEMENT_NODE)return;let r=e,n=t,i=r.parentNode;i&&this.morphCompatibleElement(i,r,n)}},Cn=class t{componentId;constructor(e){this.componentId=e}extractOwnedTemplates(e){let t=new Map,r=e.querySelectorAll("template[pp-owner]"),n=0;return r.forEach(r=>{if(r.parentElement?.closest("[pp-component]")!==e)return;let i=r.getAttribute("pp-owner");if(!i)return;let s=`__PP_OWNED_${this.componentId}_${n++}__`;t.set(s,{ownerId:i,content:r.innerHTML,contextTag:r.parentElement?.tagName.toLowerCase()??null}),r.replaceWith(document.createComment(s))}),t}resolveOwnedChildren(t,r){if(!t.includes("__PP_OWNED_"))return t;r.forEach((e,r)=>{let n=this.resolveOwnedTemplateOwner(e.ownerId);if(n){let i=this.renderOwnedContent(e,n.ownerId,n.scope);t=this.replaceOwnedPlaceholder(t,r,i)}else t=this.replaceOwnedPlaceholder(t,r,e.content)});let n,i=/__PP_OWNED_([^_]+(?:_[^_]+)*)_(\d+)__/g;for(;null!==(n=i.exec(t));){let r=n[0],s=n[1],a=e.getOwnedTemplates(s);if(a&&a.has(r)){let e=a.get(r),n=this.resolveOwnedTemplateOwner(e.ownerId,s);if(n){let i=this.renderOwnedContent(e,n.ownerId,n.scope);t=this.replaceOwnedPlaceholder(t,r,i)}else t=this.replaceOwnedPlaceholder(t,r,e.content);i.lastIndex=0}}return t}maskNestedOwnedTemplates(e,t=null){if(!e.includes("pp-owner"))return{content:e,placeholders:new Map};let r=new Map,n=se(e,t),i=0,s=n.root.querySelectorAll("[pp-component] > template[pp-owner]");for(let e of Array.from(s)){let t=`__PP_NESTED_TPL_${i++}__`;r.set(t,e.outerHTML),e.replaceWith(document.createComment(t))}return{content:n.toHtml(),placeholders:r}}restoreMaskedOwnedTemplates(e,t){if(0===t.size)return;let r=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT),n=[],i=r.nextNode();for(;i;){let e=i,s=t.get(e.data||"");if(s){let t=document.createElement("template");t.innerHTML=s;let r=t.content.firstChild;r&&n.push({node:e,replacement:r})}i=r.nextNode()}n.forEach(({node:e,replacement:t})=>{e.replaceWith(t)})}materializeTemplateComponentBoundaries(e){t.materializeTemplateComponentBoundaries(e)}static materializeTemplateComponentBoundaries(e){let t=[];e instanceof HTMLTemplateElement&&e.hasAttribute("pp-component")&&t.push(e),e.querySelectorAll("template[pp-component]").forEach(e=>t.push(e)),t.forEach(e=>{let t=e.content.cloneNode(!0),r=t.firstElementChild;r?(Array.from(e.attributes).forEach(e=>{"pp-owner"!==e.name&&r.setAttribute(e.name,e.value)}),e.replaceWith(t)):e.replaceWith(document.createComment("pp-empty-template-component"))})}replaceOwnedPlaceholder(e,t,r){let n=`\x3c!--${t}--\x3e`,i=e.includes(n)?n:t,s=e.indexOf(i);return-1===s?e:e.slice(0,s)+r+e.slice(s+i.length)}renderOwnedContent(e,t,r){let{content:n,placeholders:i}=this.maskNestedOwnedTemplates(e.content,e.contextTag),s=this.createOwnedRenderScope(r),a=c(s).keys,o=l(s,a),p=oe(e.contextTag),h=hn.compile(p.wrap(n),a),u=p.unwrap(h(...o));for(let[e,t]of i)u=this.replaceOwnedPlaceholder(u,e,t);return this.markOwnedBindings(u,t,e.contextTag)}createOwnedRenderScope(t){let r=e.getScope(this.componentId);if(!r)return t;let n={...t};return["__pp_input_value","__pp_select_value","__pp_checked_value","__pp_default_value","__pp_default_checked"].forEach(e=>{"function"==typeof r[e]&&(n[e]=r[e])}),n}resolveOwnedTemplateOwner(t,r=this.componentId){let n=e.resolveComponentId(t,r);if(!n)return null;let i=e.getResolvedScopeWithAncestors(t,r);return i?{ownerId:n,scope:i}:null}markOwnedBindings(e,t,r=null){let n=se(e,r),i=[...n.root instanceof DocumentFragment?Array.from(n.root.children):[n.root]].reverse();for(;i.length>0;){let e=i.pop();if(Array.from(e.attributes).some(e=>e.name.startsWith("on"))&&e.setAttribute("pp-event-owner",t),e.hasAttribute("data-pp-ref")&&e.setAttribute("pp-ref-owner",t),e.hasAttribute("pp-component"))continue;let r=Array.from(e.children);for(let e=r.length-1;e>=0;--e)i.push(r[e])}return n.toHtml()}},wn=class{componentId;interpolationCache;scopeEvalCache;propEvalCache;getCachedFunction;constructor(e,t,r,n,i){this.componentId=e,this.interpolationCache=t,this.scopeEvalCache=r,this.propEvalCache=n,this.getCachedFunction=i}interpolateAttrString(e,t){let r=c(t),n=r.keys,i=l(t,n),s=r.keySig;return ie(e,e=>{let t=_(e);try{let e=this.getCachedFunction(this.interpolationCache,t,n,s,300)(...i);return"boolean"==typeof e||null==e?"":Array.isArray(e)?e.join(""):String(e)}catch(e){return console.warn(`[PP-WARN] Failed attribute interpolation for {${t}}`,e),""}})}applyAttributeInterpolations(e,t){let n=c(t),i=n.keys,s=l(t,i),a=n.keySig;for(let n of Array.from(e.attributes)){let o=n.name;if("pp-component"===o||o.startsWith("on"))continue;let l=n.value;if(!l.includes("{"))continue;let c=y(l);if(!c){let r=this.interpolateAttrString(l,t);r!==l&&e.setAttribute(o,r);continue}let p,h=_(c.expression);if(!$.isValidExpression(h))continue;try{p=this.getCachedFunction(this.scopeEvalCache,h,i,a,300)(...s)}catch(e){console.error(`[PP-ERROR] Failed to eval "${h}"`,e);continue}if(r.has(o.toLowerCase())&&"boolean"==typeof p){p?e.setAttribute(o,""):e.removeAttribute(o);continue}let u=typeof p;null==p?e.removeAttribute(o):("string"===u||"number"===u||"boolean"===u||"bigint"===u)&&e.setAttribute(o,String(p))}}computePropsFromAttributes(r,n){let s=n?e.getResolvedScopeWithAncestors(n,this.componentId):void 0,a=s?c(s):null,o=a?.keys??[],p=s?l(s,o):[],h=r.__ppRawBindings,u=new Set([...Array.from(r.attributes).map(e=>e.name),...h?Object.keys(h):[]]),d=a?.keySig??"",f=e=>{if(s)try{return this.getCachedFunction(this.propEvalCache,e,o,d,200)(...p)}catch(t){return void console.warn(`[PP-WARN] Failed to evaluate prop expression "{${e}}" for component "${this.componentId}"`,t)}};return Array.from(u).reduce((e,n)=>{if(n.startsWith("on")&&!n.includes("-")||"pp-component"===n)return e;let a=i(n);if(t.has(a))return e;let o=r.attributes.getNamedItem(n),l=h?.[n]??o?.value;if(void 0===l)return e;if(""===l)return e[a]=!0,e;if(s){let t=y(l);if(t){let r=_(t.expression);if($.isValidExpression(r))return e[a]=f(r),e}if(l.includes("{"))return e[a]=this.interpolateAttrString(l,s),e}return e[a]=l,e},{})}},Tn=class{getRoot;getPortalElements;refCaptureIdsByElement;refExprsByElement;cache=null;constructor(e,t,r,n){this.getRoot=e,this.getPortalElements=t,this.refCaptureIdsByElement=r,this.refExprsByElement=n}invalidate(){this.cache=null}getCache(){if(this.cache)return this.cache;let e=this.getRoot(),t=[],r=[],n=[],i=[],s=new Set,a=[],o=(e,t)=>{if(t)a.push(e);else for(let t=e.children.length-1;t>=0;t--)a.push(e.children[t])};o(e,!0);for(let e of this.getPortalElements())o(e,!0);for(;a.length>0;){let o=a.pop();if(s.has(o))continue;s.add(o);let l=o,c=o!==e&&o.hasAttribute("pp-component");if(t.push(l),(o.hasAttribute("data-pp-ref")||o.hasAttribute("pp-ref")||this.refCaptureIdsByElement.has(l)||this.refExprsByElement.has(l))&&i.push(l),!c&&(o instanceof HTMLInputElement||o instanceof HTMLTextAreaElement||o instanceof HTMLSelectElement)&&n.push(l),c)r.push(l);else for(let e=o.children.length-1;e>=0;e--)a.push(o.children[e])}return this.cache={ownedElements:t,childBoundaries:r,managedInputs:n,refElements:i},this.cache}collectManagedInputs(){return this.getCache().managedInputs}collectEventElements(e,t){if(e!==this.getRoot()&&e.hasAttribute("pp-component"))this.hasEventAttributes(e)&&t.add(e);else{this.hasEventAttributes(e)&&t.add(e);for(let r=0;r<e.children.length;r++)this.collectEventElements(e.children[r],t)}}hasEventAttributes(e){let t=e.attributes;for(let e=0;e<t.length;e++)if(t[e].name.startsWith("on")&&!t[e].name.includes("-"))return!0;return!1}isManagedEventElement(e){if(this.isElementOwnedByTree(e,this.getRoot()))return!0;for(let t of this.getPortalElements())if(this.isElementOwnedByTree(e,t))return!0;return!1}isElementOwnedByTree(e,t){if(e===t)return!0;if(!t.contains(e))return!1;let r=e,n=!0;for(;r&&r!==t;){if(!n&&r.hasAttribute("pp-component"))return!1;r=r.parentElement,n=!1}return r===t}},En=class{options;boundaryOccurrencesByBaseId=new Map;constructor(e){this.options=e}bootstrap(){this.boundaryOccurrencesByBaseId.clear();let e=new Set,t=new Set,r=new Set,n=(i,s)=>{let a=i.children;for(let i=0;i<a.length;i++){let o=a[i];if(o.hasAttribute("pp-component")){let t=this.bootstrapComponentBoundary(o,s);t&&e.add(t);continue}n(o,this.syncContextProviderBoundary(o,s,t,r)??s)}};n(this.options.getRoot(),this.options.componentId);for(let e of this.options.getPortalElements())n(e,this.options.componentId);this.options.contextManager.replaceActiveProviderBoundaries(t).forEach(e=>r.add(e)),r.size>0&&this.options.refreshContextConsumers(r),this.destroyDisconnectedDescendants(e)}syncNestedBoundaryAttributes(e,t){let r=t.getAttribute("pp-component"),n=this.getBoundaryBaseId(e);if(!r||n&&r!==n)return!1;this.options.syncAttributes(e,t,!1,!0),e.__ppRawBindings=this.collectRawBindings(t);let i=e;return i.__ppRuntimeComponentId&&e.getAttribute("pp-component")!==i.__ppRuntimeComponentId&&e.setAttribute("pp-component",i.__ppRuntimeComponentId),this.refreshNestedOwnedChildren(e,t),!0}refreshNestedOwnedChildren(t,r){let n=t.__ppRuntimeComponentId??t.getAttribute("pp-component");n&&e.getInstance(n)?.refreshOwnedChildrenFromElement?.(r)}createBoundaryId(e,t,r){let n=(this.boundaryOccurrencesByBaseId.get(e)??0)+1;return this.boundaryOccurrencesByBaseId.set(e,n),1===n?{id:e,occurrence:n}:{id:`${e}__pp${this.hashScope(this.getBoundaryScopeSignature(t,r))}`,occurrence:n}}getBoundaryScopeSignature(e,t){let r=[],n=e;for(;n;){let e=n.getAttribute("key");e&&e.length>0?r.unshift(`k:${e}`):r.unshift(`i:${this.getElementIndexWithinParent(n)}`);let t=n.parentElement;if(!t||t.hasAttribute("pp-component"))break;n=t}return`${t}|${r.join("/")}`}getElementIndexWithinParent(e){let t=e.parentElement;if(!t)return 0;let r=t.children;for(let t=0;t<r.length;t++)if(r[t]===e)return t;return 0}hashScope(e){let t=5381;for(let r=0;r<e.length;r++)t=33*t^e.charCodeAt(r);return(t>>>0).toString(36)}getBoundaryBaseId(e){let t=e,r=e.getAttribute("pp-component");return!t.__ppBaseComponentId&&r&&(t.__ppBaseComponentId=r),t.__ppBaseComponentId??r}ensureBoundaryIdentity(t,r){let n=t,i=t.getAttribute("pp-component")||"",s=i?this.createBoundaryId(i,t,r):null,a=s?.id??"";if(n.__ppRuntimeComponentId)return i!==n.__ppRuntimeComponentId&&t.setAttribute("pp-component",n.__ppRuntimeComponentId),n.__ppBaseComponentId||=i||n.__ppRuntimeComponentId,n.__ppRuntimeComponentId;if(!i)return"";i.includes("{")&&!n.__ppWarnedDynamicComponentId&&(n.__ppWarnedDynamicComponentId=!0,console.warn(`[PP-WARN] Dynamic pp-component values are not supported. Component boundary ids are static; received "${i}". Use a stable pp-component id and pass dynamic values through props instead.`)),n.__ppBaseComponentId=i;let o=e.getInstance(a);if(o&&o.el&&o.el!==t){if(o.el.isConnected){let e=s?this.createUniqueCollisionId(a,s.occurrence,t):`${i}__ppcollision`;return n.__ppRuntimeComponentId=e,t.setAttribute("pp-component",e),e}o.destroy?.()}return n.__ppRuntimeComponentId=a,i!==a&&t.setAttribute("pp-component",a),a}createUniqueCollisionId(t,r,n){let i=Math.max(r,1);for(;;){let r=1===i?`${t}_1`:`${t}_${i.toString(36)}`,s=e.getInstance(r);if(!s||!s.el||s.el===n)return r;if(!s.el.isConnected)return s.destroy?.(),r;i+=1}}bootstrapComponentBoundary(t,r){let n=t,i=this.ensureBoundaryIdentity(t,r);if(!i)return null;if(n.__ppRawBindings){let e=this.options.isEffectManagedSurfaceElement(t),r=n.__ppRawBindings;for(let[n,i]of Object.entries(r))e&&this.options.shouldSkipEffectManagedAttr(n)||t.setAttribute(n,i)}else n.__ppRawBindings=this.collectRawBindings(t);let s=e.getResolvedScopeWithAncestors(r,this.options.componentId)??this.options.getLatestScope();this.options.applyAttributeInterpolations(t,s),this.options.materializeFormDefaults(t);let a=e.getInstance(i);if(a?.refreshPropsFromParent){let s=a.parentId!==r;if(a.parentId=r,e.saveParent(i,r),a.el!==t){let e=a.el;!n.__ppRawBindings&&e.__ppRawBindings&&(n.__ppRawBindings=e.__ppRawBindings),a.el=t}return a.refreshPropsFromParent(s),i}if(!e.getState(i)){n.__ppRuntimeParentId=r;try{this.options.createComponent(t)}finally{delete n.__ppRuntimeParentId}}return i}collectRawBindings(e){let t={};for(let r of Array.from(e.attributes))r.value.includes("{")&&"pp-component"!==r.name&&!r.name.startsWith("on")&&(t[r.name]=r.value);return t}destroyDisconnectedDescendants(t){let r=e.getDescendantIds(this.options.componentId);for(let n of r){if(t.has(n))continue;let r=e.getInstance(n);!r?.el||r.el.isConnected||r.destroy?.()}}syncContextProviderBoundary(e,t,r,n){if("pp-context-provider"!==e.tagName.toLowerCase())return null;let i=this.resolveContextProviderBoundary(e);return i?(r.add(i.boundaryId),this.options.contextManager.syncProviderBoundary(i.boundaryId,t,i.context,i.value).forEach(e=>n.add(e)),i.boundaryId):null}resolveContextProviderBoundary(e){let t=e,r=e.getAttribute("data-pp-context-token")??t.__ppContextTokenCaptureId??null,n=e.getAttribute("data-pp-context-value")??t.__ppContextValueCaptureId??null;if(!r||!n)return null;t.__ppContextTokenCaptureId=r,t.__ppContextValueCaptureId=n,e.removeAttribute("data-pp-context-token"),e.removeAttribute("data-pp-context-value");let i=this.options.getContextTokenStore().get(r);return i?{boundaryId:this.ensureContextProviderBoundaryId(t),context:i,value:this.options.getContextValueStore().get(n)}:null}ensureContextProviderBoundaryId(e){return e.__ppContextBoundaryId||=`ppctx_${this.options.componentId}_${Math.random().toString(36).slice(2,10)}`,e.__ppContextBoundaryId}},Dn=new Set(["data-state","data-open","style","aria-hidden","aria-checked","hidden","inert"]),On=new Set(["alert-dialog-content","alert-dialog-overlay","alert-dialog-portal","checkbox","dialog-content","dialog-overlay","dialog-portal","popover-content","sheet-content","sheet-overlay","sheet-portal","tooltip-content"]),kn=class{refCaptureIdsByElement;refExprsByElement;constructor(e,t){this.refCaptureIdsByElement=e,this.refExprsByElement=t}isEffectManagedAttr(e){return Dn.has(e)}isEffectManagedSurfaceElement(e,t){let r=e.getAttribute("data-slot");if(r&&On.has(r))return!0;let n=t?.getAttribute("data-slot");return!!n&&On.has(n)}syncAttributes(e,t,r=!1,n=!1){let i=r||this.isEffectManagedSurfaceElement(e,t),s=e,a=e.attributes;for(let r=a.length-1;r>=0;r--){let o=a[r].name;if(!(n&&"pp-component"===o||t.hasAttribute(o))){if(i&&Dn.has(o)||"value"===o&&e instanceof HTMLInputElement&&s.__ppHasUncontrolledDefaultValue||"checked"===o&&e instanceof HTMLInputElement&&s.__ppHasUncontrolledDefaultChecked||"selected"===o&&e instanceof HTMLOptionElement&&s.__ppHasUncontrolledDefaultSelected)continue;e.removeAttribute(o),"data-pp-ref"===o&&this.refCaptureIdsByElement.delete(e),"pp-ref"===o&&this.refExprsByElement.delete(e)}}le.unbindRemovedEventHandlers(e,t);let o=t.attributes,l=t.getAttribute("pp-event-owner");for(let t=0;t<o.length;t++){let r=o[t];i&&Dn.has(r.name)||n&&"pp-component"===r.name||le.hasSameDirectBoundHandler(e,r.name,r.value,l)||(e.getAttribute(r.name)!==r.value&&e.setAttribute(r.name,r.value),"checked"===r.name&&e instanceof HTMLInputElement&&(this.trackCheckedControlMode(e,"controlled"),e.checked=!0),"value"===r.name&&(e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement)&&e.value!=r.value&&(e.value=r.value))}if(e.hasAttribute("pp-event-owner")&&!Array.from(e.attributes).some(e=>e.name.startsWith("on")&&!e.name.includes("-"))&&e.removeAttribute("pp-event-owner"),e instanceof HTMLTextAreaElement&&t instanceof HTMLTextAreaElement&&!s.__ppHasUncontrolledDefaultValue){let r=t.getAttribute("value"),n=r??t.value,i=r??t.defaultValue;e.value!==n&&(e.value=n),e.defaultValue!==i&&(e.defaultValue=i)}}trackCheckedControlMode(e,t){let r=e,n=r.__ppCheckedControlMode;if(n){if(n!==t){if(!r.__ppWarnedCheckedControlModeSwitch){r.__ppWarnedCheckedControlModeSwitch=!0;let i=e.id?`#${e.id}`:"",s=e.getAttribute("name"),a=!i&&s?`[name="${s}"]`:"";console.warn(`[PP-WARN] input${i}${a} changed from ${n} to ${t}. Choose either a controlled checked binding or an uncontrolled defaultChecked for the lifetime of the element.`)}r.__ppCheckedControlMode=t}}else r.__ppCheckedControlMode=t}},An=Symbol.for("pp.context"),jn=null;function Mn(e){if(!e||"object"!=typeof e||!("value"in e))throw Error("Context.Provider expects an object like { value, children? }.");return e}function Nn(e,t){let r=jn;jn=e;try{return t()}finally{jn=r}}function Pn(e){let t={$$typeof:An,defaultValue:e,Provider:e=>{let r=Mn(e),n=jn;if(!n)throw Error("Context.Provider() can only be used while a component is rendering.");return n(t,r.value),r.children??null}};return t}var Fn=["script","domDiff","bindEvents","bindRefs","bootstrapNested","portals","restoreFocus","layoutEffects","effects","total"];function In(){return typeof performance<"u"&&"function"==typeof performance.now?performance.now():Date.now()}var Ln=class t{static MAX_SYNC_RERENDERS=25;el;id;rawTemplate;renderFunction;templateFn=null;hooksSystem;eventManager;latestScope={};__ppRefStore=new Map;__ppRefSeq=0;__ppRefCaptureIdsByElement=new WeakMap;__ppRefExprsByElement=new WeakMap;refBindingManager;__ppInputValueStore=new Map;__ppInputValueSeq=0;__ppSelectValueStore=new Map;__ppSelectValueSeq=0;__ppCheckedValueStore=new Map;__ppCheckedValueSeq=0;__ppContextTokenStore=new Map;__ppContextTokenSeq=0;__ppContextValueStore=new Map;__ppContextValueSeq=0;__ppDefaultValueStore=new Map;__ppDefaultValueSeq=0;__ppDefaultCheckedStore=new Map;__ppDefaultCheckedSeq=0;__ppLoopValueStore=new Map;__ppLoopValueSeq=0;formControlManager=new vn;passiveEffectsVersion=0;isRendering=!1;props={};ownedChildren=new Map;lastRenderedHtml="";renderCount=0;portalManager;parentId=null;initialChildrenHtml="";pendingEventElements=new Set;traversalManager;contextManager;focusManager;domMorpher;ownedTemplateManager;propBindingManager;nestedBoundaryManager;attributeSyncManager;_lastRawScopeKeySig="";_lastSortedKeys=[];_lastSortedScopeKeySig="";_cachedHooksAPI=null;_cachedRuntimeAPI=null;_propFnCache=new Map;_interpolationFnCache=new Map;_scopeEvalFnCache=new Map;_refEvalFnCache=new Map;hadNestedRuntimeStructures=!1;static perfEnabled=!1;static perfStats=new Map;constructor(r){this.el=r,this.id=this.el.getAttribute("pp-component")||"",this.id||(this.id="anon_"+Math.random().toString(36).substring(2,9),this.el.setAttribute("pp-component",this.id)),e.registerInstance(this.id,this),this.ownedTemplateManager=new Cn(this.id),this.propBindingManager=new wn(this.id,this._interpolationFnCache,this._scopeEvalFnCache,this._propFnCache,(e,t,r,n,i)=>this.getCachedFunction(e,t,r,n,i)),this.refBindingManager=new gn(this.id),this.portalManager=new _n(this.id),this.attributeSyncManager=new kn(this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.traversalManager=new Tn(()=>this.el,()=>this.portalManager.elements(),this.__ppRefCaptureIdsByElement,this.__ppRefExprsByElement),this.contextManager=new yn(this.id,()=>this.parentId,()=>e.getInstance(this.id)===this,()=>this.isRendering,()=>this.forceUpdate()),this.nestedBoundaryManager=new En({componentId:this.id,getRoot:()=>this.el,getPortalElements:()=>this.portalManager.elements(),getLatestScope:()=>this.latestScope,getContextTokenStore:()=>this.__ppContextTokenStore,getContextValueStore:()=>this.__ppContextValueStore,contextManager:this.contextManager,isEffectManagedSurfaceElement:e=>this.isEffectManagedSurfaceElement(e),shouldSkipEffectManagedAttr:e=>this.attributeSyncManager.isEffectManagedAttr(e),syncAttributes:(e,t,r,n)=>this.syncAttributes(e,t,r,n),applyAttributeInterpolations:(e,t)=>this.applyAttributeInterpolations(e,t),materializeFormDefaults:e=>this.materializeNestedBoundaryFormDefaults(e),createComponent:e=>{new t(e)},refreshContextConsumers:e=>this.refreshContextConsumers(e)}),this.focusManager=new xn(()=>this.el,e=>this.portalManager.contains(e),()=>this.collectManagedInputs(),e=>this.formControlManager.isDateLikeInput(e)),this.domMorpher=new Sn({root:this.el,collectEventElements:e=>this.collectEventElements(e),hasEventAttributes:e=>this.hasEventAttributes(e),isInsideTrackedPortal:e=>this.isInsideTrackedPortal(e),syncAttributes:(e,t,r,n)=>this.syncAttributes(e,t,r,n),syncNestedBoundaryAttributes:(e,t)=>this.nestedBoundaryManager.syncNestedBoundaryAttributes(e,t)}),this.syncParentId(),this.props=this.computePropsFromAttributes(),this.ownedChildren=this.ownedTemplateManager.extractOwnedTemplates(this.el);let n=this.el.innerHTML;e.removeTemplate(this.id),e.removeOwnedTemplates(this.id),e.saveTemplate(this.id,n),e.saveOwnedTemplates(this.id,this.ownedChildren),this.initialChildrenHtml=n,this.props.children=this.initialChildrenHtml,this.hooksSystem=new ue(()=>{this.isRendering||this.render()},this.id);let i=e.getState(this.id);i&&this.hooksSystem.loadState(i);let s=se(this.initialChildrenHtml,this.el.tagName.toLowerCase()),a=this.findOwnScript(s.root),o=a?.textContent||"";a&&a.remove(),this.rawTemplate=s.toHtml(),this.renderFunction=this.createRenderFunction(o),this.eventManager=new le(this.el,()=>this.latestScope,e=>this.traversalManager.isManagedEventElement(e)),this.render()}syncParentId(){let t=this.el.__ppRuntimeParentId,r=this.el.parentElement?.closest("[pp-component]");this.parentId=void 0===t?r?r.getAttribute("pp-component"):null:t,e.saveParent(this.id,this.parentId)}static setPerfEnabled(e){this.perfEnabled=e}static getPerfEnabled(){return this.perfEnabled}static resetPerfStats(){this.perfStats.clear()}static getPerfStats(){return Object.fromEntries(this.perfStats.entries())}static createEmptyPerfEntry(){let e={};return Fn.forEach(t=>{e[t]={count:0,totalMs:0,maxMs:0}}),{renderCount:0,phases:e}}recordPerfPhase(e,r){if(!t.perfEnabled)return;let n=t.perfStats.get(this.id);n||(n=t.createEmptyPerfEntry(),t.perfStats.set(this.id,n));let i=n.phases[e];i.count++,i.totalMs+=r,i.maxMs=Math.max(i.maxMs,r)}startPerfTimer(){return t.perfEnabled?In():0}endPerfTimer(e,r){t.perfEnabled&&this.recordPerfPhase(e,In()-r)}findOwnScript(e){let t=Array.from(e.children);for(let e of t){if("script"===e.tagName.toLowerCase()&&(!e.hasAttribute("type")||"text/pp"===e.getAttribute("type")))return e;if(e.hasAttribute("pp-component"))continue;let t=this.findOwnScript(e);if(t)return t}return null}applyAttributeInterpolations(e,t){this.propBindingManager.applyAttributeInterpolations(e,t)}computePropsFromAttributes(){return this.propBindingManager.computePropsFromAttributes(this.el,this.parentId)}refreshPropsFromParent(e=!1){let t=this.computePropsFromAttributes();t.children=this.initialChildrenHtml,e||!ce(this.props,t)||0!==this.ownedChildren.size?(this.props=t,this.isRendering||this.render()):this.bootstrapNestedComponents()}refreshOwnedChildrenFromElement(t){if(0===this.ownedChildren.size)return!1;let r=t.cloneNode(!0),n=this.ownedTemplateManager.extractOwnedTemplates(r);if(0===n.size)return!1;let i=!1;return n.forEach((e,t)=>{let r=this.ownedChildren.get(t);(!r||r.content!==e.content||r.ownerId!==e.ownerId)&&(i=!0)}),!!i&&(this.ownedChildren=n,e.saveOwnedTemplates(this.id,n),this.forceUpdate(),!0)}getCachedFunction(e,t,r,n,i){let s=t+"|"+n,a=e.get(s);if(!a){if(a=Function(...r,`"use strict"; return (${t});`),e.size>=i){let t=e.keys().next().value;void 0!==t&&e.delete(t)}e.set(s,a)}return a}createRenderFunction(e){let t=$.extractStateBindings(e);return Function("pp",`\n "use strict";\n ${e}\n return { ${t.join(", ")} };\n `)}resolveCapturedRefValue(t,r){if(this.__ppRefStore.has(t))return this.__ppRefStore.get(t);if(!r||r===this.id)return;let n=e.getInstance(r);return n&&n.__ppRefStore.has(t)?n.__ppRefStore.get(t):void 0}resolvePlainRefValue(e,t,r,n){let i=this.latestScope[e];if("function"==typeof i||i&&"object"==typeof i&&"current"in i)return i;try{return this.getCachedFunction(this._refEvalFnCache,e,t,n,200)(...r)}catch{return}}__ppRefCaptureFn=e=>{let t=`ppref_${this.id}_${++this.__ppRefSeq}`;return this.__ppRefStore.set(t,e),t};__ppSelectValueCaptureFn=e=>{let t=`ppselect_${this.id}_${++this.__ppSelectValueSeq}`;return this.__ppSelectValueStore.set(t,e),t};__ppCheckedValueCaptureFn=e=>{let t=`ppchecked_${this.id}_${++this.__ppCheckedValueSeq}`;return this.__ppCheckedValueStore.set(t,e),t};__ppInputValueCaptureFn=e=>{let t=`ppinput_${this.id}_${++this.__ppInputValueSeq}`;return this.__ppInputValueStore.set(t,e),t};__ppContextTokenCaptureFn=e=>{let t=`ppcontexttoken_${this.id}_${++this.__ppContextTokenSeq}`;return this.__ppContextTokenStore.set(t,e),t};__ppContextValueCaptureFn=e=>{let t=`ppcontextvalue_${this.id}_${++this.__ppContextValueSeq}`;return this.__ppContextValueStore.set(t,e),t};createRefCaptureFunction(){return this.__ppRefStore.clear(),this.__ppRefSeq=0,this.__ppRefCaptureFn}createSelectValueCaptureFunction(){return this.__ppSelectValueStore.clear(),this.__ppSelectValueSeq=0,this.__ppSelectValueCaptureFn}createCheckedValueCaptureFunction(){return this.__ppCheckedValueStore.clear(),this.__ppCheckedValueSeq=0,this.__ppCheckedValueCaptureFn}createInputValueCaptureFunction(){return this.__ppInputValueStore.clear(),this.__ppInputValueSeq=0,this.__ppInputValueCaptureFn}createContextTokenCaptureFunction(){return this.__ppContextTokenStore.clear(),this.__ppContextTokenSeq=0,this.__ppContextTokenCaptureFn}createContextValueCaptureFunction(){return this.__ppContextValueStore.clear(),this.__ppContextValueSeq=0,this.__ppContextValueCaptureFn}__ppContextLookupFn=null;createContextLookupFunction(){if(this.__ppContextLookupFn)return this.__ppContextLookupFn;let e=(e,t)=>{if(null==e)return;if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let r=Object.keys(Object(e)).find(e=>e.toLowerCase()===t.toLowerCase());return r?e[r]:void 0};return this.__ppContextLookupFn=t=>{let r=String(t).split(".").map(e=>e.trim()).filter(Boolean);if(0===r.length)return;let n,[i,...s]=r;"globalthis"===i.toLowerCase()?n=globalThis:"window"===i.toLowerCase()?n=typeof window<"u"?window:globalThis:(n=e(this.latestScope,i),void 0===n&&(n=e(globalThis,i)));for(let t of s)n=e(n,t);return n},this.__ppContextLookupFn}__ppDefaultValueCaptureFn=e=>{let t=`ppdefaultvalue_${this.id}_${++this.__ppDefaultValueSeq}`;return this.__ppDefaultValueStore.set(t,e),t};__ppDefaultCheckedCaptureFn=e=>{let t=`ppdefaultchecked_${this.id}_${++this.__ppDefaultCheckedSeq}`;return this.__ppDefaultCheckedStore.set(t,e),t};createDefaultValueCaptureFunction(){return this.__ppDefaultValueStore.clear(),this.__ppDefaultValueSeq=0,this.__ppDefaultValueCaptureFn}createDefaultCheckedCaptureFunction(){return this.__ppDefaultCheckedStore.clear(),this.__ppDefaultCheckedSeq=0,this.__ppDefaultCheckedCaptureFn}__ppLoopCaptureFn=e=>{let t="ppv_"+ ++this.__ppLoopValueSeq;return this.__ppLoopValueStore.set(t,e),t};__ppLoopReadFn=e=>this.__ppLoopValueStore.get(e);createLoopCaptureFunction(){return this.__ppLoopValueStore.clear(),this.__ppLoopValueSeq=0,this.__ppLoopCaptureFn}consumeContext(e){return this.contextManager.consume(e)}registerProvidedContext(e,t){this.contextManager.provide(e,t)}requestContextRefresh(){this.contextManager.requestRefresh()}refreshContextConsumers(e){this.contextManager.refreshConsumers(e)}makeHooksAPI(){return this._cachedHooksAPI?this._cachedHooksAPI.props=this.props:this._cachedHooksAPI={state:e=>this.hooksSystem.useState(e),effect:(e,t)=>this.hooksSystem.useEffect(e,t),layoutEffect:(e,t)=>this.hooksSystem.useLayoutEffect(e,t),ref:(e=null)=>this.hooksSystem.useRef(e),memo:(e,t)=>this.hooksSystem.useMemo(e,t),callback:(e,t)=>this.hooksSystem.useCallback(e,t),reducer:(e,t,r)=>r?this.hooksSystem.useReducer(e,t,r):this.hooksSystem.useReducer(e,t),context:e=>this.consumeContext(e),portal:(e,t)=>this.hooksSystem.usePortal(e,t),props:this.props},this._cachedHooksAPI}makeRuntimeAPI(e){if(!this._cachedRuntimeAPI){let t=globalThis.pp;return this._cachedRuntimeAPI=t?.createComponentRuntime?.(e)??e,this._cachedRuntimeAPI}return this._cachedRuntimeAPI.props=e.props,this._cachedRuntimeAPI}syncTrackedPortals(e){if(0===this.portalManager.size)return;let t=this.hooksSystem.getPortalRegistrations();if(0===t.length)return;let r=new Map,n=new Map;e.querySelectorAll("*").forEach(e=>{let t=e,i=t.getAttribute("data-pp-ref");if(i){let e=r.get(i);e?e.push(t):r.set(i,[t])}let s=t.getAttribute("pp-ref");if(s){let e=n.get(s);e?e.push(t):n.set(s,[t])}});let i=new Map;for(let[e,t]of this.__ppRefStore.entries()){if(!t||"object"!=typeof t||!("current"in t))continue;let r=t,n=i.get(r);n?n.push(e):i.set(r,[e])}let s=new Map;for(let[e,t]of Object.entries(this.latestScope)){if(!t||"object"!=typeof t||!("current"in t))continue;let r=t,n=s.get(r);n?n.push(e):s.set(r,[e])}let a=(e,t)=>{for(let r of t){let t=e.get(r);if(!t||0===t.length)continue;let n=t.shift()??null;if(0===t.length&&e.delete(r),n)return n}return null},o=[];for(let e of t){let t=e.ref.current;if(!t||!this.portalManager.has(t))continue;let l=a(r,i.get(e.ref)??[]);l||=a(n,s.get(e.ref)??[]),l&&o.push({liveElement:t,sourceElement:l,placeholderText:this.portalManager.getPlaceholderText(t)})}0!==o.length&&(o.forEach(({sourceElement:e,placeholderText:t})=>{e.replaceWith(document.createComment(t))}),o.forEach(({liveElement:e,sourceElement:t})=>{this.morphTrackedPortalRoot(e,t)}))}morphTrackedPortalRoot(e,t){if(e.tagName!==t.tagName){let r=e.parentNode;if(!r)return;let n=t.cloneNode(!0);return r.replaceChild(n,e),this.collectEventElements(n),void this.portalManager.replaceElement(e,n)}this.syncAttributes(e,t,!0),this.hasEventAttributes(e)&&this.pendingEventElements.add(e),this.domMorpher.morphChildren(e,t)}applyPortals(){let e=this.hooksSystem.getPortalRegistrations();this.portalManager.apply(e)&&this.invalidateTraversalCache()}render(r=0){if(r>t.MAX_SYNC_RERENDERS)return void console.warn(`[PP-WARN] Synchronous rerender limit exceeded for component "${this.id}". Check for state updates during render or layout effects.`);if(this.isRendering)return;this.isRendering=!0,this.renderCount++;let n=this.startPerfTimer();if(t.perfEnabled){let e=t.perfStats.get(this.id);e||(e=t.createEmptyPerfEntry(),t.perfStats.set(this.id,e)),e.renderCount++}try{this.contextManager.prepareRender(),this.hooksSystem.prepareRender();let t=this.makeHooksAPI(),n=this.makeRuntimeAPI(t),i=this.startPerfTimer();this.hooksSystem.startRenderPhase();let s,a=!1;try{s=Nn((e,t)=>this.registerProvidedContext(e,t),()=>this.renderFunction(n))}finally{a=this.hooksSystem.finishRenderPhase()}if(this.endPerfTimer("script",i),a)return this.isRendering=!1,void this.render(r+1);e.saveState(this.id,this.hooksSystem.getHooks()),this.latestScope={...s},this.latestScope.__pp_ref=this.createRefCaptureFunction(),this.latestScope.__pp_input_value=this.createInputValueCaptureFunction(),this.latestScope.__pp_select_value=this.createSelectValueCaptureFunction(),this.latestScope.__pp_checked_value=this.createCheckedValueCaptureFunction(),this.latestScope.__pp_context_token=this.createContextTokenCaptureFunction(),this.latestScope.__pp_context_value=this.createContextValueCaptureFunction(),this.latestScope.__pp_context_lookup=this.createContextLookupFunction(),this.latestScope.__pp_default_value=this.createDefaultValueCaptureFunction(),this.latestScope.__pp_default_checked=this.createDefaultCheckedCaptureFunction(),this.latestScope.__pp_loop_capture=this.createLoopCaptureFunction(),this.latestScope.__pp_loop_read=this.__ppLoopReadFn,e.saveScope(this.id,this.latestScope);let o,p,h=c(this.latestScope),u=h.keys,d=h.keySig;d===this._lastRawScopeKeySig?(o=this._lastSortedKeys,p=this._lastSortedScopeKeySig):(o=u.length>1?[...u].sort():u.slice(),p=o.join("\0"),this._lastRawScopeKeySig=d,this._lastSortedKeys=o,this._lastSortedScopeKeySig=p);let f=l(this.latestScope,o);this.templateFn||=hn.compile(this.rawTemplate,o);let m=this.templateFn(...f);m=this.ownedTemplateManager.resolveOwnedChildren(m,this.ownedChildren);let g=this.el instanceof HTMLInputElement||this.el instanceof HTMLTextAreaElement||this.el instanceof HTMLSelectElement||/<(?:input|textarea|select)\b/i.test(m),_=this.el.hasAttribute("pp-ref")||this.el.hasAttribute("data-pp-ref")||m.includes("pp-ref")||m.includes("data-pp-ref")||this.refBindingManager.hasActiveBindings(),v=this.hooksSystem.getPortalRegistrations(),y=m.includes("pp-component=")||m.includes("<pp-context-provider")||v.length>0,x=g?this.collectManagedInputs():[],E=this.focusManager.save(x),C=this.lastRenderedHtml!==m;if(C){let e=this.startPerfTimer();this.applyDomDiff(m),this.endPerfTimer("domDiff",e),this.lastRenderedHtml=m}if(this.hasEventAttributes(this.el)&&this.pendingEventElements.add(this.el),this.pendingEventElements.size>0){let e=this.pendingEventElements;this.pendingEventElements=new Set;let t=this.startPerfTimer();this.eventManager.bindEvents(e),this.endPerfTimer("bindEvents",t)}if(_){let e=this.startPerfTimer();this.bindRefs(o,f,p),this.endPerfTimer("bindRefs",e)}let S=C&&g?this.collectManagedInputs():x,b=this.contextManager.commitRenderContexts();if(y||this.hadNestedRuntimeStructures){let e=this.startPerfTimer();this.bootstrapNestedComponents(),this.endPerfTimer("bootstrapNested",e)}if(this.hadNestedRuntimeStructures=y,v.length>0||this.portalManager.size>0){let e=this.startPerfTimer();this.applyPortals(),this.endPerfTimer("portals",e)}this.bindControlledInputValues(S),this.bindUncontrolledInputDefaults(S),this.bindUncontrolledFormResets(S),this.bindControlledSelectValues(S),this.bindControlledCheckedValues(S);let A=this.startPerfTimer();this.focusManager.restore(E,S),this.endPerfTimer("restoreFocus",A);let k=this.startPerfTimer(),w=this.hooksSystem.runLayoutEffects();if(this.endPerfTimer("layoutEffects",k),w)return this.isRendering=!1,void this.render(r+1);this.schedulePassiveEffects(),b?.size&&this.refreshContextConsumers(b)}catch(e){console.error("[PP-ERROR] Render Cycle Failed",e)}finally{this.endPerfTimer("total",n),this.isRendering=!1}}schedulePassiveEffects(){let t=++this.passiveEffectsVersion;queueMicrotask(()=>{if(this.passiveEffectsVersion!==t||e.getInstance(this.id)!==this)return;let r=this.startPerfTimer();this.hooksSystem.runEffects(),this.endPerfTimer("effects",r)})}applyDomDiff(e){if(typeof SVGElement<"u"&&this.el instanceof SVGElement){let t=(new DOMParser).parseFromString(`<svg xmlns="http://www.w3.org/2000/svg">${e}</svg>`,"image/svg+xml").documentElement,r=document.createDocumentFragment();return Array.from(t.childNodes).forEach(e=>{r.appendChild(document.importNode(e,!0))}),this.domMorpher.morphChildren(this.el,r),void this.invalidateTraversalCache()}let{content:t,placeholders:r}=this.ownedTemplateManager.maskNestedOwnedTemplates(e,this.el.tagName.toLowerCase()),n=se(t,this.el.tagName.toLowerCase()).root;this.ownedTemplateManager.restoreMaskedOwnedTemplates(n,r),this.ownedTemplateManager.materializeTemplateComponentBoundaries(n),this.syncTrackedPortals(n),this.domMorpher.morphChildren(this.el,n),this.invalidateTraversalCache()}isInsideTrackedPortal(e){return this.portalManager.contains(e)}isEffectManagedSurfaceElement(e,t){return this.attributeSyncManager.isEffectManagedSurfaceElement(e,t)}collectEventElements(e){this.traversalManager.collectEventElements(e,this.pendingEventElements)}hasEventAttributes(e){return this.traversalManager.hasEventAttributes(e)}invalidateTraversalCache(){this.traversalManager.invalidate(),this.eventManager.invalidateElementCountCache()}getTraversalCache(){return this.traversalManager.getCache()}collectManagedInputs(){return this.traversalManager.collectManagedInputs()}syncAttributes(e,t,r=!1,n=!1){this.attributeSyncManager.syncAttributes(e,t,r,n)}bindRefs(e,t,r){let n=this.getTraversalCache(),i=new Map;for(let s=0;s<n.refElements.length;s++){let a=n.refElements[s],o=a,l=a!==this.el&&a.hasAttribute("pp-component"),c=a.getAttribute("data-pp-ref"),p=a.getAttribute("pp-ref-owner"),h=null;if(c)this.__ppRefStore.has(c)?(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,c),h=c):l||(a.removeAttribute("data-pp-ref"),this.__ppRefCaptureIdsByElement.set(a,c),h=c);else{let e=this.__ppRefCaptureIdsByElement.get(a);e&&this.__ppRefStore.has(e)?h=e:e&&this.__ppRefCaptureIdsByElement.delete(a)}if(h){let e=this.resolveCapturedRefValue(h,p);if("function"==typeof e||e&&"object"==typeof e&&"current"in e){let t=this.refBindingManager.ensureBindingId(o,"captured");i.set(t,{element:a,value:e})}else c&&h.startsWith(`ppref_${this.id}_`)&&console.warn(`[PP-WARN] Missing captured ref for id="${h}"`)}let u=a.getAttribute("pp-ref"),d=u;if(d=u||this.__ppRefExprsByElement.get(a)||null,!d)continue;let f=this.resolvePlainRefValue(d,e,t,r);if("function"==typeof f||f&&"object"==typeof f&&"current"in f){u&&a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d);let e=this.refBindingManager.ensureBindingId(o,"plain");i.set(e,{element:a,value:f});continue}u&&l||(u&&(a.removeAttribute("pp-ref"),this.__ppRefExprsByElement.set(a,d)),Object.prototype.hasOwnProperty.call(this.latestScope,d)||console.warn(`[PP-WARN] Could not resolve pp-ref="${d}"`))}this.refBindingManager.commit(i)}bindControlledSelectValues(e){this.formControlManager.bindControlledSelectValues(e,this.__ppSelectValueStore)}bindControlledCheckedValues(e){this.formControlManager.bindControlledCheckedValues(e,this.__ppCheckedValueStore)}bindControlledInputValues(e){this.formControlManager.bindControlledInputValues(e,this.__ppInputValueStore)}bindUncontrolledInputDefaults(e){for(let t=0;t<e.length;t++){let r=e[t];if(r.__ppManagedInputMounted)this.formControlManager.resolveDefaultValueBinding(r,this.__ppDefaultValueStore),r instanceof HTMLInputElement&&this.formControlManager.resolveDefaultCheckedBinding(r,this.__ppDefaultCheckedStore);else{let e=this.formControlManager.resolveDefaultValueBinding(r,this.__ppDefaultValueStore);if(void 0!==e&&this.formControlManager.applyUncontrolledDefaultValue(r,e),r instanceof HTMLInputElement){let e=this.formControlManager.resolveDefaultCheckedBinding(r,this.__ppDefaultCheckedStore);void 0!==e&&this.formControlManager.applyUncontrolledDefaultChecked(r,e)}}r.__ppManagedInputMounted=!0}}bindUncontrolledFormResets(e){this.formControlManager.syncUncontrolledFormResets(this.id,e,()=>this.collectManagedInputs())}bootstrapNestedComponents(){this.nestedBoundaryManager.bootstrap()}materializeNestedBoundaryFormDefaults(e){this.formControlManager.materializeNestedBoundaryFormDefaults(e,{inputValueStore:this.__ppInputValueStore,checkedValueStore:this.__ppCheckedValueStore,defaultValueStore:this.__ppDefaultValueStore,defaultCheckedStore:this.__ppDefaultCheckedStore})}forceUpdate(){this.lastRenderedHtml="",this.render()}destroyNestedComponents(){let t=e.getDescendantIds(this.id),r=new Set;t.forEach(t=>{if(r.has(t))return;r.add(t);let n=e.getInstance(t);n&&n!==this&&n.destroy?.()})}destroy(){this.destroyNestedComponents(),this.formControlManager.clearResetHandlers(this.id),this.hooksSystem.dispose(),this.refBindingManager.clearAll(),this.portalManager.destroyAll();let r=this.contextManager.destroy();this.eventManager.clearCache(),e.removeState(this.id),e.removeScope(this.id),e.removeTemplate(this.id),e.removeOwnedTemplates(this.id),e.removeInstance(this.id),t.perfStats.delete(this.id),this.contextManager.refreshConsumers(r)}},Rn="opacity 0.18s ease-out",zn=15e3,Bn={bootstrap:()=>{Cn.materializeTemplateComponentBoundaries(document.body),Array.from(document.querySelectorAll("[pp-component]")).filter(e=>!e.parentElement?.closest("[pp-component]")).forEach(e=>{new Ln(e)})}},Vn=class t{static instance=null;activeAbortController=null;navigationEnabled=!1;boundHandleLinkClick=null;boundHandlePopState=null;boundHandleTrackedScroll=null;isNavigating=!1;pendingHistoryStateSaveTimer=null;lastHistoryStateSaveAt=0;pendingProgrammaticScrollPersistenceTimer=null;RESET_SCROLL_ATTR="pp-reset-scroll";HISTORY_SCROLL_STATE_KEY="__ppScrollPositions";TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS=150;PROGRAMMATIC_SCROLL_SETTLE_MS=120;mounted=!1;suppressTrackedScrollPersistence=!1;transitionLockCount=0;pendingRevealFrame=null;pendingTransitionUnlockFrame=null;hydrationBodySnapshot=null;previousHistoryScrollRestoration=null;trackedScrollElements=new Set;didInitialScrollDiscovery=!1;SCROLL_KEY_ATTR="pp-scroll-key";static PUBLIC_METHODS=["createContext","mount","redirect","rpc","enablePerf","disablePerf","getPerfStats","resetPerfStats"];constructor(){}mount(){this.mounted||(this.mounted=!0,this.warnAboutOrphanPulsePointScripts(),this.disableTransitions(),this.hideBodyForHydration(!0),Bn.bootstrap(),this.scheduleHydrationReveal(),this.enableSPANavigation())}createComponentRuntime(e){let r={};for(let e of t.PUBLIC_METHODS){let t=this[e];"function"==typeof t?r[e]=t.bind(this):void 0!==t&&(r[e]=t)}return Object.assign({},r,e)}warnAboutOrphanPulsePointScripts(){let e=Array.from(document.querySelectorAll('script[type="text/pp"]')).filter(e=>!e.closest("[pp-component]"));0!==e.length&&console.warn(`[PP-WARN] Found ${e.length} PulsePoint script${1===e.length?"":"s"} outside a pp-component root. Keep component scripts inside the single component root so they can participate in render scope.`)}createContext(e){return Pn(e)}enablePerf(){Ln.setPerfEnabled(!0)}disablePerf(){Ln.setPerfEnabled(!1)}getPerfStats(){return Ln.getPerfStats()}resetPerfStats(){Ln.resetPerfStats()}getCsrfToken(){let e=window.location.port?[`pp_csrf_${window.location.port}`,"pp_csrf"]:["pp_csrf"];for(let t of e){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),r=document.cookie.match(RegExp(`(?:^|;\\s*)${e}=([^;]*)`));if(r)return decodeURIComponent(r[1])}return""}resolveRpcUrl(e){let t=window.location.pathname.replace(/\/+$/,"")||"/";return new URL(e??t,window.location.origin)}resolveRpcCredentials(e,t){return t||(e.origin===window.location.origin?"same-origin":"include")}async ensureCsrfToken(e,t,r){let n=this.getCsrfToken();if(""!==n||"omit"===t)return n;let i=new URL(r??e.toString(),window.location.origin);return await fetch(i.toString(),{method:"GET",credentials:t,cache:"no-store",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/html, application/json, */*"}}),n=this.getCsrfToken(),n}disableTransitions(){if(this.transitionLockCount+=1,document.getElementById("pp-disable-transitions"))return;let e=document.createElement("style");e.id="pp-disable-transitions",e.textContent="\n *, *::before, *::after {\n transition: none !important;\n animation: none !important;\n }\n ",document.head.insertBefore(e,document.head.firstChild)}enableTransitions(e=!1){if(e?this.transitionLockCount=0:this.transitionLockCount>0&&--this.transitionLockCount,this.transitionLockCount>0)return;let t=document.getElementById("pp-disable-transitions");t&&t.remove()}requestFrame(e){return"function"==typeof requestAnimationFrame?requestAnimationFrame(e):window.setTimeout(()=>e(performance.now()),16)}cancelFrame(e){"function"!=typeof cancelAnimationFrame?window.clearTimeout(e):cancelAnimationFrame(e)}cancelScheduledHydrationReveal(){null!==this.pendingRevealFrame&&(this.cancelFrame(this.pendingRevealFrame),this.pendingRevealFrame=null),null!==this.pendingTransitionUnlockFrame&&(this.cancelFrame(this.pendingTransitionUnlockFrame),this.pendingTransitionUnlockFrame=null)}cancelPendingProgrammaticScrollPersistence(){null!==this.pendingProgrammaticScrollPersistenceTimer&&(window.clearTimeout(this.pendingProgrammaticScrollPersistenceTimer),this.pendingProgrammaticScrollPersistenceTimer=null)}beginProgrammaticScrollPersistencePause(){this.suppressTrackedScrollPersistence=!0,this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence()}scheduleProgrammaticScrollPersistence(){this.suppressTrackedScrollPersistence&&(this.cancelPendingProgrammaticScrollPersistence(),this.pendingProgrammaticScrollPersistenceTimer=window.setTimeout(()=>{this.pendingProgrammaticScrollPersistenceTimer=null,this.suppressTrackedScrollPersistence=!1,this.persistCurrentHistoryScrollState()},this.PROGRAMMATIC_SCROLL_SETTLE_MS))}scrollElementIntoView(e){this.beginProgrammaticScrollPersistencePause(),e.scrollIntoView({behavior:"smooth"}),this.scheduleProgrammaticScrollPersistence()}normalizeHydrationBodySnapshotStyle(e){if(null===e)return null;let t=document.createElement("div");t.setAttribute("style",e),"0"===t.style.opacity&&t.style.removeProperty("opacity"),"none"===t.style.pointerEvents&&t.style.removeProperty("pointer-events"),"none"===t.style.userSelect&&t.style.removeProperty("user-select"),t.style.transition.replace(/\s+/g," ").trim().toLowerCase()===Rn&&t.style.removeProperty("transition");let r=t.getAttribute("style")?.trim()??"";return""===r?null:r}hideBodyForHydration(e=!1){if(!this.hydrationBodySnapshot){let t=document.body.getAttribute("style");this.hydrationBodySnapshot={style:e?this.normalizeHydrationBodySnapshotStyle(t):t,hadAriaBusy:document.body.hasAttribute("aria-busy"),ariaBusy:document.body.getAttribute("aria-busy"),hadInert:document.body.hasAttribute("inert"),inert:document.body.getAttribute("inert")}}document.body.style.opacity="0",document.body.style.pointerEvents="none",document.body.style.userSelect="none",document.body.setAttribute("aria-busy","true"),document.body.setAttribute("inert","")}scheduleHydrationReveal(e){this.cancelScheduledHydrationReveal(),this.pendingRevealFrame=this.requestFrame(()=>{this.pendingRevealFrame=null,this.restoreBodyAccessibility(),e?.(),this.pendingTransitionUnlockFrame=this.requestFrame(()=>{this.pendingTransitionUnlockFrame=null,this.enableTransitions(!0)})})}restoreBodyAccessibility(){let e=this.hydrationBodySnapshot;if(!e)return document.body.style.removeProperty("transition"),document.body.style.removeProperty("opacity"),document.body.style.removeProperty("pointer-events"),document.body.style.removeProperty("user-select"),document.body.removeAttribute("inert"),void document.body.removeAttribute("aria-busy");null===e.style?document.body.removeAttribute("style"):document.body.setAttribute("style",e.style),e.hadInert?document.body.setAttribute("inert",e.inert??""):document.body.removeAttribute("inert"),e.hadAriaBusy?document.body.setAttribute("aria-busy",e.ariaBusy??""):document.body.removeAttribute("aria-busy"),this.hydrationBodySnapshot=null}static resetInstance(){this.instance&&=(this.instance.navigationEnabled&&this.instance.disableSPANavigation(),this.instance.cancelScheduledHydrationReveal(),this.instance.restoreBodyAccessibility(),this.instance.enableTransitions(!0),this.instance.mounted=!1,this.instance.activeAbortController&&(this.instance.activeAbortController.abort(),this.instance.activeAbortController=null),null)}static getInstance(){return this.instance||=new t,this.instance}enableSPANavigation(){this.navigationEnabled||(this.navigationEnabled=!0,this.boundHandleLinkClick=this.handleLinkClick.bind(this),this.boundHandlePopState=this.handlePopState.bind(this),this.boundHandleTrackedScroll=this.handleTrackedScroll.bind(this),"scrollRestoration"in history&&(this.previousHistoryScrollRestoration=history.scrollRestoration,history.scrollRestoration="manual"),document.addEventListener("click",this.boundHandleLinkClick),window.addEventListener("popstate",this.boundHandlePopState),document.addEventListener("scroll",this.boundHandleTrackedScroll,!0),window.addEventListener("scroll",this.boundHandleTrackedScroll,{passive:!0}),this.registerInitiallyScrolledElements(),this.persistCurrentHistoryScrollState())}disableSPANavigation(){this.navigationEnabled=!1,this.suppressTrackedScrollPersistence=!1,this.boundHandleLinkClick&&=(document.removeEventListener("click",this.boundHandleLinkClick),null),this.boundHandlePopState&&=(window.removeEventListener("popstate",this.boundHandlePopState),null),this.boundHandleTrackedScroll&&=(document.removeEventListener("scroll",this.boundHandleTrackedScroll,!0),window.removeEventListener("scroll",this.boundHandleTrackedScroll),null),this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),this.trackedScrollElements.clear(),this.didInitialScrollDiscovery=!1,null!==this.previousHistoryScrollRestoration&&"scrollRestoration"in history&&(history.scrollRestoration=this.previousHistoryScrollRestoration,this.previousHistoryScrollRestoration=null)}handleLinkClick(e){if(!this.navigationEnabled)return;let t=this.getNavigationTarget(e.target);if(!t)return;let r=t.closest("a");if(r&&r.href)try{let t=new URL(r.href),n=t.origin!==window.location.origin,i=t.pathname===window.location.pathname&&t.search===window.location.search,s="false"===r.getAttribute("pp-spa");if(n||"_blank"===r.target||r.hasAttribute("download")||s||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;if(e.preventDefault(),i){let r=t.hash;if(r){e.preventDefault(),this.persistCurrentHistoryScrollState(),history.pushState(this.buildHistoryState(),"",t.pathname+t.search+r);let n=document.querySelector(r);return void(n&&this.scrollElementIntoView(n))}}this.navigateTo(t.pathname+t.search+t.hash)}catch(e){console.error("Link click navigation error:",e)}}getNavigationTarget(e){return e instanceof Element?e:e instanceof Node?e.parentElement:null}handleTrackedScroll(e){if(!this.navigationEnabled||this.isNavigating)return;if(e.target instanceof HTMLElement&&this.trackedScrollElements.add(e.target),this.suppressTrackedScrollPersistence)return void this.scheduleProgrammaticScrollPersistence();let t=Date.now()-this.lastHistoryStateSaveAt;if(t>=this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS)return this.cancelPendingHistoryStateSave(),void this.persistCurrentHistoryScrollState();null===this.pendingHistoryStateSaveTimer&&(this.pendingHistoryStateSaveTimer=window.setTimeout(()=>{this.pendingHistoryStateSaveTimer=null,this.persistCurrentHistoryScrollState()},this.TRACKED_SCROLL_PERSISTENCE_INTERVAL_MS-t))}async handlePopState(e){let t=this.getCurrentUrl(),r=this.getScrollPositionsFromHistoryState(e.state);await this.navigateTo(t,!1,r)}async navigateTo(e,t=!0,r=null){this.cancelPendingHistoryStateSave(),this.cancelPendingProgrammaticScrollPersistence(),this.suppressTrackedScrollPersistence=!1,this.isNavigating=!0;try{this.dispatchNavigationEvent("start",e),await this.showLoadingTransition();let n=await this.fetchPageContent(e);if("hardReload"in n)return void(window.location.href=n.hardReload);if("redirect"in n)return void await this.navigateTo(n.redirect,t,r);let i=n,s=t?this.saveScrollPositions():null;this.updateBrowserHistory(e,t,s),this.disableTransitions(),this.hideBodyForHydration();let a=document.getElementById("loading-file-1B87E"),o="startViewTransition"in document,l=this.getResetScrollConfig(i);!a&&o?await this.updatePageContentWithViewTransition(i):await this.updatePageContent(i),this.resetGlobalCaches(),Bn.bootstrap(),this.handleScrollRestoration(t?s:r,l,t?"push":"history"),await this.handleNavigationCompletion(),this.dispatchNavigationEvent("complete",e)}catch(t){this.handleNavigationError(e,t)}finally{this.isNavigating=!1}}resetGlobalCaches(){e.clear(),$.clearCaches(),hn.clearCache()}getResetScrollConfig(e){if("true"===e.body.getAttribute(this.RESET_SCROLL_ATTR))return{mode:"global",resetElementKeys:new Set,resetWindow:!1};let t=e.querySelectorAll(`[${this.RESET_SCROLL_ATTR}]`),r=new Set,n=!1;if(t.length>0)for(let e of Array.from(t))if("true"===e.getAttribute(this.RESET_SCROLL_ATTR)){let t=this.getElementKeyFromElement(e);r.add(t),n=!0}return n||r.size>0?{mode:"none",resetElementKeys:r,resetWindow:n}:{mode:"none",resetElementKeys:new Set,resetWindow:!1}}getElementKeyFromElement(e){return e.getAttribute(this.SCROLL_KEY_ATTR)||(e.id?e.id:e.className?e.className:e.tagName)}handleScrollRestoration(e,t,r){requestAnimationFrame(()=>{if("global"===t.mode)return window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0,void this.getTrackedScrollElements().forEach(e=>{(e.scrollTop||e.scrollLeft)&&(e.scrollTop=0,e.scrollLeft=0)});if("history"!==r||t.resetWindow||!e?.window)window.scrollTo(0,0),document.documentElement.scrollTop=0,document.documentElement.scrollLeft=0;else{let t=e?.window;t&&window.scrollTo(t.scrollLeft,t.scrollTop)}new Set([...Object.keys(e??{}).filter(e=>"window"!==e),...t.resetElementKeys]).forEach(n=>{let i=this.findScrollElementByKey(n);if(!i)return;this.trackedScrollElements.add(i);let s="history"===r||"push"===r&&!t.resetElementKeys.has(n)?e?.[n]:null;t.resetElementKeys.has(n)?(i.scrollTop=0,i.scrollLeft=0):s&&(i.scrollTop=s.scrollTop,i.scrollLeft=s.scrollLeft)})})}saveScrollPositions(){let e={window:{scrollTop:window.scrollY||document.documentElement.scrollTop,scrollLeft:window.scrollX||document.documentElement.scrollLeft}};return this.didInitialScrollDiscovery||this.registerInitiallyScrolledElements(),this.getTrackedScrollElements().forEach(t=>{(t.scrollTop||t.scrollLeft)&&(e[this.getElementKey(t)]={scrollTop:t.scrollTop,scrollLeft:t.scrollLeft})}),e}getElementKey(e){return e.getAttribute(this.SCROLL_KEY_ATTR)||e.id||e.className||e.tagName}registerInitiallyScrolledElements(){this.didInitialScrollDiscovery=!0,document.querySelectorAll("*").forEach(e=>{(e.scrollTop||e.scrollLeft||e.hasAttribute(this.SCROLL_KEY_ATTR)||e.hasAttribute(this.RESET_SCROLL_ATTR))&&this.trackedScrollElements.add(e)})}getTrackedScrollElements(){let e=[];return this.trackedScrollElements.forEach(t=>{t.isConnected?e.push(t):this.trackedScrollElements.delete(t)}),document.querySelectorAll(`[${this.SCROLL_KEY_ATTR}], [${this.RESET_SCROLL_ATTR}]`).forEach(t=>{this.trackedScrollElements.has(t)||(this.trackedScrollElements.add(t),e.push(t))}),e}findScrollElementByKey(e){for(let t of this.getTrackedScrollElements())if(this.getElementKey(t)===e)return t;let t=document.getElementById(e);if(t)return t;let r=document.getElementsByClassName(e)[0];if(r instanceof HTMLElement)return r;let n=document.getElementsByTagName(e)[0];return n instanceof HTMLElement?n:null}cancelPendingHistoryStateSave(){null!==this.pendingHistoryStateSaveTimer&&(window.clearTimeout(this.pendingHistoryStateSaveTimer),this.pendingHistoryStateSaveTimer=null)}buildHistoryState(e){let t=history.state,r=t&&"object"==typeof t&&!Array.isArray(t)?{...t}:{};return e?r[this.HISTORY_SCROLL_STATE_KEY]=e:delete r[this.HISTORY_SCROLL_STATE_KEY],r}getScrollPositionsFromHistoryState(e){if(!e||"object"!=typeof e||Array.isArray(e))return null;let t=e[this.HISTORY_SCROLL_STATE_KEY];return!t||"object"!=typeof t||Array.isArray(t)?null:t}persistCurrentHistoryScrollState(e=this.saveScrollPositions()){this.lastHistoryStateSaveAt=Date.now(),history.replaceState(this.buildHistoryState(e),"",this.getCurrentUrl())}getCurrentUrl(){return window.location.pathname+window.location.search+window.location.hash}teardownCurrentPageComponents(){e.destroyAll()}async updatePageContentWithViewTransition(e){e.title&&(document.title=e.title);let t=e.body.innerHTML;if(this.syncBodyAttributes(e.body),this.teardownCurrentPageComponents(),this.isNavigating||!document.startViewTransition)return void(document.body.innerHTML=t);let r=document.startViewTransition(()=>{document.body.innerHTML=t});try{await r.finished}catch(e){console.warn("View transition failed, continuing anyway:",e)}}dispatchNavigationEvent(e,t,r){let n=`pp:navigation:${e}`,i=r?{url:t,error:r}:{url:t};document.dispatchEvent(new CustomEvent(n,{detail:i}))}async showLoadingTransition(){let e=document.getElementById("loading-file-1B87E");if(e){let t=this.findLoadingElement(e,window.location.pathname);if(t)return void await this.updateContentWithTransition(t)}let t=document.querySelector("[pp-loading-content='true']")||document.body;t&&!("startViewTransition"in document)&&await this.fadeOut(t,250)}async fetchPageContent(e){let t,r=new URL(e,window.location.origin).hash,n=new AbortController,i=window.setTimeout(()=>{n.abort()},zn);try{t=await fetch(e,{signal:n.signal,headers:{"X-Requested-With":"XMLHttpRequest","X-PP-Navigation":"true","X-PulsePoint-Wire":"true",Accept:"text/html"}})}catch(r){throw r instanceof Error&&"AbortError"===r.name?Error(`Navigation timed out after ${Math.round(zn/1e3)}s: ${e}`):r}finally{window.clearTimeout(i)}if(!t.ok)throw Error(`Navigation failed: ${t.status} ${t.statusText}`);let s=t.headers.get("X-PP-Root-Layout"),a=document.querySelector('meta[name="pp-root-layout"]'),o=a?a.getAttribute("content"):null;if(s&&o&&s!==o)return{hardReload:e};if(t.redirected){let n=this.normalizeServerRedirectTarget(t.url);if(!n)return{hardReload:e};let i=new URL(n,window.location.origin);if(r&&i.searchParams.has("next")){let e=i.searchParams.get("next");e&&!e.includes("#")&&i.searchParams.set("next",e+r)}return{redirect:i.pathname+i.search+i.hash}}let l=this.getRedirectUrlFromResponse(t);if(l)return{redirect:l};let c=await t.text();return(new DOMParser).parseFromString(c,"text/html")}normalizeServerRedirectTarget(e){if(!e)return null;try{let t=new URL(e,window.location.href);return t.origin===window.location.origin?t.pathname+t.search+t.hash:(console.warn("Ignoring cross-origin redirect target from server response:",e),null)}catch(t){return console.warn("Ignoring invalid redirect target from server response:",e,t),null}}getRedirectUrlFromResponse(e){let t=e.headers.get("X-PP-Redirect"),r=this.normalizeServerRedirectTarget(t);if(r)return r;let n=e.headers.get("Location"),i=e.status;return n&&i>=300&&i<400?this.normalizeServerRedirectTarget(n):null}updateBrowserHistory(e,t,r=null){t&&(this.persistCurrentHistoryScrollState(r??void 0),history.pushState(this.buildHistoryState(),"",e))}async updatePageContent(e){e.title&&(document.title=e.title);let t=e.body;this.syncBodyAttributes(t),this.teardownCurrentPageComponents(),document.body.innerHTML=t.innerHTML}syncBodyAttributes(e){e&&(Array.from(document.body.attributes).forEach(e=>{"style"!==e.name&&document.body.removeAttribute(e.name)}),Array.from(e.attributes).forEach(e=>{"style"!==e.name&&document.body.setAttribute(e.name,e.value)}))}async handleNavigationCompletion(){let e=document.querySelector("[pp-loading-content='true']")||document.body,t=window.location.hash;this.scheduleHydrationReveal(()=>{if(this.fadeIn(e,150),t){let e=document.querySelector(t);e&&this.scrollElementIntoView(e)}})}handleNavigationError(e,t){console.error("Navigation error:",t),this.restoreBodyAccessibility(),this.enableTransitions(!0),this.dispatchNavigationEvent("error",e,t),window.location.href=e}findLoadingElement(e,t){let r=t;for(;;){let t=e.querySelector(`div[pp-loading-url='${r}']`);if(t)return t;if("/"===r)break;let n=r.lastIndexOf("/");r=n<=0?"/":r.substring(0,n)}return e.querySelector("div[pp-loading-url='/' ]")}async updateContentWithTransition(e){let t=document.querySelector("[pp-loading-content='true']")||document.body;if(!t)return;let{fadeIn:r,fadeOut:n}=this.parseTransition(e);await this.fadeOut(t,n),t.innerHTML=e.innerHTML,this.fadeIn(t,r)}parseTransition(e){let t=250,r=250,n=e.querySelector("[pp-loading-transition]")?.getAttribute("pp-loading-transition");if(n){let e=JSON.parse(n);e&&"object"==typeof e?(t=this.parseTime(e.fadeIn??t),r=this.parseTime(e.fadeOut??r)):console.warn("pp-loading-transition is not valid JSON -> default values (250 ms) will be used. String:",n)}return{fadeIn:t,fadeOut:r}}fadeOut(e,t){return new Promise(r=>{e.style.transition=`opacity ${t}ms ease-out`,setTimeout(()=>{e.style.transition="",r()},t)})}fadeIn(e,t){e.style.transition=`opacity ${t}ms ease-in`,setTimeout(()=>{e.style.transition=""},t)}parseTime(e){if("number"==typeof e)return e;let t=e.match(/^(\d+)(ms|s|m)?$/);if(t){let e=parseInt(t[1],10);switch(t[2]||"ms"){case"ms":default:return e;case"s":return 1e3*e;case"m":return 60*e*1e3}}return 0}async redirect(e){if(e)try{let t=new URL(e,window.location.origin);t.origin===window.location.origin&&this.navigationEnabled?await this.navigateTo(t.pathname+t.search+t.hash):window.location.href=e}catch(e){console.error("Redirect error:",e)}}async rpc(e,t={},r=!1){let n=null,i="boolean"==typeof r?{abortPrevious:r}:r;try{i.abortPrevious&&this.activeAbortController&&(this.activeAbortController.abort(),this.activeAbortController=null),n=new AbortController,i.abortPrevious&&(this.activeAbortController=n);let r,s=this.resolveRpcUrl(i.url),a=this.resolveRpcCredentials(s,i.credentials),o={"X-CSRF-Token":await this.ensureCsrfToken(s,a,i.csrfUrl),"X-PP-RPC":"true","X-PulsePoint-Wire":"true","X-PP-Function":e,"X-Requested-With":"XMLHttpRequest",Accept:"application/json, text/event-stream"},l=Object.values(t).some(e=>e instanceof File||e instanceof FileList&&e.length>0);if(l){let e=new FormData;for(let[r,n]of Object.entries(t))n instanceof File?e.append(r,n):n instanceof FileList?Array.from(n).forEach(t=>e.append(r,t)):null!=n&&e.append(r,"object"==typeof n?JSON.stringify(n):String(n));if(i.onUploadProgress)return await this.xhrFunction({url:s.toString(),headers:o,body:e,controller:n,credentials:a,options:i});r={method:"POST",headers:o,body:e,credentials:a,signal:n.signal}}else r={method:"POST",headers:{...o,"Content-Type":"application/json"},body:JSON.stringify(t),credentials:a,signal:n.signal};let c=await fetch(s.toString(),r);if(401===c.status)throw Error("Authentication required");if(403===c.status)throw Error("Permission denied");if(!c.ok){let e=await c.json().catch(()=>null);throw e||415!==c.status?Error(e?.error||`Request failed: ${c.status} ${c.statusText}`):Error("Server rejected data format (415).")}let p=this.getRedirectUrlFromResponse(c);return p?(await this.redirect(p),{redirected:!0,to:p}):(this.activeAbortController===n&&(this.activeAbortController=null),(c.headers.get("Content-Type")||"").includes("text/event-stream")&&c.body?(i.onStream||console.warn("RPC returned a stream, but no onStream handler provided."),void await this.handleStream(c.body,i)):await c.json())}catch(e){if(this.activeAbortController===n&&(this.activeAbortController=null),e instanceof Error&&"AbortError"===e.name)return console.log("Request was cancelled"),{cancelled:!0};if(i.onStreamError)return void i.onStreamError(e);throw console.error("RPC error:",e),e}}xhrFunction(e){let{url:t,headers:r,body:n,controller:i,credentials:s,options:a}=e;return new Promise((e,o)=>{let l=new XMLHttpRequest;l.open("POST",t,!0),l.withCredentials="include"===s;for(let[e,t]of Object.entries(r))l.setRequestHeader(e,t);let c=()=>{try{l.abort()}catch{}};i.signal.addEventListener("abort",c,{once:!0}),l.upload&&a.onUploadProgress&&(l.upload.onprogress=e=>{let t=e.lengthComputable?e.total:null,r=e.lengthComputable&&e.total>0?Math.min(100,Math.max(0,e.loaded/e.total*100)):null;a.onUploadProgress?.({loaded:e.loaded,total:t,percent:r})}),l.onerror=()=>{i.signal.removeEventListener("abort",c),o(Error("Network error (XHR upload)."))},l.onload=async()=>{if(i.signal.removeEventListener("abort",c),401===l.status)return o(Error("Authentication required"));if(403===l.status)return o(Error("Permission denied"));if(l.status<200||l.status>=300){let e=`Request failed: ${l.status} ${l.statusText}`;try{let t=JSON.parse(l.responseText||"{}");e=t?.error||t?.message||e}catch{}return o(Error(e))}let t=this.normalizeServerRedirectTarget(l.getResponseHeader("X-PP-Redirect")||(l.status>=300&&l.status<400?l.getResponseHeader("Location"):null));if(t)try{return await this.redirect(t),a.onUploadComplete?.(),e({redirected:!0,to:t})}catch(e){return o(e)}let r=l.responseText??"",n=r;try{n=JSON.parse(r)}catch{}a.onUploadComplete?.(),e(n)};try{l.send(n)}catch(e){i.signal.removeEventListener("abort",c),o(e)}})}async handleStream(e,t){let r=e.getReader(),n=new TextDecoder,i="";try{for(;;){let{done:e,value:s}=await r.read();if(e){t.onStreamComplete&&t.onStreamComplete();break}i+=n.decode(s,{stream:!0});let a=i.split("\n");i=a.pop()||"";for(let e of a)if(""!==e.trim()&&e.startsWith("data: ")){let r=e.slice(6),n=r;try{("true"===r||"false"===r||"null"===r||!isNaN(Number(r))||r.startsWith("{")||r.startsWith("[")||r.startsWith('"'))&&(n=JSON.parse(r))}catch{}t.onStream&&t.onStream(n)}}}catch(e){if(!t.onStreamError)throw e;t.onStreamError(e)}finally{r.releaseLock()}}};function Hn(e,t,r=(typeof window<"u"?window:globalThis),n=!0){let i=null;if(Object.defineProperty(r,e,{get(){if(null!==i)return i;if(t&&"object"==typeof t&&!Array.isArray(t)&&"getInstance"in t&&"function"==typeof t.getInstance)return i=t.getInstance(),i;if("function"!=typeof t)return i=t,i;try{return i=t.getInstance(),i}catch{return i=t,i}},set(t){null===t?i=null:console.warn(`Cannot override global ${e}`)},configurable:!0,enumerable:!0}),n)try{r[e]}catch(t){console.error(`Failed to initialize ${e}:`,t)}}Hn("pp",{getInstance:()=>Vn.getInstance()});export{Bn as ComponentInit,Vn as PPUtilities};
|