@odoo/owl 3.0.0-alpha.2 → 3.0.0-alpha.20

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.
Files changed (72) hide show
  1. package/dist/compile_templates.mjs +2430 -2532
  2. package/dist/compiler.js +2371 -0
  3. package/dist/owl.cjs.js +6571 -6615
  4. package/dist/owl.cjs.runtime.js +4070 -0
  5. package/dist/owl.es.js +6559 -6599
  6. package/dist/owl.es.runtime.js +4026 -0
  7. package/dist/owl.iife.js +6572 -6616
  8. package/dist/owl.iife.min.js +1 -1
  9. package/dist/owl.iife.runtime.js +4074 -0
  10. package/dist/owl.iife.runtime.min.js +1 -0
  11. package/dist/types/common/owl_error.d.ts +3 -3
  12. package/dist/types/common/types.d.ts +0 -28
  13. package/dist/types/common/utils.d.ts +8 -8
  14. package/dist/types/compiler/code_generator.d.ts +134 -152
  15. package/dist/types/compiler/index.d.ts +13 -13
  16. package/dist/types/compiler/inline_expressions.d.ts +58 -59
  17. package/dist/types/compiler/parser.d.ts +175 -178
  18. package/dist/types/compiler/standalone/index.d.ts +2 -2
  19. package/dist/types/compiler/standalone/setup_jsdom.d.ts +1 -1
  20. package/dist/types/index.d.ts +1 -1
  21. package/dist/types/owl.d.ts +703 -665
  22. package/dist/types/runtime/app.d.ts +55 -62
  23. package/dist/types/runtime/blockdom/attributes.d.ts +6 -6
  24. package/dist/types/runtime/blockdom/block_compiler.d.ts +21 -21
  25. package/dist/types/runtime/blockdom/config.d.ts +8 -8
  26. package/dist/types/runtime/blockdom/event_catcher.d.ts +7 -7
  27. package/dist/types/runtime/blockdom/events.d.ts +8 -8
  28. package/dist/types/runtime/blockdom/html.d.ts +17 -17
  29. package/dist/types/runtime/blockdom/index.d.ts +25 -26
  30. package/dist/types/runtime/blockdom/list.d.ts +18 -18
  31. package/dist/types/runtime/blockdom/multi.d.ts +17 -17
  32. package/dist/types/runtime/blockdom/text.d.ts +26 -26
  33. package/dist/types/runtime/blockdom/toggler.d.ts +17 -17
  34. package/dist/types/runtime/component.d.ts +17 -28
  35. package/dist/types/runtime/component_node.d.ts +57 -83
  36. package/dist/types/runtime/context.d.ts +36 -0
  37. package/dist/types/runtime/event_handling.d.ts +1 -1
  38. package/dist/types/runtime/hooks.d.ts +32 -57
  39. package/dist/types/runtime/index.d.ts +46 -35
  40. package/dist/types/runtime/lifecycle_hooks.d.ts +10 -12
  41. package/dist/types/runtime/model.d.ts +48 -0
  42. package/dist/types/runtime/plugin_hooks.d.ts +6 -0
  43. package/dist/types/runtime/plugin_manager.d.ts +34 -0
  44. package/dist/types/runtime/plugins.d.ts +36 -39
  45. package/dist/types/runtime/portal.d.ts +12 -15
  46. package/dist/types/runtime/props.d.ts +21 -0
  47. package/dist/types/runtime/reactivity/async_computed.d.ts +1 -0
  48. package/dist/types/runtime/reactivity/computations.d.ts +33 -0
  49. package/dist/types/runtime/reactivity/computed.d.ts +6 -0
  50. package/dist/types/runtime/reactivity/derived.d.ts +7 -0
  51. package/dist/types/runtime/reactivity/effect.d.ts +1 -0
  52. package/dist/types/runtime/reactivity/proxy.d.ts +47 -0
  53. package/dist/types/runtime/reactivity/reactivity.d.ts +46 -0
  54. package/dist/types/runtime/reactivity/signal.d.ts +31 -0
  55. package/dist/types/runtime/reactivity/signals.d.ts +30 -0
  56. package/dist/types/runtime/reactivity/state.d.ts +48 -0
  57. package/dist/types/runtime/reactivity.d.ts +12 -1
  58. package/dist/types/runtime/registry.d.ts +24 -15
  59. package/dist/types/runtime/rendering/error_handling.d.ts +13 -0
  60. package/dist/types/runtime/rendering/fibers.d.ts +37 -0
  61. package/dist/types/runtime/rendering/scheduler.d.ts +21 -0
  62. package/dist/types/runtime/rendering/template_helpers.d.ts +51 -0
  63. package/dist/types/runtime/resource.d.ts +18 -0
  64. package/dist/types/runtime/signals.d.ts +6 -4
  65. package/dist/types/runtime/status.d.ts +11 -10
  66. package/dist/types/runtime/suspense.d.ts +5 -0
  67. package/dist/types/runtime/template_set.d.ts +36 -40
  68. package/dist/types/runtime/types.d.ts +67 -0
  69. package/dist/types/runtime/utils.d.ts +24 -25
  70. package/dist/types/runtime/validation.d.ts +19 -36
  71. package/dist/types/version.d.ts +1 -1
  72. package/package.json +22 -19
@@ -0,0 +1 @@
1
+ !function(t){"use strict";class e extends Error{}class n{constructor(t){this.__owl__=t}setup(){}render(t=!1){this.__owl__.render(!0===t)}}function o(t){let e=!1;return async(...n)=>{e||(e=!0,await Promise.resolve(),e=!1,t(...n))}}n.template="";class r extends EventTarget{trigger(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))}}class i extends String{}function s(t){return t instanceof i?t:void 0===t?l(""):"number"==typeof t?l(String(t)):([["&","&amp;"],["<","&lt;"],[">","&gt;"],["'","&#x27;"],['"',"&quot;"],["`","&#x60;"]].forEach(e=>{t=String(t).replace(new RegExp(e[0],"g"),e[1])}),l(t))}function l(t,...e){if(!Array.isArray(t))return new i(t);const n=t;let o="",r=0;for(;r<e.length;++r)o+=n[r]+s(e[r]);return o+=n[r],new i(o)}var c;let a,h;function u(t){h&&(h.sources.add(t),t.observers.add(h))}function d(t){!function(t){if(a)return t();a=[];try{return t()}finally{}}(()=>{for(const e of t.observers)e.state===c.EXECUTED&&(e.isDerived?b(e):a.push(e)),e.state=c.STALE}),f()}!function(t){t[t.EXECUTED=0]="EXECUTED",t[t.STALE=1]="STALE",t[t.PENDING=2]="PENDING"}(c||(c={}));const f=o(function(){if(!a)return;for(const t of a)y(t);a=void 0});function p(){return h}function m(t){h=t}function g(t,e){const n=h;let o;h=t;try{o=e()}finally{h=n}return o}function y(t){var e;const n=t.state;if(n===c.EXECUTED)return;if(n===c.PENDING&&(function(t){for(const e of t.sources)"compute"in e&&y(e)}(t),t.state!==c.STALE))return void(t.state=c.EXECUTED);v(t);const o=h;h=t,t.value=null===(e=t.compute)||void 0===e?void 0:e.call(t),t.state=c.EXECUTED,h=o}function v(t){const e=t.sources;for(const n of e){n.observers.delete(t)}e.clear()}function b(t){for(const e of t.observers)e.state||(e.state=c.PENDING,e.isDerived?b(e):a.push(e))}const w=new WeakMap,x=new WeakMap;function N(t,n){try{t.destroy()}catch(t){}return Object.assign(new e("[Owl] Unhandled error. Destroying the root component"),{cause:n})}function E(t,e){if(!t)return!1;const n=t.fiber;n&&w.set(n,e);const o=x.get(t);if(o){let n=!1;const r=()=>N(t.app,e);for(let t=o.length-1;t>=0;t--)try{o[t](e,r),n=!0;break}catch(t){e=t}if(n)return!0}return E(t.parent,e)}function _(t){let{error:e}=t;const n="node"in t?t.node:t.fiber.node,o="fiber"in t?t.fiber:n.fiber;if(o){let t=o;do{t.node.fiber=t,t=t.parent}while(t);w.set(o.root,e)}if(!E(n,e))throw N(n.app,e)}function D(t){t=t.slice();const e=[];let n;for(;(n=t[0])&&"string"==typeof n;)e.push(t.shift());return{modifiers:e,data:t}}const O={shouldNormalizeDom:!0,mainEventHandler:(t,e,n)=>("function"==typeof t?t(e):Array.isArray(t)&&(t=D(t).data)[0](t[1],e),!1)},T=document.createTextNode("");class k{constructor(t,e){this.key=t,this.child=e}mount(t,e){this.parentEl=t,this.child.mount(t,e)}moveBeforeDOMNode(t,e){this.child.moveBeforeDOMNode(t,e)}moveBeforeVNode(t,e){this.moveBeforeDOMNode(t&&t.firstNode()||e)}patch(t,e){if(this===t)return;let n=this.child,o=t.child;if(this.key===t.key)n.patch(o,e);else{const r=n.firstNode();r.parentElement.insertBefore(T,r),e&&n.beforeRemove(),n.remove(),o.mount(this.parentEl,T),this.child=o,this.key=t.key}}beforeRemove(){this.child.beforeRemove()}remove(){this.child.remove()}firstNode(){return this.child.firstNode()}toString(){return this.child.toString()}}function S(t,e){return new k(t,e)}const{setAttribute:R,removeAttribute:C}=Element.prototype,M=DOMTokenList.prototype,I=M.add,P=M.remove,B=Array.isArray,{split:j,trim:A}=String.prototype,L=/\s+/;function V(t,e){switch(e){case!1:case void 0:C.call(this,t);break;case!0:R.call(this,t,"");break;default:R.call(this,t,e)}}function $(t){return function(e){V.call(this,t,e)}}function F(t){if(B(t))"class"===t[0]?H.call(this,t[1]):V.call(this,t[0],t[1]);else for(let e in t)"class"===e?H.call(this,t[e]):V.call(this,e,t[e])}function W(t,e){if(B(t)){const n=t[0],o=t[1];if(n===e[0]){if(o===e[1])return;"class"===n?X.call(this,o,e[1]):V.call(this,n,o)}else C.call(this,e[0]),V.call(this,n,o)}else{for(let n in e)n in t||("class"===n?X.call(this,"",e[n]):C.call(this,n));for(let n in t){const o=t[n];o!==e[n]&&("class"===n?X.call(this,o,e[n]):V.call(this,n,o))}}}function U(t){const e={};switch(typeof t){case"string":const n=A.call(t);if(!n)return{};let o=j.call(n,L);for(let t=0,n=o.length;t<n;t++)e[o[t]]=!0;return e;case"object":for(let n in t){const o=t[n];if(o){if(n=A.call(n),!n)continue;const t=j.call(n,L);for(let n of t)e[n]=o}}return e;case"undefined":return{};case"number":return{[t]:!0};default:return{[t]:!0}}}function H(t){t=""===t?{}:U(t);const e=this.classList;for(let n in t)I.call(e,n)}function X(t,e){e=""===e?{}:U(e),t=""===t?{}:U(t);const n=this.classList;for(let o in e)o in t||P.call(n,o);for(let o in t)o in e||I.call(n,o)}function q(t){const e=t.split(".")[0],n=t.includes(".capture");return t.includes(".synthetic")?function(t,e=!1){let n=`__event__synthetic_${t}`;e&&(n=`${n}_capture`);!function(t,e,n=!1){if(G[e])return;document.addEventListener(t,t=>function(t,e){let n=e.target;for(;null!==n;){const o=n[t];if(o)for(const t of Object.values(o)){if(O.mainEventHandler(t,e,n))return}n=n.parentNode}}(e,t),{capture:n}),G[e]=!0}(t,n,e);const o=K++;function r(t){const e=this[n]||{};e[o]=t,this[n]=e}function i(){delete this[n]}return{setup:r,update:r,remove:i}}(e,n):function(t,e=!1){let n=`__event__${t}_${z++}`;e&&(n=`${n}_capture`);function o(t){const e=t.currentTarget;if(!e||!function(t){if(!t)return!1;if(t.ownerDocument.contains(t))return!0;const e=t.getRootNode();return e instanceof ShadowRoot&&t.ownerDocument.contains(e.host)}(e))return;const o=e[n];o&&O.mainEventHandler(o,t,e)}function r(r){this[n]=r,this.addEventListener(t,o,{capture:e})}function i(){delete this[n],this.removeEventListener(t,o,{capture:e})}function s(t){this[n]=t}return{setup:r,update:s,remove:i}}(e,n)}let z=1;let K=1;const G={};const J=Node.prototype,Z=J.insertBefore,Q=(Y=J,tt="textContent",Object.getOwnPropertyDescriptor(Y,tt)).set;var Y,tt;const et=J.removeChild;class nt{constructor(t){this.children=t}mount(t,e){const n=this.children,o=n.length,r=new Array(o);for(let i=0;i<o;i++){let o=n[i];if(o)o.mount(t,e);else{const n=document.createTextNode("");r[i]=n,Z.call(t,n,e)}}this.anchors=r,this.parentEl=t}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e;const n=this.children,o=this.anchors;for(let r=0,i=n.length;r<i;r++){let i=n[r];if(i)i.moveBeforeDOMNode(t,e);else{const n=o[r];Z.call(e,n,t)}}}moveBeforeVNode(t,e){if(t){const n=t.children[0];e=(n?n.firstNode():t.anchors[0])||null}const n=this.children,o=this.parentEl,r=this.anchors;for(let t=0,i=n.length;t<i;t++){let i=n[t];if(i)i.moveBeforeVNode(null,e);else{const n=r[t];Z.call(o,n,e)}}}patch(t,e){if(this===t)return;const n=this.children,o=t.children,r=this.anchors,i=this.parentEl;for(let t=0,s=n.length;t<s;t++){const s=n[t],l=o[t];if(s)if(l)s.patch(l,e);else{const o=s.firstNode(),l=document.createTextNode("");r[t]=l,Z.call(i,l,o),e&&s.beforeRemove(),s.remove(),n[t]=void 0}else if(l){n[t]=l;const e=r[t];l.mount(i,e),et.call(i,e)}}}beforeRemove(){const t=this.children;for(let e=0,n=t.length;e<n;e++){const n=t[e];n&&n.beforeRemove()}}remove(){const t=this.parentEl;if(this.isOnlyChild)Q.call(t,"");else{const e=this.children,n=this.anchors;for(let o=0,r=e.length;o<r;o++){const r=e[o];r?r.remove():et.call(t,n[o])}}}firstNode(){const t=this.children[0];return t?t.firstNode():this.anchors[0]}toString(){return this.children.map(t=>t?t.toString():"").join("")}}function ot(t){return new nt(t)}const rt=Node.prototype,it=CharacterData.prototype,st=rt.insertBefore,lt=((t,e)=>Object.getOwnPropertyDescriptor(t,e))(it,"data").set,ct=rt.removeChild;class at{constructor(t){this.text=t}mountNode(t,e,n){this.parentEl=e,st.call(e,t,n),this.el=t}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e,st.call(e,this.el,t)}moveBeforeVNode(t,e){st.call(this.parentEl,this.el,t?t.el:e)}beforeRemove(){}remove(){ct.call(this.parentEl,this.el)}firstNode(){return this.el}toString(){return this.text}}class ht extends at{mount(t,e){this.mountNode(document.createTextNode(pt(this.text)),t,e)}patch(t){const e=t.text;this.text!==e&&(lt.call(this.el,pt(e)),this.text=e)}}class ut extends at{mount(t,e){this.mountNode(document.createComment(pt(this.text)),t,e)}patch(){}}function dt(t){return new ht(t)}function ft(t){return new ut(t)}function pt(t){switch(typeof t){case"string":return t;case"number":return String(t);case"boolean":return t?"true":"false";default:return t||""}}const mt=(t,e)=>Object.getOwnPropertyDescriptor(t,e),gt=Node.prototype,yt=Element.prototype,vt=mt(CharacterData.prototype,"data").set,bt=mt(gt,"firstChild").get,wt=mt(gt,"nextSibling").get,xt=()=>{};function Nt(t){return function(e){this[t]=0===e?0:e?e.valueOf():""}}const Et={};function _t(t){if(t in Et)return Et[t];const e=(new DOMParser).parseFromString(`<t>${t}</t>`,"text/xml").firstChild.firstChild;O.shouldNormalizeDom&&Dt(e);const n=Ot(e),o=St(n),r=function(t,e){let n=function(t,e){const{refN:n,collectors:o,children:r,locations:i,cbRefs:s}=e,l=o.length;i.sort((t,e)=>t.idx-e.idx);const c=i.length,a=r.length,h=r,u=n>0,d=gt.cloneNode,f=gt.insertBefore,p=yt.remove;class m{constructor(t){this.data=t}beforeRemove(){}remove(){p.call(this.el)}firstNode(){return this.el}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e,f.call(e,this.el,t)}moveBeforeVNode(t,e){f.call(this.parentEl,this.el,t?t.el:e)}toString(){const t=document.createElement("div");return this.mount(t,null),t.innerHTML}mount(e,n){const o=d.call(t,!0);f.call(e,o,n),this.el=o,this.parentEl=e}patch(t,e){}}u&&(m.prototype.mount=function(e,r){const u=d.call(t,!0),p=new Array(n);this.refs=p,p[0]=u;for(let t=0;t<l;t++){const e=o[t];p[e.idx]=e.getVal.call(p[e.prevIdx])}if(c){const t=this.data;for(let e=0;e<c;e++){const n=i[e];n.setData.call(p[n.refIdx],t[e])}}if(f.call(e,u,r),a){const t=this.children;for(let e=0;e<a;e++){const n=t[e];if(n){const t=h[e],o=t.afterRefIdx?p[t.afterRefIdx]:null;n.isOnlyChild=t.isOnlyChild,n.mount(p[t.parentRefIdx],o)}}}if(this.el=u,this.parentEl=e,s.length){const t=this.data,e=this.refs;for(let n of s){const{idx:o,refIdx:r}=i[n];(0,t[o])(e[r],null)}}},m.prototype.patch=function(t,e){if(this===t)return;const n=this.refs;if(c){const e=this.data,o=t.data;for(let t=0;t<c;t++){const r=e[t],s=o[t];if(r!==s){const e=i[t];e.updateData.call(n[e.refIdx],s,r)}}this.data=o}if(a){let o=this.children;const r=t.children;for(let t=0;t<a;t++){const i=o[t],s=r[t];if(i)s?i.patch(s,e):(e&&i.beforeRemove(),i.remove(),o[t]=void 0);else if(s){const e=h[t],r=e.afterRefIdx?n[e.afterRefIdx]:null;s.mount(n[e.parentRefIdx],r),o[t]=s}}}},m.prototype.remove=function(){if(s.length){const t=this.data,e=this.refs;for(let n of s){const{idx:o,refIdx:r}=i[n];(0,t[o])(null,e[r])}}p.call(this.el)});return m}(t,e);if(e.children.length)return n=class extends n{constructor(t,e){super(t),this.children=e}},n.prototype.beforeRemove=nt.prototype.beforeRemove,(t,e=[])=>new n(t,e);return t=>new n(t)}(n.el,o);return Et[t]=r,r}function Dt(t){if(t.nodeType!==Node.TEXT_NODE||/\S/.test(t.textContent)){if(t.nodeType!==Node.ELEMENT_NODE||"pre"!==t.tagName)for(let e=t.childNodes.length-1;e>=0;--e)Dt(t.childNodes.item(e))}else t.remove()}function Ot(t,n=null,o=null){switch(t.nodeType){case Node.ELEMENT_NODE:{let e=o&&o.currentNS;const r=t.tagName;let i;const s=[];if(r.startsWith("block-text-")){const t=parseInt(r.slice(11),10);s.push({type:"text",idx:t}),i=document.createTextNode("")}if(r.startsWith("block-child-")){o.isRef||Tt(o);const t=parseInt(r.slice(12),10);s.push({type:"child",idx:t}),i=document.createTextNode("")}if(e||(e=t.namespaceURI),i||(i=e?document.createElementNS(e,r):document.createElement(r)),i instanceof Element){if(!o){document.createElement("template").content.appendChild(i)}const e=t.attributes;for(let t=0;t<e.length;t++){const n=e[t].name,o=e[t].value;if(n.startsWith("block-handler-")){const t=parseInt(n.slice(14),10);s.push({type:"handler",idx:t,event:o})}else if(n.startsWith("block-attribute-")){const t=parseInt(n.slice(16),10);s.push({type:"attribute",idx:t,name:o,tag:r})}else if(n.startsWith("block-property-")){const t=parseInt(n.slice(15),10);s.push({type:"property",idx:t,name:o,tag:r})}else"block-attributes"===n?s.push({type:"attributes",idx:parseInt(o,10)}):"block-ref"===n?s.push({type:"ref",idx:parseInt(o,10)}):i.setAttribute(e[t].name,o)}}const l={parent:n,firstChild:null,nextSibling:null,el:i,info:s,refN:0,currentNS:e};if(t.firstChild){const e=t.childNodes[0];if(1===t.childNodes.length&&e.nodeType===Node.ELEMENT_NODE&&e.tagName.startsWith("block-child-")){const t=e.tagName,n=parseInt(t.slice(12),10);s.push({idx:n,type:"child",isOnlyChild:!0})}else{l.firstChild=Ot(t.firstChild,l,l),i.appendChild(l.firstChild.el);let e=t.firstChild,n=l.firstChild;for(;e=e.nextSibling;)n.nextSibling=Ot(e,n,l),i.appendChild(n.nextSibling.el),n=n.nextSibling}}return l.info.length&&Tt(l),l}case Node.TEXT_NODE:case Node.COMMENT_NODE:return{parent:n,firstChild:null,nextSibling:null,el:t.nodeType===Node.TEXT_NODE?document.createTextNode(t.textContent):document.createComment(t.textContent),info:[],refN:0,currentNS:null}}throw new e("boom")}function Tt(t){t.isRef=!0;do{t.refN++}while(t=t.parent)}function kt(t){let e=t.parent;for(;e&&e.nextSibling===t;)t=e,e=e.parent;return e}function St(t,e,n){if(!e){e={collectors:[],locations:[],children:new Array(t.info.filter(t=>"child"===t.type).length),cbRefs:[],refN:t.refN},n=0}if(t.refN){const o=n,r=t.isRef,i=t.firstChild?t.firstChild.refN:0,s=t.nextSibling?t.nextSibling.refN:0;if(r){for(let e of t.info)e.refIdx=o;t.refIdx=o,function(t,e){for(let n of e.info)switch(n.type){case"text":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:Rt,updateData:Rt});break;case"child":n.isOnlyChild?t.children[n.idx]={parentRefIdx:n.refIdx,isOnlyChild:!0}:t.children[n.idx]={parentRefIdx:kt(e).refIdx,afterRefIdx:n.refIdx};break;case"property":{const e=n.refIdx,o=Nt(n.name);t.locations.push({idx:n.idx,refIdx:e,setData:o,updateData:o});break}case"attribute":{const e=n.refIdx;let o,r;"class"===n.name?(r=H,o=X):(r=$(n.name),o=r),t.locations.push({idx:n.idx,refIdx:e,setData:r,updateData:o});break}case"attributes":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:F,updateData:W});break;case"handler":{const{setup:e,update:o}=q(n.event);t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:e,updateData:o});break}case"ref":t.locations.push({idx:n.idx,refIdx:n.refIdx,setData:xt,updateData:xt}),t.cbRefs.push(n.idx)}}(e,t),n++}if(s){const r=n+i;e.collectors.push({idx:r,prevIdx:o,getVal:wt}),St(t.nextSibling,e,r)}i&&(e.collectors.push({idx:n,prevIdx:o,getVal:bt}),St(t.firstChild,e,n))}return e}function Rt(t){vt.call(this,pt(t))}const Ct=Node.prototype,Mt=Ct.insertBefore,It=Ct.appendChild,Pt=Ct.removeChild,Bt=((t,e)=>Object.getOwnPropertyDescriptor(t,e))(Ct,"textContent").set;class jt{constructor(t){this.children=t}mount(t,e){const n=this.children,o=document.createTextNode("");this.anchor=o,Mt.call(t,o,e);const r=n.length;if(r){const e=n[0].mount;for(let i=0;i<r;i++)e.call(n[i],t,o)}this.parentEl=t}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e;const n=this.children;for(let o=0,r=n.length;o<r;o++)n[o].moveBeforeDOMNode(t,e);e.insertBefore(this.anchor,t)}moveBeforeVNode(t,e){if(t){const n=t.children[0];e=(n?n.firstNode():t.anchor)||null}const n=this.children;for(let t=0,o=n.length;t<o;t++)n[t].moveBeforeVNode(null,e);this.parentEl.insertBefore(this.anchor,e)}patch(t,e){if(this===t)return;const n=this.children,o=t.children;if(0===o.length&&0===n.length)return;this.children=o;const r=o[0]||n[0],{mount:i,patch:s,remove:l,beforeRemove:c,moveBeforeVNode:a,firstNode:h}=r,u=this.anchor,d=this.isOnlyChild,f=this.parentEl;if(0===o.length&&d){if(e)for(let t=0,e=n.length;t<e;t++)c.call(n[t]);return Bt.call(f,""),void It.call(f,u)}let p,m=0,g=0,y=n[0],v=o[0],b=n.length-1,w=o.length-1,x=n[b],N=o[w];for(;m<=b&&g<=w;){if(null===y){y=n[++m];continue}if(null===x){x=n[--b];continue}let t=y.key,r=v.key;if(t===r){s.call(y,v,e),o[g]=y,y=n[++m],v=o[++g];continue}let l=x.key,c=N.key;if(l===c){s.call(x,N,e),o[w]=x,x=n[--b],N=o[--w];continue}if(t===c){s.call(y,N,e),o[w]=y;const t=o[w+1];a.call(y,t,u),y=n[++m],N=o[--w];continue}if(l===r){s.call(x,v,e),o[g]=x;const t=n[m];a.call(x,t,u),x=n[--b],v=o[++g];continue}p=p||Lt(n,m,b);let d=p[r];if(void 0===d)i.call(v,f,h.call(y)||null);else{const t=n[d];a.call(t,y,null),s.call(t,v,e),o[g]=t,n[d]=null}v=o[++g]}if(m<=b||g<=w)if(m>b){const t=o[w+1],e=t?h.call(t)||null:u;for(let t=g;t<=w;t++)i.call(o[t],f,e)}else for(let t=m;t<=b;t++){let o=n[t];o&&(e&&c.call(o),l.call(o))}}beforeRemove(){const t=this.children,e=t.length;if(e){const n=t[0].beforeRemove;for(let o=0;o<e;o++)n.call(t[o])}}remove(){const{parentEl:t,anchor:e}=this;if(this.isOnlyChild)Bt.call(t,"");else{const n=this.children,o=n.length;if(o){const t=n[0].remove;for(let e=0;e<o;e++)t.call(n[e])}Pt.call(t,e)}}firstNode(){const t=this.children[0];return t?t.firstNode():void 0}toString(){return this.children.map(t=>t.toString()).join("")}}function At(t){return new jt(t)}function Lt(t,e,n){let o={};for(let r=e;r<=n;r++)o[t[r].key]=r;return o}const Vt=Node.prototype,$t=Vt.insertBefore,Ft=Vt.removeChild;class Wt{constructor(t){this.content=[],this.html=t}mount(t,e){this.parentEl=t;const n=document.createElement("template");n.innerHTML=this.html,this.content=[...n.content.childNodes];for(let n of this.content)$t.call(t,n,e);if(!this.content.length){const n=document.createTextNode("");this.content.push(n),$t.call(t,n,e)}}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e;for(let n of this.content)$t.call(e,n,t)}moveBeforeVNode(t,e){const n=t?t.content[0]:e;this.moveBeforeDOMNode(n)}patch(t){if(this===t)return;const e=t.html;if(this.html!==e){const n=this.parentEl,o=this.content[0],r=document.createElement("template");r.innerHTML=e;const i=[...r.content.childNodes];for(let t of i)$t.call(n,t,o);if(!i.length){const t=document.createTextNode("");i.push(t),$t.call(n,t,o)}this.remove(),this.content=i,this.html=t.html}}beforeRemove(){}remove(){const t=this.parentEl;for(let e of this.content)Ft.call(t,e)}firstNode(){return this.content[0]}toString(){return this.html}}function Ut(t){return new Wt(t)}function Ht(t,e,n=null){t.mount(e,n)}function Xt(t){let e=t.fiber;if(e){let t=e.root;return t.locked=!0,t.setCounter(t.counter+1-zt(e.children)),t.locked=!1,e.children=[],e.childrenMap={},e.bdom=null,w.has(e)&&(w.delete(e),w.delete(t),e.appliedToDom=!1,e instanceof Gt&&(e.mounted=e instanceof Jt?[e]:[])),e}const n=new Gt(t,null);return t.willPatch.length&&n.willPatch.push(n),t.patched.length&&n.patched.push(n),n}function qt(){throw new e("Attempted to render cancelled fiber")}function zt(t){let e=0;for(let n of t){let t=n.node;n.render=qt,0===t.status&&t.cancel(),t.fiber=null,n.bdom?t.forceNextRender=!0:e++,e+=zt(n.children)}return e}class Kt{constructor(t,e){if(this.bdom=null,this.children=[],this.appliedToDom=!1,this.childrenMap={},this.node=t,this.parent=e,e){const t=e.root;t.setCounter(t.counter+1),this.root=t,e.children.push(this)}else this.root=this}render(){let t=this.root.node,e=t.app.scheduler,n=t.parent;for(;n;){if(n.fiber){let o=n.fiber.root;if(0!==o.counter||!(t.parentKey in n.fiber.childrenMap))return void e.delayedRenders.push(this);n=o.node}t=n,n=n.parent}this._render()}_render(){const t=this.node,e=this.root;e&&(g(t.signalComputation,()=>{try{this.bdom=!0,this.bdom=t.renderFn()}catch(e){t.app.handleError({node:t,error:e})}}),e.setCounter(e.counter-1))}}class Gt extends Kt{constructor(){super(...arguments),this.counter=1,this.willPatch=[],this.patched=[],this.mounted=[],this.locked=!1}complete(){const t=this.node;let e;this.locked=!0;let n=this.mounted;try{for(e of this.willPatch){let t=e.node;if(t.fiber===e){const e=t.component;for(let n of t.willPatch)n.call(e)}}for(e=void 0,t._patch(),this.locked=!1;e=n.pop();)if(e.appliedToDom)for(let t of e.node.mounted)t();let o=this.patched;for(;e=o.pop();)if(e.appliedToDom)for(let t of e.node.patched)t()}catch(o){for(let t of n)t.node.willUnmount=[];this.locked=!1,t.app.handleError({fiber:e||this,error:o})}}setCounter(t){this.counter=t,0===t&&this.node.app.scheduler.flush()}}class Jt extends Gt{constructor(t,e,n={}){super(t,null),this.target=e,this.position=n.position||"last-child"}complete(){let t=this;try{const e=this.node;if(e.children=this.childrenMap,e.app.constructor.validateTarget(this.target),e.bdom)e.updateDom();else if(e.bdom=this.bdom,"last-child"===this.position||0===this.target.childNodes.length)Ht(e.bdom,this.target);else{const t=this.target.childNodes[0];Ht(e.bdom,this.target,t)}e.fiber=null,e.status=1,this.appliedToDom=!0;let n=this.mounted;for(;t=n.pop();)if(t.appliedToDom)for(let e of t.node.mounted)e()}catch(e){this.node.app.handleError({fiber:t,error:e})}}}let Zt=null;function Qt(){if(!Zt)throw new e("No active component (a hook function should only be called in 'setup')");return Zt}class Yt{constructor(t,e,n,o,r){this.fiber=null,this.bdom=null,this.status=0,this.forceNextRender=!1,this.children=Object.create(null),this.willStart=[],this.willUnmount=[],this.mounted=[],this.willPatch=[],this.patched=[],this.willDestroy=[],this.name=t.name,Zt=this,this.app=n,this.parent=o,this.parentKey=r,this.pluginManager=o?o.pluginManager:n.pluginManager,this.signalComputation={value:void 0,compute:()=>this.render(!1),sources:new Set,state:c.EXECUTED},this.props=Object.assign({},e);const i=p();m(void 0),this.component=new t(this);const s={this:this.component,__owl__:this};this.renderFn=n.getTemplate(t.template).bind(this.component,s,this),this.component.setup(),m(i),Zt=null}mountComponent(t,e){const n=new Jt(this,t,e);this.app.scheduler.addFiber(n),this.initiateRender(n)}async initiateRender(t){this.fiber=t,this.mounted.length&&t.root.mounted.push(t);const e=this.component;try{let t;g(void 0,()=>{t=this.willStart.map(t=>t.call(e))}),await Promise.all(t)}catch(t){return void this.app.handleError({node:this,error:t})}0===this.status&&this.fiber===t&&t.render()}async render(t){if(this.status>=2)return;let e=this.fiber;if(e&&(e.root.locked||!0===e.bdom)&&(await Promise.resolve(),e=this.fiber),e&&!e.bdom&&!w.has(e)||!e&&!this.bdom)return;const n=Xt(this);this.fiber=n,this.app.scheduler.addFiber(n),await Promise.resolve(),this.status>=2||this.fiber!==n||!e&&n.parent||n.render()}cancel(){this._cancel(),delete this.parent.children[this.parentKey],this.app.scheduler.scheduleDestroy(this)}_cancel(){this.status=2;const t=this.children;for(let e in t)t[e]._cancel()}destroy(){let t=1===this.status;this._destroy(),t&&this.bdom.remove()}_destroy(){const t=this.component;if(1===this.status)for(let e of this.willUnmount)e.call(t);for(let t of Object.values(this.children))t._destroy();if(this.willDestroy.length)try{for(let e of this.willDestroy)e.call(t)}catch(t){this.app.handleError({error:t,node:this})}this.status=3}updateDom(){if(this.fiber)if(this.bdom===this.fiber.bdom)for(let t in this.children){this.children[t].updateDom()}else this.bdom.patch(this.fiber.bdom,!1),this.fiber.appliedToDom=!0,this.fiber=null}firstNode(){const t=this.bdom;return t?t.firstNode():void 0}mount(t,e){const n=this.fiber.bdom;this.bdom=n,n.mount(t,e),this.status=1,this.fiber.appliedToDom=!0,this.children=this.fiber.childrenMap,this.fiber=null}moveBeforeDOMNode(t,e){this.bdom.moveBeforeDOMNode(t,e)}moveBeforeVNode(t,e){this.bdom.moveBeforeVNode(t?t.bdom:null,e)}patch(){this.fiber&&this.fiber.parent&&this._patch()}_patch(){let t=!1;for(let e in this.children){t=!0;break}const e=this.fiber;this.children=e.childrenMap,this.bdom.patch(e.bdom,t),e.appliedToDom=!0,this.fiber=null}beforeRemove(){this._destroy()}remove(){this.bdom.remove()}}function te(t,n){const o=ee(t,n);if(o.length){const t=JSON.stringify(o,(t,e)=>"function"==typeof e?e.name:e,2);throw new e(`Value does not match the type\n${t}`)}}function ee(t,e){return e(t)}const ne=function(t){return"string"!=typeof t?[{type:"type",expected:String,received:t}]:[]};function oe(...t){return function(e){if("object"!=typeof e)return[{type:"type",expected:Object,received:e}];const n=Object.keys(e),o=t.filter(t=>!!t.endsWith("?")||!n.includes(t));return o.length?[{type:"missing keys",value:e,missingKeys:o}]:[]}}function re(t){return function(e){if("object"!=typeof e)return[{type:"type",expected:Object,received:e}];if(t){const n=[],o=[];for(let r in t){const i=ee(e[r],t[r]);r in e?o.push(...i):n.push(r)}return n.length&&o.push({type:"missing keys",value:e,missingKeys:n}),o}return[]}}var ie={__proto__:null,any:function(){return[]},boolean:function(t){return"boolean"!=typeof t?[{type:"type",expected:Boolean,received:t}]:[]},number:function(t){return"number"!=typeof t?[{type:"type",expected:Number,received:t}]:[]},string:ne,array:function(t){return function(e){return Array.isArray(e)?t?e.flatMap(e=>ee(e,t)):[]:[{type:"type",expected:Array,received:e}]}},func:function(t,e){return function(t){return"function"!=typeof t?[{type:"type",expected:Function,received:t}]:[]}},instanceOf:function(t){return function(e){return e instanceof t?[]:[{type:"type",expected:t,received:e}]}},keys:oe,literal:function(t){return function(e){return e!==t?[{type:"exact value",expected:t,received:e}]:[]}},object:re,optional:function(t){return function(e){return void 0===e?[]:ee(e,t)}},record:function(t){return function(e){if("object"!=typeof e)return[{type:"type",expected:Object,received:e}];const n=[];for(let o in e)n.push(...ee(e[o],t));return n}},tuple:function(...t){return function(e){return Array.isArray(e)?e.length!==t.length?[{type:"length",expected:t.length,received:e.length}]:t.flatMap((t,n)=>ee(e[n],t)):[{type:"type",expected:Array,received:e}]}},constructor:function(t){return function(e){return"function"==typeof e&&(e===t||e.prototype instanceof t)?[]:[{type:"type"}]}},union:function(...t){return function(e){return t.filter(t=>ee(e,t).length).length?[{type:"union"}]:[]}},signal:function(t){return function(t){return"function"!=typeof t?[{type:"type",expected:Function,received:t}]:"function"!=typeof t.set?[{type:"type",expected:Function,received:t.set}]:[]}},reactiveValue:function(t){return function(t){return"function"!=typeof t?[{type:"type",expected:Function,received:t}]:[]}}};let se={};class le{constructor(t){var e;this.children=[],this.onDestroyCb=[],this.status=0,this.parent=t||null,null===(e=this.parent)||void 0===e||e.children.push(this),this.plugins=this.parent?Object.create(this.parent.plugins):{}}destroy(){for(let t of this.children)t.destroy();const t=this.onDestroyCb;for(;t.length;)t.pop()();this.status=3}getPluginById(t){return this.plugins[t]||null}getPlugin(t){return this.getPluginById(t.id)}startPlugins(t,n={}){const o=le.current;le.current=this;const r=[];for(const i of t){if(!i.id)throw le.current=o,new e(`Plugin "${i.name}" has no id`);if(this.plugins.hasOwnProperty(i.id)){const t=this.getPluginById(i.id).constructor;if(t!==i)throw le.current=o,new e(`Trying to start a plugin with the same id as an other plugin (id: '${i.id}', existing plugin: '${t.name}', starting plugin: '${i.name}')`);continue}se=n[i.id]||{};const t=new i;this.plugins[i.id]=t,r.push(t)}se={};for(let t of r)t.setup();return le.current=o,le.current||(this.status=1),r}}function ce(t){const n=le.current||Qt().pluginManager;let o=n.getPluginById(t.id);if(!o){if(n!==le.current)throw new e(`Unknown plugin "${t.id}"`);n.startPlugins([t]),o=n.getPluginById(t.id)}return o}le.current=null,ce.props=function(t,e={}){function n(t){return void 0===se[t]?e[t]:se[t]}const o=Object.create(null);function r(t){for(const e of t)Reflect.defineProperty(o,e,{enumerable:!0,get:n.bind(null,e)})}if(t){const e=t&&!Array.isArray(t);r((e?Object.keys(t):t).map(t=>t.endsWith("?")?t.slice(0,-1):t));if(Qt().app.dev){const n=e?re(t):oe(...t);te(se,n)}}else r(Object.keys(se));return se};const ae=Symbol("Key changes"),he=Object.prototype.toString,ue=Object.prototype.hasOwnProperty,de=["Object","Array","Set","Map","WeakMap"],fe=["Set","Map","WeakMap"];function pe(t){return he.call(be(t)).slice(8,-1)}function me(t){return"object"==typeof t&&de.includes(pe(t))}function ge(t,e){return!e&&me(t)?Oe(t):t}const ye=new WeakSet;function ve(t){return ye.add(t),t}function be(t){return Ee.has(t)?Ee.get(t):t}const we=new WeakMap;function xe(t,e,n){u(null!=n?n:function(t,e){let n=we.get(t);n||(n=new Map,we.set(t,n));let o=n.get(e);return o||(o={value:void 0,observers:new Set},n.set(e,o)),o}(t,e))}function Ne(t,e,n){if(!n){const o=we.get(t);if(!o)return;if(!o.has(e))return;n=o.get(e)}d(n)}const Ee=new WeakMap,_e=new WeakMap;function De(t,n){if(!me(t))throw new e("Cannot make the given value reactive");if(ye.has(t))return t;if(Ee.has(t))return t;const o=_e.get(t);if(o)return o;const r=pe(t),i=fe.includes(r)?function(t,e,n){const o=Ie[e](t,n);return Object.assign(Te(n),{get:(t,e)=>ue.call(o,e)?o[e]:(xe(t,e,n),ge(t[e],n))})}(t,r,n):Te(n),s=new Proxy(t,i);return _e.set(t,s),Ee.set(s,t),s}function Oe(t){return De(t,null)}function Te(t){return{get(e,n,o){const r=Object.getOwnPropertyDescriptor(e,n);return!r||r.writable||r.configurable?(xe(e,n,t),ge(Reflect.get(e,n,o),t)):Reflect.get(e,n,o)},set(e,n,o,r){const i=ue.call(e,n),s=Reflect.get(e,n,r),l=Reflect.set(e,n,be(o),r);return!i&&ue.call(e,n)&&Ne(e,ae,t),(s!==Reflect.get(e,n,r)||"length"===n&&Array.isArray(e))&&Ne(e,n,t),l},deleteProperty(e,n){const o=Reflect.deleteProperty(e,n);return Ne(e,ae,t),Ne(e,n,t),o},ownKeys:e=>(xe(e,ae,t),Reflect.ownKeys(e)),has:(e,n)=>(xe(e,ae,t),Reflect.has(e,n))}}function ke(t,e,n){return o=>(o=be(o),xe(e,o,n),ge(e[t](o),n))}function Se(t,e,n){return function*(){xe(e,ae,n);const o=e.keys();for(const r of e[t]()){const t=o.next().value;xe(e,t,n),yield ge(r,n)}}}function Re(t,e){return function(n,o){xe(t,ae,e),t.forEach(function(r,i,s){xe(t,i,e),n.call(o,ge(r,e),ge(i,e),ge(s,e))},o)}}function Ce(t,e,n,o){return(r,i)=>{r=be(r);const s=n.has(r),l=n[e](r),c=n[t](r,i);return s!==n.has(r)&&Ne(n,ae,o),l!==n[e](r)&&Ne(n,r,o),c}}function Me(t,e){return()=>{const n=[...t.keys()];t.clear(),Ne(t,ae,e);for(const o of n)Ne(t,o,e)}}const Ie={Set:(t,e)=>({has:ke("has",t,e),add:Ce("add","has",t,e),delete:Ce("delete","has",t,e),keys:Se("keys",t,e),values:Se("values",t,e),entries:Se("entries",t,e),[Symbol.iterator]:Se(Symbol.iterator,t,e),forEach:Re(t,e),clear:Me(t,e),get size(){return xe(t,ae,e),t.size}}),Map:(t,e)=>({has:ke("has",t,e),get:ke("get",t,e),set:Ce("set","get",t,e),delete:Ce("delete","has",t,e),keys:Se("keys",t,e),values:Se("values",t,e),entries:Se("entries",t,e),[Symbol.iterator]:Se(Symbol.iterator,t,e),forEach:Re(t,e),clear:Me(t,e),get size(){return xe(t,ae,e),t.size}}),WeakMap:(t,e)=>({has:ke("has",t,e),get:ke("get",t,e),set:Ce("set","get",t,e),delete:Ce("delete","has",t,e)})};class Pe{constructor(){this.tasks=new Set,this.frame=0,this.delayedRenders=[],this.cancelledNodes=new Set,this.processing=!1,this.requestAnimationFrame=Pe.requestAnimationFrame}addFiber(t){this.tasks.add(t.root)}scheduleDestroy(t){this.cancelledNodes.add(t),0===this.frame&&(this.frame=this.requestAnimationFrame(()=>this.processTasks()))}flush(){if(this.delayedRenders.length){let t=this.delayedRenders;this.delayedRenders=[];for(let e of t)e.root&&3!==e.node.status&&e.node.fiber===e&&e.render()}0===this.frame&&(this.frame=this.requestAnimationFrame(()=>this.processTasks()))}processTasks(){if(!this.processing){this.processing=!0,this.frame=0;for(let t of this.cancelledNodes)t._destroy();this.cancelledNodes.clear();for(let t of this.tasks)this.processFiber(t);for(let t of this.tasks)3===t.node.status&&this.tasks.delete(t);this.processing=!1}}processFiber(t){if(t.root!==t)return void this.tasks.delete(t);const e=w.has(t);e&&0!==t.counter?this.tasks.delete(t):3!==t.node.status?0===t.counter&&(e||t.complete(),t.appliedToDom&&this.tasks.delete(t)):this.tasks.delete(t)}}function Be(t,e,n){const o=e.bind(t.component);if(t.app.dev){const t=e.name?` <${e.name}>`:"";Reflect.defineProperty(o,"name",{value:n+t})}return o}function je(t){const e=Qt();e.mounted.push(Be(e,t,"onMounted"))}function Ae(t){const e=Qt();e.willUnmount.unshift(Be(e,t,"onWillUnmount"))}function Le(t){const e=le.current;if(e)e.onDestroyCb.push(t);else{const e=Qt();e.willDestroy.unshift(Be(e,t,"onWillDestroy"))}}function Ve(t,e={}){const n=Qt(),o=Object.create(null);function r(t){for(const r of t)o[r]=void 0===n.props?e[r]:n.props[r]}if(t){const e=t&&!Array.isArray(t);if(r((e?Object.keys(t):t).map(t=>t.endsWith("?")?t.slice(0,-1):t)),n.app.dev){const o=e?re(t):oe(...t);te(n.props,o)}}else r(Object.keys(n.props));return o}Pe.requestAnimationFrame=window.requestAnimationFrame.bind(window);const $e=dt("").constructor;class Fe extends $e{constructor(t,e){super(""),this.target=null,this.selector=t,this.content=e}mount(t,e){super.mount(t,e),this.target=document.querySelector(this.selector),this.target?this.content.mount(this.target,null):this.content.mount(t,e)}beforeRemove(){this.content.beforeRemove()}remove(){this.content&&(super.remove(),this.content.remove(),this.content=null)}patch(t){super.patch(t),this.content?this.content.patch(t.content,!0):(this.content=t.content,this.content.mount(this.target,null))}}class We extends n{constructor(){super(...arguments),this.props=Ve({target:ne})}setup(){const t=this.__owl__;je(()=>{const n=t.bdom;if(!n.target){const o=document.querySelector(t.props.target);if(!o)throw new e("invalid portal target");n.content.moveBeforeDOMNode(o.firstChild,o)}}),Ae(()=>{t.bdom.remove()})}}We.template="__portal__";const Ue=Object.create;function He(t){const e=Ue(t);for(let n in t)e[n]=t[n];return e}const Xe=Symbol("isBoundary");class qe{constructor(t,e,n,o,r){this.fn=t,this.ctx=He(e),this.component=n,this.node=o,this.key=r}evaluate(){return this.fn.call(this.component,this.ctx,this.node,this.key)}toString(){return this.evaluate().toString()}}const ze={withDefault:function(t,e){return null==t||!1===t?e:t},zero:Symbol("zero"),isBoundary:Xe,callSlot:function(t,e,n,o,r,i,s){n=n+"__slot_"+o;const l=t.__owl__.props.slots||{},{__render:c,__ctx:a,__scope:h}=l[o]||{},u=Ue(a||{});h&&(u[h]=i);const d=c?c(u,e,n):null;if(s){let i,l;return d?i=r?S(o,d):d:l=s(t,e,n),ot([i,l])}return d||dt("")},capture:He,withKey:function(t,e){return t.key=e,t},prepareList:function(t){let n,o;if(Array.isArray(t))n=t,o=t;else if(t instanceof Map)n=[...t.keys()],o=[...t.values()];else if(Symbol.iterator in Object(t))n=[...t],o=n;else{if(!t||"object"!=typeof t)throw new e(`Invalid loop expression: "${t}" is not iterable`);o=Object.values(t),n=Object.keys(t)}const r=o.length;return[n,o,r,new Array(r)]},setContextValue:function(t,e,n){const o=t;for(;!t.hasOwnProperty(e)&&!t.hasOwnProperty(Xe);){const e=t.__proto__;if(!e){t=o;break}t=e}t[e]=n},shallowEqual:function(t,e){for(let n=0,o=t.length;n<o;n++)if(t[n]!==e[n])return!1;return!0},toNumber:function(t){const e=parseFloat(t);return isNaN(e)?t:e},LazyValue:qe,safeOutput:function(t,e){if(null==t)return e?S("default",e):S("undefined",dt(""));let n,o;return t instanceof i?(n="string_safe",o=Ut(t)):t instanceof qe?(n="lazy_value",o=t.evaluate()):(n="string_unsafe",o=dt(t)),S(n,o)},createCatcher:function(t){const e=Object.keys(t).length;class n{constructor(t,e){this.handlerFns=[],this.afterNode=null,this.child=t,this.handlerData=e}mount(e,n){this.parentEl=e,this.child.mount(e,n),this.afterNode=document.createTextNode(""),e.insertBefore(this.afterNode,n),this.wrapHandlerData();for(let n in t){const o=t[n],r=q(n);this.handlerFns[o]=r,r.setup.call(e,this.handlerData[o])}}wrapHandlerData(){for(let t=0;t<e;t++){let e=this.handlerData[t],n=e.length-2,o=e[n];const r=this;e[n]=function(t){const e=t.target;let n=r.child.firstNode();const i=r.afterNode;for(;n&&n!==i;){if(n.contains(e))return o.call(this,t);n=n.nextSibling}}}}moveBeforeDOMNode(t,e=this.parentEl){this.parentEl=e,this.child.moveBeforeDOMNode(t,e),e.insertBefore(this.afterNode,t)}moveBeforeVNode(t,e){t&&(e=t.firstNode()||e),this.child.moveBeforeVNode(t?t.child:null,e),this.parentEl.insertBefore(this.afterNode,e)}patch(t,n){if(this!==t){this.handlerData=t.handlerData,this.wrapHandlerData();for(let t=0;t<e;t++)this.handlerFns[t].update.call(this.parentEl,this.handlerData[t]);this.child.patch(t.child,n)}}beforeRemove(){this.child.beforeRemove()}remove(){for(let t=0;t<e;t++)this.handlerFns[t].remove.call(this.parentEl);this.child.remove(),this.afterNode.remove()}firstNode(){return this.child.firstNode()}toString(){return this.child.toString()}}return function(t,e){return new n(t,e)}},markRaw:ve,OwlError:e,createRef:function(t){if(!t)throw new e("Ref is undefined or null");let n,o;if(t.add&&t.remove)n=t.add.bind(t),o=t.remove.bind(t);else{if(!t.set)throw new e("Ref should implement either a 'set' function or 'add' and 'remove' functions");n=t.set.bind(t),o=()=>t.set(null)}return(t,e)=>{e&&o(e),t&&n(t)}},modelExpr:function(t){if(!t.set||"function"!=typeof t)throw new e("Invalid t-model expression: expression should evaluate to a function with a 'set' method defined on it");return t}};const Ke={text:dt,createBlock:_t,list:At,multi:ot,html:Ut,toggler:S,comment:ft};class Ge{static registerTemplate(t,e){Je[t]=e}constructor(t={}){if(this.rawTemplates=Object.create(Je),this.templates={},this.Portal=We,this.dev=t.dev||!1,this.translateFn=t.translateFn,this.translatableAttributes=t.translatableAttributes,t.templates)if(t.templates instanceof Document||"string"==typeof t.templates)this.addTemplates(t.templates);else for(const e in t.templates)this.addTemplate(e,t.templates[e]);this.getRawTemplate=t.getTemplate,this.customDirectives=t.customDirectives||{},this.runtimeUtils={...ze,__globals__:t.globalValues||{}},this.hasGlobalValues=Boolean(t.globalValues&&Object.keys(t.globalValues).length)}addTemplate(t,n){if(t in this.rawTemplates){if(!this.dev)return;const o=this.rawTemplates[t];if(("string"==typeof o?o:o instanceof Element?o.outerHTML:o.toString())===("string"==typeof n?n:n.outerHTML))return;throw new e(`Template ${t} already defined with different content`)}this.rawTemplates[t]=n}addTemplates(t){if(t){t=t instanceof Document?t:function(t){const n=(new DOMParser).parseFromString(t,"text/xml");if(n.getElementsByTagName("parsererror").length){let o="Invalid XML in template.";const r=n.getElementsByTagName("parsererror")[0].textContent;if(r){o+="\nThe parser has produced the following error message:\n"+r;const e=/\d+/g,n=e.exec(r);if(n){const i=Number(n[0]),s=t.split("\n")[i-1],l=e.exec(r);if(s&&l){const t=Number(l[0])-1;s[t]&&(o+=`\nThe error might be located at xml line ${i} column ${t}\n${s}\n${"-".repeat(t-1)}^`)}}}throw new e(o)}return n}(t);for(const e of t.querySelectorAll("[t-name]")){const t=e.getAttribute("t-name");this.addTemplate(t,e)}}}getTemplate(t){var n;if(!(t in this.templates)){const o=(null===(n=this.getRawTemplate)||void 0===n?void 0:n.call(this,t))||this.rawTemplates[t];if(void 0===o){let n="";try{n=` (for component "${Qt().component.constructor.name}")`}catch{}throw new e(`Missing template: "${t}"${n}`)}const r="function"==typeof o&&!(o instanceof Element)?o:this._compileTemplate(t,o),i=this.templates;this.templates[t]=function(e,n){return i[t].call(this,e,n)};const s=r(this,Ke,this.runtimeUtils);this.templates[t]=s}return this.templates[t]}_compileTemplate(t,n){throw new e("Unable to compile a template. Please use owl full build instead")}callTemplate(t,e,n,o,r){return S(e,this.getTemplate(e).call(t,n,o,r+e))}}const Je={};function Ze(...t){const e="__template__"+Ze.nextId++,n=String.raw(...t);return Je[e]=n,e}Ze.nextId=1,Ge.registerTemplate("__portal__",function(t,e,n){let{callSlot:o}=n;return function(t,e,n=""){return new Fe(t.this.props.target,o(t,e,n,"default",!1,null))}});let Qe=!1;const Ye=new Set;window.__OWL_DEVTOOLS__||(window.__OWL_DEVTOOLS__={apps:Ye,Fiber:Kt,RootFiber:Gt,toRaw:be,proxy:Oe});class tn extends Ge{constructor(t={}){super(t),this.scheduler=new Pe,this.roots=new Set,this.name=t.name||"",Ye.add(this),this.pluginManager=t.pluginManager||new le(null),t.plugins&&this.pluginManager.startPlugins(t.plugins),t.test&&(this.dev=!0),!this.dev||t.test||Qe||(console.info("Owl is running in 'dev' mode."),Qe=!0)}createRoot(t,e={}){const n=e.props||{};let o,r;const i=new Promise((t,e)=>{o=t,r=e}),s=function(){let t=Zt;return()=>{Zt=t}}();let l,c=null;try{l=this.makeNode(t,n)}catch(t){c=t,r(t)}finally{s()}const a={node:l,promise:i,mount:(t,e)=>(c||(tn.validateTarget(t),this.mountNode(l,t,o,r,e)),i),destroy:()=>{this.roots.delete(a),l.destroy(),this.scheduler.processTasks()}};return this.roots.add(a),a}makeNode(t,e){return new Yt(t,e,this,null,null)}mountNode(t,e,n,o,r){let i=x.get(t);i||(i=[],x.set(t,i)),i.unshift((t,e)=>{const n=e();o(n)}),t.mounted.push(()=>{n(t.component),i.shift()}),t.mountComponent(e,r)}destroy(){for(let t of this.roots)t.destroy();this.scheduler.processTasks(),Ye.delete(this)}createComponent(t,o){const r=!o,i=Yt.prototype.initiateRender;return(s,l,c,a,h)=>{let u=c.children,d=u[l];r&&d&&d.component.constructor!==h&&(d=void 0);const f=c.fiber;if(!d){if(o){const o=a.constructor.components;if(!o)throw new e(`Cannot find the definition of component "${t}", missing static components key in parent`);if(!(h=o[t]))throw new e(`Cannot find the definition of component "${t}"`);if(!(h.prototype instanceof n))throw new e(`"${t}" is not a Component. It must inherit from the Component class`)}d=new Yt(h,s,this,c,l),u[l]=d,i.call(d,new Kt(d,f))}return f.childrenMap[l]=d,d}}handleError(...t){return _(...t)}}tn.validateTarget=function(t){const n=t&&t.ownerDocument;if(n){if(!n.defaultView)throw new e("Cannot mount a component: the target document is not attached to a window (defaultView is missing)");if(t instanceof n.defaultView.HTMLElement||t instanceof ShadowRoot){if(!function(t,e){let n=t;const o=e.defaultView.ShadowRoot;for(;n;){if(n===e)return!0;if(n.parentNode)n=n.parentNode;else{if(!(n instanceof o&&n.host))return!1;n=n.host}}return!1}(t,n))throw new e("Cannot mount a component on a detached dom node");return}}throw new e("Cannot mount component: the target is not a valid DOM element")},tn.apps=Ye,tn.version="3.0.0-alpha";function en(t,e){let n;return()=>(null!=n||(n={state:c.STALE,sources:new Set,compute:()=>(d(n),t()),isDerived:!0,value:void 0,observers:new Set,name:null==e?void 0:e.name}),y(n),u(n),n.value)}const nn=Symbol("Signal");function on(t,e,n){const o={value:t,observers:new Set,name:null==n?void 0:n.name};let r=e(o);const i=()=>(u(o),r);return i[nn]=o,i.set=t=>{Object.is(o.value,t)||(o.value=t,r=e(o),d(o))},i}function rn(t,e){return on(t,t=>t.value,e)}rn.invalidate=function(t){if(!(nn in t))throw new e(`Value is not a signal (${t})`);d(t[nn])},rn.Array=function(t,e){return on(t,t=>De(t.value,t),e)},rn.Object=function(t,e){return on(t,t=>De(t.value,t),e)},rn.Map=function(t,e){return on(t,t=>De(t.value,t),e)},rn.Set=function(t,e){return on(t,t=>De(t.value,t),e)};function sn(t,e){var n,o,r;const i={state:c.STALE,value:void 0,compute:()=>(m(void 0),ln(i),m(i),t()),sources:new Set,childrenEffect:[],name:null==e?void 0:e.name};return null===(r=null===(o=null===(n=p())||void 0===n?void 0:n.childrenEffect)||void 0===o?void 0:o.push)||void 0===r||r.call(o,i),y(i),()=>{const t=p();m(void 0),ln(i),m(t)}}function ln(t){v(t),function(t){const e=t.value;e&&"function"==typeof e&&(e(),t.value=void 0)}(t);for(const e of t.childrenEffect)e.state=c.EXECUTED,v(e),ln(e);t.childrenEffect.length=0}O.shouldNormalizeDom=!1,O.mainEventHandler=(t,n,o)=>{const{data:r,modifiers:i}=D(t);t=r;let s=!1;if(i.length){let t=!1;const e=n.target===o;for(const o of i)switch(o){case"self":if(t=!0,e)continue;return s;case"prevent":(t&&e||!t)&&n.preventDefault();continue;case"stop":(t&&e||!t)&&n.stopPropagation(),s=!0;continue}}if(Object.hasOwnProperty.call(t,0)){const o=t[0];if("function"!=typeof o)throw new e(`Invalid handler (expected a function, received: '${o}')`);let r=t[1]?t[1].__owl__:null;r&&1!==r.status||o.call(r?r.component:null,n)}return s};const cn={config:O,mount:Ht,patch:function(t,e,n=!1){t.patch(e,n)},remove:function(t,e=!1){e&&t.beforeRemove(),t.remove()},list:At,multi:ot,text:dt,toggler:S,createBlock:_t,html:Ut,comment:ft},an={version:tn.version};t.App=tn,t.Component=n,t.EventBus=r,t.OwlError=e,t.Plugin=class{static get id(){var t;return null!==(t=this._shadowId)&&void 0!==t?t:this.name}static set id(t){this._shadowId=t}setup(){}},t.PluginManager=le,t.Registry=class{constructor(t={}){this._map=rn.Object(Object.create(null)),this.entries=en(()=>Object.entries(this._map()).sort((t,e)=>t[1][0]-e[1][0]).map(([t,e])=>[t,e[1]])),this.items=en(()=>this.entries().map(t=>t[1])),this._name=t.name||"registry",this._validation=t.validation}addById(t,n=50){if(!t.id)throw new e(`Item should have an id key (registry '${this._name}')`);return this.add(t.id,t,n)}add(t,e,n=50){return this._validation&&te(e,this._validation),this._map()[t]=[n,e],this}get(t,e){const n=t in this._map();if(!n&&arguments.length<2)throw new Error(`KeyNotFoundError: Cannot find key "${t}" (registry '${this._name}')`);return n?this._map()[t][1]:e}remove(t){delete this._map()[t]}has(t){return t in this._map()}},t.Resource=class{constructor(t={}){this._items=rn.Array([]),this.items=en(()=>this._items().sort((t,e)=>t[0]-e[0]).map(t=>t[1])),this._validation=t.validation}add(t,e=50){return this._validation&&te(t,this._validation),this._items().push([e,t]),this}remove(t){const e=this._items().filter(([e,n])=>n!==t);return this._items.set(e),this}has(t){return this._items().some(([e,n])=>n===t)}},t.__info__=an,t.assertType=te,t.batched=o,t.blockDom=cn,t.computed=en,t.effect=sn,t.htmlEscape=s,t.markRaw=ve,t.markup=l,t.mount=async function(t,e,n={}){return new tn(n).createRoot(t,n).mount(e,n)},t.onError=function(t){const e=Qt();let n=x.get(e);n||(n=[],x.set(e,n)),n.push(t.bind(e.component))},t.onMounted=je,t.onPatched=function(t){const e=Qt();e.patched.push(Be(e,t,"onPatched"))},t.onWillDestroy=Le,t.onWillPatch=function(t){const e=Qt();e.willPatch.unshift(Be(e,t,"onWillPatch"))},t.onWillStart=function(t){const e=Qt();e.willStart.push(Be(e,t,"onWillStart"))},t.onWillUnmount=Ae,t.plugin=ce,t.props=Ve,t.providePlugins=function(t,e){const n=Qt(),o=new le(n.pluginManager);return n.pluginManager=o,Le(()=>o.destroy()),o.startPlugins(t,e)},t.proxy=Oe,t.signal=rn,t.status=function(){const t=le.current,e=t||Qt();return()=>{switch(e.status){case 0:return"new";case 2:return"cancelled";case 1:return t?"started":"mounted";case 3:return"destroyed"}}},t.toRaw=be,t.types=ie,t.untrack=function(t){return g(void 0,t)},t.useComponent=function(){return Zt.component},t.useEffect=function(t){Le(sn(t))},t.useListener=function(t,e,n,o){t.addEventListener(e,n,o),Le(()=>t.removeEventListener(e,n,o))},t.useResource=function(t,e){for(let n of e)t.add(n);Le(()=>{for(let n of e)t.remove(n)})},t.validateType=ee,t.whenReady=function(t){return new Promise(function(t){"loading"!==document.readyState?t(!0):document.addEventListener("DOMContentLoaded",t,!1)}).then(t||function(){})},t.xml=Ze,Object.defineProperty(t,"__esModule",{value:!0}),an.date="2026-01-14T19:21:38.789Z",an.hash="2278017",an.url="https://github.com/odoo/owl"}(this.owl=this.owl||{});
@@ -1,3 +1,3 @@
1
- export declare class OwlError extends Error {
2
- cause?: any;
3
- }
1
+ export declare class OwlError extends Error {
2
+ cause?: any;
3
+ }
@@ -1,29 +1 @@
1
1
  export declare type customDirectives = Record<string, (node: Element, value: string, modifier: string[]) => void>;
2
- export declare enum ComputationState {
3
- EXECUTED = 0,
4
- STALE = 1,
5
- PENDING = 2
6
- }
7
- export declare type Computation<T = any> = {
8
- compute?: () => T;
9
- state: ComputationState;
10
- sources: Set<Atom | Derived<any, any>>;
11
- isEager?: boolean;
12
- isDerived?: boolean;
13
- value: T;
14
- childrenEffect?: Computation[];
15
- } & Opts;
16
- export declare type Opts = {
17
- name?: string;
18
- };
19
- export declare type Atom<T = any> = {
20
- value: T;
21
- observers: Set<Computation>;
22
- } & Opts;
23
- export interface Derived<Prev, Next = Prev> extends Atom<Next>, Computation<Next> {
24
- }
25
- export declare type OldValue = any;
26
- export declare type Getter<V> = () => V | null;
27
- export declare type Setter<T, V> = (this: T, value: V) => void;
28
- export declare type MakeGetSetReturn<T, V> = readonly [Getter<V>] | readonly [Getter<V>, Setter<T, V>];
29
- export declare type MakeGetSet<T, V> = (obj: T) => MakeGetSetReturn<T, V>;
@@ -1,8 +1,8 @@
1
- /**
2
- * Parses an XML string into an XML document, throwing errors on parser errors
3
- * instead of returning an XML document containing the parseerror.
4
- *
5
- * @param xml the string to parse
6
- * @returns an XML document corresponding to the content of the string
7
- */
8
- export declare function parseXML(xml: string): XMLDocument;
1
+ /**
2
+ * Parses an XML string into an XML document, throwing errors on parser errors
3
+ * instead of returning an XML document containing the parseerror.
4
+ *
5
+ * @param xml the string to parse
6
+ * @returns an XML document corresponding to the content of the string
7
+ */
8
+ export declare function parseXML(xml: string): XMLDocument;
@@ -1,152 +1,134 @@
1
- import { AST, ASTComment, ASTComponent, ASTDebug, ASTDomNode, ASTLog, ASTMulti, ASTSlot, ASTTCall, ASTTCallBlock, ASTTEsc, ASTText, ASTTForEach, ASTTif, ASTTKey, ASTTOut, ASTTPortal, ASTTranslation, ASTTranslationContext, ASTTSet, EventHandlers } from "./parser";
2
- declare type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment";
3
- export interface Config {
4
- translateFn?: (s: string, translationCtx: string) => string;
5
- translatableAttributes?: string[];
6
- dev?: boolean;
7
- }
8
- export interface CodeGenOptions extends Config {
9
- hasSafeContext?: boolean;
10
- name?: string;
11
- hasGlobalValues: boolean;
12
- }
13
- declare class BlockDescription {
14
- static nextBlockId: number;
15
- varName: string;
16
- blockName: string;
17
- dynamicTagName: string | null;
18
- isRoot: boolean;
19
- hasDynamicChildren: boolean;
20
- children: BlockDescription[];
21
- data: string[];
22
- dom?: Node;
23
- currentDom?: Element;
24
- childNumber: number;
25
- target: CodeTarget;
26
- type: BlockType;
27
- parentVar: string;
28
- id: number;
29
- constructor(target: CodeTarget, type: BlockType);
30
- insertData(str: string, prefix?: string): number;
31
- insert(dom: Node): void;
32
- generateExpr(expr: string): string;
33
- asXmlString(): string;
34
- }
35
- interface Context {
36
- block: BlockDescription | null;
37
- index: number | string;
38
- forceNewBlock: boolean;
39
- isLast?: boolean;
40
- translate: boolean;
41
- translationCtx: string;
42
- tKeyExpr: string | null;
43
- nameSpace?: string;
44
- tModelSelectedExpr?: string;
45
- ctxVar?: string;
46
- inPreTag?: boolean;
47
- }
48
- declare class CodeTarget {
49
- name: string;
50
- indentLevel: number;
51
- loopLevel: number;
52
- code: string[];
53
- hasRoot: boolean;
54
- hasCache: boolean;
55
- shouldProtectScope: boolean;
56
- on: EventHandlers | null;
57
- hasRefWrapper: boolean;
58
- constructor(name: string, on?: EventHandlers | null);
59
- addLine(line: string, idx?: number): void;
60
- generateCode(): string;
61
- currentKey(ctx: Context): string;
62
- }
63
- export declare class CodeGenerator {
64
- blocks: BlockDescription[];
65
- nextBlockId: number;
66
- hasSafeContext: boolean;
67
- isDebug: boolean;
68
- targets: CodeTarget[];
69
- target: CodeTarget;
70
- templateName?: string;
71
- dev: boolean;
72
- translateFn: (s: string, translationCtx: string) => string;
73
- translatableAttributes: string[];
74
- ast: AST;
75
- staticDefs: {
76
- id: string;
77
- expr: string;
78
- }[];
79
- slotNames: Set<String>;
80
- helpers: Set<string>;
81
- constructor(ast: AST, options: CodeGenOptions);
82
- generateCode(): string;
83
- compileInNewTarget(prefix: string, ast: AST, ctx: Context, on?: EventHandlers | null): string;
84
- addLine(line: string, idx?: number): void;
85
- define(varName: string, expr: string): void;
86
- insertAnchor(block: BlockDescription, index?: number): void;
87
- createBlock(parentBlock: BlockDescription | null, type: BlockType, ctx: Context): BlockDescription;
88
- insertBlock(expression: string, block: BlockDescription, ctx: Context): void;
89
- /**
90
- * Captures variables that are used inside of an expression. This is useful
91
- * because in compiled code, almost all variables are accessed through the ctx
92
- * object. In the case of functions, that lookup in the context can be delayed
93
- * which can cause issues if the value has changed since the function was
94
- * defined.
95
- *
96
- * @param expr the expression to capture
97
- * @param forceCapture whether the expression should capture its scope even if
98
- * it doesn't contain a function. Useful when the expression will be used as
99
- * a function body.
100
- * @returns a new expression that uses the captured values
101
- */
102
- captureExpression(expr: string, forceCapture?: boolean): string;
103
- translate(str: string, translationCtx: string): string;
104
- /**
105
- * @returns the newly created block name, if any
106
- */
107
- compileAST(ast: AST, ctx: Context): string | null;
108
- compileDebug(ast: ASTDebug, ctx: Context): string | null;
109
- compileLog(ast: ASTLog, ctx: Context): string | null;
110
- compileComment(ast: ASTComment, ctx: Context): string;
111
- compileText(ast: ASTText, ctx: Context): string;
112
- generateHandlerCode(rawEvent: string, handler: string): string;
113
- compileTDomNode(ast: ASTDomNode, ctx: Context): string;
114
- compileTEsc(ast: ASTTEsc, ctx: Context): string;
115
- compileTOut(ast: ASTTOut, ctx: Context): string;
116
- compileTIfBranch(content: AST, block: BlockDescription, ctx: Context): void;
117
- compileTIf(ast: ASTTif, ctx: Context, nextNode?: ASTDomNode): string;
118
- compileTForeach(ast: ASTTForEach, ctx: Context): string;
119
- compileTKey(ast: ASTTKey, ctx: Context): string | null;
120
- compileMulti(ast: ASTMulti, ctx: Context): string | null;
121
- compileTCall(ast: ASTTCall, ctx: Context): string;
122
- compileTCallBlock(ast: ASTTCallBlock, ctx: Context): string;
123
- compileTSet(ast: ASTTSet, ctx: Context): null;
124
- generateComponentKey(currentKey?: string): string;
125
- /**
126
- * Formats a prop name and value into a string suitable to be inserted in the
127
- * generated code. For example:
128
- *
129
- * Name Value Result
130
- * ---------------------------------------------------------
131
- * "number" "state" "number: ctx['state']"
132
- * "something" "" "something: undefined"
133
- * "some-prop" "state" "'some-prop': ctx['state']"
134
- * "onClick.bind" "onClick" "onClick: bind(ctx, ctx['onClick'])"
135
- */
136
- formatProp(name: string, value: string, attrsTranslationCtx: {
137
- [name: string]: string;
138
- } | null, translationCtx: string): string;
139
- formatPropObject(obj: {
140
- [prop: string]: any;
141
- }, attrsTranslationCtx: {
142
- [name: string]: string;
143
- } | null, translationCtx: string): string[];
144
- getPropString(props: string[], dynProps: string | null): string;
145
- compileComponent(ast: ASTComponent, ctx: Context): string;
146
- wrapWithEventCatcher(expr: string, on: EventHandlers): string;
147
- compileTSlot(ast: ASTSlot, ctx: Context): string;
148
- compileTTranslation(ast: ASTTranslation, ctx: Context): string | null;
149
- compileTTranslationContext(ast: ASTTranslationContext, ctx: Context): string | null;
150
- compileTPortal(ast: ASTTPortal, ctx: Context): string;
151
- }
152
- export {};
1
+ import { AST, ASTComment, ASTComponent, ASTDebug, ASTDomNode, ASTLog, ASTMulti, ASTTCall, ASTTCallBlock, ASTTCallSlot, ASTText, ASTTForEach, ASTTif, ASTTKey, ASTTOut, ASTTPortal, ASTTranslation, ASTTranslationContext, ASTTSet, EventHandlers } from "./parser";
2
+ type BlockType = "block" | "text" | "multi" | "list" | "html" | "comment";
3
+ export interface Config {
4
+ translateFn?: (s: string, translationCtx: string) => string;
5
+ translatableAttributes?: string[];
6
+ dev?: boolean;
7
+ }
8
+ export interface CodeGenOptions extends Config {
9
+ name?: string;
10
+ hasGlobalValues: boolean;
11
+ }
12
+ declare class BlockDescription {
13
+ static nextBlockId: number;
14
+ varName: string;
15
+ blockName: string;
16
+ dynamicTagName: string | null;
17
+ isRoot: boolean;
18
+ hasDynamicChildren: boolean;
19
+ children: BlockDescription[];
20
+ data: string[];
21
+ dom?: Node;
22
+ currentDom?: Element;
23
+ childNumber: number;
24
+ target: CodeTarget;
25
+ type: BlockType;
26
+ parentVar: string;
27
+ id: number;
28
+ constructor(target: CodeTarget, type: BlockType);
29
+ insertData(str: string, prefix?: string): number;
30
+ insert(dom: Node): void;
31
+ generateExpr(expr: string): string;
32
+ asXmlString(): string;
33
+ }
34
+ interface Context {
35
+ block: BlockDescription | null;
36
+ index: number | string;
37
+ forceNewBlock: boolean;
38
+ translate: boolean;
39
+ translationCtx: string;
40
+ tKeyExpr: string | null;
41
+ nameSpace?: string;
42
+ tModelSelectedExpr?: string;
43
+ inPreTag?: boolean;
44
+ }
45
+ declare class CodeTarget {
46
+ name: string;
47
+ indentLevel: number;
48
+ loopLevel: number;
49
+ loopCtxVars: string[];
50
+ tSetVars: Map<string, number>;
51
+ code: string[];
52
+ hasRoot: boolean;
53
+ needsScopeProtection: boolean;
54
+ on: EventHandlers | null;
55
+ constructor(name: string, on?: EventHandlers | null);
56
+ addLine(line: string, idx?: number): void;
57
+ generateCode(): string;
58
+ currentKey(ctx: Context): string;
59
+ }
60
+ export declare class CodeGenerator {
61
+ blocks: BlockDescription[];
62
+ nextBlockId: number;
63
+ isDebug: boolean;
64
+ targets: CodeTarget[];
65
+ target: CodeTarget;
66
+ templateName?: string;
67
+ dev: boolean;
68
+ translateFn: (s: string, translationCtx: string) => string;
69
+ translatableAttributes: string[];
70
+ ast: AST;
71
+ staticDefs: {
72
+ id: string;
73
+ expr: string;
74
+ }[];
75
+ slotNames: Set<String | Symbol>;
76
+ helpers: Set<string>;
77
+ constructor(ast: AST, options: CodeGenOptions);
78
+ generateCode(): string;
79
+ compileInNewTarget(prefix: string, ast: AST, ctx: Context, on?: EventHandlers | null): string;
80
+ addLine(line: string, idx?: number): void;
81
+ define(varName: string, expr: string): void;
82
+ insertAnchor(block: BlockDescription, index?: number): void;
83
+ createBlock(parentBlock: BlockDescription | null, type: BlockType, ctx: Context): BlockDescription;
84
+ insertBlock(expression: string, block: BlockDescription, ctx: Context): void;
85
+ translate(str: string, translationCtx: string): string;
86
+ /**
87
+ * @returns the newly created block name, if any
88
+ */
89
+ compileAST(ast: AST, ctx: Context): string | null;
90
+ compileDebug(ast: ASTDebug, ctx: Context): string | null;
91
+ compileLog(ast: ASTLog, ctx: Context): string | null;
92
+ compileComment(ast: ASTComment, ctx: Context): string;
93
+ compileText(ast: ASTText, ctx: Context): string;
94
+ generateHandlerCode(rawEvent: string, handler: string): string;
95
+ compileTDomNode(ast: ASTDomNode, ctx: Context): string;
96
+ compileZero(): string;
97
+ compileTOut(ast: ASTTOut, ctx: Context): string;
98
+ compileTIfBranch(content: AST, block: BlockDescription, ctx: Context): void;
99
+ compileTIf(ast: ASTTif, ctx: Context, nextNode?: ASTDomNode): string;
100
+ compileTForeach(ast: ASTTForEach, ctx: Context): string;
101
+ compileTKey(ast: ASTTKey, ctx: Context): string | null;
102
+ compileMulti(ast: ASTMulti, ctx: Context): string | null;
103
+ compileTCall(ast: ASTTCall, ctx: Context): string;
104
+ compileTCallBlock(ast: ASTTCallBlock, ctx: Context): string;
105
+ compileTSet(ast: ASTTSet, ctx: Context): null;
106
+ generateComponentKey(currentKey?: string): string;
107
+ /**
108
+ * Formats a prop name and value into a string suitable to be inserted in the
109
+ * generated code. For example:
110
+ *
111
+ * Name Value Result
112
+ * ---------------------------------------------------------
113
+ * "number" "state" "number: ctx['state']"
114
+ * "something" "" "something: undefined"
115
+ * "some-prop" "state" "'some-prop': ctx['state']"
116
+ * "onClick.bind" "onClick" "onClick: bind(ctx, ctx['onClick'])"
117
+ */
118
+ formatProp(name: string, value: string, attrsTranslationCtx: {
119
+ [name: string]: string;
120
+ } | null, translationCtx: string): string;
121
+ formatPropObject(obj: {
122
+ [prop: string]: any;
123
+ }, attrsTranslationCtx: {
124
+ [name: string]: string;
125
+ } | null, translationCtx: string): string[];
126
+ getPropString(props: string[], dynProps: string | null): string;
127
+ compileComponent(ast: ASTComponent, ctx: Context): string;
128
+ wrapWithEventCatcher(expr: string, on: EventHandlers): string;
129
+ compileTCallSlot(ast: ASTTCallSlot, ctx: Context): string;
130
+ compileTTranslation(ast: ASTTranslation, ctx: Context): string | null;
131
+ compileTTranslationContext(ast: ASTTranslationContext, ctx: Context): string | null;
132
+ compileTPortal(ast: ASTTPortal, ctx: Context): string;
133
+ }
134
+ export {};
@@ -1,13 +1,13 @@
1
- import type { customDirectives } from "../common/types";
2
- import type { TemplateSet } from "../runtime/template_set";
3
- import type { BDom } from "../runtime/blockdom";
4
- import { Config } from "./code_generator";
5
- export declare type Template = (context: any, vnode: any, key?: string) => BDom;
6
- export declare type TemplateFunction = (app: TemplateSet, bdom: any, helpers: any) => Template;
7
- interface CompileOptions extends Config {
8
- name?: string;
9
- customDirectives?: customDirectives;
10
- hasGlobalValues: boolean;
11
- }
12
- export declare function compile(template: string | Element, options?: CompileOptions): TemplateFunction;
13
- export {};
1
+ import type { BDom } from "../runtime/blockdom";
2
+ import type { TemplateSet } from "../runtime/template_set";
3
+ import { Config } from "./code_generator";
4
+ export type CustomDirectives = Record<string, (node: Element, value: string, modifier: string[]) => void>;
5
+ export type Template = (context: any, vnode: any, key?: string) => BDom;
6
+ export type TemplateFunction = (app: TemplateSet, bdom: any, helpers: any) => Template;
7
+ interface CompileOptions extends Config {
8
+ name?: string;
9
+ customDirectives?: CustomDirectives;
10
+ hasGlobalValues: boolean;
11
+ }
12
+ export declare function compile(template: string | Element, options?: CompileOptions): TemplateFunction;
13
+ export {};
@@ -1,59 +1,58 @@
1
- export interface QWebVar {
2
- id: string;
3
- expr: string;
4
- value?: string;
5
- hasBody?: boolean;
6
- }
7
- declare type TKind = "LEFT_BRACE" | "RIGHT_BRACE" | "LEFT_BRACKET" | "RIGHT_BRACKET" | "LEFT_PAREN" | "RIGHT_PAREN" | "COMMA" | "VALUE" | "TEMPLATE_STRING" | "SYMBOL" | "OPERATOR" | "COLON";
8
- interface Token {
9
- type: TKind;
10
- value: string;
11
- originalValue?: string;
12
- size?: number;
13
- varName?: string;
14
- replace?: Function;
15
- isLocal?: boolean;
16
- }
17
- /**
18
- * Convert a javascript expression (as a string) into a list of tokens. For
19
- * example: `tokenize("1 + b")` will return:
20
- * ```js
21
- * [
22
- * {type: "VALUE", value: "1"},
23
- * {type: "OPERATOR", value: "+"},
24
- * {type: "SYMBOL", value: "b"}
25
- * ]
26
- * ```
27
- */
28
- export declare function tokenize(expr: string): Token[];
29
- /**
30
- * This is the main function exported by this file. This is the code that will
31
- * process an expression (given as a string) and returns another expression with
32
- * proper lookups in the context.
33
- *
34
- * Usually, this kind of code would be very simple to do if we had an AST (so,
35
- * if we had a javascript parser), since then, we would only need to find the
36
- * variables and replace them. However, a parser is more complicated, and there
37
- * are no standard builtin parser API.
38
- *
39
- * Since this method is applied to simple javasript expressions, and the work to
40
- * be done is actually quite simple, we actually can get away with not using a
41
- * parser, which helps with the code size.
42
- *
43
- * Here is the heuristic used by this method to determine if a token is a
44
- * variable:
45
- * - by default, all symbols are considered a variable
46
- * - unless the previous token is a dot (in that case, this is a property: `a.b`)
47
- * - or if the previous token is a left brace or a comma, and the next token is
48
- * a colon (in that case, this is an object key: `{a: b}`)
49
- *
50
- * Some specific code is also required to support arrow functions. If we detect
51
- * the arrow operator, then we add the current (or some previous tokens) token to
52
- * the list of variables so it does not get replaced by a lookup in the context
53
- */
54
- export declare function compileExprToArray(expr: string): Token[];
55
- export declare function compileExpr(expr: string): string;
56
- export declare const INTERP_REGEXP: RegExp;
57
- export declare function replaceDynamicParts(s: string, replacer: (s: string) => string): string;
58
- export declare function interpolate(s: string): string;
59
- export {};
1
+ export interface QWebVar {
2
+ id: string;
3
+ expr: string;
4
+ value?: string;
5
+ hasBody?: boolean;
6
+ }
7
+ type TKind = "LEFT_BRACE" | "RIGHT_BRACE" | "LEFT_BRACKET" | "RIGHT_BRACKET" | "LEFT_PAREN" | "RIGHT_PAREN" | "COMMA" | "VALUE" | "TEMPLATE_STRING" | "SYMBOL" | "OPERATOR" | "COLON";
8
+ interface Token {
9
+ type: TKind;
10
+ value: string;
11
+ originalValue?: string;
12
+ size?: number;
13
+ varName?: string;
14
+ replace?: Function;
15
+ isLocal?: boolean;
16
+ }
17
+ /**
18
+ * Convert a javascript expression (as a string) into a list of tokens. For
19
+ * example: `tokenize("1 + b")` will return:
20
+ * ```js
21
+ * [
22
+ * {type: "VALUE", value: "1"},
23
+ * {type: "OPERATOR", value: "+"},
24
+ * {type: "SYMBOL", value: "b"}
25
+ * ]
26
+ * ```
27
+ */
28
+ export declare function tokenize(expr: string): Token[];
29
+ /**
30
+ * This is the main function exported by this file. This is the code that will
31
+ * process an expression (given as a string) and returns another expression with
32
+ * proper lookups in the context.
33
+ *
34
+ * Usually, this kind of code would be very simple to do if we had an AST (so,
35
+ * if we had a javascript parser), since then, we would only need to find the
36
+ * variables and replace them. However, a parser is more complicated, and there
37
+ * are no standard builtin parser API.
38
+ *
39
+ * Since this method is applied to simple javasript expressions, and the work to
40
+ * be done is actually quite simple, we actually can get away with not using a
41
+ * parser, which helps with the code size.
42
+ *
43
+ * Here is the heuristic used by this method to determine if a token is a
44
+ * variable:
45
+ * - by default, all symbols are considered a variable
46
+ * - unless the previous token is a dot (in that case, this is a property: `a.b`)
47
+ * - or if the previous token is a left brace or a comma, and the next token is
48
+ * a colon (in that case, this is an object key: `{a: b}`)
49
+ *
50
+ * Some specific code is also required to support arrow functions. If we detect
51
+ * the arrow operator, then we add the current (or some previous tokens) token to
52
+ * the list of variables so it does not get replaced by a lookup in the context
53
+ */
54
+ export declare function compileExprToArray(expr: string): Token[];
55
+ export declare function compileExpr(expr: string): string;
56
+ export declare const INTERP_REGEXP: RegExp;
57
+ export declare function interpolate(s: string): string;
58
+ export {};