objs-core 2.3.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/objs.built.min.js CHANGED
@@ -1,67 +1,74 @@
1
1
  /**
2
2
  * @fileoverview Objs-core library
3
- * @version 2.2
3
+ * @version 2.4.0
4
4
  * @author Roman Torshin
5
5
  * @license Apache-2.0
6
- */const ee=!0,t=n=>{let e={els:[],ie:{},delegated:{},parented:{},store:{},refs:{},_refsByIndex:[],states:[],isDebug:!1,currentState:"",savedStates:{},isRoot:!1,_parent:null},i=1,r=2,p=3,L="boolean",g="object",k="function",m="string",R="number",b="notEmptyString",h="undefined",v="dangerouslySetInnerHTML",I,l=t.D,T=-1,o=0,c=0,f=typeof process<"u"||t.D===t.DocumentMVP,a=0,u=0;const D=e,w=s=>typeof s,$=(s,d)=>{for(const x in s)Object.hasOwn(s,x)&&d(x,s)},S=t.onError,A=s=>t.verify(s),y=(s,d="")=>(...x)=>{(t.debug||e.isDebug)&&console.log(d?`${d}()`:s,x.length?"with "+x.join(", "):"without parameters");try{const O=s(x[0],x[i],x[r],x[p]);return O!==I?O:e}catch(O){S(O,d)}},N=s=>{for(a=o;a<=T;a++)s()},q=s=>s?.els?s.el:(w(s)!==g&&(s=t.first(s).el),s),j=(s=!0,d=e.els)=>{const x=d.length;if(e.length=x,T=x-i,o=0,e.el=x?d[0]:I,e.last=x?d[T]:I,s&&($(e.states,(O,E)=>{delete e[E[O]]}),e.states=[],e.ie={}),Array.isArray(e._refsByIndex)){const O=e._refsByIndex.length;if(O>x)$(e._refsByIndex,E=>{const C=+E;C>=x&&delete e._refsByIndex[C]}),e._refsByIndex.length=x;else if(O<x)for(let E=O;E<x;E++)e._refsByIndex[E]={}}};e.reset=t;const P=s=>{if(f||!s.querySelectorAll)return;const d=s.querySelectorAll("[data-o-init]"),x={};d.forEach(O=>{const E=O.getAttribute("data-o-init");E!==null&&(x[E]||(x[E]=[]),x[E].push(O))}),$(x,O=>{const E=t.inits[O];E&&E.getSSR(Number(O),x[O])})},X=(s,d,x)=>{$(d,O=>{let E=d[O];w(E)===k&&(E=E(x)),O==="append"&&w(E)===g&&(E.els&&(E=[E]),E[0]?.els&&(valueBuff=[],$(E,C=>{valueBuff.push(...E[C].els)}),E=valueBuff)),E!==I&&s.getAttribute(O)!==E&&!["tag","tagName","name","sample","state","events","ssr","nodeName","revertChildren","root","ref"].includes(O)&&(["html","innerHTML"].includes(O)?(s.innerHTML=E,!f&&P(s)):O==="className"?s.setAttribute("class",E):O==="dataset"&&w(E)===g?$(E,C=>{s.dataset[C]=E[C]}):O==="toggleClass"?s.classList.toggle(E):O==="addClass"?w(E)===g?s.classList.add(...E):s.classList.add(E):O==="removeClass"?s.classList.remove(E):O==="style"&&w(E)===g?$(E,C=>{s.style[C]=E[C]}):(O==="append"||O==="children"||O==="childNodes")&&w(E)===g?$(E.length?E:[E],C=>{O==="append"||!s.childNodes[C]?s.appendChild(E[C]):s.childNodes[C]!==E[C]&&s.childNodes[C].replaceWith(E[C])}):s.setAttribute(O,E))}),s.dataset.oState=d.state,t.autotag&&d.name&&(s.dataset[t.autotag]=t.camelToKebab(d.name))};e.debug=y(()=>{e.isDebug=!0},"debug ON"),e.saveAs=y(s=>{A([[s,[b]]]),t.getSaved[s]?(t.debug||e.isDebug)&&console.warn("the key exists (not saved):"+s):t.getSaved[s]=e},"saveAs"),e.unmount=()=>((t.debug||e.isDebug)&&console.log("unmount() for initID:"+e.initID),w(e.remove)===k?e.remove():e.els?.length&&e.els.forEach(s=>{s?.parentNode&&s.parentNode.removeChild(s)}),t.inits[e.initID]=void 0,e={},!0),e.init=y(s=>{A([[s,[g,k]]]);const d=e.initID||t.inits.length||0;if(e.initID=d,j(),t.inits[e.initID]=e,w(s)==="function"){e.render=y(C=>{const _=l.createElement("div");setTimeout(()=>{t.reactRender(s,_,C)}),e.add(_)});return}(w(s)!==g||s.render===I)&&(s={render:s}),$(s,C=>{e?.render&&C==="render"||(e.states.push(C),e[C]=y((_=[{}])=>{e.currentState=C;const F=s[C]||{tag:"div"},B=Array.isArray(e.els)?e.els.slice(o,T+i):[],z=B.length?B:e.els||[];w(F)===g&&(F.state=C,F["data-o-init"]=d);const V=(H,U={})=>{const M=w(F)===k?F(U):F;if(w(M)===g)return l.createElement(M.tag||M.tagName||"div");const J=l.createElement("div");return J.innerHTML=M,J.children.length>i||!J.firstElementChild?(J.dataset.oInit=H,J):(J.firstElementChild.dataset.oInit=H,J.firstElementChild)},Y=_;Array.isArray(_)||(_=[_]),_.length||(_=[_]);const G=!z[0]&&C==="render";_=_.map((H,U)=>{const M=Object.assign({},w(H)===g?H:{},{self:e,o:t,i:H.i===I?U:H.i,parent:e._parent,data:Array.isArray(Y)?Y[U]:Y});return G&&(!F.ssr||f)&&z.push(V(d,M)),M}),G&&(e.els=z,j(!1));const Q=()=>{$(F.events,H=>{e.on(H,F.events[H])})};z&&(u=z.length===_.length,z.map((H,U)=>{_[u?U:0].i=U+o;const M=w(F)===k?F(_[u?U:0]):F;w(M)===g&&(M.state=C,G&&(M["data-o-init"]=d,M["data-o-init-i"]=U,M.events&&(e._hydrateEvents=e._hydrateEvents||[],e._hydrateEvents[U]=M.events)),X(H,M,_[u?U:0]))}),G&&(e._refsByIndex=[],e.refs={},e.els.forEach((H,U)=>{if(!H.querySelectorAll)return;const M={};H.querySelectorAll("[ref]").forEach(J=>{const Z=J.getAttribute("ref"),K=t(J);M[Z]=K,U===0&&(e.refs[Z]=K)}),e._refsByIndex[U]=M}),!f&&e._hydrateEvents&&(e._hydrateEvents.forEach((H,U)=>{H&&(e.select(U),$(H,M=>{const J=H[M];if(w(J)===g&&J.targetRef&&w(J.handler)===k){const K=(e._refsByIndex?.[U]??e.refs)?.[J.targetRef];K&&K.on(M,J.handler)}else w(J)===k&&e.on(M,J)}))}),e.all()))),G&&w(F)===g&&F.events&&!f&&!F.ssr&&Q()}))});const x=s.render||s,O=!f&&w(x)===g&&x.events,E=!f&&e._hydrateEvents&&e._hydrateEvents.length;(O||E)&&(e.initSSRAfterGettingSSR=()=>{e._refsByIndex=[],e.refs={},e.els.forEach((C,_)=>{if(!C.querySelectorAll)return;const F={};C.querySelectorAll("[ref]").forEach(B=>{const z=B.getAttribute("ref"),V=t(B);F[z]=V,_===0&&(e.refs[z]=V),B.removeAttribute("ref")}),e._refsByIndex[_]=F,_===0&&(e.refs=F)}),O&&$(x.events,C=>{e.on(C,x.events[C])}),e._hydrateEvents&&(e._hydrateEvents.forEach((C,_)=>{C&&(e.select(_),$(C,F=>{const B=C[F];if(w(B)===g&&B.targetRef&&w(B.handler)===k){const V=(e._refsByIndex?.[_]??e.refs)?.[B.targetRef];V&&V.on(F,B.handler)}else w(B)===k&&e.on(F,B)}))}),e.all())})},"init"),e.connect=y((s,d="render",x)=>{A([[s,[g]],[d,[b]],[x,[m,h]]]),s.connect(D,d,x)},"connect"),e.getSSR=y((s,d)=>{A([[s,[R,h]]]);const x=s!==void 0?s:e.initID;if(f||w(s)===h&&w(e.initID)===h)return;const O=d&&d.length?d:t.D.querySelectorAll(`[data-o-init="${x}"]`);O.length&&(e.els=Array.from(O),s!==void 0&&(e.initID=s,t.inits[s]=e),j(!1),w(e.initSSRAfterGettingSSR)===k?e.initSSRAfterGettingSSR():d&&d.length&&(e._refsByIndex=[],e.refs={},e.els.forEach((E,C)=>{if(!E.querySelectorAll)return;const _={};E.querySelectorAll("[ref]").forEach(F=>{const B=F.getAttribute("ref");_[B]=t(F),C===0&&(e.refs[B]=_[B]),F.removeAttribute("ref")}),e._refsByIndex[C]=_,C===0&&(e.refs=_)})))},"getSSR"),e.initState=y((s,d)=>{A([[s,[g]],[d,[g,h]]]),e.init(s).render(d)},"initState");const W=(s,d,x)=>{const O=s.attributes,E={tagName:s.tagName.toLowerCase()};for(const C of O)E[C.nodeName]=C.value;if(x){E.innerHTML=s.innerHTML,E.revertChildren=[];const C=s.querySelectorAll("[data-o-init]");for(const _ of C){const F=_.getAttribute("data-o-init");E.revertChildren.push(F),t.inits[F]?.saveState(d,!1)}}return E};return e.saveState=y((s,d=!0)=>{if(A([[s,[b,h]],[d,[L]]]),!e.el)throw Error("saveState(): There are no elements to save");const x=s||"fastSavedState",O={els:[],parentNode:e.el.parentNode,root:d};N(()=>{O.els.push(W(e.els[a],x,d))}),O.ie=Object.assign({},e.ie),O.delegated=Object.assign({},e.delegated),O.store=Object.assign({},e.store),e.isRoot=e.isRoot||d,e.savedStates[x]=O},"saveState"),e.revertState=y(s=>{A([[s,[b,h]]]);const d=s||"fastSavedState";if(!e.savedStates[d])throw Error(`revertState(): The state "${d}" should have been saved by saveState()`);const x=e.savedStates[d];e.offAll(),e.offDelegate(),e.store=Object.assign({},x.store),x.els.forEach((O,E)=>{if(!e.els[E]){const C=t.D.createElement(O.tagName);x.parentNode&&(E?e.els[E-1].after(C):x.parentNode.append(C)),e.add(C)}X(e.els[E],O)}),e.delegated=Object.assign({},x.delegated),e.ie=Object.assign({},x.ie),e.onAll(),$(x.delegated,O=>{x.delegated[O].forEach(E=>{N(()=>{e.els[a].addEventListener(O,E)})})}),e.currentState=d,x.root&&x.els.forEach(({rootElement:O})=>{O.revertChildren.forEach(E=>{t.inits[E]?.revertState(d),t('[data-o-init="'+E+'"]').els.forEach((C,_)=>{C.replaceWith(t.inits[E]?.els[_])})})})},"revertState"),e.loseState=y(s=>{A([[s,[b]]]),e.savedStates[s]&&(delete e.savedStates[s],N(()=>{const d=e.els[a].querySelectorAll("[data-o-init]");for(const x of d){const O=x.getAttribute("data-o-init");t.inits[O]?.loseState(s)}}))},"sample"),e.sample=y((s="render")=>(A([[s,[b]]]),{[s]:W(e.els[o])}),"sample"),e.select=y(s=>{let d=s;d!=null&&w(d)===g&&d.target&&e.els.length&&(d=e.els.findIndex(x=>x===d.target||x.contains(d.target)),d<0&&(d=0)),A([[d,[R,h]]]),d===I&&(d=e.length-i),T=d,o=d,e.el=e.els[d],c=i,Array.isArray(e._refsByIndex)&&e._refsByIndex[d]&&(e.refs=e._refsByIndex[d])},"select"),e.all=y(()=>{T=e.length-i,o=0,e.el=e.els[0],c=0,Array.isArray(e._refsByIndex)&&e._refsByIndex.length&&(e.refs=e._refsByIndex[0]||{})},"all"),e.remove=y(s=>{if(A([[s,[R,h]]]),s===I&&c&&(s=o),s!==I){const d=e.els[s];d?.parentNode?d.parentNode.removeChild(d):d===void 0&&s>=e.els.length&&t.onError&&t.onError("remove("+s+"): index out of bounds","remove")}else N(()=>{const d=e.els[a];d?.parentNode&&d.parentNode.removeChild(d)});j(!1)},"remove"),e.skip=y(s=>{A([[s,[R,h]]]),s===I&&(s=o),e.els.splice(s,i),Array.isArray(e._refsByIndex)&&e._refsByIndex.splice(s,i),j()},"skip"),e.add=y(s=>{A([[s,[m,g,R]]]),e.initID===I&&(w(s)==="string"&&s!==""?e.els.push(...Array.from(l.querySelectorAll(s))):w(s)===g?s.tagName?e.els.push(s):s.els?e.els.push(...s.els):s.length&&s[0].tagName&&e.els.push(...s):w(s)==="number"&&t.inits[s]&&(e=t.inits[s]),j(!1),e.initID!==I&&e.dataset({oInit:e.initID}))},"add"),e.appendInside=y(s=>{A([[s,[g,b]]]),s?.els&&(e._parent=s),N(()=>{q(s).appendChild(e.els[a])})},"appendInside"),e.appendBefore=y(s=>{A([[s,[g,b]]]),N(()=>{q(s).parentNode.insertBefore(e.els[a],q(s))})},"appendBefore"),e.appendAfter=y(s=>{A([[s,[g,b]]]),N(()=>{q(s).after(...e.els)})},"appendAfter"),e.find=y((s="")=>{A([[s,m]]);const d=[];return N(()=>{d.push(...Array.from(e.els[a].querySelectorAll(":scope "+s)))}),t(d)},"find"),e.first=y((s="")=>{A([[s,m]]);let d=I;const x=[];return N(()=>{d=e.els[a].querySelector(s),d&&x.push(d)}),t(x)},"first"),e.attr=y((s,d)=>{if(d!==null&&A([[s,m],[d,[m,h]]]),d===I){const x=[];return N(()=>{x[a]=e.els[a].getAttribute(s)}),c?x[0]:x}else N(d!==null?()=>{e.els[a].setAttribute(s,d)}:()=>{e.els[a].removeAttribute(s)})},"attr"),e.attrs=y(()=>{const s=[];return N(()=>{const d={};[...e.els[a].attributes].forEach(x=>{d[x.nodeName]=x.nodeValue}),s.push(d)}),c?s[0]:s},"attrs"),e.dataset=y(s=>{if(A([[s,[g,h]]]),typeof s===g)N(()=>{$(s,d=>{e.els[a].dataset[d]=s[d]})});else{const d=[];return N(()=>{d.push({...e.els[a].dataset})}),c?d[0]:d}},"dataset"),e.style=y(s=>{s!==null&&A([[s,[m,h]]]),e.attr("style",s)},"style"),e.css=y((s={})=>{if(s===null){e.style(null);return}A([[s,g]]);let d="";$(s,x=>{d+=x+":"+s[x].replace('"',"'")+";"}),e.style(d||null)},"css"),e.setClass=y(s=>{A([[s,m]]),N(()=>{e.els[a].setAttribute("class",s)})},"setClass"),e.addClass=y((...s)=>{N(()=>{e.els[a].classList.add(...s)})},"addClass"),e.removeClass=y((...s)=>{N(()=>{e.els[a].classList.remove(...s)})},"removeClass"),e.toggleClass=y((s,d)=>{A([[s,b],[d,[L,h]]]),N(()=>{e.els[a].classList.toggle(s,d)})},"toggleClass"),e.haveClass=s=>{A([[s,b]]);let d=!0;return N(()=>{e.els[a].classList.contains(s)||(d=!1)}),(e.isDebug||t.debug)&&console.log("haveClass() with",s),d},e.innerHTML=y(s=>{if(A([[s,[m,h]]]),s!==I)N(()=>{e.els[a].innerHTML=s});else{let d="";return N(()=>{d+=f&&e.els[a].innerHTML.length===0?t.D.parseElement(e.els[a],!1):e.els[a].innerHTML}),d}},"innerHTML"),e.innerText=y(s=>{A([[s,[m]]]),N(()=>{e.els[a].innerText=s})},"innerText"),e.textContent=y(s=>{A([[s,[m]]]),N(()=>{e.els[a].textContent=s})},"textContent"),e.html=y(s=>{if(A([[s,[m,h]]]),s!==void 0)e.innerHTML(s);else{let d="";return N(()=>{d+=f?e.els[a].outerHTML():e.els[a].outerHTML}),d}},"html"),e.toString=function(){return e.html()},e[Symbol.toPrimitive]=function(s){return s==="string"||s==="default"?e.html():s==="number"?e.els?.length??0:e.html()},e.val=y(s=>{if(s===void 0)return e.el?.value;N(()=>{e.els[a].value=s})},"val"),e.forEach=y(s=>{A([[s,[k]]]),N(()=>{s({self:e,i:a,o:t,el:e.els[a]})})},"forEach"),e.prepareFor=y((s,d)=>{A([[s,[g,k,h]],[d,[k,h]]]);const x=s&&w(s)===g&&s.createElement;if(!x&&w(s)!==k)throw Error("prepareFor(): pass React (full object) or React.createElement as first argument");const O=x?s.createElement:s,E=x?s.useEffect:void 0;return C=>{if(C.ref===I)throw Error("No ref property to convert Objs to React");const _=Object.assign({},C),F=O("div",{ref:C.ref});return delete _.ref,E(()=>{$(_,B=>{if(B.substring(0,1)==="on"){const z=t.camelToKebab(B).split("-")[1];e.on(z,_[B]),delete _[B]}}),e.render(_),e.appendInside(F.ref.current)},[]),F}},"prepareFor"),e.on=y((s,d,x,O)=>{A([[s,[b]],[d,[k]],[x,[g,h]],[O,[L,h]]]),s.split(", ").forEach(E=>{N(()=>{e.els[a].addEventListener(E,d,x,O)}),e.ie[E]||(e.ie[E]=[]),e.ie[E].push([d,x,O])})},"on"),e.off=y((s,d,x)=>{A([[s,[b]],[d,[k]],[x,[g,h]]]),s.split(", ").forEach(O=>{N(()=>{e.els[a].removeEventListener(O,d,x)}),e.ie[O]&&(e.ie[O]=e.ie[O].filter(E=>E[0]!==d))})},"off"),e.onDelegate=y((s,d,x)=>{A([[s,[b]],[d,[b]],[x,[k]]]),s.split(", ").forEach(O=>{const E=C=>{const _=C.target.closest(d);_&&(C.delegate=_,C.objs=e,x(C))};N(()=>{e.els[a].addEventListener(O,E)}),e.delegated[O]||(e.delegated[O]=[]),e.delegated[O].push(E)})},"onDelegate"),e.offDelegate=y(s=>{A([[s,[b]]]),$(e.delegated,d=>{if(!s||s===d)for(;e.delegated[d].length;){const x=e.delegated[d].pop();N(()=>{e.els[a].removeEventListener(d,x)})}}),e.delegated={}},"offDelegate"),e.onParent=y((s,d,x)=>{A([[s,[b]],[d,[b,g]],[x,[k]]]);const O=w(d)===g?d:t.D.querySelector(d);s.split(", ").forEach(E=>{const C=_=>{_.objs=e,x(_)};O.addEventListener(E,C),e.parented[E]||(e.parented[E]=[]),e.parented[E].push(C)})},"onParent"),e.offParent=y((s,d)=>{A([[s,[b]],[d,[b,g]]]);const x=w(d)===g?d:t.D.querySelector(d);$(e.parented,O=>{(!s||s===O)&&(e.parented[O].forEach(E=>{x.removeEventListener(O,E)}),delete e.parented[O])})},"offParent"),e.onAll=y((s,d)=>{A([[s,[b,h]],[d,[L,h]]]),$(e.ie,(x,O)=>{(!s||s===x)&&O[x].forEach(E=>{N(()=>{d?e.els[a].removeEventListener(x,E[0]):e.els[a].addEventListener(x,E[0],E[i],E[r])})})})},"onAll"),e.offAll=y(s=>{A([[s,[b]]]),e.onAll(s,i)},"offAll"),n&&e.add(n),e.take=s=>{if(A([[s,[m,g,R]]]),e.add(s),e.el){const d=e.el.dataset.oInit;if(d!==I&&t.inits[d])return e.length===i?(u=e.els[0],Object.assign(e,t.inits[d]),e.els=[u]):e=t.inits[d],j(!1,e.els),e}},e};t.first=n=>(t.verify([[n,["notEmptyString"]]]),t.debug&&console.log(n," -> ","o.first()"),t(t.D.querySelector(n)).select(0)),t.inits=[],t.getSaved={},t.errors=[],t.showErrors=!1,t.logErrors=()=>{t.errors.length?t.errors.forEach(n=>console.error(n)):console.log("No errors")},t.onError=(n,e)=>{t.showErrors?console.error(n,e):(t.errors.push(n),e&&t.errors.push(e))},t.reactRender=()=>new Error("React render function is not defined"),t.autotag=void 0,t.reactQA=n=>({["data-"+(t.autotag||"qa")]:n.replace(/([A-Z])/g,(e,i)=>"-"+i.toLowerCase()).replace(/^-/,"")}),t.specialTypes={notEmptyString:(n,e)=>e==="string"&&n.length,array:n=>Array.isArray(n),promise:n=>n instanceof Promise||!!(n&&typeof n.then=="function")},t.verify=(n,e=!1)=>{for(const i of n){const r=typeof i[0];let p=Array.isArray(i[1])?i[1]:[i[1]],L=!1;if(p.includes(r))return!0;p=p.filter(g=>!!t.specialTypes[g]);for(const g of p)if(L=t.specialTypes[g](i[0],r),L)return!0}return e?!1:new Error("Type verification failed")},t.safeVerify=n=>t.verify(n,!0),t.init=(n,e)=>t().init(n,e),t.initState=(n,e)=>t().init(n).render(e),t.take=n=>t().take(n),t.getStates=()=>t.inits.reduce((n,e)=>(n.push(e?.states),n),[]),t.getStores=()=>t.inits.reduce((n,e)=>(n.push(e?.store),n),[]),t.getListeners=()=>t.inits.reduce((n,e)=>(n.push(e?.ie),n),[]),t.createStore=n=>{const e=Object.assign({},n);return e._defaults=Object.assign({},n),e._listeners=[],e.subscribe=function(i,r){return this._listeners.push(p=>i[r]?.(p)),this},e.notify=function(){this._listeners.forEach(i=>i(this))},e.reset=function(){const i={_listeners:1,subscribe:1,notify:1,_defaults:1,reset:1};for(const r of Object.keys(this._defaults))i[r]||(this[r]=this._defaults[r])},e},t.U=void 0,t.W=2,t.H=100,t.F=!1,t.C=(n,e)=>Object.hasOwn(n,e),t.kebabToCamel=n=>n.replace(/-./g,e=>e.toUpperCase()[1]),t.camelToKebab=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),t.route=(n,e)=>{t.verify([[n,["notEmptyString","function","boolean"]],[e,["function","object"]]]);const i=typeof n=="function"?n(window.location.pathname):n;return i===!0||window.location.pathname===i?e?typeof e=="function"?(e(),!0):e:t:typeof e=="function"?!1:{}},t.router=(n={})=>{t.verify([[n,["object"]]]);for(const e in n)if(t.C(n,e)&&window.location.pathname===e)return typeof n[e]=="function"?(n[e](),!0):n[e];return!1},t.DocumentMVP={addEventListener:()=>{},parseElement:(n,e=!0)=>{t.verify([[n,["object","string"]],[e,["boolean"]]]);const i=(r,p="")=>{let L="";for(const g in r)t.C(r,g)&&(L+=` ${p}${t.camelToKebab(g)}="${typeof r[g]!="object"?r[g]:Object.entries(r[g]).map(k=>`${k[0]}: ${k[1]};`).join(" ")}"`);return L};if(typeof n=="string")return n;if(e){const r=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],p=n.tagName.toLowerCase(),L=n.attributes["data-o-init"],g=L!==void 0?` data-o-init="${L}"`:"";return`<${p}${n.className?` class="${n.className}"`:""}${i(n.attributes)}${g}${i(n.dataset,"data-")}${r.includes(p)?"/":""}>${r.includes(p)?"":n.innerHTML.length?n.innerHTML:n.children.map(k=>t.D.parseElement(k)).join("")}${r.includes(p)?"":`</${p}>`}`}return n.innerHTML.length?n.innerHTML:n.children.map(r=>t.D.parseElement(r)).join("")},createElement:n=>{t.verify([[n,["notEmptyString"]]]);const e={tagName:n.toUpperCase(),attributes:{},innerHTML:"",children:[],dataset:{},className:"",classArray:[],style:{},addEventListener:()=>{},removeEventListener:()=>{}};return e.classList={add:(...i)=>{t.verify([[i,["array"]]]),e.classArray.push(i),e.className=e.classArray.join(" ")},has:i=>(t.verify([[i,["notEmptyString"]]]),e.classArray.includes(i)),remove:i=>{t.verify([[i,["notEmptyString"]]]),e.classArray=e.classArray.filter(r=>i!==r),e.className=e.classArray.join(" ")}},e.classList.toggle=i=>{t.verify([[i,["notEmptyString"]]]),e.classList.has(i)?e.classList.remove(i):e.classList.add(i)},e.setAttribute=(i,r)=>{t.verify([[i,["notEmptyString"]],[r,["string","number","boolean","undefined"]]]),e.attributes[i]=r},e.getAttribute=i=>(t.verify([[i,["notEmptyString"]]]),e.attributes[i]),e.removeAttribute=i=>{t.verify([[i,["notEmptyString"]]]),delete e.attributes[i]},e.appendChild=i=>{t.verify([[i,["object"]]]),e.children.push(i),e.firstElementChild=e.children[0]},e.outerHTML=()=>t.D.parseElement(e),e}},t.D=typeof document<"u"&&typeof process>"u"?document:t.DocumentMVP,t.setCookie=(n,e="",i={})=>{if(t.verify([[n,["notEmptyString"]],[e,["string","number","boolean"]],[i,["object"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}let r=encodeURIComponent(n)+"="+encodeURIComponent(e);i={path:"/",...i},i.expires instanceof Date?i.expires=i.expires.toUTCString():typeof i.expires=="number"&&(i.expires=new Date(i.expires).toUTCString());for(const p in i){r+="; "+p;const L=i[p];L!==!0&&(r+="="+L)}t.D.cookie=r},t.getCookie=n=>{if(t.verify([[n,["notEmptyString"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const e=t.D.cookie.match(RegExp("(?:^|; )"+n.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0},t.deleteCookie=n=>{t.verify([[n,["notEmptyString"]]]),t.setCookie(n,"",{"max-age":0})},t.clearCookies=()=>{if(t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const n=t.D.cookie.split(";");for(;n.length;){let e=n.pop();for(;e.charAt(0)===" ";)e=e.substring(1);const i=e.split("=")[0];t.deleteCookie(i)}},t.clearLocalStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof localStorage>"u"))if(n)localStorage.clear();else for(let e=localStorage.length-1;e>=0;e--){const i=localStorage.key(e);i.indexOf("oInc-")===-1&&i.indexOf("oTest-")===-1&&localStorage.removeItem(i)}},t.clearSessionStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof sessionStorage>"u"))if(!n)sessionStorage.clear();else for(let e=sessionStorage.length-1;e>=0;e--){const i=sessionStorage.key(e);i&&i.indexOf("oTest-")===0&&sessionStorage.removeItem(i)}},t.clearTestsStorage=()=>{t.clearSessionStorage(1)},t.clearAfterTests=()=>{t.clearCookies(),t.clearLocalStorage(!1),t.clearTestsStorage()},t.ajax=(n,e={})=>{t.verify([[n,["notEmptyString"]],[e,["object"]]]);const i=new URLSearchParams;if(e.data&&typeof e.data=="object"){for(const r in e.data)t.C(e.data,r)&&(typeof e.data[r]=="object"?i.set(r,encodeURIComponent(JSON.stringify(e.data[r]))):i.set(r,e.data[r]));e.method.toLowerCase()==="get"?n+="?"+i.toString():e.body||(e.body=i),delete e.data}return e.headers||(e.headers={"X-Requested-With":"XMLHttpRequest"}),fetch(n,e)},t.get=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"GET"})),t.post=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"POST"})),t.newLoader=n=>{t.verify([[n,["promise","undefined"]]]);let e=[],i=null,r=!1,p=!1;const L=g=>{r=!1,p=!1,i=null,setTimeout(()=>{g.then(k=>{r=!0,!k.ok&&typeof k.ok<"u"?(p=!0,e.forEach(([m,R,b])=>{b&&m[b](k)})):typeof k.json=="function"?k.json().then(m=>{i=m,e.forEach(([R,b])=>{R[b](i)})}):(i=k,e.forEach(([m,R])=>{m[R](i)}))}).catch(k=>{p=!0,e.forEach(([m,R,b])=>{b&&m[b](k)})})},33)};return n&&L(n),{reload:L,isObjsLoader:!0,listeners:e,isFinished:()=>r,getStore:()=>i,connect:(g,k="render",m)=>{t.verify([[g,["object"]],[k,["notEmptyString"]],[m,["string","undefined"]]]),r?p?m&&g[m]():typeof g[k]=="function"&&g[k](i):e.push([g,k,m])},disconnect:g=>{t.verify([[g,["object"]]]),e=e.filter(([k])=>k!==g)}}},t.getParams=n=>{t.verify([[n,["string","undefined"]]]);const e={},i=new URLSearchParams(window.location.search).entries();for(const r of i)e[r[0]]=r[1];return n?e[n]:e},t.incCache=!0,t.incCacheExp=1e3*60*60*24,t.incTimeout=6e3,t.incSource="",t.incForce=t.F,t.incAsync=!0,t.incCors=t.F,t.incSeparator="?",t.incFns={},t.incSet=[0],t.incReady=[0],t.incN=0,t.incGetHash=n=>n.split(t.incSeparator)[1]||"",t.incCheck=(n=0,e,i=0)=>(t.verify([[n,["number"]],[e,["number","undefined"]],[i,["number"]]]),!i&&n&&e===t.U&&t.incReady[n]?t.incSet[n]===1:t.incReady[n]===t.U||t.incReady[n][e]===t.U?t.F:(t.incReady[n][e].loaded=i,t.incFns[t.incReady[n][e].name]=i,t.incReady[n][0]+=i,n&&t.incReady[n].length===t.incReady[n][0]&&(typeof t.incSet[n]=="function"&&t.incSet[n](n),t.incSet[n]=1),t.incSet[n]===1)),t.incCacheClear=(n=t.F)=>{t.verify([[n,["boolean"]]]);for(const e in t.incFns)t.C(t.incFns,e)&&(localStorage.removeItem("oInc-"+e),localStorage.removeItem("oInc-"+e+"-expires"));return n&&(t.incReady.forEach((e,i)=>{i&&e.forEach((r,p)=>{p&&t("#oInc-"+i+"-"+p).remove()})}),t.incN=0,t.incFns={},t.incSet=[0],t.incReady=[0]),!0},t.inc=(n,e,i)=>{if(t.verify([[n,["object","undefined"]],[e,["function","undefined"]],[i,["function","undefined"]]]),typeof localStorage>"u")return;let r=0,p=0,L="",g=!1;const k="function",m=-1;if(typeof n!="object"||!n)return t.incSet[0];t.incSet[0]++;const R=t.incSet[0];t.incSet[R]=e||0,t.incReady[R]=[];const b=t.incReady[R];b[0]=1;const h={};for(const v in n)if(t.C(n,v)){if(v==="preload"){g=!0;continue}L=t.incGetHash(n[v]),r++,t.incN++;const I=n[v].indexOf(".css")>m?"style":"script";if(n[v]=(t.incSource?t.incSource+"/":"")+n[v],Number.isNaN(Number(v))&&t.C(t.incFns,v)&&t.incFns[v]&&!t.incForce){b[r]={name:v,loaded:1},p++;continue}if(b[r]={name:v,loaded:0},Number.isNaN(Number(v))&&(t.incFns[v]=0),Number.isNaN(Number(v))&&t.incCache&&(n[v].substring(0,4)!=="http"||!t.incCors)&&window.location.protocol!=="file:"&&(n[v].indexOf(".css")>m||n[v].indexOf(".js")>m)){const l=localStorage,T=l.getItem("oInc-"+v),o=l.getItem("oInc-"+v+"-expires"),c=l.getItem("oInc-"+v+"-hash");T&&o&&Date.now()<o&&c===L?(g||t.initState({tag:I,id:"oInc-"+R+"-"+r,innerHTML:T,"data-o-inc":R}).appendInside("head"),b[r].loaded=1,t.incFns[v]=1,p++):(h[v]=r,t.get(n[v],{mode:t.incCors?"cors":"same-origin"}).then(f=>{if(f.status!==200){t.onError&&t.onError({message:t.incSource+n[v]+" was not loaded"});return}f.text().then(a=>{l.setItem("oInc-"+v,a),l.setItem("oInc-"+v+"-expires",Date.now()+t.incCacheExp),l.setItem("oInc-"+v+"-hash",L),g||t.initState({tag:I,id:"oInc-"+R+"-"+h[v],innerHTML:a,"data-o-inc":R}).appendInside("head"),t.incCheck(R,h[v],1)})}))}else{const l={tag:I,id:"oInc-"+R+"-"+r,"data-o-inc":R,async:t.incAsync,onload:"o.incCheck("+R+","+r+",1)"};n[v].indexOf(".css")>m?(l.tag="link",l.rel="stylesheet",l.href=n[v]):(n[v].indexOf(".js")>m||(l.tag="img",l.style="display:none;"),l.src=n[v]),t.initState(l).appendInside(l.style?"body":"head")}}return b[0]+=p,r!==0&&(p===r?typeof e===k&&e(R):setTimeout(v=>{t.incReady[v]&&t.incReady[v].length<t.incReady[v][0]&&(t.incSet[v]=0,typeof i===k&&i(R))},t.incTimeout,R)),t.incSet[0]},t.connectRedux=(n,e,i,r="render")=>{t.verify([[n,["object"]],[e,["function"]],[i,["object"]],[r,["notEmptyString"]]]);const p=()=>{if(typeof i[r]=="function"){const L=e(n.getState());i[r](L!==null&&typeof L=="object"?L:{value:L})}};return p(),n.subscribe(p)},t.connectMobX=(n,e,i,r,p="render")=>(t.verify([[n,["object"]],[e,["object"]],[i,["function"]],[r,["object"]],[p,["notEmptyString"]]]),n.autorun(()=>{if(typeof r[p]=="function"){const L=i(e);r[p](L!==null&&typeof L=="object"?L:{value:L})}})),t.ObjsContext=null,t.withReactContext=(n,e,i,r,p="render")=>function(){const g=n.useContext(e);return n.useEffect(()=>{if(typeof r[p]=="function"){const k=i(g);r[p](k!==null&&typeof k=="object"?k:{value:k})}},[g]),null},t.debug=!1,t.sleep=n=>new Promise(e=>setTimeout(e,n)),t.tLog=[],t.tRes=[],t.tStatus=[],t.tFns=[],t.tShowOk=t.F,t.tStyled=t.F,t.tTime=2e3,t.tests=[],t.tExpectedSteps={},t.tFinalized={},t.tAutolog=t.F,t.tBeforeEach=void 0,t.tAfterEach=void 0,t.addTest=(n,...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);let i={};e.length&&typeof e[e.length-1]=="object"&&!Array.isArray(e[e.length-1])&&(i=e.pop());const r=t.tests.length;return t.tests[r]={title:n,tests:e,hooks:i},{run:()=>{typeof i.before=="function"&&(t.tBeforeEach=i.before),typeof i.after=="function"&&(t.tAfterEach=i.after),t.runTest(r)},autorun:()=>{typeof i.before=="function"&&(t.tBeforeEach=i.before),typeof i.after=="function"&&(t.tAfterEach=i.after),t.runTest(r,!0)},testId:r}},t.updateLogs=()=>{for(let n=0;n<t.tests.length;n++)t.tLog[n]=t.tLog[testN]=sessionStorage.getItem(`oTest-Log-${testN}`)||"";return t.tLog},t.runTest=(n=0,e,i)=>{if(t.verify([[n,["number"]],[e,["boolean","undefined"]],[i,["boolean","undefined"]]]),!t.tests[n])return;i||(sessionStorage?.removeItem(`oTest-Log-${n}`),sessionStorage?.removeItem(`oTest-Res-${n}`),sessionStorage?.removeItem(`oTest-Status-${n}`)),sessionStorage?.setItem("oTest-Run",n),e?sessionStorage?.setItem("oTest-Autorun",e):sessionStorage?.removeItem("oTest-Autorun");const r=t.tests[n];let p=r.tests.pop();typeof p!="function"&&(r.tests.push(p),p=()=>{}),r.tests.push(L=>{p(L),sessionStorage.setItem("dddd",1),sessionStorage?.removeItem("oTest-Run"),e&&t.runTest(n+1,e)}),t.test(r.title,...r.tests)},t.tPre='<div style="font-family:monospace;text-align:left;">',t.tOk='<span style="background:#cfc;padding: 0 15px;">OK</span> ',t.tXx='<div style="background:#fcc;padding:3px;">',t.tDc="</div>",t.test=(n="",...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);const i=sessionStorage?.getItem("oTest-Run"),r=i||t.tLog.length;let p=0,L="\u251C OK: ",g="\u251C \u2718 ",k=`
7
- `,m=`
8
- `,R="",b=e.length,h=0;const v=(o="",c=!1,f=!1)=>{t.tAutolog&&(c?console.error(o):(t.tShowOk||f)&&console.log(o))};let I={};if(typeof e[b-1]=="function"&&(t.tFns[r]=e[b-1],b--),b>0&&typeof e[b-1]=="object"&&!Array.isArray(e[b-1])&&(e[b-1].sync!==void 0||e[b-1].confirmOnFailure!==void 0)&&(I=e[b-1],b--),i){t.tLog[r]=sessionStorage.getItem(`oTest-Log-${r}`)||"",t.tRes[r]=sessionStorage.getItem(`oTest-Res-${r}`)||!1,t.tStatus[r]=JSON.parse(sessionStorage.getItem(`oTest-Status-${r}`)||"[]");for(let o=0;o<t.tStatus[r].length;o++){const c=t.tStatus[r][o];(c===!0||c===!1)&&h++}}t.tStyled&&(L=t.tPre+t.tOk,g=t.tPre+t.tXx,k=t.tDc,m=k+k),(!i||t.tLog[r].length===0)&&(v("\u2552 "+n+" #"+r,!1,!0),t.tStyled?t.tLog[r]="<div><b>"+n+" #"+r+"</b></div>":t.tLog[r]="\u2552 "+n+" #"+r+`
9
- `,t.tRes[r]=t.F,t.tStatus[r]=[]),t.tExpectedSteps[r]=b,t.tFinalized[r]=!1;const l=(o,c)=>new Promise(f=>{const a=t.overlay({innerHTML:`<div style="display:flex;flex-direction:column;gap:8px;"><div style="cursor:grab;">Step ${o+1} failed: ${c||"error"}. Continue testing?</div><div style="display:flex;gap:8px;"><button class="o-cf-continue" style="padding:6px 12px;background:#2563eb;color:#fff;border:none;border-radius:6px;cursor:pointer;">Continue</button><button class="o-cf-stop" style="padding:6px 12px;background:#dc2626;color:#fff;border:none;border-radius:6px;cursor:pointer;">Stop</button></div></div>`,timeout:I.confirmOnFailureTimeout||void 0,onClose:u=>f(u||{continue:!1}),excludeDragSelector:".o-cf-continue, .o-cf-stop"});a.first(".o-cf-continue").on("click",()=>{a._overlayCleanup(),f({continue:!0})}),a.first(".o-cf-stop").on("click",()=>{a._overlayCleanup(),f({continue:!1})})}),T=()=>{if(t.tFinalized[r])return;if(p>0){R="\u251C ",R+="DONE "+h+"/"+b+", waiting: "+p,v(R,!0),t.tStyled?t.tLog[r]+=t.tPre+'<div style="color:orange;"><b>DONE '+h+"/"+b+", waiting: "+p+"</b>"+t.tDc+t.tDc:t.tLog[r]+=R+`
10
- `;return}t.tFinalized[r]=!0;const o=t.tStatus[r].some(c=>c===!1);t.tRes[r]=!o&&h===b,R="\u2558 ",R+="DONE "+h+"/"+b,v(R,h!==b),v(),t.tStyled?t.tLog[r]+=t.tPre+'<div style="color:'+(h!==b?"red":"green")+';"><b>DONE '+h+"/"+b+"</b>"+t.tDc+t.tDc:t.tLog[r]+=R+`
11
- `,i&&(sessionStorage.setItem(`oTest-Log-${r}`,t.tLog[r]),sessionStorage.setItem(`oTest-Res-${r}`,t.tRes[r]),sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]))),typeof t.tFns[r]=="function"&&t.tFns[r](r)};if(I.sync||I.confirmOnFailure)return(async()=>{for(let o=t.tStatus[r].length;o<b;o++){const c={n:r,i:o,title:e[o][0],tShowOk:t.tShowOk,tStyled:t.tStyled};let f=e[o][1];if(typeof f>"u"){t.tStyled?t.tLog[r]+="<div>"+c.title+"</div>":t.tLog[r]+=c.title+`
12
- `,v("\u251C "+c.title,!1,!0),t.tStatus[r][o]=!0,h++;continue}if(typeof t.tBeforeEach=="function"&&t.tBeforeEach(c),typeof f=="function")try{f=f(c)}catch(a){f=a.message,t.onError&&t.onError(a)}if(typeof t.tAfterEach=="function"&&t.tAfterEach(c,f),f&&typeof f.then=="function"){try{const a=await f,u=a===!0||a==null||a&&typeof a=="object"&&a.ok===!0,D=a&&a.errors&&a.errors.length?a.errors.join("; "):typeof a=="string"?a:"";if(t.testUpdate(c,u,u?"":D?": "+D:""),h++,!u&&I.confirmOnFailure&&!(await l(o,D)).continue)break}catch(a){if(t.testUpdate(c,!1,a.message||"Promise rejected"),I.confirmOnFailure&&!(await l(o,a.message||"Promise rejected")).continue)break}continue}if(typeof t.tStatus[r][o]>"u")t.tStatus[r][o]=typeof f=="string"?t.F:f;else{sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]));return}if(f===!0)h++,t.tShowOk&&(t.tLog[r]+=L+e[o][0]+k,v("\u251C OK: "+e[o][0]));else if(f!==t.U){if(t.tLog[r]+=g+e[o][0]+(f!==t.F?": "+f:"")+m,v("\u251C \u2718 "+e[o][0]+(f!==t.F?": "+f:""),!0),I.confirmOnFailure&&!(await l(o,typeof f=="string"?f:"")).continue)break}else{p++,setTimeout(a=>{a.title+=" (timeout)",t.testUpdate(a)},t.tTime,c);return}}T()})(),r;for(let o=t.tStatus[r].length;o<b;o++){const c={n:r,i:o,title:e[o][0],tShowOk:t.tShowOk,tStyled:t.tStyled};let f=e[o][1];if(typeof f>"u"){t.tStyled?t.tLog[r]+="<div>"+c.title+"</div>":t.tLog[r]+=c.title+`
13
- `,v("\u251C "+c.title,!1,!0),t.tStatus[r][o]=!0,h++;continue}if(typeof t.tBeforeEach=="function"&&t.tBeforeEach(c),typeof f=="function")try{f=f(c)}catch(a){f=a.message,t.onError&&t.onError(a)}if(typeof t.tAfterEach=="function"&&t.tAfterEach(c,f),f&&typeof f.then=="function"){p++;const a=setTimeout(()=>{c.title+=" (timeout)",t.testUpdate(c)},t.tTime);f.then(u=>{clearTimeout(a);const D=u===!0||u&&u.ok===!0,w=u&&u.errors&&u.errors.length?u.errors.join("; "):typeof u=="string"?u:"";t.testUpdate(c,D,D?"":w?": "+w:"")}).catch(u=>{clearTimeout(a),t.testUpdate(c,!1,u.message||"Promise rejected")});continue}if(typeof t.tStatus[r][o]>"u")t.tStatus[r][o]=typeof f=="string"?t.F:f;else{sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]));return}f===!0?(h++,t.tShowOk&&(t.tLog[r]+=L+e[o][0]+k,v("\u251C OK: "+e[o][0]))):f!==t.U?(t.tLog[r]+=g+e[o][0]+(f!==t.F?": "+f:"")+m,v("\u251C \u2718 "+e[o][0]+(f!==t.F?": "+f:""),!0)):(p++,setTimeout(a=>{a.title+=" (timeout)",t.testUpdate(a)},t.tTime,c))}return T(),r},t.testUpdate=(n,e=t.F,i="")=>{t.verify([[n,["object"]],[e,["boolean","string"]],[i,["string"]]]);let r="";const p=n.n,L=(g="",k=!1)=>{t.tAutolog&&(k?console.error(g):console.log(g))};if(t.tStatus[p][n.i]===t.U||t.tStatus[p][n.i]===null){t.tStatus[p][n.i]=e===!0,e===!0?n.tShowOk&&(r="\u251C OK: "+n.title+i,L(r),n.tStyled?t.tLog[p]+=t.tPre+t.tOk+n.title+i+t.tDc:t.tLog[p]+=r+`
6
+ */const ee=!0,t=n=>{let e={els:[],ie:{},delegated:{},parented:{},store:{},refs:{},_refsByIndex:[],states:[],isDebug:!1,currentState:"",savedStates:{},isRoot:!1,_parent:null},i=1,r=2,p=3,L="boolean",x="object",C="function",_="string",D="number",R="notEmptyString",v="undefined",$="dangerouslySetInnerHTML",u,f=t.D,j=-1,O=0,I=0,m=typeof process<"u"||t.D===t.DocumentMVP,s=0,d=0;const N=e,g=o=>typeof o,y=(o,a)=>{for(const b in o)Object.hasOwn(o,b)&&a(b,o)},E=t.onError,S=o=>t.verify(o),w=(o,a="")=>(...b)=>{(t.debug||e.isDebug)&&console.log(a?`${a}()`:o,b.length?"with "+b.join(", "):"without parameters");try{const h=o(b[0],b[i],b[r],b[p]);return h!==u?h:e}catch(h){E(h,a)}},A=o=>{for(s=O;s<=j;s++)o()},B=o=>o?.els?o.el:(g(o)!==x&&(o=t.first(o).el),o),q=(o=!0,a=e.els)=>{const b=a.length;if(e.length=b,j=b-i,O=0,e.el=b?a[0]:u,e.last=b?a[j]:u,o&&(y(e.states,(h,l)=>{delete e[l[h]]}),e.states=[],e.ie={}),Array.isArray(e._refsByIndex)){const h=e._refsByIndex.length;if(h>b)y(e._refsByIndex,l=>{const c=+l;c>=b&&delete e._refsByIndex[c]}),e._refsByIndex.length=b;else if(h<b)for(let l=h;l<b;l++)e._refsByIndex[l]={}}};e.reset=t;const F=o=>{if(m||!o.querySelectorAll)return;const a=o.querySelectorAll("[data-o-init]"),b={};a.forEach(h=>{const l=h.getAttribute("data-o-init");l!==null&&(b[l]||(b[l]=[]),b[l].push(h))}),y(b,h=>{const l=t.inits[h];l&&l.getSSR(Number(h),b[h])})},P=(o,a,b)=>{y(a,h=>{let l=a[h];g(l)===C&&(l=l(b)),h==="append"&&g(l)===x&&(l.els&&(l=[l]),l[0]?.els&&(valueBuff=[],y(l,c=>{valueBuff.push(...l[c].els)}),l=valueBuff)),l!==u&&o.getAttribute(h)!==l&&!["tag","tagName","name","sample","state","events","ssr","nodeName","revertChildren","root","ref"].includes(h)&&(["html","innerHTML"].includes(h)?(o.innerHTML=l,!m&&F(o)):h==="className"?o.setAttribute("class",l):h==="dataset"&&g(l)===x?y(l,c=>{o.dataset[c]=l[c]}):h==="toggleClass"?o.classList.toggle(l):h==="addClass"?g(l)===x?o.classList.add(...l):o.classList.add(l):h==="removeClass"?o.classList.remove(l):h==="style"&&g(l)===x?y(l,c=>{o.style[c]=l[c]}):(h==="append"||h==="children"||h==="childNodes")&&g(l)===x?y(l.length?l:[l],c=>{h==="append"||!o.childNodes[c]?o.appendChild(l[c]):o.childNodes[c]!==l[c]&&o.childNodes[c].replaceWith(l[c])}):o.setAttribute(h,l))}),o.dataset.oState=a.state,t.autotag&&a.name&&(o.dataset[t.autotag]=t.camelToKebab(a.name))};e.debug=w(()=>{e.isDebug=!0},"debug ON"),e.saveAs=w(o=>{S([[o,[R]]]),t.getSaved[o]?(t.debug||e.isDebug)&&console.warn("the key exists (not saved):"+o):t.getSaved[o]=e},"saveAs"),e.unmount=()=>((t.debug||e.isDebug)&&console.log("unmount() for initID:"+e.initID),g(e.remove)===C?e.remove():e.els?.length&&e.els.forEach(o=>{o?.parentNode&&o.parentNode.removeChild(o)}),t.inits[e.initID]=void 0,e={},!0),e.init=w(o=>{S([[o,[x,C]]]);const a=e.initID||t.inits.length||0;if(e.initID=a,q(),t.inits[e.initID]=e,g(o)==="function"){e.render=w(c=>{const T=f.createElement("div");setTimeout(()=>{t.reactRender(o,T,c)}),e.add(T)});return}(g(o)!==x||o.render===u)&&(o={render:o}),y(o,c=>{e?.render&&c==="render"||(e.states.push(c),e[c]=w((T=[{}])=>{e.currentState=c;const k=o[c]||{tag:"div"},M=Array.isArray(e.els)?e.els.slice(O,j+i):[],U=M.length?M:e.els||[];g(k)===x&&(k.state=c,k["data-o-init"]=a);const z=(W,V={})=>{const X=g(k)===C?k(V):k;if(g(X)===x)return f.createElement(X.tag||X.tagName||"div");const K=f.createElement("div");return K.innerHTML=X,K.children.length>i||!K.firstElementChild?(K.dataset.oInit=W,K):(K.firstElementChild.dataset.oInit=W,K.firstElementChild)},J=T;Array.isArray(T)||(T=[T]),T.length||(T=[T]);const H=!U[0]&&c==="render";T=T.map((W,V)=>{const X=Object.assign({},g(W)===x?W:{},{self:e,o:t,i:W.i===u?V:W.i,parent:e._parent,data:Array.isArray(J)?J[V]:J});return H&&(!k.ssr||m)&&U.push(z(a,X)),X}),H&&(e.els=U,q(!1));const Y=()=>{y(k.events,W=>{e.on(W,k.events[W])})};U&&(d=U.length===T.length,U.map((W,V)=>{T[d?V:0].i=V+O;const X=g(k)===C?k(T[d?V:0]):k;g(X)===x&&(X.state=c,H&&(X["data-o-init"]=a,X["data-o-init-i"]=V,X.events&&(e._hydrateEvents=e._hydrateEvents||[],e._hydrateEvents[V]=X.events)),P(W,X,T[d?V:0]))}),H&&(e._refsByIndex=[],e.refs={},e.els.forEach((W,V)=>{if(!W.querySelectorAll)return;const X={};W.querySelectorAll("[ref]").forEach(K=>{const Q=K.getAttribute("ref"),Z=t(K);X[Q]=Z,V===0&&(e.refs[Q]=Z)}),e._refsByIndex[V]=X}),!m&&e._hydrateEvents&&(e._hydrateEvents.forEach((W,V)=>{W&&(e.select(V),y(W,X=>{const K=W[X];if(g(K)===x&&K.targetRef&&g(K.handler)===C){const Z=(e._refsByIndex?.[V]??e.refs)?.[K.targetRef];Z&&Z.on(X,K.handler)}else g(K)===C&&e.on(X,K)}))}),e.all()))),H&&g(k)===x&&k.events&&!m&&!k.ssr&&Y()}))});const b=o.render||o,h=!m&&g(b)===x&&b.events,l=!m&&e._hydrateEvents&&e._hydrateEvents.length;(h||l)&&(e.initSSRAfterGettingSSR=()=>{e._refsByIndex=[],e.refs={},e.els.forEach((c,T)=>{if(!c.querySelectorAll)return;const k={};c.querySelectorAll("[ref]").forEach(M=>{const U=M.getAttribute("ref"),z=t(M);k[U]=z,T===0&&(e.refs[U]=z),M.removeAttribute("ref")}),e._refsByIndex[T]=k,T===0&&(e.refs=k)}),h&&y(b.events,c=>{e.on(c,b.events[c])}),e._hydrateEvents&&(e._hydrateEvents.forEach((c,T)=>{c&&(e.select(T),y(c,k=>{const M=c[k];if(g(M)===x&&M.targetRef&&g(M.handler)===C){const z=(e._refsByIndex?.[T]??e.refs)?.[M.targetRef];z&&z.on(k,M.handler)}else g(M)===C&&e.on(k,M)}))}),e.all())})},"init"),e.connect=w((o,a="render",b)=>{S([[o,[x]],[a,[R]],[b,[_,v]]]),o.connect(N,a,b)},"connect"),e.getSSR=w((o,a)=>{S([[o,[D,v]]]);const b=o!==void 0?o:e.initID;if(m||g(o)===v&&g(e.initID)===v)return;const h=a&&a.length?a:t.D.querySelectorAll(`[data-o-init="${b}"]`);h.length&&(e.els=Array.from(h),o!==void 0&&(e.initID=o,t.inits[o]=e),q(!1),g(e.initSSRAfterGettingSSR)===C?e.initSSRAfterGettingSSR():a&&a.length&&(e._refsByIndex=[],e.refs={},e.els.forEach((l,c)=>{if(!l.querySelectorAll)return;const T={};l.querySelectorAll("[ref]").forEach(k=>{const M=k.getAttribute("ref");T[M]=t(k),c===0&&(e.refs[M]=T[M]),k.removeAttribute("ref")}),e._refsByIndex[c]=T,c===0&&(e.refs=T)})))},"getSSR"),e.initState=w((o,a)=>{S([[o,[x]],[a,[x,v]]]),e.init(o).render(a)},"initState");const G=(o,a,b)=>{const h=o.attributes,l={tagName:o.tagName.toLowerCase()};for(const c of h)l[c.nodeName]=c.value;if(b){l.innerHTML=o.innerHTML,l.revertChildren=[];const c=o.querySelectorAll("[data-o-init]");for(const T of c){const k=T.getAttribute("data-o-init");l.revertChildren.push(k),t.inits[k]?.saveState(a,!1)}}return l};return e.saveState=w((o,a=!0)=>{if(S([[o,[R,v]],[a,[L]]]),!e.el)throw Error("saveState(): There are no elements to save");const b=o||"fastSavedState",h={els:[],parentNode:e.el.parentNode,root:a};A(()=>{h.els.push(G(e.els[s],b,a))}),h.ie=Object.assign({},e.ie),h.delegated=Object.assign({},e.delegated),h.store=Object.assign({},e.store),e.isRoot=e.isRoot||a,e.savedStates[b]=h},"saveState"),e.revertState=w(o=>{S([[o,[R,v]]]);const a=o||"fastSavedState";if(!e.savedStates[a])throw Error(`revertState(): The state "${a}" should have been saved by saveState()`);const b=e.savedStates[a];e.offAll(),e.offDelegate(),e.store=Object.assign({},b.store),b.els.forEach((h,l)=>{if(!e.els[l]){const c=t.D.createElement(h.tagName);b.parentNode&&(l?e.els[l-1].after(c):b.parentNode.append(c)),e.add(c)}P(e.els[l],h)}),e.delegated=Object.assign({},b.delegated),e.ie=Object.assign({},b.ie),e.onAll(),y(b.delegated,h=>{b.delegated[h].forEach(l=>{A(()=>{e.els[s].addEventListener(h,l)})})}),e.currentState=a,b.root&&b.els.forEach(({rootElement:h})=>{h.revertChildren.forEach(l=>{t.inits[l]?.revertState(a),t('[data-o-init="'+l+'"]').els.forEach((c,T)=>{c.replaceWith(t.inits[l]?.els[T])})})})},"revertState"),e.loseState=w(o=>{S([[o,[R]]]),e.savedStates[o]&&(delete e.savedStates[o],A(()=>{const a=e.els[s].querySelectorAll("[data-o-init]");for(const b of a){const h=b.getAttribute("data-o-init");t.inits[h]?.loseState(o)}}))},"sample"),e.sample=w((o="render")=>(S([[o,[R]]]),{[o]:G(e.els[O])}),"sample"),e.select=w(o=>{let a=o;a!=null&&g(a)===x&&a.target&&e.els.length&&(a=e.els.findIndex(b=>b===a.target||b.contains(a.target)),a<0&&(a=0)),S([[a,[D,v]]]),a===u&&(a=e.length-i),j=a,O=a,e.el=e.els[a],I=i,Array.isArray(e._refsByIndex)&&e._refsByIndex[a]&&(e.refs=e._refsByIndex[a])},"select"),e.all=w(()=>{j=e.length-i,O=0,e.el=e.els[0],I=0,Array.isArray(e._refsByIndex)&&e._refsByIndex.length&&(e.refs=e._refsByIndex[0]||{})},"all"),e.remove=w(o=>{if(S([[o,[D,v]]]),o===u&&I&&(o=O),o!==u){const a=e.els[o];a?.parentNode?a.parentNode.removeChild(a):a===void 0&&o>=e.els.length&&t.onError&&t.onError("remove("+o+"): index out of bounds","remove")}else A(()=>{const a=e.els[s];a?.parentNode&&a.parentNode.removeChild(a)});q(!1)},"remove"),e.skip=w(o=>{S([[o,[D,v]]]),o===u&&(o=O),e.els.splice(o,i),Array.isArray(e._refsByIndex)&&e._refsByIndex.splice(o,i),q()},"skip"),e.add=w(o=>{S([[o,[_,x,D]]]),e.initID===u&&(g(o)==="string"&&o!==""?e.els.push(...Array.from(f.querySelectorAll(o))):g(o)===x?o.tagName?e.els.push(o):o.els?e.els.push(...o.els):o.length&&o[0].tagName&&e.els.push(...o):g(o)==="number"&&t.inits[o]&&(e=t.inits[o]),q(!1),e.initID!==u&&e.dataset({oInit:e.initID}))},"add"),e.appendInside=w(o=>{S([[o,[x,R]]]),o?.els&&(e._parent=o),A(()=>{B(o).appendChild(e.els[s])})},"appendInside"),e.appendBefore=w(o=>{S([[o,[x,R]]]),A(()=>{B(o).parentNode.insertBefore(e.els[s],B(o))})},"appendBefore"),e.appendAfter=w(o=>{S([[o,[x,R]]]),A(()=>{B(o).after(...e.els)})},"appendAfter"),e.find=w((o="")=>{S([[o,_]]);const a=[];return A(()=>{a.push(...Array.from(e.els[s].querySelectorAll(":scope "+o)))}),t(a)},"find"),e.first=w((o="")=>{S([[o,_]]);let a=u;const b=[];return A(()=>{a=e.els[s].querySelector(o),a&&b.push(a)}),t(b)},"first"),e.attr=w((o,a)=>{if(a!==null&&S([[o,_],[a,[_,v]]]),a===u){const b=[];return A(()=>{b[s]=e.els[s].getAttribute(o)}),I?b[0]:b}else A(a!==null?()=>{e.els[s].setAttribute(o,a)}:()=>{e.els[s].removeAttribute(o)})},"attr"),e.attrs=w(()=>{const o=[];return A(()=>{const a={};[...e.els[s].attributes].forEach(b=>{a[b.nodeName]=b.nodeValue}),o.push(a)}),I?o[0]:o},"attrs"),e.dataset=w(o=>{if(S([[o,[x,v]]]),typeof o===x)A(()=>{y(o,a=>{e.els[s].dataset[a]=o[a]})});else{const a=[];return A(()=>{a.push({...e.els[s].dataset})}),I?a[0]:a}},"dataset"),e.style=w(o=>{o!==null&&S([[o,[_,v]]]),e.attr("style",o)},"style"),e.css=w((o={})=>{if(o===null){e.style(null);return}S([[o,x]]);let a="";y(o,b=>{a+=b+":"+o[b].replace('"',"'")+";"}),e.style(a||null)},"css"),e.cssMerge=w((o={})=>{if(o===null){e.style(null);return}S([[o,x]]);const a=h=>h.indexOf("-")!==-1?h:t.camelToKebab(h),b=h=>{const l={};if(!h||typeof h!==_)return l;const c=h.split(";");for(let T=0;T<c.length;T++){const k=c[T],M=k.indexOf(":");if(M===-1)continue;const U=k.slice(0,M).trim(),z=k.slice(M+1).trim();U&&(l[U]=z)}return l};A(()=>{const h=e.els[s],l=b(h.getAttribute("style"));y(o,T=>{const k=a(T),M=o[T];M===null||M===u?delete l[k]:l[k]=String(M).replace('"',"'")});let c="";y(l,T=>{c+=T+":"+l[T]+";"}),c?h.setAttribute("style",c):h.removeAttribute("style")})},"cssMerge"),e.setClass=w(o=>{S([[o,_]]),A(()=>{e.els[s].setAttribute("class",o)})},"setClass"),e.addClass=w((...o)=>{A(()=>{e.els[s].classList.add(...o)})},"addClass"),e.removeClass=w((...o)=>{A(()=>{e.els[s].classList.remove(...o)})},"removeClass"),e.toggleClass=w((o,a)=>{S([[o,R],[a,[L,v]]]),A(()=>{e.els[s].classList.toggle(o,a)})},"toggleClass"),e.haveClass=o=>{S([[o,R]]);let a=!0;return A(()=>{e.els[s].classList.contains(o)||(a=!1)}),(e.isDebug||t.debug)&&console.log("haveClass() with",o),a},e.innerHTML=w(o=>{if(S([[o,[_,v]]]),o!==u)A(()=>{e.els[s].innerHTML=o});else{let a="";return A(()=>{a+=m&&e.els[s].innerHTML.length===0?t.D.parseElement(e.els[s],!1):e.els[s].innerHTML}),a}},"innerHTML"),e.innerText=w(o=>{S([[o,[_]]]),A(()=>{e.els[s].innerText=o})},"innerText"),e.textContent=w(o=>{S([[o,[_]]]),A(()=>{e.els[s].textContent=o})},"textContent"),e.html=w(o=>{if(S([[o,[_,v]]]),o!==void 0)e.innerHTML(o);else{let a="";return A(()=>{a+=m?e.els[s].outerHTML():e.els[s].outerHTML}),a}},"html"),e.toString=function(){return e.html()},e[Symbol.toPrimitive]=function(o){return o==="string"||o==="default"?e.html():o==="number"?e.els?.length??0:e.html()},e.val=w(o=>{if(o===void 0)return e.el?.value;A(()=>{e.els[s].value=o})},"val"),e.forEach=w(o=>{S([[o,[C]]]),A(()=>{o({self:e,i:s,o:t,el:e.els[s]})})},"forEach"),e.prepareFor=w((o,a)=>{S([[o,[x,C,v]],[a,[C,v]]]);const b=o&&g(o)===x&&o.createElement;if(!b&&g(o)!==C)throw Error("prepareFor(): pass React (full object) or React.createElement as first argument");const h=b?o.createElement:o,l=b?o.useEffect:void 0;return c=>{if(c.ref===u)throw Error("No ref property to convert Objs to React");const T=Object.assign({},c),k=h("div",{ref:c.ref});return delete T.ref,l(()=>{y(T,M=>{if(M.substring(0,1)==="on"){const U=t.camelToKebab(M).split("-")[1];e.on(U,T[M]),delete T[M]}}),e.render(T),e.appendInside(k.ref.current)},[]),k}},"prepareFor"),e.on=w((o,a,b,h)=>{S([[o,[R]],[a,[C]],[b,[x,v]],[h,[L,v]]]),o.split(", ").forEach(l=>{A(()=>{e.els[s].addEventListener(l,a,b,h)}),e.ie[l]||(e.ie[l]=[]),e.ie[l].push([a,b,h])})},"on"),e.off=w((o,a,b)=>{S([[o,[R]],[a,[C]],[b,[x,v]]]),o.split(", ").forEach(h=>{A(()=>{e.els[s].removeEventListener(h,a,b)}),e.ie[h]&&(e.ie[h]=e.ie[h].filter(l=>l[0]!==a))})},"off"),e.onDelegate=w((o,a,b)=>{S([[o,[R]],[a,[R]],[b,[C]]]),o.split(", ").forEach(h=>{const l=c=>{const T=c.target.closest(a);T&&(c.delegate=T,c.objs=e,b(c))};A(()=>{e.els[s].addEventListener(h,l)}),e.delegated[h]||(e.delegated[h]=[]),e.delegated[h].push(l)})},"onDelegate"),e.offDelegate=w(o=>{S([[o,[R]]]),y(e.delegated,a=>{if(!o||o===a)for(;e.delegated[a].length;){const b=e.delegated[a].pop();A(()=>{e.els[s].removeEventListener(a,b)})}}),e.delegated={}},"offDelegate"),e.onParent=w((o,a,b)=>{S([[o,[R]],[a,[R,x]],[b,[C]]]);const h=g(a)===x?a:t.D.querySelector(a);o.split(", ").forEach(l=>{const c=T=>{T.objs=e,b(T)};h.addEventListener(l,c),e.parented[l]||(e.parented[l]=[]),e.parented[l].push(c)})},"onParent"),e.offParent=w((o,a)=>{S([[o,[R]],[a,[R,x]]]);const b=g(a)===x?a:t.D.querySelector(a);y(e.parented,h=>{(!o||o===h)&&(e.parented[h].forEach(l=>{b.removeEventListener(h,l)}),delete e.parented[h])})},"offParent"),e.onAll=w((o,a)=>{S([[o,[R,v]],[a,[L,v]]]),y(e.ie,(b,h)=>{(!o||o===b)&&h[b].forEach(l=>{A(()=>{a?e.els[s].removeEventListener(b,l[0]):e.els[s].addEventListener(b,l[0],l[i],l[r])})})})},"onAll"),e.offAll=w(o=>{S([[o,[R]]]),e.onAll(o,i)},"offAll"),n&&e.add(n),e.take=o=>{if(S([[o,[_,x,D]]]),e.add(o),e.el){const a=e.el.dataset.oInit;if(a!==u&&t.inits[a])return e.length===i?(d=e.els[0],Object.assign(e,t.inits[a]),e.els=[d]):e=t.inits[a],q(!1,e.els),e}},e};t.first=n=>(t.verify([[n,["notEmptyString"]]]),t.debug&&console.log(n," -> ","o.first()"),t(t.D.querySelector(n)).select(0)),t.inits=[],t.getSaved={},t.errors=[],t.showErrors=!1,t.logErrors=()=>{t.errors.length?t.errors.forEach(n=>console.error(n)):console.log("No errors")},t.onError=(n,e)=>{t.showErrors?console.error(n,e):(t.errors.push(n),e&&t.errors.push(e))},t.reactRender=()=>new Error("React render function is not defined"),t.autotag=void 0,t.reactQA=n=>({["data-"+(t.autotag||"qa")]:n.replace(/([A-Z])/g,(e,i)=>"-"+i.toLowerCase()).replace(/^-/,"")}),t.specialTypes={notEmptyString:(n,e)=>e==="string"&&n.length,array:n=>Array.isArray(n),promise:n=>n instanceof Promise||!!(n&&typeof n.then=="function")},t.verify=(n,e=!1)=>{for(const i of n){const r=typeof i[0];let p=Array.isArray(i[1])?i[1]:[i[1]],L=!1;if(p.includes(r))return!0;p=p.filter(x=>!!t.specialTypes[x]);for(const x of p)if(L=t.specialTypes[x](i[0],r),L)return!0}return e?!1:new Error("Type verification failed")},t.safeVerify=n=>t.verify(n,!0),t.init=(n,e)=>t().init(n,e),t.initState=(n,e)=>t().init(n).render(e),t.take=n=>t().take(n),t.getStates=()=>t.inits.reduce((n,e)=>(n.push(e?.states),n),[]),t.getStores=()=>t.inits.reduce((n,e)=>(n.push(e?.store),n),[]),t.getListeners=()=>t.inits.reduce((n,e)=>(n.push(e?.ie),n),[]),t.createStore=n=>{const e=Object.assign({},n);return e._defaults=Object.assign({},n),e._listeners=[],e.subscribe=function(i,r){return this._listeners.push(p=>i[r]?.(p)),this},e.notify=function(){this._listeners.forEach(i=>i(this))},e.reset=function(){const i={_listeners:1,subscribe:1,notify:1,_defaults:1,reset:1};for(const r of Object.keys(this._defaults))i[r]||(this[r]=this._defaults[r])},e},t.U=void 0,t.W=2,t.H=100,t.F=!1,t.C=(n,e)=>Object.hasOwn(n,e),t.kebabToCamel=n=>n.replace(/-./g,e=>e.toUpperCase()[1]),t.camelToKebab=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),t.route=(n,e)=>{t.verify([[n,["notEmptyString","function","boolean"]],[e,["function","object"]]]);const i=typeof n=="function"?n(window.location.pathname):n;return i===!0||window.location.pathname===i?e?typeof e=="function"?(e(),!0):e:t:typeof e=="function"?!1:{}},t.router=(n={})=>{t.verify([[n,["object"]]]);for(const e in n)if(t.C(n,e)&&window.location.pathname===e)return typeof n[e]=="function"?(n[e](),!0):n[e];return!1},t.DocumentMVP={addEventListener:()=>{},parseElement:(n,e=!0)=>{t.verify([[n,["object","string"]],[e,["boolean"]]]);const i=(r,p="")=>{let L="";for(const x in r)t.C(r,x)&&(L+=` ${p}${t.camelToKebab(x)}="${typeof r[x]!="object"?r[x]:Object.entries(r[x]).map(C=>`${C[0]}: ${C[1]};`).join(" ")}"`);return L};if(typeof n=="string")return n;if(e){const r=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],p=n.tagName.toLowerCase(),L=n.attributes["data-o-init"],x=L!==void 0?` data-o-init="${L}"`:"";return`<${p}${n.className?` class="${n.className}"`:""}${i(n.attributes)}${x}${i(n.dataset,"data-")}${r.includes(p)?"/":""}>${r.includes(p)?"":n.innerHTML.length?n.innerHTML:n.children.map(C=>t.D.parseElement(C)).join("")}${r.includes(p)?"":`</${p}>`}`}return n.innerHTML.length?n.innerHTML:n.children.map(r=>t.D.parseElement(r)).join("")},createElement:n=>{t.verify([[n,["notEmptyString"]]]);const e={tagName:n.toUpperCase(),attributes:{},innerHTML:"",children:[],dataset:{},className:"",classArray:[],style:{},addEventListener:()=>{},removeEventListener:()=>{}};return e.classList={add:(...i)=>{t.verify([[i,["array"]]]),e.classArray.push(i),e.className=e.classArray.join(" ")},has:i=>(t.verify([[i,["notEmptyString"]]]),e.classArray.includes(i)),remove:i=>{t.verify([[i,["notEmptyString"]]]),e.classArray=e.classArray.filter(r=>i!==r),e.className=e.classArray.join(" ")}},e.classList.toggle=i=>{t.verify([[i,["notEmptyString"]]]),e.classList.has(i)?e.classList.remove(i):e.classList.add(i)},e.setAttribute=(i,r)=>{t.verify([[i,["notEmptyString"]],[r,["string","number","boolean","undefined"]]]),e.attributes[i]=r},e.getAttribute=i=>(t.verify([[i,["notEmptyString"]]]),e.attributes[i]),e.removeAttribute=i=>{t.verify([[i,["notEmptyString"]]]),delete e.attributes[i]},e.appendChild=i=>{t.verify([[i,["object"]]]),e.children.push(i),e.firstElementChild=e.children[0]},e.outerHTML=()=>t.D.parseElement(e),e}},t.D=typeof document<"u"&&typeof process>"u"?document:t.DocumentMVP,t.setCookie=(n,e="",i={})=>{if(t.verify([[n,["notEmptyString"]],[e,["string","number","boolean"]],[i,["object"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}let r=encodeURIComponent(n)+"="+encodeURIComponent(e);i={path:"/",...i},i.expires instanceof Date?i.expires=i.expires.toUTCString():typeof i.expires=="number"&&(i.expires=new Date(i.expires).toUTCString());for(const p in i){r+="; "+p;const L=i[p];L!==!0&&(r+="="+L)}t.D.cookie=r},t.getCookie=n=>{if(t.verify([[n,["notEmptyString"]]]),t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const e=t.D.cookie.match(RegExp("(?:^|; )"+n.replace(/([.$?*|{}()[\]\\/+^])/g,"\\$1")+"=([^;]*)"));return e?decodeURIComponent(e[1]):void 0},t.deleteCookie=n=>{t.verify([[n,["notEmptyString"]]]),t.setCookie(n,"",{"max-age":0})},t.clearCookies=()=>{if(t.D.cookie===void 0){console.log("Cookies are not supported on server side");return}const n=t.D.cookie.split(";");for(;n.length;){let e=n.pop();for(;e.charAt(0)===" ";)e=e.substring(1);const i=e.split("=")[0];t.deleteCookie(i)}},t.clearLocalStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof localStorage>"u"))if(n)localStorage.clear();else for(let e=localStorage.length-1;e>=0;e--){const i=localStorage.key(e);i.indexOf("oInc-")===-1&&i.indexOf("oTest-")===-1&&localStorage.removeItem(i)}},t.clearSessionStorage=n=>{if(t.verify([[n,["boolean","undefined"]]]),!(typeof sessionStorage>"u"))if(!n)sessionStorage.clear();else for(let e=sessionStorage.length-1;e>=0;e--){const i=sessionStorage.key(e);i&&i.indexOf("oTest-")===0&&sessionStorage.removeItem(i)}},t.clearTestsStorage=()=>{t.clearSessionStorage(1)},t.clearAfterTests=()=>{t.clearCookies(),t.clearLocalStorage(!1),t.clearTestsStorage()},t.ajax=(n,e={})=>{t.verify([[n,["notEmptyString"]],[e,["object"]]]);const i=new URLSearchParams;if(e.data&&typeof e.data=="object"){for(const r in e.data)t.C(e.data,r)&&(typeof e.data[r]=="object"?i.set(r,encodeURIComponent(JSON.stringify(e.data[r]))):i.set(r,e.data[r]));e.method.toLowerCase()==="get"?n+="?"+i.toString():e.body||(e.body=i),delete e.data}return e.headers||(e.headers={"X-Requested-With":"XMLHttpRequest"}),fetch(n,e)},t.get=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"GET"})),t.post=(n,e={})=>(t.verify([[n,["notEmptyString"]],[e,["object"]]]),t.ajax(n,{...e,method:"POST"})),t.newLoader=n=>{t.verify([[n,["promise","undefined"]]]);let e=[],i=null,r=!1,p=!1;const L=x=>{r=!1,p=!1,i=null,setTimeout(()=>{x.then(C=>{r=!0,!C.ok&&typeof C.ok<"u"?(p=!0,e.forEach(([_,D,R])=>{R&&_[R](C)})):typeof C.json=="function"?C.json().then(_=>{i=_,e.forEach(([D,R])=>{D[R](i)})}):(i=C,e.forEach(([_,D])=>{_[D](i)}))}).catch(C=>{p=!0,e.forEach(([_,D,R])=>{R&&_[R](C)})})},33)};return n&&L(n),{reload:L,isObjsLoader:!0,listeners:e,isFinished:()=>r,getStore:()=>i,connect:(x,C="render",_)=>{t.verify([[x,["object"]],[C,["notEmptyString"]],[_,["string","undefined"]]]),r?p?_&&x[_]():typeof x[C]=="function"&&x[C](i):e.push([x,C,_])},disconnect:x=>{t.verify([[x,["object"]]]),e=e.filter(([C])=>C!==x)}}},t.getParams=n=>{t.verify([[n,["string","undefined"]]]);const e={},i=new URLSearchParams(window.location.search).entries();for(const r of i)e[r[0]]=r[1];return n?e[n]:e},t.incCache=!0,t.incCacheExp=1e3*60*60*24,t.incTimeout=6e3,t.incSource="",t.incForce=t.F,t.incAsync=!0,t.incCors=t.F,t.incSeparator="?",t.incFns={},t.incSet=[0],t.incReady=[0],t.incN=0,t.incGetHash=n=>n.split(t.incSeparator)[1]||"",t.incCheck=(n=0,e,i=0)=>(t.verify([[n,["number"]],[e,["number","undefined"]],[i,["number"]]]),!i&&n&&e===t.U&&t.incReady[n]?t.incSet[n]===1:t.incReady[n]===t.U||t.incReady[n][e]===t.U?t.F:(t.incReady[n][e].loaded=i,t.incFns[t.incReady[n][e].name]=i,t.incReady[n][0]+=i,n&&t.incReady[n].length===t.incReady[n][0]&&(typeof t.incSet[n]=="function"&&t.incSet[n](n),t.incSet[n]=1),t.incSet[n]===1)),t.incCacheClear=(n=t.F)=>{t.verify([[n,["boolean"]]]);for(const e in t.incFns)t.C(t.incFns,e)&&(localStorage.removeItem("oInc-"+e),localStorage.removeItem("oInc-"+e+"-expires"));return n&&(t.incReady.forEach((e,i)=>{i&&e.forEach((r,p)=>{p&&t("#oInc-"+i+"-"+p).remove()})}),t.incN=0,t.incFns={},t.incSet=[0],t.incReady=[0]),!0},t.inc=(n,e,i)=>{if(t.verify([[n,["object","undefined"]],[e,["function","undefined"]],[i,["function","undefined"]]]),typeof localStorage>"u")return;let r=0,p=0,L="",x=!1;const C="function",_=-1;if(typeof n!="object"||!n)return t.incSet[0];t.incSet[0]++;const D=t.incSet[0];t.incSet[D]=e||0,t.incReady[D]=[];const R=t.incReady[D];R[0]=1;const v={};for(const $ in n)if(t.C(n,$)){if($==="preload"){x=!0;continue}L=t.incGetHash(n[$]),r++,t.incN++;const u=n[$].indexOf(".css")>_?"style":"script";if(n[$]=(t.incSource?t.incSource+"/":"")+n[$],Number.isNaN(Number($))&&t.C(t.incFns,$)&&t.incFns[$]&&!t.incForce){R[r]={name:$,loaded:1},p++;continue}if(R[r]={name:$,loaded:0},Number.isNaN(Number($))&&(t.incFns[$]=0),Number.isNaN(Number($))&&t.incCache&&(n[$].substring(0,4)!=="http"||!t.incCors)&&window.location.protocol!=="file:"&&(n[$].indexOf(".css")>_||n[$].indexOf(".js")>_)){const f=localStorage,j=f.getItem("oInc-"+$),O=f.getItem("oInc-"+$+"-expires"),I=f.getItem("oInc-"+$+"-hash");j&&O&&Date.now()<O&&I===L?(x||t.initState({tag:u,id:"oInc-"+D+"-"+r,innerHTML:j,"data-o-inc":D}).appendInside("head"),R[r].loaded=1,t.incFns[$]=1,p++):(v[$]=r,t.get(n[$],{mode:t.incCors?"cors":"same-origin"}).then(m=>{if(m.status!==200){t.onError&&t.onError({message:t.incSource+n[$]+" was not loaded"});return}m.text().then(s=>{f.setItem("oInc-"+$,s),f.setItem("oInc-"+$+"-expires",Date.now()+t.incCacheExp),f.setItem("oInc-"+$+"-hash",L),x||t.initState({tag:u,id:"oInc-"+D+"-"+v[$],innerHTML:s,"data-o-inc":D}).appendInside("head"),t.incCheck(D,v[$],1)})}))}else{const f={tag:u,id:"oInc-"+D+"-"+r,"data-o-inc":D,async:t.incAsync,onload:"o.incCheck("+D+","+r+",1)"};n[$].indexOf(".css")>_?(f.tag="link",f.rel="stylesheet",f.href=n[$]):(n[$].indexOf(".js")>_||(f.tag="img",f.style="display:none;"),f.src=n[$]),t.initState(f).appendInside(f.style?"body":"head")}}return R[0]+=p,r!==0&&(p===r?typeof e===C&&e(D):setTimeout($=>{t.incReady[$]&&t.incReady[$].length<t.incReady[$][0]&&(t.incSet[$]=0,typeof i===C&&i(D))},t.incTimeout,D)),t.incSet[0]},t.connectRedux=(n,e,i,r="render")=>{t.verify([[n,["object"]],[e,["function"]],[i,["object"]],[r,["notEmptyString"]]]);const p=()=>{if(typeof i[r]=="function"){const L=e(n.getState());i[r](L!==null&&typeof L=="object"?L:{value:L})}};return p(),n.subscribe(p)},t.connectMobX=(n,e,i,r,p="render")=>(t.verify([[n,["object"]],[e,["object"]],[i,["function"]],[r,["object"]],[p,["notEmptyString"]]]),n.autorun(()=>{if(typeof r[p]=="function"){const L=i(e);r[p](L!==null&&typeof L=="object"?L:{value:L})}})),t.ObjsContext=null,t.withReactContext=(n,e,i,r,p="render")=>function(){const x=n.useContext(e);return n.useEffect(()=>{if(typeof r[p]=="function"){const C=i(x);r[p](C!==null&&typeof C=="object"?C:{value:C})}},[x]),null},t.debug=!1,t.sleep=n=>new Promise(e=>setTimeout(e,n)),t.tLog=[],t.tRes=[],t.tStatus=[],t.tFns=[],t.tShowOk=t.F,t.tStyled=t.F,t.tTime=2e3,t.tests=[],t.tExpectedSteps={},t.tFinalized={},t.tAutolog=t.F,t.tBeforeEach=void 0,t.tAfterEach=void 0,t.addTest=(n,...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);let i={};e.length&&typeof e[e.length-1]=="object"&&!Array.isArray(e[e.length-1])&&(i=e.pop());const r=t.tests.length;return t.tests[r]={title:n,tests:e,hooks:i},{run:()=>{typeof i.before=="function"&&(t.tBeforeEach=i.before),typeof i.after=="function"&&(t.tAfterEach=i.after),t.runTest(r)},autorun:()=>{typeof i.before=="function"&&(t.tBeforeEach=i.before),typeof i.after=="function"&&(t.tAfterEach=i.after),t.runTest(r,!0)},testId:r}},t.updateLogs=()=>{for(let n=0;n<t.tests.length;n++)t.tLog[n]=t.tLog[testN]=sessionStorage.getItem(`oTest-Log-${testN}`)||"";return t.tLog},t.runTest=(n=0,e,i)=>{if(t.verify([[n,["number"]],[e,["boolean","undefined"]],[i,["boolean","undefined"]]]),!t.tests[n])return;i||(sessionStorage?.removeItem(`oTest-Log-${n}`),sessionStorage?.removeItem(`oTest-Res-${n}`),sessionStorage?.removeItem(`oTest-Status-${n}`)),sessionStorage?.setItem("oTest-Run",n),e?sessionStorage?.setItem("oTest-Autorun",e):sessionStorage?.removeItem("oTest-Autorun");const r=t.tests[n];let p=r.tests.pop();typeof p!="function"&&(r.tests.push(p),p=()=>{}),r.tests.push(L=>{p(L),sessionStorage.setItem("dddd",1),sessionStorage?.removeItem("oTest-Run"),e&&t.runTest(n+1,e)}),t.test(r.title,...r.tests)},t.tPre='<div style="font-family:monospace;text-align:left;">',t.tOk='<span style="background:#cfc;padding: 0 15px;">OK</span> ',t.tXx='<div style="background:#fcc;padding:3px;">',t.tDc="</div>",t.test=(n="",...e)=>{t.verify([[n,["notEmptyString"]],[e,["array"]]]);const i=sessionStorage?.getItem("oTest-Run"),r=i||t.tLog.length;let p=0,L="\u251C OK: ",x="\u251C \u2718 ",C=`
7
+ `,_=`
8
+ `,D="",R=e.length,v=0;const $=(O="",I=!1,m=!1)=>{t.tAutolog&&(I?console.error(O):(t.tShowOk||m)&&console.log(O))};let u={};if(typeof e[R-1]=="function"&&(t.tFns[r]=e[R-1],R--),R>0&&typeof e[R-1]=="object"&&!Array.isArray(e[R-1])&&(e[R-1].sync!==void 0||e[R-1].confirmOnFailure!==void 0)&&(u=e[R-1],R--),i){t.tLog[r]=sessionStorage.getItem(`oTest-Log-${r}`)||"",t.tRes[r]=sessionStorage.getItem(`oTest-Res-${r}`)||!1,t.tStatus[r]=JSON.parse(sessionStorage.getItem(`oTest-Status-${r}`)||"[]");for(let O=0;O<t.tStatus[r].length;O++){const I=t.tStatus[r][O];(I===!0||I===!1)&&v++}}t.tStyled&&(L=t.tPre+t.tOk,x=t.tPre+t.tXx,C=t.tDc,_=C+C),(!i||t.tLog[r].length===0)&&($("\u2552 "+n+" #"+r,!1,!0),t.tStyled?t.tLog[r]="<div><b>"+n+" #"+r+"</b></div>":t.tLog[r]="\u2552 "+n+" #"+r+`
9
+ `,t.tRes[r]=t.F,t.tStatus[r]=[]),t.tExpectedSteps[r]=R,t.tFinalized[r]=!1;const f=(O,I)=>new Promise(m=>{const s=t.overlay({innerHTML:`<div style="display:flex;flex-direction:column;gap:8px;"><div style="cursor:grab;">Step ${O+1} failed: ${I||"error"}. Continue testing?</div><div style="display:flex;gap:8px;"><button class="o-cf-continue" style="padding:6px 12px;background:#2563eb;color:#fff;border:none;border-radius:6px;cursor:pointer;">Continue</button><button class="o-cf-stop" style="padding:6px 12px;background:#dc2626;color:#fff;border:none;border-radius:6px;cursor:pointer;">Stop</button></div></div>`,timeout:u.confirmOnFailureTimeout||void 0,onClose:d=>m(d||{continue:!1}),excludeDragSelector:".o-cf-continue, .o-cf-stop"});s.first(".o-cf-continue").on("click",()=>{s._overlayCleanup(),m({continue:!0})}),s.first(".o-cf-stop").on("click",()=>{s._overlayCleanup(),m({continue:!1})})}),j=()=>{if(t.tFinalized[r])return;if(p>0){D="\u251C ",D+="DONE "+v+"/"+R+", waiting: "+p,$(D,!0),t.tStyled?t.tLog[r]+=t.tPre+'<div style="color:orange;"><b>DONE '+v+"/"+R+", waiting: "+p+"</b>"+t.tDc+t.tDc:t.tLog[r]+=D+`
10
+ `;return}t.tFinalized[r]=!0;const O=t.tStatus[r].some(I=>I===!1);t.tRes[r]=!O&&v===R,D="\u2558 ",D+="DONE "+v+"/"+R,$(D,v!==R),$(),t.tStyled?t.tLog[r]+=t.tPre+'<div style="color:'+(v!==R?"red":"green")+';"><b>DONE '+v+"/"+R+"</b>"+t.tDc+t.tDc:t.tLog[r]+=D+`
11
+ `,i&&(sessionStorage.setItem(`oTest-Log-${r}`,t.tLog[r]),sessionStorage.setItem(`oTest-Res-${r}`,t.tRes[r]),sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]))),typeof t.tFns[r]=="function"&&t.tFns[r](r)};if(u.sync||u.confirmOnFailure)return(async()=>{for(let O=t.tStatus[r].length;O<R;O++){const I={n:r,i:O,title:e[O][0],tShowOk:t.tShowOk,tStyled:t.tStyled};let m=e[O][1];if(typeof m>"u"){t.tStyled?t.tLog[r]+="<div>"+I.title+"</div>":t.tLog[r]+=I.title+`
12
+ `,$("\u251C "+I.title,!1,!0),t.tStatus[r][O]=!0,v++;continue}if(typeof t.tBeforeEach=="function"&&t.tBeforeEach(I),typeof m=="function")try{m=m(I)}catch(s){m=s.message,t.onError&&t.onError(s)}if(typeof t.tAfterEach=="function"&&t.tAfterEach(I,m),m&&typeof m.then=="function"){try{const s=await m,d=s===!0||s==null||s&&typeof s=="object"&&s.ok===!0,N=s&&s.errors&&s.errors.length?s.errors.join("; "):typeof s=="string"?s:"";if(t.testUpdate(I,d,d?"":N?": "+N:""),v++,!d&&u.confirmOnFailure&&!(await f(O,N)).continue)break}catch(s){if(t.testUpdate(I,!1,s.message||"Promise rejected"),u.confirmOnFailure&&!(await f(O,s.message||"Promise rejected")).continue)break}continue}if(typeof t.tStatus[r][O]>"u")t.tStatus[r][O]=typeof m=="string"?t.F:m;else{sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]));return}if(m===!0)v++,t.tShowOk&&(t.tLog[r]+=L+e[O][0]+C,$("\u251C OK: "+e[O][0]));else if(m!==t.U){if(t.tLog[r]+=x+e[O][0]+(m!==t.F?": "+m:"")+_,$("\u251C \u2718 "+e[O][0]+(m!==t.F?": "+m:""),!0),u.confirmOnFailure&&!(await f(O,typeof m=="string"?m:"")).continue)break}else{p++,setTimeout(s=>{s.title+=" (timeout)",t.testUpdate(s)},t.tTime,I);return}}j()})(),r;for(let O=t.tStatus[r].length;O<R;O++){const I={n:r,i:O,title:e[O][0],tShowOk:t.tShowOk,tStyled:t.tStyled};let m=e[O][1];if(typeof m>"u"){t.tStyled?t.tLog[r]+="<div>"+I.title+"</div>":t.tLog[r]+=I.title+`
13
+ `,$("\u251C "+I.title,!1,!0),t.tStatus[r][O]=!0,v++;continue}if(typeof t.tBeforeEach=="function"&&t.tBeforeEach(I),typeof m=="function")try{m=m(I)}catch(s){m=s.message,t.onError&&t.onError(s)}if(typeof t.tAfterEach=="function"&&t.tAfterEach(I,m),m&&typeof m.then=="function"){p++;const s=setTimeout(()=>{I.title+=" (timeout)",t.testUpdate(I)},t.tTime);m.then(d=>{clearTimeout(s);const N=d===!0||d&&d.ok===!0,g=d&&d.errors&&d.errors.length?d.errors.join("; "):typeof d=="string"?d:"";t.testUpdate(I,N,N?"":g?": "+g:"")}).catch(d=>{clearTimeout(s),t.testUpdate(I,!1,d.message||"Promise rejected")});continue}if(typeof t.tStatus[r][O]>"u")t.tStatus[r][O]=typeof m=="string"?t.F:m;else{sessionStorage.setItem(`oTest-Status-${r}`,JSON.stringify(t.tStatus[r]));return}m===!0?(v++,t.tShowOk&&(t.tLog[r]+=L+e[O][0]+C,$("\u251C OK: "+e[O][0]))):m!==t.U?(t.tLog[r]+=x+e[O][0]+(m!==t.F?": "+m:"")+_,$("\u251C \u2718 "+e[O][0]+(m!==t.F?": "+m:""),!0)):(p++,setTimeout(s=>{s.title+=" (timeout)",t.testUpdate(s)},t.tTime,I))}return j(),r},t.testUpdate=(n,e=t.F,i="")=>{t.verify([[n,["object"]],[e,["boolean","string"]],[i,["string"]]]);let r="";const p=n.n,L=(x="",C=!1)=>{t.tAutolog&&(C?console.error(x):console.log(x))};if(t.tStatus[p][n.i]===t.U||t.tStatus[p][n.i]===null){t.tStatus[p][n.i]=e===!0,e===!0?n.tShowOk&&(r="\u251C OK: "+n.title+i,L(r),n.tStyled?t.tLog[p]+=t.tPre+t.tOk+n.title+i+t.tDc:t.tLog[p]+=r+`
14
14
  `):(t.tRes[p]=t.F,r="\u251C \u2718 "+n.title+(e?": "+e:"")+i,L(r,!0),n.tStyled?t.tLog[p]+=t.tPre+t.tXx+n.title+i+(e?": "+e:"")+t.tDc+t.tDc:t.tLog[p]+=r+`
15
- `);let g=0,k=0;for(const R of t.tStatus[p]){if(R===t.U||R===null)return;R||g++,k++}const m=t.tests[p]?.tests?.length??t.tExpectedSteps[p]??Number.MAX_SAFE_INTEGER;if(k<m){sessionStorage?.getItem("oTest-Run")===p&&(sessionStorage.setItem(`oTest-Log-${p}`,t.tLog[p]),sessionStorage.setItem(`oTest-Res-${p}`,t.tRes[p]),sessionStorage.setItem(`oTest-Status-${p}`,JSON.stringify(t.tStatus[p])));return}if(t.tFinalized[p])return;t.tFinalized[p]=!0,sessionStorage?.getItem("oTest-Run")===p&&(sessionStorage.setItem(`oTest-Log-${p}`,t.tLog[p]),sessionStorage.setItem(`oTest-Res-${p}`,t.tRes[p]),sessionStorage.setItem(`oTest-Status-${p}`,JSON.stringify(t.tStatus[p]))),t.tRes[p]=!g,r=g?"FAILED "+g+"/"+k:"DONE "+k+"/"+k,L("\u2558 "+r,!!g),L(),n.tStyled?t.tLog[p]+=t.tPre+'<b style="color:'+(g?"red":"green")+';">'+r+"</b>"+t.tDc:t.tLog[p]+="\u2558 "+r+`
16
- `,typeof t.tFns[p]=="function"&&t.tFns[p](p)}},sessionStorage?.getItem("oTest-Run")&&window?.addEventListener("load",()=>{t.runTest(sessionStorage?.getItem("oTest-Run"),sessionStorage?.getItem("oTest-Autorun")||t.F,!0)},!1),t.measure=n=>{if(!n)return{};const e=n.getBoundingClientRect(),i=window.getComputedStyle(n);return{width:e.width,height:e.height,top:e.top,left:e.left,visible:i.display!=="none"&&i.visibility!=="hidden"&&e.width>0,opacity:i.opacity,zIndex:i.zIndex}},t.assertVisible=n=>!!t.measure(n).visible,t.assertSize=(n,e={})=>{if(!n)return"element is null";const i=t.measure(n);if(e.w!==void 0&&Math.round(i.width)!==e.w)return`width: expected ${e.w}, got ${Math.round(i.width)}`;if(e.h!==void 0&&Math.round(i.height)!==e.h)return`height: expected ${e.h}, got ${Math.round(i.height)}`;const r=p=>{const L=window.getComputedStyle(n).getPropertyValue(p);return L?parseFloat(L):0};return e.padding!==void 0&&r("padding-top")!==e.padding?`padding: expected ${e.padding}, got ${r("padding-top")}`:e.paddingTop!==void 0&&r("padding-top")!==e.paddingTop?`paddingTop: expected ${e.paddingTop}, got ${r("padding-top")}`:e.paddingRight!==void 0&&r("padding-right")!==e.paddingRight?`paddingRight: expected ${e.paddingRight}, got ${r("padding-right")}`:e.paddingBottom!==void 0&&r("padding-bottom")!==e.paddingBottom?`paddingBottom: expected ${e.paddingBottom}, got ${r("padding-bottom")}`:e.paddingLeft!==void 0&&r("padding-left")!==e.paddingLeft?`paddingLeft: expected ${e.paddingLeft}, got ${r("padding-left")}`:e.margin!==void 0&&r("margin-top")!==e.margin?`margin: expected ${e.margin}, got ${r("margin-top")}`:e.marginTop!==void 0&&r("margin-top")!==e.marginTop?`marginTop: expected ${e.marginTop}, got ${r("margin-top")}`:e.marginRight!==void 0&&r("margin-right")!==e.marginRight?`marginRight: expected ${e.marginRight}, got ${r("margin-right")}`:e.marginBottom!==void 0&&r("margin-bottom")!==e.marginBottom?`marginBottom: expected ${e.marginBottom}, got ${r("margin-bottom")}`:e.marginLeft!==void 0&&r("margin-left")!==e.marginLeft?`marginLeft: expected ${e.marginLeft}, got ${r("margin-left")}`:!0},t.recorder={active:!1,actions:[],mocks:{},initialData:{},assertions:[],observeRoot:null,_originalFetch:null,_listeners:[],_observer:null},t.recordingAssertionDebug=!1,t.startRecording=(n,e,i)=>{if(t.recorder.active)return;const r=["click","mouseover","scroll","input","change","submit","keydown","focus","blur"],p={click:100,mouseover:50,scroll:30,input:50,change:50,submit:100,keydown:50,focus:50,blur:50},L=e||r,g=Object.assign({},p,i||{}),k={scroll:30,mouseover:50,keydown:50,focus:50,blur:50},m=t.recorder;m.active=!0,m.actions=[],m.mocks={},m.stepDelays=g,m.initialData={url:window.location.href,timestamp:Date.now()},m.observeRoot=n||null,m.assertions=[],m.removedElements=[],t.inits.forEach((l,T)=>{l?.store&&(m.initialData["init_"+T]=JSON.parse(JSON.stringify(l.store)))}),m._originalFetch=window.fetch,window.fetch=async(l,T={})=>{const o=(T.method||"GET").toUpperCase();let c;try{c=T.body?JSON.parse(T.body):void 0}catch{c=T.body}const f=await m._originalFetch(l,T),a=f.clone();let u;try{u=await a.json()}catch{u=await a.text().catch(()=>null)}const D=o+":"+l;return m.mocks[D]={url:l,method:o,request:c,response:u,status:f.status},f},m._originalXHROpen=XMLHttpRequest.prototype.open,m._originalXHRSend=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=function(l,T){return this._oMethod=(l||"GET").toUpperCase(),this._oUrl=T,m._originalXHROpen.apply(this,arguments)},XMLHttpRequest.prototype.send=function(l){const T=()=>{if(this.readyState!==4)return;let o;try{o=l?JSON.parse(l):void 0}catch{o=l}let c;try{const a=this.responseText;c=a?JSON.parse(a):null}catch{c=this.responseText??null}const f=(this._oMethod||"GET")+":"+(this._oUrl||"");m.mocks[f]={url:this._oUrl,method:this._oMethod,request:o,response:c,status:this.status}};return this.addEventListener("readystatechange",T),m._originalXHRSend.apply(this,arguments)},m.websocketEvents=[],m._originalWebSocket=window.WebSocket,window.WebSocket=function(l,T){const o=new m._originalWebSocket(l,T),c=m.websocketEvents.length;m.websocketEvents.push({url:typeof l=="string"?l:String(l),protocol:Array.isArray(T)?T[0]:T,open:!0,messages:[]}),o.addEventListener("message",a=>{const u=typeof a.data=="string"?a.data:String(a.data);m.websocketEvents[c].messages.push({dir:"in",data:u})}),o.addEventListener("close",()=>{m.websocketEvents[c].open=!1});const f=o.send.bind(o);return o.send=function(a){const u=typeof a=="string"?a:String(a);return m.websocketEvents[c].messages.push({dir:"out",data:u}),f(a)},o};const R={"data-o-init":1,"data-o-init-i":1,"data-o-state":1},b=(l,T)=>{if(t.D.querySelectorAll(l).length<=1)return l;let o=T;for(;o&&o!==t.D.body;){let c=o.id?"#"+o.id:null;if(!c&&o.attributes){const f=t.autotag?"data-"+t.autotag:null;if(f){const a=o.getAttribute(f);a!=null&&(c=`[${f}="${a}"]`)}if(!c){for(const a of o.attributes)if(a.name.startsWith("data-")&&!R[a.name]){c=`[${a.name}="${a.value}"]`;break}}}if(c){const f=c+" "+l;if(t.D.querySelectorAll(f).length===1)return f}o=o.parentElement}return l},h=l=>{if(!l||l.nodeType!==1)return"";let T="";if(l.dataset){const o=t.autotag&&l.dataset[t.autotag];o&&(T=b(`[data-${t.autotag}="${o}"]`,l.parentElement))}if(!T&&l.tagName){const o=l.id?"#"+l.id:l.className?l.tagName.toLowerCase()+"."+[...l.classList].join("."):l.tagName.toLowerCase();T=l.id?o:b(o,l.parentElement)}return T},v=n&&t.D.querySelector(n)||t.D.body;m._observer=new MutationObserver(l=>{const T=m.actions.length-1;if(T<0)return;const o=m.actions[T];t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] MutationObserver batch:",{actionIdx:T,lastAction:o?{type:o.type,target:o.target}:null,mutationTypes:l.map(c=>c.type),addedCount:l.reduce((c,f)=>c+(f.addedNodes?.length||0),0),removedCount:l.reduce((c,f)=>c+(f.removedNodes?.length||0),0)}),l.forEach(c=>{const f=(a,u)=>{let D,w;if(a&&v&&v.querySelectorAll(a).length>1){let S=u;for(;S&&S!==v&&S.nodeType===1;){const A=t.autotag&&S.dataset&&S.dataset[t.autotag];if(A){const y=`[data-${t.autotag}="${A}"]`,N=v.querySelectorAll(y);if(N.length>1){const q=[...N].indexOf(S);if(q!==-1){D=y,w=q;break}}}S=S.parentElement}}return{listSelector:D,index:w}};if(c.type==="childList"&&(c.addedNodes.forEach(a=>{if(a.nodeType!==1||!a.offsetParent)return;const u=h(a);if(!u||m.assertions.some(A=>A.actionIdx===T&&A.selector===u&&A.type==="visible"))return;const D=(a.textContent?.trim()||"").slice(0,80)||void 0,{listSelector:w,index:$}=f(u,a),S={actionIdx:T,type:"visible",selector:u,text:D};w!=null&&(S.listSelector=w),$!=null&&(S.index=$),m.assertions.push(S),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +visible assertion:",{actionIdx:T,lastAction:o?.type+" "+o?.target,selector:u,text:(D||"").slice(0,40),index:$,listSelector:w})}),c.removedNodes.forEach(a=>{if(a.nodeType!==1)return;const u=h(a);if(!u)return;const D=(a.textContent?.trim()||"").slice(0,80)||void 0,w=c.target;let $;a.previousSibling?$=Array.from(w.children).indexOf(a.previousSibling)+1:a.nextSibling?$=Array.from(w.children).indexOf(a.nextSibling):$=0;let S;if(t.autotag&&a.dataset?.[t.autotag]){const y=a.dataset[t.autotag];S=`[data-${t.autotag}="${y}"]`}const A={actionIdx:T,type:"removed",selector:u,text:D};S&&(A.listSelector=S),A.index=$,m.removedElements.push(A),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +removed element:",{actionIdx:T,lastAction:o?.type+" "+o?.target,selector:u,text:(D||"").slice(0,40),index:$,listSelector:S})})),c.type==="attributes"){const a=c.attributeName;if(!a)return;const u=h(c.target);if(!u)return;const w={class:"class",style:"style",hidden:"hidden",disabled:"disabled","aria-expanded":"aria-expanded","aria-checked":"aria-checked"}[a];if(!w||m.assertions.some(q=>q.actionIdx===T&&q.selector===u&&q.type===w))return;const{listSelector:$,index:S}=f(u,c.target),A=c.target;let y;w==="class"?y=A.className:w==="style"?y=A.style?.cssText||A.getAttribute("style")||"":w==="hidden"?y=A.hidden:w==="disabled"?y=A.disabled===!0:w==="aria-expanded"?y=A.getAttribute("aria-expanded"):w==="aria-checked"&&(y=A.getAttribute("aria-checked"));const N={actionIdx:T,type:w,selector:u};w==="class"?N.className=y:w==="style"?N.style=y:w==="hidden"?N.hidden=y:w==="disabled"?N.disabled=y:w==="aria-expanded"?N.ariaExpanded=y:w==="aria-checked"&&(N.ariaChecked=y),$!=null&&(N.listSelector=$),S!=null&&(N.index=S),m.assertions.push(N),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +attr assertion:",{actionIdx:T,lastAction:o?.type+" "+o?.target,selector:u,type:w,value:y,index:S,listSelector:$})}})}),m._observer.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","disabled","aria-expanded","aria-checked"]});const I={};L.forEach(l=>{const T=o=>{const c=o.target;if(n&&v&&c?.nodeType===1&&!v.contains(c))return;let f="";if(c?.dataset){const j=t.autotag&&c.dataset[t.autotag];j&&(f=b(`[data-${t.autotag}="${j}"]`,c.parentElement))}if(!f&&c?.tagName){const j=c.id?"#"+c.id:c.className?c.tagName.toLowerCase()+"."+[...c.classList].join("."):c.tagName.toLowerCase();f=c.id?j:b(j,c.parentElement)}let a,u;if(f&&v&&v.querySelectorAll(f).length>1){let P=c;for(;P&&P!==v&&P.nodeType===1;){const X=t.autotag&&P.dataset&&P.dataset[t.autotag];if(X){const W=`[data-${t.autotag}="${X}"]`,s=v.querySelectorAll(W);if(s.length>1){const d=[...s].indexOf(P);if(d!==-1){a=W,u=d;break}}}P=P.parentElement}}const D=c?.tagName?c.tagName.toLowerCase()+(c.type?":"+c.type:""):void 0,w=l==="scroll"?window.scrollY:void 0,$=l==="input"||l==="change"?c?.value:void 0,S=l==="change"&&(c?.type==="checkbox"||c?.type==="radio")?c?.checked:void 0,A=l==="keydown"?c?.key:void 0,y=l==="keydown"?c?.code:void 0,N=l==="click"||l==="change"||l==="submit"?0:g[l]!==void 0?g[l]:k[l]??0,q=()=>{if((l==="blur"||l==="focus")&&f){const P=m.actions.length-1,X=P>=0?m.actions[P]:null;if(X){if(X.target===f&&X.listSelector==null==(a==null)&&X.targetIndex==null==(u==null)&&(X.targetIndex==null||X.targetIndex===u))return;for(const s of m.removedElements)if(s.actionIdx===P&&(s.selector===f||f.startsWith(s.selector+" ")||f.startsWith(s.selector+">")))return}}const j={type:l,target:f,time:Date.now()};D&&(j.targetType=D),w!==void 0&&(j.scrollY=w),$!==void 0&&(j.value=$),S!==void 0&&(j.checked=S),A!==void 0&&(j.key=A),y!==void 0&&(j.code=y),a!=null&&(j.listSelector=a),u!=null&&(j.targetIndex=u),m.actions.push(j)};N===0?q():(clearTimeout(I[l]),I[l]=setTimeout(q,N))};t.D.addEventListener(l,T,!0),m._listeners.push({ev:l,handler:T})})},t.stopRecording=()=>{const n=t.recorder;return n.active=!1,n._originalFetch&&(window.fetch=n._originalFetch,n._originalFetch=null),n._originalXHROpen&&(XMLHttpRequest.prototype.open=n._originalXHROpen,XMLHttpRequest.prototype.send=n._originalXHRSend,n._originalXHROpen=null,n._originalXHRSend=null),n._originalWebSocket&&(window.WebSocket=n._originalWebSocket,n._originalWebSocket=null),n._listeners.forEach(({ev:e,handler:i})=>{t.D.removeEventListener(e,i,!0)}),n._listeners=[],n._observer&&(n._observer.disconnect(),n._observer=null),{actions:[...n.actions],mocks:{...n.mocks},initialData:{...n.initialData},stepDelays:{...n.stepDelays},assertions:[...n.assertions||[]],removedElements:[...n.removedElements||[]],observeRoot:n.observeRoot||null,websocketEvents:[...n.websocketEvents||[]]}},t.clearRecording=n=>{if(n!==void 0)sessionStorage?.removeItem("oTest-Recording-"+n);else for(let e=sessionStorage?.length-1;e>=0;e--){const i=sessionStorage?.key(e);i&&i.indexOf("oTest-Recording-")===0&&sessionStorage?.removeItem(i)}},t.runRecordingAssertions=(n,e,i,r)=>{const p=r&&r.assertions,L=p??(n.assertions||[]).filter(o=>i==null||o.actionIdx===i);t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[runRecordingAssertions] run:",{actionIdx:i,scope:i==null?"teardown (all)":"per-action",assertionsCount:L.length,assertions:L.map(o=>({actionIdx:o.actionIdx,type:o.type,selector:o.selector,index:o.index,text:(o.text||"").slice(0,40)}))});const g=new Set,k=L.filter(o=>{const c=`${o.selector}|${o.type}|${o.actionIdx}|${o.index??""}`;return g.has(c)?!1:(g.add(c),!0)}),R=(()=>{if(e!=null)return typeof e=="string"?t.D.querySelector(e)||t.D.body:e;const o=n.observeRoot;return o&&t.D.querySelector(o)||t.D.body})(),b=o=>(o||"").trim().replace(/\s+/g," "),h=o=>o?b(o.textContent||""):"",v=r?.removedElements||[],I=o=>{if(!v.length||i==null)return!1;const c=b(o.text||"");for(const f of v)if(!(f.actionIdx>i)&&b(f.text||"")===c&&f.selector===o.selector&&!(o.listSelector!=null&&f.listSelector!==o.listSelector)&&!(o.index!=null&&f.index!==o.index))return!0;return!1};let l=0;const T=[];for(const o of k){if(I(o)){l+=1,t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[runRecordingAssertions] skip (explicit removed):",{actionIdx:o.actionIdx,selector:o.selector,text:(o.text||"").slice(0,40)});continue}let c=null,f=!1;if(o.listSelector!=null&&o.index!=null){const a=R.querySelectorAll(o.listSelector),u=b(o.text||""),D=$=>{const S=a[$];return S?(o.selector!==o.listSelector?S.querySelector(o.selector):S)||(o.selector!==o.listSelector?S:null):null};let w=a[o.index];if(!w&&o.index>0&&(w=a[o.index-1]),w){if(c=D(o.index)||(o.index>0?D(o.index-1):null),!c&&o.selector!==o.listSelector&&(c=w),o.type==="visible"&&u&&c){const $=h(c);if($.indexOf(u)===-1&&u.indexOf($)===-1)for(let A=0;A<a.length;A++){const y=D(A);if(y&&h(y).indexOf(u)!==-1){c=y,w=a[A];break}}}}else f=!0}else{const a=R.querySelectorAll(o.selector);c=a.length>0?a[0]:t.D.querySelector(o.selector)}if(o.type==="visible"){const a=c&&c.nodeType===1&&(c.offsetParent!==null||c.getBoundingClientRect&&c.getBoundingClientRect().width>0),u=b(o.text||""),D=h(c),w=D,$=!u||D.indexOf(u)!==-1||w.indexOf(u)!==-1||u.length>0&&u.indexOf(D)!==-1;if(a&&$)l+=1;else{const S=f?`index out of bounds (list has ${R.querySelectorAll(o.listSelector||o.selector).length} items, assertion expected index ${o.index})`:c?a?$?"fail":"text mismatch":"not visible":"element not found";T.push({selector:o.selector,message:S}),typeof console<"u"&&console.warn&&console.warn("[runRecordingAssertions] visible failed:",{actionIdx:o.actionIdx,selector:o.selector,listSelector:o.listSelector,index:o.index,expectedText:o.text||"(any)",actualText:D.slice(0,80),message:S})}}else if(o.type==="class"){const a=(o.className||"").trim().split(/\s+/).filter(Boolean);if(c&&(a.length===0||a.every(D=>c.classList?.contains(D))))l+=1;else{const D=f?`index out of bounds (list has ${R.querySelectorAll(o.listSelector).length} items, expected index ${o.index})`:c?`expected class "${o.className}"`:"element not found";T.push({selector:o.selector,message:D}),typeof console<"u"&&console.warn&&console.warn("[runRecordingAssertions] failed:",{type:o.type,selector:o.selector,actionIdx:o.actionIdx,listSelector:o.listSelector,index:o.index,itemsInRoot:o.listSelector?R.querySelectorAll(o.listSelector).length:"-",message:D})}}else if(o.type==="style"){const a=(o.style||"").trim(),u=(c?.style?.cssText||c?.getAttribute?.("style")||"").trim();if(c&&(!a||u.indexOf(a)!==-1||a===u))l+=1;else{const w=c?`expected style "${a.slice(0,60)}..."`:"element not found";T.push({selector:o.selector,message:w})}}else if(o.type==="hidden")if(c&&c.hidden===o.hidden)l+=1;else{const u=c?`expected hidden=${o.hidden}`:"element not found";T.push({selector:o.selector,message:u})}else if(o.type==="disabled")if(c&&c.disabled===o.disabled)l+=1;else{const u=c?`expected disabled=${o.disabled}`:"element not found";T.push({selector:o.selector,message:u})}else if(o.type==="aria-expanded"){const a=c?.getAttribute?.("aria-expanded");if(c&&(o.ariaExpanded==null||String(a)===String(o.ariaExpanded)))l+=1;else{const D=c?`expected aria-expanded="${o.ariaExpanded}"`:"element not found";T.push({selector:o.selector,message:D})}}else if(o.type==="aria-checked"){const a=c?.getAttribute?.("aria-checked");if(c&&(o.ariaChecked==null||String(a)===String(o.ariaChecked)))l+=1;else{const D=c?`expected aria-checked="${o.ariaChecked}"`:"element not found";T.push({selector:o.selector,message:D})}}}return{passed:l,total:k.length,failures:T}},t.exportTest=(n,e={})=>{const i=e.delay!==void 0?e.delay:16,r={actions:n.actions,assertions:n.assertions||[],observeRoot:n.observeRoot||null},p=n.observeRoot?`(o.D.querySelector('${n.observeRoot.replace(/'/g,"\\'")}') || o.D.body)`:"o.D.body",L=b=>{if(b.listSelector!=null&&b.targetIndex!=null){const h=JSON.stringify(b.listSelector),v=b.target===b.listSelector,I=v?h:JSON.stringify(b.target);return` const items = o.D.querySelectorAll(${h});
17
- const item = items[${b.targetIndex}];
15
+ `);let x=0,C=0;for(const D of t.tStatus[p]){if(D===t.U||D===null)return;D||x++,C++}const _=t.tests[p]?.tests?.length??t.tExpectedSteps[p]??Number.MAX_SAFE_INTEGER;if(C<_){sessionStorage?.getItem("oTest-Run")===p&&(sessionStorage.setItem(`oTest-Log-${p}`,t.tLog[p]),sessionStorage.setItem(`oTest-Res-${p}`,t.tRes[p]),sessionStorage.setItem(`oTest-Status-${p}`,JSON.stringify(t.tStatus[p])));return}if(t.tFinalized[p])return;t.tFinalized[p]=!0,sessionStorage?.getItem("oTest-Run")===p&&(sessionStorage.setItem(`oTest-Log-${p}`,t.tLog[p]),sessionStorage.setItem(`oTest-Res-${p}`,t.tRes[p]),sessionStorage.setItem(`oTest-Status-${p}`,JSON.stringify(t.tStatus[p]))),t.tRes[p]=!x,r=x?"FAILED "+x+"/"+C:"DONE "+C+"/"+C,L("\u2558 "+r,!!x),L(),n.tStyled?t.tLog[p]+=t.tPre+'<b style="color:'+(x?"red":"green")+';">'+r+"</b>"+t.tDc:t.tLog[p]+="\u2558 "+r+`
16
+ `,typeof t.tFns[p]=="function"&&t.tFns[p](p)}},sessionStorage?.getItem("oTest-Run")&&window?.addEventListener("load",()=>{t.runTest(sessionStorage?.getItem("oTest-Run"),sessionStorage?.getItem("oTest-Autorun")||t.F,!0)},!1),t.measure=n=>{if(!n)return{};const e=n.getBoundingClientRect(),i=window.getComputedStyle(n);return{width:e.width,height:e.height,top:e.top,left:e.left,visible:i.display!=="none"&&i.visibility!=="hidden"&&e.width>0,opacity:i.opacity,zIndex:i.zIndex}},t.assertVisible=n=>!!t.measure(n).visible,t.assertSize=(n,e={})=>{if(!n)return"element is null";const i=t.measure(n);if(e.w!==void 0&&Math.round(i.width)!==e.w)return`width: expected ${e.w}, got ${Math.round(i.width)}`;if(e.h!==void 0&&Math.round(i.height)!==e.h)return`height: expected ${e.h}, got ${Math.round(i.height)}`;const r=p=>{const L=window.getComputedStyle(n).getPropertyValue(p);return L?parseFloat(L):0};return e.padding!==void 0&&r("padding-top")!==e.padding?`padding: expected ${e.padding}, got ${r("padding-top")}`:e.paddingTop!==void 0&&r("padding-top")!==e.paddingTop?`paddingTop: expected ${e.paddingTop}, got ${r("padding-top")}`:e.paddingRight!==void 0&&r("padding-right")!==e.paddingRight?`paddingRight: expected ${e.paddingRight}, got ${r("padding-right")}`:e.paddingBottom!==void 0&&r("padding-bottom")!==e.paddingBottom?`paddingBottom: expected ${e.paddingBottom}, got ${r("padding-bottom")}`:e.paddingLeft!==void 0&&r("padding-left")!==e.paddingLeft?`paddingLeft: expected ${e.paddingLeft}, got ${r("padding-left")}`:e.margin!==void 0&&r("margin-top")!==e.margin?`margin: expected ${e.margin}, got ${r("margin-top")}`:e.marginTop!==void 0&&r("margin-top")!==e.marginTop?`marginTop: expected ${e.marginTop}, got ${r("margin-top")}`:e.marginRight!==void 0&&r("margin-right")!==e.marginRight?`marginRight: expected ${e.marginRight}, got ${r("margin-right")}`:e.marginBottom!==void 0&&r("margin-bottom")!==e.marginBottom?`marginBottom: expected ${e.marginBottom}, got ${r("margin-bottom")}`:e.marginLeft!==void 0&&r("margin-left")!==e.marginLeft?`marginLeft: expected ${e.marginLeft}, got ${r("margin-left")}`:!0},t.recorder={active:!1,actions:[],mocks:{},initialData:{},assertions:[],observeRoot:null,strictCapture:null,_originalFetch:null,_listeners:[],_observer:null},t.recordingAssertionDebug=!1,t.startRecording=(n,e,i)=>{if(t.recorder.active)return;let r,p,L,x=null;if(n!=null&&typeof n=="object"&&!Array.isArray(n)&&(t.C(n,"observe")||t.C(n,"events")||t.C(n,"timeouts")||t.C(n,"strictCaptureAssertions")||t.C(n,"strictCaptureNetwork")||t.C(n,"strictCaptureWebSocket"))){const s=n;r=s.observe!=null?String(s.observe):void 0,p=s.events,L=s.timeouts,(t.C(s,"strictCaptureAssertions")||t.C(s,"strictCaptureNetwork")||t.C(s,"strictCaptureWebSocket"))&&(x={assertions:!!s.strictCaptureAssertions,network:!!s.strictCaptureNetwork,websocket:!!s.strictCaptureWebSocket})}else r=typeof n=="string"?n:void 0,p=e,L=i;const _=["click","mouseover","scroll","input","change","submit","keydown","focus","blur"],D={click:100,mouseover:50,scroll:30,input:50,change:50,submit:100,keydown:50,focus:50,blur:50},R=p||_,v=Object.assign({},D,L||{}),$={scroll:30,mouseover:50,keydown:50,focus:50,blur:50},u=t.recorder;u.active=!0,u.actions=[],u.mocks={},u.stepDelays=v,u.initialData={url:window.location.href,timestamp:Date.now()},u.strictCapture=x,u.observeRoot=r||null,u.assertions=[],u.removedElements=[],t.inits.forEach((s,d)=>{s?.store&&(u.initialData["init_"+d]=JSON.parse(JSON.stringify(s.store)))}),u._originalFetch=window.fetch,window.fetch=async(s,d={})=>{const N=(d.method||"GET").toUpperCase();let g;try{g=d.body?JSON.parse(d.body):void 0}catch{g=d.body}const y=await u._originalFetch(s,d),E=y.clone();let S;try{S=await E.json()}catch{S=await E.text().catch(()=>null)}const w=N+":"+s;return u.mocks[w]={url:s,method:N,request:g,response:S,status:y.status},y},u._originalXHROpen=XMLHttpRequest.prototype.open,u._originalXHRSend=XMLHttpRequest.prototype.send,XMLHttpRequest.prototype.open=function(s,d){return this._oMethod=(s||"GET").toUpperCase(),this._oUrl=d,u._originalXHROpen.apply(this,arguments)},XMLHttpRequest.prototype.send=function(s){const d=()=>{if(this.readyState!==4)return;let N;try{N=s?JSON.parse(s):void 0}catch{N=s}let g;try{const E=this.responseText;g=E?JSON.parse(E):null}catch{g=this.responseText??null}const y=(this._oMethod||"GET")+":"+(this._oUrl||"");u.mocks[y]={url:this._oUrl,method:this._oMethod,request:N,response:g,status:this.status}};return this.addEventListener("readystatechange",d),u._originalXHRSend.apply(this,arguments)},u.websocketEvents=[],u._originalWebSocket=window.WebSocket,window.WebSocket=function(s,d){const N=new u._originalWebSocket(s,d),g=u.websocketEvents.length;u.websocketEvents.push({url:typeof s=="string"?s:String(s),protocol:Array.isArray(d)?d[0]:d,open:!0,messages:[]}),N.addEventListener("message",E=>{const S=typeof E.data=="string"?E.data:String(E.data);u.websocketEvents[g].messages.push({dir:"in",data:S})}),N.addEventListener("close",()=>{u.websocketEvents[g].open=!1});const y=N.send.bind(N);return N.send=function(E){const S=typeof E=="string"?E:String(E);return u.websocketEvents[g].messages.push({dir:"out",data:S}),y(E)},N};const f={"data-o-init":1,"data-o-init-i":1,"data-o-state":1},j=(s,d)=>{if(t.D.querySelectorAll(s).length<=1)return s;let N=d;for(;N&&N!==t.D.body;){let g=N.id?"#"+N.id:null;if(!g&&N.attributes){const y=t.autotag?"data-"+t.autotag:null;if(y){const E=N.getAttribute(y);E!=null&&(g=`[${y}="${E}"]`)}if(!g){for(const E of N.attributes)if(E.name.startsWith("data-")&&!f[E.name]){g=`[${E.name}="${E.value}"]`;break}}}if(g){const y=g+" "+s;if(t.D.querySelectorAll(y).length===1)return y}N=N.parentElement}return s},O=s=>{if(!s||s.nodeType!==1)return"";let d="";if(s.dataset){const N=t.autotag&&s.dataset[t.autotag];N&&(d=j(`[data-${t.autotag}="${N}"]`,s.parentElement))}if(!d&&s.tagName){const N=s.id?"#"+s.id:s.className?s.tagName.toLowerCase()+"."+[...s.classList].join("."):s.tagName.toLowerCase();d=s.id?N:j(N,s.parentElement)}return d},I=r&&t.D.querySelector(r)||t.D.body;u._observer=new MutationObserver(s=>{const d=u.actions.length-1;if(d<0)return;const N=u.actions[d];t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] MutationObserver batch:",{actionIdx:d,lastAction:N?{type:N.type,target:N.target}:null,mutationTypes:s.map(g=>g.type),addedCount:s.reduce((g,y)=>g+(y.addedNodes?.length||0),0),removedCount:s.reduce((g,y)=>g+(y.removedNodes?.length||0),0)}),s.forEach(g=>{const y=(E,S)=>{let w,A;if(E&&I){const B=I.querySelectorAll(E);if(B.length>1){const q=[...B].indexOf(S);if(q!==-1)w=E,A=q;else{let F=S;for(;F&&F!==I&&F.nodeType===1;){const P=t.autotag&&F.dataset&&F.dataset[t.autotag];if(P){const G=`[data-${t.autotag}="${P}"]`,o=I.querySelectorAll(G);if(o.length>1){const a=[...o].indexOf(F);if(a!==-1){w=G,A=a;break}}}F=F.parentElement}}}}return{listSelector:w,index:A}};if(g.type==="childList"&&(g.addedNodes.forEach(E=>{if(E.nodeType!==1||!E.offsetParent)return;const S=O(E);if(!S||u.assertions.some(F=>F.actionIdx===d&&F.selector===S&&F.type==="visible"))return;const w=(E.textContent?.trim()||"").slice(0,80)||void 0,{listSelector:A,index:B}=y(S,E),q={actionIdx:d,type:"visible",selector:S,text:w};A!=null&&(q.listSelector=A),B!=null&&(q.index=B),u.assertions.push(q),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +visible assertion:",{actionIdx:d,lastAction:N?.type+" "+N?.target,selector:S,text:(w||"").slice(0,40),index:B,listSelector:A})}),g.removedNodes.forEach(E=>{if(E.nodeType!==1)return;const S=O(E);if(!S)return;const w=(E.textContent?.trim()||"").slice(0,80)||void 0,A=g.target;let B;E.previousSibling?B=Array.from(A.children).indexOf(E.previousSibling)+1:E.nextSibling?B=Array.from(A.children).indexOf(E.nextSibling):B=0;let q;if(t.autotag&&E.dataset?.[t.autotag]){const P=E.dataset[t.autotag];q=`[data-${t.autotag}="${P}"]`}const F={actionIdx:d,type:"removed",selector:S,text:w};q&&(F.listSelector=q),F.index=B,u.removedElements.push(F),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +removed element:",{actionIdx:d,lastAction:N?.type+" "+N?.target,selector:S,text:(w||"").slice(0,40),index:B,listSelector:q})})),g.type==="attributes"){const E=g.attributeName;if(!E)return;const S=O(g.target);if(!S)return;const A={class:"class",style:"style",hidden:"hidden",disabled:"disabled","aria-expanded":"aria-expanded","aria-checked":"aria-checked"}[E];if(!A||u.assertions.some(o=>o.actionIdx===d&&o.selector===S&&o.type===A))return;const{listSelector:B,index:q}=y(S,g.target),F=g.target;let P;A==="class"?P=F.className:A==="style"?P=F.style?.cssText||F.getAttribute("style")||"":A==="hidden"?P=F.hidden:A==="disabled"?P=F.disabled===!0:A==="aria-expanded"?P=F.getAttribute("aria-expanded"):A==="aria-checked"&&(P=F.getAttribute("aria-checked"));const G={actionIdx:d,type:A,selector:S};A==="class"?G.className=P:A==="style"?G.style=P:A==="hidden"?G.hidden=P:A==="disabled"?G.disabled=P:A==="aria-expanded"?G.ariaExpanded=P:A==="aria-checked"&&(G.ariaChecked=P),B!=null&&(G.listSelector=B),q!=null&&(G.index=q),u.assertions.push(G),t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[recording] +attr assertion:",{actionIdx:d,lastAction:N?.type+" "+N?.target,selector:S,type:A,value:P,index:q,listSelector:B})}})}),u._observer.observe(I,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden","disabled","aria-expanded","aria-checked"]});const m={};R.forEach(s=>{const d=N=>{const g=N.target;if(r&&I&&g?.nodeType===1&&!I.contains(g))return;let y="";if(g?.dataset){const a=t.autotag&&g.dataset[t.autotag];a&&(y=j(`[data-${t.autotag}="${a}"]`,g.parentElement))}if(!y&&g?.tagName){const a=g.id?"#"+g.id:g.className?g.tagName.toLowerCase()+"."+[...g.classList].join("."):g.tagName.toLowerCase();y=g.id?a:j(a,g.parentElement)}let E,S;if(y&&I){const a=I.querySelectorAll(y);if(a.length>1){const b=[...a].indexOf(g);if(b!==-1)E=y,S=b;else{let h=g;for(;h&&h!==I&&h.nodeType===1;){const l=t.autotag&&h.dataset&&h.dataset[t.autotag];if(l){const c=`[data-${t.autotag}="${l}"]`,T=I.querySelectorAll(c);if(T.length>1){const k=[...T].indexOf(h);if(k!==-1){E=c,S=k;break}}}h=h.parentElement}}}}const w=g?.tagName?g.tagName.toLowerCase()+(g.type?":"+g.type:""):void 0,A=s==="scroll"?window.scrollY:void 0,B=s==="input"||s==="change"?g?.value:void 0,q=s==="change"&&(g?.type==="checkbox"||g?.type==="radio")?g?.checked:void 0,F=s==="keydown"?g?.key:void 0,P=s==="keydown"?g?.code:void 0,G=s==="click"||s==="change"||s==="submit"?0:v[s]!==void 0?v[s]:$[s]??0,o=()=>{if((s==="blur"||s==="focus")&&y){const b=u.actions.length-1,h=b>=0?u.actions[b]:null;if(h){if(h.target===y&&h.listSelector==null==(E==null)&&h.targetIndex==null==(S==null)&&(h.targetIndex==null||h.targetIndex===S))return;for(const c of u.removedElements)if(c.actionIdx===b&&(c.selector===y||y.startsWith(c.selector+" ")||y.startsWith(c.selector+">")))return}}const a={type:s,target:y,time:Date.now()};w&&(a.targetType=w),A!==void 0&&(a.scrollY=A),B!==void 0&&(a.value=B),q!==void 0&&(a.checked=q),F!==void 0&&(a.key=F),P!==void 0&&(a.code=P),E!=null&&(a.listSelector=E),S!=null&&(a.targetIndex=S),u.actions.push(a)};G===0?o():(clearTimeout(m[s]),m[s]=setTimeout(o,G))};t.D.addEventListener(s,d,!0),u._listeners.push({ev:s,handler:d})})},t.stopRecording=()=>{const n=t.recorder;n.active=!1,n._originalFetch&&(window.fetch=n._originalFetch,n._originalFetch=null),n._originalXHROpen&&(XMLHttpRequest.prototype.open=n._originalXHROpen,XMLHttpRequest.prototype.send=n._originalXHRSend,n._originalXHROpen=null,n._originalXHRSend=null),n._originalWebSocket&&(window.WebSocket=n._originalWebSocket,n._originalWebSocket=null),n._listeners.forEach(({ev:i,handler:r})=>{t.D.removeEventListener(i,r,!0)}),n._listeners=[],n._observer&&(n._observer.disconnect(),n._observer=null);const e={actions:[...n.actions],mocks:{...n.mocks},initialData:{...n.initialData},stepDelays:{...n.stepDelays},assertions:[...n.assertions||[]],removedElements:[...n.removedElements||[]],observeRoot:n.observeRoot||null,websocketEvents:[...n.websocketEvents||[]]};return n.strictCapture&&(e.strictCapture={...n.strictCapture}),e},t.clearRecording=n=>{if(n!==void 0)sessionStorage?.removeItem("oTest-Recording-"+n);else for(let e=sessionStorage?.length-1;e>=0;e--){const i=sessionStorage?.key(e);i&&i.indexOf("oTest-Recording-")===0&&sessionStorage?.removeItem(i)}},t.runRecordingAssertions=(n,e,i,r)=>{const p=!!(r&&r.strictAssertions),L=r&&r.strictRemoved!==void 0?!!r.strictRemoved:p,x=r&&r.assertions,C=x??(n.assertions||[]).filter(s=>i==null||s.actionIdx===i);t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[runRecordingAssertions] run:",{actionIdx:i,scope:i==null?"teardown (all)":"per-action",assertionsCount:C.length,assertions:C.map(s=>({actionIdx:s.actionIdx,type:s.type,selector:s.selector,index:s.index,text:(s.text||"").slice(0,40)}))});const _=new Set,D=C.filter(s=>{const d=`${s.selector}|${s.type}|${s.actionIdx}|${s.index??""}`;return _.has(d)?!1:(_.add(d),!0)}),v=(()=>{if(e!=null)return typeof e=="string"?t.D.querySelector(e)||t.D.body:e;const s=n.observeRoot;return s&&t.D.querySelector(s)||t.D.body})(),$=s=>(s||"").trim().replace(/\s+/g," "),u=s=>$(String(s||"").replace(/\s*:\s*/g,": ").replace(/\s*;\s*/g,"; ")),f=s=>s?$(s.textContent||""):"",j=r?.removedElements||[],O=s=>{if(!j.length||i==null)return!1;const d=$(s.text||"");for(const N of j)if(!(N.actionIdx>i)&&$(N.text||"")===d&&N.selector===s.selector&&!(s.listSelector!=null&&N.listSelector!==s.listSelector)&&!(s.index!=null&&N.index!==s.index))return!0;return!1};let I=0;const m=[];for(const s of D){if(O(s)){if(!L){I+=1,t.recordingAssertionDebug&&typeof console<"u"&&console.log&&console.log("[runRecordingAssertions] skip (explicit removed):",{actionIdx:s.actionIdx,selector:s.selector,text:(s.text||"").slice(0,40)});continue}let y=null;const E=$(s.text||"");if(s.listSelector!=null&&s.index!=null){const S=v.querySelectorAll(s.listSelector);let w=S[s.index];if(!w&&s.index>0&&(w=S[s.index-1]),w&&(y=s.selector!==s.listSelector&&w.querySelector(s.selector)||w),!y&&E&&s.type==="visible")for(let A=0;A<S.length;A++){const B=S[A],q=s.selector!==s.listSelector&&B.querySelector(s.selector)||B;if(q&&f(q).indexOf(E)!==-1){y=q;break}}}else{const S=v.querySelectorAll(s.selector);y=S.length>0?S[0]:t.D.querySelector(s.selector)}if(y&&s.type==="visible"){const S=y.nodeType===1&&(y.offsetParent!==null||y.getBoundingClientRect&&y.getBoundingClientRect().width>0),w=f(y);if(S&&(!E||w.indexOf(E)!==-1||E.indexOf(w)!==-1)){m.push({selector:s.selector,message:"expected absent (recorded removed) but matching content still visible"});continue}}else if(y&&s.type!=="visible"){m.push({selector:s.selector,message:"expected absent (recorded removed) but element still present"});continue}I+=1;continue}let d=null,N=!1,g=-1;if(s.listSelector!=null&&s.index!=null){const y=v.querySelectorAll(s.listSelector);g=y.length;const E=$(s.text||""),S=A=>{const B=y[A];return B?(s.selector!==s.listSelector?B.querySelector(s.selector):B)||(s.selector!==s.listSelector?B:null):null};let w;if(p)w=y[s.index],w&&(d=S(s.index),!d&&s.selector!==s.listSelector&&(d=w));else if(w=y[s.index],!w&&s.index>0&&(w=y[s.index-1]),w&&(d=S(s.index)||(s.index>0?S(s.index-1):null),!d&&s.selector!==s.listSelector&&(d=w),s.type==="visible"&&E&&d)){const A=f(d);if(A.indexOf(E)===-1&&E.indexOf(A)===-1)for(let q=0;q<y.length;q++){const F=S(q);if(F&&f(F).indexOf(E)!==-1){d=F,w=y[q];break}}}w||(N=!0)}else{const y=v.querySelectorAll(s.selector);d=y.length>0?y[0]:t.D.querySelector(s.selector)}if(s.type==="visible"){const y=d&&d.nodeType===1&&(d.offsetParent!==null||d.getBoundingClientRect&&d.getBoundingClientRect().width>0),E=$(s.text||""),S=f(d),w=p?!E||S===E:!E||S.indexOf(E)!==-1||E.length>0&&E.indexOf(S)!==-1;if(y&&w)I+=1;else{const A=g>=0?g:v.querySelectorAll(s.listSelector||s.selector).length,B=N?`index out of bounds (list has ${A} items, assertion expected index ${s.index})`:d?y?w?"fail":"text mismatch":"not visible":"element not found";m.push({selector:s.selector,message:B}),typeof console<"u"&&console.warn&&console.warn("[runRecordingAssertions] visible failed:",{actionIdx:s.actionIdx,selector:s.selector,listSelector:s.listSelector,index:s.index,expectedText:s.text||"(any)",actualText:S.slice(0,80),message:B})}}else if(s.type==="class"){const y=(s.className||"").trim().split(/\s+/).filter(Boolean),E=d&&(y.length===0||y.every(w=>d.classList?.contains(w))),S=!p||!s.className||$((d?.className||"").trim())===$((s.className||"").trim());if(E&&S)I+=1;else{const w=N?`index out of bounds (list has ${v.querySelectorAll(s.listSelector).length} items, expected index ${s.index})`:d?E&&!S?`expected exact className "${s.className}" (strict)`:`expected class "${s.className}"`:"element not found";m.push({selector:s.selector,message:w}),typeof console<"u"&&console.warn&&console.warn("[runRecordingAssertions] failed:",{type:s.type,selector:s.selector,actionIdx:s.actionIdx,listSelector:s.listSelector,index:s.index,itemsInRoot:s.listSelector?v.querySelectorAll(s.listSelector).length:"-",message:w})}}else if(s.type==="style"){const y=(s.style||"").trim(),E=(d?.style?.cssText||d?.getAttribute?.("style")||"").trim();if(d&&(!y||(p?u(E)===u(y):E.indexOf(y)!==-1||y===E)))I+=1;else{const w=d?`expected style "${y.slice(0,60)}..."`:"element not found";m.push({selector:s.selector,message:w})}}else if(s.type==="hidden")if(d&&d.hidden===s.hidden)I+=1;else{const E=d?`expected hidden=${s.hidden}`:"element not found";m.push({selector:s.selector,message:E})}else if(s.type==="disabled")if(d&&d.disabled===s.disabled)I+=1;else{const E=d?`expected disabled=${s.disabled}`:"element not found";m.push({selector:s.selector,message:E})}else if(s.type==="aria-expanded"){const y=d?.getAttribute?.("aria-expanded");if(d&&(s.ariaExpanded==null||String(y)===String(s.ariaExpanded)))I+=1;else{const S=d?`expected aria-expanded="${s.ariaExpanded}"`:"element not found";m.push({selector:s.selector,message:S})}}else if(s.type==="aria-checked"){const y=d?.getAttribute?.("aria-checked");if(d&&(s.ariaChecked==null||String(y)===String(s.ariaChecked)))I+=1;else{const S=d?`expected aria-checked="${s.ariaChecked}"`:"element not found";m.push({selector:s.selector,message:S})}}}return{passed:I,total:D.length,failures:m}},t.exportTest=(n,e={})=>{const i=e.delay!==void 0?e.delay:16,r=e.extensionExport===!0,p={actions:n.actions,assertions:n.assertions||[],observeRoot:n.observeRoot||null},L=n.observeRoot?`(o.D.querySelector('${n.observeRoot.replace(/'/g,"\\'")}') || o.D.body)`:"o.D.body",x=u=>{if(u.listSelector!=null&&u.targetIndex!=null){const f=JSON.stringify(u.listSelector),j=u.target===u.listSelector,O=j?f:JSON.stringify(u.target);return` const items = o.D.querySelectorAll(${f});
17
+ const item = items[${u.targetIndex}];
18
18
  let el = null;
19
- if (item) { el = ${v?"item":`item.querySelector(${I}) || item`}; }`}return` const el = o.D.querySelector(${JSON.stringify(b.target)});`},g=i>0?`
19
+ if (item) { el = ${j?"item":`item.querySelector(${O}) || item`}; }`}return` const el = o.D.querySelector(${JSON.stringify(u.target)});`},C=i>0?`
20
20
  await o.sleep(${i});
21
21
  return true;
22
22
  `:` return true;
23
- `,k=i>0?"async () =>":"() =>",m=[];for(let b=0;b<n.actions.length;b++){const h=n.actions[b];let v;h.type==="scroll"?v=` window.scrollTo(0, ${h.scrollY||0});${g}`:h.type==="input"||h.type==="change"?v=(h.value!==void 0?` el.value = ${JSON.stringify(h.value)};
24
- `:"")+(h.checked!==void 0?` el.checked = ${h.checked};
25
- `:"")+` el.dispatchEvent(new Event('${h.type}', {bubbles:true}));${g}`:h.type==="submit"?v=` (el.requestSubmit && el.requestSubmit()) || el.submit();${g}`:h.type==="keydown"?v=` el.dispatchEvent(new KeyboardEvent('keydown', {key:${JSON.stringify(h.key||"")}, code:${JSON.stringify(h.code||"")}, bubbles:true, cancelable:true}));${g}`:h.type==="focus"?v=` el.focus();${g}`:h.type==="blur"?v=` el.blur();${g}`:v=h.type==="click"?` el.click();${g}`:` el.dispatchEvent(new MouseEvent('${h.type}', {bubbles:true,cancelable:true}));${g}`;const I=h.type==="blur"||h.type==="focus";m.push(` ['${h.type} on ${h.target}', ${k} {
26
- `+L(h)+`
27
- if (!el && '${h.type}' !== 'scroll') { if (${I}) return true; return 'element not found: ${h.target.replace(/'/g,"\\'")}'; }
28
- `+v+" }]"),(n.assertions||[]).filter(T=>T.actionIdx===b).length>0&&m.push(` ['assert after ${h.type}', () => {
29
- const r = o.runRecordingAssertions(recordingData, ${p}, ${b});
23
+ `,_=i>0?"async () =>":"() =>",D=[];for(let u=0;u<n.actions.length;u++){const f=n.actions[u];let j;f.type==="scroll"?j=` window.scrollTo(0, ${f.scrollY||0});${C}`:f.type==="input"||f.type==="change"?j=(f.value!==void 0?` el.value = ${JSON.stringify(f.value)};
24
+ `:"")+(f.checked!==void 0?` el.checked = ${f.checked};
25
+ `:"")+` el.dispatchEvent(new Event('${f.type}', {bubbles:true}));${C}`:f.type==="submit"?j=` (el.requestSubmit && el.requestSubmit()) || el.submit();${C}`:f.type==="keydown"?j=` el.dispatchEvent(new KeyboardEvent('keydown', {key:${JSON.stringify(f.key||"")}, code:${JSON.stringify(f.code||"")}, bubbles:true, cancelable:true}));${C}`:f.type==="focus"?j=` el.focus();${C}`:f.type==="blur"?j=` el.blur();${C}`:j=f.type==="click"?` el.click();${C}`:` el.dispatchEvent(new MouseEvent('${f.type}', {bubbles:true,cancelable:true}));${C}`;const O=f.type==="blur"||f.type==="focus";D.push(` ['${f.type} on ${f.target}', ${_} {
26
+ `+x(f)+`
27
+ if (!el && '${f.type}' !== 'scroll') { if (${O}) return true; return 'element not found: ${f.target.replace(/'/g,"\\'")}'; }
28
+ `+j+" }]"),(n.assertions||[]).filter(m=>m.actionIdx===u).length>0&&D.push(` ['assert after ${f.type}', () => {
29
+ const r = o.runRecordingAssertions(recordingData, ${L}, ${u});
30
30
  return r.passed === r.total ? true : r.failures.map(f => f.selector + ': ' + f.message).join('; ');
31
- }]`)}return`// Auto-generated by o.exportTest() \u2014 review and anonymize mocks before committing
31
+ }]`)}const v=`// Auto-generated by o.exportTest() \u2014 review and anonymize mocks before committing
32
32
  const recordingMocks = ${Object.keys(n.mocks||{}).length?JSON.stringify(n.mocks,null,2):"{}"};
33
33
  const recordingData = { actions: ${JSON.stringify(n.actions)}, assertions: ${JSON.stringify(n.assertions||[])}, observeRoot: ${JSON.stringify(n.observeRoot||null)} };
34
34
 
35
- o.addTest('Recorded test', [
36
- ${m.join(`,
35
+ `,$=" // Add manual checks: ['Manual: label', () => o.testConfirm('label', ['item1'])],";return r?v+`const __objsExtensionTestRun = o.test('Recorded test',
36
+ ${D.join(`,
37
+ `)},
38
+ ${$}
39
+ { sync: true }, () => {
40
+ // teardown
41
+ });
42
+ `:v+`o.addTest('Recorded test', [
43
+ ${D.join(`,
37
44
  `)}
38
- // Add manual checks: ['Manual: label', () => o.testConfirm('label', ['item1'])],
45
+ ${$}
39
46
  ], () => {
40
47
  // teardown
41
48
  });
42
- `},t.exportPlaywrightTest=(n,e={})=>{const i=e.testName||"Recorded session",r=n.initialData?.url??"/";let p="/";try{p=new URL(r).pathname||"/"}catch{p=r}const L=e.baseUrl||p,g=Object.values(n.mocks).map(l=>{let T=l.url;try{T=new URL(l.url).pathname||T}catch{}T.startsWith("/")||(T="/"+T);const o=JSON.stringify(l.response),c=JSON.stringify(l.request),f=(l.method||"GET").toUpperCase();let a=` if (route.request().method() !== ${JSON.stringify(f)}) { await route.continue(); return; }
43
- `;return l.request!=null&&(f==="POST"||f==="PUT"||f==="PATCH")&&(a+=` const postData = route.request().postData();
49
+ `},t.exportPlaywrightTest=(n,e={})=>{const i=e.testName||"Recorded session",r=n.initialData?.url??"/";let p="/";try{p=new URL(r).pathname||"/"}catch{p=r}const L=e.baseUrl||p,x=Object.values(n.mocks).map(f=>{let j=f.url;try{j=new URL(f.url).pathname||j}catch{}j.startsWith("/")||(j="/"+j);const O=JSON.stringify(f.response),I=JSON.stringify(f.request),m=(f.method||"GET").toUpperCase();let s=` if (route.request().method() !== ${JSON.stringify(m)}) { await route.continue(); return; }
50
+ `;return f.request!=null&&(m==="POST"||m==="PUT"||m==="PATCH")&&(s+=` const postData = route.request().postData();
44
51
  const body = (() => { try { return JSON.parse(postData || '{}'); } catch { return {}; } })();
45
- expect(body).toEqual(${c});
46
- `),` await page.route('**${T}', async route => {
47
- `+a+` await route.fulfill({ status: ${l.status||200}, contentType: 'application/json',
48
- body: JSON.stringify(${o}) });
52
+ expect(body).toEqual(${I});
53
+ `),` await page.route('**${j}', async route => {
54
+ `+s+` await route.fulfill({ status: ${f.status||200}, contentType: 'application/json',
55
+ body: JSON.stringify(${O}) });
49
56
  });`}).join(`
50
- `),k=Object.assign({click:100,mouseover:50,scroll:30,input:50,change:50,submit:100,keydown:50,focus:50,blur:50},n.stepDelays||{}),m=n.actions.map((l,T)=>{const o=l.listSelector!=null&&l.targetIndex!=null?l.target!==l.listSelector?`page.locator(${JSON.stringify(l.listSelector)}).nth(${l.targetIndex}).locator(${JSON.stringify(l.target)})`:`page.locator(${JSON.stringify(l.listSelector)}).nth(${l.targetIndex})`:`page.locator(${JSON.stringify(l.target)})`,c=` await page.waitForTimeout(${k[l.type]||50});`;let f;if(l.type==="scroll")f=` await page.evaluate(() => window.scrollTo(0, ${l.scrollY||0}));`;else if(l.type==="mouseover")f=` await ${o}.hover();
57
+ `),C=Object.assign({click:100,mouseover:50,scroll:30,input:50,change:50,submit:100,keydown:50,focus:50,blur:50},n.stepDelays||{}),_=n.actions.map((f,j)=>{const O=f.listSelector!=null&&f.targetIndex!=null?f.target!==f.listSelector?`page.locator(${JSON.stringify(f.listSelector)}).nth(${f.targetIndex}).locator(${JSON.stringify(f.target)})`:`page.locator(${JSON.stringify(f.listSelector)}).nth(${f.targetIndex})`:`page.locator(${JSON.stringify(f.target)})`,I=` await page.waitForTimeout(${C[f.type]||50});`;let m;if(f.type==="scroll")m=` await page.evaluate(() => window.scrollTo(0, ${f.scrollY||0}));`;else if(f.type==="mouseover")m=` await ${O}.hover();
51
58
  // Pure CSS :hover \u2014 no DOM mutation to assert.
52
- // Fix: toggle a class in a mouseover handler, or add a page.screenshot() visual check.`;else if(l.type==="input")f=` await ${o}.fill(${JSON.stringify(l.value||"")});`;else if(l.type==="change"){const u=l.targetType||"";if(u.indexOf(":checkbox")!==-1||u.indexOf(":radio")!==-1){const D=l.checked!==void 0?l.checked:l.value==="true"||l.value==="on";f=` await ${o}.${D?"check":"uncheck"}();`}else u.indexOf("select")!==-1?f=` await ${o}.selectOption(${JSON.stringify(l.value||"")});`:f=` await ${o}.fill(${JSON.stringify(l.value||"")});`}else if(l.type==="submit")f=` await ${o}.evaluate((el) => el.requestSubmit?.() || el.submit());`;else if(l.type==="keydown"){const u=l.key||"";f=u==="Enter"?` await ${o}.press("Enter");`:u?` await ${o}.press(${JSON.stringify(u)});`:` await ${o}.press(${JSON.stringify(l.code||"")});`}else l.type==="focus"?f=` if (await ${o}.count() > 0) await ${o}.focus();`:l.type==="blur"?f=` if (await ${o}.count() > 0) await ${o}.blur();`:f=` await ${o}.click();`;const a=(n.assertions||[]).filter(u=>u.actionIdx===T).filter((u,D,w)=>w.findIndex($=>$.selector===u.selector&&$.type===u.type&&$.index===u.index)===D).map(u=>{const D=u.listSelector!=null&&u.index!=null?u.selector!==u.listSelector?`page.locator(${JSON.stringify(u.listSelector)}).nth(${u.index}).locator(${JSON.stringify(u.selector)})`:`page.locator(${JSON.stringify(u.listSelector)}).nth(${u.index})`:`page.locator(${JSON.stringify(u.selector)})`;if(u.type==="visible"){let w=` await expect(${D}).toBeVisible();`;return u.text&&(w+=`
53
- await expect(${D}).toContainText(${JSON.stringify(u.text)});`),w}if(u.type==="class"){const w=(u.className||"").trim().split(/\s+/).filter(Boolean);return w.length>0?w.map($=>` await expect(${D}).toHaveClass(${JSON.stringify($)});`).join(`
54
- `):` // class on ${u.selector} (no specific classes asserted)`}if(u.type==="style"){const w=(u.style||"").trim();if(w){const $=w.match(/(\w+)\s*:\s*([^;]+)/);return $?` await expect(${D}).toHaveCSS(${JSON.stringify($[1])}, ${JSON.stringify($[2].trim())});`:` await expect(${D}).toHaveAttribute("style", ${JSON.stringify(w)});`}return""}return u.type==="hidden"?u.hidden?` await expect(${D}).toBeHidden();`:` await expect(${D}).toBeVisible();`:u.type==="disabled"?u.disabled?` await expect(${D}).toBeDisabled();`:` await expect(${D}).toBeEnabled();`:u.type==="aria-expanded"&&u.ariaExpanded!=null?` await expect(${D}).toHaveAttribute("aria-expanded", ${JSON.stringify(String(u.ariaExpanded))});`:u.type==="aria-checked"&&u.ariaChecked!=null?` await expect(${D}).toHaveAttribute("aria-checked", ${JSON.stringify(String(u.ariaChecked))});`:""}).filter(Boolean).join(`
55
- `);return f+`
56
- `+c+(a?`
57
- `+a:"")}).join(`
58
- `),R=(n.assertions||[]).length>0,b=n.websocketEvents||[],h=b.length>0&&b.some(l=>l.messages?.length>0),v=h?` const wsCollected = [];
59
+ // Fix: toggle a class in a mouseover handler, or add a page.screenshot() visual check.`;else if(f.type==="input")m=` await ${O}.fill(${JSON.stringify(f.value||"")});`;else if(f.type==="change"){const d=f.targetType||"";if(d.indexOf(":checkbox")!==-1||d.indexOf(":radio")!==-1){const N=f.checked!==void 0?f.checked:f.value==="true"||f.value==="on";m=` await ${O}.${N?"check":"uncheck"}();`}else d.indexOf("select")!==-1?m=` await ${O}.selectOption(${JSON.stringify(f.value||"")});`:m=` await ${O}.fill(${JSON.stringify(f.value||"")});`}else if(f.type==="submit")m=` await ${O}.evaluate((el) => el.requestSubmit?.() || el.submit());`;else if(f.type==="keydown"){const d=f.key||"";m=d==="Enter"?` await ${O}.press("Enter");`:d?` await ${O}.press(${JSON.stringify(d)});`:` await ${O}.press(${JSON.stringify(f.code||"")});`}else f.type==="focus"?m=` if (await ${O}.count() > 0) await ${O}.focus();`:f.type==="blur"?m=` if (await ${O}.count() > 0) await ${O}.blur();`:m=` await ${O}.click();`;const s=(n.assertions||[]).filter(d=>d.actionIdx===j).filter((d,N,g)=>g.findIndex(y=>y.selector===d.selector&&y.type===d.type&&y.index===d.index)===N).map(d=>{const N=d.listSelector!=null&&d.index!=null?d.selector!==d.listSelector?`page.locator(${JSON.stringify(d.listSelector)}).nth(${d.index}).locator(${JSON.stringify(d.selector)})`:`page.locator(${JSON.stringify(d.listSelector)}).nth(${d.index})`:`page.locator(${JSON.stringify(d.selector)})`;if(d.type==="visible"){let g=` await expect(${N}).toBeVisible();`;return d.text&&(g+=`
60
+ await expect(${N}).toContainText(${JSON.stringify(d.text)});`),g}if(d.type==="class"){const g=(d.className||"").trim().split(/\s+/).filter(Boolean);return g.length>0?g.map(y=>` await expect(${N}).toHaveClass(${JSON.stringify(y)});`).join(`
61
+ `):` // class on ${d.selector} (no specific classes asserted)`}if(d.type==="style"){const g=(d.style||"").trim();if(g){const y=g.match(/(\w+)\s*:\s*([^;]+)/);return y?` await expect(${N}).toHaveCSS(${JSON.stringify(y[1])}, ${JSON.stringify(y[2].trim())});`:` await expect(${N}).toHaveAttribute("style", ${JSON.stringify(g)});`}return""}return d.type==="hidden"?d.hidden?` await expect(${N}).toBeHidden();`:` await expect(${N}).toBeVisible();`:d.type==="disabled"?d.disabled?` await expect(${N}).toBeDisabled();`:` await expect(${N}).toBeEnabled();`:d.type==="aria-expanded"&&d.ariaExpanded!=null?` await expect(${N}).toHaveAttribute("aria-expanded", ${JSON.stringify(String(d.ariaExpanded))});`:d.type==="aria-checked"&&d.ariaChecked!=null?` await expect(${N}).toHaveAttribute("aria-checked", ${JSON.stringify(String(d.ariaChecked))});`:""}).filter(Boolean).join(`
62
+ `);return m+`
63
+ `+I+(s?`
64
+ `+s:"")}).join(`
65
+ `),D=(n.assertions||[]).length>0,R=n.websocketEvents||[],v=R.length>0&&R.some(f=>f.messages?.length>0),$=v?` const wsCollected = [];
59
66
  page.on('websocket', ws => {
60
67
  ws.on('framereceived', ev => wsCollected.push({ dir: 'in', payload: typeof ev.payload === 'string' ? ev.payload : String(ev.payload) }));
61
68
  ws.on('framesent', ev => wsCollected.push({ dir: 'out', payload: typeof ev.payload === 'string' ? ev.payload : String(ev.payload) }));
62
69
  });
63
70
 
64
- `:"",I=h?b.flatMap(l=>(l.messages||[]).map(T=>({dir:T.dir,data:T.data}))).map(l=>` expect(wsCollected).toContainEqual({ dir: ${JSON.stringify(l.dir)}, payload: ${JSON.stringify(l.data)} });`).join(`
71
+ `:"",u=v?R.flatMap(f=>(f.messages||[]).map(j=>({dir:j.dir,data:j.data}))).map(f=>` expect(wsCollected).toContainEqual({ dir: ${JSON.stringify(f.dir)}, payload: ${JSON.stringify(f.data)} });`).join(`
65
72
  `)+`
66
73
 
67
74
  `:"";return`// Auto-generated by o.exportPlaywrightTest() \u2014 review and anonymize mocks before committing
@@ -70,23 +77,25 @@ ${m.join(`,
70
77
  import { test, expect } from '@playwright/test';
71
78
 
72
79
  test(${JSON.stringify(i)}, async ({ page }) => {
73
- `+(g?` // Network mocks \u2014 edit/anonymize before committing
74
- `+g+`
80
+ `+(x?` // Network mocks \u2014 edit/anonymize before committing
81
+ `+x+`
75
82
 
76
- `:"")+v+` // Set baseURL in playwright.config.ts: { use: { baseURL: 'https://staging.example.com' } }
83
+ `:"")+$+` // Set baseURL in playwright.config.ts: { use: { baseURL: 'https://staging.example.com' } }
77
84
  await page.goto(${JSON.stringify(L)});
78
85
 
79
- `+(m?m+`
86
+ `+(_?_+`
80
87
 
81
- `:"")+(I?` // WebSocket verifications
82
- `+I:"")+(!R&&!h?` // TODO: Add assertions before committing, e.g.:
88
+ `:"")+(u?` // WebSocket verifications
89
+ `+u:"")+(!D&&!v?` // TODO: Add assertions before committing, e.g.:
83
90
  // await expect(page.locator('[data-qa="success-panel"]')).toBeVisible();
84
91
  // await expect(page).toHaveURL(/\\/confirmation/);
85
92
  // await expect(page.locator('[data-qa="error-banner"]')).not.toBeVisible();
86
- `:R||h?` // Auto-generated assertions above \u2014 review for correctness before committing
93
+ `:D||v?` // Auto-generated assertions above \u2014 review for correctness before committing
87
94
  `:"")+`});
88
- `},t.playRecording=(n,e={})=>{const i=e&&typeof e=="object"&&(e.runAssertions!==void 0||e.root!==void 0||e.manualChecks!==void 0||e.actionDelay!==void 0),r=i?e.mockOverrides||{}:e,p=i&&e.runAssertions,L=i?e.root:void 0,g=i&&e.manualChecks||[],k=i&&e.actionDelay!==void 0?e.actionDelay:16,m=Object.assign({},n.mocks,r),R=window.fetch;window.fetch=($,S={})=>{const y=(S.method||"GET").toUpperCase()+":"+$;if(m[y]){const N=m[y],q=typeof N.response=="string"?N.response:JSON.stringify(N.response);return Promise.resolve(new Response(q,{status:N.status||200}))}return R($,S)};const b=XMLHttpRequest.prototype.open,h=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.open=function($,S){return this._oMethod=($||"GET").toUpperCase(),this._oUrl=S,b.apply(this,arguments)},XMLHttpRequest.prototype.send=function($){const S=this,A=(S._oMethod||"GET")+":"+(S._oUrl||""),y=m[A];if(y){const N=typeof y.response=="string"?y.response:JSON.stringify(y.response);setTimeout(()=>{S.readyState=4,S.status=y.status||200,S.statusText="OK",S.responseText=N,S.response=N,S.dispatchEvent(new Event("readystatechange")),S.dispatchEvent(new Event("load"))},0);return}return h.apply(this,arguments)};const v=()=>{if(L!=null)return typeof L=="string"?t.D.querySelector(L)||t.D.body:L;const $=n.observeRoot;return $&&t.D.querySelector($)||t.D.body},I=p?v():null,l=L!=null?v():t.D,T=n.actions,o=n.assertions||[],c={};for(const $ of o){const S=$.actionIdx;c[S]||(c[S]=[]),c[S].push($)}if(t.recordingAssertionDebug&&p&&typeof console<"u"&&console.log){const $=T.map((S,A)=>({i:A,action:S.type+" "+(S.target||""),assertions:(c[A]||[]).length,assertionDetails:(c[A]||[]).map(y=>({type:y.type,index:y.index,text:(y.text||"").slice(0,30)}))}));console.log("[playRecording] assertions by action:",$)}const f={};for(const $ of g){const S=$.afterAction;f[S]||(f[S]=[]),f[S].push($)}const a=[];let u={passed:0,total:0,failures:[]};for(let $=0;$<T.length;$++){const S=T[$];a.push([`${S.type} on ${S.target}`,async()=>{let y=null;const N=l;if(S.target)if(S.listSelector!=null&&S.targetIndex!=null){const j=N.querySelectorAll(S.listSelector)[S.targetIndex];j&&(y=S.target!==S.listSelector?j.querySelector(S.target):j,!y&&S.target!==S.listSelector&&(y=j))}else y=N.querySelector(S.target);return!y&&S.type!=="scroll"?S.type==="blur"||S.type==="focus"?!0:`element not found: ${S.target}`:(S.type==="scroll"?window.scrollTo(0,S.scrollY||0):S.type==="input"||S.type==="change"?(S.value!==void 0&&(y.value=S.value),S.checked!==void 0&&(y.checked=S.checked),y.dispatchEvent(new Event(S.type,{bubbles:!0}))):S.type==="submit"?typeof y.requestSubmit=="function"?y.requestSubmit():y.submit():S.type==="keydown"?y.dispatchEvent(new KeyboardEvent("keydown",{key:S.key||"",code:S.code||"",bubbles:!0,cancelable:!0})):S.type==="focus"?y.focus():S.type==="blur"?y.blur():S.type==="click"?y.click():y.dispatchEvent(new MouseEvent(S.type,{bubbles:!0,cancelable:!0})),k>0&&await t.sleep(k),!0)}]);const A=c[$];p&&A&&A.length>0&&a.push([`assert after ${S.type}`,()=>new Promise(y=>{const N=()=>{const q=t.runRecordingAssertions(n,I,$,{assertions:A,removedElements:n.removedElements});u.passed+=q.passed,u.total+=q.total,u.failures.push(...q.failures),y(q.passed===q.total?!0:q.failures.map(j=>j.selector+": "+j.message).join("; "))};requestAnimationFrame(()=>requestAnimationFrame(N))})]);for(const y of f[$]||[])a.push([`Manual: ${y.label}`,()=>typeof t.testConfirm=="function"?t.testConfirm(y.label,y.items||[]):{ok:!0}])}for(const $ of f.end||[])a.push([`Manual: ${$.label}`,()=>typeof t.testConfirm=="function"?t.testConfirm($.label,$.items||[]):{ok:!0}]);const D=i&&e.onComplete,w=t.test("Recorded playback",...a,{sync:!0},$=>{window.fetch=R,XMLHttpRequest.prototype.open=b,XMLHttpRequest.prototype.send=h;const S=p&&o.length>0?u:void 0;if(S?.failures?.length>0){t.tRes[$]=!1;const A=S.failures.map(N=>`${N.selector}: ${N.message}`).join("; "),y=t.tStyled?t.tPre+t.tXx+"Assertions failed: "+A+t.tDc:`
89
- \u2718 Assertions failed: `+A;t.tLog[$]=(t.tLog[$]||"")+y}typeof D=="function"&&D(S)});return p?{testId:w}:w},t.testOverlay=()=>{const n="o-test-overlay-btn",e="o-test-overlay-panel";if(t("#"+n).el)return;const i=()=>{const g=t("#"+e);if(!g.el)return;const k=t.tRes.length;let R=`<b>Tests: ${t.tRes.filter(Boolean).length}/${k}</b><hr style="margin:4px 0">`;t.tLog.forEach((b,h)=>{const v=t.tRes[h];R+=`<div style="margin:2px 0;padding:2px 4px;border-radius:3px;background:${v?"#d4edda":"#f8d7da"};color:${v?"#155724":"#721c24"};font-size:11px;white-space:pre-wrap">${b||"Test #"+h}</div>`}),R+='<button id="o-test-export" style="margin-top:6px;padding:4px 8px;font-size:11px;cursor:pointer">Export results</button>',g.html(R),t("#o-test-export").on("click",()=>{const b=JSON.stringify({results:t.tRes,logs:t.tLog},null,2),h=new Blob([b],{type:"application/json"}),v=t.D.createElement("a");v.href=URL.createObjectURL(h),v.download="objs-test-results.json",v.click()})},r=`<div style="display:flex;align-items:center;gap:12px;"><span class="o-test-overlay-summary" style="flex:1;font-size:13px;cursor:grab;">Tests: 0/0</span><button type="button" class="o-test-overlay-toggle" style="padding:6px 10px;background:#334155;color:#e2e8f0;border:none;border-radius:6px;cursor:pointer;font-size:12px;">List</button><button type="button" class="o-test-overlay-close" style="padding:4px 8px;background:transparent;color:#94a3b8;border:none;border-radius:4px;cursor:pointer;font-size:16px;line-height:1;" title="Close">\xD7</button></div><div id="${e}" style="display:none;margin-top:4px;padding:8px;background:#fff;border:1px solid #334155;border-radius:6px;max-height:240px;overflow-y:auto;box-shadow:0 2px 8px rgba(0,0,0,.15);font-size:11px;user-select:text;cursor:text;"></div>`,p=t.overlay({innerHTML:r,removeExisting:!1,className:"o-test-overlay",id:n,excludeDragSelector:".o-test-overlay-close, .o-test-overlay-toggle, #"+e}),L=()=>{const g=t(".o-test-overlay-summary");g.els.length&&g.innerText(`Tests: ${t.tRes.filter(Boolean).length}/${t.tRes.length}`)};p.first(".o-test-overlay-toggle").on("click",()=>{const g=t("#"+e);if(!g.el)return;const k=g.el.style.display!=="none";g.css({display:k?"none":"block"}),k||i()}),p.first(".o-test-overlay-close").on("click",()=>{p._overlayCleanup()}),t.testOverlay.showPanel=()=>{const g=t("#"+e);g.el&&(g.css({display:"block"}),i(),L())},t._testOverlayBase||(t._testOverlayBase=t.test),t.test=(...g)=>{const k=t._testOverlayBase(...g),m=t.tFns[k];return t.tFns[k]=R=>{typeof m=="function"&&m(R);const b=t("#"+e);b.el&&b.el.style.display!=="none"&&i(),L()},k}},t.overlay=(n={})=>{const{innerHTML:e,onClose:i,timeout:r,excludeDragSelector:p,removeExisting:L=!0,className:g="o-overlay-common",id:k}=n;if(L)t("."+g).remove();else if(k&&t("#"+k).el)return t("#"+k);const m={position:"fixed",left:"50%",bottom:"50px",transform:"translateX(-50%)","z-index":"999999",width:"fit-content","max-width":"min(90vw, 420px)","font-family":"system-ui,sans-serif","user-select":"text"},R="o-overlay-countdown",b='<div class="o-overlay-bar" style="display:flex;flex-direction:column;align-items:stretch;padding:10px 14px;background:#1e293b;color:#e2e8f0;border:1px solid #334155;border-radius:8px;font-size:14px;min-width:200px;max-height:90vh;overflow-y:auto;">'+e+(r?`<div id="${R}" style="margin-top:6px;font-size:11px;color:#94a3b8;"></div>`:"")+"</div>",h=t.initState({tag:"div",className:g,id:k||void 0,style:"position:fixed;left:50%;bottom:50px;transform:translateX(-50%);z-index:999999;width:fit-content;max-width:min(90vw,420px);font-family:system-ui,sans-serif;user-select:text;",html:b}).appendInside("body"),v=()=>h.css(m);let I=null;const l=f=>{I&&(m.left=I.left+(f.clientX-I.startX)+"px",m.top=I.top+(f.clientY-I.startY)+"px",delete m.bottom,m.transform="none",v())},T=()=>{I&&(delete m.cursor,v()),I=null};h.on("mousedown",f=>{if(p&&f.target.closest(p))return;const a=h.el.getBoundingClientRect();I={startX:f.clientX,startY:f.clientY,left:a.left,top:a.top},m.cursor="grabbing",v()}),t.D.addEventListener("mousemove",l),t.D.addEventListener("mouseup",T);let o;const c=()=>{t.D.removeEventListener("mousemove",l),t.D.removeEventListener("mouseup",T),o&&clearInterval(o),h.remove()};if(r&&r>0){let f=Math.ceil(r/1e3);const a=t("#"+R);a.el&&(a.el.textContent=f?`Continue in ${f}s`:""),o=setInterval(()=>{f-=1,a.el&&(a.el.textContent=f>0?`Continue in ${f}s`:""),f<=0&&(clearInterval(o),o=null,c(),typeof i=="function"&&i({ok:!1,errors:["timeout"]}))},1e3)}return h._overlayCleanup=c,h._overlayOnClose=i,h},t.testConfirm=(n,e=[],i={})=>new Promise(r=>{const p=i.confirm||"Continue",L=e.length>0,g=L?"#dc2626":"#2563eb",k=e.map((I,l)=>"o-tc-cb-"+l),R=L?`<style>.o-tc-item-cb{appearance:none;-webkit-appearance:none;width:16px;height:16px;border:2px solid #ef4444;border-radius:3px;background:#fef2f2;flex-shrink:0;cursor:pointer;}.o-tc-item-cb:checked{border-color:#22c55e;background:#22c55e;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");background-size:12px 12px;background-position:center;}</style><ul class="o-tc-list" style="margin:8px 0 0;padding:0;list-style:none;font-size:13px;color:#cbd5e1;cursor:grab;">`+e.map((I,l)=>`<li style="margin-bottom:4px;"><label for="${k[l]}" style="display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;"><input type="checkbox" id="${k[l]}" class="o-tc-item-cb"> <span>${I}</span></label></li>`).join("")+"</ul>":"",b=`<div style="display:flex;align-items:center;gap:12px;"><span class="o-tc-label" style="flex:1;cursor:grab;">${n}: Paused</span><button type="button" class="o-tc-ok" style="padding:6px 14px;background:${g};color:#fff;border:none;border-radius:6px;font-weight:600;cursor:pointer;font-size:13px;flex-shrink:0;">${p}</button></div>`+R,h=t.overlay({innerHTML:b,timeout:i.timeout,excludeDragSelector:".o-tc-ok",onClose:I=>r(I||{ok:!0})}),v={padding:"6px 14px",background:L?"#dc2626":"#2563eb",color:"#fff",border:"none","border-radius":"6px","font-weight":"600",cursor:"pointer","font-size":"13px","flex-shrink":"0"};if(L){const I=h.first(".o-tc-ok"),l=t(".o-overlay-common .o-tc-item-cb"),T=()=>{const o=l.length>0&&l.els.every(c=>c.checked);I.css({...v,background:o?"#16a34a":"#dc2626"})};l.on("change",T)}h.first(".o-tc-ok").on("click",()=>{let I=[];if(L){const l=t(".o-overlay-common .o-tc-item-cb");l.els.length&&l.els.forEach((T,o)=>{!T.checked&&e[o]!==void 0&&I.push(e[o])})}h._overlayCleanup(),r(I.length===0?{ok:!0}:{ok:!1,errors:I})})});
95
+ `},t.playRecording=(n,e={})=>{const i=e&&typeof e=="object"&&(e.runAssertions!==void 0||e.root!==void 0||e.manualChecks!==void 0||e.actionDelay!==void 0||e.skipWebSocketMock!==void 0||e.skipNetworkMocks!==void 0||e.recordingAssertionDebug!==void 0||e.strictPlay!==void 0||e.strictAssertions!==void 0||e.strictNetwork!==void 0||e.strictWebSocket!==void 0||e.strictRemoved!==void 0||e.onComplete!==void 0),r=i?e.mockOverrides||{}:e,p=i&&e.runAssertions,L=i?e.root:void 0,x=i&&e.manualChecks||[],C=i&&e.actionDelay!==void 0?e.actionDelay:16,_=i&&e.skipWebSocketMock,D=i&&e.skipNetworkMocks;i&&e.recordingAssertionDebug!==void 0&&(t.recordingAssertionDebug=!!e.recordingAssertionDebug);const R=n.strictCapture||{},v=i&&e.strictPlay===!0,$=i&&e.strictAssertions!==void 0?!!e.strictAssertions:v?!0:!!R.assertions,u=i&&e.strictNetwork!==void 0?!!e.strictNetwork:v?!0:!!R.network,f=i&&e.strictWebSocket!==void 0?!!e.strictWebSocket:v?!0:!!R.websocket,j=i&&e.strictRemoved!==void 0?!!e.strictRemoved:$,O=l=>{if(!(l==null||l==="")){if(typeof l=="string")try{return JSON.parse(l)}catch{return l}return l}},I=(l,c)=>{const T=O(c);return l===T||l==null&&T==null?!0:l==null||T==null?!1:typeof l=="object"&&typeof T=="object"?JSON.stringify(l)===JSON.stringify(T):String(l)===String(T)},m=l=>String(l||"").trim().replace(/\s+/g," "),s=Object.assign({},n.mocks,r),d=window.fetch,N=XMLHttpRequest.prototype.open,g=XMLHttpRequest.prototype.send;D||(window.fetch=(l,c={})=>{const k=(c.method||"GET").toUpperCase()+":"+l;if(s[k]){const M=s[k];if(u&&t.C(M,"request")&&!I(M.request,c.body))return Promise.reject(new Error("[Objs playRecording] strictNetwork: request body does not match recording for "+k));const U=typeof M.response=="string"?M.response:JSON.stringify(M.response);return Promise.resolve(new Response(U,{status:M.status||200}))}return d(l,c)},XMLHttpRequest.prototype.open=function(l,c){return this._oMethod=(l||"GET").toUpperCase(),this._oUrl=c,N.apply(this,arguments)},XMLHttpRequest.prototype.send=function(l){const c=this,T=(c._oMethod||"GET")+":"+(c._oUrl||""),k=s[T];if(k){if(u&&t.C(k,"request")&&!I(k.request,l)){setTimeout(()=>{c.readyState=4,c.status=0,c.statusText="Objs strictNetwork mismatch",c.dispatchEvent(new Event("readystatechange")),c.dispatchEvent(new Event("error"))},0);return}const M=typeof k.response=="string"?k.response:JSON.stringify(k.response);setTimeout(()=>{c.readyState=4,c.status=k.status||200,c.statusText="OK",c.responseText=M,c.response=M,c.dispatchEvent(new Event("readystatechange")),c.dispatchEvent(new Event("load"))},0);return}return g.apply(this,arguments)});let y=null;const E=n.websocketEvents||[];if(!_&&E.length>0&&E.some(l=>l.messages&&l.messages.length>0)&&typeof window.WebSocket=="function"){y=window.WebSocket;let l=0;const c=z=>{const J=typeof z=="string"?z:String(z);try{return new URL(J,window.location.href).href}catch{return J}},T=z=>{const J=c(z);for(let H=l;H<E.length;H++)if(c(E[H].url)===J)return l=H+1,E[H];for(let H=l;H<E.length;H++)if(String(E[H].url)===String(z))return l=H+1,E[H];return null},k=y;class M extends EventTarget{constructor(J,H,Y){super();const W=typeof J=="string"?J:String(J);this.url=W,this.readyState=k.CONNECTING;const V=H;this.protocol=Array.isArray(V)?V[0]||"":V?String(V):"",this.extensions="",this.binaryType="blob",this._messages=(Y.messages||[]).slice(),this._pos=0;const X=this;setTimeout(()=>{X.readyState!==k.CLOSED&&(X.readyState=k.OPEN,X._dispatchOpen(),X._drainInbound())},0)}_dispatchOpen(){const J=new Event("open");this.dispatchEvent(J),typeof this.onopen=="function"&&this.onopen(J)}_dispatchMessage(J){const H=new MessageEvent("message",{data:J});this.dispatchEvent(H),typeof this.onmessage=="function"&&this.onmessage(H)}_drainInbound(){for(;this._pos<this._messages.length&&this._messages[this._pos].dir==="in";){const J=this._messages[this._pos++];this._dispatchMessage(J.data)}}send(J){if(this.readyState!==k.OPEN)throw typeof DOMException<"u"?new DOMException("Still in CONNECTING state.","InvalidStateError"):new Error("InvalidStateError");if(this._pos>=this._messages.length){if(f)throw new Error("[Objs playRecording] strictWebSocket: unexpected send() after recorded frames exhausted");this._drainInbound();return}const H=this._messages[this._pos];if(H.dir==="out"){if(f){const Y=typeof J=="string"?J:String(J),W=String(H.data!=null?H.data:"");if(m(Y)!==m(W))throw new Error("[Objs playRecording] strictWebSocket: outbound frame mismatch")}this._pos++}this._drainInbound()}close(J,H){if(this.readyState===k.CLOSING||this.readyState===k.CLOSED)return;this.readyState=k.CLOSING;const Y=this;setTimeout(()=>{Y.readyState=k.CLOSED;const W=typeof CloseEvent<"u"?new CloseEvent("close",{code:J!==void 0?J:1e3,reason:H!==void 0?String(H):"",wasClean:!0}):new Event("close");Y.dispatchEvent(W),typeof Y.onclose=="function"&&Y.onclose(W)},0)}}const U=function(J,H){const Y=typeof J=="string"?J:String(J),W=T(Y);return!W||!W.messages||W.messages.length===0?new y(J,H):new M(J,H,W)};U.CONNECTING=k.CONNECTING,U.OPEN=k.OPEN,U.CLOSING=k.CLOSING,U.CLOSED=k.CLOSED,window.WebSocket=U}const w=()=>{if(L!=null)return typeof L=="string"?t.D.querySelector(L)||t.D.body:L;const l=n.observeRoot;return l&&t.D.querySelector(l)||t.D.body},A=p?w():null,B=L!=null?w():t.D,q=n.actions,F=n.assertions||[],P={};for(const l of F){const c=l.actionIdx;P[c]||(P[c]=[]),P[c].push(l)}if(t.recordingAssertionDebug&&p&&typeof console<"u"&&console.log){const l=q.map((c,T)=>({i:T,action:c.type+" "+(c.target||""),assertions:(P[T]||[]).length,assertionDetails:(P[T]||[]).map(k=>({type:k.type,index:k.index,text:(k.text||"").slice(0,30)}))}));console.log("[playRecording] assertions by action:",l)}const G={};for(const l of x){const c=l.afterAction;G[c]||(G[c]=[]),G[c].push(l)}const o=[];let a={passed:0,total:0,failures:[]};for(let l=0;l<q.length;l++){const c=q[l];o.push([`${c.type} on ${c.target}`,async()=>{let k=null;const M=B;if(c.target)if(c.listSelector!=null&&c.targetIndex!=null){const z=M.querySelectorAll(c.listSelector)[c.targetIndex];z&&(k=c.target!==c.listSelector?z.querySelector(c.target):z,!k&&c.target!==c.listSelector&&(k=z))}else k=M.querySelector(c.target);return!k&&c.type!=="scroll"?c.type==="blur"||c.type==="focus"?!0:`element not found: ${c.target}`:(c.type==="scroll"?window.scrollTo(0,c.scrollY||0):c.type==="input"||c.type==="change"?(c.value!==void 0&&(k.value=c.value),c.checked!==void 0&&(k.checked=c.checked),k.dispatchEvent(new Event(c.type,{bubbles:!0}))):c.type==="submit"?typeof k.requestSubmit=="function"?k.requestSubmit():k.submit():c.type==="keydown"?k.dispatchEvent(new KeyboardEvent("keydown",{key:c.key||"",code:c.code||"",bubbles:!0,cancelable:!0})):c.type==="focus"?k.focus():c.type==="blur"?k.blur():c.type==="click"?k.click():k.dispatchEvent(new MouseEvent(c.type,{bubbles:!0,cancelable:!0})),C>0&&await t.sleep(C),!0)}]);const T=P[l];p&&T&&T.length>0&&o.push([`assert after ${c.type}`,()=>new Promise(k=>{const M=()=>{const U=t.runRecordingAssertions(n,A,l,{assertions:T,removedElements:n.removedElements,strictAssertions:$,strictRemoved:j});a.passed+=U.passed,a.total+=U.total,a.failures.push(...U.failures),k(U.passed===U.total?!0:U.failures.map(z=>z.selector+": "+z.message).join("; "))};requestAnimationFrame(()=>requestAnimationFrame(M))})]);for(const k of G[l]||[])o.push([`Manual: ${k.label}`,()=>typeof t.testConfirm=="function"?t.testConfirm(k.label,k.items||[]):{ok:!0}])}for(const l of G.end||[])o.push([`Manual: ${l.label}`,()=>typeof t.testConfirm=="function"?t.testConfirm(l.label,l.items||[]):{ok:!0}]);const b=i&&e.onComplete,h=t.test("Recorded playback",...o,{sync:!0},l=>{window.fetch=d,XMLHttpRequest.prototype.open=N,XMLHttpRequest.prototype.send=g,y&&(window.WebSocket=y);const c=p&&F.length>0?a:void 0;if(c?.failures?.length>0){t.tRes[l]=!1;const T=c.failures.map(M=>`${M.selector}: ${M.message}`).join("; "),k=t.tStyled?t.tPre+t.tXx+"Assertions failed: "+T+t.tDc:`
96
+ \u2718 Assertions failed: `+T;t.tLog[l]=(t.tLog[l]||"")+k}typeof b=="function"&&b(c)});return p?{testId:h}:h},t.testOverlay=()=>{const n="o-test-overlay-btn",e="o-test-overlay-panel";if(t("#"+n).el)return;const i="o-test-overlay-scroll",r="o-test-export-objs",p="o-test-copy-txt",L="padding:6px 10px;background:#334155;color:#e2e8f0;border:none;border-radius:6px;cursor:pointer;font-size:12px;",x=()=>t.tLog.map((v,$)=>(v!=null&&v!==""?String(v):"Test #"+$)+(t.tRes[$]?" \u2713":" \u2717")).join(`
97
+
98
+ `),C=()=>{const v=t("#"+i);if(!v.el)return;let $="";t.tLog.forEach((u,f)=>{const j=t.tRes[f];$+=`<div style="margin:2px 0;padding:2px 4px;border-radius:3px;background:${j?"#14532d":"#450a0a"};color:${j?"#86efac":"#fca5a5"};font-size:11px;white-space:pre-wrap">${u||"Test #"+f}</div>`}),v.html($)},_=`<div class="o-test-overlay-root" style="display:flex;flex-direction:column;gap:4px;max-height:min(88vh,560px);overflow:hidden;"><div style="display:flex;align-items:center;gap:12px;flex-shrink:0;"><span class="o-test-overlay-summary" style="flex:1;font-size:13px;cursor:grab;">Tests: 0/0</span><button type="button" class="o-test-overlay-toggle" style="${L}">List</button><button type="button" class="o-test-overlay-close" style="padding:4px 8px;background:transparent;color:#94a3b8;border:none;border-radius:4px;cursor:pointer;font-size:16px;line-height:1;" title="Close">\xD7</button></div><div id="${e}" style="display:none;flex-direction:column;margin-top:4px;max-height:min(52vh,420px);background:#0a0f1e;border:1px solid #1e293b;border-radius:6px;box-shadow:0 2px 8px rgba(0,0,0,.35);overflow:hidden;"><div id="${i}" style="box-sizing:border-box;height:min(48vh,380px);overflow-y:scroll;padding:8px;font-size:11px;user-select:text;cursor:text;"></div><div id="o-test-overlay-footer" style="display:flex;flex-wrap:wrap;gap:8px;padding:8px;border-top:1px solid #1e293b;background:#0f172a;flex-shrink:0;"><button type="button" id="${r}" class="o-test-overlay-export-btn" style="${L}">Export (objs)</button><button type="button" id="${p}" class="o-test-overlay-export-btn" style="${L}">Copy (txt)</button></div></div></div>`,D=t.overlay({innerHTML:_,removeExisting:!1,className:"o-test-overlay",id:n,excludeDragSelector:".o-test-overlay-close, .o-test-overlay-toggle, #"+e+", #"+i+", #o-test-overlay-footer, .o-test-overlay-export-btn"});t("#"+r).on("click",()=>{const v=JSON.stringify({results:t.tRes,logs:t.tLog},null,2),$=new Blob([v],{type:"application/json"}),u=t.D.createElement("a");u.href=URL.createObjectURL($),u.download="objs-test-results.json",u.click()}),t("#"+p).on("click",()=>{const v=x(),$=()=>{const u=t.D.createElement("textarea");u.value=v,u.setAttribute("readonly",""),u.style.cssText="position:fixed;left:-9999px;top:0",t.D.body.appendChild(u),u.select(),t.D.execCommand("copy"),u.remove()};typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText?navigator.clipboard.writeText(v).catch($):$()});const R=()=>{const v=t(".o-test-overlay-summary");v.els.length&&v.innerText(`Tests: ${t.tRes.filter(Boolean).length}/${t.tRes.length}`)};D.first(".o-test-overlay-toggle").on("click",()=>{const v=t("#"+e);if(!v.el)return;v.el.style.display!=="none"?v.el.style.display="none":(v.el.style.display="flex",C())}),D.first(".o-test-overlay-close").on("click",()=>{D._overlayCleanup()}),t.testOverlay.showPanel=()=>{const v=t("#"+e);v.el&&(v.el.style.display="flex",C(),R())},t._testOverlayBase||(t._testOverlayBase=t.test),t.test=(...v)=>{const $=t._testOverlayBase(...v),u=t.tFns[$];return t.tFns[$]=f=>{typeof u=="function"&&u(f);const j=t("#"+e);j.el&&j.el.style.display!=="none"&&C(),R()},$}},t.overlay=(n={})=>{const{innerHTML:e,onClose:i,timeout:r,excludeDragSelector:p,removeExisting:L=!0,className:x="o-overlay-common",id:C}=n;if(L)t("."+x).remove();else if(C&&t("#"+C).el)return t("#"+C);const _={position:"fixed",left:"50%",bottom:"50px",transform:"translateX(-50%)","z-index":"999999",width:"fit-content","max-width":"min(90vw, 420px)","font-family":"system-ui,sans-serif","user-select":"text"},D="o-overlay-countdown",R='<div class="o-overlay-bar" style="display:flex;flex-direction:column;align-items:stretch;padding:10px 14px;background:#1e293b;color:#e2e8f0;border:1px solid #334155;border-radius:8px;font-size:14px;min-width:200px;max-height:90vh;overflow-y:auto;">'+e+(r?`<div id="${D}" style="margin-top:6px;font-size:11px;color:#94a3b8;"></div>`:"")+"</div>",v=t.initState({tag:"div",className:x,id:C||void 0,style:"position:fixed;left:50%;bottom:50px;transform:translateX(-50%);z-index:999999;width:fit-content;max-width:min(90vw,420px);font-family:system-ui,sans-serif;user-select:text;",html:R}).appendInside("body"),$=()=>v.css(_);let u=null;const f=m=>{u&&(_.left=u.left+(m.clientX-u.startX)+"px",_.top=u.top+(m.clientY-u.startY)+"px",delete _.bottom,_.transform="none",$())},j=()=>{u&&(delete _.cursor,$()),u=null};v.on("mousedown",m=>{if(p&&m.target.closest(p))return;const s=v.el.getBoundingClientRect();u={startX:m.clientX,startY:m.clientY,left:s.left,top:s.top},_.cursor="grabbing",$()}),t.D.addEventListener("mousemove",f),t.D.addEventListener("mouseup",j);let O;const I=()=>{t.D.removeEventListener("mousemove",f),t.D.removeEventListener("mouseup",j),O&&clearInterval(O),v.remove()};if(r&&r>0){let m=Math.ceil(r/1e3);const s=t("#"+D);s.el&&(s.el.textContent=m?`Continue in ${m}s`:""),O=setInterval(()=>{m-=1,s.el&&(s.el.textContent=m>0?`Continue in ${m}s`:""),m<=0&&(clearInterval(O),O=null,I(),typeof i=="function"&&i({ok:!1,errors:["timeout"]}))},1e3)}return v._overlayCleanup=I,v._overlayOnClose=i,v},t.testConfirm=(n,e=[],i={})=>new Promise(r=>{const p=i.confirm||"Continue",L=e.length>0,x=L?"#dc2626":"#2563eb",C=e.map((u,f)=>"o-tc-cb-"+f),D=L?`<style>.o-tc-item-cb{appearance:none;-webkit-appearance:none;width:16px;height:16px;border:2px solid #ef4444;border-radius:3px;background:#fef2f2;flex-shrink:0;cursor:pointer;}.o-tc-item-cb:checked{border-color:#22c55e;background:#22c55e;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");background-size:12px 12px;background-position:center;}</style><ul class="o-tc-list" style="margin:8px 0 0;padding:0;list-style:none;font-size:13px;color:#cbd5e1;cursor:grab;">`+e.map((u,f)=>`<li style="margin-bottom:4px;"><label for="${C[f]}" style="display:flex;align-items:center;gap:8px;cursor:pointer;user-select:none;"><input type="checkbox" id="${C[f]}" class="o-tc-item-cb"> <span>${u}</span></label></li>`).join("")+"</ul>":"",R=`<div style="display:flex;align-items:center;gap:12px;"><span class="o-tc-label" style="flex:1;cursor:grab;">${n}: Paused</span><button type="button" class="o-tc-ok" style="padding:6px 14px;background:${x};color:#fff;border:none;border-radius:6px;font-weight:600;cursor:pointer;font-size:13px;flex-shrink:0;">${p}</button></div>`+D,v=t.overlay({innerHTML:R,timeout:i.timeout,excludeDragSelector:".o-tc-ok",onClose:u=>r(u||{ok:!0})}),$={padding:"6px 14px",background:L?"#dc2626":"#2563eb",color:"#fff",border:"none","border-radius":"6px","font-weight":"600",cursor:"pointer","font-size":"13px","flex-shrink":"0"};if(L){const u=v.first(".o-tc-ok"),f=t(".o-overlay-common .o-tc-item-cb"),j=()=>{const O=f.length>0&&f.els.every(I=>I.checked);u.css({...$,background:O?"#16a34a":"#dc2626"})};f.on("change",j)}v.first(".o-tc-ok").on("click",()=>{let u=[];if(L){const f=t(".o-overlay-common .o-tc-item-cb");f.els.length&&f.els.forEach((j,O)=>{!j.checked&&e[O]!==void 0&&u.push(e[O])})}v._overlayCleanup(),r(u.length===0?{ok:!0}:{ok:!1,errors:u})})});
90
99
 
91
100
  export { o };
92
101
  export default o;