@fieldia/viewer 0.19.1 → 0.20.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/README.md +18 -0
- package/bundle/fieldia.ar.js +2 -2
- package/bundle/fieldia.ar.js.map +2 -2
- package/bundle/fieldia.choice.js +5 -0
- package/bundle/fieldia.choice.js.map +7 -0
- package/bundle/fieldia.de.js +2 -2
- package/bundle/fieldia.de.js.map +2 -2
- package/bundle/fieldia.filters.js +5 -0
- package/bundle/fieldia.filters.js.map +7 -0
- package/bundle/fieldia.fr.js +2 -2
- package/bundle/fieldia.fr.js.map +2 -2
- package/bundle/fieldia.head.js +5 -0
- package/bundle/fieldia.head.js.map +7 -0
- package/bundle/fieldia.js +44 -44
- package/bundle/fieldia.js.map +4 -4
- package/bundle/fieldia.path.js +5 -0
- package/bundle/fieldia.path.js.map +7 -0
- package/bundle/fieldia.text.js +24 -0
- package/bundle/fieldia.text.js.map +7 -0
- package/package.json +7 -3
- package/src/index.d.mts +2 -1
- package/src/index.d.ts +2 -1
- package/src/index.js +6 -1
- package/src/index.js.map +1 -1
- package/src/index.mjs +1 -0
- package/src/index.mjs.map +1 -1
- package/src/lib/button-parts.d.mts +30 -0
- package/src/lib/button-parts.d.ts +30 -0
- package/src/lib/button-parts.js +24 -0
- package/src/lib/button-parts.js.map +1 -0
- package/src/lib/button-parts.mjs +18 -0
- package/src/lib/button-parts.mjs.map +1 -0
- package/src/lib/dialog-window.d.mts +11 -0
- package/src/lib/dialog-window.d.ts +11 -0
- package/src/lib/dialog-window.js +86 -0
- package/src/lib/dialog-window.js.map +1 -0
- package/src/lib/dialog-window.mjs +82 -0
- package/src/lib/dialog-window.mjs.map +1 -0
- package/src/lib/dialog.d.mts +14 -3
- package/src/lib/dialog.d.ts +14 -3
- package/src/lib/dialog.js +84 -14
- package/src/lib/dialog.js.map +1 -1
- package/src/lib/dialog.mjs +85 -15
- package/src/lib/dialog.mjs.map +1 -1
- package/src/lib/filter-bar.d.mts +39 -0
- package/src/lib/filter-bar.d.ts +39 -0
- package/src/lib/filter-bar.js +290 -0
- package/src/lib/filter-bar.js.map +1 -0
- package/src/lib/filter-bar.mjs +287 -0
- package/src/lib/filter-bar.mjs.map +1 -0
- package/src/lib/filter-styles.d.mts +4 -0
- package/src/lib/filter-styles.d.ts +4 -0
- package/src/lib/filter-styles.js +63 -0
- package/src/lib/filter-styles.js.map +1 -0
- package/src/lib/filter-styles.mjs +59 -0
- package/src/lib/filter-styles.mjs.map +1 -0
- package/src/lib/filters-part.d.mts +8 -0
- package/src/lib/filters-part.d.ts +8 -0
- package/src/lib/filters-part.js +14 -0
- package/src/lib/filters-part.js.map +1 -0
- package/src/lib/filters-part.mjs +9 -0
- package/src/lib/filters-part.mjs.map +1 -0
- package/src/lib/group-styles.d.mts +9 -0
- package/src/lib/group-styles.d.ts +9 -0
- package/src/lib/group-styles.js +64 -0
- package/src/lib/group-styles.js.map +1 -0
- package/src/lib/group-styles.mjs +60 -0
- package/src/lib/group-styles.mjs.map +1 -0
- package/src/lib/head-part.d.mts +15 -0
- package/src/lib/head-part.d.ts +15 -0
- package/src/lib/head-part.js +26 -0
- package/src/lib/head-part.js.map +1 -0
- package/src/lib/head-part.mjs +16 -0
- package/src/lib/head-part.mjs.map +1 -0
- package/src/lib/head-styles.d.mts +28 -0
- package/src/lib/head-styles.d.ts +28 -0
- package/src/lib/head-styles.js +320 -0
- package/src/lib/head-styles.js.map +1 -0
- package/src/lib/head-styles.mjs +316 -0
- package/src/lib/head-styles.mjs.map +1 -0
- package/src/lib/labels.d.mts +29 -0
- package/src/lib/labels.d.ts +29 -0
- package/src/lib/labels.js +16 -0
- package/src/lib/labels.js.map +1 -1
- package/src/lib/labels.mjs +16 -0
- package/src/lib/labels.mjs.map +1 -1
- package/src/lib/list-styles.d.mts +1 -1
- package/src/lib/list-styles.d.ts +1 -1
- package/src/lib/list-styles.js +88 -1
- package/src/lib/list-styles.js.map +1 -1
- package/src/lib/list-styles.mjs +88 -1
- package/src/lib/list-styles.mjs.map +1 -1
- package/src/lib/list.d.mts +16 -1
- package/src/lib/list.d.ts +16 -1
- package/src/lib/list.js +281 -51
- package/src/lib/list.js.map +1 -1
- package/src/lib/list.mjs +282 -52
- package/src/lib/list.mjs.map +1 -1
- package/src/lib/locales/ar.js +16 -0
- package/src/lib/locales/ar.js.map +1 -1
- package/src/lib/locales/ar.mjs +16 -0
- package/src/lib/locales/ar.mjs.map +1 -1
- package/src/lib/locales/de.js +16 -0
- package/src/lib/locales/de.js.map +1 -1
- package/src/lib/locales/de.mjs +16 -0
- package/src/lib/locales/de.mjs.map +1 -1
- package/src/lib/locales/fr.js +16 -0
- package/src/lib/locales/fr.js.map +1 -1
- package/src/lib/locales/fr.mjs +16 -0
- package/src/lib/locales/fr.mjs.map +1 -1
- package/src/lib/look.d.mts +1 -1
- package/src/lib/look.d.ts +1 -1
- package/src/lib/look.js +3 -0
- package/src/lib/look.js.map +1 -1
- package/src/lib/look.mjs +3 -0
- package/src/lib/look.mjs.map +1 -1
- package/src/lib/record-bar.d.mts +10 -1
- package/src/lib/record-bar.d.ts +10 -1
- package/src/lib/record-bar.js +15 -7
- package/src/lib/record-bar.js.map +1 -1
- package/src/lib/record-bar.mjs +14 -7
- package/src/lib/record-bar.mjs.map +1 -1
- package/src/lib/record-head.d.mts +58 -0
- package/src/lib/record-head.d.ts +58 -0
- package/src/lib/record-head.js +245 -0
- package/src/lib/record-head.js.map +1 -0
- package/src/lib/record-head.mjs +240 -0
- package/src/lib/record-head.mjs.map +1 -0
- package/src/lib/rich-button.d.mts +12 -0
- package/src/lib/rich-button.d.ts +12 -0
- package/src/lib/rich-button.js +186 -0
- package/src/lib/rich-button.js.map +1 -0
- package/src/lib/rich-button.mjs +183 -0
- package/src/lib/rich-button.mjs.map +1 -0
- package/src/lib/section-head.d.mts +26 -0
- package/src/lib/section-head.d.ts +26 -0
- package/src/lib/section-head.js +65 -0
- package/src/lib/section-head.js.map +1 -0
- package/src/lib/section-head.mjs +56 -0
- package/src/lib/section-head.mjs.map +1 -0
- package/src/lib/section-tools.d.mts +12 -0
- package/src/lib/section-tools.d.ts +12 -0
- package/src/lib/section-tools.js +124 -0
- package/src/lib/section-tools.js.map +1 -0
- package/src/lib/section-tools.mjs +121 -0
- package/src/lib/section-tools.mjs.map +1 -0
- package/src/lib/viewer-parts.d.mts +33 -0
- package/src/lib/viewer-parts.d.ts +33 -0
- package/src/lib/viewer-parts.js +75 -0
- package/src/lib/viewer-parts.js.map +1 -0
- package/src/lib/viewer-parts.mjs +70 -0
- package/src/lib/viewer-parts.mjs.map +1 -0
- package/src/lib/viewer.d.mts +30 -7
- package/src/lib/viewer.d.ts +30 -7
- package/src/lib/viewer.js +317 -97
- package/src/lib/viewer.js.map +1 -1
- package/src/lib/viewer.mjs +319 -99
- package/src/lib/viewer.mjs.map +1 -1
package/bundle/fieldia.js
CHANGED
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
/*! Fieldia 0.
|
|
2
|
-
"use strict";var Fieldia=(()=>{var Ur=Object.defineProperty;var zl=Object.getOwnPropertyDescriptor;var Bl=Object.getOwnPropertyNames;var ql=Object.prototype.hasOwnProperty;var _l=(e,t,n)=>t in e?Ur(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ul=(e,t)=>{for(var n in t)Ur(e,n,{get:t[n],enumerable:!0})},Kl=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bl(t))!ql.call(e,i)&&i!==n&&Ur(e,i,{get:()=>t[i],enumerable:!(r=zl(t,i))||r.enumerable});return e};var Jl=e=>Kl(Ur({},"__esModule",{value:!0}),e);var Ht=(e,t,n)=>_l(e,typeof t!="symbol"?t+"":t,n);var ju={};Ul(ju,{ADDRESS_PARTS:()=>ci,BROWSER_HOTKEYS:()=>ti,DEFAULT_LABELS:()=>fl,DRAWN_IN_CELLS:()=>Qc,FIELDIA_CSS:()=>sl,FIELD_NAME:()=>_n,FIELD_TYPES:()=>Kr,FIRST_FIELD:()=>Or,FORMAT_VERSION:()=>Jr,FORM_WIDTHS:()=>Jf,HOTKEY:()=>Ja,ICONS:()=>id,MESSAGES:()=>Tt,PART_LOOKS:()=>Pa,SKINS:()=>Ca,THEMES:()=>Na,THEME_SKINS:()=>ga,TOKEN_NAMES:()=>ha,VERSION:()=>Wu,VIEWER_LABELS:()=>Vt,WIDGET_LABELS:()=>Ze,accentShades:()=>Pr,addLanguage:()=>Qi,applyLook:()=>jn,binaryWidget:()=>Ar,browserPreferences:()=>ca,builtInWidgets:()=>Jd,cardLineFields:()=>Ma,cardLines:()=>uo,cardPart:()=>fo,cellText:()=>In,charTagsWidget:()=>Co,checkPage:()=>yr,checkValue:()=>wn,compileModifier:()=>et,contrast:()=>Wn,countriesIn:()=>Xo,createForm:()=>pi,createMemoryDataSource:()=>bs,createWidget:()=>Ot,currencyOf:()=>Qn,dayOf:()=>yn,describeTypes:()=>wr,detailLines:()=>xi,displayValue:()=>At,distributionIds:()=>td,distributionModel:()=>Io,distributionWords:()=>Si,drawIcon:()=>kt,emptyValue:()=>Cn,evaluateModifier:()=>Za,expressionContext:()=>vn,facetsToFilter:()=>kr,fileProblem:()=>vr,fileShown:()=>zo,fill:()=>Ye,fillValues:()=>Ka,focusField:()=>Gi,formatBytes:()=>on,formatMoney:()=>Vn,formatNumber:()=>pt,formatPlain:()=>No,groupByFields:()=>di,hostScheduler:()=>Sr,hotkeyWords:()=>Kn,htmlWidget:()=>Ko,imageWidget:()=>Ho,initialValues:()=>xn,installListStyles:()=>Xi,installStyles:()=>la,isEmpty:()=>Kt,isModifierValid:()=>Qa,isRightToLeft:()=>Mn,isoWeek:()=>yd,jsonProblem:()=>Ci,jsonWidget:()=>Jo,keepTabIn:()=>Gt,kindTextField:()=>dd,labelPlace:()=>Dr,labelWidget:()=>Tr,lineForm:()=>Li,lineKind:()=>gt,linesWidget:()=>Wo,linkAddress:()=>wd,linkAvatar:()=>Zn,linkCheckboxesWidget:()=>Po,localizePage:()=>xr,many2oneWidget:()=>Rr,matchesFilter:()=>Xn,memoryPreferences:()=>Yf,moneyReads:()=>ki,mountViewer:()=>Vr,normalizeNumber:()=>Jt,onelineRuns:()=>Vl,openFormDialog:()=>ir,openFormPanel:()=>ba,openLineDialog:()=>Ei,openSearchDialog:()=>ya,ownCurrency:()=>ld,pageWords:()=>Xa,planSection:()=>Zi,progressbarWidget:()=>$r,propertiesWidget:()=>_o,quietHint:()=>Ol,readFile:()=>Fi,readText:()=>ua,readsAsText:()=>fa,referenceWidget:()=>Oo,rolesAllow:()=>Nn,sanitizeHtml:()=>Uo,saveProblemOf:()=>oi,saveRefused:()=>fs,scoreOf:()=>cs,shortNumber:()=>Vo,skinFor:()=>Ln,splitValues:()=>Un,statusbarWidget:()=>$i,suggestions:()=>si,summary:()=>Ai,tagsWidget:()=>vi,translatePage:()=>Gn,ungroup:()=>Lr,valuesIn:()=>ei,wait:()=>li,wearTokens:()=>En,wearsQuiet:()=>Ti,wideColumns:()=>gn,withCalendar:()=>Ni,writeMoney:()=>wi});var _n=/^[A-Za-z_][A-Za-z0-9_]*$/,Kr=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json","matrix"];function gn(e){return typeof e=="object"?e.wide:e??1}function fo(e){return typeof e=="string"?{field:e}:e}function uo(e){return(e?.fields??[]).map(t=>(Array.isArray(t)?t:[t]).map(fo))}function Ma(e){return[...new Set(uo(e).flatMap(t=>t.map(n=>n.field)))]}var Jr="0.1";var Na=["material","fluent","apple","bootstrap","shadcn","ant","odoo","google-forms"],Ca=["underline","outlined","quiet"];var Pa={inputs:["background","border","corners","textSize","accent"],choices:["accent","background","border","corners","textSize"],groups:["background","border","corners"],buttons:["accent","corners","textSize"],tables:["background","border","textSize"]};var po=["id","user","editing","context"],mo=["id","name","roles"];var wt=e=>typeof e=="number"&&Number.isFinite(e);function nn(e){return Number.isFinite(e)?Number(e.toPrecision(15)):null}function Va(e,t,n){if(e==="+"&&(typeof t=="string"||typeof n=="string")){let r=Oa(t),i=Oa(n);return r===null||i===null?null:r+i}if(!wt(t)||!wt(n))return null;switch(e){case"+":return nn(t+n);case"-":return nn(t-n);case"*":return nn(t*n);case"/":return nn(t/n);case"%":return nn(t-n*Math.floor(t/n));default:return null}}function Oa(e){return e==null?"":typeof e=="string"?e:wt(e)?String(e):null}function Ia(e){return wt(e)?nn(-e):null}function Ct(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function hr(e,t){let n=10**Math.trunc(t),r=Number((Math.abs(e)*n).toPrecision(15));return nn(Math.sign(e)*Math.round(r)/n)}function hn(e){let t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Da(e){let t=e.args[0];return(t.type==="Identifier"?e.env.lines?.(t.name):void 0)??e.value(t)}function Wa(e,t,n,r){let i=e[t];return i&&!(i.type==="Literal"&&typeof i.value=="string")?`${n} takes a condition, in quotes, on the lines: ${r}`:void 0}function ja(e,t,n){let r=e.args[n];if(r?.type!=="Literal"||typeof r.value!="string")return t;let i=r.value;return t.filter(o=>o!==null&&typeof o=="object"&&e.holds(i,o))}function Ha(e){if(typeof e!="string")return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]))/864e5:null}function za(e,t){let n=e.args.flatMap(i=>{let o=e.value(i);return Array.isArray(o)?o:[o]}).filter(i=>i!=null);return!n.length||!n.every(wt)&&!n.every(i=>typeof i=="string")?null:n.reduce((i,o)=>(t?o<i:o>i)?o:i)}var br=new Map([["round",{takes:[1,2],call({args:e,value:t}){let n=t(e[0]),r=e.length>1?t(e[1]):0;return wt(n)&&wt(r)?hr(n,r):null}}],["abs",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return wt(n)?Math.abs(n):null}}],["min",{takes:[1,1/0],call:e=>za(e,!0)}],["max",{takes:[1,1/0],call:e=>za(e,!1)}],["len",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return n==null?0:typeof n=="string"||Array.isArray(n)?n.length:null}}],["today",{takes:[0,0],call:({env:e})=>e.today?.()??hn(new Date)}],["sum",{takes:[1,3],check(e){let t=e[1];return t&&!(t.type==="Literal"&&typeof t.value=="string")?"sum takes the name of a field, in quotes, after the lines: sum(lines, 'subtotal')":Wa(e,2,"sum",`sum(lines, 'amount', "state == 'done'")`)},call(e){let t=Da(e);if(t==null)return 0;if(!Array.isArray(t))return null;let n=e.args[1]?.type==="Literal"?e.args[1].value:void 0,r=0;for(let i of ja(e,t,2)){let o=n===void 0?i:i?.[n];wt(o)&&(r+=o)}return nn(r)}}],["count",{takes:[1,2],check:e=>Wa(e,1,"count",`count(lines, "state == 'done'")`),call(e){let t=Da(e);return t==null?0:Array.isArray(t)?ja(e,t,1).length:null}}],["days",{takes:[2,2],call({args:e,value:t}){let n=Ha(t(e[0])),r=Ha(t(e[1]));return n===null||r===null?null:r-n}}],["if",{takes:[3,3],call:({args:e,value:t})=>Ct(t(e[0]))?t(e[1]):t(e[2])}]]);function Ba(e,[t,n]){return n===0?`${e} takes no values`:t===n?`${e} takes ${t} value${t===1?"":"s"}`:n===1/0?`${e} takes ${t} or more values`:`${e} takes ${t} or ${n} values`}var go=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]),Gl=new Set(["+","-","*","/","%"]);function rn(e){let t=[];if(!e)return t;let n=/(\(|\)|,|==|!=|<=|>=|<>|<|>|[-+*/%]|not\s+in\b|in\b|and\b|or\b|not\b|\[[^\]]*\]|'[^']*'|"[^"]*"|\d+\.?\d*|\w+(?:\.\w+)*)/iy,r=/\s*/y,i=0;for(;;){if(r.lastIndex=i,r.exec(e),i=r.lastIndex,i>=e.length)return t;n.lastIndex=i;let o=n.exec(e);if(!o)throw new Error(`Unexpected "${e[i]}" at character ${i+1} of: ${e}`);t.push({type:Yl(o[0]),value:o[0],position:t.length}),i=n.lastIndex}}function Yl(e){let t=e.toLowerCase().trim();return go.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":Gl.has(e)?"ARITHMETIC":e===","?"COMMA":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var zt=class{constructor(t){Ht(this,"tokens");Ht(this,"position",0);this.tokens=t}parse(){if(this.tokens.length===0)throw new Error("Cannot parse empty expression");let t=this.parseOr();if(!this.isAtEnd())throw new Error(`Unexpected token at position ${this.position}: ${this.peek()?.value}`);return t}parseOr(){let t=this.parseAnd();for(;this.matchLogical("or");){let n=this.previous().value,r=this.parseAnd();t={type:"BinaryOp",operator:n.toLowerCase(),left:t,right:r}}return t}parseAnd(){let t=this.parseNot();for(;this.matchLogical("and");){let n=this.previous().value,r=this.parseNot();t={type:"BinaryOp",operator:n.toLowerCase(),left:t,right:r}}return t}parseNot(){if(this.matchLogical("not")){let t=this.previous().value,n=this.parseComparison();return{type:"UnaryOp",operator:t.toLowerCase(),operand:n}}return this.parseComparison()}parseComparison(){let t=this.parseSum(),n=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...n)){let r=this.previous().value,i=this.parseSum();return{type:"BinaryOp",operator:r.toLowerCase(),left:t,right:i}}return t}parseSum(){let t=this.parseProduct();for(;this.match("ARITHMETIC","+","-");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseProduct()};return t}parseProduct(){let t=this.parseUnary();for(;this.match("ARITHMETIC","*","/","%");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseUnary()};return t}parseUnary(){return this.match("ARITHMETIC","-")?{type:"UnaryOp",operator:"-",operand:this.parseUnary()}:this.parseValue()}parseTuple(t){let n=[t];for(;this.match("COMMA")&&!(this.peek()?.type==="PAREN"&&this.peek()?.value===")");)n.push(this.parseOr());return this.consume("PAREN",")",'Expected "," or ")" in a tuple'),{type:"Literal",value:n.map(Xl)}}parseCall(t){let n=br.get(t);if(!n)throw new Error(`no function "${t}": the functions are ${[...br.keys()].join(", ")}`);this.advance();let r=[];if(!this.match("PAREN",")")){do r.push(this.parseOr());while(this.match("COMMA"));this.consume("PAREN",")",`Expected "," or ")" after a value of ${t}(\u2026)`)}let[i,o]=n.takes;if(r.length<i||r.length>o)throw new Error(Ba(t,n.takes));let a=n.check?.(r);if(a)throw new Error(a);return{type:"Call",name:t,args:r}}parseValue(){if(this.match("PAREN","(")){if(this.match("PAREN",")"))return{type:"Literal",value:[]};let t=this.parseOr();return this.check("COMMA")?this.parseTuple(t):(this.consume("PAREN",")","Expected closing parenthesis"),t)}if(this.check("STRING"))return{type:"Literal",value:this.advance().value.slice(1,-1)};if(this.check("CONSTANT")){let t=this.advance();return{type:"Literal",value:go.get(t.value)??null}}if(this.check("NUMBER")){let t=this.advance();return{type:"Literal",value:Number(t.value)}}if(this.check("LIST")){let t=this.advance();return{type:"Literal",value:Zl(t.value)}}if(this.check("IDENTIFIER")){let t=this.advance(),n=this.peek();return n?.type==="PAREN"&&n.value==="("?this.parseCall(t.value):{type:"Identifier",name:t.value}}throw new Error(`Unexpected token: ${this.peek()?.value||"EOF"}`)}match(t,...n){if(this.check(t)){if(n.length===0)return this.advance(),!0;let r=this.peek();if(r&&n.includes(r.value))return this.advance(),!0}return!1}matchLogical(...t){let n=this.peek();if(n&&n.type==="LOGICAL"){let r=n.value.toLowerCase();if(t.map(i=>i.toLowerCase()).includes(r))return this.advance(),!0}return!1}matchOperator(...t){let n=this.peek();if(n&&n.type==="OPERATOR"){let r=n.value.toLowerCase();if(t.map(i=>i.toLowerCase()).includes(r))return this.advance(),!0}return!1}check(t){return this.peek()?.type===t}advance(){return this.isAtEnd()||this.position++,this.previous()}peek(){return this.isAtEnd()?null:this.tokens[this.position]}previous(){return this.tokens[this.position-1]}isAtEnd(){return this.position>=this.tokens.length}consume(t,n,r){if(this.check(t)){let i=this.peek();if(i&&i.value===n)return this.advance()}throw new Error(r)}};function Xl(e){if(e.type==="Literal")return e.value;if(e.type==="UnaryOp"&&e.operator==="-"&&e.operand.type==="Literal"&&typeof e.operand.value=="number")return-e.operand.value;throw new Error("a tuple holds values such as 'draft' or 3, not expressions")}function Zl(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let n=[],r="",i=!1,o="";for(let a=0;a<t.length;a++){let s=t[a];(s==="'"||s==='"')&&(a===0||t[a-1]!=="\\")&&(i?s===o&&(i=!1,o=""):(i=!0,o=s)),s===","&&!i?(n.push(qa(r.trim())),r=""):r+=s}return r.trim()&&n.push(qa(r.trim())),n}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function qa(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):isNaN(Number(e))?e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:e:Number(e)}function Pt(e,t,n={}){switch(e.type){case"BinaryOp":return Ql(e,t,n);case"UnaryOp":return ec(e,t,n);case"Call":return tc(e,t,n);case"Literal":return e.value;case"Identifier":return rc(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function Ql(e,t,n){let r=e.operator.toLowerCase();if(r==="and"||r==="or"){let s=Gr(Pt(e.left,t,n));return Ct(s)===(r==="or")?s:Gr(Pt(e.right,t,n))}let i=Gr(Pt(e.left,t,n)),o=Gr(Pt(e.right,t,n)),a=i!==null&&o!==null;switch(r){case"==":return i===o;case"!=":case"<>":return i!==o;case"<":return a&&i<o;case">":return a&&i>o;case"<=":return a&&i<=o;case">=":return a&&i>=o;case"in":return Array.isArray(o)&&o.includes(i);case"not in":return Array.isArray(o)&&!o.includes(i);case"+":case"-":case"*":case"/":case"%":return Va(r,i,o);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function ec(e,t,n){let r=Pt(e.operand,t,n);switch(e.operator.toLowerCase()){case"not":return!Ct(r);case"-":return Ia(r);default:throw new Error(`Unknown unary operator: ${e.operator}`)}}function tc(e,t,n){let r=br.get(e.name);if(!r)throw new Error(`Unknown function: ${e.name}`);return r.call({args:e.args,value:i=>Pt(i,t,n),env:n,holds:(i,o)=>Ct(Pt(nc(i),o,n))})}var _a=new Map;function nc(e){let t=_a.get(e);return t||_a.set(e,t=new zt(rn(e)).parse()),t}function Gr(e){return e===void 0?null:e}function rc(e,t){let n=t.split("."),r=e;for(let i of n){if(r==null)return;r=r[i]}return r}function bn(e,t){switch(t(e),e.type){case"BinaryOp":bn(e.left,t),bn(e.right,t);return;case"UnaryOp":bn(e.operand,t);return;case"Call":for(let n of e.args)bn(n,t);return;default:return}}function Yr(e){let t=[];return bn(e,n=>{if(n.type!=="Identifier")return;let r=n.name.split(".")[0];t.includes(r)||t.push(r)}),t}function Xr(e){let t=[];return bn(e,n=>{n.type==="Identifier"&&!t.includes(n.name)&&t.push(n.name)}),t}function Zr(e){let t=[];return bn(e,n=>{if(n.type!=="Call"||n.name!=="count"&&n.name!=="sum")return;let[r,i]=n.name==="count"?[n.args[0],n.args[1]]:[n.args[0],n.args[2]];r.type==="Identifier"&&i?.type==="Literal"&&typeof i.value=="string"&&t.push({lines:r.name,condition:i.value})}),t}function Ua(e){let t=[];return bn(e,n=>{if(n.type!=="Call"||n.name!=="sum")return;let[r,i]=n.args;r.type==="Identifier"&&i?.type==="Literal"&&t.push({lines:r.name,field:i.value})}),t}function et(e){if(typeof e!="string"){let n=e===!0;return{source:e,fields:[],paths:[],wheres:[],evaluate:()=>n}}let t=new zt(rn(e)).parse();return{source:e,fields:Yr(t),paths:Xr(t),wheres:Zr(t),evaluate(n,r){try{return Ct(Pt(t,n,r))}catch{return!1}}}}function Bt(e){let t=new zt(rn(e)).parse();return{source:e,fields:Yr(t),paths:Xr(t),wheres:Zr(t),sums:Ua(t),evaluate(n,r={}){try{return Pt(t,n,r)??null}catch{return null}}}}function Qr(e){let t=[],n=[],r=new Set,i=[],o=a=>{if(r.has(a))return;let s=i.indexOf(a);if(s!==-1){n.push([...i.slice(s),a]);return}i.push(a);for(let d of e.get(a)??[])e.has(d)&&o(d);i.pop(),r.add(a),t.push(a)};for(let a of e.keys())o(a);return{order:t,cycles:n}}var ho=/\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function ei(e){return[...e.matchAll(ho)].map(t=>t[1])}function Ka(e,t){return e.replace(ho,(n,r)=>t(r))}function Un(e){let t=[],n=0;for(let r of e.matchAll(ho))r.index>n&&t.push({text:e.slice(n,r.index)}),t.push({text:"",field:r[1]}),n=r.index+r[0].length;return n<e.length&&t.push({text:e.slice(n)}),t}var Ja=/^(shift\+)?[a-z0-9]$/,ti=["d","e","f"],Kn=e=>`Alt+${e.startsWith("shift+")?"Shift+":""}${e.slice(-1).toUpperCase()}`;var xt=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Ga=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),bo="text, numbers, yes or no, dates, choices and json can",ic=e=>{let t=e.map(n=>`"${n}"`);return t.length<2?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`},ni=class e{constructor(t,n){Ht(this,"page",t);Ht(this,"line",n);Ht(this,"issues",[]);Ht(this,"ids",new Map);Ht(this,"formNames",new Map);Ht(this,"places",new Set);Ht(this,"goingTo",[])}run(){return this.checkFields(this.page.fields,"fields",this.line?.name,this.line?.parent),this.walkRoot(this.page.layout,"layout"),this.page.on&&this.checkEvents(this.page.on,"on"),this.checkGoingTo(),this.issues}checkGoingTo(){for(let{target:t,path:n}of this.goingTo)this.places.has(t)||this.report(n,`no tab or wizard step "${t}" on this page`)}here(){return this.line?{fields:this.page.fields,lines:this.line.name,parent:this.line.parent}:{fields:this.page.fields}}checkLineForm(t,n,r){let i=t.lineForm?.children;if(!Array.isArray(i))return this.report(`${r}.lineForm`,'a line\u2019s form holds its parts: { "children": [...] }');let o={...this.page,fields:n.fields,layout:{type:"sections",id:`${t.id}#line`,children:i},on:void 0},a=new e(o,{name:t.field,parent:this.page.fields});a.walkChildren(i,`${r}.lineForm`),a.checkGoingTo(),this.issues.push(...a.issues)}checkEvents(t,n){for(let r of["open","beforeSave","afterSave"]){let i=t[r];i&&this.checkSteps(i,`${n}.${r}`)}for(let[r,i]of Object.entries(t.change??{}))this.formNames.has(r)||this.need(r,`${n}.change.${r}`),this.checkSteps(i,`${n}.change.${r}`);for(let[r,i]of Object.entries(t.show??{}))this.goingTo.push({target:r,path:`${n}.show.${r}`}),this.checkSteps(i,`${n}.show.${r}`)}checkPress(t,n){!t.steps&&t.action===void 0&&this.report(n,"a button needs steps, an action, or both");let r="hotkey"in t?t.hotkey:void 0;typeof r=="string"&&ti.includes(r.replace("shift+",""))&&this.report(`${n}.hotkey`,`${Kn(r)} is the browser\u2019s own: pick another key`),t.steps&&this.checkSteps(t.steps,`${n}.steps`)}checkSteps(t,n){let r=this.here();t.forEach((i,o)=>{let a=`${n}[${o}]`;switch(this.checkModifiers(i,a,["when"]),i.do){case"set":{let s=this.need(i.field,`${a}.field`);s&&!Ga.has(s.type)&&this.report(`${a}.field`,`a ${s.type} cannot be set from an expression; ${bo}`),this.checkExpression(i.value,`${a}.value`,r);return}case"clear":this.need(i.field,`${a}.field`);return;case"addLine":{let s=this.need(i.field,`${a}.field`);if(s&&s.type!=="one2many")return this.report(`${a}.field`,`"${i.field}" is a ${s.type}; a line is added to a one2many`);for(let[d,l]of Object.entries(i.values??{}))s?.type==="one2many"&&!xt(s.fields,d)&&this.report(`${a}.values.${d}`,`"${d}" is not a field of the lines of "${i.field}"`),this.checkExpression(l,`${a}.values.${d}`,r);return}case"check":i.fields?.forEach((s,d)=>this.need(s,`${a}.fields[${d}]`));return;case"goTo":this.goingTo.push({target:i.target,path:`${a}.target`});return;case"open":i.page===this.page.id&&i.as==="page"&&this.report(`${a}.page`,"a page cannot open itself in its own place"),i.side!==void 0&&i.as!=="panel"&&this.report(`${a}.side`,`a side is where a panel comes from; this opens ${i.as==="page"?"in its place":"in a dialog"}`),i.record!==void 0&&this.checkExpression(i.record,`${a}.record`,r);for(let[s,d]of Object.entries(i.values??{}))this.checkExpression(d,`${a}.values.${s}`,r);i.filter?.forEach((s,d)=>this.checkFilterItem(s,`${a}.filter[${d}]`,r));for(let[s,d]of Object.entries(i.into??{})){this.need(s,`${a}.into.${s}`);try{Bt(d)}catch(l){this.report(`${a}.into.${s}`,`cannot read "${d}": ${l.message}`)}}i.then&&this.checkSteps(i.then,`${a}.then`);return;case"openUrl":this.checkExpression(i.url,`${a}.url`,r);return;default:return}})}checkValuesIn(t,n){for(let r of ei(t))this.need(r,n)}report(t,n){this.issues.push({path:t,message:n})}claim(t,n){let r=this.ids.get(t);r!==void 0?this.report(n,`duplicate id "${t}", also used at ${r}`):this.ids.set(t,n)}need(t,n,r=this.page.fields){if(xt(r,t))return r[t];this.report(n,`no field "${t}"`)}checkFilterItem(t,n,r){if("any"in t)return t.any.forEach((i,o)=>this.checkFilterItem(i,`${n}.any[${o}]`,r));if("all"in t)return t.all.forEach((i,o)=>this.checkFilterItem(i,`${n}.all[${o}]`,r));t.valueFrom!==void 0&&this.checkValueFrom(t.valueFrom,`${n}.valueFrom`,r)}checkValueFrom(t,n,r){let[i,o]=t.split(".");if(o===void 0){if(xt(r.fields,t)||t==="id"&&r.lines===void 0)return;this.need(t,n,r.fields)}else i==="user"?mo.includes(o)||this.report(n,`"${t}": the person has an id, name or roles`):i==="context"||(r.lines===void 0?this.report(n,`"${t}": only a line's filter reads parent, the record it is on`):!xt(r.parent??this.page.fields,o)&&o!=="id"&&this.report(n,`"${t}": "${o}" is not a field of this page`))}checkModifiers(t,n,r=["invisible"],i=this.here()){for(let o of r){let a=t[o];if(typeof a!="string")continue;let s;try{s=et(a)}catch(d){this.report(`${n}.${o}`,`cannot read "${a}": ${d.message}`);continue}this.checkReads(a,s,`${n}.${o}`,i)}}checkReads(t,n,r,i){for(let o of n.wheres){let a=i.fields[o.lines];if(a?.type!=="one2many")continue;let s;try{s=et(o.condition).fields}catch(d){this.report(r,`cannot read the condition "${o.condition}": ${d.message}`);continue}for(let d of s)xt(a.fields,d)||this.report(r,`"${o.condition}" reads "${d}", which is not a field of the lines of "${o.lines}"`)}for(let o of n.fields){if(xt(i.fields,o))continue;if(i.lines===void 0?po.includes(o):o==="user"||o==="parent"||o==="id"||o==="context"){for(let d of n.paths){let[l,f]=d.split(".");l!==o||f===void 0||(o==="user"&&!mo.includes(f)&&this.report(r,`"${t}" reads "${d}": the person has an id, name or roles`),o==="parent"&&!xt(i.parent??this.page.fields,f)&&!po.includes(f)&&this.report(r,`"${t}" reads "${d}": "${f}" is not a field of this page`))}continue}let s=i.lines===void 0?"of this page":`of the lines of "${i.lines}"`;this.report(r,`"${t}" reads "${o}", which is not a field ${s}`)}}checkExpression(t,n,r){let i;try{i=Bt(t)}catch(o){return this.report(n,`cannot read "${t}": ${o.message}`),null}this.checkReads(t,i,n,r);for(let o of i.sums){if(!xt(r.fields,o.lines))continue;let a=r.fields[o.lines];a.type!=="one2many"?this.report(n,`sum adds up the lines of a one2many; "${o.lines}" is a ${a.type}`):xt(a.fields,o.field)||this.report(n,`"${o.field}" is not a field of the lines of "${o.lines}"`)}return i.fields}checkWorkedOut(t,n,r){let i=new Map;for(let[o,a]of Object.entries(t)){let s=`${n}.${o}`;if((a.compute!==void 0||a.setWhen)&&!Ga.has(a.type)){a.compute!==void 0&&this.report(`${s}.compute`,`a ${a.type} cannot be worked out; ${bo}`),a.setWhen&&this.report(`${s}.setWhen`,`a ${a.type} cannot be set by a condition; ${bo}`);continue}if(a.compute!==void 0){let d=this.checkExpression(a.compute,`${s}.compute`,r);d&&i.set(o,d)}a.setWhen?.forEach((d,l)=>{this.checkModifiers(d,`${s}.setWhen[${l}]`,["when"],r),d.on?.forEach((f,c)=>this.need(f,`${s}.setWhen[${l}].on[${c}]`,t)),this.checkExpression(d.value,`${s}.setWhen[${l}].value`,r)})}for(let o of Qr(i).cycles){let a=o.slice(0,-1),s=a.length===1?`"${a[0]}" is worked out from itself`:`${ic(a)} are worked out from each other: ${o.join(" \u2192 ")}`;this.report(`${n}.${o[0]}.compute`,s)}}checkFields(t,n,r,i){let o={fields:t,lines:r,...i?{parent:i}:{}};this.checkWorkedOut(t,n,o);for(let[a,s]of Object.entries(t)){let d=`${n}.${a}`;if(s.type==="monetary"&&s.currencyField!==void 0&&this.checkCurrency(s.currencyField,`${d}.currencyField`,t,r,i),s.type==="monetary"&&s.money?.per?.forEach((l,f)=>this.checkModifiers(l,`${d}.money.per[${f}]`,["when"],o)),s.defaultFrom!==void 0&&this.checkExpression(s.defaultFrom,`${d}.defaultFrom`,o),(s.type==="many2one"||s.type==="many2many")&&s.createValues)for(let[l,f]of Object.entries(s.createValues))this.checkExpression(f,`${d}.createValues.${l}`,o);if(s.type==="one2many"&&s.lineDefaults)for(let[l,f]of Object.entries(s.lineDefaults))xt(s.fields,l)?this.checkExpression(f,`${d}.lineDefaults.${l}`,o):this.report(`${d}.lineDefaults.${l}`,`"${l}" is not a field of the lines of "${a}"`);if((s.type==="many2one"||s.type==="many2many")&&s.filter&&s.filter.forEach((l,f)=>this.checkFilterItem(l,`${d}.filter[${f}]`,o)),s.type==="selection"&&s.optionsFrom?.dependsOn?.forEach((l,f)=>this.need(l,`${d}.optionsFrom.dependsOn[${f}]`,t)),s.type==="properties"&&s.definitionsFrom?.dependsOn?.forEach((l,f)=>this.need(l,`${d}.definitionsFrom.dependsOn[${f}]`,t)),s.type==="properties"&&s.definitions){let l=new Set;s.definitions.forEach((f,c)=>{f.type==="selection"&&!f.options&&this.report(`${d}.definitions[${c}].options`,"a choice property needs its choices"),l.has(f.name)&&this.report(`${d}.definitions[${c}].name`,`"${f.name}" is named twice`),l.add(f.name)})}if(s.type==="one2many"&&(this.checkFields(s.fields,`${d}.fields`,a,t),"lineKinds"in s&&s.lineKinds&&this.checkLineKinds(a,s.lineKinds,s.fields,`${d}.lineKinds`),s.sequenceField!==void 0)){let l=s.fields[s.sequenceField];l?l.type!=="integer"&&this.report(`${d}.sequenceField`,`"${s.sequenceField}" is a ${l.type}; the field that keeps the order of lines must be an integer`):this.report(`${d}.sequenceField`,`"${s.sequenceField}" is not a field of the lines of "${a}"`)}}}checkCurrency(t,n,r,i,o=this.page.fields){let a;if(!t.startsWith("parent."))a=this.need(t,n,r);else{if(i===void 0)return this.report(n,`"${t}": only a line\u2019s money reads parent, the record it is on`);if(xt(o,t.slice(7)))a=o[t.slice(7)];else return this.report(n,`"${t}": "${t.slice(7)}" is not a field of this page`)}a&&!["many2one","selection","char"].includes(a.type)&&this.report(n,`"${t}" is a ${a.type}; a currency field must be a many2one, selection or char`)}checkLineKinds(t,n,r,i){let o=r[n.field];if(!o)this.report(`${i}.field`,`"${n.field}" is not a field of the lines of "${t}"`);else if(o.type!=="selection"&&o.type!=="char")this.report(`${i}.field`,`"${n.field}" is a ${o.type}; the field that says what a line is must be a selection or char`);else if(o.type==="selection")for(let s of["section","note"]){let d=n[s]??s;o.options.some(l=>l.value===d)||this.report(`${i}.${s}`,`"${n.field}" has no option "${d}"`)}let a=r[n.text];a?a.type!=="char"&&a.type!=="text"&&this.report(`${i}.text`,`"${n.text}" is a ${a.type}; a section's or note's text must be a char or text field`):this.report(`${i}.text`,`"${n.text}" is not a field of the lines of "${t}"`)}walkFooter(t,n){t?.forEach((r,i)=>{this.claim(r.id,`${n}.footer[${i}]`),this.checkModifiers(r,`${n}.footer[${i}]`),this.checkPress(r,`${n}.footer[${i}]`)})}walkRoot(t,n){if(t.type==="tabs")return this.walkNode(t,n);if(this.claim(t.id,n),(t.type==="sheet"||t.type==="sections")&&this.walkFooter(t.footer,n),t.type==="sheet")return this.walkSheet(t,n);if(t.type==="sections")return this.walkChildren(t.children,n);if(t.type==="list")return this.walkList(t,n);t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}walkList(t,n){this.page.data.kind!=="record"&&this.report("data",'a list shows records: its data needs kind "record" and a model'),t.columns.forEach((o,a)=>this.need(o,`${n}.columns[${a}]`)),t.sort?.forEach((o,a)=>this.need(o.field,`${n}.sort[${a}].field`)),t.searchFields?.forEach((o,a)=>this.need(o,`${n}.searchFields[${a}]`)),t.groupBy?.forEach((o,a)=>this.need(o,`${n}.groupBy[${a}]`));let r=(o,a)=>{if("any"in o)return o.any.forEach((s,d)=>r(s,`${a}.any[${d}]`));if("all"in o)return o.all.forEach((s,d)=>r(s,`${a}.all[${d}]`));this.need(o.field,`${a}.field`),o.valueFrom!==void 0&&this.report(`${a}.valueFrom`,"a list's filter compares with values, not with another field")},i=new Set;t.filters?.forEach((o,a)=>{this.claim(o.id,`${n}.filters[${a}]`),i.add(o.id),o.filter.forEach((s,d)=>r(s,`${n}.filters[${a}].filter[${d}]`))}),t.defaultFilters?.forEach((o,a)=>{i.has(o)||this.report(`${n}.defaultFilters[${a}]`,`no filter "${o}" in this list`)}),t.actions?.forEach((o,a)=>{this.claim(o.id,`${n}.actions[${a}]`),this.checkPress(o,`${n}.actions[${a}]`)}),t.map&&this.walkListMap(t.map,`${n}.map`)}walkListMap(t,n){let r=t.latitude!==void 0||t.longitude!==void 0;if(t.point!==void 0&&r?this.report(n,"a map takes point, or latitude and longitude, not both"):t.point===void 0&&(t.latitude===void 0||t.longitude===void 0)&&this.report(n,"a map needs where each record is: point, or latitude and longitude"),this.checkPlace(t,n,this.here(),t.pin,t.card),t.regions&&this.need(t.regions.field,`${n}.regions.field`),typeof t.heat=="object"&&t.heat.weight!==void 0){let i=this.need(t.heat.weight,`${n}.heat.weight`);i&&i.type!=="float"&&i.type!=="integer"&&i.type!=="monetary"&&this.report(`${n}.heat.weight`,`"${t.heat.weight}" is a ${i.type}; a weight is a number field`)}}checkPlace(t,n,r,i,o){let a=(l,f,c,y)=>{if(l===void 0)return;let p=this.need(l,f,r.fields);p&&!c(p.type)&&this.report(f,`"${l}" is a ${p.type}; ${y}`)},s=l=>l==="float"||l==="integer",d=l=>l==="image"||l==="binary";a(t.point,`${n}.point`,l=>l==="json","a point is kept in a json field"),a(t.latitude,`${n}.latitude`,s,"a latitude is a number field (float or integer)"),a(t.longitude,`${n}.longitude`,s,"a longitude is a number field (float or integer)"),i&&(a(i.image,`${n}.pin.image`,d,"a pin's photo is an image or binary field"),a(i.turn,`${n}.pin.turn`,s,"a turn is a number field, in degrees"),i.iconField!==void 0&&this.need(i.iconField,`${n}.pin.iconField`,r.fields),i.label!==void 0&&this.need(i.label,`${n}.pin.label`,r.fields),i.tones?.forEach((l,f)=>this.checkModifiers(l,`${n}.pin.tones[${f}]`,["when"],r)),i.money?.per?.forEach((l,f)=>this.checkModifiers(l,`${n}.pin.money.per[${f}]`,["when"],r))),o&&(o.title!==void 0&&this.need(o.title,`${n}.card.title`,r.fields),a(o.image,`${n}.card.image`,d,"a card's picture is an image or binary field"),o.fields?.forEach((l,f)=>(Array.isArray(l)?l:[l]).forEach((c,y)=>{let p=`${n}.card.fields[${f}]${Array.isArray(l)?`[${y}]`:""}${typeof c=="string"?"":".field"}`;this.need(typeof c=="string"?c:c.field,p,r.fields)})),a(o.href,`${n}.card.href`,l=>l==="char"||l==="text","a card's link is a text field holding a web address"))}walkMap(t,n){let r=new Map;t.layers.forEach((i,o)=>{let a=`${n}.layers[${o}]`;r.has(i.id)&&this.report(`${a}.id`,`two layers are called "${i.id}"`);let s=i.latitude!==void 0||i.longitude!==void 0,d=i.point!==void 0||s;if([d,!!i.route,!!i.myLocation,!!i.regions,!!i.reachable].filter(Boolean).length!==1&&this.report(a,"a layer is one of: a place (point, or latitude and longitude, for the record or for each of its lines), a route, myLocation, regions, or reachable"),i.regions?.choose!==void 0&&this.need(i.regions.choose,`${a}.regions.choose`),i.point!==void 0&&s?this.report(a,"a layer takes point, or latitude and longitude, not both"):i.point===void 0&&s&&(i.latitude===void 0||i.longitude===void 0)&&this.report(a,"a layer needs both latitude and longitude"),i.lines!==void 0&&!d&&this.report(`${a}.lines`,"a layer of lines needs where each line is: point, or latitude and longitude, of the line's fields"),i.live&&(!d||i.lines!==void 0)&&this.report(`${a}.live`,"live is for a layer of the record's own place: it moves as its fields change"),this.checkModifiers(i,a,["invisible"]),r.set(i.id,{lines:i.lines!==void 0,place:d||!!i.myLocation}),!d)return;if(i.lines===void 0)return this.checkPlace(i,a,this.here(),i.pin,i.card);let f=this.need(i.lines,`${a}.lines`);if(f){if(f.type!=="one2many")return this.report(`${a}.lines`,`"${i.lines}" is a ${f.type}; a layer of lines is a one2many field`);this.checkPlace(i,a,{fields:f.fields,lines:i.lines,parent:this.page.fields},i.pin,i.card)}}),t.layers.forEach((i,o)=>{let a=i.route;if(!a)return;let s=`${n}.layers[${o}].route`,d=(c,y)=>{if(c===void 0)return;let p=r.get(c);p?(!p.place||p.lines)&&this.report(`${s}.${y}`,`a route's ${y} is a layer of one place, or the reader's own; "${c}" is not`):this.report(`${s}.${y}`,`no layer "${c}" on this map`)};if(d(a.from,"from"),d(a.to,"to"),a.through!==void 0){let c=r.get(a.through);c?c.lines||this.report(`${s}.through`,`a route goes through a layer of lines; "${a.through}" is not one`):this.report(`${s}.through`,`no layer "${a.through}" on this map`)}a.to===void 0&&a.through===void 0&&this.report(s,"a route needs where it goes: to, or through");let l=(c,y,p,k)=>{if(c===void 0)return;let g=this.need(c,`${s}.write.${y}`);g&&!p(g.type)&&this.report(`${s}.write.${y}`,`"${c}" is a ${g.type}; ${k}`)},f=c=>c==="float"||c==="integer";l(a.write?.seconds,"seconds",f,"seconds are a number field"),l(a.write?.metres,"metres",f,"metres are a number field"),l(a.write?.line,"line",c=>c==="json","a line is kept in a json field")}),t.layers.forEach((i,o)=>{if(!i.reachable)return;let a=r.get(i.reachable.from),s=`${n}.layers[${o}].reachable.from`;a?(!a.place||a.lines)&&this.report(s,`a reachable area is worked out from a layer of one place, or the reader's own; "${i.reachable.from}" is not`):this.report(s,`no layer "${i.reachable.from}" on this map`)}),t.fences?.forEach((i,o)=>{let a=`${n}.fences[${o}]`,s=t.layers.find(d=>d.id===i.layer);if(s?!s.live&&!s.myLocation&&this.report(`${a}.layer`,`a fence watches a place that moves: a live layer, or the reader's own; "${i.layer}" is not`):this.report(`${a}.layer`,`no layer "${i.layer}" on this map`),i.area!==void 0){let d=this.need(i.area,`${a}.area`);d&&d.type!=="json"&&this.report(`${a}.area`,`"${i.area}" is a ${d.type}; an area is kept in a json field`)}i.within!==void 0&&!t.layers.some(d=>d.id===i.within&&d.reachable)&&this.report(`${a}.within`,`a fence is within a reachable area of this map; "${i.within}" is not one`),this.checkSteps(i.steps,`${a}.steps`)})}walkChildren(t,n){t.forEach((r,i)=>this.walkNode(r,`${n}.children[${i}]`))}walkNode(t,n){switch(this.claim(t.id,n),this.checkModifiers(t,n,t.type==="field"?["invisible","readonly","required"]:t.type==="section"||t.type==="form"?["invisible","readonly"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,n);case"section":return t.collapsible&&!t.title&&this.report(n,"a collapsible section needs a title to fold it by"),t.collapsed&&!t.collapsible&&this.report(n,"collapsed needs collapsible: true"),t.style==="inline"&&t.columns!==void 0&&this.report(`${n}.columns`,"parts on one line take no columns: each is as wide as it needs"),t.style==="inline"&&t.collapsible&&this.report(`${n}.collapsible`,"a line of parts does not fold: its title is its label"),t.style==="inline"&&t.children.forEach((r,i)=>{["field","text","button","spacer"].includes(r.type)||this.report(`${n}.children[${i}]`,`a line of parts holds fields, words and buttons; a ${r.type} needs a row of its own`)}),this.walkChildren(t.children,n);case"tabs":return this.walkTabs(t,n);case"form":return this.checkFormNode(t,n);case"button":return this.checkPress(t,n);case"text":return this.checkValuesIn(t.text,`${n}.text`);case"map":return this.walkMap(t,n);default:return}}checkFormNode(t,n){if(typeof t.page!="string"||typeof t.name!="string")return this.report(n,"a saved form placed here needs the page\u2019s id and a name for its answers");t.page===this.page.id&&this.report(`${n}.page`,"a page cannot be placed inside itself");let r=this.formNames.get(t.name);xt(this.page.fields,t.name)?this.report(`${n}.name`,`"${t.name}" is a field of this page: the saved form\u2019s answers need a name of their own`):r!==void 0?this.report(`${n}.name`,`the answers of the saved form at ${r} go under "${t.name}" already: give each copy a name of its own`):this.formNames.set(t.name,n)}walkTabs(t,n){t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}walkSheet(t,n){if(t.title&&(this.need(t.title.field,`${n}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${n}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${n}.title.avatarField`),t.title.placeholderWhen?.forEach((o,a)=>this.checkModifiers(o,`${n}.title.placeholderWhen[${a}]`,["when"]))),t.statusbar){let{field:o,visibleStates:a,durationsField:s,fold:d,saves:l,clickable:f}=t.statusbar,c=`${n}.statusbar`;if(this.checkModifiers(t.statusbar,c),s!==void 0){let p=this.need(s,`${c}.durationsField`);p&&p.type!=="json"&&this.report(`${c}.durationsField`,`"${s}" is a ${p.type}; time per step comes from a json field`)}l&&!f&&this.report(`${c}.saves`,"a click saves only where a step can be clicked (clickable)");let y=this.need(o,`${n}.statusbar.field`);if(d&&y&&y.type!=="many2one"&&this.report(`${c}.fold`,"steps fold by their record (a stage), so only a link\u2019s steps fold; a choice keeps the steps it shows with visibleStates"),y&&y.type!=="selection"&&y.type!=="many2one"&&this.report(`${n}.statusbar.field`,`"${o}" is a ${y.type}; a statusbar needs a selection or many2one`),y?.type==="selection"&&a){let p=new Set(y.options.map(k=>k.value));a.forEach((k,g)=>{p.has(k)||this.report(`${n}.statusbar.visibleStates[${g}]`,`"${k}" is not an option of "${o}"`)})}}t.buttons?.forEach((o,a)=>{this.claim(o.id,`${n}.buttons[${a}]`),this.checkModifiers(o,`${n}.buttons[${a}]`),this.checkPress(o,`${n}.buttons[${a}]`)}),t.statButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.statButtons[${a}]`),this.checkModifiers(o,`${n}.statButtons[${a}]`),this.checkPress(o,`${n}.statButtons[${a}]`);for(let s of["field","unitField","labelField","secondField"]){let d=o[s];d!==void 0&&this.need(d,`${n}.statButtons[${a}].${s}`)}o.secondLabel!==void 0&&o.secondField===void 0&&this.report(`${n}.statButtons[${a}].secondLabel`,"words for a second value need its field (secondField)")});let r=[...t.ribbon?[[t.ribbon,`${n}.ribbon`]]:[],...(t.ribbons??[]).map((o,a)=>[o,`${n}.ribbons[${a}]`])];for(let[o,a]of r)this.claim(o.id,a),this.checkModifiers(o,a),o.labelField!==void 0&&this.need(o.labelField,`${a}.labelField`);t.badges?.forEach((o,a)=>{this.claim(o.id,`${n}.badges[${a}]`),this.checkModifiers(o,`${n}.badges[${a}]`)});for(let o of["above","before","after","below"])t.title?.[o]?.forEach((a,s)=>this.walkNode(a,`${n}.title.${o}[${s}]`));t.alerts?.forEach((o,a)=>{let s=`${n}.alerts[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),this.checkValuesIn(o.message,`${s}.message`),o.messageField!==void 0&&this.need(o.messageField,`${s}.messageField`),o.buttons?.forEach((d,l)=>{this.claim(d.id,`${s}.buttons[${l}]`),this.checkModifiers(d,`${s}.buttons[${l}]`),this.checkPress(d,`${s}.buttons[${l}]`)})}),t.toolbar?.menu?.forEach((o,a)=>{let s=`${n}.toolbar.menu[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),!o.steps&&o.action===void 0&&!o.builtin&&this.report(s,"a menu item needs steps, an action, or a built-in"),o.label===void 0&&!o.builtin&&this.report(`${s}.label`,"a menu item needs words, unless it is a built-in"),o.steps&&this.checkSteps(o.steps,`${s}.steps`)});let i=t.attachmentPreview;if(i){this.checkModifiers(i,`${n}.attachmentPreview`);let o=i.field!==void 0?this.need(i.field,`${n}.attachmentPreview.field`):void 0;o&&o.type!=="binary"&&o.type!=="image"&&this.report(`${n}.attachmentPreview.field`,`"${i.field}" is a ${o.type}; the preview shows a file (binary or image)`)}this.walkChildren(t.children,n),t.sidePanel&&(this.claim(t.sidePanel.id,`${n}.sidePanel`),this.checkModifiers(t.sidePanel,`${n}.sidePanel`))}checkAddressSearch(t,n,r){let i=t.options??{},o=l=>{let f=i[l];return typeof f=="string"&&xt(this.page.fields,f)?this.page.fields[f].type:void 0};n&&n.type!=="char"&&this.report(`${r}.widget`,`address-search is for a char field; "${t.field}" is a ${n.type}`);let a=o("placeField");a&&a!=="json"&&a!=="float"&&this.report(`${r}.options.placeField`,`"${i.placeField}" is a ${a}; a place is kept in a json field, or in a float field (its latitude) with longitudeField`),a==="float"&&i.longitudeField===void 0&&this.report(`${r}.options.placeField`,`"${i.placeField}" keeps a latitude: name the float field for its longitude in longitudeField`),i.longitudeField!==void 0&&a!=="float"&&this.report(`${r}.options.longitudeField`,"longitudeField goes with a placeField that is a float field, its latitude");let s=o("longitudeField");s&&s!=="float"&&this.report(`${r}.options.longitudeField`,`"${i.longitudeField}" is a ${s}; a longitude is kept in a float field`);let d=o("partsField");d&&d!=="json"&&this.report(`${r}.options.partsField`,`"${i.partsField}" is a ${d}; an address's parts are kept in a json field`)}checkFieldNode(t,n){let r=this.need(t.field,`${n}.field`);t.validate?.forEach((i,o)=>{let a=`${n}.validate[${o}]`;if(this.checkModifiers(i,a,["when","holds"]),i.distinct!==void 0&&r&&(r.type!=="one2many"?this.report(`${a}.distinct`,`distinct is for a table of lines; "${t.field}" is a ${r.type}`):xt(r.fields,i.distinct)||this.report(`${a}.distinct`,`"${i.distinct}" is not a field of the lines of "${t.field}"`)),i.pattern!==void 0)try{new RegExp(i.pattern)}catch{this.report(`${a}.pattern`,`"${i.pattern}" is not a regular expression`)}}),t.tones?.forEach((i,o)=>this.checkModifiers(i,`${n}.tones[${o}]`,["when"])),t.placeholderWhen?.forEach((i,o)=>this.checkModifiers(i,`${n}.placeholderWhen[${o}]`,["when"])),this.checkModifiers(t,n,["bold"]),r&&t.totals&&(r.type!=="one2many"?this.report(`${n}.totals`,`totals only apply to one2many fields; "${t.field}" is a ${r.type}`):t.totals.forEach((i,o)=>{let a=xt(r.fields,i)?r.fields[i]:void 0;a?["integer","float","monetary"].includes(a.type)||this.report(`${n}.totals[${o}]`,`"${i}" is a ${a.type}; only integer, float and monetary columns add up`):this.report(`${n}.totals[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}));for(let[i,o]of Object.entries(t.options??{}))i.endsWith("Field")&&typeof o=="string"&&this.need(o,`${n}.options.${i}`);t.widget==="address-search"&&this.checkAddressSearch(t,r,n),r&&t.order&&(r.type!=="one2many"?this.report(`${n}.order`,`order only applies to one2many fields; "${t.field}" is a ${r.type}`):t.order.forEach((i,o)=>!xt(r.fields,i.field)&&this.report(`${n}.order[${o}].field`,`"${i.field}" is not a field of the lines of "${t.field}"`))),r&&t.lineForm&&(r.type!=="one2many"?this.report(`${n}.lineForm`,`lineForm only applies to one2many fields; "${t.field}" is a ${r.type}`):this.checkLineForm(t,r,n));for(let i of["lineOpens","cards","fit"])r&&t[i]&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only applies to one2many fields; "${t.field}" is a ${r.type}`);if(r&&t.editMode&&r.type!=="one2many"&&this.report(`${n}.editMode`,`editMode only applies to one2many fields; "${t.field}" is a ${r.type}`),r&&t.lineDelete!==void 0&&r.type!=="one2many"&&this.report(`${n}.lineDelete`,`lineDelete only applies to one2many fields; "${t.field}" is a ${r.type}`),r&&(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons||t.lineDelete!==void 0))if(r.type!=="one2many")(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons)&&this.report(n,`cells, rowTones, rowBold and rowButtons only apply to one2many fields; "${t.field}" is a ${r.type}`);else{let i={fields:r.fields,lines:t.field};for(let[o,a]of Object.entries(t.cells??{})){if(!xt(r.fields,o)){this.report(`${n}.cells.${o}`,`"${o}" is not a field of the lines of "${t.field}"`);continue}this.checkModifiers(a,`${n}.cells.${o}`,["invisible","readonly","required","bold"],i),this.checkModifiers(a,`${n}.cells.${o}`,["hidden"]),a.tones?.forEach((s,d)=>this.checkModifiers(s,`${n}.cells.${o}.tones[${d}]`,["when"],i));for(let[s,d]of Object.entries(a.options??{}))s.endsWith("Field")&&typeof d=="string"&&this.need(d,`${n}.cells.${o}.options.${s}`,r.fields)}t.rowTones?.forEach((o,a)=>this.checkModifiers(o,`${n}.rowTones[${a}]`,["when"],i)),this.checkModifiers(t,n,["rowBold","lineDelete"],i),t.rowButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.rowButtons[${a}]`),this.checkModifiers(o,`${n}.rowButtons[${a}]`,["invisible"],i),this.checkPress(o,`${n}.rowButtons[${a}]`)})}for(let i of["selectedButtons","controlButtons"])t[i]&&(r&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only apply to one2many fields; "${t.field}" is a ${r.type}`),t[i].forEach((o,a)=>{this.claim(o.id,`${n}.${i}[${a}]`),this.checkModifiers(o,`${n}.${i}[${a}]`),this.checkPress(o,`${n}.${i}[${a}]`)}));if(r&&t.optionalColumns)if(r.type!=="one2many")this.report(`${n}.optionalColumns`,`optional columns only apply to one2many fields; "${t.field}" is a ${r.type}`);else{let i=t.columns??Object.keys(r.fields).filter(o=>o!==("lineKinds"in r?r.lineKinds?.field:void 0)&&o!==r.sequenceField);for(let o of Object.keys(t.optionalColumns))i.includes(o)||this.report(`${n}.optionalColumns.${o}`,`"${o}" is not a column of "${t.field}"`)}!r||!t.columns||(r.type==="one2many"?t.columns.forEach((i,o)=>{xt(r.fields,i)?r.fields[i].type==="one2many"&&this.report(`${n}.columns[${o}]`,`"${i}" holds lines of its own: they are edited in the line's form (lineForm), not drawn in its row`):this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}):r.type==="many2many"?t.columns.forEach((i,o)=>{(!r.fields||!xt(r.fields,i))&&this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the records of "${t.field}"`)}):this.report(`${n}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${r.type}`))}};var Jn=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),oc=["sheet","sections","tabs","wizard"];function yr(e,t={}){if(!Jn(e))return{ok:!1,issues:[{path:"(page)",message:"a page is a JSON object"}]};let n=[],r=(l,f)=>n.push({path:l,message:f});e.fieldia!=="0.1"&&r("fieldia",`this build reads format ${"0.1"}`),(typeof e.id!="string"||!e.id)&&r("id","a page needs an id");let i=e.data;(!Jn(i)||!(i.kind==="responses"||i.kind==="record"&&typeof i.model=="string"&&i.model))&&r("data",'data is { "kind": "record", "model": \u2026 } or { "kind": "responses" }');let o=e.fields;if(!Jn(o))r("fields","fields is an object of field definitions, by name");else for(let[l,f]of Object.entries(o))(!Jn(f)||!Kr.includes(f.type)||typeof f.label!="string")&&r(`fields.${l}`,"a field needs a type Fieldia knows and a label");let a=e.layout,s=Jn(a)&&a.type==="list";if((!Jn(a)||(s?!Array.isArray(a.columns):!oc.includes(a.type)||!Array.isArray(a.children)))&&r("layout","the layout is a sheet, sections, tabs or wizard, with children, or a list with columns"),n.length)return{ok:!1,issues:n};let d=e;try{let l=new ni(d,t.parent?{name:d.id,parent:t.parent}:void 0).run();return l.length?{ok:!1,issues:l}:{ok:!0,page:d}}catch(l){return{ok:!1,issues:[{path:"(page)",message:`a part of this page cannot be read: ${l.message}`}]}}}var ac=new Set(["title","description","label","help","placeholder","message","text","confirm","alt","caption","tooltip","unit","readonlyReason"]),sc=new Set(["lineKinds","filter","default","data","translations","optionalColumns","values","into","params","map"]),dc=e=>t=>{if(t===null||typeof t!="object"||Array.isArray(t))return t;let n=t.unit;return typeof n=="string"?{...t,unit:e(n)}:n===null||typeof n!="object"?t:{...t,unit:Object.fromEntries(Object.entries(n).map(([r,i])=>[r,typeof i=="string"?e(i):i]))}},Ya=e=>t=>{if(t===null||typeof t!="object")return t;let n=t.card;if(!n||!Array.isArray(n.fields))return t;let r=dc(e);return{...t,card:{...n,fields:n.fields.map(i=>Array.isArray(i)?i.map(r):r(i))}}},lc=e=>t=>{let n=t!==null&&typeof t=="object"&&typeof t.label=="string"?{...t,label:e(t.label)}:t;return Ya(e)(n)};function ri(e,t,n,r,i=!1){if(typeof e=="string")return t!==null&&(t.endsWith("Label")||!i&&ac.has(t))?n(e):e;if(Array.isArray(e))return e.map(a=>ri(a,null,n,r,i));if(e===null||typeof e!="object")return e;r?.(e);let o={};for(let[a,s]of Object.entries(e))a==="layers"&&Array.isArray(s)?o[a]=s.map(lc(n)):a==="map"&&s!==null&&typeof s=="object"&&!Array.isArray(s)?o[a]=Ya(n)(s):o[a]=sc.has(a)?s:ri(s,a,n,r,i||a==="options"&&!Array.isArray(s));return o}function Gn(e,t){return ri(e,null,t)}function Xa(e){let t=new Set,n=e.fields,r=(i,o=null)=>ri(i,o,a=>(a.trim()&&t.add(a),a),a=>{a.type==="wizard"&&r(a.children);let s=a.type==="field"?n[a.field]:void 0;if(s){for(let[d,l]of[[a,"label"],[s,"label"],[a,"placeholder"],[a,"help"],[s,"help"],[a,"readonlyReason"]])r(d[l],l);r(s)}});return r({title:e.title,description:e.description,layout:e.layout}),r(e),[...t]}function xr(e,t){let n=e.translations?.[t]??e.translations?.[t.split("-")[0]];return n?Gn(e,r=>n[r]??r):e}function Mn(e){let[t,...n]=e.toLowerCase().split("-"),r=n.find(i=>i.length===4&&!/\d/.test(i));return r?/^(arab|hebr|syrc|thaa|nkoo|adlm|rohg)$/.test(r):/^(ar|he|iw|fa|ur|ps|sd|yi|dv|ckb|ug|ks|syr|prs|pnb|azb)$/.test(t)}function Nn(e,t){if(!e?.length)return!0;let n=e.filter(r=>!r.startsWith("!"));return e.some(r=>r.startsWith("!")&&t.includes(r.slice(1)))?!1:!n.length||n.some(r=>t.includes(r))}function Za(e,t){if(e===void 0)return!1;if(typeof e=="boolean")return e;if(e==="1"||e==="True"||e==="true")return!0;if(e==="0"||e==="False"||e==="false"||e==="")return!1;try{let n=rn(e);if(n.length===0)return!1;let i=new zt(n).parse(),o=Pt(i,t);return Ct(o)}catch{return!1}}function Qa(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=rn(e);return t.length===0||new zt(t).parse(),!0}catch{return!1}}var es={};var cc={required:"{label} is required",maxLength:"Maximum {max} characters allowed",pattern:"{label} is not in the expected format",text:"{label} must be text",number:"{label} must be a number",integer:"{label} must be a whole number",min:"{label} must be at least {min}",max:"{label} must be at most {max}",decimals:"Maximum {digits} decimal places allowed",boolean:"{label} must be yes or no",dateFormat:"Invalid date format (expected YYYY-MM-DD)",dateInvalid:"Invalid date (check month/day values)",datetimeFormat:"Invalid date and time format (expected YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"Invalid date and time (check the values)",choice:"Must be one of: {options}",choiceOrOther:"Must be one of: {options}, or an answer of its own",matrix:"{label} takes an answer for each row",matrixRow:"Rows are: {rows}",matrixRows:"Answer every row of {label}",choices:"{label} must be a list of choices",record:"{label} must be a record",records:"{label} must be a list of records",reference:"{label} must point to {aModels}",file:"{label} must be a file",fileSize:"{label} is larger than {size}",fileType:"{label} must be {aTypes} file",minFiles:"Add at least {min} files to {label}",maxFiles:"Too many files for {label}: at most {max}",minLength:"{label} must be at least {min} characters",endsWith:"{label} must end with {ending}",atLeast:"Choose at least {min} for {label}",atMost:"Choose at most {max} for {label}",datePast:"{label} must be in the past",dateFuture:"{label} must be in the future",holds:"{label} does not agree with the other answers",distinct:"{column}: {value} is on more than one line of {label}",or:"or",tick:"Tick this box to go on",email:"Enter an email address, like name@example.com",url:"Enter a web address, like example.com",phone:"Enter a phone number, like +20 100 123 4567",time:"Enter a time, like 14:30",before:"{label} can\u2019t be before {min}",after:"{label} can\u2019t be after {max}",weekday:"{label} can\u2019t be on a {days}",minLines:"Add at least {min} to {label}",maxLines:"Too many in {label}: at most {max}",addressParts:"Street address|Address line 2|City|State or region|Postcode|Country",archiveConfirm:"Are you sure that you want to archive this record?",deleteConfirm:"Are you sure you want to delete this record?",locale:"en"},Tt={en:cc,...es};function Ye(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n)}function yn(e,t=hn(new Date)){let n=/^today([+-]\d+)?$/.exec(e);if(!n)return e;let[r,i,o]=t.split("-").map(Number);return new Date(Date.UTC(r,i-1,o+Number(n[1]??0))).toISOString().slice(0,10)}var ts=(e,t,n)=>new Intl.DateTimeFormat(t.locale,{...e,timeZone:"UTC",numberingSystem:"latn"}).format(n);function yo(e,t,n,r){if(e.type!=="date"&&e.type!=="datetime")return;let i=e.type==="date"?t:hn(new Date(t)),o=(f,c)=>Ye(r[f],{label:e.label,min:c,max:c,days:c}),a=f=>ts({day:"numeric",month:"long",year:"numeric"},r,Date.parse(f)),s=e.min&&yn(e.min,n),d=e.max&&yn(e.max,n);if(s&&i<s)return o("before",a(s));if(d&&i>d)return o("after",a(d));let l=e.days;if(l&&!l.includes(new Date(Date.parse(i)).getUTCDay()||7)){let f=[1,2,3,4,5,6,7].filter(c=>!l.includes(c)).map(c=>ts({weekday:"long"},r,Date.UTC(2024,0,c)));return o("weekday",f.length>1?`${f.slice(0,-1).join(", ")} ${r.or} ${f[f.length-1]}`:f[0])}}function Cn(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":case"binary":case"image":return e.multiple?[]:null;default:return null}}function xn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=i.default;n[r]=o===void 0?Cn(i):i.type==="date"&&typeof o=="string"&&o.startsWith("today")?yn(o,t):Ae(o)}return n}function Kt(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:e.type==="matrix"&&typeof t=="object"?Object.values(t).every(n=>n==null||Array.isArray(n)&&!n.length):!1}function vn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=t[r];n[r]=o?fc(o,i):i}return n}function fc(e,t){if(t==null)return null;switch(e.type){case"many2one":return t.id;case"many2many":return t.map(n=>n.id);case"one2many":return t.map(n=>n.key);case"reference":{let n=t;return`${n.model},${n.id}`}case"binary":case"image":return Array.isArray(t)?t.map(n=>n.name):t.name;default:return t}}function gt(e,t){let n=e.lineKinds;if(!n)return null;let r=t[n.field];return r===(n.section??"section")?"section":r===(n.note??"note")?"note":null}function ii(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function Ae(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function wn(e,t,n,r=Tt.en,i){let o=e.label||"This field",a=(s,d={})=>Ye(r[s],{label:o,...d});if(Kt(e,t))return n?a("required"):void 0;if(e.type==="matrix")return uc(e,t,n,a);switch(e.type){case"char":case"text":case"html":return typeof t!="string"?a("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?a("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?a("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?a("number"):e.type==="integer"&&!Number.isInteger(t)?a("integer"):e.min!==void 0&&t<e.min?a("min",{min:e.min}):e.max!==void 0&&t>e.max?a("max",{max:e.max}):e.type!=="integer"&&e.digits&&pc(t)>e.digits[1]?a("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:a("boolean");case"date":return mc(t,a)??yo(e,t,i,r);case"datetime":return hc(t,a)??yo(e,t,i,r);case"selection":{if(e.optionsFrom)return;let s=new Set(e.options.map(f=>f.value)),d=a(e.other?"choiceOrOther":"choice",{options:e.options.map(f=>f.label).join(", ")}),l=f=>(e.other===!0||e.ownAnswers===!0)&&typeof f=="string"&&f.trim()!==""&&!s.has(f);return e.multiple?Array.isArray(t)?(t.filter(c=>!s.has(c)).length<=1||e.ownAnswers)&&t.every(c=>s.has(c)||l(c))?void 0:d:a("choices"):s.has(t)||l(t)?void 0:d}case"many2one":return xo(t)?void 0:a("record");case"many2many":return Array.isArray(t)&&t.every(xo)?void 0:a("records");case"reference":{let s=t;if(!xo(t)||typeof s.model!="string")return a("record");if(!e.models.some(d=>d.value===s.model)){let d=rs(e.models.map(l=>l.label),r.or);return a("reference",{models:d,aModels:is(d)})}return}case"binary":case"image":return bc(e,t,a,r);default:return}}function uc(e,t,n,r){if(t===null||typeof t!="object"||Array.isArray(t))return r("matrix");let i=new Set(e.rows.map(d=>String(d.value))),o=new Set(e.columns.map(d=>d.value)),a=r("choice",{options:e.columns.map(d=>d.label).join(", ")});for(let[d,l]of Object.entries(t)){if(!i.has(d))return r("matrixRow",{rows:e.rows.map(c=>c.label).join(", ")});let f=e.multiple&&Array.isArray(l)?l:[l];if(!e.multiple&&Array.isArray(l)||f.some(c=>c!=null&&!o.has(c)))return a}let s=d=>{let l=t[d];return l!=null&&!(Array.isArray(l)&&!l.length)};if(n&&e.rows.some(d=>!s(String(d.value))))return r("matrixRows")}function pc(e){let t=String(e);if(t.includes("e-"))return Number(t.split("e-")[1]);let n=t.indexOf(".");return n===-1?0:t.length-n-1}function xo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function mc(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[n,r,i]=e.split("-").map(Number);return ns(n,r,i)?void 0:t("dateInvalid")}var gc=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function hc(e,t){let n=typeof e=="string"?gc.exec(e):null;if(!n)return t("datetimeFormat");let[r,i,o,a,s,d]=n.slice(1).map(l=>Number(l??0));return ns(r,i,o)&&a<24&&s<60&&d<60?void 0:t("datetimeInvalid")}function ns(e,t,n){if(t<1||t>12||n<1)return!1;let r=[31,e%4===0&&(e%100!==0||e%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return n<=r[t-1]}function bc(e,t,n,r){let i=e.multiple?Array.isArray(t)?t:[t]:[t];if(e.multiple&&e.minFiles!==void 0&&i.length<e.minFiles)return n("minFiles",{min:e.minFiles});if(e.multiple&&e.maxFiles!==void 0&&i.length>e.maxFiles)return n("maxFiles",{max:e.maxFiles});for(let o of i){if(!yc(o))return n("file");let a=vr(e,o,r,e.multiple?o.name:e.label||"This field");if(a)return a}}function vr(e,t,n=Tt.en,r=t.name){if(e.maxSize!==void 0&&t.size>e.maxSize)return Ye(n.fileSize,{label:r,size:on(e.maxSize)});let i=e.type==="image"?["image/*"]:e.accept;if(i&&!xc(i,t.type)){let o=wr(i,n.or);return Ye(n.fileType,{label:r,types:o,aTypes:is(o)})}}function yc(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function xc(e,t){return e.some(n=>n.endsWith("/*")?t.startsWith(n.slice(0,-1)):n===t)}var vc="pdf PDF,msword DOC,wordprocessingml DOCX,opendocument.text ODT,plain TXT,ms-excel XLS,spreadsheetml XLSX,opendocument.spreadsheet ODS,csv CSV,ms-powerpoint PPT,presentationml PPTX,opendocument.presentation ODP".split(",").map(e=>e.split(" "));function wc(e){if(e.endsWith("/*"))return e.slice(0,-2);let t=e.split("/")[1]??e;return vc.find(([n])=>t.includes(n))?.[1]??t.toUpperCase()}function wr(e,t){return rs([...new Set(e.map(wc))],t)}function rs(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function is(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function on(e){let t=["bytes","KB","MB","GB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${Number(n.toFixed(1))} ${t[r]}`}var os=e=>Math.round(e*1e9)/1e9,as=(e,t)=>e.find(n=>n.value===t)?.score??0,ss=e=>e.reduce((t,n)=>Math.max(t,n.score??0),0),ds=e=>e.reduce((t,n)=>t+Math.max(0,n.score??0),0),ls=(e,t,n)=>n?Array.isArray(t)?t.reduce((r,i)=>r+as(e,i),0):0:as(e,t);function cs(e,t){let n=0,r=0,i=!1;for(let[o,a]of Object.entries(e.fields))if(a.type==="selection"&&a.options.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0;n+=ls(a.options,t[o],s),r+=s?ds(a.options):ss(a.options)}else if(a.type==="matrix"&&a.columns.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0,d=t[o],l=d&&typeof d=="object"&&!Array.isArray(d)?d:{};for(let f of a.rows)n+=ls(a.columns,l[String(f.value)],s),r+=s?ds(a.columns):ss(a.columns)}return i?{score:os(n),max:os(r)}:null}function fs(e){return Object.assign(new Error(e.message),{problem:e})}function oi(e){let t=e?.problem;if(t&&typeof t.kind=="string")return t;let n=e instanceof Error?e.message:String(e);return e instanceof TypeError&&/fetch|network|load failed/i.test(n)?{kind:"network",message:n}:{kind:"other",message:n}}function Xn(e,t){return t.every(n=>vo(e,n))}function vo(e,t){return"any"in t?t.any.some(n=>vo(e,n)):"all"in t?t.all.every(n=>vo(e,n)):Sc(e,t)}function an(e){return e!=null&&e!==""&&e!==!1&&!(Array.isArray(e)&&!e.length)}function kc(e){return Array.isArray(e)?e.map(t=>t!==null&&typeof t=="object"&&"id"in t?t.id:t):[]}function Sc(e,t){let n=e[t.field],r=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"id"in n?n.id:n,i=t.value,o=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"label"in n?String(n.label):String(r??"");switch(t.op){case"=":return r===i;case"=?":return!an(i)||r===i;case"contains":case"not contains":{let a=kc(n),d=(Array.isArray(i)?i:[i]).some(l=>a.includes(l));return t.op==="contains"?d:!d}case"!=":return r!==i;case"<":return an(r)&&r<i;case">":return an(r)&&r>i;case"<=":return an(r)&&r<=i;case">=":return an(r)&&r>=i;case"in":return Array.isArray(i)&&i.includes(r);case"not in":return Array.isArray(i)&&!i.includes(r);case"like":return o.includes(String(i));case"ilike":return o.toLowerCase().includes(String(i).toLowerCase());case"startswith":return o.toLowerCase().startsWith(String(i).toLowerCase());case"endswith":return o.toLowerCase().endsWith(String(i).toLowerCase());case"set":return an(n);case"notset":return!an(n);case"between":{if(!an(r)||!Array.isArray(i))return!1;let[a,s]=i;return r>=a&&r<=s}case"within":return Lc(e,n,i)}}var wo=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function Lc(e,t,n){if(!wo(n))return!1;let r=us(e,t,n.longitude);if(!r)return!1;let{lat:i,lng:o}=r;if(Array.isArray(n.polygon))return Ec(o,i,n.polygon);if(Array.isArray(n.center)){let[f,c]=n.center;return ps(i,o,c,f)<=n.radius}let{south:a,west:s,north:d,east:l}=n;return i<a||i>d?!1:s<=l?o>=s&&o<=l:o>=s||o<=l}function us(e,t,n){let r,i;if(typeof n=="string")r=t,i=e[n];else{let o=wo(t)&&t.type==="Feature"?t.geometry:t,a=wo(o)&&o.type==="Point"?o.coordinates:null;if(!Array.isArray(a))return null;[i,r]=a}return typeof r=="number"&&typeof i=="number"?{lat:r,lng:i}:null}function ko(e,t,n){let r=us(e,e[t],n.longitude);return r?ps(r.lat,r.lng,n.lat,n.lng):null}function Ec(e,t,n){let r=!1;for(let i=0,o=n.length-1;i<n.length;o=i++){let[a,s]=n[i],[d,l]=n[o];s>t!=l>t&&e<(d-a)*(t-s)/(l-s)+a&&(r=!r)}return r}function ps(e,t,n,r){let i=Math.PI/180,o=Math.sin((n-e)*i/2)**2+Math.cos(e*i)*Math.cos(n*i)*Math.sin((r-t)*i/2)**2;return 2*63710088e-1*Math.asin(Math.min(1,Math.sqrt(o)))}var Yn=null;function ai(e,t){let n=r=>{if("any"in r){let o=r.any.map(n);return o.includes(Yn)?Yn:{any:o}}if("all"in r){let o=r.all.map(n).filter(a=>a!==Yn);return o.length?{all:o}:Yn}let i=r.valueFrom!==void 0?Rc(t,r.valueFrom):r.value??null;return r.op==="=?"?an(i)?{field:r.field,op:"=",value:i}:Yn:{field:r.field,op:r.op,value:i}};return e.map(n).filter(r=>r!==Yn)}function Rc(e,t){let n=e;for(let r of t.split("."))n=n===null||typeof n!="object"?void 0:n[r];return n??null}var ms=new Set(["char","text","html"]),gs=new Set(["integer","float","monetary"]),Fc=new Set(["many2one","many2many"]);function si(e,t,n,r={searchFor:"Search {field} for: {text}"}){let i=e.trim();if(!i)return[];let o=[];for(let s of n.searchFields??n.columns){let d=t.fields[s];if(!d)continue;let l=(f,c,y,p)=>o.push({field:s,fieldLabel:d.label,op:f,value:c,valueLabel:y,label:p??Ye(r.searchFor,{field:d.label,text:i})});if(ms.has(d.type)||Fc.has(d.type))l("ilike",i,i);else if(d.type==="selection"){let f=i.toLowerCase();for(let c of d.options)c.label.toLowerCase().includes(f)&&l("=",c.value,c.label,`${d.label}: ${c.label}`)}else if(gs.has(d.type)){let f=Number(i.replace(/[\s,]/g,""));i&&Number.isFinite(f)&&l("=",f,i)}}let a=s=>{let d=t.fields[s.field]?.type??"";return ms.has(d)?0:d==="selection"?1:gs.has(d)?2:3};return o.map((s,d)=>({s,i:d})).sort((s,d)=>a(s.s)-a(d.s)||s.i-d.i).map(({s})=>s)}function kr(e,t){let n=[];for(let r of e)if(r.kind==="field"){let i=r.values.map(o=>({field:r.field,op:o.op,value:o.value}));n.push(i.length===1?i[0]:{any:i})}else if(r.kind==="filters"){let i=r.ids.map(o=>t.filters?.find(a=>a.id===o)?.filter??[]).filter(o=>o.length);i.length===1?n.push(...i[0]):i.length>1&&n.push({any:i.map(o=>o.length===1?o[0]:{all:o})})}else r.kind==="custom"&&n.push(...r.filter);return n}function di(e){return e.find(t=>t.kind==="groupBy")?.fields??[]}var Sr={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function li(e,t=Sr){return new Promise(n=>{t.setTimeout(n,e)})}function bs(e={}){let t=Ae(e.records??{}),n=[],r=[],i=new Map,o=1e3,a=()=>e.delayMs?li(e.delayMs,e.scheduler):Promise.resolve(),s=m=>t[m]??(t[m]={}),d=(m,b)=>{let h=s(m)[String(b)]?.[e.labelField?.[m]??"name"];return typeof h=="string"?h:String(b)},l=(m,b)=>{let h=e.shows?.[m],v=h?s(m)[String(b.id)]:void 0;if(!h||!v)return b;let S={...b};h.avatar&&typeof v[h.avatar]=="string"&&(S.avatar=v[h.avatar]),h.color&&typeof v[h.color]=="number"&&(S.color=v[h.color]),h.folded&&(S.folded=v[h.folded]===!0);let x=(h.details??[]).map(F=>v[F]).map(F=>F&&typeof F=="object"&&"label"in F?F.label:F).filter(F=>typeof F=="string"&&F.trim());return x.length&&(S.details=x.join(`
|
|
3
|
-
`)),S},f=m=>Math.max(0,...Object.keys(s(m)).map(Number).filter(Number.isFinite))+1,c=m=>Number.isFinite(Number(m))?Number(m):m,y=(m,b)=>({id:c(m),...b});function p(m,b){let h=[...m];for(let v of b)v.op==="create"?h.push({key:v.key,id:++o,values:Ae(v.values)}):v.op==="update"?h=h.map(S=>S.id===v.id?{...S,values:{...S.values,...Ae(v.values)}}:S):h=h.filter(S=>S.id!==v.id);return h}function k(m,b,h){let v=[...m],S=x=>({id:x,label:d(h,x)});for(let x of b)x.op==="link"&&!v.some(F=>F.id===x.id)?v.push(S(x.id)):x.op==="unlink"?v=v.filter(F=>F.id!==x.id):x.op==="set"?v=x.ids.map(S):x.op==="clear"&&(v=[]);return v}function g(m,b){let h=m[b];return h&&"relation"in h?h.relation:b}return{records:t,responses:n,calls:r,async load(m){r.push({method:"load",request:m}),await a();let b=s(m.model)[String(m.id)];if(!b)throw new Error(`No ${m.model} record with id ${m.id}`);let h=Ae(b);if(e.shows)for(let[v,S]of Object.entries(m.fields)){let x=h[v];S.type==="many2one"&&x&&typeof x=="object"&&"id"in x?h[v]=l(S.relation,x):S.type==="many2many"&&Array.isArray(x)&&(h[v]=x.map(F=>l(S.relation,F)))}return h},async save(m){r.push({method:"save",request:m}),await a();let b=m.id??f(m.model),h={...s(m.model)[String(b)]??{},...Ae(m.changes.values)};for(let[v,S]of Object.entries(m.changes.lines))h[v]=p(h[v]??[],S);for(let[v,S]of Object.entries(m.changes.links))h[v]=k(h[v]??[],S,g(m.fields,v));return s(m.model)[String(b)]=h,{id:b,values:Ae(h)}},async onchange(m){r.push({method:"onchange",request:m}),await a();let b=e.onchange?.[m.model]?.[m.changed],h=e.warnings?.[m.model]?.[m.changed],v=b?{values:b(Ae(m.values))}:{},S=h?.(Ae(m.values));return S?{...v,warning:S}:v},async search(m){r.push({method:"search",request:m}),await a();let b=m.query.trim().toLowerCase();return Object.entries(s(m.model)).filter(([h,v])=>Xn(y(h,v),m.filter??[])).map(([h])=>({id:c(h),label:d(m.model,c(h))})).filter(h=>h.label.toLowerCase().includes(b)).slice(0,m.limit??8).map(h=>l(m.model,h))},async list(m){r.push({method:"list",request:m}),await a();let b=Object.entries(s(m.model)).filter(([h,v])=>Xn(y(h,v),m.filter)).map(([h,v])=>({id:c(h),values:v}));return b.sort((h,v)=>{for(let S of m.sort){let x=S.near?hs(ko(h.values,S.field,S.near),ko(v.values,S.field,S.near)):hs(h.values[S.field],v.values[S.field]);if(x.empty)return x.result;if(x.result)return S.desc?-x.result:x.result}return 0}),{total:b.length,records:b.slice(m.offset,m.offset+m.limit).map(({id:h,values:v})=>({id:h,values:Object.fromEntries(m.fields.map(S=>[S,Ae(v[S]??null)]))}))}},async groups(m){r.push({method:"groups",request:m}),await a();let b=new Map;for(let[h,v]of Object.entries(s(m.model))){if(!Xn(y(h,v),m.filter))continue;let S=v[m.field]??null,x=S!==null&&typeof S=="object"&&!Array.isArray(S)&&"id"in S?S:null,F=x?x.id:S,E=JSON.stringify(F),w=b.get(E)??{value:F,label:x?x.label:S===null||S===""?"":String(S),count:0};w.count++,b.set(E,w)}return[...b.values()].sort((h,v)=>h.value===null==(v.value===null)?h.label.localeCompare(v.label):h.value===null?1:-1)},async create(m){r.push({method:"create",request:m}),await a();let b=s(m.model),h=Object.keys(b).reduce((v,S)=>Math.max(v,Number(S)||0),0)+1;return b[String(h)]={...Ae(m.values??{}),name:m.name},{id:h,label:m.name}},async submit(m){return r.push({method:"submit",request:m}),await a(),n.push(Ae(m)),{id:n.length}},async archive(m){r.push({method:"archive",request:m}),await a();let b=s(m.model)[String(m.id)];if(!b)throw new Error(`No ${m.model} record with id ${m.id}`);b.active=!m.archive},async copy(m){r.push({method:"copy",request:m}),await a();let b=s(m.model)[String(m.id)];if(!b)throw new Error(`No ${m.model} record with id ${m.id}`);let h=f(m.model),v=Ae(b),S=e.labelField?.[m.model]??"name";typeof v[S]=="string"&&(v[S]=`${v[S]}${e.copySuffix??" (copy)"}`);for(let[x,F]of Object.entries(v))Array.isArray(F)&&F.every(E=>E&&typeof E=="object"&&"key"in E&&"values"in E)&&(v[x]=F.map(E=>({...E,id:++o})));return s(m.model)[String(h)]=v,{id:h,values:Ae(v)}},async delete(m){if(r.push({method:"delete",request:m}),await a(),!s(m.model)[String(m.id)])throw new Error(`No ${m.model} record with id ${m.id}`);delete s(m.model)[String(m.id)]},async attachments(m){return r.push({method:"attachments",request:m}),await a(),Ae(e.attachments?.[`${m.model}:${m.id}`]??[])},async options(m){r.push({method:"options",request:m}),await a();let b=e.lists?.[m.list];if(!b)throw new Error(`No list "${m.list}"`);return Ae(typeof b=="function"?await b(m.values):b)},async definitions(m){r.push({method:"definitions",request:m}),await a();let b=e.definitions?.[m.list];if(!b)throw new Error(`No definitions "${m.list}"`);let h=b(m.values),v=i.get(`${m.list}:${JSON.stringify(h)}`)??[];return Ae([...h,...v.filter(S=>!h.some(x=>x.name===S.name))])},async saveDefinitions(m){r.push({method:"saveDefinitions",request:m}),await a();let b=e.definitions?.[m.list]?.(m.values)??[];i.set(`${m.list}:${JSON.stringify(b)}`,Ae(m.definitions.filter(h=>!b.some(v=>v.name===h.name))))}}}function hs(e,t){let n=a=>a==null||a==="";if(n(e)||n(t))return{result:n(e)===n(t)?0:n(e)?1:-1,empty:n(e)!==n(t)};let r=a=>typeof a=="object"&&a!==null&&"label"in a?a.label:a,[i,o]=[r(e),r(t)];return typeof i=="number"&&typeof o=="number"?{result:i-o,empty:!1}:{result:String(i).localeCompare(String(o)),empty:!1}}var ci=["street","line2","city","region","postcode","country"];function ys(e,t,n,r){let i=t.options??{},o=t.label??e.label;if(e.type==="one2many"&&Array.isArray(n)&&n.length){if(typeof i.min=="number"&&n.length<i.min)return Ye(r.minLines,{label:o,min:i.min});if(typeof i.max=="number"&&n.length>i.max)return Ye(r.maxLines,{label:o,max:i.max})}let a=i.requiredParts;if(t.widget!=="address"||!Array.isArray(a)||!n||typeof n!="object"||Array.isArray(n))return;let s=Array.isArray(i.parts)?i.parts:ci,d=n,l=ci.findIndex(f=>a.includes(f)&&s.includes(f)&&!String(d[f]??"").trim());return l<0?void 0:Ye(r.required,{label:r.addressParts.split("|")[l]})}var Ac={email:/^[^@\s]+@[^@\s]+\.[^@\s]+$/,url:/^(https?:\/\/)?([\p{L}\p{N}-]+\.)+\p{L}{2,}(:\d+)?([/?#]\S*)?$/iu,phone:/^\+?[\p{Nd}\s.()-]+$/u,time:/^([01]\d|2[0-3]):[0-5]\d$/};function So(e,t,n,r){let i=t.widget??"";if(e.type!=="char")return ys(e,t,n,r);if(typeof n!="string"||!n.trim())return;let o=n.trim(),a=t.options??{},s=t.label??e.label,d=Ac[i],l=o.match(/\p{Nd}/gu)?.length??0;if(d&&(!d.test(o)||i==="phone"&&(l<7||l>15)))return r[i];if(i==="time"){if(typeof a.min=="string"&&o<a.min)return Ye(r.before,{label:s,min:a.min});if(typeof a.max=="string"&&o>a.max)return Ye(r.after,{label:s,max:a.max})}if(i==="tags"&&typeof a.max=="number"&&o.split(typeof a.separator=="string"&&a.separator?a.separator:",").filter(c=>c.trim()).length>a.max)return Ye(r.atMost,{label:s,max:a.max})}function xs(e,t,n,r=!0,i={},o){let a={id:t??null,user:{id:n?.id??null,name:n?.name??null,roles:[...n?.roles??[]]},editing:r,context:i,...o?{parent:o}:{}};for(let s of Object.keys(a))s in e&&delete a[s];return a}function qt(e,t,n){return{...xs(t,n.recordId,n.user,n.editing,n.context,n.parent),...vn(e,t)}}function kn(e,t,n,r=null){let i={parent:n,user:n.user??xs({},null,void 0).user,id:r,context:n.context??{}};for(let o of Object.keys(i))o in t&&delete i[o];return{...i,...vn(e,t)}}function Pn(e,t,n){let r=new Map;return{today:n,lines(i){let o=t[i];if(o?.type!=="one2many")return;let a=r.get(i);return a||(a=(e[i]??[]).filter(d=>gt(o,d.values)===null).map(d=>vn(d.values,o.fields)),r.set(i,a)),a}}}function vs(e){let t=new Map;for(let[r,i]of Object.entries(e))i.compute!==void 0&&t.set(r,Bt(i.compute));let{order:n}=Qr(new Map([...t].map(([r,i])=>[r,i.fields])));return n.map(r=>[r,t.get(r),e[r]])}function On(e,t){if(e.type==="boolean")return Ct(t);if(t==null)return null;switch(e.type){case"integer":return wt(t)?hr(t,0):null;case"float":case"monetary":return wt(t)?e.digits?hr(t,e.digits[1]):t:null;case"char":case"text":case"html":return typeof t=="string"?t:wt(t)?String(t):null;case"date":case"datetime":return typeof t=="string"?t:null;default:return t}}function ws(e,t,n=()=>({recordId:null})){let r=vs(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=vs(l.fields);f.length&&i.set(d,{def:l,steps:f})}let o={today:t};function a(d,l,f,c,y){let p=d,k=y(d);for(let[g,m,b]of l){let h=On(b,m.evaluate(k,c));ii(h,p[g])||(p={...p,[g]:h},Object.assign(k,vn({[g]:h},f)))}return p}function s(d,l,f){let c=i.get(d);return!c||gt(c.def,l)!==null?l:a(l,c.steps,c.def.fields,o,y=>kn(y,c.def.fields,f))}return{line:(d,l,f)=>s(d,l,qt(f,e.fields,n())),apply(d){let l=d,f=i.size?qt(d,e.fields,n()):{};for(let c of i.keys()){let y=l[c];if(!Array.isArray(y))continue;let p=!1,k=y.map(g=>{let m=s(c,g.values,f);return m===g.values?g:(p=!0,{...g,values:m})});p&&(l={...l,[c]:k})}return r.length?a(l,r,e.fields,Pn(l,e.fields,t),c=>qt(c,e.fields,n())):l}}}function ks(e){return Object.entries(e).flatMap(([t,n])=>(n.setWhen??[]).map((r,i)=>({key:`${t}#${i}`,name:t,def:n,when:et(r.when??!0),value:Bt(r.value),...r.on?{on:r.on}:{}})))}var $c={has:()=>!0};function Ss(e,t,n=()=>({recordId:null})){let r=ks(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let f=ks(l.fields);f.length&&i.set(d,{def:l,rules:f})}let o={today:t};function a(d,l,f,c,y,p,k){let g=d;for(let m of l){if(m.on){let h=`${y}${m.key}@${JSON.stringify(m.on.map(v=>d[v]??null))}`;if(k.add(h),p.has(h)||!m.when.evaluate(f,c))continue}else{if(!m.when.evaluate(f,c))continue;let h=y+m.key;if(k.add(h),p.has(h))continue}let b=On(m.def,m.value.evaluate(f,c));ii(b,g[m.name])||(g={...g,[m.name]:b})}return g}function s(d,l){let f=new Set,c=r.length?a(d,r,qt(d,e.fields,n()),Pn(d,e.fields,t),"",l,f):d,y=i.size?qt(d,e.fields,n()):{};for(let[p,{def:k,rules:g}]of i){let m=d[p];if(!Array.isArray(m))continue;let b=!1,h=m.map(v=>{if(gt(k,v.values)!==null)return v;let S=a(v.values,g,kn(v.values,k.fields,y,v.id??null),o,`${p}.${v.key}.`,l,f);return S===v.values?v:(b=!0,{...v,values:S})});b&&(c={...c,[p]:h})}return{values:c,holding:f}}return{apply:s,holding:d=>s(d,$c).holding}}function Ls(e){return(e??[]).map(t=>({rule:t,when:et(t.when??!0),pattern:t.pattern===void 0?null:new RegExp(`^(?:${t.pattern})$`),holds:t.holds===void 0?null:et(t.holds)}))}function Es(e,t,n,r,i){let o={};if(!r.length||Kt(e,n))return o;for(let a of r){let s=a.rule.level??"error";if(o[s]!==void 0||!a.when.evaluate(i.context,i.env))continue;let d=Tc(a,e,n,i.now)??Cc(a,i);d&&(o[s]=a.rule.message??Ye(i.messages[d.say],{label:t,...d.values}))}return o}function Tc({rule:e,pattern:t},n,r,i){let o=typeof r=="string"?r:null;if(o!==null&&e.minLength!==void 0&&o.length<e.minLength)return{say:"minLength",values:{min:e.minLength}};if(o!==null&&e.maxLength!==void 0&&o.length>e.maxLength)return{say:"maxLength",values:{max:e.maxLength}};if(t&&(o!==null||wt(r))&&!t.test(String(r)))return{say:"pattern"};if(o!==null&&e.endsWith!==void 0&&!o.trim().toLowerCase().endsWith(e.endsWith.toLowerCase()))return{say:"endsWith",values:{ending:e.endsWith}};if(wt(r)&&e.min!==void 0&&r<e.min)return{say:"min",values:{min:e.min}};if(wt(r)&&e.max!==void 0&&r>e.max)return{say:"max",values:{max:e.max}};let a=Array.isArray(r)?r.length:null;if(a!==null&&e.atLeast!==void 0&&a<e.atLeast)return{say:"atLeast",values:{min:e.atLeast}};if(a!==null&&e.atMost!==void 0&&a>e.atMost)return{say:"atMost",values:{max:e.atMost}};if(e.distinct!==void 0&&n.type==="one2many"&&Array.isArray(r)){let s=Mc(n,r,e.distinct);if(s!==null)return{say:"distinct",values:{column:n.fields[e.distinct]?.label??e.distinct,value:s}}}if(o!==null&&e.date!==void 0){let s=Pc(n,o,i);if(e.date==="past"&&s>=0)return{say:"datePast"};if(e.date==="future"&&s<=0)return{say:"dateFuture"}}}function Mc(e,t,n){let r=e.fields[n],i=new Set;for(let o of t){if(gt(e,o.values)!==null)continue;let a=o.values[n];if(a==null||a===""||Array.isArray(a)&&!a.length)continue;let s=typeof a=="object"&&!Array.isArray(a)&&"id"in a?a:null,d=JSON.stringify(s?s.id:a);if(!i.has(d)){i.add(d);continue}return s?s.label:r?.type==="selection"?r.options.find(l=>l.value===a)?.label??String(a):String(a)}return null}var Nc=e=>e==null||typeof e=="string"&&!e.trim()||Array.isArray(e)&&!e.length;function Cc({holds:e},t){if(!(!e||e.fields.some(n=>Nc(t.context[n]))))return e.evaluate(t.context,t.env)?void 0:{say:"holds"}}function Pc(e,t,n){if(e.type==="datetime")return Math.sign(Date.parse(t)-n.getTime());let r=hn(n);return t<r?-1:t>r?1:0}var Rs=new Map;function Oc(e){let t=Rs.get(e);return t||Rs.set(e,t=Bt(e)),t}function Lo(e,t){let n=e.trim();if(_n.test(n)&&n in t.fields)return Ae(t.values[n]);if(n==="user"&&!("user"in t.fields))return t.user?.id==null?null:{id:t.user.id,label:t.user.name??String(t.user.id)};let r=/^parent\.([A-Za-z_][A-Za-z0-9_]*)$/.exec(n);return r&&t.parent&&r[1]in t.parent.fields?Ae(t.parent.values[r[1]]):Oc(e).evaluate(t.context,t.env)}function Fs(e,t,n){if(e.type!=="many2one"&&e.type!=="many2many")return On(e,t);let r=i=>{if(i==null||i===!1||i==="")return null;if(typeof i=="number"||typeof i=="string")return{id:i,label:n.labelOf?.(e.relation,i)??String(i)};if(typeof i=="object"&&!Array.isArray(i)&&"id"in i){let o=i;return{id:o.id,label:typeof o.label=="string"?o.label:n.labelOf?.(e.relation,o.id)??String(o.id)}}return null};return e.type==="many2one"?r(Array.isArray(t)?t[0]:t):(Array.isArray(t)?t:[t]).map(r).filter(i=>i!==null)}function As(e,t,n){let r={};for(let[i,o]of Object.entries(e)){let a=t[i];a&&(r[i]=Fs(a,Lo(o,n),n))}return r}function Eo(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=Lo(i,t)??null;return n}function Ro(e,t){let n={};for(let[r,i]of Object.entries(e))i.defaultFrom!==void 0&&(n[r]=Fs(i,Lo(i.defaultFrom,t),t));return n}function $s(e){let t=Fo(e.tones),n=et(e.bold);return(r,i)=>({tone:Ao(t,r,i),bold:n.evaluate(r,i)})}var Fo=e=>(e??[]).map(t=>({tone:t.tone,when:et(t.when)})),Ao=(e,t,n)=>e.find(r=>r.when.evaluate(t,n))?.tone??null;function Ts(e){let t=new Map;for(let[s,d]of Object.entries(e.cells??{}))t.set(s,{invisible:et(d.invisible),readonly:et(d.readonly),required:et(d.required),hidden:et(d.hidden),...d.roles?.length?{roles:d.roles}:{},tones:Fo(d.tones),bold:et(d.bold)});let n=Fo(e.rowTones),r=et(e.rowBold),i=e.lineDelete===void 0?null:et(e.lineDelete),o=e.rowButtons??[],a=o.map(s=>({id:s.id,roles:s.roles,invisible:et(s.invisible)}));return{buttons:o,line(s,d,l){let f={tone:Ao(n,s,d),bold:r.evaluate(s,d),cells:{},buttons:{},deletable:i?.evaluate(s,d)??!0};for(let[c,y]of t)f.cells[c]={invisible:y.invisible.evaluate(s,d),readonly:y.readonly.evaluate(s,d),required:y.required.evaluate(s,d),tone:Ao(y.tones,s,d),bold:y.bold.evaluate(s,d)};for(let c of a)f.buttons[c.id]=Nn(c.roles,l)&&!c.invisible.evaluate(s,d);return f},hidden(s,d,l,f){let c=t.get(s);return!!c&&(!Nn(c.roles,f)||c.hidden.evaluate(d,l))}}}var fi=Object.freeze({done:!0}),$o=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),To=e=>e instanceof Error?e.message:String(e);function Ms(e){let t=new Map,n=new Map,r=x=>{let F=t.get(x);return F||t.set(x,F=Bt(x)),F};function i(x){if(typeof x=="boolean")return x;let F=n.get(x);F||n.set(x,F=et(x));let{context:E,env:w}=e.reading();return F.evaluate(E,w)}let o=x=>{let F=x.trim();return _n.test(F)?F:null};function a(x,F){let E=o(x);if(F&&E!==null&&E in e.fields)return Ae(e.values()[E]);let{context:w,env:A}=e.reading();return r(x).evaluate(w,A)}function s(x,F){let E=e.values();for(let[w,A]of Object.entries(e.fields)){if(A.type!=="many2one"&&A.type!=="many2many"||A.relation!==x)continue;let R=E[w],M=(Array.isArray(R)?R:R?[R]:[]).find(P=>P&&P.id===F);if(M)return M.label}}function d(x,F,E=()=>{}){let w=A=>{if(A==null||A===!1||A==="")return null;let R=x.relation,I=M=>E(M)??s(R,M)??String(M);if(typeof A=="number"||typeof A=="string")return{id:A,label:I(A)};if(typeof A=="object"&&!Array.isArray(A)&&"id"in A){let M=A;return{id:M.id,label:typeof M.label=="string"?M.label:I(M.id)}}return null};return x.type==="many2one"?w(F):x.type==="many2many"?(Array.isArray(F)?F:[F]).map(w).filter(A=>A!==null):On(x,F)}function l(x){let F=e.fields[x];if(!F)throw new Error(`The page has no field "${x}"`);return F}async function f(x){return e.host?e.host.ask(x):e.confirm?e.confirm(x):!0}function c(x){return{reason:"cannot",message:x}}async function y(x,F){let E=e.host;if(!E)return c(`Nothing can open "${x.page}" here: the form has no host`);let w=x.record!==void 0?a(x.record,!1):null,A={page:x.page,...x.version!==void 0?{version:x.version}:{},as:x.as??"dialog",...x.side&&x.as==="panel"?{side:x.side}:{},...x.title!==void 0?{title:x.title}:{},recordId:typeof w=="number"||typeof w=="string"&&w!==""?w:null,...x.values?{values:p(x.values)}:{},...x.filter?{filter:ai(x.filter,e.reading().context)}:{}},R;try{R=await E.open(A)}catch(M){return{reason:"cannot",message:To(M),error:M}}if(!R.saved)return{reason:"closed"};if(x.into&&e.write(k(x.into,R)),!x.then)return null;let I=await S(x.then,F);return I.done?null:{reason:I.reason,message:I.message,step:I.step,error:I.error}}function p(x){let F={};for(let[E,w]of Object.entries(x))F[E]=a(w,!0)??null;return F}function k(x,F){let E=F.values??{},w=F.recordId??null,A={...Vc(E),id:w},R=[F.label,E.display_name,E.name].find(P=>typeof P=="string"&&P!==""),I=P=>P===w?R:void 0,M={};for(let[P,H]of Object.entries(x)){let D=l(P),W=o(H),z=W==="id"?w:W!==null&&!$o.has(D.type)&&W in E?E[W]:r(H).evaluate(A,{today:e.today});M[P]=d(D,z,I)}return M}async function g(x,F){let E={id:F.id,action:x.action,...x.params?{params:Ae(x.params)}:{},recordId:e.recordId(),values:Ae(e.values()),...F.recordIds?{recordIds:[...F.recordIds]}:{},...F.line?{line:Ae(F.line)}:{},...F.lines?{lines:Ae(F.lines)}:{}};if(!e.onAction)return null;let w;try{w=await e.onAction(E)??void 0}catch(A){return{reason:"app",message:To(A),error:A}}if(e.answered(E,w),!w)return null;if(w.reload){let A=await e.reload();if(A)return A}if(w.values){let A={};for(let[R,I]of Object.entries(w.values))R in e.fields&&(A[R]=d(e.fields[R],I));e.write(A)}if(w.say!==void 0){let A=typeof w.say=="string"?{message:w.say}:w.say;e.host?.say(A.message,A.tone??"info")}if(w.post!==void 0){let A=typeof w.post=="string"?{message:w.post}:w.post,R=await m(A.message,A.kind??"note",!1);if(R)return R}if(w.record!==void 0){let A=await e.showRecord(w.record);if(A)return A}if(w.open){let A=await y(w.open,F);if(A)return A}return w.stop?(typeof w.stop=="string"&&e.host?.say(w.stop,"warning"),{reason:"app",...typeof w.stop=="string"?{message:w.stop}:{}}):null}async function m(x,F,E){let w=E?Un(x):[{text:x}],A=w.map(M=>M.field?e.wordsOf(M.field):M.text).join(""),R=w.map(M=>M.field&&e.fields[M.field]?.type==="html"?String(e.values()[M.field]??""):Ic(M.field?e.wordsOf(M.field):M.text)).join("");return await e.post({kind:F,text:A,body:`<p>${R}</p>`})?null:c("Nothing can post a message here: no conversation is beside this record")}async function b(x,F,E){return e.onAction?g({action:x},E):c(`Nothing can ${x} this record here: the data source has no ${F}, and the app takes no actions`)}async function h(x,F){let E=e.recordId();if(E==null)return c(`A new record cannot be ${x==="duplicate"?"duplicated":x==="delete"?"deleted":`${x}d`}: it is not saved yet`);if(x==="archive"||x==="unarchive")return e.archive?(await e.archive(x==="archive"),e.told({archived:x==="archive"},E),e.reload()):b(x,"archive",F);if(x==="duplicate"){if(e.changed()){let R=await e.save(F.chain);if(R)return R}if(!e.copy){let R=await b(x,"copy",F),I=e.recordId();return!R&&I!=null&&I!==E&&e.told({copied:I},E),R}let w=await e.copy(),A=await e.showRecord(w);return A||(e.told({copied:w},E),null)}if(!e.remove){let w=await b(x,"delete",F);return w||e.told({deleted:!0},E),w}return await e.remove(),e.told({deleted:!0},E),null}async function v(x,F){switch(x.do){case"set":{let E=l(x.field);return e.write({[x.field]:d(E,a(x.value,!$o.has(E.type)))}),null}case"clear":return e.write({[x.field]:Cn(l(x.field))}),null;case"addLine":{let E=l(x.field);if(E.type!=="one2many")return c(`"${x.field}" is a ${E.type}; a line is added to a one2many`);let w={};for(let[A,R]of Object.entries(x.values??{})){let I=E.fields[A];if(!I)return c(`The lines of "${x.field}" have no field "${A}"`);w[A]=d(I,a(R,!$o.has(I.type)))}return e.addLine(x.field,w),null}case"check":return e.check(x.fields);case"save":return e.save(F.chain);case"reset":return e.reset(),null;case"goTo":{let E=e.goTo(x.target,F.chain);if(E!==void 0)return E;let w=e.host?.show;return w?(e.showing(F.chain,()=>w.call(e.host,x.target)),null):c(`Nothing can show "${x.target}" here: the form has no host that shows tabs`)}case"say":return e.host?.say(x.message,x.tone??"info"),null;case"ask":return await f(x.message)?null:{reason:"no",message:x.message};case"call":return g(x,F);case"open":return y(x,F);case"close":{let E=e.host?.close;return E?(E.call(e.host),null):c("Nothing can close this form: it has no host, or was not opened in a dialog or panel")}case"reload":return e.reload();case"openUrl":{let E=e.host?.openUrl;if(!E)return c("Nothing can open a web address here: the form has no host that opens one");let w=a(x.url,!1);return typeof w!="string"||!w.trim()?c(`"${x.url}" gives no address to open`):(E.call(e.host,w.trim(),x.newTab??!0),null)}case"archive":case"unarchive":case"duplicate":case"delete":return h(x.do,F);case"post":return m(x.message,x.kind??"note",!0)}}async function S(x,F){for(let E=0;E<x.length;E++){let w=x[E],A;try{if(w.when!==void 0&&!i(w.when))continue;A=await v(w,F)}catch(R){A={reason:"cannot",message:To(R),error:R}}if(A)return{done:!1,stoppedAt:E,step:A.step??w,reason:A.reason,...A.message!==void 0?{message:A.message}:{},...A.error!==void 0?{error:A.error}:{}}}return fi}return{runSteps:S,ask:f}}function Vc(e){let t={},n=r=>{if(r===null||typeof r!="object")return r;let i=r;return"key"in i&&"values"in i?i.key:"model"in i&&"id"in i?`${i.model},${i.id}`:"id"in i?i.id:"name"in i&&"type"in i&&"size"in i?i.name:r};for(let[r,i]of Object.entries(e))t[r]=Array.isArray(i)?i.map(n):n(i);return t}function Ns(e){let t=new Map;return function(r,i,o,a){if(!i?.length||o.includes(r))return Promise.resolve(fi);let s=l=>{let f,c=new Promise(y=>f=y).finally(()=>{l.running===c&&!l.queued&&t.delete(r)});return l.running=c,f(e(r,i,[...o,r])),c},d=t.get(r);if(!d){let l={running:Promise.resolve(fi)};return t.set(r,l),s(l)}if(!a)return Promise.resolve(fi);if(!d.queued){let l=()=>(d.queued=void 0,s(d));d.queued=d.running.then(l,l)}return d.queued}}function Ic(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]).replace(/\n/g,"<br>")}function pi(e){return Os(e,[]).form}var Cs=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Mo=e=>e;function Os(e,t){let{page:n}=e,r=e.scheduler??Sr,i=e.messages??Tt.en,o=Bc(n.layout),a=new Map;for(let u of o.values()){let L=u.source.validate;u.kind==="field"&&L&&a.set(u.id,Ls(L))}let s=new Map;for(let u of o.values()){let L=u.source;u.kind!=="field"||n.fields[L.field]?.type!=="one2many"||(L.cells||L.rowTones||L.rowBold!==void 0||L.rowButtons||L.lineDelete!==void 0)&&s.set(u.id,{field:L.field,compiled:Ts(L)})}let d=new Map;for(let u of o.values()){let L=u.source;u.kind==="field"&&(L.tones||L.bold!==void 0)&&d.set(u.id,$s(L))}let l=new Map;for(let u of o.values()){let L=u.source;u.kind==="field"&&L.order?.length&&n.fields[L.field]?.type==="one2many"&&!l.has(L.field)&&l.set(L.field,L.order)}function f(u,L){let T=u;for(let[C,q]of l){if(L&&!L.includes(C))continue;let Z=u[C];if(!Array.isArray(Z)||Z.length<2)continue;let ee=[...Z].sort(($e,Fe)=>jc($e.values,Fe.values,q));ee.some(($e,Fe)=>$e!==Z[Fe])&&(T={...T,[C]:ee})}return T}let c=new Map,y=(u,L)=>{L.placeholderWhen?.length&&c.set(u,{fixed:L.placeholder,when:L.placeholderWhen.map(T=>({text:T.text,holds:et(T.when)}))})};for(let u of o.values())u.kind==="field"&&"type"in u.source&&y(u.id,u.source);n.layout.type==="sheet"&&n.layout.title&&y("#title",n.layout.title);let p=[...a.values()].some(u=>u.some(L=>L.rule.level==="warning")),k=n.layout.type==="wizard"?n.layout.children.map(u=>u.id):[],g=()=>`fieldia:draft:${n.id}:${$.recordId??"new"}`,m=()=>hn(e.now?.()??new Date),b=!1,h=e.editing!==!1,v=e.parent?qt(e.parent.values,e.parent.fields,{recordId:e.parent.id??null,user:e.user,context:e.context}):void 0,S=()=>({recordId:b?$.recordId:e.recordId??null,user:e.user,editing:h,context:e.context,parent:v}),x=ws(n,m,S),F=Ss(n,m,S),E=new Map;for(let u of o.values())u.kind==="form"&&E.set(u.id,u.source);let w=new Map,A={...n.fields};for(let u of E.values())A[u.name]={type:"json",label:u.title||u.name};let R=!1;function I(u=e.recordId==null,L=!0){let T=xn(A,m());if(u){let C={recordId:null,user:e.user,context:e.context,parent:v};Object.assign(T,Ro(n.fields,P(T,n.fields,qt(T,n.fields,C),Pn(T,n.fields,m))))}return L?f({...T,...Ae(e.values??{})}):T}function M(u,L){let T=b?$.values:{};for(let[C,q]of Object.entries(n.fields)){if(q.type!=="many2one"&&q.type!=="many2many"||q.relation!==u)continue;let Z=T[C],ee=(Array.isArray(Z)?Z:Z?[Z]:[]).find($e=>$e?.id===L);if(ee)return ee.label}}function P(u,L,T,C,q){return{values:u,fields:L,context:T,env:C,...q?{parent:q}:{},...e.user?{user:e.user}:{},labelOf:M}}function H(){let{context:u,env:L}=me();return P($.values,n.fields,u,L)}function D(u,L){let C=Re(u).fields;return P(L,C,kn(L,C,me().context),{today:m},{values:$.values,fields:n.fields})}function W(u){let L=s.get(u);if(L)return L;let T=o.get(u);if(T?.kind!=="field"||n.fields[T.field]?.type!=="one2many")throw new Error(`"${u}" is not a table of lines`);return null}function z(u,L){let T=W(u);if(!T)return{tone:null,bold:!1,cells:{},buttons:{},deletable:!0};let C=($.values[T.field]??[]).find(Z=>Z.key===L);if(!C)throw new Error(`"${T.field}" has no line "${L}"`);let q=Re(T.field);return T.compiled.line(kn(C.values,q.fields,me().context,C.id??null),{today:m},ke)}function j(u,L){if(!L){let q=be(u);return q.type==="many2one"||q.type==="many2many"?q.createValues?Eo(q.createValues,H()):{}:{}}let T=($.values[L.lines]??[]).find(q=>q.key===L.key),C=Re(L.lines).fields[u];return!T||!C||C.type!=="many2one"&&C.type!=="many2many"||!C.createValues?{}:Eo(C.createValues,D(L.lines,T.values))}let V=x.apply(I()),B=F.holding(V),$={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:Ae(V),errors:{},dirty:[],warnings:{},warning:null,warningField:null,error:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null,choices:{},definitions:{}};b=!0;let Q={},X=0,J=0,_=null,te=null,Ve=new Set,Ie=new Set,Ee=new Map,Me=[],ie=!1,ge=null,oe=null,ke=[...e.user?.roles??[]],De={};function xe(u){let L=$.values,T=$.errors;if($={...$,...u},$.errors!==T)for(let C of w.values())C.inner.show(Dc($.errors,C.name));for(let C of[...Ie])C($);if($.values!==L){for(let C in $.choices)U(C).dependsOn?.some(q=>L[q]!==$.values[q])&&re(C);for(let C in $.definitions)Ce(C).dependsOn?.some(q=>L[q]!==$.values[q])&&ae(C)}ie&&$.step!==ge&&ne(Me)}function Xe(u,L){let T=Ee.get(u);if(T)for(let C of[...T])C(L)}function Y(u,L){Xe("change",{field:u,value:$.values[u],values:$.values,by:L});let T=n.on?.change?.[u];L==="person"&&T&&ce(we(`on.change.${u}`,T,[],!0))}function ne(u){let L=$.step;if(L===ge||L===null)return;ge=L,Xe("step",{step:L});let T=n.on?.show?.[L];T&&ce(we(`on.show.${L}`,T,u,!0))}function fe(u,L){let T=Me;Me=u;try{L()}finally{Me=T}}let U=u=>n.fields[u].optionsFrom;function re(u){let{list:L}=U(u),T=De[u]=(De[u]??0)+1,C=ee=>T===De[u]&&xe({choices:{...$.choices,[u]:ee}}),q=$.choices[u]?.options??null;C({options:q,loading:!0});let Z=e.dataSource;ce((Z?.options?Z.options({list:L,values:Ae($.values)}):Promise.reject(new Error(`No list "${L}"`))).then(ee=>C({options:ee}),ee=>C({options:q,error:ee.message??String(ee)})))}let Ce=u=>n.fields[u].definitionsFrom,Pe={};function ae(u){let{list:L}=Ce(u),T=Pe[u]=(Pe[u]??0)+1,C=ee=>T===Pe[u]&&xe({definitions:{...$.definitions,[u]:ee}}),q=$.definitions[u]?.definitions??null;C({definitions:q,loading:!0});let Z=e.dataSource;ce((Z?.definitions?Z.definitions({list:L,values:Ae($.values)}):Promise.reject(new Error(`No definitions "${L}"`))).then(ee=>C({definitions:ee}),ee=>C({definitions:q,error:ee.message??String(ee)})))}async function le(u,L){let{list:T}=Ce(u),C=[...$.definitions[u]?.definitions??[],L];xe({definitions:{...$.definitions,[u]:{definitions:C}}}),await ce(e.dataSource?.saveDefinitions?.({list:T,values:Ae($.values),definitions:C})??Promise.resolve())}function se(u){let L=n.fields[u],T=$.choices[u]?.options;return L.type==="selection"&&L.optionsFrom&&T?{...L,options:T,optionsFrom:void 0}:L}function ce(u){Ve.add(u);let L=()=>Ve.delete(u);return u.then(L,L),u}function me(){if(oe?.values!==$.values||oe.recordId!==$.recordId||oe.editing!==h){let u=$.values,L=qt(u,n.fields,S());oe={values:u,recordId:$.recordId,editing:h,context:L,env:Pn(u,n.fields,m)}}return oe}let he=()=>me().context;function be(u){let L=A[u];if(!L)throw new Error(`The page has no field "${u}"`);return L}function rt(u){return Object.keys(A).filter(L=>JSON.stringify(u[L]??null)!==JSON.stringify(V[L]??null))}function ht(u){let L=o.get(u);if(!L)throw new Error(`The page has no element "${u}"`);let{context:T,env:C}=me(),q=Fe=>Fe?!Nn(Fe.roles,ke)||Fe.invisible.evaluate(T,C):!1,Z=q(L);for(let Fe=L.parent;!Z&&Fe;Fe=o.get(Fe)?.parent??null)Z=q(o.get(Fe));let ee=L.readonly.evaluate(T,C);for(let Fe=L.parent;!ee&&Fe;Fe=o.get(Fe)?.parent??null)ee=o.get(Fe)?.readonly.evaluate(T,C)??!1;let $e=L.field?n.fields[L.field]:void 0;return{invisible:Z,readonly:ee||$e!==void 0&&Ps($e),required:L.required.evaluate(T,C)||$e?.required===!0}}function St(u,L="field"){let T=q=>{if(!u)return!0;for(let Z=q.id;Z;Z=o.get(Z)?.parent??null)if(Z===u)return!0;return!1},C=q=>{if(u||!$.skipped.length)return!1;for(let Z=q.id;Z;Z=o.get(Z)?.parent??null)if($.skipped.includes(Z))return!0;return!1};return[...o.values()].filter(q=>q.kind===L&&T(q)&&!C(q)&&!ht(q.id).invisible)}function Zt(u){let L=a.get(u.id);if(!L)return{};let T=u.field,C=n.fields[T],q=u.source.label??C.label,{context:Z,env:ee}=me();return Es(C,q,$.values[T],L,{context:Z,env:ee,now:e.now?.()??new Date,messages:i})}function ar(u){let L=u.field;return u.source.widget==="tick"&&n.fields[L].type==="boolean"&&$.values[L]!==!0&&ht(u.id).required?i.tick:void 0}function jr(u){let L=u.field;return ar(u)??So(n.fields[L],u.source,$.values[L],i)??wn(se(L),$.values[L],ht(u.id).required,i,m())??Zt(u).error}function Qt(){var L;let u={};if(!p)return u;for(let T of St()){let C=a.has(T.id)?Zt(T).warning:void 0;C&&(u[L=T.field]??(u[L]=C))}return u}function _t(u,L){let T=$;$={...$,values:u};try{return L()}finally{$=T}}function jt(u){let L={};for(let T of St(u)){let C=T.field;if(L[C])continue;let q=n.fields[C],Z=jr(T);if(Z&&(L[C]=Z),q.type==="one2many")for(let ee of $.values[C]??[]){let $e=gt(q,ee.values),Fe=s.has(T.id)?z(T.id,ee.key).cells:{};for(let[O,G]of Object.entries(q.fields)){if($e&&O!==q.lineKinds?.text)continue;let de=Fe[O];if(de?.invisible||s.has(T.id)&&s.get(T.id).compiled.hidden(O,me().context,me().env,ke))continue;let pe=wn(G,ee.values[O],G.required===!0||de?.required===!0,i,m());pe&&(L[`${C}.${ee.key}.${O}`]=pe)}}}for(let T of St(u,"form")){let C=w.get(T.id);if(C)for(let[q,Z]of Object.entries(C.inner.errorsNow()))L[`${C.name}.${q}`]=Z}return L}function fn(u,L){let T=u;for(let C of w.values())if(!(L!=="start"&&T[C.name]===C.inner.form.getState().values)){R=!0;try{C.inner.take(Cs(T[C.name])?T[C.name]:{},L)}finally{R=!1}T={...T,[C.name]:Mo(C.inner.form.getState().values)}}return T}function eo(u){let L=x.apply(u);for(let T=0;T<8;T++){let C=F.apply(L,B);if(B=C.holding,C.values===L)break;L=x.apply(C.values)}return L}function un(u){let L=x.apply(u);return B=F.holding(L),L}function Lt(u,L={},T=!1){let C=fn(T?un(u):eo(u),T?"fresh":"edit"),q=Object.keys($.errors).length?Et(C):$.errors,Z={};for(let ee of Object.keys(u)){let $e=n.fields[ee];if(!(u[ee]===$.values[ee]||!$e)&&(ui($e,u[ee])&&(Z[ee]=wn($e,u[ee],!1,i)),$e.type==="one2many"))for(let Fe of u[ee]??[])for(let[O,G]of Object.entries(Fe.values))ui($e.fields[O],G)&&(Z[`${ee}.${Fe.key}.${O}`]=wn($e.fields[O],G,!1,i))}Object.keys(Z).length&&(q={...q,...Z}),xe({values:C,dirty:rt(C),errors:q,warnings:_t(C,Qt),...L})}function Et(u){let L=_t(u,()=>jt($.step??void 0)),T={};for(let C of Object.keys($.errors))L[C]&&(T[C]=L[C]);for(let[C,q]of Object.entries(Q))JSON.stringify(u[C]??null)===q.value?T[C]??(T[C]=q.message):delete Q[C];return T}function pn(){let u=e.drafts;u&&(_!==null&&r.clearTimeout(_),_=r.setTimeout(()=>{_=null,u.store.setItem(g(),JSON.stringify({savedAt:new Date().toISOString(),values:$.values}))},u.delayMs??400))}function Rn(){_!==null&&r.clearTimeout(_),_=null,e.drafts?.store.removeItem(g())}function zn(){let u=e.drafts;if(!u)return;let L=u.store.getItem(g());if(!L)return;let T;try{T=JSON.parse(L)}catch{u.store.removeItem(g());return}u.restore==="auto"?Lt({...$.values,...T.values},{draft:null},!0):xe({draft:{savedAt:T.savedAt}})}function to(){let u=e.autosave;!u||n.data.kind!=="record"||(te!==null&&r.clearTimeout(te),te=r.setTimeout(()=>{te=null,$.dirty.length&&Object.keys(jt()).length===0&&ce(lr())},u.delayMs))}function no(u){let L=e.dataSource;if(!L?.onchange||n.data.kind!=="record"||_c(n.fields[u],$.values[u]))return;let T=++J,C={model:n.data.model,id:$.recordId,changed:u,values:Ae($.values)};ce(L.onchange(C).then(q=>{if(T!==J)return;let Z={...$.values,...q.values??{}};Lt(Z,{warning:q.warning??null,warningField:q.warning?u:null})},()=>{}))}function Ut(u){pn(),to(),no(u)}function sr(){let u={values:{},lines:{},links:{}},L=$.recordId===null||$.recordId===void 0,T=L?Object.keys(A).filter(C=>$.dirty.includes(C)||!Kt(A[C],$.values[C])):$.dirty;for(let C of T){let q=A[C],Z=$.values[C],ee=L?Cn(q):V[C];q.type==="one2many"?u.lines[C]=Hc(ee??[],Z??[]):q.type==="many2many"?u.links[C]=zc(ee??[],Z??[]):u.values[C]=Ae(Z)}return u}function dr(){let u={};for(let L of St()){let T=L.field;u[T]=Ae($.values[T])}for(let L of St(void 0,"form")){let T=w.get(L.id);T&&(u[T.name]=Ae($.values[T.name]))}return u}async function lr(u=[]){return await cr(u)===null}async function cr(u){if(n.on?.beforeSave){let C=await we("on.beforeSave",n.on.beforeSave,u,!1);if(!C.done){if(C.reason!=="check"&&C.reason!=="save"){let q={kind:"stopped",reason:C.reason,message:C.message??""};xe({status:"error",error:q.message||null,saveProblem:q})}return{reason:"save",...C.message!==void 0?{message:C.message}:{}}}}let L=jt();if(Object.keys(L).length)return xe({errors:L}),{reason:"save",message:Object.values(L)[0]};let T=e.dataSource;Q={},xe({status:"saving",errors:{},error:null,saveProblem:null});try{if(n.data.kind==="responses"){if(!T?.submit)throw new Error("This page has no data source to send its answers to");let Z=dr();return await T.submit({pageId:n.id,values:Z}),Rn(),xe({status:"saved"}),Xe("send",{values:Z}),ce(we("on.afterSave",n.on?.afterSave,u,!1)),null}if(!T?.save)throw new Error("This page has no data source to save to");let C=await T.save({model:n.data.model,id:$.recordId,fields:A,changes:sr(),values:Ae($.values)});Rn();let q=fn(un(C.values?f({...$.values,...C.values},Object.keys(C.values)):$.values),"start");return V=Ae(q),xe({status:"saved",recordId:C.id,values:q,dirty:[],warnings:_t(q,Qt)}),Xe("save",{recordId:$.recordId,values:$.values}),ce(we("on.afterSave",n.on?.afterSave,u,!1)),null}catch(C){let q=oi(C),Z=q.kind==="fields"?q.fields??{}:{};return Q=Object.fromEntries(Object.entries(Z).map(([ee,$e])=>[ee,{message:$e,value:JSON.stringify($.values[ee]??null)}])),xe({status:"error",error:q.message,saveProblem:q,errors:{...Z}}),{reason:"save",message:q.message}}}async function en(){Xe("open",{recordId:$.recordId,values:$.values}),await we("on.open",n.on?.open,[],!0),ie=!0,ne([])}function Hr(u,L){let T=Object.keys(u);if(T.forEach(be),!!T.length){Lt({...$.values,...Ae(u)});for(let C of T)Ut(C);for(let C of T)Y(C,L)}}function fr(u,L,T){let C=Re(u),q=$.values[u]??[],Z=`new-${++X}`;for(;q.some(G=>G.key===Z);)Z=`new-${++X}`;let ee=C.fields,$e=xn(ee,m());Object.assign($e,Ro(ee,D(u,$e))),C.lineDefaults&&Object.assign($e,As(C.lineDefaults,ee,H()));let Fe={key:Z,values:{...$e,...Ae(L)}};if(C.sequenceField&&Fe.values[C.sequenceField]==null){let G=q.map(de=>de.values[C.sequenceField]).filter(de=>typeof de=="number");Fe.values[C.sequenceField]=G.length?Math.max(...G)+1:1}let O=[...q,Fe];return Lt({...$.values,[u]:O}),Ut(u),Y(u,T),Z}function zr(u){u?.forEach(be);let L=jt(),T=u?Object.fromEntries(Object.entries(L).filter(([q])=>u.some(Z=>q===Z||q.startsWith(`${Z}.`)))):L;xe({errors:T});let C=Object.values(T)[0];return C===void 0?null:{reason:"check",message:C}}function N(u,L){if(!k.includes(u))return;if(!ve.steps().includes(u))return{reason:"cannot",message:`The step "${u}" does not apply now`};let T=!1;return fe(L,()=>T=ve.goTo(u)),T?null:{reason:"check",message:Object.values($.errors)[0]}}async function K(u,L){let T=await st.runSteps(u,L);return Xe("run",{id:L.id,steps:u,result:T}),T}function ue(u){return!e.dataSource?.create||!u||u.readonly?null:u.type==="many2one"||u.type==="many2many"?u.relation:null}async function Se(u,L,T,C={}){let q=ue(u),Z=e.dataSource;if(!q||!Z?.create)throw new Error(`"${L}" cannot make records: its data source has no create, or it is not a link`);return ce(Z.create({model:q,name:T.trim(),...Object.keys(C).length?{values:C}:{}}))}async function Ne(u,L,T,C,q,Z,ee){if(u.type!=="many2one"&&u.type!=="many2many"&&u.type!=="reference"&&u.type!=="json")throw new Error(`"${L}" is not a many2one, many2many, reference or json`);if((u.type==="reference"||u.type==="json")&&!Z)throw new Error(`Searching "${L}" needs a model`);let $e=e.dataSource;if(!$e?.search)return[];let Fe=u.type==="reference"||u.type==="json"||!u.filter?void 0:ai(u.filter,T),O=ee?[...Fe??[],{field:"id",op:"in",value:ee}]:Fe,G=u.type==="reference"||u.type==="json"?Z:u.relation;return ce($e.search({model:G,query:C,...O?{filter:O}:{},limit:q}))}function Re(u){let L=be(u);if(L.type!=="one2many")throw new Error(`"${u}" is a ${L.type}, not a one2many`);return L}function bt(){return $.step?k.indexOf($.step):-1}function lt(u){return o.get(u)?.source?.optional===!0}async function vt(u=!1){let L=e.dataSource;if($.recordId==null||n.data.kind!=="record")return;if(!L?.load){xe({status:"error",error:"This page has no data source to load from"});return}let T=++dt;xe({status:"loading",error:null});try{let C=await L.load({model:n.data.model,id:$.recordId,fields:A});if(T!==dt||(V=fn(un(f({...xn(A,m()),...C})),"start"),xe({status:"ready",values:Ae(V),dirty:[],errors:{},warnings:_t(V,Qt)}),u))return;zn(),ce(en())}catch(C){T===dt&&xe({status:"error",error:C.message})}}let dt=0;async function Qe(u){_!==null&&r.clearTimeout(_),te!==null&&r.clearTimeout(te),_=te=null,Q={},ge=null,ie=!1;let L={dirty:[],errors:{},warning:null,warningField:null,error:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null};if(u!=null)return xe({...L,recordId:u,status:"idle"}),vt();dt++,V=un(I(!0,!1));let T=fn(Ae(V),"start");xe({...L,recordId:null,status:"ready",values:T,warnings:_t(T,Qt)}),zn(),await en()}let ct=()=>({model:n.data.model,id:$.recordId,fields:A});async function Be(u){if(e.host?.post)try{return await e.host.post(u)!==!1}catch{return!1}return Ee.get("post")?.size?(Xe("post",{recordId:$.recordId,message:u}),!0):!1}let st=Ms({fields:A,values:()=>$.values,recordId:()=>$.recordId,reading:me,today:m,write:u=>Hr(u,"step"),addLine:(u,L)=>{fr(u,L,"step")},check:zr,save:cr,async reload(){return $.recordId==null?{reason:"cannot",message:"The record is not saved yet: there is nothing to load again"}:(await vt(!0),$.status==="error"?{reason:"cannot",message:$.error??"The record could not be loaded again"}:null)},reset:()=>ve.reset(),goTo:N,showing:fe,host:e.host,confirm:e.confirm,onAction:e.onAction,answered:(u,L)=>Xe("action",{request:u,result:L}),changed:()=>$.dirty.length>0,...e.dataSource?.archive&&n.data.kind==="record"?{archive:u=>ce((e.dataSource?.archive)({...ct(),archive:u}))}:{},...e.dataSource?.copy&&n.data.kind==="record"?{copy:async()=>(await ce((e.dataSource?.copy)(ct()))).id}:{},...e.dataSource?.delete&&n.data.kind==="record"?{remove:()=>ce((e.dataSource?.delete)(ct()))}:{},async showRecord(u){return await Qe(u),$.status==="error"?{reason:"cannot",message:$.error??"The record could not be loaded"}:null},told(u,L){"archived"in u?Xe("archive",{recordId:L,archived:u.archived}):"copied"in u?Xe("duplicate",{from:L,recordId:u.copied}):(Xe("delete",{recordId:L}),$.recordId===L&&ce(Qe(null)))},post:Be,wordsOf:u=>qc(be(u),$.values[u])}),we=Ns((u,L,T)=>K(L,{id:u,chain:T}));function Ue(u,L){let T=[...u.steps??[]];u.action!==void 0&&T.push({do:"call",action:u.action,..."params"in u&&u.params?{params:u.params}:{}});let C="builtin"in u&&!T.length?u.builtin:void 0;C&&T.push({do:C});let q=C==="archive"?i.archiveConfirm:C==="delete"?i.deleteConfirm:void 0,Z="confirm"in u&&u.confirm!==void 0?u.confirm:q;return ce((async()=>{if(Z&&!await st.ask(Z)){let ee={done:!1,reason:"no",message:Z};return Xe("run",{id:L.id,steps:T,result:ee}),ee}return K(T,L)})())}let ve={page:n,getState:()=>$,subscribe(u){return Ie.add(u),()=>Ie.delete(u)},load:()=>ce(vt()),setValue(u,L,T){be(u),Lt({...$.values,[u]:Ae(L)}),Ut(u),Y(u,T?.by??"person")},setValues:u=>Hr(u,"app"),node:ht,openRecord:u=>ce(Qe(u)),post:Be,setEditing(u){u!==h&&(h=u,xe({}))},fieldReadonly:u=>Ps(be(u)),loadChoices:re,loadDefinitions:ae,addDefinition:le,problem(u){be(u);let L=St().filter(C=>C.field===u);return L.length?L.map(ar).find(Boolean)??L.map(C=>So(n.fields[u],C.source,$.values[u],i)).find(Boolean)??wn(se(u),$.values[u],L.some(C=>ht(C.id).required),i,m())??L.map(C=>Zt(C).error).find(C=>C!==void 0)??null:null},validate(){let u=jt();return xe({errors:u}),Object.keys(u).length===0},save:()=>ce(lr()),reset(){Rn(),Q={},B=F.holding(V);let u=fn(Ae(V),"start");xe({values:u,dirty:[],errors:{},warnings:_t(u,Qt),warning:null,warningField:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null})},changes:sr,addLine:(u,L={})=>fr(u,L,"person"),updateLine(u,L,T,C){if(!Re(u).fields[T])throw new Error(`The lines of "${u}" have no field "${T}"`);let Z=($.values[u]??[]).map(ee=>ee.key===L?{...ee,values:{...ee.values,[T]:Ae(C)}}:ee);Lt({...$.values,[u]:Z}),Ut(u),Y(u,"person")},moveLine(u,L,T){let q=Re(u).sequenceField;if(!q)throw new Error(`The lines of "${u}" keep no order: give the field a sequenceField`);let Z=[...$.values[u]??[]],ee=Z.findIndex(Le=>Le.key===L);if(ee<0)throw new Error(`"${u}" has no line "${L}"`);let $e=Math.max(0,Math.min(T,Z.length-1));if($e===ee)return;let Fe=Z.map(Le=>Le.values[q]),O=Fe.every((Le,ye)=>typeof Le=="number"&&(ye===0||Le>Fe[ye-1]));Z.splice($e,0,...Z.splice(ee,1));let G=Math.min(ee,$e),de=Math.max(ee,$e),pe=O?Fe.slice(G,de+1):[],Oe=Z.map((Le,ye)=>{let je=O?ye>=G&&ye<=de?pe[ye-G]:Le.values[q]:ye+1;return je===Le.values[q]?Le:{...Le,values:{...Le.values,[q]:je}}});Lt({...$.values,[u]:Oe}),Ut(u),Y(u,"person")},removeLine(u,L){Re(u);for(let[C,q]of s)if(!(q.field!==u||(o.get(C)?.source).lineDelete===void 0)&&($.values[u]??[]).some(Z=>Z.key===L)&&!z(C,L).deletable)throw new Error(`The line "${L}" of "${u}" cannot be deleted now: its table's lineDelete does not hold on it`);let T=($.values[u]??[]).filter(C=>C.key!==L);Lt({...$.values,[u]:T}),Ut(u),Y(u,"person")},async search(u,L,T=8,C={}){return Ne(be(u),u,he(),L,T,C.model,C.ids)},async previewLine(u,L,T){Re(u);let C=$.values[u]??[],q=C.find(G=>G.key===L);if(!q)throw new Error(`"${u}" has no line "${L}"`);let Z=x.line(u,{...q.values,...T},$.values),ee=e.dataSource;if(!ee?.onchange||n.data.kind!=="record")return Z;let $e=C.map(G=>G.key===L?{...G,values:Z}:G),O=((await ee.onchange({model:n.data.model,id:$.recordId,changed:u,values:Ae({...$.values,[u]:$e})})).values?.[u]??[]).find(G=>G.key===L);return O?x.line(u,{...Z,...O.values},$.values):Z},async searchLine(u,L,T,C,q=8,Z={}){let ee=Re(u),$e=ee.fields[T];if(!$e)throw new Error(`The lines of "${u}" have no field "${T}"`);let Fe=($.values[u]??[]).find(O=>O.key===L);if(!Fe)throw new Error(`"${u}" has no line "${L}"`);return Ne($e,T,kn(Fe.values,ee.fields,he(),Fe.id??null),C,q,Z.model,Z.ids)},canCreate:u=>ue(n.fields[u])!==null,quickCreate:(u,L)=>Se(n.fields[u],u,L,n.fields[u]?j(u):{}),canCreateLine:(u,L)=>ue(Re(u).fields[L])!==null,quickCreateLine:(u,L,T,C)=>Se(Re(u).fields[L],L,T,C?j(L,{lines:u,key:C}):{}),createValues:(u,L)=>j(u,L),steps:()=>k.filter(u=>!ht(u).invisible),next(){if(!$.step)return!1;$.skipped.includes($.step)&&xe({skipped:$.skipped.filter(C=>C!==$.step)});let u=jt($.step);if(Object.keys(u).length)return xe({errors:u}),!1;let L=ve.steps(),T=k.slice(bt()+1).find(C=>L.includes(C));return T?(xe({step:T,errors:{}}),!0):!1},back(){if(!$.step)return!1;let u=ve.steps(),L=k.slice(0,bt()).reverse().find(T=>u.includes(T));return L?(xe({step:L,errors:{}}),!0):!1},skip(){let u=$.step;if(!u||!lt(u))return!1;let L=ve.steps(),T=L[L.indexOf(u)+1];return T?(xe({step:T,errors:{},skipped:[...$.skipped.filter(C=>C!==u),u]}),!0):!1},goTo(u){let L=ve.steps(),T=L.indexOf(u),C=$.step?L.indexOf($.step):-1;if(T===-1||C===-1)return!1;if(T<=C)return xe({step:u,errors:{}}),!0;let q=[...$.skipped];for(let Z of L.slice(C,T)){if(q.includes(Z))continue;let ee=jt(Z);if(Object.keys(ee).length){if(lt(Z)){q.push(Z);continue}return xe({step:Z,errors:ee,skipped:q}),!1}}return xe({step:u,errors:{},skipped:q}),!0},async runAction(u,L){let T=o.get(u);if(!T||T.kind!=="button"&&T.kind!=="stat")throw new Error(`The page has no button "${u}"`);return ht(u).invisible?{done:!1,reason:"cannot",message:`The button "${u}" is hidden`}:T.parent&&o.get(T.parent)?.source?.selectedButtons?.some(C=>C.id===u)?{done:!1,reason:"cannot",message:`The button "${u}" runs with the lines chosen in its table`}:Ue(T.source,{id:u,chain:[],...L?{recordIds:[...L.recordIds]}:{}})},async linkedValues(u,L,T){let C=be(u);if(C.type!=="many2many")throw new Error(`"${u}" is not a many2many`);let q=e.dataSource;if(!q?.list||!L.length)return[];let Z=await q.list({model:C.relation,fields:[...T],filter:[{field:"id",op:"in",value:[...L]}],sort:[],offset:0,limit:L.length}),ee=new Map(Z.records.map($e=>[String($e.id),$e]));return L.flatMap($e=>{let Fe=ee.get(String($e));return Fe?[{id:Fe.id,values:Fe.values}]:[]})},fieldTone(u){let L=d.get(u);if(L){let{context:T,env:C}=me();return L(T,C)}if(o.get(u)?.kind!=="field")throw new Error(`"${u}" is not a field on this page`);return{tone:null,bold:!1}},placeholder(u){let L=c.get(u);if(!L){let q=o.get(u);if(q?.kind!=="field")throw new Error(`"${u}" is not a field on this page`);let Z=q.source;return u==="#title"&&n.layout.type==="sheet"?n.layout.title?.placeholder:Z.placeholder}let{context:T,env:C}=me();return L.when.find(q=>q.holds.evaluate(T,C))?.text??L.fixed},lineState:(u,L)=>z(u,L),columnHidden(u,L){let T=W(u),{context:C,env:q}=me();return T?T.compiled.hidden(L,C,q,ke):!1},async runRowAction(u,L,T){let C=W(u),q=C?.compiled.buttons.find(ee=>ee.id===L);if(!C||!q)throw new Error(`The table "${u}" has no button "${L}"`);if(!z(u,T).buttons[L])return{done:!1,reason:"cannot",message:`The button "${L}" is hidden on this line`};let Z=($.values[C.field]??[]).find(ee=>ee.key===T);return Ue(q,{id:L,chain:[],line:{field:C.field,key:T,values:Ae(Z.values)}})},async runLinesAction(u,L,T){let C=o.get(u),q=C?.source,Z=q?.selectedButtons?.find(G=>G.id===L);if(!C||!q||!Z)throw new Error(`The table "${u}" has no button "${L}" for its chosen lines`);let ee=$.values[q.field]??[],$e=T.map(G=>ee.find(de=>de.key===G)??null),Fe=T.find((G,de)=>!$e[de]);if(Fe!==void 0)throw new Error(`"${q.field}" has no line "${Fe}"`);if(ht(L).invisible)return{done:!1,reason:"cannot",message:`The button "${L}" is hidden`};if(!T.length)return{done:!1,reason:"cannot",message:`The button "${L}" runs with lines chosen: none is`};let O=$e;return Ue(Z,{id:L,chain:[],lines:{field:q.field,keys:[...T],ids:O.flatMap(G=>G.id===void 0?[]:[G.id]),values:O.map(G=>Ae(G.values))}})},run:(u,L={})=>ce(K(u,{id:L.id??"run",chain:[],...L.recordIds?{recordIds:[...L.recordIds]}:{}})),shown(u){k.includes(u)||ce(we(`on.show.${u}`,n.on?.show?.[u],Me,!0))},on(u,L){let T=Ee.get(u);return T||Ee.set(u,T=new Set),T.add(L),()=>{T.delete(L)}},restoreDraft(){let u=e.drafts?.store.getItem(g());if(!u)return;let L=JSON.parse(u);Lt({...$.values,...L.values},{draft:null},!0)},discardDraft(){Rn(),xe({draft:null})},async settled(){for(;Ve.size;)await Promise.allSettled([...Ve])},embed(u,L){let T=w.get(u);if(T)return T.inner.form;let C=E.get(u);if(!C)throw new Error(`"${u}" is not a saved form placed on this page`);let q=[...t,n.id];if(q.includes(L.id))throw new Error(`a page cannot be placed inside itself: ${[...q.slice(q.indexOf(L.id)),L.id].join(" \u2192 ")}`);let Z=$.values[C.name],ee=Os({page:{...L,data:{kind:"responses"}},dataSource:e.dataSource,values:Cs(Z)?Z:{},onAction:e.onAction,host:e.host,confirm:e.confirm,scheduler:r,messages:i,now:e.now},q);w.set(u,{name:C.name,inner:ee}),ee.form.on("change",({by:O})=>{R||Y(C.name,O)}),ee.form.subscribe(O=>{R||O.values===$.values[C.name]||(Lt({...$.values,[C.name]:Mo(O.values)}),Ut(C.name))});let $e=Mo(ee.form.getState().values);$.dirty.includes(C.name)||(V={...V,[C.name]:$e});let Fe={...$.values,[C.name]:$e};return xe({values:Fe,dirty:rt(Fe)}),ee.form},embedded:u=>w.get(u)?.inner.form??null,dispose(){_!==null&&r.clearTimeout(_),te!==null&&r.clearTimeout(te),Ie.clear(),Ee.clear();for(let u of w.values())u.inner.form.dispose()}};return $={...$,warnings:Qt()},$.recordId==null&&zn(),$.recordId==null&&ce(Promise.resolve().then(en)),{form:ve,take(u,L){if(L!=="start")return Lt({...xn(n.fields,m()),...u},{},L==="fresh");V=un({...xn(n.fields,m()),...Ae(u)});let T=fn(Ae(V),"start");xe({values:T,dirty:[],errors:{},warnings:_t(T,Qt),warning:null,warningField:null})},errorsNow:()=>jt(),show(u){JSON.stringify(u)!==JSON.stringify($.errors)&&xe({errors:u})}}}function Dc(e,t){let n={};for(let[r,i]of Object.entries(e))r.startsWith(`${t}.`)&&(n[r.slice(t.length+1)]=i);return n}function Wc(e,t){let n=a=>a==null||a===!1||a==="";if(n(e)||n(t))return n(e)===n(t)?0:n(e)?-1:1;let r=a=>a!==null&&typeof a=="object"&&!Array.isArray(a)&&"label"in a?String(a.label):a,i=r(e),o=r(t);return typeof i=="number"&&typeof o=="number"?i-o:typeof i=="boolean"&&typeof o=="boolean"?Number(i)-Number(o):String(i).localeCompare(String(o))}function jc(e,t,n){for(let r of n){let i=Wc(e[r.field],t[r.field]);if(i)return r.desc?-i:i}return 0}function Ps(e){return e.readonly===!0||e.compute!==void 0}function Hc(e,t){let n=[],r=new Map(e.filter(o=>o.id!==void 0).map(o=>[o.key,o]));for(let o of t){let a=r.get(o.key);if(o.id===void 0||!a){n.push({op:"create",key:o.key,values:Ae(o.values)});continue}let s={};for(let[d,l]of Object.entries(o.values))JSON.stringify(l)!==JSON.stringify(a.values[d])&&(s[d]=Ae(l));Object.keys(s).length&&n.push({op:"update",id:o.id,values:s})}let i=new Set(t.map(o=>o.key));for(let o of e)o.id!==void 0&&!i.has(o.key)&&n.push({op:"delete",id:o.id});return n}function zc(e,t){let n=new Set(e.map(i=>i.id)),r=new Set(t.map(i=>i.id));return[...t.filter(i=>!n.has(i.id)).map(i=>({op:"link",id:i.id})),...e.filter(i=>!r.has(i.id)).map(i=>({op:"unlink",id:i.id}))]}function Bc(e){let t=new Map,n=(i,o,a,s)=>{let d=i.roles;t.set(i.id,{id:i.id,parent:o,kind:a,field:s.field,...d?.length?{roles:d}:{},invisible:et(s.invisible),readonly:et(s.readonly),required:et(s.required),source:i})},r=(i,o)=>{for(let a of i)if(a.type==="field"){n(a,o,"field",{invisible:a.invisible,readonly:a.readonly,required:a.required,field:a.field});for(let s of[...a.selectedButtons??[],...a.controlButtons??[]])n(s,a.id,"button",{invisible:s.invisible})}else if(a.type==="button")n(a,o,"button",{invisible:a.invisible});else if(a.type==="tabs"){n(a,o,"other",{invisible:a.invisible});for(let s of a.children)n(s,a.id,"other",{invisible:s.invisible}),r(s.children,s.id)}else a.type==="section"?(n(a,o,"other",{invisible:a.invisible,readonly:a.readonly}),r(a.children,a.id)):a.type==="form"?n(a,o,"form",{invisible:a.invisible,readonly:a.readonly}):n(a,o,"other",{invisible:a.invisible})};if(e.type==="tabs")return r([e],""),t.get(e.id).parent=null,t;if(n(e,null,"other",{}),e.type==="wizard")for(let i of e.children)n(i,e.id,"step",{invisible:i.invisible}),r(i.children,i.id);else if(e.type==="sections"){r(e.children,e.id);for(let i of e.footer??[])n(i,e.id,"button",{invisible:i.invisible})}else if(e.type==="list")for(let i of e.actions??[])n(i,e.id,"button",{invisible:i.invisible});else{let i=(o,a)=>{a&&n({id:o},e.id,"field",{field:a})};i("#title",e.title?.field),i("#subtitle",e.title?.subtitleField),i("#avatar",e.title?.avatarField),e.statusbar&&n({id:"#statusbar",...e.statusbar.roles?{roles:e.statusbar.roles}:{}},e.id,"field",{field:e.statusbar.field,invisible:e.statusbar.invisible});for(let o of[...e.buttons??[],...e.footer??[]])n(o,e.id,"button",{invisible:o.invisible});for(let o of e.statButtons??[])n(o,e.id,"stat",{invisible:o.invisible});for(let o of[...e.ribbon?[e.ribbon]:[],...e.ribbons??[]])n(o,e.id,"other",{invisible:o.invisible});for(let o of e.alerts??[]){n(o,e.id,"other",{invisible:o.invisible});for(let a of o.buttons??[])n(a,o.id,"button",{invisible:a.invisible})}for(let o of e.badges??[])n(o,e.id,"other",{invisible:o.invisible});r([...e.title?.above??[],...e.title?.before??[],...e.title?.after??[],...e.title?.below??[]],e.id),r(e.children,e.id),e.sidePanel&&n(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible});for(let o of e.toolbar?.menu??[])if(n(o,e.id,"button",{invisible:o.invisible}),o.builtin==="archive"||o.builtin==="unarchive"){let a=t.get(o.id),s=a.invisible,d=o.builtin==="unarchive";a.invisible={...s,evaluate:(l,f)=>l.active===!1!==d||s.evaluate(l,f)}}e.attachmentPreview&&n({id:"#preview",...e.attachmentPreview},e.id,"other",{invisible:e.attachmentPreview.invisible})}return t}function qc(e,t){if(e.type==="boolean")return t===!0?"Yes":"No";if(t==null||t===!1)return"";if(e.type==="selection")return e.options.find(r=>r.value===t)?.label??String(t);if(e.type==="html")return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();let n=r=>r&&typeof r=="object"&&"label"in r?String(r.label):r&&typeof r=="object"&&"name"in r?String(r.name):String(r);return Array.isArray(t)?t.map(n).join(", "):n(t)}function ui(e,t){return!!e&&(e.type==="integer"||e.type==="float"||e.type==="monetary")&&typeof t=="string"&&t.trim()!==""}function _c(e,t){return e?.type!=="one2many"?ui(e,t):(t??[]).some(n=>Object.entries(n.values).some(([r,i])=>ui(e.fields[r],i)))}var Vs=new Map;function Is(e,t){let n=`${e}:${t}`,r=Vs.get(n);return r||(r=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),Vs.set(n,r)),r}function Vn(e,t,n,r="en"){try{let i=new Intl.NumberFormat(r,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",numberingSystem:"latn",minimumFractionDigits:n,maximumFractionDigits:n}).formatToParts(e);return i.map((o,a)=>o.type==="currency"&&/^(integer|minusSign)$/.test(i[a+1]?.type??"")?`${o.value}\xA0`:o.value).join("")}catch{return`${t} ${pt(e,n,r)}`}}function Ds(e){let t=Is(e,1).formatToParts(12345.6);return{group:t.find(n=>n.type==="group")?.value??",",decimal:t.find(n=>n.type==="decimal")?.value??"."}}function No(e,t,n="en"){return Lr(pt(e,t,n),n)}function Lr(e,t="en"){let{group:n}=Ds(t);return e.split(n).join("")}function pt(e,t,n="en"){return Is(n,t).format(e)}function Jt(e,t="en"){let{group:n,decimal:r}=Ds(t),i=e.replace(/[٠-٩]/g,o=>String(o.charCodeAt(0)-1632)).replace(/[۰-۹]/g,o=>String(o.charCodeAt(0)-1776)).replace(/٫/g,r).replace(/٬/g,n);return i=i.replace(/[\s\u00a0\u202f]/g,""),n.trim()&&(i=i.split(n).join("")),r==="."?i:i.split(r).join(".")}var Ws={};var Uc={search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",addSection:"Add a section",addNote:"Add a note",deleteLine:"Delete line",lineN:"line {n}",noLines:"No lines yet",total:"Total",lineProblem:"Line {n}: {message}",moreProblems:"and {n} more",chooseColumns:"Choose columns",createNamed:"Create \u201C{name}\u201D",createAndEdit:"Create and edit\u2026",searchMore:"Search more\u2026",openNamed:"Open {name}",openLine:"Open line",chooseLine:"Choose {name}",chooseAllLines:"Choose every line",linesChosen:"{n} chosen",moreSteps:"More",timeInStep:"{time} in this step",chooseDate:"Choose a date",other:"Other:",otherAnswer:"Your own answer",clearSelection:"Clear selection",previousMonth:"Previous month",nextMonth:"Next month",weekShort:"Wk",week:"Week",formatting:"Formatting",bold:"Bold",italic:"Italic",underline:"Underline",textStyle:"Text style",paragraph:"Paragraph",heading:"Heading",subheading:"Subheading",bulletList:"Bulleted list",numberList:"Numbered list",alignLeft:"Align left",alignCenter:"Align centre",alignRight:"Align right",link:"Link",linkAddress:"Link address",applyLink:"Apply",removeLink:"Remove link",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",addFiles:"Add files",addPhotos:"Add photos",dropThem:"or drop them here",upToSize:"up to {size}",upToEach:"up to {size} each",upToFiles:"up to {max} files",fileCount:"{n} files",oneFile:"1 file",fileCountOf:"{n} of {max} files",tooMany:"Up to {max} files: {n} not added",alreadyAdded:"{name}: already added",removeAsk:"Remove {name}?",keep:"Keep",previous:"Previous",next:"Next",download:"Download",close:"Close",fileAt:"{n} of {total}",noPreview:"No preview for this kind of file",showFilesAs:"Show files as",asList:"List",asCards:"Cards",asThumbnails:"Thumbnails",invalidJson:"Not valid JSON",invalidJsonAt:"Not valid JSON: line {line}, column {column}",signaturePad:"Signature pad: draw your signature",signHere:"Sign here",typeSignature:"Or type your name",clearDrawing:"Clear",undo:"Undo",uploadSignature:"Upload a picture",notAnswered:"Not answered",moveUp:"Move {label} up",moveDown:"Move {label} down",movedTo:"{label} moved to place {n} of {total}",addressStreet:"Street address",addressCity:"City",addressLine2:"Address line 2",addressRegion:"State or region",addressPostcode:"Postcode",addressCountry:"Country",entry:"Entry {n}",addAnother:"Add another",copy:"Copy {name}",removed:"{name} removed",loadingChoices:"Loading choices\u2026",choicesFailed:"Load the choices again",notOffered:"{name}: no longer offered",yes:"Yes",no:"No",upTo:"Up to {n}",keepOrder:"Keep this order",ofMax:"{n} of {max}",charactersLeft:"Characters left: {n}",colourNames:"No colour|Red|Orange|Yellow|Cyan|Purple|Almond|Teal|Blue|Raspberry|Green|Violet",copyValue:"Copy",copied:"Copied",noDocument:"No document yet",openInNewTab:"Open in a new tab",account:"Account",share:"Percentage",addAccount:"Add an account",sharesOff:"The shares add up to {n}, not 100%",untaxed:"Untaxed amount",paidOn:"Paid on {date}",amountDue:"Amount due",paymentOf:"Payment of {amount}",journal:"Journal",memo:"Memo",openPayment:"Open",addProperty:"Add a property",propertyName:"Property name",propertyType:"Kind",propertyTypes:"Text|Long text|Whole number|Number|Yes or no|Date",add:"Add",cancel:"Cancel",loading:"Loading\u2026",perDay:"/day",perNight:"/night",perWeek:"/week",perMonth:"/month",perYear:"/year"},Ze={en:Uc,...Ws};function mi(e,t){let n=e.ownerDocument,r=n.defaultView,i=typeof t.showPopover=="function";i&&t.setAttribute("popover","manual");let o=!1,a="",s=0;function d(){let y=e.getBoundingClientRect(),p=n.documentElement.clientWidth,k=n.documentElement.clientHeight,[g,m]=[k-y.bottom-10,y.top-10],b=g<160&&m>g;Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",minWidth:`${Math.min(Math.max(y.width,224),p-16)}px`,maxWidth:`${Math.max(y.width,Math.min(448,p-16))}px`,maxHeight:`${Math.max(96,Math.min(240,b?m:g))}px`}),a=`${y.left},${y.top},${y.width},${p},${k}`;let h=t.offsetWidth,v=r?.getComputedStyle(e).direction==="rtl",S=Math.max(8,Math.min(v?y.right-h:y.left,p-h-8));Object.assign(t.style,{left:`${S}px`,top:`${b?y.top-2-t.offsetHeight:y.bottom+2}px`})}let l=()=>{if(o){if(!e.isConnected)return c.hide();d()}},f=()=>{if(!o)return;let y=e.getBoundingClientRect();`${y.left},${y.top},${y.width},${n.documentElement.clientWidth},${n.documentElement.clientHeight}`!==a&&l(),s=r?.requestAnimationFrame(f)??0},c={show(){t.hidden=!1,i&&!t.matches(":popover-open")&&t.showPopover(),d(),o||(n.addEventListener("scroll",l,!0),r?.addEventListener("resize",l)),o=!0,!s&&r?.requestAnimationFrame&&(s=r.requestAnimationFrame(f))},place:l,hide(){i&&t.matches(":popover-open")&&t.hidePopover(),t.hidden=!0,o&&(n.removeEventListener("scroll",l,!0),r?.removeEventListener("resize",l)),s&&r?.cancelAnimationFrame(s),s=0,o=!1}};return c}function Te(e){return(t,n={},...r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}}var We=(e,t)=>e??Ze[t??"en"]??Ze.en,ze=(e,t)=>e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n);function He(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}function Mt(e,t){e.hidden!==t&&(e.hidden=t)}function ft(e,t){e.textContent!==t&&(e.textContent=t)}function tt(e,t){He(e,"aria-invalid",String(t.invalid)),He(e,"aria-describedby",t.describedBy||null)}function gi(e){let t=e("div",{class:"fd-announce",role:"status","aria-live":"polite"});return{element:t,say(n){t.textContent="",t.textContent=n}}}var Wt=e=>e.closest("[dir]")?.getAttribute("dir")==="rtl";function sn(e,t,n,r,i=!0){let o=Te(e)("button",{type:"button",class:"fd-choice-clear",hidden:""},t.clearSelection);o.addEventListener("click",n);let a=i&&r.options?.clear!==!1,s=!1;return{button:o,allow(d){s=a&&!d.required&&!d.readonly},show(d){Mt(o,!(s&&d))}}}function hi(e,t){let n=e("span"),r=e("button",{type:"button",class:"fd-button fd-button-link"},t.removeFile),i=e("button",{type:"button",class:"fd-button fd-button-link"},t.keep),o=e("div",{class:"fd-file-confirm",hidden:""},n,r,i),a=d=>{},s=d=>{o.hidden=!0,a(d)};return r.addEventListener("click",()=>s(!0)),i.addEventListener("click",()=>s(!1)),o.addEventListener("keydown",d=>d.key==="Escape"&&s(!1)),{element:o,ask(d,l){n.textContent=d,a=l,o.hidden=!1,i.focus()}}}var Kc=180,bi=8;function Er(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>t[r]??n)}function yi(e){let{document:t,id:n,labels:r}=e,i=`${n}-list`,o=t.createElement("input");Object.assign(o,{id:n,className:"fd-input fd-combo-input",autocomplete:"off"}),o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls",i),o.placeholder=e.placeholder||r.search;let a=t.createElement("ul");a.id=i,a.className="fd-listbox",a.setAttribute("role","listbox"),a.hidden=!0;let s=t.createElement("div");s.className="fd-combo",s.append(o,a);let d=mi(o,a),l="",f=null,c="",y=new Map,p=!1,k=[],g=-1,m=0,b,h=!1;function v(){if(a.replaceChildren(),k.forEach((w,A)=>{let R=t.createElement("li");R.id=`${i}-${A}`,R.setAttribute("role","option"),R.setAttribute("aria-selected",String(A===g)),R.className=`fd-option${A===g?" fd-active":""}${w===f||y.has(w)?" fd-option-create":""}`,R.textContent=w.label,R.addEventListener("mousedown",I=>I.preventDefault()),R.addEventListener("click",()=>F(A)),a.append(R)}),!k.length){let w=t.createElement("li");w.className="fd-empty",w.textContent=r.noResults,a.append(w)}g>=0?o.setAttribute("aria-activedescendant",`${i}-${g}`):o.removeAttribute("aria-activedescendant"),d.place()}function S(){d.show(),o.setAttribute("aria-expanded","true")}function x(){clearTimeout(b),m++,d.hide(),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),g=-1}function F(w){let A=k[w];if(!A)return;let R=c;if(x(),p=!1,A===f&&e.create){e.create(R).then(e.pick,()=>{});return}let I=y.get(A);if(I){I(R).then(M=>M&&e.pick(M),()=>{});return}e.pick(A)}function E(w){clearTimeout(b);let A=++m;b=setTimeout(async()=>{let R=await e.search(w).catch(()=>[]);if(A!==m||t.activeElement!==o)return;let I=k[g],M=I&&I!==f&&!y.has(I)?I.id:void 0,P=e.exclude?.()??new Set,H=R.filter(z=>!P.has(z.id)),D=e.shown!==void 0&&H.length>e.shown;k=D?H.slice(0,e.shown):H;let W=w.trim();f=null,e.create&&W&&!R.some(z=>z.label.trim().toLowerCase()===W.toLowerCase())&&(c=W,f={id:"__create__",label:Er(r.createNamed,{name:W})},k=[...k,f]),c=W,y=new Map((e.more?.(W,D)??[]).map((z,j)=>[{id:`__more_${j}__`,label:z.label},z.act])),k=[...k,...y.keys()],g=M===void 0?-1:k.findIndex(z=>z.id===M),v(),S()},Kc)}return o.addEventListener("input",()=>{p=!0,h||E(o.value)}),o.addEventListener("focus",()=>{h||E("")}),o.addEventListener("click",()=>{!h&&a.hidden&&t.activeElement===o&&E(p?o.value:"")}),o.addEventListener("keydown",w=>{if(!h)switch(w.key){case"ArrowDown":case"ArrowUp":{if(w.preventDefault(),a.hidden)return E(o.value);if(!k.length)return;g=(g+(w.key==="ArrowDown"?1:-1)+k.length)%k.length,v(),a.children[g]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!a.hidden&&g>=0&&(w.preventDefault(),F(g));return;case"Escape":a.hidden||w.preventDefault(),x(),p=!1,o.value=l;return;case"Backspace":o.value===""&&e.onEmptyBackspace?.();return}}),o.addEventListener("blur",()=>{m++,clearTimeout(b),x();let w=p&&o.value.trim()===""&&l!=="";p=!1,w?e.onCommitEmpty?.():o.value=l}),{element:s,input:o,setText(w){l=w,!p&&o.value!==w&&(o.value=w)},setReadonly(w){h=w,o.readOnly!==w&&(o.readOnly=w),w&&x()},close:x}}function Zn(e,t,n){let r=n??e.createElement("span");if(r.className="fd-link-avatar",r.setAttribute("aria-hidden","true"),!t)return r.hidden=!0,r.replaceChildren(),r;if(r.hidden=!1,t.avatar){let i=e.createElement("img");i.src=t.avatar,i.alt="",r.replaceChildren(i)}else{let i=t.label.trim().split(/\s+/).filter(Boolean);r.textContent=(i.length>1?i[0][0]+i[i.length-1][0]:i[0]?.[0]??"").toUpperCase()}return r}function xi(e,t){let n=e.ownerDocument;e.replaceChildren(...t.split(`
|
|
4
|
-
`).map(r=>{let i=n.createElement("div");return i.textContent=r,i}))}function js(e){let t=e.options??{};return{avatar:t.avatar===!0,details:t.details===!0,colors:t.colors===!0,opens:t.open!==!1}}function Hs(e,t,n){return n.options?.create!==!1&&e.canCreate(t)?r=>e.quickCreate(t,r):void 0}var Rr=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,dialogs:s})=>{let d=n.type==="many2one"?n.relation:"",l=js(r),f=l.opens&&!!s&&s.canOpen(d),c=!1,y=yi({document:o,id:i,labels:a,search:h=>e.search(t,h,bi+1),shown:bi,pick:h=>e.setValue(t,h),onCommitEmpty:()=>e.setValue(t,null),create:Hs(e,t,r),placeholder:r.placeholder,more:(h,v)=>{if(!s||c)return[];let S=[];return h&&f&&r.options?.create!==!1&&S.push({label:a.createAndEdit,act:x=>{let F=e.createValues(t);return s.openRecord(d,{name:x,title:n.label,...Object.keys(F).length?{values:F}:{}})}}),v&&S.push({label:a.searchMore,act:()=>s.searchMore({title:n.label,search:(x,F)=>e.search(t,x,F)})}),S}}),p=f?o.createElement("button"):null;p&&(p.type="button",p.className="fd-combo-open",p.textContent="\u2197",p.hidden=!0,p.addEventListener("click",async()=>{let h=e.getState().values[t];if(!h||!s)return;let v=await s.openRecord(d,{recordId:h.id,title:h.label});v&&v.label!==h.label&&e.setValue(t,v)}));let k=o.createElement("button");k.type="button",k.className="fd-combo-clear",k.textContent="\xD7",k.setAttribute("aria-label",Er(a.clear,{label:n.label})),k.addEventListener("click",()=>{e.setValue(t,null),y.input.focus()}),y.element.append(k,...p?[p]:[]);let g=l.avatar?Zn(o,null):null;g&&(y.element.prepend(g),y.element.setAttribute("data-avatar",""));let m=l.details?o.createElement("div"):null,b=y.element;return m&&(m.className="fd-link-details",m.hidden=!0,b=o.createElement("div"),b.className="fd-link",b.append(y.element,m)),{element:b,focus:()=>y.input.focus(),update(h){let v=h.value;if(g&&Zn(o,v,g),m){let S=v?.details?.trim()??"";Mt(m,!S),m.textContent!==S.replace(/\n/g,"")&&xi(m,S)}c=h.readonly,y.setText(v?.label??""),y.setReadonly(h.readonly),Mt(k,!v||h.readonly),p&&(Mt(p,!v),v&&He(p,"aria-label",Er(a.openNamed,{name:v.label}))),He(y.input,"aria-invalid",String(h.invalid)),He(y.input,"aria-required",String(h.required)),h.describedBy&&He(y.input,"aria-describedby",h.describedBy)}}},vi=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,dialogs:s})=>{let d=n.type==="many2many"?n.relation:"",l=js(r),f=()=>e.getState().values[t]??[],c=o.createElement("div");c.className="fd-tags",c.setAttribute("role","group");let y=o.createElement("ul");y.className="fd-chips";let p=yi({document:o,id:i,labels:a,search:b=>e.search(t,b,bi+1+f().length),shown:bi,pick:b=>{f().some(h=>h.id===b.id)||e.setValue(t,[...f(),b]),p.input.value=""},exclude:()=>new Set(f().map(b=>b.id)),onEmptyBackspace:()=>{let b=f();b.length&&e.setValue(t,b.slice(0,-1))},create:Hs(e,t,r),placeholder:r.placeholder,more:(b,h)=>s&&h?[{label:a.searchMore,act:()=>s.searchMore({title:n.label,search:(v,S)=>e.search(t,v,S)})}]:[]}),k=l.opens&&s&&s.canOpen(d)?async b=>{let h=await s.openRecord(d,{recordId:b.id,title:b.label});h&&h.label!==b.label&&e.setValue(t,f().map(v=>v.id===b.id?h:v))}:void 0;c.append(y,p.element);let g=!1,m="";return{element:c,focus:()=>p.input.focus(),update(b){let h=b.value??[],v=JSON.stringify([b.readonly,h]);g=b.readonly,p.setReadonly(g),p.element.hidden=g,p.input.setAttribute("aria-invalid",String(b.invalid)),b.describedBy&&p.input.setAttribute("aria-describedby",b.describedBy),v!==m&&(m=v,zs(y,h,g,a,S=>e.setValue(t,f().filter(x=>x.id!==S.id)),k,l),p.setText(""))}}};function zs(e,t,n,r,i,o,a={}){let s=e.ownerDocument;e.replaceChildren(...t.map(d=>{let l=s.createElement("li");l.className="fd-chip",a.colors&&typeof d.color=="number"&&d.color>=1&&d.color<=11&&l.setAttribute("data-color",String(Math.trunc(d.color))),a.avatar&&l.append(Zn(s,d));let f=s.createElement(o?"button":"span");if(f.className="fd-chip-label",f.textContent=d.label,o&&(f.type="button",f.setAttribute("aria-label",Er(r.openNamed,{name:d.label})),f.addEventListener("click",()=>o(d))),l.append(f),!n){let c=s.createElement("button");c.type="button",c.className="fd-chip-remove",c.textContent="\xD7",c.setAttribute("aria-label",Er(r.remove,{name:d.label})),c.addEventListener("click",()=>i(d)),l.append(c)}return l}))}var Co=({form:e,name:t,node:n,id:r,document:i,labels:o=Ze.en})=>{let a=n.options??{},s=typeof a.separator=="string"&&a.separator?a.separator:",",d=Array.isArray(a.suggestions)?a.suggestions.filter(b=>typeof b=="string"):[],l=b=>typeof b=="string"?b.split(s).map(h=>h.trim()).filter(h=>h!==""):[],f=()=>l(e.getState().values[t]),c=b=>e.setValue(t,b.length?b.join(`${s} `):null),y=b=>{let h=b.trim(),v=f();h&&!v.some(S=>S.toLowerCase()===h.toLowerCase())&&!(v.length>=a.max)&&c([...v,h])},p=i.createElement("div");p.className="fd-tags",p.setAttribute("role","group");let k=i.createElement("ul");k.className="fd-chips";let g=yi({document:i,id:r,labels:o,placeholder:n.placeholder,search:async b=>{let h=new Set(f().map(S=>S.toLowerCase())),v=b.trim().toLowerCase();return d.filter(S=>!h.has(S.toLowerCase())&&S.toLowerCase().includes(v)).map(S=>({id:S,label:S}))},pick:b=>{y(b.label),g.input.value=""},onEmptyBackspace:()=>{let b=f();b.length&&c(b.slice(0,-1))}});g.input.addEventListener("keydown",b=>{b.key!=="Enter"||b.defaultPrevented||g.input.value.trim()===""||(b.preventDefault(),y(g.input.value),g.input.value="",g.close())}),g.input.addEventListener("input",()=>{let b=g.input.value.split(s);if(!(b.length<2)){for(let h of b.slice(0,-1))y(h);g.input.value=b[b.length-1].trimStart()}}),g.input.addEventListener("change",()=>{g.input.value.trim()&&y(g.input.value)}),p.append(k,g.element);let m="";return{element:p,focus:()=>g.input.focus(),update(b){let h=l(b.value);g.setReadonly(b.readonly),g.element.hidden=b.readonly||h.length>=a.max,g.input.setAttribute("aria-invalid",String(b.invalid)),b.describedBy&&g.input.setAttribute("aria-describedby",b.describedBy);let v=JSON.stringify([b.readonly,h]);if(v===m)return;m=v;let S=i.activeElement===g.input;zs(k,h.map(x=>({id:x,label:x})),b.readonly,o,x=>c(f().filter(F=>F!==x.label))),g.setText(""),S&&g.element.hidden&&k.querySelector("li:last-child button")?.focus()}}},Po=({form:e,name:t,id:n,document:r})=>{let i=r.createElement("div");i.id=n,i.className="fd-choices fd-choices-checkbox",i.setAttribute("role","group");let o=[],a={readonly:!1,value:[]},s=()=>{let d=new Set(a.value.map(l=>l.id));for(let{record:l,box:f}of o)f.checked=d.has(l.id),f.disabled=a.readonly};return e.search(t,"",50).then(d=>{o=d.map((l,f)=>{let c=r.createElement("input");c.type="checkbox",c.id=`${n}-${f}`,c.addEventListener("change",()=>{let k=e.getState().values[t]??[];e.setValue(t,c.checked?[...k,l]:k.filter(g=>g.id!==l.id))});let y=r.createElement("label");y.className="fd-choice",y.htmlFor=c.id;let p=r.createElement("span");return p.textContent=l.label,y.append(c,p),i.append(y),{record:l,box:c}}),s()}),{element:i,focus:()=>i.querySelector("input")?.focus(),update(d){a={readonly:d.readonly,value:d.value??[]},s()}}},Oo=e=>{let{form:t,name:n,field:r,id:i,document:o,labels:a=Ze.en}=e,s=r.type==="reference"?r.models:[],d=o.createElement("div");d.className="fd-reference";let l=o.createElement("select");l.className="fd-input fd-select",l.setAttribute("aria-label",r.label),l.append(o.createElement("option"));for(let y of s){let p=o.createElement("option");p.value=String(y.value),p.textContent=y.label,l.append(p)}let f="";l.addEventListener("change",()=>{f=l.value,t.setValue(n,null)});let c=yi({document:o,id:i,labels:a,placeholder:e.node.placeholder,search:y=>f?t.search(n,y,8,{model:f}):Promise.resolve([]),pick:y=>t.setValue(n,{model:f,id:y.id,label:y.label}),onCommitEmpty:()=>t.setValue(n,null)});return d.append(l,c.element),{element:d,focus:()=>f?c.input.focus():l.focus(),update(y){let p=y.value;p&&(f=p.model),l.value=f,l.disabled=y.readonly,c.setText(p?.label??""),c.setReadonly(y.readonly||!f)}}};function Fr(e,t){try{let n=new Intl.NumberFormat(t,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).formatToParts(1),r=n.findIndex(i=>i.type==="currency");return{text:n[r].value,after:r>n.findIndex(i=>i.type==="integer")}}catch{return{text:e,after:!1}}}var _s=/[\u200e\u200f\u061c]/g,Jc=e=>`\u2068${e}\u2069`,Bs=new Map;function Vo(e,t="en"){let n=Bs.get(t);return n||Bs.set(t,n=new Intl.NumberFormat(t,{notation:"compact",numberingSystem:"latn",maximumFractionDigits:1})),n.format(e).replace(_s,"")}var Gc={day:"perDay",night:"perNight",week:"perWeek",month:"perMonth",year:"perYear"},qs=new WeakMap;function Yc(e,t){if(!e.per)return null;let n=qs.get(e.per);n||(n=e.per.map(({period:i,when:o})=>{let a=o===void 0?null:et(o);return{period:i,holds:s=>!a||a.evaluate(s)}}),qs.set(e.per,n));let r={};for(let[i,o]of Object.entries(t))r[i]=o&&typeof o=="object"&&!Array.isArray(o)&&"id"in o?o.id:o;return n.find(i=>i.holds(r))?.period??null}function wi(e,t,n,r,i,o={}){let a=i.short?Vo(e,r):pt(e,n,r),s=a;if(t&&t!==i.home){let c=/^[A-Z]{3}$/.test(t)?Fr(t,r):null,y=(i.currency==="code"||!c?t:c.text).replace(_s,""),p=i.at?i.at==="after":!!c?.after,k=Mn(r)&&!/^\p{L}+$/u.test(y)?Jc(y):y;s=p?`${a}\xA0${k}`:`${k}\xA0${a}`}let d=Yc(i,o);if(!d)return s;let l=Ze[r]??Ze.en;return`${Mn(r)?`\u2068${s}\u2069`:s}${l[Gc[d]]}`}function ki(e,t){if(e?.type!=="monetary")return[];let n=e.currencyField&&!e.currencyField.startsWith("parent.")?[e.currencyField]:[];for(let r of[e.money,t])for(let i of r?.per??[])i.when!==void 0&&n.push(...et(i.when).fields);return[...new Set(n)]}var Us=e=>String(e).padStart(2,"0");function Js(e){let t=Math.round(Math.abs(e)*60);return`${e<0&&t?"-":""}${Us(Math.floor(t/60))}:${Us(t%60)}`}function Xc(e,t="en"){let n=Jt(e.trim(),t);if(n==="")return null;let r=/^(-?)(\d+):(\d{1,2})$/.exec(n);if(r){let i=Number(r[3]);if(i>59)return e.trim();let o=Number(r[2])+i/60;return r[1]?-o:o}if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))return Number(n);if(!/^-?(\d+:?)?\.?$/.test(n))return e.trim()}var Ks=new Map;function Gs(e,t,n){let r=`${e}:${t}:${n}`,i=Ks.get(r);return i||(i=new Intl.NumberFormat(e,{style:n,numberingSystem:"latn",minimumFractionDigits:0,maximumFractionDigits:t}),Ks.set(r,i)),i}function Zc(e,t="en",n=2){return Gs(t,n,"percent").format(e)}var Ys=e=>e.type==="float"?e.digits?.[1]??2:2;function Xs(e,t){let{form:n,name:r,node:i,id:o,document:a}=e,s=Te(a),d=s("input",{id:o,type:"text",class:`fd-input fd-number-input ${t.className}`,autocomplete:"off",inputmode:t.inputMode});i.placeholder&&(d.placeholder=i.placeholder);let l=p=>typeof p=="number"?t.show(p):p==null?"":String(p);d.addEventListener("input",()=>{let p=t.parse(d.value);p!==void 0&&n.setValue(r,p)}),d.addEventListener("blur",()=>{d.value=l(n.getState().values[r])});let f=typeof i.options?.suffix=="string"&&i.options.suffix?i.options.suffix:t.unit,c=f?s("span",{class:"fd-unit",id:`${o}-unit2`},f):null,y=c?s("span",{class:"fd-number"},d,c):d;return c&&d.style.setProperty("padding-inline-end",`calc(var(--fd-pad-x) + ${f?.length??0}ch + 4px)`),{element:y,focus:()=>d.focus(),update(p){let k=a.activeElement===d,g=t.parse(d.value);if(!(k&&(g===void 0||g===p.value))){let m=l(p.value);d.value!==m&&(d.value=m)}d.readOnly!==p.readonly&&(d.readOnly=p.readonly),He(d,"aria-required",String(p.required)),tt(d,{...p,describedBy:[p.describedBy,c?.id].filter(Boolean).join(" ")})}}}var Zs=e=>{let t=e.locale??"en";return Xs(e,{show:Js,parse:n=>Xc(n,t),inputMode:"text",className:"fd-duration"})},Qs=e=>{let t=e.locale??"en",n=Ys(e.field);return Xs(e,{show:r=>Gs(t,n,"decimal").format(Math.round(r*100*10**n)/10**n),parse(r){let i=Jt(r.trim(),t).replace(/%$/,"");if(i==="")return null;if(/^-?(\d+\.?\d*|\.\d+)$/.test(i))return Math.round(Number(i)/100*1e10)/1e10;if(!/^-?\.?$/.test(i))return r.trim()},unit:"%",inputMode:"decimal",className:"fd-percentage"})};function ed(e,t,n,r,i={}){if(typeof n!="number"||e!=="duration"&&e!=="percentage")return null;let o=typeof i.suffix=="string"&&i.suffix?` ${i.suffix}`:"";return e==="duration"?Js(n)+o:Zc(n,r,Ys(t))}var Io=e=>typeof e?.model=="string"?e.model:"account.analytic.account";function td(e){return[...new Set(Do(e).flatMap(([t])=>t.split(",")))].map(t=>/^\d+$/.test(t)?Number(t):t)}function Si(e,t="en",n){let r=i=>`${pt(i,Number.isInteger(i)?0:2,t)}%`;return Do(e).map(([i,o])=>{let a=n?i.split(",").map(s=>n(s)??`#${s}`).join(" \xB7 "):"";return a?`${a} ${r(o)}`:r(o)}).join(n?", ":" \xB7 ")}var Do=e=>e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).map(([t,n])=>[t,typeof n=="number"?n:Number(n)||0]):[],nd=e=>{let{form:t,name:n,node:r,id:i,document:o,labels:a,locale:s="en"}=e,d=Te(o),l=We(a,s),f=Io(r.options),c=new Map,y=I=>I.split(",").map(M=>c.get(M)??`#${M}`).join(" \xB7 "),p=I=>`${pt(I,Number.isInteger(I)?0:2,s)}%`,k=d("tbody"),g=d("td",{class:"fd-distribution-total"}),m=d("table",{class:"fd-lines-table fd-distribution-table"},d("thead",{},d("tr",{},d("th",{scope:"col"},l.account),d("th",{scope:"col",class:"fd-distribution-share"},l.share),d("th",{class:"fd-lines-tools"}))),k,d("tfoot",{},d("tr",{class:"fd-lines-totals"},d("td",{},l.total),g,d("td")))),b=d("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-distribution-add"},`+ ${l.addAccount}`),h=d("div",{class:"fd-warning fd-distribution-off",role:"status",hidden:""}),v=d("div",{id:i,class:"fd-distribution",role:"group"},d("div",{class:"fd-lines-scroll"},m),b,h),S=[],x=!1;function F(){let I={};for(let M of S)M.key&&(I[M.key]=M.share);t.setValue(n,S.some(M=>M.key)?I:null)}function E(I,M){let P=S.length,H=`${i}-${P}-${Math.random().toString(36).slice(2,7)}`,D={key:I,share:M},W={...t,getState:()=>({...t.getState(),values:{account:D.key?{id:D.key,label:y(D.key)}:null}}),setValue:(j,V)=>{let B=V;D.key=B?String(B.id):"",B&&c.set(String(B.id),B.label),F()},search:(j,V,B)=>t.search(n,V,B,{model:f}),canCreate:()=>!1},z={type:"many2one",label:l.account,relation:f};return D.account=Rr({...e,form:W,name:"account",field:z,node:{type:"field",id:`${r.id}.account`,field:"account",options:{create:!1}},id:H}),D.input=d("input",{type:"text",class:"fd-input fd-number-input fd-share",inputmode:"decimal",autocomplete:"off","aria-label":l.share}),D.input.addEventListener("input",()=>{let j=Jt(D.input.value.trim(),s);/^\d+\.?\d*$|^\.\d+$/.test(j)&&(D.share=Number(j),F())}),D.remove=d("button",{type:"button",class:"fd-line-delete","aria-label":l.deleteLine},"\xD7"),D.remove.addEventListener("click",()=>{S=S.filter(j=>j!==D),D.account.destroy?.(),D.element.remove(),F(),R()}),D.element=d("tr",{},d("td",{},d("label",{class:"fd-sr-only",for:H},l.account),D.account.element),d("td",{class:"fd-distribution-share"},d("span",{class:"fd-number"},D.input,d("span",{class:"fd-unit"},"%"))),d("td",{class:"fd-lines-tools"},D.remove)),D}b.addEventListener("click",()=>{let I=Math.max(0,100-S.reduce((P,H)=>P+H.share,0)),M=E("",Math.round(I*100)/100);S.push(M),k.append(M.element),R(),M.account.focus()});let w="";function A(I){let M=[...new Set(I.flatMap(H=>H.split(",")))].filter(H=>!c.has(H));if(!M.length||M.join()===w)return;w=M.join();let P=M.map(H=>/^\d+$/.test(H)?Number(H):H);t.search(n,"",M.length,{model:f,ids:P}).then(H=>{for(let D of H)c.set(String(D.id),D.label);R()},()=>{})}function R(){let I=S.reduce((P,H)=>P+H.share,0);ft(g,p(Math.round(I*100)/100));let M=S.some(P=>P.key)&&Math.abs(I-100)>.001;ft(h,M?ze(l.sharesOff,{n:p(Math.round(I*100)/100)}):""),Mt(h,!M),Mt(b,x);for(let P of S){P.account.update({value:P.key?{id:P.key,label:y(P.key)}:null,values:{},readonly:x,required:!1,invalid:!1});let H=pt(P.share,Number.isInteger(P.share)?0:2,s);o.activeElement!==P.input&&P.input.value!==H&&(P.input.value=H),P.input.readOnly=x,x?P.remove.remove():P.remove.isConnected||P.element.lastElementChild?.append(P.remove)}}return{element:v,focus:()=>(S[0]?.input??b).focus(),destroy:()=>S.forEach(I=>I.account.destroy?.()),update(I){x=I.readonly;let M=Do(I.value);if(!(M.length===S.filter(H=>H.key).length&&M.every(([H,D],W)=>S.filter(z=>z.key)[W]?.key===H&&S.filter(z=>z.key)[W]?.share===D))){for(let D of S)D.account.destroy?.();let H=S.filter(D=>!D.key);S=M.map(([D,W])=>E(D,W)),S.push(...H.map(D=>E("",D.share))),k.replaceChildren(...S.map(D=>D.element))}A(M.map(([H])=>H)),R()}}};function rd(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,n,r,i,o,a]=t;return new Date(Number(n),Number(r)-1,Number(i),Number(o??0),Number(a??0))}function Qn(e,t,n){if(e.type!=="monetary")return null;if(e.currency)return e.currency;if(!e.currencyField)return null;let r=e.currencyField.startsWith("parent.")?n?.[e.currencyField.slice(7)]:t[e.currencyField];return r&&typeof r=="object"&&"label"in r?r.label||null:typeof r=="string"&&r?r:null}function At(e,t,n={},r="en",i){let o=(a,s)=>pt(a,s,r);if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(a=>a.label).join(", ");case"selection":{let a=s=>e.options.find(d=>d.value===s)?.label??String(s);return Array.isArray(t)?t.map(a).join(", "):a(t)}case"integer":return o(Number(t),0);case"float":return o(Number(t),e.digits?.[1]??2);case"monetary":{let a=Qn(e,n,i);return e.money?wi(Number(t),a,e.digits?.[1]??2,r,e.money,n):a?Vn(Number(t),a,e.digits?.[1]??2,r):o(Number(t),e.digits?.[1]??2)}case"date":{let a=rd(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",numberingSystem:"latn"}).format(a):String(t)}case"datetime":{let a=rd(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",numberingSystem:"latn"}).format(a):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return[t].flat().map(a=>a.name??"").join(", ");case"boolean":return t?"\u2713":"";default:return String(t)}}function In(e,t,n={},r="en",i,o={}){return o.widget==="distribution"&&e.type==="json"?Si(t,r):ed(o.widget,e,t,r,o.options)??At(e,t,n,r,i)}var Qc=new Set(["progressbar","priority","dot","color","timer","badge"]);var ef="http://www.w3.org/2000/svg",id={user:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-6 8-6s8 2 8 6"/>',users:'<circle cx="9" cy="8" r="3.5"/><path d="M2 20c0-3.5 3-5.5 7-5.5s7 2 7 5.5"/><circle cx="17" cy="9" r="2.5"/><path d="M16.5 14.5c3 0 5.5 1.6 5.5 4.5"/>',building:'<rect x="4" y="3" width="16" height="18" rx="1"/><path d="M9 21v-4h6v4M8 7h2M14 7h2M8 11h2M14 11h2"/>',home:'<path d="M3 11l9-7 9 7"/><path d="M5 10v10h14V10"/><path d="M10 20v-6h4v6"/>',phone:'<rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 18h2"/>',mail:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/>',pin:'<path d="M12 21s-7-6.5-7-12a7 7 0 0 1 14 0c0 5.5-7 12-7 12z"/><circle cx="12" cy="9" r="2.5"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 3"/>',money:'<rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="3"/><path d="M6 9.5v0M18 14.5v0"/>',cart:'<path d="M3 4h2l2.5 11h11L21 7H6.4"/><circle cx="9" cy="19.5" r="1.5"/><circle cx="17" cy="19.5" r="1.5"/>',box:'<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9z"/><path d="M4 7.5l8 4.5 8-4.5M12 12v9"/>',truck:'<path d="M2 6h12v10H2zM14 9h4l3 3.5V16h-7"/><circle cx="6.5" cy="17.5" r="1.8"/><circle cx="17" cy="17.5" r="1.8"/>',receipt:'<path d="M6 3h12v18l-3-2-3 2-3-2-3 2z"/><path d="M9 8h6M9 12h6"/>',file:'<path d="M6 3h8l4 4v14H6z"/><path d="M14 3v4h4M9 12h6M9 16h6"/>',edit:'<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="M13.5 6.5l4 4"/>',tag:'<path d="M3 12V4h8l10 10-8 8z"/><circle cx="7.5" cy="8" r="1.5"/>',star:'<path d="M12 3l2.8 6 6.2.6-4.7 4.2 1.4 6.2L12 16.8 6.3 20l1.4-6.2L3 9.6 9.2 9z"/>',lock:'<rect x="5" y="11" width="14" height="10" rx="2"/><path d="M8 11V7a4 4 0 0 1 8 0v4"/>',check:'<path d="M5 12.5l4.5 4.5L19 7.5"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v6M12 7.5v0"/>',warning:'<path d="M12 3l10 18H2z"/><path d="M12 10v5M12 18v0"/>',settings:'<path d="M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1"/><circle cx="15" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="17" cy="18" r="2"/>',chart:'<path d="M3 20h18M6 20v-8M11 20V5M16 20v-6"/>',link:'<path d="M10 14a4 4 0 0 0 5.6 0l3-3a4 4 0 0 0-5.6-5.6l-1 1"/><path d="M14 10a4 4 0 0 0-5.6 0l-3 3a4 4 0 0 0 5.6 5.6l1-1"/>',list:'<path d="M8 6h12M8 12h12M8 18h12M4 6v0M4 12v0M4 18v0"/>',chat:'<path d="M4 5h16v11H9l-5 4z"/>',search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l5 5"/>',filter:'<path d="M3 5h18l-7 8.5V20l-4-2v-4.5z"/>',layers:'<path d="M12 3l9 5-9 5-9-5z"/><path d="M3 13l9 5 9-5"/>',thumb:'<path d="M7 21V10l4-8c1.6 0 2.6 1.3 2.2 3L12.5 9H19a2 2 0 0 1 2 2.3l-1.3 7.6a2.5 2.5 0 0 1-2.5 2.1H7zM7 10H3v11h4"/>'};function kt(e,t,n){let r=t?n?.[t]??id[t]:void 0;if(r===void 0)return null;let i=e.createElementNS(ef,"svg");for(let[o,a]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",class:"fd-icon","data-icon":t}))i.setAttribute(o,a);return i.innerHTML=r,i}function er(e,t,n,r,i){if(n.type==="one2many"&&n.sequenceField)return e.moveLine(t,r,i);let o=[...e.getState().values[t]??[]],a=o.findIndex(s=>s.key===r);a<0||i<0||i>=o.length||i===a||(o.splice(i,0,...o.splice(a,1)),e.setValue(t,o))}var tf=new Set(["integer","float","monetary"]),od=new Set(["boolean","integer","float","monetary","date","datetime"]),ad=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0;function dd(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function Li(e,t,n){let r=()=>(e.getState().values[t]??[]).find(i=>i.key===n)?.values??{};return{...e,getState:()=>({...e.getState(),values:r()}),setValue:(i,o)=>e.updateLine(t,n,i,o),search:(i,o,a,s)=>e.searchLine(t,n,i,o,a,s),canCreate:i=>e.canCreateLine(t,i),quickCreate:(i,o)=>e.quickCreateLine(t,i,o,n),createValues:i=>e.createValues(i,{lines:t,key:n})}}function ld(e,t){if(e.type!=="monetary"||!e.currencyField?.startsWith("parent."))return e;let{currencyField:n,...r}=e,i=Qn(e,{},t);return i&&/^[A-Z]{3}$/.test(i)?{...r,currency:i}:r}async function Ei(e,t,n,r,i,o){let a=e.page.fields[t],s=()=>e.getState().values[t]??[],d=y=>e.setValue(t,s().map(p=>p.key===r.key?{...p,values:{...p.values,...y}}:p));if(n.lineOpens==="record"&&r.id!==void 0&&i.canOpen(a.relation)){let y=await i.openRecord(a.relation,{recordId:r.id,title:a.label,withValues:!0}),p=Object.fromEntries(Object.entries(y?.values??{}).filter(([k])=>k in a.fields&&k!==a.sequenceField));Object.keys(p).length&&d(p);return}let l=Object.fromEntries(Object.entries(a.fields).filter(([y])=>y!==a.lineKinds?.field&&y!==a.sequenceField).map(([y,p])=>[y,ld(p,e.getState().values)])),f=e.getState(),c=await i.editValues({title:a.label,fields:l,values:r.values,readonly:o,recompute:y=>e.previewLine(t,r.key,y),parent:{values:f.values,fields:e.page.fields,id:f.recordId},...n.lineForm?{layout:n.lineForm.children}:{}});c&&d(c)}var Wo=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,locale:s,dialogs:d,widgets:l})=>{let f=n,c=f.lineKinds,y=Te(o),p=r.options??{},k=ad(p.min)??0,g=ad(p.max)??1/0,m=Y=>typeof p[Y]=="string"&&p[Y].trim()?p[Y]:null,b=new Map,h=!!(r.cells||r.rowTones||r.rowBold!==void 0||r.rowButtons||r.lineDelete!==void 0),v=(r.columns??Object.keys(f.fields)).filter(Y=>f.fields[Y]&&f.fields[Y].type!=="one2many"&&Y!==c?.field&&Y!==f.sequenceField&&r.optionalColumns?.[Y]!=="hide"),S=o.createElement("div");S.className="fd-lines",S.id=i,r.cards&&(S.dataset.cards=r.cards),r.fit&&(S.dataset.fit=r.fit),S.setAttribute("role","group");let x=o.createElement("div");x.className="fd-lines-scroll";let F=o.createElement("table");F.className="fd-lines-table";let E=o.createElement("thead"),w=o.createElement("tr"),A=!!r.selectedButtons?.length,R=new Set,I=A?y("input",{type:"checkbox",class:"fd-checkbox fd-line-pick fd-line-pick-all","aria-label":a.chooseAllLines}):null;w.append(y("th",{class:"fd-lines-grip"},...I?[I]:[]));for(let Y of v){let ne=o.createElement("th");ne.scope="col",ne.dataset.column=Y,ne.textContent=f.fields[Y].label;let fe=r.cells?.[Y]?.width;fe?ne.style.width=`${fe}ch`:od.has(f.fields[Y].type)&&(ne.dataset.fit=f.fields[Y].type),b.set(Y,ne),w.append(ne)}let M=o.createElement("th");M.className="fd-lines-tools",w.append(M),E.append(w);let P=o.createElement("tbody");F.append(E,P);let H=(r.totals??[]).filter(Y=>v.includes(Y)),D=new Map,W=new Map;if(H.length){let Y=o.createElement("tfoot"),ne=o.createElement("tr");ne.className="fd-lines-totals",ne.append(o.createElement("td")),v.forEach((fe,U)=>{let re=o.createElement("td");re.dataset.column=fe,W.set(fe,re),H.includes(fe)?D.set(fe,re):U===0&&(re.textContent=a.total),ne.append(re)}),ne.append(o.createElement("td")),Y.append(ne),F.append(Y)}x.append(F);let z=o.createElement("div");z.className="fd-lines-adds";let j=(Y,ne,fe)=>{let U=o.createElement("button");U.type="button",U.className="fd-button fd-button-link fd-lines-add",U.dataset.add=fe,U.textContent=`+ ${Y}`,U.addEventListener("click",()=>{Me=e.addLine(t,ne);let re=Ee.get(Me);re&&(re.cells[0]?.widget.focus(),Me=null)}),z.append(U)};j(m("addLabel")??a.addLine,{},"line"),c&&(j(m("addSectionLabel")??a.addSection,{[c.field]:c.section??"section"},"section"),j(m("addNoteLabel")??a.addNote,{[c.field]:c.note??"note"},"note"));let V=(r.controlButtons??[]).map(Y=>{let ne=kt(o,Y.icon),fe=y("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-lines-control","data-node":Y.id},...ne?[ne]:[],Y.label);return fe.addEventListener("click",()=>{Ve(fe,()=>e.runAction(Y.id))}),z.append(fe),{id:Y.id,button:fe}}),B=y("span",{class:"fd-lines-chosen-count",role:"status"}),$=(r.selectedButtons??[]).map(Y=>{let ne=kt(o,Y.icon),fe=y("button",{type:"button",class:`fd-button fd-button-${Y.style??"secondary"} fd-lines-chosen-button`,"data-node":Y.id},...ne?[ne]:[],Y.label);return fe.addEventListener("click",()=>{Ve(fe,()=>e.runLinesAction(r.id,Y.id,oe().filter(U=>R.has(U.key)).map(U=>U.key)))}),{id:Y.id,button:fe}}),Q=A?y("div",{class:"fd-lines-chosen",hidden:""},B,...$.map(Y=>Y.button)):null,X=m("emptyLabel"),J=X?y("div",{class:"fd-help fd-lines-empty"},X):null,_=hi(y,a),te=y("div",{class:"fd-sr-only",role:"status"});S.append(...Q?[Q]:[],x,...J?[J]:[],z,_.element,te);async function Ve(Y,ne){if(!Y.hasAttribute("aria-busy")){Y.setAttribute("aria-busy","true");try{await ne()}finally{Y.removeAttribute("aria-busy")}}}function Ie(){if(!Q||!I)return;let Y=oe().filter(ne=>!gt(f,ne.values));for(let ne of[...R])Y.some(fe=>fe.key===ne)||R.delete(ne);Q.hidden=ie||R.size===0,B.textContent=ze(a.linesChosen,{n:R.size});for(let{id:ne,button:fe}of $)fe.hidden=e.node(ne).invisible;I.checked=Y.length>0&&R.size===Y.length,I.indeterminate=R.size>0&&R.size<Y.length,I.disabled=ie||!Y.length;for(let[ne,fe]of Ee)fe.pick&&(fe.pick.checked=R.has(ne),fe.pick.disabled=ie)}I?.addEventListener("change",()=>{let Y=oe().filter(ne=>!gt(f,ne.values));if(I.checked)for(let ne of Y)R.add(ne.key);else R.clear();Ie()});let Ee=new Map,Me=null,ie=!1,ge=null,oe=()=>e.getState().values[t]??[];for(let Y=oe().length;Y<k;Y++)e.addLine(t);function ke(Y,ne){let fe=oe().findIndex(Ce=>Ce.key===Y);if(ie||ne===fe||ne<0||ne>=oe().length)return;let U=o.activeElement,re=oe()[fe].values[v[0]];er(e,t,f,Y,ne),U&&U!==o.activeElement&&U.focus(),te.textContent=ze(a.movedTo,{label:typeof re=="string"&&re.trim()?re:ze(a.lineN,{n:fe+1}),n:ne+1,total:oe().length})}function De(Y,ne,fe){let U=[...P.children],re=U.indexOf(Y),Ce=U.filter(he=>he!==Y),Pe=Y.getBoundingClientRect(),ae=Ce.map(he=>{let be=he.getBoundingClientRect();return be.top+be.height/2}),le=re,se=!1,ce=he=>{he.key==="Escape"&&(he.preventDefault(),me())};function me(){for(let he of U)he.style.transform="";Y.classList.remove("fd-line-lifted"),P.classList.remove("fd-lines-dragging"),o.removeEventListener("keydown",ce,!0),se=!1}return{follow(he){let be=he-fe;if(!se){if(Math.abs(be)<4||ie)return;se=!0,Y.classList.add("fd-line-lifted"),P.classList.add("fd-lines-dragging"),o.addEventListener("keydown",ce,!0)}Y.style.transform=`translateY(${be}px)`;let rt=Pe.top+Pe.height/2+be;le=ae.filter(ht=>ht<rt).length,Ce.forEach((ht,St)=>{ht.style.transform=St>=re&&St<le?`translateY(${-Pe.height}px)`:St<re&&St>=le?`translateY(${Pe.height}px)`:""})},drop(){let he=se&&le!==re;me(),he&&ke(ne,le)},settle:me}}P.addEventListener("keydown",Y=>{let ne=Y.target.closest("tr")?.dataset.line;!ne||!Y.altKey||Y.key!=="ArrowUp"&&Y.key!=="ArrowDown"||(Y.preventDefault(),ke(ne,oe().findIndex(fe=>fe.key===ne)+(Y.key==="ArrowUp"?-1:1)))});function xe(Y,ne,fe,U,re=1){let Ce=`${i}-${ne.key}-${fe}`,Pe=gt(f,ne.values)?void 0:r.cells?.[fe],ae=Pe?.badge?{widget:"badge"}:Pe?.widget?{widget:Pe.widget,...Pe.options?{options:Pe.options}:{}}:Pe?.options?{options:Pe.options}:{},le={type:"field",id:`${r.id}.${ne.key}.${fe}`,field:fe,...ae},se=Ot({form:Li(e,t,ne.key),name:fe,field:U,node:le,id:Ce,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ce=o.createElement("td");ce.colSpan=re,ce.dataset.column=fe,od.has(U.type)&&(ce.dataset.fit=U.type),ce.dataset.label=U.label;let me=o.createElement("label");me.className="fd-sr-only",me.htmlFor=Ce,me.textContent=U.label;let he=o.createElement("div");return he.className="fd-cell-error",he.hidden=!0,ce.append(me,se.element,he),Y.append(ce),{name:fe,def:U,widget:se,error:he,td:ce}}function Xe(Y){let ne=o.createElement("tr");ne.dataset.line=Y.key;let fe=gt(f,Y.values);fe&&(ne.className=`fd-line-${fe}`);let U=y("span",{class:"fd-line-grip fd-rank-grip","aria-hidden":"true"}),re=null;U.addEventListener("pointerdown",me=>{ie||me.button!==0||(me.preventDefault(),U.setPointerCapture?.(me.pointerId),re=De(ne,Y.key,me.clientY))}),U.addEventListener("pointermove",me=>re?.follow(me.clientY)),U.addEventListener("pointerup",()=>{re?.drop(),re=null}),U.addEventListener("pointercancel",()=>{re?.settle(),re=null});let Ce=A&&!fe?y("input",{type:"checkbox",class:"fd-checkbox fd-line-pick"}):null;Ce?.addEventListener("change",()=>{Ce.checked?R.add(Y.key):R.delete(Y.key),Ie()}),ne.append(y("td",{class:"fd-lines-grip"},...Ce?[y("span",{class:"fd-line-lead"},Ce,U)]:[U]));let Pe=fe&&c?[xe(ne,Y,c.text,dd(f.fields[c.text],fe),v.length)]:v.map(me=>xe(ne,Y,me,f.fields[me])),ae=o.createElement("td");ae.className="fd-lines-tools";let le=o.createElement("button");le.type="button",le.className="fd-line-delete",le.textContent="\xD7",le.setAttribute("aria-label",a.deleteLine),le.addEventListener("click",()=>{let me=oe().findIndex(be=>be.key===Y.key),he=oe()[me]?.values??{};if(p.confirmDelete!==!0||Pe.every(be=>Kt(be.def,he[be.name])||he[be.name]===!1))return e.removeLine(t,Y.key);_.ask(ze(a.removeAsk,{name:ze(a.lineN,{n:me+1})}),be=>{be&&e.removeLine(t,Y.key);let rt=oe(),ht=rt[be?Math.min(me,rt.length-1):me];(ht?Ee.get(ht.key)?.remove:z.querySelector("button"))?.focus()})});let se=new Map;for(let me of fe?[]:r.rowButtons??[]){let he=kt(o,me.icon),be=y("button",{type:"button",class:`fd-button fd-button-link fd-line-button${he?" fd-line-button-icon":""}`,"data-row-button":me.id,"aria-label":me.label,title:me.label});be.append(he??me.label),be.addEventListener("click",async()=>{if(!be.hasAttribute("aria-busy")){be.setAttribute("aria-busy","true");try{await e.runRowAction(r.id,me.id,Y.key)}finally{be.removeAttribute("aria-busy")}}}),se.set(me.id,be),ae.append(be)}let ce=p.copy===!0&&!fe?y("button",{type:"button",class:"fd-line-copy"},"\u29C9"):null;if(ce?.addEventListener("click",()=>{let me=oe(),he=me.findIndex(ht=>ht.key===Y.key);if(ie||he<0||me.length>=g)return;let be={...me[he].values};f.sequenceField&&delete be[f.sequenceField];let rt=e.addLine(t,be);er(e,t,f,rt,he+1),Ee.get(rt)?.cells[0]?.widget.focus()}),ce&&ae.append(ce),(r.lineOpens||r.lineForm)&&d&&!fe){let me=y("button",{type:"button",class:"fd-line-open","aria-label":a.openLine,title:a.openLine},"\u2197");me.addEventListener("click",()=>{let he=oe().find(be=>be.key===Y.key);he&&Ei(e,t,r,he,d,ie)}),ae.append(me)}return ae.append(le),ne.append(ae),{element:ne,kind:fe,cells:Pe,remove:le,grip:U,buttons:se,pick:Ce,copy:ce}}return{element:S,focus:()=>(P.querySelector("input, select, textarea")??z.querySelector("button"))?.focus(),update(Y){ie=Y.readonly;let ne=Y.value??[];z.hidden=ie||ne.length>=g,ie&&(_.element.hidden=!0),J&&(J.hidden=ne.length>0);let fe=e.getState().errors,U=new Set(h?v.filter(ae=>e.columnHidden(r.id,ae)):[]);for(let[ae,le]of b)le.hidden=U.has(ae);for(let[ae,le]of W)le.hidden=U.has(ae);let re=ne.map(ae=>ae.key).join(" "),Ce=re!==ge;ge=re;for(let[ae,le]of Ce?b:new Map){if(r.cells?.[ae]?.width)continue;let se=f.fields[ae];if(le.dataset.fit){if(!tf.has(se.type))continue;let he=ne.reduce((be,rt)=>gt(f,rt.values)?be:Math.max(be,In(se,rt.values[ae],rt.values,s).length),0);le.style.setProperty("--fd-fit-need",`${he+4}ch`);continue}let ce=ne.reduce((he,be)=>gt(f,be.values)?he:Math.max(he,In(se,be.values[ae],be.values,s).length),0),me=se.type==="many2one"?5:0;le.style.width=`${Math.min(Math.max(ce,Math.min(se.label.length,10),6),32)+4+me}ch`,le.style.minWidth=`${Math.min(Math.max(ce,6),14)+4}ch`}let Pe=new Set(ne.map(ae=>ae.key));for(let[ae,le]of Ee)Pe.has(ae)||(le.element.remove(),Ee.delete(ae));ne.forEach((ae,le)=>{let se=Ee.get(ae.key);se&&se.kind!==gt(f,ae.values)&&(se.element.remove(),se=void 0),se||(se=Xe(ae),Ee.set(ae.key,se)),P.children[le]!==se.element&&P.insertBefore(se.element,P.children[le]??null);let ce=h?e.lineState(r.id,ae.key):null;se.remove.hidden=ie||ne.length<=k||ce?.deletable===!1,se.grip.hidden=ie;let me=ze(a.lineN,{n:le+1});se.pick?.setAttribute("aria-label",ze(a.chooseLine,{name:me})),se.copy&&(se.copy.setAttribute("aria-label",ze(a.copy,{name:me})),se.copy.title=se.copy.getAttribute("aria-label"),se.copy.hidden=ie||ne.length>=g),ie?se.remove.remove():se.remove.isConnected||se.element.lastElementChild?.append(se.remove),sd(se.element,"tone",ce?.tone),se.element.classList.toggle("fd-line-bold",!!ce?.bold);for(let[he,be]of se.buttons)be.hidden=!ce?.buttons[he];se.kind&&(se.cells[0].td.colSpan=v.length-U.size);for(let he of se.cells){let be=fe[`${t}.${ae.key}.${he.name}`],rt=se.kind?void 0:ce?.cells[he.name];se.kind||(he.td.hidden=U.has(he.name)),he.widget.element.hidden=!!rt?.invisible,sd(he.td,"tone",rt?.tone),he.td.classList.toggle("fd-cell-bold",!!rt?.bold),he.error.hidden=!be,he.error.textContent=be??"",he.widget.update({value:ae.values[he.name],values:ae.values,parent:Y.values,readonly:ie||he.def.readonly===!0||he.def.compute!==void 0||!!rt?.readonly,required:he.def.required===!0||!!rt?.required,invalid:!!be})}});for(let[ae,le]of D){let se=ne.filter(ce=>!gt(f,ce.values)).reduce((ce,me)=>ce+Number(me.values[ae]??0),0);le.textContent=In(f.fields[ae],se,ne[0]?.values??{},s,Y.values,r.cells?.[ae])}for(let{id:ae,button:le}of V)le.hidden=e.node(ae).invisible;Ie(),Me&&Ee.has(Me)&&(Ee.get(Me)?.cells[0]?.widget.focus(),Me=null)}}};function sd(e,t,n){n?e.dataset[t]=n:delete e.dataset[t]}var nf='a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';function Gt(e,t){if(t.key!=="Tab")return;let n=[...e.querySelectorAll(nf)].filter(a=>!a.closest("[hidden], [inert]")&&!a.disabled);if(!n.length)return;let r=n[0],i=n[n.length-1],o=e.ownerDocument.activeElement;(t.shiftKey?o===r||!e.contains(o):o===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}var Fi=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result??"");t({name:e.name,type:e.type,size:e.size,data:i.slice(i.indexOf(",")+1)})},r.onerror=()=>n(r.error),r.readAsDataURL(e)}),fd=e=>(/\.(\w{1,5})$/.exec(e)?.[1]??"").toUpperCase();function Ri(e){let t=`${e.type} ${fd(e.name)}`.toLowerCase();return/^image\//.test(t)?"image":/pdf/.test(t)?"pdf":/sheet|excel|csv|xlsx?$|ods$/.test(t)?"sheet":/zip|rar|7z|tar|gz/.test(t)?"zip":/word|opendocument|^text|docx?$|odt$|rtf$/.test(t)?"doc":"file"}var rf=e=>/^text\/|json|xml|csv/.test(e.type),jo=e=>e.data?`data:${e.type};base64,${e.data}`:e.url??"",ud=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),cd=(e,t)=>e("span",{class:"fd-file-icon","data-kind":Ri(t),"aria-hidden":"true"},fd(t.name)||"?"),of={cards:'<path d="M3 3h8v8H3zM13 3h8v8h-8zM3 15h8M13 15h8M3 19h5M13 19h5"/>',thumbnails:'<path d="M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"/>'},af=(e,t)=>e("span",{class:"fd-file-name",dir:"auto",title:t},e("span",{},t.slice(0,-9)),t.slice(-9));function sf(e,t){let n=t.length/2,[r,i]=[Math.round(n),n/2];for(let a=t.indexOf(" ");a>=0;a=t.indexOf(" ",a+1))Math.abs(a+1-n)<i&&([r,i]=[a+1,Math.abs(a+1-n)]);let o=/^\P{L}*[\p{sc=Arabic}\p{sc=Hebrew}]/u.test(t);return e("span",{class:"fd-file-name",dir:o?"rtl":"ltr",title:t},e("span",{},t.slice(0,r)),e("span",{dir:o?"ltr":"rtl"},e("bdi",{},t.slice(r))))}function pd(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d="en",preferences:l})=>{let f=r,c=We(s,d),y=Tt[d]??Tt.en,p=Te(a),k=f.multiple===!0,g=k?f.maxFiles??1/0:1,m=e==="image",b=String(i.options?.files??(m?"thumbnails":"list")),h=b==="thumbnails"?b:"cards",v=i.options?.filesSwitch===!0,S=`${t.page.id}.${i.id}.files`,x=v?l?.get(S):null,F=i.options?.camera,E=f.type==="binary"?f.accept:["image/*"],w=p("div"),A=p("input",{type:"file",id:o,class:"fd-sr-only",accept:E?.join(","),capture:F?F==="user"?"user":"environment":void 0});A.multiple=k;let R=[!m&&E?wr(E,y.or):"",f.maxSize?Ye(k?c.upToEach:c.upToSize,{size:on(f.maxSize)}):"",k&&f.maxFiles?Ye(c.upToFiles,{max:f.maxFiles}):""].filter(Boolean),I=p("label",{class:"fd-file-pick",for:o},p("span",{class:"fd-button"},k?m?c.addPhotos:c.addFiles:m?c.uploadImage:c.upload),p("span",{class:"fd-help"},k?c.dropThem:c.dropHere)),M=p("span",{class:"fd-help fd-file-limits"},R.join(" \xB7 ")),P=k?p("span",{class:"fd-help fd-file-count"}):null,H=p("ul",{class:"fd-files",role:"list"}),D=p("button",{type:"button",class:"fd-button fd-button-link"},c.replace);D.addEventListener("click",()=>A.click());let W=hi(p,c),z=p("div",{class:"fd-help fd-file-note",role:"status"}),j=(ie,ge)=>{let oe=p("button",{type:"button","data-view":ie},kt(a,ie,of),ge);return oe.addEventListener("click",()=>(X(ie),l?.set(S,ie))),oe},V=v?p("div",{class:"fd-file-views",role:"group","aria-label":c.showFilesAs},j("list",c.asList),j(h,h==="cards"?c.asCards:c.asThumbnails)):null,B=P||V?p("div",{class:"fd-file-bar"},...P?[P]:[],...V?[V]:[]):null,$=[A,I,...R.length?[M]:[]];w.append(...B?[B]:[],H,D,W.element,z);let Q=b;function X(ie){Q=ie;let ge=ie!=="list";w.className=`fd-file fd-file-${e} fd-files-${ie==="thumbnails"?"thumbs":ie}`,I.classList.toggle("fd-image-pick",ge),ge?H.after(...$):(B??H).before(...$),V?.querySelectorAll("button").forEach(oe=>oe.setAttribute("aria-pressed",String(oe.dataset.view===ie))),Ee()}let J=!1,_=[],te,Ve=ie=>z.replaceChildren(...ie.map(ge=>p("div",{},ge))),Ie=async ie=>{if(J||!ie.length)return;let ge=[],oe=[],ke=0;for(let xe of ie){let Xe=vr(f,xe,y)??(k&&[..._,...ge].some(Y=>Y.name===xe.name)?Ye(c.alreadyAdded,{name:xe.name}):void 0);Xe?oe.push(Xe):(k?_.length:0)+ge.length<g?ge.push(xe):ke++}if(ke&&k&&oe.push(Ye(c.tooMany,{max:g,n:ke})),Ve(oe),!ge.length)return;let De=await Promise.all(ge.map(Fi));t.setValue(n,k?[..._,...De]:De[0])};A.addEventListener("change",()=>{Ie([...A.files??[]]),A.value=""}),w.addEventListener("dragover",ie=>{J||(ie.preventDefault(),w.classList.add("fd-dragging"))}),w.addEventListener("dragleave",()=>w.classList.remove("fd-dragging")),w.addEventListener("drop",ie=>{ie.preventDefault(),w.classList.remove("fd-dragging"),Ie([...ie.dataTransfer?.files??[]])}),H.addEventListener("click",ie=>{let ge=ie.target.closest("button"),oe=Number(ge?.dataset.at);if(ge){if(ge.classList.contains("fd-file-open"))return Me(oe,ge);W.ask(Ye(c.removeAsk,{name:_[oe].name}),ke=>{let De=_[oe];ke&&(t.setValue(n,k?_.filter((xe,Xe)=>Xe!==oe):null),Ve([Ye(c.removed,{name:De.name})])),(H.querySelectorAll(".fd-file-remove")[ke?Math.min(oe,_.length-1):oe]??(I.hidden?D:A)).focus()})}});function Ee(){H.replaceChildren(..._.map((ie,ge)=>p("li",{class:"fd-file-item"},p("button",{type:"button",class:"fd-file-open","data-at":String(ge),"aria-haspopup":"dialog","aria-label":`${ie.name}, ${on(ie.size)}`},...[Ri(ie)==="image"&&jo(ie)?p("img",{class:"fd-file-thumb",src:jo(ie),alt:""}):cd(p,ie)].map(oe=>Q==="cards"?p("span",{class:"fd-file-picture"},oe):oe),(Q==="cards"?sf:af)(p,ie.name),p("span",{class:"fd-file-size"},on(ie.size))),...J?[]:[p("button",{type:"button",class:"fd-file-remove","data-at":String(ge),"aria-label":Ye(c.remove,{name:ie.name})},"\xD7")])))}X(x==="list"||x===h?x:b===h?b:"list");function Me(ie,ge){let oe=_,ke="",De=p("h2",{id:`${o}-view`,class:"fd-form-dialog-title"}),xe=p("span",{class:"fd-help"}),Xe=(se,ce,me)=>{let he=p("button",{type:"button",class:"fd-button fd-file-step","aria-label":ce},me);return he.hidden=oe.length<2,he.addEventListener("click",()=>ae(ie+se)),he},Y=p("a",{class:"fd-button"},c.download),ne=p("button",{type:"button",class:"fd-dialog-close","aria-label":c.close},"\xD7"),fe=p("div",{class:"fd-file-viewer-body"}),U=p("div",{class:"fd-form-dialog fd-file-viewer",role:"dialog","aria-modal":"true","aria-labelledby":De.id,tabindex:"-1"},p("div",{class:"fd-form-dialog-head"},De,xe,Xe(-1,c.previous,"\u2039"),Xe(1,c.next,"\u203A"),Y,ne),fe),re=p("div",{class:"fd-dialog-backdrop"},U),Ce=()=>ke.startsWith("blob:")&&URL.revokeObjectURL(ke),Pe=se=>p("div",{class:"fd-file-none"},cd(p,se),p("strong",{},se.name),on(se.size),p("p",{},c.noPreview));function ae(se){ie=(se+oe.length)%oe.length;let ce=oe[ie];Ce();let me=ce.data?ud(ce.data):null;ke=me?URL.createObjectURL(new Blob([me],{type:ce.type})):ce.url??"",De.textContent=ce.name,xe.replaceChildren(p("span",{class:"fd-file-size"},on(ce.size)),oe.length>1?` \xB7 ${Ye(c.fileAt,{n:ie+1,total:oe.length})}`:""),Y.href=ke,Y.download=ce.name;let he=Ri(ce);if(he==="image")return fe.replaceChildren(p("img",{src:ke,alt:ce.name}));if(he==="pdf")return fe.replaceChildren(p("iframe",{src:ke,title:ce.name}));if(!rf(ce))return fe.replaceChildren(Pe(ce));let be=p("pre",{tabindex:"0"});fe.replaceChildren(be),(me?Promise.resolve(new TextDecoder().decode(me.subarray(0,2e5))):fetch(ke).then(rt=>rt.text())).then(rt=>be.textContent=rt.slice(0,2e5),()=>be.replaceWith(Pe(ce)))}let le=()=>{Ce(),re.remove(),(ge.isConnected?ge:H.querySelectorAll(".fd-file-open")[ie])?.focus()};ne.addEventListener("click",le),re.addEventListener("click",se=>se.target===re&&le()),U.addEventListener("keydown",se=>{let ce={ArrowLeft:-1,ArrowRight:1}[se.key];se.key==="Escape"?le():ce&&oe.length>1&&se.target.tagName!=="PRE"?ae(ie+(Wt(w)?-ce:ce)):Gt(U,se)}),ae(ie),(w.closest(".fd-form")??a.body).append(re),U.focus()}return{element:w,focus:()=>(H.querySelector("button")??(I.hidden?D:A)).focus(),update(ie){J=ie.readonly;let ge=ie.value;_=Array.isArray(ge)?ge:ge?[ge]:[];let oe=_.length>=g;Mt(I,oe||J),Mt(M,J),A.disabled=J,A.hidden=I.hidden,Mt(D,k||!_.length||J),B&&Mt(B,!_.length),P&&ft(P,_.length?k&&f.maxFiles?Ye(c.fileCountOf,{n:_.length,max:f.maxFiles}):_.length===1?c.oneFile:Ye(c.fileCount,{n:_.length}):""),tt(A,ie),!(te===ge&&H.dataset.readonly===String(J))&&(te=ge,H.dataset.readonly=String(J),Ee())}}}}var Ar=pd("binary"),Ho=pd("image");function zo(e,t){let n=Ri(t);if(n!=="image"&&n!=="pdf")return null;let r=t.data?URL.createObjectURL(new Blob([ud(t.data)],{type:t.type})):jo(t),i=e.createElement(n==="image"?"img":"iframe");return i.setAttribute("src",n==="pdf"?`${r}#view=FitH&navpanes=0`:r),i.setAttribute(n==="image"?"alt":"title",t.name),i.setAttribute("data-kind",n),{element:i,url:r,free:()=>{r.startsWith("blob:")&&URL.revokeObjectURL(r)}}}var md=new Map;function gd(e,t){let n=md.get(t);return n||(n=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),md.set(t,n)),n.format(e/100)}var $r=e=>{let{field:t,node:n,id:r,document:i,locale:o="en"}=e,a=n.options??{},s=(h,v)=>{let S=a[h]??t[h];return typeof S=="number"?S:v},d=s("min",0),l=s("max",100),f=typeof a.maxField=="string"?a.maxField:null,c=typeof a.color=="string"?a.color:"auto",y=a.showPercent!==!1,p=i.createElement("div");p.className="fd-progressbar",p.setAttribute("role","progressbar");let k=i.createElement("div");k.className="fd-progressbar-fill";let g=i.createElement("span");g.className="fd-progressbar-text",p.append(k,g);let m=null,b=p;return a.editable===!0?(m=Ot({...e,node:{...n,widget:void 0}}),p.setAttribute("aria-hidden","true"),b=i.createElement("div"),b.className="fd-progressbar-edit",b.append(p,m.element)):(p.id=r,p.setAttribute("aria-label",n.label??t.label)),{element:b,focus:()=>m?.focus(),update(h){let v=typeof h.value=="number"?h.value:0,S=f?Number(h.values[f]??0):l,x=S>d?Math.min(100,Math.max(0,(v-d)/(S-d)*100)):0,F=Math.round(x*10)/10;k.style.width=`${F}%`,p.setAttribute("aria-valuenow",String(v)),p.setAttribute("aria-valuemin",String(d)),p.setAttribute("aria-valuemax",String(S)),p.setAttribute("aria-valuetext",gd(x,o)),g.textContent=y?gd(x,o):"",p.dataset.tone=c!=="auto"?c:x<30?"danger":x<70?"warning":"success",m?.update(h)}}};function hd(e){return e==null?"":typeof e=="object"&&"label"in e?e.label:String(e)}var Tr=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options??{},a=f=>typeof o[f]=="string"?o[f]:"",s=f=>typeof o[f]=="string"?o[f]:null,d=e.type==="integer"?0:e.type==="float"||e.type==="monetary"?e.digits?.[1]??2:null,l=r.createElement("output");return l.id=n,l.className="fd-value-text",{element:l,focus:()=>{},update({value:f,values:c}){if(f==null||f===""){l.textContent="";return}let y=d!==null&&typeof f=="number"?pt(f,d,i):Ai(f,e),p=s("prefixField"),k=s("suffixField"),g=p?hd(c[p]):a("prefix"),m=k?hd(c[k]):a("suffix");l.textContent=[g,y,m].filter(b=>b!=="").join(" ")}}};function df(e,t){let[n,r]=e>=86400?[e/86400,"day"]:e>=3600?[e/3600,"hour"]:[Math.max(1,e/60),"minute"];try{return new Intl.NumberFormat(t,{style:"unit",unit:r,unitDisplay:"narrow",maximumFractionDigits:0,numberingSystem:"latn"}).format(Math.floor(n))}catch{return`${Math.floor(n)}${r[0]}`}}var $i=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,locale:s="en"})=>{let d=r.options??{},l=d.clickable===!0,f=Array.isArray(d.visibleStates)?d.visibleStates:null,c=typeof d.durationsField=="string"?d.durationsField:null,y=d.fold===!0,p=d.saves===!0,k=o.createElement("ol");k.className="fd-statusbar",k.id=i,k.setAttribute("aria-label",n.label);let g=P=>P&&typeof P=="object"&&"id"in P?`id:${String(P.id)}`:`v:${String(P)}`,m=P=>P&&typeof P=="object"&&"id"in P?String(P.id):String(P),b=n.type==="selection"?n.options.map(P=>({key:g(P.value),label:P.label,value:P.value,folded:!1})):[],h=[],v=P=>P.forEach(H=>"any"in H?v(H.any):"all"in H?v(H.all):H.valueFrom&&h.push(H.valueFrom));n.type==="many2one"&&v(n.filter??[]);let S=n.type==="selection"?"":null,x=0,F={value:void 0,readonly:!1,durations:{}},E="",w=!1,A=P=>{e.setValue(t,P.value),p&&e.settled().then(()=>e.save())};function R(){let{value:P,readonly:H,durations:D}=F,W=k.contains(o.activeElement)?o.activeElement.dataset.key:void 0,z=P==null?null:g(P),j=b.filter(_=>!f||f.some(te=>g(te)===_.key)||_.key===z);z&&!j.some(_=>_.key===z)&&P&&typeof P=="object"&&(j=[...j,{key:z,label:P.label,value:P,folded:!1}]);let V=y?j.filter(_=>_.folded&&_.key!==z):[];j=j.filter(_=>!V.includes(_));let B=j.map(_=>c?Number(D[m(_.value)]??0):0),$=JSON.stringify([j.map(_=>[_.key,_.label]),V.map(_=>_.key),B,z,H,w]);if($===E)return;E=$;let Q=j.map((_,te)=>{let Ve=o.createElement("span");Ve.textContent=_.label;let Ie=o.createElement(l?"button":"span");if(Ie instanceof HTMLButtonElement&&(Ie.type="button",Ie.disabled=H,Ie.dataset.key=_.key,Ie.addEventListener("click",()=>A(_))),Ie.append(Ve),B[te]>0){let Me=o.createElement("small");Me.className="fd-step-time",Me.textContent=df(B[te],s),Ie.title=a.timeInStep.replace("{time}",Me.textContent),Ie.append(Me)}_.key===z&&Ie.setAttribute("aria-current","step");let Ee=o.createElement("li");return Ee.append(Ie),Ee});V.length&&Q.push(I(V,H)),k.replaceChildren(...Q);let X=k.querySelector(".fd-step-menu:not([hidden])"),J=X?.previousElementSibling;if(X&&J){let _=J.getBoundingClientRect(),te=o.defaultView,Ve=getComputedStyle(k).direction==="rtl";X.style.top=`${_.bottom+4}px`,Ve?X.style.left=`${_.left}px`:X.style.right=`${Math.max(0,(te?.innerWidth??_.right)-_.right)}px`}W&&[...k.querySelectorAll("button")].find(_=>_.dataset.key===W)?.focus()}function I(P,H){let D=o.createElement("li");D.className="fd-step-more";let W=o.createElement("button");W.type="button",W.dataset.key="more",W.setAttribute("aria-haspopup","menu"),W.setAttribute("aria-expanded",String(w)),W.setAttribute("aria-label",a.moreSteps),W.title=a.moreSteps;let z=o.createElement("span");z.textContent="\u22EF",z.setAttribute("aria-hidden","true"),W.append(z);let j=o.createElement("div");j.className="fd-step-menu",j.setAttribute("role","menu"),j.hidden=!w;for(let V of P){let B=o.createElement("button");B.type="button",B.setAttribute("role","menuitem"),B.textContent=V.label,B.disabled=H||!l,B.addEventListener("click",()=>{w=!1,A(V),R()}),j.append(B)}return W.addEventListener("click",()=>{w=!w,R(),w&&k.querySelector(".fd-step-menu button:not([disabled])")?.focus()}),j.addEventListener("keydown",V=>{V.key==="Escape"&&(V.stopPropagation(),w=!1,R(),k.querySelector(".fd-step-more > button")?.focus())}),D.append(W,j),D}let M=P=>{w&&!k.contains(P.target)&&(w=!1,R())};return o.addEventListener("pointerdown",M),o.addEventListener("scroll",M,!0),{element:k,focus:()=>k.querySelector("button:not([disabled])")?.focus(),destroy(){o.removeEventListener("pointerdown",M),o.removeEventListener("scroll",M,!0)},update(P){let H=c?P.values?.[c]:null;F={value:P.value,readonly:P.readonly,durations:H&&typeof H=="object"&&!Array.isArray(H)?H:{}},R();let D=n.type==="selection"?"":JSON.stringify(h.map(W=>P.values?.[W]??null));if(S!==D){S=D;let W=++x;e.search(t,"",20).then(z=>{W===x&&(b=z.map(j=>({key:g(j),label:j.label,value:j,folded:j.folded===!0})),R())}).catch(()=>{})}}}};var lf={char:[void 0,"email","phone","url","password","time","tags","copy"],text:[void 0,"copy"],integer:[void 0],float:[void 0,"duration","percentage"],monetary:[void 0],selection:[void 0,"dot","tags"],date:[void 0,"daterange"],datetime:[void 0,"daterange"],many2one:[void 0],many2many:[void 0,"tags"],reference:[void 0],html:[void 0],json:["address"],properties:[void 0]};function Ti(e,t){return!t.widget&&(e.type==="selection"&&e.multiple||e.type==="many2many"&&t.columns?.length)?!1:lf[e.type]?.includes(t.widget)??!1}var cf=e=>!!e.closest(".fd-field[data-quiet]");function Dn(e,t=()=>e.showPicker?.()){e.addEventListener("click",()=>{if(!(e.readOnly||!cf(e)))try{t()}catch{}})}function yd(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let n=Date.UTC(t.getUTCFullYear(),0,1);return Math.ceil(((t.getTime()-n)/864e5+1)/7)}var bd=e=>String(e).padStart(2,"0"),Bo=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Yt=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t);function Mi(e,t){let n=new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate();return new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),n))}function qo(e,t){if(typeof t!="string"||!t)return null;if(e==="date"){let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(t);return r?new Date(Number(r[1]),Number(r[2])-1,Number(r[3])):null}let n=new Date(t);return Number.isNaN(n.getTime())?null:n}function Ni(e,t,n){let{form:r,name:i,id:o,document:a,locale:s="en"}=t,d=t.labels??Ze.en,l=s==="en"?"en-GB":s,f=new Intl.DateTimeFormat(l,{month:"long",year:"numeric",numberingSystem:"latn"}),c=new Intl.DateTimeFormat(l,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),y=new Intl.DateTimeFormat(l,{weekday:"short"}),p=new Intl.DateTimeFormat(l,{weekday:"long"}),k=a.createElement("button");k.type="button",k.className="fd-calendar-button";let g="http://www.w3.org/2000/svg",m=a.createElementNS(g,"svg");m.setAttribute("viewBox","0 0 16 16"),m.setAttribute("aria-hidden","true");for(let[j,V]of[["rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}],["path",{d:"M2 6.5h12M5 1.5v3M11 1.5v3"}]]){let B=a.createElementNS(g,j);for(let[$,Q]of Object.entries(V))B.setAttribute($,Q);m.append(B)}k.append(m),k.setAttribute("aria-label",d.chooseDate),k.setAttribute("aria-haspopup","dialog"),k.setAttribute("aria-expanded","false"),k.setAttribute("aria-controls",`${o}-calendar`);let b=a.createElement("div");b.className="fd-calendar",b.id=`${o}-calendar`,b.setAttribute("role","dialog"),b.hidden=!0;let h=a.createElement("div");h.className="fd-calendar-head";let v=a.createElement("button");v.type="button",v.textContent="\u2039",v.setAttribute("aria-label",d.previousMonth);let S=a.createElement("span");S.className="fd-calendar-title",S.setAttribute("aria-live","polite");let x=a.createElement("button");x.type="button",x.textContent="\u203A",x.setAttribute("aria-label",d.nextMonth),h.append(v,S,x);let F=a.createElement("table");F.className="fd-calendar-grid",F.setAttribute("role","grid"),b.append(h,F);let E=a.createElement("span");E.className="fd-date-pick",E.append(e.element,k,b);let w=new Date,A=!1;function R(j){if(n==="date")r.setValue(i,`${j.getFullYear()}-${bd(j.getMonth()+1)}-${bd(j.getDate())}`);else{let V=qo("datetime",r.getState().values[i]),B=new Date(j.getFullYear(),j.getMonth(),j.getDate(),V?.getHours()??0,V?.getMinutes()??0);r.setValue(i,B.toISOString())}W(),E.dispatchEvent(new CustomEvent("fd-picked",{bubbles:!0,detail:{value:r.getState().values[i]}}))}function I(j){let V=qo(n,r.getState().values[i]),B=new Date,$=f.format(w);S.textContent=$,b.setAttribute("aria-label",$);let Q=new Date(w.getFullYear(),w.getMonth(),1),X=Yt(Q,-((Q.getDay()+6)%7)),J=a.createElement("tr"),_=a.createElement("th");_.scope="col",_.textContent=d.weekShort,_.setAttribute("abbr",d.week),J.append(_);for(let Ie=0;Ie<7;Ie++){let Ee=Yt(X,Ie),Me=a.createElement("th");Me.scope="col",Me.textContent=y.format(Ee).replace(/\.$/,""),Me.setAttribute("abbr",p.format(Ee)),J.append(Me)}let te=a.createElement("thead");te.append(J);let Ve=a.createElement("tbody");for(let Ie=X;Ie<=new Date(w.getFullYear(),w.getMonth()+1,0);Ie=Yt(Ie,7)){let Ee=a.createElement("tr"),Me=a.createElement("th");Me.scope="row",Me.className="fd-week",Me.textContent=String(yd(Ie)),Ee.append(Me);for(let ie=0;ie<7;ie++){let ge=Yt(Ie,ie),oe=a.createElement("td"),ke=a.createElement("button");ke.type="button",ke.textContent=String(ge.getDate()),ke.setAttribute("aria-label",c.format(ge)),ke.tabIndex=Bo(ge,w)?0:-1,ge.getMonth()!==w.getMonth()&&ke.classList.add("fd-outside"),V&&Bo(ge,V)&&ke.setAttribute("aria-selected","true"),Bo(ge,B)&&ke.setAttribute("aria-current","date"),ke.disabled=A,ke.addEventListener("click",()=>R(ge)),ke.addEventListener("keydown",De=>P(De,ge)),oe.append(ke),Ee.append(oe)}Ve.append(Ee)}F.replaceChildren(te,Ve),j&&F.querySelector('button[tabindex="0"]')?.focus()}function M(j){w=j,I(!0)}function P(j,V){let B={ArrowLeft:()=>Yt(V,-1),ArrowRight:()=>Yt(V,1),ArrowUp:()=>Yt(V,-7),ArrowDown:()=>Yt(V,7),PageUp:()=>Mi(V,-1),PageDown:()=>Mi(V,1),Home:()=>Yt(V,-((V.getDay()+6)%7)),End:()=>Yt(V,6-(V.getDay()+6)%7)};B[j.key]?(j.preventDefault(),M(B[j.key]())):(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),R(V))}function H(){w=qo(n,r.getState().values[i])??new Date,b.hidden=!1,k.setAttribute("aria-expanded","true"),I(!0),D()}function D(){b.style.translate="";let j=b.getBoundingClientRect(),V=a.documentElement.clientWidth;if(!j.width||!V)return;let B=j.left<8?8-j.left:j.right>V-8?Math.max(8-j.left,V-8-j.right):0;B&&(b.style.translate=`${Math.round(B)}px 0`)}function W(){b.hidden||(b.hidden=!0,k.setAttribute("aria-expanded","false"),k.focus())}k.addEventListener("click",()=>b.hidden?H():W()),e.element instanceof HTMLInputElement&&Dn(e.element,()=>b.hidden&&H()),v.addEventListener("click",()=>{w=Mi(w,-1),I(!1)}),x.addEventListener("click",()=>{w=Mi(w,1),I(!1)}),b.addEventListener("keydown",j=>{j.key==="Escape"&&(j.preventDefault(),j.stopPropagation(),W())});let z=j=>{!b.hidden&&!E.contains(j.target)&&(b.hidden=!0,k.setAttribute("aria-expanded","false"))};return a.addEventListener("mousedown",z),{element:E,focus:()=>e.focus(),update(j){A=j.readonly,k.hidden=j.readonly,j.readonly&&(b.hidden=!0),e.update(j)},destroy(){a.removeEventListener("mousedown",z),e.destroy?.()}}}var ff=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},xd=e=>e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/^(\d)/,"p_$1")||"property";function uf(e,t){let n=ff(e);return typeof t=="boolean"?{name:e,label:n,type:"boolean"}:typeof t=="number"?{name:e,label:n,type:Number.isInteger(t)?"integer":"float"}:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)?{name:e,label:n,type:"date"}:{name:e,label:n,type:"char"}}var pf=["char","text","integer","float","boolean","date"],_o=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d}=e,l=Te(a),f=We(s,d),c=r.type==="properties"?r.definitions:void 0,y=r.type==="properties"&&!!r.definitionsFrom,p=()=>{let z=t.getState().values[n];return z&&typeof z=="object"&&!Array.isArray(z)?z:{}},k={...t,getState:()=>({...t.getState(),values:p()}),setValue:(z,j)=>t.setValue(n,{...p(),[z]:j})},g=l("div",{class:"fd-properties-list"}),m=l("div",{class:"fd-properties",role:"group"},g);i.options?.columns===2&&(m.dataset.columns="2");let h=l("div",{class:"fd-help",role:"status",hidden:""});m.append(h);let v=y&&i.options?.add===!0,S=l("button",{type:"button",class:"fd-button fd-button-link fd-property-add",hidden:""},`+ ${f.addProperty}`),x=l("input",{type:"text",class:"fd-input","aria-label":f.propertyName,placeholder:f.propertyName,autocomplete:"off"}),F=f.propertyTypes.split("|"),E=l("select",{class:"fd-input fd-select","aria-label":f.propertyType},...pf.map((z,j)=>l("option",{value:z},F[j]??z))),w=l("button",{type:"button",class:"fd-button fd-button-primary"},f.add),A=l("button",{type:"button",class:"fd-button"},f.cancel),R=l("div",{class:"fd-property-new",hidden:""},x,E,w,A);v&&m.append(S,R);let I=null,M=()=>{R.hidden=!0,S.hidden=!1};S.addEventListener("click",()=>{R.hidden=!1,S.hidden=!0,x.value="",E.value="char",x.focus()}),A.addEventListener("click",()=>{M(),S.focus()});let P=()=>{let z=x.value.trim();if(!z)return x.focus();let j=new Set(H.map(B=>B.definition.name)),V=xd(z);for(let B=2;j.has(V);B++)V=`${xd(z)}_${B}`;I=V,M(),t.addDefinition(n,{name:V,label:z,type:E.value})};w.addEventListener("click",P),R.addEventListener("keydown",z=>{z.key==="Enter"&&z.target===x?(z.preventDefault(),P()):z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),M(),S.focus())});let H=[],D="";function W(z){for(let j of H)j.widget.destroy?.();H=z.map(j=>{let V=`${o}-${j.name}`,B={type:j.type,label:j.label,...j.options?{options:j.options}:{}},$={type:"field",id:`${i.id}.${j.name}`,field:j.name},Q=Ot({...e,form:k,name:j.name,field:B,node:$,id:V});return{definition:j,widget:Q}}),g.replaceChildren(...H.map(({definition:j,widget:V})=>{let B=a.createElement("div");B.className="fd-property",B.dataset.type=j.type;let $=a.createElement("label");return $.htmlFor=`${o}-${j.name}`,$.textContent=j.label,B.append($,V.element),B}))}return y&&!t.getState().definitions[n]&&t.loadDefinitions(n),{element:m,focus:()=>(H[0]?.widget??{focus:()=>S.focus()}).focus(),destroy:()=>H.forEach(z=>z.widget.destroy?.()),update(z){let j=p(),V=y?t.getState().definitions[n]:void 0,B=y?V?.definitions??[]:c??Object.keys(j).map(Q=>uf(Q,j[Q])),$=JSON.stringify(B);$!==D&&(D=$,W(B));for(let{definition:Q,widget:X}of H)X.update({value:j[Q.name]??null,values:j,readonly:z.readonly,required:!1,invalid:!1});h.textContent=V?.loading&&!V.definitions?f.loading:V?.error??"",h.hidden=!h.textContent,v&&(z.readonly&&M(),S.hidden=z.readonly||!R.hidden),I&&H.some(Q=>Q.definition.name===I)&&(H.find(Q=>Q.definition.name===I)?.widget.focus(),I=null)}}};function Ci(e){let t=0,n=()=>{throw t},r=()=>{for(;t<e.length&&`
|
|
5
|
-
\r`.includes(e[t]);)t++},i=
|
|
6
|
-
`);return{offset:f,line:c.length,column:c[c.length-1].length+1}}}var mf=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV"]),gf=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),hf=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),bf=new Set(["left","center","right","justify","start","end"]);function Uo(e,t=globalThis.document){let n=t.createElement("template");n.innerHTML=e;let r=o=>{for(let a of[...o.childNodes]){if(a.nodeType===Node.TEXT_NODE)continue;if(a.nodeType!==Node.ELEMENT_NODE){a.remove();continue}let s=a;if(gf.has(s.tagName)){s.remove();continue}if(r(s),!mf.has(s.tagName)){s.replaceWith(...s.childNodes);continue}let d=s.tagName==="A"?s.getAttribute("href"):null,l=hf.has(s.tagName)?s.style?.textAlign?.trim().toLowerCase():"";for(let f of[...s.attributes])s.removeAttribute(f.name);d&&/^(https?:|mailto:)/i.test(d.trim())&&s.setAttribute("href",d.trim()),l&&bf.has(l)&&s.setAttribute("style",`text-align: ${l};`)}};r(n.content);let i=t.createElement("div");return i.append(n.content),i.innerHTML}function wd(e){let t=e.trim();return/^(https?:\/\/|mailto:)\S+$/i.test(t)?t:/^[^\s@:/]+@[^\s@:/]+\.[^\s@:/]+$/.test(t)?`mailto:${t}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(t)?`https://${t}`:null}var vd=[["bold","bold","<b>B</b>"],["italic","italic","<i>I</i>"],["underline","underline","<u>U</u>"],["heading","heading","<b>H</b>"],["bulletList","insertUnorderedList",'<svg viewBox="0 0 16 16"><circle cx="3" cy="4" r="1.2"/><circle cx="3" cy="8" r="1.2"/><circle cx="3" cy="12" r="1.2"/><path d="M6 4h8M6 8h8M6 12h8"/></svg>'],["numberList","insertOrderedList",'<svg viewBox="0 0 16 16"><path d="M2.5 3h1v3M2 10.5c.5-.8 2-.8 2 .2 0 .8-2 1.3-2 2.3h2M6 4h8M6 8h8M6 12h8"/></svg>'],["alignLeft","justifyLeft",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M2 6.5h8M2 9.5h12M2 12.5h8"/></svg>'],["alignCenter","justifyCenter",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M4 6.5h8M2 9.5h12M4 12.5h8"/></svg>'],["alignRight","justifyRight",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M6 6.5h8M2 9.5h12M6 12.5h8"/></svg>'],["link","createLink",'<svg viewBox="0 0 16 16"><path d="M7 9a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2L8.2 3.6M9 7a3 3 0 0 0-4.2 0L2.5 9.3a3 3 0 0 0 4.2 4.2l1.1-1.1"/></svg>']],Ko=({form:e,name:t,node:n,id:r,document:i,labels:o=Ze.en})=>{let a=i.createElement("div");a.id=r,a.className="fd-input fd-richtext",a.setAttribute("role","textbox"),a.setAttribute("aria-multiline","true"),a.setAttribute("contenteditable","true"),n.placeholder&&(a.setAttribute("data-placeholder",n.placeholder),a.setAttribute("aria-placeholder",n.placeholder));let s=n.options?.toolbar!==!1,d="";a.addEventListener("input",()=>{let c=Uo(a.innerHTML,i);d=c,e.setValue(t,c.trim()===""?null:c)}),a.addEventListener("blur",()=>{a.innerHTML!==d&&(a.innerHTML=d)});let l=s?yf(a,i,o):null,f=a;return l&&(f=i.createElement("div"),f.className="fd-richtext-box",f.setAttribute("role","group"),a.setAttribute("aria-labelledby",`${r}-label`),f.append(l.bar,l.linkRow,a)),{element:f,focus:()=>a.focus(),destroy:()=>l?.destroy(),update(c){l&&(l.bar.hidden=c.readonly,c.readonly&&(l.linkRow.hidden=!0));let y=Uo(typeof c.value=="string"?c.value:"",i);(y!==d||i.activeElement!==a)&&(a.innerHTML!==y&&(a.innerHTML=y),d=y),a.setAttribute("contenteditable",String(!c.readonly)),a.classList.toggle("fd-blank",!y.trim()),a.setAttribute("aria-readonly",String(c.readonly)),a.setAttribute("aria-invalid",String(c.invalid)),c.describedBy&&a.setAttribute("aria-describedby",c.describedBy)}}};function yf(e,t,n){let r=t.createElement("div");r.className="fd-richtext-bar",r.setAttribute("role","toolbar"),r.setAttribute("aria-label",n.formatting);let i=null,o=()=>{e.focus();let g=t.getSelection();i&&g&&(g.removeAllRanges(),g.addRange(i))},a=(g,m)=>{o(),t.execCommand?.(g,!1,m)},s=t.createElement("select");s.className="fd-richtext-style",s.setAttribute("aria-label",n.textStyle);for(let[g,m]of[["p","paragraph"],["h2","heading"],["h3","subheading"]]){let b=t.createElement("option");b.value=g,b.textContent=n[m],s.append(b)}s.addEventListener("change",()=>a("formatBlock",`<${s.value}>`));let d=t.createElement("div");d.className="fd-link-row",d.hidden=!0;let l=t.createElement("input");l.className="fd-input",l.type="url",l.placeholder="https://",l.setAttribute("aria-label",n.linkAddress);let f=t.createElement("button");f.type="button",f.className="fd-button fd-link-apply",f.textContent=n.applyLink;let c=t.createElement("button");c.type="button",c.className="fd-button fd-button-link fd-link-remove",c.textContent=n.removeLink,d.append(l,f,c),f.addEventListener("click",()=>{let g=wd(l.value);if(!g){l.setAttribute("aria-invalid","true");return}l.setAttribute("aria-invalid","false"),o(),t.execCommand?.("createLink",!1,g),d.hidden=!0}),c.addEventListener("click",()=>{o(),t.execCommand?.("unlink",!1),d.hidden=!0}),l.addEventListener("keydown",g=>{g.key==="Enter"?(g.preventDefault(),f.click()):g.key==="Escape"&&(g.preventDefault(),d.hidden=!0,o())});let y=vd.map(([g,m,b])=>{let h=t.createElement("button");return h.type="button",h.className="fd-richtext-tool",h.setAttribute("aria-label",n[g]),h.title=n[g],h.innerHTML=b,h.querySelector("svg")?.setAttribute("aria-hidden","true"),["bold","italic","underline","heading"].includes(m)&&h.setAttribute("aria-pressed","false"),h.addEventListener("mousedown",v=>v.preventDefault()),h.addEventListener("click",()=>{if(m==="heading")return a("formatBlock",s.value==="h2"?"<p>":"<h2>");if(m!=="createLink")return a(m);d.hidden=!1,l.value="",l.focus()}),h});r.append(s,...y);let p=[s,...y];p.forEach((g,m)=>g.tabIndex=m===0?0:-1),r.addEventListener("keydown",g=>{if(g.key!=="ArrowRight"&&g.key!=="ArrowLeft")return;let m=p.indexOf(t.activeElement);if(m<0)return;let b=getComputedStyle(r).direction==="rtl",h=g.key==="ArrowRight"!==b?1:-1,v=p[(m+h+p.length)%p.length];g.preventDefault(),p.forEach(S=>S.tabIndex=S===v?0:-1),v.focus()});let k=()=>{let g=t.getSelection();if(!g||!g.rangeCount||!e.contains(g.anchorNode))return;i=g.getRangeAt(0).cloneRange();let m=String(t.queryCommandValue?.("formatBlock")??"").toLowerCase().replace(/[<>]/g,"");s.value=m==="h2"||m==="h3"?m:"p";for(let b of y){let h=vd[y.indexOf(b)][1];b.hasAttribute("aria-pressed")&&b.setAttribute("aria-pressed",String(h==="heading"?m==="h2":t.queryCommandState?.(h)??!1))}};return t.addEventListener("selectionchange",k),{bar:r,linkRow:d,destroy:()=>t.removeEventListener("selectionchange",k)}}var Jo=({form:e,name:t,id:n,document:r,labels:i=Ze.en})=>{let o=r.createElement("div");o.className="fd-json";let a=r.createElement("textarea");a.id=n,a.className="fd-input fd-textarea fd-code",a.spellcheck=!1;let s=r.createElement("div");return s.className="fd-cell-error",s.hidden=!0,o.append(a,s),a.addEventListener("input",()=>{if(a.value.trim()===""){s.hidden=!0,e.setValue(t,null);return}let d=Ci(a.value);s.hidden=!d,d?s.textContent=i.invalidJsonAt.replace("{line}",String(d.line)).replace("{column}",String(d.column)):e.setValue(t,JSON.parse(a.value))}),{element:o,focus:()=>a.focus(),update(d){if(r.activeElement!==a){let l=d.value===null||d.value===void 0?"":JSON.stringify(d.value,null,2);a.value!==l&&(a.value=l)}a.readOnly=d.readonly,a.setAttribute("aria-invalid",String(d.invalid||!s.hidden))}}};var kd=new WeakMap;function xf(e){let t=kd.get(e);return t===void 0&&(t=Math.floor(Math.random()*4294967296)>>>0,kd.set(e,t)),t}function vf(e,t){let n=e^2654435769;for(let r=0;r<t.length;r++)n=Math.imul(n^t.charCodeAt(r),2246822507),n^=n>>>13;return n>>>0}function wf(e){let t=e;return()=>{t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function dn(e,t,n,r){if(r.options?.shuffle!==!0)return[...e];let i=(s,d)=>s[d]===!0,o=e.filter(s=>!i(s,"fixed")&&!i(s,"exclusive")),a=wf(vf(xf(t),n));for(let s=o.length-1;s>0;s--){let d=Math.floor(a()*(s+1));[o[s],o[d]]=[o[d],o[s]]}return o.push(...e.filter(s=>!i(s,"fixed")&&i(s,"exclusive"))),e.map(s=>i(s,"fixed")?s:o.shift())}var Sd=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=n,s=a.multiple?"checkbox":"radio",d=(m,b={},...h)=>{let v=o.createElement(m);for(let[S,x]of Object.entries(b))v.setAttribute(S,x);return v.append(...h),v},l=d("table",{id:i,class:"fd-matrix-table"});l.append(d("thead",{},d("tr",{},d("th",{scope:"col"}),...a.columns.map(m=>d("th",{scope:"col"},m.label)))));let f=d("tbody"),c=[],y=[];for(let m of dn(a.rows,e,t,r)){let b=d("tr",{role:s==="radio"?"radiogroup":"group","aria-label":m.label});y.push(b),b.append(d("th",{scope:"row"},m.label));for(let h of a.columns){let v=d("input",{type:s,name:`${i}-${m.value}`,value:String(h.value),"data-row":String(m.value),"aria-label":`${m.label}: ${h.label}`});v.addEventListener("change",()=>{if(a.onePerColumn&&v.checked)for(let S of c)S.value===v.value&&S!==v&&(S.checked=!1);g()}),c.push(v),b.append(d("td",{},d("label",{class:"fd-matrix-pick"},v,d("span",{class:"fd-matrix-column"},h.label))))}f.append(b)}l.append(f);let p=d("div",{class:"fd-matrix"},l),k=m=>a.columns.find(b=>String(b.value)===m)?.value??m;function g(){let m={};for(let b of a.rows){let h=c.filter(v=>v.dataset.row===String(b.value)&&v.checked).map(v=>k(v.value));(a.multiple?h.length:h.length===1)&&(m[String(b.value)]=a.multiple?h:h[0])}e.setValue(t,Object.keys(m).length?m:null)}return{element:p,focus:()=>(c.find(m=>m.checked)??c[0])?.focus(),update(m){let b=m.value&&typeof m.value=="object"&&!Array.isArray(m.value)?m.value:{};for(let h of c){let v=b[h.dataset.row??""],S=Array.isArray(v)?v.map(String):v==null?[]:[String(v)];h.checked=S.includes(h.value),h.disabled=m.readonly}if(l.setAttribute("aria-invalid",String(m.invalid)),s==="radio")for(let h of y)He(h,"aria-required",String(m.required));m.describedBy?l.setAttribute("aria-describedby",m.describedBy):l.removeAttribute("aria-describedby")}}};var tr=600,Mr=180,kf="#1b2a5c",Sf='"Segoe Script", "Snell Roundhand", "Brush Script MT", "Apple Chancery", cursive',Lf=e=>Math.floor(e.length*3/4)-(e.endsWith("==")?2:e.endsWith("=")?1:0),Ef=e=>e.data??e.url??"",Ld=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=We(a,s),l=Te(o),f=r.options??{},c=f.color,y=typeof c=="string"&&/^#[\da-f]{6}$/i.test(c)?c:kf,p=f.penWidth,k=typeof p=="number"&&p>0?p:3,g=f.footerLabel,m=l("canvas",{class:"fd-signature-pad",width:String(tr),height:String(Mr),role:"img","aria-label":d.signaturePad}),b=l("span",{class:"fd-signature-hint","aria-hidden":"true"},r.placeholder||d.signHere),h=l("img",{class:"fd-signature-image",alt:n.label,hidden:""}),v=l("input",{type:"text",class:"fd-input fd-signature-typed","aria-label":d.typeSignature,placeholder:d.typeSignature,autocomplete:"name"}),S=J=>l("button",{type:"button",class:"fd-button fd-button-link",hidden:""},J),x=S(d.undo),F=S(d.clearDrawing);F.classList.add("fd-signature-clear");let E=f.upload===!0?S(d.uploadSignature):null,w=l("input",{type:"file",accept:"image/*",class:"fd-sr-only",tabindex:"-1","aria-hidden":"true"}),A=l("div",{id:i,class:"fd-signature",role:"group"},l("div",{class:"fd-signature-box"},m,h,b),...typeof g=="string"&&g?[l("span",{class:"fd-signature-footer"},g)]:[],l("div",{class:"fd-signature-tools"},v,x,...E?[E,w]:[],F)),R=()=>{let J=m.getContext("2d");return J&&(J.strokeStyle=J.fillStyle=y,J.lineWidth=k,J.lineCap=J.lineJoin="round"),J},I=null,M=!1,P=null,H=[],D=null,W=()=>!H.length&&!P;function z(){let J=R();if(J){J.clearRect(0,0,tr,Mr),P&&(J.font=`italic 64px ${Sf}`,J.textAlign="center",J.textBaseline="middle",J.fillText(P,tr/2,Mr/2,tr-40));for(let _ of H){J.beginPath(),J.arc(_[0].x,_[0].y,k/2,0,Math.PI*2),J.fill();for(let te=1;te<_.length;te++)j(_[te-1],_[te])}}}function j(J,_){let te=R();te?.beginPath(),te?.moveTo(J.x,J.y),te?.lineTo(_.x,_.y),te?.stroke()}function V(){H=[],P=null,z()}function B(){if(b.hidden=!W(),W())return I=null,e.setValue(t,null);let J;try{J=m.toDataURL("image/png")}catch{return}if(!J)return;let _=J.slice(J.indexOf(",")+1);I=_,e.setValue(t,{name:"signature.png",type:"image/png",size:Lf(_),data:_,...P&&!H.length?{text:P}:{}})}function $(J){let _=m.getBoundingClientRect();return{x:(J.clientX-_.left)*tr/(_.width||tr),y:(J.clientY-_.top)*Mr/(_.height||Mr)}}m.addEventListener("pointerdown",J=>{M||J.button!==0||(J.preventDefault(),m.setPointerCapture?.(J.pointerId),D=$(J),H.push([D]),b.hidden=!0,z())}),m.addEventListener("pointermove",J=>{if(!D)return;let _=$(J);j(D,_),H[H.length-1].push(_),D=_});let Q=()=>{D&&(D=null,B())};m.addEventListener("pointerup",Q),m.addEventListener("pointercancel",Q),v.addEventListener("input",()=>{X(),H=[],P=v.value.trim()||null,z(),B()}),x.addEventListener("click",()=>{H.pop(),z(),B()}),E?.addEventListener("click",()=>w.click()),w.addEventListener("change",()=>{let J=w.files?.[0];w.value="",J&&Fi(J).then(_=>e.setValue(t,_))}),F.addEventListener("click",()=>{V(),I=null,v.value="",X(),e.setValue(t,null),v.focus()});function X(){h.hidden=!0,m.hidden=!1}return{element:A,focus:()=>(v.hidden?F:v).focus(),update(J){M=J.readonly;let _=J.value&&typeof J.value=="object"&&!Array.isArray(J.value)?J.value:null,te=o.activeElement!==v;if(_&&Ef(_)!==I){let Ve=_.data?`data:${_.type};base64,${_.data}`:_.url??"";h.getAttribute("src")!==Ve&&(h.src=Ve),h.hidden=!1,m.hidden=!0,I=null,V(),te&&(v.value=_.text??"")}else _||((I!==null||!h.hidden)&&(I=null,V(),te&&(v.value="")),X());b.hidden=M||!W()||!h.hidden,v.hidden=M,v.readOnly=M,F.hidden=M||!_,x.hidden=M||!H.length||!h.hidden,E&&(E.hidden=M),m.classList.toggle("fd-signature-locked",M),tt(A,J),v.setAttribute("aria-invalid",String(J.invalid))}}};var Go=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=We(a,s),l=Te(o),f=E=>E in n&&typeof n[E]=="number"?n[E]:void 0,c=f("min")??0,y=f("max")??100,p=typeof r.options?.step=="number"&&r.options.step>0?r.options.step:1,k=n.type==="integer"?0:n.type==="float"&&n.digits?n.digits[1]:Math.max(0,-Math.floor(Math.log10(p))),g=E=>pt(E,k,s),m=l("input",{id:i,type:"range",class:"fd-slider-input",min:String(c),max:String(y),step:String(p)}),b=l("output",{class:"fd-slider-value",for:i,"aria-hidden":"true"}),h=[r.options?.startLabel,r.options?.endLabel].map(E=>typeof E=="string"?E:""),v=(E,w)=>l("span",{class:w?"fd-slider-last":void 0},g(E),...h[w]?[l("span",{class:"fd-slider-word"},h[w])]:[]),S=l("div",{class:"fd-slider-ends","aria-hidden":"true"},v(c,0),v(y,1)),x=sn(o,d,()=>{e.setValue(t,null),m.focus()},r),F=l("div",{class:"fd-slider"},l("div",{class:"fd-slider-track"},m,b),S,x.button);return h.some(Boolean)&&m.setAttribute("aria-description",h.filter(Boolean).join(" \u2026 ")),m.addEventListener("input",()=>e.setValue(t,Number(m.value))),{element:F,focus:()=>m.focus(),update(E){let w=typeof E.value=="number"?E.value:null;F.classList.toggle("fd-slider-empty",w===null);let A=String(w??(c+y)/2);m.value!==A&&(m.value=A),b.textContent=w===null?"\u2013":g(w),m.setAttribute("aria-valuetext",w===null?d.notAnswered:g(w)),m.disabled=E.readonly,x.allow(E),x.show(w!==null),tt(m,E)}}};function Pi(e,t,n){let r=i=>e.some(o=>o.exclusive&&o.value===i);return r(n)?[n]:[...t.filter(i=>!r(i)),n]}function Oi(e,t,n){let r=n.validate?.find(o=>o.atMost!==void 0&&(o.when??!0)===!0&&o.level!=="warning")?.atMost,i=r?e("span",{class:"fd-choice-limit",role:"status"}):null;return{element:i,full(o){let a=!!r&&o>=r;return i&&ft(i,a?ze(t.upTo,{n:r}):""),a}}}function Vi(e,t){let n=t.options?.columns;n==="row"?e.classList.add("fd-choices-row"):typeof n=="number"&&n>=1&&(e.classList.add("fd-choices-columns"),e.style.setProperty("--fd-choice-columns",String(Math.min(4,Math.round(n)))))}var Ed=e=>Fd(e,!1),Rd=e=>Fd(e,!0);function Fd({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s},d){let l=We(a,s),f=Te(o),c=n.type==="selection"?n.options:[],y=n.type==="selection"&&n.ownAnswers===!0&&!d,p=`${i}-list`,k=f("input",{id:i,type:"text",class:"fd-input fd-combo-input",role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-controls":p,autocomplete:"off",placeholder:r.placeholder||l.search}),g=f("ul",{id:p,class:"fd-listbox",role:"listbox",hidden:""}),m=f("ul",{class:"fd-chips"}),b=f("div",{class:"fd-combo"},k,g),h=mi(k,g),v=d?f("div",{class:"fd-choice-search"},b):f("div",{class:"fd-tags fd-choice-tags"},m,b),S=()=>e.getState().values[t],x=()=>Array.isArray(S())?S():[],F=W=>e.setValue(t,W),E=W=>c.find(z=>z.value===W)?.label??(W==null?"":String(W)),w=[],A=-1,R=!1;function I(){g.replaceChildren(...w.map((W,z)=>{let j=f("li",{id:`${p}-${z}`,role:"option",class:`fd-option${z===A?" fd-active":""}`,"aria-selected":String(z===A)},W.label);return j.addEventListener("mousedown",V=>V.preventDefault()),j.addEventListener("click",()=>H(W)),j})),w.length||g.append(f("li",{class:"fd-empty"},l.noResults)),He(k,"aria-activedescendant",A>=0?`${p}-${A}`:null)}function M(){let W=k.value.trim(),z=d&&W===E(S())?"":W.toLowerCase(),j=new Set(x());w=c.filter(V=>!j.has(V.value)&&V.label.toLowerCase().includes(z)),y&&z&&!j.has(W)&&!c.some(V=>V.label.toLowerCase()===z)&&w.push({value:W,label:ze(l.createNamed,{name:W})}),A=-1,I(),h.show(),k.setAttribute("aria-expanded","true")}function P(){h.hide(),A=-1,k.setAttribute("aria-expanded","false"),k.removeAttribute("aria-activedescendant")}function H(W){if(d)return k.value=W.label,F(W.value),P();k.value="",F(Pi(c,x(),W.value)),o.activeElement===k?M():P()}d||k.addEventListener("focus",()=>!R&&M()),k.addEventListener("click",()=>!R&&g.hidden&&M()),k.addEventListener("input",()=>!R&&M()),k.addEventListener("blur",()=>{P(),d&&!R&&(k.value.trim()?k.value=E(S()):F(null))}),k.addEventListener("keydown",W=>{if(!R)switch(W.key){case"ArrowDown":case"ArrowUp":{if(W.preventDefault(),g.hidden)return M();if(!w.length)return;let z=W.key==="ArrowDown";A=A===-1?z?0:w.length-1:(A+(z?1:-1)+w.length)%w.length,I(),g.children[A]?.scrollIntoView?.({block:"nearest"});return}case"Enter":{let z=w[A]??(k.value.trim()?w[0]:void 0);if(g.hidden||!z)return;W.preventDefault(),H(z);return}case"Escape":g.hidden||W.preventDefault(),P();return;case"Backspace":!d&&k.value===""&&x().length&&F(x().slice(0,-1));return}});let D="";return{element:v,focus:()=>k.focus(),update(W){if(R=W.readonly,R&&P(),tt(k,W),He(k,"aria-required",String(W.required)),d){k.readOnly=R,o.activeElement!==k&&(k.value=E(W.value));return}let z=Array.isArray(W.value)?W.value:[];k.hidden=R;let j=JSON.stringify([R,z]);j!==D&&(D=j,m.replaceChildren(...z.map(V=>{let B=E(V),$=f("li",{class:"fd-chip"},f("span",{class:"fd-chip-label"},B));if(!R){let Q=f("button",{type:"button",class:"fd-chip-remove","aria-label":ze(l.remove,{name:B})},"\xD7");Q.addEventListener("click",()=>F(x().filter(X=>X!==V))),$.append(Q)}return $})),g.hidden||M())}}}var Rf='<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="M21 16l-5-5-9 9"/></svg>',Ad=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=We(a,s),l=Te(o),f=n.type==="selection"&&n.multiple===!0,c=n.type==="selection"?n.options:[],y=dn(c,e,t,r),p=r.options??{},k=p.showLabels===!1,g=l("div",{id:i,class:`fd-image-choices${k?" fd-image-choices-bare":""}`,role:f?"group":"radiogroup","data-size":p.imageSize,"data-fit":p.imageFit});Vi(g,r);let m=f?Oi(l,d,r):null,b=y.map(F=>{let E=F.image?l("img",{src:F.image,alt:F.alt??"",loading:"lazy",draggable:"false"}):l("span",{class:"fd-image-card-blank"});F.image||(E.innerHTML=Rf);let w=l("button",{type:"button",class:"fd-image-card",role:f?"checkbox":"radio","aria-checked":"false","aria-label":k?F.label:void 0},l("span",{class:"fd-image-card-picture"},E),l("span",{class:"fd-image-card-words"},F.label));return w.addEventListener("click",()=>v(F)),g.append(w),w}),h=()=>e.getState().values[t];function v(F){if(!f)return e.setValue(t,F.value);let E=Array.isArray(h())?h():[],w=new Set(E.includes(F.value)?E.filter(A=>A!==F.value):Pi(c,E,F.value));e.setValue(t,c.filter(A=>w.has(A.value)).map(A=>A.value))}let S=!1;f||g.addEventListener("keydown",F=>{if(S)return;let E=b.indexOf(F.target);if(E===-1)return;let w=Wt(g),A={ArrowDown:1,ArrowUp:-1,ArrowRight:w?-1:1,ArrowLeft:w?1:-1},R=F.key==="Home"?0:F.key==="End"?b.length-1:F.key in A?(E+A[F.key]+b.length)%b.length:-1;R!==-1&&(F.preventDefault(),v(y[R]),b[R].focus())});let x=f?null:sn(o,d,()=>{e.setValue(t,null),b[0]?.focus()},r);return m?.element&&g.append(m.element),{element:x?l("div",{class:"fd-choices-box"},g,x.button):g,focus:()=>(b.find(F=>F.getAttribute("aria-checked")==="true")??b[0])?.focus(),update(F){S=F.readonly;let E=new Set(Array.isArray(F.value)?F.value:[F.value]),w=f?-1:Math.max(0,y.findIndex(R=>E.has(R.value))),A=!!m?.full(Array.isArray(F.value)?F.value.length:0);b.forEach((R,I)=>{let M=E.has(y[I].value);R.setAttribute("aria-checked",String(M)),R.tabIndex=f||I===w?0:-1,R.disabled=S||A&&!M&&!y[I].exclusive}),x?.allow(F),x?.show(y.some(R=>E.has(R.value))),tt(g,F)}}};var Ff=4,$d=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=We(a,s),l=Te(o),f=dn(n.type==="selection"?n.options:[],e,t,r),c=l("ol",{class:"fd-rank-list"}),y=gi(l),p=r.options?.top,k=typeof p=="number"&&p>=1&&p<f.length?Math.floor(p):0,g=l("div",{class:"fd-rank-pool"}),m=l("button",{type:"button",class:"fd-button fd-rank-keep"},d.keepOrder);m.addEventListener("click",()=>e.setValue(t,S.map(M=>M.option.value)));let b=l("div",{id:i,class:"fd-ranking",role:"group"},...k?[l("div",{class:"fd-choice-limit"},ze(d.upTo,{n:k})),g,c]:[c,m],y.element),h=f.map(M=>{let P=M.label,H=l("span",{class:"fd-rank-place","aria-hidden":"true"}),D=l("button",{type:"button",class:"fd-rank-move fd-rank-up","aria-label":ze(d.moveUp,{label:P})},"\u2191"),W=l("button",{type:"button",class:"fd-rank-move fd-rank-down","aria-label":ze(d.moveDown,{label:P})},"\u2193"),z=l("span",{class:"fd-rank-grip","aria-hidden":"true"}),j=l("span",{class:"fd-rank-tools"},D,W),V=l("li",{class:"fd-rank-item","data-value":String(M.value)},z,H,l("span",{class:"fd-rank-words"},P),j),B={option:M,element:V,place:H,up:D,down:W};if(k){let $=l("button",{type:"button",class:"fd-rank-pick"},P);$.addEventListener("click",()=>!v&&S.length<k&&E([...S,B],B));let Q=l("button",{type:"button",class:"fd-rank-move fd-rank-out","aria-label":ze(d.remove,{name:P})},"\xD7");Q.addEventListener("click",()=>{y.say(ze(d.removed,{name:P})),e.setValue(t,S.filter(X=>X!==B).map(X=>X.option.value))}),j.append(Q),g.append($),B.pick=$}return D.addEventListener("click",()=>w(B,-1,"up")),W.addEventListener("click",()=>w(B,1,"down")),V.addEventListener("pointerdown",$=>R(B,$)),B}),v=!1,S=[...h],x=null;function F(M){for(S=M,M.forEach((P,H)=>{c.children[H]!==P.element&&c.insertBefore(P.element,c.children[H]??null),P.place.textContent=String(H+1),P.up.disabled=H===0,P.down.disabled=H===M.length-1});c.children.length>M.length;)c.lastElementChild?.remove()}function E(M,P){y.say(ze(d.movedTo,{label:P.option.label,n:M.indexOf(P)+1,total:M.length})),e.setValue(t,M.map(H=>H.option.value))}function w(M,P,H){let D=S.indexOf(M),W=D+P;if(v||W<0||W>=S.length)return;let z=[...S];z.splice(D,1),z.splice(W,0,M),x=M.element.contains(o.activeElement)?{item:M,which:H==="up"&&W===0||H==="down"&&W===z.length-1?H==="up"?"down":"up":H}:null,E(z,M),A()}function A(){if(!x)return;let{item:M,which:P}=x;x=null,M[P].focus()}c.addEventListener("keydown",M=>{if(v||!M.altKey||M.key!=="ArrowUp"&&M.key!=="ArrowDown")return;let P=h.find(H=>H.element.contains(M.target));P&&(M.preventDefault(),w(P,M.key==="ArrowUp"?-1:1,M.key==="ArrowUp"?"up":"down"))});function R(M,P){if(v||P.button!==0||P.target.closest("button")||P.pointerType==="touch"&&!P.target.closest(".fd-rank-grip"))return;let H=P.clientY,D=[...S],W=!1;M.element.setPointerCapture?.(P.pointerId);let z=V=>{if(!W&&Math.abs(V.clientY-H)<Ff)return;W||(W=!0,M.element.classList.add("fd-rank-lifted")),V.preventDefault();let B=S.filter(Q=>Q!==M),$=B.filter(Q=>{let X=Q.element.getBoundingClientRect();return X.top+X.height/2<V.clientY}).length;S.indexOf(M)!==$&&F([...B.slice(0,$),M,...B.slice($)])},j=()=>{M.element.removeEventListener("pointermove",z),M.element.removeEventListener("pointerup",j),M.element.removeEventListener("pointercancel",j),M.element.classList.remove("fd-rank-lifted"),S.some((V,B)=>V!==D[B])&&E(S,M)};M.element.addEventListener("pointermove",z),M.element.addEventListener("pointerup",j),M.element.addEventListener("pointercancel",j)}function I(M){let P=(Array.isArray(M)?M:[]).map(H=>h.find(D=>D.option.value===H)).filter(H=>!!H);return k?P.slice(0,k):Array.isArray(M)?[...new Set([...P,...S])]:S}return F(k?[]:S),{element:b,focus:()=>(h.find(M=>M.pick&&!M.pick.hidden&&!M.pick.disabled)?.pick??(S[0]?.down.disabled?S[0]?.up:S[0]?.down))?.focus(),update(M){v=M.readonly,b.classList.toggle("fd-ranking-locked",v);let P=I(M.value);(P.length!==S.length||P.some((H,D)=>H!==S[D])||!k&&!c.children.length)&&F(P);for(let H of h)H.up.hidden=H.down.hidden=v,H.pick&&(H.pick.hidden=S.includes(H),H.pick.disabled=v||S.length>=k,H.element.querySelector(".fd-rank-out").hidden=v);m.hidden=v||Array.isArray(M.value)&&M.value.length>0,A(),tt(b,M)}}};var Td={street:["addressStreet","street-address"],line2:["addressLine2","address-line2"],city:["addressCity","address-level2"],region:["addressRegion","address-level1"],postcode:["addressPostcode","postal-code"],country:["addressCountry","country"]},Af=e=>typeof e=="string"&&e in Td,$f="AC AN BU CP CQ CS DD DG DY EA EU EZ FX HV IC NH QO RH SU TA TP UK UN VD XA XB YD YU ZR ZZ",Yo={};function Xo(e){if(!Yo[e]){let t=new Intl.DisplayNames([e],{type:"region",fallback:"none"}),n=[];for(let r=65;r<91;r++)for(let i=65;i<91;i++){let o=String.fromCharCode(r,i),a=!$f.includes(o)&&t.of(o);a&&n.push([o,a])}Yo[e]=n.sort((r,i)=>r[1].localeCompare(i[1],e))}return Yo[e]}var Md=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=We(o,a),d=Te(i),l=n.options??{},f=l.parts,c=Array.isArray(f)?f.filter(Af):["street","city","postcode","country"],y=Array.isArray(l.requiredParts)?l.requiredParts:[],p=typeof l.country=="string"?l.country:"",k=d("div",{id:r,class:"fd-address",role:"group"}),g=(b,h)=>{let v=e.getState().values[t],S=v&&typeof v=="object"&&!Array.isArray(v)?{...v}:{};S[b]=h,p&&c.includes("country")&&S.country===void 0&&(S.country=p);let x=Object.fromEntries(Object.entries(S).filter(([,E])=>typeof E!="string"||E.trim()!=="")),F=Object.keys(x);e.setValue(t,F.length&&(b==="country"||F.join()!=="country"||x.country!==p)?x:null)},m=c.map(b=>{let[h,v]=Td[b],S={id:`${r}-${b}`,class:"fd-input","data-part":b,autocomplete:b==="street"&&c.includes("line2")?"address-line1":v,"aria-required":y.includes(b)?"true":void 0},x=b==="country"?d("select",S,d("option",{value:""}),...Xo(a).map(([F,E])=>d("option",{value:F},E))):d("input",{type:"text",...S});return x.addEventListener(b==="country"?"change":"input",()=>g(b,x.value)),b==="country"&&x.classList.add("fd-select"),k.append(d("div",{class:`fd-address-part fd-address-${b}${y.includes(b)?" fd-required":""}`},d("label",{class:"fd-address-label",for:x.id},s[h]),x)),{part:b,input:x}});return{element:k,focus:()=>m[0]?.input.focus(),update(b){let h=b.value&&typeof b.value=="object"&&!Array.isArray(b.value)?b.value:{};for(let{part:v,input:S}of m){let x=typeof h[v]=="string"?h[v]:v==="country"&&h.country===void 0?p:"";S instanceof HTMLSelectElement?(x&&![...S.options].some(F=>F.value===x)&&S.append(d("option",{value:x},x)),S.disabled=b.readonly):S.readOnly=b.readonly,i.activeElement!==S&&S.value!==x&&(S.value=x),S.setAttribute("aria-invalid",String(b.invalid&&(!y.length||y.includes(v)&&!x.trim())))}tt(k,b)}}};var Nd=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0,Cd=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s,dialogs:d,widgets:l})=>{let f=We(a,s),c=Te(o),y=n,p=r.options??{},k=Nd(p.min)??0,g=Nd(p.max)??1/0,m=typeof p.itemLabel=="string"&&p.itemLabel.trim()?p.itemLabel.trim():null,b=D=>m?`${m} ${D}`:ze(f.entry,{n:D}),h=(r.columns??Object.keys(y.fields)).filter(D=>y.fields[D]&&y.fields[D].type!=="one2many"&&D!==y.sequenceField&&D!==y.lineKinds?.field),v=c("div",{class:"fd-repeat-list"}),S=c("button",{type:"button",class:"fd-button fd-repeat-add"},typeof p.addLabel=="string"&&p.addLabel?p.addLabel:f.addAnother),x=gi(c),F=c("div",{id:i,class:"fd-repeat",role:"group"},v,S,x.element),E=new Map,w=()=>e.getState().values[t]??[],A=!1,R=null;for(let D=w().length;D<k;D++)e.addLine(t);S.addEventListener("click",()=>{if(A||w().length>=g)return;let D=e.addLine(t);R=()=>E.get(D)?.fields[0]?.widget.focus(),H()});function I(D){let W=`${i}-${D.key}-title`,z=c("span",{id:W,class:"fd-repeat-title"}),j=c("button",{type:"button",class:"fd-repeat-remove"},"\xD7"),V=(te,Ve,Ie)=>{let Ee=c("button",{type:"button",class:"fd-repeat-tool"},te);return Ee.addEventListener("click",Ie),[Ee,Ve]},B=()=>w().findIndex(te=>te.key===D.key),$=[V("\u2191","moveUp",()=>M(D.key,B()-1)),V("\u2193","moveDown",()=>M(D.key,B()+1)),V("\u29C9","copy",()=>P(D.key))],Q=d&&(r.lineOpens||r.lineForm)?c("button",{type:"button",class:"fd-repeat-tool fd-line-open","aria-label":f.openLine,title:f.openLine},"\u2197"):null;Q?.addEventListener("click",()=>{let te=w().find(Ve=>Ve.key===D.key);te&&d&&Ei(e,t,r,te,d,A)});let X=c("div",{class:"fd-repeat-fields"}),J=c("div",{class:"fd-repeat-card",role:"group","aria-labelledby":W,"data-line":D.key},c("div",{class:"fd-repeat-head"},z,...$.map(([te])=>te),...Q?[Q]:[],j),X),_=h.map(te=>{let Ve=y.fields[te],Ie=`${i}-${D.key}-${te}`,Ee={type:"field",id:`${r.id}.${D.key}.${te}`,field:te},Me=Ot({form:Li(e,t,D.key),name:te,field:Ve,node:Ee,id:Ie,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ie=c("label",{class:"fd-repeat-label",for:Ie},Ve.label);["INPUT","SELECT","TEXTAREA"].includes(Me.element.tagName)||ie.addEventListener("click",()=>Me.focus());let ge=c("div",{class:"fd-cell-error",hidden:""});return X.append(c("div",{class:"fd-repeat-field"},ie,Me.element,ge)),{name:te,def:Ve,widget:Me,error:ge}});return j.addEventListener("click",()=>{let te=w(),Ve=te.findIndex(ie=>ie.key===D.key);if(A||Ve===-1||te.length<=k)return;let Ie=z.textContent??"";e.removeLine(t,D.key),x.say(ze(f.removed,{name:Ie}));let Ee=w(),Me=Ee[Math.min(Ve,Ee.length-1)];R=()=>Me?E.get(Me.key)?.fields[0]?.widget.focus():S.focus(),H()}),{element:J,title:z,remove:j,tools:$,fields:_}}function M(D,W){let z=w().findIndex(B=>B.key===D);if(A||W<0||W>=w().length||W===z)return;let j=E.get(D)?.title.textContent??"";er(e,t,y,D,W);let V=z>W&&W>0||W===w().length-1?0:1;E.get(D)?.tools[V][0].focus(),x.say(ze(f.movedTo,{label:j,n:W+1,total:w().length}))}function P(D){let W=w(),z=W.findIndex(B=>B.key===D);if(A||z<0||W.length>=g)return;let j={...W[z].values};y.sequenceField&&delete j[y.sequenceField];let V=e.addLine(t,j);er(e,t,y,V,z+1),E.get(V)?.fields[0]?.widget.focus()}function H(){let D=R;R=null,D?.()}return{element:F,focus:()=>([...E.values()].find(D=>D.element===v.firstElementChild)?.fields[0]?.widget??S).focus(),update(D){A=D.readonly;let W=D.value??[],z=e.getState().errors,j=new Set(W.map(V=>V.key));for(let[V,B]of E)if(!j.has(V)){B.element.remove();for(let $ of B.fields)$.widget.destroy?.();E.delete(V)}W.forEach((V,B)=>{let $=E.get(V.key);$||E.set(V.key,$=I(V)),v.children[B]!==$.element&&v.insertBefore($.element,v.children[B]??null),$.title.textContent=b(B+1),$.remove.setAttribute("aria-label",ze(f.remove,{name:$.title.textContent})),$.remove.hidden=A||W.length<=k||r.lineDelete!==void 0&&!e.lineState(r.id,V.key).deletable;for(let[Q,X]of $.tools)Q.setAttribute("aria-label",ze(f[X],{label:$.title.textContent,name:$.title.textContent})),Q.hidden=A||(X==="moveUp"?B===0:X==="moveDown"?B===W.length-1:W.length>=g);for(let Q of $.fields){let X=z[`${t}.${V.key}.${Q.name}`];Q.error.hidden=!X,Q.error.textContent=X??"",Q.widget.update({value:V.values[Q.name],values:V.values,parent:D.values,readonly:A||Q.def.readonly===!0,required:Q.def.required===!0,invalid:!!X})}}),S.hidden=A||W.length>=g,tt(F,D)}}};function Zo(e,{form:t,name:n,field:r,document:i,labels:o,locale:a},s){let d=r.type==="char"||r.type==="text"?r.size:void 0;if(!d||t.page.fields[n]!==r)return e;let l=Te(i),f=l("div",{class:"fd-count","aria-hidden":"true"}),c=l("div",{class:"fd-sr-only","aria-live":"polite"}),y;return{...e,element:l("div",{class:"fd-counted"},e.element,f,c),update(p){e.update(p);let k=s.value.length;ft(f,`${k} / ${d}`),f.classList.toggle("fd-count-near",k>=d*.9),Mt(f,p.readonly),i.activeElement===s&&(clearTimeout(y),y=setTimeout(()=>ft(c,ze(We(o,a).charactersLeft,{n:d-k})),700))}}}function Pd(e,t){let n=t.options?.rows;return typeof n=="number"&&(e.rows=n),t.options?.autoGrow===!1?()=>{}:()=>{e.style.height="",e.scrollHeight&&(e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)}}function Ii(e,t,n){let r=n.options??{},i=t.type==="char";(i?[r.min,r.max]:"min"in t?[t.min,t.max]:[]).forEach((a,s)=>{typeof a=="string"&&(e[s?"max":"min"]=i?a:yn(a)+(t.type==="datetime"?s?"T23:59":"T00:00":""))}),typeof r.step=="number"&&(e.step=String(r.step*60))}function Od(e,t){let{form:n,name:r,document:i}=t,o=We(t.labels,t.locale),a=i.createElement("div"),s=i.createElement("div"),d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link",d.textContent=o.choicesFailed,d.onclick=()=>n.loadChoices(r),s.setAttribute("role","status"),a.style.cssText="display:grid;gap:4px";let l=new Map,f,c=null,y=p=>{f?.destroy?.(),f=e({...t,field:{...t.field,options:p}}),f.element.getAttribute("role")&&f.element.setAttribute("aria-labelledby",`${t.id}-label`),a.replaceChildren(f.element,s,d)};return y([]),n.getState().choices[r]||n.loadChoices(r),{element:a,focus:()=>f.focus(),destroy:()=>f.destroy?.(),update(p){let k=n.getState().choices[r];if(k?.options&&k.options!==c){c=k.options;for(let m of c)l.set(m.value,m.label);y(c)}f.update(p);let g=c&&!t.field.other?[p.value].flat().filter(m=>m!=null&&!c?.some(b=>b.value===m)):[];s.className=k?.loading?"fd-help":"fd-warning",s.textContent=k?.loading?o.loadingChoices:g.length?Ye(o.notOffered,{name:g.map(m=>l.get(m)??String(m)).join(", ")}):"",s.hidden=!s.textContent,d.hidden=!k?.error}}}var Vd=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a})=>{let s=We(o,a),d=Te(i),l=d("div",{id:r,class:"fd-points fd-yes-no",role:"radiogroup"}),f=!1,c=[!0,!1].map(p=>{let k=n.options?.[p?"yesLabel":"noLabel"],g=d("button",{type:"button",role:"radio"},typeof k=="string"&&k?k:p?s.yes:s.no);return g.addEventListener("click",()=>e.setValue(t,p)),l.append(g),g});l.addEventListener("keydown",p=>{let k=c.indexOf(p.target);f||k===-1||!p.key.startsWith("Arrow")||(p.preventDefault(),e.setValue(t,k===1),c[1-k].focus())});let y=sn(i,s,()=>{e.setValue(t,null),c[0].focus()},n);return{element:d("div",{class:"fd-choices-box"},l,y.button),focus:()=>(c.find(p=>p.getAttribute("aria-checked")==="true")??c[0]).focus(),update(p){f=p.readonly;let k=p.value===!0?0:p.value===!1?1:-1;c.forEach((g,m)=>{He(g,"aria-checked",String(m===k)),g.classList.toggle("fd-on",m===k),g.tabIndex=m===Math.max(0,k)?0:-1,g.disabled=f}),He(l,"aria-required",String(p.required)),y.allow(p),y.show(k!==-1),tt(l,p)}}};var Tf=new Set(["info","success","warning","danger","muted"]),Di=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options?.tones??{},a=r.createElement("span");return a.id=n,a.className="fd-value-badge",a.hidden=!0,{element:a,focus:()=>{},update({value:s,values:d}){let l=At(e,s,d,i);a.textContent!==l&&(a.textContent=l),a.hidden=l==="";let f=s!==null&&typeof s=="object"&&"id"in s?String(s.id):String(s),c=o[f];typeof c=="string"&&Tf.has(c)?a.dataset.tone=c:delete a.dataset.tone}}};var Id=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=Ze.en,locale:s,dialogs:d})=>{let l=n,f=Te(o),c=l.fields??{},y=(r.columns??[]).filter(W=>c[W]),p=W=>typeof r.options?.[W]=="string"&&r.options[W].trim()?r.options[W]:null,k=!!d&&d.canOpen(l.relation),g=f("tr",{},...y.map(W=>f("th",{scope:"col","data-column":W},c[W].label)),f("th",{class:"fd-lines-tools"})),m=f("tbody"),b=f("table",{class:"fd-lines-table fd-links-table"},f("thead",{},g),m),h=f("button",{type:"button",class:"fd-button fd-button-link fd-lines-add","data-add":"line"},`+ ${p("addLabel")??a.addLine}`),v=f("div",{class:"fd-lines-adds"},h),S=p("emptyLabel"),x=S?f("div",{class:"fd-help fd-lines-empty"},S):null,F=f("div",{class:"fd-lines fd-links",id:i,role:"group"},f("div",{class:"fd-lines-scroll"},b),...x?[x]:[],v),E=new Map,w=new Set,A=!1,R=[],I=()=>e.getState().values[t]??[];function M(W,z=!1){let j=W.map(V=>V.id).filter(V=>z||!E.has(String(V))&&!w.has(String(V)));if(j.length){for(let V of j)w.add(String(V));e.linkedValues(t,j,y).then(V=>{for(let{id:B,values:$}of V)E.set(String(B),$);for(let B of j)w.delete(String(B));D()},()=>j.forEach(V=>w.delete(String(V))))}}h.addEventListener("click",async()=>{if(!d||A)return;let W=await d.searchMore({title:l.label,search:(z,j)=>e.search(t,z,j)});!W||I().some(z=>z.id===W.id)||e.setValue(t,[...I(),{id:W.id,label:W.label}])});async function P(W){let z=await d?.openRecord(l.relation,{recordId:W.id,title:W.label});z&&(z.label!==W.label&&e.setValue(t,I().map(j=>j.id===W.id?{id:j.id,label:z.label}:j)),M([W],!0))}function H(W){let z=E.get(String(W.id)),j=y.map((B,$)=>{let Q=z?At(c[B],z[B]??null,z,s):$===0?W.label:"";return f("td",{"data-column":B},f("span",{class:"fd-value-text"},Q))}),V=f("td",{class:"fd-lines-tools"});if(k){let B=f("button",{type:"button",class:"fd-line-open","aria-label":ze(a.openNamed,{name:W.label}),title:a.openLine},"\u2197");B.addEventListener("click",()=>{P(W)}),V.append(B)}if(!A){let B=f("button",{type:"button",class:"fd-line-delete","aria-label":ze(a.remove,{name:W.label})},"\xD7");B.addEventListener("click",()=>e.setValue(t,I().filter($=>$.id!==W.id))),V.append(B)}return f("tr",{"data-record":String(W.id)},...j,V)}function D(){let W=o.activeElement,z=F.contains(W)?W.closest("tr")?.dataset.record:void 0;m.replaceChildren(...R.map(H)),z&&m.querySelector(`tr[data-record="${CSS.escape(z)}"] button`)?.focus()}return{element:F,focus:()=>(m.querySelector("button")??h).focus(),update(W){let z=W.value??[],j=z!==R||W.readonly!==A;A=W.readonly,R=z,v.hidden=A||!d,x&&(x.hidden=z.length>0),He(F,"aria-invalid",String(W.invalid)),He(F,"aria-describedby",W.describedBy||null),j&&D(),M(z)}}};var Qo=({form:e,name:t,field:n,id:r,document:i})=>{let o=Te(i),a=n.type==="selection"?n.options.map(c=>({value:c.value,label:c.label})):[{value:!1,label:""},{value:!0,label:n.label}],s=o("div",{id:r,class:"fd-priority",role:"radiogroup"}),d=a.slice(1).map((c,y)=>{let p=o("button",{type:"button",role:"radio",class:"fd-priority-star","aria-label":c.label,title:c.label,"data-value":String(c.value)},"\u2605");return p.addEventListener("click",()=>e.setValue(t,l(e.getState().values[t])===y+1?a[0].value:c.value)),s.append(p),p}),l=c=>Math.max(0,a.findIndex(y=>y.value===c)),f=!1;return s.addEventListener("keydown",c=>{if(f)return;let y=Wt(s)?"ArrowLeft":"ArrowRight",p=Wt(s)?"ArrowRight":"ArrowLeft",k=c.key===y||c.key==="ArrowUp"?1:c.key===p||c.key==="ArrowDown"?-1:0;if(!k)return;c.preventDefault();let g=Math.min(a.length-1,Math.max(0,l(e.getState().values[t])+k));e.setValue(t,a[g].value),d[Math.max(0,g-1)]?.focus()}),{element:s,focus:()=>(d.find(c=>c.tabIndex===0)??d[0])?.focus(),update(c){f=c.readonly;let y=l(c.value);d.forEach((p,k)=>{He(p,"aria-checked",String(y===k+1)),p.classList.toggle("fd-on",k<y);let g=y===k+1||y===0&&k===0?0:-1;p.tabIndex!==g&&(p.tabIndex=g),p.disabled!==c.readonly&&(p.disabled=c.readonly)}),tt(s,c)}}};function nr(e,t,n,r){let i=e.ownerDocument,o=d=>{!n.contains(d.target)&&!t.contains(d.target)&&s()};function a(){n.hidden=!1,t.setAttribute("aria-expanded","true");let d=e.closest(".fd-form");if(d){d.append(n),Object.assign(n.style,{position:"absolute",top:"0px",left:"0px",right:"auto"});let[l,f,c]=[t.getBoundingClientRect(),n.getBoundingClientRect(),n.offsetWidth],y=getComputedStyle(e).direction==="rtl",p=i.documentElement.clientWidth||c,k=Math.max(8,Math.min(y?l.right-c:l.left,p-c-8));Object.assign(n.style,{top:`${l.bottom-f.top+4}px`,left:`${k-f.left}px`})}i.addEventListener("pointerdown",o,!0)}function s(){if(!n.hidden){if(n.hidden=!0,t.setAttribute("aria-expanded","false"),n.parentElement!==e){e.append(n);for(let d of["position","top","left","right"])n.style.removeProperty(d)}i.removeEventListener("pointerdown",o,!0),r()}}return{open:a,close:s,isOpen:()=>!n.hidden}}var Mf={normal:"muted",grey:"muted",blocked:"danger",red:"danger",done:"success",green:"success",waiting:"warning"},Dd=["muted","danger","success","warning","info"],Nf=new Set(["info","success","warning","danger","muted"]),Wd=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=Te(o),s=n.type==="selection"?n.options:[],d=r.options?.tones??{},l=(F,E)=>{let w=d[String(F)];return typeof w=="string"&&Nf.has(w)?w:Mf[String(F)]??Dd[E%Dd.length]},f=()=>a("span",{class:"fd-dot","aria-hidden":"true"}),c=a("button",{type:"button",id:i,class:"fd-dot-button","aria-haspopup":"menu","aria-expanded":"false","aria-controls":`${i}-menu`},f()),y=a("span",{class:"fd-dot-label","data-quiet-words":r.options?.label===!0?void 0:""}),p=s.map((F,E)=>{let w=a("div",{role:"menuitemradio",class:"fd-dot-item",tabindex:"-1","data-tone":l(F.value,E)},f(),F.label);return w.addEventListener("click",()=>x(E)),w}),k=a("div",{id:`${i}-menu`,role:"menu",class:"fd-dot-menu","aria-label":n.label,hidden:""},...p),g=a("span",{class:"fd-dot-box"},c,y,k),m=()=>s.findIndex(F=>F.value===e.getState().values[t]),b=!1,h=nr(g,c,k,()=>{b&&c.focus(),b=!1});function v(F=Math.max(0,m())){h.open(),p[F]?.focus()}function S(F){b=F,h.close()}function x(F){e.setValue(t,s[F].value),S(!0)}return c.addEventListener("click",()=>k.hidden?v():S(!0)),c.addEventListener("keydown",F=>{F.key!=="ArrowDown"&&F.key!=="ArrowUp"&&F.key!=="Enter"&&F.key!==" "||(F.preventDefault(),v(F.key==="ArrowUp"?m()<0?p.length-1:m():void 0))}),k.addEventListener("keydown",F=>{let E=p.indexOf(o.activeElement),w={ArrowDown:E+1,ArrowUp:E-1,Home:0,End:p.length-1}[F.key];w!==void 0?(F.preventDefault(),p[(w+p.length)%p.length]?.focus()):F.key==="Enter"||F.key===" "?(F.preventDefault(),E>=0&&x(E)):F.key==="Escape"?(F.preventDefault(),F.stopPropagation(),S(!0)):F.key==="Tab"&&S(!0)}),{element:g,focus:()=>c.focus(),destroy:()=>S(!1),update(F){let E=s.findIndex(A=>A.value===F.value),w=E<0?"":s[E].label;He(c,"aria-label",w?`${n.label}: ${w}`:n.label),He(c,"title",w||null),He(c,"data-tone",E<0?"muted":l(F.value,E)),ft(y,w),p.forEach((A,R)=>He(A,"aria-checked",String(R===E))),c.disabled!==F.readonly&&(c.disabled=F.readonly),F.readonly&&S(!1),tt(c,F)}}};var Wi=["transparent","#f06050","#f4a460","#f7cd1f","#6cc1ed","#814968","#eb7e7f","#2c8397","#475577","#d6145f","#30c381","#9365b8"],Cf=({form:e,name:t,field:n,id:r,document:i,labels:o,locale:a})=>{let s=Te(i),d=We(o,a).colourNames.split("|"),l=s("button",{type:"button",id:r,class:"fd-colour-button","aria-haspopup":"true","aria-expanded":"false","aria-controls":`${r}-palette`}),f=Wi.map((h,v)=>{let S=s("button",{type:"button",role:"radio",class:"fd-colour","aria-label":d[v]??String(v),title:d[v]??String(v),tabindex:"-1","data-colour":String(v)});return S.style.setProperty("--fd-swatch",h),S.addEventListener("click",()=>b(v)),S}),c=s("div",{id:`${r}-palette`,role:"radiogroup",class:"fd-colour-palette","aria-label":n.label,hidden:""},...f),y=s("span",{class:"fd-colour-box"},l,c),p=!1,k=nr(y,l,c,()=>{p&&l.focus(),p=!1}),g=()=>{let h=e.getState().values[t];return typeof h=="number"&&h>=0&&h<Wi.length?h:0};function m(h){p=h,k.close()}function b(h){e.setValue(t,h),m(!0)}return l.addEventListener("click",()=>{if(k.isOpen())return m(!0);k.open(),f[g()].focus()}),c.addEventListener("keydown",h=>{let v=f.indexOf(i.activeElement),S=Wt(y)?"ArrowLeft":"ArrowRight",x=Wt(y)?"ArrowRight":"ArrowLeft",F=h.key===S||h.key==="ArrowDown"?v+1:h.key===x||h.key==="ArrowUp"?v-1:h.key==="Home"?0:h.key==="End"?f.length-1:null;F!==null?(h.preventDefault(),f[(F+f.length)%f.length].focus()):(h.key==="Enter"||h.key===" ")&&v>=0?(h.preventDefault(),b(v)):h.key==="Escape"?(h.preventDefault(),h.stopPropagation(),m(!0)):h.key==="Tab"&&m(!0)}),{element:y,focus:()=>l.focus(),destroy:()=>m(!1),update(h){let v=typeof h.value=="number"&&h.value>=0&&h.value<Wi.length?h.value:0;l.style.setProperty("--fd-swatch",Wi[v]),l.classList.toggle("fd-colour-none",v===0),He(l,"aria-label",`${n.label}: ${d[v]??v}`),He(l,"title",d[v]??String(v)),f.forEach((S,x)=>He(S,"aria-checked",String(x===v))),l.disabled!==h.readonly&&(l.disabled=h.readonly),h.readonly&&m(!1),tt(l,h)}}},Pf=({form:e,name:t,id:n,document:r})=>{let i=Te(r),o=i("input",{id:n,type:"color",class:"fd-colour-input"}),a=i("span",{class:"fd-colour-code",dir:"ltr"});return o.addEventListener("input",()=>e.setValue(t,o.value)),{element:i("span",{class:"fd-colour-box"},o,a),focus:()=>o.focus(),update(s){let d=typeof s.value=="string"?s.value:"",l=/^#[0-9a-f]{6}$/i.test(d)?d.toLowerCase():"#000000";o.value!==l&&(o.value=l),ft(a,d),o.disabled!==s.readonly&&(o.disabled=s.readonly),tt(o,s)}}},ea=e=>e.field.type==="char"?Pf(e):Cf(e);var ta=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Te(o),l=We(a,s),f=n.type==="text",c=f?d("textarea",{id:i,class:"fd-input fd-textarea",rows:"3"}):d("input",{id:i,type:"text",class:"fd-input",autocomplete:"off"});r.placeholder&&(c.placeholder=r.placeholder),c.addEventListener("input",()=>e.setValue(t,c.value===""?null:c.value));let y=d("button",{type:"button",class:"fd-button fd-copy-button",hidden:""},l.copyValue),p=d("span",{class:"fd-sr-only",role:"status"}),k;return y.addEventListener("click",async()=>{let g=String(e.getState().values[t]??"");if(g){try{await navigator.clipboard.writeText(g)}catch{c.select(),o.execCommand?.("copy")}ft(y,l.copied),ft(p,l.copied),clearTimeout(k),k=setTimeout(()=>{ft(y,l.copyValue),ft(p,"")},2e3)}}),{element:d("span",{class:`fd-copy${f?" fd-copy-long":""}`},c,y,p),focus:()=>c.focus(),destroy:()=>clearTimeout(k),update(g){let m=g.value===null||g.value===void 0?"":String(g.value);c.value!==m&&(c.value=m),c.readOnly!==g.readonly&&(c.readOnly=g.readonly),y.hidden=!m,tt(c,g)}}};var zi=e=>String(e).padStart(2,"0"),Xt=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),ji=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate())),Hi=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Of='<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="11" rx="1.5"></rect><path d="M2 6.5h12M5 1.5v3M11 1.5v3"></path></svg>',na=e=>`${e.getFullYear()}-${zi(e.getMonth()+1)}-${zi(e.getDate())}`,ra=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=Te(o),l=We(a,s),f=n.type==="datetime"?"datetime":"date",c=typeof r.options?.endField=="string"?r.options.endField:null,y=c?e.page.fields[c]?.label??c:"",p=s==="en"?"en-GB":s,k=new Intl.DateTimeFormat(p,{month:"long",year:"numeric",numberingSystem:"latn"}),g=new Intl.DateTimeFormat(p,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),m=new Intl.DateTimeFormat(p,{weekday:"short"}),b=X=>{if(typeof X!="string"||!X)return"";if(f==="date")return X.slice(0,10);let J=new Date(X);return Number.isNaN(J.getTime())?"":`${na(J)}T${zi(J.getHours())}:${zi(J.getMinutes())}`},h=X=>{let J=b(X),_=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(J);return _?new Date(Number(_[1]),Number(_[2])-1,Number(_[3]),Number(_[4]??0),Number(_[5]??0)):null},v=(X,J)=>{if(f==="date")return na(X);let _=h(J);return new Date(X.getFullYear(),X.getMonth(),X.getDate(),_?.getHours()??0,_?.getMinutes()??0).toISOString()},S=(X,J,_)=>{let te=d("input",{type:f==="date"?"date":"datetime-local",class:"fd-input fd-range-input","aria-label":J,..._?{id:_}:{}});return te.addEventListener("input",()=>{if(!te.value)return e.setValue(X,null);if(f==="date")return e.setValue(X,te.value);let Ve=new Date(te.value);Number.isNaN(Ve.getTime())||e.setValue(X,Ve.toISOString())}),Dn(te,()=>M.hidden&&B()),te},x=S(t,n.label,i),F=c?S(c,y):null,E=d("button",{type:"button",class:"fd-calendar-button fd-range-button","aria-label":l.chooseDate,"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${i}-range`});E.innerHTML=Of;let w=d("button",{type:"button","aria-label":l.previousMonth},"\u2039"),A=d("button",{type:"button","aria-label":l.nextMonth},"\u203A"),R=d("span",{class:"fd-calendar-title","aria-live":"polite"}),I=d("table",{class:"fd-calendar-grid",role:"grid"}),M=d("div",{id:`${i}-range`,class:"fd-calendar fd-range-calendar",role:"dialog",hidden:""},d("div",{class:"fd-calendar-head"},w,R,A),I),P=d("div",{class:"fd-range",role:"group"},d("span",{class:"fd-range-box"},x,...F?[d("span",{class:"fd-range-arrow","aria-hidden":"true"},"\u2192"),F]:[]),E,M),H=new Date,D=null,W=null;function z(X){let J=e.getState().values;if(!c)return e.setValue(t,v(X,J[t])),$();if(!D)return D=X,H=X,j(!0);let[_,te]=X<D?[X,D]:[D,X];D=null,e.setValue(t,v(_,J[t])),e.setValue(c,v(te,J[c])),$()}function j(X){let J=e.getState().values,_=D??h(J[t]),te=D?W&&W>=D?W:null:c?h(J[c]):null,Ve=k.format(H);R.textContent=Ve,M.setAttribute("aria-label",Ve);let Ie=new Date(H.getFullYear(),H.getMonth(),1),Ee=Xt(Ie,-((Ie.getDay()+6)%7)),Me=d("tr",{},...Array.from({length:7},(ge,oe)=>d("th",{scope:"col"},m.format(Xt(Ee,oe)).replace(/\.$/,"")))),ie=d("tbody");for(let ge=Ee;ge<=new Date(H.getFullYear(),H.getMonth()+1,0);ge=Xt(ge,7)){let oe=d("tr");for(let ke=0;ke<7;ke++){let De=Xt(ge,ke),xe=d("button",{type:"button","data-day":na(De),"aria-label":g.format(De),tabindex:Hi(De,H)?"0":"-1"},String(De.getDate()));De.getMonth()!==H.getMonth()&&xe.classList.add("fd-outside");let Xe=Hi(De,_)||Hi(De,te);Xe&&xe.setAttribute("aria-selected","true"),_&&te&&De>_&&De<te&&!Xe&&xe.classList.add("fd-in-range"),Hi(De,new Date)&&xe.setAttribute("aria-current","date"),xe.addEventListener("click",()=>z(De)),xe.addEventListener("pointerenter",()=>{if(D){W=De;for(let Y of I.querySelectorAll("button[data-day]")){let ne=h(Y.dataset.day);Y.classList.toggle("fd-in-range",!!ne&&ne>D&&ne<De)}}}),xe.addEventListener("keydown",Y=>V(Y,De)),oe.append(d("td",{},xe))}ie.append(oe)}I.replaceChildren(d("thead",{},Me),ie),X&&I.querySelector('button[tabindex="0"]')?.focus()}function V(X,J){let _=Wt(P),te={ArrowLeft:()=>Xt(J,_?1:-1),ArrowRight:()=>Xt(J,_?-1:1),ArrowUp:()=>Xt(J,-7),ArrowDown:()=>Xt(J,7),PageUp:()=>ji(J,-1),PageDown:()=>ji(J,1),Home:()=>Xt(J,-((J.getDay()+6)%7)),End:()=>Xt(J,6-(J.getDay()+6)%7)};te[X.key]?(X.preventDefault(),H=te[X.key](),D&&(W=H),j(!0)):(X.key==="Enter"||X.key===" ")&&(X.preventDefault(),z(J))}function B(){D=null,W=null,H=h(e.getState().values[t])??new Date,M.hidden=!1,E.setAttribute("aria-expanded","true"),j(!0)}function $(){M.hidden||(M.hidden=!0,D=null,E.setAttribute("aria-expanded","false"),E.focus())}E.addEventListener("click",()=>M.hidden?B():$()),w.addEventListener("click",()=>(H=ji(H,-1),j(!1))),A.addEventListener("click",()=>(H=ji(H,1),j(!1))),M.addEventListener("keydown",X=>{X.key==="Escape"&&(X.preventDefault(),X.stopPropagation(),$())});let Q=X=>{M.hidden||P.contains(X.target)||(M.hidden=!0,D=null,E.setAttribute("aria-expanded","false"))};return o.addEventListener("mousedown",Q),{element:P,focus:()=>x.focus(),destroy:()=>o.removeEventListener("mousedown",Q),update(X){for(let[J,_]of[[x,X.value],...F&&c?[[F,X.values[c]]]:[]]){let te=b(_);o.activeElement!==J&&J.value!==te&&(J.value=te),J.readOnly!==X.readonly&&(J.readOnly=X.readonly),J.classList.toggle("fd-blank",!te)}E.hidden=X.readonly,X.readonly&&(M.hidden=!0),He(P,"aria-labelledby",null),tt(x,X)}}};var ia=e=>String(e).padStart(2,"0");function Vf(e){let t=Math.max(0,Math.floor(e));return`${ia(Math.floor(t/3600))}:${ia(Math.floor(t%3600/60))}:${ia(t%60)}`}var jd=e=>{if(typeof e!="string"||!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t},oa=({field:e,node:t,id:n,document:r})=>{let i=Te(r),o=e.type==="datetime",a=!o&&typeof t.options?.startField=="string"?t.options.startField:null,s=t.options?.unit==="minutes"?60:3600,d=i("span",{class:"fd-timer-time"}),l=i("span",{id:n,role:"timer",class:"fd-timer"},i("span",{class:"fd-timer-dot","aria-hidden":"true"}),d);He(l,"aria-label",e.label);let f=0,c=null,y,p=()=>ft(d,Vf(f+(c===null?0:(Date.now()-c)/1e3))),k=()=>{clearInterval(y),y=void 0};return{element:l,focus:()=>{},destroy:k,update(g){f=!o&&typeof g.value=="number"?g.value*s:0,c=o?jd(g.value):a?jd(g.values[a]):null,c!==null?l.dataset.running="true":delete l.dataset.running,p(),c===null?k():y||(y=setInterval(()=>l.isConnected?p():k(),1e3))}}};var Hd=e=>typeof e=="number"&&e>0?e:480,If=e=>/^https?:\/\//i.test(e);function Df(e){if(e.data){let t=Uint8Array.from(atob(e.data),n=>n.charCodeAt(0));return URL.createObjectURL(new Blob([t],{type:e.type||"application/pdf"}))}return e.url??""}var zd=e=>{let t=Te(e.document),n=We(e.labels,e.locale),r=Ar({...e,node:{...e.node,widget:void 0}}),i=t("iframe",{class:"fd-embed-frame"});i.style.height=`${Hd(e.node.options?.height)}px`;let o=t("div",{class:"fd-embed-none"},n.noDocument),a=t("div",{class:"fd-embed-view"}),s,d="",l=()=>d.startsWith("blob:")&&URL.revokeObjectURL(d);return{element:t("div",{class:"fd-embed fd-embed-pdf"},r.element,a),focus:()=>r.focus(),destroy(){l(),r.destroy?.()},update(f){r.update(f);let c=Array.isArray(f.value)?f.value[0]:f.value;c!==s&&(s=c,l(),d=c?Df(c):"",d&&(i.title=c?.name??e.field.label,i.src=d)),a.replaceChildren(...d?[i]:f.readonly?[o]:[])}}},Bd=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Te(o),l=We(a,s),f=d("input",{id:i,type:"url",class:"fd-input",autocomplete:"url"});r.placeholder&&(f.placeholder=r.placeholder),f.addEventListener("input",()=>e.setValue(t,f.value===""?null:f.value));let c=d("iframe",{class:"fd-embed-frame",title:n.label,sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",referrerpolicy:"no-referrer",loading:"lazy"});c.style.height=`${Hd(r.options?.height)}px`;let y=d("a",{class:"fd-button fd-button-link fd-embed-open",target:"_blank",rel:"noopener noreferrer",hidden:""},l.openInNewTab),p=d("div",{class:"fd-embed-view"}),k="";return{element:d("div",{class:"fd-embed"},d("div",{class:"fd-embed-bar"},f,y),p),focus:()=>f.focus(),update(g){let m=typeof g.value=="string"?g.value.trim():"";o.activeElement!==f&&f.value!==(typeof g.value=="string"?g.value:"")&&(f.value=typeof g.value=="string"?g.value:""),f.readOnly!==g.readonly&&(f.readOnly=g.readonly),f.hidden=g.readonly;let b=If(m)?m:"";b!==k&&(k=b,b&&(c.src=b),p.replaceChildren(...b?[c]:[])),y.hidden=!b,b&&(y.href=b)}}};var ln=e=>typeof e=="number"?e:Number(e)||0;function Wf(e,t){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=e;if(Array.isArray(n.subtotals)||n.groups_by_subtotal){let i=n.groups_by_subtotal??{},o=n.subtotals??[{name:t,amount:ln(n.amount_untaxed)}];return{subtotals:(n.subtotals_order??o.map(s=>s.name)).map(s=>({name:s,amount:ln(o.find(d=>d.name===s)?.amount??n.amount_untaxed),groups:(i[s]??[]).map((d,l)=>({name:String(d.tax_group_name??""),amount:ln(d.tax_group_amount),at:[s,l]}))})),total:ln(n.amount_total)}}let r=(Array.isArray(n.groups)?n.groups:[]).map((i,o)=>({name:String(i.name??""),amount:ln(i.amount),at:o}));return{subtotals:[{name:t,amount:ln(n.untaxed),groups:r}],total:ln(n.total)}}var qd=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=Te(i),d=We(o,a),l=n.options??{},f=typeof l.currencyField=="string"?l.currencyField:null,c=typeof l.currency=="string"?l.currency:null,y=s("tbody"),p=s("table",{id:r,class:"fd-tax-totals"},y),k="";function g(m,b){let h=JSON.parse(JSON.stringify(e.getState().values[t])),v=m.amount;if(Array.isArray(m.at)){let[S,x]=m.at;h.groups_by_subtotal[S][x].tax_group_amount=b,h.amount_total=Math.round((ln(h.amount_total)+b-v)*100)/100}else h.groups[m.at].amount=b,h.total=Math.round((ln(h.total)+b-v)*100)/100;e.setValue(t,h)}return{element:p,focus:()=>p.querySelector("input")?.focus(),update(m){let b=Wf(m.value,d.untaxed),h=f?m.values[f]:null,v=c??(h&&typeof h=="object"&&"label"in h?h.label:typeof h=="string"?h:""),S=A=>/^[A-Z]{3}$/.test(v)?Vn(A,v,2,a):pt(A,2,a),x=l.editable===!0&&!m.readonly,F=JSON.stringify([b,v,x]);if(F===k||p.contains(i.activeElement))return;k=F;let E=(A,R,I)=>s("tr",{class:I},s("th",{scope:"row"},A),s("td",{},R)),w=[];for(let A of b?.subtotals??[]){w.push(E(A.name,S(A.amount),"fd-tax-subtotal"));for(let R of A.groups){if(!x){w.push(E(R.name,S(R.amount),"fd-tax-group"));continue}let I=s("input",{type:"text",class:"fd-input fd-number-input",inputmode:"decimal",autocomplete:"off","aria-label":R.name});I.value=pt(R.amount,2,a),I.addEventListener("change",()=>{let M=Jt(I.value.trim(),a);/^-?(\d+\.?\d*|\.\d+)$/.test(M)&&g(R,Number(M))}),w.push(E(R.name,I,"fd-tax-group"))}}b&&w.push(E(d.total,S(b.total),"fd-tax-total")),y.replaceChildren(...w)}}};var Bi=e=>typeof e=="string"?e:typeof e=="number"?String(e):"";function jf(e){return(Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.content)?e.content:[]).filter(n=>n&&typeof n=="object").map(n=>({date:Bi(n.date),amount:typeof n.amount=="number"?n.amount:Number(n.amount)||0,name:Bi(n.name),journal:Bi(n.journal_name??n.journal),memo:Bi(n.ref??n.memo),id:n.account_payment_id??n.payment_id??n.id??null}))}var _d=({node:e,id:t,document:n,labels:r,locale:i="en",dialogs:o})=>{let a=Te(n),s=We(r,i),d=e.options??{},l=typeof d.currencyField=="string"?d.currencyField:null,f=typeof d.dueField=="string"?d.dueField:null,c=typeof d.model=="string"?d.model:"account.payment",y=a("ul",{class:"fd-payments-list"}),p=a("div",{class:"fd-payment-due",hidden:""}),k=a("div",{id:t,class:"fd-payments"},y,p),g={type:"date",label:""},m="",b=null;return{element:k,focus:()=>y.querySelector("button")?.focus(),destroy:()=>b?.(),update(h){let v=l?h.values[l]:null,S=v&&typeof v=="object"&&"label"in v?v.label:typeof v=="string"?v:"",x=A=>/^[A-Z]{3}$/.test(S)?Vn(A,S,2,i):pt(A,2,i),F=jf(h.value),E=f?h.values[f]:null,w=JSON.stringify([F,S,E]);w!==m&&(m=w,b?.(),y.replaceChildren(...F.map((A,R)=>{let I=x(A.amount),M=a("button",{type:"button",class:"fd-payment-info","aria-label":ze(s.paymentOf,{amount:I}),"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${t}-payment-${R}`},"i"),P=(B,$)=>$?[a("dt",{},B),a("dd",{},$)]:[],H=A.id!==null&&o?.canOpen(c)?a("button",{type:"button",class:"fd-button fd-button-link fd-payment-open"},s.openPayment):null,D=a("div",{id:`${t}-payment-${R}`,class:"fd-payment-details",role:"dialog","aria-label":ze(s.paymentOf,{amount:I}),tabindex:"-1",hidden:""},a("strong",{},A.name||I),a("span",{class:"fd-payment-details-amount"},I),a("dl",{},...P(s.journal,A.journal),...P(s.memo,A.memo)),...H?[H]:[]),W=a("li",{class:"fd-payment"},M,a("span",{class:"fd-payment-date"},ze(s.paidOn,{date:At(g,A.date,{},i)})),a("span",{class:"fd-payment-amount"},I),D),z=!1,j=nr(W,M,D,()=>{z&&M.focus(),z=!1,b===V&&(b=null)}),V=()=>j.close();return M.addEventListener("click",()=>{if(j.isOpen())return V();b?.(),j.open(),b=V,(H??D).focus()}),D.addEventListener("keydown",B=>{B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),z=!0,V())}),H?.addEventListener("click",()=>{V(),o?.openRecord(c,{recordId:A.id,title:A.name||I})}),W})),p.hidden=E==null,p.replaceChildren(a("span",{},s.amountDue),a("strong",{},typeof E=="number"?x(E):"")))}}};function Ot(e,t=e.widgets??{}){let n=e.widgets===t?e:{...e,widgets:t},{field:r,node:i}=n,o=[i.widget?`${r.type}.${i.widget}`:null,r.type==="selection"&&r.multiple?"selection.checkboxes":null,r.type==="many2many"&&i.columns?.length?"many2many.table":null,r.type].filter(a=>a!==null);for(let a of o){let s=t[a]??Jd[a];if(s)return r.type==="selection"&&r.optionsFrom?Od(s,n):s(n)}return Kf(n)}function at(e,t,n={},...r){let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}function cn(e,t){He(e,"aria-invalid",String(t.invalid)),He(e,"aria-required",e.getAttribute("role")==="group"?null:String(t.required)),He(e,"aria-describedby",t.describedBy||null)}var Ui=e=>e==null?"":String(e);function rr(e){return t=>{let{form:n,name:r,field:i,node:o,id:a,document:s}=t,d=at(s,"input",{id:a,type:e,class:"fd-input",autocomplete:/^(email|tel|url)$/.test(e)?e:"off"});return i.type==="char"&&i.size!==void 0&&(d.maxLength=i.size),e==="time"&&Ii(d,i,o),o.placeholder&&(d.placeholder=o.placeholder),d.addEventListener("input",()=>n.setValue(r,d.value===""?null:d.value)),Zo({element:d,focus:()=>d.focus(),update(l){let f=Ui(l.value);d.value!==f&&(d.value=f),d.readOnly!==l.readonly&&(d.readOnly=l.readonly),cn(d,l)}},t,d)}}var Hf=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=at(a,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),i.placeholder&&(s.placeholder=i.placeholder);let d=Pd(s,i);return s.addEventListener("input",()=>{d(),t.setValue(n,s.value===""?null:s.value)}),Zo({element:s,focus:()=>s.focus(),update(l){let f=Ui(l.value);s.value!==f&&(s.value=f,d()),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),cn(s,l)}},e,s)},zf=/^-?(\d+\.?\d*|\.\d+)$/,Bf=/^-?\.?$/,aa=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,locale:s="en"}=e,d=r.type==="integer",l=d?0:(r.type==="float"||r.type==="monetary"?r.digits?.[1]:void 0)??2,f=I=>typeof I=="number"?pt(I,l,s):Ui(I),c=at(a,"input",{id:o,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});c.inputMode=d?"numeric":"decimal",i.placeholder&&(c.placeholder=i.placeholder);let y=I=>{let M=Jt(I.trim(),s);if(M==="")return null;if(zf.test(M))return Number(M);if(!Bf.test(M))return M};c.addEventListener("input",()=>{let I=y(c.value);I!==void 0&&t.setValue(n,I)}),c.addEventListener("focus",()=>{queueMicrotask(()=>{let I=t.getState().values[n];if(a.activeElement!==c||c.readOnly||typeof I!="number"||c.value!==f(I))return;let M=c.value,[P,H]=[c.selectionStart??M.length,c.selectionEnd??M.length],D=W=>Lr(M.slice(0,W),s).length;c.value=Lr(M,s),c.setSelectionRange(D(P),D(H))})}),c.addEventListener("blur",()=>{c.value=f(t.getState().values[n])});let p=i.options??{},k=r.type==="monetary"?r.currencyField:void 0,g=k?t.page.fields[k]:void 0,m=k&&g&&p.pickCurrency===!0?Ot({...e,name:k,field:g,node:{type:"field",id:`${i.id}.currency`,field:k},id:`${o}-currency`}):null;m&&g&&m.element.querySelector("input, select")?.setAttribute("aria-label",g.label),m?.element.matches("input, select")&&g&&m.element.setAttribute("aria-label",g.label);let b=r.type==="monetary"?r.money:void 0,h=p.symbol?p.symbol==="after":b?.at?b.at==="after":r.type==="monetary"&&Fr(r.currency??"USD",s).after,v=(I,M)=>at(a,"span",{class:`fd-unit${r.type==="monetary"?" fd-currency":""}`,id:`${o}-unit${M}`},I),S=r.type==="monetary"&&!m?v("",0):null,[x,F]=["prefix","suffix"].map((I,M)=>typeof p[I]=="string"&&p[I]?v(p[I],M+1):null),E=(h?null:m?.element??S)??x,w=(h?m?.element??S:null)??F,A=[E,w].filter(I=>!!I&&I!==m?.element);return{element:E||w?at(a,"span",{class:`fd-number${h?" fd-currency-after":""}${m?" fd-currency-picked":""}`},...[E,c,w].filter(I=>!!I)):c,focus:()=>c.focus(),update(I){let M=a.activeElement===c,P=y(c.value),H=P===void 0||P===I.value;if(!(M&&H)){let D=M&&!I.readonly&&typeof I.value=="number"?No(I.value,l,s):f(I.value);c.value!==D&&(c.value=D)}if(c.readOnly!==I.readonly&&(c.readOnly=I.readonly),cn(c,{...I,describedBy:[I.describedBy,...A.map(D=>D.id)].filter(Boolean).join(" ")}),m&&k&&m.update({value:I.values[k],values:I.values,readonly:I.readonly,required:!1,invalid:!1}),S&&r.type==="monetary"){let D=Qn(r,I.values,I.parent)??"";ft(S,/^[A-Z]{3}$/.test(D)&&b?.currency!=="code"?Fr(D,s).text:D)}for(let[D,W]of[[E,"start"],[w,"end"]])D&&A.includes(D)&&c.style.setProperty(`padding-inline-${W}`,`calc(var(--fd-pad-x) + ${D.textContent?.length??0}ch + 4px)`)}}};function sa(e="box"){let t=e==="switch"?{class:"fd-switch",role:"switch"}:{class:e==="tick"?"fd-checkbox fd-tick":"fd-checkbox"};return({form:n,name:r,id:i,document:o})=>{let a=at(o,"input",{id:i,type:"checkbox",...t});return a.addEventListener("change",()=>n.setValue(r,a.checked)),{element:a,focus:()=>a.focus(),update(s){a.checked=s.value===!0,a.disabled!==s.readonly&&(a.disabled=s.readonly),cn(a,s)}}}}function _i(e){return e.type==="selection"?e.options:[]}var qf=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=i.options?.search;if(s===!0||s!==!1&&_i(r).length>15)return Rd(e);let d=dn(_i(r),t,n,i),l=at(a,"option",{value:""}),f=at(a,"select",{id:o,class:"fd-input fd-select"},l);return d.forEach((c,y)=>f.append(at(a,"option",{value:String(y)},c.label))),f.addEventListener("change",()=>t.setValue(n,f.value===""?null:d[Number(f.value)].value)),{element:f,focus:()=>f.focus(),update(c){let y=d.findIndex(p=>p.value===c.value);f.value=y===-1?"":String(y),l.hidden=c.required&&y!==-1,f.disabled!==c.readonly&&(f.disabled=c.readonly),cn(f,c)}}};function Ud(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=dn(_i(r),t,n,i),f=We(s,d),c=at(a,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"});Vi(c,i);let y=e==="checkbox"?Oi(Te(a),f,i):null,p=l.map((x,F)=>{let E=at(a,"input",{type:e,name:o,value:String(F),id:`${o}-${F}`});return c.append(at(a,"label",{class:"fd-choice",for:`${o}-${F}`},E,at(a,"span",{},x.label))),E}),k=r.type==="selection"&&r.other===!0,g=k?at(a,"input",{type:e,name:o,value:"other",id:`${o}-other`}):null,m=k?at(a,"input",{type:"text",class:"fd-input fd-other-input","aria-label":f.otherAnswer,autocomplete:"off"}):null;g&&m&&(c.append(at(a,"div",{class:"fd-choice fd-choice-other"},at(a,"label",{class:"fd-choice-other-pick",for:`${o}-other`},g,at(a,"span",{},f.other)),m)),m.addEventListener("input",()=>{g.checked||(g.checked=!0),b(g)}),g.addEventListener("change",()=>{g.checked&&m.focus()})),y?.element&&c.append(y.element);function b(x){if(e==="checkbox"&&x instanceof HTMLInputElement&&x.checked){let E=l[p.indexOf(x)]?.exclusive===!0;p.forEach((w,A)=>w!==x&&(E||l[A].exclusive)&&(w.checked=!1)),E&&g&&(g.checked=!1)}let F=g?.checked&&m&&m.value.trim()?m.value:null;if(e==="radio"){let E=p.findIndex(w=>w.checked);t.setValue(n,E!==-1?l[E].value:F)}else{let E=new Set(l.filter((w,A)=>p[A].checked));t.setValue(n,[..._i(r).filter(w=>E.has(w)).map(w=>w.value),...F!==null?[F]:[]])}}c.addEventListener("change",x=>{x.target!==m&&b(x.target)});let h=new Set(l.map(x=>x.value)),v=()=>p.some(x=>x.checked)||g?.checked===!0,S=e==="radio"?sn(a,f,()=>{for(let x of[...p,g])x&&(x.checked=!1);t.setValue(n,null),(p[0]??g)?.focus()},i):null;return{element:S?at(a,"div",{class:"fd-choices-box"},c,S.button):c,focus:()=>(p.find(x=>x.checked)??(g?.checked?m:null)??p[0])?.focus(),update(x){let F=Array.isArray(x.value)?x.value:[x.value],E=!!y?.full(Array.isArray(x.value)?x.value.length:0);if(p.forEach((w,A)=>{w.checked=F.includes(l[A].value);let R=x.readonly||E&&!w.checked&&!l[A].exclusive;w.disabled!==R&&(w.disabled=R)}),g&&m){let w=F.find(I=>typeof I=="string"&&!h.has(I)),A=g.checked&&!m.value.trim()&&(e==="checkbox"||F.every(I=>I==null));g.checked=w!==void 0||A,w!==void 0&&a.activeElement!==m&&(m.value=w);let R=x.readonly||E&&!g.checked;g.disabled!==R&&(g.disabled=m.disabled=R)}S?.allow(x),S?.show(v()),cn(c,x)}}}}function Kd(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=We(s,d),f="min"in r&&typeof r.min=="number"?r.min:e==="rating"?1:0,c="max"in r&&typeof r.max=="number"?r.max:e==="rating"?5:10,y=e==="rating"?i.options?.icon:"number",p=y!=="number",k=e==="scale"&&i.options?.nps===!0&&f===0&&c===10,g=at(a,"div",{id:o,class:`fd-points fd-${p?"rating":"scale"}${p?` fd-rating-${y??"star"}`:""}${k?" fd-nps":""}`,role:"radiogroup"}),m=[],b=e==="rating"&&f===c,h=e==="rating"&&(b||i.options?.clear===!1),v=!1;for(let E=f;E<=c;E++){let w=at(a,"button",{type:"button",role:"radio","aria-label":ze(l.ofMax,{n:E,max:c}),"data-value":String(E)},y==="thumb"?kt(a,"thumb"):y==="heart"?"\u2665":p?"\u2605":String(E));e==="scale"&&w.removeAttribute("aria-label"),k&&(w.dataset.tone=E<7?"low":E<9?"mid":"high"),w.addEventListener("click",()=>t.setValue(n,h&&!v&&t.getState().values[n]===E?null:E)),m.push(w),g.append(w)}g.addEventListener("keydown",E=>{let w=t.getState().values[n],A=typeof w=="number"?w:f-1,R=E.key==="ArrowRight"||E.key==="ArrowUp"?1:E.key==="ArrowLeft"||E.key==="ArrowDown"?-1:0;if(!R)return;E.preventDefault();let I=Math.min(c,Math.max(f,A+R));t.setValue(n,I),m[I-f]?.focus()});let S=[i.options?.startLabel,i.options?.endLabel].map(E=>typeof E=="string"?E:""),x=sn(a,l,()=>{t.setValue(n,null),m[0]?.focus()},i,!b),F=S.some(Boolean)?at(a,"div",{class:"fd-scale-box"},g,at(a,"div",{class:"fd-scale-ends","aria-hidden":"true"},at(a,"span",{},S[0]),at(a,"span",{},S[1]))):g;return S.some(Boolean)&&g.setAttribute("aria-description",S.filter(Boolean).join(" \u2026 ")),{element:at(a,"div",{class:"fd-choices-box"},F,x.button),focus:()=>(m.find(E=>E.getAttribute("aria-checked")==="true")??m[0])?.focus(),update(E){let w=typeof E.value=="number"?E.value:null;v=E.required,m.forEach((A,R)=>{let I=f+R;He(A,"aria-checked",String(I===w)),A.classList.toggle("fd-on",p?w!==null&&I<=w:I===w);let M=I===w||w===null&&R===0?0:-1;A.tabIndex!==M&&(A.tabIndex=M),A.disabled!==E.readonly&&(A.disabled=E.readonly)}),x.allow(E),x.show(w!==null),cn(g,E)}}}}var _f=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=at(o,"input",{id:i,type:"date",class:"fd-input fd-date"});Ii(s,r,a),s.addEventListener("input",()=>t.setValue(n,s.value||null));let d={element:s,focus:()=>s.focus(),update(l){let f=Ui(l.value);s.value!==f&&(s.value=f),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),s.classList.toggle("fd-blank",!f),cn(s,l)}};return a.options?.weekNumbers===!0?Ni(d,e,"date"):(Dn(s),d)},qi=e=>String(e).padStart(2,"0"),Uf=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=at(o,"input",{id:i,type:"datetime-local",class:"fd-input fd-datetime"});Ii(s,r,a);let d=f=>{if(typeof f!="string"||!f)return"";let c=new Date(f);return Number.isNaN(c.getTime())?"":`${c.getFullYear()}-${qi(c.getMonth()+1)}-${qi(c.getDate())}T${qi(c.getHours())}:${qi(c.getMinutes())}`};s.addEventListener("input",()=>{if(!s.value)return t.setValue(n,null);let f=new Date(s.value);Number.isNaN(f.getTime())||t.setValue(n,f.toISOString())});let l={element:s,focus:()=>s.focus(),update(f){let c=d(f.value);s.value!==c&&(s.value=c),s.readOnly!==f.readonly&&(s.readOnly=f.readonly),s.classList.toggle("fd-blank",!c),cn(s,f)}};return a.options?.weekNumbers===!0?Ni(l,e,"datetime"):(Dn(s),l)};function Kf({field:e,id:t,document:n}){let r=at(n,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:r,focus:()=>{},update(i){r.textContent=Ai(i.value,e)}}}function Ai(e,t){if(e==null)return"";switch(t.type){case"many2one":case"reference":return e.label;case"many2many":return e.map(n=>n.label).join(", ");case"one2many":{let n=e.length;return`${n} ${n===1?"line":"lines"}`}case"binary":case"image":return[e].flat().map(n=>n.name).join(", ");case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var Jd={char:rr("text"),"char.email":rr("email"),"char.phone":rr("tel"),"char.url":rr("url"),"char.password":rr("password"),"char.time":rr("time"),"char.tags":Co,text:Hf,integer:aa,float:aa,monetary:aa,"integer.rating":Kd("rating"),"integer.scale":Kd("scale"),"integer.slider":Go,"float.slider":Go,"integer.progressbar":$r,"integer.label":Tr,"float.label":Tr,"monetary.label":Tr,"float.progressbar":$r,"float.duration":Zs,"float.percentage":Qs,"monetary.progressbar":$r,boolean:sa(),"boolean.toggle":sa("switch"),"boolean.tick":sa("tick"),"boolean.buttons":Vd,"boolean.priority":Qo,"selection.priority":Qo,"selection.dot":Wd,"integer.color":ea,"char.color":ea,"char.copy":ta,"text.copy":ta,"date.daterange":ra,"datetime.daterange":ra,"float.timer":oa,"datetime.timer":oa,"binary.pdf":zd,"char.embed":Bd,"json.distribution":nd,"json.tax-totals":qd,"json.payments":_d,selection:qf,"selection.radio":Ud("radio"),"selection.checkboxes":Ud("checkbox"),"selection.tags":Ed,"selection.image-choice":Ad,"selection.ranking":$d,"selection.statusbar":$i,date:_f,datetime:Uf,many2one:Rr,"many2one.statusbar":$i,many2many:vi,"many2many.tags":vi,"many2many.checkboxes":Po,"many2many.table":Id,reference:Oo,one2many:Wo,"one2many.cards":Cd,binary:Ar,"binary.signature":Ld,image:Ho,html:Ko,json:Jo,"json.address":Md,properties:_o,matrix:Sd,"char.badge":Di,"selection.badge":Di,"many2one.badge":Di};var Gd=`.fd-signature{display:grid;gap:8px;justify-items:start;width:100%;max-width:480px;min-width:0}.fd-signature-box{position:relative;width:100%;aspect-ratio:10 / 3;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:#fff;overflow:hidden}.fd-signature-box:has(.fd-signature-pad:not([hidden]):not(.fd-signature-locked)):hover{border-color:var(--fd-accent)}.fd-signature-pad,.fd-signature-image{display:block;width:100%;height:100%}.fd-signature-pad{touch-action:none;cursor:crosshair}.fd-signature-pad.fd-signature-locked{cursor:default}.fd-signature-image{object-fit:contain}.fd-signature-hint{position:absolute;inset-inline:18px;inset-block-end:16px;padding-block-start:4px;pointer-events:none;border-block-start:1px solid var(--fd-border-strong);color:var(--fd-muted);font-size:12.5px}.fd-signature-tools{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;width:100%}.fd-signature-typed{flex:1 1 200px;min-width:0}.fd-signature-footer{margin-block-start:-4px;color:var(--fd-muted);font-size:12.5px}.fd-slider{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:14px;row-gap:0;align-items:center;width:100%;max-width:440px;min-width:0}.fd-slider-track{display:contents}.fd-slider-input{width:100%;min-width:0;height:26px;margin:0;accent-color:var(--fd-accent);cursor:pointer}.fd-slider-input:disabled{cursor:default}.fd-slider-value{min-width:2.5em;text-align:start;font-variant-numeric:tabular-nums;font-weight:600}.fd-slider-ends{grid-column:1;display:flex;justify-content:space-between;gap:12px;font-size:12.5px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-slider-empty .fd-slider-input{filter:grayscale(1);opacity:.55}.fd-slider-empty .fd-slider-value{color:var(--fd-muted);font-weight:400}.fd-slider .fd-choice-clear{grid-column:1 / -1}.fd-image-choices{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr));gap:12px;width:100%;min-width:0}.fd-image-card{position:relative;display:grid;grid-template-rows:auto 1fr;padding:0;margin:0;overflow:hidden;cursor:pointer;font:inherit;color:var(--fd-text);text-align:start;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);transition:border-color .15s ease,box-shadow .15s ease}.fd-image-card:hover:not(:disabled){border-color:var(--fd-accent)}.fd-image-card:disabled{cursor:default}.fd-image-card:disabled:not([aria-checked=true]){opacity:.6}.fd-image-card[aria-checked=true]{border-color:var(--fd-accent);box-shadow:0 0 0 1px var(--fd-accent)}.fd-image-card-picture{display:block;aspect-ratio:4 / 3;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-image-card-picture img{display:block;width:100%;height:100%;object-fit:cover}.fd-image-card-blank{display:grid;place-items:center;width:100%;height:100%;color:var(--fd-border-strong)}.fd-image-card-blank svg{width:36%;height:36%;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.fd-image-card-words{display:flex;align-items:flex-start;gap:8px;padding:9px 10px;font-size:13.5px;line-height:1.35}.fd-image-card-words:before{content:"";flex:none;width:16px;height:16px;margin-block-start:1px;box-sizing:border-box;border:1.5px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface)}.fd-image-card[role=checkbox] .fd-image-card-words:before{border-radius:4px}.fd-image-card[aria-checked=true] .fd-image-card-words:before{border-color:var(--fd-accent);background:var(--fd-accent);box-shadow:inset 0 0 0 3px var(--fd-surface)}.fd-image-card[role=checkbox][aria-checked=true] .fd-image-card-words:before{box-shadow:none;background:var(--fd-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat}.fd-image-choices+.fd-choice-clear{justify-self:end}.fd-ranking{width:100%;max-width:480px;min-width:0}.fd-rank-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}.fd-rank-item{display:flex;align-items:center;gap:10px;padding-block:5px;padding-inline:8px 5px;min-height:40px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);cursor:grab;user-select:none;-webkit-user-select:none}.fd-rank-item.fd-rank-lifted{position:relative;z-index:1;cursor:grabbing;border-color:var(--fd-accent);box-shadow:0 6px 18px #0f141929}.fd-ranking-locked .fd-rank-item{cursor:default}.fd-rank-grip{flex:none;width:10px;height:16px;touch-action:none;background:radial-gradient(circle,var(--fd-border-strong) 1.3px,transparent 1.7px) 0 0 / 5px 5.33px}.fd-ranking-locked .fd-rank-grip{visibility:hidden}.fd-rank-place{flex:none;display:grid;place-items:center;min-width:24px;height:24px;padding-inline:4px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:12.5px;font-weight:600;font-variant-numeric:tabular-nums}.fd-rank-words{flex:1;min-width:0;overflow-wrap:anywhere}.fd-rank-tools{flex:none;display:inline-flex;gap:2px}.fd-rank-move{width:30px;height:30px;padding:0;font:inherit;font-size:15px;line-height:1;color:var(--fd-muted);background:none;border:1px solid transparent;border-radius:4px;cursor:pointer}.fd-rank-move:hover:not(:disabled){background:var(--fd-page);border-color:var(--fd-border);color:var(--fd-text)}.fd-rank-move:disabled{opacity:.3;cursor:default}.fd-address{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;width:100%;max-width:560px;min-width:0}.fd-address-part{display:grid;gap:3px;min-width:0;align-content:start}.fd-address-street,.fd-address-line2{grid-column:1 / -1}.fd-address-part.fd-required>.fd-address-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-address-label{font-size:12.5px;color:var(--fd-muted)}@container (max-width: 420px){.fd-address{grid-template-columns:minmax(0,1fr)}}.fd-repeat{display:grid;gap:10px;justify-items:start;width:100%;min-width:0}.fd-repeat-list{display:grid;gap:10px;width:100%;min-width:0}.fd-repeat-list:empty{display:none}.fd-repeat-card{display:grid;gap:8px;min-width:0;padding:10px 14px 14px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-radius),6px)}.fd-repeat-head{display:flex;align-items:center;gap:2px;min-height:28px}.fd-repeat-title{font-weight:600;font-size:13.5px;margin-inline-end:auto}.fd-repeat-remove,.fd-repeat-tool{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:18px;line-height:1;padding:4px 8px;border-radius:4px}.fd-repeat-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-repeat-tool{font-size:15px;min-width:24px;min-height:24px}.fd-repeat-tool:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-repeat-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:10px 14px}.fd-repeat-field{display:grid;gap:3px;min-width:0;align-content:start}.fd-repeat-label{font-size:12.5px;color:var(--fd-muted)}.fd-repeat-add{border-style:dashed}`;var Yd='.fd-yes-no button{min-width:76px}.fd-choices-columns{display:grid;grid-template-columns:repeat(var(--fd-choice-columns),minmax(0,1fr))}.fd-choices-row{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}.fd-choice-limit{grid-column:1 / -1;flex-basis:100%;font-size:12.5px;color:var(--fd-muted)}.fd-choice-limit:empty{display:none}.fd-image-choices[data-size=small]{--fd-card: 96px}.fd-image-choices[data-size=large]{--fd-card: 210px}.fd-image-choices[data-size]{grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--fd-card, 130px)),1fr))}.fd-image-choices[data-fit=whole] img{object-fit:contain}.fd-image-choices-bare .fd-image-card-words{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0;font-size:0}.fd-choice-search .fd-combo:after{content:"";position:absolute;inset-inline-end:12px;width:6px;height:6px;margin-block-start:-4px;pointer-events:none;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}.fd-rank-pool{display:flex;flex-wrap:wrap;gap:8px;margin-block:6px 10px}.fd-rank-pick{min-height:32px;padding:4px 12px;font:inherit;color:inherit;cursor:pointer;background:var(--fd-surface);border:1px dashed var(--fd-border-strong);border-radius:999px}.fd-rank-pick:disabled{opacity:.5;cursor:default}.fd-rank-list:empty{display:none}.fd-rank-keep{margin-block-start:8px}.fd-matrix-pick{display:inline-flex;align-items:center;gap:8px}.fd-matrix-column{display:none}@container (max-width: 520px){.fd-choices-columns{grid-template-columns:minmax(0,1fr)}.fd-image-choices.fd-image-choices{grid-auto-flow:row;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-matrix-table,.fd-matrix-table :is(tbody,tr,th,td){display:block}.fd-matrix-table thead{display:none}.fd-matrix-table tr{padding:10px 12px;margin-block-end:10px;border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-matrix-table :is(th,td){padding:2px 0;border:0;text-align:start}.fd-matrix-pick{min-height:32px}.fd-matrix-column{display:inline}}';var Xd='.fd-counted{display:grid;gap:2px;min-width:0}.fd-count{justify-self:end;direction:ltr;unicode-bidi:isolate;font-size:12px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-count-near{color:var(--fd-warning);font-weight:600}.fd-number:not(.fd-currency-picked){position:relative;display:block}.fd-field>.fd-number:not(.fd-currency-picked){align-self:start}.fd-number>.fd-unit{position:absolute;inset-block:0;display:flex;align-items:center;pointer-events:none;color:var(--fd-muted)}.fd-number>.fd-unit:first-child{inset-inline-start:var(--fd-pad-x)}.fd-number>.fd-unit:last-child{inset-inline-end:var(--fd-pad-x)}.fd-rating-heart button.fd-on{color:#e5484d}.fd-rating-thumb button.fd-on{color:var(--fd-accent)}.fd-rating .fd-icon{display:block;width:1em;height:1em}.fd-rating .fd-on .fd-icon{fill:currentColor}.fd-slider-word{display:block;max-width:12em}.fd-slider-last{text-align:end}.fd-nps [data-tone=low]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-nps [data-tone=mid]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-nps [data-tone=high]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-nps button{background:var(--fd-tone-soft);border-color:var(--fd-tone);color:var(--fd-tone);font-weight:600}.fd-nps button.fd-on{background:var(--fd-tone);border-color:var(--fd-tone);color:var(--fd-surface)}.fd-nps [data-value="7"],.fd-nps [data-value="9"]{margin-inline-start:8px}.fd-choices-box>.fd-scale-box{justify-self:start}';var Zd=".fd-form[data-inputs~=bg] :is(.fd-input:not([readonly]),.fd-calendar-button){background:var(--fd-inputs-bg)}.fd-form[data-inputs~=border] :is(.fd-input,.fd-calendar-button){--fd-border: var(--fd-inputs-border);--fd-border-strong: var(--fd-inputs-border)}.fd-form[data-inputs~=radius] :is(.fd-input,.fd-calendar-button){--fd-control-radius: var(--fd-inputs-radius)}.fd-form[data-inputs~=size] :where(.fd-input){font-size:var(--fd-inputs-size)}.fd-form[data-inputs~=accent] :is(.fd-input,.fd-combo,.fd-tags,.fd-date-pick){--fd-accent: var(--fd-inputs-accent);--fd-accent-text: var(--fd-inputs-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}.fd-form[data-choices~=accent] :is(.fd-choices,.fd-points,.fd-image-choices,.fd-ranking,.fd-checkbox,.fd-switch,.fd-matrix-table,.fd-slider){--fd-accent: var(--fd-choices-accent);--fd-accent-text: var(--fd-choices-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface))}.fd-form[data-choices~=bg] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-surface: var(--fd-choices-bg)}.fd-form[data-choices~=border] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-border: var(--fd-choices-border)}.fd-form[data-choices~=radius] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-control-radius: var(--fd-choices-radius)}.fd-form[data-choices~=size] :is(.fd-choices,.fd-points,.fd-image-card-words,.fd-rank-list){font-size:var(--fd-choices-size)}.fd-form[data-groups~=bg] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){background:var(--fd-groups-bg);--fd-ground: var(--fd-groups-bg)}.fd-form[data-groups~=border] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border:1px solid var(--fd-groups-border)}.fd-form[data-groups~=radius] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border-radius:var(--fd-groups-radius)}.fd-form[data-fd-skin=underline]:is([data-groups~=bg],[data-groups~=border]) :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){padding:var(--fd-group-pad, 18px 22px);border-radius:var(--fd-groups-radius, var(--fd-radius))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button{--fd-accent: var(--fd-buttons-accent);--fd-accent-text: var(--fd-buttons-accent-text);--fd-focus: var(--fd-accent);--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}:is(.fd-form,.fd-form-dialog)[data-buttons~=radius] .fd-button{border-radius:var(--fd-buttons-radius)}:is(.fd-form,.fd-form-dialog)[data-buttons~=size] .fd-button{font-size:var(--fd-buttons-size)}.fd-form[data-tables~=bg] :is(.fd-lines-table,.fd-matrix-table) thead th{background:var(--fd-tables-bg)}.fd-form[data-tables~=border] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){border-color:var(--fd-tables-border)}.fd-form[data-tables~=size] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){font-size:var(--fd-tables-size)}";var Qd='.fd-read-text{min-width:0;min-height:var(--fd-control-height, 30px);padding-block:calc(var(--fd-pad-y) + 1px);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.45;color:var(--fd-text)}.fd-field:is([data-type=integer],[data-type=float],[data-type=monetary])>.fd-read-text{font-variant-numeric:tabular-nums}.fd-read-text{unicode-bidi:plaintext;text-align:left}[dir=rtl] .fd-read-text{text-align:right}.fd-read-text{padding-inline:var(--fd-pad-x)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-read-text{padding-inline:calc(var(--fd-pad-x) + 1px)}.fd-form :is(.fd-title,.fd-title-line) .fd-read-text{padding-inline:0}.fd-read-text a,.fd-read-link{color:var(--fd-accent);text-decoration:none}.fd-read-link{border:none;background:none;padding:0;font:inherit;cursor:pointer;text-align:start}.fd-read-text a:hover,.fd-read-link:hover{text-decoration:underline}.fd-read-link:focus-visible,.fd-read-text a:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-field>.fd-value-badge{justify-self:start;align-self:start;width:fit-content;margin-block:calc((var(--fd-control-height, 30px) - 24px) / 2)}.fd-title>.fd-field>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-ribbon[title]{pointer-events:auto;cursor:help}.fd-value{font-weight:600}.fd-alert:has(>.fd-alert-actions){flex-wrap:wrap;align-items:baseline}.fd-alert-actions{display:inline-flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline}.fd-alert-actions .fd-button{min-height:0;padding-block:0;font-size:inherit}.fd-alert-actions .fd-button-link{color:inherit;padding-inline:0;text-decoration:underline;text-underline-offset:2px;font-weight:600}.fd-text-alert{grid-column:1 / -1;margin:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden]))>:is(.fd-ribbon-frame+.fd-alert,.fd-ribbon-frame+.fd-stats[hidden]+.fd-alert){margin-inline-end:72px}.fd-stat-pair{gap:1px}.fd-stat-row{display:inline-flex;align-items:baseline;gap:5px}.fd-stat-row>.fd-stat-label:after{content:":"}.fd-stat-pair .fd-stat-value{font-size:13.5px}@container (max-width: 520px){.fd-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.fd-stat{min-width:0;padding-inline:12px;text-align:start;column-gap:8px}.fd-stat:has(>.fd-icon){column-gap:8px}.fd-stat-value{font-size:14px}.fd-stat:nth-child(odd of:not([hidden])){border-inline-start:none}.fd-stat:nth-child(n+3 of:not([hidden])){border-block-start:1px solid var(--fd-border)}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(2 of:not([hidden])){padding-inline-end:64px}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(4 of:not([hidden])){padding-inline-end:36px}}.fd-step-time{margin-inline-start:6px;font-size:11.5px;font-weight:400;font-variant-numeric:tabular-nums}.fd-statusbar li.fd-step-more>button{padding-inline:16px 20px;letter-spacing:1px}.fd-statusbar li.fd-step-more>.fd-step-menu{position:fixed;z-index:30;display:grid;min-width:160px;margin:0;padding:4px 0;clip-path:none;transform:none;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;white-space:nowrap}.fd-statusbar li.fd-step-more>.fd-step-menu[hidden]{display:none}.fd-statusbar .fd-step-menu>button{font:inherit;font-size:13px;text-align:start;border:none;background:none;color:inherit;padding:6px 14px;cursor:pointer;transform:none}.fd-statusbar .fd-step-menu>button:hover:not(:disabled),.fd-statusbar .fd-step-menu>button:focus-visible{background:var(--fd-accent-soft);outline:none}.fd-statusbar .fd-step-menu>button:disabled{cursor:default;color:var(--fd-muted)}.fd-hotkey{display:none}[data-hotkeys] .fd-hotkey{display:inline-block;margin-inline-start:6px;padding:0 4px;border:1px solid currentColor;border-radius:3px;font:600 10.5px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace;opacity:.85;vertical-align:1px}.fd-link-avatar{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:10px;font-weight:700;line-height:1;vertical-align:middle}.fd-link-avatar img{width:100%;height:100%;object-fit:cover}.fd-combo[data-avatar]>.fd-link-avatar{position:absolute;inset-inline-start:4px;pointer-events:none}.fd-combo[data-avatar]>.fd-link-avatar[hidden]~.fd-combo-input{padding-inline-start:var(--fd-pad-x)}.fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:32px}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar{inset-inline-start:0}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:28px}.fd-read-text>.fd-link-avatar{margin-inline-end:6px}.fd-chip>.fd-link-avatar{width:18px;height:18px;font-size:9px;margin-inline:-4px 2px}.fd-link{display:grid;gap:2px;min-width:0}.fd-link-details{font-size:12.5px;line-height:1.4;color:var(--fd-muted);text-align:left}[dir=rtl] .fd-link-details{text-align:right}.fd-link-details>div{unicode-bidi:plaintext}.fd-chip[data-color]{background:color-mix(in srgb,var(--fd-tag) 18%,var(--fd-surface));border-color:color-mix(in srgb,var(--fd-tag) 55%,var(--fd-surface))}.fd-chip[data-color="1"]{--fd-tag: #f06050}.fd-chip[data-color="2"]{--fd-tag: #f4a460}.fd-chip[data-color="3"]{--fd-tag: #f7cd1f}.fd-chip[data-color="4"]{--fd-tag: #6cc1ed}.fd-chip[data-color="5"]{--fd-tag: #814968}.fd-chip[data-color="6"]{--fd-tag: #eb7e7f}.fd-chip[data-color="7"]{--fd-tag: #2c8397}.fd-chip[data-color="8"]{--fd-tag: #475577}.fd-chip[data-color="9"]{--fd-tag: #d6145f}.fd-chip[data-color="10"]{--fd-tag: #30c381}.fd-chip[data-color="11"]{--fd-tag: #9365b8}.fd-oneline-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;min-height:var(--fd-control-height, 30px)}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 6px;flex:0 1 auto;width:auto;min-width:0;grid-template-columns:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{grid-column:auto!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:not([data-labels=beside]):not([data-labels=above])>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>:is(.fd-error,.fd-warning){flex-basis:100%}.fd-oneline-row .fd-input{width:12em;max-width:100%}.fd-form .fd-oneline-pair{display:inline-flex;flex-wrap:nowrap;align-items:center;gap:6px 10px;flex:0 1 auto;max-width:100%;min-width:0}.fd-form .fd-oneline-pair:not(:has(>:not([hidden]))){display:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{max-width:100%}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{max-width:100%;min-width:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference]) .fd-input{width:15em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=integer],[data-type=float]) .fd-input{width:7em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=monetary] .fd-input{width:8.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=date],[data-type=datetime]) .fd-input{width:9.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime] .fd-input{width:14em}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]){flex:1 1 auto}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime])>:not(.fd-label){flex:1 1 auto}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]) .fd-input{width:100%;min-width:min(100%,var(--fd-oneline-min, 9.5em))}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime]{--fd-oneline-min: 14em}.fd-form .fd-oneline-words{margin:0;padding:0;border:0;background:none;color:var(--fd-text)}.fd-form .fd-oneline-words.fd-text-note{color:var(--fd-muted);font-size:12.5px}.fd-form .fd-oneline:not(:has(>.fd-label))>.fd-oneline-row{grid-column:1 / -1!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-button-link{padding-inline:0;min-height:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>.fd-read-text{min-height:0;padding-block:0}.fd-title-label{font-size:12.5px;font-weight:600;color:var(--fd-muted)}';var el='.fd-priority{display:inline-flex;align-items:center;gap:1px}.fd-priority-star{border:none;background:none;padding:0 1px;min-width:0;font:inherit;font-size:20px;line-height:1;color:var(--fd-border-strong);cursor:pointer}.fd-priority-star.fd-on{color:#e8a317}.fd-priority:not(:has(:disabled)):hover .fd-priority-star{color:#e8a317}.fd-priority:not(:has(:disabled)) .fd-priority-star:hover~.fd-priority-star{color:var(--fd-border-strong)}.fd-priority-star:disabled{cursor:default}.fd-title-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;min-width:0}.fd-title-line>.fd-title-name{flex:1 1 18em;min-width:0}.fd-title-line>.fd-title-name .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-title-line>.fd-title-name>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-form .fd-title-line>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form .fd-title-line>.fd-field>*{grid-column:1!important}.fd-form .fd-title-line>.fd-title-side{display:flex;align-items:center;flex:none}.fd-title-line>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-line .fd-priority-star{font-size:24px}.fd-dot-box{position:relative;display:inline-flex;align-items:center;gap:6px}.fd-dot-button{display:inline-grid;place-items:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:none;cursor:pointer}.fd-dot-button:hover:not(:disabled){background:var(--fd-accent-soft)}.fd-dot-button:disabled{cursor:default}.fd-dot{display:inline-block;width:12px;height:12px;flex:none;border-radius:50%;background:var(--fd-dot, var(--fd-border-strong))}.fd-dot-button[data-tone=muted],.fd-dot-item[data-tone=muted]{--fd-dot: var(--fd-border-strong)}.fd-dot-button[data-tone=danger],.fd-dot-item[data-tone=danger]{--fd-dot: var(--fd-error)}.fd-dot-button[data-tone=success],.fd-dot-item[data-tone=success]{--fd-dot: var(--fd-success)}.fd-dot-button[data-tone=warning],.fd-dot-item[data-tone=warning]{--fd-dot: #d97706}.fd-dot-button[data-tone=info],.fd-dot-item[data-tone=info]{--fd-dot: var(--fd-info)}.fd-dot-label{font-size:13px;color:var(--fd-muted)}.fd-dot-menu{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:180px;padding:4px;display:grid;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-dot-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:4px;cursor:pointer;white-space:nowrap;font-size:14px}.fd-dot-item:hover,.fd-dot-item:focus{background:var(--fd-accent-soft);outline:none}.fd-dot-item[aria-checked=true]{font-weight:600}.fd-dot-item[aria-checked=true]:after{content:"\u2713";margin-inline-start:auto;padding-inline-start:16px;color:var(--fd-accent)}.fd-colour-box{position:relative;display:inline-flex;align-items:center;gap:8px}.fd-colour-button,.fd-colour{width:24px;height:24px;padding:0;border:1px solid var(--fd-border-strong);border-radius:4px;background:var(--fd-swatch, transparent);cursor:pointer}.fd-colour-button:disabled{cursor:default}.fd-colour-none,.fd-colour[data-colour="0"]{background:linear-gradient(to top right,transparent calc(50% - 1px),var(--fd-error) calc(50% - 1px),var(--fd-error) calc(50% + 1px),transparent calc(50% + 1px))}.fd-colour-palette{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;display:grid;grid-template-columns:repeat(6,24px);gap:6px;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-colour[aria-checked=true]{box-shadow:0 0 0 2px var(--fd-surface),0 0 0 4px var(--fd-accent)}.fd-colour-input{width:44px;height:30px;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-colour-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;color:var(--fd-muted)}.fd-copy{display:flex;align-items:center;gap:8px;min-width:0}.fd-copy>.fd-input{flex:1 1 auto;min-width:0}.fd-copy-long{align-items:flex-start}.fd-copy-button{flex:none}.fd-range{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}.fd-range-box{flex:1 1 8em;display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}.fd-range-box>.fd-input{flex:1 1 9em;min-width:0}.fd-range-box>.fd-input[type=datetime-local]{flex-basis:13em}.fd-range-arrow{flex:none;display:inline-block;color:var(--fd-muted)}.fd-range-arrow:dir(rtl){transform:scaleX(-1)}.fd-range-calendar .fd-calendar-grid td button.fd-in-range{background:var(--fd-accent-soft);border-radius:0}.fd-timer{display:inline-flex;align-items:center;gap:8px;font-variant-numeric:tabular-nums;font-weight:600;direction:ltr;unicode-bidi:isolate}.fd-timer-dot{width:8px;height:8px;border-radius:50%;background:var(--fd-border-strong)}.fd-timer[data-running] .fd-timer-dot{background:var(--fd-success);animation:fd-timer-beat 1s ease-in-out infinite alternate}.fd-timer[data-running] .fd-timer-time{color:var(--fd-success)}@keyframes fd-timer-beat{to{opacity:.35}}@media(prefers-reduced-motion:reduce){.fd-timer[data-running] .fd-timer-dot{animation:none}}.fd-embed{display:grid;gap:8px;min-width:0}.fd-embed-bar{display:flex;align-items:center;gap:8px;min-width:0}.fd-embed-bar>.fd-input{flex:1 1 auto;min-width:0}.fd-embed-open{flex:none}.fd-embed-frame{display:block;width:100%;border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);background:var(--fd-page)}.fd-embed-none{padding:24px 12px;text-align:center;color:var(--fd-muted);border:1px dashed var(--fd-border);border-radius:max(var(--fd-control-radius),4px)}.fd-distribution{display:grid;gap:6px;min-width:0}.fd-distribution-table .fd-distribution-share{width:8.5em}.fd-distribution-table .fd-share{text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch)}.fd-distribution-total{font-weight:600;text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch + 4px);font-variant-numeric:tabular-nums}.fd-distribution-add{justify-self:start}.fd-tax-totals{justify-self:end;border-collapse:collapse;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-tax-totals th{text-align:start;font-weight:400;color:var(--fd-muted);padding:3px 16px 3px 0;padding-inline:0 16px}.fd-tax-totals td{text-align:end;padding:3px 0;white-space:nowrap}.fd-tax-totals .fd-tax-subtotal th{color:var(--fd-text)}.fd-tax-totals .fd-tax-total :is(th,td){font-weight:700;color:var(--fd-text);font-size:15px;border-top:1px solid var(--fd-border);padding-top:6px}.fd-tax-totals .fd-input{width:9em;text-align:end}.fd-payments{display:grid;gap:6px;justify-self:end;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-payments-list{list-style:none;margin:0;padding:0;display:grid;gap:4px}.fd-payment{position:relative;display:flex;align-items:center;gap:8px}.fd-payment-info{flex:none;width:20px;height:20px;padding:0;border:1px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface);color:var(--fd-muted);font:italic 600 12px/1 Georgia,serif;cursor:pointer}.fd-payment-info:hover,.fd-payment-info[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-payment-date{flex:1 1 auto;font-style:italic;color:var(--fd-muted)}.fd-payment-amount{white-space:nowrap}.fd-payment-details{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:240px;display:grid;gap:6px;padding:10px 12px;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-payment-details dl{display:grid;grid-template-columns:auto 1fr;gap:2px 12px;margin:0}.fd-payment-details dt{color:var(--fd-muted)}.fd-payment-details dd{margin:0}.fd-payment-open{justify-self:start}.fd-payment-due{display:flex;justify-content:space-between;gap:16px;padding-top:6px;border-top:1px solid var(--fd-border);font-weight:600}.fd-properties-list{display:grid;gap:8px;min-width:0}.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:var(--fd-gap-x, 24px)}@container (max-width: 520px){.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:minmax(0,1fr)}}.fd-property-add{justify-self:start}.fd-property-new{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.fd-property-new>.fd-input{flex:1 1 10em;width:auto}';var tl='.fd-dot-label[data-quiet-words]{display:none}.fd-form .fd-field[data-in-quiet]>.fd-label{color:var(--fd-muted)}.fd-form .fd-field[data-quiet]{--fd-quiet-pad: max(var(--fd-pad-x), 6px)}.fd-form .fd-field[data-quiet] :where(.fd-input){padding-inline-start:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet] :is(.fd-input:not(.fd-tags *),.fd-tags,.fd-dot-box){border:1px solid transparent;border-radius:max(var(--fd-control-radius),4px);background-color:transparent;box-shadow:none;transition:border-color .12s ease,background-color .12s ease,box-shadow .12s ease}.fd-form .fd-field[data-quiet]:not(:focus-within) .fd-count{visibility:hidden}.fd-form .fd-field[data-quiet] textarea.fd-input:not(:focus){resize:none}.fd-form .fd-field[data-quiet]>.fd-number:not(.fd-currency-picked){max-width:18em}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],:disabled,[contenteditable=false]){color:var(--fd-text);opacity:1;cursor:default}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],:disabled,[contenteditable=false]):not(.fd-combo[data-avatar]>*){padding-inline:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet]>.fd-read-text{padding-inline:calc(var(--fd-quiet-pad) + 1px)}.fd-form .fd-field[data-quiet][data-locked] :is(.fd-input,.fd-dot-label),.fd-form .fd-field[data-quiet][data-locked]>.fd-read-text{color:var(--fd-muted)}.fd-form .fd-field[data-quiet][data-empty] .fd-input:not(:focus){color:var(--fd-muted)}.fd-form .fd-field[data-quiet][data-empty] .fd-dot-label:empty:before{content:attr(data-hint);color:var(--fd-muted)}.fd-form .fd-field[data-quiet] :is(.fd-input[aria-invalid=true]:not(.fd-tags *),.fd-tags:has(.fd-input[aria-invalid=true]),.fd-dot-box:has(>[aria-invalid=true])){border-color:var(--fd-error)}@media(hover:hover){.fd-form .fd-field[data-quiet]>:hover :is(.fd-input:not(.fd-tags *),.fd-tags):not([readonly],:disabled,[contenteditable=false]),.fd-form .fd-field[data-quiet]>:is(.fd-input,.fd-tags,.fd-dot-box:not(:has(:disabled))):not([readonly],:disabled,[contenteditable=false]):hover{border-color:var(--fd-border);background-color:var(--fd-inputs-bg, var(--fd-surface))}}.fd-form .fd-field[data-quiet] :is(.fd-input:not(.fd-tags *):not([readonly],:disabled,[contenteditable=false]):focus,.fd-tags:focus-within,.fd-dot-box:has(>.fd-dot-button:is(:focus-visible,[aria-expanded=true]))){border-color:var(--fd-accent);background-color:var(--fd-inputs-bg, var(--fd-surface));box-shadow:0 0 0 1px var(--fd-accent)}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],[contenteditable=false]):focus-visible{outline:2px solid var(--fd-accent);outline-offset:0}.fd-form .fd-field[data-quiet] select.fd-input{appearance:none;padding-inline-end:calc(var(--fd-quiet-pad) + 14px);background-image:none}.fd-form .fd-field[data-quiet] select.fd-input:not(:disabled):is(:hover,:focus),.fd-form .fd-field[data-quiet]>:hover select.fd-input:not(:disabled){background-image:linear-gradient(45deg,transparent 50%,var(--fd-muted) 50%),linear-gradient(135deg,var(--fd-muted) 50%,transparent 50%);background-position:calc(100% - var(--fd-quiet-pad) - 5px) 55%,calc(100% - var(--fd-quiet-pad)) 55%;background-size:5px 5px;background-repeat:no-repeat}.fd-form .fd-field[data-quiet] select.fd-input:not(:disabled):is(:hover,:focus):dir(rtl),.fd-form .fd-field[data-quiet]>:hover select.fd-input:not(:disabled):dir(rtl){background-position:var(--fd-quiet-pad) 55%,calc(var(--fd-quiet-pad) + 5px) 55%}.fd-form .fd-field[data-quiet] .fd-combo:is(.fd-choice-search *,:has(>.fd-combo-clear[hidden])):has(>.fd-combo-input:not([readonly])):after{content:"";position:absolute;inset-inline-end:12px;width:6px;height:6px;margin-block-start:-4px;pointer-events:none;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg);visibility:hidden}.fd-form .fd-field[data-quiet] .fd-combo:focus-within:after{visibility:visible}.fd-form .fd-field[data-quiet] .fd-choice-search .fd-combo:has(>.fd-combo-input[readonly]):after{content:none}.fd-form .fd-field[data-quiet] input.fd-input:is([type=date],[type=datetime-local],[type=time]):dir(rtl){position:relative;text-align:right}.fd-form .fd-field[data-quiet] input.fd-input:is([type=date],[type=datetime-local],[type=time]):dir(rtl)::-webkit-calendar-picker-indicator{position:absolute;left:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet] .fd-input::-webkit-calendar-picker-indicator{opacity:0;transition:opacity .12s ease}.fd-form .fd-field[data-quiet] .fd-input:not([readonly]):focus::-webkit-calendar-picker-indicator{opacity:1}.fd-form .fd-field[data-quiet]:not(:focus-within) :is(.fd-calendar-button,.fd-combo-clear,.fd-combo-open){visibility:hidden}@media(hover:hover){.fd-form .fd-field[data-quiet]>:hover :is(.fd-calendar-button,.fd-combo-clear,.fd-combo-open),.fd-form .fd-field[data-quiet]>:hover .fd-combo:after{visibility:visible}.fd-form .fd-field[data-quiet]>:hover .fd-input:not([readonly])::-webkit-calendar-picker-indicator,.fd-form .fd-field[data-quiet]>.fd-input:not([readonly]):hover::-webkit-calendar-picker-indicator{opacity:1}}.fd-form .fd-field[data-quiet] .fd-link>.fd-link-details{padding-inline-start:calc(var(--fd-quiet-pad) + 1px)}.fd-form .fd-field[data-quiet] .fd-tags{padding:1px var(--fd-quiet-pad);min-height:var(--fd-control-height, 30px)}.fd-form .fd-field[data-quiet] .fd-tags .fd-input{border:0;background-color:transparent;box-shadow:none;padding-inline-start:0}.fd-form .fd-field[data-quiet] .fd-tags:has(.fd-chip) .fd-combo-input:not(:focus)::placeholder{color:transparent}.fd-form .fd-field[data-quiet] .fd-dot-box{display:flex;gap:8px;min-height:var(--fd-control-height, 30px);padding-block:0;padding-inline:var(--fd-quiet-pad) calc(var(--fd-quiet-pad) + 16px)}.fd-form .fd-field[data-quiet] .fd-dot-box:after{content:"";position:absolute;inset-inline-end:calc(var(--fd-quiet-pad) + 2px);inset-block-start:50%;width:6px;height:6px;margin-block-start:-5px;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg);visibility:hidden;pointer-events:none}.fd-form .fd-field[data-quiet] .fd-dot-box:has(>.fd-dot-button:is(:focus-visible,[aria-expanded=true])):after{visibility:visible}@media(hover:hover){.fd-form .fd-field[data-quiet] .fd-dot-box:not(:has(:disabled)):hover:after{visibility:visible}}.fd-form .fd-field[data-quiet] .fd-dot-button{margin-inline-start:-6px;margin-inline-end:-4px;background:none}.fd-form .fd-field[data-quiet] .fd-dot-button:before{content:"";position:absolute;inset:0}.fd-form .fd-field[data-quiet] .fd-dot-button:focus-visible{outline:none}.fd-form .fd-field[data-quiet] .fd-dot-label{display:inline;font-size:inherit;color:var(--fd-text)}.fd-form .fd-field[data-quiet] .fd-richtext-box{position:relative}.fd-form .fd-field[data-quiet] .fd-richtext{min-height:64px}.fd-form .fd-field[data-quiet] .fd-richtext[contenteditable=false]{min-height:0}.fd-form .fd-field[data-quiet] .fd-richtext>*{unicode-bidi:plaintext;text-align:left}.fd-form .fd-field[data-quiet] .fd-richtext>:dir(rtl){text-align:right}.fd-form .fd-field[data-quiet] .fd-richtext-box:not(:focus-within)>:is(.fd-richtext-bar,.fd-link-row){display:none}.fd-form .fd-field[data-quiet] .fd-richtext-box>:is(.fd-richtext-bar,.fd-link-row){position:absolute;inset-inline:0;z-index:25;border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);background:var(--fd-surface);box-shadow:0 6px 18px #0f141924}.fd-form .fd-field[data-quiet] .fd-richtext-box>.fd-richtext-bar{inset-block-start:calc(100% + 4px)}.fd-form .fd-field[data-quiet] .fd-richtext-box>.fd-link-row{inset-block-start:calc(100% + 46px)}.fd-lock-wrap{position:relative;display:inline-flex;vertical-align:-.15em;margin-inline-start:6px}.fd-lock{display:inline-grid;place-items:center;width:18px;height:18px;padding:0;border:0;border-radius:4px;background:none;color:var(--fd-muted)}button.fd-lock{cursor:help}.fd-lock .fd-icon{width:14px;height:14px;margin:0}.fd-lock:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}';var nl='.fd-grid>.fd-section[data-place=tracks]{--fd-tracks: min(var(--fd-span, 1), var(--fd-cols));grid-template-columns:subgrid;column-gap:var(--fd-gap-x)}.fd-form .fd-section[data-place=tracks]>.fd-grid{--fd-cols: var(--fd-tracks);grid-column:1 / -1;grid-template-columns:subgrid}.fd-section[data-place]>.fd-section-description{grid-column:1 / -1}.fd-grid>.fd-section[data-place=shared]{container-type:inline-size}.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: var(--fd-columns, 1)}@container (max-width: 330px){.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: 1}}.fd-form{--fd-ground: transparent}.fd-card,.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-section[data-style=card][data-on-page]{--fd-ground: var(--fd-surface)}fieldset.fd-section[data-style]{background-color:var(--fd-ground)}.fd-form .fd-section[data-style=line]>.fd-section-title{border-block-end:1px solid var(--fd-border);padding-block-end:8px}.fd-form .fd-section[data-style=plain]>.fd-section-title{border-block-end:0;padding-block-end:0}.fd-form .fd-section[data-style=framed]{border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:6px 18px 18px}.fd-form .fd-section[data-style=framed]>.fd-section-title{float:none;width:auto;max-width:100%;padding:0 6px;margin-inline-start:-6px;border:0}.fd-form .fd-field[data-labels]{grid-template-columns:minmax(0,1fr)}.fd-form .fd-field[data-labels]>*{grid-column:1 / -1}.fd-form .fd-field[data-labels=beside]{container-type:inline-size;grid-template-columns:minmax(0,var(--fd-label-width, 140px)) minmax(0,1fr);column-gap:14px}@container (min-width: 300px){.fd-form .fd-field[data-labels=beside]>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=beside]>:not(.fd-label){grid-column:2}}.fd-form .fd-field[data-labels=hidden]>.fd-label{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form .fd-field[data-labels=after]{grid-template-columns:auto minmax(0,1fr);column-gap:9px;align-items:start;--fd-tick-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=after]>:is(.fd-tick,:has(>.fd-tick)){grid-column:1;grid-row:1;display:flex;margin-block-start:calc(var(--fd-tick-drop) + (1.45em - 17px) / 2)}.fd-form .fd-field[data-labels=after] .fd-tick{width:17px;height:17px}.fd-form .fd-field[data-labels=after]>:not(.fd-tick,:has(>.fd-tick)){grid-column:2}.fd-form .fd-field[data-labels=after]>.fd-label{grid-row:1;margin-block-start:var(--fd-tick-drop);font-weight:inherit;line-height:1.45;cursor:pointer}.fd-form .fd-field[data-labels=beside]:focus-within,.fd-grid>.fd-section[data-place=shared]:focus-within{z-index:3}:is(.fd-grid,.fd-sections)>.fd-button{justify-self:start}.fd-form .fd-text-note{background:color-mix(in srgb,var(--fd-text) 6%,transparent);color:var(--fd-text);border-radius:var(--fd-control-radius, 6px);padding:10px 12px}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-font=serif]{--fd-font: "Source Serif 4", Georgia, serif}:is(.fd-form,.fd-form-dialog)[data-font=rounded]{--fd-font: Nunito, "Varela Round", system-ui}:is(.fd-form,.fd-form-dialog)[data-density=compact]{--fd-gap-y: 10px;--fd-gap-x: 16px;--fd-control-height: 30px;--fd-gap-block: 16px;--fd-group-pad: 14px 16px}:is(.fd-form,.fd-form-dialog)[data-density=comfortable]{--fd-gap-y: 16px;--fd-gap-x: 20px;--fd-control-height: 36px;--fd-gap-block: 22px;--fd-group-pad: 18px 22px}:is(.fd-form,.fd-form-dialog)[data-density=roomy]{--fd-gap-y: 22px;--fd-gap-x: 28px;--fd-control-height: 42px;--fd-gap-block: 30px;--fd-group-pad: 24px 30px}:is(.fd-form,.fd-form-dialog)[data-corners=square]{--fd-radius: 0px;--fd-control-radius: 0px}:is(.fd-form,.fd-form-dialog)[data-corners=soft]{--fd-radius: 10px;--fd-control-radius: 6px}:is(.fd-form,.fd-form-dialog)[data-corners=round]{--fd-radius: 16px;--fd-control-radius: 12px}.fd-form[data-scheme]{--fd-ground: var(--fd-page)}}.fd-form[data-scheme]{color-scheme:light;background:var(--fd-page);color:var(--fd-text);border-radius:var(--fd-radius)}:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{color-scheme:dark}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{color-scheme:dark}}.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:20px}.fd-form-dialog-body>.fd-form[data-scheme]{background:none;border-radius:0}.fd-form-dialog-body>.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:0}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}}:is(.fd-form,.fd-form-dialog)[data-accent]{--fd-accent: var(--fd-look-accent);--fd-accent-text: var(--fd-look-accent-text);--fd-focus: var(--fd-look-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-scheme=dark][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}}:is(.fd-form,.fd-form-dialog):is([data-fd-skin=outlined],[data-fd-skin=quiet])[data-accent]{--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}}:is(.fd-form,.fd-form-dialog)[data-accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}.fd-form[data-accent] .fd-page-head{border-block-end:3px solid var(--fd-accent);padding-block-end:14px}';var Sn='system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif',rl={material:{light:{font:`Roboto, ${Sn}`,text:"#1d1b20",muted:"#49454f",page:"#fef7ff",surface:"#ffffff",border:"#79747e","border-strong":"#49454f",accent:"#6750a4","accent-text":"#ffffff","accent-soft":"#eaddff",focus:"#6750a4","focus-ring":"none",error:"#b3261e","error-soft":"#f9dedc",radius:"12px","control-radius":"4px","control-height":"48px","pad-y":"10px","pad-x":"16px","input-border":"0 0 1px 0","label-weight":"500","gap-x":"24px","gap-y":"20px",fill:"#ece6f0"},dark:{text:"#e6e0e9",muted:"#cac4d0",page:"#141218",surface:"#1d1b20",border:"#938f99","border-strong":"#cac4d0",accent:"#d0bcff","accent-text":"#381e72","accent-soft":"#4f378b",focus:"#d0bcff",error:"#f2b8b5","error-soft":"#601410",fill:"#36343b",edge:"#938f99"}},fluent:{light:{font:`"Segoe UI Variable Text", "Segoe UI", ${Sn}`,text:"#242424",muted:"#616161",page:"#f5f5f5",surface:"#ffffff",border:"#d1d1d1","border-strong":"#616161",accent:"#0f6cbd","accent-text":"#ffffff","accent-soft":"#ebf3fc",focus:"#0f6cbd","focus-ring":"none",error:"#c50f1f","error-soft":"#fdf3f4",radius:"8px","control-radius":"4px","control-height":"32px","pad-y":"5px","pad-x":"10px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#ffffff",muted:"#d6d6d6",page:"#1f1f1f",surface:"#292929",border:"#666666","border-strong":"#adadad",accent:"#479ef5","accent-text":"#0a0a0a","accent-soft":"#0e4775",focus:"#479ef5",error:"#e37d80","error-soft":"#3b1012",edge:"#adadad"}},apple:{light:{font:`-apple-system, BlinkMacSystemFont, "SF Pro Text", ${Sn}`,text:"#1d1d1f",muted:"#6e6e73",page:"#f2f2f7",surface:"#ffffff",border:"#d1d1d6","border-strong":"#8e8e93",accent:"#0066cc","accent-text":"#ffffff","accent-soft":"#e5f0fb",focus:"#0066cc","focus-ring":"0 0 0 4px rgba(0, 113, 227, 0.25)",error:"#d70015","error-soft":"#ffebec",radius:"12px","control-radius":"10px","control-height":"40px","pad-y":"8px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"20px","gap-y":"16px",fill:"#f2f2f7"},dark:{text:"#f5f5f7",muted:"#a1a1a6",page:"#000000",surface:"#1c1c1e",border:"#38383a","border-strong":"#636366",accent:"#409cff","accent-text":"#000000","accent-soft":"#0f2b4d",focus:"#409cff","focus-ring":"0 0 0 4px rgba(64, 156, 255, 0.3)",error:"#ff6961","error-soft":"#3a1412",fill:"#2c2c2e",edge:"#636366"}},bootstrap:{light:{font:Sn,text:"#212529",muted:"#5c636a",page:"#f8f9fa",surface:"#ffffff",border:"#dee2e6","border-strong":"#adb5bd",accent:"#0a58ca","accent-text":"#ffffff","accent-soft":"#cfe2ff",focus:"#86b7fe","focus-ring":"0 0 0 0.25rem rgba(13, 110, 253, 0.25)",error:"#b02a37","error-soft":"#f8d7da",radius:"6px","control-radius":"6px","control-height":"38px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#dee2e6",muted:"#adb5bd",page:"#212529",surface:"#2b3035",border:"#495057","border-strong":"#6c757d",accent:"#6ea8fe","accent-text":"#000000","accent-soft":"#031633",focus:"#6ea8fe","focus-ring":"0 0 0 0.25rem rgba(110, 168, 254, 0.25)",error:"#ea868f","error-soft":"#2c0b0e",edge:"#6c757d"}},shadcn:{light:{font:`Geist, Inter, ${Sn}`,text:"#09090b",muted:"#64646c",page:"#fafafa",surface:"#ffffff",border:"#e4e4e7","border-strong":"#a1a1aa",accent:"#18181b","accent-text":"#fafafa","accent-soft":"#f4f4f5",focus:"#a1a1aa","focus-ring":"0 0 0 3px rgba(161, 161, 170, 0.5)",error:"#dc2626","error-soft":"#fef2f2",radius:"10px","control-radius":"8px","control-height":"36px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"24px","gap-y":"16px"},dark:{text:"#fafafa",muted:"#a1a1aa",page:"#09090b",surface:"#18181b",border:"#3f3f46","border-strong":"#71717a",accent:"#e4e4e7","accent-text":"#18181b","accent-soft":"#27272a",focus:"#71717a","focus-ring":"0 0 0 3px rgba(113, 113, 122, 0.5)",error:"#f87171","error-soft":"#450a0a",edge:"#71717a"}},ant:{light:{font:Sn,text:"rgba(0, 0, 0, 0.88)",muted:"rgba(0, 0, 0, 0.55)",page:"#f5f5f5",surface:"#ffffff",border:"#d9d9d9","border-strong":"#bfbfbf",accent:"#1365d9","accent-text":"#ffffff","accent-soft":"#e6f4ff",focus:"#1365d9","focus-ring":"0 0 0 2px rgba(5, 145, 255, 0.12)",error:"#c63c3d","error-soft":"#fff2f0",radius:"8px","control-radius":"6px","pad-y":"4px","pad-x":"11px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"18px"},dark:{text:"rgba(255, 255, 255, 0.85)",muted:"rgba(255, 255, 255, 0.6)",page:"#000000",surface:"#141414",border:"#424242","border-strong":"#595959",accent:"#3c89e8","accent-text":"#000000","accent-soft":"#111a2c",focus:"#3c89e8","focus-ring":"0 0 0 2px rgba(60, 137, 232, 0.2)",error:"#e86e6b","error-soft":"#2c1618",edge:"#595959"}},odoo:{light:{font:Sn,text:"#1f2937",muted:"#4b5563",page:"#f9fafb",surface:"#ffffff",border:"#d1d5db","border-strong":"#9ca3af",accent:"#714b67","accent-text":"#ffffff","accent-soft":"#f3edf2",focus:"#714b67","focus-ring":"none",error:"#c4161c","error-soft":"#fdecec",radius:"4px","control-radius":"0px","pad-y":"3px","pad-x":"4px","input-border":"0 0 1px 0","label-weight":"600","gap-x":"32px","gap-y":"14px"},dark:{text:"#e5e7eb",muted:"#9ca3af",page:"#111827",surface:"#1f2937",border:"#4b5563","border-strong":"#6b7280",accent:"#c79fbc","accent-text":"#1f1020","accent-soft":"#3b2836",focus:"#c79fbc",error:"#f6878b","error-soft":"#3a1214",edge:"#6b7280"}},"google-forms":{light:{font:`Roboto, Arial, ${Sn}`,text:"#202124",muted:"#5f6368",page:"#f0ebf8",surface:"#ffffff",border:"#dadce0","border-strong":"#80868b",accent:"#673ab7","accent-text":"#ffffff","accent-soft":"#ede7f6",focus:"#673ab7","focus-ring":"none",error:"#d93025","error-soft":"#fce8e6",radius:"8px","control-radius":"0px","control-height":"36px","pad-y":"6px","pad-x":"0px","input-border":"0 0 1px 0","label-weight":"400","gap-x":"24px","gap-y":"12px"},dark:{text:"#e8e3ee",muted:"#b8b0c4",page:"#1c1822",surface:"#2a2431",border:"#4a4255","border-strong":"#7b7088",accent:"#c4abf2","accent-text":"#1d1528","accent-soft":"#3b2f52",focus:"#c4abf2",error:"#f28b82","error-soft":"#3c1714",edge:"#7b7088"}}},da=e=>Object.entries(e).map(([t,n])=>`--fd-${t}: ${n};`).join(" "),_e=e=>`:is(.fd-form, .fd-form-dialog, .fd-theme)[data-fd-theme="${e}"]`,Nr=':is(.fd-sections > .fd-section:not([data-style]), .fd-section[data-style="card"][data-on-page])',il=Object.keys(rl).map(e=>{let{light:t,dark:n}=rl[e],r=`${_e(e)}[data-scheme="dark"]`;return`${_e(e)} { ${da(t)} }
|
|
7
|
-
${r} { ${
|
|
8
|
-
@media (prefers-color-scheme: dark) { ${
|
|
1
|
+
/*! Fieldia 0.20.0 · MIT · https://fieldia.dev */
|
|
2
|
+
"use strict";var Fieldia=(()=>{var Ti=Object.defineProperty;var af=Object.getOwnPropertyDescriptor;var sf=Object.getOwnPropertyNames;var df=Object.prototype.hasOwnProperty;var lf=(e,t,n)=>t in e?Ti(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var cf=(e,t)=>{for(var n in t)Ti(e,n,{get:t[n],enumerable:!0})},ff=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of sf(t))!df.call(e,i)&&i!==n&&Ti(e,i,{get:()=>t[i],enumerable:!(r=af(t,i))||r.enumerable});return e};var uf=e=>ff(Ti({},"__esModule",{value:!0}),e);var dn=(e,t,n)=>lf(e,typeof t!="symbol"?t+"":t,n);var $m={};cf($m,{ADDRESS_PARTS:()=>Ki,BROWSER_HOTKEYS:()=>Wi,DEFAULT_LABELS:()=>wc,DRAWN_IN_CELLS:()=>Mu,FIELDIA_CSS:()=>ap,FIELD_NAME:()=>yr,FIELD_TYPES:()=>Mi,FIRST_FIELD:()=>ki,FORMAT_VERSION:()=>Ni,FORM_WIDTHS:()=>ip,HOTKEY:()=>js,ICONS:()=>Dd,MARKDOWN_TOOLS:()=>Lo,MESSAGES:()=>qt,PART_LOOKS:()=>Fs,PART_RANK:()=>gi,RICH_TOOLS:()=>So,SKINS:()=>Rs,TEXT_TOOLS:()=>ko,THEMES:()=>Es,THEME_SKINS:()=>ss,TOKEN_NAMES:()=>ds,VERSION:()=>Am,VIEWER_LABELS:()=>Zt,WIDGET_LABELS:()=>ot,accentShades:()=>wi,addLanguage:()=>_o,applyLook:()=>cr,binaryWidget:()=>li,browserPreferences:()=>ns,builtInWidgets:()=>bc,cardLineFields:()=>Ls,cardLines:()=>ea,cardPart:()=>Qo,cellText:()=>or,charTagsWidget:()=>ka,checkPage:()=>Qr,checkValue:()=>Hn,choicePart:()=>Cr,compileModifier:()=>ut,contrast:()=>lr,countriesIn:()=>qa,createForm:()=>Yi,createMemoryDataSource:()=>md,createWidget:()=>Xt,currencyOf:()=>$r,dayOf:()=>Vn,describeTypes:()=>ni,detailLines:()=>eo,displayValue:()=>It,distributionIds:()=>tl,distributionModel:()=>Ra,distributionWords:()=>ro,drawIcon:()=>rt,emptyValue:()=>er,evaluateModifier:()=>Gs,expressionContext:()=>Wn,facetsToFilter:()=>ri,fileProblem:()=>ti,fileShown:()=>Ma,fill:()=>lt,fillValues:()=>Hs,filtersPart:()=>Dr,focusField:()=>jo,formatBytes:()=>Sn,formatMoney:()=>rr,formatNumber:()=>St,formatPlain:()=>va,groupByFields:()=>_i,headPart:()=>Qt,hostScheduler:()=>ii,hotkeyWords:()=>In,htmlWidget:()=>Ha,imageWidget:()=>Ta,initialValues:()=>Dn,installListStyles:()=>Bo,installPartStyles:()=>hi,installStyles:()=>wo,isEmpty:()=>mn,isModifierValid:()=>Js,isRightToLeft:()=>Zn,isoWeek:()=>bl,jsonProblem:()=>mo,jsonWidget:()=>ja,keepTabIn:()=>hn,kindTextField:()=>sl,labelPlace:()=>Ei,labelWidget:()=>fi,lazyPart:()=>Fn,lineForm:()=>io,lineKind:()=>Lt,linesWidget:()=>Aa,linkAddress:()=>Mr,linkAvatar:()=>Fr,linkCheckboxesWidget:()=>Sa,linkedWords:()=>Nr,loadParts:()=>Pc,localizePage:()=>ei,many2oneWidget:()=>Ar,matchesFilter:()=>Sr,memoryPreferences:()=>Ip,moneyReads:()=>no,mountViewer:()=>Si,normalizeNumber:()=>gn,onelineRuns:()=>Qc,openFormDialog:()=>Wr,openFormPanel:()=>ls,openLineDialog:()=>oo,openSearchDialog:()=>cs,ownCurrency:()=>dl,pageWords:()=>Ks,partFactory:()=>_n,partWidget:()=>Wa,partsFor:()=>fr,pathPart:()=>Or,planSection:()=>qo,progressbarWidget:()=>ci,propertiesWidget:()=>Oa,quietHint:()=>Zc,readFile:()=>so,readText:()=>is,readsAsText:()=>rs,referenceWidget:()=>La,rolesAllow:()=>Qn,sanitizeHtml:()=>sr,saveProblemOf:()=>Bi,saveRefused:()=>sd,scoreOf:()=>ad,settleParts:()=>Pr,shortNumber:()=>Ea,skinFor:()=>Un,splitValues:()=>xr,statusbarWidget:()=>co,suggestions:()=>Lr,summary:()=>lo,tagsWidget:()=>si,textPart:()=>qn,translatePage:()=>wr,ungroup:()=>oi,usesEditor:()=>ql,valuesIn:()=>Di,wait:()=>Ui,wearTokens:()=>Kn,wearsQuiet:()=>fo,wideColumns:()=>pn,widgetPart:()=>ts,withCalendar:()=>po,writeMoney:()=>to});var yr=/^[A-Za-z_][A-Za-z0-9_]*$/,Mi=["char","text","html","integer","float","monetary","boolean","date","datetime","selection","binary","image","many2one","many2many","one2many","reference","properties","json","matrix"];function pn(e){return typeof e=="object"?e.wide:e??1}function Qo(e){return typeof e=="string"?{field:e}:e}function ea(e){return(e?.fields??[]).map(t=>(Array.isArray(t)?t:[t]).map(Qo))}function Ls(e){return[...new Set(ea(e).flatMap(t=>t.map(n=>n.field)))]}var Ni="0.1";var Es=["material","fluent","apple","bootstrap","shadcn","ant","odoo","google-forms"],Rs=["underline","outlined","quiet"];var Fs={inputs:["background","border","corners","textSize","accent"],choices:["accent","background","border","corners","textSize"],groups:["background","border","corners"],buttons:["accent","corners","textSize"],tables:["background","border","textSize"]};var ta=["id","user","editing","context"],na=["id","name","roles"];var Ct=e=>typeof e=="number"&&Number.isFinite(e);function wn(e){return Number.isFinite(e)?Number(e.toPrecision(15)):null}function $s(e,t,n){if(e==="+"&&(typeof t=="string"||typeof n=="string")){let r=As(t),i=As(n);return r===null||i===null?null:r+i}if(!Ct(t)||!Ct(n))return null;switch(e){case"+":return wn(t+n);case"-":return wn(t-n);case"*":return wn(t*n);case"/":return wn(t/n);case"%":return wn(t-n*Math.floor(t/n));default:return null}}function As(e){return e==null?"":typeof e=="string"?e:Ct(e)?String(e):null}function Ts(e){return Ct(e)?wn(-e):null}function Jt(e){return Array.isArray(e)?e.length>0:e!==null&&typeof e=="object"?Object.keys(e).length>0:!!e}function Xr(e,t){let n=10**Math.trunc(t),r=Number((Math.abs(e)*n).toPrecision(15));return wn(Math.sign(e)*Math.round(r)/n)}function On(e){let t=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}`}function Ms(e){let t=e.args[0];return(t.type==="Identifier"?e.env.lines?.(t.name):void 0)??e.value(t)}function Ns(e,t,n,r){let i=e[t];return i&&!(i.type==="Literal"&&typeof i.value=="string")?`${n} takes a condition, in quotes, on the lines: ${r}`:void 0}function Ps(e,t,n){let r=e.args[n];if(r?.type!=="Literal"||typeof r.value!="string")return t;let i=r.value;return t.filter(o=>o!==null&&typeof o=="object"&&e.holds(i,o))}function Os(e){if(typeof e!="string")return null;let t=/^(\d{4})-(\d{2})-(\d{2})/.exec(e);return t?Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]))/864e5:null}function Cs(e,t){let n=e.args.flatMap(i=>{let o=e.value(i);return Array.isArray(o)?o:[o]}).filter(i=>i!=null);return!n.length||!n.every(Ct)&&!n.every(i=>typeof i=="string")?null:n.reduce((i,o)=>(t?o<i:o>i)?o:i)}var Zr=new Map([["round",{takes:[1,2],call({args:e,value:t}){let n=t(e[0]),r=e.length>1?t(e[1]):0;return Ct(n)&&Ct(r)?Xr(n,r):null}}],["abs",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return Ct(n)?Math.abs(n):null}}],["min",{takes:[1,1/0],call:e=>Cs(e,!0)}],["max",{takes:[1,1/0],call:e=>Cs(e,!1)}],["len",{takes:[1,1],call({args:e,value:t}){let n=t(e[0]);return n==null?0:typeof n=="string"||Array.isArray(n)?n.length:null}}],["today",{takes:[0,0],call:({env:e})=>e.today?.()??On(new Date)}],["sum",{takes:[1,3],check(e){let t=e[1];return t&&!(t.type==="Literal"&&typeof t.value=="string")?"sum takes the name of a field, in quotes, after the lines: sum(lines, 'subtotal')":Ns(e,2,"sum",`sum(lines, 'amount', "state == 'done'")`)},call(e){let t=Ms(e);if(t==null)return 0;if(!Array.isArray(t))return null;let n=e.args[1]?.type==="Literal"?e.args[1].value:void 0,r=0;for(let i of Ps(e,t,2)){let o=n===void 0?i:i?.[n];Ct(o)&&(r+=o)}return wn(r)}}],["count",{takes:[1,2],check:e=>Ns(e,1,"count",`count(lines, "state == 'done'")`),call(e){let t=Ms(e);return t==null?0:Array.isArray(t)?Ps(e,t,1).length:null}}],["days",{takes:[2,2],call({args:e,value:t}){let n=Os(t(e[0])),r=Os(t(e[1]));return n===null||r===null?null:r-n}}],["if",{takes:[3,3],call:({args:e,value:t})=>Jt(t(e[0]))?t(e[1]):t(e[2])}]]);function Is(e,[t,n]){return n===0?`${e} takes no values`:t===n?`${e} takes ${t} value${t===1?"":"s"}`:n===1/0?`${e} takes ${t} or more values`:`${e} takes ${t} or ${n} values`}var ra=new Map([["True",!0],["False",!1],["None",null],["true",!0],["false",!1],["null",null]]),pf=new Set(["+","-","*","/","%"]);function kn(e){let t=[];if(!e)return t;let n=/(\(|\)|,|==|!=|<=|>=|<>|<|>|[-+*/%]|not\s+in\b|in\b|and\b|or\b|not\b|\[[^\]]*\]|'[^']*'|"[^"]*"|\d+\.?\d*|\w+(?:\.\w+)*)/iy,r=/\s*/y,i=0;for(;;){if(r.lastIndex=i,r.exec(e),i=r.lastIndex,i>=e.length)return t;n.lastIndex=i;let o=n.exec(e);if(!o)throw new Error(`Unexpected "${e[i]}" at character ${i+1} of: ${e}`);t.push({type:mf(o[0]),value:o[0],position:t.length}),i=n.lastIndex}}function mf(e){let t=e.toLowerCase().trim();return ra.has(e)?"CONSTANT":t==="and"||t==="or"||t==="not"?"LOGICAL":["==","!=","<>","<",">","<=",">="].includes(e)||t==="in"||t==="not in"?"OPERATOR":e==="("||e===")"?"PAREN":pf.has(e)?"ARITHMETIC":e===","?"COMMA":e.startsWith("[")?"LIST":e.startsWith("'")||e.startsWith('"')?"STRING":/^\d+\.?\d*$/.test(e)?"NUMBER":"IDENTIFIER"}var ln=class{constructor(t){dn(this,"tokens");dn(this,"position",0);this.tokens=t}parse(){if(this.tokens.length===0)throw new Error("Cannot parse empty expression");let t=this.parseOr();if(!this.isAtEnd())throw new Error(`Unexpected token at position ${this.position}: ${this.peek()?.value}`);return t}parseOr(){let t=this.parseAnd();for(;this.matchLogical("or");){let n=this.previous().value,r=this.parseAnd();t={type:"BinaryOp",operator:n.toLowerCase(),left:t,right:r}}return t}parseAnd(){let t=this.parseNot();for(;this.matchLogical("and");){let n=this.previous().value,r=this.parseNot();t={type:"BinaryOp",operator:n.toLowerCase(),left:t,right:r}}return t}parseNot(){if(this.matchLogical("not")){let t=this.previous().value,n=this.parseComparison();return{type:"UnaryOp",operator:t.toLowerCase(),operand:n}}return this.parseComparison()}parseComparison(){let t=this.parseSum(),n=["==","!=","<>","<",">","<=",">=","in","not in"];if(this.matchOperator(...n)){let r=this.previous().value,i=this.parseSum();return{type:"BinaryOp",operator:r.toLowerCase(),left:t,right:i}}return t}parseSum(){let t=this.parseProduct();for(;this.match("ARITHMETIC","+","-");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseProduct()};return t}parseProduct(){let t=this.parseUnary();for(;this.match("ARITHMETIC","*","/","%");)t={type:"BinaryOp",operator:this.previous().value,left:t,right:this.parseUnary()};return t}parseUnary(){return this.match("ARITHMETIC","-")?{type:"UnaryOp",operator:"-",operand:this.parseUnary()}:this.parseValue()}parseTuple(t){let n=[t];for(;this.match("COMMA")&&!(this.peek()?.type==="PAREN"&&this.peek()?.value===")");)n.push(this.parseOr());return this.consume("PAREN",")",'Expected "," or ")" in a tuple'),{type:"Literal",value:n.map(gf)}}parseCall(t){let n=Zr.get(t);if(!n)throw new Error(`no function "${t}": the functions are ${[...Zr.keys()].join(", ")}`);this.advance();let r=[];if(!this.match("PAREN",")")){do r.push(this.parseOr());while(this.match("COMMA"));this.consume("PAREN",")",`Expected "," or ")" after a value of ${t}(\u2026)`)}let[i,o]=n.takes;if(r.length<i||r.length>o)throw new Error(Is(t,n.takes));let a=n.check?.(r);if(a)throw new Error(a);return{type:"Call",name:t,args:r}}parseValue(){if(this.match("PAREN","(")){if(this.match("PAREN",")"))return{type:"Literal",value:[]};let t=this.parseOr();return this.check("COMMA")?this.parseTuple(t):(this.consume("PAREN",")","Expected closing parenthesis"),t)}if(this.check("STRING"))return{type:"Literal",value:this.advance().value.slice(1,-1)};if(this.check("CONSTANT")){let t=this.advance();return{type:"Literal",value:ra.get(t.value)??null}}if(this.check("NUMBER")){let t=this.advance();return{type:"Literal",value:Number(t.value)}}if(this.check("LIST")){let t=this.advance();return{type:"Literal",value:hf(t.value)}}if(this.check("IDENTIFIER")){let t=this.advance(),n=this.peek();return n?.type==="PAREN"&&n.value==="("?this.parseCall(t.value):{type:"Identifier",name:t.value}}throw new Error(`Unexpected token: ${this.peek()?.value||"EOF"}`)}match(t,...n){if(this.check(t)){if(n.length===0)return this.advance(),!0;let r=this.peek();if(r&&n.includes(r.value))return this.advance(),!0}return!1}matchLogical(...t){let n=this.peek();if(n&&n.type==="LOGICAL"){let r=n.value.toLowerCase();if(t.map(i=>i.toLowerCase()).includes(r))return this.advance(),!0}return!1}matchOperator(...t){let n=this.peek();if(n&&n.type==="OPERATOR"){let r=n.value.toLowerCase();if(t.map(i=>i.toLowerCase()).includes(r))return this.advance(),!0}return!1}check(t){return this.peek()?.type===t}advance(){return this.isAtEnd()||this.position++,this.previous()}peek(){return this.isAtEnd()?null:this.tokens[this.position]}previous(){return this.tokens[this.position-1]}isAtEnd(){return this.position>=this.tokens.length}consume(t,n,r){if(this.check(t)){let i=this.peek();if(i&&i.value===n)return this.advance()}throw new Error(r)}};function gf(e){if(e.type==="Literal")return e.value;if(e.type==="UnaryOp"&&e.operator==="-"&&e.operand.type==="Literal"&&typeof e.operand.value=="number")return-e.operand.value;throw new Error("a tuple holds values such as 'draft' or 3, not expressions")}function hf(e){try{let t=e.slice(1,-1).trim();if(!t)return[];let n=[],r="",i=!1,o="";for(let a=0;a<t.length;a++){let s=t[a];(s==="'"||s==='"')&&(a===0||t[a-1]!=="\\")&&(i?s===o&&(i=!1,o=""):(i=!0,o=s)),s===","&&!i?(n.push(Vs(r.trim())),r=""):r+=s}return r.trim()&&n.push(Vs(r.trim())),n}catch(t){throw new Error(`Cannot read the list ${e}`,{cause:t})}}function Vs(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):isNaN(Number(e))?e.toLowerCase()==="true"?!0:e.toLowerCase()==="false"?!1:e:Number(e)}function Yt(e,t,n={}){switch(e.type){case"BinaryOp":return bf(e,t,n);case"UnaryOp":return yf(e,t,n);case"Call":return xf(e,t,n);case"Literal":return e.value;case"Identifier":return wf(t,e.name);default:throw new Error(`Unknown AST node type: ${e.type}`)}}function bf(e,t,n){let r=e.operator.toLowerCase();if(r==="and"||r==="or"){let s=Pi(Yt(e.left,t,n));return Jt(s)===(r==="or")?s:Pi(Yt(e.right,t,n))}let i=Pi(Yt(e.left,t,n)),o=Pi(Yt(e.right,t,n)),a=i!==null&&o!==null;switch(r){case"==":return i===o;case"!=":case"<>":return i!==o;case"<":return a&&i<o;case">":return a&&i>o;case"<=":return a&&i<=o;case">=":return a&&i>=o;case"in":return Array.isArray(o)&&o.includes(i);case"not in":return Array.isArray(o)&&!o.includes(i);case"+":case"-":case"*":case"/":case"%":return $s(r,i,o);default:throw new Error(`Unknown binary operator: ${e.operator}`)}}function yf(e,t,n){let r=Yt(e.operand,t,n);switch(e.operator.toLowerCase()){case"not":return!Jt(r);case"-":return Ts(r);default:throw new Error(`Unknown unary operator: ${e.operator}`)}}function xf(e,t,n){let r=Zr.get(e.name);if(!r)throw new Error(`Unknown function: ${e.name}`);return r.call({args:e.args,value:i=>Yt(i,t,n),env:n,holds:(i,o)=>Jt(Yt(vf(i),o,n))})}var Ds=new Map;function vf(e){let t=Ds.get(e);return t||Ds.set(e,t=new ln(kn(e)).parse()),t}function Pi(e){return e===void 0?null:e}function wf(e,t){let n=t.split("."),r=e;for(let i of n){if(r==null)return;r=r[i]}return r}function Cn(e,t){switch(t(e),e.type){case"BinaryOp":Cn(e.left,t),Cn(e.right,t);return;case"UnaryOp":Cn(e.operand,t);return;case"Call":for(let n of e.args)Cn(n,t);return;default:return}}function Oi(e){let t=[];return Cn(e,n=>{if(n.type!=="Identifier")return;let r=n.name.split(".")[0];t.includes(r)||t.push(r)}),t}function Ci(e){let t=[];return Cn(e,n=>{n.type==="Identifier"&&!t.includes(n.name)&&t.push(n.name)}),t}function Ii(e){let t=[];return Cn(e,n=>{if(n.type!=="Call"||n.name!=="count"&&n.name!=="sum")return;let[r,i]=n.name==="count"?[n.args[0],n.args[1]]:[n.args[0],n.args[2]];r.type==="Identifier"&&i?.type==="Literal"&&typeof i.value=="string"&&t.push({lines:r.name,condition:i.value})}),t}function Ws(e){let t=[];return Cn(e,n=>{if(n.type!=="Call"||n.name!=="sum")return;let[r,i]=n.args;r.type==="Identifier"&&i?.type==="Literal"&&t.push({lines:r.name,field:i.value})}),t}function ut(e){if(typeof e!="string"){let n=e===!0;return{source:e,fields:[],paths:[],wheres:[],evaluate:()=>n}}let t=new ln(kn(e)).parse();return{source:e,fields:Oi(t),paths:Ci(t),wheres:Ii(t),evaluate(n,r){try{return Jt(Yt(t,n,r))}catch{return!1}}}}function cn(e){let t=new ln(kn(e)).parse();return{source:e,fields:Oi(t),paths:Ci(t),wheres:Ii(t),sums:Ws(t),evaluate(n,r={}){try{return Yt(t,n,r)??null}catch{return null}}}}function Vi(e){let t=[],n=[],r=new Set,i=[],o=a=>{if(r.has(a))return;let s=i.indexOf(a);if(s!==-1){n.push([...i.slice(s),a]);return}i.push(a);for(let d of e.get(a)??[])e.has(d)&&o(d);i.pop(),r.add(a),t.push(a)};for(let a of e.keys())o(a);return{order:t,cycles:n}}var ia=/\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function Di(e){return[...e.matchAll(ia)].map(t=>t[1])}function Hs(e,t){return e.replace(ia,(n,r)=>t(r))}function xr(e){let t=[],n=0;for(let r of e.matchAll(ia))r.index>n&&t.push({text:e.slice(n,r.index)}),t.push({text:"",field:r[1]}),n=r.index+r[0].length;return n<e.length&&t.push({text:e.slice(n)}),t}var js=/^(shift\+)?[a-z0-9]$/,Wi=["d","e","f"],In=e=>`Alt+${e.startsWith("shift+")?"Shift+":""}${e.slice(-1).toUpperCase()}`;var kf=new Set(["integer","float","monetary"]),Sf=new Set(["integer","float","monetary","one2many","many2many","binary","image"]),Lf=new Set(["integer","float","char"]),Ef=new Set(["date","datetime"]);function zs(e,t,n){e.iconOnly&&!e.icon&&n.report(`${t}.iconOnly`,"a button shown by its icon alone needs an icon"),e.pressedLabel!==void 0&&e.pressed===void 0&&n.report(`${t}.pressedLabel`,"words while pressed need the condition that presses it (pressed)"),(e.menuIcon!==void 0||e.menuLabel!==void 0)&&!e.menu?.length&&n.report(`${t}.menu`,"a chevron of its own needs a menu to open"),n.checkModifiers(e,t,["pressed"]),e.menu?.forEach((r,i)=>Rf(r,`${t}.menu[${i}]`,n))}function Rf(e,t,n){n.claim(e.id,t),n.checkModifiers(e,t),!e.steps&&e.action===void 0&&!e.builtin&&n.report(t,"a menu item needs steps, an action, or a built-in"),e.label===void 0&&!e.builtin&&n.report(`${t}.label`,"a menu item needs words, unless it is a built-in"),e.steps&&n.checkSteps(e.steps,`${t}.steps`)}function Ff(e,t,n){let r=(i,o,a)=>i.forEach((s,d)=>{let l=`${o}[${d}]`;n(s,l,a),s.type==="section"&&r(s.children,`${l}.children`,s),s.type==="tabs"&&s.children.forEach((c,f)=>{n(c,`${l}.children[${f}]`,s),r(c.children,`${l}.children[${f}].children`,c)}),s.type==="field"&&s.lineForm&&r(s.lineForm.children,`${l}.lineForm.children`,s)});if(e.type==="tabs"){n(e,t,e),e.children.forEach((i,o)=>{n(i,`${t}.children[${o}]`,e),r(i.children,`${t}.children[${o}].children`,i)});return}if(e.type!=="list"){if(e.type==="wizard")return e.children.forEach((i,o)=>r(i.children,`${t}.children[${o}].children`,e));if(r(e.children,`${t}.children`,e),e.type==="sheet"){for(let i of["above","before","after","below"])r(e.title?.[i]??[],`${t}.title.${i}`,e);r((e.head?.meta??[]).filter(i=>i.type==="field"),`${t}.head.meta`,e),r(e.head?.band?.children??[],`${t}.head.band.children`,e)}}}function Bs(e,t,n){e.type==="sheet"&&e.head&&$f(e,t,n);let r=new Map,i=0;Ff(e,t,(o,a,s)=>{if(o.type==="tabs"&&o.place==="head"&&(s.type==="sheet"&&!!s.head&&s.children.includes(o)?++i>1&&n.report(`${a}.place`,"a head holds one row of tabs"):n.report(`${a}.place`,"tabs go in the head only from directly in a sheet with a head")),o.type==="tab"&&Af(o,a,n),o.type==="field"&&o.hotkey!==void 0){let d=r.get(o.hotkey);d!==void 0?n.report(`${a}.hotkey`,`Alt+${o.hotkey.toUpperCase()} takes the focus to the field at ${d} already`):r.set(o.hotkey,a)}})}function Af(e,t,n){if(e.iconOnly&&!e.icon&&n.report(`${t}.iconOnly`,"a tab shown by its icon alone needs an icon"),e.count===void 0)return;let r=n.need(e.count,`${t}.count`);r&&!Sf.has(r.type)&&n.report(`${t}.count`,`"${e.count}" is a ${r.type}; a tab counts a number, a table's lines, links or files`)}function $f(e,t,n){let r=e.head,i=`${t}.head`,o=r.kind;if(o){let d=o.field!==void 0?n.need(o.field,`${i}.kind.field`):void 0;if(d&&d.type!=="selection"&&d.type!=="many2one"&&n.report(`${i}.kind.field`,`"${o.field}" is a ${d.type}; a kind is a selection or a many2one`),d?.type==="selection"){let l=new Set(d.options.map(c=>String(c.value)));for(let c of Object.keys(o.looks??{}))l.has(c)||n.report(`${i}.kind.looks.${c}`,`"${c}" is not an option of "${o.field}"`)}if(o.looks&&o.field===void 0&&n.report(`${i}.kind.looks`,"a look for each kind needs the field that holds the kind"),o.numberField!==void 0){let l=n.need(o.numberField,`${i}.kind.numberField`);l&&!Lf.has(l.type)&&n.report(`${i}.kind.numberField`,`"${o.numberField}" is a ${l.type}; a record's number is a number or words`)}}r.meta?.forEach((d,l)=>{let c=`${i}.meta[${l}]`;if(d.type==="field")return n.walkNode(d,c);n.claim(d.id,c),n.checkModifiers(d,c);let f=n.need(d.field,`${c}.field`);f&&!kf.has(f.type)&&n.report(`${c}.field`,`"${d.field}" is a ${f.type}; a link's words follow a number`),d.target!==void 0&&!n.isPart(d.target)&&n.report(`${c}.target`,`no part "${d.target}" on this page`),d.steps&&n.checkSteps(d.steps,`${c}.steps`)}),r.actions?.forEach((d,l)=>{let c=`${i}.actions[${l}]`;n.claim(d.id,c),n.checkModifiers(d,c),n.checkPress(d,c)}),r.band?.children.forEach((d,l)=>n.walkNode(d,`${i}.band.children[${l}]`));let s=r.updated;if(s){n.need(s.byField,`${i}.updated.byField`);let d=n.need(s.atField,`${i}.updated.atField`);d&&!Ef.has(d.type)&&n.report(`${i}.updated.atField`,`"${s.atField}" is a ${d.type}; when it was updated is a date or a datetime`),s.opens!==void 0&&!n.isPlace(s.opens)&&n.report(`${i}.updated.opens`,`no tab "${s.opens}" on this page`)}}var Tf=/^\d+(\.\d+)?(px|%|fr)$/;function qs(e,t,n){if(e.tracks!==void 0){let r=pn(e.columns);e.style==="inline"?n(`${t}.tracks`,"parts on one line take no column widths: each is as wide as it needs"):e.columns===void 0?n(`${t}.tracks`,"column widths need columns: give the group as many columns as widths"):e.tracks.length!==r&&n(`${t}.tracks`,`the group has ${r} column${r===1?"":"s"} and ${e.tracks.length} width${e.tracks.length===1?"":"s"}: give one width for each column`),e.tracks.forEach((i,o)=>{(typeof i!="string"||!Tf.test(i))&&n(`${t}.tracks[${o}]`,`"${i}" is no width: write pixels ("274px"), a share of the row ("50%") or of what is left ("1fr")`)})}e.foldAt!==void 0&&!e.collapsible&&n(`${t}.foldAt`,"the fold control\u2019s place needs a group that folds: collapsible: true"),e.maximise&&!e.title&&n(`${t}.maximise`,"a group is maximised from its heading: give it a title"),e.maximise&&e.style==="inline"&&n(`${t}.maximise`,"a line of parts has no heading to maximise it from")}var At=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_s=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),oa="text, numbers, yes or no, dates, choices and json can",Mf=new Set(["selection","many2one","many2many","boolean","char","integer"]),Nf=e=>{let t=e.map(n=>`"${n}"`);return t.length<2?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`},Hi=class e{constructor(t,n){dn(this,"page",t);dn(this,"line",n);dn(this,"issues",[]);dn(this,"ids",new Map);dn(this,"formNames",new Map);dn(this,"places",new Set);dn(this,"goingTo",[])}run(){return this.checkFields(this.page.fields,"fields",this.line?.name,this.line?.parent),this.walkRoot(this.page.layout,"layout"),Bs(this.page.layout,"layout",{claim:(t,n)=>this.claim(t,n),need:(t,n)=>this.need(t,n),report:(t,n)=>this.report(t,n),walkNode:(t,n)=>this.walkNode(t,n),checkModifiers:(t,n,r)=>this.checkModifiers(t,n,r),checkSteps:(t,n)=>this.checkSteps(t,n),checkPress:(t,n)=>this.checkPress(t,n),isPart:t=>this.ids.has(t),isPlace:t=>this.places.has(t)}),this.page.on&&this.checkEvents(this.page.on,"on"),this.checkGoingTo(),this.issues}checkGoingTo(){for(let{target:t,path:n}of this.goingTo)this.places.has(t)||this.report(n,`no tab or wizard step "${t}" on this page`)}here(){return this.line?{fields:this.page.fields,lines:this.line.name,parent:this.line.parent}:{fields:this.page.fields}}checkLineForm(t,n,r){let i=t.lineForm?.children;if(!Array.isArray(i))return this.report(`${r}.lineForm`,'a line\u2019s form holds its parts: { "children": [...] }');let o={...this.page,fields:n.fields,layout:{type:"sections",id:`${t.id}#line`,children:i},on:void 0},a=new e(o,{name:t.field,parent:this.page.fields});a.walkChildren(i,`${r}.lineForm`),a.checkGoingTo(),this.issues.push(...a.issues)}checkEvents(t,n){for(let r of["open","beforeSave","afterSave"]){let i=t[r];i&&this.checkSteps(i,`${n}.${r}`)}for(let[r,i]of Object.entries(t.change??{}))this.formNames.has(r)||this.need(r,`${n}.change.${r}`),this.checkSteps(i,`${n}.change.${r}`);for(let[r,i]of Object.entries(t.show??{}))this.goingTo.push({target:r,path:`${n}.show.${r}`}),this.checkSteps(i,`${n}.show.${r}`)}checkPress(t,n){let r="menu"in t&&!!t.menu?.length;!t.steps&&t.action===void 0&&!r&&this.report(n,"a button needs steps, an action, or both"),"type"in t&&t.type==="button"&&zs(t,n,{claim:(o,a)=>this.claim(o,a),report:(o,a)=>this.report(o,a),checkModifiers:(o,a,s)=>this.checkModifiers(o,a,s),checkSteps:(o,a)=>this.checkSteps(o,a)});let i="hotkey"in t?t.hotkey:void 0;typeof i=="string"&&Wi.includes(i.replace("shift+",""))&&this.report(`${n}.hotkey`,`${In(i)} is the browser\u2019s own: pick another key`),t.steps&&this.checkSteps(t.steps,`${n}.steps`)}checkSteps(t,n){let r=this.here();t.forEach((i,o)=>{let a=`${n}[${o}]`;switch(this.checkModifiers(i,a,["when"]),i.do){case"set":{let s=this.need(i.field,`${a}.field`);s&&!_s.has(s.type)&&this.report(`${a}.field`,`a ${s.type} cannot be set from an expression; ${oa}`),this.checkExpression(i.value,`${a}.value`,r);return}case"clear":this.need(i.field,`${a}.field`);return;case"addLine":{let s=this.need(i.field,`${a}.field`);if(s&&s.type!=="one2many")return this.report(`${a}.field`,`"${i.field}" is a ${s.type}; a line is added to a one2many`);for(let[d,l]of Object.entries(i.values??{}))s?.type==="one2many"&&!At(s.fields,d)&&this.report(`${a}.values.${d}`,`"${d}" is not a field of the lines of "${i.field}"`),this.checkExpression(l,`${a}.values.${d}`,r);return}case"check":i.fields?.forEach((s,d)=>this.need(s,`${a}.fields[${d}]`));return;case"goTo":this.goingTo.push({target:i.target,path:`${a}.target`});return;case"open":i.page===this.page.id&&i.as==="page"&&this.report(`${a}.page`,"a page cannot open itself in its own place"),i.side!==void 0&&i.as!=="panel"&&this.report(`${a}.side`,`a side is where a panel comes from; this opens ${i.as==="page"?"in its place":"in a dialog"}`),i.record!==void 0&&this.checkExpression(i.record,`${a}.record`,r);for(let[s,d]of Object.entries(i.values??{}))this.checkExpression(d,`${a}.values.${s}`,r);i.filter?.forEach((s,d)=>this.checkFilterItem(s,`${a}.filter[${d}]`,r));for(let[s,d]of Object.entries(i.into??{})){this.need(s,`${a}.into.${s}`);try{cn(d)}catch(l){this.report(`${a}.into.${s}`,`cannot read "${d}": ${l.message}`)}}i.then&&this.checkSteps(i.then,`${a}.then`);return;case"openUrl":this.checkExpression(i.url,`${a}.url`,r);return;default:return}})}checkValuesIn(t,n){for(let r of Di(t))this.need(r,n)}report(t,n){this.issues.push({path:t,message:n})}claim(t,n){let r=this.ids.get(t);r!==void 0?this.report(n,`duplicate id "${t}", also used at ${r}`):this.ids.set(t,n)}need(t,n,r=this.page.fields){if(At(r,t))return r[t];this.report(n,`no field "${t}"`)}checkFilterItem(t,n,r){if("any"in t)return t.any.forEach((i,o)=>this.checkFilterItem(i,`${n}.any[${o}]`,r));if("all"in t)return t.all.forEach((i,o)=>this.checkFilterItem(i,`${n}.all[${o}]`,r));t.valueFrom!==void 0&&this.checkValueFrom(t.valueFrom,`${n}.valueFrom`,r)}checkValueFrom(t,n,r){let[i,o]=t.split(".");if(o===void 0){if(At(r.fields,t)||t==="id"&&r.lines===void 0)return;this.need(t,n,r.fields)}else i==="user"?na.includes(o)||this.report(n,`"${t}": the person has an id, name or roles`):i==="context"||(r.lines===void 0?this.report(n,`"${t}": only a line's filter reads parent, the record it is on`):!At(r.parent??this.page.fields,o)&&o!=="id"&&this.report(n,`"${t}": "${o}" is not a field of this page`))}checkModifiers(t,n,r=["invisible"],i=this.here()){for(let o of r){let a=t[o];if(typeof a!="string")continue;let s;try{s=ut(a)}catch(d){this.report(`${n}.${o}`,`cannot read "${a}": ${d.message}`);continue}this.checkReads(a,s,`${n}.${o}`,i)}}checkReads(t,n,r,i){for(let o of n.wheres){let a=i.fields[o.lines];if(a?.type!=="one2many")continue;let s;try{s=ut(o.condition).fields}catch(d){this.report(r,`cannot read the condition "${o.condition}": ${d.message}`);continue}for(let d of s)At(a.fields,d)||this.report(r,`"${o.condition}" reads "${d}", which is not a field of the lines of "${o.lines}"`)}for(let o of n.fields){if(At(i.fields,o))continue;if(i.lines===void 0?ta.includes(o):o==="user"||o==="parent"||o==="id"||o==="context"){for(let d of n.paths){let[l,c]=d.split(".");l!==o||c===void 0||(o==="user"&&!na.includes(c)&&this.report(r,`"${t}" reads "${d}": the person has an id, name or roles`),o==="parent"&&!At(i.parent??this.page.fields,c)&&!ta.includes(c)&&this.report(r,`"${t}" reads "${d}": "${c}" is not a field of this page`))}continue}let s=i.lines===void 0?"of this page":`of the lines of "${i.lines}"`;this.report(r,`"${t}" reads "${o}", which is not a field ${s}`)}}checkExpression(t,n,r){let i;try{i=cn(t)}catch(o){return this.report(n,`cannot read "${t}": ${o.message}`),null}this.checkReads(t,i,n,r);for(let o of i.sums){if(!At(r.fields,o.lines))continue;let a=r.fields[o.lines];a.type!=="one2many"?this.report(n,`sum adds up the lines of a one2many; "${o.lines}" is a ${a.type}`):At(a.fields,o.field)||this.report(n,`"${o.field}" is not a field of the lines of "${o.lines}"`)}return i.fields}checkWorkedOut(t,n,r){let i=new Map;for(let[o,a]of Object.entries(t)){let s=`${n}.${o}`;if((a.compute!==void 0||a.setWhen)&&!_s.has(a.type)){a.compute!==void 0&&this.report(`${s}.compute`,`a ${a.type} cannot be worked out; ${oa}`),a.setWhen&&this.report(`${s}.setWhen`,`a ${a.type} cannot be set by a condition; ${oa}`);continue}if(a.compute!==void 0){let d=this.checkExpression(a.compute,`${s}.compute`,r);d&&i.set(o,d)}a.setWhen?.forEach((d,l)=>{this.checkModifiers(d,`${s}.setWhen[${l}]`,["when"],r),d.on?.forEach((c,f)=>this.need(c,`${s}.setWhen[${l}].on[${f}]`,t)),this.checkExpression(d.value,`${s}.setWhen[${l}].value`,r)})}for(let o of Vi(i).cycles){let a=o.slice(0,-1),s=a.length===1?`"${a[0]}" is worked out from itself`:`${Nf(a)} are worked out from each other: ${o.join(" \u2192 ")}`;this.report(`${n}.${o[0]}.compute`,s)}}checkFields(t,n,r,i){let o={fields:t,lines:r,...i?{parent:i}:{}};this.checkWorkedOut(t,n,o);for(let[a,s]of Object.entries(t)){let d=`${n}.${a}`;if(s.type==="monetary"&&s.currencyField!==void 0&&this.checkCurrency(s.currencyField,`${d}.currencyField`,t,r,i),s.type==="monetary"&&s.money?.per?.forEach((l,c)=>this.checkModifiers(l,`${d}.money.per[${c}]`,["when"],o)),s.defaultFrom!==void 0&&this.checkExpression(s.defaultFrom,`${d}.defaultFrom`,o),(s.type==="many2one"||s.type==="many2many")&&s.createValues)for(let[l,c]of Object.entries(s.createValues))this.checkExpression(c,`${d}.createValues.${l}`,o);if(s.type==="one2many"&&s.lineDefaults)for(let[l,c]of Object.entries(s.lineDefaults))At(s.fields,l)?this.checkExpression(c,`${d}.lineDefaults.${l}`,o):this.report(`${d}.lineDefaults.${l}`,`"${l}" is not a field of the lines of "${a}"`);if((s.type==="many2one"||s.type==="many2many")&&s.filter&&s.filter.forEach((l,c)=>this.checkFilterItem(l,`${d}.filter[${c}]`,o)),s.type==="selection"&&s.optionsFrom?.dependsOn?.forEach((l,c)=>this.need(l,`${d}.optionsFrom.dependsOn[${c}]`,t)),s.type==="properties"&&s.definitionsFrom?.dependsOn?.forEach((l,c)=>this.need(l,`${d}.definitionsFrom.dependsOn[${c}]`,t)),s.type==="properties"&&s.definitions){let l=new Set;s.definitions.forEach((c,f)=>{c.type==="selection"&&!c.options&&this.report(`${d}.definitions[${f}].options`,"a choice property needs its choices"),l.has(c.name)&&this.report(`${d}.definitions[${f}].name`,`"${c.name}" is named twice`),l.add(c.name)})}if(s.type==="one2many"&&(this.checkFields(s.fields,`${d}.fields`,a,t),"lineKinds"in s&&s.lineKinds&&this.checkLineKinds(a,s.lineKinds,s.fields,`${d}.lineKinds`),s.sequenceField!==void 0)){let l=s.fields[s.sequenceField];l?l.type!=="integer"&&this.report(`${d}.sequenceField`,`"${s.sequenceField}" is a ${l.type}; the field that keeps the order of lines must be an integer`):this.report(`${d}.sequenceField`,`"${s.sequenceField}" is not a field of the lines of "${a}"`)}}}checkCurrency(t,n,r,i,o=this.page.fields){let a;if(!t.startsWith("parent."))a=this.need(t,n,r);else{if(i===void 0)return this.report(n,`"${t}": only a line\u2019s money reads parent, the record it is on`);if(At(o,t.slice(7)))a=o[t.slice(7)];else return this.report(n,`"${t}": "${t.slice(7)}" is not a field of this page`)}a&&!["many2one","selection","char"].includes(a.type)&&this.report(n,`"${t}" is a ${a.type}; a currency field must be a many2one, selection or char`)}checkLineKinds(t,n,r,i){let o=r[n.field];if(!o)this.report(`${i}.field`,`"${n.field}" is not a field of the lines of "${t}"`);else if(o.type!=="selection"&&o.type!=="char")this.report(`${i}.field`,`"${n.field}" is a ${o.type}; the field that says what a line is must be a selection or char`);else if(o.type==="selection")for(let s of["section","note"]){let d=n[s]??s;o.options.some(l=>l.value===d)||this.report(`${i}.${s}`,`"${n.field}" has no option "${d}"`)}let a=r[n.text];a?a.type!=="char"&&a.type!=="text"&&this.report(`${i}.text`,`"${n.text}" is a ${a.type}; a section's or note's text must be a char or text field`):this.report(`${i}.text`,`"${n.text}" is not a field of the lines of "${t}"`)}walkFooter(t,n){t?.forEach((r,i)=>{this.claim(r.id,`${n}.footer[${i}]`),this.checkModifiers(r,`${n}.footer[${i}]`),this.checkPress(r,`${n}.footer[${i}]`)})}walkRoot(t,n){if(t.type==="tabs")return this.walkNode(t,n);if(this.claim(t.id,n),(t.type==="sheet"||t.type==="sections")&&this.walkFooter(t.footer,n),t.type==="sheet")return this.walkSheet(t,n);if(t.type==="sections")return this.walkChildren(t.children,n);if(t.type==="list")return this.walkList(t,n);t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}walkList(t,n){this.page.data.kind!=="record"&&this.report("data",'a list shows records: its data needs kind "record" and a model'),t.columns.forEach((o,a)=>this.need(o,`${n}.columns[${a}]`)),t.sort?.forEach((o,a)=>this.need(o.field,`${n}.sort[${a}].field`)),t.searchFields?.forEach((o,a)=>this.need(o,`${n}.searchFields[${a}]`)),t.groupBy?.forEach((o,a)=>this.need(o,`${n}.groupBy[${a}]`));let r=(o,a)=>{if("any"in o)return o.any.forEach((s,d)=>r(s,`${a}.any[${d}]`));if("all"in o)return o.all.forEach((s,d)=>r(s,`${a}.all[${d}]`));this.need(o.field,`${a}.field`),o.valueFrom!==void 0&&this.report(`${a}.valueFrom`,"a list's filter compares with values, not with another field")},i=new Set;t.filters?.forEach((o,a)=>{this.claim(o.id,`${n}.filters[${a}]`),i.add(o.id),o.filter.forEach((s,d)=>r(s,`${n}.filters[${a}].filter[${d}]`))}),t.defaultFilters?.forEach((o,a)=>{i.has(o)||this.report(`${n}.defaultFilters[${a}]`,`no filter "${o}" in this list`)}),t.actions?.forEach((o,a)=>{this.claim(o.id,`${n}.actions[${a}]`),this.checkPress(o,`${n}.actions[${a}]`)}),t.map&&this.walkListMap(t.map,`${n}.map`),this.checkListCells(t,n)}checkListCells(t,n){for(let[r,i]of Object.entries(t.cells??{})){let o=`${n}.cells.${r}`;if(!t.columns.includes(r)){this.report(o,`"${r}" is no column of this list: its cells are for its columns`);continue}if(!i.lead)continue;let a=this.need(i.lead.field,`${o}.lead.field`);if(a?.type!=="selection")continue;let s=new Set(a.options.map(d=>String(d.value)));for(let d of Object.keys(i.lead.looks))s.has(d)||this.report(`${o}.lead.looks.${d}`,`"${d}" is no value of "${i.lead.field}"`)}t.filterFields&&t.search!=="fields"&&this.report(`${n}.filterFields`,'the filter fields are for the "fields" search: add "search": "fields"'),t.filterFields?.forEach((r,i)=>{let o=this.need(r,`${n}.filterFields[${i}]`);o&&!Mf.has(o.type)&&this.report(`${n}.filterFields[${i}]`,`"${r}" is a ${o.type}; a filter lists the values of a choice, a link, links, a yes or no, text or a whole number`)});for(let r of Object.keys(t.filterLabels??{}))t.filterFields?.includes(r)||this.report(`${n}.filterLabels.${r}`,`"${r}" is no field of filterFields: its name is for a filter the bar offers`);if(t.parentField!==void 0){let r=this.need(t.parentField,`${n}.parentField`),i=this.page.data.kind==="record"?this.page.data.model:"";r&&(r.type!=="many2one"||r.relation!==i)&&this.report(`${n}.parentField`,`"${t.parentField}" ${r.type==="many2one"?`links to ${r.relation}`:`is a ${r.type}`}; a parent is a many2one to the list\u2019s own model, ${i}`)}t.choose===!1&&t.actions?.length&&this.report(`${n}.actions`,'a list\u2019s buttons act on the rows chosen: with "choose": false there is no way to choose one')}walkListMap(t,n){let r=t.latitude!==void 0||t.longitude!==void 0;if(t.point!==void 0&&r?this.report(n,"a map takes point, or latitude and longitude, not both"):t.point===void 0&&(t.latitude===void 0||t.longitude===void 0)&&this.report(n,"a map needs where each record is: point, or latitude and longitude"),this.checkPlace(t,n,this.here(),t.pin,t.card),t.regions&&this.need(t.regions.field,`${n}.regions.field`),typeof t.heat=="object"&&t.heat.weight!==void 0){let i=this.need(t.heat.weight,`${n}.heat.weight`);i&&i.type!=="float"&&i.type!=="integer"&&i.type!=="monetary"&&this.report(`${n}.heat.weight`,`"${t.heat.weight}" is a ${i.type}; a weight is a number field`)}}checkPlace(t,n,r,i,o){let a=(l,c,f,y)=>{if(l===void 0)return;let u=this.need(l,c,r.fields);u&&!f(u.type)&&this.report(c,`"${l}" is a ${u.type}; ${y}`)},s=l=>l==="float"||l==="integer",d=l=>l==="image"||l==="binary";a(t.point,`${n}.point`,l=>l==="json","a point is kept in a json field"),a(t.latitude,`${n}.latitude`,s,"a latitude is a number field (float or integer)"),a(t.longitude,`${n}.longitude`,s,"a longitude is a number field (float or integer)"),i&&(a(i.image,`${n}.pin.image`,d,"a pin's photo is an image or binary field"),a(i.turn,`${n}.pin.turn`,s,"a turn is a number field, in degrees"),i.iconField!==void 0&&this.need(i.iconField,`${n}.pin.iconField`,r.fields),i.label!==void 0&&this.need(i.label,`${n}.pin.label`,r.fields),i.tones?.forEach((l,c)=>this.checkModifiers(l,`${n}.pin.tones[${c}]`,["when"],r)),i.money?.per?.forEach((l,c)=>this.checkModifiers(l,`${n}.pin.money.per[${c}]`,["when"],r))),o&&(o.title!==void 0&&this.need(o.title,`${n}.card.title`,r.fields),a(o.image,`${n}.card.image`,d,"a card's picture is an image or binary field"),o.fields?.forEach((l,c)=>(Array.isArray(l)?l:[l]).forEach((f,y)=>{let u=`${n}.card.fields[${c}]${Array.isArray(l)?`[${y}]`:""}${typeof f=="string"?"":".field"}`;this.need(typeof f=="string"?f:f.field,u,r.fields)})),a(o.href,`${n}.card.href`,l=>l==="char"||l==="text","a card's link is a text field holding a web address"))}walkMap(t,n){let r=new Map;t.layers.forEach((i,o)=>{let a=`${n}.layers[${o}]`;r.has(i.id)&&this.report(`${a}.id`,`two layers are called "${i.id}"`);let s=i.latitude!==void 0||i.longitude!==void 0,d=i.point!==void 0||s;if([d,!!i.route,!!i.myLocation,!!i.regions,!!i.reachable].filter(Boolean).length!==1&&this.report(a,"a layer is one of: a place (point, or latitude and longitude, for the record or for each of its lines), a route, myLocation, regions, or reachable"),i.regions?.choose!==void 0&&this.need(i.regions.choose,`${a}.regions.choose`),i.point!==void 0&&s?this.report(a,"a layer takes point, or latitude and longitude, not both"):i.point===void 0&&s&&(i.latitude===void 0||i.longitude===void 0)&&this.report(a,"a layer needs both latitude and longitude"),i.lines!==void 0&&!d&&this.report(`${a}.lines`,"a layer of lines needs where each line is: point, or latitude and longitude, of the line's fields"),i.live&&(!d||i.lines!==void 0)&&this.report(`${a}.live`,"live is for a layer of the record's own place: it moves as its fields change"),this.checkModifiers(i,a,["invisible"]),r.set(i.id,{lines:i.lines!==void 0,place:d||!!i.myLocation}),!d)return;if(i.lines===void 0)return this.checkPlace(i,a,this.here(),i.pin,i.card);let c=this.need(i.lines,`${a}.lines`);if(c){if(c.type!=="one2many")return this.report(`${a}.lines`,`"${i.lines}" is a ${c.type}; a layer of lines is a one2many field`);this.checkPlace(i,a,{fields:c.fields,lines:i.lines,parent:this.page.fields},i.pin,i.card)}}),t.layers.forEach((i,o)=>{let a=i.route;if(!a)return;let s=`${n}.layers[${o}].route`,d=(f,y)=>{if(f===void 0)return;let u=r.get(f);u?(!u.place||u.lines)&&this.report(`${s}.${y}`,`a route's ${y} is a layer of one place, or the reader's own; "${f}" is not`):this.report(`${s}.${y}`,`no layer "${f}" on this map`)};if(d(a.from,"from"),d(a.to,"to"),a.through!==void 0){let f=r.get(a.through);f?f.lines||this.report(`${s}.through`,`a route goes through a layer of lines; "${a.through}" is not one`):this.report(`${s}.through`,`no layer "${a.through}" on this map`)}a.to===void 0&&a.through===void 0&&this.report(s,"a route needs where it goes: to, or through");let l=(f,y,u,k)=>{if(f===void 0)return;let h=this.need(f,`${s}.write.${y}`);h&&!u(h.type)&&this.report(`${s}.write.${y}`,`"${f}" is a ${h.type}; ${k}`)},c=f=>f==="float"||f==="integer";l(a.write?.seconds,"seconds",c,"seconds are a number field"),l(a.write?.metres,"metres",c,"metres are a number field"),l(a.write?.line,"line",f=>f==="json","a line is kept in a json field")}),t.layers.forEach((i,o)=>{if(!i.reachable)return;let a=r.get(i.reachable.from),s=`${n}.layers[${o}].reachable.from`;a?(!a.place||a.lines)&&this.report(s,`a reachable area is worked out from a layer of one place, or the reader's own; "${i.reachable.from}" is not`):this.report(s,`no layer "${i.reachable.from}" on this map`)}),t.fences?.forEach((i,o)=>{let a=`${n}.fences[${o}]`,s=t.layers.find(d=>d.id===i.layer);if(s?!s.live&&!s.myLocation&&this.report(`${a}.layer`,`a fence watches a place that moves: a live layer, or the reader's own; "${i.layer}" is not`):this.report(`${a}.layer`,`no layer "${i.layer}" on this map`),i.area!==void 0){let d=this.need(i.area,`${a}.area`);d&&d.type!=="json"&&this.report(`${a}.area`,`"${i.area}" is a ${d.type}; an area is kept in a json field`)}i.within!==void 0&&!t.layers.some(d=>d.id===i.within&&d.reachable)&&this.report(`${a}.within`,`a fence is within a reachable area of this map; "${i.within}" is not one`),this.checkSteps(i.steps,`${a}.steps`)})}walkChildren(t,n){t.forEach((r,i)=>this.walkNode(r,`${n}.children[${i}]`))}walkNode(t,n){switch(this.claim(t.id,n),this.checkModifiers(t,n,t.type==="field"?["invisible","readonly","required"]:t.type==="section"||t.type==="form"?["invisible","readonly"]:["invisible"]),t.type){case"field":return this.checkFieldNode(t,n);case"section":return t.collapsible&&!t.title&&this.report(n,"a collapsible section needs a title to fold it by"),t.collapsed&&!t.collapsible&&this.report(n,"collapsed needs collapsible: true"),t.style==="inline"&&t.columns!==void 0&&this.report(`${n}.columns`,"parts on one line take no columns: each is as wide as it needs"),t.style==="inline"&&t.collapsible&&this.report(`${n}.collapsible`,"a line of parts does not fold: its title is its label"),t.style==="inline"&&t.children.forEach((r,i)=>{["field","text","button","spacer"].includes(r.type)||this.report(`${n}.children[${i}]`,`a line of parts holds fields, words and buttons; a ${r.type} needs a row of its own`)}),qs(t,n,(r,i)=>this.report(r,i)),this.walkChildren(t.children,n);case"tabs":return this.walkTabs(t,n);case"form":return this.checkFormNode(t,n);case"button":return this.checkPress(t,n);case"text":return this.checkValuesIn(t.text,`${n}.text`);case"map":return this.walkMap(t,n);default:return}}checkFormNode(t,n){if(typeof t.page!="string"||typeof t.name!="string")return this.report(n,"a saved form placed here needs the page\u2019s id and a name for its answers");t.page===this.page.id&&this.report(`${n}.page`,"a page cannot be placed inside itself");let r=this.formNames.get(t.name);At(this.page.fields,t.name)?this.report(`${n}.name`,`"${t.name}" is a field of this page: the saved form\u2019s answers need a name of their own`):r!==void 0?this.report(`${n}.name`,`the answers of the saved form at ${r} go under "${t.name}" already: give each copy a name of its own`):this.formNames.set(t.name,n)}walkTabs(t,n){t.children.forEach((r,i)=>{let o=`${n}.children[${i}]`;this.places.add(r.id),this.claim(r.id,o),this.checkModifiers(r,o),this.walkChildren(r.children,o)})}walkSheet(t,n){if(t.title&&(this.need(t.title.field,`${n}.title.field`),t.title.subtitleField!==void 0&&this.need(t.title.subtitleField,`${n}.title.subtitleField`),t.title.avatarField!==void 0&&this.need(t.title.avatarField,`${n}.title.avatarField`),t.title.placeholderWhen?.forEach((o,a)=>this.checkModifiers(o,`${n}.title.placeholderWhen[${a}]`,["when"]))),t.statusbar){let{field:o,visibleStates:a,durationsField:s,fold:d,saves:l,clickable:c}=t.statusbar,f=`${n}.statusbar`;if(this.checkModifiers(t.statusbar,f),s!==void 0){let u=this.need(s,`${f}.durationsField`);u&&u.type!=="json"&&this.report(`${f}.durationsField`,`"${s}" is a ${u.type}; time per step comes from a json field`)}l&&!c&&this.report(`${f}.saves`,"a click saves only where a step can be clicked (clickable)");let y=this.need(o,`${n}.statusbar.field`);if(d&&y&&y.type!=="many2one"&&this.report(`${f}.fold`,"steps fold by their record (a stage), so only a link\u2019s steps fold; a choice keeps the steps it shows with visibleStates"),y&&y.type!=="selection"&&y.type!=="many2one"&&this.report(`${n}.statusbar.field`,`"${o}" is a ${y.type}; a statusbar needs a selection or many2one`),y?.type==="selection"&&a){let u=new Set(y.options.map(k=>k.value));a.forEach((k,h)=>{u.has(k)||this.report(`${n}.statusbar.visibleStates[${h}]`,`"${k}" is not an option of "${o}"`)})}}t.buttons?.forEach((o,a)=>{this.claim(o.id,`${n}.buttons[${a}]`),this.checkModifiers(o,`${n}.buttons[${a}]`),this.checkPress(o,`${n}.buttons[${a}]`)}),t.statButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.statButtons[${a}]`),this.checkModifiers(o,`${n}.statButtons[${a}]`),this.checkPress(o,`${n}.statButtons[${a}]`);for(let s of["field","unitField","labelField","secondField"]){let d=o[s];d!==void 0&&this.need(d,`${n}.statButtons[${a}].${s}`)}o.secondLabel!==void 0&&o.secondField===void 0&&this.report(`${n}.statButtons[${a}].secondLabel`,"words for a second value need its field (secondField)")});let r=[...t.ribbon?[[t.ribbon,`${n}.ribbon`]]:[],...(t.ribbons??[]).map((o,a)=>[o,`${n}.ribbons[${a}]`])];for(let[o,a]of r)this.claim(o.id,a),this.checkModifiers(o,a),o.labelField!==void 0&&this.need(o.labelField,`${a}.labelField`);t.badges?.forEach((o,a)=>{this.claim(o.id,`${n}.badges[${a}]`),this.checkModifiers(o,`${n}.badges[${a}]`)});for(let o of["above","before","after","below"])t.title?.[o]?.forEach((a,s)=>this.walkNode(a,`${n}.title.${o}[${s}]`));t.alerts?.forEach((o,a)=>{let s=`${n}.alerts[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),this.checkValuesIn(o.message,`${s}.message`),o.messageField!==void 0&&this.need(o.messageField,`${s}.messageField`),o.buttons?.forEach((d,l)=>{this.claim(d.id,`${s}.buttons[${l}]`),this.checkModifiers(d,`${s}.buttons[${l}]`),this.checkPress(d,`${s}.buttons[${l}]`)})}),t.toolbar?.menu?.forEach((o,a)=>{let s=`${n}.toolbar.menu[${a}]`;this.claim(o.id,s),this.checkModifiers(o,s),!o.steps&&o.action===void 0&&!o.builtin&&this.report(s,"a menu item needs steps, an action, or a built-in"),o.label===void 0&&!o.builtin&&this.report(`${s}.label`,"a menu item needs words, unless it is a built-in"),o.steps&&this.checkSteps(o.steps,`${s}.steps`)});let i=t.attachmentPreview;if(i){this.checkModifiers(i,`${n}.attachmentPreview`);let o=i.field!==void 0?this.need(i.field,`${n}.attachmentPreview.field`):void 0;o&&o.type!=="binary"&&o.type!=="image"&&this.report(`${n}.attachmentPreview.field`,`"${i.field}" is a ${o.type}; the preview shows a file (binary or image)`)}this.walkChildren(t.children,n),t.sidePanel&&(this.claim(t.sidePanel.id,`${n}.sidePanel`),this.checkModifiers(t.sidePanel,`${n}.sidePanel`))}checkAddressSearch(t,n,r){let i=t.options??{},o=l=>{let c=i[l];return typeof c=="string"&&At(this.page.fields,c)?this.page.fields[c].type:void 0};n&&n.type!=="char"&&this.report(`${r}.widget`,`address-search is for a char field; "${t.field}" is a ${n.type}`);let a=o("placeField");a&&a!=="json"&&a!=="float"&&this.report(`${r}.options.placeField`,`"${i.placeField}" is a ${a}; a place is kept in a json field, or in a float field (its latitude) with longitudeField`),a==="float"&&i.longitudeField===void 0&&this.report(`${r}.options.placeField`,`"${i.placeField}" keeps a latitude: name the float field for its longitude in longitudeField`),i.longitudeField!==void 0&&a!=="float"&&this.report(`${r}.options.longitudeField`,"longitudeField goes with a placeField that is a float field, its latitude");let s=o("longitudeField");s&&s!=="float"&&this.report(`${r}.options.longitudeField`,`"${i.longitudeField}" is a ${s}; a longitude is kept in a float field`);let d=o("partsField");d&&d!=="json"&&this.report(`${r}.options.partsField`,`"${i.partsField}" is a ${d}; an address's parts are kept in a json field`)}checkPicker(t,n,r){let i=t.options??{};t.widget==="path"&&n.type!=="many2one"&&this.report(`${r}.widget`,`path is for a many2one field; "${t.field}" is a ${n.type}`);let o=n.type==="selection"&&!n.multiple&&!t.widget;i.list!==void 0&&!o&&this.report(`${r}.options.list`,`list "own" is for a choice of one drawn as a list, with no widget; "${t.field}" is ${n.type==="selection"?`a selection${n.multiple?" of several":` drawn as ${t.widget}`}`:`a ${n.type}`}`);let a=n.type==="many2many"&&(!t.widget||t.widget==="tags")&&!t.columns?.length||n.type==="char"&&t.widget==="tags";i.adder!==void 0&&!a&&this.report(`${r}.options.adder`,`adder is for tags: a many2many, or a char field drawn as tags; "${t.field}" is ${t.widget?`a ${n.type} drawn as ${t.widget}`:`a ${n.type}`}`);let s=i.colours;if(t.widget==="dot"&&n.type==="selection"&&s&&typeof s=="object"&&!Array.isArray(s)){let d=new Set(n.options.map(l=>String(l.value)));for(let l of Object.keys(s))d.has(l)||this.report(`${r}.options.colours.${l}`,`"${l}" is not a value of "${t.field}"`)}}checkFieldNode(t,n){let r=this.need(t.field,`${n}.field`);t.validate?.forEach((i,o)=>{let a=`${n}.validate[${o}]`;if(this.checkModifiers(i,a,["when","holds"]),i.distinct!==void 0&&r&&(r.type!=="one2many"?this.report(`${a}.distinct`,`distinct is for a table of lines; "${t.field}" is a ${r.type}`):At(r.fields,i.distinct)||this.report(`${a}.distinct`,`"${i.distinct}" is not a field of the lines of "${t.field}"`)),i.pattern!==void 0)try{new RegExp(i.pattern)}catch{this.report(`${a}.pattern`,`"${i.pattern}" is not a regular expression`)}}),t.tones?.forEach((i,o)=>this.checkModifiers(i,`${n}.tones[${o}]`,["when"])),t.placeholderWhen?.forEach((i,o)=>this.checkModifiers(i,`${n}.placeholderWhen[${o}]`,["when"])),this.checkModifiers(t,n,["bold"]),r&&t.totals&&(r.type!=="one2many"?this.report(`${n}.totals`,`totals only apply to one2many fields; "${t.field}" is a ${r.type}`):t.totals.forEach((i,o)=>{let a=At(r.fields,i)?r.fields[i]:void 0;a?["integer","float","monetary"].includes(a.type)||this.report(`${n}.totals[${o}]`,`"${i}" is a ${a.type}; only integer, float and monetary columns add up`):this.report(`${n}.totals[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}));for(let[i,o]of Object.entries(t.options??{}))i.endsWith("Field")&&typeof o=="string"&&this.need(o,`${n}.options.${i}`);t.widget==="address-search"&&this.checkAddressSearch(t,r,n),r&&this.checkPicker(t,r,n),r&&t.order&&(r.type!=="one2many"?this.report(`${n}.order`,`order only applies to one2many fields; "${t.field}" is a ${r.type}`):t.order.forEach((i,o)=>!At(r.fields,i.field)&&this.report(`${n}.order[${o}].field`,`"${i.field}" is not a field of the lines of "${t.field}"`))),r&&t.lineForm&&(r.type!=="one2many"?this.report(`${n}.lineForm`,`lineForm only applies to one2many fields; "${t.field}" is a ${r.type}`):this.checkLineForm(t,r,n));for(let i of["lineOpens","cards","fit"])r&&t[i]&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only applies to one2many fields; "${t.field}" is a ${r.type}`);if(r&&t.editMode&&r.type!=="one2many"&&this.report(`${n}.editMode`,`editMode only applies to one2many fields; "${t.field}" is a ${r.type}`),r&&t.lineDelete!==void 0&&r.type!=="one2many"&&this.report(`${n}.lineDelete`,`lineDelete only applies to one2many fields; "${t.field}" is a ${r.type}`),r&&(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons||t.lineDelete!==void 0))if(r.type!=="one2many")(t.cells||t.rowTones||t.rowBold!==void 0||t.rowButtons)&&this.report(n,`cells, rowTones, rowBold and rowButtons only apply to one2many fields; "${t.field}" is a ${r.type}`);else{let i={fields:r.fields,lines:t.field};for(let[o,a]of Object.entries(t.cells??{})){if(!At(r.fields,o)){this.report(`${n}.cells.${o}`,`"${o}" is not a field of the lines of "${t.field}"`);continue}this.checkModifiers(a,`${n}.cells.${o}`,["invisible","readonly","required","bold"],i),this.checkModifiers(a,`${n}.cells.${o}`,["hidden"]),a.tones?.forEach((s,d)=>this.checkModifiers(s,`${n}.cells.${o}.tones[${d}]`,["when"],i));for(let[s,d]of Object.entries(a.options??{}))s.endsWith("Field")&&typeof d=="string"&&this.need(d,`${n}.cells.${o}.options.${s}`,r.fields)}t.rowTones?.forEach((o,a)=>this.checkModifiers(o,`${n}.rowTones[${a}]`,["when"],i)),this.checkModifiers(t,n,["rowBold","lineDelete"],i),t.rowButtons?.forEach((o,a)=>{this.claim(o.id,`${n}.rowButtons[${a}]`),this.checkModifiers(o,`${n}.rowButtons[${a}]`,["invisible"],i),this.checkPress(o,`${n}.rowButtons[${a}]`)})}for(let i of["selectedButtons","controlButtons"])t[i]&&(r&&r.type!=="one2many"&&this.report(`${n}.${i}`,`${i} only apply to one2many fields; "${t.field}" is a ${r.type}`),t[i].forEach((o,a)=>{this.claim(o.id,`${n}.${i}[${a}]`),this.checkModifiers(o,`${n}.${i}[${a}]`),this.checkPress(o,`${n}.${i}[${a}]`)}));if(r&&t.optionalColumns)if(r.type!=="one2many")this.report(`${n}.optionalColumns`,`optional columns only apply to one2many fields; "${t.field}" is a ${r.type}`);else{let i=t.columns??Object.keys(r.fields).filter(o=>o!==("lineKinds"in r?r.lineKinds?.field:void 0)&&o!==r.sequenceField);for(let o of Object.keys(t.optionalColumns))i.includes(o)||this.report(`${n}.optionalColumns.${o}`,`"${o}" is not a column of "${t.field}"`)}!r||!t.columns||(r.type==="one2many"?t.columns.forEach((i,o)=>{At(r.fields,i)?r.fields[i].type==="one2many"&&this.report(`${n}.columns[${o}]`,`"${i}" holds lines of its own: they are edited in the line's form (lineForm), not drawn in its row`):this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the lines of "${t.field}"`)}):r.type==="many2many"?t.columns.forEach((i,o)=>{(!r.fields||!At(r.fields,i))&&this.report(`${n}.columns[${o}]`,`"${i}" is not a field of the records of "${t.field}"`)}):this.report(`${n}.columns`,`columns only apply to one2many and many2many fields; "${t.field}" is a ${r.type}`))}};var vr=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Pf=["sheet","sections","tabs","wizard"];function Qr(e,t={}){if(!vr(e))return{ok:!1,issues:[{path:"(page)",message:"a page is a JSON object"}]};let n=[],r=(l,c)=>n.push({path:l,message:c});e.fieldia!=="0.1"&&r("fieldia",`this build reads format ${"0.1"}`),(typeof e.id!="string"||!e.id)&&r("id","a page needs an id");let i=e.data;(!vr(i)||!(i.kind==="responses"||i.kind==="record"&&typeof i.model=="string"&&i.model))&&r("data",'data is { "kind": "record", "model": \u2026 } or { "kind": "responses" }');let o=e.fields;if(!vr(o))r("fields","fields is an object of field definitions, by name");else for(let[l,c]of Object.entries(o))(!vr(c)||!Mi.includes(c.type)||typeof c.label!="string")&&r(`fields.${l}`,"a field needs a type Fieldia knows and a label");let a=e.layout,s=vr(a)&&a.type==="list";if((!vr(a)||(s?!Array.isArray(a.columns):!Pf.includes(a.type)||!Array.isArray(a.children)))&&r("layout","the layout is a sheet, sections, tabs or wizard, with children, or a list with columns"),n.length)return{ok:!1,issues:n};let d=e;try{let l=new Hi(d,t.parent?{name:d.id,parent:t.parent}:void 0).run();return l.length?{ok:!1,issues:l}:{ok:!0,page:d}}catch(l){return{ok:!1,issues:[{path:"(page)",message:`a part of this page cannot be read: ${l.message}`}]}}}var Of=new Set(["title","description","label","help","placeholder","message","text","confirm","alt","caption","tooltip","unit","readonlyReason"]),Cf=new Set(["help","emptyLink"]),If=e=>t=>t!==null&&typeof t=="object"&&typeof t.label=="string"?{...t,label:e(t.label)}:t,Vf=new Set(["lineKinds","filter","default","data","translations","optionalColumns","values","into","params","map"]),Df=e=>t=>{if(t===null||typeof t!="object"||Array.isArray(t))return t;let n=t.unit;return typeof n=="string"?{...t,unit:e(n)}:n===null||typeof n!="object"?t:{...t,unit:Object.fromEntries(Object.entries(n).map(([r,i])=>[r,typeof i=="string"?e(i):i]))}},Us=e=>t=>{if(t===null||typeof t!="object")return t;let n=t.card;if(!n||!Array.isArray(n.fields))return t;let r=Df(e);return{...t,card:{...n,fields:n.fields.map(i=>Array.isArray(i)?i.map(r):r(i))}}},Wf=e=>t=>{let n=t!==null&&typeof t=="object"&&typeof t.label=="string"?{...t,label:e(t.label)}:t;return Us(e)(n)};function ji(e,t,n,r,i=!1){if(typeof e=="string")return t!==null&&(t.endsWith("Label")||(i?Cf:Of).has(t))?n(e):e;if(Array.isArray(e))return e.map(a=>ji(a,null,n,r,i));if(e===null||typeof e!="object")return e;r?.(e);let o={};for(let[a,s]of Object.entries(e))a==="layers"&&Array.isArray(s)?o[a]=s.map(Wf(n)):i&&a==="references"&&Array.isArray(s)?o[a]=s.map(If(n)):a==="map"&&s!==null&&typeof s=="object"&&!Array.isArray(s)?o[a]=Us(n)(s):(a==="words"||a==="filterLabels")&&s!==null&&typeof s=="object"&&!Array.isArray(s)?o[a]=Object.fromEntries(Object.entries(s).map(([d,l])=>[d,typeof l=="string"?n(l):l])):o[a]=Vf.has(a)?s:ji(s,a,n,r,i||a==="options"&&!Array.isArray(s));return o}function wr(e,t){return ji(e,null,t)}function Ks(e){let t=new Set,n=e.fields,r=(i,o=null)=>ji(i,o,a=>(a.trim()&&t.add(a),a),a=>{a.type==="wizard"&&r(a.children);let s=a.type==="field"?n[a.field]:void 0;if(s){for(let[d,l]of[[a,"label"],[s,"label"],[a,"placeholder"],[a,"help"],[s,"help"],[a,"readonlyReason"]])r(d[l],l);r(s)}});return r({title:e.title,description:e.description,layout:e.layout}),r(e),[...t]}function ei(e,t){let n=e.translations?.[t]??e.translations?.[t.split("-")[0]];return n?wr(e,r=>n[r]??r):e}function Zn(e){let[t,...n]=e.toLowerCase().split("-"),r=n.find(i=>i.length===4&&!/\d/.test(i));return r?/^(arab|hebr|syrc|thaa|nkoo|adlm|rohg)$/.test(r):/^(ar|he|iw|fa|ur|ps|sd|yi|dv|ckb|ug|ks|syr|prs|pnb|azb)$/.test(t)}function Qn(e,t){if(!e?.length)return!0;let n=e.filter(r=>!r.startsWith("!"));return e.some(r=>r.startsWith("!")&&t.includes(r.slice(1)))?!1:!n.length||n.some(r=>t.includes(r))}function Gs(e,t){if(e===void 0)return!1;if(typeof e=="boolean")return e;if(e==="1"||e==="True"||e==="true")return!0;if(e==="0"||e==="False"||e==="false"||e==="")return!1;try{let n=kn(e);if(n.length===0)return!1;let i=new ln(n).parse(),o=Yt(i,t);return Jt(o)}catch{return!1}}function Js(e){if(e===void 0||typeof e=="boolean"||e==="")return!0;try{let t=kn(e);return t.length===0||new ln(t).parse(),!0}catch{return!1}}var Ys={};var Hf={required:"{label} is required",maxLength:"Maximum {max} characters allowed",pattern:"{label} is not in the expected format",text:"{label} must be text",number:"{label} must be a number",integer:"{label} must be a whole number",min:"{label} must be at least {min}",max:"{label} must be at most {max}",decimals:"Maximum {digits} decimal places allowed",boolean:"{label} must be yes or no",dateFormat:"Invalid date format (expected YYYY-MM-DD)",dateInvalid:"Invalid date (check month/day values)",datetimeFormat:"Invalid date and time format (expected YYYY-MM-DDTHH:MM:SS)",datetimeInvalid:"Invalid date and time (check the values)",choice:"Must be one of: {options}",choiceOrOther:"Must be one of: {options}, or an answer of its own",matrix:"{label} takes an answer for each row",matrixRow:"Rows are: {rows}",matrixRows:"Answer every row of {label}",choices:"{label} must be a list of choices",record:"{label} must be a record",records:"{label} must be a list of records",reference:"{label} must point to {aModels}",file:"{label} must be a file",fileSize:"{label} is larger than {size}",fileType:"{label} must be {aTypes} file",minFiles:"Add at least {min} files to {label}",maxFiles:"Too many files for {label}: at most {max}",minLength:"{label} must be at least {min} characters",endsWith:"{label} must end with {ending}",atLeast:"Choose at least {min} for {label}",atMost:"Choose at most {max} for {label}",datePast:"{label} must be in the past",dateFuture:"{label} must be in the future",holds:"{label} does not agree with the other answers",distinct:"{column}: {value} is on more than one line of {label}",or:"or",tick:"Tick this box to go on",email:"Enter an email address, like name@example.com",url:"Enter a web address, like example.com",phone:"Enter a phone number, like +20 100 123 4567",time:"Enter a time, like 14:30",before:"{label} can\u2019t be before {min}",after:"{label} can\u2019t be after {max}",weekday:"{label} can\u2019t be on a {days}",minLines:"Add at least {min} to {label}",maxLines:"Too many in {label}: at most {max}",addressParts:"Street address|Address line 2|City|State or region|Postcode|Country",archiveConfirm:"Are you sure that you want to archive this record?",deleteConfirm:"Are you sure you want to delete this record?",locale:"en"},qt={en:Hf,...Ys};function lt(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n)}function Vn(e,t=On(new Date)){let n=/^today([+-]\d+)?$/.exec(e);if(!n)return e;let[r,i,o]=t.split("-").map(Number);return new Date(Date.UTC(r,i-1,o+Number(n[1]??0))).toISOString().slice(0,10)}var Xs=(e,t,n)=>new Intl.DateTimeFormat(t.locale,{...e,timeZone:"UTC",numberingSystem:"latn"}).format(n);function aa(e,t,n,r){if(e.type!=="date"&&e.type!=="datetime")return;let i=e.type==="date"?t:On(new Date(t)),o=(c,f)=>lt(r[c],{label:e.label,min:f,max:f,days:f}),a=c=>Xs({day:"numeric",month:"long",year:"numeric"},r,Date.parse(c)),s=e.min&&Vn(e.min,n),d=e.max&&Vn(e.max,n);if(s&&i<s)return o("before",a(s));if(d&&i>d)return o("after",a(d));let l=e.days;if(l&&!l.includes(new Date(Date.parse(i)).getUTCDay()||7)){let c=[1,2,3,4,5,6,7].filter(f=>!l.includes(f)).map(f=>Xs({weekday:"long"},r,Date.UTC(2024,0,f)));return o("weekday",c.length>1?`${c.slice(0,-1).join(", ")} ${r.or} ${c[c.length-1]}`:c[0])}}function er(e){switch(e.type){case"boolean":return!1;case"many2many":case"one2many":return[];case"selection":case"binary":case"image":return e.multiple?[]:null;default:return null}}function Dn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=i.default;n[r]=o===void 0?er(i):i.type==="date"&&typeof o=="string"&&o.startsWith("today")?Vn(o,t):Te(o)}return n}function mn(e,t){return t==null?!0:typeof t=="string"?t.trim()==="":Array.isArray(t)?t.length===0:e.type==="matrix"&&typeof t=="object"?Object.values(t).every(n=>n==null||Array.isArray(n)&&!n.length):!1}function Wn(e,t){let n={};for(let[r,i]of Object.entries(e)){let o=t[r];n[r]=o?jf(o,i):i}return n}function jf(e,t){if(t==null)return null;switch(e.type){case"many2one":return t.id;case"many2many":return t.map(n=>n.id);case"one2many":return t.map(n=>n.key);case"reference":{let n=t;return`${n.model},${n.id}`}case"binary":case"image":return Array.isArray(t)?t.map(n=>n.name):t.name;default:return t}}function Lt(e,t){let n=e.lineKinds;if(!n)return null;let r=t[n.field];return r===(n.section??"section")?"section":r===(n.note??"note")?"note":null}function zi(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function Te(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function Hn(e,t,n,r=qt.en,i){let o=e.label||"This field",a=(s,d={})=>lt(r[s],{label:o,...d});if(mn(e,t))return n?a("required"):void 0;if(e.type==="matrix")return zf(e,t,n,a);switch(e.type){case"char":case"text":case"html":return typeof t!="string"?a("text"):(e.type==="char"||e.type==="text")&&e.size!==void 0&&t.length>e.size?a("maxLength",{max:e.size}):e.type==="char"&&e.pattern!==void 0&&!new RegExp(e.pattern).test(t)?a("pattern"):void 0;case"integer":case"float":case"monetary":return typeof t!="number"||!Number.isFinite(t)?a("number"):e.type==="integer"&&!Number.isInteger(t)?a("integer"):e.min!==void 0&&t<e.min?a("min",{min:e.min}):e.max!==void 0&&t>e.max?a("max",{max:e.max}):e.type!=="integer"&&e.digits&&Bf(t)>e.digits[1]?a("decimals",{digits:e.digits[1]}):void 0;case"boolean":return typeof t=="boolean"?void 0:a("boolean");case"date":return qf(t,a)??aa(e,t,i,r);case"datetime":return Uf(t,a)??aa(e,t,i,r);case"selection":{if(e.optionsFrom)return;let s=new Set(e.options.map(c=>c.value)),d=a(e.other?"choiceOrOther":"choice",{options:e.options.map(c=>c.label).join(", ")}),l=c=>(e.other===!0||e.ownAnswers===!0)&&typeof c=="string"&&c.trim()!==""&&!s.has(c);return e.multiple?Array.isArray(t)?(t.filter(f=>!s.has(f)).length<=1||e.ownAnswers)&&t.every(f=>s.has(f)||l(f))?void 0:d:a("choices"):s.has(t)||l(t)?void 0:d}case"many2one":return sa(t)?void 0:a("record");case"many2many":return Array.isArray(t)&&t.every(sa)?void 0:a("records");case"reference":{let s=t;if(!sa(t)||typeof s.model!="string")return a("record");if(!e.models.some(d=>d.value===s.model)){let d=Qs(e.models.map(l=>l.label),r.or);return a("reference",{models:d,aModels:ed(d)})}return}case"binary":case"image":return Kf(e,t,a,r);default:return}}function zf(e,t,n,r){if(t===null||typeof t!="object"||Array.isArray(t))return r("matrix");let i=new Set(e.rows.map(d=>String(d.value))),o=new Set(e.columns.map(d=>d.value)),a=r("choice",{options:e.columns.map(d=>d.label).join(", ")});for(let[d,l]of Object.entries(t)){if(!i.has(d))return r("matrixRow",{rows:e.rows.map(f=>f.label).join(", ")});let c=e.multiple&&Array.isArray(l)?l:[l];if(!e.multiple&&Array.isArray(l)||c.some(f=>f!=null&&!o.has(f)))return a}let s=d=>{let l=t[d];return l!=null&&!(Array.isArray(l)&&!l.length)};if(n&&e.rows.some(d=>!s(String(d.value))))return r("matrixRows")}function Bf(e){let t=String(e);if(t.includes("e-"))return Number(t.split("e-")[1]);let n=t.indexOf(".");return n===-1?0:t.length-n-1}function sa(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)&&(typeof e.id=="number"||typeof e.id=="string")&&typeof e.label=="string"}function qf(e,t){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(e))return t("dateFormat");let[n,r,i]=e.split("-").map(Number);return Zs(n,r,i)?void 0:t("dateInvalid")}var _f=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2})(?:\.\d{1,9})?)?(?:Z|[+-]\d{2}:\d{2})?$/;function Uf(e,t){let n=typeof e=="string"?_f.exec(e):null;if(!n)return t("datetimeFormat");let[r,i,o,a,s,d]=n.slice(1).map(l=>Number(l??0));return Zs(r,i,o)&&a<24&&s<60&&d<60?void 0:t("datetimeInvalid")}function Zs(e,t,n){if(t<1||t>12||n<1)return!1;let r=[31,e%4===0&&(e%100!==0||e%400===0)?29:28,31,30,31,30,31,31,30,31,30,31];return n<=r[t-1]}function Kf(e,t,n,r){let i=e.multiple?Array.isArray(t)?t:[t]:[t];if(e.multiple&&e.minFiles!==void 0&&i.length<e.minFiles)return n("minFiles",{min:e.minFiles});if(e.multiple&&e.maxFiles!==void 0&&i.length>e.maxFiles)return n("maxFiles",{max:e.maxFiles});for(let o of i){if(!Gf(o))return n("file");let a=ti(e,o,r,e.multiple?o.name:e.label||"This field");if(a)return a}}function ti(e,t,n=qt.en,r=t.name){if(e.maxSize!==void 0&&t.size>e.maxSize)return lt(n.fileSize,{label:r,size:Sn(e.maxSize)});let i=e.type==="image"?["image/*"]:e.accept;if(i&&!Jf(i,t.type)){let o=ni(i,n.or);return lt(n.fileType,{label:r,types:o,aTypes:ed(o)})}}function Gf(e){let t=e;return e!==null&&typeof e=="object"&&typeof t.name=="string"&&typeof t.size=="number"}function Jf(e,t){return e.some(n=>n.endsWith("/*")?t.startsWith(n.slice(0,-1)):n===t)}var Yf="pdf PDF,msword DOC,wordprocessingml DOCX,opendocument.text ODT,plain TXT,ms-excel XLS,spreadsheetml XLSX,opendocument.spreadsheet ODS,csv CSV,ms-powerpoint PPT,presentationml PPTX,opendocument.presentation ODP".split(",").map(e=>e.split(" "));function Xf(e){if(e.endsWith("/*"))return e.slice(0,-2);let t=e.split("/")[1]??e;return Yf.find(([n])=>t.includes(n))?.[1]??t.toUpperCase()}function ni(e,t){return Qs([...new Set(e.map(Xf))],t)}function Qs(e,t){return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function ed(e){return/^[aeiou]/i.test(e)?`an ${e}`:`a ${e}`}function Sn(e){let t=["bytes","KB","MB","GB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${Number(n.toFixed(1))} ${t[r]}`}var td=e=>Math.round(e*1e9)/1e9,nd=(e,t)=>e.find(n=>n.value===t)?.score??0,rd=e=>e.reduce((t,n)=>Math.max(t,n.score??0),0),id=e=>e.reduce((t,n)=>t+Math.max(0,n.score??0),0),od=(e,t,n)=>n?Array.isArray(t)?t.reduce((r,i)=>r+nd(e,i),0):0:nd(e,t);function ad(e,t){let n=0,r=0,i=!1;for(let[o,a]of Object.entries(e.fields))if(a.type==="selection"&&a.options.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0;n+=od(a.options,t[o],s),r+=s?id(a.options):rd(a.options)}else if(a.type==="matrix"&&a.columns.some(s=>s.score!==void 0)){i=!0;let s=a.multiple===!0,d=t[o],l=d&&typeof d=="object"&&!Array.isArray(d)?d:{};for(let c of a.rows)n+=od(a.columns,l[String(c.value)],s),r+=s?id(a.columns):rd(a.columns)}return i?{score:td(n),max:td(r)}:null}function sd(e){return Object.assign(new Error(e.message),{problem:e})}function Bi(e){let t=e?.problem;if(t&&typeof t.kind=="string")return t;let n=e instanceof Error?e.message:String(e);return e instanceof TypeError&&/fetch|network|load failed/i.test(n)?{kind:"network",message:n}:{kind:"other",message:n}}function Sr(e,t){return t.every(n=>da(e,n))}function da(e,t){return"any"in t?t.any.some(n=>da(e,n)):"all"in t?t.all.every(n=>da(e,n)):Qf(e,t)}function Ln(e){return e!=null&&e!==""&&e!==!1&&!(Array.isArray(e)&&!e.length)}function Zf(e){return Array.isArray(e)?e.map(t=>t!==null&&typeof t=="object"&&"id"in t?t.id:t):[]}function Qf(e,t){let n=e[t.field],r=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"id"in n?n.id:n,i=t.value,o=n!==null&&typeof n=="object"&&!Array.isArray(n)&&"label"in n?String(n.label):String(r??"");switch(t.op){case"=":return r===i;case"=?":return!Ln(i)||r===i;case"contains":case"not contains":{let a=Zf(n),d=(Array.isArray(i)?i:[i]).some(l=>a.includes(l));return t.op==="contains"?d:!d}case"!=":return r!==i;case"<":return Ln(r)&&r<i;case">":return Ln(r)&&r>i;case"<=":return Ln(r)&&r<=i;case">=":return Ln(r)&&r>=i;case"in":return Array.isArray(i)&&i.includes(r);case"not in":return Array.isArray(i)&&!i.includes(r);case"like":return o.includes(String(i));case"ilike":return o.toLowerCase().includes(String(i).toLowerCase());case"startswith":return o.toLowerCase().startsWith(String(i).toLowerCase());case"endswith":return o.toLowerCase().endsWith(String(i).toLowerCase());case"set":return Ln(n);case"notset":return!Ln(n);case"between":{if(!Ln(r)||!Array.isArray(i))return!1;let[a,s]=i;return r>=a&&r<=s}case"within":return eu(e,n,i)}}var la=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);function eu(e,t,n){if(!la(n))return!1;let r=dd(e,t,n.longitude);if(!r)return!1;let{lat:i,lng:o}=r;if(Array.isArray(n.polygon))return tu(o,i,n.polygon);if(Array.isArray(n.center)){let[c,f]=n.center;return ld(i,o,f,c)<=n.radius}let{south:a,west:s,north:d,east:l}=n;return i<a||i>d?!1:s<=l?o>=s&&o<=l:o>=s||o<=l}function dd(e,t,n){let r,i;if(typeof n=="string")r=t,i=e[n];else{let o=la(t)&&t.type==="Feature"?t.geometry:t,a=la(o)&&o.type==="Point"?o.coordinates:null;if(!Array.isArray(a))return null;[i,r]=a}return typeof r=="number"&&typeof i=="number"?{lat:r,lng:i}:null}function ca(e,t,n){let r=dd(e,e[t],n.longitude);return r?ld(r.lat,r.lng,n.lat,n.lng):null}function tu(e,t,n){let r=!1;for(let i=0,o=n.length-1;i<n.length;o=i++){let[a,s]=n[i],[d,l]=n[o];s>t!=l>t&&e<(d-a)*(t-s)/(l-s)+a&&(r=!r)}return r}function ld(e,t,n,r){let i=Math.PI/180,o=Math.sin((n-e)*i/2)**2+Math.cos(e*i)*Math.cos(n*i)*Math.sin((r-t)*i/2)**2;return 2*63710088e-1*Math.asin(Math.min(1,Math.sqrt(o)))}var kr=null;function qi(e,t){let n=r=>{if("any"in r){let o=r.any.map(n);return o.includes(kr)?kr:{any:o}}if("all"in r){let o=r.all.map(n).filter(a=>a!==kr);return o.length?{all:o}:kr}let i=r.valueFrom!==void 0?nu(t,r.valueFrom):r.value??null;return r.op==="=?"?Ln(i)?{field:r.field,op:"=",value:i}:kr:{field:r.field,op:r.op,value:i}};return e.map(n).filter(r=>r!==kr)}function nu(e,t){let n=e;for(let r of t.split("."))n=n===null||typeof n!="object"?void 0:n[r];return n??null}var cd=new Set(["char","text","html"]),fd=new Set(["integer","float","monetary"]),ru=new Set(["many2one","many2many"]);function Lr(e,t,n,r={searchFor:"Search {field} for: {text}"}){let i=e.trim();if(!i)return[];let o=[];for(let s of n.searchFields??n.columns){let d=t.fields[s];if(!d)continue;let l=(c,f,y,u)=>o.push({field:s,fieldLabel:d.label,op:c,value:f,valueLabel:y,label:u??lt(r.searchFor,{field:d.label,text:i})});if(cd.has(d.type)||ru.has(d.type))l("ilike",i,i);else if(d.type==="selection"){let c=i.toLowerCase();for(let f of d.options)f.label.toLowerCase().includes(c)&&l("=",f.value,f.label,`${d.label}: ${f.label}`)}else if(fd.has(d.type)){let c=Number(i.replace(/[\s,]/g,""));i&&Number.isFinite(c)&&l("=",c,i)}}let a=s=>{let d=t.fields[s.field]?.type??"";return cd.has(d)?0:d==="selection"?1:fd.has(d)?2:3};return o.map((s,d)=>({s,i:d})).sort((s,d)=>a(s.s)-a(d.s)||s.i-d.i).map(({s})=>s)}function ri(e,t){let n=[];for(let r of e)if(r.kind==="field"){let i=r.values.map(o=>({field:r.field,op:o.op,value:o.value}));n.push(i.length===1?i[0]:{any:i})}else if(r.kind==="filters"){let i=r.ids.map(o=>t.filters?.find(a=>a.id===o)?.filter??[]).filter(o=>o.length);i.length===1?n.push(...i[0]):i.length>1&&n.push({any:i.map(o=>o.length===1?o[0]:{all:o})})}else r.kind==="custom"&&n.push(...r.filter);return n}function _i(e){return e.find(t=>t.kind==="groupBy")?.fields??[]}var ii={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e)};function Ui(e,t=ii){return new Promise(n=>{t.setTimeout(n,e)})}function md(e={}){let t=Te(e.records??{}),n=[],r=[],i=new Map,o=1e3,a=()=>e.delayMs?Ui(e.delayMs,e.scheduler):Promise.resolve(),s=b=>t[b]??(t[b]={}),d=(b,E)=>{let m=s(b)[String(E)]?.[e.labelField?.[b]??"name"];return typeof m=="string"?m:String(E)},l=(b,E)=>{let m=e.shows?.[b],x=m?s(b)[String(E.id)]:void 0;if(!m||!x)return E;let g={...E};m.avatar&&typeof x[m.avatar]=="string"&&(g.avatar=x[m.avatar]),m.color&&typeof x[m.color]=="number"&&(g.color=x[m.color]),m.folded&&(g.folded=x[m.folded]===!0);let $=(m.details??[]).map(L=>x[L]).map(L=>L&&typeof L=="object"&&"label"in L?L.label:L).filter(L=>typeof L=="string"&&L.trim());$.length&&(g.details=$.join(`
|
|
3
|
+
`));let A=m.path?ud(x[m.path]):null;A&&(g.path=A);let w=m.aside?x[m.aside]:null;return typeof w=="string"&&w.trim()&&(g.aside=w),g},c=(b,E)=>{let m=e.shows?.[b]?.path;return m&&ud(s(b)[String(E)]?.[m])?.join("\\")||""},f=b=>Math.max(0,...Object.keys(s(b)).map(Number).filter(Number.isFinite))+1,y=b=>Number.isFinite(Number(b))?Number(b):b,u=(b,E)=>({id:y(b),...E});function k(b,E){let m=[...b];for(let x of E)x.op==="create"?m.push({key:x.key,id:++o,values:Te(x.values)}):x.op==="update"?m=m.map(g=>g.id===x.id?{...g,values:{...g.values,...Te(x.values)}}:g):m=m.filter(g=>g.id!==x.id);return m}function h(b,E,m){let x=[...b],g=$=>({id:$,label:d(m,$)});for(let $ of E)$.op==="link"&&!x.some(A=>A.id===$.id)?x.push(g($.id)):$.op==="unlink"?x=x.filter(A=>A.id!==$.id):$.op==="set"?x=$.ids.map(g):$.op==="clear"&&(x=[]);return x}function v(b,E){let m=b[E];return m&&"relation"in m?m.relation:E}return{records:t,responses:n,calls:r,async load(b){r.push({method:"load",request:b}),await a();let E=s(b.model)[String(b.id)];if(!E)throw new Error(`No ${b.model} record with id ${b.id}`);let m=Te(E);if(e.shows)for(let[x,g]of Object.entries(b.fields)){let $=m[x];g.type==="many2one"&&$&&typeof $=="object"&&"id"in $?m[x]=l(g.relation,$):g.type==="many2many"&&Array.isArray($)&&(m[x]=$.map(A=>l(g.relation,A)))}return m},async save(b){r.push({method:"save",request:b}),await a();let E=b.id??f(b.model),m={...s(b.model)[String(E)]??{},...Te(b.changes.values)};for(let[x,g]of Object.entries(b.changes.lines))m[x]=k(m[x]??[],g);for(let[x,g]of Object.entries(b.changes.links))m[x]=h(m[x]??[],g,v(b.fields,x));return s(b.model)[String(E)]=m,{id:E,values:Te(m)}},async onchange(b){r.push({method:"onchange",request:b}),await a();let E=e.onchange?.[b.model]?.[b.changed],m=e.warnings?.[b.model]?.[b.changed],x=E?{values:E(Te(b.values))}:{},g=m?.(Te(b.values));return g?{...x,warning:g}:x},async search(b){r.push({method:"search",request:b}),await a();let E=b.query.trim().toLowerCase();return Object.entries(s(b.model)).filter(([m,x])=>Sr(u(m,x),b.filter??[])).map(([m])=>({id:y(m),label:d(b.model,y(m))})).filter(m=>m.label.toLowerCase().includes(E)||c(b.model,m.id).toLowerCase().includes(E)).slice(0,b.limit??8).map(m=>l(b.model,m))},async list(b){r.push({method:"list",request:b}),await a();let E=Object.entries(s(b.model)).filter(([m,x])=>Sr(u(m,x),b.filter)).map(([m,x])=>({id:y(m),values:x}));return E.sort((m,x)=>{for(let g of b.sort){let $=g.near?pd(ca(m.values,g.field,g.near),ca(x.values,g.field,g.near)):pd(m.values[g.field],x.values[g.field]);if($.empty)return $.result;if($.result)return g.desc?-$.result:$.result}return 0}),{total:E.length,records:E.slice(b.offset,b.offset+b.limit).map(({id:m,values:x})=>({id:m,values:Object.fromEntries(b.fields.map(g=>[g,Te(x[g]??null)]))}))}},async groups(b){r.push({method:"groups",request:b}),await a();let E=new Map;for(let[m,x]of Object.entries(s(b.model))){if(!Sr(u(m,x),b.filter))continue;let g=x[b.field]??null,$=g!==null&&typeof g=="object"&&!Array.isArray(g)&&"id"in g?g:null,A=$?$.id:g,w=JSON.stringify(A),L=E.get(w)??{value:A,label:$?$.label:g===null||g===""?"":String(g),count:0};L.count++,E.set(w,L)}return[...E.values()].sort((m,x)=>m.value===null==(x.value===null)?m.label.localeCompare(x.label):m.value===null?1:-1)},async create(b){r.push({method:"create",request:b}),await a();let E=s(b.model),m=Object.keys(E).reduce((x,g)=>Math.max(x,Number(g)||0),0)+1;return E[String(m)]={...Te(b.values??{}),name:b.name},{id:m,label:b.name}},async submit(b){return r.push({method:"submit",request:b}),await a(),n.push(Te(b)),{id:n.length}},async archive(b){r.push({method:"archive",request:b}),await a();let E=s(b.model)[String(b.id)];if(!E)throw new Error(`No ${b.model} record with id ${b.id}`);E.active=!b.archive},async copy(b){r.push({method:"copy",request:b}),await a();let E=s(b.model)[String(b.id)];if(!E)throw new Error(`No ${b.model} record with id ${b.id}`);let m=f(b.model),x=Te(E),g=e.labelField?.[b.model]??"name";typeof x[g]=="string"&&(x[g]=`${x[g]}${e.copySuffix??" (copy)"}`);for(let[$,A]of Object.entries(x))Array.isArray(A)&&A.every(w=>w&&typeof w=="object"&&"key"in w&&"values"in w)&&(x[$]=A.map(w=>({...w,id:++o})));return s(b.model)[String(m)]=x,{id:m,values:Te(x)}},async delete(b){if(r.push({method:"delete",request:b}),await a(),!s(b.model)[String(b.id)])throw new Error(`No ${b.model} record with id ${b.id}`);delete s(b.model)[String(b.id)]},async attachments(b){return r.push({method:"attachments",request:b}),await a(),Te(e.attachments?.[`${b.model}:${b.id}`]??[])},async options(b){r.push({method:"options",request:b}),await a();let E=e.lists?.[b.list];if(!E)throw new Error(`No list "${b.list}"`);return Te(typeof E=="function"?await E(b.values):E)},async definitions(b){r.push({method:"definitions",request:b}),await a();let E=e.definitions?.[b.list];if(!E)throw new Error(`No definitions "${b.list}"`);let m=E(b.values),x=i.get(`${b.list}:${JSON.stringify(m)}`)??[];return Te([...m,...x.filter(g=>!m.some($=>$.name===g.name))])},async saveDefinitions(b){r.push({method:"saveDefinitions",request:b}),await a();let E=e.definitions?.[b.list]?.(b.values)??[];i.set(`${b.list}:${JSON.stringify(E)}`,Te(b.definitions.filter(m=>!E.some(x=>x.name===m.name))))}}}function ud(e){let n=(Array.isArray(e)?e:typeof e=="string"?e.split("\\"):null)?.filter(r=>typeof r=="string"&&r.trim()!=="");return n?.length?n:null}function pd(e,t){let n=a=>a==null||a==="";if(n(e)||n(t))return{result:n(e)===n(t)?0:n(e)?1:-1,empty:n(e)!==n(t)};let r=a=>typeof a=="object"&&a!==null&&"label"in a?a.label:a,[i,o]=[r(e),r(t)];return typeof i=="number"&&typeof o=="number"?{result:i-o,empty:!1}:{result:String(i).localeCompare(String(o)),empty:!1}}var Ki=["street","line2","city","region","postcode","country"];function gd(e,t,n,r){let i=t.options??{},o=t.label??e.label;if(e.type==="one2many"&&Array.isArray(n)&&n.length){if(typeof i.min=="number"&&n.length<i.min)return lt(r.minLines,{label:o,min:i.min});if(typeof i.max=="number"&&n.length>i.max)return lt(r.maxLines,{label:o,max:i.max})}let a=i.requiredParts;if(t.widget!=="address"||!Array.isArray(a)||!n||typeof n!="object"||Array.isArray(n))return;let s=Array.isArray(i.parts)?i.parts:Ki,d=n,l=Ki.findIndex(c=>a.includes(c)&&s.includes(c)&&!String(d[c]??"").trim());return l<0?void 0:lt(r.required,{label:r.addressParts.split("|")[l]})}var iu={email:/^[^@\s]+@[^@\s]+\.[^@\s]+$/,url:/^(https?:\/\/)?([\p{L}\p{N}-]+\.)+\p{L}{2,}(:\d+)?([/?#]\S*)?$/iu,phone:/^\+?[\p{Nd}\s.()-]+$/u,time:/^([01]\d|2[0-3]):[0-5]\d$/};function fa(e,t,n,r){let i=t.widget??"";if(e.type!=="char")return gd(e,t,n,r);if(typeof n!="string"||!n.trim())return;let o=n.trim(),a=t.options??{},s=t.label??e.label,d=iu[i],l=o.match(/\p{Nd}/gu)?.length??0;if(d&&(!d.test(o)||i==="phone"&&(l<7||l>15)))return r[i];if(i==="time"){if(typeof a.min=="string"&&o<a.min)return lt(r.before,{label:s,min:a.min});if(typeof a.max=="string"&&o>a.max)return lt(r.after,{label:s,max:a.max})}if(i==="tags"&&typeof a.max=="number"&&o.split(typeof a.separator=="string"&&a.separator?a.separator:",").filter(f=>f.trim()).length>a.max)return lt(r.atMost,{label:s,max:a.max})}function hd(e,t,n,r=!0,i={},o){let a={id:t??null,user:{id:n?.id??null,name:n?.name??null,roles:[...n?.roles??[]]},editing:r,context:i,...o?{parent:o}:{}};for(let s of Object.keys(a))s in e&&delete a[s];return a}function fn(e,t,n){return{...hd(t,n.recordId,n.user,n.editing,n.context,n.parent),...Wn(e,t)}}function jn(e,t,n,r=null){let i={parent:n,user:n.user??hd({},null,void 0).user,id:r,context:n.context??{}};for(let o of Object.keys(i))o in t&&delete i[o];return{...i,...Wn(e,t)}}function tr(e,t,n){let r=new Map;return{today:n,lines(i){let o=t[i];if(o?.type!=="one2many")return;let a=r.get(i);return a||(a=(e[i]??[]).filter(d=>Lt(o,d.values)===null).map(d=>Wn(d.values,o.fields)),r.set(i,a)),a}}}function bd(e){let t=new Map;for(let[r,i]of Object.entries(e))i.compute!==void 0&&t.set(r,cn(i.compute));let{order:n}=Vi(new Map([...t].map(([r,i])=>[r,i.fields])));return n.map(r=>[r,t.get(r),e[r]])}function nr(e,t){if(e.type==="boolean")return Jt(t);if(t==null)return null;switch(e.type){case"integer":return Ct(t)?Xr(t,0):null;case"float":case"monetary":return Ct(t)?e.digits?Xr(t,e.digits[1]):t:null;case"char":case"text":case"html":return typeof t=="string"?t:Ct(t)?String(t):null;case"date":case"datetime":return typeof t=="string"?t:null;default:return t}}function yd(e,t,n=()=>({recordId:null})){let r=bd(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let c=bd(l.fields);c.length&&i.set(d,{def:l,steps:c})}let o={today:t};function a(d,l,c,f,y){let u=d,k=y(d);for(let[h,v,b]of l){let E=nr(b,v.evaluate(k,f));zi(E,u[h])||(u={...u,[h]:E},Object.assign(k,Wn({[h]:E},c)))}return u}function s(d,l,c){let f=i.get(d);return!f||Lt(f.def,l)!==null?l:a(l,f.steps,f.def.fields,o,y=>jn(y,f.def.fields,c))}return{line:(d,l,c)=>s(d,l,fn(c,e.fields,n())),apply(d){let l=d,c=i.size?fn(d,e.fields,n()):{};for(let f of i.keys()){let y=l[f];if(!Array.isArray(y))continue;let u=!1,k=y.map(h=>{let v=s(f,h.values,c);return v===h.values?h:(u=!0,{...h,values:v})});u&&(l={...l,[f]:k})}return r.length?a(l,r,e.fields,tr(l,e.fields,t),f=>fn(f,e.fields,n())):l}}}function xd(e){return Object.entries(e).flatMap(([t,n])=>(n.setWhen??[]).map((r,i)=>({key:`${t}#${i}`,name:t,def:n,when:ut(r.when??!0),value:cn(r.value),...r.on?{on:r.on}:{}})))}var ou={has:()=>!0};function vd(e,t,n=()=>({recordId:null})){let r=xd(e.fields),i=new Map;for(let[d,l]of Object.entries(e.fields)){if(l.type!=="one2many")continue;let c=xd(l.fields);c.length&&i.set(d,{def:l,rules:c})}let o={today:t};function a(d,l,c,f,y,u,k){let h=d;for(let v of l){if(v.on){let E=`${y}${v.key}@${JSON.stringify(v.on.map(m=>d[m]??null))}`;if(k.add(E),u.has(E)||!v.when.evaluate(c,f))continue}else{if(!v.when.evaluate(c,f))continue;let E=y+v.key;if(k.add(E),u.has(E))continue}let b=nr(v.def,v.value.evaluate(c,f));zi(b,h[v.name])||(h={...h,[v.name]:b})}return h}function s(d,l){let c=new Set,f=r.length?a(d,r,fn(d,e.fields,n()),tr(d,e.fields,t),"",l,c):d,y=i.size?fn(d,e.fields,n()):{};for(let[u,{def:k,rules:h}]of i){let v=d[u];if(!Array.isArray(v))continue;let b=!1,E=v.map(m=>{if(Lt(k,m.values)!==null)return m;let x=a(m.values,h,jn(m.values,k.fields,y,m.id??null),o,`${u}.${m.key}.`,l,c);return x===m.values?m:(b=!0,{...m,values:x})});b&&(f={...f,[u]:E})}return{values:f,holding:c}}return{apply:s,holding:d=>s(d,ou).holding}}function wd(e){return(e??[]).map(t=>({rule:t,when:ut(t.when??!0),pattern:t.pattern===void 0?null:new RegExp(`^(?:${t.pattern})$`),holds:t.holds===void 0?null:ut(t.holds)}))}function kd(e,t,n,r,i){let o={};if(!r.length||mn(e,n))return o;for(let a of r){let s=a.rule.level??"error";if(o[s]!==void 0||!a.when.evaluate(i.context,i.env))continue;let d=au(a,e,n,i.now)??lu(a,i);d&&(o[s]=a.rule.message??lt(i.messages[d.say],{label:t,...d.values}))}return o}function au({rule:e,pattern:t},n,r,i){let o=typeof r=="string"?r:null;if(o!==null&&e.minLength!==void 0&&o.length<e.minLength)return{say:"minLength",values:{min:e.minLength}};if(o!==null&&e.maxLength!==void 0&&o.length>e.maxLength)return{say:"maxLength",values:{max:e.maxLength}};if(t&&(o!==null||Ct(r))&&!t.test(String(r)))return{say:"pattern"};if(o!==null&&e.endsWith!==void 0&&!o.trim().toLowerCase().endsWith(e.endsWith.toLowerCase()))return{say:"endsWith",values:{ending:e.endsWith}};if(Ct(r)&&e.min!==void 0&&r<e.min)return{say:"min",values:{min:e.min}};if(Ct(r)&&e.max!==void 0&&r>e.max)return{say:"max",values:{max:e.max}};let a=Array.isArray(r)?r.length:null;if(a!==null&&e.atLeast!==void 0&&a<e.atLeast)return{say:"atLeast",values:{min:e.atLeast}};if(a!==null&&e.atMost!==void 0&&a>e.atMost)return{say:"atMost",values:{max:e.atMost}};if(e.distinct!==void 0&&n.type==="one2many"&&Array.isArray(r)){let s=su(n,r,e.distinct);if(s!==null)return{say:"distinct",values:{column:n.fields[e.distinct]?.label??e.distinct,value:s}}}if(o!==null&&e.date!==void 0){let s=cu(n,o,i);if(e.date==="past"&&s>=0)return{say:"datePast"};if(e.date==="future"&&s<=0)return{say:"dateFuture"}}}function su(e,t,n){let r=e.fields[n],i=new Set;for(let o of t){if(Lt(e,o.values)!==null)continue;let a=o.values[n];if(a==null||a===""||Array.isArray(a)&&!a.length)continue;let s=typeof a=="object"&&!Array.isArray(a)&&"id"in a?a:null,d=JSON.stringify(s?s.id:a);if(!i.has(d)){i.add(d);continue}return s?s.label:r?.type==="selection"?r.options.find(l=>l.value===a)?.label??String(a):String(a)}return null}var du=e=>e==null||typeof e=="string"&&!e.trim()||Array.isArray(e)&&!e.length;function lu({holds:e},t){if(!(!e||e.fields.some(n=>du(t.context[n]))))return e.evaluate(t.context,t.env)?void 0:{say:"holds"}}function cu(e,t,n){if(e.type==="datetime")return Math.sign(Date.parse(t)-n.getTime());let r=On(n);return t<r?-1:t>r?1:0}var Sd=new Map;function fu(e){let t=Sd.get(e);return t||Sd.set(e,t=cn(e)),t}function ua(e,t){let n=e.trim();if(yr.test(n)&&n in t.fields)return Te(t.values[n]);if(n==="user"&&!("user"in t.fields))return t.user?.id==null?null:{id:t.user.id,label:t.user.name??String(t.user.id)};let r=/^parent\.([A-Za-z_][A-Za-z0-9_]*)$/.exec(n);return r&&t.parent&&r[1]in t.parent.fields?Te(t.parent.values[r[1]]):fu(e).evaluate(t.context,t.env)}function Ld(e,t,n){if(e.type!=="many2one"&&e.type!=="many2many")return nr(e,t);let r=i=>{if(i==null||i===!1||i==="")return null;if(typeof i=="number"||typeof i=="string")return{id:i,label:n.labelOf?.(e.relation,i)??String(i)};if(typeof i=="object"&&!Array.isArray(i)&&"id"in i){let o=i;return{id:o.id,label:typeof o.label=="string"?o.label:n.labelOf?.(e.relation,o.id)??String(o.id)}}return null};return e.type==="many2one"?r(Array.isArray(t)?t[0]:t):(Array.isArray(t)?t:[t]).map(r).filter(i=>i!==null)}function Ed(e,t,n){let r={};for(let[i,o]of Object.entries(e)){let a=t[i];a&&(r[i]=Ld(a,ua(o,n),n))}return r}function pa(e,t){let n={};for(let[r,i]of Object.entries(e))n[r]=ua(i,t)??null;return n}function ma(e,t){let n={};for(let[r,i]of Object.entries(e))i.defaultFrom!==void 0&&(n[r]=Ld(i,ua(i.defaultFrom,t),t));return n}function Rd(e){let t=ga(e.tones),n=ut(e.bold);return(r,i)=>({tone:ha(t,r,i),bold:n.evaluate(r,i)})}var ga=e=>(e??[]).map(t=>({tone:t.tone,when:ut(t.when)})),ha=(e,t,n)=>e.find(r=>r.when.evaluate(t,n))?.tone??null;function Fd(e){let t=new Map;for(let[s,d]of Object.entries(e.cells??{}))t.set(s,{invisible:ut(d.invisible),readonly:ut(d.readonly),required:ut(d.required),hidden:ut(d.hidden),...d.roles?.length?{roles:d.roles}:{},tones:ga(d.tones),bold:ut(d.bold)});let n=ga(e.rowTones),r=ut(e.rowBold),i=e.lineDelete===void 0?null:ut(e.lineDelete),o=e.rowButtons??[],a=o.map(s=>({id:s.id,roles:s.roles,invisible:ut(s.invisible)}));return{buttons:o,line(s,d,l){let c={tone:ha(n,s,d),bold:r.evaluate(s,d),cells:{},buttons:{},deletable:i?.evaluate(s,d)??!0};for(let[f,y]of t)c.cells[f]={invisible:y.invisible.evaluate(s,d),readonly:y.readonly.evaluate(s,d),required:y.required.evaluate(s,d),tone:ha(y.tones,s,d),bold:y.bold.evaluate(s,d)};for(let f of a)c.buttons[f.id]=Qn(f.roles,l)&&!f.invisible.evaluate(s,d);return c},hidden(s,d,l,c){let f=t.get(s);return!!f&&(!Qn(f.roles,c)||f.hidden.evaluate(d,l))}}}var Gi=Object.freeze({done:!0}),ba=new Set(["char","text","html","integer","float","monetary","boolean","date","datetime","selection","json"]),ya=e=>e instanceof Error?e.message:String(e);function Ad(e){let t=new Map,n=new Map,r=g=>{let $=t.get(g);return $||t.set(g,$=cn(g)),$};function i(g){if(typeof g=="boolean")return g;let $=n.get(g);$||n.set(g,$=ut(g));let{context:A,env:w}=e.reading();return $.evaluate(A,w)}let o=g=>{let $=g.trim();return yr.test($)?$:null};function a(g,$){let A=o(g);if($&&A!==null&&A in e.fields)return Te(e.values()[A]);let{context:w,env:L}=e.reading();return r(g).evaluate(w,L)}function s(g,$){let A=e.values();for(let[w,L]of Object.entries(e.fields)){if(L.type!=="many2one"&&L.type!=="many2many"||L.relation!==g)continue;let S=A[w],F=(Array.isArray(S)?S:S?[S]:[]).find(D=>D&&D.id===$);if(F)return F.label}}function d(g,$,A=()=>{}){let w=L=>{if(L==null||L===!1||L==="")return null;let S=g.relation,I=F=>A(F)??s(S,F)??String(F);if(typeof L=="number"||typeof L=="string")return{id:L,label:I(L)};if(typeof L=="object"&&!Array.isArray(L)&&"id"in L){let F=L;return{id:F.id,label:typeof F.label=="string"?F.label:I(F.id)}}return null};return g.type==="many2one"?w($):g.type==="many2many"?(Array.isArray($)?$:[$]).map(w).filter(L=>L!==null):nr(g,$)}function l(g){let $=e.fields[g];if(!$)throw new Error(`The page has no field "${g}"`);return $}async function c(g){return e.host?e.host.ask(g):e.confirm?e.confirm(g):!0}function f(g){return{reason:"cannot",message:g}}async function y(g,$){let A=e.host;if(!A)return f(`Nothing can open "${g.page}" here: the form has no host`);let w=g.record!==void 0?a(g.record,!1):null,L={page:g.page,...g.version!==void 0?{version:g.version}:{},as:g.as??"dialog",...g.side&&g.as==="panel"?{side:g.side}:{},...g.title!==void 0?{title:g.title}:{},recordId:typeof w=="number"||typeof w=="string"&&w!==""?w:null,...g.values?{values:u(g.values)}:{},...g.filter?{filter:qi(g.filter,e.reading().context)}:{}},S;try{S=await A.open(L)}catch(F){return{reason:"cannot",message:ya(F),error:F}}if(!S.saved)return{reason:"closed"};if(g.into&&e.write(k(g.into,S)),!g.then)return null;let I=await x(g.then,$);return I.done?null:{reason:I.reason,message:I.message,step:I.step,error:I.error}}function u(g){let $={};for(let[A,w]of Object.entries(g))$[A]=a(w,!0)??null;return $}function k(g,$){let A=$.values??{},w=$.recordId??null,L={...uu(A),id:w},S=[$.label,A.display_name,A.name].find(D=>typeof D=="string"&&D!==""),I=D=>D===w?S:void 0,F={};for(let[D,W]of Object.entries(g)){let j=l(D),O=o(W),B=O==="id"?w:O!==null&&!ba.has(j.type)&&O in A?A[O]:r(W).evaluate(L,{today:e.today});F[D]=d(j,B,I)}return F}async function h(g,$){let A={id:$.id,action:g.action,...g.params?{params:Te(g.params)}:{},recordId:e.recordId(),values:Te(e.values()),...$.recordIds?{recordIds:[...$.recordIds]}:{},...$.line?{line:Te($.line)}:{},...$.lines?{lines:Te($.lines)}:{}};if(!e.onAction)return null;let w;try{w=await e.onAction(A)??void 0}catch(L){return{reason:"app",message:ya(L),error:L}}if(e.answered(A,w),!w)return null;if(w.reload){let L=await e.reload();if(L)return L}if(w.stored){let L={};for(let[S,I]of Object.entries(w.stored))S in e.fields&&(L[S]=d(e.fields[S],I));e.store(L)}if(w.values){let L={};for(let[S,I]of Object.entries(w.values))S in e.fields&&(L[S]=d(e.fields[S],I));e.write(L)}if(w.say!==void 0){let L=typeof w.say=="string"?{message:w.say}:w.say;e.host?.say(L.message,L.tone??"info")}if(w.post!==void 0){let L=typeof w.post=="string"?{message:w.post}:w.post,S=await v(L.message,L.kind??"note",!1);if(S)return S}if(w.record!==void 0){let L=await e.showRecord(w.record);if(L)return L}if(w.open){let L=await y(w.open,$);if(L)return L}return w.stop?(typeof w.stop=="string"&&e.host?.say(w.stop,"warning"),{reason:"app",...typeof w.stop=="string"?{message:w.stop}:{}}):null}async function v(g,$,A){let w=A?xr(g):[{text:g}],L=w.map(F=>F.field?e.wordsOf(F.field):F.text).join(""),S=w.map(F=>F.field&&e.fields[F.field]?.type==="html"?String(e.values()[F.field]??""):pu(F.field?e.wordsOf(F.field):F.text)).join("");return await e.post({kind:$,text:L,body:`<p>${S}</p>`})?null:f("Nothing can post a message here: no conversation is beside this record")}async function b(g,$,A){return e.onAction?h({action:g},A):f(`Nothing can ${g} this record here: the data source has no ${$}, and the app takes no actions`)}async function E(g,$){let A=e.recordId();if(A==null)return f(`A new record cannot be ${g==="duplicate"?"duplicated":g==="delete"?"deleted":`${g}d`}: it is not saved yet`);if(g==="archive"||g==="unarchive")return e.archive?(await e.archive(g==="archive"),e.told({archived:g==="archive"},A),e.reload()):b(g,"archive",$);if(g==="duplicate"){if(e.changed()){let S=await e.save($.chain);if(S)return S}if(!e.copy){let S=await b(g,"copy",$),I=e.recordId();return!S&&I!=null&&I!==A&&e.told({copied:I},A),S}let w=await e.copy(),L=await e.showRecord(w);return L||(e.told({copied:w},A),null)}if(!e.remove){let w=await b(g,"delete",$);return w||e.told({deleted:!0},A),w}return await e.remove(),e.told({deleted:!0},A),null}async function m(g,$){switch(g.do){case"set":{let A=l(g.field);return e.write({[g.field]:d(A,a(g.value,!ba.has(A.type)))}),null}case"clear":return e.write({[g.field]:er(l(g.field))}),null;case"addLine":{let A=l(g.field);if(A.type!=="one2many")return f(`"${g.field}" is a ${A.type}; a line is added to a one2many`);let w={};for(let[L,S]of Object.entries(g.values??{})){let I=A.fields[L];if(!I)return f(`The lines of "${g.field}" have no field "${L}"`);w[L]=d(I,a(S,!ba.has(I.type)))}return e.addLine(g.field,w),null}case"check":return e.check(g.fields);case"save":return e.save($.chain);case"reset":return e.reset(),null;case"goTo":{let A=e.goTo(g.target,$.chain);if(A!==void 0)return A;let w=e.host?.show;return w?(e.showing($.chain,()=>w.call(e.host,g.target)),null):f(`Nothing can show "${g.target}" here: the form has no host that shows tabs`)}case"say":return e.host?.say(g.message,g.tone??"info"),null;case"ask":return await c(g.message)?null:{reason:"no",message:g.message};case"call":return h(g,$);case"open":return y(g,$);case"close":{let A=e.host?.close;return A?(A.call(e.host),null):f("Nothing can close this form: it has no host, or was not opened in a dialog or panel")}case"reload":return e.reload();case"openUrl":{let A=e.host?.openUrl;if(!A)return f("Nothing can open a web address here: the form has no host that opens one");let w=a(g.url,!1);return typeof w!="string"||!w.trim()?f(`"${g.url}" gives no address to open`):(A.call(e.host,w.trim(),g.newTab??!0),null)}case"archive":case"unarchive":case"duplicate":case"delete":return E(g.do,$);case"post":return v(g.message,g.kind??"note",!0)}}async function x(g,$){for(let A=0;A<g.length;A++){let w=g[A],L;try{if(w.when!==void 0&&!i(w.when))continue;L=await m(w,$)}catch(S){L={reason:"cannot",message:ya(S),error:S}}if(L)return{done:!1,stoppedAt:A,step:L.step??w,reason:L.reason,...L.message!==void 0?{message:L.message}:{},...L.error!==void 0?{error:L.error}:{}}}return Gi}return{runSteps:x,ask:c}}function uu(e){let t={},n=r=>{if(r===null||typeof r!="object")return r;let i=r;return"key"in i&&"values"in i?i.key:"model"in i&&"id"in i?`${i.model},${i.id}`:"id"in i?i.id:"name"in i&&"type"in i&&"size"in i?i.name:r};for(let[r,i]of Object.entries(e))t[r]=Array.isArray(i)?i.map(n):n(i);return t}function $d(e){let t=new Map;return function(r,i,o,a){if(!i?.length||o.includes(r))return Promise.resolve(Gi);let s=l=>{let c,f=new Promise(y=>c=y).finally(()=>{l.running===f&&!l.queued&&t.delete(r)});return l.running=f,c(e(r,i,[...o,r])),f},d=t.get(r);if(!d){let l={running:Promise.resolve(Gi)};return t.set(r,l),s(l)}if(!a)return Promise.resolve(Gi);if(!d.queued){let l=()=>(d.queued=void 0,s(d));d.queued=d.running.then(l,l)}return d.queued}}function pu(e){return e.replace(/[&<>"']/g,t=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[t]).replace(/\n/g,"<br>")}function Yi(e){return Nd(e,[]).form}var Td=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),xa=e=>e;function Nd(e,t){let{page:n}=e,r=e.scheduler??ii,i=e.messages??qt.en,o=xu(n.layout),a=new Map;for(let p of o.values()){let R=p.source.validate;p.kind==="field"&&R&&a.set(p.id,wd(R))}let s=new Map;for(let p of o.values()){let R=p.source;p.kind!=="field"||n.fields[R.field]?.type!=="one2many"||(R.cells||R.rowTones||R.rowBold!==void 0||R.rowButtons||R.lineDelete!==void 0)&&s.set(p.id,{field:R.field,compiled:Fd(R)})}let d=new Map;for(let p of o.values()){let R=p.source;p.kind==="field"&&(R.tones||R.bold!==void 0)&&d.set(p.id,Rd(R))}let l=new Map;for(let p of o.values()){let R=p.source;p.kind==="field"&&R.order?.length&&n.fields[R.field]?.type==="one2many"&&!l.has(R.field)&&l.set(R.field,R.order)}function c(p,R){let P=p;for(let[N,K]of l){if(R&&!R.includes(N))continue;let J=p[N];if(!Array.isArray(J)||J.length<2)continue;let X=[...J].sort((se,Ee)=>hu(se.values,Ee.values,K));X.some((se,Ee)=>se!==J[Ee])&&(P={...P,[N]:X})}return P}let f=new Map,y=(p,R)=>{R.placeholderWhen?.length&&f.set(p,{fixed:R.placeholder,when:R.placeholderWhen.map(P=>({text:P.text,holds:ut(P.when)}))})};for(let p of o.values())p.kind==="field"&&"type"in p.source&&y(p.id,p.source);n.layout.type==="sheet"&&n.layout.title&&y("#title",n.layout.title);let u=[...a.values()].some(p=>p.some(R=>R.rule.level==="warning")),k=n.layout.type==="wizard"?n.layout.children.map(p=>p.id):[],h=()=>`fieldia:draft:${n.id}:${M.recordId??"new"}`,v=()=>On(e.now?.()??new Date),b=!1,E=e.editing!==!1,m=e.parent?fn(e.parent.values,e.parent.fields,{recordId:e.parent.id??null,user:e.user,context:e.context}):void 0,x=()=>({recordId:b?M.recordId:e.recordId??null,user:e.user,editing:E,context:e.context,parent:m}),g=yd(n,v,x),$=vd(n,v,x),A=new Map;for(let p of o.values())p.kind==="form"&&A.set(p.id,p.source);let w=new Map,L={...n.fields};for(let p of A.values())L[p.name]={type:"json",label:p.title||p.name};let S=!1;function I(p=e.recordId==null,R=!0){let P=Dn(L,v());if(p){let N={recordId:null,user:e.user,context:e.context,parent:m};Object.assign(P,ma(n.fields,D(P,n.fields,fn(P,n.fields,N),tr(P,n.fields,v))))}return R?c({...P,...Te(e.values??{})}):P}function F(p,R){let P=b?M.values:{};for(let[N,K]of Object.entries(n.fields)){if(K.type!=="many2one"&&K.type!=="many2many"||K.relation!==p)continue;let J=P[N],X=(Array.isArray(J)?J:J?[J]:[]).find(se=>se?.id===R);if(X)return X.label}}function D(p,R,P,N,K){return{values:p,fields:R,context:P,env:N,...K?{parent:K}:{},...e.user?{user:e.user}:{},labelOf:F}}function W(){let{context:p,env:R}=me();return D(M.values,n.fields,p,R)}function j(p,R){let N=_t(p).fields;return D(R,N,jn(R,N,me().context),{today:v},{values:M.values,fields:n.fields})}function O(p){let R=s.get(p);if(R)return R;let P=o.get(p);if(P?.kind!=="field"||n.fields[P.field]?.type!=="one2many")throw new Error(`"${p}" is not a table of lines`);return null}function B(p,R){let P=O(p);if(!P)return{tone:null,bold:!1,cells:{},buttons:{},deletable:!0};let N=(M.values[P.field]??[]).find(J=>J.key===R);if(!N)throw new Error(`"${P.field}" has no line "${R}"`);let K=_t(P.field);return P.compiled.line(jn(N.values,K.fields,me().context,N.id??null),{today:v},Oe)}function H(p,R){if(!R){let K=ce(p);return K.type==="many2one"||K.type==="many2many"?K.createValues?pa(K.createValues,W()):{}:{}}let P=(M.values[R.lines]??[]).find(K=>K.key===R.key),N=_t(R.lines).fields[p];return!P||!N||N.type!=="many2one"&&N.type!=="many2many"||!N.createValues?{}:pa(N.createValues,j(R.lines,P.values))}let C=g.apply(I()),z=$.holding(C),M={status:e.recordId!=null?"idle":"ready",recordId:e.recordId??null,values:Te(C),errors:{},dirty:[],warnings:{},warning:null,warningField:null,error:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null,choices:{},definitions:{}};b=!0;let te={},Y=0,G=0,_=null,Q=null,$e=new Set,Ne=new Set,Ie=new Map,Pe=[],ee=!1,ge=null,ke=null,Oe=[...e.user?.roles??[]],Xe={};function Se(p){let R=M.values,P=M.errors;if(M={...M,...p},M.errors!==P)for(let N of w.values())N.inner.show(mu(M.errors,N.name));for(let N of[...Ne])N(M);if(M.values!==R){for(let N in M.choices)Re(N).dependsOn?.some(K=>R[K]!==M.values[K])&&De(N);for(let N in M.definitions)gt(N).dependsOn?.some(K=>R[K]!==M.values[K])&&Ae(N)}ee&&M.step!==ge&&re(Pe)}function tt(p,R){let P=Ie.get(p);if(P)for(let N of[...P])N(R)}function Z(p,R){tt("change",{field:p,value:M.values[p],values:M.values,by:R});let P=n.on?.change?.[p];R==="person"&&P&&le(oe(`on.change.${p}`,P,[],!0))}function re(p){let R=M.step;if(R===ge||R===null)return;ge=R,tt("step",{step:R});let P=n.on?.show?.[R];P&&le(oe(`on.show.${R}`,P,p,!0))}function ae(p,R){let P=Pe;Pe=p;try{R()}finally{Pe=P}}let Re=p=>n.fields[p].optionsFrom;function De(p){let{list:R}=Re(p),P=Xe[p]=(Xe[p]??0)+1,N=X=>P===Xe[p]&&Se({choices:{...M.choices,[p]:X}}),K=M.choices[p]?.options??null;N({options:K,loading:!0});let J=e.dataSource;le((J?.options?J.options({list:R,values:Te(M.values)}):Promise.reject(new Error(`No list "${R}"`))).then(X=>N({options:X}),X=>N({options:K,error:X.message??String(X)})))}let gt=p=>n.fields[p].definitionsFrom,Ge={};function Ae(p){let{list:R}=gt(p),P=Ge[p]=(Ge[p]??0)+1,N=X=>P===Ge[p]&&Se({definitions:{...M.definitions,[p]:X}}),K=M.definitions[p]?.definitions??null;N({definitions:K,loading:!0});let J=e.dataSource;le((J?.definitions?J.definitions({list:R,values:Te(M.values)}):Promise.reject(new Error(`No definitions "${R}"`))).then(X=>N({definitions:X}),X=>N({definitions:K,error:X.message??String(X)})))}async function Ve(p,R){let{list:P}=gt(p),N=[...M.definitions[p]?.definitions??[],R];Se({definitions:{...M.definitions,[p]:{definitions:N}}}),await le(e.dataSource?.saveDefinitions?.({list:P,values:Te(M.values),definitions:N})??Promise.resolve())}function pe(p){let R=n.fields[p],P=M.choices[p]?.options;return R.type==="selection"&&R.optionsFrom&&P?{...R,options:P,optionsFrom:void 0}:R}function le(p){$e.add(p);let R=()=>$e.delete(p);return p.then(R,R),p}function me(){if(ke?.values!==M.values||ke.recordId!==M.recordId||ke.editing!==E){let p=M.values,R=fn(p,n.fields,x());ke={values:p,recordId:M.recordId,editing:E,context:R,env:tr(p,n.fields,v)}}return ke}let he=()=>me().context;function ce(p){let R=L[p];if(!R)throw new Error(`The page has no field "${p}"`);return R}function Ze(p){return Object.keys(L).filter(R=>JSON.stringify(p[R]??null)!==JSON.stringify(C[R]??null))}function vt(p){let R=o.get(p);if(!R)throw new Error(`The page has no element "${p}"`);let{context:P,env:N}=me(),K=Ee=>Ee?!Qn(Ee.roles,Oe)||Ee.invisible.evaluate(P,N):!1,J=K(R);for(let Ee=R.parent;!J&&Ee;Ee=o.get(Ee)?.parent??null)J=K(o.get(Ee));let X=R.readonly.evaluate(P,N);for(let Ee=R.parent;!X&&Ee;Ee=o.get(Ee)?.parent??null)X=o.get(Ee)?.readonly.evaluate(P,N)??!1;let se=R.field?n.fields[R.field]:void 0;return{invisible:J,readonly:X||se!==void 0&&Md(se),required:R.required.evaluate(P,N)||se?.required===!0,...R.pressed?{pressed:R.pressed.evaluate(P,N)}:{}}}function Tt(p,R="field"){let P=K=>{if(!p)return!0;for(let J=K.id;J;J=o.get(J)?.parent??null)if(J===p)return!0;return!1},N=K=>{if(p||!M.skipped.length)return!1;for(let J=K.id;J;J=o.get(J)?.parent??null)if(M.skipped.includes(J))return!0;return!1};return[...o.values()].filter(K=>K.kind===R&&P(K)&&!N(K)&&!vt(K.id).invisible)}function an(p){let R=a.get(p.id);if(!R)return{};let P=p.field,N=n.fields[P],K=p.source.label??N.label,{context:J,env:X}=me();return kd(N,K,M.values[P],R,{context:J,env:X,now:e.now?.()??new Date,messages:i})}function Kt(p){let R=p.field;return p.source.widget==="tick"&&n.fields[R].type==="boolean"&&M.values[R]!==!0&&vt(p.id).required?i.tick:void 0}function bt(p){let R=p.field;return Kt(p)??fa(n.fields[R],p.source,M.values[R],i)??Hn(pe(R),M.values[R],vt(p.id).required,i,v())??an(p).error}function Ht(){var R;let p={};if(!u)return p;for(let P of Tt()){let N=a.has(P.id)?an(P).warning:void 0;N&&(p[R=P.field]??(p[R]=N))}return p}function en(p,R){let P=M;M={...M,values:p};try{return R()}finally{M=P}}function Dt(p){let R={};for(let P of Tt(p)){let N=P.field;if(R[N])continue;let K=n.fields[N],J=bt(P);if(J&&(R[N]=J),K.type==="one2many")for(let X of M.values[N]??[]){let se=Lt(K,X.values),Ee=s.has(P.id)?B(P.id,X.key).cells:{};for(let[xe,ye]of Object.entries(K.fields)){if(se&&xe!==K.lineKinds?.text)continue;let ve=Ee[xe];if(ve?.invisible||s.has(P.id)&&s.get(P.id).compiled.hidden(xe,me().context,me().env,Oe))continue;let mt=Hn(ye,X.values[xe],ye.required===!0||ve?.required===!0,i,v());mt&&(R[`${N}.${X.key}.${xe}`]=mt)}}}for(let P of Tt(p,"form")){let N=w.get(P.id);if(N)for(let[K,J]of Object.entries(N.inner.errorsNow()))R[`${N.name}.${K}`]=J}return R}function jt(p,R){let P=p;for(let N of w.values())if(!(R!=="start"&&P[N.name]===N.inner.form.getState().values)){S=!0;try{N.inner.take(Td(P[N.name])?P[N.name]:{},R)}finally{S=!1}P={...P,[N.name]:xa(N.inner.form.getState().values)}}return P}function Gn(p){let R=g.apply(p);for(let P=0;P<8;P++){let N=$.apply(R,z);if(z=N.holding,N.values===R)break;R=g.apply(N.values)}return R}function tn(p){let R=g.apply(p);return z=$.holding(R),R}function Mt(p,R={},P=!1){let N=jt(P?tn(p):Gn(p),P?"fresh":"edit"),K=Object.keys(M.errors).length?U(N):M.errors,J={};for(let X of Object.keys(p)){let se=n.fields[X];if(!(p[X]===M.values[X]||!se)&&(Ji(se,p[X])&&(J[X]=Hn(se,p[X],!1,i)),se.type==="one2many"))for(let Ee of p[X]??[])for(let[xe,ye]of Object.entries(Ee.values))Ji(se.fields[xe],ye)&&(J[`${X}.${Ee.key}.${xe}`]=Hn(se.fields[xe],ye,!1,i))}Object.keys(J).length&&(K={...K,...J}),Se({values:N,dirty:Ze(N),errors:K,warnings:en(N,Ht),...R})}function U(p){let R=en(p,()=>Dt(M.step??void 0)),P={};for(let N of Object.keys(M.errors))R[N]&&(P[N]=R[N]);for(let[N,K]of Object.entries(te))JSON.stringify(p[N]??null)===K.value?P[N]??(P[N]=K.message):delete te[N];return P}function de(){let p=e.drafts;p&&(_!==null&&r.clearTimeout(_),_=r.setTimeout(()=>{_=null,p.store.setItem(h(),JSON.stringify({savedAt:new Date().toISOString(),values:M.values}))},p.delayMs??400))}function Fe(){_!==null&&r.clearTimeout(_),_=null,e.drafts?.store.removeItem(h())}function je(){let p=e.drafts;if(!p)return;let R=p.store.getItem(h());if(!R)return;let P;try{P=JSON.parse(R)}catch{p.store.removeItem(h());return}p.restore==="auto"?Mt({...M.values,...P.values},{draft:null},!0):Se({draft:{savedAt:P.savedAt}})}function Ke(){let p=e.autosave;!p||n.data.kind!=="record"||(Q!==null&&r.clearTimeout(Q),Q=r.setTimeout(()=>{Q=null,M.dirty.length&&Object.keys(Dt()).length===0&&le(zt())},p.delayMs))}function He(p){let R=e.dataSource;if(!R?.onchange||n.data.kind!=="record"||wu(n.fields[p],M.values[p]))return;let P=++G,N={model:n.data.model,id:M.recordId,changed:p,values:Te(M.values)};le(R.onchange(N).then(K=>{if(P!==G)return;let J={...M.values,...K.values??{}};Mt(J,{warning:K.warning??null,warningField:K.warning?p:null})},()=>{}))}function pt(p){de(),Ke(),He(p)}function Qe(){let p={values:{},lines:{},links:{}},R=M.recordId===null||M.recordId===void 0,P=R?Object.keys(L).filter(N=>M.dirty.includes(N)||!mn(L[N],M.values[N])):M.dirty;for(let N of P){let K=L[N],J=M.values[N],X=R?er(K):C[N];K.type==="one2many"?p.lines[N]=bu(X??[],J??[]):K.type==="many2many"?p.links[N]=yu(X??[],J??[]):p.values[N]=Te(J)}return p}function Je(){let p={};for(let R of Tt()){let P=R.field;p[P]=Te(M.values[P])}for(let R of Tt(void 0,"form")){let P=w.get(R.id);P&&(p[P.name]=Te(M.values[P.name]))}return p}async function zt(p=[]){return await Nt(p)===null}async function Nt(p){if(n.on?.beforeSave){let N=await oe("on.beforeSave",n.on.beforeSave,p,!1);if(!N.done){if(N.reason!=="check"&&N.reason!=="save"){let K={kind:"stopped",reason:N.reason,message:N.message??""};Se({status:"error",error:K.message||null,saveProblem:K})}return{reason:"save",...N.message!==void 0?{message:N.message}:{}}}}let R=Dt();if(Object.keys(R).length)return Se({errors:R}),{reason:"save",message:Object.values(R)[0]};let P=e.dataSource;te={},Se({status:"saving",errors:{},error:null,saveProblem:null});try{if(n.data.kind==="responses"){if(!P?.submit)throw new Error("This page has no data source to send its answers to");let J=Je();return await P.submit({pageId:n.id,values:J}),Fe(),Se({status:"saved"}),tt("send",{values:J}),le(oe("on.afterSave",n.on?.afterSave,p,!1)),null}if(!P?.save)throw new Error("This page has no data source to save to");let N=await P.save({model:n.data.model,id:M.recordId,fields:L,changes:Qe(),values:Te(M.values)});Fe();let K=jt(tn(N.values?c({...M.values,...N.values},Object.keys(N.values)):M.values),"start");return C=Te(K),Se({status:"saved",recordId:N.id,values:K,dirty:[],warnings:en(K,Ht)}),tt("save",{recordId:M.recordId,values:M.values}),le(oe("on.afterSave",n.on?.afterSave,p,!1)),null}catch(N){let K=Bi(N),J=K.kind==="fields"?K.fields??{}:{};return te=Object.fromEntries(Object.entries(J).map(([X,se])=>[X,{message:se,value:JSON.stringify(M.values[X]??null)}])),Se({status:"error",error:K.message,saveProblem:K,errors:{...J}}),{reason:"save",message:K.message}}}async function Wt(){tt("open",{recordId:M.recordId,values:M.values}),await oe("on.open",n.on?.open,[],!0),ee=!0,re([])}function nn(p){let R=Object.keys(p);if(R.forEach(ce),!R.length)return;let P=Te(p);C={...C,...P},Mt({...M.values,...P});for(let N of R)Z(N,"app")}function Tn(p,R){let P=Object.keys(p);if(P.forEach(ce),!!P.length){Mt({...M.values,...Te(p)});for(let N of P)pt(N);for(let N of P)Z(N,R)}}function sn(p,R,P){let N=_t(p),K=M.values[p]??[],J=`new-${++Y}`;for(;K.some(ye=>ye.key===J);)J=`new-${++Y}`;let X=N.fields,se=Dn(X,v());Object.assign(se,ma(X,j(p,se))),N.lineDefaults&&Object.assign(se,Ed(N.lineDefaults,X,W()));let Ee={key:J,values:{...se,...Te(R)}};if(N.sequenceField&&Ee.values[N.sequenceField]==null){let ye=K.map(ve=>ve.values[N.sequenceField]).filter(ve=>typeof ve=="number");Ee.values[N.sequenceField]=ye.length?Math.max(...ye)+1:1}let xe=[...K,Ee];return Mt({...M.values,[p]:xe}),pt(p),Z(p,P),J}function jr(p){p?.forEach(ce);let R=Dt(),P=p?Object.fromEntries(Object.entries(R).filter(([K])=>p.some(J=>K===J||K.startsWith(`${J}.`)))):R;Se({errors:P});let N=Object.values(P)[0];return N===void 0?null:{reason:"check",message:N}}function Uo(p,R){if(!k.includes(p))return;if(!Le.steps().includes(p))return{reason:"cannot",message:`The step "${p}" does not apply now`};let P=!1;return ae(R,()=>P=Le.goTo(p)),P?null:{reason:"check",message:Object.values(M.errors)[0]}}async function zr(p,R){let P=await ne.runSteps(p,R);return tt("run",{id:R.id,steps:p,result:P}),P}function ur(p){return!e.dataSource?.create||!p||p.readonly?null:p.type==="many2one"||p.type==="many2many"?p.relation:null}async function Br(p,R,P,N={}){let K=ur(p),J=e.dataSource;if(!K||!J?.create)throw new Error(`"${R}" cannot make records: its data source has no create, or it is not a link`);return le(J.create({model:K,name:P.trim(),...Object.keys(N).length?{values:N}:{}}))}async function pr(p,R,P,N,K,J,X){let se=p.type==="reference"||p.type==="json"||p.type==="html";if(p.type!=="many2one"&&p.type!=="many2many"&&!se)throw new Error(`"${R}" is not a many2one, many2many, reference, json or html`);if(se&&!J)throw new Error(`Searching "${R}" needs a model`);let Ee=e.dataSource;if(!Ee?.search)return[];let xe=se||!p.filter?void 0:qi(p.filter,P),ye=X?[...xe??[],{field:"id",op:"in",value:X}]:xe,ve=se?J:p.relation;return le(Ee.search({model:ve,query:N,...ye?{filter:ye}:{},limit:K}))}function _t(p){let R=ce(p);if(R.type!=="one2many")throw new Error(`"${p}" is a ${R.type}, not a one2many`);return R}function qr(){return M.step?k.indexOf(M.step):-1}function xn(p){return o.get(p)?.source?.optional===!0}async function _r(p=!1){let R=e.dataSource;if(M.recordId==null||n.data.kind!=="record")return;if(!R?.load){Se({status:"error",error:"This page has no data source to load from"});return}let P=++Jn;Se({status:"loading",error:null});try{let N=await R.load({model:n.data.model,id:M.recordId,fields:L});if(P!==Jn||(C=jt(tn(c({...Dn(L,v()),...N})),"start"),Se({status:"ready",values:Te(C),dirty:[],errors:{},warnings:en(C,Ht)}),p))return;je(),le(Wt())}catch(N){P===Jn&&Se({status:"error",error:N.message})}}let Jn=0;async function mr(p){_!==null&&r.clearTimeout(_),Q!==null&&r.clearTimeout(Q),_=Q=null,te={},ge=null,ee=!1;let R={dirty:[],errors:{},warning:null,warningField:null,error:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null};if(p!=null)return Se({...R,recordId:p,status:"idle"}),_r();Jn++,C=tn(I(!0,!1));let P=jt(Te(C),"start");Se({...R,recordId:null,status:"ready",values:P,warnings:en(P,Ht)}),je(),await Wt()}let T=()=>({model:n.data.model,id:M.recordId,fields:L});async function q(p){if(e.host?.post)try{return await e.host.post(p)!==!1}catch{return!1}return Ie.get("post")?.size?(tt("post",{recordId:M.recordId,message:p}),!0):!1}let ne=Ad({fields:L,values:()=>M.values,recordId:()=>M.recordId,reading:me,today:v,write:p=>Tn(p,"step"),store:p=>nn(p),addLine:(p,R)=>{sn(p,R,"step")},check:jr,save:Nt,async reload(){return M.recordId==null?{reason:"cannot",message:"The record is not saved yet: there is nothing to load again"}:(await _r(!0),M.status==="error"?{reason:"cannot",message:M.error??"The record could not be loaded again"}:null)},reset:()=>Le.reset(),goTo:Uo,showing:ae,host:e.host,confirm:e.confirm,onAction:e.onAction,answered:(p,R)=>tt("action",{request:p,result:R}),changed:()=>M.dirty.length>0,...e.dataSource?.archive&&n.data.kind==="record"?{archive:p=>le((e.dataSource?.archive)({...T(),archive:p}))}:{},...e.dataSource?.copy&&n.data.kind==="record"?{copy:async()=>(await le((e.dataSource?.copy)(T()))).id}:{},...e.dataSource?.delete&&n.data.kind==="record"?{remove:()=>le((e.dataSource?.delete)(T()))}:{},async showRecord(p){return await mr(p),M.status==="error"?{reason:"cannot",message:M.error??"The record could not be loaded"}:null},told(p,R){"archived"in p?tt("archive",{recordId:R,archived:p.archived}):"copied"in p?tt("duplicate",{from:R,recordId:p.copied}):(tt("delete",{recordId:R}),M.recordId===R&&le(mr(null)))},post:q,wordsOf:p=>vu(ce(p),M.values[p])}),oe=$d((p,R,P)=>zr(R,{id:p,chain:P}));function be(p,R){let P=[...p.steps??[]];p.action!==void 0&&P.push({do:"call",action:p.action,..."params"in p&&p.params?{params:p.params}:{}});let N="builtin"in p&&!P.length?p.builtin:void 0;N&&P.push({do:N});let K=N==="archive"?i.archiveConfirm:N==="delete"?i.deleteConfirm:void 0,J="confirm"in p&&p.confirm!==void 0?p.confirm:K;return le((async()=>{if(J&&!await ne.ask(J)){let X={done:!1,reason:"no",message:J};return tt("run",{id:R.id,steps:P,result:X}),X}return zr(P,R)})())}let Le={page:n,getState:()=>M,subscribe(p){return Ne.add(p),()=>Ne.delete(p)},load:()=>le(_r()),setValue(p,R,P){ce(p),Mt({...M.values,[p]:Te(R)}),pt(p),Z(p,P?.by??"person")},setValues:(p,R)=>R?.stored?nn(p):Tn(p,"app"),node:vt,openRecord:p=>le(mr(p)),post:q,setEditing(p){p!==E&&(E=p,Se({}))},fieldReadonly:p=>Md(ce(p)),loadChoices:De,loadDefinitions:Ae,addDefinition:Ve,problem(p){ce(p);let R=Tt().filter(N=>N.field===p);return R.length?R.map(Kt).find(Boolean)??R.map(N=>fa(n.fields[p],N.source,M.values[p],i)).find(Boolean)??Hn(pe(p),M.values[p],R.some(N=>vt(N.id).required),i,v())??R.map(N=>an(N).error).find(N=>N!==void 0)??null:null},validate(){let p=Dt();return Se({errors:p}),Object.keys(p).length===0},save:()=>le(zt()),reset(){Fe(),te={},z=$.holding(C);let p=jt(Te(C),"start");Se({values:p,dirty:[],errors:{},warnings:en(p,Ht),warning:null,warningField:null,draft:null,step:k[0]??null,skipped:[],saveProblem:null})},changes:Qe,addLine:(p,R={})=>sn(p,R,"person"),updateLine(p,R,P,N){if(!_t(p).fields[P])throw new Error(`The lines of "${p}" have no field "${P}"`);let J=(M.values[p]??[]).map(X=>X.key===R?{...X,values:{...X.values,[P]:Te(N)}}:X);Mt({...M.values,[p]:J}),pt(p),Z(p,"person")},moveLine(p,R,P){let K=_t(p).sequenceField;if(!K)throw new Error(`The lines of "${p}" keep no order: give the field a sequenceField`);let J=[...M.values[p]??[]],X=J.findIndex(nt=>nt.key===R);if(X<0)throw new Error(`"${p}" has no line "${R}"`);let se=Math.max(0,Math.min(P,J.length-1));if(se===X)return;let Ee=J.map(nt=>nt.values[K]),xe=Ee.every((nt,Ot)=>typeof nt=="number"&&(Ot===0||nt>Ee[Ot-1]));J.splice(se,0,...J.splice(X,1));let ye=Math.min(X,se),ve=Math.max(X,se),mt=xe?Ee.slice(ye,ve+1):[],Pt=J.map((nt,Ot)=>{let rn=xe?Ot>=ye&&Ot<=ve?mt[Ot-ye]:nt.values[K]:Ot+1;return rn===nt.values[K]?nt:{...nt,values:{...nt.values,[K]:rn}}});Mt({...M.values,[p]:Pt}),pt(p),Z(p,"person")},removeLine(p,R){_t(p);for(let[N,K]of s)if(!(K.field!==p||(o.get(N)?.source).lineDelete===void 0)&&(M.values[p]??[]).some(J=>J.key===R)&&!B(N,R).deletable)throw new Error(`The line "${R}" of "${p}" cannot be deleted now: its table's lineDelete does not hold on it`);let P=(M.values[p]??[]).filter(N=>N.key!==R);Mt({...M.values,[p]:P}),pt(p),Z(p,"person")},async search(p,R,P=8,N={}){return pr(ce(p),p,he(),R,P,N.model,N.ids)},async previewLine(p,R,P){_t(p);let N=M.values[p]??[],K=N.find(ye=>ye.key===R);if(!K)throw new Error(`"${p}" has no line "${R}"`);let J=g.line(p,{...K.values,...P},M.values),X=e.dataSource;if(!X?.onchange||n.data.kind!=="record")return J;let se=N.map(ye=>ye.key===R?{...ye,values:J}:ye),xe=((await X.onchange({model:n.data.model,id:M.recordId,changed:p,values:Te({...M.values,[p]:se})})).values?.[p]??[]).find(ye=>ye.key===R);return xe?g.line(p,{...J,...xe.values},M.values):J},async searchLine(p,R,P,N,K=8,J={}){let X=_t(p),se=X.fields[P];if(!se)throw new Error(`The lines of "${p}" have no field "${P}"`);let Ee=(M.values[p]??[]).find(xe=>xe.key===R);if(!Ee)throw new Error(`"${p}" has no line "${R}"`);return pr(se,P,jn(Ee.values,X.fields,he(),Ee.id??null),N,K,J.model,J.ids)},canCreate:p=>ur(n.fields[p])!==null,quickCreate:(p,R)=>Br(n.fields[p],p,R,n.fields[p]?H(p):{}),canCreateLine:(p,R)=>ur(_t(p).fields[R])!==null,quickCreateLine:(p,R,P,N)=>Br(_t(p).fields[R],R,P,N?H(R,{lines:p,key:N}):{}),createValues:(p,R)=>H(p,R),steps:()=>k.filter(p=>!vt(p).invisible),next(){if(!M.step)return!1;M.skipped.includes(M.step)&&Se({skipped:M.skipped.filter(N=>N!==M.step)});let p=Dt(M.step);if(Object.keys(p).length)return Se({errors:p}),!1;let R=Le.steps(),P=k.slice(qr()+1).find(N=>R.includes(N));return P?(Se({step:P,errors:{}}),!0):!1},back(){if(!M.step)return!1;let p=Le.steps(),R=k.slice(0,qr()).reverse().find(P=>p.includes(P));return R?(Se({step:R,errors:{}}),!0):!1},skip(){let p=M.step;if(!p||!xn(p))return!1;let R=Le.steps(),P=R[R.indexOf(p)+1];return P?(Se({step:P,errors:{},skipped:[...M.skipped.filter(N=>N!==p),p]}),!0):!1},goTo(p){let R=Le.steps(),P=R.indexOf(p),N=M.step?R.indexOf(M.step):-1;if(P===-1||N===-1)return!1;if(P<=N)return Se({step:p,errors:{}}),!0;let K=[...M.skipped];for(let J of R.slice(N,P)){if(K.includes(J))continue;let X=Dt(J);if(Object.keys(X).length){if(xn(J)){K.push(J);continue}return Se({step:J,errors:X,skipped:K}),!1}}return Se({step:p,errors:{},skipped:K}),!0},async runAction(p,R){let P=o.get(p);if(!P||P.kind!=="button"&&P.kind!=="stat")throw new Error(`The page has no button "${p}"`);return vt(p).invisible?{done:!1,reason:"cannot",message:`The button "${p}" is hidden`}:P.parent&&o.get(P.parent)?.source?.selectedButtons?.some(N=>N.id===p)?{done:!1,reason:"cannot",message:`The button "${p}" runs with the lines chosen in its table`}:be(P.source,{id:p,chain:[],...R?{recordIds:[...R.recordIds]}:{}})},async linkedValues(p,R,P){let N=ce(p);if(N.type!=="many2many")throw new Error(`"${p}" is not a many2many`);let K=e.dataSource;if(!K?.list||!R.length)return[];let J=await K.list({model:N.relation,fields:[...P],filter:[{field:"id",op:"in",value:[...R]}],sort:[],offset:0,limit:R.length}),X=new Map(J.records.map(se=>[String(se.id),se]));return R.flatMap(se=>{let Ee=X.get(String(se));return Ee?[{id:Ee.id,values:Ee.values}]:[]})},fieldTone(p){let R=d.get(p);if(R){let{context:P,env:N}=me();return R(P,N)}if(o.get(p)?.kind!=="field")throw new Error(`"${p}" is not a field on this page`);return{tone:null,bold:!1}},placeholder(p){let R=f.get(p);if(!R){let K=o.get(p);if(K?.kind!=="field")throw new Error(`"${p}" is not a field on this page`);let J=K.source;return p==="#title"&&n.layout.type==="sheet"?n.layout.title?.placeholder:J.placeholder}let{context:P,env:N}=me();return R.when.find(K=>K.holds.evaluate(P,N))?.text??R.fixed},lineState:(p,R)=>B(p,R),columnHidden(p,R){let P=O(p),{context:N,env:K}=me();return P?P.compiled.hidden(R,N,K,Oe):!1},async runRowAction(p,R,P){let N=O(p),K=N?.compiled.buttons.find(X=>X.id===R);if(!N||!K)throw new Error(`The table "${p}" has no button "${R}"`);if(!B(p,P).buttons[R])return{done:!1,reason:"cannot",message:`The button "${R}" is hidden on this line`};let J=(M.values[N.field]??[]).find(X=>X.key===P);return be(K,{id:R,chain:[],line:{field:N.field,key:P,values:Te(J.values)}})},async runLinesAction(p,R,P){let N=o.get(p),K=N?.source,J=K?.selectedButtons?.find(ye=>ye.id===R);if(!N||!K||!J)throw new Error(`The table "${p}" has no button "${R}" for its chosen lines`);let X=M.values[K.field]??[],se=P.map(ye=>X.find(ve=>ve.key===ye)??null),Ee=P.find((ye,ve)=>!se[ve]);if(Ee!==void 0)throw new Error(`"${K.field}" has no line "${Ee}"`);if(vt(R).invisible)return{done:!1,reason:"cannot",message:`The button "${R}" is hidden`};if(!P.length)return{done:!1,reason:"cannot",message:`The button "${R}" runs with lines chosen: none is`};let xe=se;return be(J,{id:R,chain:[],lines:{field:K.field,keys:[...P],ids:xe.flatMap(ye=>ye.id===void 0?[]:[ye.id]),values:xe.map(ye=>Te(ye.values))}})},run:(p,R={})=>le(zr(p,{id:R.id??"run",chain:[],...R.recordIds?{recordIds:[...R.recordIds]}:{}})),shown(p){k.includes(p)||le(oe(`on.show.${p}`,n.on?.show?.[p],Pe,!0))},on(p,R){let P=Ie.get(p);return P||Ie.set(p,P=new Set),P.add(R),()=>{P.delete(R)}},restoreDraft(){let p=e.drafts?.store.getItem(h());if(!p)return;let R=JSON.parse(p);Mt({...M.values,...R.values},{draft:null},!0)},discardDraft(){Fe(),Se({draft:null})},async settled(){for(;$e.size;)await Promise.allSettled([...$e])},embed(p,R){let P=w.get(p);if(P)return P.inner.form;let N=A.get(p);if(!N)throw new Error(`"${p}" is not a saved form placed on this page`);let K=[...t,n.id];if(K.includes(R.id))throw new Error(`a page cannot be placed inside itself: ${[...K.slice(K.indexOf(R.id)),R.id].join(" \u2192 ")}`);let J=M.values[N.name],X=Nd({page:{...R,data:{kind:"responses"}},dataSource:e.dataSource,values:Td(J)?J:{},onAction:e.onAction,host:e.host,confirm:e.confirm,scheduler:r,messages:i,now:e.now},K);w.set(p,{name:N.name,inner:X}),X.form.on("change",({by:xe})=>{S||Z(N.name,xe)}),X.form.subscribe(xe=>{S||xe.values===M.values[N.name]||(Mt({...M.values,[N.name]:xa(xe.values)}),pt(N.name))});let se=xa(X.form.getState().values);M.dirty.includes(N.name)||(C={...C,[N.name]:se});let Ee={...M.values,[N.name]:se};return Se({values:Ee,dirty:Ze(Ee)}),X.form},embedded:p=>w.get(p)?.inner.form??null,dispose(){_!==null&&r.clearTimeout(_),Q!==null&&r.clearTimeout(Q),Ne.clear(),Ie.clear();for(let p of w.values())p.inner.form.dispose()}};return M={...M,warnings:Ht()},M.recordId==null&&je(),M.recordId==null&&le(Promise.resolve().then(Wt)),{form:Le,take(p,R){if(R!=="start")return Mt({...Dn(n.fields,v()),...p},{},R==="fresh");C=tn({...Dn(n.fields,v()),...Te(p)});let P=jt(Te(C),"start");Se({values:P,dirty:[],errors:{},warnings:en(P,Ht),warning:null,warningField:null})},errorsNow:()=>Dt(),show(p){JSON.stringify(p)!==JSON.stringify(M.errors)&&Se({errors:p})}}}function mu(e,t){let n={};for(let[r,i]of Object.entries(e))r.startsWith(`${t}.`)&&(n[r.slice(t.length+1)]=i);return n}function gu(e,t){let n=a=>a==null||a===!1||a==="";if(n(e)||n(t))return n(e)===n(t)?0:n(e)?-1:1;let r=a=>a!==null&&typeof a=="object"&&!Array.isArray(a)&&"label"in a?String(a.label):a,i=r(e),o=r(t);return typeof i=="number"&&typeof o=="number"?i-o:typeof i=="boolean"&&typeof o=="boolean"?Number(i)-Number(o):String(i).localeCompare(String(o))}function hu(e,t,n){for(let r of n){let i=gu(e[r.field],t[r.field]);if(i)return r.desc?-i:i}return 0}function Md(e){return e.readonly===!0||e.compute!==void 0}function bu(e,t){let n=[],r=new Map(e.filter(o=>o.id!==void 0).map(o=>[o.key,o]));for(let o of t){let a=r.get(o.key);if(o.id===void 0||!a){n.push({op:"create",key:o.key,values:Te(o.values)});continue}let s={};for(let[d,l]of Object.entries(o.values))JSON.stringify(l)!==JSON.stringify(a.values[d])&&(s[d]=Te(l));Object.keys(s).length&&n.push({op:"update",id:o.id,values:s})}let i=new Set(t.map(o=>o.key));for(let o of e)o.id!==void 0&&!i.has(o.key)&&n.push({op:"delete",id:o.id});return n}function yu(e,t){let n=new Set(e.map(i=>i.id)),r=new Set(t.map(i=>i.id));return[...t.filter(i=>!n.has(i.id)).map(i=>({op:"link",id:i.id})),...e.filter(i=>!r.has(i.id)).map(i=>({op:"unlink",id:i.id}))]}function xu(e){let t=new Map,n=(i,o,a,s)=>{let d=i.roles,l=a==="button"?i.pressed:void 0;if(t.set(i.id,{id:i.id,parent:o,kind:a,field:s.field,...d?.length?{roles:d}:{},invisible:ut(s.invisible),readonly:ut(s.readonly),required:ut(s.required),...l!==void 0?{pressed:ut(l)}:{},source:i}),a==="button")for(let c of i.menu??[])n(c,i.id,"button",{invisible:c.invisible})},r=(i,o)=>{for(let a of i)if(a.type==="field"){n(a,o,"field",{invisible:a.invisible,readonly:a.readonly,required:a.required,field:a.field});for(let s of[...a.selectedButtons??[],...a.controlButtons??[]])n(s,a.id,"button",{invisible:s.invisible})}else if(a.type==="button")n(a,o,"button",{invisible:a.invisible});else if(a.type==="tabs"){n(a,o,"other",{invisible:a.invisible});for(let s of a.children)n(s,a.id,"other",{invisible:s.invisible}),r(s.children,s.id)}else a.type==="section"?(n(a,o,"other",{invisible:a.invisible,readonly:a.readonly}),r(a.children,a.id)):a.type==="form"?n(a,o,"form",{invisible:a.invisible,readonly:a.readonly}):n(a,o,"other",{invisible:a.invisible})};if(e.type==="tabs")return r([e],""),t.get(e.id).parent=null,t;if(n(e,null,"other",{}),e.type==="wizard")for(let i of e.children)n(i,e.id,"step",{invisible:i.invisible}),r(i.children,i.id);else if(e.type==="sections"){r(e.children,e.id);for(let i of e.footer??[])n(i,e.id,"button",{invisible:i.invisible})}else if(e.type==="list")for(let i of e.actions??[])n(i,e.id,"button",{invisible:i.invisible});else{let i=(a,s)=>{s&&n({id:a},e.id,"field",{field:s})};i("#title",e.title?.field),i("#subtitle",e.title?.subtitleField),i("#avatar",e.title?.avatarField),e.statusbar&&n({id:"#statusbar",...e.statusbar.roles?{roles:e.statusbar.roles}:{}},e.id,"field",{field:e.statusbar.field,invisible:e.statusbar.invisible});for(let a of[...e.buttons??[],...e.footer??[]])n(a,e.id,"button",{invisible:a.invisible});for(let a of e.statButtons??[])n(a,e.id,"stat",{invisible:a.invisible});for(let a of[...e.ribbon?[e.ribbon]:[],...e.ribbons??[]])n(a,e.id,"other",{invisible:a.invisible});for(let a of e.alerts??[]){n(a,e.id,"other",{invisible:a.invisible});for(let s of a.buttons??[])n(s,a.id,"button",{invisible:s.invisible})}for(let a of e.badges??[])n(a,e.id,"other",{invisible:a.invisible});r([...e.title?.above??[],...e.title?.before??[],...e.title?.after??[],...e.title?.below??[]],e.id),r(e.children,e.id);let o=e.head;for(let a of o?.meta??[])a.type==="field"?r([a],e.id):n(a,e.id,"button",{invisible:a.invisible});for(let a of o?.actions??[])n(a,e.id,"button",{invisible:a.invisible});r(o?.band?.children??[],e.id),e.sidePanel&&n(e.sidePanel,e.id,"other",{invisible:e.sidePanel.invisible});for(let a of e.toolbar?.menu??[])if(n(a,e.id,"button",{invisible:a.invisible}),a.builtin==="archive"||a.builtin==="unarchive"){let s=t.get(a.id),d=s.invisible,l=a.builtin==="unarchive";s.invisible={...d,evaluate:(c,f)=>c.active===!1!==l||d.evaluate(c,f)}}e.attachmentPreview&&n({id:"#preview",...e.attachmentPreview},e.id,"other",{invisible:e.attachmentPreview.invisible})}return t}function vu(e,t){if(e.type==="boolean")return t===!0?"Yes":"No";if(t==null||t===!1)return"";if(e.type==="selection")return e.options.find(r=>r.value===t)?.label??String(t);if(e.type==="html")return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();let n=r=>r&&typeof r=="object"&&"label"in r?String(r.label):r&&typeof r=="object"&&"name"in r?String(r.name):String(r);return Array.isArray(t)?t.map(n).join(", "):n(t)}function Ji(e,t){return!!e&&(e.type==="integer"||e.type==="float"||e.type==="monetary")&&typeof t=="string"&&t.trim()!==""}function wu(e,t){return e?.type!=="one2many"?Ji(e,t):(t??[]).some(n=>Object.entries(n.values).some(([r,i])=>Ji(e.fields[r],i)))}var Pd=new Map;function Od(e,t){let n=`${e}:${t}`,r=Pd.get(n);return r||(r=new Intl.NumberFormat(e,{numberingSystem:"latn",minimumFractionDigits:t,maximumFractionDigits:t}),Pd.set(n,r)),r}function rr(e,t,n,r="en"){try{let i=new Intl.NumberFormat(r,{style:"currency",currency:t,currencyDisplay:"narrowSymbol",numberingSystem:"latn",minimumFractionDigits:n,maximumFractionDigits:n}).formatToParts(e);return i.map((o,a)=>o.type==="currency"&&/^(integer|minusSign)$/.test(i[a+1]?.type??"")?`${o.value}\xA0`:o.value).join("")}catch{return`${t} ${St(e,n,r)}`}}function Cd(e){let t=Od(e,1).formatToParts(12345.6);return{group:t.find(n=>n.type==="group")?.value??",",decimal:t.find(n=>n.type==="decimal")?.value??"."}}function va(e,t,n="en"){return oi(St(e,t,n),n)}function oi(e,t="en"){let{group:n}=Cd(t);return e.split(n).join("")}function St(e,t,n="en"){return Od(n,t).format(e)}function gn(e,t="en"){let{group:n,decimal:r}=Cd(t),i=e.replace(/[٠-٩]/g,o=>String(o.charCodeAt(0)-1632)).replace(/[۰-۹]/g,o=>String(o.charCodeAt(0)-1776)).replace(/٫/g,r).replace(/٬/g,n);return i=i.replace(/[\s\u00a0\u202f]/g,""),n.trim()&&(i=i.split(n).join("")),r==="."?i:i.split(r).join(".")}var Id={};var ku={search:"Search\u2026",noResults:"No results",remove:"Remove {name}",clear:"Clear {label}",addLine:"Add a line",addSection:"Add a section",addNote:"Add a note",deleteLine:"Delete line",lineN:"line {n}",noLines:"No lines yet",total:"Total",lineProblem:"Line {n}: {message}",moreProblems:"and {n} more",chooseColumns:"Choose columns",createNamed:"Create \u201C{name}\u201D",createAndEdit:"Create and edit\u2026",searchMore:"Search more\u2026",suggestions:"Suggestions",expandNamed:"Expand {name}",collapseNamed:"Collapse {name}",addNamed:"Add {label}",openNamed:"Open {name}",openLine:"Open line",chooseLine:"Choose {name}",chooseAllLines:"Choose every line",linesChosen:"{n} chosen",moreSteps:"More",timeInStep:"{time} in this step",chooseDate:"Choose a date",other:"Other:",otherAnswer:"Your own answer",clearSelection:"Clear selection",previousMonth:"Previous month",nextMonth:"Next month",weekShort:"Wk",week:"Week",formatting:"Formatting",bold:"Bold",italic:"Italic",underline:"Underline",textStyle:"Text style",paragraph:"Paragraph",heading:"Heading",subheading:"Subheading",bulletList:"Bulleted list",numberList:"Numbered list",alignLeft:"Align left",alignCenter:"Align centre",alignRight:"Align right",link:"Link",linkAddress:"Link address",applyLink:"Apply",removeLink:"Remove link",strike:"Strikethrough",highlight:"Highlight",textColour:"Text colour",emoji:"Emoji",indent:"Increase indent",outdent:"Decrease indent",textSize:"Text size",code:"Code",mention:"Mention someone",linkRecordNamed:"Link {kind}",clearFormatting:"Clear formatting",image:"Insert image",moreTools:"More",switchToMarkdown:"switch to Markdown editor",switchToRich:"switch to rich text editor",markdownSupported:"Markdown supported.",pasteOrSelect:"Paste or select files to insert.",preview:"Preview",editNamed:"Edit {name}",doneEditing:"Done",maximiseNamed:"Maximise {name}",foldNamed:"Collapse {name}",unfoldNamed:"Expand {name}",addLink:"Add link",existingItem:"Existing item",newItem:"New item",formattingLost:"Some formatting cannot be written in Markdown and will be lost. Switch anyway?",taskList:"Checklist",cursorInLink:"Put the cursor in a link first.",attachFile:"Attach a file",switchAnyway:"Switch",headingLevel:"Heading {n}",upload:"Upload a file",uploadImage:"Add a photo",replace:"Replace",removeFile:"Remove",dropHere:"or drop it here",addFiles:"Add files",addPhotos:"Add photos",dropThem:"or drop them here",upToSize:"up to {size}",upToEach:"up to {size} each",upToFiles:"up to {max} files",fileCount:"{n} files",oneFile:"1 file",fileCountOf:"{n} of {max} files",tooMany:"Up to {max} files: {n} not added",alreadyAdded:"{name}: already added",removeAsk:"Remove {name}?",keep:"Keep",previous:"Previous",next:"Next",download:"Download",close:"Close",fileAt:"{n} of {total}",noPreview:"No preview for this kind of file",showFilesAs:"Show files as",asList:"List",asCards:"Cards",asThumbnails:"Thumbnails",invalidJson:"Not valid JSON",invalidJsonAt:"Not valid JSON: line {line}, column {column}",signaturePad:"Signature pad: draw your signature",signHere:"Sign here",typeSignature:"Or type your name",clearDrawing:"Clear",undo:"Undo",uploadSignature:"Upload a picture",notAnswered:"Not answered",moveUp:"Move {label} up",moveDown:"Move {label} down",movedTo:"{label} moved to place {n} of {total}",addressStreet:"Street address",addressCity:"City",addressLine2:"Address line 2",addressRegion:"State or region",addressPostcode:"Postcode",addressCountry:"Country",entry:"Entry {n}",addAnother:"Add another",copy:"Copy {name}",removed:"{name} removed",loadingChoices:"Loading choices\u2026",choicesFailed:"Load the choices again",notOffered:"{name}: no longer offered",yes:"Yes",no:"No",upTo:"Up to {n}",keepOrder:"Keep this order",ofMax:"{n} of {max}",charactersLeft:"Characters left: {n}",colourNames:"No colour|Red|Orange|Yellow|Cyan|Purple|Almond|Teal|Blue|Raspberry|Green|Violet",copyValue:"Copy",copied:"Copied",noDocument:"No document yet",openInNewTab:"Open in a new tab",account:"Account",share:"Percentage",addAccount:"Add an account",sharesOff:"The shares add up to {n}, not 100%",untaxed:"Untaxed amount",paidOn:"Paid on {date}",amountDue:"Amount due",paymentOf:"Payment of {amount}",journal:"Journal",memo:"Memo",openPayment:"Open",addProperty:"Add a property",propertyName:"Property name",propertyType:"Kind",propertyTypes:"Text|Long text|Whole number|Number|Yes or no|Date",add:"Add",cancel:"Cancel",loading:"Loading\u2026",perDay:"/day",perNight:"/night",perWeek:"/week",perMonth:"/month",perYear:"/year"},ot={en:ku,...Id};function Er(e,t,n={}){let r=e.ownerDocument,i=r.defaultView,o=typeof t.showPopover=="function";o&&t.setAttribute("popover","manual");let a=!1,s="",d=0;function l(){let u=e.getBoundingClientRect(),k=r.documentElement.clientWidth,h=r.documentElement.clientHeight,[v,b]=[h-u.bottom-10,u.top-10],E=v<160&&b>v,m=n.gap??2;Object.assign(t.style,{position:"fixed",inset:"auto",margin:"0",minWidth:`${n.sameWidth?u.width:Math.min(Math.max(u.width,224),k-16)}px`,maxWidth:`${n.sameWidth?u.width:Math.max(u.width,Math.min(448,k-16))}px`,maxHeight:`${Math.max(96,Math.min(n.maxHeight??240,E?b:v))}px`}),s=`${u.left},${u.top},${u.width},${k},${h}`;let x=t.offsetWidth,g=i?.getComputedStyle(e).direction==="rtl",$=Math.max(8,Math.min(g?u.right-x:u.left,k-x-8));Object.assign(t.style,{left:`${$}px`,top:`${E?u.top-m-t.offsetHeight:u.bottom+m}px`})}let c=()=>{if(a){if(!e.isConnected)return y.hide();l()}},f=()=>{if(!a)return;let u=e.getBoundingClientRect();`${u.left},${u.top},${u.width},${r.documentElement.clientWidth},${r.documentElement.clientHeight}`!==s&&c(),d=i?.requestAnimationFrame(f)??0},y={show(){t.hidden=!1,o&&!t.matches(":popover-open")&&t.showPopover(),l(),a||(r.addEventListener("scroll",c,!0),i?.addEventListener("resize",c)),a=!0,!d&&i?.requestAnimationFrame&&(d=i.requestAnimationFrame(f))},place:c,hide(){o&&t.matches(":popover-open")&&t.hidePopover(),t.hidden=!0,a&&(r.removeEventListener("scroll",c,!0),i?.removeEventListener("resize",c)),d&&i?.cancelAnimationFrame(d),d=0,a=!1}};return y}function Me(e){return(t,n={},...r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}}var Be=(e,t)=>e??ot[t??"en"]??ot.en,Ue=(e,t)=>e.replace(/\{(\w+)\}/g,(n,r)=>r in t?String(t[r]):n);function _e(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}function Et(e,t){e.hidden!==t&&(e.hidden=t)}function xt(e,t){e.textContent!==t&&(e.textContent=t)}function ct(e,t){_e(e,"aria-invalid",String(t.invalid)),_e(e,"aria-describedby",t.describedBy||null)}function Xi(e){let t=e("div",{class:"fd-announce",role:"status","aria-live":"polite"});return{element:t,say(n){t.textContent="",t.textContent=n}}}var Ut=e=>e.closest("[dir]")?.getAttribute("dir")==="rtl";function En(e,t,n,r,i=!0){let o=Me(e)("button",{type:"button",class:"fd-choice-clear",hidden:""},t.clearSelection);o.addEventListener("click",n);let a=i&&r.options?.clear!==!1,s=!1;return{button:o,allow(d){s=a&&!d.required&&!d.readonly},show(d){Et(o,!(s&&d))}}}function Zi(e,t){let n=e("span"),r=e("button",{type:"button",class:"fd-button fd-button-link"},t.removeFile),i=e("button",{type:"button",class:"fd-button fd-button-link"},t.keep),o=e("div",{class:"fd-file-confirm",hidden:""},n,r,i),a=d=>{},s=d=>{o.hidden=!0,a(d)};return r.addEventListener("click",()=>s(!0)),i.addEventListener("click",()=>s(!1)),o.addEventListener("keydown",d=>d.key==="Escape"&&s(!1)),{element:o,ask(d,l){n.textContent=d,a=l,o.hidden=!1,i.focus()}}}var ir=e=>`<g transform="scale(1.5)" stroke-width="1">${e}</g>`,Vd={attach:ir('<path d="M4 7.5l4.7-4.3a3 3 0 0 1 4.2 4.2L6.6 13a1.4 1.4 0 0 1-2-2L10 5.4"/>'),branch:'<circle cx="6" cy="5" r="2"/><circle cx="6" cy="19" r="2"/><circle cx="18" cy="7" r="2"/><path d="M6 7v10M18 9c0 4-5 4-11 8.5"/>',bug:'<g fill="currentColor" stroke="none" fill-rule="evenodd"><path d="M7.4 3.2h9.2v6.4H7.4zM9.6 5.2v2.6h4.8V5.2z"/><path d="M3.1 15.5a8.9 7.1 0 1 0 17.8 0a8.9 7.1 0 1 0-17.8 0zM7.6 11.6h3v3h-3zM13.4 11.6h3v3h-3zM5.4 16.4h3v3h-3zM15.6 16.4h3v3h-3zM11.55 16.2h.9v6h-.9z"/></g><path d="M7.9 3.6L6.8 1.8M16.1 3.6l1.1-1.8M8.4 21.6l-.8 1.6M15.6 21.6l.8 1.6" stroke-width="1.6"/>',"chevron-down":'<path d="M6 9l6 6 6-6"/>',"chevron-right":'<path d="M9 6l6 6-6 6"/>',"chevron-up":'<path d="M6 15l6-6 6 6"/>',close:'<path d="M6 6l12 12M18 6L6 18"/>',code:'<path d="M8.5 7L3.5 12l5 5M15.5 7l5 5-5 5"/>',copy:ir('<rect x="5.5" y="2.5" width="7" height="9" rx="1"/><path d="M3.5 4.5v7a2 2 0 0 0 2 2h5"/>'),emoji:'<circle cx="12" cy="12" r="9"/><path d="M8.5 14.5a4.5 4.5 0 0 0 7 0M9 9.5v.01M15 9.5v.01"/>',external:'<path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>',eye:ir('<path d="M1.5 7.5a6 4 0 0 1 12 0"/><circle cx="7.5" cy="8.5" r="2"/>'),"filter-lines":'<path d="M4 6.5h16M7 12h10M10 17.5h4"/>',gear:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',hash:'<path d="M10 3L8 21M16 3l-2 18M4 8.5h16M3.5 15.5h16"/>',history:'<path d="M4.5 12a7.5 7.5 0 1 0 2.2-5.3"/><path d="M4.5 4.5V9H9M12 8v4.5l3 2"/>',image:'<rect x="3" y="5" width="18" height="14" rx="1.5"/><path d="M3 16l5-5 4.5 4.5 3-3L21 18"/><circle cx="15.5" cy="9.5" r="1.5"/>',maximise:'<path d="M3.5 20.5l17-17M13.5 3.5h7v7M10.5 20.5h-7v-7"/>',mention:'<circle cx="12" cy="12" r="3.5"/><path d="M15.5 8.5V13a2.5 2.5 0 0 0 5 0v-1a8.5 8.5 0 1 0-3.4 6.8"/>',more:'<circle cx="12" cy="5" r="1.2"/><circle cx="12" cy="12" r="1.2"/><circle cx="12" cy="19" r="1.2"/>',"pull-request":'<circle cx="6" cy="5" r="2"/><circle cx="6" cy="19" r="2"/><circle cx="18" cy="19" r="2"/><path d="M6 7v10M18 17v-8a3 3 0 0 0-3-3h-3.5M13.5 3.5L11 6l2.5 2.5"/>',refresh:'<path d="M20 12a8 8 0 1 1-2.34-5.66"/><path d="M20 4v4.5h-4.5"/>',restore:'<path d="M19 5l-5 5M14 6v4h4M5 19l5-5M10 18v-4H6"/>',save:'<path d="M5 4h11.5L20 7.5V20H5z"/><path d="M8 4v5h8V4M8 20v-6h8v6"/>',story:'<path d="M5 4.5A1.5 1.5 0 0 1 6.5 3H19v14H6.5A1.5 1.5 0 0 0 5 18.5z"/><path d="M5 18.5A1.5 1.5 0 0 0 6.5 20H19"/>',task:'<rect x="5" y="4" width="14" height="17" rx="2"/><path d="M9 3h6v3H9zM9 12.5l2 2 4-4"/>',undo:ir('<path d="M3.5 1.5v5h5M4 6l3.6-3.6a3.3 3.3 0 0 1 4.8 4.6L8.5 12.5"/>')};var Su="http://www.w3.org/2000/svg",Dd={user:'<circle cx="12" cy="8" r="4"/><path d="M4 21c0-4 3.6-6 8-6s8 2 8 6"/>',users:'<circle cx="9" cy="8" r="3.5"/><path d="M2 20c0-3.5 3-5.5 7-5.5s7 2 7 5.5"/><circle cx="17" cy="9" r="2.5"/><path d="M16.5 14.5c3 0 5.5 1.6 5.5 4.5"/>',building:'<rect x="4" y="3" width="16" height="18" rx="1"/><path d="M9 21v-4h6v4M8 7h2M14 7h2M8 11h2M14 11h2"/>',home:'<path d="M3 11l9-7 9 7"/><path d="M5 10v10h14V10"/><path d="M10 20v-6h4v6"/>',phone:'<rect x="7" y="2" width="10" height="20" rx="2"/><path d="M11 18h2"/>',mail:'<rect x="3" y="5" width="18" height="14" rx="2"/><path d="M3 7l9 6 9-6"/>',pin:'<path d="M12 21s-7-6.5-7-12a7 7 0 0 1 14 0c0 5.5-7 12-7 12z"/><circle cx="12" cy="9" r="2.5"/>',globe:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3.2 3 14.8 0 18M12 3c-3 3.2-3 14.8 0 18"/>',calendar:'<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/>',clock:'<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 3"/>',money:'<rect x="2" y="6" width="20" height="12" rx="2"/><circle cx="12" cy="12" r="3"/><path d="M6 9.5v0M18 14.5v0"/>',cart:'<path d="M3 4h2l2.5 11h11L21 7H6.4"/><circle cx="9" cy="19.5" r="1.5"/><circle cx="17" cy="19.5" r="1.5"/>',box:'<path d="M12 3l8 4.5v9L12 21l-8-4.5v-9z"/><path d="M4 7.5l8 4.5 8-4.5M12 12v9"/>',truck:'<path d="M2 6h12v10H2zM14 9h4l3 3.5V16h-7"/><circle cx="6.5" cy="17.5" r="1.8"/><circle cx="17" cy="17.5" r="1.8"/>',receipt:'<path d="M6 3h12v18l-3-2-3 2-3-2-3 2z"/><path d="M9 8h6M9 12h6"/>',file:'<path d="M6 3h8l4 4v14H6z"/><path d="M14 3v4h4M9 12h6M9 16h6"/>',edit:'<path d="M4 20h4L19 9l-4-4L4 16z"/><path d="M13.5 6.5l4 4"/>',tag:'<path d="M3 12V4h8l10 10-8 8z"/><circle cx="7.5" cy="8" r="1.5"/>',star:'<path d="M12 3l2.8 6 6.2.6-4.7 4.2 1.4 6.2L12 16.8 6.3 20l1.4-6.2L3 9.6 9.2 9z"/>',lock:ir('<rect x="3.5" y="6.5" width="10" height="7" rx="1.5"/><path d="M5.5 6.5v-1a3 3 0 0 1 6 0v1"/><circle cx="8.5" cy="10" r="1" fill="currentColor" stroke="none"/>'),check:'<path d="M5 12.5l4.5 4.5L19 7.5"/>',info:'<circle cx="12" cy="12" r="9"/><path d="M12 11v6M12 7.5v0"/>',warning:'<path d="M12 3l10 18H2z"/><path d="M12 10v5M12 18v0"/>',settings:'<path d="M4 6h9M17 6h3M4 12h3M11 12h9M4 18h11M19 18h1"/><circle cx="15" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="17" cy="18" r="2"/>',chart:'<path d="M3 20h18M6 20v-8M11 20V5M16 20v-6"/>',link:'<path d="M9.5 7.5H7.2a4.5 4.5 0 0 0 0 9h2.3M14.5 7.5h2.3a4.5 4.5 0 0 1 0 9h-2.3M8.5 12h7"/>',list:'<path d="M8 6h12M8 12h12M8 18h12M4 6v0M4 12v0M4 18v0"/>',chat:ir('<path d="M6 9.5h5a1.5 1.5 0 0 0 1.5-1.5V4A1.5 1.5 0 0 0 11 2.5H3A1.5 1.5 0 0 0 1.5 4v4A1.5 1.5 0 0 0 3 9.5h.5v3z"/>'),search:'<circle cx="11" cy="11" r="6.5"/><path d="M16 16l5 5"/>',filter:'<path d="M3 5h18l-7 8.5V20l-4-2v-4.5z"/>',layers:'<path d="M12 3l9 5-9 5-9-5z"/><path d="M3 13l9 5 9-5"/>',thumb:'<path d="M7 21V10l4-8c1.6 0 2.6 1.3 2.2 3L12.5 9H19a2 2 0 0 1 2 2.3l-1.3 7.6a2.5 2.5 0 0 1-2.5 2.1H7zM7 10H3v11h4"/>',...Vd};function rt(e,t,n){let r=t?n?.[t]??Dd[t]:void 0;if(r===void 0)return null;let i=e.createElementNS(Su,"svg");for(let[o,a]of Object.entries({viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",focusable:"false",class:"fd-icon","data-icon":t}))i.setAttribute(o,a);return i.innerHTML=r,i}var Lu=180,ai=8;function Rr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>t[r]??n)}function Qi(e){let{document:t,id:n,labels:r}=e,i=`${n}-list`,o=t.createElement("input");Object.assign(o,{id:n,className:"fd-input fd-combo-input",autocomplete:"off"}),o.setAttribute("role","combobox"),o.setAttribute("aria-autocomplete","list"),o.setAttribute("aria-expanded","false"),o.setAttribute("aria-controls",i),o.placeholder=e.placeholder||r.search;let a=t.createElement("ul");a.id=i,a.className="fd-listbox",a.setAttribute("role","listbox"),a.hidden=!0;let s=t.createElement("div");s.className="fd-combo",s.append(o,a);let d=Er(o,a),l="",c=null,f="",y=new Map,u=!1,k=[],h=-1,v=0,b,E=!1;function m(){if(a.replaceChildren(),k.forEach((w,L)=>{let S=t.createElement("li");S.id=`${i}-${L}`,S.setAttribute("role","option"),S.setAttribute("aria-selected",String(L===h)),S.className=`fd-option${L===h?" fd-active":""}${w===c||y.has(w)?" fd-option-create":""}`,S.textContent=w.label,S.addEventListener("mousedown",I=>I.preventDefault()),S.addEventListener("click",()=>$(L)),a.append(S)}),!k.length){let w=t.createElement("li");w.className="fd-empty",w.textContent=r.noResults,a.append(w)}h>=0?o.setAttribute("aria-activedescendant",`${i}-${h}`):o.removeAttribute("aria-activedescendant"),d.place()}function x(){d.show(),o.setAttribute("aria-expanded","true")}function g(){clearTimeout(b),v++,d.hide(),o.setAttribute("aria-expanded","false"),o.removeAttribute("aria-activedescendant"),h=-1}function $(w){let L=k[w];if(!L)return;let S=f;if(g(),u=!1,L===c&&e.create){e.create(S).then(e.pick,()=>{});return}let I=y.get(L);if(I){I(S).then(F=>F&&e.pick(F),()=>{});return}e.pick(L)}function A(w){clearTimeout(b);let L=++v;b=setTimeout(async()=>{let S=await e.search(w).catch(()=>[]);if(L!==v||t.activeElement!==o)return;let I=k[h],F=I&&I!==c&&!y.has(I)?I.id:void 0,D=e.exclude?.()??new Set,W=S.filter(B=>!D.has(B.id)),j=e.shown!==void 0&&W.length>e.shown;k=j?W.slice(0,e.shown):W;let O=w.trim();c=null,e.create&&O&&!S.some(B=>B.label.trim().toLowerCase()===O.toLowerCase())&&(f=O,c={id:"__create__",label:Rr(r.createNamed,{name:O})},k=[...k,c]),f=O,y=new Map((e.more?.(O,j)??[]).map((B,H)=>[{id:`__more_${H}__`,label:B.label},B.act])),k=[...k,...y.keys()],h=F===void 0?-1:k.findIndex(B=>B.id===F),m(),x()},Lu)}return o.addEventListener("input",()=>{u=!0,E||A(o.value)}),o.addEventListener("focus",()=>{E||A("")}),o.addEventListener("click",()=>{!E&&a.hidden&&t.activeElement===o&&A(u?o.value:"")}),o.addEventListener("keydown",w=>{if(!E)switch(w.key){case"ArrowDown":case"ArrowUp":{if(w.preventDefault(),a.hidden)return A(o.value);if(!k.length)return;h=(h+(w.key==="ArrowDown"?1:-1)+k.length)%k.length,m(),a.children[h]?.scrollIntoView?.({block:"nearest"});return}case"Enter":!a.hidden&&h>=0&&(w.preventDefault(),$(h));return;case"Escape":a.hidden||w.preventDefault(),g(),u=!1,o.value=l;return;case"Backspace":o.value===""&&e.onEmptyBackspace?.();return}}),o.addEventListener("blur",()=>{v++,clearTimeout(b),g();let w=u&&o.value.trim()===""&&l!=="";u=!1,w?e.onCommitEmpty?.():o.value=l}),{element:s,input:o,setText(w){l=w,!u&&o.value!==w&&(o.value=w)},setReadonly(w){E=w,o.readOnly!==w&&(o.readOnly=w),w&&g()},close:g}}function Fr(e,t,n){let r=n??e.createElement("span");if(r.className="fd-link-avatar",r.setAttribute("aria-hidden","true"),!t)return r.hidden=!0,r.replaceChildren(),r;if(r.hidden=!1,t.avatar){let i=e.createElement("img");i.src=t.avatar,i.alt="",r.replaceChildren(i)}else{let i=t.label.trim().split(/\s+/).filter(Boolean);r.textContent=(i.length>1?i[0][0]+i[i.length-1][0]:i[0]?.[0]??"").toUpperCase()}return r}function eo(e,t){let n=e.ownerDocument;e.replaceChildren(...t.split(`
|
|
4
|
+
`).map(r=>{let i=n.createElement("div");return i.textContent=r,i}))}function Wd(e){let t=e.options??{};return{avatar:t.avatar===!0,details:t.details===!0,colors:t.colors===!0,opens:t.open!==!1}}function Hd(e,t,n,r){let i=e.createElement("button");i.type="button",i.className="fd-tags-adder",i.textContent=t;let o=!1,a=!1,s=()=>{Et(i,o||a),Et(n.element,!o||a)},d=l=>{o&&(o=!1,n.close(),n.input.value="",s(),l&&i.focus())};return i.addEventListener("click",()=>{o=!0,s(),n.input.focus()}),n.input.addEventListener("keydown",l=>{l.key!=="Escape"||!o||(l.preventDefault(),d(!0))}),n.input.addEventListener("blur",()=>setTimeout(()=>o&&!r.contains(e.activeElement)&&d(!1))),s(),{button:i,added:()=>d(!0),setReadonly(l){a=l,l&&(o=!1),s()}}}var jd=(e,t,n)=>e.placeholder||Rr(n.addNamed,{label:t}),Eu={nobody:'<circle cx="10.5" cy="5.9" r="3.3"/><path d="M3.75 12.75h13.5v1.5a6.75 6 0 0 1-13.5 0z"/>'};function wa(e,t,n){return n.options?.create!==!1&&e.canCreate(t)?r=>e.quickCreate(t,r):void 0}var Ar=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=ot.en,dialogs:s})=>{let d=n.type==="many2one"?n.relation:"",l=Wd(r),c=l.opens&&!!s&&s.canOpen(d),f=!1,y=Qi({document:o,id:i,labels:a,search:m=>e.search(t,m,ai+1),shown:ai,pick:m=>e.setValue(t,m),onCommitEmpty:()=>e.setValue(t,null),create:wa(e,t,r),placeholder:r.placeholder,more:(m,x)=>{if(!s||f)return[];let g=[];return m&&c&&r.options?.create!==!1&&g.push({label:a.createAndEdit,act:$=>{let A=e.createValues(t);return s.openRecord(d,{name:$,title:n.label,...Object.keys(A).length?{values:A}:{}})}}),x&&g.push({label:a.searchMore,act:()=>s.searchMore({title:n.label,search:($,A)=>e.search(t,$,A)})}),g}}),u=c?o.createElement("button"):null;u&&(u.type="button",u.className="fd-combo-open",u.textContent="\u2197",u.hidden=!0,u.addEventListener("click",async()=>{let m=e.getState().values[t];if(!m||!s)return;let x=await s.openRecord(d,{recordId:m.id,title:m.label});x&&x.label!==m.label&&e.setValue(t,x)}));let k=o.createElement("button");k.type="button",k.className="fd-combo-clear",k.textContent="\xD7",k.setAttribute("aria-label",Rr(a.clear,{label:n.label})),k.addEventListener("click",()=>{e.setValue(t,null),y.input.focus()}),y.element.append(k,...u?[u]:[]);let h=l.avatar?Fr(o,null):null,v=h?o.createElement("span"):null;if(h&&v){v.className="fd-link-nobody",v.setAttribute("aria-hidden","true");let m=rt(o,"nobody",Eu);m&&v.append(m),y.element.prepend(h,v),y.element.setAttribute("data-avatar","")}let b=l.details?o.createElement("div"):null,E=y.element;return b&&(b.className="fd-link-details",b.hidden=!0,E=o.createElement("div"),E.className="fd-link",E.append(y.element,b)),{element:E,focus:()=>y.input.focus(),update(m){let x=m.value;if(h&&Fr(o,x,h),v&&Et(v,!!x),b){let g=x?.details?.trim()??"";Et(b,!g),b.textContent!==g.replace(/\n/g,"")&&eo(b,g)}f=m.readonly,y.setText(x?.label??""),y.setReadonly(m.readonly),Et(k,!x||m.readonly),u&&(Et(u,!x),x&&_e(u,"aria-label",Rr(a.openNamed,{name:x.label}))),_e(y.input,"aria-invalid",String(m.invalid)),_e(y.input,"aria-required",String(m.required)),m.describedBy&&_e(y.input,"aria-describedby",m.describedBy)}}},si=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=ot.en,dialogs:s})=>{let d=n.type==="many2many"?n.relation:"",l=Wd(r),c=()=>e.getState().values[t]??[],f=o.createElement("div");f.className="fd-tags",f.setAttribute("role","group");let y=o.createElement("ul");y.className="fd-chips";let u=Qi({document:o,id:i,labels:a,search:m=>e.search(t,m,ai+1+c().length),shown:ai,pick:m=>{c().some(x=>x.id===m.id)||e.setValue(t,[...c(),m]),u.input.value="",h?.added()},exclude:()=>new Set(c().map(m=>m.id)),onEmptyBackspace:()=>{let m=c();m.length&&e.setValue(t,m.slice(0,-1))},create:wa(e,t,r),placeholder:r.placeholder,more:(m,x)=>s&&x?[{label:a.searchMore,act:()=>s.searchMore({title:n.label,search:(g,$)=>e.search(t,g,$)})}]:[]}),k=l.opens&&s&&s.canOpen(d)?async m=>{let x=await s.openRecord(d,{recordId:m.id,title:m.label});x&&x.label!==m.label&&e.setValue(t,c().map(g=>g.id===m.id?x:g))}:void 0,h=r.options?.adder==="button"?Hd(o,jd(r,n.label,a),u,f):null,v=wa(e,t,r);h&&u.input.addEventListener("keydown",m=>{let x=u.input.value.trim();m.key!=="Enter"||m.defaultPrevented||!x||(m.preventDefault(),(async()=>{let A=(await e.search(t,x,ai).catch(()=>[])).find(w=>w.label.trim().toLowerCase()===x.toLowerCase())??(v?await v(x).catch(()=>null):null);A&&(c().some(w=>w.id===A.id)||e.setValue(t,[...c(),A]),h.added())})())}),f.append(y,u.element,...h?[h.button]:[]);let b=!1,E="";return{element:f,focus:()=>u.input.focus(),update(m){let x=m.value??[],g=JSON.stringify([m.readonly,x]);b=m.readonly,u.setReadonly(b),h?h.setReadonly(b):u.element.hidden=b,u.input.setAttribute("aria-invalid",String(m.invalid)),m.describedBy&&u.input.setAttribute("aria-describedby",m.describedBy),g!==E&&(E=g,zd(y,x,b,a,$=>e.setValue(t,c().filter(A=>A.id!==$.id)),k,l),u.setText(""))}}};function zd(e,t,n,r,i,o,a={}){let s=e.ownerDocument;e.replaceChildren(...t.map(d=>{let l=s.createElement("li");l.className="fd-chip",a.colors&&typeof d.color=="number"&&d.color>=1&&d.color<=11&&l.setAttribute("data-color",String(Math.trunc(d.color))),a.avatar&&l.append(Fr(s,d));let c=s.createElement(o?"button":"span");if(c.className="fd-chip-label",c.textContent=d.label,o&&(c.type="button",c.setAttribute("aria-label",Rr(r.openNamed,{name:d.label})),c.addEventListener("click",()=>o(d))),l.append(c),!n){let f=s.createElement("button");f.type="button",f.className="fd-chip-remove",f.textContent="\xD7",f.setAttribute("aria-label",Rr(r.remove,{name:d.label})),f.addEventListener("click",()=>i(d)),l.append(f)}return l}))}var ka=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=ot.en})=>{let s=r.options??{},d=typeof s.separator=="string"&&s.separator?s.separator:",",l=Array.isArray(s.suggestions)?s.suggestions.filter(m=>typeof m=="string"):[],c=m=>typeof m=="string"?m.split(d).map(x=>x.trim()).filter(x=>x!==""):[],f=()=>c(e.getState().values[t]),y=m=>e.setValue(t,m.length?m.join(`${d} `):null),u=m=>{let x=m.trim(),g=f();x&&!g.some($=>$.toLowerCase()===x.toLowerCase())&&!(g.length>=s.max)&&y([...g,x])},k=o.createElement("div");k.className="fd-tags",k.setAttribute("role","group");let h=o.createElement("ul");h.className="fd-chips";let v=Qi({document:o,id:i,labels:a,placeholder:r.placeholder,search:async m=>{let x=new Set(f().map($=>$.toLowerCase())),g=m.trim().toLowerCase();return l.filter($=>!x.has($.toLowerCase())&&$.toLowerCase().includes(g)).map($=>({id:$,label:$}))},pick:m=>{u(m.label),v.input.value="",b?.added()},onEmptyBackspace:()=>{let m=f();m.length&&y(m.slice(0,-1))}});v.input.addEventListener("keydown",m=>{m.key!=="Enter"||m.defaultPrevented||v.input.value.trim()===""||(m.preventDefault(),u(v.input.value),v.input.value="",v.close(),b?.added())}),v.input.addEventListener("input",()=>{let m=v.input.value.split(d);if(!(m.length<2)){for(let x of m.slice(0,-1))u(x);v.input.value=m[m.length-1].trimStart()}}),v.input.addEventListener("change",()=>{v.input.value.trim()&&u(v.input.value)});let b=s.adder==="button"?Hd(o,jd(r,n.label,a),v,k):null;k.append(h,v.element,...b?[b.button]:[]);let E="";return{element:k,focus:()=>v.input.focus(),update(m){let x=c(m.value);v.setReadonly(m.readonly);let g=x.length>=s.max;b?b.setReadonly(m.readonly||g):v.element.hidden=m.readonly||g,v.input.setAttribute("aria-invalid",String(m.invalid)),m.describedBy&&v.input.setAttribute("aria-describedby",m.describedBy);let $=JSON.stringify([m.readonly,x]);if($===E)return;E=$;let A=o.activeElement===v.input;zd(h,x.map(w=>({id:w,label:w})),m.readonly,a,w=>y(f().filter(L=>L!==w.label))),v.setText(""),A&&v.element.hidden&&h.querySelector("li:last-child button")?.focus()}}},Sa=({form:e,name:t,id:n,document:r})=>{let i=r.createElement("div");i.id=n,i.className="fd-choices fd-choices-checkbox",i.setAttribute("role","group");let o=[],a={readonly:!1,value:[]},s=()=>{let d=new Set(a.value.map(l=>l.id));for(let{record:l,box:c}of o)c.checked=d.has(l.id),c.disabled=a.readonly};return e.search(t,"",50).then(d=>{o=d.map((l,c)=>{let f=r.createElement("input");f.type="checkbox",f.id=`${n}-${c}`,f.addEventListener("change",()=>{let k=e.getState().values[t]??[];e.setValue(t,f.checked?[...k,l]:k.filter(h=>h.id!==l.id))});let y=r.createElement("label");y.className="fd-choice",y.htmlFor=f.id;let u=r.createElement("span");return u.textContent=l.label,y.append(f,u),i.append(y),{record:l,box:f}}),s()}),{element:i,focus:()=>i.querySelector("input")?.focus(),update(d){a={readonly:d.readonly,value:d.value??[]},s()}}},La=e=>{let{form:t,name:n,field:r,id:i,document:o,labels:a=ot.en}=e,s=r.type==="reference"?r.models:[],d=o.createElement("div");d.className="fd-reference";let l=o.createElement("select");l.className="fd-input fd-select",l.setAttribute("aria-label",r.label),l.append(o.createElement("option"));for(let y of s){let u=o.createElement("option");u.value=String(y.value),u.textContent=y.label,l.append(u)}let c="";l.addEventListener("change",()=>{c=l.value,t.setValue(n,null)});let f=Qi({document:o,id:i,labels:a,placeholder:e.node.placeholder,search:y=>c?t.search(n,y,8,{model:c}):Promise.resolve([]),pick:y=>t.setValue(n,{model:c,id:y.id,label:y.label}),onCommitEmpty:()=>t.setValue(n,null)});return d.append(l,f.element),{element:d,focus:()=>c?f.input.focus():l.focus(),update(y){let u=y.value;u&&(c=u.model),l.value=c,l.disabled=y.readonly,f.setText(u?.label??""),f.setReadonly(y.readonly||!c)}}};function di(e,t){try{let n=new Intl.NumberFormat(t,{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).formatToParts(1),r=n.findIndex(i=>i.type==="currency");return{text:n[r].value,after:r>n.findIndex(i=>i.type==="integer")}}catch{return{text:e,after:!1}}}var _d=/[\u200e\u200f\u061c]/g,Ru=e=>`\u2068${e}\u2069`,Bd=new Map;function Ea(e,t="en"){let n=Bd.get(t);return n||Bd.set(t,n=new Intl.NumberFormat(t,{notation:"compact",numberingSystem:"latn",maximumFractionDigits:1})),n.format(e).replace(_d,"")}var Fu={day:"perDay",night:"perNight",week:"perWeek",month:"perMonth",year:"perYear"},qd=new WeakMap;function Au(e,t){if(!e.per)return null;let n=qd.get(e.per);n||(n=e.per.map(({period:i,when:o})=>{let a=o===void 0?null:ut(o);return{period:i,holds:s=>!a||a.evaluate(s)}}),qd.set(e.per,n));let r={};for(let[i,o]of Object.entries(t))r[i]=o&&typeof o=="object"&&!Array.isArray(o)&&"id"in o?o.id:o;return n.find(i=>i.holds(r))?.period??null}function to(e,t,n,r,i,o={}){let a=i.short?Ea(e,r):St(e,n,r),s=a;if(t&&t!==i.home){let f=/^[A-Z]{3}$/.test(t)?di(t,r):null,y=(i.currency==="code"||!f?t:f.text).replace(_d,""),u=i.at?i.at==="after":!!f?.after,k=Zn(r)&&!/^\p{L}+$/u.test(y)?Ru(y):y;s=u?`${a}\xA0${k}`:`${k}\xA0${a}`}let d=Au(i,o);if(!d)return s;let l=ot[r]??ot.en;return`${Zn(r)?`\u2068${s}\u2069`:s}${l[Fu[d]]}`}function no(e,t){if(e?.type!=="monetary")return[];let n=e.currencyField&&!e.currencyField.startsWith("parent.")?[e.currencyField]:[];for(let r of[e.money,t])for(let i of r?.per??[])i.when!==void 0&&n.push(...ut(i.when).fields);return[...new Set(n)]}var Ud=e=>String(e).padStart(2,"0");function Gd(e){let t=Math.round(Math.abs(e)*60);return`${e<0&&t?"-":""}${Ud(Math.floor(t/60))}:${Ud(t%60)}`}function $u(e,t="en"){let n=gn(e.trim(),t);if(n==="")return null;let r=/^(-?)(\d+):(\d{1,2})$/.exec(n);if(r){let i=Number(r[3]);if(i>59)return e.trim();let o=Number(r[2])+i/60;return r[1]?-o:o}if(/^-?(\d+\.?\d*|\.\d+)$/.test(n))return Number(n);if(!/^-?(\d+:?)?\.?$/.test(n))return e.trim()}var Kd=new Map;function Jd(e,t,n){let r=`${e}:${t}:${n}`,i=Kd.get(r);return i||(i=new Intl.NumberFormat(e,{style:n,numberingSystem:"latn",minimumFractionDigits:0,maximumFractionDigits:t}),Kd.set(r,i)),i}function Tu(e,t="en",n=2){return Jd(t,n,"percent").format(e)}var Yd=e=>e.type==="float"?e.digits?.[1]??2:2;function Xd(e,t){let{form:n,name:r,node:i,id:o,document:a}=e,s=Me(a),d=s("input",{id:o,type:"text",class:`fd-input fd-number-input ${t.className}`,autocomplete:"off",inputmode:t.inputMode});i.placeholder&&(d.placeholder=i.placeholder);let l=u=>typeof u=="number"?t.show(u):u==null?"":String(u);d.addEventListener("input",()=>{let u=t.parse(d.value);u!==void 0&&n.setValue(r,u)}),d.addEventListener("blur",()=>{d.value=l(n.getState().values[r])});let c=typeof i.options?.suffix=="string"&&i.options.suffix?i.options.suffix:t.unit,f=c?s("span",{class:"fd-unit",id:`${o}-unit2`},c):null,y=f?s("span",{class:"fd-number"},d,f):d;return f&&d.style.setProperty("padding-inline-end",`calc(var(--fd-pad-x) + ${c?.length??0}ch + 4px)`),{element:y,focus:()=>d.focus(),update(u){let k=a.activeElement===d,h=t.parse(d.value);if(!(k&&(h===void 0||h===u.value))){let v=l(u.value);d.value!==v&&(d.value=v)}d.readOnly!==u.readonly&&(d.readOnly=u.readonly),_e(d,"aria-required",String(u.required)),ct(d,{...u,describedBy:[u.describedBy,f?.id].filter(Boolean).join(" ")})}}}var Zd=e=>{let t=e.locale??"en";return Xd(e,{show:Gd,parse:n=>$u(n,t),inputMode:"text",className:"fd-duration"})},Qd=e=>{let t=e.locale??"en",n=Yd(e.field);return Xd(e,{show:r=>Jd(t,n,"decimal").format(Math.round(r*100*10**n)/10**n),parse(r){let i=gn(r.trim(),t).replace(/%$/,"");if(i==="")return null;if(/^-?(\d+\.?\d*|\.\d+)$/.test(i))return Math.round(Number(i)/100*1e10)/1e10;if(!/^-?\.?$/.test(i))return r.trim()},unit:"%",inputMode:"decimal",className:"fd-percentage"})};function el(e,t,n,r,i={}){if(typeof n!="number"||e!=="duration"&&e!=="percentage")return null;let o=typeof i.suffix=="string"&&i.suffix?` ${i.suffix}`:"";return e==="duration"?Gd(n)+o:Tu(n,r,Yd(t))}var Ra=e=>typeof e?.model=="string"?e.model:"account.analytic.account";function tl(e){return[...new Set(Fa(e).flatMap(([t])=>t.split(",")))].map(t=>/^\d+$/.test(t)?Number(t):t)}function ro(e,t="en",n){let r=i=>`${St(i,Number.isInteger(i)?0:2,t)}%`;return Fa(e).map(([i,o])=>{let a=n?i.split(",").map(s=>n(s)??`#${s}`).join(" \xB7 "):"";return a?`${a} ${r(o)}`:r(o)}).join(n?", ":" \xB7 ")}var Fa=e=>e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).map(([t,n])=>[t,typeof n=="number"?n:Number(n)||0]):[],nl=e=>{let{form:t,name:n,node:r,id:i,document:o,labels:a,locale:s="en"}=e,d=Me(o),l=Be(a,s),c=Ra(r.options),f=new Map,y=I=>I.split(",").map(F=>f.get(F)??`#${F}`).join(" \xB7 "),u=I=>`${St(I,Number.isInteger(I)?0:2,s)}%`,k=d("tbody"),h=d("td",{class:"fd-distribution-total"}),v=d("table",{class:"fd-lines-table fd-distribution-table"},d("thead",{},d("tr",{},d("th",{scope:"col"},l.account),d("th",{scope:"col",class:"fd-distribution-share"},l.share),d("th",{class:"fd-lines-tools"}))),k,d("tfoot",{},d("tr",{class:"fd-lines-totals"},d("td",{},l.total),h,d("td")))),b=d("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-distribution-add"},`+ ${l.addAccount}`),E=d("div",{class:"fd-warning fd-distribution-off",role:"status",hidden:""}),m=d("div",{id:i,class:"fd-distribution",role:"group"},d("div",{class:"fd-lines-scroll"},v),b,E),x=[],g=!1;function $(){let I={};for(let F of x)F.key&&(I[F.key]=F.share);t.setValue(n,x.some(F=>F.key)?I:null)}function A(I,F){let D=x.length,W=`${i}-${D}-${Math.random().toString(36).slice(2,7)}`,j={key:I,share:F},O={...t,getState:()=>({...t.getState(),values:{account:j.key?{id:j.key,label:y(j.key)}:null}}),setValue:(H,C)=>{let z=C;j.key=z?String(z.id):"",z&&f.set(String(z.id),z.label),$()},search:(H,C,z)=>t.search(n,C,z,{model:c}),canCreate:()=>!1},B={type:"many2one",label:l.account,relation:c};return j.account=Ar({...e,form:O,name:"account",field:B,node:{type:"field",id:`${r.id}.account`,field:"account",options:{create:!1}},id:W}),j.input=d("input",{type:"text",class:"fd-input fd-number-input fd-share",inputmode:"decimal",autocomplete:"off","aria-label":l.share}),j.input.addEventListener("input",()=>{let H=gn(j.input.value.trim(),s);/^\d+\.?\d*$|^\.\d+$/.test(H)&&(j.share=Number(H),$())}),j.remove=d("button",{type:"button",class:"fd-line-delete","aria-label":l.deleteLine},"\xD7"),j.remove.addEventListener("click",()=>{x=x.filter(H=>H!==j),j.account.destroy?.(),j.element.remove(),$(),S()}),j.element=d("tr",{},d("td",{},d("label",{class:"fd-sr-only",for:W},l.account),j.account.element),d("td",{class:"fd-distribution-share"},d("span",{class:"fd-number"},j.input,d("span",{class:"fd-unit"},"%"))),d("td",{class:"fd-lines-tools"},j.remove)),j}b.addEventListener("click",()=>{let I=Math.max(0,100-x.reduce((D,W)=>D+W.share,0)),F=A("",Math.round(I*100)/100);x.push(F),k.append(F.element),S(),F.account.focus()});let w="";function L(I){let F=[...new Set(I.flatMap(W=>W.split(",")))].filter(W=>!f.has(W));if(!F.length||F.join()===w)return;w=F.join();let D=F.map(W=>/^\d+$/.test(W)?Number(W):W);t.search(n,"",F.length,{model:c,ids:D}).then(W=>{for(let j of W)f.set(String(j.id),j.label);S()},()=>{})}function S(){let I=x.reduce((D,W)=>D+W.share,0);xt(h,u(Math.round(I*100)/100));let F=x.some(D=>D.key)&&Math.abs(I-100)>.001;xt(E,F?Ue(l.sharesOff,{n:u(Math.round(I*100)/100)}):""),Et(E,!F),Et(b,g);for(let D of x){D.account.update({value:D.key?{id:D.key,label:y(D.key)}:null,values:{},readonly:g,required:!1,invalid:!1});let W=St(D.share,Number.isInteger(D.share)?0:2,s);o.activeElement!==D.input&&D.input.value!==W&&(D.input.value=W),D.input.readOnly=g,g?D.remove.remove():D.remove.isConnected||D.element.lastElementChild?.append(D.remove)}}return{element:m,focus:()=>(x[0]?.input??b).focus(),destroy:()=>x.forEach(I=>I.account.destroy?.()),update(I){g=I.readonly;let F=Fa(I.value);if(!(F.length===x.filter(W=>W.key).length&&F.every(([W,j],O)=>x.filter(B=>B.key)[O]?.key===W&&x.filter(B=>B.key)[O]?.share===j))){for(let j of x)j.account.destroy?.();let W=x.filter(j=>!j.key);x=F.map(([j,O])=>A(j,O)),x.push(...W.map(j=>A("",j.share))),k.replaceChildren(...x.map(j=>j.element))}L(F.map(([W])=>W)),S()}}};function rl(e){let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t)return null;let[,n,r,i,o,a]=t;return new Date(Number(n),Number(r)-1,Number(i),Number(o??0),Number(a??0))}function $r(e,t,n){if(e.type!=="monetary")return null;if(e.currency)return e.currency;if(!e.currencyField)return null;let r=e.currencyField.startsWith("parent.")?n?.[e.currencyField.slice(7)]:t[e.currencyField];return r&&typeof r=="object"&&"label"in r?r.label||null:typeof r=="string"&&r?r:null}function It(e,t,n={},r="en",i){let o=(a,s)=>St(a,s,r);if(t==null||t==="")return"";switch(e.type){case"many2one":case"reference":return t.label??"";case"many2many":return(t??[]).map(a=>a.label).join(", ");case"selection":{let a=s=>e.options.find(d=>d.value===s)?.label??String(s);return Array.isArray(t)?t.map(a).join(", "):a(t)}case"integer":return o(Number(t),0);case"float":return o(Number(t),e.digits?.[1]??2);case"monetary":{let a=$r(e,n,i);return e.money?to(Number(t),a,e.digits?.[1]??2,r,e.money,n):a?rr(Number(t),a,e.digits?.[1]??2,r):o(Number(t),e.digits?.[1]??2)}case"date":{let a=rl(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",numberingSystem:"latn"}).format(a):String(t)}case"datetime":{let a=rl(String(t));return a?new Intl.DateTimeFormat(r==="en"?"en-GB":r,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",numberingSystem:"latn"}).format(a):String(t)}case"html":return String(t).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();case"binary":case"image":return[t].flat().map(a=>a.name??"").join(", ");case"boolean":return t?"\u2713":"";default:return String(t)}}function or(e,t,n={},r="en",i,o={}){return o.widget==="distribution"&&e.type==="json"?ro(t,r):el(o.widget,e,t,r,o.options)??It(e,t,n,r,i)}var Mu=new Set(["progressbar","priority","dot","color","timer","badge"]);function Tr(e,t,n,r,i){if(n.type==="one2many"&&n.sequenceField)return e.moveLine(t,r,i);let o=[...e.getState().values[t]??[]],a=o.findIndex(s=>s.key===r);a<0||i<0||i>=o.length||i===a||(o.splice(i,0,...o.splice(a,1)),e.setValue(t,o))}var Nu=new Set(["integer","float","monetary"]),il=new Set(["boolean","integer","float","monetary","date","datetime"]),ol=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0;function sl(e,t){return t==="section"?{...e,type:"char"}:{...e,type:"text"}}function io(e,t,n){let r=()=>(e.getState().values[t]??[]).find(i=>i.key===n)?.values??{};return{...e,getState:()=>({...e.getState(),values:r()}),setValue:(i,o)=>e.updateLine(t,n,i,o),search:(i,o,a,s)=>e.searchLine(t,n,i,o,a,s),canCreate:i=>e.canCreateLine(t,i),quickCreate:(i,o)=>e.quickCreateLine(t,i,o,n),createValues:i=>e.createValues(i,{lines:t,key:n})}}function dl(e,t){if(e.type!=="monetary"||!e.currencyField?.startsWith("parent."))return e;let{currencyField:n,...r}=e,i=$r(e,{},t);return i&&/^[A-Z]{3}$/.test(i)?{...r,currency:i}:r}async function oo(e,t,n,r,i,o){let a=e.page.fields[t],s=()=>e.getState().values[t]??[],d=y=>e.setValue(t,s().map(u=>u.key===r.key?{...u,values:{...u.values,...y}}:u));if(n.lineOpens==="record"&&r.id!==void 0&&i.canOpen(a.relation)){let y=await i.openRecord(a.relation,{recordId:r.id,title:a.label,withValues:!0}),u=Object.fromEntries(Object.entries(y?.values??{}).filter(([k])=>k in a.fields&&k!==a.sequenceField));Object.keys(u).length&&d(u);return}let l=Object.fromEntries(Object.entries(a.fields).filter(([y])=>y!==a.lineKinds?.field&&y!==a.sequenceField).map(([y,u])=>[y,dl(u,e.getState().values)])),c=e.getState(),f=await i.editValues({title:a.label,fields:l,values:r.values,readonly:o,recompute:y=>e.previewLine(t,r.key,y),parent:{values:c.values,fields:e.page.fields,id:c.recordId},...n.lineForm?{layout:n.lineForm.children}:{}});f&&d(f)}var Aa=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=ot.en,locale:s,dialogs:d,widgets:l})=>{let c=n,f=c.lineKinds,y=Me(o),u=r.options??{},k=ol(u.min)??0,h=ol(u.max)??1/0,v=Z=>typeof u[Z]=="string"&&u[Z].trim()?u[Z]:null,b=new Map,E=!!(r.cells||r.rowTones||r.rowBold!==void 0||r.rowButtons||r.lineDelete!==void 0),m=(r.columns??Object.keys(c.fields)).filter(Z=>c.fields[Z]&&c.fields[Z].type!=="one2many"&&Z!==f?.field&&Z!==c.sequenceField&&r.optionalColumns?.[Z]!=="hide"),x=o.createElement("div");x.className="fd-lines",x.id=i,r.cards&&(x.dataset.cards=r.cards),r.fit&&(x.dataset.fit=r.fit),x.setAttribute("role","group");let g=o.createElement("div");g.className="fd-lines-scroll";let $=o.createElement("table");$.className="fd-lines-table";let A=o.createElement("thead"),w=o.createElement("tr"),L=!!r.selectedButtons?.length,S=new Set,I=L?y("input",{type:"checkbox",class:"fd-checkbox fd-line-pick fd-line-pick-all","aria-label":a.chooseAllLines}):null;w.append(y("th",{class:"fd-lines-grip"},...I?[I]:[]));for(let Z of m){let re=o.createElement("th");re.scope="col",re.dataset.column=Z,re.textContent=c.fields[Z].label;let ae=r.cells?.[Z]?.width;ae?re.style.width=`${ae}ch`:il.has(c.fields[Z].type)&&(re.dataset.fit=c.fields[Z].type),b.set(Z,re),w.append(re)}let F=o.createElement("th");F.className="fd-lines-tools",w.append(F),A.append(w);let D=o.createElement("tbody");$.append(A,D);let W=(r.totals??[]).filter(Z=>m.includes(Z)),j=new Map,O=new Map;if(W.length){let Z=o.createElement("tfoot"),re=o.createElement("tr");re.className="fd-lines-totals",re.append(o.createElement("td")),m.forEach((ae,Re)=>{let De=o.createElement("td");De.dataset.column=ae,O.set(ae,De),W.includes(ae)?j.set(ae,De):Re===0&&(De.textContent=a.total),re.append(De)}),re.append(o.createElement("td")),Z.append(re),$.append(Z)}g.append($);let B=o.createElement("div");B.className="fd-lines-adds";let H=(Z,re,ae)=>{let Re=o.createElement("button");Re.type="button",Re.className="fd-button fd-button-link fd-lines-add",Re.dataset.add=ae,Re.textContent=`+ ${Z}`,Re.addEventListener("click",()=>{Pe=e.addLine(t,re);let De=Ie.get(Pe);De&&(De.cells[0]?.widget.focus(),Pe=null)}),B.append(Re)};H(v("addLabel")??a.addLine,{},"line"),f&&(H(v("addSectionLabel")??a.addSection,{[f.field]:f.section??"section"},"section"),H(v("addNoteLabel")??a.addNote,{[f.field]:f.note??"note"},"note"));let C=(r.controlButtons??[]).map(Z=>{let re=rt(o,Z.icon),ae=y("button",{type:"button",class:"fd-button fd-button-link fd-lines-add fd-lines-control","data-node":Z.id},...re?[re]:[],Z.label);return ae.addEventListener("click",()=>{$e(ae,()=>e.runAction(Z.id))}),B.append(ae),{id:Z.id,button:ae}}),z=y("span",{class:"fd-lines-chosen-count",role:"status"}),M=(r.selectedButtons??[]).map(Z=>{let re=rt(o,Z.icon),ae=y("button",{type:"button",class:`fd-button fd-button-${Z.style??"secondary"} fd-lines-chosen-button`,"data-node":Z.id},...re?[re]:[],Z.label);return ae.addEventListener("click",()=>{$e(ae,()=>e.runLinesAction(r.id,Z.id,ke().filter(Re=>S.has(Re.key)).map(Re=>Re.key)))}),{id:Z.id,button:ae}}),te=L?y("div",{class:"fd-lines-chosen",hidden:""},z,...M.map(Z=>Z.button)):null,Y=v("emptyLabel"),G=Y?y("div",{class:"fd-help fd-lines-empty"},Y):null,_=Zi(y,a),Q=y("div",{class:"fd-sr-only",role:"status"});x.append(...te?[te]:[],g,...G?[G]:[],B,_.element,Q);async function $e(Z,re){if(!Z.hasAttribute("aria-busy")){Z.setAttribute("aria-busy","true");try{await re()}finally{Z.removeAttribute("aria-busy")}}}function Ne(){if(!te||!I)return;let Z=ke().filter(re=>!Lt(c,re.values));for(let re of[...S])Z.some(ae=>ae.key===re)||S.delete(re);te.hidden=ee||S.size===0,z.textContent=Ue(a.linesChosen,{n:S.size});for(let{id:re,button:ae}of M)ae.hidden=e.node(re).invisible;I.checked=Z.length>0&&S.size===Z.length,I.indeterminate=S.size>0&&S.size<Z.length,I.disabled=ee||!Z.length;for(let[re,ae]of Ie)ae.pick&&(ae.pick.checked=S.has(re),ae.pick.disabled=ee)}I?.addEventListener("change",()=>{let Z=ke().filter(re=>!Lt(c,re.values));if(I.checked)for(let re of Z)S.add(re.key);else S.clear();Ne()});let Ie=new Map,Pe=null,ee=!1,ge=null,ke=()=>e.getState().values[t]??[];for(let Z=ke().length;Z<k;Z++)e.addLine(t);function Oe(Z,re){let ae=ke().findIndex(gt=>gt.key===Z);if(ee||re===ae||re<0||re>=ke().length)return;let Re=o.activeElement,De=ke()[ae].values[m[0]];Tr(e,t,c,Z,re),Re&&Re!==o.activeElement&&Re.focus(),Q.textContent=Ue(a.movedTo,{label:typeof De=="string"&&De.trim()?De:Ue(a.lineN,{n:ae+1}),n:re+1,total:ke().length})}function Xe(Z,re,ae){let Re=[...D.children],De=Re.indexOf(Z),gt=Re.filter(he=>he!==Z),Ge=Z.getBoundingClientRect(),Ae=gt.map(he=>{let ce=he.getBoundingClientRect();return ce.top+ce.height/2}),Ve=De,pe=!1,le=he=>{he.key==="Escape"&&(he.preventDefault(),me())};function me(){for(let he of Re)he.style.transform="";Z.classList.remove("fd-line-lifted"),D.classList.remove("fd-lines-dragging"),o.removeEventListener("keydown",le,!0),pe=!1}return{follow(he){let ce=he-ae;if(!pe){if(Math.abs(ce)<4||ee)return;pe=!0,Z.classList.add("fd-line-lifted"),D.classList.add("fd-lines-dragging"),o.addEventListener("keydown",le,!0)}Z.style.transform=`translateY(${ce}px)`;let Ze=Ge.top+Ge.height/2+ce;Ve=Ae.filter(vt=>vt<Ze).length,gt.forEach((vt,Tt)=>{vt.style.transform=Tt>=De&&Tt<Ve?`translateY(${-Ge.height}px)`:Tt<De&&Tt>=Ve?`translateY(${Ge.height}px)`:""})},drop(){let he=pe&&Ve!==De;me(),he&&Oe(re,Ve)},settle:me}}D.addEventListener("keydown",Z=>{let re=Z.target.closest("tr")?.dataset.line;!re||!Z.altKey||Z.key!=="ArrowUp"&&Z.key!=="ArrowDown"||(Z.preventDefault(),Oe(re,ke().findIndex(ae=>ae.key===re)+(Z.key==="ArrowUp"?-1:1)))});function Se(Z,re,ae,Re,De=1){let gt=`${i}-${re.key}-${ae}`,Ge=Lt(c,re.values)?void 0:r.cells?.[ae],Ae=Ge?.badge?{widget:"badge"}:Ge?.widget?{widget:Ge.widget,...Ge.options?{options:Ge.options}:{}}:Ge?.options?{options:Ge.options}:{},Ve={type:"field",id:`${r.id}.${re.key}.${ae}`,field:ae,...Ae},pe=Xt({form:io(e,t,re.key),name:ae,field:Re,node:Ve,id:gt,document:o,labels:a,locale:s,dialogs:d,widgets:l}),le=o.createElement("td");le.colSpan=De,le.dataset.column=ae,il.has(Re.type)&&(le.dataset.fit=Re.type),le.dataset.label=Re.label;let me=o.createElement("label");me.className="fd-sr-only",me.htmlFor=gt,me.textContent=Re.label;let he=o.createElement("div");return he.className="fd-cell-error",he.hidden=!0,le.append(me,pe.element,he),Z.append(le),{name:ae,def:Re,widget:pe,error:he,td:le}}function tt(Z){let re=o.createElement("tr");re.dataset.line=Z.key;let ae=Lt(c,Z.values);ae&&(re.className=`fd-line-${ae}`);let Re=y("span",{class:"fd-line-grip fd-rank-grip","aria-hidden":"true"}),De=null;Re.addEventListener("pointerdown",me=>{ee||me.button!==0||(me.preventDefault(),Re.setPointerCapture?.(me.pointerId),De=Xe(re,Z.key,me.clientY))}),Re.addEventListener("pointermove",me=>De?.follow(me.clientY)),Re.addEventListener("pointerup",()=>{De?.drop(),De=null}),Re.addEventListener("pointercancel",()=>{De?.settle(),De=null});let gt=L&&!ae?y("input",{type:"checkbox",class:"fd-checkbox fd-line-pick"}):null;gt?.addEventListener("change",()=>{gt.checked?S.add(Z.key):S.delete(Z.key),Ne()}),re.append(y("td",{class:"fd-lines-grip"},...gt?[y("span",{class:"fd-line-lead"},gt,Re)]:[Re]));let Ge=ae&&f?[Se(re,Z,f.text,sl(c.fields[f.text],ae),m.length)]:m.map(me=>Se(re,Z,me,c.fields[me])),Ae=o.createElement("td");Ae.className="fd-lines-tools";let Ve=o.createElement("button");Ve.type="button",Ve.className="fd-line-delete",Ve.textContent="\xD7",Ve.setAttribute("aria-label",a.deleteLine),Ve.addEventListener("click",()=>{let me=ke().findIndex(ce=>ce.key===Z.key),he=ke()[me]?.values??{};if(u.confirmDelete!==!0||Ge.every(ce=>mn(ce.def,he[ce.name])||he[ce.name]===!1))return e.removeLine(t,Z.key);_.ask(Ue(a.removeAsk,{name:Ue(a.lineN,{n:me+1})}),ce=>{ce&&e.removeLine(t,Z.key);let Ze=ke(),vt=Ze[ce?Math.min(me,Ze.length-1):me];(vt?Ie.get(vt.key)?.remove:B.querySelector("button"))?.focus()})});let pe=new Map;for(let me of ae?[]:r.rowButtons??[]){let he=rt(o,me.icon),ce=y("button",{type:"button",class:`fd-button fd-button-link fd-line-button${he?" fd-line-button-icon":""}`,"data-row-button":me.id,"aria-label":me.label,title:me.label});ce.append(he??me.label),ce.addEventListener("click",async()=>{if(!ce.hasAttribute("aria-busy")){ce.setAttribute("aria-busy","true");try{await e.runRowAction(r.id,me.id,Z.key)}finally{ce.removeAttribute("aria-busy")}}}),pe.set(me.id,ce),Ae.append(ce)}let le=u.copy===!0&&!ae?y("button",{type:"button",class:"fd-line-copy"},"\u29C9"):null;if(le?.addEventListener("click",()=>{let me=ke(),he=me.findIndex(vt=>vt.key===Z.key);if(ee||he<0||me.length>=h)return;let ce={...me[he].values};c.sequenceField&&delete ce[c.sequenceField];let Ze=e.addLine(t,ce);Tr(e,t,c,Ze,he+1),Ie.get(Ze)?.cells[0]?.widget.focus()}),le&&Ae.append(le),(r.lineOpens||r.lineForm)&&d&&!ae){let me=y("button",{type:"button",class:"fd-line-open","aria-label":a.openLine,title:a.openLine},"\u2197");me.addEventListener("click",()=>{let he=ke().find(ce=>ce.key===Z.key);he&&oo(e,t,r,he,d,ee)}),Ae.append(me)}return Ae.append(Ve),re.append(Ae),{element:re,kind:ae,cells:Ge,remove:Ve,grip:Re,buttons:pe,pick:gt,copy:le}}return{element:x,focus:()=>(D.querySelector("input, select, textarea")??B.querySelector("button"))?.focus(),update(Z){ee=Z.readonly;let re=Z.value??[];B.hidden=ee||re.length>=h,ee&&(_.element.hidden=!0),G&&(G.hidden=re.length>0);let ae=e.getState().errors,Re=new Set(E?m.filter(Ae=>e.columnHidden(r.id,Ae)):[]);for(let[Ae,Ve]of b)Ve.hidden=Re.has(Ae);for(let[Ae,Ve]of O)Ve.hidden=Re.has(Ae);let De=re.map(Ae=>Ae.key).join(" "),gt=De!==ge;ge=De;for(let[Ae,Ve]of gt?b:new Map){if(r.cells?.[Ae]?.width)continue;let pe=c.fields[Ae];if(Ve.dataset.fit){if(!Nu.has(pe.type))continue;let he=re.reduce((ce,Ze)=>Lt(c,Ze.values)?ce:Math.max(ce,or(pe,Ze.values[Ae],Ze.values,s).length),0);Ve.style.setProperty("--fd-fit-need",`${he+4}ch`);continue}let le=re.reduce((he,ce)=>Lt(c,ce.values)?he:Math.max(he,or(pe,ce.values[Ae],ce.values,s).length),0),me=pe.type==="many2one"?5:0;Ve.style.width=`${Math.min(Math.max(le,Math.min(pe.label.length,10),6),32)+4+me}ch`,Ve.style.minWidth=`${Math.min(Math.max(le,6),14)+4}ch`}let Ge=new Set(re.map(Ae=>Ae.key));for(let[Ae,Ve]of Ie)Ge.has(Ae)||(Ve.element.remove(),Ie.delete(Ae));re.forEach((Ae,Ve)=>{let pe=Ie.get(Ae.key);pe&&pe.kind!==Lt(c,Ae.values)&&(pe.element.remove(),pe=void 0),pe||(pe=tt(Ae),Ie.set(Ae.key,pe)),D.children[Ve]!==pe.element&&D.insertBefore(pe.element,D.children[Ve]??null);let le=E?e.lineState(r.id,Ae.key):null;pe.remove.hidden=ee||re.length<=k||le?.deletable===!1,pe.grip.hidden=ee;let me=Ue(a.lineN,{n:Ve+1});pe.pick?.setAttribute("aria-label",Ue(a.chooseLine,{name:me})),pe.copy&&(pe.copy.setAttribute("aria-label",Ue(a.copy,{name:me})),pe.copy.title=pe.copy.getAttribute("aria-label"),pe.copy.hidden=ee||re.length>=h),ee?pe.remove.remove():pe.remove.isConnected||pe.element.lastElementChild?.append(pe.remove),al(pe.element,"tone",le?.tone),pe.element.classList.toggle("fd-line-bold",!!le?.bold);for(let[he,ce]of pe.buttons)ce.hidden=!le?.buttons[he];pe.kind&&(pe.cells[0].td.colSpan=m.length-Re.size);for(let he of pe.cells){let ce=ae[`${t}.${Ae.key}.${he.name}`],Ze=pe.kind?void 0:le?.cells[he.name];pe.kind||(he.td.hidden=Re.has(he.name)),he.widget.element.hidden=!!Ze?.invisible,al(he.td,"tone",Ze?.tone),he.td.classList.toggle("fd-cell-bold",!!Ze?.bold),he.error.hidden=!ce,he.error.textContent=ce??"",he.widget.update({value:Ae.values[he.name],values:Ae.values,parent:Z.values,readonly:ee||he.def.readonly===!0||he.def.compute!==void 0||!!Ze?.readonly,required:he.def.required===!0||!!Ze?.required,invalid:!!ce})}});for(let[Ae,Ve]of j){let pe=re.filter(le=>!Lt(c,le.values)).reduce((le,me)=>le+Number(me.values[Ae]??0),0);Ve.textContent=or(c.fields[Ae],pe,re[0]?.values??{},s,Z.values,r.cells?.[Ae])}for(let{id:Ae,button:Ve}of C)Ve.hidden=e.node(Ae).invisible;Ne(),Pe&&Ie.has(Pe)&&(Ie.get(Pe)?.cells[0]?.widget.focus(),Pe=null)}}};function al(e,t,n){n?e.dataset[t]=n:delete e.dataset[t]}var Pu='a[href], button, input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';function hn(e,t){if(t.key!=="Tab")return;let n=[...e.querySelectorAll(Pu)].filter(a=>!a.closest("[hidden], [inert]")&&!a.disabled);if(!n.length)return;let r=n[0],i=n[n.length-1],o=e.ownerDocument.activeElement;(t.shiftKey?o===r||!e.contains(o):o===i)&&(t.preventDefault(),(t.shiftKey?i:r).focus())}var so=e=>new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{let i=String(r.result??"");t({name:e.name,type:e.type,size:e.size,data:i.slice(i.indexOf(",")+1)})},r.onerror=()=>n(r.error),r.readAsDataURL(e)}),cl=e=>(/\.(\w{1,5})$/.exec(e)?.[1]??"").toUpperCase();function ao(e){let t=`${e.type} ${cl(e.name)}`.toLowerCase();return/^image\//.test(t)?"image":/pdf/.test(t)?"pdf":/sheet|excel|csv|xlsx?$|ods$/.test(t)?"sheet":/zip|rar|7z|tar|gz/.test(t)?"zip":/word|opendocument|^text|docx?$|odt$|rtf$/.test(t)?"doc":"file"}var Ou=e=>/^text\/|json|xml|csv/.test(e.type),$a=e=>e.data?`data:${e.type};base64,${e.data}`:e.url??"",fl=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),ll=(e,t)=>e("span",{class:"fd-file-icon","data-kind":ao(t),"aria-hidden":"true"},cl(t.name)||"?"),Cu={cards:'<path d="M3 3h8v8H3zM13 3h8v8h-8zM3 15h8M13 15h8M3 19h5M13 19h5"/>',thumbnails:'<path d="M3 3h7v7H3zM14 3h7v7h-7zM3 14h7v7H3zM14 14h7v7h-7z"/>'},Iu=(e,t)=>e("span",{class:"fd-file-name",dir:"auto",title:t},e("span",{},t.slice(0,-9)),t.slice(-9));function Vu(e,t){let n=t.length/2,[r,i]=[Math.round(n),n/2];for(let a=t.indexOf(" ");a>=0;a=t.indexOf(" ",a+1))Math.abs(a+1-n)<i&&([r,i]=[a+1,Math.abs(a+1-n)]);let o=/^\P{L}*[\p{sc=Arabic}\p{sc=Hebrew}]/u.test(t);return e("span",{class:"fd-file-name",dir:o?"rtl":"ltr",title:t},e("span",{},t.slice(0,r)),e("span",{dir:o?"ltr":"rtl"},e("bdi",{},t.slice(r))))}function ul(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d="en",preferences:l})=>{let c=r,f=Be(s,d),y=qt[d]??qt.en,u=Me(a),k=c.multiple===!0,h=k?c.maxFiles??1/0:1,v=e==="image",b=String(i.options?.files??(v?"thumbnails":"list")),E=b==="thumbnails"?b:"cards",m=i.options?.filesSwitch===!0,x=`${t.page.id}.${i.id}.files`,g=m?l?.get(x):null,$=i.options?.camera,A=c.type==="binary"?c.accept:["image/*"],w=u("div"),L=u("input",{type:"file",id:o,class:"fd-sr-only",accept:A?.join(","),capture:$?$==="user"?"user":"environment":void 0});L.multiple=k;let S=[!v&&A?ni(A,y.or):"",c.maxSize?lt(k?f.upToEach:f.upToSize,{size:Sn(c.maxSize)}):"",k&&c.maxFiles?lt(f.upToFiles,{max:c.maxFiles}):""].filter(Boolean),I=u("label",{class:"fd-file-pick",for:o},u("span",{class:"fd-button"},k?v?f.addPhotos:f.addFiles:v?f.uploadImage:f.upload),u("span",{class:"fd-help"},k?f.dropThem:f.dropHere)),F=u("span",{class:"fd-help fd-file-limits"},S.join(" \xB7 ")),D=k?u("span",{class:"fd-help fd-file-count"}):null,W=u("ul",{class:"fd-files",role:"list"}),j=u("button",{type:"button",class:"fd-button fd-button-link"},f.replace);j.addEventListener("click",()=>L.click());let O=Zi(u,f),B=u("div",{class:"fd-help fd-file-note",role:"status"}),H=(ee,ge)=>{let ke=u("button",{type:"button","data-view":ee},rt(a,ee,Cu),ge);return ke.addEventListener("click",()=>(Y(ee),l?.set(x,ee))),ke},C=m?u("div",{class:"fd-file-views",role:"group","aria-label":f.showFilesAs},H("list",f.asList),H(E,E==="cards"?f.asCards:f.asThumbnails)):null,z=D||C?u("div",{class:"fd-file-bar"},...D?[D]:[],...C?[C]:[]):null,M=[L,I,...S.length?[F]:[]];w.append(...z?[z]:[],W,j,O.element,B);let te=b;function Y(ee){te=ee;let ge=ee!=="list";w.className=`fd-file fd-file-${e} fd-files-${ee==="thumbnails"?"thumbs":ee}`,I.classList.toggle("fd-image-pick",ge),ge?W.after(...M):(z??W).before(...M),C?.querySelectorAll("button").forEach(ke=>ke.setAttribute("aria-pressed",String(ke.dataset.view===ee))),Ie()}let G=!1,_=[],Q,$e=ee=>B.replaceChildren(...ee.map(ge=>u("div",{},ge))),Ne=async ee=>{if(G||!ee.length)return;let ge=[],ke=[],Oe=0;for(let Se of ee){let tt=ti(c,Se,y)??(k&&[..._,...ge].some(Z=>Z.name===Se.name)?lt(f.alreadyAdded,{name:Se.name}):void 0);tt?ke.push(tt):(k?_.length:0)+ge.length<h?ge.push(Se):Oe++}if(Oe&&k&&ke.push(lt(f.tooMany,{max:h,n:Oe})),$e(ke),!ge.length)return;let Xe=await Promise.all(ge.map(so));t.setValue(n,k?[..._,...Xe]:Xe[0])};L.addEventListener("change",()=>{Ne([...L.files??[]]),L.value=""}),w.addEventListener("dragover",ee=>{G||(ee.preventDefault(),w.classList.add("fd-dragging"))}),w.addEventListener("dragleave",()=>w.classList.remove("fd-dragging")),w.addEventListener("drop",ee=>{ee.preventDefault(),w.classList.remove("fd-dragging"),Ne([...ee.dataTransfer?.files??[]])}),W.addEventListener("click",ee=>{let ge=ee.target.closest("button"),ke=Number(ge?.dataset.at);if(ge){if(ge.classList.contains("fd-file-open"))return Pe(ke,ge);O.ask(lt(f.removeAsk,{name:_[ke].name}),Oe=>{let Xe=_[ke];Oe&&(t.setValue(n,k?_.filter((Se,tt)=>tt!==ke):null),$e([lt(f.removed,{name:Xe.name})])),(W.querySelectorAll(".fd-file-remove")[Oe?Math.min(ke,_.length-1):ke]??(I.hidden?j:L)).focus()})}});function Ie(){W.replaceChildren(..._.map((ee,ge)=>u("li",{class:"fd-file-item"},u("button",{type:"button",class:"fd-file-open","data-at":String(ge),"aria-haspopup":"dialog","aria-label":`${ee.name}, ${Sn(ee.size)}`},...[ao(ee)==="image"&&$a(ee)?u("img",{class:"fd-file-thumb",src:$a(ee),alt:""}):ll(u,ee)].map(ke=>te==="cards"?u("span",{class:"fd-file-picture"},ke):ke),(te==="cards"?Vu:Iu)(u,ee.name),u("span",{class:"fd-file-size"},Sn(ee.size))),...G?[]:[u("button",{type:"button",class:"fd-file-remove","data-at":String(ge),"aria-label":lt(f.remove,{name:ee.name})},"\xD7")])))}Y(g==="list"||g===E?g:b===E?b:"list");function Pe(ee,ge){let ke=_,Oe="",Xe=u("h2",{id:`${o}-view`,class:"fd-form-dialog-title"}),Se=u("span",{class:"fd-help"}),tt=(pe,le,me)=>{let he=u("button",{type:"button",class:"fd-button fd-file-step","aria-label":le},me);return he.hidden=ke.length<2,he.addEventListener("click",()=>Ae(ee+pe)),he},Z=u("a",{class:"fd-button"},f.download),re=u("button",{type:"button",class:"fd-dialog-close","aria-label":f.close},"\xD7"),ae=u("div",{class:"fd-file-viewer-body"}),Re=u("div",{class:"fd-form-dialog fd-file-viewer",role:"dialog","aria-modal":"true","aria-labelledby":Xe.id,tabindex:"-1"},u("div",{class:"fd-form-dialog-head"},Xe,Se,tt(-1,f.previous,"\u2039"),tt(1,f.next,"\u203A"),Z,re),ae),De=u("div",{class:"fd-dialog-backdrop"},Re),gt=()=>Oe.startsWith("blob:")&&URL.revokeObjectURL(Oe),Ge=pe=>u("div",{class:"fd-file-none"},ll(u,pe),u("strong",{},pe.name),Sn(pe.size),u("p",{},f.noPreview));function Ae(pe){ee=(pe+ke.length)%ke.length;let le=ke[ee];gt();let me=le.data?fl(le.data):null;Oe=me?URL.createObjectURL(new Blob([me],{type:le.type})):le.url??"",Xe.textContent=le.name,Se.replaceChildren(u("span",{class:"fd-file-size"},Sn(le.size)),ke.length>1?` \xB7 ${lt(f.fileAt,{n:ee+1,total:ke.length})}`:""),Z.href=Oe,Z.download=le.name;let he=ao(le);if(he==="image")return ae.replaceChildren(u("img",{src:Oe,alt:le.name}));if(he==="pdf")return ae.replaceChildren(u("iframe",{src:Oe,title:le.name}));if(!Ou(le))return ae.replaceChildren(Ge(le));let ce=u("pre",{tabindex:"0"});ae.replaceChildren(ce),(me?Promise.resolve(new TextDecoder().decode(me.subarray(0,2e5))):fetch(Oe).then(Ze=>Ze.text())).then(Ze=>ce.textContent=Ze.slice(0,2e5),()=>ce.replaceWith(Ge(le)))}let Ve=()=>{gt(),De.remove(),(ge.isConnected?ge:W.querySelectorAll(".fd-file-open")[ee])?.focus()};re.addEventListener("click",Ve),De.addEventListener("click",pe=>pe.target===De&&Ve()),Re.addEventListener("keydown",pe=>{let le={ArrowLeft:-1,ArrowRight:1}[pe.key];pe.key==="Escape"?Ve():le&&ke.length>1&&pe.target.tagName!=="PRE"?Ae(ee+(Ut(w)?-le:le)):hn(Re,pe)}),Ae(ee),(w.closest(".fd-form")??a.body).append(De),Re.focus()}return{element:w,focus:()=>(W.querySelector("button")??(I.hidden?j:L)).focus(),update(ee){G=ee.readonly;let ge=ee.value;_=Array.isArray(ge)?ge:ge?[ge]:[];let ke=_.length>=h;Et(I,ke||G),Et(F,G),L.disabled=G,L.hidden=I.hidden,Et(j,k||!_.length||G),z&&Et(z,!_.length),D&&xt(D,_.length?k&&c.maxFiles?lt(f.fileCountOf,{n:_.length,max:c.maxFiles}):_.length===1?f.oneFile:lt(f.fileCount,{n:_.length}):""),ct(L,ee),!(Q===ge&&W.dataset.readonly===String(G))&&(Q=ge,W.dataset.readonly=String(G),Ie())}}}}var li=ul("binary"),Ta=ul("image");function Ma(e,t){let n=ao(t);if(n!=="image"&&n!=="pdf")return null;let r=t.data?URL.createObjectURL(new Blob([fl(t.data)],{type:t.type})):$a(t),i=e.createElement(n==="image"?"img":"iframe");return i.setAttribute("src",n==="pdf"?`${r}#view=FitH&navpanes=0`:r),i.setAttribute(n==="image"?"alt":"title",t.name),i.setAttribute("data-kind",n),{element:i,url:r,free:()=>{r.startsWith("blob:")&&URL.revokeObjectURL(r)}}}var pl=new Map;function ml(e,t){let n=pl.get(t);return n||(n=new Intl.NumberFormat(t,{style:"percent",maximumFractionDigits:0,numberingSystem:"latn"}),pl.set(t,n)),n.format(e/100)}var ci=e=>{let{field:t,node:n,id:r,document:i,locale:o="en"}=e,a=n.options??{},s=(E,m)=>{let x=a[E]??t[E];return typeof x=="number"?x:m},d=s("min",0),l=s("max",100),c=typeof a.maxField=="string"?a.maxField:null,f=typeof a.color=="string"?a.color:"auto",y=a.showPercent!==!1,u=i.createElement("div");u.className="fd-progressbar",u.setAttribute("role","progressbar");let k=i.createElement("div");k.className="fd-progressbar-fill";let h=i.createElement("span");h.className="fd-progressbar-text",u.append(k,h);let v=null,b=u;return a.editable===!0?(v=Xt({...e,node:{...n,widget:void 0}}),u.setAttribute("aria-hidden","true"),b=i.createElement("div"),b.className="fd-progressbar-edit",b.append(u,v.element)):(u.id=r,u.setAttribute("aria-label",n.label??t.label)),{element:b,focus:()=>v?.focus(),update(E){let m=typeof E.value=="number"?E.value:0,x=c?Number(E.values[c]??0):l,g=x>d?Math.min(100,Math.max(0,(m-d)/(x-d)*100)):0,$=Math.round(g*10)/10;k.style.width=`${$}%`,u.setAttribute("aria-valuenow",String(m)),u.setAttribute("aria-valuemin",String(d)),u.setAttribute("aria-valuemax",String(x)),u.setAttribute("aria-valuetext",ml(g,o)),h.textContent=y?ml(g,o):"",u.dataset.tone=f!=="auto"?f:g<30?"danger":g<70?"warning":"success",v?.update(E)}}};function gl(e){return e==null?"":typeof e=="object"&&"label"in e?e.label:String(e)}var fi=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options??{},a=c=>typeof o[c]=="string"?o[c]:"",s=c=>typeof o[c]=="string"?o[c]:null,d=e.type==="integer"?0:e.type==="float"||e.type==="monetary"?e.digits?.[1]??2:null,l=r.createElement("output");return l.id=n,l.className="fd-value-text",{element:l,focus:()=>{},update({value:c,values:f}){if(c==null||c===""){l.textContent="";return}let y=d!==null&&typeof c=="number"?St(c,d,i):lo(c,e),u=s("prefixField"),k=s("suffixField"),h=u?gl(f[u]):a("prefix"),v=k?gl(f[k]):a("suffix");l.textContent=[h,y,v].filter(b=>b!=="").join(" ")}}};function Du(e,t){let[n,r]=e>=86400?[e/86400,"day"]:e>=3600?[e/3600,"hour"]:[Math.max(1,e/60),"minute"];try{return new Intl.NumberFormat(t,{style:"unit",unit:r,unitDisplay:"narrow",maximumFractionDigits:0,numberingSystem:"latn"}).format(Math.floor(n))}catch{return`${Math.floor(n)}${r[0]}`}}var co=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=ot.en,locale:s="en"})=>{let d=r.options??{},l=d.clickable===!0,c=Array.isArray(d.visibleStates)?d.visibleStates:null,f=typeof d.durationsField=="string"?d.durationsField:null,y=d.fold===!0,u=d.saves===!0,k=o.createElement("ol");k.className="fd-statusbar",k.id=i,k.setAttribute("aria-label",n.label);let h=D=>D&&typeof D=="object"&&"id"in D?`id:${String(D.id)}`:`v:${String(D)}`,v=D=>D&&typeof D=="object"&&"id"in D?String(D.id):String(D),b=n.type==="selection"?n.options.map(D=>({key:h(D.value),label:D.label,value:D.value,folded:!1})):[],E=[],m=D=>D.forEach(W=>"any"in W?m(W.any):"all"in W?m(W.all):W.valueFrom&&E.push(W.valueFrom));n.type==="many2one"&&m(n.filter??[]);let x=n.type==="selection"?"":null,g=0,$={value:void 0,readonly:!1,durations:{}},A="",w=!1,L=D=>{e.setValue(t,D.value),u&&e.settled().then(()=>e.save())};function S(){let{value:D,readonly:W,durations:j}=$,O=k.contains(o.activeElement)?o.activeElement.dataset.key:void 0,B=D==null?null:h(D),H=b.filter(_=>!c||c.some(Q=>h(Q)===_.key)||_.key===B);B&&!H.some(_=>_.key===B)&&D&&typeof D=="object"&&(H=[...H,{key:B,label:D.label,value:D,folded:!1}]);let C=y?H.filter(_=>_.folded&&_.key!==B):[];H=H.filter(_=>!C.includes(_));let z=H.map(_=>f?Number(j[v(_.value)]??0):0),M=JSON.stringify([H.map(_=>[_.key,_.label]),C.map(_=>_.key),z,B,W,w]);if(M===A)return;A=M;let te=H.map((_,Q)=>{let $e=o.createElement("span");$e.textContent=_.label;let Ne=o.createElement(l?"button":"span");if(Ne instanceof HTMLButtonElement&&(Ne.type="button",Ne.disabled=W,Ne.dataset.key=_.key,Ne.addEventListener("click",()=>L(_))),Ne.append($e),z[Q]>0){let Pe=o.createElement("small");Pe.className="fd-step-time",Pe.textContent=Du(z[Q],s),Ne.title=a.timeInStep.replace("{time}",Pe.textContent),Ne.append(Pe)}_.key===B&&Ne.setAttribute("aria-current","step");let Ie=o.createElement("li");return Ie.append(Ne),Ie});C.length&&te.push(I(C,W)),k.replaceChildren(...te);let Y=k.querySelector(".fd-step-menu:not([hidden])"),G=Y?.previousElementSibling;if(Y&&G){let _=G.getBoundingClientRect(),Q=o.defaultView,$e=getComputedStyle(k).direction==="rtl";Y.style.top=`${_.bottom+4}px`,$e?Y.style.left=`${_.left}px`:Y.style.right=`${Math.max(0,(Q?.innerWidth??_.right)-_.right)}px`}O&&[...k.querySelectorAll("button")].find(_=>_.dataset.key===O)?.focus()}function I(D,W){let j=o.createElement("li");j.className="fd-step-more";let O=o.createElement("button");O.type="button",O.dataset.key="more",O.setAttribute("aria-haspopup","menu"),O.setAttribute("aria-expanded",String(w)),O.setAttribute("aria-label",a.moreSteps),O.title=a.moreSteps;let B=o.createElement("span");B.textContent="\u22EF",B.setAttribute("aria-hidden","true"),O.append(B);let H=o.createElement("div");H.className="fd-step-menu",H.setAttribute("role","menu"),H.hidden=!w;for(let C of D){let z=o.createElement("button");z.type="button",z.setAttribute("role","menuitem"),z.textContent=C.label,z.disabled=W||!l,z.addEventListener("click",()=>{w=!1,L(C),S()}),H.append(z)}return O.addEventListener("click",()=>{w=!w,S(),w&&k.querySelector(".fd-step-menu button:not([disabled])")?.focus()}),H.addEventListener("keydown",C=>{C.key==="Escape"&&(C.stopPropagation(),w=!1,S(),k.querySelector(".fd-step-more > button")?.focus())}),j.append(O,H),j}let F=D=>{w&&!k.contains(D.target)&&(w=!1,S())};return o.addEventListener("pointerdown",F),o.addEventListener("scroll",F,!0),{element:k,focus:()=>k.querySelector("button:not([disabled])")?.focus(),destroy(){o.removeEventListener("pointerdown",F),o.removeEventListener("scroll",F,!0)},update(D){let W=f?D.values?.[f]:null;$={value:D.value,readonly:D.readonly,durations:W&&typeof W=="object"&&!Array.isArray(W)?W:{}},S();let j=n.type==="selection"?"":JSON.stringify(E.map(O=>D.values?.[O]??null));if(x!==j){x=j;let O=++g;e.search(t,"",20).then(B=>{O===g&&(b=B.map(H=>({key:h(H),label:H.label,value:H,folded:H.folded===!0})),S())}).catch(()=>{})}}}};var Wu={char:[void 0,"email","phone","url","password","time","tags","copy"],text:[void 0,"copy"],integer:[void 0],float:[void 0,"duration","percentage"],monetary:[void 0],selection:[void 0,"dot","tags"],date:[void 0,"daterange"],datetime:[void 0,"daterange"],many2one:[void 0,"path"],many2many:[void 0,"tags"],reference:[void 0],html:[void 0],json:["address"],properties:[void 0]};function fo(e,t){return!t.widget&&(e.type==="selection"&&e.multiple||e.type==="many2many"&&t.columns?.length)?!1:Wu[e.type]?.includes(t.widget)??!1}var Hu=e=>!!e.closest(".fd-field[data-quiet]");function ar(e,t=()=>e.showPicker?.()){e.addEventListener("click",()=>{if(!(e.readOnly||!Hu(e)))try{t()}catch{}})}function bl(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()));t.setUTCDate(t.getUTCDate()+4-(t.getUTCDay()||7));let n=Date.UTC(t.getUTCFullYear(),0,1);return Math.ceil(((t.getTime()-n)/864e5+1)/7)}var hl=e=>String(e).padStart(2,"0"),Na=(e,t)=>e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),bn=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t);function uo(e,t){let n=new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate();return new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),n))}function Pa(e,t){if(typeof t!="string"||!t)return null;if(e==="date"){let r=/^(\d{4})-(\d{2})-(\d{2})/.exec(t);return r?new Date(Number(r[1]),Number(r[2])-1,Number(r[3])):null}let n=new Date(t);return Number.isNaN(n.getTime())?null:n}function po(e,t,n){let{form:r,name:i,id:o,document:a,locale:s="en"}=t,d=t.labels??ot.en,l=s==="en"?"en-GB":s,c=new Intl.DateTimeFormat(l,{month:"long",year:"numeric",numberingSystem:"latn"}),f=new Intl.DateTimeFormat(l,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),y=new Intl.DateTimeFormat(l,{weekday:"short"}),u=new Intl.DateTimeFormat(l,{weekday:"long"}),k=a.createElement("button");k.type="button",k.className="fd-calendar-button";let h="http://www.w3.org/2000/svg",v=a.createElementNS(h,"svg");v.setAttribute("viewBox","0 0 16 16"),v.setAttribute("aria-hidden","true");for(let[H,C]of[["rect",{x:"2",y:"3",width:"12",height:"11",rx:"1.5"}],["path",{d:"M2 6.5h12M5 1.5v3M11 1.5v3"}]]){let z=a.createElementNS(h,H);for(let[M,te]of Object.entries(C))z.setAttribute(M,te);v.append(z)}k.append(v),k.setAttribute("aria-label",d.chooseDate),k.setAttribute("aria-haspopup","dialog"),k.setAttribute("aria-expanded","false"),k.setAttribute("aria-controls",`${o}-calendar`);let b=a.createElement("div");b.className="fd-calendar",b.id=`${o}-calendar`,b.setAttribute("role","dialog"),b.hidden=!0;let E=a.createElement("div");E.className="fd-calendar-head";let m=a.createElement("button");m.type="button",m.textContent="\u2039",m.setAttribute("aria-label",d.previousMonth);let x=a.createElement("span");x.className="fd-calendar-title",x.setAttribute("aria-live","polite");let g=a.createElement("button");g.type="button",g.textContent="\u203A",g.setAttribute("aria-label",d.nextMonth),E.append(m,x,g);let $=a.createElement("table");$.className="fd-calendar-grid",$.setAttribute("role","grid"),b.append(E,$);let A=a.createElement("span");A.className="fd-date-pick",A.append(e.element,k,b);let w=new Date,L=!1;function S(H){if(n==="date")r.setValue(i,`${H.getFullYear()}-${hl(H.getMonth()+1)}-${hl(H.getDate())}`);else{let C=Pa("datetime",r.getState().values[i]),z=new Date(H.getFullYear(),H.getMonth(),H.getDate(),C?.getHours()??0,C?.getMinutes()??0);r.setValue(i,z.toISOString())}O(),A.dispatchEvent(new CustomEvent("fd-picked",{bubbles:!0,detail:{value:r.getState().values[i]}}))}function I(H){let C=Pa(n,r.getState().values[i]),z=new Date,M=c.format(w);x.textContent=M,b.setAttribute("aria-label",M);let te=new Date(w.getFullYear(),w.getMonth(),1),Y=bn(te,-((te.getDay()+6)%7)),G=a.createElement("tr"),_=a.createElement("th");_.scope="col",_.textContent=d.weekShort,_.setAttribute("abbr",d.week),G.append(_);for(let Ne=0;Ne<7;Ne++){let Ie=bn(Y,Ne),Pe=a.createElement("th");Pe.scope="col",Pe.textContent=y.format(Ie).replace(/\.$/,""),Pe.setAttribute("abbr",u.format(Ie)),G.append(Pe)}let Q=a.createElement("thead");Q.append(G);let $e=a.createElement("tbody");for(let Ne=Y;Ne<=new Date(w.getFullYear(),w.getMonth()+1,0);Ne=bn(Ne,7)){let Ie=a.createElement("tr"),Pe=a.createElement("th");Pe.scope="row",Pe.className="fd-week",Pe.textContent=String(bl(Ne)),Ie.append(Pe);for(let ee=0;ee<7;ee++){let ge=bn(Ne,ee),ke=a.createElement("td"),Oe=a.createElement("button");Oe.type="button",Oe.textContent=String(ge.getDate()),Oe.setAttribute("aria-label",f.format(ge)),Oe.tabIndex=Na(ge,w)?0:-1,ge.getMonth()!==w.getMonth()&&Oe.classList.add("fd-outside"),C&&Na(ge,C)&&Oe.setAttribute("aria-selected","true"),Na(ge,z)&&Oe.setAttribute("aria-current","date"),Oe.disabled=L,Oe.addEventListener("click",()=>S(ge)),Oe.addEventListener("keydown",Xe=>D(Xe,ge)),ke.append(Oe),Ie.append(ke)}$e.append(Ie)}$.replaceChildren(Q,$e),H&&$.querySelector('button[tabindex="0"]')?.focus()}function F(H){w=H,I(!0)}function D(H,C){let z={ArrowLeft:()=>bn(C,-1),ArrowRight:()=>bn(C,1),ArrowUp:()=>bn(C,-7),ArrowDown:()=>bn(C,7),PageUp:()=>uo(C,-1),PageDown:()=>uo(C,1),Home:()=>bn(C,-((C.getDay()+6)%7)),End:()=>bn(C,6-(C.getDay()+6)%7)};z[H.key]?(H.preventDefault(),F(z[H.key]())):(H.key==="Enter"||H.key===" ")&&(H.preventDefault(),S(C))}function W(){w=Pa(n,r.getState().values[i])??new Date,b.hidden=!1,k.setAttribute("aria-expanded","true"),I(!0),j()}function j(){b.style.translate="";let H=b.getBoundingClientRect(),C=a.documentElement.clientWidth;if(!H.width||!C)return;let z=H.left<8?8-H.left:H.right>C-8?Math.max(8-H.left,C-8-H.right):0;z&&(b.style.translate=`${Math.round(z)}px 0`)}function O(){b.hidden||(b.hidden=!0,k.setAttribute("aria-expanded","false"),k.focus())}k.addEventListener("click",()=>b.hidden?W():O()),e.element instanceof HTMLInputElement&&ar(e.element,()=>b.hidden&&W()),m.addEventListener("click",()=>{w=uo(w,-1),I(!1)}),g.addEventListener("click",()=>{w=uo(w,1),I(!1)}),b.addEventListener("keydown",H=>{H.key==="Escape"&&(H.preventDefault(),H.stopPropagation(),O())});let B=H=>{!b.hidden&&!A.contains(H.target)&&(b.hidden=!0,k.setAttribute("aria-expanded","false"))};return a.addEventListener("mousedown",B),{element:A,focus:()=>e.focus(),update(H){L=H.readonly,k.hidden=H.readonly,H.readonly&&(b.hidden=!0),e.update(H)},destroy(){a.removeEventListener("mousedown",B),e.destroy?.()}}}var ju=e=>{let t=e.replace(/_/g," ").trim();return t.charAt(0).toUpperCase()+t.slice(1)},yl=e=>e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"").replace(/^(\d)/,"p_$1")||"property";function zu(e,t){let n=ju(e);return typeof t=="boolean"?{name:e,label:n,type:"boolean"}:typeof t=="number"?{name:e,label:n,type:Number.isInteger(t)?"integer":"float"}:typeof t=="string"&&/^\d{4}-\d{2}-\d{2}$/.test(t)?{name:e,label:n,type:"date"}:{name:e,label:n,type:"char"}}var Bu=["char","text","integer","float","boolean","date"],Oa=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d}=e,l=Me(a),c=Be(s,d),f=r.type==="properties"?r.definitions:void 0,y=r.type==="properties"&&!!r.definitionsFrom,u=()=>{let B=t.getState().values[n];return B&&typeof B=="object"&&!Array.isArray(B)?B:{}},k={...t,getState:()=>({...t.getState(),values:u()}),setValue:(B,H)=>t.setValue(n,{...u(),[B]:H})},h=l("div",{class:"fd-properties-list"}),v=l("div",{class:"fd-properties",role:"group"},h);i.options?.columns===2&&(v.dataset.columns="2");let E=l("div",{class:"fd-help",role:"status",hidden:""});v.append(E);let m=y&&i.options?.add===!0,x=l("button",{type:"button",class:"fd-button fd-button-link fd-property-add",hidden:""},`+ ${c.addProperty}`),g=l("input",{type:"text",class:"fd-input","aria-label":c.propertyName,placeholder:c.propertyName,autocomplete:"off"}),$=c.propertyTypes.split("|"),A=l("select",{class:"fd-input fd-select","aria-label":c.propertyType},...Bu.map((B,H)=>l("option",{value:B},$[H]??B))),w=l("button",{type:"button",class:"fd-button fd-button-primary"},c.add),L=l("button",{type:"button",class:"fd-button"},c.cancel),S=l("div",{class:"fd-property-new",hidden:""},g,A,w,L);m&&v.append(x,S);let I=null,F=()=>{S.hidden=!0,x.hidden=!1};x.addEventListener("click",()=>{S.hidden=!1,x.hidden=!0,g.value="",A.value="char",g.focus()}),L.addEventListener("click",()=>{F(),x.focus()});let D=()=>{let B=g.value.trim();if(!B)return g.focus();let H=new Set(W.map(z=>z.definition.name)),C=yl(B);for(let z=2;H.has(C);z++)C=`${yl(B)}_${z}`;I=C,F(),t.addDefinition(n,{name:C,label:B,type:A.value})};w.addEventListener("click",D),S.addEventListener("keydown",B=>{B.key==="Enter"&&B.target===g?(B.preventDefault(),D()):B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),F(),x.focus())});let W=[],j="";function O(B){for(let H of W)H.widget.destroy?.();W=B.map(H=>{let C=`${o}-${H.name}`,z={type:H.type,label:H.label,...H.options?{options:H.options}:{}},M={type:"field",id:`${i.id}.${H.name}`,field:H.name},te=Xt({...e,form:k,name:H.name,field:z,node:M,id:C});return{definition:H,widget:te}}),h.replaceChildren(...W.map(({definition:H,widget:C})=>{let z=a.createElement("div");z.className="fd-property",z.dataset.type=H.type;let M=a.createElement("label");return M.htmlFor=`${o}-${H.name}`,M.textContent=H.label,z.append(M,C.element),z}))}return y&&!t.getState().definitions[n]&&t.loadDefinitions(n),{element:v,focus:()=>(W[0]?.widget??{focus:()=>x.focus()}).focus(),destroy:()=>W.forEach(B=>B.widget.destroy?.()),update(B){let H=u(),C=y?t.getState().definitions[n]:void 0,z=y?C?.definitions??[]:f??Object.keys(H).map(te=>zu(te,H[te])),M=JSON.stringify(z);M!==j&&(j=M,O(z));for(let{definition:te,widget:Y}of W)Y.update({value:H[te.name]??null,values:H,readonly:B.readonly,required:!1,invalid:!1});E.textContent=C?.loading&&!C.definitions?c.loading:C?.error??"",E.hidden=!E.textContent,m&&(B.readonly&&F(),x.hidden=B.readonly||!S.hidden),I&&W.some(te=>te.definition.name===I)&&(W.find(te=>te.definition.name===I)?.widget.focus(),I=null)}}};function mo(e){let t=0,n=()=>{throw t},r=()=>{for(;t<e.length&&`
|
|
5
|
+
\r`.includes(e[t]);)t++},i=c=>e[t]===c?t++:n(),o=c=>{for(let f of c)i(f)},a=()=>{for(/[0-9]/.test(e[t]??"")||n();/[0-9]/.test(e[t]??"");)t++};function s(){for(i('"');e[t]!=='"';)if((t>=e.length||e.charCodeAt(t)<32)&&n(),e[t]==="\\")if(t++,'"\\/bfnrt'.includes(e[t]??"x"))t++;else if(e[t]==="u"){t++;for(let c=0;c<4;c++)/[0-9a-fA-F]/.test(e[t]??"")||n(),t++}else n();else t++;t++}function d(){e[t]==="-"&&t++,e[t]==="0"?t++:a(),e[t]==="."&&(t++,a()),(e[t]==="e"||e[t]==="E")&&(t++,(e[t]==="+"||e[t]==="-")&&t++,a())}function l(){r();let c=e[t];if(c==="{"){if(t++,r(),e[t]==="}"){t++;return}for(;;)if(r(),s(),r(),i(":"),l(),r(),e[t]===",")t++;else return void i("}")}if(c==="["){if(t++,r(),e[t]==="]"){t++;return}for(;;)if(l(),r(),e[t]===",")t++;else return void i("]")}if(c==='"')return s();if(c==="-"||/[0-9]/.test(c??""))return d();if(c==="t")return o("true");if(c==="f")return o("false");if(c==="n")return o("null");n()}try{return l(),r(),t<e.length&&n(),null}catch(c){if(typeof c!="number")throw c;let f=e.slice(0,c).split(`
|
|
6
|
+
`);return{offset:c,line:f.length,column:f[f.length-1].length+1}}}var qu=new Set(["P","BR","B","STRONG","I","EM","U","S","UL","OL","LI","A","H1","H2","H3","H4","BLOCKQUOTE","CODE","PRE","SPAN","DIV","IMG"]),_u=new Set(["SCRIPT","STYLE","IFRAME","OBJECT","EMBED","TEMPLATE","NOSCRIPT","SVG","MATH"]),Uu=new Set(["P","DIV","H1","H2","H3","H4","LI","BLOCKQUOTE","PRE"]),Ku=new Set(["left","center","right","justify","start","end"]),xl=/^(#[0-9a-f]{3}|#[0-9a-f]{6}|rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,\s*(0|1|0?\.\d+)\s*)?\))$/i,Gu=new Set(["12px","14px","16px","20px","28px"]),Ju=/^(https:\/\/[^\s"'<>]+|data:image\/(png|jpeg|gif|webp);base64,[A-Za-z0-9+/=]+)$/i,Yu=/^[\w.-]{1,64}$/,Xu=/^[A-Za-z][\w.]{0,63}$/;function sr(e,t=globalThis.document){let n=t.createElement("template");n.innerHTML=e;let r=o=>{for(let a of[...o.childNodes]){if(a.nodeType===Node.TEXT_NODE)continue;if(a.nodeType!==Node.ELEMENT_NODE){a.remove();continue}let s=a;if(_u.has(s.tagName)){s.remove();continue}if(r(s),!qu.has(s.tagName)){s.replaceWith(...s.childNodes);continue}let d=s.tagName,l=[],c=d==="A"?s.getAttribute("href")?.trim():null;if(c&&/^(https?:|mailto:)/i.test(c)&&l.push(["href",c]),d==="IMG"){let h=s.getAttribute("src")?.trim()??"";if(!Ju.test(h)){s.remove();continue}l.push(["src",h],["alt",s.getAttribute("alt")??""])}let f=[],y=s.style,u=Uu.has(d)?y?.textAlign?.trim().toLowerCase():"";if(u&&Ku.has(u)&&f.push(`text-align: ${u};`),d==="SPAN"&&y){let h=y.color?.trim(),v=y.backgroundColor?.trim(),b=y.fontSize?.trim();h&&xl.test(h)&&f.push(`color: ${h};`),v&&xl.test(v)&&f.push(`background-color: ${v};`),b&&Gu.has(b)&&f.push(`font-size: ${b};`)}if(f.length&&l.push(["style",f.join(" ")]),d==="SPAN"||d==="A"){for(let v of["data-mention","data-record"]){let b=s.getAttribute(v);b&&Yu.test(b)&&l.push([v,b])}let h=s.getAttribute("data-model");h&&Xu.test(h)&&s.hasAttribute("data-record")&&l.push(["data-model",h])}let k=d==="LI"?s.getAttribute("data-task"):null;(k==="open"||k==="done")&&l.push(["data-task",k]);for(let h of[...s.attributes])s.removeAttribute(h.name);for(let[h,v]of l)s.setAttribute(h,v)}};r(n.content);let i=t.createElement("div");return i.append(n.content),i.innerHTML}function Mr(e){let t=e.trim();return/^(https?:\/\/|mailto:)\S+$/i.test(t)?t:/^[^\s@:/]+@[^\s@:/]+\.[^\s@:/]+$/.test(t)?`mailto:${t}`:/^[\w-]+(\.[\w-]+)+([/?#]\S*)?$/.test(t)?`https://${t}`:null}function go(e){return!!(e.iconOnly||e.pressed!==void 0||e.menu?.length||e.primaryWhenChanged)}var Ca=(e,t)=>!!e?.length&&t===void 0&&e.every(n=>n.do==="reset");function ho(e,t,n,r){return!Ca(e.steps,e.action)||t.getState().dirty.length?!1:(n(r.nothingChanged,"info"),!0)}function at(e,t){e.hidden!==t&&(e.hidden=t)}function $t(e,t){e.textContent!==t&&(e.textContent=t)}function yt(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}function Rn(e,t,n){let r=In(t);e.setAttribute("data-hotkey",t),e.setAttribute("aria-keyshortcuts",r),e.title=`${n} (${r})`;let i=e.ownerDocument.createElement("kbd");i.className="fd-hotkey",i.setAttribute("aria-hidden","true"),i.dir="ltr",i.textContent=`${t.startsWith("shift+")?"\u21E7":""}${t.slice(-1).toUpperCase()}`,e.append(i)}function bo(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return null;let t=/^(?:Key([A-Z])|Digit([0-9]))$/.exec(e.code);return t?`${e.shiftKey?"shift+":""}${(t[1]??t[2]).toLowerCase()}`:null}var Zu={gear:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>'},ui=(e,t)=>e!=null&&t!=null&&String(e)===String(t);function vl(e){let{el:t,labels:n,toolbar:r}=e,i=r?.menu??[],o=r?.breadcrumbs===!1?void 0:e.breadcrumbs,a=r?.pager===!1?void 0:e.records;if(!i.length&&!o?.length&&!a)return null;let s=[],d=[],l=t("div",{class:"fd-record-bar"});if(o?.length){let c=t("span",{class:"fd-crumb-current","aria-current":"page"}),f=t("ol",{},...o.map(y=>{let u=y.href!==void 0?t("a",{class:"fd-crumb",href:y.href},y.label):t("button",{type:"button",class:"fd-crumb"},y.label);return y.open&&u.addEventListener("click",k=>{k.preventDefault(),y.open?.()}),t("li",{},u)}),t("li",{},c));l.append(t("nav",{class:"fd-breadcrumbs","aria-label":n.breadcrumbs},f)),s.push(()=>$t(c,e.name()||n.newRecord))}return i.length&&l.append(Ia(e,i,s,d)),a&&l.append(Qu(e,a,o,s,d)),{element:l,update:()=>{for(let c of s)c()},destroy:()=>{for(let c of d)c()}}}function Ia(e,t,n,r,i="gear"){let{doc:o,el:a,form:s,labels:d}=e,l=e.uid(i==="more"?"record-more":"record-menu"),c=i==="more"?d.moreActions:d.actions,f=a("button",{type:"button",class:i==="more"?"fd-button fd-record-gear fd-head-more":"fd-button fd-record-gear",id:`${l}-button`,"aria-haspopup":"menu","aria-expanded":"false","aria-controls":l,title:c,"aria-label":i==="more"?c:void 0}),y=rt(o,i==="more"?"more":"gear",Zu);y&&f.append(y),i==="gear"&&f.append(a("span",{class:"fd-record-gear-words"},d.actions));let u=a("div",{class:"fd-record-menu",role:"menu",id:l,"aria-labelledby":f.id,hidden:""}),k=t.map(L=>{let S=L.label??(L.builtin?d[L.builtin]:L.id),I=a("button",{type:"button",role:"menuitem",tabindex:"-1",class:"fd-record-menu-item","data-node":L.id},...e.withIcon(L.icon,S));return L.builtin==="delete"&&I.classList.add("fd-record-menu-danger"),I.addEventListener("click",()=>{w(!0),e.press(f,()=>s.runAction(L.id))}),{item:L,button:I}}),h=k.filter(L=>L.item.group==="print"),v=k.filter(L=>L.item.group!=="print"),b=a("div",{class:"fd-record-menu-heading",role:"presentation"},d.print),E=a("div",{role:"group","aria-label":d.print},b,...h.map(L=>L.button)),m=a("div",{class:"fd-record-menu-rule",role:"separator"});u.append(...h.length?[E]:[],...h.length&&v.length?[m]:[],...v.map(L=>L.button));let x=a("div",{class:"fd-record-actions"},f,u),g=()=>k.filter(L=>!L.button.hidden).map(L=>L.button),$=L=>{x.contains(L.target)||w(!1)};function A(L){if(!u.hidden)return;u.hidden=!1,u.removeAttribute("data-end");let S=u.getBoundingClientRect();(S.right>o.documentElement.clientWidth-4||S.left<4)&&u.setAttribute("data-end",""),f.setAttribute("aria-expanded","true"),o.addEventListener("pointerdown",$,!0);let I=g();(L==="first"?I[0]:I[I.length-1])?.focus()}function w(L){u.hidden||(u.hidden=!0,f.setAttribute("aria-expanded","false"),o.removeEventListener("pointerdown",$,!0),L&&f.focus())}return r.push(()=>o.removeEventListener("pointerdown",$,!0)),f.addEventListener("click",()=>u.hidden?A("first"):w(!1)),f.addEventListener("keydown",L=>{(L.key==="ArrowDown"||L.key==="ArrowUp")&&(L.preventDefault(),A(L.key==="ArrowDown"?"first":"last"))}),u.addEventListener("keydown",L=>{let S=g(),I=S.indexOf(o.activeElement),F={ArrowDown:I+1,ArrowUp:I-1,Home:0,End:S.length-1}[L.key];F!==void 0?(L.preventDefault(),S[(F+S.length)%S.length]?.focus()):L.key==="Escape"?(L.preventDefault(),L.stopPropagation(),w(!0)):L.key==="Tab"&&w(!1)}),n.push(()=>{for(let{item:L,button:S}of k)at(S,s.node(L.id).invisible);at(E,!h.some(L=>!L.button.hidden)),at(m,E.hidden||!v.some(L=>!L.button.hidden)),at(x,!k.some(L=>!L.button.hidden))}),x}function Qu(e,t,n,r,i){let{el:o,form:a,labels:s}=e,d=Array.isArray(t)?[...t]:null,l=Array.isArray(t)?null:t,c=d?d.length:l.total,f=d?-1:l.at,y=d?null:a.getState().recordId,u=!1,k=()=>{let g=a.getState().recordId;return d?d.findIndex($=>ui($,g)):ui(y,g)?f:-1},h=o("span",{class:"fd-record-pager-text",dir:"ltr"}),v=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.previousRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),b=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.nextRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A"));Rn(v,"p",s.previousRecord),Rn(b,"n",s.nextRecord);let E=o("div",{class:"fd-record-pager",role:"group","aria-label":s.records},h,v,b),m=async g=>d?d[g]:l.id(g);async function x(g){let $=k();if(!(u||$===-1||c<2)){u=!0;try{let A=($+g+c)%c;if(!await e.leave())return;let w=await m(A);f=A,y=w,await a.openRecord(w)}finally{u=!1}}}return v.addEventListener("click",()=>{x(-1)}),b.addEventListener("click",()=>{x(1)}),i.push(a.on("duplicate",({from:g,recordId:$})=>{if(!d)return;let A=d.findIndex(w=>ui(w,g));d.splice(A+1,0,$),c=d.length,e.render()}),a.on("delete",({recordId:g})=>{let $=d?d.findIndex(L=>ui(L,g)):ui(y,g)?f:-1;if($===-1)return;if(d&&d.splice($,1),c=d?d.length:c-1,c<1)return void n?.[n.length-1]?.open?.();f=Math.min($,c-1);let A=L=>{y=L,a.openRecord(L)},w=d?d[f]:l.id(f);w instanceof Promise?w.then(A):A(w)})),r.push(()=>{let g=k();at(E,g===-1),$t(h,e.fill(s.recordAt,{n:g+1,total:c}));let $=c<2;yt(v,"aria-disabled",$?"true":null),yt(b,"aria-disabled",$?"true":null)}),E}var ep=/\[([^\]\n]+)\]\(((?:https?:\/\/|mailto:)[^\s)]+)\)/g;function Nr(e,t,n={}){let r=[],i=0;for(let o of t.matchAll(ep)){o.index>i&&r.push(e.createTextNode(t.slice(i,o.index)));let a=e.createElement("a");a.href=o[2],a.textContent=o[1],/^https?:/i.test(o[2])&&(a.target="_blank",a.rel="noopener noreferrer"),r.push(a);let s=n.external&&/^https?:/i.test(o[2])?rt(e,"external"):null;s&&(s.classList.add("fd-external"),r.push(s)),i=o.index+o[0].length}return i<t.length&&r.push(e.createTextNode(t.slice(i))),r}function yo(e,t,n){let r=e("span",{class:"fd-pick-tick","aria-hidden":"true"}),i=rt(r.ownerDocument,"check");return i&&r.append(i),e("div",{...t,class:`${t.class?`${t.class} `:""}fd-pick-row`},r,e("span",{class:"fd-pick-words"},n))}var pi=e=>e.key.length===1&&e.key!==" "&&!e.ctrlKey&&!e.metaKey&&!e.altKey;function xo(e){let t="",n=0;return(r,i)=>{let o=Date.now();o-n>700&&(t=""),n=o,t+=r.toLocaleLowerCase();let a=e().map(c=>c.trim().toLocaleLowerCase()),s=(c,f)=>{for(let y=0;y<a.length;y++){let u=(f+y)%a.length;if(a[u].startsWith(c))return u}return-1},l=[...t].every(c=>c===t[0])?s(t[0],i+1):s(t,Math.max(i,0));return l>=0||t.length===1?l:(t=r.toLocaleLowerCase(),s(t,i+1))}}function vo(e,t){if(!t)return;let[n,r]=[e.getBoundingClientRect(),t.getBoundingClientRect()];r.top<n.top?e.scrollTop-=n.top-r.top+8:r.bottom>n.bottom&&(e.scrollTop+=r.bottom-n.bottom+8)}function zn(e,t,n,r,i={}){let o=e.ownerDocument,a=l=>{!n.contains(l.target)&&!t.contains(l.target)&&!i.alignTo?.contains(l.target)&&d()};function s(){n.hidden=!1,t.setAttribute("aria-expanded","true");let l=e.closest(".fd-form"),c=i.alignTo??t;if(i.matchWidth&&(n.style.minWidth=`${c.getBoundingClientRect().width}px`),l){l.append(n),Object.assign(n.style,{position:"absolute",top:"0px",left:"0px",right:"auto"});let[f,y,u]=[c.getBoundingClientRect(),n.getBoundingClientRect(),n.offsetWidth],k=getComputedStyle(e).direction==="rtl",h=o.documentElement.clientWidth||u,v=Math.max(8,Math.min(k?f.right-u:f.left,h-u-8));Object.assign(n.style,{top:`${f.bottom-y.top+(i.gap??4)}px`,left:`${v-y.left}px`})}o.addEventListener("pointerdown",a,!0)}function d(){if(!n.hidden){if(n.hidden=!0,t.setAttribute("aria-expanded","false"),n.parentElement!==e){e.append(n);for(let l of["position","top","left","right"])n.style.removeProperty(l)}i.matchWidth&&n.style.removeProperty("min-width"),o.removeEventListener("pointerdown",a,!0),r()}}return{open:s,close:d,isOpen:()=>!n.hidden}}var wl=new WeakMap;function tp(e){let t=wl.get(e);return t===void 0&&(t=Math.floor(Math.random()*4294967296)>>>0,wl.set(e,t)),t}function np(e,t){let n=e^2654435769;for(let r=0;r<t.length;r++)n=Math.imul(n^t.charCodeAt(r),2246822507),n^=n>>>13;return n>>>0}function rp(e){let t=e;return()=>{t=t+1831565813|0;let n=Math.imul(t^t>>>15,1|t);return n=n+Math.imul(n^n>>>7,61|n)^n,((n^n>>>14)>>>0)/4294967296}}function un(e,t,n,r){if(r.options?.shuffle!==!0)return[...e];let i=(s,d)=>s[d]===!0,o=e.filter(s=>!i(s,"fixed")&&!i(s,"exclusive")),a=rp(np(tp(t),n));for(let s=o.length-1;s>0;s--){let d=Math.floor(a()*(s+1));[o[s],o[d]]=[o[d],o[s]]}return o.push(...e.filter(s=>!i(s,"fixed")&&i(s,"exclusive"))),e.map(s=>i(s,"fixed")?s:o.shift())}var kl=`.fd-signature{display:grid;gap:8px;justify-items:start;width:100%;max-width:480px;min-width:0}.fd-signature-box{position:relative;width:100%;aspect-ratio:10 / 3;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:#fff;overflow:hidden}.fd-signature-box:has(.fd-signature-pad:not([hidden]):not(.fd-signature-locked)):hover{border-color:var(--fd-accent)}.fd-signature-pad,.fd-signature-image{display:block;width:100%;height:100%}.fd-signature-pad{touch-action:none;cursor:crosshair}.fd-signature-pad.fd-signature-locked{cursor:default}.fd-signature-image{object-fit:contain}.fd-signature-hint{position:absolute;inset-inline:18px;inset-block-end:16px;padding-block-start:4px;pointer-events:none;border-block-start:1px solid var(--fd-border-strong);color:var(--fd-muted);font-size:12.5px}.fd-signature-tools{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;width:100%}.fd-signature-typed{flex:1 1 200px;min-width:0}.fd-signature-footer{margin-block-start:-4px;color:var(--fd-muted);font-size:12.5px}.fd-slider{display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:14px;row-gap:0;align-items:center;width:100%;max-width:440px;min-width:0}.fd-slider-track{display:contents}.fd-slider-input{width:100%;min-width:0;height:26px;margin:0;accent-color:var(--fd-accent);cursor:pointer}.fd-slider-input:disabled{cursor:default}.fd-slider-value{min-width:2.5em;text-align:start;font-variant-numeric:tabular-nums;font-weight:600}.fd-slider-ends{grid-column:1;display:flex;justify-content:space-between;gap:12px;font-size:12.5px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-slider-empty .fd-slider-input{filter:grayscale(1);opacity:.55}.fd-slider-empty .fd-slider-value{color:var(--fd-muted);font-weight:400}.fd-slider .fd-choice-clear{grid-column:1 / -1}.fd-image-choices{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr));gap:12px;width:100%;min-width:0}.fd-image-card{position:relative;display:grid;grid-template-rows:auto 1fr;padding:0;margin:0;overflow:hidden;cursor:pointer;font:inherit;color:var(--fd-text);text-align:start;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);transition:border-color .15s ease,box-shadow .15s ease}.fd-image-card:hover:not(:disabled){border-color:var(--fd-accent)}.fd-image-card:disabled{cursor:default}.fd-image-card:disabled:not([aria-checked=true]){opacity:.6}.fd-image-card[aria-checked=true]{border-color:var(--fd-accent);box-shadow:0 0 0 1px var(--fd-accent)}.fd-image-card-picture{display:block;aspect-ratio:4 / 3;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-image-card-picture img{display:block;width:100%;height:100%;object-fit:cover}.fd-image-card-blank{display:grid;place-items:center;width:100%;height:100%;color:var(--fd-border-strong)}.fd-image-card-blank svg{width:36%;height:36%;fill:none;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}.fd-image-card-words{display:flex;align-items:flex-start;gap:8px;padding:9px 10px;font-size:13.5px;line-height:1.35}.fd-image-card-words:before{content:"";flex:none;width:16px;height:16px;margin-block-start:1px;box-sizing:border-box;border:1.5px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface)}.fd-image-card[role=checkbox] .fd-image-card-words:before{border-radius:4px}.fd-image-card[aria-checked=true] .fd-image-card-words:before{border-color:var(--fd-accent);background:var(--fd-accent);box-shadow:inset 0 0 0 3px var(--fd-surface)}.fd-image-card[role=checkbox][aria-checked=true] .fd-image-card-words:before{box-shadow:none;background:var(--fd-accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 13px no-repeat}.fd-image-choices+.fd-choice-clear{justify-self:end}.fd-ranking{width:100%;max-width:480px;min-width:0}.fd-rank-list{list-style:none;margin:0;padding:0;display:grid;gap:6px}.fd-rank-item{display:flex;align-items:center;gap:10px;padding-block:5px;padding-inline:8px 5px;min-height:40px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);cursor:grab;user-select:none;-webkit-user-select:none}.fd-rank-item.fd-rank-lifted{position:relative;z-index:1;cursor:grabbing;border-color:var(--fd-accent);box-shadow:0 6px 18px #0f141929}.fd-ranking-locked .fd-rank-item{cursor:default}.fd-rank-grip{flex:none;width:10px;height:16px;touch-action:none;background:radial-gradient(circle,var(--fd-border-strong) 1.3px,transparent 1.7px) 0 0 / 5px 5.33px}.fd-ranking-locked .fd-rank-grip{visibility:hidden}.fd-rank-place{flex:none;display:grid;place-items:center;min-width:24px;height:24px;padding-inline:4px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:12.5px;font-weight:600;font-variant-numeric:tabular-nums}.fd-rank-words{flex:1;min-width:0;overflow-wrap:anywhere}.fd-rank-tools{flex:none;display:inline-flex;gap:2px}.fd-rank-move{width:30px;height:30px;padding:0;font:inherit;font-size:15px;line-height:1;color:var(--fd-muted);background:none;border:1px solid transparent;border-radius:4px;cursor:pointer}.fd-rank-move:hover:not(:disabled){background:var(--fd-page);border-color:var(--fd-border);color:var(--fd-text)}.fd-rank-move:disabled{opacity:.3;cursor:default}.fd-address{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;width:100%;max-width:560px;min-width:0}.fd-address-part{display:grid;gap:3px;min-width:0;align-content:start}.fd-address-street,.fd-address-line2{grid-column:1 / -1}.fd-address-part.fd-required>.fd-address-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-address-label{font-size:12.5px;color:var(--fd-muted)}@container (max-width: 420px){.fd-address{grid-template-columns:minmax(0,1fr)}}.fd-repeat{display:grid;gap:10px;justify-items:start;width:100%;min-width:0}.fd-repeat-list{display:grid;gap:10px;width:100%;min-width:0}.fd-repeat-list:empty{display:none}.fd-repeat-card{display:grid;gap:8px;min-width:0;padding:10px 14px 14px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-radius),6px)}.fd-repeat-head{display:flex;align-items:center;gap:2px;min-height:28px}.fd-repeat-title{font-weight:600;font-size:13.5px;margin-inline-end:auto}.fd-repeat-remove,.fd-repeat-tool{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:18px;line-height:1;padding:4px 8px;border-radius:4px}.fd-repeat-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-repeat-tool{font-size:15px;min-width:24px;min-height:24px}.fd-repeat-tool:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-repeat-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,200px),1fr));gap:10px 14px}.fd-repeat-field{display:grid;gap:3px;min-width:0;align-content:start}.fd-repeat-label{font-size:12.5px;color:var(--fd-muted)}.fd-repeat-add{border-style:dashed}`;var Sl='.fd-yes-no button{min-width:76px}.fd-choices-columns{display:grid;grid-template-columns:repeat(var(--fd-choice-columns),minmax(0,1fr))}.fd-choices-row{grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr)}.fd-choice-limit{grid-column:1 / -1;flex-basis:100%;font-size:12.5px;color:var(--fd-muted)}.fd-choice-limit:empty{display:none}.fd-image-choices[data-size=small]{--fd-card: 96px}.fd-image-choices[data-size=large]{--fd-card: 210px}.fd-image-choices[data-size]{grid-template-columns:repeat(auto-fill,minmax(min(100%,var(--fd-card, 130px)),1fr))}.fd-image-choices[data-fit=whole] img{object-fit:contain}.fd-image-choices-bare .fd-image-card-words{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0;font-size:0}.fd-choice-search .fd-combo:after{content:"";position:absolute;inset-inline-end:12px;width:6px;height:6px;margin-block-start:-4px;pointer-events:none;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg)}.fd-rank-pool{display:flex;flex-wrap:wrap;gap:8px;margin-block:6px 10px}.fd-rank-pick{min-height:32px;padding:4px 12px;font:inherit;color:inherit;cursor:pointer;background:var(--fd-surface);border:1px dashed var(--fd-border-strong);border-radius:999px}.fd-rank-pick:disabled{opacity:.5;cursor:default}.fd-rank-list:empty{display:none}.fd-rank-keep{margin-block-start:8px}.fd-matrix-pick{display:inline-flex;align-items:center;gap:8px}.fd-matrix-column{display:none}@container (max-width: 520px){.fd-choices-columns{grid-template-columns:minmax(0,1fr)}.fd-image-choices.fd-image-choices{grid-auto-flow:row;grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-matrix-table,.fd-matrix-table :is(tbody,tr,th,td){display:block}.fd-matrix-table thead{display:none}.fd-matrix-table tr{padding:10px 12px;margin-block-end:10px;border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-matrix-table :is(th,td){padding:2px 0;border:0;text-align:start}.fd-matrix-pick{min-height:32px}.fd-matrix-column{display:inline}}';var Ll='.fd-counted{display:grid;gap:2px;min-width:0}.fd-count{justify-self:end;direction:ltr;unicode-bidi:isolate;font-size:12px;color:var(--fd-muted);font-variant-numeric:tabular-nums}.fd-count-near{color:var(--fd-warning);font-weight:600}.fd-number:not(.fd-currency-picked){position:relative;display:block}.fd-field>.fd-number:not(.fd-currency-picked){align-self:start}.fd-number>.fd-unit{position:absolute;inset-block:0;display:flex;align-items:center;pointer-events:none;color:var(--fd-muted)}.fd-number>.fd-unit:first-child{inset-inline-start:var(--fd-pad-x)}.fd-number>.fd-unit:last-child{inset-inline-end:var(--fd-pad-x)}.fd-rating-heart button.fd-on{color:#e5484d}.fd-rating-thumb button.fd-on{color:var(--fd-accent)}.fd-rating .fd-icon{display:block;width:1em;height:1em}.fd-rating .fd-on .fd-icon{fill:currentColor}.fd-slider-word{display:block;max-width:12em}.fd-slider-last{text-align:end}.fd-nps [data-tone=low]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-nps [data-tone=mid]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-nps [data-tone=high]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-nps button{background:var(--fd-tone-soft);border-color:var(--fd-tone);color:var(--fd-tone);font-weight:600}.fd-nps button.fd-on{background:var(--fd-tone);border-color:var(--fd-tone);color:var(--fd-surface)}.fd-nps [data-value="7"],.fd-nps [data-value="9"]{margin-inline-start:8px}.fd-choices-box>.fd-scale-box{justify-self:start}';var El=".fd-form[data-inputs~=bg] :is(.fd-input:not([readonly]),.fd-calendar-button){background:var(--fd-inputs-bg)}.fd-form[data-inputs~=border] :is(.fd-input,.fd-calendar-button){--fd-border: var(--fd-inputs-border);--fd-border-strong: var(--fd-inputs-border)}.fd-form[data-inputs~=radius] :is(.fd-input,.fd-calendar-button){--fd-control-radius: var(--fd-inputs-radius)}.fd-form[data-inputs~=size] :where(.fd-input){font-size:var(--fd-inputs-size)}.fd-form[data-inputs~=accent] :is(.fd-input,.fd-combo,.fd-tags,.fd-date-pick){--fd-accent: var(--fd-inputs-accent);--fd-accent-text: var(--fd-inputs-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}.fd-form[data-choices~=accent] :is(.fd-choices,.fd-points,.fd-image-choices,.fd-ranking,.fd-checkbox,.fd-switch,.fd-matrix-table,.fd-slider){--fd-accent: var(--fd-choices-accent);--fd-accent-text: var(--fd-choices-accent-text);--fd-focus: var(--fd-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface))}.fd-form[data-choices~=bg] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-surface: var(--fd-choices-bg)}.fd-form[data-choices~=border] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-border: var(--fd-choices-border)}.fd-form[data-choices~=radius] :is(.fd-points button,.fd-image-card,.fd-rank-item){--fd-control-radius: var(--fd-choices-radius)}.fd-form[data-choices~=size] :is(.fd-choices,.fd-points,.fd-image-card-words,.fd-rank-list){font-size:var(--fd-choices-size)}.fd-form[data-groups~=bg] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){background:var(--fd-groups-bg);--fd-ground: var(--fd-groups-bg)}.fd-form[data-groups~=border] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border:1px solid var(--fd-groups-border)}.fd-form[data-groups~=radius] :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page],.fd-section[data-style=framed],.fd-card,.fd-repeat-card){border-radius:var(--fd-groups-radius)}.fd-form[data-fd-skin=underline]:is([data-groups~=bg],[data-groups~=border]) :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){padding:var(--fd-group-pad, 18px 22px);border-radius:var(--fd-groups-radius, var(--fd-radius))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button{--fd-accent: var(--fd-buttons-accent);--fd-accent-text: var(--fd-buttons-accent-text);--fd-focus: var(--fd-accent);--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-buttons~=accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}:is(.fd-form,.fd-form-dialog)[data-buttons~=radius] .fd-button{border-radius:var(--fd-buttons-radius)}:is(.fd-form,.fd-form-dialog)[data-buttons~=size] .fd-button{font-size:var(--fd-buttons-size)}.fd-form[data-tables~=bg] :is(.fd-lines-table,.fd-matrix-table) thead th{background:var(--fd-tables-bg)}.fd-form[data-tables~=border] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){border-color:var(--fd-tables-border)}.fd-form[data-tables~=size] :is(.fd-lines-table,.fd-matrix-table) :is(th,td){font-size:var(--fd-tables-size)}";var Rl='.fd-read-text{min-width:0;min-height:var(--fd-control-height, 30px);padding-block:calc(var(--fd-pad-y) + 1px);white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.45;color:var(--fd-text)}.fd-field:is([data-type=integer],[data-type=float],[data-type=monetary])>.fd-read-text{font-variant-numeric:tabular-nums}.fd-read-text{unicode-bidi:plaintext;text-align:left}[dir=rtl] .fd-read-text{text-align:right}.fd-read-text{padding-inline:var(--fd-pad-x)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-read-text{padding-inline:calc(var(--fd-pad-x) + 1px)}.fd-form :is(.fd-title,.fd-title-line) .fd-read-text{padding-inline:0}.fd-read-text a,.fd-read-link{color:var(--fd-accent);text-decoration:none}.fd-read-link{border:none;background:none;padding:0;font:inherit;cursor:pointer;text-align:start}.fd-read-text a:hover,.fd-read-link:hover{text-decoration:underline}.fd-read-link:focus-visible,.fd-read-text a:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-field>.fd-value-badge{justify-self:start;align-self:start;width:fit-content;margin-block:calc((var(--fd-control-height, 30px) - 24px) / 2)}.fd-title>.fd-field>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-ribbon[title]{pointer-events:auto;cursor:help}.fd-value{font-weight:600}.fd-alert:has(>.fd-alert-actions){flex-wrap:wrap;align-items:baseline}.fd-alert-actions{display:inline-flex;flex-wrap:wrap;gap:4px 12px;align-items:baseline}.fd-alert-actions .fd-button{min-height:0;padding-block:0;font-size:inherit}.fd-alert-actions .fd-button-link{color:inherit;padding-inline:0;text-decoration:underline;text-underline-offset:2px;font-weight:600}.fd-text-alert{grid-column:1 / -1;margin:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden]))>:is(.fd-ribbon-frame+.fd-alert,.fd-ribbon-frame+.fd-stats[hidden]+.fd-alert){margin-inline-end:72px}.fd-stat-pair{gap:1px}.fd-stat-row{display:inline-flex;align-items:baseline;gap:5px}.fd-stat-row>.fd-stat-label:after{content:":"}.fd-stat-pair .fd-stat-value{font-size:13.5px}@container (max-width: 520px){.fd-stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}.fd-stat{min-width:0;padding-inline:12px;text-align:start;column-gap:8px}.fd-stat:has(>.fd-icon){column-gap:8px}.fd-stat-value{font-size:14px}.fd-stat:nth-child(odd of:not([hidden])){border-inline-start:none}.fd-stat:nth-child(n+3 of:not([hidden])){border-block-start:1px solid var(--fd-border)}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:0}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(2 of:not([hidden])){padding-inline-end:64px}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stat:nth-child(4 of:not([hidden])){padding-inline-end:36px}}.fd-step-time{margin-inline-start:6px;font-size:11.5px;font-weight:400;font-variant-numeric:tabular-nums}.fd-statusbar li.fd-step-more>button{padding-inline:16px 20px;letter-spacing:1px}.fd-statusbar li.fd-step-more>.fd-step-menu{position:fixed;z-index:30;display:grid;min-width:160px;margin:0;padding:4px 0;clip-path:none;transform:none;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;white-space:nowrap}.fd-statusbar li.fd-step-more>.fd-step-menu[hidden]{display:none}.fd-statusbar .fd-step-menu>button{font:inherit;font-size:13px;text-align:start;border:none;background:none;color:inherit;padding:6px 14px;cursor:pointer;transform:none}.fd-statusbar .fd-step-menu>button:hover:not(:disabled),.fd-statusbar .fd-step-menu>button:focus-visible{background:var(--fd-accent-soft);outline:none}.fd-statusbar .fd-step-menu>button:disabled{cursor:default;color:var(--fd-muted)}.fd-hotkey{display:none}[data-hotkeys] .fd-hotkey{display:inline-block;margin-inline-start:6px;padding:0 4px;border:1px solid currentColor;border-radius:3px;font:600 10.5px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace;opacity:.85;vertical-align:1px}.fd-link-avatar{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;overflow:hidden;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:10px;font-weight:700;line-height:1;vertical-align:middle}.fd-link-avatar img{width:100%;height:100%;object-fit:cover}.fd-combo[data-avatar]>.fd-link-avatar{position:absolute;inset-inline-start:4px;pointer-events:none}.fd-combo[data-avatar]>.fd-link-avatar[hidden]~.fd-combo-input{padding-inline-start:var(--fd-pad-x)}.fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:32px}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar{inset-inline-start:0}.fd-form[data-fd-skin=underline] .fd-combo[data-avatar]>.fd-link-avatar:not([hidden])~.fd-combo-input{padding-inline-start:28px}.fd-read-text>.fd-link-avatar{margin-inline-end:6px}.fd-chip>.fd-link-avatar{width:18px;height:18px;font-size:9px;margin-inline:-4px 2px}.fd-link{display:grid;gap:2px;min-width:0}.fd-link-details{font-size:12.5px;line-height:1.4;color:var(--fd-muted);text-align:left}[dir=rtl] .fd-link-details{text-align:right}.fd-link-details>div{unicode-bidi:plaintext}.fd-chip[data-color]{background:color-mix(in srgb,var(--fd-tag) 18%,var(--fd-surface));border-color:color-mix(in srgb,var(--fd-tag) 55%,var(--fd-surface))}.fd-chip[data-color="1"]{--fd-tag: #f06050}.fd-chip[data-color="2"]{--fd-tag: #f4a460}.fd-chip[data-color="3"]{--fd-tag: #f7cd1f}.fd-chip[data-color="4"]{--fd-tag: #6cc1ed}.fd-chip[data-color="5"]{--fd-tag: #814968}.fd-chip[data-color="6"]{--fd-tag: #eb7e7f}.fd-chip[data-color="7"]{--fd-tag: #2c8397}.fd-chip[data-color="8"]{--fd-tag: #475577}.fd-chip[data-color="9"]{--fd-tag: #d6145f}.fd-chip[data-color="10"]{--fd-tag: #30c381}.fd-chip[data-color="11"]{--fd-tag: #9365b8}.fd-oneline-row{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;min-width:0;min-height:var(--fd-control-height, 30px)}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 6px;flex:0 1 auto;width:auto;min-width:0;grid-template-columns:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{grid-column:auto!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:not([data-labels=beside]):not([data-labels=above])>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>:is(.fd-error,.fd-warning){flex-basis:100%}.fd-oneline-row .fd-input{width:12em;max-width:100%}.fd-form .fd-oneline-pair{display:inline-flex;flex-wrap:nowrap;align-items:center;gap:6px 10px;flex:0 1 auto;max-width:100%;min-width:0}.fd-form .fd-oneline-pair:not(:has(>:not([hidden]))){display:none}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field{max-width:100%}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>*{max-width:100%;min-width:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference]) .fd-input{width:15em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=integer],[data-type=float]) .fd-input{width:7em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=monetary] .fd-input{width:8.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=date],[data-type=datetime]) .fd-input{width:9.5em}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime] .fd-input{width:14em}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]){flex:1 1 auto}.fd-form :is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime])>:not(.fd-label){flex:1 1 auto}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field:is([data-type=many2one],[data-type=reference],[data-type=date],[data-type=datetime]) .fd-input{width:100%;min-width:min(100%,var(--fd-oneline-min, 9.5em))}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field[data-type=datetime]{--fd-oneline-min: 14em}.fd-form .fd-oneline-words{margin:0;padding:0;border:0;background:none;color:var(--fd-text)}.fd-form .fd-oneline-words.fd-text-note{color:var(--fd-muted);font-size:12.5px}.fd-form .fd-oneline:not(:has(>.fd-label))>.fd-oneline-row{grid-column:1 / -1!important}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-button-link{padding-inline:0;min-height:0}:is(.fd-oneline-row,.fd-oneline-pair)>.fd-field>.fd-read-text{min-height:0;padding-block:0}.fd-title-label{font-size:12.5px;font-weight:600;color:var(--fd-muted)}';var Fl='.fd-priority{display:inline-flex;align-items:center;gap:1px}.fd-priority-star{border:none;background:none;padding:0 1px;min-width:0;font:inherit;font-size:20px;line-height:1;color:var(--fd-border-strong);cursor:pointer}.fd-priority-star.fd-on{color:#e8a317}.fd-priority:not(:has(:disabled)):hover .fd-priority-star{color:#e8a317}.fd-priority:not(:has(:disabled)) .fd-priority-star:hover~.fd-priority-star{color:var(--fd-border-strong)}.fd-priority-star:disabled{cursor:default}.fd-title-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;min-width:0}.fd-title-line>.fd-title-name{flex:1 1 18em;min-width:0}.fd-title-line>.fd-title-name .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-title-line>.fd-title-name>.fd-read-text{font-size:24px;font-weight:600;line-height:1.25}.fd-form .fd-title-line>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form .fd-title-line>.fd-field>*{grid-column:1!important}.fd-form .fd-title-line>.fd-title-side{display:flex;align-items:center;flex:none}.fd-title-line>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-line .fd-priority-star{font-size:24px}.fd-dot-box{position:relative;display:inline-flex;align-items:center;gap:6px}.fd-dot-button{display:inline-grid;place-items:center;width:24px;height:24px;padding:0;border:none;border-radius:50%;background:none;cursor:pointer}.fd-dot-button:hover:not(:disabled){background:var(--fd-accent-soft)}.fd-dot-button:disabled{cursor:default}.fd-dot{display:inline-block;width:12px;height:12px;flex:none;border-radius:50%;background:var(--fd-dot, var(--fd-border-strong))}.fd-dot-button[data-tone=muted],.fd-dot-item[data-tone=muted]{--fd-dot: var(--fd-border-strong)}.fd-dot-button[data-tone=danger],.fd-dot-item[data-tone=danger]{--fd-dot: var(--fd-error)}.fd-dot-button[data-tone=success],.fd-dot-item[data-tone=success]{--fd-dot: var(--fd-success)}.fd-dot-button[data-tone=warning],.fd-dot-item[data-tone=warning]{--fd-dot: #d97706}.fd-dot-button[data-tone=info],.fd-dot-item[data-tone=info]{--fd-dot: var(--fd-info)}.fd-dot-label{font-size:13px;color:var(--fd-muted)}.fd-dot-menu{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:180px;padding:4px;display:grid;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-dot-item{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:4px;cursor:pointer;white-space:nowrap;font-size:14px}.fd-dot-item:hover,.fd-dot-item:focus{background:var(--fd-accent-soft);outline:none}.fd-dot-item[aria-checked=true]{font-weight:600}.fd-dot-item[aria-checked=true]:after{content:"\u2713";margin-inline-start:auto;padding-inline-start:16px;color:var(--fd-accent)}.fd-colour-box{position:relative;display:inline-flex;align-items:center;gap:8px}.fd-colour-button,.fd-colour{width:24px;height:24px;padding:0;border:1px solid var(--fd-border-strong);border-radius:4px;background:var(--fd-swatch, transparent);cursor:pointer}.fd-colour-button:disabled{cursor:default}.fd-colour-none,.fd-colour[data-colour="0"]{background:linear-gradient(to top right,transparent calc(50% - 1px),var(--fd-error) calc(50% - 1px),var(--fd-error) calc(50% + 1px),transparent calc(50% + 1px))}.fd-colour-palette{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;display:grid;grid-template-columns:repeat(6,24px);gap:6px;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-colour[aria-checked=true]{box-shadow:0 0 0 2px var(--fd-surface),0 0 0 4px var(--fd-accent)}.fd-colour-input{width:44px;height:30px;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-colour-code{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;color:var(--fd-muted)}.fd-copy{display:flex;align-items:center;gap:8px;min-width:0}.fd-copy>.fd-input{flex:1 1 auto;min-width:0}.fd-copy-long{align-items:flex-start}.fd-copy-button{flex:none}.fd-range{position:relative;display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-width:0}.fd-range-box{flex:1 1 8em;display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}.fd-range-box>.fd-input{flex:1 1 9em;min-width:0}.fd-range-box>.fd-input[type=datetime-local]{flex-basis:13em}.fd-range-arrow{flex:none;display:inline-block;color:var(--fd-muted)}.fd-range-arrow:dir(rtl){transform:scaleX(-1)}.fd-range-calendar .fd-calendar-grid td button.fd-in-range{background:var(--fd-accent-soft);border-radius:0}.fd-timer{display:inline-flex;align-items:center;gap:8px;font-variant-numeric:tabular-nums;font-weight:600;direction:ltr;unicode-bidi:isolate}.fd-timer-dot{width:8px;height:8px;border-radius:50%;background:var(--fd-border-strong)}.fd-timer[data-running] .fd-timer-dot{background:var(--fd-success);animation:fd-timer-beat 1s ease-in-out infinite alternate}.fd-timer[data-running] .fd-timer-time{color:var(--fd-success)}@keyframes fd-timer-beat{to{opacity:.35}}@media(prefers-reduced-motion:reduce){.fd-timer[data-running] .fd-timer-dot{animation:none}}.fd-embed{display:grid;gap:8px;min-width:0}.fd-embed-bar{display:flex;align-items:center;gap:8px;min-width:0}.fd-embed-bar>.fd-input{flex:1 1 auto;min-width:0}.fd-embed-open{flex:none}.fd-embed-frame{display:block;width:100%;border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);background:var(--fd-page)}.fd-embed-none{padding:24px 12px;text-align:center;color:var(--fd-muted);border:1px dashed var(--fd-border);border-radius:max(var(--fd-control-radius),4px)}.fd-distribution{display:grid;gap:6px;min-width:0}.fd-distribution-table .fd-distribution-share{width:8.5em}.fd-distribution-table .fd-share{text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch)}.fd-distribution-total{font-weight:600;text-align:end;padding-inline-end:calc(var(--fd-pad-x) + 2ch + 4px);font-variant-numeric:tabular-nums}.fd-distribution-add{justify-self:start}.fd-tax-totals{justify-self:end;border-collapse:collapse;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-tax-totals th{text-align:start;font-weight:400;color:var(--fd-muted);padding:3px 16px 3px 0;padding-inline:0 16px}.fd-tax-totals td{text-align:end;padding:3px 0;white-space:nowrap}.fd-tax-totals .fd-tax-subtotal th{color:var(--fd-text)}.fd-tax-totals .fd-tax-total :is(th,td){font-weight:700;color:var(--fd-text);font-size:15px;border-top:1px solid var(--fd-border);padding-top:6px}.fd-tax-totals .fd-input{width:9em;text-align:end}.fd-payments{display:grid;gap:6px;justify-self:end;min-width:min(100%,320px);font-variant-numeric:tabular-nums}.fd-payments-list{list-style:none;margin:0;padding:0;display:grid;gap:4px}.fd-payment{position:relative;display:flex;align-items:center;gap:8px}.fd-payment-info{flex:none;width:20px;height:20px;padding:0;border:1px solid var(--fd-border-strong);border-radius:50%;background:var(--fd-surface);color:var(--fd-muted);font:italic 600 12px/1 Georgia,serif;cursor:pointer}.fd-payment-info:hover,.fd-payment-info[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-payment-date{flex:1 1 auto;font-style:italic;color:var(--fd-muted)}.fd-payment-amount{white-space:nowrap}.fd-payment-details{position:absolute;top:calc(100% + 4px);inset-inline-start:0;z-index:30;min-width:240px;display:grid;gap:6px;padding:10px 12px;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 6px 20px #00000029}.fd-payment-details dl{display:grid;grid-template-columns:auto 1fr;gap:2px 12px;margin:0}.fd-payment-details dt{color:var(--fd-muted)}.fd-payment-details dd{margin:0}.fd-payment-open{justify-self:start}.fd-payment-due{display:flex;justify-content:space-between;gap:16px;padding-top:6px;border-top:1px solid var(--fd-border);font-weight:600}.fd-properties-list{display:grid;gap:8px;min-width:0}.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:repeat(2,minmax(0,1fr));column-gap:var(--fd-gap-x, 24px)}@container (max-width: 520px){.fd-properties[data-columns="2"]>.fd-properties-list{grid-template-columns:minmax(0,1fr)}}.fd-property-add{justify-self:start}.fd-property-new{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.fd-property-new>.fd-input{flex:1 1 10em;width:auto}';var Al='.fd-dot-label[data-quiet-words]{display:none}.fd-form .fd-field[data-in-quiet]>.fd-label{color:var(--fd-muted)}.fd-form .fd-field[data-quiet]{--fd-quiet-pad: max(var(--fd-pad-x), 6px)}.fd-form .fd-field[data-quiet] :where(.fd-input){padding-inline-start:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet] :is(.fd-input:not(.fd-tags *),.fd-tags,.fd-dot-box){border:1px solid transparent;border-radius:max(var(--fd-control-radius),4px);background-color:transparent;box-shadow:none;transition:border-color .12s ease,background-color .12s ease,box-shadow .12s ease}.fd-form .fd-field[data-quiet]:not(:focus-within) .fd-count{visibility:hidden}.fd-form .fd-field[data-quiet] textarea.fd-input:not(:focus){resize:none}.fd-form .fd-field[data-quiet]>.fd-number:not(.fd-currency-picked){max-width:18em}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],:disabled,[contenteditable=false]){color:var(--fd-text);opacity:1;cursor:default}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],:disabled,[contenteditable=false]):not(.fd-combo[data-avatar]>*){padding-inline:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet]>.fd-read-text{padding-inline:calc(var(--fd-quiet-pad) + 1px)}.fd-form .fd-field[data-quiet][data-locked] :is(.fd-input,.fd-dot-label),.fd-form .fd-field[data-quiet][data-locked]>.fd-read-text{color:var(--fd-muted)}.fd-form .fd-field[data-quiet][data-empty] .fd-input:not(:focus){color:var(--fd-muted)}.fd-form .fd-field[data-quiet][data-empty] .fd-dot-label:empty:before{content:attr(data-hint);color:var(--fd-muted)}.fd-form .fd-field[data-quiet] :is(.fd-input[aria-invalid=true]:not(.fd-tags *),.fd-tags:has(.fd-input[aria-invalid=true]),.fd-dot-box:has(>[aria-invalid=true])){border-color:var(--fd-error)}@media(hover:hover){.fd-form .fd-field[data-quiet]>:hover :is(.fd-input:not(.fd-tags *),.fd-tags):not([readonly],:disabled,[contenteditable=false],:focus,:focus-within),.fd-form .fd-field[data-quiet]>:is(.fd-input,.fd-tags,.fd-dot-box:not(:has(:disabled))):not([readonly],:disabled,[contenteditable=false],:focus,:focus-within):hover{border-color:var(--fd-border);background-color:var(--fd-inputs-bg, var(--fd-surface))}}.fd-form .fd-field[data-quiet] :is(.fd-input:not(.fd-tags *):not([readonly],:disabled,[contenteditable=false]):focus,.fd-tags:focus-within,.fd-dot-box:has(>.fd-dot-button:is(:focus-visible,[aria-expanded=true]))){border-color:var(--fd-accent);background-color:var(--fd-inputs-bg, var(--fd-surface));box-shadow:0 0 0 1px var(--fd-accent)}.fd-form .fd-field[data-quiet] .fd-input:is([readonly],[contenteditable=false]):focus-visible{outline:2px solid var(--fd-accent);outline-offset:0}.fd-form .fd-field[data-quiet] select.fd-input{appearance:none;padding-inline-end:calc(var(--fd-quiet-pad) + 14px);background-image:none}.fd-form .fd-field[data-quiet] select.fd-input:not(:disabled):is(:hover,:focus),.fd-form .fd-field[data-quiet]>:hover select.fd-input:not(:disabled){background-image:linear-gradient(45deg,transparent 50%,var(--fd-muted) 50%),linear-gradient(135deg,var(--fd-muted) 50%,transparent 50%);background-position:calc(100% - var(--fd-quiet-pad) - 5px) 55%,calc(100% - var(--fd-quiet-pad)) 55%;background-size:5px 5px;background-repeat:no-repeat}.fd-form .fd-field[data-quiet] select.fd-input:not(:disabled):is(:hover,:focus):dir(rtl),.fd-form .fd-field[data-quiet]>:hover select.fd-input:not(:disabled):dir(rtl){background-position:var(--fd-quiet-pad) 55%,calc(var(--fd-quiet-pad) + 5px) 55%}.fd-form .fd-field[data-quiet] .fd-combo:is(.fd-choice-search *,:has(>.fd-combo-clear[hidden])):has(>.fd-combo-input:not([readonly])):after{content:"";position:absolute;inset-inline-end:12px;width:6px;height:6px;margin-block-start:-4px;pointer-events:none;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg);visibility:hidden}.fd-form .fd-field[data-quiet] .fd-combo:focus-within:after{visibility:visible}.fd-form .fd-field[data-quiet] .fd-choice-search .fd-combo:has(>.fd-combo-input[readonly]):after{content:none}.fd-form .fd-field[data-quiet] input.fd-input:is([type=date],[type=datetime-local],[type=time]):dir(rtl){position:relative;text-align:right}.fd-form .fd-field[data-quiet] input.fd-input:is([type=date],[type=datetime-local],[type=time]):dir(rtl)::-webkit-calendar-picker-indicator{position:absolute;left:var(--fd-quiet-pad)}.fd-form .fd-field[data-quiet] .fd-input::-webkit-calendar-picker-indicator{opacity:0;transition:opacity .12s ease}.fd-form .fd-field[data-quiet] .fd-input:not([readonly]):focus::-webkit-calendar-picker-indicator{opacity:1}.fd-form .fd-field[data-quiet]:not(:focus-within) :is(.fd-calendar-button,.fd-combo-clear,.fd-combo-open){visibility:hidden}@media(hover:hover){.fd-form .fd-field[data-quiet]>:hover :is(.fd-calendar-button,.fd-combo-clear,.fd-combo-open),.fd-form .fd-field[data-quiet]>:hover .fd-combo:after{visibility:visible}.fd-form .fd-field[data-quiet]>:hover .fd-input:not([readonly])::-webkit-calendar-picker-indicator,.fd-form .fd-field[data-quiet]>.fd-input:not([readonly]):hover::-webkit-calendar-picker-indicator{opacity:1}}.fd-form .fd-field[data-quiet] .fd-link>.fd-link-details{padding-inline-start:calc(var(--fd-quiet-pad) + 1px)}.fd-form .fd-field[data-quiet] .fd-tags{padding:1px var(--fd-quiet-pad);min-height:var(--fd-control-height, 30px)}.fd-form .fd-field[data-quiet] .fd-tags .fd-input{border:0;background-color:transparent;box-shadow:none;padding-inline-start:0}.fd-form .fd-field[data-quiet] .fd-tags:has(.fd-chip) .fd-combo-input:not(:focus)::placeholder{color:transparent}.fd-form .fd-field[data-quiet] .fd-dot-box{display:flex;gap:8px;min-height:var(--fd-control-height, 30px);padding-block:0;padding-inline:var(--fd-quiet-pad) calc(var(--fd-quiet-pad) + 16px)}.fd-form .fd-field[data-quiet] .fd-dot-box:after{content:"";position:absolute;inset-inline-end:calc(var(--fd-quiet-pad) + 2px);inset-block-start:50%;width:6px;height:6px;margin-block-start:-5px;border:solid var(--fd-muted);border-width:0 1.5px 1.5px 0;transform:rotate(45deg);visibility:hidden;pointer-events:none}.fd-form .fd-field[data-quiet] .fd-dot-box:has(>.fd-dot-button:is(:focus-visible,[aria-expanded=true])):after{visibility:visible}@media(hover:hover){.fd-form .fd-field[data-quiet] .fd-dot-box:not(:has(:disabled)):hover:after{visibility:visible}}.fd-form .fd-field[data-quiet] .fd-dot-button{margin-inline-start:-6px;margin-inline-end:-4px;background:none}.fd-form .fd-field[data-quiet] .fd-dot-button:before{content:"";position:absolute;inset:0}.fd-form .fd-field[data-quiet] .fd-dot-button:focus-visible{outline:none}.fd-form .fd-field[data-quiet] .fd-dot-label{display:inline;font-size:inherit;color:var(--fd-text)}.fd-form .fd-field[data-quiet] .fd-richtext-box{position:relative}.fd-form .fd-field[data-quiet] .fd-richtext{min-height:64px}.fd-form .fd-field[data-quiet] .fd-richtext[contenteditable=false]{min-height:0}.fd-form .fd-field[data-quiet] .fd-richtext>*{unicode-bidi:plaintext;text-align:left}.fd-form .fd-field[data-quiet] .fd-richtext>:dir(rtl){text-align:right}.fd-form .fd-field[data-quiet] .fd-richtext-box:not(:focus-within)>:is(.fd-richtext-bar,.fd-link-row){display:none}.fd-form .fd-field[data-quiet] .fd-richtext-box>:is(.fd-richtext-bar,.fd-link-row){position:absolute;inset-inline:0;z-index:25;border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);background:var(--fd-surface);box-shadow:0 6px 18px #0f141924}.fd-form .fd-field[data-quiet] .fd-richtext-box>.fd-richtext-bar{inset-block-start:calc(100% + 4px)}.fd-form .fd-field[data-quiet] .fd-richtext-box>.fd-link-row{inset-block-start:calc(100% + 46px)}.fd-lock-wrap{position:relative;display:inline-flex;vertical-align:-.15em;margin-inline-start:6px}.fd-lock{display:inline-grid;place-items:center;width:18px;height:18px;padding:0;border:0;border-radius:4px;background:none;color:var(--fd-muted)}button.fd-lock{cursor:help}.fd-lock .fd-icon{width:14px;height:14px;margin:0}.fd-lock:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}';var $l='.fd-pick-list{position:absolute;inset-block-start:100%;inset-inline-start:0;z-index:30;display:block;min-width:100%;max-height:320px;margin:0;padding:8px 0;overflow-x:hidden;overflow-y:auto;border:0;border-radius:4px;outline:none;background:var(--fd-surface);color:var(--fd-text);font-size:14px;line-height:20px;box-shadow:0 3.2px 7.2px #0002,0 .6px 1.8px #0000001c}.fd-pick-row{display:grid;grid-template-columns:26px minmax(0,1fr);gap:0;height:29.3px;margin:0 0 1px;padding:0;padding-inline-end:20px;border-radius:0;color:var(--fd-text);font-weight:400;white-space:nowrap;cursor:pointer;outline:none}.fd-pick-row[aria-checked=true]{font-weight:400}.fd-pick-list .fd-pick-row:after{content:none}.fd-pick-tick{display:grid;place-items:center;visibility:hidden;color:var(--fd-text)}.fd-pick-tick .fd-icon{width:16px;height:16px;margin:0;stroke-width:1.5}.fd-pick-row:is([aria-checked=true],[aria-selected=true])>.fd-pick-tick{visibility:visible}.fd-pick-words{display:block;min-width:0;padding-inline:0 6px;line-height:29.3px;overflow:hidden;text-overflow:ellipsis}@media(hover:hover){.fd-pick-row:hover{background:color-mix(in srgb,var(--fd-text) 5%,transparent)}}.fd-pick-row:is(:focus,[data-active]){background:var(--fd-accent-soft);outline:none}.fd-pick-row:is(:focus,[data-active])>.fd-pick-words{outline:1px solid var(--fd-focus);outline-offset:-1px;box-shadow:inset 0 0 0 3px color-mix(in srgb,var(--fd-focus) 14%,transparent)}.fd-field[data-lead] .fd-dot-box:not(.fd-own-box)>.fd-dot-button{position:absolute;inset-inline-end:100%;inset-block:0;width:24px;height:auto;margin:0;border-radius:0;background:none}.fd-field[data-lead] .fd-dot-box:not(.fd-own-box)>.fd-dot-button>.fd-dot{width:10px;height:10px}.fd-field[data-lead] .fd-dot-box:not(.fd-own-box){cursor:pointer}.fd-form .fd-field[data-quiet]>.fd-dot-box.fd-dot-box[data-list=own]:not(.fd-own-box):has(>.fd-dot-button[aria-expanded=true]){border-color:transparent;background-color:transparent;box-shadow:none}.fd-form .fd-field[data-quiet]>.fd-dot-box.fd-dot-box[data-list=own]:not(.fd-own-box):has(>.fd-dot-button[aria-expanded=true]):after{visibility:hidden}.fd-form .fd-field[data-quiet]>.fd-dot-box[data-list=own]:not(.fd-own-box):has(>.fd-dot-button[aria-expanded=true])>.fd-dot-label:after{content:"";display:inline-block;width:1px;height:17px;margin-inline-start:1px;vertical-align:-4px;background:var(--fd-text);animation:fd-caret 1.06s steps(1,end) infinite}@keyframes fd-caret{50%{opacity:0}}@media(prefers-reduced-motion:reduce){.fd-form .fd-field[data-quiet] .fd-dot-label:after{animation:none}}.fd-tags-adder{display:inline-flex;align-items:center;height:19px;padding:0 1px;border:0;border-radius:2px;background:var(--fd-fill, color-mix(in srgb, var(--fd-text) 6%, var(--fd-surface)));color:var(--fd-text);font:inherit;font-size:14px;font-weight:600;line-height:19px;white-space:nowrap;cursor:pointer}.fd-tags-adder:hover{background:color-mix(in srgb,var(--fd-text) 10%,var(--fd-surface))}.fd-tags-adder:active{background:color-mix(in srgb,var(--fd-text) 18%,var(--fd-surface))}.fd-tags:has(>.fd-tags-adder:not([hidden])){border-color:transparent!important;background-color:transparent!important;box-shadow:none!important}.fd-link-nobody{display:none}.fd-form .fd-field[data-quiet] .fd-combo[data-avatar]>.fd-link-nobody:not([hidden]){position:absolute;inset-inline-start:var(--fd-quiet-pad);display:grid;place-items:center;width:16px;height:16px;color:var(--fd-muted);pointer-events:none}.fd-form .fd-field[data-quiet] .fd-combo[data-avatar]>.fd-link-nobody .fd-icon{width:16px;height:16px;margin:0;stroke-width:1.5}.fd-form .fd-field[data-quiet] .fd-combo[data-avatar]>.fd-link-nobody:not([hidden])~.fd-combo-input{padding-inline-start:calc(var(--fd-quiet-pad) + 22px)}.fd-form .fd-field[data-quiet] .fd-combo[data-avatar]>.fd-combo-input::placeholder{color:var(--fd-muted);opacity:1}';var Tl=".fd-access-key{text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:2px}.fd-form .fd-field[data-lock-at=value]:not(.fd-head-fields>*):has(>.fd-lock-wrap:not([hidden])){grid-template-columns:auto minmax(0,1fr);column-gap:6px}.fd-form .fd-field[data-lock-at=value]:not(.fd-head-fields>*):has(>.fd-lock-wrap:not([hidden]))>*{grid-column:1 / -1}.fd-form .fd-field[data-lock-at=value]:not(.fd-head-fields>*):has(>.fd-lock-wrap:not([hidden]))>.fd-lock-wrap{grid-column:1;align-self:center;margin:0}.fd-form .fd-field[data-lock-at=value]:not(.fd-head-fields>*):has(>.fd-lock-wrap:not([hidden]))>.fd-lock-wrap+:not([hidden]),.fd-form .fd-field[data-lock-at=value]:not(.fd-head-fields>*):has(>.fd-lock-wrap:not([hidden]))>.fd-lock-wrap+[hidden]+.fd-read-text{grid-column:2}:is(.fd-head,.fd-split,.fd-form-dialog) :is(.fd-button,.fd-head-link,.fd-head-updated):focus-visible{outline:2px solid var(--fd-focus, var(--fd-accent));outline-offset:1px}:is(.fd-form-dialog :is(.fd-dialog-max,.fd-dialog-close),.fd-dialog-grip,.fd-head-copy,.fd-head-tabs .fd-tab):focus-visible{outline:2px solid var(--fd-focus, var(--fd-accent));outline-offset:-2px}";var Ml=".fd-form,.fd-theme{--fd-text-link: var(--fd-link, var(--fd-accent));--fd-text-fill: var(--fd-fill, color-mix(in srgb, var(--fd-text) 6%, var(--fd-surface)));--fd-text-hover: color-mix(in srgb, var(--fd-text) 4%, var(--fd-surface));--fd-text-pressed: color-mix(in srgb, var(--fd-text) 20%, var(--fd-surface));--fd-text-help: var(--fd-help, color-mix(in srgb, var(--fd-text) 4%, var(--fd-surface)));--fd-depth-4: 0 1.6px 3.6px rgb(0 0 0 / .132), 0 .3px .9px rgb(0 0 0 / .108);--fd-depth-8: 0 3.2px 7.2px rgb(0 0 0 / .132), 0 .6px 1.8px rgb(0 0 0 / .108)}@container (min-width: 761px){.fd-form .fd-grid[data-tracks]{grid-template-columns:var(--fd-track-list)}}.fd-help-box{position:relative;margin:0;padding:10px 12px 10px 50px;padding-inline:50px 12px;min-height:37px;box-sizing:border-box;background:var(--fd-text-help);color:var(--fd-text);font-size:14px;line-height:17px;overflow-wrap:anywhere}.fd-help-box>p{margin:0}.fd-help-box-icon,.fd-links-help-icon{position:absolute;inset-inline-start:11px;inset-block-start:50%;translate:0 -50%;width:28px;height:30px;color:var(--fd-muted);stroke-width:1.4}:is(.fd-help-box,.fd-links-help,.fd-text-help) a{color:var(--fd-text-link);text-decoration:underline}.fd-external{width:12px;height:12px;margin-inline-start:4px;vertical-align:-1px;color:var(--fd-muted);stroke-width:2}";var Nl='.fd-grid>.fd-section[data-place=tracks]{--fd-tracks: min(var(--fd-span, 1), var(--fd-cols));grid-template-columns:subgrid;column-gap:var(--fd-gap-x)}.fd-form .fd-section[data-place=tracks]>.fd-grid{--fd-cols: var(--fd-tracks);grid-column:1 / -1;grid-template-columns:subgrid}.fd-section[data-place]>.fd-section-description{grid-column:1 / -1}.fd-grid>.fd-section[data-place=shared]{container-type:inline-size}.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: var(--fd-columns, 1)}@container (max-width: 330px){.fd-form .fd-section[data-place=shared]>.fd-grid{--fd-cols: 1}}.fd-form{--fd-ground: transparent}.fd-card,.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-section[data-style=card][data-on-page]{--fd-ground: var(--fd-surface)}fieldset.fd-section[data-style]{background-color:var(--fd-ground)}.fd-form .fd-section[data-style=line]>.fd-section-title{border-block-end:1px solid var(--fd-border);padding-block-end:8px}.fd-form .fd-section[data-style=plain]>.fd-section-title{border-block-end:0;padding-block-end:0}.fd-form .fd-section[data-style=framed]{border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:6px 18px 18px}.fd-form .fd-section[data-style=framed]>.fd-section-title{float:none;width:auto;max-width:100%;padding:0 6px;margin-inline-start:-6px;border:0}.fd-form .fd-field[data-labels]{grid-template-columns:minmax(0,1fr)}.fd-form .fd-field[data-labels]>*{grid-column:1 / -1}.fd-form .fd-field[data-labels=beside]{container-type:inline-size;grid-template-columns:minmax(0,var(--fd-label-width, 140px)) minmax(0,1fr);column-gap:14px}@container (min-width: 300px){.fd-form .fd-field[data-labels=beside]>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=beside]>:not(.fd-label){grid-column:2}}.fd-form .fd-field[data-labels=hidden]>.fd-label{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form .fd-field[data-labels=after]{grid-template-columns:auto minmax(0,1fr);column-gap:9px;align-items:start;--fd-tick-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-field[data-labels=after]>:is(.fd-tick,:has(>.fd-tick)){grid-column:1;grid-row:1;display:flex;margin-block-start:calc(var(--fd-tick-drop) + (1.45em - 17px) / 2)}.fd-form .fd-field[data-labels=after] .fd-tick{width:17px;height:17px}.fd-form .fd-field[data-labels=after]>:not(.fd-tick,:has(>.fd-tick)){grid-column:2}.fd-form .fd-field[data-labels=after]>.fd-label{grid-row:1;margin-block-start:var(--fd-tick-drop);font-weight:inherit;line-height:1.45;cursor:pointer}.fd-form .fd-field[data-labels=beside]:focus-within,.fd-grid>.fd-section[data-place=shared]:focus-within{z-index:3}:is(.fd-grid,.fd-sections)>.fd-button{justify-self:start}.fd-form .fd-text-note{background:color-mix(in srgb,var(--fd-text) 6%,transparent);color:var(--fd-text);border-radius:var(--fd-control-radius, 6px);padding:10px 12px}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-font=serif]{--fd-font: "Source Serif 4", Georgia, serif}:is(.fd-form,.fd-form-dialog)[data-font=rounded]{--fd-font: Nunito, "Varela Round", system-ui}:is(.fd-form,.fd-form-dialog)[data-density=compact]{--fd-gap-y: 10px;--fd-gap-x: 16px;--fd-control-height: 30px;--fd-gap-block: 16px;--fd-group-pad: 14px 16px}:is(.fd-form,.fd-form-dialog)[data-density=comfortable]{--fd-gap-y: 16px;--fd-gap-x: 20px;--fd-control-height: 36px;--fd-gap-block: 22px;--fd-group-pad: 18px 22px}:is(.fd-form,.fd-form-dialog)[data-density=roomy]{--fd-gap-y: 22px;--fd-gap-x: 28px;--fd-control-height: 42px;--fd-gap-block: 30px;--fd-group-pad: 24px 30px}:is(.fd-form,.fd-form-dialog)[data-corners=square]{--fd-radius: 0px;--fd-control-radius: 0px}:is(.fd-form,.fd-form-dialog)[data-corners=soft]{--fd-radius: 10px;--fd-control-radius: 6px}:is(.fd-form,.fd-form-dialog)[data-corners=round]{--fd-radius: 16px;--fd-control-radius: 12px}.fd-form[data-scheme]{--fd-ground: var(--fd-page)}}.fd-form[data-scheme]{color-scheme:light;background:var(--fd-page);color:var(--fd-text);border-radius:var(--fd-radius)}:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{color-scheme:dark}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{color-scheme:dark}}.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:20px}.fd-form-dialog-body>.fd-form[data-scheme]{background:none;border-radius:0}.fd-form-dialog-body>.fd-form[data-scheme]>.fd-content:not(:has(>.fd-sheet-page)){padding:0}@layer fieldia-tokens{:is(.fd-form,.fd-form-dialog)[data-scheme=dark]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto]{--fd-text: #e8eaed;--fd-muted: #a3a9b2;--fd-page: #16191e;--fd-surface: #1f2329;--fd-border: #3a4048;--fd-border-strong: #59616c;--fd-accent: #5aa2ff;--fd-accent-text: #0b1220;--fd-accent-soft: rgba(90, 162, 255, .16);--fd-focus: #5aa2ff;--fd-error: #ff8a7a;--fd-error-soft: rgba(255, 138, 122, .13);--fd-success: #6fd08e;--fd-success-soft: rgba(111, 208, 142, .14);--fd-warning: #f2b55c;--fd-warning-soft: rgba(242, 181, 92, .13);--fd-info: #7db7ff;--fd-info-soft: rgba(90, 162, 255, .14);--fd-edge: #59616c}}:is(.fd-form,.fd-form-dialog)[data-accent]{--fd-accent: var(--fd-look-accent);--fd-accent-text: var(--fd-look-accent-text);--fd-focus: var(--fd-look-accent);--fd-accent-soft: color-mix(in srgb, var(--fd-accent) 12%, var(--fd-surface));--fd-accent-hover: color-mix(in srgb, var(--fd-accent) 84%, var(--fd-text))}:is(.fd-form,.fd-form-dialog)[data-scheme=dark][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}@media(prefers-color-scheme:dark){:is(.fd-form,.fd-form-dialog)[data-scheme=auto][data-accent]{--fd-accent: var(--fd-look-accent-dark);--fd-accent-text: var(--fd-look-accent-dark-text);--fd-focus: var(--fd-look-accent-dark)}}:is(.fd-form,.fd-form-dialog):is([data-fd-skin=outlined],[data-fd-skin=quiet])[data-accent]{--fd-focus-ring: 0 0 0 2px color-mix(in srgb, var(--fd-accent) 22%, transparent)}}:is(.fd-form,.fd-form-dialog)[data-accent] .fd-button-primary:hover{filter:none;background:var(--fd-accent-hover);border-color:var(--fd-accent-hover)}.fd-form[data-accent] .fd-page-head{border-block-end:3px solid var(--fd-accent);padding-block-end:14px}';var Bn='system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif',Pl={material:{light:{font:`Roboto, ${Bn}`,text:"#1d1b20",muted:"#49454f",page:"#fef7ff",surface:"#ffffff",border:"#79747e","border-strong":"#49454f",accent:"#6750a4","accent-text":"#ffffff","accent-soft":"#eaddff",focus:"#6750a4","focus-ring":"none",error:"#b3261e","error-soft":"#f9dedc",radius:"12px","control-radius":"4px","control-height":"48px","pad-y":"10px","pad-x":"16px","input-border":"0 0 1px 0","label-weight":"500","gap-x":"24px","gap-y":"20px",fill:"#ece6f0"},dark:{text:"#e6e0e9",muted:"#cac4d0",page:"#141218",surface:"#1d1b20",border:"#938f99","border-strong":"#cac4d0",accent:"#d0bcff","accent-text":"#381e72","accent-soft":"#4f378b",focus:"#d0bcff",error:"#f2b8b5","error-soft":"#601410",fill:"#36343b",edge:"#938f99"}},fluent:{light:{font:`"Segoe UI Variable Text", "Segoe UI", ${Bn}`,text:"#242424",muted:"#616161",page:"#f5f5f5",surface:"#ffffff",border:"#d1d1d1","border-strong":"#616161",accent:"#0f6cbd","accent-text":"#ffffff","accent-soft":"#ebf3fc",focus:"#0f6cbd","focus-ring":"none",error:"#c50f1f","error-soft":"#fdf3f4",radius:"8px","control-radius":"4px","control-height":"32px","pad-y":"5px","pad-x":"10px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#ffffff",muted:"#d6d6d6",page:"#1f1f1f",surface:"#292929",border:"#666666","border-strong":"#adadad",accent:"#479ef5","accent-text":"#0a0a0a","accent-soft":"#0e4775",focus:"#479ef5",error:"#e37d80","error-soft":"#3b1012",edge:"#adadad"}},apple:{light:{font:`-apple-system, BlinkMacSystemFont, "SF Pro Text", ${Bn}`,text:"#1d1d1f",muted:"#6e6e73",page:"#f2f2f7",surface:"#ffffff",border:"#d1d1d6","border-strong":"#8e8e93",accent:"#0066cc","accent-text":"#ffffff","accent-soft":"#e5f0fb",focus:"#0066cc","focus-ring":"0 0 0 4px rgba(0, 113, 227, 0.25)",error:"#d70015","error-soft":"#ffebec",radius:"12px","control-radius":"10px","control-height":"40px","pad-y":"8px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"20px","gap-y":"16px",fill:"#f2f2f7"},dark:{text:"#f5f5f7",muted:"#a1a1a6",page:"#000000",surface:"#1c1c1e",border:"#38383a","border-strong":"#636366",accent:"#409cff","accent-text":"#000000","accent-soft":"#0f2b4d",focus:"#409cff","focus-ring":"0 0 0 4px rgba(64, 156, 255, 0.3)",error:"#ff6961","error-soft":"#3a1412",fill:"#2c2c2e",edge:"#636366"}},bootstrap:{light:{font:Bn,text:"#212529",muted:"#5c636a",page:"#f8f9fa",surface:"#ffffff",border:"#dee2e6","border-strong":"#adb5bd",accent:"#0a58ca","accent-text":"#ffffff","accent-soft":"#cfe2ff",focus:"#86b7fe","focus-ring":"0 0 0 0.25rem rgba(13, 110, 253, 0.25)",error:"#b02a37","error-soft":"#f8d7da",radius:"6px","control-radius":"6px","control-height":"38px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"16px"},dark:{text:"#dee2e6",muted:"#adb5bd",page:"#212529",surface:"#2b3035",border:"#495057","border-strong":"#6c757d",accent:"#6ea8fe","accent-text":"#000000","accent-soft":"#031633",focus:"#6ea8fe","focus-ring":"0 0 0 0.25rem rgba(110, 168, 254, 0.25)",error:"#ea868f","error-soft":"#2c0b0e",edge:"#6c757d"}},shadcn:{light:{font:`Geist, Inter, ${Bn}`,text:"#09090b",muted:"#64646c",page:"#fafafa",surface:"#ffffff",border:"#e4e4e7","border-strong":"#a1a1aa",accent:"#18181b","accent-text":"#fafafa","accent-soft":"#f4f4f5",focus:"#a1a1aa","focus-ring":"0 0 0 3px rgba(161, 161, 170, 0.5)",error:"#dc2626","error-soft":"#fef2f2",radius:"10px","control-radius":"8px","control-height":"36px","pad-y":"6px","pad-x":"12px","input-border":"1px","label-weight":"500","gap-x":"24px","gap-y":"16px"},dark:{text:"#fafafa",muted:"#a1a1aa",page:"#09090b",surface:"#18181b",border:"#3f3f46","border-strong":"#71717a",accent:"#e4e4e7","accent-text":"#18181b","accent-soft":"#27272a",focus:"#71717a","focus-ring":"0 0 0 3px rgba(113, 113, 122, 0.5)",error:"#f87171","error-soft":"#450a0a",edge:"#71717a"}},ant:{light:{font:Bn,text:"rgba(0, 0, 0, 0.88)",muted:"rgba(0, 0, 0, 0.55)",page:"#f5f5f5",surface:"#ffffff",border:"#d9d9d9","border-strong":"#bfbfbf",accent:"#1365d9","accent-text":"#ffffff","accent-soft":"#e6f4ff",focus:"#1365d9","focus-ring":"0 0 0 2px rgba(5, 145, 255, 0.12)",error:"#c63c3d","error-soft":"#fff2f0",radius:"8px","control-radius":"6px","pad-y":"4px","pad-x":"11px","input-border":"1px","label-weight":"400","gap-x":"24px","gap-y":"18px"},dark:{text:"rgba(255, 255, 255, 0.85)",muted:"rgba(255, 255, 255, 0.6)",page:"#000000",surface:"#141414",border:"#424242","border-strong":"#595959",accent:"#3c89e8","accent-text":"#000000","accent-soft":"#111a2c",focus:"#3c89e8","focus-ring":"0 0 0 2px rgba(60, 137, 232, 0.2)",error:"#e86e6b","error-soft":"#2c1618",edge:"#595959"}},odoo:{light:{font:Bn,text:"#1f2937",muted:"#4b5563",page:"#f9fafb",surface:"#ffffff",border:"#d1d5db","border-strong":"#9ca3af",accent:"#714b67","accent-text":"#ffffff","accent-soft":"#f3edf2",focus:"#714b67","focus-ring":"none",error:"#c4161c","error-soft":"#fdecec",radius:"4px","control-radius":"0px","pad-y":"3px","pad-x":"4px","input-border":"0 0 1px 0","label-weight":"600","gap-x":"32px","gap-y":"14px"},dark:{text:"#e5e7eb",muted:"#9ca3af",page:"#111827",surface:"#1f2937",border:"#4b5563","border-strong":"#6b7280",accent:"#c79fbc","accent-text":"#1f1020","accent-soft":"#3b2836",focus:"#c79fbc",error:"#f6878b","error-soft":"#3a1214",edge:"#6b7280"}},"google-forms":{light:{font:`Roboto, Arial, ${Bn}`,text:"#202124",muted:"#5f6368",page:"#f0ebf8",surface:"#ffffff",border:"#dadce0","border-strong":"#80868b",accent:"#673ab7","accent-text":"#ffffff","accent-soft":"#ede7f6",focus:"#673ab7","focus-ring":"none",error:"#d93025","error-soft":"#fce8e6",radius:"8px","control-radius":"0px","control-height":"36px","pad-y":"6px","pad-x":"0px","input-border":"0 0 1px 0","label-weight":"400","gap-x":"24px","gap-y":"12px"},dark:{text:"#e8e3ee",muted:"#b8b0c4",page:"#1c1822",surface:"#2a2431",border:"#4a4255","border-strong":"#7b7088",accent:"#c4abf2","accent-text":"#1d1528","accent-soft":"#3b2f52",focus:"#c4abf2",error:"#f28b82","error-soft":"#3c1714",edge:"#7b7088"}}},Va=e=>Object.entries(e).map(([t,n])=>`--fd-${t}: ${n};`).join(" "),it=e=>`:is(.fd-form, .fd-form-dialog, .fd-theme)[data-fd-theme="${e}"]`,mi=':is(.fd-sections > .fd-section:not([data-style]), .fd-section[data-style="card"][data-on-page])',Ol=Object.keys(Pl).map(e=>{let{light:t,dark:n}=Pl[e],r=`${it(e)}[data-scheme="dark"]`;return`${it(e)} { ${Va(t)} }
|
|
7
|
+
${r} { ${Va(n)} }
|
|
8
|
+
@media (prefers-color-scheme: dark) { ${it(e)}[data-scheme="auto"] { ${Va(n)} } }`}).join(`
|
|
9
9
|
`).replace(/^/,`@layer fieldia-tokens {
|
|
10
10
|
`).concat(`
|
|
11
|
-
}`),
|
|
11
|
+
}`),Cl=`
|
|
12
12
|
/* A themed form paints its own ground, as one with a scheme does: Google Forms' lilac, Apple's grey. In a dialog, the dialog is its ground. */
|
|
13
13
|
.fd-form[data-fd-theme] { background: var(--fd-page); color: var(--fd-text); border-radius: var(--fd-radius); }
|
|
14
14
|
.fd-form[data-fd-theme] > .fd-content:not(:has(> .fd-sheet-page)) { padding: 20px; }
|
|
15
15
|
.fd-form-dialog-body > .fd-form[data-fd-theme] { background: none; border-radius: 0; }
|
|
16
16
|
.fd-form-dialog-body > .fd-form[data-fd-theme] > .fd-content:not(:has(> .fd-sheet-page)) { padding: 0; }
|
|
17
17
|
/* Material: boxes filled and underlined, the line thickening on focus; pill buttons; borderless tinted cards. */
|
|
18
|
-
${
|
|
19
|
-
${
|
|
20
|
-
${
|
|
21
|
-
${
|
|
22
|
-
${
|
|
18
|
+
${it("material")} .fd-input:not([readonly]) { background: var(--fd-fill); border-start-start-radius: var(--fd-control-radius); border-start-end-radius: var(--fd-control-radius); border-end-start-radius: 0; border-end-end-radius: 0; }
|
|
19
|
+
${it("material")} .fd-input:focus { box-shadow: inset 0 -1px 0 0 var(--fd-focus); }
|
|
20
|
+
${it("material")} .fd-button { border-radius: 20px; min-height: 40px; padding-inline: 24px; font-weight: 500; letter-spacing: 0.01em; border-color: var(--fd-border); }
|
|
21
|
+
${it("material")} .fd-tab[aria-selected="true"] { border-block-end-width: 3px; }
|
|
22
|
+
${it("material")} ${mi} { border-color: transparent; background: color-mix(in srgb, var(--fd-accent) 4%, var(--fd-surface)); }
|
|
23
23
|
|
|
24
24
|
/* Fluent: a darker bottom edge under every box, an accent bar on focus; semibold buttons; the picked tab in words, not the accent. */
|
|
25
|
-
${
|
|
26
|
-
${
|
|
27
|
-
${
|
|
28
|
-
${
|
|
25
|
+
${it("fluent")} .fd-input:not([readonly]) { border-block-end-color: var(--fd-border-strong); }
|
|
26
|
+
${it("fluent")} .fd-input:focus { box-shadow: inset 0 -2px 0 0 var(--fd-focus); border-block-end-color: var(--fd-focus); }
|
|
27
|
+
${it("fluent")} .fd-button { font-weight: 600; }
|
|
28
|
+
${it("fluent")} .fd-tab[aria-selected="true"] { color: var(--fd-text); border-block-end-width: 3px; }
|
|
29
29
|
|
|
30
30
|
/* Apple: boxes filled, no frame until focused; pill buttons; grouped cards with no edge. */
|
|
31
|
-
${
|
|
32
|
-
${
|
|
33
|
-
${
|
|
34
|
-
${
|
|
31
|
+
${it("apple")} .fd-input:not([readonly]) { background: var(--fd-fill); border-color: transparent; }
|
|
32
|
+
${it("apple")} .fd-input:not([readonly]):focus { background: var(--fd-surface); border-color: var(--fd-focus); }
|
|
33
|
+
${it("apple")} .fd-button { border-radius: 980px; padding-inline: 18px; font-weight: 500; }
|
|
34
|
+
${it("apple")} ${mi} { border-color: transparent; }
|
|
35
35
|
|
|
36
36
|
/* Bootstrap: its buttons' weight and padding. */
|
|
37
|
-
${
|
|
37
|
+
${it("bootstrap")} .fd-button { padding-inline: 12px; }
|
|
38
38
|
|
|
39
39
|
/* shadcn: a hairline shadow under boxes and buttons; the picked tab a raised segment on a grey strip. */
|
|
40
|
-
${
|
|
41
|
-
${
|
|
42
|
-
${
|
|
43
|
-
${
|
|
44
|
-
${
|
|
45
|
-
${
|
|
46
|
-
${
|
|
47
|
-
${
|
|
40
|
+
${it("shadcn")} :is(.fd-input:not([readonly]), .fd-button:not(.fd-button-link)) { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
|
|
41
|
+
${it("shadcn")} .fd-input:focus { box-shadow: var(--fd-focus-ring); }
|
|
42
|
+
${it("shadcn")} .fd-button { font-weight: 500; }
|
|
43
|
+
${it("shadcn")} .fd-button:hover { color: var(--fd-text); background: var(--fd-accent-soft); border-color: var(--fd-border); }
|
|
44
|
+
${it("shadcn")} .fd-button-primary:hover { color: var(--fd-accent-text); background: var(--fd-accent); filter: brightness(1.25); }
|
|
45
|
+
${it("shadcn")} .fd-tablist { gap: 2px; padding: 3px; border: 0; border-radius: var(--fd-radius); background: var(--fd-accent-soft); width: max-content; max-width: 100%; }
|
|
46
|
+
${it("shadcn")} .fd-tab { border: 0; margin: 0; padding: 5px 12px; border-radius: calc(var(--fd-radius) - 3px); color: var(--fd-muted); }
|
|
47
|
+
${it("shadcn")} .fd-tab[aria-selected="true"] { color: var(--fd-text); background: var(--fd-surface); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); font-weight: 500; }
|
|
48
48
|
|
|
49
49
|
/* Odoo: square buttons with small corners. */
|
|
50
|
-
${
|
|
50
|
+
${it("odoo")} .fd-button { border-radius: 4px; }
|
|
51
51
|
|
|
52
52
|
/* Google Forms: the title a card with a band of the accent along its top; each question its own card; answers underlined. */
|
|
53
|
-
${
|
|
54
|
-
${
|
|
55
|
-
${
|
|
56
|
-
${
|
|
57
|
-
${
|
|
58
|
-
${
|
|
59
|
-
${
|
|
60
|
-
${
|
|
61
|
-
${
|
|
62
|
-
`;var Jf={medium:760,narrow:520},Gf='@layer fieldia-tokens{.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){--fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;--fd-text: #212529;--fd-muted: #636976;--fd-page: #f2f3f5;--fd-surface: #ffffff;--fd-border: #cfd4da;--fd-border-strong: #9aa3ad;--fd-accent: #002855;--fd-accent-text: #ffffff;--fd-accent-soft: #e6ebf2;--fd-focus: #002855;--fd-focus-ring: none;--fd-error: #c62828;--fd-error-soft: #fdecea;--fd-success: #2e7d32;--fd-success-soft: #e8f5e9;--fd-warning: #8a5300;--fd-warning-soft: #fff4e0;--fd-info: #0b5cad;--fd-info-soft: #e7f0fb;--fd-radius: 0px;--fd-control-radius: 0px;--fd-pad-y: 3px;--fd-pad-x: 4px;--fd-input-border: 0 0 1px 0;--fd-label-weight: 600;--fd-gap-x: 32px;--fd-gap-y: 14px}:is(.fd-form,.fd-theme):is([data-fd-skin=outlined],[data-fd-skin=quiet]){--fd-text: rgba(0, 0, 0, .88);--fd-muted: rgba(0, 0, 0, .55);--fd-page: #f5f5f5;--fd-border: #d9d9d9;--fd-border-strong: #bfbfbf;--fd-accent: #1365d9;--fd-accent-soft: #e6f4ff;--fd-focus: #1365d9;--fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, .12);--fd-error: #c63c3d;--fd-error-soft: #fff2f0;--fd-radius: 8px;--fd-control-radius: 6px;--fd-pad-y: 4px;--fd-pad-x: 11px;--fd-input-border: 1px;--fd-label-weight: 400;--fd-gap-x: 24px;--fd-gap-y: 18px}:is(.fd-form,.fd-theme)[data-fd-skin=quiet]{--fd-pad-x: 8px}}.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){container-type:inline-size;font-family:var(--fd-font);font-size:14px;line-height:1.45;color:var(--fd-text);-webkit-text-size-adjust:100%}.fd-form *,.fd-form *:before,.fd-form *:after{box-sizing:border-box}.fd-form [hidden]{display:none!important}.fd-page-head{display:grid;gap:4px;margin-block-end:20px}.fd-page-title{font-size:22px;font-weight:650;margin:0;line-height:1.25}.fd-page-description{color:var(--fd-muted);margin:0}.fd-form[data-max-width=narrow]{--fd-page-max: 640px}.fd-form[data-max-width=medium]{--fd-page-max: 900px}.fd-form[data-max-width=wide]{--fd-page-max: 1180px}.fd-form[data-max-width=full]{--fd-page-max: none}.fd-form[data-max-width]>.fd-content:not(:has(>.fd-sheet-page)){max-width:var(--fd-page-max);margin-inline:auto}.fd-actions.fd-actions-top{margin-block-start:0;padding-block-end:14px;margin-block-end:18px;border-block-end:1px solid var(--fd-border)}.fd-icon{width:1.15em;height:1.15em;flex:none;vertical-align:-.2em}.fd-section-title .fd-icon,.fd-tab .fd-icon,.fd-button .fd-icon,.fd-step-title .fd-icon{margin-inline-end:.4em}.fd-section-title .fd-icon{color:var(--fd-muted)}.fd-grid{--fd-cols: var(--fd-columns, 1);--fd-span: 1;display:grid;grid-template-columns:repeat(var(--fd-cols),minmax(0,1fr));gap:var(--fd-gap-y) var(--fd-gap-x);align-items:start}.fd-grid>*{grid-column:span min(var(--fd-span, 1),var(--fd-cols))}.fd-grid[data-twelfths]{column-gap:min(var(--fd-gap-x),100% / 24)}.fd-field{display:grid;gap:4px;min-width:0}.fd-label{font-weight:var(--fd-label-weight);color:var(--fd-text)}.fd-valid-mark{color:var(--fd-success);width:1em;height:1em;margin-inline-start:6px;vertical-align:-.15em;stroke-width:2.4}.fd-field.fd-required>.fd-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:after{content:none}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:before{content:"*";margin-inline-end:.25em;color:var(--fd-error)}.fd-help{color:var(--fd-muted);font-size:12.5px}.fd-help-tip-wrap{position:relative;display:inline-flex;vertical-align:.05em;margin-inline-start:6px}.fd-label>.fd-help-tip-wrap{position:absolute;margin-block-start:.15em}.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:22px}.fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap):after{padding-inline-start:22px}.fd-form:not([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:0}.fd-help-tip{all:unset;box-sizing:border-box;display:inline-grid;place-items:center;width:16px;height:16px;border:1px solid var(--fd-border);border-radius:50%;color:var(--fd-muted);font-size:11px;font-weight:600;line-height:1;cursor:help}.fd-help-tip:hover,.fd-help-tip[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-help-tip:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-help-bubble{position:absolute;inset-block-start:calc(100% + 6px);inset-inline-start:-8px;z-index:30;width:max-content;max-width:min(280px,calc(100vw - 16px));padding:6px 9px;border-radius:6px;background:var(--fd-text);color:var(--fd-surface);font-size:12.5px;font-weight:400;line-height:1.4;white-space:normal;box-shadow:0 6px 18px #0000002e}.fd-page-title,.fd-page-description,.fd-section-description,.fd-label,.fd-help,.fd-text-heading,.fd-text-paragraph,.fd-text-note,.fd-choice>span{unicode-bidi:plaintext;text-align:match-parent;text-align:-webkit-match-parent}.fd-error{color:var(--fd-error);font-size:12.5px}.fd-warning{color:var(--fd-warning);background:var(--fd-warning-soft);font-size:12.5px;padding:3px 8px;border-radius:var(--fd-control-radius);justify-self:start}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr);column-gap:12px}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]>*{grid-column:1!important}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>:not(.fd-label){grid-column:2}.fd-form[data-fd-skin=underline] .fd-section[data-row=skin]{--fd-row-label: var(--fd-label-width, 11em);--fd-row-gap: 12px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row=beside]{--fd-row-label: var(--fd-label-width, 140px);--fd-row-gap: 14px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row]{padding-inline-start:calc(var(--fd-row-label, 0px) + var(--fd-row-gap, 0px))}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child{grid-template-columns:minmax(0,1fr);position:relative}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>:not(.fd-label){grid-column:1}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>.fd-label{position:var(--fd-row-place, static);inset-inline-start:calc(-1 * (var(--fd-row-label, 0px) + var(--fd-row-gap, 0px)));inset-block-start:0;width:var(--fd-row-label, auto);padding-block-start:var(--fd-row-drop, 0px)}@container (max-width: 760px){.fd-form[data-fd-skin=underline] .fd-grid{--fd-cols: 1}.fd-form .fd-grid[data-columns-medium]{--fd-cols: var(--fd-columns-medium)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels]))>*{grid-column:1!important}}@container (max-width: 520px){.fd-grid{--fd-cols: 1}.fd-form .fd-section.fd-section[data-row]{--fd-row-label: auto;--fd-row-gap: 0px;--fd-row-place: static;--fd-row-drop: 0px}.fd-form .fd-section[data-row]{padding-inline-start:0}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>*{grid-column:1!important}.fd-form .fd-grid[data-columns-medium],.fd-form .fd-grid[data-columns-narrow]{--fd-cols: var(--fd-columns-narrow, 1)}.fd-form .fd-file-viewer>:first-child{padding-inline-end:16px}.fd-form .fd-file-viewer h2{flex-basis:100%;margin-inline-end:36px}}.fd-input{width:100%;min-width:0;font:inherit;color:inherit;background:var(--fd-surface);border:solid var(--fd-border);border-width:var(--fd-input-border);border-radius:var(--fd-control-radius);padding:var(--fd-pad-y) var(--fd-pad-x);min-height:var(--fd-control-height, 30px);text-overflow:ellipsis;transition:border-color .15s ease,box-shadow .15s ease}.fd-input::placeholder{color:var(--fd-muted);opacity:.8}.fd-input:hover{border-color:var(--fd-border-strong)}.fd-input:focus{outline:none;border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-form[data-fd-skin=underline] .fd-input{background:transparent}.fd-form[data-fd-skin=underline] .fd-input:focus{box-shadow:0 1px 0 0 var(--fd-focus)}.fd-form[data-fd-skin=underline] .fd-field.fd-required:not([data-quiet]) .fd-input{border-color:var(--fd-accent)}.fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-input[readonly]{background:color-mix(in srgb,var(--fd-text) 5%,var(--fd-surface));border-color:var(--fd-border);padding-inline:var(--fd-pad-x);color:var(--fd-muted)}.fd-form[data-readonly] .fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text)}.fd-form[data-readonly] .fd-input::placeholder{color:transparent}.fd-input[readonly]::placeholder,.fd-form .fd-input.fd-blank[readonly]{color:transparent}.fd-blank[readonly]::-webkit-calendar-picker-indicator{display:none}.fd-form[data-readonly] select.fd-input:disabled{appearance:none;background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text);opacity:1}.fd-input[aria-invalid=true]{border-color:var(--fd-error)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-input[aria-invalid=true]:focus{box-shadow:0 0 0 2px #ff26050f}.fd-textarea{resize:vertical;min-height:64px}.fd-select{appearance:auto}.fd-number{display:flex;align-items:baseline;gap:6px}.fd-number-input{font-variant-numeric:tabular-nums}.fd-currency{color:var(--fd-muted);font-size:12.5px;font-weight:600}.fd-currency-after>.fd-number-input{text-align:end}.fd-currency-picked{align-items:center}.fd-currency-picked>:not(.fd-number-input){flex:0 0 104px;min-width:0}.fd-currency-picked>.fd-number-input{flex:1 1 auto;min-width:0}.fd-pending{color:var(--fd-muted);font-style:italic}.fd-pending:empty:before{content:"\u2014"}.fd-checkbox,.fd-choice input{width:16px;height:16px;accent-color:var(--fd-accent);margin:0}.fd-switch{appearance:none;width:34px;height:20px;margin:0;border-radius:999px;position:relative;background:var(--fd-border-strong);cursor:pointer;transition:background .2s ease}.fd-switch:after{content:"";position:absolute;inset-block-start:2px;inset-inline-start:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .2s ease;box-shadow:0 1px 2px #00000040}.fd-switch:checked{background:var(--fd-accent)}.fd-switch:checked:after{transform:translate(14px)}[dir=rtl] .fd-switch:checked:after{transform:translate(-14px)}.fd-choices{display:flex;flex-wrap:wrap;gap:6px 18px}.fd-choice{display:inline-flex;align-items:center;gap:8px;cursor:pointer}.fd-choice-other{cursor:default;flex:1 1 260px;max-width:420px;min-width:0}.fd-choice-other-pick{display:inline-flex;align-items:center;gap:8px;cursor:pointer;flex:none}.fd-choice-other .fd-other-input{flex:1;min-width:6em;width:auto;min-height:30px;padding-block:2px}.fd-scale-box{display:inline-grid;gap:4px;max-width:100%}.fd-scale-ends{display:flex;justify-content:space-between;gap:16px;font-size:12.5px;color:var(--fd-muted)}.fd-choices-box{display:grid;gap:6px;min-width:0}.fd-choice-clear{justify-self:end;font:inherit;font-size:13px;color:var(--fd-muted);background:none;border:0;padding:2px 4px;border-radius:4px;cursor:pointer}.fd-choice-clear:hover{color:var(--fd-text);text-decoration:underline;text-underline-offset:3px}.fd-lines-table .fd-choice-clear,.fd-grid-editor .fd-choice-clear{display:none}.fd-points{display:flex;flex-wrap:wrap;gap:6px}.fd-points button{font:inherit;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text);border-radius:var(--fd-control-radius);min-width:34px;height:34px;padding:0 8px}.fd-points button.fd-on{background:var(--fd-accent);color:var(--fd-accent-text);border-color:var(--fd-accent)}.fd-rating button{border:none;background:none;font-size:24px;color:var(--fd-border-strong);padding:0 2px;min-width:0}.fd-rating button.fd-on{background:none;color:#f5a623}.fd-points button:disabled,.fd-choice input:disabled{cursor:default}.fd-form :focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-form .fd-input:focus-visible{outline:none}.fd-combo{position:relative;display:flex;align-items:center;min-width:0}.fd-combo-input{padding-inline-end:30px}.fd-combo-clear{position:absolute;inset-inline-end:3px;border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-clear:hover{color:var(--fd-text);background:var(--fd-page)}.fd-combo:has(>.fd-combo-open:not([hidden])) .fd-combo-input{padding-inline-end:56px}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]) .fd-combo-input[readonly]{padding-inline-end:var(--fd-pad-x)}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]):has(>.fd-combo-open:not([hidden])) .fd-combo-input[readonly]{padding-inline-end:30px}.fd-combo:has(>.fd-combo-input[readonly])>.fd-combo-clear[hidden]~.fd-combo-open{inset-inline-end:3px}.fd-combo-open{position:absolute;inset-inline-end:29px;border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-open:hover{background:var(--fd-page)}.fd-listbox{position:absolute;inset-inline:0;inset-block-start:calc(100% + 2px);z-index:20;margin:0;padding:4px 0;list-style:none;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;max-height:240px;overflow-y:auto}.fd-option{padding:6px 12px;cursor:pointer}.fd-option:hover,.fd-option.fd-active{background:var(--fd-accent-soft)}.fd-option-create{color:var(--fd-accent);border-block-start:1px solid var(--fd-border)}.fd-empty{padding:6px 12px;color:var(--fd-muted);font-style:italic}.fd-tags{display:flex;flex-wrap:wrap;gap:6px;align-items:center;min-width:0}.fd-chips{display:contents;list-style:none;margin:0;padding:0}.fd-chip{display:inline-flex;align-items:center;gap:4px;padding:1px 4px 1px 10px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-text);font-size:13px;line-height:22px}button.fd-chip-label{border:none;padding:0;background:none;font:inherit;color:inherit;cursor:pointer}button.fd-chip-label:hover{text-decoration:underline}.fd-chip-remove{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:0 4px;border-radius:999px}.fd-chip-remove:hover{color:var(--fd-error)}.fd-tags .fd-combo{flex:1 1 140px}.fd-reference{display:grid;grid-template-columns:minmax(7em,34%) minmax(0,1fr);gap:8px}.fd-lines{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;min-width:0}.fd-lines-scroll{overflow-x:auto;min-width:0;position:relative}.fd-lines-table{width:100%;border-collapse:collapse;font-size:13.5px}.fd-lines-table th{text-align:start;font-weight:600;color:var(--fd-muted);font-size:12.5px;padding:6px 8px;border-block-end:1px solid var(--fd-border);white-space:nowrap}.fd-lines-table td{padding:4px 8px;border-block-end:1px solid var(--fd-border);vertical-align:top;min-width:7em}.fd-lines-table td.fd-lines-tools,.fd-lines-table th.fd-lines-tools{width:32px;min-width:32px;padding-inline:0;text-align:center}.fd-lines-table .fd-input{min-height:28px}.fd-lines-table td>.fd-checkbox,.fd-lines-table td>.fd-switch{margin-block-start:6px}.fd-lines-table .fd-lines-grip{width:1px;min-width:0;padding-inline:6px 2px}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td):is(.fd-lines-grip,.fd-lines-tools){position:sticky;z-index:1;background-color:var(--fd-surface)}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-grip{inset-inline-start:0}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-tools{inset-inline-end:0}.fd-lines-table td[data-fit]{min-width:0}.fd-lines-table thead th:not(.fd-lines-grip,.fd-lines-tools){white-space:normal}.fd-lines-table thead th{vertical-align:bottom}.fd-lines-table th[data-fit=boolean]{width:5em;min-width:5em}.fd-lines-table th[data-fit=integer]{width:max(7em,var(--fd-fit-need, 0px));min-width:max(7em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=float]{width:max(7.5em,var(--fd-fit-need, 0px));min-width:max(7.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=monetary]{width:max(11.5em,var(--fd-fit-need, 0px));min-width:max(11.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=date]{width:9em;min-width:9em}.fd-lines-table th[data-fit=datetime]{width:12.5em;min-width:12.5em}.fd-lines-table th:is([data-fit=integer],[data-fit=float],[data-fit=monetary]){text-align:end}.fd-lines-table td:is([data-fit=integer],[data-fit=float],[data-fit=monetary]) input{text-align:end}@media(hover:hover)and (pointer:fine){.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) .fd-input:not([aria-invalid=true]){border-color:transparent;background-color:transparent;box-shadow:none}.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) :is(.fd-combo-open,.fd-combo-clear){visibility:hidden}}.fd-line-grip{display:block;margin-block-start:7px;cursor:grab}.fd-lines-dragging,.fd-lines-dragging *{cursor:grabbing;user-select:none}.fd-lines-dragging>tr:not(.fd-line-lifted){transition:transform .15s ease}.fd-line-lifted{position:relative;z-index:2;box-shadow:0 6px 18px #0f141929}.fd-line-lifted>td{background:var(--fd-surface)}.fd-line-delete{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:4px 6px;border-radius:4px;min-width:24px;min-height:24px}.fd-line-delete:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-lines-table [data-tone=info]{--fd-line-tone: var(--fd-info);--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-lines-table [data-tone=success]{--fd-line-tone: var(--fd-success);--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-lines-table [data-tone=warning]{--fd-line-tone: var(--fd-warning);--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-lines-table [data-tone=danger]{--fd-line-tone: var(--fd-error);--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-lines-table [data-tone=muted]{--fd-line-tone: var(--fd-muted);--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-lines-table [data-tone] :is(input,select,textarea,.fd-input,.fd-display){color:var(--fd-line-tone);-webkit-text-fill-color:var(--fd-line-tone)}.fd-lines-table :is(.fd-line-bold,.fd-cell-bold) :is(input,select,textarea,.fd-input,.fd-display){font-weight:600}.fd-lines-table td.fd-lines-tools{white-space:nowrap}.fd-lines-table:has(.fd-line-button) td.fd-lines-tools{text-align:end;padding-inline-end:4px}.fd-line-button{padding:2px 6px;font-size:12.5px;vertical-align:middle}.fd-line-button-icon{padding:4px;color:var(--fd-muted)}.fd-line-button-icon:hover{color:var(--fd-accent)}.fd-line-button svg{width:15px;height:15px;display:block}.fd-lines-totals td{padding:8px;font-weight:600;border-block-start:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-lines-adds{display:flex;flex-wrap:wrap;gap:4px 16px;justify-self:start}.fd-lines-control{display:inline-flex;align-items:center;gap:6px}.fd-lines-control svg,.fd-lines-chosen-button svg{width:15px;height:15px}.fd-line-lead{display:inline-flex;align-items:center;gap:4px;margin-block-start:6px}.fd-line-lead .fd-line-grip{margin-block-start:0}.fd-lines-table th.fd-lines-grip:has(.fd-line-pick-all){padding-block:4px}.fd-lines-chosen{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:6px 10px;border-radius:var(--fd-radius);background:var(--fd-accent-soft)}.fd-lines-chosen[hidden]{display:none}.fd-lines-chosen-count{font-weight:600;font-size:13px;margin-inline-end:6px}.fd-lines-chosen-button{display:inline-flex;align-items:center;gap:6px;padding-block:3px}.fd-lines-table .fd-line-open{border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:4px 6px;border-radius:4px}.fd-lines-table .fd-line-open:hover{background:var(--fd-accent-soft)}.fd-links-table td{vertical-align:middle}.fd-links-table .fd-value-text{padding-block:4px}.fd-lines[data-fit=content] .fd-lines-table{width:auto;max-width:100%}.fd-lines[data-fit=content] .fd-lines-table td{min-width:0}.fd-lines[data-cards]{container:fd-lines / inline-size}@container fd-lines (max-width: 520px){.fd-lines[data-cards=narrow] .fd-lines-table,.fd-lines[data-cards=narrow] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=narrow] .fd-lines-table thead{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr{display:grid;grid-template-columns:minmax(0,1fr);gap:4px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=narrow] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=narrow] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip .fd-line-grip{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr:has(.fd-line-pick){padding-inline-start:36px}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-tools{width:auto;text-align:end}.fd-lines[data-cards=narrow] .fd-lines-totals td:empty{display:none}}.fd-lines[data-cards=always] .fd-lines-table,.fd-lines[data-cards=always] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=always] .fd-lines-table thead{display:none}.fd-lines[data-cards=always] .fd-lines-table tr{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:6px 12px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=always] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=always] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-grip,.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{grid-column:1 / -1;width:auto}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{text-align:end}.fd-line-copy{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:4px 6px;border-radius:4px}.fd-line-copy:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-line-section td{background:var(--fd-page)}.fd-line-section .fd-input{font-weight:600}.fd-line-note .fd-input{font-style:italic}.fd-cell-error{color:var(--fd-error);font-size:12px}.fd-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-file{display:grid;gap:8px;justify-items:start;padding:6px 0;border-radius:var(--fd-control-radius);min-width:0}.fd-file.fd-dragging{outline:2px dashed var(--fd-accent);outline-offset:4px}.fd-file-pick{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center;cursor:pointer}.fd-file input:focus-visible+.fd-file-pick{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-files-list .fd-file-pick{justify-self:stretch;padding:10px 14px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-pick:hover,.fd-dragging .fd-file-pick{border-color:var(--fd-accent)}.fd-files{list-style:none;margin:0;padding:0;display:grid;gap:6px;justify-self:stretch;min-width:0}.fd-files:empty{display:none}.fd-file-item{position:relative;display:flex;align-items:center;gap:2px;min-width:0}.fd-file-open{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding:5px 8px;font:inherit;color:inherit;text-align:start;cursor:pointer;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius)}.fd-file-open:hover{border-color:var(--fd-accent)}.fd-file-thumb,.fd-file-icon{flex:none;width:36px;height:36px;border-radius:3px;object-fit:cover}.fd-file-icon{display:grid;place-items:end center;padding-block-end:4px;font-size:9px;font-weight:700;color:#fff;background:var(--fd-kind, #5b6573);clip-path:polygon(0 0,68% 0,100% 28%,100% 100%,0 100%)}.fd-file-icon[data-kind=pdf]{--fd-kind: #c62828}.fd-file-icon[data-kind=doc]{--fd-kind: #1f5fbf}.fd-file-icon[data-kind=sheet]{--fd-kind: #1d7a3e}.fd-file-icon[data-kind=zip]{--fd-kind: #8a5300}.fd-file-name{flex:1;display:flex;min-width:0;white-space:pre}.fd-file-name>span{overflow:hidden;text-overflow:ellipsis}.fd-file-size{color:var(--fd-muted);font-size:12.5px;font-variant-numeric:tabular-nums;unicode-bidi:plaintext}.fd-file-remove{flex:none;width:32px;height:32px;border:none;border-radius:999px;background:none;color:var(--fd-muted);font-size:20px;line-height:1;cursor:pointer}.fd-file-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-file-confirm:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px}.fd-file-note:empty{display:none}.fd-file-note{color:var(--fd-warning)}.fd-file-bar{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;justify-self:stretch}.fd-file-views{display:flex;gap:2px;margin-inline-start:auto;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-views button{display:flex;align-items:center;gap:6px;min-height:28px;padding:2px 10px;font:inherit;font-size:13px;color:var(--fd-muted);cursor:pointer;border:none;border-radius:calc(var(--fd-control-radius) - 2px);background:none}.fd-file-views [aria-pressed=true]{color:var(--fd-text);background:var(--fd-surface);box-shadow:0 0 0 1px var(--fd-border)}.fd-files-thumbs{display:flex;flex-wrap:wrap;align-items:flex-start}.fd-files-thumbs>*{flex-basis:100%}:is(.fd-files-thumbs,.fd-files-cards)>.fd-files{display:contents}.fd-files-thumbs .fd-file-item,.fd-image-pick{flex:none;width:96px;height:96px}.fd-files-thumbs .fd-file-open{height:100%;padding:6px;flex-direction:column;justify-content:center;gap:4px;overflow:hidden;font-size:12px}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-thumb{position:absolute;inset:0;width:100%;height:100%;border-radius:inherit}.fd-files-thumbs .fd-file-name{flex:none;max-width:100%}.fd-files-thumbs .fd-file-size,.fd-files-thumbs .fd-file-thumb~*{display:none}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-remove{position:absolute;inset-block-start:4px;inset-inline-end:4px;width:26px;height:26px;font-size:17px;background:#0f14199e;color:#fff;opacity:0}.fd-file-item:is(:hover,:focus-within) .fd-file-remove{opacity:1}@media(hover:none){.fd-file-item .fd-file-remove{opacity:1}}.fd-image-pick{display:grid;place-content:center;justify-items:center;gap:2px;padding:6px;text-align:center;font-size:12px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-files-cards{grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-files-cards>*{grid-column:1 / -1}.fd-files-cards>.fd-image-pick{grid-column:auto;justify-self:stretch;width:auto;height:auto;min-height:96px}.fd-files-cards .fd-file-item{justify-self:stretch;align-items:stretch}.fd-files-cards .fd-file-open{flex-direction:column;align-items:stretch;gap:2px;padding:0 0 8px;overflow:hidden}.fd-file-picture{position:relative;display:grid;place-items:center;aspect-ratio:4 / 3;margin-block-end:6px;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-file-picture .fd-file-icon{width:44px;height:56px;padding-block-end:8px;font-size:12px}.fd-files-cards :is(.fd-file-name,.fd-file-size){padding-inline:8px}.fd-files-cards .fd-file-name{flex:none;flex-wrap:wrap;font-size:13px;line-height:1.35}.fd-files-cards .fd-file-name>span{max-width:100%}.fd-image-pick .fd-button{border:none;background:none;color:var(--fd-accent);padding:0;min-height:0;font-size:13px}.fd-file-viewer{max-width:1000px;height:min(88vh,100%);background:var(--fd-surface)}.fd-file-viewer>:first-child{position:relative;flex-wrap:wrap;justify-content:start;gap:6px 10px;padding-block:8px;padding-inline-end:52px}.fd-file-viewer .fd-dialog-close{position:absolute;inset-block-start:10px;inset-inline-end:10px}.fd-file-viewer h2{flex:1 1 10em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-file-step{font-size:18px;line-height:1;min-width:34px}.fd-file-viewer a{text-decoration:none}.fd-file-viewer-body{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto;background:var(--fd-page)}.fd-file-viewer-body img{max-width:100%;max-height:100%;object-fit:contain}.fd-file-viewer-body :is(iframe,pre){flex:1;align-self:stretch;margin:0;border:0;background:var(--fd-surface)}.fd-file-viewer-body pre{padding:14px 16px;overflow:auto;font:13px/1.5 monospace;white-space:pre-wrap;overflow-wrap:anywhere}.fd-file-none{display:grid;justify-items:center;gap:4px;padding:24px;text-align:center;color:var(--fd-muted)}.fd-file-none strong{color:var(--fd-text);overflow-wrap:anywhere}.fd-file-none .fd-file-icon{width:64px;height:64px;font-size:14px;padding-block-end:8px}.fd-richtext{min-height:96px;line-height:1.5;overflow-wrap:anywhere}.fd-richtext-box{display:grid;gap:0;min-width:0}.fd-richtext-box>.fd-richtext{border-start-start-radius:0;border-start-end-radius:0}.fd-richtext-bar{display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:4px;min-width:0;border:1px solid var(--fd-border);border-block-end:none;border-start-start-radius:var(--fd-control-radius);border-start-end-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-richtext-style{font:inherit;font-size:12.5px;padding:3px 6px;margin-inline-end:4px;border:1px solid var(--fd-border);border-radius:4px;background:var(--fd-surface);color:var(--fd-text)}.fd-richtext-tool{display:grid;place-items:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:14px}.fd-richtext-tool:hover{background:var(--fd-surface)}.fd-richtext-tool[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-richtext-tool svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round}.fd-richtext-tool svg circle{fill:currentColor;stroke:none}.fd-link-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:6px;border:1px solid var(--fd-border);border-block-end:none;background:var(--fd-surface)}.fd-link-row>.fd-input{flex:1 1 200px;min-width:0}.fd-richtext.fd-blank[contenteditable=true]:before{content:attr(data-placeholder);position:absolute;color:var(--fd-muted);opacity:.8;pointer-events:none}.fd-richtext[contenteditable=false]{background:transparent;border-color:transparent;padding-inline:0;min-height:0}.fd-richtext p{margin:0 0 6px}textarea.fd-code{font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:12.5px;min-height:96px}.fd-sections{display:grid;gap:var(--fd-gap-block, 24px)}.fd-section{border:0;margin:0;padding:0;min-width:0;display:grid;gap:14px}.fd-section-title{font-size:15px;font-weight:650;padding:0;margin:0;float:inline-start;width:100%}.fd-section-title+*{clear:both}.fd-form[data-fd-skin=underline] .fd-section-title{text-transform:uppercase;letter-spacing:.05em;font-size:12.5px;color:var(--fd-muted);border-block-end:1px solid var(--fd-border);padding-block-end:6px;width:100%}.fd-section-description{color:var(--fd-muted);margin:0}.fd-section-toggle{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;gap:8px;text-align:start}.fd-section-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-section-chevron{width:.5em;height:.5em;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg);margin-block-start:-.2em;transition:transform .15s ease;flex:none}.fd-section-folded .fd-section-chevron{transform:rotate(-45deg);margin-block-start:0}[dir=rtl] .fd-section-folded .fd-section-chevron{transform:rotate(135deg)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:var(--fd-group-pad, 20px 24px)}.fd-form-part-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-form-part-problem{padding:10px 12px;border:1px dashed var(--fd-border);border-radius:var(--fd-radius)}.fd-tablist{display:flex;gap:2px;border-block-end:1px solid var(--fd-border);overflow-x:auto;scrollbar-width:none}.fd-tablist::-webkit-scrollbar{display:none}.fd-tabbar{position:relative;min-width:0;--fd-fade: to right}[dir=rtl] .fd-tabbar{--fd-fade: to left}.fd-tabbar[data-more=start]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px)}.fd-tabbar[data-more=end]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabbar[data-more="start end"]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px,#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabs-scroll{position:absolute;inset-block:0 1px;z-index:1;width:28px;padding:0;border:none;background:none;cursor:pointer;color:var(--fd-muted);display:grid;place-items:center}.fd-tabs-scroll[hidden]{display:none}.fd-tabs-scroll:hover{color:var(--fd-accent)}.fd-tabs-scroll:before{content:"";width:7px;height:7px;border:solid currentColor;border-width:0 0 2px 2px}.fd-tabs-before{inset-inline-start:0}.fd-tabs-after{inset-inline-end:0}.fd-tabs-before:before{transform:translate(2px) rotate(45deg)}.fd-tabs-after:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-before:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-after:before{transform:translate(2px) rotate(45deg)}.fd-tab{font:inherit;background:none;border:none;cursor:pointer;padding:8px 14px;color:var(--fd-muted);border-block-end:2px solid transparent;margin-block-end:-1px;white-space:nowrap}.fd-tab[aria-selected=true]{color:var(--fd-accent);border-block-end-color:var(--fd-accent);font-weight:600}.fd-tab[data-problem]:after{content:"";display:inline-block;width:6px;height:6px;margin-inline-start:6px;border-radius:50%;background:var(--fd-error);vertical-align:.15em}.fd-tabpanel{padding-block:16px;display:grid;gap:16px}.fd-button{font:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:6px;justify-content:center;min-height:var(--fd-control-height, 32px);padding:4px 14px;border-radius:var(--fd-control-radius);border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text)}.fd-button:hover{border-color:var(--fd-accent);color:var(--fd-accent)}.fd-button-primary{background:var(--fd-accent);border-color:var(--fd-accent);color:var(--fd-accent-text)}.fd-button-primary:hover{color:var(--fd-accent-text);filter:brightness(1.12)}.fd-button-danger{color:var(--fd-error);border-color:var(--fd-error)}.fd-button-danger:hover{background:var(--fd-error);color:var(--fd-surface)}.fd-button-link{border-color:transparent;background:none;color:var(--fd-accent);padding-inline:4px}.fd-form[data-fd-skin=underline] .fd-button{border-radius:3px}.fd-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.fd-actions-end{justify-content:flex-end;margin-block-start:24px}.fd-sheet-page{background:var(--fd-page);padding:0 0 32px;min-width:0}.fd-header{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;justify-content:space-between;background:var(--fd-surface);border-block-end:1px solid var(--fd-border);padding:8px 16px}.fd-statusbar{display:flex;list-style:none;margin:0;padding:0;overflow-x:auto}.fd-statusbar li{display:flex}.fd-statusbar li>*{font:inherit;font-size:13px;border:none;background:var(--fd-page);color:var(--fd-muted);padding:5px 18px 5px 22px;margin-inline-start:-6px;white-space:nowrap;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%,10px 50%)}.fd-statusbar li:first-child>*{margin-inline-start:0;padding-inline-start:14px;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%)}.fd-statusbar li>button{cursor:pointer}.fd-statusbar li>[aria-current=step]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}[dir=rtl] .fd-statusbar li>*{transform:scaleX(-1)}[dir=rtl] .fd-statusbar li>*>*{display:inline-block;transform:scaleX(-1)}.fd-sheet-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:16px;max-width:var(--fd-page-max, 1180px);margin:16px auto 0;padding-inline:16px}.fd-sheet-layout{align-items:start}.fd-sheet-foot{margin:4px -28px -28px;padding:12px 28px;border-block-start:1px solid var(--fd-border);border-end-start-radius:inherit;border-end-end-radius:inherit}@container (min-width: 1534px){.fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr) minmax(260px,360px);max-width:calc(var(--fd-page-max, 1180px) + 376px)}}.fd-sheet-layout.fd-has-side[data-side-beside=always]{grid-template-columns:minmax(0,1fr) minmax(260px,360px)}.fd-form{container-name:fd-form}@container fd-form (max-width: 520px){.fd-form [data-hide-on~=narrow]{display:none!important}}@container fd-form (min-width: 521px) and (max-width: 760px){.fd-form [data-hide-on~=medium]{display:none!important}}@container fd-form (min-width: 761px){.fd-form [data-hide-on~=wide]{display:none!important}}.fd-card{position:relative;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:24px 28px 28px;display:grid;gap:18px;min-width:0;container-type:inline-size}.fd-ribbon-frame{position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}.fd-ribbon{position:absolute;inset-block-start:18px;inset-inline-end:-42px;transform:rotate(45deg);width:160px;text-align:center;font-size:12px;font-weight:700;padding:4px 0;color:#fff;background:#5f6670;text-transform:uppercase;letter-spacing:.06em;pointer-events:none}[dir=rtl] .fd-ribbon{transform:rotate(-45deg)}.fd-ribbon.fd-tone-danger{background:#c63c3d}.fd-ribbon.fd-tone-success{background:#2e7d32}.fd-ribbon.fd-tone-warning{background:#a14f00}.fd-ribbon.fd-tone-info{background:#1365d9}.fd-alert{padding:10px 14px;border-radius:var(--fd-control-radius);border:1px solid;font-size:13.5px;display:flex;align-items:flex-start;gap:10px}.fd-alert-message{flex:1 1 auto;min-width:0}.fd-alert-close{border:none;background:none;color:inherit;cursor:pointer;font:inherit;font-size:18px;line-height:1;padding:0 4px;border-radius:4px;opacity:.75}.fd-alert-close:hover{opacity:1}.fd-alert-close:focus-visible{outline:2px solid var(--fd-focus);opacity:1}.fd-alert.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-alert.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-alert.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-alert.fd-tone-info,.fd-alert:not([class*=fd-tone-]){background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-stats{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:0;margin:-24px -28px 0;border-block-end:1px solid var(--fd-border)}.fd-stats:empty{display:none}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:104px}.fd-stat{font:inherit;background:none;border:none;border-inline-start:1px solid var(--fd-border);cursor:pointer;padding:8px 18px;display:grid;justify-items:start;line-height:1.2;color:var(--fd-text);min-width:120px}.fd-stat:hover{background:var(--fd-page)}.fd-stat:has(>.fd-icon){grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:10px}.fd-stat>.fd-icon{width:22px;height:22px;color:var(--fd-muted)}.fd-stat-words{display:grid;justify-items:start}.fd-stat-value{font-weight:700;font-size:15px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-stat-label{font-size:12.5px;color:var(--fd-muted)}.fd-title-row{display:flex;gap:16px;align-items:flex-start;justify-content:space-between}.fd-title{display:grid;gap:4px;flex:1 1 auto;min-width:0}.fd-avatar{flex:none}.fd-avatar>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form[data-fd-skin=underline] .fd-avatar{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-avatar>*{grid-column:1!important}.fd-avatar .fd-file{justify-items:center;gap:4px 8px;padding:0;justify-content:center}.fd-avatar :is(.fd-file-item,.fd-image-pick){width:88px;height:88px}.fd-avatar :is(.fd-image-pick .fd-help,.fd-file-limits){display:none}.fd-avatar .fd-button-link{flex-basis:auto;font-size:12.5px}.fd-title>.fd-field .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-form[data-fd-skin=underline] .fd-title>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-title>.fd-field>*{grid-column:1}.fd-title>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-above,.fd-title-below{display:flex;flex-wrap:wrap;align-items:center;gap:6px 24px}.fd-title-above{margin-block-end:4px}.fd-title-below{margin-block-start:6px}.fd-form .fd-title-above>.fd-field,.fd-form .fd-title-below>.fd-field{display:flex;align-items:center;gap:8px;grid-template-columns:none}.fd-form .fd-title-above>.fd-field>*,.fd-form .fd-title-below>.fd-field>*{grid-column:auto!important}.fd-title-above .fd-label:empty,.fd-title-below .fd-label:empty{display:none}.fd-title-above>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-statusbar{display:flex}.fd-badges{display:flex;flex-wrap:wrap;gap:6px}.fd-badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;line-height:1;padding:5px 10px;border-radius:999px;border:1px solid var(--fd-border);background:var(--fd-page);color:var(--fd-muted)}.fd-badge .fd-icon{width:13px;height:13px}.fd-badge.fd-tone-info{background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-badge.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-badge.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-badge.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-side{display:grid;gap:12px;align-content:start;min-width:0}.fd-wizard{display:grid;gap:20px}.fd-progress{display:grid;gap:8px}.fd-progress-text{color:var(--fd-muted);font-size:13px}.fd-value-text{display:block;padding-block:6px;font-variant-numeric:tabular-nums}.fd-field[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-field[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-field[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-field[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-field[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-field[data-tone] :is(input,select,textarea,.fd-value-text,.fd-pending){color:var(--fd-tone);-webkit-text-fill-color:var(--fd-tone)}.fd-field.fd-value-bold :is(input,select,textarea,.fd-value-text,.fd-pending,.fd-value-badge){font-weight:700}.fd-value-badge{justify-self:start;align-self:center;display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 10px;border-radius:999px;font-size:12.5px;line-height:18px;font-weight:500;color:var(--fd-tone, var(--fd-muted));background:var(--fd-tone-soft, color-mix(in srgb, var(--fd-tone, var(--fd-muted)) 14%, transparent))}.fd-value-badge[hidden]{display:none}.fd-value-badge[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-value-badge[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-value-badge[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-value-badge[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-value-badge[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-date-pick{position:relative;display:flex;align-items:center;gap:6px;min-width:0}.fd-date-pick>.fd-input{flex:1 1 auto;min-width:0}.fd-calendar-button{flex:0 0 auto;display:grid;place-items:center;width:32px;height:32px;padding:0;cursor:pointer;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface);color:var(--fd-muted)}.fd-calendar-button:hover,.fd-calendar-button[aria-expanded=true]{color:var(--fd-text);background:var(--fd-page)}.fd-calendar-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round}.fd-calendar{position:absolute;inset-block-start:calc(100% + 4px);inset-inline-end:0;z-index:30;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 8px 24px #0f141924}.fd-calendar-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 4px 6px}.fd-calendar-head button{border:none;background:none;cursor:pointer;font-size:18px;line-height:1;padding:4px 8px;border-radius:4px;color:var(--fd-text)}.fd-calendar-head button:hover{background:var(--fd-page)}.fd-calendar-title{font-weight:600}.fd-calendar-grid{border-collapse:collapse;font-variant-numeric:tabular-nums}.fd-calendar-grid th{font-size:11.5px;font-weight:600;color:var(--fd-muted);padding:4px 0;width:34px;text-align:center}.fd-calendar-grid .fd-week{color:var(--fd-accent);font-weight:600;border-inline-end:1px solid var(--fd-border)}.fd-calendar-grid td{padding:1px}.fd-calendar-grid td button{width:32px;height:30px;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:13px}.fd-calendar-grid td button:hover{background:var(--fd-accent-soft)}.fd-calendar-grid td button.fd-outside{color:var(--fd-muted);opacity:.6}.fd-calendar-grid td button[aria-current=date]{box-shadow:inset 0 0 0 1px var(--fd-accent)}.fd-calendar-grid td button[aria-selected=true]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}.fd-calendar-grid td button:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}.fd-properties{display:grid;gap:8px;min-width:0}.fd-property{display:grid;grid-template-columns:minmax(120px,30%) minmax(0,1fr);align-items:center;gap:12px;min-width:0}.fd-property>label{color:var(--fd-muted);font-size:13px}.fd-property[data-type=boolean]>:last-child{justify-self:start}.fd-form[data-fd-skin=underline] .fd-property{grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-property>label{color:var(--fd-text);font-size:inherit;font-weight:var(--fd-label-weight)}@container (max-width: 520px){.fd-property{grid-template-columns:minmax(0,1fr);gap:4px}}.fd-progressbar{position:relative;height:22px;min-width:120px;border-radius:999px;overflow:hidden;background:var(--fd-page);border:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-progressbar-fill{height:100%;background:var(--fd-success);transition:width .2s ease}.fd-progressbar[data-tone=warning] .fd-progressbar-fill{background:#d97706}.fd-progressbar[data-tone=danger] .fd-progressbar-fill{background:var(--fd-error)}.fd-progressbar[data-tone=info] .fd-progressbar-fill{background:var(--fd-info)}.fd-progressbar-text{position:absolute;inset-block:2px;left:50%;translate:-50% 0;display:grid;place-items:center;padding-inline:7px;border-radius:999px;background:var(--fd-surface);font-size:12px;line-height:1;font-weight:600;color:var(--fd-text)}.fd-progressbar-text:empty{display:none}.fd-progressbar-edit{display:flex;align-items:center;gap:12px;min-width:0}.fd-progressbar-edit>.fd-progressbar{flex:1 1 auto}.fd-progressbar-edit>.fd-input{flex:0 0 96px}.fd-progress-bar{height:4px;background:var(--fd-border);border-radius:999px;overflow:hidden}.fd-progress-bar>span{display:block;height:100%;background:var(--fd-accent);transition:width .25s ease}.fd-step{display:grid;gap:18px}.fd-step-title{font-size:18px;font-weight:650;margin:0}.fd-wizard-nav{display:flex;gap:8px;justify-content:space-between}.fd-steps-list{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:0;counter-reset:fd-step}.fd-steps-list>li{counter-increment:fd-step}.fd-step-link{font:inherit;font-size:13.5px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-muted);border-radius:999px;padding:4px 12px 4px 6px}.fd-step-link:before{content:counter(fd-step);display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--fd-page);color:var(--fd-muted);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}.fd-step-link:hover{border-color:var(--fd-accent);color:var(--fd-text)}.fd-step-link:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-step-link.fd-step-done{color:var(--fd-text)}.fd-step-link.fd-step-done:before{content:"\u2713";background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-step-link.fd-step-skipped{border-style:dashed;color:var(--fd-muted)}.fd-step-link.fd-step-skipped:before{content:"\u2013";background:var(--fd-page);color:var(--fd-muted)}.fd-step-link[aria-current=step]{border-color:var(--fd-accent);color:var(--fd-accent);font-weight:600}.fd-step-link[aria-current=step]:before{content:counter(fd-step);background:var(--fd-accent);color:var(--fd-accent-text)}.fd-wizard-nav .fd-spacer{flex:1}.fd-text-heading{font-size:16px;font-weight:650;margin:0}.fd-matrix{overflow-x:auto;max-width:100%}.fd-matrix-table{border-collapse:collapse;min-width:100%}.fd-matrix-table th,.fd-matrix-table td{padding:6px 10px;text-align:center;border-bottom:1px solid var(--fd-border)}.fd-matrix-table thead th{font-weight:500;font-size:13px;color:var(--fd-muted)}.fd-matrix-table tbody th{text-align:start;font-weight:500}.fd-matrix-table input{accent-color:var(--fd-accent);width:16px;height:16px;margin:0}.fd-divider{grid-column:1 / -1;width:100%;border:0;border-top:1px solid var(--fd-border);margin:4px 0}.fd-block{min-width:0}.fd-spacer{min-height:24px}.fd-image{display:block;max-width:100%;height:auto;border-radius:var(--fd-radius)}.fd-figure{display:grid;justify-items:start;gap:6px;margin:0}.fd-figure[data-align=center]{justify-items:center}.fd-figure[data-align=end]{justify-items:end}.fd-figure>a,.fd-figure .fd-image{width:var(--fd-image-width, auto);max-width:100%}.fd-figure>a{display:block;border-radius:var(--fd-radius)}.fd-caption{font-size:13px;color:var(--fd-muted)}.fd-text-paragraph{margin:0}.fd-text-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-status{min-height:1.4em;color:var(--fd-muted);font-size:13px}.fd-status-box{display:inline-flex;align-items:center;gap:6px;min-width:0}.fd-status-box .fd-retry{font-size:13px}.fd-announce{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-banner{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:10px 14px;margin-block-end:16px;border:1px solid #f0c47a;border-radius:var(--fd-control-radius);background:var(--fd-warning-soft);color:var(--fd-warning);font-size:13.5px}.fd-banner-text{flex:1 1 16em;min-width:0}.fd-content>.fd-banner:has(+.fd-draft+.fd-sheet-page),.fd-content>.fd-banner:has(+.fd-sheet-page){margin:12px 16px 0}.fd-status-box.fd-toast{position:fixed;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));inset-inline-end:20px;z-index:900;padding:10px 16px;border-radius:8px;background:var(--fd-text);box-shadow:0 8px 24px #0f141940}.fd-toast .fd-status,.fd-toast .fd-status.fd-status-saved,.fd-toast .fd-status.fd-status-error{color:var(--fd-surface);font-size:13.5px;min-height:0}.fd-toast .fd-retry{color:var(--fd-surface);text-decoration:underline}.fd-toast:has(.fd-status-error){background:var(--fd-error)}.fd-status-box.fd-status-bar{display:flex;justify-content:center;min-height:32px;padding:6px 16px;background:var(--fd-surface);border-block-end:1px solid var(--fd-border)}.fd-status-bar .fd-status-error,.fd-status.fd-status-error{color:var(--fd-error)}.fd-status.fd-status-saved{color:var(--fd-success)}.fd-draft{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;padding:10px 14px;margin-block-end:16px;background:var(--fd-info-soft);border:1px solid #a9c8ef;border-radius:var(--fd-control-radius)}.fd-done{padding:40px 0;text-align:center;display:grid;gap:12px;justify-items:center}.fd-done-title{font-size:20px;font-weight:650;margin:0}.fd-dialog-backdrop{position:fixed;inset:0;background:#0f141973;display:grid;place-items:center;z-index:1000;padding:16px}.fd-dialog{background:var(--fd-surface);color:var(--fd-text);border-radius:max(var(--fd-radius),6px);max-width:420px;width:100%;padding:20px 22px;display:grid;gap:16px;box-shadow:0 10px 30px #0003;font-family:var(--fd-font);border:1px solid var(--fd-edge, transparent)}.fd-dialog p{margin:0}.fd-says{position:fixed;inset-inline:16px;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));z-index:1100;display:grid;justify-items:center;gap:8px;pointer-events:none}.fd-say{pointer-events:auto;display:flex;align-items:center;gap:8px;max-width:420px;padding-block:8px;padding-inline:14px 6px;border:1px solid var(--fd-border);border-inline-start:4px solid var(--fd-tone);border-radius:max(var(--fd-control-radius),6px);background:var(--fd-surface);color:var(--fd-text);box-shadow:0 8px 24px #0f141940;font-size:13.5px}.fd-say>span{flex:1 1 auto;min-width:0}.fd-button[aria-busy=true],.fd-stat[aria-busy=true]{cursor:progress}.fd-button[aria-busy=true]:after{content:"";width:.85em;height:.85em;border:2px solid currentColor;border-inline-end-color:transparent;border-radius:50%;animation:fd-spin .8s linear infinite}@keyframes fd-spin{to{rotate:1turn}}.fd-back{margin:8px 12px}.fd-back:before{content:"\u2190"}.fd-back:dir(rtl):before{content:"\u2192"}.fd-form[data-scheme]>.fd-back{margin:12px 20px 0}.fd-form-dialog{display:flex;flex-direction:column;width:100%;max-height:min(90vh,100%);min-height:0;background:var(--fd-page);color:var(--fd-text);border-radius:max(var(--fd-radius),8px);box-shadow:0 24px 64px #0f14194d;overflow:hidden}.fd-form-dialog:focus{outline:none}.fd-form-dialog.fd-size-small{max-width:440px}.fd-form-dialog.fd-size-medium{max-width:760px}.fd-form-dialog.fd-size-large{max-width:1080px}.fd-form-dialog-backdrop:has(>.fd-size-full),.fd-form-panel-backdrop{padding:0}.fd-form-dialog:is(.fd-size-full,.fd-form-panel){max-height:none;height:100%;border-radius:0}.fd-size-full{max-width:none}.fd-form-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-block-end:1px solid var(--fd-border);background:var(--fd-surface)}.fd-form-dialog-title{margin:0;font-size:16px;font-weight:600}.fd-dialog-close{border:none;background:none;cursor:pointer;font-size:22px;line-height:1;padding:2px 8px;border-radius:4px;color:var(--fd-muted)}.fd-dialog-close:hover{background:var(--fd-page);color:var(--fd-text)}.fd-form-dialog-body{flex:1 1 auto;min-height:0;overflow:auto;container-type:inline-size}.fd-form-dialog-body .fd-sheet-layout{margin-block-start:12px}.fd-form-dialog-body .fd-page-title{display:none}.fd-form-dialog-body .fd-page-head:not(:has(.fd-page-description)){display:none}.fd-form-dialog-body .fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr)}.fd-form-dialog-body .fd-side{display:none}.fd-search-body{display:grid;gap:12px;align-content:start}.fd-search-list{list-style:none;margin:0;padding:0;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:auto;max-height:min(60vh,520px)}.fd-search-list .fd-option{padding:8px 12px}.fd-search-list .fd-option+.fd-option{border-block-start:1px solid var(--fd-border)}.fd-search-list .fd-empty{padding:10px 12px;color:var(--fd-muted)}.fd-form-dialog-body:not(:has(.fd-sheet-layout)){background:var(--fd-surface);padding:16px 20px 20px}.fd-form-dialog-foot{padding:12px 16px;border-block-start:1px solid var(--fd-border);background:var(--fd-surface);margin:0}.fd-form-panel-backdrop{justify-items:end}.fd-form-panel{max-width:560px;position:relative}.fd-form-panel>.fd-dialog-backdrop{position:absolute}.fd-width-narrow{max-width:420px}.fd-width-wide{max-width:720px}.fd-form-panel[data-side=start]{justify-self:start}.fd-form-panel[data-side=left]{justify-self:left}.fd-form-panel[data-side=right]{justify-self:right}.fd-form-panel[data-side=top]{align-self:start;--fd-from: 0 -100%;--fd-back: 48px 0 0}.fd-form-panel[data-side=bottom]{align-self:end;--fd-from: 0 100%;--fd-back: 0 0 48px}.fd-form-panel[data-side=end]:dir(rtl),.fd-form-panel[data-side=start]:dir(ltr),.fd-form-panel[data-side=left]{--fd-from: -100% 0;--fd-back: 0 0 0 48px}.fd-form-panel:is([data-side=top],[data-side=bottom]){max-width:none;height:60%}.fd-form-panel.fd-height-short{height:40%}.fd-form-panel.fd-height-tall{height:85%}.fd-form-panel[data-behind]{margin:var(--fd-back, 0 48px 0 0)}@media(max-width:600px){.fd-form-dialog.fd-form-panel[data-side]{max-width:none;height:100%;margin:0;--fd-from: 0 100%}.fd-form-dialog.fd-form-panel[data-side=top]{--fd-from: 0 -100%}}@media(prefers-reduced-motion:no-preference){.fd-form-panel{animation:fd-slide .25s ease-out;transition:margin .2s}}@keyframes fd-slide{0%{translate:var(--fd-from, 100% 0)}}@media(prefers-reduced-motion:reduce){.fd-form *,.fd-form *:before,.fd-form *:after{transition:none!important}.fd-button[aria-busy=true]:after{animation:none}}',sl=Gf+il+nl+Xd+Qd+el+ol+tl+Gd+Yd+Zd,al="fieldia-styles";function la(e){if(e.getElementById(al))return;let t=e.createElement("style");t.id=al,t.textContent=sl,(e.head??e.documentElement).append(t)}function ca(e){let t=()=>{try{return e??globalThis.localStorage??null}catch{return null}};return{get(n){try{let r=t()?.getItem(`fieldia:${n}`);return r==null?null:JSON.parse(r)}catch{return null}},set(n,r){try{t()?.setItem(`fieldia:${n}`,JSON.stringify(r))}catch{}}}}function Yf(){let e=new Map;return{get:t=>e.has(t)?dl(e.get(t)):null,set:(t,n)=>{e.set(t,dl(n))}}}var dl=e=>JSON.parse(JSON.stringify(e));function fa(e,t){let n=t.widget;switch(e.type){case"char":return!n||n==="email"||n==="phone"||n==="url";case"selection":return!n&&!e.multiple&&!e.optionsFrom;case"text":case"integer":case"float":return!n||n==="duration"||n==="percentage";case"monetary":case"date":case"datetime":case"many2one":case"reference":return!n;default:return!1}}var Xf={email:[/^[^\s@]+@[^\s@]+$/,"mailto:"],phone:[/^\+?[\d\s().-]{3,}$/,"tel:"],url:[/^https?:\/\/\S+$/i,""]};function Zf(e,t,n,r){if(t.type!=="integer"&&t.type!=="float"||n.widget||r===null||r===void 0||e==="")return e;let i=o=>typeof n.options?.[o]=="string"?n.options[o].trim():"";return[i("prefix"),e,i("suffix")].filter(Boolean).join(" ")}function ua(e){let{document:t,field:n,node:r,locale:i="en",labels:o=Ze.en,dialogs:a}=e,s=t.createElement("div");s.className="fd-read-text",s.id=`${e.id}-text`;let d=n.type==="many2one"?n.relation:null,l=d!==null&&r.options?.open!==!1&&!!a?.canOpen(d),f="";return{element:s,update(c,y){let p=Zf(In(n,c,y,i,void 0,{widget:r.widget,options:r.options}),n,r,c),k=JSON.stringify([p,c??null]);if(k===f)return;f=k;let g=r.widget?Xf[r.widget]:void 0,m=d!==null&&c&&typeof c=="object"&&"id"in c?c:null,b;if(g&&typeof c=="string"&&g[0].test(c.trim())){let S=t.createElement("a");S.href=`${g[1]}${c.trim()}`,r.widget==="url"&&Object.assign(S,{target:"_blank",rel:"noopener noreferrer"}),S.textContent=p,b=S}else if(l&&m){let S=t.createElement("button");S.type="button",S.className="fd-read-link",S.textContent=p,S.setAttribute("aria-label",o.openNamed.replace("{name}",m.label)),S.addEventListener("click",()=>{a?.openRecord(d,{recordId:m.id,title:m.label})}),b=S}else b=t.createTextNode(p);let h=m&&r.options?.avatar===!0?[Zn(t,m)]:[],v=[];if(m?.details?.trim()&&r.options?.details===!0){let S=t.createElement("div");S.className="fd-link-details",xi(S,m.details.trim()),v.push(S)}s.replaceChildren(...h,b,...v)}}}var ll={};var Qf={save:"Save",edit:"Edit",done:"Done",discard:"Discard",saving:"Saving\u2026",saved:"Saved",submit:"Submit",next:"Next",back:"Back",skip:"Skip",steps:"Steps",stepOf:"Step {n} of {total}",submitted:"Thank you. Your answers were sent.",submitAnother:"Submit another response",draftFound:"You have unsaved answers from {time}.",restore:"Restore",discardDraft:"Discard",ok:"OK",cancel:"Cancel",loading:"Loading\u2026",saveClose:"Save & Close",close:"Close",discardChanges:"Discard your changes?",dismiss:"Dismiss",helpFor:"Help for {label}",quietHint:"Add {label}",quietAnswer:"Your answer",locked:"Locked: {label}",retry:"Retry",notSaved:"Not saved",notSent:"Not sent",checkFields:"{what}. Check: {fields}",offline:"Could not reach the server. Your changes are still here.",previousPage:"Previous page",nextPage:"Next page",range:"{from}\u2013{to} / {total}",selected:"{n} selected",clearSelection:"Clear",selectAll:"Select all",showAs:"Show as",viewList:"List",viewMap:"Map",viewBoth:"List and map",selectRecord:"Select {name}",noRecords:"No records match.",loadFailed:"Could not load the records.",search:"Search\u2026",searchLabel:"Search",searchFor:"Search {field} for: {text}",searchOptions:"Search options",filters:"Filters",groupBy:"Group By",favourites:"Favourites",or:"or",removeFacet:"Remove {label}",addCustomFilter:"Add a custom filter",field:"Field",condition:"Condition",value:"Value",apply:"Apply",saveSearch:"Save current search",searchName:"Name of the search",useByDefault:"Use by default",deleteFavourite:"Delete {name}",noFavourites:"No saved searches yet.",opIs:"is",opIsNot:"is not",opContains:"contains",opGreater:"greater than",opLess:"less than",opSet:"is set",opNotSet:"is not set",yes:"Yes",no:"No",none:"None",loadMore:"Show {n} more",formMissing:"The saved form \u201C{page}\u201D cannot be found.",formInItself:"The saved form \u201C{page}\u201D is not shown here: it would be placed inside itself ({chain}).",formNotPlaceable:"The saved form \u201C{page}\u201D cannot be placed here: only a form of sections or tabs can.",formBroken:"The saved form \u201C{page}\u201D cannot be shown.",pageMissing:"The page \u201C{page}\u201D cannot be found.",actions:"Actions",print:"Print",archive:"Archive",unarchive:"Unarchive",duplicate:"Duplicate",delete:"Delete",breadcrumbs:"Breadcrumbs",newRecord:"New",records:"Records",recordAt:"{n} / {total}",previousRecord:"Previous record",nextRecord:"Next record",attachment:"Attachment: {name}",openAttachment:"Open",previousAttachment:"Previous attachment",nextAttachment:"Next attachment"},Vt={en:Qf,...ll},fl=Vt.en,eu=new Map([["ar","Arabic"],["de","German"],["fr","French"]]),cl=new Set;function Cr(e="en"){let t=e.split("-")[0];if(Object.prototype.hasOwnProperty.call(Vt,t))return t;let n=eu.get(t);return n&&!cl.has(t)&&(cl.add(t),console.warn(`Fieldia: this page is in ${n}, but only English words are loaded, so Fieldia's own words show in English. Load the ${n} ones after fieldia.js: <script src="https://cdn.jsdelivr.net/npm/@fieldia/viewer/bundle/fieldia.${t}.js"><\/script>`)),"en"}var pa="#111418",gl="#1f2329",tu="#f2f3f5";var ma=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),nu=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function ul(e){let[t,n,r]=ma(e).map(i=>{let o=i/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function Wn(e,t){let[n,r]=[ul(e),ul(t)].sort((i,o)=>o-i);return(n+.05)/(r+.05)}var ru=e=>Wn(e,"#ffffff")>=4.5?"#ffffff":pa,iu=e=>Wn(e,pa)>=Wn(e,"#ffffff")?pa:"#ffffff",hl=(e,t,n)=>nu(ma(e).map((r,i)=>r+(ma(t)[i]-r)*n)),ou=(e,t)=>hl(t,e,.12),pl=(e,t)=>[...t,ou(e,t[0])].every(n=>Wn(e,n)>=4.5);function Ki(e,t,n){let r=e;for(let i=1;i<=40&&!n(r);i++)r=hl(e,t,i/40);return r}function Pr(e,t={light:[],dark:[]}){let n=e.toLowerCase(),r=Ki(n,"#000000",o=>pl(o,["#ffffff",tu,...t.light])),i=Ki(n,"#ffffff",o=>pl(o,[gl,...t.dark]));return{accent:r,accentText:ru(r),dark:i,darkText:iu(i)}}var au=["#212529","#636976","#c63c3d"],su=["#e8eaed","#a3a9b2","#ff8a7a"],du={accent:"#1365d9",dark:"#5aa2ff"},ml={background:"bg",border:"border",corners:"radius",textSize:"size",accent:"accent"},lu={small:"13px",large:"16px"},cu={square:[0,0],soft:[6,10],round:[12,16]};function fu(e,t){let n=(d,l)=>t.scheme==="dark"?l:t.scheme==="auto"?`light-dark(${d}, ${l})`:d,r=t.accent?Pr(t.accent):du,i=Object.entries(t.parts??{}),o=(d,l,f)=>e.style.setProperty(`--fd-${d}-${l}`,f),a={light:[],dark:[]},s=d=>l=>d.every(f=>Wn(f,l)>=4.5);for(let[d,l]of i){let f=l.background?.toLowerCase();if(!f)continue;let c=Ki(f,"#ffffff",s([...au,r.accent])),y=Ki(f,gl,s([...su,r.dark]));a.light.push(c),a.dark.push(y),o(d,"bg",n(c,y))}for(let[d,l]of i){let f=Object.keys(ml).filter(c=>l[c]).map(c=>ml[c]);if(f.length&&e.setAttribute(`data-${d}`,f.join(" ")),l.border&&o(d,"border",l.border),l.corners&&o(d,"radius",`${cu[l.corners][d==="groups"?1:0]}px`),l.textSize&&o(d,"size",lu[l.textSize]),l.accent){let c=Pr(l.accent,a);o(d,"accent",n(c.accent,c.dark)),o(d,"accent-text",n(c.accentText,c.darkText))}}}var ga={material:"outlined",fluent:"outlined",apple:"outlined",bootstrap:"outlined",shadcn:"outlined",ant:"outlined",odoo:"underline","google-forms":"outlined"};function Ln(e,t){return e??(t?ga[t]:"underline")}var ha=["text","muted","page","surface","fill","border","border-strong","edge","accent","accent-text","accent-soft","accent-hover","focus","focus-ring","error","error-soft","success","success-soft","warning","warning-soft","info","info-soft","radius","control-radius","font","label-weight"];function En(e,t){for(let n of ha){let r=t?.[n];r?e.style.setProperty(`--fd-${n}`,r):e.style.removeProperty(`--fd-${n}`)}}function jn(e,t){if(t){t.theme&&e.setAttribute("data-fd-theme",t.theme);for(let n of["font","density","corners","scheme"]){let r=t[n];r&&e.setAttribute(`data-${n}`,r)}if(t.labelWidth&&e.style.setProperty("--fd-label-width",`${t.labelWidth}px`),t.accent){let n=Pr(t.accent);e.setAttribute("data-accent",""),e.style.setProperty("--fd-look-accent",n.accent),e.style.setProperty("--fd-look-accent-text",n.accentText),e.style.setProperty("--fd-look-accent-dark",n.dark),e.style.setProperty("--fd-look-accent-dark-text",n.darkText)}fu(e,t)}}function Hn(e,t,n){let r=Kn(t);e.setAttribute("data-hotkey",t),e.setAttribute("aria-keyshortcuts",r),e.title=`${n} (${r})`;let i=e.ownerDocument.createElement("kbd");i.className="fd-hotkey",i.setAttribute("aria-hidden","true"),i.dir="ltr",i.textContent=`${t.startsWith("shift+")?"\u21E7":""}${t.slice(-1).toUpperCase()}`,e.append(i)}function Ji(e){if(!e.altKey||e.ctrlKey||e.metaKey||e.defaultPrevented)return null;let t=/^(?:Key([A-Z])|Digit([0-9]))$/.exec(e.code);return t?`${e.shiftKey?"shift+":""}${(t[1]??t[2]).toLowerCase()}`:null}var bl=0,Or='input:not([type="hidden"]), select, textarea, [contenteditable="true"]';function Gi(e){return[...e.querySelectorAll(".fd-field[data-focus]")].find(n=>!n.closest("[hidden]"))?.querySelector(Or)??null}var yl=e=>(t,n={},r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))i.setAttribute(o,a);return r!==void 0&&(i.textContent=r),i};function ir(e){return xl(e,`fd-size-${e.size??"medium"}`)}function ba(e){let t=e.side??"end";return xl(e,`fd-form-panel ${t==="top"||t==="bottom"?`fd-height-${e.height??"medium"}`:`fd-width-${e.width??"medium"}`}`,t)}function xl(e,t,n){let r=!!n,i=e.container?.ownerDocument??document,o=e.container??i.body,a=i.activeElement instanceof i.defaultView.HTMLElement?i.activeElement:null,s={...Vt[Cr(e.locale)],...e.labels},d=`fd-dialog-${++bl}`,l=yl(i),f=l("h2",{id:`${d}-title`,class:"fd-form-dialog-title"},e.title),c=l("button",{type:"button",class:"fd-dialog-close","aria-label":s.close},"\xD7"),y=l("div",{class:"fd-form-dialog-body"}),p=l("button",{type:"button",class:"fd-button"},s.discard),k=l("button",{type:"button",class:"fd-button fd-button-primary"},r&&e.mode==="values"?s.done:s.saveClose),g=e.page.look??e.look,m=e.theme??g?.theme,b=l("div",{class:`fd-theme fd-form-dialog ${t}`,"data-fd-skin":Ln(e.skin??g?.skin,m),role:"dialog","aria-modal":"true","aria-labelledby":f.id,tabindex:"-1"});n&&b.setAttribute("data-side",n),e.dir&&b.setAttribute("dir",e.dir),jn(b,m?{...g,theme:m}:g),En(b,e.tokens),b.append(l("div",{class:"fd-form-dialog-head"}),y,l("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"})),b.firstElementChild?.append(f,c);let v=(e.page.layout.type==="sections"||e.page.layout.type==="sheet"?e.page.layout.footer??[]:[]).map(A=>({node:A,button:l("button",{type:"button",class:`fd-button fd-button-${A.style??"secondary"}`,"data-node":A.id},A.label)}));for(let{node:A,button:R}of v)A.hotkey&&Hn(R,A.hotkey,A.label);b.lastElementChild?.append(...v.length?v.map(A=>A.button):[p,k]);let S=l("div",{class:`fd-dialog-backdrop fd-form-dialog-backdrop${r?" fd-form-panel-backdrop":""}`});S.append(b);let x=r?[...i.querySelectorAll(".fd-form-panel")].pop():void 0;x?.setAttribute("data-behind",""),o.append(S);let F=Vr(y,{...e,page:g&&!e.page.look?{...e.page,look:g}:e.page,showActions:!1,records:void 0,breadcrumbs:void 0,host:{...e.host,close:()=>p.click()}});r&&F.element.dir&&(S.dir=F.element.dir);let E=!1;e.recompute&&uu(F.form,e.page.fields,e.recompute,()=>E);let w=()=>Gi(y)??y.querySelector(Or);return(w()??b).focus(),F.form.settled().then(()=>{(i.activeElement===b||!b.contains(i.activeElement))&&w()?.focus()}),new Promise(A=>{let R=D=>{if(E)return;E=!0;let W=F.form.getState(),z={saved:D,recordId:W.recordId??null,values:W.values};F.destroy(),S.remove(),x?.removeAttribute("data-behind"),a?.focus(),A(z)},I=()=>new Promise(D=>{let W=i.activeElement,z=l("p",{id:`${d}-ask`},s.discardChanges),j=l("button",{type:"button",class:"fd-button"},s.cancel),V=l("button",{type:"button",class:"fd-button fd-button-primary"},s.discard),B=l("div",{class:"fd-actions fd-actions-end"}),$=l("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":z.id}),Q=l("div",{class:"fd-dialog-backdrop"});B.append(j,V),$.append(z,B),Q.append($);let X=J=>{Q.remove(),W?.focus(),D(J)};j.addEventListener("click",()=>X(!1)),V.addEventListener("click",()=>X(!0)),Q.addEventListener("keydown",J=>{J.stopPropagation(),J.key==="Escape"?X(!1):Gt($,J)}),b.append(Q),j.focus()}),M=async()=>{(!r||!F.form.getState().dirty.length||await I())&&R(!1)};k.addEventListener("click",async()=>{k.disabled=!0;let D=e.mode==="values"?F.check():await F.save();k.disabled=!1,D&&R(!0)}),p.addEventListener("click",()=>R(!1));let P=!1;F.on("save",()=>P=!0),F.on("send",()=>P=!0);let H=()=>{for(let{node:D,button:W}of v)W.hidden=F.form.node(D.id).invisible};v.length&&(H(),F.form.subscribe(H));for(let{node:D,button:W}of v)W.addEventListener("click",async()=>{if(W.hasAttribute("aria-busy"))return;W.setAttribute("aria-busy","true"),P=!1;let z=await F.form.runAction(D.id);W.removeAttribute("aria-busy"),!E&&(P?R(!0):(z.reason==="check"||z.reason==="save")&&F.check())});c.addEventListener("click",M),b.addEventListener("keyup",D=>D.key==="Alt"&&b.removeAttribute("data-hotkeys")),b.addEventListener("keydown",D=>{D.key==="Alt"&&b.setAttribute("data-hotkeys","");let W=Ji(D),z=W?v.find(({node:j,button:V})=>j.hotkey===W&&!V.hidden&&!V.disabled)?.button:void 0;if(z){D.preventDefault(),b.removeAttribute("data-hotkeys"),z.click();return}if(D.key==="Enter"&&(D.ctrlKey||D.metaKey)&&!D.isComposing){if(D.target.closest(".ag-root-wrapper"))return;D.preventDefault(),i.activeElement?.dispatchEvent(new Event("change",{bubbles:!0})),v.length?v.find(({node:j,button:V})=>j.style==="primary"&&!V.hidden)?.button.click():k.click();return}D.defaultPrevented||(D.key==="Escape"?(D.preventDefault(),M()):Gt(b,D))})})}function uu(e,t,n,r){let i=JSON.stringify(e.getState().values),o=!1;e.subscribe(()=>{let a=e.getState().values,s=JSON.stringify(a);o||s===i||(i=s,n(a).then(d=>{if(r()||JSON.stringify(e.getState().values)!==s)return;o=!0;let l=Object.fromEntries(Object.entries(d).filter(([f,c])=>f in t&&JSON.stringify(a[f]??null)!==JSON.stringify(c??null)));Object.keys(l).length&&e.setValues(l),o=!1,i=JSON.stringify(e.getState().values)},()=>{}))})}function ya(e){let t=e.container?.ownerDocument??document,n=e.container??t.body,r=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,i=Cr(e.locale),o=Vt[i],a=Ze[i],s=`fd-dialog-${++bl}`,d=yl(t),l=d("h2",{id:`${s}-title`,class:"fd-form-dialog-title"},e.title),f=d("button",{type:"button",class:"fd-dialog-close","aria-label":o.close},"\xD7"),c=d("input",{type:"search",class:"fd-input","aria-label":a.search,placeholder:a.search,"aria-controls":`${s}-list`,autocomplete:"off"}),y=d("ul",{id:`${s}-list`,class:"fd-search-list",role:"listbox","aria-labelledby":l.id}),p=d("button",{type:"button",class:"fd-button"},o.cancel),k=d("div",{class:"fd-theme fd-form-dialog fd-search-dialog fd-size-small","data-fd-skin":Ln(e.skin??e.look?.skin,e.theme??e.look?.theme),role:"dialog","aria-modal":"true","aria-labelledby":l.id});e.dir&&k.setAttribute("dir",e.dir);let g=e.theme??e.look?.theme;jn(k,g?{...e.look,theme:g}:e.look),En(k,e.tokens);let m=d("div",{class:"fd-form-dialog-head"});m.append(l,f);let b=d("div",{class:"fd-form-dialog-body fd-search-body"});b.append(c,y);let h=d("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"});h.append(p),k.append(m,b,h);let v=d("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});return v.append(k),n.append(v),c.focus(),new Promise(S=>{let x=[],F=-1,E=0,w,A=M=>{clearTimeout(w),E++,v.remove(),r?.focus(),S(M)},R=()=>{y.replaceChildren(...x.map((M,P)=>{let H=d("li",{id:`${s}-option-${P}`,role:"option",class:`fd-option${P===F?" fd-active":""}`,"aria-selected":String(P===F)},M.label);return H.addEventListener("click",()=>A(M)),H})),x.length||y.append(d("li",{class:"fd-empty"},a.noResults)),F>=0?c.setAttribute("aria-activedescendant",`${s}-option-${F}`):c.removeAttribute("aria-activedescendant")},I=()=>{clearTimeout(w);let M=++E;w=setTimeout(async()=>{let P=await e.search(c.value,80).catch(()=>[]);M===E&&(x=P,F=-1,R())},180)};c.addEventListener("input",I),c.addEventListener("keydown",M=>{if(M.key==="ArrowDown"||M.key==="ArrowUp"){if(M.preventDefault(),!x.length)return;F=(F+(M.key==="ArrowDown"?1:-1)+x.length)%x.length,R(),y.children[F]?.scrollIntoView?.({block:"nearest"})}else M.key==="Enter"&&F>=0&&(M.preventDefault(),A(x[F]))}),p.addEventListener("click",()=>A(null)),f.addEventListener("click",()=>A(null)),k.addEventListener("keydown",M=>{M.key==="Escape"?(M.preventDefault(),A(null)):Gt(k,M)}),I()})}function xa(e){return e.layout.type==="sheet"&&e.layout.title?.field?e.layout.title.field:e.fields.name?"name":Object.entries(e.fields).find(([,t])=>t.type==="char")?.[0]??null}function pu(e,t,n,r){let i=Object.fromEntries(Object.entries(e).map(([o,a])=>[o,n?{...a,readonly:!0}:a]));return{fieldia:"0.1",id:"values",title:t,data:{kind:"record",model:"values"},fields:i,layout:{type:"sections",id:"values",children:r??[{type:"section",id:"values-section",columns:2,children:Object.keys(i).map(o=>({type:"field",id:`values-${o}`,field:o}))}]}}}function Ir(e,t){let{pages:n,relatedPages:r}=e,i="model"in t?t.model:t.version===void 0?t.id:`${t.id}@${t.version}`,o=typeof n=="function"?n(t):n&&Object.prototype.hasOwnProperty.call(n,i)?n[i]:null;return o instanceof Promise?o.then(a=>a??null):o||!("model"in t)?o??null:(typeof r=="function"?r(t.model):r?.[t.model])??null}function mu(e){if(e)return{...e.search?{search:t=>e.search(t)}:{},...e.create?{create:t=>e.create(t)}:{}}}function vl(e,t){let n=i=>Ir(e,{model:i}),r={locale:e.locale,skin:e.skin,theme:e.theme??e.page.look?.theme,get tokens(){return e.tokens},dir:e.dir,widgets:e.widgets,preferences:e.preferences,pages:e.pages,relatedPages:e.relatedPages,translate:e.translate,look:e.page.look,user:e.user,context:e.context};return{canOpen:i=>n(i)!==null,async openRecord(i,o){let a=await n(i);if(!a)return null;let s=xa(a),d=await ir({...r,page:a,dataSource:e.dataSource,recordId:o.recordId??null,values:o.name||o.values?{...o.values??{},...o.name&&s?{[s]:o.name}:{}}:void 0,title:o.title,size:"large",...t?{host:{say:t}}:{}});if(!d.saved||d.recordId===null)return null;let l=s?d.values[s]:null,f=typeof l=="string"&&l?l:o.name??o.title;return o.withValues?{id:d.recordId,label:f,values:d.values}:{id:d.recordId,label:f}},searchMore:i=>ya({title:i.title,search:i.search,locale:e.locale,skin:e.skin,theme:e.theme,tokens:e.tokens,dir:e.dir,look:e.page.look}),async editValues(i){let o=await ir({...r,page:pu(i.fields,i.title,i.readonly===!0,i.layout),...i.parent?{parent:i.parent}:{},dataSource:mu(e.dataSource),values:i.values,title:i.title,...i.layout?{size:"large"}:{},mode:"values",...i.recompute?{recompute:i.recompute}:{},...t?{host:{say:t}}:{}});return o.saved?o.values:null}}}var wl=e=>`favourites:${e.id}`;function Yi(e,t){let n=e.get(wl(t));return Array.isArray(n)?n:[]}function kl(e,t,n){let r=Yi(t,n).find(i=>i.isDefault);return r?r.facets:e.defaultFilters?.length?[{kind:"filters",ids:[...e.defaultFilters],labels:e.defaultFilters.map(i=>e.filters?.find(o=>o.id===i)?.label??i)}]:[]}function Sl(e){let{page:t,el:n,labels:r,fill:i,preferences:o}=e,a=n("ul",{class:"fd-favourite-list"}),s=n("p",{class:"fd-favourites-none"},r.noFavourites),d=n("input",{class:"fd-input","aria-label":r.searchName,placeholder:r.searchName}),l=n("input",{type:"checkbox"}),f=n("button",{type:"button",class:"fd-button fd-button-primary"},r.save),c=n("div",{class:"fd-favourite-form",hidden:""},d,n("label",{class:"fd-favourite-default"},l,r.useByDefault),f),y=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.saveSearch),p=g=>o.set(wl(t),g);function k(){let g=Yi(o,t);s.hidden=g.length>0,a.replaceChildren(...g.map(m=>{let b=n("button",{type:"button",class:"fd-search-option","data-default":m.isDefault?"true":void 0},m.name);b.addEventListener("click",()=>e.apply(m.facets));let h=n("button",{type:"button",class:"fd-favourite-remove","aria-label":i(r.deleteFavourite,{name:m.name})},"\xD7");return h.addEventListener("click",()=>{p(Yi(o,t).filter(v=>v.name!==m.name)),k()}),n("li",{class:"fd-favourite"},b,h)}))}return y.addEventListener("click",()=>{c.hidden=!c.hidden,y.setAttribute("aria-expanded",String(!c.hidden)),c.hidden||d.focus()}),f.addEventListener("click",()=>{let g=d.value.trim();if(!g)return d.focus();let m={name:g,facets:e.current(),...l.checked?{isDefault:!0}:{}},b=Yi(o,t).filter(h=>h.name!==g).map(h=>l.checked?{name:h.name,facets:h.facets}:h);p([...b,m]),d.value="",l.checked=!1,c.hidden=!0,y.setAttribute("aria-expanded","false"),k()}),k(),{list:a,none:s,open:y,form:c}}function gu(e,t,n){let r=e.page.fields[t];return n.value===null?e.labels.none:r.type==="selection"?r.options.find(i=>i.value===n.value)?.label??n.label:r.type==="boolean"?n.value?e.labels.yes:e.labels.no:n.label||String(n.value)}function hu(e){let t=Number(e.dataset.level),n=e.nextElementSibling;for(;n&&Number(n.dataset.level??0)>t;){let r=n.nextElementSibling;n.remove(),n=r}}function va(e,t,n,r,i){let{el:o,labels:a}=e,s=i[n],d=[...r,t.value===null?{field:s,op:"notset",value:null}:{field:s,op:"=",value:t.value}],l=o("button",{type:"button",class:"fd-group-toggle","aria-expanded":"false"},o("span",{class:"fd-group-label"},gu(e,s,t))," ",o("span",{class:"fd-group-count"},`(${t.count})`)),f=o("tr",{class:"fd-list-group","data-level":String(n),"aria-level":String(n+1)},o("td",{colspan:String(e.columns)},l));f.style.setProperty("--fd-level",String(n));let c=!1;async function y(){c=!0;try{let k=n+1<i.length?(await e.dataSource.groups?.({model:e.model,field:i[n+1],filter:d}))?.map(g=>va(e,g,n+1,d,i))??[]:await p(0);if(!f.isConnected||l.getAttribute("aria-expanded")!=="true")return;f.after(...k),e.changed()}finally{c=!1}}async function p(k){let g=await e.dataSource.list({model:e.model,fields:e.fields,filter:d,sort:e.sort(),offset:k,limit:e.pageSize}),m=g.records.map(S=>e.recordRow(S,n+1)),b=g.total-k-g.records.length;if(b<=0)return m;let h=o("button",{type:"button",class:"fd-button fd-button-link"},e.fill(a.loadMore,{n:b})),v=o("tr",{class:"fd-list-more","data-level":String(n+1)},o("td",{colspan:String(e.columns)},h));return v.style.setProperty("--fd-level",String(n)),h.addEventListener("click",async()=>{h.disabled=!0;let S=await p(k+g.records.length);v.isConnected&&(v.replaceWith(...S),e.changed())}),[...m,v]}return l.addEventListener("click",()=>{let k=l.getAttribute("aria-expanded")==="true";l.setAttribute("aria-expanded",String(!k)),k?(hu(f),e.changed()):c||y()}),f}var bu='.fd-list{display:grid;gap:10px;min-width:0}.fd-list [hidden]{display:none!important}.fd-list-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;min-height:34px}.fd-list{container:fd-list / inline-size}.fd-list-views{display:inline-flex;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:hidden}.fd-list-views .fd-button{border:0;border-radius:0;min-height:32px;padding-inline:12px}.fd-list-views .fd-button+.fd-button{border-inline-start:1px solid var(--fd-border)}.fd-list-views .fd-button[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent);font-weight:600}.fd-list-body{display:grid;gap:16px;min-width:0}.fd-list-records{display:grid;gap:10px;min-width:0;align-content:start}.fd-list[data-view=list] .fd-list-map,.fd-list[data-view=map] .fd-list-records,.fd-list[data-view=map] .fd-pager{display:none}.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,3fr) minmax(320px,2fr);align-items:start}.fd-list[data-view=both] .fd-list-map{position:sticky;top:8px}@container fd-list (max-width: 860px){.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,1fr)}.fd-list[data-view=both] .fd-list-map{position:static;order:-1}}.fd-list-row.fd-list-hot>td{background:var(--fd-accent-soft)}.fd-search{position:relative;flex:1 1 360px;max-width:680px;min-width:0;container:fd-search / inline-size}.fd-search-field{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:34px;box-sizing:border-box;padding:2px 2px 2px 8px;padding-inline:8px 2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-search-field:focus-within{border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-search-field>.fd-icon,.fd-search-field>svg{width:16px;height:16px;color:var(--fd-muted);flex:none}.fd-facets{display:contents}.fd-facet{display:inline-flex;align-items:center;gap:4px;max-width:100%;min-width:0;min-height:24px;padding-block:0;padding-inline:6px 0;border-radius:3px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:13px;line-height:18px}.fd-facet svg{width:13px;height:13px;flex:none}.fd-facet[data-kind=groupBy]{background:var(--fd-success-soft);color:var(--fd-success)}.fd-facet-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-facet-remove{all:unset;cursor:pointer;display:grid;place-items:center;width:24px;height:24px;border-radius:2px;font-size:15px;line-height:1;opacity:.7}.fd-facet-remove:hover,.fd-facet-remove:focus-visible{opacity:1;background:var(--fd-surface)}.fd-search-input{flex:1 1 140px;min-width:100px;border:none;outline:none;background:none;font:inherit;font-size:14px;color:var(--fd-text);padding:5px 4px}.fd-form .fd-search-input:focus-visible{outline:none}.fd-search-toggle{all:unset;cursor:pointer;display:grid;place-items:center;width:30px;height:28px;border-radius:3px;color:var(--fd-muted)}.fd-search-toggle:before{content:"";width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg)}.fd-search-toggle[aria-expanded=true]:before{transform:translateY(2px) rotate(-135deg)}.fd-search-toggle:hover,.fd-search-toggle[aria-expanded=true]{background:var(--fd-page);color:var(--fd-text)}.fd-search-toggle:focus-visible{outline:2px solid var(--fd-focus)}.fd-search-suggestions,.fd-search-panel{position:absolute;z-index:30;inset-inline:0;top:calc(100% + 4px);box-sizing:border-box;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);box-shadow:0 10px 28px #0f172a24}.fd-search-suggestions{list-style:none;margin:0;padding:4px 0}.fd-search-suggestions [role=option]{padding:7px 12px;cursor:pointer;font-size:14px}.fd-search-suggestions [role=option][aria-selected=true]{background:var(--fd-accent-soft)}.fd-search-panel{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);padding-block:6px}.fd-search-group{display:flex;flex-direction:column;align-items:stretch;gap:1px;padding:4px 10px 8px;min-width:0}.fd-search-group+.fd-search-group{border-inline-start:1px solid var(--fd-border)}@container fd-search (max-width: 540px){.fd-search-panel{grid-auto-flow:row}.fd-search-group+.fd-search-group{border-inline-start:none;border-block-start:1px solid var(--fd-border);padding-block-start:8px}}.fd-search-heading{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13.5px;padding:4px 6px 6px}.fd-search-heading svg{width:15px;height:15px}.fd-search-group[data-group-kind=filters] .fd-search-heading svg{color:var(--fd-accent)}.fd-search-group[data-group-kind=groupBy] .fd-search-heading svg{color:var(--fd-success)}.fd-search-group[data-group-kind=favourites] .fd-search-heading svg{color:var(--fd-warning)}.fd-search-option{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:6px;padding:5px 6px;border-radius:4px;font-size:14px;color:var(--fd-text)}.fd-search-option:before{content:"";width:14px;flex:none;text-align:center;color:var(--fd-accent);font-weight:700}.fd-search-option[aria-pressed=true]:before{content:"\u2713"}.fd-search-option:hover,.fd-search-option:focus-visible{background:var(--fd-page)}.fd-search-add{color:var(--fd-muted);margin-block-start:4px}.fd-search-add:before{content:"+";color:var(--fd-muted);font-weight:400}.fd-custom-filter,.fd-favourite-form{display:grid;gap:6px;padding:6px}.fd-custom-filter .fd-input,.fd-favourite-form .fd-input{width:100%;box-sizing:border-box;min-height:30px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:3px 6px;font:inherit;font-size:13.5px;background:var(--fd-surface);color:var(--fd-text)}.fd-favourite-default{display:flex;align-items:center;gap:6px;font-size:13.5px}.fd-favourite-list{list-style:none;margin:0;padding:0}.fd-favourite{display:flex;align-items:center}.fd-favourite .fd-search-option{flex:1;min-width:0}.fd-favourite .fd-search-option[data-default=true]:before{content:"\u2605";color:var(--fd-warning)}.fd-favourite-remove{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:4px;color:var(--fd-muted)}.fd-favourite-remove:hover{background:var(--fd-page);color:var(--fd-error)}.fd-favourites-none{margin:0;padding:4px 6px;color:var(--fd-muted);font-size:13px}.fd-list-selection{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:3px 4px 3px 10px;border-radius:var(--fd-control-radius);background:var(--fd-accent-soft)}.fd-list-count{font-weight:600;font-size:13.5px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-pager-text{color:var(--fd-muted);font-size:13.5px;font-variant-numeric:tabular-nums;margin-inline-end:6px;white-space:nowrap}.fd-pager-button{min-width:32px;padding-inline:0;font-size:18px;line-height:1}.fd-list-scroll{overflow-x:auto;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-list-table{width:100%;border-collapse:collapse;font-size:14px}.fd-list-table th{text-align:start;font-weight:600;font-size:13px;color:var(--fd-text);padding:8px 10px;border-block-end:1px solid var(--fd-border-strong);white-space:nowrap;background:var(--fd-surface)}.fd-list-table td{padding:7px 10px;border-block-end:1px solid var(--fd-border);max-width:28em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-list-table tbody tr:last-child td{border-block-end:none}.fd-list-table .fd-num{text-align:end;font-variant-numeric:tabular-nums}.fd-list-table th.fd-list-check,.fd-list-table td.fd-list-check{width:36px;padding-inline:10px 0}.fd-list-checkbox{width:16px;height:16px;margin:0;vertical-align:middle;accent-color:var(--fd-accent);cursor:pointer}.fd-list-sort{all:unset;box-sizing:border-box;width:100%;cursor:pointer;display:flex;align-items:center;gap:4px;font:inherit;color:inherit}.fd-list-sort:after{content:"";width:0;height:0;border-inline:4px solid transparent;opacity:0}.fd-list-sort:hover:after{opacity:.35;border-block-start:5px solid currentColor}.fd-list-table th[aria-sort=ascending] .fd-list-sort:after{opacity:1;border-block-start:none;border-block-end:5px solid currentColor}.fd-list-table th[aria-sort=descending] .fd-list-sort:after{opacity:1;border-block-end:none;border-block-start:5px solid currentColor}.fd-list-table th.fd-num .fd-list-sort{justify-content:flex-end}.fd-list-table th.fd-num .fd-list-sort:after{order:-1}.fd-list-sort:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-list-row:hover td{background:var(--fd-page)}.fd-list-openable{cursor:pointer}.fd-list-row[aria-selected=true] td{background:var(--fd-accent-soft)}.fd-list-row:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-list-table[aria-busy=true] tbody{opacity:.6;transition:opacity .2s .15s}.fd-list-group td{padding:0;background:var(--fd-page)}.fd-group-toggle{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;width:100%;padding:8px 10px;padding-inline-start:calc(12px + var(--fd-level, 0) * 22px);font-weight:600;font-size:13.5px;color:var(--fd-text)}.fd-group-toggle:before{content:"";flex:none;width:6px;height:6px;border-top:1.5px solid currentColor;border-right:1.5px solid currentColor;transform:rotate(45deg);transition:transform .12s}.fd-group-toggle:dir(rtl):before{transform:rotate(-135deg)}.fd-group-toggle[aria-expanded=true]:before{transform:rotate(135deg)}.fd-group-toggle:hover{background:var(--fd-accent-soft)}.fd-group-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-group-count{color:var(--fd-muted);font-weight:400;font-variant-numeric:tabular-nums}.fd-list-more td{padding:4px 10px;padding-inline-start:calc(46px + var(--fd-level, 0) * 22px)}.fd-list-empty,.fd-list-failed{margin:0;padding:28px 12px;text-align:center;color:var(--fd-muted)}.fd-list-failed{color:var(--fd-error)}';function Xi(e){if(e.getElementById("fd-list-styles"))return;let t=e.createElement("style");t.id="fd-list-styles",t.textContent=bu,e.head.append(t)}var yu=[["ilike","opContains"],["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],xu=[["ilike","opContains"],["set","opSet"],["notset","opNotSet"]],vu=[["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],wu=[["=","opIs"],["!=","opIsNot"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]],ku=[["=","opIs"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]];function wa(e){switch(e.type){case"char":case"text":case"html":return yu;case"many2one":case"many2many":return xu;case"selection":return vu;case"integer":case"float":case"monetary":return wu;case"date":case"datetime":return ku;case"boolean":return[["=","opIs"]];default:return[]}}function Ll(e){let{page:t,el:n,labels:r}=e,i=Object.entries(t.fields).filter(([,g])=>wa(g).length),o=n("select",{class:"fd-input","aria-label":r.field},...i.map(([g,m])=>n("option",{value:g},m.label))),a=n("select",{class:"fd-input","aria-label":r.condition}),s=n("span",{class:"fd-custom-filter-value"}),d=n("button",{type:"button",class:"fd-button fd-button-primary"},r.apply),l=n("div",{class:"fd-custom-filter",hidden:""},o,a,s,d),f=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.addCustomFilter),c=n("input",{class:"fd-input","aria-label":r.value}),y=()=>t.fields[o.value];function p(){a.replaceChildren(...wa(y()).map(([g,m])=>n("option",{value:g},r[m]))),k()}function k(){let g=y();if(g.type==="selection")c=n("select",{class:"fd-input","aria-label":r.value},...g.options.map(m=>n("option",{value:String(m.value)},m.label)));else if(g.type==="boolean")c=n("select",{class:"fd-input","aria-label":r.value},n("option",{value:"true"},r.yes),n("option",{value:"false"},r.no));else{let m=["integer","float","monetary"].includes(g.type)?"number":g.type==="date"?"date":g.type==="datetime"?"datetime-local":"text";c=n("input",{class:"fd-input",type:m,"aria-label":r.value})}s.replaceChildren(c),s.hidden=a.value==="set"||a.value==="notset"}return o.addEventListener("change",p),a.addEventListener("change",()=>s.hidden=a.value==="set"||a.value==="notset"),f.addEventListener("click",()=>{l.hidden=!l.hidden,f.setAttribute("aria-expanded",String(!l.hidden)),l.hidden||o.focus()}),d.addEventListener("click",()=>{let g=y(),m=a.value,b=r[wa(g).find(([S])=>S===m)?.[1]??"opIs"],h=null,v="";if(!s.hidden){let S=c.value.trim();if(!S)return c.focus();if(g.type==="selection"){let x=g.options.find(F=>String(F.value)===S);h=x?.value??S,v=x?.label??S}else if(g.type==="boolean")h=S==="true",v=h?r.yes:r.no;else if(["integer","float","monetary"].includes(g.type)){if(h=Number(S),!Number.isFinite(h))return c.focus();v=S}else h=S,v=S}e.add({kind:"custom",label:[g.label,b,v].filter(Boolean).join(" "),filter:[{field:o.value,op:m,value:h}]}),l.hidden=!0,f.setAttribute("aria-expanded","false")}),p(),{button:f,form:l}}function Su(e,t){let n=` ${t.or} `;switch(e.kind){case"field":return`${e.label}: ${e.values.map(r=>r.label).join(n)}`;case"filters":return e.labels.join(n);case"groupBy":return e.labels.join(" > ");case"custom":return e.label}}function El(e){let{page:t,node:n,doc:r,el:i,labels:o,fill:a,uid:s}=e,d=e.facets,l=V=>{let B=kt(r,V,e.icons);return B?.setAttribute("aria-hidden","true"),B?[B]:[]};function f(V){d=V,v(),D(),e.onChange(d)}let c=s(`${n.id}-suggestions`),y=s(`${n.id}-search-panel`),p=i("input",{class:"fd-search-input",role:"combobox",autocomplete:"off",placeholder:o.search,"aria-label":o.searchLabel,"aria-autocomplete":"list","aria-expanded":"false","aria-controls":c}),k=i("div",{class:"fd-facets"}),g=i("ul",{class:"fd-search-suggestions",role:"listbox",id:c,"aria-label":o.searchLabel,hidden:""}),m=i("button",{type:"button",class:"fd-search-toggle","aria-label":o.searchOptions,"aria-expanded":"false","aria-controls":y}),b=[],h=0;function v(){k.replaceChildren(...d.map((V,B)=>{let $=Su(V,o),Q=i("button",{type:"button",class:"fd-facet-remove","aria-label":a(o.removeFacet,{label:$})},"\xD7");Q.addEventListener("click",()=>{f(d.filter((J,_)=>_!==B)),p.focus()});let X=V.kind==="groupBy"?"layers":V.kind==="field"?"":"filter";return i("span",{class:"fd-facet","data-kind":V.kind},...X?l(X):[],i("span",{class:"fd-facet-text"},$),Q)}))}function S(){g.replaceChildren(...b.map((V,B)=>{let $=i("li",{role:"option",id:`${c}-${B}`,"aria-selected":String(B===h)},V.label);return $.addEventListener("mousedown",Q=>Q.preventDefault()),$.addEventListener("click",()=>F(V)),$})),g.hidden=b.length===0,p.setAttribute("aria-expanded",String(!g.hidden)),g.hidden?p.removeAttribute("aria-activedescendant"):p.setAttribute("aria-activedescendant",`${c}-${h}`)}function x(){b=[],S()}function F(V){let B={op:V.op,value:V.value,label:V.valueLabel},$=d.findIndex(X=>X.kind==="field"&&X.field===V.field),Q=[...d];if($<0)Q.push({kind:"field",field:V.field,label:V.fieldLabel,values:[B]});else{let X=Q[$];X.values.some(_=>_.op===B.op&&JSON.stringify(_.value)===JSON.stringify(B.value))||(Q[$]={...X,values:[...X.values,B]})}p.value="",x(),f(Q)}p.addEventListener("input",()=>{b=si(p.value,t,n,{searchFor:o.searchFor}),h=0,S()}),p.addEventListener("blur",x),p.addEventListener("keydown",V=>{V.isComposing||((V.key==="ArrowDown"||V.key==="ArrowUp")&&b.length?(V.preventDefault(),h=(h+(V.key==="ArrowDown"?1:b.length-1))%b.length,S()):V.key==="Enter"?(V.preventDefault(),b.length&&F(b[h])):V.key==="Backspace"&&!p.value&&d.length?f(d.slice(0,-1)):V.key==="Escape"&&!g.hidden&&(V.preventDefault(),x()))});let E=(V,B,$)=>i("div",{class:"fd-search-heading",id:$},...l(V),B),w=(V,B)=>{let $=d.findIndex(te=>te.kind===V),Q=$<0?[]:V==="filters"?d[$].ids:d[$].fields,X=Q.includes(B)?Q.filter(te=>te!==B):[...Q,B],J=V==="filters"?{kind:V,ids:X,labels:X.map(te=>n.filters?.find(Ve=>Ve.id===te)?.label??te)}:{kind:V,fields:X,labels:X.map(te=>t.fields[te]?.label??te)},_=[...d];$<0?_.push(J):X.length?_[$]=J:_.splice($,1),f(_)},A=(n.filters??[]).map(V=>{let B=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-filter":V.id},V.label);return B.addEventListener("click",()=>w("filters",V.id)),B}),R=(n.groupBy??[]).map(V=>{let B=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-group":V},t.fields[V].label);return B.addEventListener("click",()=>w("groupBy",V)),B}),I=Ll({page:t,el:i,labels:o,add:V=>f([...d,V])}),M=Sl({page:t,el:i,labels:o,fill:a,preferences:e.preferences,current:()=>d,apply:f}),P=(V,B,$,...Q)=>i("div",{class:"fd-search-group","data-group-kind":V,role:"group","aria-labelledby":`${y}-${V}`},E(B,$,`${y}-${V}`),...Q),H=i("div",{class:"fd-search-panel",id:y,hidden:""},P("filters","filter",o.filters,...A,I.button,I.form),...R.length?[P("groupBy","layers",o.groupBy,...R)]:[],P("favourites","star",o.favourites,M.list,M.none,M.open,M.form));function D(){let V=d.find($=>$.kind==="filters")?.ids??[],B=d.find($=>$.kind==="groupBy")?.fields??[];for(let $ of A)$.setAttribute("aria-pressed",String(V.includes($.dataset.filter??"")));for(let $ of R)$.setAttribute("aria-pressed",String(B.includes($.dataset.group??"")))}function W(V){H.hidden=!V,m.setAttribute("aria-expanded",String(V)),V&&x()}m.addEventListener("click",()=>W(H.hidden)),H.addEventListener("keydown",V=>{V.key==="Escape"&&(V.preventDefault(),W(!1),m.focus())});let z=i("div",{class:"fd-search"},i("div",{class:"fd-search-field"},...l("search"),k,p,m),g,H),j=V=>{!H.hidden&&!z.contains(V.target)&&W(!1)};return r.addEventListener("pointerdown",j),v(),D(),{element:z,add(V){let B=V.kind==="custom"?V.label:null;f([...d.filter($=>!(B!==null&&$.kind==="custom"&&$.label===B)),V])},destroy:()=>r.removeEventListener("pointerdown",j)}}var Rl=new Set(["integer","float","monetary"]),Lu=new Set(["one2many","many2many","binary","image","html","json","properties"]);function Fl(e){let{page:t,node:n,form:r,el:i,labels:o,fill:a,locale:s,doc:d}=e;Xi(d);let l=n.pageSize??40,f=n.sort??[],c=f,y=0,p=0,k=[],g=new WeakMap,m=()=>[...R.querySelectorAll(".fd-list-row")].map(U=>g.get(U)),b=t.data.kind==="record"?t.data.model:"",h=kl(n,e.preferences,t),v=new Set,S=0,x=!1,F=[...new Set(n.columns.flatMap(U=>[U,...ki(t.fields[U])]))],E=(U,re)=>At(t.fields[U],re[U],re,s),w=i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":o.selectAll}),A=n.columns.map(U=>{let re=t.fields[U],Ce=i("th",{scope:"col","data-field":U,class:Rl.has(re.type)?"fd-num":void 0});if(Lu.has(re.type))Ce.append(re.label);else{let Pe=i("button",{type:"button",class:"fd-list-sort"},re.label);Pe.addEventListener("click",()=>{let ae=c[0]?.field===U?!c[0].desc:!1;c=[{field:U,...ae?{desc:ae}:{}},...f.filter(le=>le.field!==U)],y=0,Ee()}),Ce.append(Pe)}return Ce}),R=i("tbody"),I=i("table",{class:"fd-list-table","aria-label":t.title},i("thead",{},i("tr",{},i("th",{class:"fd-list-check",scope:"col"},w),...A)),R),M=i("p",{class:"fd-list-empty",hidden:""},o.noRecords),P=i("button",{type:"button",class:"fd-button fd-button-link"},o.retry),H=i("p",{class:"fd-list-failed",role:"alert",hidden:""},o.loadFailed," ",P);P.addEventListener("click",()=>{Ee()});function D(U,re=0){let Ce=E(n.columns[0],U.values)||String(U.id),Pe=i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":a(o.selectRecord,{name:Ce})});Pe.checked=v.has(U.id),Pe.addEventListener("change",()=>{Pe.checked?v.add(U.id):v.delete(U.id),B(),oe?.chosenChanged()});let ae=i("tr",{class:e.onOpenRecord?"fd-list-row fd-list-openable":"fd-list-row",tabindex:"0","data-id":String(U.id),"data-level":re?String(re):void 0},i("td",{class:"fd-list-check"},Pe),...n.columns.map(le=>i("td",{class:Rl.has(t.fields[le].type)?"fd-num":void 0},i("bdi",{},E(le,U.values)))));return ae.addEventListener("click",le=>{let se=le.target.closest("td");if(se?.classList.contains("fd-list-check")){le.target===se&&Pe.click();return}e.onOpenRecord?.(U.id)}),ae.addEventListener("keydown",le=>{le.target===ae&&(le.key==="Enter"?(le.preventDefault(),e.onOpenRecord?.(U.id)):le.key===" "?(le.preventDefault(),Pe.click()):(le.key==="ArrowDown"||le.key==="ArrowUp")&&(le.preventDefault(),(le.key==="ArrowDown"?ae.nextElementSibling:ae.previousElementSibling)?.focus()))}),ae.addEventListener("mouseenter",()=>oe?.highlight(U.id)),ae.addEventListener("mouseleave",()=>oe?.highlight(null)),ae.addEventListener("focus",()=>oe?.highlight(U.id)),g.set(ae,U),ae}let W=i("span",{class:"fd-list-count",role:"status"}),z=i("button",{type:"button",class:"fd-button fd-button-link"},o.clearSelection),j=(n.actions??[]).map(U=>{let re=i("button",{type:"button",class:`fd-button fd-button-${U.style??"secondary"}`,"data-node":U.id},...e.withIcon(U.icon,U.label));return re.addEventListener("click",()=>{e.press(re,async()=>{let Ce=await r.runAction(U.id,{recordIds:[...v]});return await Promise.all([Ee(),oe?.reload()]),Ce})}),re}),V=i("div",{class:"fd-list-selection",hidden:""},W,...j,z);z.addEventListener("click",()=>{v.clear();for(let U of R.querySelectorAll(".fd-list-checkbox"))U.checked=!1;B()}),w.addEventListener("change",()=>{for(let U of m())w.checked?v.add(U.id):v.delete(U.id);for(let U of R.querySelectorAll(".fd-list-checkbox"))U.checked=w.checked;B()});function B(){let U=m(),re=U.filter(Ce=>v.has(Ce.id)).length;w.checked=U.length>0&&re===U.length,w.indeterminate=re>0&&re<U.length,V.hidden=v.size===0,W.textContent=a(o.selected,{n:v.size});for(let Ce of R.querySelectorAll(".fd-list-row"))Ce.setAttribute("aria-selected",String([...v].some(Pe=>String(Pe)===Ce.dataset.id)))}let $=i("span",{class:"fd-pager-text"}),Q=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.previousPage},"\u2039"),X=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.nextPage},"\u203A"),J=i("div",{class:"fd-pager",role:"group"},$,Q,X);Q.addEventListener("click",()=>{y=Math.max(0,y-l),Ee()}),X.addEventListener("click",()=>{y+=l,Ee()});function _(){J.hidden=p===0,$.textContent=a(o.range,{from:y+1,to:Math.min(y+k.length,p),total:p}),Q.disabled=y===0,X.disabled=y+l>=p}function te(){for(let U of A){let re=!c[0]?.near&&c[0]?.field===U.dataset.field?c[0]:null;re?U.setAttribute("aria-sort",re.desc?"descending":"ascending"):U.removeAttribute("aria-sort")}}function Ve(){if(ge==="list"){let U=new Set(m().map(re=>re.id));for(let re of[...v])U.has(re)||v.delete(re)}B(),oe?.chosenChanged()}let Ie=U=>({page:t,el:i,labels:o,fill:a,dataSource:U,model:b,fields:F,columns:n.columns.length+1,pageSize:l,sort:()=>c,recordRow:D,changed:Ve});async function Ee(){let U=++S;te(),I.setAttribute("aria-busy","true");let re=[];try{let Ce=[...e.fixedFilter??[],...kr(h,n)],Pe=di(h),ae=e.dataSource;if(Pe.length&&ae?.groups&&ae.list){let le=await ae.groups({model:b,field:Pe[0],filter:Ce});if(U!==S||x)return;k=[],p=0,re=le.map(se=>va(Ie(ae),se,0,Ce,Pe))}else{let le=ae?.list?await ae.list({model:b,fields:F,filter:Ce,sort:c,offset:y,limit:l}):{records:[],total:0};if(U!==S||x)return;if(!le.records.length&&le.total>0&&y>0)return y=Math.floor((le.total-1)/l)*l,Ee();k=le.records,p=le.total,re=k.map(se=>D(se))}H.hidden=!0}catch{if(U!==S||x)return;k=[],p=0,H.hidden=!1}R.replaceChildren(...re),M.hidden=re.length>0||!H.hidden,I.removeAttribute("aria-busy"),_(),Ve()}let Me=El({page:t,node:n,doc:d,el:i,labels:o,fill:a,uid:e.uid,icons:e.icons,preferences:e.preferences,facets:h,onChange(U){h=U,y=0,Ee(),oe?.reload()}}),ie=n.map?e.views?.map:void 0,ge=ie?n.map?.view??"list":"list",oe=null,ke=i("div",{class:"fd-list-map"}),De=()=>[...e.fixedFilter??[],...kr(h,n)];function xe(){oe||!ie||(oe=ie({page:t,node:n,dataSource:e.dataSource,document:d,locale:s,icons:e.icons,filter:De,isChosen:U=>v.has(U),choose(U,re){re?v.add(U):v.delete(U);for(let Ce of R.querySelectorAll(".fd-list-row")){if(Ce.dataset.id!==String(U))continue;let Pe=Ce.querySelector(".fd-list-checkbox");Pe&&(Pe.checked=re)}B(),oe?.chosenChanged()},...e.onOpenRecord?{open:e.onOpenRecord}:{},highlight(U){for(let re of R.querySelectorAll(".fd-list-row")){let Ce=U!==null&&re.dataset.id===String(U);re.classList.toggle("fd-list-hot",Ce),Ce&&ge==="both"&&re.scrollIntoView({block:"nearest"})}},addSearch:({label:U,filter:re})=>Me.add({kind:"custom",label:U,filter:re}),sort:()=>c,sortBy(U){c=U??f,y=0,Ee(),oe?.reload()},actions:(n.actions??[]).map(U=>({id:U.id,label:U.label,...U.style?{style:U.style}:{}})),act:(U,re,Ce)=>e.press(Ce,async()=>{let Pe=await r.runAction(U,{recordIds:re});return await Promise.all([Ee(),oe?.reload()]),Pe})}),ke.append(oe.element),oe.reload())}let Xe=["list","map","both"].map(U=>{let re=i("button",{type:"button",class:"fd-button fd-list-view","data-view":U,"aria-pressed":"false"},U==="list"?o.viewList:U==="map"?o.viewMap:o.viewBoth);return re.addEventListener("click",()=>ne(U)),re}),Y=i("div",{class:"fd-list-views",role:"group","aria-label":o.showAs},...Xe);Y.hidden=!ie;function ne(U){ge=U,fe.dataset.view=ge;for(let re of Xe)re.setAttribute("aria-pressed",String(re.dataset.view===ge));ge!=="list"&&(xe(),oe?.shown())}let fe=i("div",{class:"fd-list","data-node":n.id},i("div",{class:"fd-list-bar"},Me.element,Y,J),V,i("div",{class:"fd-list-body"},i("div",{class:"fd-list-records"},i("div",{class:"fd-list-scroll"},I),M,H),ke));return ne(ge),Ee(),{element:fe,reload:async()=>{await Promise.all([Ee(),oe?.reload()])},destroy(){x=!0,Me.destroy(),oe?.destroy()}}}function Zi(e,t){let n=e.style??"card",r=n==="plain"&&!e.title,i=gn(e.columns),o=e.colspan??1,a=r&&t.columns>1?o===1&&i>1?"shared":"tracks":void 0;return{style:n,arrangement:r,at:a,inner:{columns:a==="tracks"?Math.min(o,t.columns):i,onPage:t.onPage&&(n==="plain"||n==="line"),labels:e.labels??t.labels,quiet:e.quiet??t.quiet,reason:e.readonlyReason??t.reason}}}var Eu=new Set(["one2many","matrix"]);function Dr(e,t,n){if(t==="boolean"&&e.widget==="tick")return"after";let r=e.labels??n;return r==="beside"&&Eu.has(t)?"above":r}function nt(e,t){e.hidden!==t&&(e.hidden=t)}function $t(e,t){e.textContent!==t&&(e.textContent=t)}function ut(e,t,n){e.getAttribute(t)!==n&&(n===null?e.removeAttribute(t):e.setAttribute(t,n))}async function Al(e,t){let{options:n}=e,r=n.onOpen?.(t);if(r)return r;let i=await Ir(n,t.version===void 0?{id:t.page}:{id:t.page,version:t.version});if(!i)throw new Error(e.missing(t.page));let o=n.page.look,a={...n,page:o&&!i.look?{...i,look:o}:i,form:void 0,recordId:t.recordId??null,values:t.values,listFilter:t.filter,drafts:void 0,autosave:void 0,readonly:void 0,editSwitch:void 0,saveStatus:void 0,records:void 0,breadcrumbs:void 0},s=t.title??e.title(i),d={...a,host:{...n.host,say:e.say,post:e.post}},l=t.as==="page"?await Ru(e,{...a,host:{...n.host,post:e.post}}):t.as==="panel"?await ba({...d,title:s,side:t.side}):await ir({...d,title:s,size:i.layout.type==="sheet"?"large":"medium"}),f=xa(i),c=f?l.values[f]:void 0;return{...l,...typeof c=="string"&&c?{label:c}:{}}}function Ru(e,t){let{place:n,root:r}=e,i=n.ownerDocument,o=i.activeElement;return new Promise(a=>{let s=!1,d=p=>{if(s)return;s=!0;let k=f.form.getState();f.destroy(),r.hidden=!1,o?.isConnected&&o.focus(),a({saved:p,recordId:k.recordId??null,values:k.values})};r.hidden=!0;let l=e.options.breadcrumbs?[...e.options.breadcrumbs,{label:e.name(),open:()=>d(!1)}]:void 0,f=Vr(n,{...t,breadcrumbs:l,host:{...t.host,close:()=>d(!1)}}),c=i.createElement("button");c.type="button",c.className="fd-button fd-button-link fd-back",c.textContent=e.back,c.addEventListener("click",()=>d(!1)),f.element.querySelector(".fd-breadcrumbs")||f.element.prepend(c);let y=()=>{f.form.settled().then(()=>d(!0))};f.on("save",y),f.on("send",y),(Gi(f.element)??f.element.querySelector(Or)??c).focus()})}function $l(e,t,n){let r=t("div",{class:"fd-says",role:"status","aria-live":"polite"});return e.append(r),(i,o)=>{let a=t("button",{type:"button",class:"fd-alert-close","aria-label":n},"\xD7"),s=t("div",{class:"fd-say","data-tone":o},t("span",{},i),a);s.style.setProperty("--fd-tone",`var(--fd-${o==="danger"?"error":o})`);let d,l=()=>clearTimeout(d),f=()=>{l(),s.remove()},c=()=>{l(),d=setTimeout(f,o==="warning"||o==="danger"?1e4:6e3)};for(a.addEventListener("click",f),s.addEventListener("mouseenter",l),s.addEventListener("focusin",l),s.addEventListener("mouseleave",c),s.addEventListener("focusout",c),r.append(s);r.children.length>4;)r.firstElementChild?.remove();Fu(r,t,i),c()}}function Fu(e,t,n){let r=[...e.ownerDocument.querySelectorAll('[aria-modal="true"]')].filter(a=>!a.contains(e)),i=r[r.length-1];if(!i)return;let o=i.querySelector(":scope > .fd-says-echo");o||(o=t("div",{class:"fd-says-echo fd-sr-only",role:"status","aria-live":"polite"}),i.append(o)),o.textContent=n}var or=64;function Tl(e,t){let n=()=>e.closest("[dir]")?.getAttribute("dir")==="rtl",r=y=>t("button",{type:"button",class:`fd-tabs-scroll fd-tabs-${y}`,tabindex:"-1","aria-hidden":"true",hidden:""}),i=r("before"),o=r("after"),a=t("div",{class:"fd-tabbar"},i,e,o),s=y=>e.scrollBy({left:y*(n()?-1:1)*Math.max(e.clientWidth-2*or,or),behavior:"smooth"});i.addEventListener("click",()=>s(-1)),o.addEventListener("click",()=>s(1));function d(){let y=Math.abs(e.scrollLeft),p=y>1,k=y+e.clientWidth<e.scrollWidth-1;nt(i,!p),nt(o,!k);let g=[p&&"start",k&&"end"].filter(Boolean).join(" ");ut(a,"data-more",g||null)}function l(y){if(!e.clientWidth||e.scrollWidth<=e.clientWidth)return;let p=e.getBoundingClientRect(),k=y.getBoundingClientRect();k.left<p.left+or?e.scrollLeft+=k.left-p.left-or:k.right>p.right-or&&(e.scrollLeft+=k.right-p.right+or),d()}e.addEventListener("scroll",d,{passive:!0});let f=e.ownerDocument.defaultView,c=f&&"ResizeObserver"in f?new f.ResizeObserver(()=>d()):null;return c?.observe(e),{element:a,measure:d,reveal:l,destroy:()=>c?.disconnect()}}function ka(e,t,n,r){let i=Un(n);if(!i.some(s=>s.field))return{nodes:[n],update:()=>{}};let o=[];return{nodes:i.map(s=>{if(!s.field)return s.text;let d=e.createElement("bdi");return d.className="fd-value",d.dataset.field=s.field,o.push({field:s.field,span:d}),d}),update(s){for(let{field:d,span:l}of o){let f=t[d],c=f?At(f,s[d],s,r):"";l.textContent!==c&&(l.textContent=c)}}}}var Au={gear:'<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>'},Wr=(e,t)=>e!=null&&t!=null&&String(e)===String(t);function Ml(e){let{el:t,labels:n,toolbar:r}=e,i=r?.menu??[],o=r?.breadcrumbs===!1?void 0:e.breadcrumbs,a=r?.pager===!1?void 0:e.records;if(!i.length&&!o?.length&&!a)return null;let s=[],d=[],l=t("div",{class:"fd-record-bar"});if(o?.length){let f=t("span",{class:"fd-crumb-current","aria-current":"page"}),c=t("ol",{},...o.map(y=>{let p=y.href!==void 0?t("a",{class:"fd-crumb",href:y.href},y.label):t("button",{type:"button",class:"fd-crumb"},y.label);return y.open&&p.addEventListener("click",k=>{k.preventDefault(),y.open?.()}),t("li",{},p)}),t("li",{},f));l.append(t("nav",{class:"fd-breadcrumbs","aria-label":n.breadcrumbs},c)),s.push(()=>$t(f,e.name()||n.newRecord))}return i.length&&l.append($u(e,i,s,d)),a&&l.append(Tu(e,a,o,s,d)),{element:l,update:()=>{for(let f of s)f()},destroy:()=>{for(let f of d)f()}}}function $u(e,t,n,r){let{doc:i,el:o,form:a,labels:s}=e,d=e.uid("record-menu"),l=o("button",{type:"button",class:"fd-button fd-record-gear",id:`${d}-button`,"aria-haspopup":"menu","aria-expanded":"false","aria-controls":d,title:s.actions}),f=kt(i,"gear",Au);f&&l.append(f),l.append(o("span",{class:"fd-record-gear-words"},s.actions));let c=o("div",{class:"fd-record-menu",role:"menu",id:d,"aria-labelledby":l.id,hidden:""}),y=t.map(E=>{let w=E.label??(E.builtin?s[E.builtin]:E.id),A=o("button",{type:"button",role:"menuitem",tabindex:"-1",class:"fd-record-menu-item","data-node":E.id},...e.withIcon(E.icon,w));return E.builtin==="delete"&&A.classList.add("fd-record-menu-danger"),A.addEventListener("click",()=>{F(!0),e.press(l,()=>a.runAction(E.id))}),{item:E,button:A}}),p=y.filter(E=>E.item.group==="print"),k=y.filter(E=>E.item.group!=="print"),g=o("div",{class:"fd-record-menu-heading",role:"presentation"},s.print),m=o("div",{role:"group","aria-label":s.print},g,...p.map(E=>E.button)),b=o("div",{class:"fd-record-menu-rule",role:"separator"});c.append(...p.length?[m]:[],...p.length&&k.length?[b]:[],...k.map(E=>E.button));let h=o("div",{class:"fd-record-actions"},l,c),v=()=>y.filter(E=>!E.button.hidden).map(E=>E.button),S=E=>{h.contains(E.target)||F(!1)};function x(E){if(!c.hidden)return;c.hidden=!1,c.removeAttribute("data-end");let w=c.getBoundingClientRect();(w.right>i.documentElement.clientWidth-4||w.left<4)&&c.setAttribute("data-end",""),l.setAttribute("aria-expanded","true"),i.addEventListener("pointerdown",S,!0);let A=v();(E==="first"?A[0]:A[A.length-1])?.focus()}function F(E){c.hidden||(c.hidden=!0,l.setAttribute("aria-expanded","false"),i.removeEventListener("pointerdown",S,!0),E&&l.focus())}return r.push(()=>i.removeEventListener("pointerdown",S,!0)),l.addEventListener("click",()=>c.hidden?x("first"):F(!1)),l.addEventListener("keydown",E=>{(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),x(E.key==="ArrowDown"?"first":"last"))}),c.addEventListener("keydown",E=>{let w=v(),A=w.indexOf(i.activeElement),R={ArrowDown:A+1,ArrowUp:A-1,Home:0,End:w.length-1}[E.key];R!==void 0?(E.preventDefault(),w[(R+w.length)%w.length]?.focus()):E.key==="Escape"?(E.preventDefault(),E.stopPropagation(),F(!0)):E.key==="Tab"&&F(!1)}),n.push(()=>{for(let{item:E,button:w}of y)nt(w,a.node(E.id).invisible);nt(m,!p.some(E=>!E.button.hidden)),nt(b,m.hidden||!k.some(E=>!E.button.hidden)),nt(h,!y.some(E=>!E.button.hidden))}),h}function Tu(e,t,n,r,i){let{el:o,form:a,labels:s}=e,d=Array.isArray(t)?[...t]:null,l=Array.isArray(t)?null:t,f=d?d.length:l.total,c=d?-1:l.at,y=d?null:a.getState().recordId,p=!1,k=()=>{let x=a.getState().recordId;return d?d.findIndex(F=>Wr(F,x)):Wr(y,x)?c:-1},g=o("span",{class:"fd-record-pager-text",dir:"ltr"}),m=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.previousRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),b=o("button",{type:"button",class:"fd-button fd-record-step","aria-label":s.nextRecord},o("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A"));Hn(m,"p",s.previousRecord),Hn(b,"n",s.nextRecord);let h=o("div",{class:"fd-record-pager",role:"group","aria-label":s.records},g,m,b),v=async x=>d?d[x]:l.id(x);async function S(x){let F=k();if(!(p||F===-1||f<2)){p=!0;try{let E=(F+x+f)%f;if(!await e.leave())return;let w=await v(E);c=E,y=w,await a.openRecord(w)}finally{p=!1}}}return m.addEventListener("click",()=>{S(-1)}),b.addEventListener("click",()=>{S(1)}),i.push(a.on("duplicate",({from:x,recordId:F})=>{if(!d)return;let E=d.findIndex(w=>Wr(w,x));d.splice(E+1,0,F),f=d.length,e.render()}),a.on("delete",({recordId:x})=>{let F=d?d.findIndex(A=>Wr(A,x)):Wr(y,x)?c:-1;if(F===-1)return;if(d&&d.splice(F,1),f=d?d.length:f-1,f<1)return void n?.[n.length-1]?.open?.();c=Math.min(F,f-1);let E=A=>{y=A,a.openRecord(A)},w=d?d[c]:l.id(c);w instanceof Promise?w.then(E):E(w)})),r.push(()=>{let x=k();nt(h,x===-1),$t(g,e.fill(s.recordAt,{n:x+1,total:f}));let F=f<2;ut(m,"aria-disabled",F?"true":null),ut(b,"aria-disabled",F?"true":null)}),h}var Mu=e=>/^image\//.test(e.type)||/pdf/i.test(e.type)||/\.pdf$/i.test(e.name),Nu=e=>(Array.isArray(e)?e:e?[e]:[]).filter(t=>t&&typeof t=="object"&&"name"in t);function Nl(e){let{el:t,form:n,labels:r,node:i}=e,o=t("span",{class:"fd-attachment-name",dir:"auto"}),a=t("span",{class:"fd-attachment-count",dir:"ltr"}),s=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.previousAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),d=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.nextAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A")),l=t("a",{class:"fd-button fd-button-link fd-attachment-open",target:"_blank",rel:"noopener"},r.openAttachment),f=t("div",{class:"fd-attachment-body"}),c=t("aside",{class:"fd-attachment-preview",hidden:""},t("div",{class:"fd-attachment-head"},o,a,s,d,l),f),y=[],p=0,k=null,g,m=0,b,h;function v(){k?.free(),k=null;let w=y[p];if(!w)return f.replaceChildren();let A=zo(e.doc,w);k=A,f.replaceChildren(...A?[A.element]:[]),$t(o,w.name),$t(a,y.length>1?e.fill(r.recordAt,{n:p+1,total:y.length}):""),nt(s,y.length<2),nt(d,y.length<2),ut(l,"href",A?.url??null),ut(c,"aria-label",e.fill(r.attachment,{name:w.name}))}let S=w=>{p=(p+w+y.length)%y.length,v()};s.addEventListener("click",()=>S(-1)),d.addEventListener("click",()=>S(1));let x=w=>{y=w.filter(Mu),p=0,v(),F()},F=()=>nt(c,n.node("#preview").invisible||!y.length);function E(w){let A=e.dataSource,R=++m;if(g=w.recordId,w.recordId==null||!A?.attachments||e.page.data.kind!=="record")return x([]);A.attachments({model:e.page.data.model,id:w.recordId,fields:e.page.fields}).then(I=>R===m&&x(I),()=>R===m&&x([]))}return{element:c,update(w){if(i.field){let A=w.values[i.field];A!==h&&(h=A,x(Nu(A)))}else w.status!=="loading"&&w.status!=="idle"&&(w.recordId!==g||w.status==="saved"&&b!=="saved")&&E(w);b=w.status,F()},destroy:()=>k?.free()}}var Cu='.fd-record-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;min-height:46px;box-sizing:border-box;padding:6px 16px;background:var(--fd-surface);border-block-end:1px solid var(--fd-border)}.fd-form>.fd-content>.fd-record-bar{margin:-4px 0 12px;border-radius:var(--fd-radius);border:1px solid var(--fd-border)}.fd-breadcrumbs{min-width:0}.fd-breadcrumbs ol{display:flex;flex-wrap:wrap;align-items:center;list-style:none;margin:0;padding:0;font-size:17px;line-height:1.3}.fd-breadcrumbs li{display:flex;align-items:center;min-width:0}.fd-breadcrumbs li+li:before{content:"/";color:var(--fd-muted);padding-inline:8px}.fd-crumb{all:unset;cursor:pointer;color:var(--fd-accent);border-radius:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-crumb:hover{text-decoration:underline}.fd-crumb:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-crumb-current{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-record-actions{position:relative}.fd-record-actions[hidden]{display:none}.fd-record-gear{display:inline-flex;align-items:center;gap:6px}.fd-record-gear svg{width:16px;height:16px;flex:none}.fd-record-menu{position:absolute;z-index:40;inset-block-start:calc(100% + 4px);inset-inline-start:0;display:grid;min-width:220px;max-width:min(320px,90vw);padding:4px;box-sizing:border-box;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #00000029}.fd-record-menu[data-end]{inset-inline-start:auto;inset-inline-end:0}.fd-record-menu[hidden],.fd-record-menu [hidden]{display:none}.fd-record-menu [role=group]{display:grid}.fd-record-menu-heading{padding:6px 12px 2px;font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--fd-muted)}.fd-record-menu-rule{margin:4px 0;border-block-start:1px solid var(--fd-border)}.fd-record-menu-item{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 12px;border-radius:3px;cursor:pointer;color:var(--fd-text)}.fd-record-menu-item svg{width:16px;height:16px;flex:none;color:var(--fd-muted)}.fd-record-menu-item:hover,.fd-record-menu-item:focus{background:var(--fd-accent-soft)}.fd-record-menu-item:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-record-menu-danger{color:var(--fd-error)}.fd-record-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-record-pager[hidden]{display:none}.fd-record-pager-text{padding-inline-end:6px;font-variant-numeric:tabular-nums;color:var(--fd-muted);white-space:nowrap}.fd-record-step{min-width:34px;padding-inline:8px;font-size:18px;line-height:1}.fd-record-step[aria-disabled=true]{opacity:.5;cursor:default}@container fd-form (max-width: 520px){.fd-record-bar{padding-inline:12px;gap:6px 8px}.fd-record-gear-words{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-breadcrumbs ol{flex-wrap:nowrap;font-size:15px}.fd-breadcrumbs li:not(:nth-last-child(-n+2)){display:none}.fd-breadcrumbs li:nth-last-child(2):before{content:"\u2039";padding-inline:0 6px;font-size:20px;color:var(--fd-accent)}}.fd-attachment-preview{display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);overflow:hidden}.fd-attachment-preview[hidden]{display:none}.fd-attachment-head{display:flex;align-items:center;gap:6px;padding:6px 8px 6px 12px;padding-inline:12px 8px;border-block-end:1px solid var(--fd-border);min-width:0}.fd-attachment-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.fd-attachment-count{color:var(--fd-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.fd-attachment-head [hidden]{display:none}.fd-attachment-body{display:grid;min-height:0;background:var(--fd-page)}.fd-attachment-body>iframe{width:100%;height:100%;min-height:70vh;border:0;background:#fff}.fd-attachment-body>img{display:block;max-width:100%;max-height:80vh;margin:auto;object-fit:contain}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){max-width:none;grid-template-columns:minmax(0,3fr) minmax(320px,2fr);grid-template-rows:auto 1fr}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden]))>:is(.fd-card,.fd-side){grid-column:1}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:2;grid-row:1 / span 2;position:sticky;top:8px;height:calc(100vh - 16px);max-height:1200px}@container (max-width: 1000px){.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){grid-template-columns:minmax(0,1fr)}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:1;grid-row:auto;position:static;height:auto}.fd-attachment-body>iframe{min-height:60vh}}@container (max-width: 1000px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr) minmax(240px,300px)}}@container (max-width: 600px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr)}}';function Cl(e){if(e.getElementById("fd-record-styles"))return;let t=e.createElement("style");t.id="fd-record-styles",t.textContent=Cu,(e.head??e.documentElement).append(t)}var Pu=0;function Vr(e,t){let n={...t},r=e.ownerDocument,i=yr(n.page,n.parent?{parent:n.parent.fields}:{});if(!i.ok)throw new Error(`This page cannot be shown:
|
|
63
|
-
${i.issues.map(
|
|
64
|
-
`)}`);let o=n.locale??i.page.language,a=o?xr(i.page,o):i.page,s=n.translate?Gn(a,n.translate):a,d=N=>{let K=o?xr(N,o):N;return n.translate?Gn(K,n.translate):K},l=Cr(o),f=n.preferences??ca(),c=vl(n,(N,K)=>k.say(N,K)),y=!n.form,p={...Vt[l],...n.labels},k={open:N=>Al({options:n,place:e,root:P,title:K=>d(K).title||K.id,back:p.back,missing:K=>A(p.pageMissing,{page:K}),say:(K,ue)=>k.say(K,ue),post:K=>g.post(K),name:()=>ar()||p.newRecord},N),say:(N,K)=>D(N,K),ask:N=>H(N),show:N=>{if(!W.get(N)?.())throw new Error(`No tab "${N}" can be shown here`)},openUrl:(N,K)=>K?r.defaultView?.open(N,"_blank","noopener,noreferrer"):r.defaultView?.location.assign(N),...n.host},g=n.form??pi({...n,page:s,host:k,messages:n.messages??Tt[l]}),m=Ze[l],b=n.dir??(o&&Mn(o)?"rtl":void 0),h=`fd${++Pu}`,v=[],S=v,x=[],F=!1,E=N=>`${h}-${N.replace(/[^A-Za-z0-9_-]/g,"_")}`,w=E,A=(N,K)=>N.replace(/\{(\w+)\}/g,(ue,Se)=>String(K[Se]??""));la(r),Cl(r);function R(N,K={},...ue){let Se=r.createElement(N);for(let[Ne,Re]of Object.entries(K))Re!==void 0&&Se.setAttribute(Ne,Re);return Se.append(...ue),Se}function I(N,K){let ue=kt(r,N,n.icons),Se=R("bdi",{},K);return ue?[ue,Se]:[Se]}let M=n.theme??s.look?.theme,P=R("form",{class:"fd-form",novalidate:"","data-fd-skin":Ln(n.skin??s.look?.skin,M),dir:b,lang:o,"data-max-width":s.maxWidth});jn(P,M?{...s.look,theme:M}:s.look),En(P,n.tokens);let H=n.confirm??cr,D=$l(P,R,p.dismiss),W=new Map,z=new Map;async function j(N,K){if(!N.hasAttribute("aria-busy")){N.setAttribute("aria-busy","true"),N.setAttribute("aria-disabled","true");try{let{reason:ue}=await K();(ue==="check"||ue==="save")&&(g.getState().saveProblem||ae(fe(g.getState())),be())}finally{N.removeAttribute("aria-busy"),N.removeAttribute("aria-disabled")}}}let V=[],B=[],$=new Map,Q=()=>en(g.getState()),X=!1,J=!1;function _(N,K){K&&N.style.setProperty("--fd-span",String(K))}let te=N=>({columns:1,onPage:N,labels:s.look?.labels});function Ve(N){let{form:K,page:ue}=N,Se=O=>E(N.prefix+O),Ne=O=>S.push(N.root?O:()=>O(K.getState()));function Re(O,G,de={}){let pe=ue.fields[O.field],Oe=Se(O.id),Le=Dr(O,pe.type,G),ye=R("div",{class:"fd-field","data-node":O.id,"data-field":O.field,"data-path":N.path+O.field,"data-type":pe.type,"data-labels":Le,"data-focus":O.focus&&N.root?"":void 0});O.colspan&&ye.style.setProperty("--fd-span",String(O.colspan));let je=O.label??pe.label,qe=R("label",{class:"fd-label",id:`${Oe}-label`,for:Oe},Du(je)),it=n.showValid&&!Iu.has(pe.type)?kt(r,"check"):null;it&&(it.classList.add("fd-valid-mark"),qe.append(it));let Ge=Ot({form:K,name:O.field,field:pe,node:O,id:Oe,document:r,labels:m,preferences:f,locale:l,dialogs:c},n.widgets);O.focus&&N.root&&V.push({wrapper:ye,focus:()=>Ge.focus()});let Ke=Ge.element.matches(Pl)?Ge.element:Ge.element.querySelector(Pl);Le==="hidden"&&!O.placeholder&&Ke?.setAttribute("placeholder",je);let Rt=Ke?.getAttribute("placeholder")??null,mt=O.placeholderWhen?.length?Ke:null,It=O.quiet??de.quiet,Dt=Ti(pe,O),yt=()=>It??P.getAttribute("data-fd-skin")==="quiet",ot=!!O.placeholder||Le==="hidden"||pe.type==="json"||pe.type==="properties",Nt=Ol(je,l,p),tn=()=>!ot&&ye.hasAttribute("data-quiet")?Nt:Rt,ur=O.placeholder||(Le==="hidden"?je:Nt),Fn=Ge.element instanceof HTMLSelectElement?Ge.element.querySelector(':scope > option[value=""]'):null,ro=Ge.element.matches(".fd-richtext")?Ge.element:Ge.element.querySelector(":scope > .fd-richtext"),Sa=Ge.element.querySelector(":scope > .fd-dot-label"),La=()=>{let Je=yt(),Ft=Dt&&Je;ye.toggleAttribute("data-in-quiet",Je),ye.toggleAttribute("data-quiet",Ft),Ke&&!mt&&ut(Ke,"placeholder",tn()),Fn&&(Fn.textContent=Ft?ur:""),ro&&!O.placeholder&&(ut(ro,"data-placeholder",Ft?Nt:null),ut(ro,"aria-placeholder",Ft?Nt:null)),Sa&&ut(Sa,"data-hint",Ft?ur:null)};B.push(La),La(),["INPUT","SELECT","TEXTAREA"].includes(Ge.element.tagName)||((Ge.element.getAttribute("role")?Ge.element:Ge.element.querySelector(`[id="${Oe}"][role]`))?.setAttribute("aria-labelledby",qe.id),qe.addEventListener("click",Ft=>{Ft.target.closest?.(".fd-help-tip-wrap, .fd-lock-wrap")||Ge.focus()}));let Br=O.help??pe.help,Ea=O.helpShown??ue.look?.helpShown??"below",io=Br&&Ea!=="tooltip"?R("div",{class:"fd-help",id:`${Oe}-help`},Br):null,An=Br&&Ea!=="below"?bt(`${Oe}-tip`,Br,A(p.helpFor,{label:je})):null;An&&Le==="hidden"?Ge.element.after(An.element):An&&(qe.append(An.element),qe.dir="auto");let pr=O.readonlyReason??de.reason,Dl=O.readonly===!0||pe.readonly===!0||pe.compute!==void 0,mr=null,$n=null,gr=!1,Wl=()=>{if($n)return $n;let Je=kt(r,"lock",n.icons)??"";return mr=pr?lt(`${Oe}-lock`,pr,A(p.locked,{label:je}),"fd-lock",Je):null,$n=mr?.element??R("span",{class:"fd-lock-wrap"},R("span",{class:"fd-lock","aria-hidden":"true"},Je)),Le==="hidden"?Ge.element.after($n):qe.insertBefore($n,An&&Le!=="after"?An.element:null),$n},oo=Je=>mr?.point(Je&&gr&&ye.hasAttribute("data-in-quiet"));if(pr)for(let[Je,Ft]of[["mouseenter",!0],["mouseleave",!1],["focusin",!0],["focusout",!1]])Ge.element.addEventListener(Je,()=>oo(Ft));let qr=R("div",{class:"fd-error",id:`${Oe}-error`,hidden:""}),_r=R("div",{class:"fd-warning",id:`${Oe}-warning`,role:"status",hidden:""});ye.append(...Le==="after"?[Ge.element,qe]:[qe,Ge.element],...io?[io]:[],qr,_r);let Tn=ue.look?.readonlyShown==="text"&&fa(pe,O)?ua({document:r,field:pe,node:O,id:Oe,locale:l,labels:m,dialogs:c}):null;if(Tn&&Ge.element.after(Tn.element),Tn&&pr)for(let[Je,Ft]of[["mouseenter",!0],["mouseleave",!1]])Tn.element.addEventListener(Je,()=>oo(Ft));Ge.destroy&&x.push(()=>Ge.destroy?.());let ao=!1,Ra="";ye.addEventListener("focusin",()=>ao=!0),ye.addEventListener("focusout",Je=>{ye.contains(Je.relatedTarget)||(ao=!1,queueMicrotask(()=>Fa(K.getState())))});let so;ye.addEventListener("focusin",Je=>{ye.contains(Je.relatedTarget)||(so=K.getState().values[O.field])}),ye.addEventListener("keydown",Je=>{Je.key!=="Escape"||Je.defaultPrevented||!ye.hasAttribute("data-quiet")||JSON.stringify(K.getState().values[O.field]??null)!==JSON.stringify(so??null)&&(Je.preventDefault(),Je.stopPropagation(),K.setValue(O.field,so??null))});let jl=O.tones!==void 0||O.bold!==void 0,Fa=Je=>{let Ft=K.node(O.id);if(nt(ye,Ft.invisible),ye.classList.toggle("fd-required",Ft.required),jl){let mn=K.fieldTone(O.id);ut(ye,"data-tone",mn.tone),ye.classList.toggle("fd-value-bold",mn.bold)}mt&&ut(mt,"placeholder",K.placeholder(O.id)??tn());let Bn=Je.errors[O.field];nt(qr,!Bn),$t(qr,Bn??"");let Aa=Je.warnings[O.field]??"";(!ao||!Aa)&&(Ra=Aa);let lo=[Bn?"":Ra,Je.warning&&Je.warningField===O.field?Je.warning:""].filter(Boolean).join(" ");if(nt(_r,!lo),$t(_r,lo),it){let mn=Je.values[O.field],Hl=mn!=null&&mn!==""&&!(Array.isArray(mn)&&!mn.length),Ta=!Ft.readonly&&!Bn&&Hl&&Je.dirty.includes(O.field)&&K.problem(O.field)===null;ye.classList.toggle("fd-valid",Ta),it.toggleAttribute("hidden",!Ta)}let qn=Ft.readonly||ke||N.locked(),$a=ye.hasAttribute("data-quiet");gr=qn&&!ke;let co=gr&&(!!pr||ye.hasAttribute("data-in-quiet")&&!Dl);(co||$n)&&nt(Wl(),!co),gr||oo(!1),ut(ye,"data-locked",$a&&co?"":null),ut(ye,"data-empty",$a&&Ou(Je.values[O.field])?"":null),Tn&&(nt(Ge.element,qn),nt(Tn.element,!qn),ut(ye,"data-read-text",qn?"":null),qn&&Tn.update(Je.values[O.field],Je.values)),Ge.update({value:Je.values[O.field],values:Je.values,readonly:qn,required:Ft.required,invalid:!!Bn,describedBy:[io?.id??An?.bubble.id,mr&&gr?mr.bubble.id:void 0,Bn?qr.id:void 0,lo?_r.id:void 0].filter(Boolean).join(" ")||void 0})};return Ne(Fa),ye}function bt(O,G,de){return lt(O,G,de,"fd-help-tip","?")}function lt(O,G,de,pe,Oe){let Le=R("span",{class:"fd-help-bubble",role:"tooltip",id:O,hidden:""},G),ye=R("button",{type:"button",class:pe,"aria-label":de,"aria-expanded":"false","aria-controls":O},Oe);pe==="fd-lock"&&ye.setAttribute("aria-describedby",O);let je=!1,qe=it=>{Le.hidden=!it,ye.setAttribute("aria-expanded",String(it)),it&&vt(Le)};return ye.addEventListener("mouseenter",()=>qe(!0)),ye.addEventListener("mouseleave",()=>qe(je)),ye.addEventListener("focus",()=>qe(!0)),ye.addEventListener("blur",()=>(je=!1,qe(!1))),ye.addEventListener("click",it=>{it.preventDefault(),je=!je,qe(je)}),ye.addEventListener("keydown",it=>{it.key!=="Escape"||Le.hidden||(it.stopPropagation(),je=!1,qe(!1))}),{element:R("span",{class:pe==="fd-lock"?"fd-lock-wrap":"fd-help-tip-wrap"},ye,Le),bubble:Le,point:it=>qe(it||je)}}function vt(O){O.style.transform="";let G=O.getBoundingClientRect(),de=r.documentElement.clientWidth,pe=8,Oe=G.right>de-pe?de-pe-G.right:G.left<pe?pe-G.left:0;Oe&&(O.style.transform=`translateX(${Math.round(Oe)}px)`)}function dt(O,G){Ne(()=>nt(O,K.node(G).invisible))}function Qe(O){let G=R("button",{type:"button",class:`fd-button fd-button-${O.style??"secondary"}`,"data-node":O.id},...I(O.icon,O.label));return O.hotkey&&Hn(G,O.hotkey,O.label),_(G,O.colspan),G.addEventListener("click",()=>{j(G,()=>K.runAction(O.id))}),dt(G,O.id),C(O,G)}function ct(O,G=!1){let de=O.style??"paragraph",pe=ka(r,ue.fields,O.text,l),Oe=G?R("span",{class:`fd-oneline-words fd-text-${de}`,"data-node":O.id},...pe.nodes):de==="alert"?R("div",{class:`fd-alert fd-text-alert fd-tone-${O.tone??"info"}`,role:"status","data-node":O.id},R("span",{class:"fd-alert-message"},...pe.nodes)):R(de==="heading"?"h3":"p",{class:`fd-text-${de}`,"data-node":O.id},...pe.nodes);return _(Oe,O.colspan),dt(Oe,O.id),Ne(Le=>pe.update(Le.values)),Oe}function Be(O){let G=R("div",{class:"fd-slot","data-slot":O.name,"data-node":O.id}),de=n.slots?.[O.name]?.(G,{form:K,name:O.name});return de&&x.push(de),dt(G,O.id),G}function st(O,G,de){let pe=R("div",{class:"fd-grid"});if(G!==null&&(pe.style.setProperty("--fd-columns",String(gn(G))),gn(G)===12&&pe.setAttribute("data-twelfths",""),typeof G=="object"))for(let Oe of["medium","narrow"]){let Le=G[Oe];Le!==void 0&&(pe.setAttribute(`data-columns-${Oe}`,String(Le)),pe.style.setProperty(`--fd-columns-${Oe}`,String(Le)))}return pe.append(...O.map(Oe=>T(Oe,de))),pe}function we(O,G){let[de]=O.children;if(!G.arrangement||G.at==="tracks"||gn(O.columns)!==12||O.children.length<2||de?.type!=="field"||O.children.reduce((Le,ye)=>Le+(ye.colspan??1),0)>12)return null;let pe=ue.fields[de.field]?.type,Oe=pe?Dr(de,pe,G.inner.labels):"hidden";return Oe===void 0?"skin":Oe==="beside"?"beside":null}function Ue(O,G){let de=R("div",{class:"fd-field fd-oneline","data-node":O.id,"data-style":"inline","data-labels":G.labels});_(de,O.colspan);let pe=R("div",{class:"fd-oneline-row",role:"group"},...Vl(O.children).map(Le=>{let ye=Le.map(je=>T(je,{columns:1,onPage:!1,inline:!0,quiet:O.quiet??G.quiet,reason:O.readonlyReason??G.reason}));return ye.length===1?ye[0]:R("span",{class:"fd-oneline-pair"},...ye)}));if(O.title){let Le=R("span",{class:"fd-label",id:Se(`${O.id}-label`)},O.title);pe.setAttribute("aria-labelledby",Le.id),de.append(Le)}de.append(pe),dt(de,O.id);let Oe=()=>de.toggleAttribute("data-in-quiet",O.quiet??G.quiet??P.getAttribute("data-fd-skin")==="quiet");return B.push(Oe),Oe(),de}function ve(O,G){if(O.style==="inline")return Ue(O,G);let de=Zi(O,G),pe=R(de.arrangement?"div":"fieldset",{class:"fd-section","data-node":O.id,"data-style":de.style,"data-place":de.at,"data-on-page":de.style==="card"&&G.onPage?"":void 0});_(pe,O.colspan);let Oe=we(O,de);Oe&&pe.setAttribute("data-row",Oe),O.labelWidth&&pe.style.setProperty("--fd-label-width",`${O.labelWidth}px`);let Le=O.description?R("p",{class:"fd-section-description"},O.description):null,ye=st(O.children,de.at==="tracks"?null:O.columns,de.inner);if(O.title&&O.collapsible){ye.id=Se(`${O.id}-content`);let je=R("button",{type:"button",class:"fd-section-toggle","aria-controls":ye.id},R("span",{class:"fd-section-chevron","aria-hidden":"true"}),...I(O.icon,O.title)),qe=O.collapsed!==!0,it=Ge=>{qe=Ge,je.setAttribute("aria-expanded",String(qe)),ye.hidden=!qe,Le&&(Le.hidden=!qe),pe.classList.toggle("fd-section-folded",!qe)};je.addEventListener("click",()=>it(!qe)),$.set(pe,()=>it(!0)),it(qe),pe.append(R("legend",{class:"fd-section-title"},je))}else O.title&&pe.append(R("legend",{class:"fd-section-title"},...I(O.icon,O.title)));return Le&&pe.append(Le),pe.append(ye),dt(pe,O.id),pe}function u(O,G){let de=R("div",{class:"fd-tabs","data-node":O.id});_(de,O.colspan);let pe=R("div",{class:"fd-tablist",role:"tablist"}),Oe=null,Le=O.children[0].id,ye=Ke=>{Oe=Le=Ke,Q(),K.shown(Ke)},je=O.children.map(Ke=>{let Rt=Se(`${Ke.id}-tab`),mt=Se(`${Ke.id}-panel`),It=R("button",{type:"button",class:"fd-tab",role:"tab",id:Rt,"aria-controls":mt,"data-node":Ke.id},...I(Ke.icon,Ke.label)),Dt=R("div",{class:"fd-tabpanel",role:"tabpanel",id:mt,"aria-labelledby":Rt}),yt=[],ot=!1,Nt=()=>{if(ot)return;ot=!0;let Fn=S;S=yt;try{Dt.append(st(Ke.children,1,{columns:1,onPage:G.onPage,labels:G.labels,quiet:G.quiet,reason:G.reason}))}finally{S=Fn}},tn=()=>!K.node(Ke.id).invisible&&(ye(Ke.id),!0);It.addEventListener("click",()=>ye(Ke.id)),W.has(Ke.id)||W.set(Ke.id,tn);let ur=L(Ke.children);if(N.root)for(let Fn of ur)z.has(Fn)||z.set(Fn,tn);return pe.append(It),{tab:Ke,button:It,panel:Dt,own:yt,build:Nt,fields:ur}});pe.addEventListener("keydown",Ke=>{let Rt=je.filter(ot=>!ot.button.hidden),mt=Rt.findIndex(ot=>ot.tab.id===Le),It={ArrowRight:1,ArrowLeft:-1,Home:-mt,End:Rt.length-1-mt}[Ke.key];if(It===void 0||mt===-1)return;Ke.preventDefault();let Dt=P.getAttribute("dir")==="rtl"&&(Ke.key==="ArrowRight"||Ke.key==="ArrowLeft"),yt=Rt[(mt+(Dt?-It:It)+Rt.length)%Rt.length];ye(yt.tab.id),yt.button.focus()});let qe=Tl(pe,R);x.push(qe.destroy),de.append(qe.element,...je.map(Ke=>Ke.panel));let it="",Ge="";return Ne(Ke=>{let Rt=K.node(O.id).invisible;nt(de,Rt);let mt=je.filter(ot=>!K.node(ot.tab.id).invisible);Oe!==null&&mt.some(ot=>ot.tab.id===Oe)?Le=Oe:mt.length&&(Le=mt[0].tab.id);let Dt=K.getState().errors;for(let ot of je){let Nt=ot.tab.id===Le;if(nt(ot.button,!mt.includes(ot)),ut(ot.button,"aria-selected",String(Nt)),ot.button.tabIndex!==(Nt?0:-1)&&(ot.button.tabIndex=Nt?0:-1),ut(ot.button,"data-problem",ot.fields.some(tn=>Dt[tn])?"":null),nt(ot.panel,!Nt),Nt&&!Rt){ot.build();for(let tn of ot.own)tn(Ke)}}let yt=mt.map(ot=>ot.tab.id).join(" ");if(yt!==it&&(it=yt,qe.measure()),Le!==Ge&&pe.clientWidth){Ge=Le;let ot=je.find(Nt=>Nt.tab.id===Le);ot&&qe.reveal(ot.button)}}),de}function L(O){return O.flatMap(G=>G.type==="field"?[G.field]:G.type==="section"?L(G.children):G.type==="tabs"?G.children.flatMap(de=>L(de.children)):[])}function T(O,G){return C(O,q(O,G))}function C(O,G){return O.hideOn?.length&&(G.dataset.hideOn=O.hideOn.join(" ")),G}function q(O,G){switch(O.type){case"field":return Re(O,G.labels,G);case"button":return Qe(O);case"text":return ct(O,G.inline);case"slot":return Be(O);case"section":return ve(O,G);case"tabs":return u(O,G);case"divider":case"spacer":case"image":return ee(O);case"form":return Fe(O,G);case"map":return Z(O)}}function Z(O){if(!n.maps)return F||console.warn("[Fieldia] This page has a map: give the viewer `maps` (mapParts from @fieldia/map) to draw it."),F=!0,R("div",{class:"fd-map-part","data-node":O.id,hidden:""});let G=n.maps({node:O,page:ue,form:K,document:r,locale:l,icons:n.icons});return G.element.classList.add("fd-map-part"),G.element.dataset.node=O.id,_(G.element,O.colspan??12),Ne(de=>G.update(de)),G.destroy&&x.push(()=>G.destroy?.()),dt(G.element,O.id),G.element}function ee(O){let G=O.type==="divider"?R("hr",{class:"fd-divider","data-node":O.id}):O.type==="spacer"?R("div",{class:"fd-block fd-spacer","aria-hidden":"true","data-node":O.id}):$e(O);return O.type!=="divider"&&O.colspan&&G.style.setProperty("--fd-span",String(O.colspan)),dt(G,O.id),G}function $e(O){let G=R("img",{class:"fd-image",src:O.src,alt:O.alt,loading:"lazy"}),de=O.href&&/^(https?:\/\/|mailto:)/i.test(O.href)?O.href:void 0,pe=R("figure",{class:"fd-block fd-figure","data-node":O.id,"data-align":O.align},de?R("a",{href:de,target:"_blank",rel:"noopener noreferrer"},G):G,...O.caption?[R("figcaption",{class:"fd-caption"},O.caption)]:[]),Oe=typeof O.width=="number"?`${O.width}px`:O.width&&{small:"160px",medium:"320px",large:"480px",full:"100%"}[O.width];return Oe&&pe.style.setProperty("--fd-image-width",Oe),pe}function Fe(O,G){let de=R("fieldset",{class:"fd-section fd-form-part","data-node":O.id,"data-style":"card","data-on-page":G.onPage?"":void 0,"aria-busy":"true"});_(de,O.colspan);let pe=R("p",{class:"fd-form-part-note"},p.loading);de.append(pe),dt(de,O.id);let Oe=je=>{de.removeAttribute("aria-busy"),pe.textContent=je,pe.classList.add("fd-form-part-problem")},Le=je=>{if(J)return;if(!je)return Oe(A(p.formMissing,{page:O.page}));let qe=d(je),it=qe.title||je.id,Ge=N.chain.findIndex(yt=>yt.id===je.id);if(Ge!==-1)return Oe(A(p.formInItself,{page:it,chain:[...N.chain.slice(Ge).map(yt=>yt.title),it].join(" \u2192 ")}));if(je.layout.type!=="sections"&&je.layout.type!=="tabs")return Oe(A(p.formNotPlaceable,{page:it}));let Ke=yr(qe),Rt;try{if(!Ke.ok)throw new Error(Ke.issues.map(yt=>`${yt.path}: ${yt.message}`).join("; "));Rt=K.embed(O.id,qe)}catch(yt){return console.warn(`Fieldia: the saved form "${je.id}" cannot be shown: ${yt.message}`),Oe(A(p.formBroken,{page:it}))}let mt=O.title??qe.title??"";de.setAttribute("data-title",mt),mt&&de.prepend(R("legend",{class:"fd-section-title"},...I(void 0,mt)));let It=Ve({root:!1,form:Rt,page:qe,prefix:`${N.prefix}${O.id}-`,chain:[...N.chain,{id:je.id,title:it}],locked:()=>N.locked()||K.node(O.id).readonly,path:`${N.path}${O.name}.`}),Dt=qe.layout;pe.replaceWith(It.grid(Dt.type==="tabs"?[Dt]:Dt.children,1,{columns:1,onPage:!1,labels:G.labels,quiet:G.quiet})),de.removeAttribute("aria-busy"),x.push(Rt.subscribe(Q)),X&&Q()},ye;try{ye=Ir(n,O.version===void 0?{id:O.page}:{id:O.page,version:O.version})}catch{ye=null}return ye instanceof Promise?ye.then(Le,()=>Le(null)):Le(ye),de}return{item:T,grid:st,fieldItem:Re,buttonItem:Qe,hideWhen:dt,slotItem:Be}}let{item:Ie,grid:Ee,fieldItem:Me,buttonItem:ie,hideWhen:ge,slotItem:oe}=Ve({root:!0,form:g,page:s,prefix:"",chain:[{id:s.id,title:s.title||s.id}],locked:()=>!1,path:""}),ke=n.readonly===!0,De=n.editSwitch?R("button",{type:"button",class:"fd-button fd-edit-switch"}):null;De?.addEventListener("click",async()=>{if(ke)ke=!1;else{if(g.getState().dirty.length&&!await g.save()){g.getState().saveProblem||ae(fe(g.getState())),be();return}ke=!0}P.toggleAttribute("data-readonly",ke),g.setEditing(!ke),en(g.getState())}),P.toggleAttribute("data-readonly",ke),g.setEditing(!ke),v.push(()=>{De&&(De.textContent=ke?p.edit:p.done,De.classList.toggle("fd-button-primary",ke))});let xe=R("div",{class:"fd-status",role:"status","aria-live":"polite"}),Xe=R("button",{type:"button",class:"fd-button fd-button-link fd-retry",hidden:""},p.retry);Xe.addEventListener("click",()=>{Zt()});let Y=R("div",{class:"fd-status-box"},xe,Xe),ne=()=>s.data.kind==="responses"?p.notSent:p.notSaved;function fe(N){let K=[...P.querySelectorAll(".fd-field[data-path]")],ue=[];for(let Ne of Object.keys(N.errors)){let Re;for(let Qe=Ne;Qe&&!Re;Qe=Qe.slice(0,Math.max(0,Qe.lastIndexOf("."))))Re=K.find(ct=>ct.getAttribute("data-path")===Qe&&!ct.hidden);let bt=Ne.split(".")[0],lt=Re?.querySelector(":scope > .fd-label")?.firstChild?.textContent??s.fields[bt]?.label??bt,vt=Re?.closest(".fd-form-part")?.getAttribute("data-title"),dt=vt?`${lt} (${vt})`:lt;ue.some(Qe=>Qe.name===dt)||ue.push({name:dt,at:Re?K.indexOf(Re):1/0})}let Se=ue.sort((Ne,Re)=>Ne.at-Re.at).map(Ne=>Ne.name);return Se.length?A(p.checkFields,{what:ne(),fields:Se.join(", ")}):ne()}let U;v.push(N=>{let K=N.saveProblem,ue=N.status==="saving"?p.saving:N.status==="saved"?p.saved:N.status==="loading"?p.loading:N.status==="error"&&K?K.kind==="fields"?fe(N):K.kind==="other"?K.message:ne():N.status==="error"?N.error??"":"";ut(xe,"aria-live",N.status==="error"&&K?"off":"polite"),$t(xe,ue),nt(Xe,!(N.status==="error"&&K?.kind==="other")),xe.classList.toggle("fd-status-error",N.status==="error"),xe.classList.toggle("fd-status-saved",N.status==="saved"),n.saveStatus==="toast"&&(clearTimeout(U),Y.hidden=!ue,N.status==="saved"&&(U=setTimeout(()=>Y.hidden=!0,2500)))});let re=R("button",{type:"button",class:"fd-button fd-retry"},p.retry);re.addEventListener("click",()=>{Zt()});let Ce=R("div",{class:"fd-banner fd-tone-warning",role:"alert",hidden:""},R("span",{class:"fd-banner-text"},p.offline),re),Pe=R("div",{class:"fd-announce",role:"alert","aria-live":"assertive"});function ae(N){Pe.textContent="",setTimeout(()=>Pe.textContent=N,0)}let le=null;v.push(N=>{N.saveProblem!==le&&(le=N.saveProblem,Ce.hidden=le?.kind!=="network",le&&(le.kind==="rule"?cr(le.message,!1):le.kind==="fields"?ae(fe(N)):le.kind==="other"&&ae(le.message)))});let se=R("div",{class:"fd-draft",hidden:""}),ce=R("span"),me=R("button",{type:"button",class:"fd-button fd-button-primary"},p.restore),he=R("button",{type:"button",class:"fd-button fd-button-link"},p.discardDraft);me.addEventListener("click",()=>g.restoreDraft()),he.addEventListener("click",()=>g.discardDraft()),se.append(ce,me,he),v.push(N=>{nt(se,!N.draft),N.draft&&(ce.textContent=A(p.draftFound,{time:new Date(N.draft.savedAt).toLocaleString()}))});function be(){if(![...P.querySelectorAll('[aria-invalid="true"]')].find(Se=>!Se.closest(".fd-tabpanel[hidden]"))){let Se=g.getState().errors,Ne=[...z.keys()].find(Re=>Se[Re]);Ne&&z.get(Ne)?.()}let K=[...P.querySelectorAll('[aria-invalid="true"]')].find(Se=>!Se.closest(".fd-tabpanel[hidden]"))??null;if(!K)return;for(let Se=K.closest(".fd-section-folded");Se;Se=Se.parentElement?.closest(".fd-section-folded")??null)$.get(Se)?.();if(!K.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(K.matches("input, select, textarea, button")?K:K.querySelector("input, select, textarea, button"))?.focus()}let rt=R("div",{class:"fd-done",hidden:""},R("p",{class:"fd-done-title"},p.submitted)),ht=R("button",{type:"button",class:"fd-button"},p.submitAnother);rt.append(ht);let St=R("div",{class:"fd-content"});async function Zt(){if(!await g.save()){g.getState().saveProblem||ae(fe(g.getState())),be();return}s.data.kind==="responses"&&(St.hidden=!0,rt.hidden=!1)}ht.addEventListener("click",()=>{g.reset(),St.hidden=!1,rt.hidden=!0});function ar(){let N=g.getState();if(N.recordId==null)return"";let K=s.layout.type==="sheet"?s.layout.title?.field:void 0;return(K?At(s.fields[K],N.values[K],N.values,l):"")||s.title||""}function jr(N){if(s.data.kind!=="record")return null;let K=Ml({doc:r,el:R,form:g,toolbar:N,records:n.records,breadcrumbs:n.breadcrumbs,labels:p,icons:n.icons,uid:w,fill:A,withIcon:I,press:j,name:ar,render:Q,async leave(){if(!g.getState().dirty.length)return!0;let ue=await g.save();return ue||(g.getState().saveProblem||ae(fe(g.getState())),be()),ue}});return K?(v.push(K.update),x.push(K.destroy),K.element):null}function Qt(){if(!s.title&&!s.description)return null;let N=R("header",{class:"fd-page-head"});return s.title&&N.append(R("h1",{class:"fd-page-title"},s.title)),s.description&&N.append(R("p",{class:"fd-page-description"},s.description)),N}function _t(N){return!N?.length||n.showActions===!1?null:R("div",{class:"fd-actions fd-actions-end fd-page-footer"},Y,...N.map(ie))}function jt(N){let K=R("div",{class:"fd-sections","data-node":N.id},...N.children.map(Re=>Ie(Re,te(!0)))),ue=_t(N.footer);if(ue)return R("div",{},K,ue);let Se=R("button",{type:"submit",class:"fd-button fd-button-primary"},s.data.kind==="responses"?p.submit:p.save),Ne=R("div",{class:"fd-actions fd-actions-end"},Y,Se);if(s.data.kind==="record"){let Re=R("button",{type:"button",class:"fd-button"},p.discard);Re.addEventListener("click",()=>g.reset()),Ne.insertBefore(Re,Se),v.push(bt=>{let lt=bt.dirty.length>0&&bt.status!=="saving"&&!ke;nt(Se,!lt),nt(Re,!lt)})}else v.push(()=>nt(Se,ke));return De&&Ne.prepend(De),n.showActions===!1?R("div",{},K):s.actionsPosition==="top"?(Ne.classList.add("fd-actions-top"),R("div",{},Ne,K)):R("div",{},K,Ne)}function fn(N){let K=R("div",{class:"fd-wizard","data-node":N.id}),ue=R("div",{class:"fd-progress-text"}),Se=R("span");K.append(R("div",{class:"fd-progress"},ue,R("div",{class:"fd-progress-bar"},Se)));let Ne=N.clickable?R("ol",{class:"fd-steps-list"}):null,Re=new Map;if(Ne){for(let Be of N.children){let st=R("button",{type:"button",class:"fd-step-link"},...I(Be.icon,Be.label));st.addEventListener("click",()=>{g.goTo(Be.id)?ct():be()}),Re.set(Be.id,st),Ne.append(R("li",{},st))}K.append(R("nav",{class:"fd-steps","aria-label":p.steps},Ne))}let bt=N.children.map(Be=>{let st=R("section",{class:"fd-step","data-node":Be.id,"aria-labelledby":w(`${Be.id}-title`)});return st.append(R("h2",{class:"fd-step-title",id:w(`${Be.id}-title`)},...I(Be.icon,Be.label))),Be.description&&st.append(R("p",{class:"fd-section-description"},Be.description)),st.append(Ee(Be.children,1,te(!1))),K.append(st),{step:Be,panel:st}}),lt=R("button",{type:"button",class:"fd-button"},N.backLabel??p.back),vt=R("button",{type:"button",class:"fd-button fd-button-link"},p.skip),dt=R("button",{type:"submit",class:"fd-button fd-button-primary"});K.append(R("div",{class:"fd-wizard-nav"},lt,R("span",{class:"fd-spacer"}),Y,vt,dt)),lt.addEventListener("click",()=>{g.back()&&ct()}),vt.addEventListener("click",()=>{g.skip()&&ct()});let Qe=()=>{let Be=g.steps();return Be.indexOf(g.getState().step??"")===Be.length-1};Lt=async()=>{if(Qe())return Zt();g.next()?ct():be()};function ct(){bt.find(st=>st.step.id===g.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return v.push(Be=>{let st=g.steps(),we=Math.max(0,st.indexOf(Be.step??""));ue.textContent=A(p.stepOf,{n:we+1,total:st.length}),Se.style.width=`${(we+1)/Math.max(1,st.length)*100}%`;for(let{step:ve,panel:u}of bt)u.hidden=ve.id!==Be.step;let Ue=we===st.length-1;lt.hidden=we===0,vt.hidden=Ue||!N.children.find(ve=>ve.id===Be.step)?.optional,dt.textContent=Ue?N.finishLabel??p.submit:N.nextLabel??p.next;for(let[ve,u]of Re){let L=st.indexOf(ve);u.parentElement.hidden=L===-1,u.classList.toggle("fd-step-done",L!==-1&&L<we),u.classList.toggle("fd-step-skipped",Be.skipped.includes(ve)),ve===Be.step?u.setAttribute("aria-current","step"):u.removeAttribute("aria-current")}}),K}function eo(N){let K=R("div",{class:"fd-sheet-page","data-node":N.id}),ue=R("div",{class:"fd-actions"}),Se=R("button",{type:"submit",class:"fd-button fd-button-primary"},p.save),Ne=R("button",{type:"button",class:"fd-button"},p.discard);Ne.addEventListener("click",()=>g.reset());let Re=s.actionsPosition==="bottom",bt=R("div",{class:"fd-actions fd-actions-end fd-sheet-foot"}),lt=_t(N.footer);n.showActions===!1||lt?ue.append(...(N.buttons??[]).map(ie)):Re?(ue.append(...(N.buttons??[]).map(ie)),bt.append(Y,Ne,Se)):ue.append(Se,Ne,...(N.buttons??[]).map(ie),Y),De&&n.showActions!==!1&&ue.prepend(De),v.push(we=>{let Ue=we.dirty.length>0&&we.status!=="saving"&&!ke;Se.hidden=!Ue,Ne.hidden=!Ue});let vt=R("div",{class:"fd-header"},ue),dt=N.statusbar?.position==="title";N.statusbar&&!dt&&vt.append(un(N.statusbar));let Qe=R("div",{class:"fd-card"}),ct=[...N.ribbon?[N.ribbon]:[],...N.ribbons??[]];if(ct.length){let we=R("div",{class:"fd-ribbon-frame"}),Ue=ct.map(ve=>{let u=R("div",{class:`fd-ribbon fd-tone-${ve.tone??"muted"}`,"data-node":ve.id,title:ve.tooltip},ve.label);return we.append(u),{ribbon:ve,element:u}});v.push(ve=>{let u=!1;for(let{ribbon:L,element:T}of Ue){let C=!u&&!g.node(L.id).invisible;if(u||(u=C),nt(T,!C),!C)continue;let q=L.labelField?At(s.fields[L.labelField],ve.values[L.labelField],ve.values,l):"";$t(T,q||L.label)}}),Qe.append(we)}if(N.statButtons?.length){let we=R("div",{class:"fd-stats"}),Ue=(ve,u)=>ve&&s.fields[ve]?At(s.fields[ve],u[ve],u,l):"";for(let ve of N.statButtons){let u=R("span",{class:"fd-stat-value"}),L=R("span",{class:"fd-stat-label"},ve.label),T=ve.secondField&&ve.secondLabel!==void 0?{value:R("span",{class:"fd-stat-value"}),label:R("span",{class:"fd-stat-label"},ve.secondLabel)}:null,C=kt(r,ve.icon,n.icons),q=T?R("span",{class:"fd-stat-words fd-stat-pair"},R("span",{class:"fd-stat-row"},L,u),R("span",{class:"fd-stat-row"},T.label,T.value)):R("span",{class:"fd-stat-words"},u,L),Z=ve.help?w(`${ve.id}-help`):void 0,ee=R("button",{type:"button",class:"fd-stat","data-node":ve.id,title:ve.help||void 0,"aria-describedby":Z},...C?[C,q]:[q]);Z&&we.append(R("span",{class:"fd-sr-only",id:Z},ve.help)),ee.addEventListener("click",()=>{j(ee,()=>g.runAction(ve.id))}),v.push($e=>{ee.hidden=g.node(ve.id).invisible;let Fe=$e.values,O=Ue(ve.unitField,Fe)||ve.unit||"",G=Ue(ve.field,Fe),de=Ue(ve.secondField,Fe);T?($t(u,G),$t(T.value,[de,O].filter(Boolean).join(" "))):$t(u,[[G,de].filter(Boolean).join(" / "),G||de?O:""].filter(Boolean).join(" ")),$t(L,Ue(ve.labelField,Fe)||ve.label)}),we.append(ee)}v.push(()=>{we.hidden=[...we.querySelectorAll(":scope > .fd-stat")].every(ve=>ve.hidden)}),Qe.append(we)}for(let we of N.alerts??[]){let Ue=ka(r,s.fields,we.message,l),ve=R("span",{class:"fd-alert-message"},...Ue.nodes),u=!1,L=R("div",{class:`fd-alert fd-tone-${we.tone??"info"}`,role:"status","data-node":we.id},ve);if(we.buttons?.length&&L.append(R("span",{class:"fd-alert-actions"},...we.buttons.map(T=>ie({...T,style:T.style??"link"})))),v.push(T=>{Ue.update(T.values);let C=we.messageField?T.values[we.messageField]:null,q=typeof C=="string"?C.trim():"";q?$t(ve,q):u&&ve.replaceChildren(...Ue.nodes),u=!!q}),we.dismissible){let T=!1,C=R("button",{type:"button",class:"fd-alert-close","aria-label":p.dismiss},"\xD7");C.addEventListener("click",()=>{T=!0,L.hidden=!0}),L.append(C),v.push(()=>{L.hidden=T||g.node(we.id).invisible})}else ge(L,we.id);Qe.append(L)}if(N.badges?.length){let we=R("div",{class:"fd-badges"});for(let Ue of N.badges){let ve=R("span",{class:`fd-badge fd-tone-${Ue.tone??"muted"}`,"data-node":Ue.id},...I(Ue.icon,Ue.label));ge(ve,Ue.id),we.append(ve)}v.push(()=>{we.hidden=[...we.children].every(Ue=>Ue.hidden)}),Qe.append(we)}if(N.title){let we=R("div",{class:"fd-title"});N.title.label&&we.append(R("label",{class:"fd-title-label",for:w("#title")},N.title.label)),N.title.above?.length&&we.append(R("div",{class:"fd-title-above"},...N.title.above.map(T=>Me(T))));let Ue=Me({type:"field",id:"#title",field:N.title.field,placeholder:N.title.placeholder,...N.title.placeholderWhen?{placeholderWhen:N.title.placeholderWhen}:{},...N.title.focus?{focus:!0}:{}}),ve=N.title.before??[],u=N.title.after??[];if(ve.length||u.length){Ue.classList.add("fd-title-name");let T=C=>{let q=Me(C);return q.classList.add("fd-title-side"),q};we.append(R("div",{class:"fd-title-line"},...ve.map(T),Ue,...u.map(T)))}else we.append(Ue);N.title.subtitleField&&we.append(Me({type:"field",id:"#subtitle",field:N.title.subtitleField})),N.title.below?.length&&we.append(R("div",{class:"fd-title-below"},...N.title.below.map(T=>Me(T))));let L=R("div",{class:"fd-title-row"},we);if(N.title.avatarField){let T=Me({type:"field",id:"#avatar",field:N.title.avatarField});T.classList.add("fd-avatar"),L.append(T)}Qe.append(L)}N.statusbar&&dt&&Qe.append(R("div",{class:"fd-title-statusbar"},un(N.statusbar))),Qe.append(Ee(N.children,1,te(!1))),lt&&Qe.append(lt),Re&&n.showActions!==!1&&(Qe.append(bt),v.push(we=>{bt.hidden=we.dirty.length===0&&!xe.textContent}));let Be=R("div",{class:"fd-sheet-layout"},Qe);if(N.attachmentPreview){let we=Nl({doc:r,el:R,form:g,page:s,node:N.attachmentPreview,dataSource:n.dataSource,labels:p,fill:A});Be.classList.add("fd-has-preview"),Be.append(we.element),v.push(we.update),x.push(we.destroy)}N.sidePanel&&(Be.classList.add("fd-has-side"),N.sidePanelBeside&&Be.setAttribute("data-side-beside",N.sidePanelBeside),Be.append(R("aside",{class:"fd-side"},oe(N.sidePanel))));let st=jr(N.toolbar);return K.append(...st?[st]:[],vt,Be),K}function un(N){let K=s.fields[N.field],ue={clickable:N.clickable===!0};N.visibleStates&&(ue.visibleStates=N.visibleStates);for(let Re of["durationsField","fold","saves"])N[Re]!==void 0&&(ue[Re]=N[Re]);let Se={type:"field",id:"#statusbar",field:N.field,widget:"statusbar",options:ue},Ne=Ot({form:g,name:N.field,field:K,node:Se,id:w("statusbar"),document:r,labels:m,preferences:f,locale:l,dialogs:c},n.widgets);return Ne.destroy&&x.push(()=>Ne.destroy?.()),v.push(Re=>{nt(Ne.element,g.node("#statusbar").invisible),Ne.update({value:Re.values[N.field],values:Re.values,readonly:g.node("#statusbar").readonly||ke,required:!1,invalid:!1})}),Ne.element}let Lt=null,Et=s.layout,pn;if(Et.type==="sheet")pn=eo(Et);else if(Et.type==="wizard")pn=fn(Et);else if(Et.type==="tabs")pn=jt({id:`${Et.id}-page`,children:[Et]});else if(Et.type==="list"){let N=Fl({page:s,node:Et,form:g,dataSource:n.dataSource,doc:r,el:R,labels:p,locale:l,fill:A,press:j,withIcon:I,uid:w,icons:n.icons,preferences:f,onOpenRecord:n.onOpenRecord,...n.listFilter?{fixedFilter:n.listFilter}:{},...n.listViews?{views:n.listViews}:{}});x.push(N.destroy),pn=N.element}else pn=jt(Et);let Rn=Et.type==="sheet"?null:Qt(),zn=Et.type==="sections"||Et.type==="tabs"?jr(void 0):null;St.append(...zn?[zn]:[],...Rn?[Rn]:[],Ce,se,pn),P.append(St,rt,Pe),n.saveStatus==="toast"?(Y.classList.add("fd-toast"),P.append(Y)):n.saveStatus==="bar"&&(Y.classList.add("fd-status-bar"),St.prepend(Y)),P.addEventListener("mouseover",N=>{let K=N.target;if(K.tagName!=="INPUT"||!K.classList.contains("fd-input")||K.title&&!K.hasAttribute("data-cut-title"))return;let ue=K.scrollWidth>K.clientWidth&&K.value!=="";ut(K,"title",ue?K.value:null),ut(K,"data-cut-title",ue?"":null)}),P.addEventListener("submit",N=>{N.preventDefault(),Et.type!=="list"&&(Lt?Lt():Zt())});function to(){let N=r.activeElement;N&&P.contains(N)&&(N.tagName==="INPUT"||N.tagName==="TEXTAREA")&&N.dispatchEvent(new Event("change",{bubbles:!0}))}function no(N){let K=[...P.querySelectorAll(".fd-field")].filter(Ne=>!Ne.closest('[hidden], [data-type="one2many"] .fd-field, .fd-form-dialog')&&!Ne.parentElement?.closest('[data-type="one2many"]')),ue=N.closest(".fd-field"),Se=K.slice(K.indexOf(ue)+1);for(let Ne of Se){let Re=Ne.querySelector('input:not([type="hidden"]):not([readonly]):not([disabled]), select:not([disabled]), textarea:not([readonly]), [contenteditable="true"]');if(Re)return Re}return null}P.addEventListener("keydown",N=>{if(N.isComposing||N.key!=="Enter"||Et.type==="list"||N.target.closest(".fd-slot"))return;let K=n.keys??{};if(N.ctrlKey||N.metaKey){if(K.saveWithCtrlEnter===!1||n.showActions===!1||N.target.closest(".ag-root-wrapper"))return;N.preventDefault(),to(),Lt?Lt():Zt();return}let ue=N.target,Se=ue.getAttribute("aria-multiline")==="false";N.defaultPrevented&&!Se||!K.enterMovesToNext||N.shiftKey||N.altKey||ue.tagName!=="INPUT"&&ue.tagName!=="SELECT"&&!Se||ue.closest('[data-type="one2many"]')||["button","submit","reset","file"].includes(ue.type)||(N.preventDefault(),no(ue)?.focus())});function Ut(N){let K=N instanceof Element?N.closest(".fd-form"):null;if(K)return K===P&&!P.querySelector(":scope > .fd-dialog-backdrop");let ue=[...r.querySelectorAll('[aria-modal="true"]')].filter(Ne=>!Ne.closest("[hidden]"));return(ue[ue.length-1]??r).querySelector(".fd-form")===P}let sr=N=>{if(N.key==="Alt"){Ut(N.target)&&P.setAttribute("data-hotkeys","");return}let K=Ji(N);if(!K||!Ut(N.target))return;let ue=[...P.querySelectorAll(`button[data-hotkey="${K}"]`)].find(Se=>Se.closest(".fd-form")===P&&!Se.closest("[hidden]")&&!Se.disabled&&!Se.hasAttribute("aria-busy"));ue&&(N.preventDefault(),P.removeAttribute("data-hotkeys"),ue.click())},dr=()=>P.removeAttribute("data-hotkeys"),lr=N=>N.key==="Alt"&&dr();r.addEventListener("keydown",sr),r.addEventListener("keyup",lr),r.defaultView?.addEventListener("blur",dr),x.push(()=>{r.removeEventListener("keydown",sr),r.removeEventListener("keyup",lr),r.defaultView?.removeEventListener("blur",dr)});function cr(N,K=!0){return new Promise(ue=>{let Se=R("p",{id:`${h}-confirm`},N),Ne=R("button",{type:"button",class:"fd-button"},p.cancel),Re=R("button",{type:"button",class:"fd-button fd-button-primary"},p.ok),bt=R("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":Se.id},Se,R("div",{class:"fd-actions fd-actions-end"},...K?[Ne,Re]:[Re])),lt=R("div",{class:"fd-dialog-backdrop"},bt),vt=P.ownerDocument,dt=vt.activeElement,Qe=ct=>{lt.remove(),((we=>!!we&&we!==vt.body&&we.isConnected&&!we.closest("[hidden]"))(dt)?dt:P.querySelector('button[type="submit"]:not([hidden])'))?.focus(),ue(ct)};Ne.addEventListener("click",()=>Qe(!1)),Re.addEventListener("click",()=>Qe(!0)),lt.addEventListener("keydown",ct=>{ct.stopPropagation(),ct.key==="Escape"?(ct.preventDefault(),Qe(!1)):Gt(bt,ct)}),P.append(lt),Re.focus()})}function en(N){for(let K of v)K(N)}e.append(P);let Hr=g.subscribe(en);x.push(g.on("run",({result:N})=>{(N.reason==="cannot"||N.reason==="app"&&N.error!==void 0)&&k.say(N.message??"",N.reason==="app"?"danger":"warning")})),en(g.getState());function fr(){for(let N of B)N();X&&Q()}X=!0;let zr=!1;return V.length&&x.push(g.on("open",()=>{let N=!zr;zr=!0,queueMicrotask(()=>{if(J||!P.isConnected||P.closest("[hidden]")||typeof P.checkVisibility=="function"&&!P.checkVisibility())return;let K=r.activeElement;!(!K||K===r.body||K===r.documentElement)&&!(N&&P.contains(K))||V.find(Se=>!Se.wrapper.closest("[hidden]"))?.focus()})})),g.getState().status==="idle"&&g.load(),{form:g,element:P,setSkin(N){P.setAttribute("data-fd-skin",N),fr()},setTheme(N){N?P.setAttribute("data-fd-theme",N):P.removeAttribute("data-fd-theme"),P.setAttribute("data-fd-skin",Ln(n.skin??s.look?.skin,N??void 0)),fr()},setTokens(N){n.tokens=N??void 0,En(P,N)},async save(){let N=await g.save();return N||be(),N},check(){let N=g.validate();return N||be(),N},setReadonly(N){ke=N,P.toggleAttribute("data-readonly",ke),g.setEditing(!ke),en(g.getState())},isReadonly:()=>ke,on:(N,K)=>{let ue=g.on(N,K);return x.push(ue),ue},setValues:N=>g.setValues(N),run:(N,K)=>g.run(N,K),destroy(){J=!0,Hr();for(let N of x)N();P.remove(),y&&g.dispose()}}}var Pl='input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea',Ou=e=>e==null||e===""||Array.isArray(e)&&!e.length;function Vu(e,t){return(t==="en"||t==="fr")&&/^\p{Lu}\p{Ll}/u.test(e)?e[0].toLocaleLowerCase(t)+e.slice(1):e}function Ol(e,t,n=Vt[t]){return/[?؟]\s*$/.test(e)?n.quietAnswer:n.quietHint.replace("{label}",Vu(e,t))}var Iu=new Set(["boolean","one2many","binary","image","html","json","properties"]);function Du(e){return e.replace(/\s+([^\p{L}\p{N}\s]{1,3})$/u,"\xA0$1")}function Vl(e){let t=[],n=0;for(;n<e.length;){let r=[e[n]],i=e[n].type==="field";if(!i&&e[n].type==="text"&&e[n+1]?.type==="field"&&(r.push(e[++n]),i=!0),n++,i)for(;e[n]?.type==="text"&&e[n+1]?.type!=="field";)r.push(e[n++]);t.push(r)}return t}function Qi(e,t){Tt[e]={...Tt.en,...t.messages},Ze[e]={...Ze.en,...t.widgets},Vt[e]={...Vt.en,...t.viewer}}var Wu="0.19.1",Il=globalThis;for(let[e,t]of Il.FieldiaLanguages??[])Qi(e,t);delete Il.FieldiaLanguages;return Jl(ju);})();
|
|
53
|
+
${it("google-forms")} .fd-page-head { background: var(--fd-surface); border: 1px solid var(--fd-border); border-block-start: 10px solid var(--fd-accent); border-radius: var(--fd-radius); padding: 22px 24px; }
|
|
54
|
+
${it("google-forms")} .fd-page-title { font-size: 32px; font-weight: 400; line-height: 1.2; }
|
|
55
|
+
${it("google-forms")} ${mi} { background: none; border: 0; padding: 0; }
|
|
56
|
+
${it("google-forms")} ${mi} > .fd-grid > .fd-field:not(.fd-oneline) { background: var(--fd-surface); border: 1px solid var(--fd-border); border-radius: var(--fd-radius); padding: 22px 24px; }
|
|
57
|
+
${it("google-forms")} ${mi} > .fd-grid > .fd-field:focus-within { border-inline-start: 6px solid var(--fd-accent); padding-inline-start: 19px; }
|
|
58
|
+
${it("google-forms")} .fd-label { font-size: 16px; }
|
|
59
|
+
${it("google-forms")} .fd-input:not([readonly]) { background: transparent; }
|
|
60
|
+
${it("google-forms")} .fd-input:focus { box-shadow: inset 0 -1px 0 0 var(--fd-focus); }
|
|
61
|
+
${it("google-forms")} .fd-button { border-radius: 4px; font-weight: 500; }
|
|
62
|
+
`;var ip={medium:760,narrow:520},op='@layer fieldia-tokens{.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){--fd-font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", sans-serif;--fd-text: #212529;--fd-muted: #636976;--fd-page: #f2f3f5;--fd-surface: #ffffff;--fd-border: #cfd4da;--fd-border-strong: #9aa3ad;--fd-accent: #002855;--fd-accent-text: #ffffff;--fd-accent-soft: #e6ebf2;--fd-focus: #002855;--fd-focus-ring: none;--fd-error: #c62828;--fd-error-soft: #fdecea;--fd-success: #2e7d32;--fd-success-soft: #e8f5e9;--fd-warning: #8a5300;--fd-warning-soft: #fff4e0;--fd-info: #0b5cad;--fd-info-soft: #e7f0fb;--fd-radius: 0px;--fd-control-radius: 0px;--fd-pad-y: 3px;--fd-pad-x: 4px;--fd-input-border: 0 0 1px 0;--fd-label-weight: 600;--fd-gap-x: 32px;--fd-gap-y: 14px}:is(.fd-form,.fd-theme):is([data-fd-skin=outlined],[data-fd-skin=quiet]){--fd-text: rgba(0, 0, 0, .88);--fd-muted: rgba(0, 0, 0, .55);--fd-page: #f5f5f5;--fd-border: #d9d9d9;--fd-border-strong: #bfbfbf;--fd-accent: #1365d9;--fd-accent-soft: #e6f4ff;--fd-focus: #1365d9;--fd-focus-ring: 0 0 0 2px rgba(5, 145, 255, .12);--fd-error: #c63c3d;--fd-error-soft: #fff2f0;--fd-radius: 8px;--fd-control-radius: 6px;--fd-pad-y: 4px;--fd-pad-x: 11px;--fd-input-border: 1px;--fd-label-weight: 400;--fd-gap-x: 24px;--fd-gap-y: 18px}:is(.fd-form,.fd-theme)[data-fd-skin=quiet]{--fd-pad-x: 8px}}.fd-form,.fd-theme:is([data-fd-skin],:not(.fd-form *)){container-type:inline-size;font-family:var(--fd-font);font-size:14px;line-height:1.45;color:var(--fd-text);-webkit-text-size-adjust:100%}.fd-form *,.fd-form *:before,.fd-form *:after{box-sizing:border-box}.fd-form [hidden]{display:none!important}.fd-page-head{display:grid;gap:4px;margin-block-end:20px}.fd-page-title{font-size:22px;font-weight:650;margin:0;line-height:1.25}.fd-page-description{color:var(--fd-muted);margin:0}.fd-form[data-max-width=narrow]{--fd-page-max: 640px}.fd-form[data-max-width=medium]{--fd-page-max: 900px}.fd-form[data-max-width=wide]{--fd-page-max: 1180px}.fd-form[data-max-width=full]{--fd-page-max: none}.fd-form[data-max-width]>.fd-content:not(:has(>.fd-sheet-page)){max-width:var(--fd-page-max);margin-inline:auto}.fd-actions.fd-actions-top{margin-block-start:0;padding-block-end:14px;margin-block-end:18px;border-block-end:1px solid var(--fd-border)}.fd-icon{width:1.15em;height:1.15em;flex:none;vertical-align:-.2em}.fd-section-title .fd-icon,.fd-tab .fd-icon,.fd-button .fd-icon,.fd-step-title .fd-icon{margin-inline-end:.4em}.fd-section-title .fd-icon{color:var(--fd-muted)}.fd-grid{--fd-cols: var(--fd-columns, 1);--fd-span: 1;display:grid;grid-template-columns:repeat(var(--fd-cols),minmax(0,1fr));gap:var(--fd-gap-y) var(--fd-gap-x);align-items:start}.fd-grid>*{grid-column:span min(var(--fd-span, 1),var(--fd-cols))}.fd-grid[data-twelfths]{column-gap:min(var(--fd-gap-x),100% / 24)}.fd-field{display:grid;gap:4px;min-width:0}.fd-label{font-weight:var(--fd-label-weight);color:var(--fd-text)}.fd-valid-mark{color:var(--fd-success);width:1em;height:1em;margin-inline-start:6px;vertical-align:-.15em;stroke-width:2.4}.fd-field.fd-required>.fd-label:after{content:"*";margin-inline-start:.25em;color:var(--fd-error)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:after{content:none}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:before{content:"*";margin-inline-end:.25em;color:var(--fd-error)}.fd-help{color:var(--fd-muted);font-size:12.5px}.fd-help-tip-wrap{position:relative;display:inline-flex;vertical-align:.05em;margin-inline-start:6px}.fd-label>.fd-help-tip-wrap{position:absolute;margin-block-start:.15em}.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:22px}.fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap):after{padding-inline-start:22px}.fd-form:not([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-field.fd-required>.fd-label:has(>.fd-help-tip-wrap){padding-inline-end:0}.fd-help-tip{all:unset;box-sizing:border-box;display:inline-grid;place-items:center;width:16px;height:16px;border:1px solid var(--fd-border);border-radius:50%;color:var(--fd-muted);font-size:11px;font-weight:600;line-height:1;cursor:help}.fd-help-tip:hover,.fd-help-tip[aria-expanded=true]{color:var(--fd-accent);border-color:var(--fd-accent)}.fd-help-tip:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-help-bubble{position:absolute;inset-block-start:calc(100% + 6px);inset-inline-start:-8px;z-index:30;width:max-content;max-width:min(280px,calc(100vw - 16px));padding:6px 9px;border-radius:6px;background:var(--fd-text);color:var(--fd-surface);font-size:12.5px;font-weight:400;line-height:1.4;white-space:normal;box-shadow:0 6px 18px #0000002e}.fd-page-title,.fd-page-description,.fd-section-description,.fd-label,.fd-help,.fd-text-heading,.fd-text-paragraph,.fd-text-note,.fd-choice>span{unicode-bidi:plaintext;text-align:match-parent;text-align:-webkit-match-parent}.fd-error{color:var(--fd-error);font-size:12.5px}.fd-warning{color:var(--fd-warning);background:var(--fd-warning-soft);font-size:12.5px;padding:3px 8px;border-radius:var(--fd-control-radius);justify-self:start}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr);column-gap:12px}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>.fd-label{grid-column:1;align-self:start;padding-block-start:max(0px,calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field[data-type=one2many]>*{grid-column:1!important}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>:not(.fd-label){grid-column:2}.fd-form[data-fd-skin=underline] .fd-section[data-row=skin]{--fd-row-label: var(--fd-label-width, 11em);--fd-row-gap: 12px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row=beside]{--fd-row-label: var(--fd-label-width, 140px);--fd-row-gap: 14px;--fd-row-place: absolute;--fd-row-drop: max(0px, calc((var(--fd-control-height, 30px) - 1.45em) / 2))}.fd-form .fd-section[data-row]{padding-inline-start:calc(var(--fd-row-label, 0px) + var(--fd-row-gap, 0px))}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child{grid-template-columns:minmax(0,1fr);position:relative}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>:not(.fd-label){grid-column:1}.fd-form .fd-section[data-row]>.fd-grid>.fd-field:first-child>.fd-label{position:var(--fd-row-place, static);inset-inline-start:calc(-1 * (var(--fd-row-label, 0px) + var(--fd-row-gap, 0px)));inset-block-start:0;width:var(--fd-row-label, auto);padding-block-start:var(--fd-row-drop, 0px)}@container (max-width: 760px){.fd-form[data-fd-skin=underline] .fd-grid{--fd-cols: 1}.fd-form .fd-grid[data-columns-medium]{--fd-cols: var(--fd-columns-medium)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-grid[data-columns-medium]:not([data-columns-medium="1"]) .fd-field:where(:not([data-labels]))>*{grid-column:1!important}}@container (max-width: 520px){.fd-grid{--fd-cols: 1}.fd-form .fd-section.fd-section[data-row]{--fd-row-label: auto;--fd-row-gap: 0px;--fd-row-place: static;--fd-row-drop: 0px}.fd-form .fd-section[data-row]{padding-inline-start:0}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels])){grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-field:where(:not([data-labels]))>*{grid-column:1!important}.fd-form .fd-grid[data-columns-medium],.fd-form .fd-grid[data-columns-narrow]{--fd-cols: var(--fd-columns-narrow, 1)}.fd-form .fd-file-viewer>:first-child{padding-inline-end:16px}.fd-form .fd-file-viewer h2{flex-basis:100%;margin-inline-end:36px}}.fd-input{width:100%;min-width:0;font:inherit;color:inherit;background:var(--fd-surface);border:solid var(--fd-border);border-width:var(--fd-input-border);border-radius:var(--fd-control-radius);padding:var(--fd-pad-y) var(--fd-pad-x);min-height:var(--fd-control-height, 30px);text-overflow:ellipsis;transition:border-color .15s ease,box-shadow .15s ease}.fd-input::placeholder{color:var(--fd-muted);opacity:.8}.fd-input:hover{border-color:var(--fd-border-strong)}.fd-input:focus{outline:none;border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-form[data-fd-skin=underline] .fd-input{background:transparent}.fd-form[data-fd-skin=underline] .fd-input:focus{box-shadow:0 1px 0 0 var(--fd-focus)}.fd-form[data-fd-skin=underline] .fd-field.fd-required:not([data-quiet]) .fd-input{border-color:var(--fd-accent)}.fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-input[readonly]{background:color-mix(in srgb,var(--fd-text) 5%,var(--fd-surface));border-color:var(--fd-border);padding-inline:var(--fd-pad-x);color:var(--fd-muted)}.fd-form[data-readonly] .fd-input[readonly]{background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text)}.fd-form[data-readonly] .fd-input::placeholder{color:transparent}.fd-input[readonly]::placeholder,.fd-form .fd-input.fd-blank[readonly]{color:transparent}.fd-blank[readonly]::-webkit-calendar-picker-indicator{display:none}.fd-form[data-readonly] select.fd-input:disabled{appearance:none;background:transparent;border-color:transparent;padding-inline:0;color:var(--fd-text);opacity:1}.fd-input[aria-invalid=true]{border-color:var(--fd-error)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) .fd-input[aria-invalid=true]:focus{box-shadow:0 0 0 2px #ff26050f}.fd-textarea{resize:vertical;min-height:64px}.fd-select{appearance:auto}.fd-number{display:flex;align-items:baseline;gap:6px}.fd-number-input{font-variant-numeric:tabular-nums}.fd-currency{color:var(--fd-muted);font-size:12.5px;font-weight:600}.fd-currency-after>.fd-number-input{text-align:end}.fd-currency-picked{align-items:center}.fd-currency-picked>:not(.fd-number-input){flex:0 0 104px;min-width:0}.fd-currency-picked>.fd-number-input{flex:1 1 auto;min-width:0}.fd-pending{color:var(--fd-muted);font-style:italic}.fd-pending:empty:before{content:"\u2014"}.fd-checkbox,.fd-choice input{width:16px;height:16px;accent-color:var(--fd-accent);margin:0}.fd-switch{appearance:none;width:34px;height:20px;margin:0;border-radius:999px;position:relative;background:var(--fd-border-strong);cursor:pointer;transition:background .2s ease}.fd-switch:after{content:"";position:absolute;inset-block-start:2px;inset-inline-start:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:transform .2s ease;box-shadow:0 1px 2px #00000040}.fd-switch:checked{background:var(--fd-accent)}.fd-switch:checked:after{transform:translate(14px)}[dir=rtl] .fd-switch:checked:after{transform:translate(-14px)}.fd-choices{display:flex;flex-wrap:wrap;gap:6px 18px}.fd-choice{display:inline-flex;align-items:center;gap:8px;cursor:pointer}.fd-choice-other{cursor:default;flex:1 1 260px;max-width:420px;min-width:0}.fd-choice-other-pick{display:inline-flex;align-items:center;gap:8px;cursor:pointer;flex:none}.fd-choice-other .fd-other-input{flex:1;min-width:6em;width:auto;min-height:30px;padding-block:2px}.fd-scale-box{display:inline-grid;gap:4px;max-width:100%}.fd-scale-ends{display:flex;justify-content:space-between;gap:16px;font-size:12.5px;color:var(--fd-muted)}.fd-choices-box{display:grid;gap:6px;min-width:0}.fd-choice-clear{justify-self:end;font:inherit;font-size:13px;color:var(--fd-muted);background:none;border:0;padding:2px 4px;border-radius:4px;cursor:pointer}.fd-choice-clear:hover{color:var(--fd-text);text-decoration:underline;text-underline-offset:3px}.fd-lines-table .fd-choice-clear,.fd-grid-editor .fd-choice-clear{display:none}.fd-points{display:flex;flex-wrap:wrap;gap:6px}.fd-points button{font:inherit;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text);border-radius:var(--fd-control-radius);min-width:34px;height:34px;padding:0 8px}.fd-points button.fd-on{background:var(--fd-accent);color:var(--fd-accent-text);border-color:var(--fd-accent)}.fd-rating button{border:none;background:none;font-size:24px;color:var(--fd-border-strong);padding:0 2px;min-width:0}.fd-rating button.fd-on{background:none;color:#f5a623}.fd-points button:disabled,.fd-choice input:disabled{cursor:default}.fd-form :focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-form .fd-input:focus-visible{outline:none}.fd-combo{position:relative;display:flex;align-items:center;min-width:0}.fd-combo-input{padding-inline-end:30px}.fd-combo-clear{position:absolute;inset-inline-end:3px;border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-clear:hover{color:var(--fd-text);background:var(--fd-page)}.fd-combo:has(>.fd-combo-open:not([hidden])) .fd-combo-input{padding-inline-end:56px}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]) .fd-combo-input[readonly]{padding-inline-end:var(--fd-pad-x)}.fd-combo:not(.fd-choice-search .fd-combo):has(>.fd-combo-clear[hidden]):has(>.fd-combo-open:not([hidden])) .fd-combo-input[readonly]{padding-inline-end:30px}.fd-combo:has(>.fd-combo-input[readonly])>.fd-combo-clear[hidden]~.fd-combo-open{inset-inline-end:3px}.fd-combo-open{position:absolute;inset-inline-end:29px;border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:0 4px;border-radius:4px;min-width:24px;min-height:24px;display:inline-grid;place-items:center}.fd-combo-open:hover{background:var(--fd-page)}.fd-listbox{position:absolute;inset-inline:0;inset-block-start:calc(100% + 2px);z-index:20;margin:0;padding:4px 0;list-style:none;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #0f14191f;max-height:240px;overflow-y:auto}.fd-option{padding:6px 12px;cursor:pointer}.fd-option:hover,.fd-option.fd-active{background:var(--fd-accent-soft)}.fd-option-create{color:var(--fd-accent);border-block-start:1px solid var(--fd-border)}.fd-empty{padding:6px 12px;color:var(--fd-muted);font-style:italic}.fd-tags{display:flex;flex-wrap:wrap;gap:6px;align-items:center;min-width:0}.fd-chips{display:contents;list-style:none;margin:0;padding:0}.fd-chip{display:inline-flex;align-items:center;gap:4px;padding:1px 4px 1px 10px;border-radius:999px;background:var(--fd-accent-soft);color:var(--fd-text);font-size:13px;line-height:22px}button.fd-chip-label{border:none;padding:0;background:none;font:inherit;color:inherit;cursor:pointer}button.fd-chip-label:hover{text-decoration:underline}.fd-chip-remove{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:0 4px;border-radius:999px}.fd-chip-remove:hover{color:var(--fd-error)}.fd-tags .fd-combo{flex:1 1 140px}.fd-reference{display:grid;grid-template-columns:minmax(7em,34%) minmax(0,1fr);gap:8px}.fd-lines{display:grid;grid-template-columns:minmax(0,1fr);gap:6px;min-width:0}.fd-lines-scroll{overflow-x:auto;min-width:0;position:relative}.fd-lines-table{width:100%;border-collapse:collapse;font-size:13.5px}.fd-lines-table th{text-align:start;font-weight:600;color:var(--fd-muted);font-size:12.5px;padding:6px 8px;border-block-end:1px solid var(--fd-border);white-space:nowrap}.fd-lines-table td{padding:4px 8px;border-block-end:1px solid var(--fd-border);vertical-align:top;min-width:7em}.fd-lines-table td.fd-lines-tools,.fd-lines-table th.fd-lines-tools{width:32px;min-width:32px;padding-inline:0;text-align:center}.fd-lines-table .fd-input{min-height:28px}.fd-lines-table td>.fd-checkbox,.fd-lines-table td>.fd-switch{margin-block-start:6px}.fd-lines-table .fd-lines-grip{width:1px;min-width:0;padding-inline:6px 2px}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td):is(.fd-lines-grip,.fd-lines-tools){position:sticky;z-index:1;background-color:var(--fd-surface)}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-grip{inset-inline-start:0}.fd-lines:not([data-cards=always]) .fd-lines-table :is(th,td).fd-lines-tools{inset-inline-end:0}.fd-lines-table td[data-fit]{min-width:0}.fd-lines-table thead th:not(.fd-lines-grip,.fd-lines-tools){white-space:normal}.fd-lines-table thead th{vertical-align:bottom}.fd-lines-table th[data-fit=boolean]{width:5em;min-width:5em}.fd-lines-table th[data-fit=integer]{width:max(7em,var(--fd-fit-need, 0px));min-width:max(7em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=float]{width:max(7.5em,var(--fd-fit-need, 0px));min-width:max(7.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=monetary]{width:max(11.5em,var(--fd-fit-need, 0px));min-width:max(11.5em,var(--fd-fit-need, 0px))}.fd-lines-table th[data-fit=date]{width:9em;min-width:9em}.fd-lines-table th[data-fit=datetime]{width:12.5em;min-width:12.5em}.fd-lines-table th:is([data-fit=integer],[data-fit=float],[data-fit=monetary]){text-align:end}.fd-lines-table td:is([data-fit=integer],[data-fit=float],[data-fit=monetary]) input{text-align:end}@media(hover:hover)and (pointer:fine){.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) .fd-input:not([aria-invalid=true]){border-color:transparent;background-color:transparent;box-shadow:none}.fd-lines:not([data-cards=always]) .fd-lines-table tbody tr:not(:hover,:focus-within) :is(.fd-combo-open,.fd-combo-clear){visibility:hidden}}.fd-line-grip{display:block;margin-block-start:7px;cursor:grab}.fd-lines-dragging,.fd-lines-dragging *{cursor:grabbing;user-select:none}.fd-lines-dragging>tr:not(.fd-line-lifted){transition:transform .15s ease}.fd-line-lifted{position:relative;z-index:2;box-shadow:0 6px 18px #0f141929}.fd-line-lifted>td{background:var(--fd-surface)}.fd-line-delete{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:16px;line-height:1;padding:4px 6px;border-radius:4px;min-width:24px;min-height:24px}.fd-line-delete:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-lines-table [data-tone=info]{--fd-line-tone: var(--fd-info);--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-lines-table [data-tone=success]{--fd-line-tone: var(--fd-success);--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-lines-table [data-tone=warning]{--fd-line-tone: var(--fd-warning);--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-lines-table [data-tone=danger]{--fd-line-tone: var(--fd-error);--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-lines-table [data-tone=muted]{--fd-line-tone: var(--fd-muted);--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-lines-table [data-tone] :is(input,select,textarea,.fd-input,.fd-display){color:var(--fd-line-tone);-webkit-text-fill-color:var(--fd-line-tone)}.fd-lines-table :is(.fd-line-bold,.fd-cell-bold) :is(input,select,textarea,.fd-input,.fd-display){font-weight:600}.fd-lines-table td.fd-lines-tools{white-space:nowrap}.fd-lines-table:has(.fd-line-button) td.fd-lines-tools{text-align:end;padding-inline-end:4px}.fd-line-button{padding:2px 6px;font-size:12.5px;vertical-align:middle}.fd-line-button-icon{padding:4px;color:var(--fd-muted)}.fd-line-button-icon:hover{color:var(--fd-accent)}.fd-line-button svg{width:15px;height:15px;display:block}.fd-lines-totals td{padding:8px;font-weight:600;border-block-start:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-lines-adds{display:flex;flex-wrap:wrap;gap:4px 16px;justify-self:start}.fd-lines-control{display:inline-flex;align-items:center;gap:6px}.fd-lines-control svg,.fd-lines-chosen-button svg{width:15px;height:15px}.fd-line-lead{display:inline-flex;align-items:center;gap:4px;margin-block-start:6px}.fd-line-lead .fd-line-grip{margin-block-start:0}.fd-lines-table th.fd-lines-grip:has(.fd-line-pick-all){padding-block:4px}.fd-lines-chosen{display:flex;flex-wrap:wrap;align-items:center;gap:6px 8px;padding:6px 10px;border-radius:var(--fd-radius);background:var(--fd-accent-soft)}.fd-lines-chosen[hidden]{display:none}.fd-lines-chosen-count{font-weight:600;font-size:13px;margin-inline-end:6px}.fd-lines-chosen-button{display:inline-flex;align-items:center;gap:6px;padding-block:3px}.fd-lines-table .fd-line-open{border:none;background:none;cursor:pointer;color:var(--fd-accent);font-size:14px;line-height:1;padding:4px 6px;border-radius:4px}.fd-lines-table .fd-line-open:hover{background:var(--fd-accent-soft)}.fd-links-table td{vertical-align:middle}.fd-links-table .fd-value-text{padding-block:4px}.fd-lines[data-fit=content] .fd-lines-table{width:auto;max-width:100%}.fd-lines[data-fit=content] .fd-lines-table td{min-width:0}.fd-lines[data-cards]{container:fd-lines / inline-size}@container fd-lines (max-width: 520px){.fd-lines[data-cards=narrow] .fd-lines-table,.fd-lines[data-cards=narrow] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=narrow] .fd-lines-table thead{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr{display:grid;grid-template-columns:minmax(0,1fr);gap:4px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=narrow] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=narrow] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip{position:absolute;inset-block-start:6px;inset-inline-start:6px;padding:0}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-grip .fd-line-grip{display:none}.fd-lines[data-cards=narrow] .fd-lines-table tr:has(.fd-line-pick){padding-inline-start:36px}.fd-lines[data-cards=narrow] .fd-lines-table td.fd-lines-tools{width:auto;text-align:end}.fd-lines[data-cards=narrow] .fd-lines-totals td:empty{display:none}}.fd-lines[data-cards=always] .fd-lines-table,.fd-lines[data-cards=always] .fd-lines-table :is(tbody,tfoot){display:block}.fd-lines[data-cards=always] .fd-lines-table thead{display:none}.fd-lines[data-cards=always] .fd-lines-table tr{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:6px 12px;position:relative;padding:10px 12px;margin-block-end:8px;border:1px solid var(--fd-border);border-radius:var(--fd-radius);background:var(--fd-surface)}.fd-lines[data-cards=always] .fd-lines-table td{display:block;border:none;padding:0;min-width:0}.fd-lines[data-cards=always] .fd-lines-table td[data-label]:not([colspan]:not([colspan="1"])):before{content:attr(data-label);display:block;font-size:12px;font-weight:600;color:var(--fd-muted)}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-grip,.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{grid-column:1 / -1;width:auto}.fd-lines[data-cards=always] .fd-lines-table td.fd-lines-tools{text-align:end}.fd-line-copy{border:none;background:none;cursor:pointer;color:var(--fd-muted);font-size:15px;line-height:1;padding:4px 6px;border-radius:4px}.fd-line-copy:hover{color:var(--fd-accent);background:var(--fd-accent-soft)}.fd-line-section td{background:var(--fd-page)}.fd-line-section .fd-input{font-weight:600}.fd-line-note .fd-input{font-style:italic}.fd-cell-error{color:var(--fd-error);font-size:12px}.fd-sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-file{display:grid;gap:8px;justify-items:start;padding:6px 0;border-radius:var(--fd-control-radius);min-width:0}.fd-file.fd-dragging{outline:2px dashed var(--fd-accent);outline-offset:4px}.fd-file-pick{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:center;cursor:pointer}.fd-file input:focus-visible+.fd-file-pick{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-files-list .fd-file-pick{justify-self:stretch;padding:10px 14px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-pick:hover,.fd-dragging .fd-file-pick{border-color:var(--fd-accent)}.fd-files{list-style:none;margin:0;padding:0;display:grid;gap:6px;justify-self:stretch;min-width:0}.fd-files:empty{display:none}.fd-file-item{position:relative;display:flex;align-items:center;gap:2px;min-width:0}.fd-file-open{flex:1;min-width:0;display:flex;align-items:center;gap:10px;padding:5px 8px;font:inherit;color:inherit;text-align:start;cursor:pointer;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-control-radius)}.fd-file-open:hover{border-color:var(--fd-accent)}.fd-file-thumb,.fd-file-icon{flex:none;width:36px;height:36px;border-radius:3px;object-fit:cover}.fd-file-icon{display:grid;place-items:end center;padding-block-end:4px;font-size:9px;font-weight:700;color:#fff;background:var(--fd-kind, #5b6573);clip-path:polygon(0 0,68% 0,100% 28%,100% 100%,0 100%)}.fd-file-icon[data-kind=pdf]{--fd-kind: #c62828}.fd-file-icon[data-kind=doc]{--fd-kind: #1f5fbf}.fd-file-icon[data-kind=sheet]{--fd-kind: #1d7a3e}.fd-file-icon[data-kind=zip]{--fd-kind: #8a5300}.fd-file-name{flex:1;display:flex;min-width:0;white-space:pre}.fd-file-name>span{overflow:hidden;text-overflow:ellipsis}.fd-file-size{color:var(--fd-muted);font-size:12.5px;font-variant-numeric:tabular-nums;unicode-bidi:plaintext}.fd-file-remove{flex:none;width:32px;height:32px;border:none;border-radius:999px;background:none;color:var(--fd-muted);font-size:20px;line-height:1;cursor:pointer}.fd-file-remove:hover{color:var(--fd-error);background:var(--fd-error-soft)}.fd-file-confirm:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:4px 14px}.fd-file-note:empty{display:none}.fd-file-note{color:var(--fd-warning)}.fd-file-bar{display:flex;flex-wrap:wrap;align-items:center;gap:4px 12px;justify-self:stretch}.fd-file-views{display:flex;gap:2px;margin-inline-start:auto;padding:2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-file-views button{display:flex;align-items:center;gap:6px;min-height:28px;padding:2px 10px;font:inherit;font-size:13px;color:var(--fd-muted);cursor:pointer;border:none;border-radius:calc(var(--fd-control-radius) - 2px);background:none}.fd-file-views [aria-pressed=true]{color:var(--fd-text);background:var(--fd-surface);box-shadow:0 0 0 1px var(--fd-border)}.fd-files-thumbs{display:flex;flex-wrap:wrap;align-items:flex-start}.fd-files-thumbs>*{flex-basis:100%}:is(.fd-files-thumbs,.fd-files-cards)>.fd-files{display:contents}.fd-files-thumbs .fd-file-item,.fd-image-pick{flex:none;width:96px;height:96px}.fd-files-thumbs .fd-file-open{height:100%;padding:6px;flex-direction:column;justify-content:center;gap:4px;overflow:hidden;font-size:12px}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-thumb{position:absolute;inset:0;width:100%;height:100%;border-radius:inherit}.fd-files-thumbs .fd-file-name{flex:none;max-width:100%}.fd-files-thumbs .fd-file-size,.fd-files-thumbs .fd-file-thumb~*{display:none}:is(.fd-files-thumbs,.fd-files-cards) .fd-file-remove{position:absolute;inset-block-start:4px;inset-inline-end:4px;width:26px;height:26px;font-size:17px;background:#0f14199e;color:#fff;opacity:0}.fd-file-item:is(:hover,:focus-within) .fd-file-remove{opacity:1}@media(hover:none){.fd-file-item .fd-file-remove{opacity:1}}.fd-image-pick{display:grid;place-content:center;justify-items:center;gap:2px;padding:6px;text-align:center;font-size:12px;border:1px dashed var(--fd-border-strong);border-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-files-cards{grid-template-columns:repeat(auto-fill,minmax(min(100%,130px),1fr))}.fd-files-cards>*{grid-column:1 / -1}.fd-files-cards>.fd-image-pick{grid-column:auto;justify-self:stretch;width:auto;height:auto;min-height:96px}.fd-files-cards .fd-file-item{justify-self:stretch;align-items:stretch}.fd-files-cards .fd-file-open{flex-direction:column;align-items:stretch;gap:2px;padding:0 0 8px;overflow:hidden}.fd-file-picture{position:relative;display:grid;place-items:center;aspect-ratio:4 / 3;margin-block-end:6px;background:var(--fd-page);border-block-end:1px solid var(--fd-border)}.fd-file-picture .fd-file-icon{width:44px;height:56px;padding-block-end:8px;font-size:12px}.fd-files-cards :is(.fd-file-name,.fd-file-size){padding-inline:8px}.fd-files-cards .fd-file-name{flex:none;flex-wrap:wrap;font-size:13px;line-height:1.35}.fd-files-cards .fd-file-name>span{max-width:100%}.fd-image-pick .fd-button{border:none;background:none;color:var(--fd-accent);padding:0;min-height:0;font-size:13px}.fd-file-viewer{max-width:1000px;height:min(88vh,100%);background:var(--fd-surface)}.fd-file-viewer>:first-child{position:relative;flex-wrap:wrap;justify-content:start;gap:6px 10px;padding-block:8px;padding-inline-end:52px}.fd-file-viewer .fd-dialog-close{position:absolute;inset-block-start:10px;inset-inline-end:10px}.fd-file-viewer h2{flex:1 1 10em;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-file-step{font-size:18px;line-height:1;min-width:34px}.fd-file-viewer a{text-decoration:none}.fd-file-viewer-body{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:auto;background:var(--fd-page)}.fd-file-viewer-body img{max-width:100%;max-height:100%;object-fit:contain}.fd-file-viewer-body :is(iframe,pre){flex:1;align-self:stretch;margin:0;border:0;background:var(--fd-surface)}.fd-file-viewer-body pre{padding:14px 16px;overflow:auto;font:13px/1.5 monospace;white-space:pre-wrap;overflow-wrap:anywhere}.fd-file-none{display:grid;justify-items:center;gap:4px;padding:24px;text-align:center;color:var(--fd-muted)}.fd-file-none strong{color:var(--fd-text);overflow-wrap:anywhere}.fd-file-none .fd-file-icon{width:64px;height:64px;font-size:14px;padding-block-end:8px}.fd-richtext{min-height:96px;line-height:1.5;overflow-wrap:anywhere}.fd-richtext-box{display:grid;gap:0;min-width:0}.fd-richtext-box>.fd-richtext{border-start-start-radius:0;border-start-end-radius:0}.fd-richtext-bar{display:flex;flex-wrap:wrap;align-items:center;gap:2px;padding:4px;min-width:0;border:1px solid var(--fd-border);border-block-end:none;border-start-start-radius:var(--fd-control-radius);border-start-end-radius:var(--fd-control-radius);background:var(--fd-page)}.fd-richtext-style{font:inherit;font-size:12.5px;padding:3px 6px;margin-inline-end:4px;border:1px solid var(--fd-border);border-radius:4px;background:var(--fd-surface);color:var(--fd-text)}.fd-richtext-tool{display:grid;place-items:center;width:28px;height:28px;padding:0;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:14px}.fd-richtext-tool:hover{background:var(--fd-surface)}.fd-richtext-tool[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-richtext-tool svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.3;stroke-linecap:round}.fd-richtext-tool svg circle{fill:currentColor;stroke:none}.fd-link-row{display:flex;flex-wrap:wrap;gap:6px;align-items:center;padding:6px;border:1px solid var(--fd-border);border-block-end:none;background:var(--fd-surface)}.fd-link-row>.fd-input{flex:1 1 200px;min-width:0}.fd-richtext.fd-blank[contenteditable=true]:before{content:attr(data-placeholder);position:absolute;color:var(--fd-muted);opacity:.8;pointer-events:none}.fd-richtext[contenteditable=false]{background:transparent;border-color:transparent;padding-inline:0;min-height:0}.fd-richtext p{margin:0 0 6px}textarea.fd-code{font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:12.5px;min-height:96px}.fd-sections{display:grid;gap:var(--fd-gap-block, 24px)}.fd-section{border:0;margin:0;padding:0;min-width:0;display:grid;gap:14px}.fd-section-title{font-size:15px;font-weight:650;padding:0;margin:0;float:inline-start;width:100%}.fd-section-title+*{clear:both}.fd-form[data-fd-skin=underline] .fd-section-title{text-transform:uppercase;letter-spacing:.05em;font-size:12.5px;color:var(--fd-muted);border-block-end:1px solid var(--fd-border);padding-block-end:6px;width:100%}.fd-section-description{color:var(--fd-muted);margin:0}.fd-section-toggle{font:inherit;color:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;display:inline-flex;align-items:center;gap:8px;text-align:start}.fd-section-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px;border-radius:2px}.fd-section-chevron{width:.5em;height:.5em;border:solid currentColor;border-width:0 2px 2px 0;transform:rotate(45deg);margin-block-start:-.2em;transition:transform .15s ease;flex:none}.fd-section-folded .fd-section-chevron{transform:rotate(-45deg);margin-block-start:0}[dir=rtl] .fd-section-folded .fd-section-chevron{transform:rotate(135deg)}.fd-form:is([data-fd-skin=outlined],[data-fd-skin=quiet]) :is(.fd-sections>.fd-section:not([data-style]),.fd-section[data-style=card][data-on-page]){background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:var(--fd-group-pad, 20px 24px)}.fd-form-part-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-form-part-problem{padding:10px 12px;border:1px dashed var(--fd-border);border-radius:var(--fd-radius)}.fd-tablist{display:flex;gap:2px;border-block-end:1px solid var(--fd-border);overflow-x:auto;scrollbar-width:none}.fd-tablist::-webkit-scrollbar{display:none}.fd-tabbar{position:relative;min-width:0;--fd-fade: to right}[dir=rtl] .fd-tabbar{--fd-fade: to left}.fd-tabbar[data-more=start]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px)}.fd-tabbar[data-more=end]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabbar[data-more="start end"]>.fd-tablist{mask-image:linear-gradient(var(--fd-fade),transparent 28px,#000 64px,#000 calc(100% - 64px),transparent calc(100% - 28px))}.fd-tabs-scroll{position:absolute;inset-block:0 1px;z-index:1;width:28px;padding:0;border:none;background:none;cursor:pointer;color:var(--fd-muted);display:grid;place-items:center}.fd-tabs-scroll[hidden]{display:none}.fd-tabs-scroll:hover{color:var(--fd-accent)}.fd-tabs-scroll:before{content:"";width:7px;height:7px;border:solid currentColor;border-width:0 0 2px 2px}.fd-tabs-before{inset-inline-start:0}.fd-tabs-after{inset-inline-end:0}.fd-tabs-before:before{transform:translate(2px) rotate(45deg)}.fd-tabs-after:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-before:before{transform:translate(-2px) rotate(-135deg)}[dir=rtl] .fd-tabs-after:before{transform:translate(2px) rotate(45deg)}.fd-tab{font:inherit;background:none;border:none;cursor:pointer;padding:8px 14px;color:var(--fd-muted);border-block-end:2px solid transparent;margin-block-end:-1px;white-space:nowrap}.fd-tab[aria-selected=true]{color:var(--fd-accent);border-block-end-color:var(--fd-accent);font-weight:600}.fd-tab[data-problem]:after{content:"";display:inline-block;width:6px;height:6px;margin-inline-start:6px;border-radius:50%;background:var(--fd-error);vertical-align:.15em}.fd-tabpanel{padding-block:16px;display:grid;gap:16px}.fd-button{font:inherit;cursor:pointer;display:inline-flex;align-items:center;gap:6px;justify-content:center;min-height:var(--fd-control-height, 32px);padding:4px 14px;border-radius:var(--fd-control-radius);border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-text)}.fd-button:hover{border-color:var(--fd-accent);color:var(--fd-accent)}.fd-button-primary{background:var(--fd-accent);border-color:var(--fd-accent);color:var(--fd-accent-text)}.fd-button-primary:hover{color:var(--fd-accent-text);filter:brightness(1.12)}.fd-button-danger{color:var(--fd-error);border-color:var(--fd-error)}.fd-button-danger:hover{background:var(--fd-error);color:var(--fd-surface)}.fd-button-link{border-color:transparent;background:none;color:var(--fd-accent);padding-inline:4px}.fd-form[data-fd-skin=underline] .fd-button{border-radius:3px}.fd-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.fd-actions-end{justify-content:flex-end;margin-block-start:24px}.fd-sheet-page{background:var(--fd-page);padding:0 0 32px;min-width:0}.fd-header{display:flex;flex-wrap:wrap;gap:10px 16px;align-items:center;justify-content:space-between;background:var(--fd-surface);border-block-end:1px solid var(--fd-border);padding:8px 16px}.fd-statusbar{display:flex;list-style:none;margin:0;padding:0;overflow-x:auto}.fd-statusbar li{display:flex}.fd-statusbar li>*{font:inherit;font-size:13px;border:none;background:var(--fd-page);color:var(--fd-muted);padding:5px 18px 5px 22px;margin-inline-start:-6px;white-space:nowrap;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%,10px 50%)}.fd-statusbar li:first-child>*{margin-inline-start:0;padding-inline-start:14px;clip-path:polygon(0 0,calc(100% - 10px) 0,100% 50%,calc(100% - 10px) 100%,0 100%)}.fd-statusbar li>button{cursor:pointer}.fd-statusbar li>[aria-current=step]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}[dir=rtl] .fd-statusbar li>*{transform:scaleX(-1)}[dir=rtl] .fd-statusbar li>*>*{display:inline-block;transform:scaleX(-1)}.fd-sheet-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:16px;max-width:var(--fd-page-max, 1180px);margin:16px auto 0;padding-inline:16px}.fd-sheet-layout{align-items:start}.fd-sheet-foot{margin:4px -28px -28px;padding:12px 28px;border-block-start:1px solid var(--fd-border);border-end-start-radius:inherit;border-end-end-radius:inherit}@container (min-width: 1534px){.fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr) minmax(260px,360px);max-width:calc(var(--fd-page-max, 1180px) + 376px)}}.fd-sheet-layout.fd-has-side[data-side-beside=always]{grid-template-columns:minmax(0,1fr) minmax(260px,360px)}.fd-form{container-name:fd-form}@container fd-form (max-width: 520px){.fd-form [data-hide-on~=narrow]{display:none!important}}@container fd-form (min-width: 521px) and (max-width: 760px){.fd-form [data-hide-on~=medium]{display:none!important}}@container fd-form (min-width: 761px){.fd-form [data-hide-on~=wide]{display:none!important}}.fd-card{position:relative;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);padding:24px 28px 28px;display:grid;gap:18px;min-width:0;container-type:inline-size}.fd-ribbon-frame{position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}.fd-ribbon{position:absolute;inset-block-start:18px;inset-inline-end:-42px;transform:rotate(45deg);width:160px;text-align:center;font-size:12px;font-weight:700;padding:4px 0;color:#fff;background:#5f6670;text-transform:uppercase;letter-spacing:.06em;pointer-events:none}[dir=rtl] .fd-ribbon{transform:rotate(-45deg)}.fd-ribbon.fd-tone-danger{background:#c63c3d}.fd-ribbon.fd-tone-success{background:#2e7d32}.fd-ribbon.fd-tone-warning{background:#a14f00}.fd-ribbon.fd-tone-info{background:#1365d9}.fd-alert{padding:10px 14px;border-radius:var(--fd-control-radius);border:1px solid;font-size:13.5px;display:flex;align-items:flex-start;gap:10px}.fd-alert-message{flex:1 1 auto;min-width:0}.fd-alert-close{border:none;background:none;color:inherit;cursor:pointer;font:inherit;font-size:18px;line-height:1;padding:0 4px;border-radius:4px;opacity:.75}.fd-alert-close:hover{opacity:1}.fd-alert-close:focus-visible{outline:2px solid var(--fd-focus);opacity:1}.fd-alert.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-alert.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-alert.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-alert.fd-tone-info,.fd-alert:not([class*=fd-tone-]){background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-stats{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:0;margin:-24px -28px 0;border-block-end:1px solid var(--fd-border)}.fd-stats:empty{display:none}.fd-card:has(>.fd-ribbon-frame>.fd-ribbon:not([hidden])) .fd-stats{padding-inline-end:104px}.fd-stat{font:inherit;background:none;border:none;border-inline-start:1px solid var(--fd-border);cursor:pointer;padding:8px 18px;display:grid;justify-items:start;line-height:1.2;color:var(--fd-text);min-width:120px}.fd-stat:hover{background:var(--fd-page)}.fd-stat:has(>.fd-icon){grid-template-columns:auto minmax(0,1fr);align-items:center;column-gap:10px}.fd-stat>.fd-icon{width:22px;height:22px;color:var(--fd-muted)}.fd-stat-words{display:grid;justify-items:start}.fd-stat-value{font-weight:700;font-size:15px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-stat-label{font-size:12.5px;color:var(--fd-muted)}.fd-title-row{display:flex;gap:16px;align-items:flex-start;justify-content:space-between}.fd-title{display:grid;gap:4px;flex:1 1 auto;min-width:0}.fd-avatar{flex:none}.fd-avatar>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-form[data-fd-skin=underline] .fd-avatar{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-avatar>*{grid-column:1!important}.fd-avatar .fd-file{justify-items:center;gap:4px 8px;padding:0;justify-content:center}.fd-avatar :is(.fd-file-item,.fd-image-pick){width:88px;height:88px}.fd-avatar :is(.fd-image-pick .fd-help,.fd-file-limits){display:none}.fd-avatar .fd-button-link{flex-basis:auto;font-size:12.5px}.fd-title>.fd-field .fd-input{font-size:24px;font-weight:600;min-height:40px}.fd-form[data-fd-skin=underline] .fd-title>.fd-field{grid-template-columns:minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-title>.fd-field>*{grid-column:1}.fd-title>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-above,.fd-title-below{display:flex;flex-wrap:wrap;align-items:center;gap:6px 24px}.fd-title-above{margin-block-end:4px}.fd-title-below{margin-block-start:6px}.fd-form .fd-title-above>.fd-field,.fd-form .fd-title-below>.fd-field{display:flex;align-items:center;gap:8px;grid-template-columns:none}.fd-form .fd-title-above>.fd-field>*,.fd-form .fd-title-below>.fd-field>*{grid-column:auto!important}.fd-title-above .fd-label:empty,.fd-title-below .fd-label:empty{display:none}.fd-title-above>.fd-field>.fd-label{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-title-statusbar{display:flex}.fd-badges{display:flex;flex-wrap:wrap;gap:6px}.fd-badge{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;line-height:1;padding:5px 10px;border-radius:999px;border:1px solid var(--fd-border);background:var(--fd-page);color:var(--fd-muted)}.fd-badge .fd-icon{width:13px;height:13px}.fd-badge.fd-tone-info{background:var(--fd-info-soft);border-color:#a9c8ef;color:var(--fd-info)}.fd-badge.fd-tone-success{background:var(--fd-success-soft);border-color:#a7d7ab;color:var(--fd-success)}.fd-badge.fd-tone-warning{background:var(--fd-warning-soft);border-color:#f0c47a;color:var(--fd-warning)}.fd-badge.fd-tone-danger{background:var(--fd-error-soft);border-color:#f1a7a7;color:var(--fd-error)}.fd-side{display:grid;gap:12px;align-content:start;min-width:0}.fd-wizard{display:grid;gap:20px}.fd-progress{display:grid;gap:8px}.fd-progress-text{color:var(--fd-muted);font-size:13px}.fd-value-text{display:block;padding-block:6px;font-variant-numeric:tabular-nums}.fd-field[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-field[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-field[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-field[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-field[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-field[data-tone] :is(input,select,textarea,.fd-value-text,.fd-pending){color:var(--fd-tone);-webkit-text-fill-color:var(--fd-tone)}.fd-field.fd-value-bold :is(input,select,textarea,.fd-value-text,.fd-pending,.fd-value-badge){font-weight:700}.fd-value-badge{justify-self:start;align-self:center;display:inline-block;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:2px 10px;border-radius:999px;font-size:12.5px;line-height:18px;font-weight:500;color:var(--fd-tone, var(--fd-muted));background:var(--fd-tone-soft, color-mix(in srgb, var(--fd-tone, var(--fd-muted)) 14%, transparent))}.fd-value-badge[hidden]{display:none}.fd-value-badge[data-tone=info]{--fd-tone: var(--fd-info);--fd-tone-soft: var(--fd-info-soft)}.fd-value-badge[data-tone=success]{--fd-tone: var(--fd-success);--fd-tone-soft: var(--fd-success-soft)}.fd-value-badge[data-tone=warning]{--fd-tone: var(--fd-warning);--fd-tone-soft: var(--fd-warning-soft)}.fd-value-badge[data-tone=danger]{--fd-tone: var(--fd-error);--fd-tone-soft: var(--fd-error-soft)}.fd-value-badge[data-tone=muted]{--fd-tone: var(--fd-muted);--fd-tone-soft: color-mix(in srgb, var(--fd-muted) 14%, transparent)}.fd-date-pick{position:relative;display:flex;align-items:center;gap:6px;min-width:0}.fd-date-pick>.fd-input{flex:1 1 auto;min-width:0}.fd-calendar-button{flex:0 0 auto;display:grid;place-items:center;width:32px;height:32px;padding:0;cursor:pointer;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface);color:var(--fd-muted)}.fd-calendar-button:hover,.fd-calendar-button[aria-expanded=true]{color:var(--fd-text);background:var(--fd-page)}.fd-calendar-button svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.4;stroke-linecap:round}.fd-calendar{position:absolute;inset-block-start:calc(100% + 4px);inset-inline-end:0;z-index:30;padding:8px;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),6px);box-shadow:0 8px 24px #0f141924}.fd-calendar-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 4px 6px}.fd-calendar-head button{border:none;background:none;cursor:pointer;font-size:18px;line-height:1;padding:4px 8px;border-radius:4px;color:var(--fd-text)}.fd-calendar-head button:hover{background:var(--fd-page)}.fd-calendar-title{font-weight:600}.fd-calendar-grid{border-collapse:collapse;font-variant-numeric:tabular-nums}.fd-calendar-grid th{font-size:11.5px;font-weight:600;color:var(--fd-muted);padding:4px 0;width:34px;text-align:center}.fd-calendar-grid .fd-week{color:var(--fd-accent);font-weight:600;border-inline-end:1px solid var(--fd-border)}.fd-calendar-grid td{padding:1px}.fd-calendar-grid td button{width:32px;height:30px;border:none;border-radius:4px;background:none;cursor:pointer;color:var(--fd-text);font:inherit;font-size:13px}.fd-calendar-grid td button:hover{background:var(--fd-accent-soft)}.fd-calendar-grid td button.fd-outside{color:var(--fd-muted);opacity:.6}.fd-calendar-grid td button[aria-current=date]{box-shadow:inset 0 0 0 1px var(--fd-accent)}.fd-calendar-grid td button[aria-selected=true]{background:var(--fd-accent);color:var(--fd-accent-text);font-weight:600}.fd-calendar-grid td button:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}.fd-properties{display:grid;gap:8px;min-width:0}.fd-property{display:grid;grid-template-columns:minmax(120px,30%) minmax(0,1fr);align-items:center;gap:12px;min-width:0}.fd-property>label{color:var(--fd-muted);font-size:13px}.fd-property[data-type=boolean]>:last-child{justify-self:start}.fd-form[data-fd-skin=underline] .fd-property{grid-template-columns:var(--fd-label-width, 11em) minmax(0,1fr)}.fd-form[data-fd-skin=underline] .fd-property>label{color:var(--fd-text);font-size:inherit;font-weight:var(--fd-label-weight)}@container (max-width: 520px){.fd-property{grid-template-columns:minmax(0,1fr);gap:4px}}.fd-progressbar{position:relative;height:22px;min-width:120px;border-radius:999px;overflow:hidden;background:var(--fd-page);border:1px solid var(--fd-border);font-variant-numeric:tabular-nums}.fd-progressbar-fill{height:100%;background:var(--fd-success);transition:width .2s ease}.fd-progressbar[data-tone=warning] .fd-progressbar-fill{background:#d97706}.fd-progressbar[data-tone=danger] .fd-progressbar-fill{background:var(--fd-error)}.fd-progressbar[data-tone=info] .fd-progressbar-fill{background:var(--fd-info)}.fd-progressbar-text{position:absolute;inset-block:2px;left:50%;translate:-50% 0;display:grid;place-items:center;padding-inline:7px;border-radius:999px;background:var(--fd-surface);font-size:12px;line-height:1;font-weight:600;color:var(--fd-text)}.fd-progressbar-text:empty{display:none}.fd-progressbar-edit{display:flex;align-items:center;gap:12px;min-width:0}.fd-progressbar-edit>.fd-progressbar{flex:1 1 auto}.fd-progressbar-edit>.fd-input{flex:0 0 96px}.fd-progress-bar{height:4px;background:var(--fd-border);border-radius:999px;overflow:hidden}.fd-progress-bar>span{display:block;height:100%;background:var(--fd-accent);transition:width .25s ease}.fd-step{display:grid;gap:18px}.fd-step-title{font-size:18px;font-weight:650;margin:0}.fd-wizard-nav{display:flex;gap:8px;justify-content:space-between}.fd-steps-list{display:flex;flex-wrap:wrap;gap:8px;list-style:none;margin:0;padding:0;counter-reset:fd-step}.fd-steps-list>li{counter-increment:fd-step}.fd-step-link{font:inherit;font-size:13.5px;display:inline-flex;align-items:center;gap:6px;cursor:pointer;border:1px solid var(--fd-border);background:var(--fd-surface);color:var(--fd-muted);border-radius:999px;padding:4px 12px 4px 6px}.fd-step-link:before{content:counter(fd-step);display:inline-grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--fd-page);color:var(--fd-muted);font-size:12px;font-weight:600;font-variant-numeric:tabular-nums}.fd-step-link:hover{border-color:var(--fd-accent);color:var(--fd-text)}.fd-step-link:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-step-link.fd-step-done{color:var(--fd-text)}.fd-step-link.fd-step-done:before{content:"\u2713";background:var(--fd-accent-soft);color:var(--fd-accent)}.fd-step-link.fd-step-skipped{border-style:dashed;color:var(--fd-muted)}.fd-step-link.fd-step-skipped:before{content:"\u2013";background:var(--fd-page);color:var(--fd-muted)}.fd-step-link[aria-current=step]{border-color:var(--fd-accent);color:var(--fd-accent);font-weight:600}.fd-step-link[aria-current=step]:before{content:counter(fd-step);background:var(--fd-accent);color:var(--fd-accent-text)}.fd-wizard-nav .fd-spacer{flex:1}.fd-text-heading{font-size:16px;font-weight:650;margin:0}.fd-matrix{overflow-x:auto;max-width:100%}.fd-matrix-table{border-collapse:collapse;min-width:100%}.fd-matrix-table th,.fd-matrix-table td{padding:6px 10px;text-align:center;border-bottom:1px solid var(--fd-border)}.fd-matrix-table thead th{font-weight:500;font-size:13px;color:var(--fd-muted)}.fd-matrix-table tbody th{text-align:start;font-weight:500}.fd-matrix-table input{accent-color:var(--fd-accent);width:16px;height:16px;margin:0}.fd-divider{grid-column:1 / -1;width:100%;border:0;border-top:1px solid var(--fd-border);margin:4px 0}.fd-block{min-width:0}.fd-spacer{min-height:24px}.fd-image{display:block;max-width:100%;height:auto;border-radius:var(--fd-radius)}.fd-figure{display:grid;justify-items:start;gap:6px;margin:0}.fd-figure[data-align=center]{justify-items:center}.fd-figure[data-align=end]{justify-items:end}.fd-figure>a,.fd-figure .fd-image{width:var(--fd-image-width, auto);max-width:100%}.fd-figure>a{display:block;border-radius:var(--fd-radius)}.fd-caption{font-size:13px;color:var(--fd-muted)}.fd-text-paragraph{margin:0}.fd-text-note{margin:0;color:var(--fd-muted);font-size:13px}.fd-status{min-height:1.4em;color:var(--fd-muted);font-size:13px}.fd-status-box{display:inline-flex;align-items:center;gap:6px;min-width:0}.fd-status-box .fd-retry{font-size:13px}.fd-announce{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-banner{display:flex;flex-wrap:wrap;align-items:center;gap:8px 14px;padding:10px 14px;margin-block-end:16px;border:1px solid #f0c47a;border-radius:var(--fd-control-radius);background:var(--fd-warning-soft);color:var(--fd-warning);font-size:13.5px}.fd-banner-text{flex:1 1 16em;min-width:0}.fd-content>.fd-banner:has(+.fd-draft+.fd-sheet-page),.fd-content>.fd-banner:has(+.fd-sheet-page){margin:12px 16px 0}.fd-status-box.fd-toast{position:fixed;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));inset-inline-end:20px;z-index:900;padding:10px 16px;border-radius:8px;background:var(--fd-text);box-shadow:0 8px 24px #0f141940}.fd-toast .fd-status,.fd-toast .fd-status.fd-status-saved,.fd-toast .fd-status.fd-status-error{color:var(--fd-surface);font-size:13.5px;min-height:0}.fd-toast .fd-retry{color:var(--fd-surface);text-decoration:underline}.fd-toast:has(.fd-status-error){background:var(--fd-error)}.fd-status-box.fd-status-bar{display:flex;justify-content:center;min-height:32px;padding:6px 16px;background:var(--fd-surface);border-block-end:1px solid var(--fd-border)}.fd-status-bar .fd-status-error,.fd-status.fd-status-error{color:var(--fd-error)}.fd-status.fd-status-saved{color:var(--fd-success)}.fd-draft{display:flex;flex-wrap:wrap;gap:8px 12px;align-items:center;padding:10px 14px;margin-block-end:16px;background:var(--fd-info-soft);border:1px solid #a9c8ef;border-radius:var(--fd-control-radius)}.fd-done{padding:40px 0;text-align:center;display:grid;gap:12px;justify-items:center}.fd-done-title{font-size:20px;font-weight:650;margin:0}.fd-dialog-backdrop{position:fixed;inset:0;background:#0f141973;display:grid;place-items:center;z-index:1000;padding:16px}.fd-dialog{background:var(--fd-surface);color:var(--fd-text);border-radius:max(var(--fd-radius),6px);max-width:420px;width:100%;padding:20px 22px;display:grid;gap:16px;box-shadow:0 10px 30px #0003;font-family:var(--fd-font);border:1px solid var(--fd-edge, transparent)}.fd-dialog p{margin:0}.fd-says{position:fixed;inset-inline:16px;inset-block-end:max(20px,env(safe-area-inset-bottom,0px));z-index:1100;display:grid;justify-items:center;gap:8px;pointer-events:none}.fd-say{pointer-events:auto;display:flex;align-items:center;gap:8px;max-width:420px;padding-block:8px;padding-inline:14px 6px;border:1px solid var(--fd-border);border-inline-start:4px solid var(--fd-tone);border-radius:max(var(--fd-control-radius),6px);background:var(--fd-surface);color:var(--fd-text);box-shadow:0 8px 24px #0f141940;font-size:13.5px}.fd-say>span{flex:1 1 auto;min-width:0}.fd-button[aria-busy=true],.fd-stat[aria-busy=true]{cursor:progress}.fd-button[aria-busy=true]:after{content:"";width:.85em;height:.85em;border:2px solid currentColor;border-inline-end-color:transparent;border-radius:50%;animation:fd-spin .8s linear infinite}@keyframes fd-spin{to{rotate:1turn}}.fd-back{margin:8px 12px}.fd-back:before{content:"\u2190"}.fd-back:dir(rtl):before{content:"\u2192"}.fd-form[data-scheme]>.fd-back{margin:12px 20px 0}.fd-form-dialog{display:flex;flex-direction:column;width:100%;max-height:min(90vh,100%);min-height:0;background:var(--fd-page);color:var(--fd-text);border-radius:max(var(--fd-radius),8px);box-shadow:0 24px 64px #0f14194d;overflow:hidden}.fd-form-dialog:focus{outline:none}.fd-form-dialog.fd-size-small{max-width:440px}.fd-form-dialog.fd-size-medium{max-width:760px}.fd-form-dialog.fd-size-large{max-width:1080px}.fd-form-dialog-backdrop:has(>.fd-size-full),.fd-form-panel-backdrop{padding:0}.fd-form-dialog:is(.fd-size-full,.fd-form-panel){max-height:none;height:100%;border-radius:0}.fd-size-full{max-width:none}.fd-form-dialog-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 16px;border-block-end:1px solid var(--fd-border);background:var(--fd-surface)}.fd-form-dialog-title{margin:0;font-size:16px;font-weight:600}.fd-dialog-close{border:none;background:none;cursor:pointer;font-size:22px;line-height:1;padding:2px 8px;border-radius:4px;color:var(--fd-muted)}.fd-dialog-close:hover{background:var(--fd-page);color:var(--fd-text)}.fd-form-dialog-body{flex:1 1 auto;min-height:0;overflow:auto;container-type:inline-size}.fd-form-dialog-body .fd-sheet-layout{margin-block-start:12px}.fd-form-dialog-body .fd-page-title{display:none}.fd-form-dialog-body .fd-page-head:not(:has(.fd-page-description)){display:none}.fd-form-dialog-body .fd-sheet-layout.fd-has-side{grid-template-columns:minmax(0,1fr)}.fd-form-dialog-body .fd-side{display:none}.fd-search-body{display:grid;gap:12px;align-content:start}.fd-search-list{list-style:none;margin:0;padding:0;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:auto;max-height:min(60vh,520px)}.fd-search-list .fd-option{padding:8px 12px}.fd-search-list .fd-option+.fd-option{border-block-start:1px solid var(--fd-border)}.fd-search-list .fd-empty{padding:10px 12px;color:var(--fd-muted)}.fd-form-dialog-body:not(:has(.fd-sheet-layout)){background:var(--fd-surface);padding:16px 20px 20px}.fd-form-dialog-foot{padding:12px 16px;border-block-start:1px solid var(--fd-border);background:var(--fd-surface);margin:0}.fd-form-panel-backdrop{justify-items:end}.fd-form-panel{max-width:560px;position:relative}.fd-form-panel>.fd-dialog-backdrop{position:absolute}.fd-width-narrow{max-width:420px}.fd-width-wide{max-width:720px}.fd-form-panel[data-side=start]{justify-self:start}.fd-form-panel[data-side=left]{justify-self:left}.fd-form-panel[data-side=right]{justify-self:right}.fd-form-panel[data-side=top]{align-self:start;--fd-from: 0 -100%;--fd-back: 48px 0 0}.fd-form-panel[data-side=bottom]{align-self:end;--fd-from: 0 100%;--fd-back: 0 0 48px}.fd-form-panel[data-side=end]:dir(rtl),.fd-form-panel[data-side=start]:dir(ltr),.fd-form-panel[data-side=left]{--fd-from: -100% 0;--fd-back: 0 0 0 48px}.fd-form-panel:is([data-side=top],[data-side=bottom]){max-width:none;height:60%}.fd-form-panel.fd-height-short{height:40%}.fd-form-panel.fd-height-tall{height:85%}.fd-form-panel[data-behind]{margin:var(--fd-back, 0 48px 0 0)}@media(max-width:600px){.fd-form-dialog.fd-form-panel[data-side]{max-width:none;height:100%;margin:0;--fd-from: 0 100%}.fd-form-dialog.fd-form-panel[data-side=top]{--fd-from: 0 -100%}}@media(prefers-reduced-motion:no-preference){.fd-form-panel{animation:fd-slide .25s ease-out;transition:margin .2s}}@keyframes fd-slide{0%{translate:var(--fd-from, 100% 0)}}@media(prefers-reduced-motion:reduce){.fd-form *,.fd-form *:before,.fd-form *:after{transition:none!important}.fd-button[aria-busy=true]:after{animation:none}}',Vl=op+Ol+Nl+Ll+Rl+Fl+Cl+Al+$l+Tl+Ml,Dl=kl+Sl+El,ap=Vl+Dl,Il="fieldia-styles",Wl="fieldia-styles-looks";function wo(e){if(e.getElementById(Il))return;let t=e.createElement("style");t.id=Il,t.textContent=Vl;let n=e.createElement("style");n.id=Wl,n.textContent=Dl,(e.head??e.documentElement).append(t,n)}var gi={picker:1,head:2,groups:3,text:4};function hi(e,t,n,r){if(e.getElementById(t))return;wo(e);let i=e.createElement("style");i.id=t,i.setAttribute("data-fd-rank",String(r)),i.textContent=n;let a=[...e.querySelectorAll("style[data-fd-rank]")].find(s=>Number(s.getAttribute("data-fd-rank"))>r)??e.getElementById(Wl);a?a.before(i):(e.head??e.documentElement).append(i)}var ko=["bold","italic","underline","bulletList","numberList","highlight","colour","emoji","outdent","indent","strike","size","code","mention","reference","clearFormatting","image","link","unlink","taskList","heading","attach"],So=["bold","italic","underline","bulletList","numberList","highlight","colour","emoji","outdent","indent","strike","size","code","mention","reference","clearFormatting","image","link","unlink"],Lo=["mention","reference","attach","highlight","heading","bold","italic","code","link","bulletList","numberList","taskList"];var Hl=[{suggestions:Lr},{nothingToUndo:ho,onlyResets:Ca},{setAttr:yt,setHidden:at,setText:$t},{hotkeyOn:Rn},{recordMenu:Ia},{PART_RANK:gi,displayValue:It,drawIcon:rt,installPartStyles:hi},{floatUnder:Er},{drawIcon:rt},{describeState:ct,fillIn:Ue,maker:Me,rightToLeft:Ut,setAttr:_e,setHidden:Et,setText:xt,wordsFor:Be},{WIDGET_LABELS:ot},{linkedWords:Nr},{pickRow:yo,scrollToRow:vo,typeAhead:xo,typedKey:pi},{popup:zn},{linkAddress:Mr,sanitizeHtml:sr},{shownOptions:un},{PART_RANK:gi,installPartStyles:hi},{MARKDOWN_TOOLS:Lo,RICH_TOOLS:So,TEXT_TOOLS:ko}];var bi=new Map,Eo=new Map,Da="";function yi(e,t){for(let n of Eo.get(e)??[])"exports"in t?n.resolve(t.exports):n.reject(t.error);Eo.delete(e)}function jl([e,t,n]){if(bi.has(e))return;if(t!=="0.20.0"){let i=`fieldia.${e}.js is version ${t}, but fieldia.js is 0.20.0: load a part of the main script's own version, from the same folder. Its parts are drawn plainly meanwhile.`;console.warn(i),yi(e,{error:new Error(i)});return}let r=n(Hl);bi.set(e,r),yi(e,{exports:r})}function dr(e){return bi.has(e)?Promise.resolve(bi.get(e)):new Promise((t,n)=>{let r=Eo.get(e);if(r){r.push({resolve:t,reject:n});return}Eo.set(e,[{resolve:t,reject:n}]);let i=typeof document>"u"?null:document;if(!i||!Da){yi(e,{error:new Error(`fieldia.${e}.js cannot be loaded: fieldia.js came from no address of its own. Add its tag after fieldia.js.`)});return}let o=i.createElement("script");o.src=`${Da}fieldia.${e}.js`,o.async=!0,o.onload=()=>{o.remove(),bi.has(e)||yi(e,{error:new Error(`${o.src} gave no part`)})},o.onerror=()=>{o.remove(),yi(e,{error:new Error(`${o.src} could not be loaded`)})},(i.head??i.documentElement).append(o)})}function zl(){let e=typeof document>"u"?null:document.currentScript,t=e&&"src"in e?String(e.src):"";Da=t?t.replace(/[?#].*$/,"").replace(/[^/]*$/,""):"";let n=globalThis,r=Array.isArray(n.FieldiaParts)?n.FieldiaParts:[];n.FieldiaParts={push:jl};for(let i of r)jl(i)}function Fn(e,t){let n,r;return{name:e,get loaded(){return r},load(){return n??(n=t().then(i=>r=i,i=>{throw n=void 0,i}))}}}function Pr(e){return Promise.all(e.map(t=>t.load().then(()=>{},()=>{}))).then(()=>{})}var qn=Fn("text",()=>dr("text")),Or=Fn("path",()=>dr("path")),Cr=Fn("choice",()=>dr("choice"));function _n(e,t,n,r=()=>!0){return Object.assign(o=>r(o.node)?Wa(e,o,a=>t(a)(o),n):n(o),{partOf:o=>r(o)?e:void 0})}function Wa(e,t,n,r){let i=e.loaded;if(i)return n(i);let o=r(t),a,s=!1;return e.load().then(d=>{if(s)return;let l=o,c=n(d),f=t.document,y=!!f.activeElement&&l.element.contains(f.activeElement);l.element.replaceWith(c.element),l.destroy?.(),o=c,a&&c.update(a),y&&c.focus()},()=>{}),{get element(){return o.element},get tools(){return o.tools},update(d){a=d,o.update(d)},focus:()=>o.focus(),destroy(){s=!0,o.destroy?.()}}}function ql(e){return e?e.toolbar==="focus"||e.toolbarAt!==void 0||Array.isArray(e.tools)||e.editor!==void 0||e.switchEditor===!0||e.mention!==void 0||e.references!==void 0:!1}var Bl=[["bold","bold","<b>B</b>"],["italic","italic","<i>I</i>"],["underline","underline","<u>U</u>"],["heading","heading","<b>H</b>"],["bulletList","insertUnorderedList",'<svg viewBox="0 0 16 16"><circle cx="3" cy="4" r="1.2"/><circle cx="3" cy="8" r="1.2"/><circle cx="3" cy="12" r="1.2"/><path d="M6 4h8M6 8h8M6 12h8"/></svg>'],["numberList","insertOrderedList",'<svg viewBox="0 0 16 16"><path d="M2.5 3h1v3M2 10.5c.5-.8 2-.8 2 .2 0 .8-2 1.3-2 2.3h2M6 4h8M6 8h8M6 12h8"/></svg>'],["alignLeft","justifyLeft",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M2 6.5h8M2 9.5h12M2 12.5h8"/></svg>'],["alignCenter","justifyCenter",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M4 6.5h8M2 9.5h12M4 12.5h8"/></svg>'],["alignRight","justifyRight",'<svg viewBox="0 0 16 16"><path d="M2 3.5h12M6 6.5h8M2 9.5h12M6 12.5h8"/></svg>'],["link","createLink",'<svg viewBox="0 0 16 16"><path d="M7 9a3 3 0 0 0 4.2 0l2.3-2.3a3 3 0 0 0-4.2-4.2L8.2 3.6M9 7a3 3 0 0 0-4.2 0L2.5 9.3a3 3 0 0 0 4.2 4.2l1.1-1.1"/></svg>']],Ha=_n(qn,e=>e.modernHtml,e=>sp(e),e=>ql(e.options)),sp=({form:e,name:t,node:n,id:r,document:i,labels:o=ot.en})=>{let a=i.createElement("div");a.id=r,a.className="fd-input fd-richtext",a.setAttribute("role","textbox"),a.setAttribute("aria-multiline","true"),a.setAttribute("contenteditable","true"),n.placeholder&&(a.setAttribute("data-placeholder",n.placeholder),a.setAttribute("aria-placeholder",n.placeholder));let s=n.options?.toolbar!==!1&&n.options?.toolbar!=="never",d="";a.addEventListener("input",()=>{let f=sr(a.innerHTML,i);d=f,e.setValue(t,f.trim()===""?null:f)}),a.addEventListener("blur",()=>{a.innerHTML!==d&&(a.innerHTML=d)});let l=s?dp(a,i,o):null,c=a;return l&&(c=i.createElement("div"),c.className="fd-richtext-box",c.setAttribute("role","group"),a.setAttribute("aria-labelledby",`${r}-label`),c.append(l.bar,l.linkRow,a)),{element:c,focus:()=>a.focus(),destroy:()=>l?.destroy(),update(f){l&&(l.bar.hidden=f.readonly,f.readonly&&(l.linkRow.hidden=!0));let y=sr(typeof f.value=="string"?f.value:"",i);(y!==d||i.activeElement!==a)&&(a.innerHTML!==y&&(a.innerHTML=y),d=y),a.setAttribute("contenteditable",String(!f.readonly)),a.classList.toggle("fd-blank",!y.trim()),a.setAttribute("aria-readonly",String(f.readonly)),a.setAttribute("aria-invalid",String(f.invalid)),f.describedBy&&a.setAttribute("aria-describedby",f.describedBy)}}};function dp(e,t,n){let r=t.createElement("div");r.className="fd-richtext-bar",r.setAttribute("role","toolbar"),r.setAttribute("aria-label",n.formatting);let i=null,o=()=>{e.focus();let h=t.getSelection();i&&h&&(h.removeAllRanges(),h.addRange(i))},a=(h,v)=>{o(),t.execCommand?.(h,!1,v)},s=t.createElement("select");s.className="fd-richtext-style",s.setAttribute("aria-label",n.textStyle);for(let[h,v]of[["p","paragraph"],["h2","heading"],["h3","subheading"]]){let b=t.createElement("option");b.value=h,b.textContent=n[v],s.append(b)}s.addEventListener("change",()=>a("formatBlock",`<${s.value}>`));let d=t.createElement("div");d.className="fd-link-row",d.hidden=!0;let l=t.createElement("input");l.className="fd-input",l.type="url",l.placeholder="https://",l.setAttribute("aria-label",n.linkAddress);let c=t.createElement("button");c.type="button",c.className="fd-button fd-link-apply",c.textContent=n.applyLink;let f=t.createElement("button");f.type="button",f.className="fd-button fd-button-link fd-link-remove",f.textContent=n.removeLink,d.append(l,c,f),c.addEventListener("click",()=>{let h=Mr(l.value);if(!h){l.setAttribute("aria-invalid","true");return}l.setAttribute("aria-invalid","false"),o(),t.execCommand?.("createLink",!1,h),d.hidden=!0}),f.addEventListener("click",()=>{o(),t.execCommand?.("unlink",!1),d.hidden=!0}),l.addEventListener("keydown",h=>{h.key==="Enter"?(h.preventDefault(),c.click()):h.key==="Escape"&&(h.preventDefault(),d.hidden=!0,o())});let y=Bl.map(([h,v,b])=>{let E=t.createElement("button");return E.type="button",E.className="fd-richtext-tool",E.setAttribute("aria-label",n[h]),E.title=n[h],E.innerHTML=b,E.querySelector("svg")?.setAttribute("aria-hidden","true"),["bold","italic","underline","heading"].includes(v)&&E.setAttribute("aria-pressed","false"),E.addEventListener("mousedown",m=>m.preventDefault()),E.addEventListener("click",()=>{if(v==="heading")return a("formatBlock",s.value==="h2"?"<p>":"<h2>");if(v!=="createLink")return a(v);d.hidden=!1,l.value="",l.focus()}),E});r.append(s,...y);let u=[s,...y];u.forEach((h,v)=>h.tabIndex=v===0?0:-1),r.addEventListener("keydown",h=>{if(h.key!=="ArrowRight"&&h.key!=="ArrowLeft")return;let v=u.indexOf(t.activeElement);if(v<0)return;let b=getComputedStyle(r).direction==="rtl",E=h.key==="ArrowRight"!==b?1:-1,m=u[(v+E+u.length)%u.length];h.preventDefault(),u.forEach(x=>x.tabIndex=x===m?0:-1),m.focus()});let k=()=>{let h=t.getSelection();if(!h||!h.rangeCount||!e.contains(h.anchorNode))return;i=h.getRangeAt(0).cloneRange();let v=String(t.queryCommandValue?.("formatBlock")??"").toLowerCase().replace(/[<>]/g,"");s.value=v==="h2"||v==="h3"?v:"p";for(let b of y){let E=Bl[y.indexOf(b)][1];b.hasAttribute("aria-pressed")&&b.setAttribute("aria-pressed",String(E==="heading"?v==="h2":t.queryCommandState?.(E)??!1))}};return t.addEventListener("selectionchange",k),{bar:r,linkRow:d,destroy:()=>t.removeEventListener("selectionchange",k)}}var ja=({form:e,name:t,id:n,document:r,labels:i=ot.en})=>{let o=r.createElement("div");o.className="fd-json";let a=r.createElement("textarea");a.id=n,a.className="fd-input fd-textarea fd-code",a.spellcheck=!1;let s=r.createElement("div");return s.className="fd-cell-error",s.hidden=!0,o.append(a,s),a.addEventListener("input",()=>{if(a.value.trim()===""){s.hidden=!0,e.setValue(t,null);return}let d=mo(a.value);s.hidden=!d,d?s.textContent=i.invalidJsonAt.replace("{line}",String(d.line)).replace("{column}",String(d.column)):e.setValue(t,JSON.parse(a.value))}),{element:o,focus:()=>a.focus(),update(d){if(r.activeElement!==a){let l=d.value===null||d.value===void 0?"":JSON.stringify(d.value,null,2);a.value!==l&&(a.value=l)}a.readOnly=d.readonly,a.setAttribute("aria-invalid",String(d.invalid||!s.hidden))}}};var _l=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=n,s=a.multiple?"checkbox":"radio",d=(v,b={},...E)=>{let m=o.createElement(v);for(let[x,g]of Object.entries(b))m.setAttribute(x,g);return m.append(...E),m},l=d("table",{id:i,class:"fd-matrix-table"});l.append(d("thead",{},d("tr",{},d("th",{scope:"col"}),...a.columns.map(v=>d("th",{scope:"col"},v.label)))));let c=d("tbody"),f=[],y=[];for(let v of un(a.rows,e,t,r)){let b=d("tr",{role:s==="radio"?"radiogroup":"group","aria-label":v.label});y.push(b),b.append(d("th",{scope:"row"},v.label));for(let E of a.columns){let m=d("input",{type:s,name:`${i}-${v.value}`,value:String(E.value),"data-row":String(v.value),"aria-label":`${v.label}: ${E.label}`});m.addEventListener("change",()=>{if(a.onePerColumn&&m.checked)for(let x of f)x.value===m.value&&x!==m&&(x.checked=!1);h()}),f.push(m),b.append(d("td",{},d("label",{class:"fd-matrix-pick"},m,d("span",{class:"fd-matrix-column"},E.label))))}c.append(b)}l.append(c);let u=d("div",{class:"fd-matrix"},l),k=v=>a.columns.find(b=>String(b.value)===v)?.value??v;function h(){let v={};for(let b of a.rows){let E=f.filter(m=>m.dataset.row===String(b.value)&&m.checked).map(m=>k(m.value));(a.multiple?E.length:E.length===1)&&(v[String(b.value)]=a.multiple?E:E[0])}e.setValue(t,Object.keys(v).length?v:null)}return{element:u,focus:()=>(f.find(v=>v.checked)??f[0])?.focus(),update(v){let b=v.value&&typeof v.value=="object"&&!Array.isArray(v.value)?v.value:{};for(let E of f){let m=b[E.dataset.row??""],x=Array.isArray(m)?m.map(String):m==null?[]:[String(m)];E.checked=x.includes(E.value),E.disabled=v.readonly}if(l.setAttribute("aria-invalid",String(v.invalid)),s==="radio")for(let E of y)_e(E,"aria-required",String(v.required));v.describedBy?l.setAttribute("aria-describedby",v.describedBy):l.removeAttribute("aria-describedby")}}};var Ir=600,xi=180,lp="#1b2a5c",cp='"Segoe Script", "Snell Roundhand", "Brush Script MT", "Apple Chancery", cursive',fp=e=>Math.floor(e.length*3/4)-(e.endsWith("==")?2:e.endsWith("=")?1:0),up=e=>e.data??e.url??"",Ul=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Be(a,s),l=Me(o),c=r.options??{},f=c.color,y=typeof f=="string"&&/^#[\da-f]{6}$/i.test(f)?f:lp,u=c.penWidth,k=typeof u=="number"&&u>0?u:3,h=c.footerLabel,v=l("canvas",{class:"fd-signature-pad",width:String(Ir),height:String(xi),role:"img","aria-label":d.signaturePad}),b=l("span",{class:"fd-signature-hint","aria-hidden":"true"},r.placeholder||d.signHere),E=l("img",{class:"fd-signature-image",alt:n.label,hidden:""}),m=l("input",{type:"text",class:"fd-input fd-signature-typed","aria-label":d.typeSignature,placeholder:d.typeSignature,autocomplete:"name"}),x=G=>l("button",{type:"button",class:"fd-button fd-button-link",hidden:""},G),g=x(d.undo),$=x(d.clearDrawing);$.classList.add("fd-signature-clear");let A=c.upload===!0?x(d.uploadSignature):null,w=l("input",{type:"file",accept:"image/*",class:"fd-sr-only",tabindex:"-1","aria-hidden":"true"}),L=l("div",{id:i,class:"fd-signature",role:"group"},l("div",{class:"fd-signature-box"},v,E,b),...typeof h=="string"&&h?[l("span",{class:"fd-signature-footer"},h)]:[],l("div",{class:"fd-signature-tools"},m,g,...A?[A,w]:[],$)),S=()=>{let G=v.getContext("2d");return G&&(G.strokeStyle=G.fillStyle=y,G.lineWidth=k,G.lineCap=G.lineJoin="round"),G},I=null,F=!1,D=null,W=[],j=null,O=()=>!W.length&&!D;function B(){let G=S();if(G){G.clearRect(0,0,Ir,xi),D&&(G.font=`italic 64px ${cp}`,G.textAlign="center",G.textBaseline="middle",G.fillText(D,Ir/2,xi/2,Ir-40));for(let _ of W){G.beginPath(),G.arc(_[0].x,_[0].y,k/2,0,Math.PI*2),G.fill();for(let Q=1;Q<_.length;Q++)H(_[Q-1],_[Q])}}}function H(G,_){let Q=S();Q?.beginPath(),Q?.moveTo(G.x,G.y),Q?.lineTo(_.x,_.y),Q?.stroke()}function C(){W=[],D=null,B()}function z(){if(b.hidden=!O(),O())return I=null,e.setValue(t,null);let G;try{G=v.toDataURL("image/png")}catch{return}if(!G)return;let _=G.slice(G.indexOf(",")+1);I=_,e.setValue(t,{name:"signature.png",type:"image/png",size:fp(_),data:_,...D&&!W.length?{text:D}:{}})}function M(G){let _=v.getBoundingClientRect();return{x:(G.clientX-_.left)*Ir/(_.width||Ir),y:(G.clientY-_.top)*xi/(_.height||xi)}}v.addEventListener("pointerdown",G=>{F||G.button!==0||(G.preventDefault(),v.setPointerCapture?.(G.pointerId),j=M(G),W.push([j]),b.hidden=!0,B())}),v.addEventListener("pointermove",G=>{if(!j)return;let _=M(G);H(j,_),W[W.length-1].push(_),j=_});let te=()=>{j&&(j=null,z())};v.addEventListener("pointerup",te),v.addEventListener("pointercancel",te),m.addEventListener("input",()=>{Y(),W=[],D=m.value.trim()||null,B(),z()}),g.addEventListener("click",()=>{W.pop(),B(),z()}),A?.addEventListener("click",()=>w.click()),w.addEventListener("change",()=>{let G=w.files?.[0];w.value="",G&&so(G).then(_=>e.setValue(t,_))}),$.addEventListener("click",()=>{C(),I=null,m.value="",Y(),e.setValue(t,null),m.focus()});function Y(){E.hidden=!0,v.hidden=!1}return{element:L,focus:()=>(m.hidden?$:m).focus(),update(G){F=G.readonly;let _=G.value&&typeof G.value=="object"&&!Array.isArray(G.value)?G.value:null,Q=o.activeElement!==m;if(_&&up(_)!==I){let $e=_.data?`data:${_.type};base64,${_.data}`:_.url??"";E.getAttribute("src")!==$e&&(E.src=$e),E.hidden=!1,v.hidden=!0,I=null,C(),Q&&(m.value=_.text??"")}else _||((I!==null||!E.hidden)&&(I=null,C(),Q&&(m.value="")),Y());b.hidden=F||!O()||!E.hidden,m.hidden=F,m.readOnly=F,$.hidden=F||!_,g.hidden=F||!W.length||!E.hidden,A&&(A.hidden=F),v.classList.toggle("fd-signature-locked",F),ct(L,G),m.setAttribute("aria-invalid",String(G.invalid))}}};var za=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=Be(a,s),l=Me(o),c=A=>A in n&&typeof n[A]=="number"?n[A]:void 0,f=c("min")??0,y=c("max")??100,u=typeof r.options?.step=="number"&&r.options.step>0?r.options.step:1,k=n.type==="integer"?0:n.type==="float"&&n.digits?n.digits[1]:Math.max(0,-Math.floor(Math.log10(u))),h=A=>St(A,k,s),v=l("input",{id:i,type:"range",class:"fd-slider-input",min:String(f),max:String(y),step:String(u)}),b=l("output",{class:"fd-slider-value",for:i,"aria-hidden":"true"}),E=[r.options?.startLabel,r.options?.endLabel].map(A=>typeof A=="string"?A:""),m=(A,w)=>l("span",{class:w?"fd-slider-last":void 0},h(A),...E[w]?[l("span",{class:"fd-slider-word"},E[w])]:[]),x=l("div",{class:"fd-slider-ends","aria-hidden":"true"},m(f,0),m(y,1)),g=En(o,d,()=>{e.setValue(t,null),v.focus()},r),$=l("div",{class:"fd-slider"},l("div",{class:"fd-slider-track"},v,b),x,g.button);return E.some(Boolean)&&v.setAttribute("aria-description",E.filter(Boolean).join(" \u2026 ")),v.addEventListener("input",()=>e.setValue(t,Number(v.value))),{element:$,focus:()=>v.focus(),update(A){let w=typeof A.value=="number"?A.value:null;$.classList.toggle("fd-slider-empty",w===null);let L=String(w??(f+y)/2);v.value!==L&&(v.value=L),b.textContent=w===null?"\u2013":h(w),v.setAttribute("aria-valuetext",w===null?d.notAnswered:h(w)),v.disabled=A.readonly,g.allow(A),g.show(w!==null),ct(v,A)}}};function Ro(e,t,n){let r=i=>e.some(o=>o.exclusive&&o.value===i);return r(n)?[n]:[...t.filter(i=>!r(i)),n]}function Fo(e,t,n){let r=n.validate?.find(o=>o.atMost!==void 0&&(o.when??!0)===!0&&o.level!=="warning")?.atMost,i=r?e("span",{class:"fd-choice-limit",role:"status"}):null;return{element:i,full(o){let a=!!r&&o>=r;return i&&xt(i,a?Ue(t.upTo,{n:r}):""),a}}}function Ao(e,t){let n=t.options?.columns;n==="row"?e.classList.add("fd-choices-row"):typeof n=="number"&&n>=1&&(e.classList.add("fd-choices-columns"),e.style.setProperty("--fd-choice-columns",String(Math.min(4,Math.round(n)))))}var Kl=e=>Jl(e,!1),Gl=e=>Jl(e,!0);function Jl({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s},d){let l=Be(a,s),c=Me(o),f=n.type==="selection"?n.options:[],y=n.type==="selection"&&n.ownAnswers===!0&&!d,u=`${i}-list`,k=c("input",{id:i,type:"text",class:"fd-input fd-combo-input",role:"combobox","aria-autocomplete":"list","aria-expanded":"false","aria-controls":u,autocomplete:"off",placeholder:r.placeholder||l.search}),h=c("ul",{id:u,class:"fd-listbox",role:"listbox",hidden:""}),v=c("ul",{class:"fd-chips"}),b=c("div",{class:"fd-combo"},k,h),E=Er(k,h),m=d?c("div",{class:"fd-choice-search"},b):c("div",{class:"fd-tags fd-choice-tags"},v,b),x=()=>e.getState().values[t],g=()=>Array.isArray(x())?x():[],$=O=>e.setValue(t,O),A=O=>f.find(B=>B.value===O)?.label??(O==null?"":String(O)),w=[],L=-1,S=!1;function I(){h.replaceChildren(...w.map((O,B)=>{let H=c("li",{id:`${u}-${B}`,role:"option",class:`fd-option${B===L?" fd-active":""}`,"aria-selected":String(B===L)},O.label);return H.addEventListener("mousedown",C=>C.preventDefault()),H.addEventListener("click",()=>W(O)),H})),w.length||h.append(c("li",{class:"fd-empty"},l.noResults)),_e(k,"aria-activedescendant",L>=0?`${u}-${L}`:null)}function F(){let O=k.value.trim(),B=d&&O===A(x())?"":O.toLowerCase(),H=new Set(g());w=f.filter(C=>!H.has(C.value)&&C.label.toLowerCase().includes(B)),y&&B&&!H.has(O)&&!f.some(C=>C.label.toLowerCase()===B)&&w.push({value:O,label:Ue(l.createNamed,{name:O})}),L=-1,I(),E.show(),k.setAttribute("aria-expanded","true")}function D(){E.hide(),L=-1,k.setAttribute("aria-expanded","false"),k.removeAttribute("aria-activedescendant")}function W(O){if(d)return k.value=O.label,$(O.value),D();k.value="",$(Ro(f,g(),O.value)),o.activeElement===k?F():D()}d||k.addEventListener("focus",()=>!S&&F()),k.addEventListener("click",()=>!S&&h.hidden&&F()),k.addEventListener("input",()=>!S&&F()),k.addEventListener("blur",()=>{D(),d&&!S&&(k.value.trim()?k.value=A(x()):$(null))}),k.addEventListener("keydown",O=>{if(!S)switch(O.key){case"ArrowDown":case"ArrowUp":{if(O.preventDefault(),h.hidden)return F();if(!w.length)return;let B=O.key==="ArrowDown";L=L===-1?B?0:w.length-1:(L+(B?1:-1)+w.length)%w.length,I(),h.children[L]?.scrollIntoView?.({block:"nearest"});return}case"Enter":{let B=w[L]??(k.value.trim()?w[0]:void 0);if(h.hidden||!B)return;O.preventDefault(),W(B);return}case"Escape":h.hidden||O.preventDefault(),D();return;case"Backspace":!d&&k.value===""&&g().length&&$(g().slice(0,-1));return}});let j="";return{element:m,focus:()=>k.focus(),update(O){if(S=O.readonly,S&&D(),ct(k,O),_e(k,"aria-required",String(O.required)),d){k.readOnly=S,o.activeElement!==k&&(k.value=A(O.value));return}let B=Array.isArray(O.value)?O.value:[];k.hidden=S;let H=JSON.stringify([S,B]);H!==j&&(j=H,v.replaceChildren(...B.map(C=>{let z=A(C),M=c("li",{class:"fd-chip"},c("span",{class:"fd-chip-label"},z));if(!S){let te=c("button",{type:"button",class:"fd-chip-remove","aria-label":Ue(l.remove,{name:z})},"\xD7");te.addEventListener("click",()=>$(g().filter(Y=>Y!==C))),M.append(te)}return M})),h.hidden||F())}}}var pp='<svg viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="M21 16l-5-5-9 9"/></svg>',Yl=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Be(a,s),l=Me(o),c=n.type==="selection"&&n.multiple===!0,f=n.type==="selection"?n.options:[],y=un(f,e,t,r),u=r.options??{},k=u.showLabels===!1,h=l("div",{id:i,class:`fd-image-choices${k?" fd-image-choices-bare":""}`,role:c?"group":"radiogroup","data-size":u.imageSize,"data-fit":u.imageFit});Ao(h,r);let v=c?Fo(l,d,r):null,b=y.map($=>{let A=$.image?l("img",{src:$.image,alt:$.alt??"",loading:"lazy",draggable:"false"}):l("span",{class:"fd-image-card-blank"});$.image||(A.innerHTML=pp);let w=l("button",{type:"button",class:"fd-image-card",role:c?"checkbox":"radio","aria-checked":"false","aria-label":k?$.label:void 0},l("span",{class:"fd-image-card-picture"},A),l("span",{class:"fd-image-card-words"},$.label));return w.addEventListener("click",()=>m($)),h.append(w),w}),E=()=>e.getState().values[t];function m($){if(!c)return e.setValue(t,$.value);let A=Array.isArray(E())?E():[],w=new Set(A.includes($.value)?A.filter(L=>L!==$.value):Ro(f,A,$.value));e.setValue(t,f.filter(L=>w.has(L.value)).map(L=>L.value))}let x=!1;c||h.addEventListener("keydown",$=>{if(x)return;let A=b.indexOf($.target);if(A===-1)return;let w=Ut(h),L={ArrowDown:1,ArrowUp:-1,ArrowRight:w?-1:1,ArrowLeft:w?1:-1},S=$.key==="Home"?0:$.key==="End"?b.length-1:$.key in L?(A+L[$.key]+b.length)%b.length:-1;S!==-1&&($.preventDefault(),m(y[S]),b[S].focus())});let g=c?null:En(o,d,()=>{e.setValue(t,null),b[0]?.focus()},r);return v?.element&&h.append(v.element),{element:g?l("div",{class:"fd-choices-box"},h,g.button):h,focus:()=>(b.find($=>$.getAttribute("aria-checked")==="true")??b[0])?.focus(),update($){x=$.readonly;let A=new Set(Array.isArray($.value)?$.value:[$.value]),w=c?-1:Math.max(0,y.findIndex(S=>A.has(S.value))),L=!!v?.full(Array.isArray($.value)?$.value.length:0);b.forEach((S,I)=>{let F=A.has(y[I].value);S.setAttribute("aria-checked",String(F)),S.tabIndex=c||I===w?0:-1,S.disabled=x||L&&!F&&!y[I].exclusive}),g?.allow($),g?.show(y.some(S=>A.has(S.value))),ct(h,$)}}};var mp=4,Xl=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Be(a,s),l=Me(o),c=un(n.type==="selection"?n.options:[],e,t,r),f=l("ol",{class:"fd-rank-list"}),y=Xi(l),u=r.options?.top,k=typeof u=="number"&&u>=1&&u<c.length?Math.floor(u):0,h=l("div",{class:"fd-rank-pool"}),v=l("button",{type:"button",class:"fd-button fd-rank-keep"},d.keepOrder);v.addEventListener("click",()=>e.setValue(t,x.map(F=>F.option.value)));let b=l("div",{id:i,class:"fd-ranking",role:"group"},...k?[l("div",{class:"fd-choice-limit"},Ue(d.upTo,{n:k})),h,f]:[f,v],y.element),E=c.map(F=>{let D=F.label,W=l("span",{class:"fd-rank-place","aria-hidden":"true"}),j=l("button",{type:"button",class:"fd-rank-move fd-rank-up","aria-label":Ue(d.moveUp,{label:D})},"\u2191"),O=l("button",{type:"button",class:"fd-rank-move fd-rank-down","aria-label":Ue(d.moveDown,{label:D})},"\u2193"),B=l("span",{class:"fd-rank-grip","aria-hidden":"true"}),H=l("span",{class:"fd-rank-tools"},j,O),C=l("li",{class:"fd-rank-item","data-value":String(F.value)},B,W,l("span",{class:"fd-rank-words"},D),H),z={option:F,element:C,place:W,up:j,down:O};if(k){let M=l("button",{type:"button",class:"fd-rank-pick"},D);M.addEventListener("click",()=>!m&&x.length<k&&A([...x,z],z));let te=l("button",{type:"button",class:"fd-rank-move fd-rank-out","aria-label":Ue(d.remove,{name:D})},"\xD7");te.addEventListener("click",()=>{y.say(Ue(d.removed,{name:D})),e.setValue(t,x.filter(Y=>Y!==z).map(Y=>Y.option.value))}),H.append(te),h.append(M),z.pick=M}return j.addEventListener("click",()=>w(z,-1,"up")),O.addEventListener("click",()=>w(z,1,"down")),C.addEventListener("pointerdown",M=>S(z,M)),z}),m=!1,x=[...E],g=null;function $(F){for(x=F,F.forEach((D,W)=>{f.children[W]!==D.element&&f.insertBefore(D.element,f.children[W]??null),D.place.textContent=String(W+1),D.up.disabled=W===0,D.down.disabled=W===F.length-1});f.children.length>F.length;)f.lastElementChild?.remove()}function A(F,D){y.say(Ue(d.movedTo,{label:D.option.label,n:F.indexOf(D)+1,total:F.length})),e.setValue(t,F.map(W=>W.option.value))}function w(F,D,W){let j=x.indexOf(F),O=j+D;if(m||O<0||O>=x.length)return;let B=[...x];B.splice(j,1),B.splice(O,0,F),g=F.element.contains(o.activeElement)?{item:F,which:W==="up"&&O===0||W==="down"&&O===B.length-1?W==="up"?"down":"up":W}:null,A(B,F),L()}function L(){if(!g)return;let{item:F,which:D}=g;g=null,F[D].focus()}f.addEventListener("keydown",F=>{if(m||!F.altKey||F.key!=="ArrowUp"&&F.key!=="ArrowDown")return;let D=E.find(W=>W.element.contains(F.target));D&&(F.preventDefault(),w(D,F.key==="ArrowUp"?-1:1,F.key==="ArrowUp"?"up":"down"))});function S(F,D){if(m||D.button!==0||D.target.closest("button")||D.pointerType==="touch"&&!D.target.closest(".fd-rank-grip"))return;let W=D.clientY,j=[...x],O=!1;F.element.setPointerCapture?.(D.pointerId);let B=C=>{if(!O&&Math.abs(C.clientY-W)<mp)return;O||(O=!0,F.element.classList.add("fd-rank-lifted")),C.preventDefault();let z=x.filter(te=>te!==F),M=z.filter(te=>{let Y=te.element.getBoundingClientRect();return Y.top+Y.height/2<C.clientY}).length;x.indexOf(F)!==M&&$([...z.slice(0,M),F,...z.slice(M)])},H=()=>{F.element.removeEventListener("pointermove",B),F.element.removeEventListener("pointerup",H),F.element.removeEventListener("pointercancel",H),F.element.classList.remove("fd-rank-lifted"),x.some((C,z)=>C!==j[z])&&A(x,F)};F.element.addEventListener("pointermove",B),F.element.addEventListener("pointerup",H),F.element.addEventListener("pointercancel",H)}function I(F){let D=(Array.isArray(F)?F:[]).map(W=>E.find(j=>j.option.value===W)).filter(W=>!!W);return k?D.slice(0,k):Array.isArray(F)?[...new Set([...D,...x])]:x}return $(k?[]:x),{element:b,focus:()=>(E.find(F=>F.pick&&!F.pick.hidden&&!F.pick.disabled)?.pick??(x[0]?.down.disabled?x[0]?.up:x[0]?.down))?.focus(),update(F){m=F.readonly,b.classList.toggle("fd-ranking-locked",m);let D=I(F.value);(D.length!==x.length||D.some((W,j)=>W!==x[j])||!k&&!f.children.length)&&$(D);for(let W of E)W.up.hidden=W.down.hidden=m,W.pick&&(W.pick.hidden=x.includes(W),W.pick.disabled=m||x.length>=k,W.element.querySelector(".fd-rank-out").hidden=m);v.hidden=m||Array.isArray(F.value)&&F.value.length>0,L(),ct(b,F)}}};var Zl={street:["addressStreet","street-address"],line2:["addressLine2","address-line2"],city:["addressCity","address-level2"],region:["addressRegion","address-level1"],postcode:["addressPostcode","postal-code"],country:["addressCountry","country"]},gp=e=>typeof e=="string"&&e in Zl,hp="AC AN BU CP CQ CS DD DG DY EA EU EZ FX HV IC NH QO RH SU TA TP UK UN VD XA XB YD YU ZR ZZ",Ba={};function qa(e){if(!Ba[e]){let t=new Intl.DisplayNames([e],{type:"region",fallback:"none"}),n=[];for(let r=65;r<91;r++)for(let i=65;i<91;i++){let o=String.fromCharCode(r,i),a=!hp.includes(o)&&t.of(o);a&&n.push([o,a])}Ba[e]=n.sort((r,i)=>r[1].localeCompare(i[1],e))}return Ba[e]}var Ql=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=Be(o,a),d=Me(i),l=n.options??{},c=l.parts,f=Array.isArray(c)?c.filter(gp):["street","city","postcode","country"],y=Array.isArray(l.requiredParts)?l.requiredParts:[],u=typeof l.country=="string"?l.country:"",k=d("div",{id:r,class:"fd-address",role:"group"}),h=(b,E)=>{let m=e.getState().values[t],x=m&&typeof m=="object"&&!Array.isArray(m)?{...m}:{};x[b]=E,u&&f.includes("country")&&x.country===void 0&&(x.country=u);let g=Object.fromEntries(Object.entries(x).filter(([,A])=>typeof A!="string"||A.trim()!=="")),$=Object.keys(g);e.setValue(t,$.length&&(b==="country"||$.join()!=="country"||g.country!==u)?g:null)},v=f.map(b=>{let[E,m]=Zl[b],x={id:`${r}-${b}`,class:"fd-input","data-part":b,autocomplete:b==="street"&&f.includes("line2")?"address-line1":m,"aria-required":y.includes(b)?"true":void 0},g=b==="country"?d("select",x,d("option",{value:""}),...qa(a).map(([$,A])=>d("option",{value:$},A))):d("input",{type:"text",...x});return g.addEventListener(b==="country"?"change":"input",()=>h(b,g.value)),b==="country"&&g.classList.add("fd-select"),k.append(d("div",{class:`fd-address-part fd-address-${b}${y.includes(b)?" fd-required":""}`},d("label",{class:"fd-address-label",for:g.id},s[E]),g)),{part:b,input:g}});return{element:k,focus:()=>v[0]?.input.focus(),update(b){let E=b.value&&typeof b.value=="object"&&!Array.isArray(b.value)?b.value:{};for(let{part:m,input:x}of v){let g=typeof E[m]=="string"?E[m]:m==="country"&&E.country===void 0?u:"";x instanceof HTMLSelectElement?(g&&![...x.options].some($=>$.value===g)&&x.append(d("option",{value:g},g)),x.disabled=b.readonly):x.readOnly=b.readonly,i.activeElement!==x&&x.value!==g&&(x.value=g),x.setAttribute("aria-invalid",String(b.invalid&&(!y.length||y.includes(m)&&!g.trim())))}ct(k,b)}}};var ec=e=>typeof e=="number"&&Number.isInteger(e)&&e>=0?e:void 0,tc=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s,dialogs:d,widgets:l})=>{let c=Be(a,s),f=Me(o),y=n,u=r.options??{},k=ec(u.min)??0,h=ec(u.max)??1/0,v=typeof u.itemLabel=="string"&&u.itemLabel.trim()?u.itemLabel.trim():null,b=j=>v?`${v} ${j}`:Ue(c.entry,{n:j}),E=(r.columns??Object.keys(y.fields)).filter(j=>y.fields[j]&&y.fields[j].type!=="one2many"&&j!==y.sequenceField&&j!==y.lineKinds?.field),m=f("div",{class:"fd-repeat-list"}),x=f("button",{type:"button",class:"fd-button fd-repeat-add"},typeof u.addLabel=="string"&&u.addLabel?u.addLabel:c.addAnother),g=Xi(f),$=f("div",{id:i,class:"fd-repeat",role:"group"},m,x,g.element),A=new Map,w=()=>e.getState().values[t]??[],L=!1,S=null;for(let j=w().length;j<k;j++)e.addLine(t);x.addEventListener("click",()=>{if(L||w().length>=h)return;let j=e.addLine(t);S=()=>A.get(j)?.fields[0]?.widget.focus(),W()});function I(j){let O=`${i}-${j.key}-title`,B=f("span",{id:O,class:"fd-repeat-title"}),H=f("button",{type:"button",class:"fd-repeat-remove"},"\xD7"),C=(Q,$e,Ne)=>{let Ie=f("button",{type:"button",class:"fd-repeat-tool"},Q);return Ie.addEventListener("click",Ne),[Ie,$e]},z=()=>w().findIndex(Q=>Q.key===j.key),M=[C("\u2191","moveUp",()=>F(j.key,z()-1)),C("\u2193","moveDown",()=>F(j.key,z()+1)),C("\u29C9","copy",()=>D(j.key))],te=d&&(r.lineOpens||r.lineForm)?f("button",{type:"button",class:"fd-repeat-tool fd-line-open","aria-label":c.openLine,title:c.openLine},"\u2197"):null;te?.addEventListener("click",()=>{let Q=w().find($e=>$e.key===j.key);Q&&d&&oo(e,t,r,Q,d,L)});let Y=f("div",{class:"fd-repeat-fields"}),G=f("div",{class:"fd-repeat-card",role:"group","aria-labelledby":O,"data-line":j.key},f("div",{class:"fd-repeat-head"},B,...M.map(([Q])=>Q),...te?[te]:[],H),Y),_=E.map(Q=>{let $e=y.fields[Q],Ne=`${i}-${j.key}-${Q}`,Ie={type:"field",id:`${r.id}.${j.key}.${Q}`,field:Q},Pe=Xt({form:io(e,t,j.key),name:Q,field:$e,node:Ie,id:Ne,document:o,labels:a,locale:s,dialogs:d,widgets:l}),ee=f("label",{class:"fd-repeat-label",for:Ne},$e.label);["INPUT","SELECT","TEXTAREA"].includes(Pe.element.tagName)||ee.addEventListener("click",()=>Pe.focus());let ge=f("div",{class:"fd-cell-error",hidden:""});return Y.append(f("div",{class:"fd-repeat-field"},ee,Pe.element,ge)),{name:Q,def:$e,widget:Pe,error:ge}});return H.addEventListener("click",()=>{let Q=w(),$e=Q.findIndex(ee=>ee.key===j.key);if(L||$e===-1||Q.length<=k)return;let Ne=B.textContent??"";e.removeLine(t,j.key),g.say(Ue(c.removed,{name:Ne}));let Ie=w(),Pe=Ie[Math.min($e,Ie.length-1)];S=()=>Pe?A.get(Pe.key)?.fields[0]?.widget.focus():x.focus(),W()}),{element:G,title:B,remove:H,tools:M,fields:_}}function F(j,O){let B=w().findIndex(z=>z.key===j);if(L||O<0||O>=w().length||O===B)return;let H=A.get(j)?.title.textContent??"";Tr(e,t,y,j,O);let C=B>O&&O>0||O===w().length-1?0:1;A.get(j)?.tools[C][0].focus(),g.say(Ue(c.movedTo,{label:H,n:O+1,total:w().length}))}function D(j){let O=w(),B=O.findIndex(z=>z.key===j);if(L||B<0||O.length>=h)return;let H={...O[B].values};y.sequenceField&&delete H[y.sequenceField];let C=e.addLine(t,H);Tr(e,t,y,C,B+1),A.get(C)?.fields[0]?.widget.focus()}function W(){let j=S;S=null,j?.()}return{element:$,focus:()=>([...A.values()].find(j=>j.element===m.firstElementChild)?.fields[0]?.widget??x).focus(),update(j){L=j.readonly;let O=j.value??[],B=e.getState().errors,H=new Set(O.map(C=>C.key));for(let[C,z]of A)if(!H.has(C)){z.element.remove();for(let M of z.fields)M.widget.destroy?.();A.delete(C)}O.forEach((C,z)=>{let M=A.get(C.key);M||A.set(C.key,M=I(C)),m.children[z]!==M.element&&m.insertBefore(M.element,m.children[z]??null),M.title.textContent=b(z+1),M.remove.setAttribute("aria-label",Ue(c.remove,{name:M.title.textContent})),M.remove.hidden=L||O.length<=k||r.lineDelete!==void 0&&!e.lineState(r.id,C.key).deletable;for(let[te,Y]of M.tools)te.setAttribute("aria-label",Ue(c[Y],{label:M.title.textContent,name:M.title.textContent})),te.hidden=L||(Y==="moveUp"?z===0:Y==="moveDown"?z===O.length-1:O.length>=h);for(let te of M.fields){let Y=B[`${t}.${C.key}.${te.name}`];te.error.hidden=!Y,te.error.textContent=Y??"",te.widget.update({value:C.values[te.name],values:C.values,parent:j.values,readonly:L||te.def.readonly===!0,required:te.def.required===!0,invalid:!!Y})}}),x.hidden=L||O.length>=h,ct($,j)}}};function _a(e,{form:t,name:n,field:r,document:i,labels:o,locale:a},s){let d=r.type==="char"||r.type==="text"?r.size:void 0;if(!d||t.page.fields[n]!==r)return e;let l=Me(i),c=l("div",{class:"fd-count","aria-hidden":"true"}),f=l("div",{class:"fd-sr-only","aria-live":"polite"}),y;return{...e,element:l("div",{class:"fd-counted"},e.element,c,f),update(u){e.update(u);let k=s.value.length;xt(c,`${k} / ${d}`),c.classList.toggle("fd-count-near",k>=d*.9),Et(c,u.readonly),i.activeElement===s&&(clearTimeout(y),y=setTimeout(()=>xt(f,Ue(Be(o,a).charactersLeft,{n:d-k})),700))}}}function nc(e,t){let n=t.options?.rows;return typeof n=="number"&&(e.rows=n),t.options?.autoGrow===!1?()=>{}:()=>{e.style.height="",e.scrollHeight&&(e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)}}function $o(e,t,n){let r=n.options??{},i=t.type==="char";(i?[r.min,r.max]:"min"in t?[t.min,t.max]:[]).forEach((a,s)=>{typeof a=="string"&&(e[s?"max":"min"]=i?a:Vn(a)+(t.type==="datetime"?s?"T23:59":"T00:00":""))}),typeof r.step=="number"&&(e.step=String(r.step*60))}function rc(e,t){let{form:n,name:r,document:i}=t,o=Be(t.labels,t.locale),a=i.createElement("div"),s=i.createElement("div"),d=i.createElement("button");d.type="button",d.className="fd-button fd-button-link",d.textContent=o.choicesFailed,d.onclick=()=>n.loadChoices(r),s.setAttribute("role","status"),a.style.cssText="display:grid;gap:4px";let l=new Map,c,f=null,y=u=>{c?.destroy?.(),c=e({...t,field:{...t.field,options:u}}),c.element.getAttribute("role")&&c.element.setAttribute("aria-labelledby",`${t.id}-label`),a.replaceChildren(c.element,s,d)};return y([]),n.getState().choices[r]||n.loadChoices(r),{element:a,focus:()=>c.focus(),destroy:()=>c.destroy?.(),update(u){let k=n.getState().choices[r];if(k?.options&&k.options!==f){f=k.options;for(let v of f)l.set(v.value,v.label);y(f)}c.update(u);let h=f&&!t.field.other?[u.value].flat().filter(v=>v!=null&&!f?.some(b=>b.value===v)):[];s.className=k?.loading?"fd-help":"fd-warning",s.textContent=k?.loading?o.loadingChoices:h.length?lt(o.notOffered,{name:h.map(v=>l.get(v)??String(v)).join(", ")}):"",s.hidden=!s.textContent,d.hidden=!k?.error}}}var ic=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a})=>{let s=Be(o,a),d=Me(i),l=d("div",{id:r,class:"fd-points fd-yes-no",role:"radiogroup"}),c=!1,f=[!0,!1].map(u=>{let k=n.options?.[u?"yesLabel":"noLabel"],h=d("button",{type:"button",role:"radio"},typeof k=="string"&&k?k:u?s.yes:s.no);return h.addEventListener("click",()=>e.setValue(t,u)),l.append(h),h});l.addEventListener("keydown",u=>{let k=f.indexOf(u.target);c||k===-1||!u.key.startsWith("Arrow")||(u.preventDefault(),e.setValue(t,k===1),f[1-k].focus())});let y=En(i,s,()=>{e.setValue(t,null),f[0].focus()},n);return{element:d("div",{class:"fd-choices-box"},l,y.button),focus:()=>(f.find(u=>u.getAttribute("aria-checked")==="true")??f[0]).focus(),update(u){c=u.readonly;let k=u.value===!0?0:u.value===!1?1:-1;f.forEach((h,v)=>{_e(h,"aria-checked",String(v===k)),h.classList.toggle("fd-on",v===k),h.tabIndex=v===Math.max(0,k)?0:-1,h.disabled=c}),_e(l,"aria-required",String(u.required)),y.allow(u),y.show(k!==-1),ct(l,u)}}};var bp=new Set(["info","success","warning","danger","muted"]),To=({field:e,node:t,id:n,document:r,locale:i="en"})=>{let o=t.options?.tones??{},a=r.createElement("span");return a.id=n,a.className="fd-value-badge",a.hidden=!0,{element:a,focus:()=>{},update({value:s,values:d}){let l=It(e,s,d,i);a.textContent!==l&&(a.textContent=l),a.hidden=l==="";let c=s!==null&&typeof s=="object"&&"id"in s?String(s.id):String(s),f=o[c];typeof f=="string"&&bp.has(f)?a.dataset.tone=f:delete a.dataset.tone}}};var oc=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a=ot.en,locale:s,dialogs:d})=>{let l=n,c=Me(o),f=l.fields??{},y=(r.columns??[]).filter(O=>f[O]),u=O=>typeof r.options?.[O]=="string"&&r.options[O].trim()?r.options[O]:null,k=!!d&&d.canOpen(l.relation),h=c("tr",{},...y.map(O=>c("th",{scope:"col","data-column":O},f[O].label)),c("th",{class:"fd-lines-tools"})),v=c("tbody"),b=c("table",{class:"fd-lines-table fd-links-table"},c("thead",{},h),v),E=c("button",{type:"button",class:"fd-button fd-button-link fd-lines-add","data-add":"line"},`+ ${u("addLabel")??a.addLine}`),m=c("div",{class:"fd-lines-adds"},E),x=u("emptyLabel"),g=x?c("div",{class:"fd-help fd-lines-empty"},x):null,$=c("div",{class:"fd-lines fd-links",id:i,role:"group"},c("div",{class:"fd-lines-scroll"},b),...g?[g]:[],m),A=new Map,w=new Set,L=!1,S=[],I=()=>e.getState().values[t]??[];function F(O,B=!1){let H=O.map(C=>C.id).filter(C=>B||!A.has(String(C))&&!w.has(String(C)));if(H.length){for(let C of H)w.add(String(C));e.linkedValues(t,H,y).then(C=>{for(let{id:z,values:M}of C)A.set(String(z),M);for(let z of H)w.delete(String(z));j()},()=>H.forEach(C=>w.delete(String(C))))}}E.addEventListener("click",async()=>{if(!d||L)return;let O=await d.searchMore({title:l.label,search:(B,H)=>e.search(t,B,H)});!O||I().some(B=>B.id===O.id)||e.setValue(t,[...I(),{id:O.id,label:O.label}])});async function D(O){let B=await d?.openRecord(l.relation,{recordId:O.id,title:O.label});B&&(B.label!==O.label&&e.setValue(t,I().map(H=>H.id===O.id?{id:H.id,label:B.label}:H)),F([O],!0))}function W(O){let B=A.get(String(O.id)),H=y.map((z,M)=>{let te=B?It(f[z],B[z]??null,B,s):M===0?O.label:"";return c("td",{"data-column":z},c("span",{class:"fd-value-text"},te))}),C=c("td",{class:"fd-lines-tools"});if(k){let z=c("button",{type:"button",class:"fd-line-open","aria-label":Ue(a.openNamed,{name:O.label}),title:a.openLine},"\u2197");z.addEventListener("click",()=>{D(O)}),C.append(z)}if(!L){let z=c("button",{type:"button",class:"fd-line-delete","aria-label":Ue(a.remove,{name:O.label})},"\xD7");z.addEventListener("click",()=>e.setValue(t,I().filter(M=>M.id!==O.id))),C.append(z)}return c("tr",{"data-record":String(O.id)},...H,C)}function j(){let O=o.activeElement,B=$.contains(O)?O.closest("tr")?.dataset.record:void 0;v.replaceChildren(...S.map(W)),B&&v.querySelector(`tr[data-record="${CSS.escape(B)}"] button`)?.focus()}return{element:$,focus:()=>(v.querySelector("button")??E).focus(),update(O){let B=O.value??[],H=B!==S||O.readonly!==L;L=O.readonly,S=B,m.hidden=L||!d,g&&(g.hidden=B.length>0),_e($,"aria-invalid",String(O.invalid)),_e($,"aria-describedby",O.describedBy||null),H&&j(),F(B)}}};var Ua=({form:e,name:t,field:n,id:r,document:i})=>{let o=Me(i),a=n.type==="selection"?n.options.map(f=>({value:f.value,label:f.label})):[{value:!1,label:""},{value:!0,label:n.label}],s=o("div",{id:r,class:"fd-priority",role:"radiogroup"}),d=a.slice(1).map((f,y)=>{let u=o("button",{type:"button",role:"radio",class:"fd-priority-star","aria-label":f.label,title:f.label,"data-value":String(f.value)},"\u2605");return u.addEventListener("click",()=>e.setValue(t,l(e.getState().values[t])===y+1?a[0].value:f.value)),s.append(u),u}),l=f=>Math.max(0,a.findIndex(y=>y.value===f)),c=!1;return s.addEventListener("keydown",f=>{if(c)return;let y=Ut(s)?"ArrowLeft":"ArrowRight",u=Ut(s)?"ArrowRight":"ArrowLeft",k=f.key===y||f.key==="ArrowUp"?1:f.key===u||f.key==="ArrowDown"?-1:0;if(!k)return;f.preventDefault();let h=Math.min(a.length-1,Math.max(0,l(e.getState().values[t])+k));e.setValue(t,a[h].value),d[Math.max(0,h-1)]?.focus()}),{element:s,focus:()=>(d.find(f=>f.tabIndex===0)??d[0])?.focus(),update(f){c=f.readonly;let y=l(f.value);d.forEach((u,k)=>{_e(u,"aria-checked",String(y===k+1)),u.classList.toggle("fd-on",k<y);let h=y===k+1||y===0&&k===0?0:-1;u.tabIndex!==h&&(u.tabIndex=h),u.disabled!==f.readonly&&(u.disabled=f.readonly)}),ct(s,f)}}};var yp={normal:"muted",grey:"muted",blocked:"danger",red:"danger",done:"success",green:"success",waiting:"warning"},ac=["muted","danger","success","warning","info"],xp=new Set(["info","success","warning","danger","muted"]),vp=/^#[0-9a-fA-F]{6}$/,sc=({form:e,name:t,field:n,node:r,id:i,document:o})=>{let a=Me(o),s=n.type==="selection"?n.options:[],d=r.options?.tones??{},l=r.options?.colours??{},c=r.options?.listDots===!1,f=(F,D)=>{let W=d[String(F)];return typeof W=="string"&&xp.has(W)?W:yp[String(F)]??ac[D%ac.length]},y=F=>{let D=l[String(F)];return typeof D=="string"&&vp.test(D)?D:null},u=(F,D)=>{let W=y(D);W?F.style.setProperty("--fd-dot",W):F.style.removeProperty("--fd-dot")},k=()=>a("span",{class:"fd-dot","aria-hidden":"true"}),h=a("button",{type:"button",id:i,class:"fd-dot-button","aria-haspopup":"menu","aria-expanded":"false","aria-controls":`${i}-menu`},k()),v=a("span",{class:"fd-dot-label","data-quiet-words":r.options?.label===!0?void 0:""}),b=s.map((F,D)=>{let W=c?yo(a,{role:"menuitemradio",class:"fd-dot-item",tabindex:"-1"},F.label):a("div",{role:"menuitemradio",class:"fd-dot-item",tabindex:"-1","data-tone":f(F.value,D)},k(),F.label);return c||u(W,F.value),W.addEventListener("click",()=>I(D)),W}),E=a("div",{id:`${i}-menu`,role:"menu",class:c?"fd-dot-menu fd-pick-list":"fd-dot-menu","aria-label":n.label,hidden:""},...b),m=a("span",{class:"fd-dot-box","data-list":c?"own":void 0},h,v,E),x=()=>s.findIndex(F=>F.value===e.getState().values[t]),g=!1,$=zn(m,h,E,()=>{g&&h.focus(),g=!1},c?{alignTo:m,matchWidth:!0,gap:0}:{}),A=xo(()=>s.map(F=>F.label));function w(F){b[F]?.focus(),vo(E,b[F])}function L(F=Math.max(0,x())){$.open(),w(F)}function S(F){g=F,$.close()}function I(F){e.setValue(t,s[F].value),S(!0)}return h.addEventListener("click",()=>E.hidden?L():S(!0)),m.addEventListener("click",F=>{h.disabled||h.contains(F.target)||E.contains(F.target)||(E.hidden?L():S(!0))}),h.addEventListener("keydown",F=>{if(pi(F)){let D=A(F.key,x());D>=0&&(F.preventDefault(),L(D));return}F.key!=="ArrowDown"&&F.key!=="ArrowUp"&&F.key!=="Enter"&&F.key!==" "||(F.preventDefault(),L(F.key==="ArrowUp"?x()<0?b.length-1:x():void 0))}),E.addEventListener("keydown",F=>{let D=b.indexOf(o.activeElement),W={ArrowDown:D+1,ArrowUp:D-1,Home:0,End:b.length-1}[F.key];if(W!==void 0)F.preventDefault(),w((W+b.length)%b.length);else if(F.key==="Enter"||F.key===" ")F.preventDefault(),D>=0&&I(D);else if(F.key==="Escape")F.preventDefault(),F.stopPropagation(),S(!0);else if(F.key==="Tab")S(!0);else if(pi(F)){let j=A(F.key,D);j>=0&&(F.preventDefault(),w(j))}}),{element:m,focus:()=>h.focus(),destroy:()=>S(!1),update(F){let D=s.findIndex(j=>j.value===F.value),W=D<0?"":s[D].label;_e(h,"aria-label",W?`${n.label}: ${W}`:n.label),_e(h,"title",W||null),_e(h,"data-tone",D<0?"muted":f(F.value,D)),u(h,D<0?void 0:F.value),xt(v,W),b.forEach((j,O)=>_e(j,"aria-checked",String(O===D))),h.disabled!==F.readonly&&(h.disabled=F.readonly),F.readonly&&S(!1),ct(h,F)}}};var Mo=["transparent","#f06050","#f4a460","#f7cd1f","#6cc1ed","#814968","#eb7e7f","#2c8397","#475577","#d6145f","#30c381","#9365b8"],wp=({form:e,name:t,field:n,id:r,document:i,labels:o,locale:a})=>{let s=Me(i),d=Be(o,a).colourNames.split("|"),l=s("button",{type:"button",id:r,class:"fd-colour-button","aria-haspopup":"true","aria-expanded":"false","aria-controls":`${r}-palette`}),c=Mo.map((E,m)=>{let x=s("button",{type:"button",role:"radio",class:"fd-colour","aria-label":d[m]??String(m),title:d[m]??String(m),tabindex:"-1","data-colour":String(m)});return x.style.setProperty("--fd-swatch",E),x.addEventListener("click",()=>b(m)),x}),f=s("div",{id:`${r}-palette`,role:"radiogroup",class:"fd-colour-palette","aria-label":n.label,hidden:""},...c),y=s("span",{class:"fd-colour-box"},l,f),u=!1,k=zn(y,l,f,()=>{u&&l.focus(),u=!1}),h=()=>{let E=e.getState().values[t];return typeof E=="number"&&E>=0&&E<Mo.length?E:0};function v(E){u=E,k.close()}function b(E){e.setValue(t,E),v(!0)}return l.addEventListener("click",()=>{if(k.isOpen())return v(!0);k.open(),c[h()].focus()}),f.addEventListener("keydown",E=>{let m=c.indexOf(i.activeElement),x=Ut(y)?"ArrowLeft":"ArrowRight",g=Ut(y)?"ArrowRight":"ArrowLeft",$=E.key===x||E.key==="ArrowDown"?m+1:E.key===g||E.key==="ArrowUp"?m-1:E.key==="Home"?0:E.key==="End"?c.length-1:null;$!==null?(E.preventDefault(),c[($+c.length)%c.length].focus()):(E.key==="Enter"||E.key===" ")&&m>=0?(E.preventDefault(),b(m)):E.key==="Escape"?(E.preventDefault(),E.stopPropagation(),v(!0)):E.key==="Tab"&&v(!0)}),{element:y,focus:()=>l.focus(),destroy:()=>v(!1),update(E){let m=typeof E.value=="number"&&E.value>=0&&E.value<Mo.length?E.value:0;l.style.setProperty("--fd-swatch",Mo[m]),l.classList.toggle("fd-colour-none",m===0),_e(l,"aria-label",`${n.label}: ${d[m]??m}`),_e(l,"title",d[m]??String(m)),c.forEach((x,g)=>_e(x,"aria-checked",String(g===m))),l.disabled!==E.readonly&&(l.disabled=E.readonly),E.readonly&&v(!1),ct(l,E)}}},kp=({form:e,name:t,id:n,document:r})=>{let i=Me(r),o=i("input",{id:n,type:"color",class:"fd-colour-input"}),a=i("span",{class:"fd-colour-code",dir:"ltr"});return o.addEventListener("input",()=>e.setValue(t,o.value)),{element:i("span",{class:"fd-colour-box"},o,a),focus:()=>o.focus(),update(s){let d=typeof s.value=="string"?s.value:"",l=/^#[0-9a-f]{6}$/i.test(d)?d.toLowerCase():"#000000";o.value!==l&&(o.value=l),xt(a,d),o.disabled!==s.readonly&&(o.disabled=s.readonly),ct(o,s)}}},Ka=e=>e.field.type==="char"?kp(e):wp(e);var Ga=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Me(o),l=Be(a,s),c=n.type==="text",f=c?d("textarea",{id:i,class:"fd-input fd-textarea",rows:"3"}):d("input",{id:i,type:"text",class:"fd-input",autocomplete:"off"});r.placeholder&&(f.placeholder=r.placeholder),f.addEventListener("input",()=>e.setValue(t,f.value===""?null:f.value));let y=d("button",{type:"button",class:"fd-button fd-copy-button",hidden:""},l.copyValue),u=d("span",{class:"fd-sr-only",role:"status"}),k;return y.addEventListener("click",async()=>{let h=String(e.getState().values[t]??"");if(h){try{await navigator.clipboard.writeText(h)}catch{f.select(),o.execCommand?.("copy")}xt(y,l.copied),xt(u,l.copied),clearTimeout(k),k=setTimeout(()=>{xt(y,l.copyValue),xt(u,"")},2e3)}}),{element:d("span",{class:`fd-copy${c?" fd-copy-long":""}`},f,y,u),focus:()=>f.focus(),destroy:()=>clearTimeout(k),update(h){let v=h.value===null||h.value===void 0?"":String(h.value);f.value!==v&&(f.value=v),f.readOnly!==h.readonly&&(f.readOnly=h.readonly),y.hidden=!v,ct(f,h)}}};var Oo=e=>String(e).padStart(2,"0"),yn=(e,t)=>new Date(e.getFullYear(),e.getMonth(),e.getDate()+t),No=(e,t)=>new Date(e.getFullYear(),e.getMonth()+t,Math.min(e.getDate(),new Date(e.getFullYear(),e.getMonth()+t+1,0).getDate())),Po=(e,t)=>!!e&&!!t&&e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate(),Sp='<svg viewBox="0 0 16 16" aria-hidden="true"><rect x="2" y="3" width="12" height="11" rx="1.5"></rect><path d="M2 6.5h12M5 1.5v3M11 1.5v3"></path></svg>',Ja=e=>`${e.getFullYear()}-${Oo(e.getMonth()+1)}-${Oo(e.getDate())}`,Ya=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s="en"})=>{let d=Me(o),l=Be(a,s),c=n.type==="datetime"?"datetime":"date",f=typeof r.options?.endField=="string"?r.options.endField:null,y=f?e.page.fields[f]?.label??f:"",u=s==="en"?"en-GB":s,k=new Intl.DateTimeFormat(u,{month:"long",year:"numeric",numberingSystem:"latn"}),h=new Intl.DateTimeFormat(u,{weekday:"long",day:"numeric",month:"long",year:"numeric",numberingSystem:"latn"}),v=new Intl.DateTimeFormat(u,{weekday:"short"}),b=Y=>{if(typeof Y!="string"||!Y)return"";if(c==="date")return Y.slice(0,10);let G=new Date(Y);return Number.isNaN(G.getTime())?"":`${Ja(G)}T${Oo(G.getHours())}:${Oo(G.getMinutes())}`},E=Y=>{let G=b(Y),_=/^(\d{4})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/.exec(G);return _?new Date(Number(_[1]),Number(_[2])-1,Number(_[3]),Number(_[4]??0),Number(_[5]??0)):null},m=(Y,G)=>{if(c==="date")return Ja(Y);let _=E(G);return new Date(Y.getFullYear(),Y.getMonth(),Y.getDate(),_?.getHours()??0,_?.getMinutes()??0).toISOString()},x=(Y,G,_)=>{let Q=d("input",{type:c==="date"?"date":"datetime-local",class:"fd-input fd-range-input","aria-label":G,..._?{id:_}:{}});return Q.addEventListener("input",()=>{if(!Q.value)return e.setValue(Y,null);if(c==="date")return e.setValue(Y,Q.value);let $e=new Date(Q.value);Number.isNaN($e.getTime())||e.setValue(Y,$e.toISOString())}),ar(Q,()=>F.hidden&&z()),Q},g=x(t,n.label,i),$=f?x(f,y):null,A=d("button",{type:"button",class:"fd-calendar-button fd-range-button","aria-label":l.chooseDate,"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${i}-range`});A.innerHTML=Sp;let w=d("button",{type:"button","aria-label":l.previousMonth},"\u2039"),L=d("button",{type:"button","aria-label":l.nextMonth},"\u203A"),S=d("span",{class:"fd-calendar-title","aria-live":"polite"}),I=d("table",{class:"fd-calendar-grid",role:"grid"}),F=d("div",{id:`${i}-range`,class:"fd-calendar fd-range-calendar",role:"dialog",hidden:""},d("div",{class:"fd-calendar-head"},w,S,L),I),D=d("div",{class:"fd-range",role:"group"},d("span",{class:"fd-range-box"},g,...$?[d("span",{class:"fd-range-arrow","aria-hidden":"true"},"\u2192"),$]:[]),A,F),W=new Date,j=null,O=null;function B(Y){let G=e.getState().values;if(!f)return e.setValue(t,m(Y,G[t])),M();if(!j)return j=Y,W=Y,H(!0);let[_,Q]=Y<j?[Y,j]:[j,Y];j=null,e.setValue(t,m(_,G[t])),e.setValue(f,m(Q,G[f])),M()}function H(Y){let G=e.getState().values,_=j??E(G[t]),Q=j?O&&O>=j?O:null:f?E(G[f]):null,$e=k.format(W);S.textContent=$e,F.setAttribute("aria-label",$e);let Ne=new Date(W.getFullYear(),W.getMonth(),1),Ie=yn(Ne,-((Ne.getDay()+6)%7)),Pe=d("tr",{},...Array.from({length:7},(ge,ke)=>d("th",{scope:"col"},v.format(yn(Ie,ke)).replace(/\.$/,"")))),ee=d("tbody");for(let ge=Ie;ge<=new Date(W.getFullYear(),W.getMonth()+1,0);ge=yn(ge,7)){let ke=d("tr");for(let Oe=0;Oe<7;Oe++){let Xe=yn(ge,Oe),Se=d("button",{type:"button","data-day":Ja(Xe),"aria-label":h.format(Xe),tabindex:Po(Xe,W)?"0":"-1"},String(Xe.getDate()));Xe.getMonth()!==W.getMonth()&&Se.classList.add("fd-outside");let tt=Po(Xe,_)||Po(Xe,Q);tt&&Se.setAttribute("aria-selected","true"),_&&Q&&Xe>_&&Xe<Q&&!tt&&Se.classList.add("fd-in-range"),Po(Xe,new Date)&&Se.setAttribute("aria-current","date"),Se.addEventListener("click",()=>B(Xe)),Se.addEventListener("pointerenter",()=>{if(j){O=Xe;for(let Z of I.querySelectorAll("button[data-day]")){let re=E(Z.dataset.day);Z.classList.toggle("fd-in-range",!!re&&re>j&&re<Xe)}}}),Se.addEventListener("keydown",Z=>C(Z,Xe)),ke.append(d("td",{},Se))}ee.append(ke)}I.replaceChildren(d("thead",{},Pe),ee),Y&&I.querySelector('button[tabindex="0"]')?.focus()}function C(Y,G){let _=Ut(D),Q={ArrowLeft:()=>yn(G,_?1:-1),ArrowRight:()=>yn(G,_?-1:1),ArrowUp:()=>yn(G,-7),ArrowDown:()=>yn(G,7),PageUp:()=>No(G,-1),PageDown:()=>No(G,1),Home:()=>yn(G,-((G.getDay()+6)%7)),End:()=>yn(G,6-(G.getDay()+6)%7)};Q[Y.key]?(Y.preventDefault(),W=Q[Y.key](),j&&(O=W),H(!0)):(Y.key==="Enter"||Y.key===" ")&&(Y.preventDefault(),B(G))}function z(){j=null,O=null,W=E(e.getState().values[t])??new Date,F.hidden=!1,A.setAttribute("aria-expanded","true"),H(!0)}function M(){F.hidden||(F.hidden=!0,j=null,A.setAttribute("aria-expanded","false"),A.focus())}A.addEventListener("click",()=>F.hidden?z():M()),w.addEventListener("click",()=>(W=No(W,-1),H(!1))),L.addEventListener("click",()=>(W=No(W,1),H(!1))),F.addEventListener("keydown",Y=>{Y.key==="Escape"&&(Y.preventDefault(),Y.stopPropagation(),M())});let te=Y=>{F.hidden||D.contains(Y.target)||(F.hidden=!0,j=null,A.setAttribute("aria-expanded","false"))};return o.addEventListener("mousedown",te),{element:D,focus:()=>g.focus(),destroy:()=>o.removeEventListener("mousedown",te),update(Y){for(let[G,_]of[[g,Y.value],...$&&f?[[$,Y.values[f]]]:[]]){let Q=b(_);o.activeElement!==G&&G.value!==Q&&(G.value=Q),G.readOnly!==Y.readonly&&(G.readOnly=Y.readonly),G.classList.toggle("fd-blank",!Q)}A.hidden=Y.readonly,Y.readonly&&(F.hidden=!0),_e(D,"aria-labelledby",null),ct(g,Y)}}};var Xa=e=>String(e).padStart(2,"0");function Lp(e){let t=Math.max(0,Math.floor(e));return`${Xa(Math.floor(t/3600))}:${Xa(Math.floor(t%3600/60))}:${Xa(t%60)}`}var dc=e=>{if(typeof e!="string"||!e)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t},Za=({field:e,node:t,id:n,document:r})=>{let i=Me(r),o=e.type==="datetime",a=!o&&typeof t.options?.startField=="string"?t.options.startField:null,s=t.options?.unit==="minutes"?60:3600,d=i("span",{class:"fd-timer-time"}),l=i("span",{id:n,role:"timer",class:"fd-timer"},i("span",{class:"fd-timer-dot","aria-hidden":"true"}),d);_e(l,"aria-label",e.label);let c=0,f=null,y,u=()=>xt(d,Lp(c+(f===null?0:(Date.now()-f)/1e3))),k=()=>{clearInterval(y),y=void 0};return{element:l,focus:()=>{},destroy:k,update(h){c=!o&&typeof h.value=="number"?h.value*s:0,f=o?dc(h.value):a?dc(h.values[a]):null,f!==null?l.dataset.running="true":delete l.dataset.running,u(),f===null?k():y||(y=setInterval(()=>l.isConnected?u():k(),1e3))}}};var lc=e=>typeof e=="number"&&e>0?e:480,Ep=e=>/^https?:\/\//i.test(e);function Rp(e){if(e.data){let t=Uint8Array.from(atob(e.data),n=>n.charCodeAt(0));return URL.createObjectURL(new Blob([t],{type:e.type||"application/pdf"}))}return e.url??""}var cc=e=>{let t=Me(e.document),n=Be(e.labels,e.locale),r=li({...e,node:{...e.node,widget:void 0}}),i=t("iframe",{class:"fd-embed-frame"});i.style.height=`${lc(e.node.options?.height)}px`;let o=t("div",{class:"fd-embed-none"},n.noDocument),a=t("div",{class:"fd-embed-view"}),s,d="",l=()=>d.startsWith("blob:")&&URL.revokeObjectURL(d);return{element:t("div",{class:"fd-embed fd-embed-pdf"},r.element,a),focus:()=>r.focus(),destroy(){l(),r.destroy?.()},update(c){r.update(c);let f=Array.isArray(c.value)?c.value[0]:c.value;f!==s&&(s=f,l(),d=f?Rp(f):"",d&&(i.title=f?.name??e.field.label,i.src=d)),a.replaceChildren(...d?[i]:c.readonly?[o]:[])}}},fc=({form:e,name:t,field:n,node:r,id:i,document:o,labels:a,locale:s})=>{let d=Me(o),l=Be(a,s),c=d("input",{id:i,type:"url",class:"fd-input",autocomplete:"url"});r.placeholder&&(c.placeholder=r.placeholder),c.addEventListener("input",()=>e.setValue(t,c.value===""?null:c.value));let f=d("iframe",{class:"fd-embed-frame",title:n.label,sandbox:"allow-scripts allow-same-origin allow-popups allow-presentation",referrerpolicy:"no-referrer",loading:"lazy"});f.style.height=`${lc(r.options?.height)}px`;let y=d("a",{class:"fd-button fd-button-link fd-embed-open",target:"_blank",rel:"noopener noreferrer",hidden:""},l.openInNewTab),u=d("div",{class:"fd-embed-view"}),k="";return{element:d("div",{class:"fd-embed"},d("div",{class:"fd-embed-bar"},c,y),u),focus:()=>c.focus(),update(h){let v=typeof h.value=="string"?h.value.trim():"";o.activeElement!==c&&c.value!==(typeof h.value=="string"?h.value:"")&&(c.value=typeof h.value=="string"?h.value:""),c.readOnly!==h.readonly&&(c.readOnly=h.readonly),c.hidden=h.readonly;let b=Ep(v)?v:"";b!==k&&(k=b,b&&(f.src=b),u.replaceChildren(...b?[f]:[])),y.hidden=!b,b&&(y.href=b)}}};var An=e=>typeof e=="number"?e:Number(e)||0;function Fp(e,t){if(!e||typeof e!="object"||Array.isArray(e))return null;let n=e;if(Array.isArray(n.subtotals)||n.groups_by_subtotal){let i=n.groups_by_subtotal??{},o=n.subtotals??[{name:t,amount:An(n.amount_untaxed)}];return{subtotals:(n.subtotals_order??o.map(s=>s.name)).map(s=>({name:s,amount:An(o.find(d=>d.name===s)?.amount??n.amount_untaxed),groups:(i[s]??[]).map((d,l)=>({name:String(d.tax_group_name??""),amount:An(d.tax_group_amount),at:[s,l]}))})),total:An(n.amount_total)}}let r=(Array.isArray(n.groups)?n.groups:[]).map((i,o)=>({name:String(i.name??""),amount:An(i.amount),at:o}));return{subtotals:[{name:t,amount:An(n.untaxed),groups:r}],total:An(n.total)}}var uc=({form:e,name:t,node:n,id:r,document:i,labels:o,locale:a="en"})=>{let s=Me(i),d=Be(o,a),l=n.options??{},c=typeof l.currencyField=="string"?l.currencyField:null,f=typeof l.currency=="string"?l.currency:null,y=s("tbody"),u=s("table",{id:r,class:"fd-tax-totals"},y),k="";function h(v,b){let E=JSON.parse(JSON.stringify(e.getState().values[t])),m=v.amount;if(Array.isArray(v.at)){let[x,g]=v.at;E.groups_by_subtotal[x][g].tax_group_amount=b,E.amount_total=Math.round((An(E.amount_total)+b-m)*100)/100}else E.groups[v.at].amount=b,E.total=Math.round((An(E.total)+b-m)*100)/100;e.setValue(t,E)}return{element:u,focus:()=>u.querySelector("input")?.focus(),update(v){let b=Fp(v.value,d.untaxed),E=c?v.values[c]:null,m=f??(E&&typeof E=="object"&&"label"in E?E.label:typeof E=="string"?E:""),x=L=>/^[A-Z]{3}$/.test(m)?rr(L,m,2,a):St(L,2,a),g=l.editable===!0&&!v.readonly,$=JSON.stringify([b,m,g]);if($===k||u.contains(i.activeElement))return;k=$;let A=(L,S,I)=>s("tr",{class:I},s("th",{scope:"row"},L),s("td",{},S)),w=[];for(let L of b?.subtotals??[]){w.push(A(L.name,x(L.amount),"fd-tax-subtotal"));for(let S of L.groups){if(!g){w.push(A(S.name,x(S.amount),"fd-tax-group"));continue}let I=s("input",{type:"text",class:"fd-input fd-number-input",inputmode:"decimal",autocomplete:"off","aria-label":S.name});I.value=St(S.amount,2,a),I.addEventListener("change",()=>{let F=gn(I.value.trim(),a);/^-?(\d+\.?\d*|\.\d+)$/.test(F)&&h(S,Number(F))}),w.push(A(S.name,I,"fd-tax-group"))}}b&&w.push(A(d.total,x(b.total),"fd-tax-total")),y.replaceChildren(...w)}}};var Co=e=>typeof e=="string"?e:typeof e=="number"?String(e):"";function Ap(e){return(Array.isArray(e)?e:e&&typeof e=="object"&&Array.isArray(e.content)?e.content:[]).filter(n=>n&&typeof n=="object").map(n=>({date:Co(n.date),amount:typeof n.amount=="number"?n.amount:Number(n.amount)||0,name:Co(n.name),journal:Co(n.journal_name??n.journal),memo:Co(n.ref??n.memo),id:n.account_payment_id??n.payment_id??n.id??null}))}var pc=({node:e,id:t,document:n,labels:r,locale:i="en",dialogs:o})=>{let a=Me(n),s=Be(r,i),d=e.options??{},l=typeof d.currencyField=="string"?d.currencyField:null,c=typeof d.dueField=="string"?d.dueField:null,f=typeof d.model=="string"?d.model:"account.payment",y=a("ul",{class:"fd-payments-list"}),u=a("div",{class:"fd-payment-due",hidden:""}),k=a("div",{id:t,class:"fd-payments"},y,u),h={type:"date",label:""},v="",b=null;return{element:k,focus:()=>y.querySelector("button")?.focus(),destroy:()=>b?.(),update(E){let m=l?E.values[l]:null,x=m&&typeof m=="object"&&"label"in m?m.label:typeof m=="string"?m:"",g=L=>/^[A-Z]{3}$/.test(x)?rr(L,x,2,i):St(L,2,i),$=Ap(E.value),A=c?E.values[c]:null,w=JSON.stringify([$,x,A]);w!==v&&(v=w,b?.(),y.replaceChildren(...$.map((L,S)=>{let I=g(L.amount),F=a("button",{type:"button",class:"fd-payment-info","aria-label":Ue(s.paymentOf,{amount:I}),"aria-haspopup":"dialog","aria-expanded":"false","aria-controls":`${t}-payment-${S}`},"i"),D=(z,M)=>M?[a("dt",{},z),a("dd",{},M)]:[],W=L.id!==null&&o?.canOpen(f)?a("button",{type:"button",class:"fd-button fd-button-link fd-payment-open"},s.openPayment):null,j=a("div",{id:`${t}-payment-${S}`,class:"fd-payment-details",role:"dialog","aria-label":Ue(s.paymentOf,{amount:I}),tabindex:"-1",hidden:""},a("strong",{},L.name||I),a("span",{class:"fd-payment-details-amount"},I),a("dl",{},...D(s.journal,L.journal),...D(s.memo,L.memo)),...W?[W]:[]),O=a("li",{class:"fd-payment"},F,a("span",{class:"fd-payment-date"},Ue(s.paidOn,{date:It(h,L.date,{},i)})),a("span",{class:"fd-payment-amount"},I),j),B=!1,H=zn(O,F,j,()=>{B&&F.focus(),B=!1,b===C&&(b=null)}),C=()=>H.close();return F.addEventListener("click",()=>{if(H.isOpen())return C();b?.(),H.open(),b=C,(W??j).focus()}),j.addEventListener("keydown",z=>{z.key==="Escape"&&(z.preventDefault(),z.stopPropagation(),B=!0,C())}),W?.addEventListener("click",()=>{C(),o?.openRecord(f,{recordId:L.id,title:L.name||I})}),O})),u.hidden=A==null,u.replaceChildren(a("span",{},s.amountDue),a("strong",{},typeof A=="number"?g(A):"")))}}};function Xt(e,t=e.widgets??{}){let n=e.widgets===t?e:{...e,widgets:t},{field:r}=n,i=hc(r,n.node,t);return i?r.type==="selection"&&r.optionsFrom?rc(i,n):i(n):Cp(n)}function ts(e,t,n={}){return hc(e,t,n)?.partOf?.(t)}function hc(e,t,n){let r=[t.widget?`${e.type}.${t.widget}`:null,e.type==="selection"&&e.multiple?"selection.checkboxes":null,e.type==="many2many"&&t.columns?.length?"many2many.table":null,e.type].filter(i=>i!==null);for(let i of r){let o=n[i]??bc[i];if(o)return o}}function ht(e,t,n={},...r){let i=e.createElement(t);for(let[o,a]of Object.entries(n))a!==void 0&&i.setAttribute(o,a);return i.append(...r),i}function $n(e,t){_e(e,"aria-invalid",String(t.invalid)),_e(e,"aria-required",e.getAttribute("role")==="group"?null:String(t.required)),_e(e,"aria-describedby",t.describedBy||null)}var Do=e=>e==null?"":String(e);function Vr(e){return t=>{let{form:n,name:r,field:i,node:o,id:a,document:s}=t,d=ht(s,"input",{id:a,type:e,class:"fd-input",autocomplete:/^(email|tel|url)$/.test(e)?e:"off"});return i.type==="char"&&i.size!==void 0&&(d.maxLength=i.size),e==="time"&&$o(d,i,o),o.placeholder&&(d.placeholder=o.placeholder),d.addEventListener("input",()=>n.setValue(r,d.value===""?null:d.value)),_a({element:d,focus:()=>d.focus(),update(l){let c=Do(l.value);d.value!==c&&(d.value=c),d.readOnly!==l.readonly&&(d.readOnly=l.readonly),$n(d,l)}},t,d)}}var $p=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=ht(a,"textarea",{id:o,class:"fd-input fd-textarea",rows:"3"});r.type==="text"&&r.size!==void 0&&(s.maxLength=r.size),i.placeholder&&(s.placeholder=i.placeholder);let d=nc(s,i);return s.addEventListener("input",()=>{d(),t.setValue(n,s.value===""?null:s.value)}),_a({element:s,focus:()=>s.focus(),update(l){let c=Do(l.value);s.value!==c&&(s.value=c,d()),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),$n(s,l)}},e,s)},Tp=/^-?(\d+\.?\d*|\.\d+)$/,Mp=/^-?\.?$/,Qa=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a,locale:s="en"}=e,d=r.type==="integer",l=d?0:(r.type==="float"||r.type==="monetary"?r.digits?.[1]:void 0)??2,c=I=>typeof I=="number"?St(I,l,s):Do(I),f=ht(a,"input",{id:o,type:"text",class:"fd-input fd-number-input",autocomplete:"off"});f.inputMode=d?"numeric":"decimal",i.placeholder&&(f.placeholder=i.placeholder);let y=I=>{let F=gn(I.trim(),s);if(F==="")return null;if(Tp.test(F))return Number(F);if(!Mp.test(F))return F};f.addEventListener("input",()=>{let I=y(f.value);I!==void 0&&t.setValue(n,I)}),f.addEventListener("focus",()=>{queueMicrotask(()=>{let I=t.getState().values[n];if(a.activeElement!==f||f.readOnly||typeof I!="number"||f.value!==c(I))return;let F=f.value,[D,W]=[f.selectionStart??F.length,f.selectionEnd??F.length],j=O=>oi(F.slice(0,O),s).length;f.value=oi(F,s),f.setSelectionRange(j(D),j(W))})}),f.addEventListener("blur",()=>{f.value=c(t.getState().values[n])});let u=i.options??{},k=r.type==="monetary"?r.currencyField:void 0,h=k?t.page.fields[k]:void 0,v=k&&h&&u.pickCurrency===!0?Xt({...e,name:k,field:h,node:{type:"field",id:`${i.id}.currency`,field:k},id:`${o}-currency`}):null;v&&h&&v.element.querySelector("input, select")?.setAttribute("aria-label",h.label),v?.element.matches("input, select")&&h&&v.element.setAttribute("aria-label",h.label);let b=r.type==="monetary"?r.money:void 0,E=u.symbol?u.symbol==="after":b?.at?b.at==="after":r.type==="monetary"&&di(r.currency??"USD",s).after,m=(I,F)=>ht(a,"span",{class:`fd-unit${r.type==="monetary"?" fd-currency":""}`,id:`${o}-unit${F}`},I),x=r.type==="monetary"&&!v?m("",0):null,[g,$]=["prefix","suffix"].map((I,F)=>typeof u[I]=="string"&&u[I]?m(u[I],F+1):null),A=(E?null:v?.element??x)??g,w=(E?v?.element??x:null)??$,L=[A,w].filter(I=>!!I&&I!==v?.element);return{element:A||w?ht(a,"span",{class:`fd-number${E?" fd-currency-after":""}${v?" fd-currency-picked":""}`},...[A,f,w].filter(I=>!!I)):f,focus:()=>f.focus(),update(I){let F=a.activeElement===f,D=y(f.value),W=D===void 0||D===I.value;if(!(F&&W)){let j=F&&!I.readonly&&typeof I.value=="number"?va(I.value,l,s):c(I.value);f.value!==j&&(f.value=j)}if(f.readOnly!==I.readonly&&(f.readOnly=I.readonly),$n(f,{...I,describedBy:[I.describedBy,...L.map(j=>j.id)].filter(Boolean).join(" ")}),v&&k&&v.update({value:I.values[k],values:I.values,readonly:I.readonly,required:!1,invalid:!1}),x&&r.type==="monetary"){let j=$r(r,I.values,I.parent)??"";xt(x,/^[A-Z]{3}$/.test(j)&&b?.currency!=="code"?di(j,s).text:j)}for(let[j,O]of[[A,"start"],[w,"end"]])j&&L.includes(j)&&f.style.setProperty(`padding-inline-${O}`,`calc(var(--fd-pad-x) + ${j.textContent?.length??0}ch + 4px)`)}}};function es(e="box"){let t=e==="switch"?{class:"fd-switch",role:"switch"}:{class:e==="tick"?"fd-checkbox fd-tick":"fd-checkbox"};return({form:n,name:r,id:i,document:o})=>{let a=ht(o,"input",{id:i,type:"checkbox",...t});return a.addEventListener("change",()=>n.setValue(r,a.checked)),{element:a,focus:()=>a.focus(),update(s){a.checked=s.value===!0,a.disabled!==s.readonly&&(a.disabled=s.readonly),$n(a,s)}}}}function Vo(e){return e.type==="selection"?e.options:[]}var Np=e=>{let{form:t,name:n,field:r,node:i,id:o,document:a}=e,s=i.options?.search;if(s===!0||s!==!1&&Vo(r).length>15)return Gl(e);let d=un(Vo(r),t,n,i),l=ht(a,"option",{value:""}),c=ht(a,"select",{id:o,class:"fd-input fd-select"},l);return d.forEach((f,y)=>c.append(ht(a,"option",{value:String(y)},f.label))),c.addEventListener("change",()=>t.setValue(n,c.value===""?null:d[Number(c.value)].value)),{element:c,focus:()=>c.focus(),update(f){let y=d.findIndex(u=>u.value===f.value);c.value=y===-1?"":String(y),l.hidden=f.required&&y!==-1,c.disabled!==f.readonly&&(c.disabled=f.readonly),$n(c,f)}}};function mc(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=un(Vo(r),t,n,i),c=Be(s,d),f=ht(a,"div",{id:o,class:`fd-choices fd-choices-${e}`,role:e==="radio"?"radiogroup":"group"});Ao(f,i);let y=e==="checkbox"?Fo(Me(a),c,i):null,u=l.map((g,$)=>{let A=ht(a,"input",{type:e,name:o,value:String($),id:`${o}-${$}`});return f.append(ht(a,"label",{class:"fd-choice",for:`${o}-${$}`},A,ht(a,"span",{},g.label))),A}),k=r.type==="selection"&&r.other===!0,h=k?ht(a,"input",{type:e,name:o,value:"other",id:`${o}-other`}):null,v=k?ht(a,"input",{type:"text",class:"fd-input fd-other-input","aria-label":c.otherAnswer,autocomplete:"off"}):null;h&&v&&(f.append(ht(a,"div",{class:"fd-choice fd-choice-other"},ht(a,"label",{class:"fd-choice-other-pick",for:`${o}-other`},h,ht(a,"span",{},c.other)),v)),v.addEventListener("input",()=>{h.checked||(h.checked=!0),b(h)}),h.addEventListener("change",()=>{h.checked&&v.focus()})),y?.element&&f.append(y.element);function b(g){if(e==="checkbox"&&g instanceof HTMLInputElement&&g.checked){let A=l[u.indexOf(g)]?.exclusive===!0;u.forEach((w,L)=>w!==g&&(A||l[L].exclusive)&&(w.checked=!1)),A&&h&&(h.checked=!1)}let $=h?.checked&&v&&v.value.trim()?v.value:null;if(e==="radio"){let A=u.findIndex(w=>w.checked);t.setValue(n,A!==-1?l[A].value:$)}else{let A=new Set(l.filter((w,L)=>u[L].checked));t.setValue(n,[...Vo(r).filter(w=>A.has(w)).map(w=>w.value),...$!==null?[$]:[]])}}f.addEventListener("change",g=>{g.target!==v&&b(g.target)});let E=new Set(l.map(g=>g.value)),m=()=>u.some(g=>g.checked)||h?.checked===!0,x=e==="radio"?En(a,c,()=>{for(let g of[...u,h])g&&(g.checked=!1);t.setValue(n,null),(u[0]??h)?.focus()},i):null;return{element:x?ht(a,"div",{class:"fd-choices-box"},f,x.button):f,focus:()=>(u.find(g=>g.checked)??(h?.checked?v:null)??u[0])?.focus(),update(g){let $=Array.isArray(g.value)?g.value:[g.value],A=!!y?.full(Array.isArray(g.value)?g.value.length:0);if(u.forEach((w,L)=>{w.checked=$.includes(l[L].value);let S=g.readonly||A&&!w.checked&&!l[L].exclusive;w.disabled!==S&&(w.disabled=S)}),h&&v){let w=$.find(I=>typeof I=="string"&&!E.has(I)),L=h.checked&&!v.value.trim()&&(e==="checkbox"||$.every(I=>I==null));h.checked=w!==void 0||L,w!==void 0&&a.activeElement!==v&&(v.value=w);let S=g.readonly||A&&!h.checked;h.disabled!==S&&(h.disabled=v.disabled=S)}x?.allow(g),x?.show(m()),$n(f,g)}}}}function gc(e){return({form:t,name:n,field:r,node:i,id:o,document:a,labels:s,locale:d})=>{let l=Be(s,d),c="min"in r&&typeof r.min=="number"?r.min:e==="rating"?1:0,f="max"in r&&typeof r.max=="number"?r.max:e==="rating"?5:10,y=e==="rating"?i.options?.icon:"number",u=y!=="number",k=e==="scale"&&i.options?.nps===!0&&c===0&&f===10,h=ht(a,"div",{id:o,class:`fd-points fd-${u?"rating":"scale"}${u?` fd-rating-${y??"star"}`:""}${k?" fd-nps":""}`,role:"radiogroup"}),v=[],b=e==="rating"&&c===f,E=e==="rating"&&(b||i.options?.clear===!1),m=!1;for(let A=c;A<=f;A++){let w=ht(a,"button",{type:"button",role:"radio","aria-label":Ue(l.ofMax,{n:A,max:f}),"data-value":String(A)},y==="thumb"?rt(a,"thumb"):y==="heart"?"\u2665":u?"\u2605":String(A));e==="scale"&&w.removeAttribute("aria-label"),k&&(w.dataset.tone=A<7?"low":A<9?"mid":"high"),w.addEventListener("click",()=>t.setValue(n,E&&!m&&t.getState().values[n]===A?null:A)),v.push(w),h.append(w)}h.addEventListener("keydown",A=>{let w=t.getState().values[n],L=typeof w=="number"?w:c-1,S=A.key==="ArrowRight"||A.key==="ArrowUp"?1:A.key==="ArrowLeft"||A.key==="ArrowDown"?-1:0;if(!S)return;A.preventDefault();let I=Math.min(f,Math.max(c,L+S));t.setValue(n,I),v[I-c]?.focus()});let x=[i.options?.startLabel,i.options?.endLabel].map(A=>typeof A=="string"?A:""),g=En(a,l,()=>{t.setValue(n,null),v[0]?.focus()},i,!b),$=x.some(Boolean)?ht(a,"div",{class:"fd-scale-box"},h,ht(a,"div",{class:"fd-scale-ends","aria-hidden":"true"},ht(a,"span",{},x[0]),ht(a,"span",{},x[1]))):h;return x.some(Boolean)&&h.setAttribute("aria-description",x.filter(Boolean).join(" \u2026 ")),{element:ht(a,"div",{class:"fd-choices-box"},$,g.button),focus:()=>(v.find(A=>A.getAttribute("aria-checked")==="true")??v[0])?.focus(),update(A){let w=typeof A.value=="number"?A.value:null;m=A.required,v.forEach((L,S)=>{let I=c+S;_e(L,"aria-checked",String(I===w)),L.classList.toggle("fd-on",u?w!==null&&I<=w:I===w);let F=I===w||w===null&&S===0?0:-1;L.tabIndex!==F&&(L.tabIndex=F),L.disabled!==A.readonly&&(L.disabled=A.readonly)}),g.allow(A),g.show(w!==null),$n(h,A)}}}}var Pp=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=ht(o,"input",{id:i,type:"date",class:"fd-input fd-date"});$o(s,r,a),s.addEventListener("input",()=>t.setValue(n,s.value||null));let d={element:s,focus:()=>s.focus(),update(l){let c=Do(l.value);s.value!==c&&(s.value=c),s.readOnly!==l.readonly&&(s.readOnly=l.readonly),s.classList.toggle("fd-blank",!c),$n(s,l)}};return a.options?.weekNumbers===!0?po(d,e,"date"):(ar(s),d)},Io=e=>String(e).padStart(2,"0"),Op=e=>{let{form:t,name:n,field:r,id:i,document:o,node:a}=e,s=ht(o,"input",{id:i,type:"datetime-local",class:"fd-input fd-datetime"});$o(s,r,a);let d=c=>{if(typeof c!="string"||!c)return"";let f=new Date(c);return Number.isNaN(f.getTime())?"":`${f.getFullYear()}-${Io(f.getMonth()+1)}-${Io(f.getDate())}T${Io(f.getHours())}:${Io(f.getMinutes())}`};s.addEventListener("input",()=>{if(!s.value)return t.setValue(n,null);let c=new Date(s.value);Number.isNaN(c.getTime())||t.setValue(n,c.toISOString())});let l={element:s,focus:()=>s.focus(),update(c){let f=d(c.value);s.value!==f&&(s.value=f),s.readOnly!==c.readonly&&(s.readOnly=c.readonly),s.classList.toggle("fd-blank",!f),$n(s,c)}};return a.options?.weekNumbers===!0?po(l,e,"datetime"):(ar(s),l)};function Cp({field:e,id:t,document:n}){let r=ht(n,"span",{id:t,class:"fd-pending","data-fd-pending":e.type});return{element:r,focus:()=>{},update(i){r.textContent=lo(i.value,e)}}}function lo(e,t){if(e==null)return"";switch(t.type){case"many2one":case"reference":return e.label;case"many2many":return e.map(n=>n.label).join(", ");case"one2many":{let n=e.length;return`${n} ${n===1?"line":"lines"}`}case"binary":case"image":return[e].flat().map(n=>n.name).join(", ");case"html":return String(e).replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();default:return typeof e=="object"?JSON.stringify(e):String(e)}}var bc={char:Vr("text"),"char.email":Vr("email"),"char.phone":Vr("tel"),"char.url":Vr("url"),"char.password":Vr("password"),"char.time":Vr("time"),"char.tags":ka,text:$p,integer:Qa,float:Qa,monetary:Qa,"integer.rating":gc("rating"),"integer.scale":gc("scale"),"integer.slider":za,"float.slider":za,"integer.progressbar":ci,"integer.label":fi,"float.label":fi,"monetary.label":fi,"float.progressbar":ci,"float.duration":Zd,"float.percentage":Qd,"monetary.progressbar":ci,boolean:es(),"boolean.toggle":es("switch"),"boolean.tick":es("tick"),"boolean.buttons":ic,"boolean.priority":Ua,"selection.priority":Ua,"selection.dot":sc,"integer.color":Ka,"char.color":Ka,"char.copy":Ga,"text.copy":Ga,"date.daterange":Ya,"datetime.daterange":Ya,"float.timer":Za,"datetime.timer":Za,"binary.pdf":cc,"char.embed":fc,"json.distribution":nl,"json.tax-totals":uc,"json.payments":pc,selection:_n(Cr,e=>e.ownListWidget,e=>Np(e),e=>e.options?.list==="own"),"selection.radio":mc("radio"),"selection.checkboxes":mc("checkbox"),"selection.tags":Kl,"selection.image-choice":Yl,"selection.ranking":Xl,"selection.statusbar":co,date:Pp,datetime:Op,many2one:Ar,"many2one.statusbar":co,"many2one.path":_n(Or,e=>e.pathPickerWidget,e=>Ar(e)),many2many:si,"many2many.tags":si,"many2many.checkboxes":Sa,"many2many.table":oc,"many2many.links":_n(qn,e=>e.linksWidget,e=>si(e)),reference:La,one2many:Aa,"one2many.cards":tc,binary:li,"binary.signature":Ul,image:Ta,html:Ha,json:ja,"json.address":Ql,properties:Oa,matrix:_l,"char.badge":To,"selection.badge":To,"many2one.badge":To};function ns(e){let t=()=>{try{return e??globalThis.localStorage??null}catch{return null}};return{get(n){try{let r=t()?.getItem(`fieldia:${n}`);return r==null?null:JSON.parse(r)}catch{return null}},set(n,r){try{t()?.setItem(`fieldia:${n}`,JSON.stringify(r))}catch{}}}}function Ip(){let e=new Map;return{get:t=>e.has(t)?yc(e.get(t)):null,set:(t,n)=>{e.set(t,yc(n))}}}var yc=e=>JSON.parse(JSON.stringify(e));function rs(e,t){let n=t.widget;switch(e.type){case"char":return!n||n==="email"||n==="phone"||n==="url";case"selection":return!n&&!e.multiple&&!e.optionsFrom;case"text":case"integer":case"float":return!n||n==="duration"||n==="percentage";case"monetary":case"date":case"datetime":case"many2one":case"reference":return!n;default:return!1}}var Vp={email:[/^[^\s@]+@[^\s@]+$/,"mailto:"],phone:[/^\+?[\d\s().-]{3,}$/,"tel:"],url:[/^https?:\/\/\S+$/i,""]};function Dp(e,t,n,r){if(t.type!=="integer"&&t.type!=="float"||n.widget||r===null||r===void 0||e==="")return e;let i=o=>typeof n.options?.[o]=="string"?n.options[o].trim():"";return[i("prefix"),e,i("suffix")].filter(Boolean).join(" ")}function is(e){let{document:t,field:n,node:r,locale:i="en",labels:o=ot.en,dialogs:a}=e,s=t.createElement("div");s.className="fd-read-text",s.id=`${e.id}-text`;let d=n.type==="many2one"?n.relation:null,l=d!==null&&r.options?.open!==!1&&!!a?.canOpen(d),c="";return{element:s,update(f,y){let u=Dp(or(n,f,y,i,void 0,{widget:r.widget,options:r.options}),n,r,f),k=JSON.stringify([u,f??null]);if(k===c)return;c=k;let h=r.widget?Vp[r.widget]:void 0,v=d!==null&&f&&typeof f=="object"&&"id"in f?f:null,b;if(h&&typeof f=="string"&&h[0].test(f.trim())){let x=t.createElement("a");x.href=`${h[1]}${f.trim()}`,r.widget==="url"&&Object.assign(x,{target:"_blank",rel:"noopener noreferrer"}),x.textContent=u,b=x}else if(l&&v){let x=t.createElement("button");x.type="button",x.className="fd-read-link",x.textContent=u,x.setAttribute("aria-label",o.openNamed.replace("{name}",v.label)),x.addEventListener("click",()=>{a?.openRecord(d,{recordId:v.id,title:v.label})}),b=x}else b=t.createTextNode(u);let E=v&&r.options?.avatar===!0?[Fr(t,v)]:[],m=[];if(v?.details?.trim()&&r.options?.details===!0){let x=t.createElement("div");x.className="fd-link-details",eo(x,v.details.trim()),m.push(x)}s.replaceChildren(...E,b,...m)}}}var xc={};var Wp={save:"Save",edit:"Edit",done:"Done",discard:"Discard",saving:"Saving\u2026",saved:"Saved",submit:"Submit",next:"Next",back:"Back",skip:"Skip",steps:"Steps",stepOf:"Step {n} of {total}",submitted:"Thank you. Your answers were sent.",submitAnother:"Submit another response",draftFound:"You have unsaved answers from {time}.",restore:"Restore",discardDraft:"Discard",ok:"OK",cancel:"Cancel",loading:"Loading\u2026",saveClose:"Save & Close",close:"Close",maximise:"Maximise",restoreSize:"Restore",resize:"Resize",copyTitle:"Copy title",titleCopied:"Title copied",moreActions:"More actions",optionsFor:"{label} options",updatedBy:"Updated by {name}: {date}",nothingChanged:"Nothing has changed.",countOf:"{label}, {count}",discardChanges:"Discard your changes?",dismiss:"Dismiss",helpFor:"Help for {label}",quietHint:"Add {label}",quietAnswer:"Your answer",locked:"Locked: {label}",retry:"Retry",notSaved:"Not saved",notSent:"Not sent",checkFields:"{what}. Check: {fields}",offline:"Could not reach the server. Your changes are still here.",previousPage:"Previous page",nextPage:"Next page",range:"{from}\u2013{to} / {total}",selected:"{n} selected",clearSelection:"Clear",selectAll:"Select all",showAs:"Show as",viewList:"List",viewMap:"Map",viewBoth:"List and map",selectRecord:"Select {name}",noRecords:"No records match.",loadFailed:"Could not load the records.",search:"Search\u2026",searchLabel:"Search",searchFor:"Search {field} for: {text}",searchOptions:"Search options",filters:"Filters",groupBy:"Group By",favourites:"Favourites",or:"or",removeFacet:"Remove {label}",addCustomFilter:"Add a custom filter",field:"Field",condition:"Condition",value:"Value",apply:"Apply",saveSearch:"Save current search",searchName:"Name of the search",useByDefault:"Use by default",deleteFavourite:"Delete {name}",noFavourites:"No saved searches yet.",opIs:"is",opIsNot:"is not",opContains:"contains",opGreater:"greater than",opLess:"less than",opSet:"is set",opNotSet:"is not set",yes:"Yes",no:"No",none:"None",loadMore:"Show {n} more",filterByKeyword:"Filter by keyword",clearFilters:"Clear filters",expandAll:"Expand all",collapseAll:"Collapse all",filterNamed:"Filter by {label}",filterSettings:"Filter settings",formMissing:"The saved form \u201C{page}\u201D cannot be found.",formInItself:"The saved form \u201C{page}\u201D is not shown here: it would be placed inside itself ({chain}).",formNotPlaceable:"The saved form \u201C{page}\u201D cannot be placed here: only a form of sections or tabs can.",formBroken:"The saved form \u201C{page}\u201D cannot be shown.",pageMissing:"The page \u201C{page}\u201D cannot be found.",actions:"Actions",print:"Print",archive:"Archive",unarchive:"Unarchive",duplicate:"Duplicate",delete:"Delete",breadcrumbs:"Breadcrumbs",newRecord:"New",records:"Records",recordAt:"{n} / {total}",previousRecord:"Previous record",nextRecord:"Next record",attachment:"Attachment: {name}",openAttachment:"Open",previousAttachment:"Previous attachment",nextAttachment:"Next attachment"},Zt={en:Wp,...xc},wc=Zt.en,Hp=new Map([["ar","Arabic"],["de","German"],["fr","French"]]),vc=new Set;function vi(e="en"){let t=e.split("-")[0];if(Object.prototype.hasOwnProperty.call(Zt,t))return t;let n=Hp.get(t);return n&&!vc.has(t)&&(vc.add(t),console.warn(`Fieldia: this page is in ${n}, but only English words are loaded, so Fieldia's own words show in English. Load the ${n} ones after fieldia.js: <script src="https://cdn.jsdelivr.net/npm/@fieldia/viewer/bundle/fieldia.${t}.js"><\/script>`)),"en"}var os="#111418",Ec="#1f2329",jp="#f2f3f5";var as=e=>[1,3,5].map(t=>parseInt(e.slice(t,t+2),16)),zp=e=>`#${e.map(t=>Math.round(t).toString(16).padStart(2,"0")).join("")}`;function kc(e){let[t,n,r]=as(e).map(i=>{let o=i/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function lr(e,t){let[n,r]=[kc(e),kc(t)].sort((i,o)=>o-i);return(n+.05)/(r+.05)}var Bp=e=>lr(e,"#ffffff")>=4.5?"#ffffff":os,qp=e=>lr(e,os)>=lr(e,"#ffffff")?os:"#ffffff",Rc=(e,t,n)=>zp(as(e).map((r,i)=>r+(as(t)[i]-r)*n)),_p=(e,t)=>Rc(t,e,.12),Sc=(e,t)=>[...t,_p(e,t[0])].every(n=>lr(e,n)>=4.5);function Wo(e,t,n){let r=e;for(let i=1;i<=40&&!n(r);i++)r=Rc(e,t,i/40);return r}function wi(e,t={light:[],dark:[]}){let n=e.toLowerCase(),r=Wo(n,"#000000",o=>Sc(o,["#ffffff",jp,...t.light])),i=Wo(n,"#ffffff",o=>Sc(o,[Ec,...t.dark]));return{accent:r,accentText:Bp(r),dark:i,darkText:qp(i)}}var Up=["#212529","#636976","#c63c3d"],Kp=["#e8eaed","#a3a9b2","#ff8a7a"],Gp={accent:"#1365d9",dark:"#5aa2ff"},Lc={background:"bg",border:"border",corners:"radius",textSize:"size",accent:"accent"},Jp={small:"13px",large:"16px"},Yp={square:[0,0],soft:[6,10],round:[12,16]};function Xp(e,t){let n=(d,l)=>t.scheme==="dark"?l:t.scheme==="auto"?`light-dark(${d}, ${l})`:d,r=t.accent?wi(t.accent):Gp,i=Object.entries(t.parts??{}),o=(d,l,c)=>e.style.setProperty(`--fd-${d}-${l}`,c),a={light:[],dark:[]},s=d=>l=>d.every(c=>lr(c,l)>=4.5);for(let[d,l]of i){let c=l.background?.toLowerCase();if(!c)continue;let f=Wo(c,"#ffffff",s([...Up,r.accent])),y=Wo(c,Ec,s([...Kp,r.dark]));a.light.push(f),a.dark.push(y),o(d,"bg",n(f,y))}for(let[d,l]of i){let c=Object.keys(Lc).filter(f=>l[f]).map(f=>Lc[f]);if(c.length&&e.setAttribute(`data-${d}`,c.join(" ")),l.border&&o(d,"border",l.border),l.corners&&o(d,"radius",`${Yp[l.corners][d==="groups"?1:0]}px`),l.textSize&&o(d,"size",Jp[l.textSize]),l.accent){let f=wi(l.accent,a);o(d,"accent",n(f.accent,f.dark)),o(d,"accent-text",n(f.accentText,f.darkText))}}}var ss={material:"outlined",fluent:"outlined",apple:"outlined",bootstrap:"outlined",shadcn:"outlined",ant:"outlined",odoo:"underline","google-forms":"outlined"};function Un(e,t){return e??(t?ss[t]:"underline")}var ds=["text","muted","page","surface","fill","border","border-strong","edge","accent","accent-text","accent-soft","accent-hover","focus","focus-ring","error","error-soft","success","success-soft","warning","warning-soft","info","info-soft","link","band","help","radius","control-radius","font","label-weight"];function Kn(e,t){for(let n of ds){let r=t?.[n];r?e.style.setProperty(`--fd-${n}`,r):e.style.removeProperty(`--fd-${n}`)}}function cr(e,t){if(t){t.theme&&e.setAttribute("data-fd-theme",t.theme);for(let n of["font","density","corners","scheme"]){let r=t[n];r&&e.setAttribute(`data-${n}`,r)}if(t.labelWidth&&e.style.setProperty("--fd-label-width",`${t.labelWidth}px`),t.accent){let n=wi(t.accent);e.setAttribute("data-accent",""),e.style.setProperty("--fd-look-accent",n.accent),e.style.setProperty("--fd-look-accent-text",n.accentText),e.style.setProperty("--fd-look-accent-dark",n.dark),e.style.setProperty("--fd-look-accent-dark-text",n.darkText)}Xp(e,t)}}var Fc=new WeakMap;function Ac(e,t){t.tools?.length&&Fc.set(e,t.tools)}var Ho=e=>!!e.title&&e.style!=="inline"&&(e.foldAt==="end"||e.maximise===!0);function $c(e,t){if(!e.title||e.children.length!==1||e.children[0].type!=="field")return[];let n=t.firstElementChild;return!n||n.getAttribute("data-labels")!=="hidden"?[]:Fc.get(n)??[]}function Tc(e,t){t.tracks?.length&&(e.setAttribute("data-tracks",""),e.style.setProperty("--fd-track-list",t.tracks.map(n=>n.endsWith("fr")?`minmax(0, ${n})`:n).join(" "))),t.gap!==void 0&&(e.style.columnGap=`${t.gap}px`)}function Mc(e,t){return t.flatMap(n=>typeof n=="string"?Nr(e,n):[n])}function Nc(e,t,n){let r=t.icon?rt(e.doc,t.icon,e.icons):null;return r?.classList.add("fd-help-box-icon"),e.el("div",{class:"fd-help-box fd-text-help","data-node":t.id},...r?[r]:[],e.el("p",{},...n))}var Qt=Fn("head",()=>dr("head")),Dr=Fn("filters",()=>dr("filters")),Zp=[Qt,Dr,qn,Or,Cr],Qp=e=>{let t=e.children.length===1?e.children[0]:void 0;return!!e.title&&t?.type==="field"&&t.options?.editor==="markdown"};function fr(e,t={},n={}){let r=new Set,i=o=>{if(Array.isArray(o)){for(let s of o)i(s);return}if(!o||typeof o!="object")return;let a=o;if(a.type==="sheet"&&a.head)r.add(Qt);else if(a.type==="button"&&go(a))r.add(Qt);else if(a.type==="section"&&Array.isArray(a.children)&&(Ho(a)||Qp(a)))r.add(Qt);else if(a.type==="list"&&a.search==="fields")r.add(Dr);else if(a.type==="slot"&&typeof a.name=="string")for(let s of n[a.name]?.parts??[])r.add(s);else if(a.type==="field"&&typeof a.field=="string"){let s=e.fields[a.field],d=s?ts(s,a,t):void 0;d&&r.add(d)}for(let s of Object.keys(a)){let d=a[s];d&&typeof d=="object"&&i(d)}};return i(e.layout),[...r]}async function Pc(e,t,n){await Promise.all((e?fr(e,t,n):Zp).map(r=>r.load()))}var Cc=0,ki='input:not([type="hidden"]):not([hidden]), select:not([hidden]), textarea:not([hidden]), [contenteditable="true"]';function jo(e){return[...e.querySelectorAll(".fd-field[data-focus]")].find(n=>!n.closest("[hidden]"))?.querySelector(ki)??null}var Ic=e=>(t,n={},r)=>{let i=e.createElement(t);for(let[o,a]of Object.entries(n))i.setAttribute(o,a);return r!==void 0&&(i.textContent=r),i};function Wr(e){return Vc(e,`fd-size-${e.size??"medium"}`)}function ls(e){let t=e.side??"end";return Vc(e,`fd-form-panel ${t==="top"||t==="bottom"?`fd-height-${e.height??"medium"}`:`fd-width-${e.width??"medium"}`}`,t)}function Vc(e,t,n){let r=e.container?.ownerDocument??document,i=r.activeElement instanceof r.defaultView.HTMLElement?r.activeElement:null,o=!n&&(e.size==="inset"||e.backdrop==="clear"||!!e.maximise||!!e.resizable),a=[...fr(e.page,e.widgets,e.slots),...o?[Qt]:[]].filter(s=>!s.loaded);return a.length?Pr(a).then(()=>Oc(e,t,n,i)):Oc(e,t,n,i)}function Oc(e,t,n,r){let i=!!n,o=e.page.layout,a=Qt.loaded,s=!i&&o.type==="sheet"&&!!o.head&&!!a,d=e.container?.ownerDocument??document,l=e.container??d.body;a&&!i&&(s||e.size==="inset"||e.backdrop==="clear"||e.maximise||e.resizable)&&a.installHeadStyles(d);let c={...Zt[vi(e.locale)],...e.labels},f=`fd-dialog-${++Cc}`,y=Ic(d),u=y("h2",{id:`${f}-title`,class:"fd-form-dialog-title"},e.title),k=y("button",{type:"button",class:"fd-dialog-close","aria-label":c.close,title:c.close}),h=s?rt(d,"close"):null;h?k.append(h):k.textContent="\xD7";let v=e.maximise&&!i&&a?y("button",{type:"button",class:"fd-dialog-max","aria-label":c.maximise,title:c.maximise}):null,b=e.resizable&&!i&&a?y("button",{type:"button",class:"fd-dialog-grip","aria-label":c.resize,title:c.resize,"aria-keyshortcuts":"ArrowLeft ArrowRight ArrowUp ArrowDown"}):null,E=y("div",{class:"fd-form-dialog-body"}),m=y("button",{type:"button",class:"fd-button"},c.discard),x=y("button",{type:"button",class:"fd-button fd-button-primary"},i&&e.mode==="values"?c.done:c.saveClose),g=e.page.look??e.look,$=e.theme??g?.theme,A=y("div",{class:`fd-theme fd-form-dialog ${t}`,"data-fd-skin":Un(e.skin??g?.skin,$),role:"dialog","aria-modal":"true","aria-labelledby":u.id,tabindex:"-1"});n&&A.setAttribute("data-side",n),e.dir&&A.setAttribute("dir",e.dir),s&&A.setAttribute("data-headed",""),cr(A,$?{...g,theme:$}:g),Kn(A,e.tokens),s?A.append(E):(A.append(y("div",{class:"fd-form-dialog-head"}),E,y("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"})),A.firstElementChild?.append(u,...v?[v]:[],k)),b&&A.append(b);let L=(e.page.layout.type==="sections"||e.page.layout.type==="sheet"?e.page.layout.footer??[]:[]).map(H=>({node:H,button:y("button",{type:"button",class:`fd-button fd-button-${H.style??"secondary"}`,"data-node":H.id},H.label)}));for(let{node:H,button:C}of L)H.hotkey&&Rn(C,H.hotkey,H.label);s||A.querySelector(".fd-form-dialog-foot")?.append(...L.length?L.map(H=>H.button):[m,x]);let S=y("div",{class:`fd-dialog-backdrop fd-form-dialog-backdrop${i?" fd-form-panel-backdrop":""}${e.backdrop==="clear"?" fd-backdrop-clear":""}`});S.append(A);let I=i?[...d.querySelectorAll(".fd-form-panel")].pop():void 0;I?.setAttribute("data-behind",""),l.append(S);let F=Si(E,{...e,page:g&&!e.page.look?{...e.page,look:g}:e.page,showActions:!1,records:void 0,breadcrumbs:void 0,host:{...e.host,close:()=>O(W>j)}});if(i&&F.element.dir&&(S.dir=F.element.dir),s){F.element.dir&&!e.dir&&(A.dir=F.element.dir),E.querySelector(".fd-head-window")?.append(...v?[v]:[],k);let C=[...E.querySelectorAll("[data-head-name]")].map(z=>z.id).filter(Boolean);C.length?A.setAttribute("aria-labelledby",C.join(" ")):A.setAttribute("aria-label",e.title)}v&&a?.wireMaximise(A,v,c,d),b&&a?.wireGrip(A,b,d);let D=!1,W=0,j=0;F.on("save",()=>W++),F.on("run",({id:H})=>{H.startsWith("on.")||(j=W)});let O=H=>{};e.recompute&&em(F.form,e.page.fields,e.recompute,()=>D);let B=()=>jo(E)??(s?null:E.querySelector(ki));return(B()??A).focus(),F.form.settled().then(()=>{(d.activeElement===A||!A.contains(d.activeElement))&&B()?.focus()}),new Promise(H=>{O=Y=>{if(D)return;D=!0;let G=F.form.getState(),_={saved:Y,recordId:G.recordId??null,values:G.values};F.destroy(),S.remove(),I?.removeAttribute("data-behind"),r?.focus(),H(_)};let C=()=>new Promise(Y=>{let G=d.activeElement,_=y("p",{id:`${f}-ask`},c.discardChanges),Q=y("button",{type:"button",class:"fd-button"},c.cancel),$e=y("button",{type:"button",class:"fd-button fd-button-primary"},c.discard),Ne=y("div",{class:"fd-actions fd-actions-end"}),Ie=y("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":_.id}),Pe=y("div",{class:"fd-dialog-backdrop"});Ne.append(Q,$e),Ie.append(_,Ne),Pe.append(Ie);let ee=ge=>{Pe.remove(),G?.focus(),Y(ge)};Q.addEventListener("click",()=>ee(!1)),$e.addEventListener("click",()=>ee(!0)),Pe.addEventListener("keydown",ge=>{ge.stopPropagation(),ge.key==="Escape"?ee(!1):hn(Ie,ge)}),A.append(Pe),Q.focus()}),z=async()=>{(!(i||s)||!F.form.getState().dirty.length||await C())&&O(!1)};x.addEventListener("click",async()=>{x.disabled=!0;let Y=e.mode==="values"?F.check():await F.save();x.disabled=!1,Y&&O(!0)}),m.addEventListener("click",()=>O(!1));let M=!1;F.on("save",()=>M=!0),F.on("send",()=>M=!0);let te=()=>{for(let{node:Y,button:G}of L)G.hidden=F.form.node(Y.id).invisible};L.length&&(te(),F.form.subscribe(te));for(let{node:Y,button:G}of L)G.addEventListener("click",async()=>{if(G.hasAttribute("aria-busy"))return;G.setAttribute("aria-busy","true"),M=!1;let _=await F.form.runAction(Y.id);G.removeAttribute("aria-busy"),!D&&(M?O(!0):(_.reason==="check"||_.reason==="save")&&F.check())});k.addEventListener("click",z),A.addEventListener("keyup",Y=>Y.key==="Alt"&&A.removeAttribute("data-hotkeys")),A.addEventListener("keydown",Y=>{Y.key==="Alt"&&A.setAttribute("data-hotkeys","");let G=bo(Y),_=G?L.find(({node:Q,button:$e})=>Q.hotkey===G&&!$e.hidden&&!$e.disabled)?.button:void 0;if(_){Y.preventDefault(),A.removeAttribute("data-hotkeys"),_.click();return}if(Y.key==="Enter"&&(Y.ctrlKey||Y.metaKey)&&!Y.isComposing){if(Y.target.closest(".ag-root-wrapper"))return;Y.preventDefault(),d.activeElement?.dispatchEvent(new Event("change",{bubbles:!0})),L.length?L.find(({node:Q,button:$e})=>Q.style==="primary"&&!$e.hidden)?.button.click():x.click();return}Y.defaultPrevented||(Y.key==="Escape"?(Y.preventDefault(),z()):hn(A,Y))})})}function em(e,t,n,r){let i=JSON.stringify(e.getState().values),o=!1;e.subscribe(()=>{let a=e.getState().values,s=JSON.stringify(a);o||s===i||(i=s,n(a).then(d=>{if(r()||JSON.stringify(e.getState().values)!==s)return;o=!0;let l=Object.fromEntries(Object.entries(d).filter(([c,f])=>c in t&&JSON.stringify(a[c]??null)!==JSON.stringify(f??null)));Object.keys(l).length&&e.setValues(l),o=!1,i=JSON.stringify(e.getState().values)},()=>{}))})}function cs(e){let t=e.container?.ownerDocument??document,n=e.container??t.body,r=t.activeElement instanceof t.defaultView.HTMLElement?t.activeElement:null,i=vi(e.locale),o=Zt[i],a=ot[i],s=`fd-dialog-${++Cc}`,d=Ic(t),l=d("h2",{id:`${s}-title`,class:"fd-form-dialog-title"},e.title),c=d("button",{type:"button",class:"fd-dialog-close","aria-label":o.close},"\xD7"),f=d("input",{type:"search",class:"fd-input","aria-label":a.search,placeholder:a.search,"aria-controls":`${s}-list`,autocomplete:"off"}),y=d("ul",{id:`${s}-list`,class:"fd-search-list",role:"listbox","aria-labelledby":l.id}),u=d("button",{type:"button",class:"fd-button"},o.cancel),k=d("div",{class:"fd-theme fd-form-dialog fd-search-dialog fd-size-small","data-fd-skin":Un(e.skin??e.look?.skin,e.theme??e.look?.theme),role:"dialog","aria-modal":"true","aria-labelledby":l.id});e.dir&&k.setAttribute("dir",e.dir);let h=e.theme??e.look?.theme;cr(k,h?{...e.look,theme:h}:e.look),Kn(k,e.tokens);let v=d("div",{class:"fd-form-dialog-head"});v.append(l,c);let b=d("div",{class:"fd-form-dialog-body fd-search-body"});b.append(f,y);let E=d("div",{class:"fd-actions fd-actions-end fd-form-dialog-foot"});E.append(u),k.append(v,b,E);let m=d("div",{class:"fd-dialog-backdrop fd-form-dialog-backdrop"});return m.append(k),n.append(m),f.focus(),new Promise(x=>{let g=[],$=-1,A=0,w,L=F=>{clearTimeout(w),A++,m.remove(),r?.focus(),x(F)},S=()=>{y.replaceChildren(...g.map((F,D)=>{let W=d("li",{id:`${s}-option-${D}`,role:"option",class:`fd-option${D===$?" fd-active":""}`,"aria-selected":String(D===$)},F.label);return W.addEventListener("click",()=>L(F)),W})),g.length||y.append(d("li",{class:"fd-empty"},a.noResults)),$>=0?f.setAttribute("aria-activedescendant",`${s}-option-${$}`):f.removeAttribute("aria-activedescendant")},I=()=>{clearTimeout(w);let F=++A;w=setTimeout(async()=>{let D=await e.search(f.value,80).catch(()=>[]);F===A&&(g=D,$=-1,S())},180)};f.addEventListener("input",I),f.addEventListener("keydown",F=>{if(F.key==="ArrowDown"||F.key==="ArrowUp"){if(F.preventDefault(),!g.length)return;$=($+(F.key==="ArrowDown"?1:-1)+g.length)%g.length,S(),y.children[$]?.scrollIntoView?.({block:"nearest"})}else F.key==="Enter"&&$>=0&&(F.preventDefault(),L(g[$]))}),u.addEventListener("click",()=>L(null)),c.addEventListener("click",()=>L(null)),k.addEventListener("keydown",F=>{F.key==="Escape"?(F.preventDefault(),L(null)):hn(k,F)}),I()})}function fs(e){return e.layout.type==="sheet"&&e.layout.title?.field?e.layout.title.field:e.fields.name?"name":Object.entries(e.fields).find(([,t])=>t.type==="char")?.[0]??null}function tm(e,t,n,r){let i=Object.fromEntries(Object.entries(e).map(([o,a])=>[o,n?{...a,readonly:!0}:a]));return{fieldia:"0.1",id:"values",title:t,data:{kind:"record",model:"values"},fields:i,layout:{type:"sections",id:"values",children:r??[{type:"section",id:"values-section",columns:2,children:Object.keys(i).map(o=>({type:"field",id:`values-${o}`,field:o}))}]}}}function Li(e,t){let{pages:n,relatedPages:r}=e,i="model"in t?t.model:t.version===void 0?t.id:`${t.id}@${t.version}`,o=typeof n=="function"?n(t):n&&Object.prototype.hasOwnProperty.call(n,i)?n[i]:null;return o instanceof Promise?o.then(a=>a??null):o||!("model"in t)?o??null:(typeof r=="function"?r(t.model):r?.[t.model])??null}function nm(e){if(e)return{...e.search?{search:t=>e.search(t)}:{},...e.create?{create:t=>e.create(t)}:{}}}function Dc(e,t){let n=i=>Li(e,{model:i}),r={locale:e.locale,skin:e.skin,theme:e.theme??e.page.look?.theme,get tokens(){return e.tokens},dir:e.dir,widgets:e.widgets,preferences:e.preferences,pages:e.pages,relatedPages:e.relatedPages,translate:e.translate,look:e.page.look,user:e.user,context:e.context};return{canOpen:i=>n(i)!==null,async openRecord(i,o){let a=await n(i);if(!a)return null;let s=fs(a),d=await Wr({...r,page:a,dataSource:e.dataSource,recordId:o.recordId??null,values:o.name||o.values?{...o.values??{},...o.name&&s?{[s]:o.name}:{}}:void 0,title:o.title,size:"large",...t?{host:{say:t}}:{}});if(!d.saved||d.recordId===null)return null;let l=s?d.values[s]:null,c=typeof l=="string"&&l?l:o.name??o.title;return o.withValues?{id:d.recordId,label:c,values:d.values}:{id:d.recordId,label:c}},searchMore:i=>cs({title:i.title,search:i.search,locale:e.locale,skin:e.skin,theme:e.theme,tokens:e.tokens,dir:e.dir,look:e.page.look}),async editValues(i){let o=await Wr({...r,page:tm(i.fields,i.title,i.readonly===!0,i.layout),...i.parent?{parent:i.parent}:{},dataSource:nm(e.dataSource),values:i.values,title:i.title,...i.layout?{size:"large"}:{},mode:"values",...i.recompute?{recompute:i.recompute}:{},...t?{host:{say:t}}:{}});return o.saved?o.values:null}}}var Wc=e=>`favourites:${e.id}`;function zo(e,t){let n=e.get(Wc(t));return Array.isArray(n)?n:[]}function Hc(e,t,n){let r=zo(t,n).find(i=>i.isDefault);return r?r.facets:e.defaultFilters?.length?[{kind:"filters",ids:[...e.defaultFilters],labels:e.defaultFilters.map(i=>e.filters?.find(o=>o.id===i)?.label??i)}]:[]}function jc(e){let{page:t,el:n,labels:r,fill:i,preferences:o}=e,a=n("ul",{class:"fd-favourite-list"}),s=n("p",{class:"fd-favourites-none"},r.noFavourites),d=n("input",{class:"fd-input","aria-label":r.searchName,placeholder:r.searchName}),l=n("input",{type:"checkbox"}),c=n("button",{type:"button",class:"fd-button fd-button-primary"},r.save),f=n("div",{class:"fd-favourite-form",hidden:""},d,n("label",{class:"fd-favourite-default"},l,r.useByDefault),c),y=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.saveSearch),u=h=>o.set(Wc(t),h);function k(){let h=zo(o,t);s.hidden=h.length>0,a.replaceChildren(...h.map(v=>{let b=n("button",{type:"button",class:"fd-search-option","data-default":v.isDefault?"true":void 0},v.name);b.addEventListener("click",()=>e.apply(v.facets));let E=n("button",{type:"button",class:"fd-favourite-remove","aria-label":i(r.deleteFavourite,{name:v.name})},"\xD7");return E.addEventListener("click",()=>{u(zo(o,t).filter(m=>m.name!==v.name)),k()}),n("li",{class:"fd-favourite"},b,E)}))}return y.addEventListener("click",()=>{f.hidden=!f.hidden,y.setAttribute("aria-expanded",String(!f.hidden)),f.hidden||d.focus()}),c.addEventListener("click",()=>{let h=d.value.trim();if(!h)return d.focus();let v={name:h,facets:e.current(),...l.checked?{isDefault:!0}:{}},b=zo(o,t).filter(E=>E.name!==h).map(E=>l.checked?{name:E.name,facets:E.facets}:E);u([...b,v]),d.value="",l.checked=!1,f.hidden=!0,y.setAttribute("aria-expanded","false"),k()}),k(),{list:a,none:s,open:y,form:f}}function rm(e,t,n){let r=e.page.fields[t];return n.value===null?e.labels.none:r.type==="selection"?r.options.find(i=>i.value===n.value)?.label??n.label:r.type==="boolean"?n.value?e.labels.yes:e.labels.no:n.label||String(n.value)}function im(e){let t=Number(e.dataset.level),n=e.nextElementSibling;for(;n&&Number(n.dataset.level??0)>t;){let r=n.nextElementSibling;n.remove(),n=r}}function us(e,t,n,r,i){let{el:o,labels:a}=e,s=i[n],d=[...r,t.value===null?{field:s,op:"notset",value:null}:{field:s,op:"=",value:t.value}],l=o("button",{type:"button",class:"fd-group-toggle","aria-expanded":"false"},o("span",{class:"fd-group-label"},rm(e,s,t))," ",o("span",{class:"fd-group-count"},`(${t.count})`)),c=o("tr",{class:"fd-list-group","data-level":String(n),"aria-level":String(n+1)},o("td",{colspan:String(e.columns)},l));c.style.setProperty("--fd-level",String(n));let f=!1;async function y(){f=!0;try{let k=n+1<i.length?(await e.dataSource.groups?.({model:e.model,field:i[n+1],filter:d}))?.map(h=>us(e,h,n+1,d,i))??[]:await u(0);if(!c.isConnected||l.getAttribute("aria-expanded")!=="true")return;c.after(...k),e.changed()}finally{f=!1}}async function u(k){let h=await e.dataSource.list({model:e.model,fields:e.fields,filter:d,sort:e.sort(),offset:k,limit:e.pageSize}),v=h.records.map(x=>e.recordRow(x,n+1)),b=h.total-k-h.records.length;if(b<=0)return v;let E=o("button",{type:"button",class:"fd-button fd-button-link"},e.fill(a.loadMore,{n:b})),m=o("tr",{class:"fd-list-more","data-level":String(n+1)},o("td",{colspan:String(e.columns)},E));return m.style.setProperty("--fd-level",String(n)),E.addEventListener("click",async()=>{E.disabled=!0;let x=await u(k+h.records.length);m.isConnected&&(m.replaceWith(...x),e.changed())}),[...v,m]}return l.addEventListener("click",()=>{let k=l.getAttribute("aria-expanded")==="true";l.setAttribute("aria-expanded",String(!k)),k?(im(c),e.changed()):f||y()}),c}var om='.fd-list{display:grid;gap:10px;min-width:0}.fd-list [hidden]{display:none!important}.fd-list-bar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;min-height:34px}.fd-list{container:fd-list / inline-size}.fd-list-views{display:inline-flex;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);overflow:hidden}.fd-list-views .fd-button{border:0;border-radius:0;min-height:32px;padding-inline:12px}.fd-list-views .fd-button+.fd-button{border-inline-start:1px solid var(--fd-border)}.fd-list-views .fd-button[aria-pressed=true]{background:var(--fd-accent-soft);color:var(--fd-accent);font-weight:600}.fd-list-body{display:grid;gap:16px;min-width:0}.fd-list-records{display:grid;gap:10px;min-width:0;align-content:start}.fd-list[data-view=list] .fd-list-map,.fd-list[data-view=map] .fd-list-records,.fd-list[data-view=map] .fd-pager{display:none}.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,3fr) minmax(320px,2fr);align-items:start}.fd-list[data-view=both] .fd-list-map{position:sticky;top:8px}@container fd-list (max-width: 860px){.fd-list[data-view=both] .fd-list-body{grid-template-columns:minmax(0,1fr)}.fd-list[data-view=both] .fd-list-map{position:static;order:-1}}.fd-list-row.fd-list-hot>td{background:var(--fd-accent-soft)}.fd-search{position:relative;flex:1 1 360px;max-width:680px;min-width:0;container:fd-search / inline-size}.fd-search-field{display:flex;flex-wrap:wrap;align-items:center;gap:4px;min-height:34px;box-sizing:border-box;padding:2px 2px 2px 8px;padding-inline:8px 2px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);background:var(--fd-surface)}.fd-search-field:focus-within{border-color:var(--fd-focus);box-shadow:var(--fd-focus-ring)}.fd-search-field>.fd-icon,.fd-search-field>svg{width:16px;height:16px;color:var(--fd-muted);flex:none}.fd-facets{display:contents}.fd-facet{display:inline-flex;align-items:center;gap:4px;max-width:100%;min-width:0;min-height:24px;padding-block:0;padding-inline:6px 0;border-radius:3px;background:var(--fd-accent-soft);color:var(--fd-accent);font-size:13px;line-height:18px}.fd-facet svg{width:13px;height:13px;flex:none}.fd-facet[data-kind=groupBy]{background:var(--fd-success-soft);color:var(--fd-success)}.fd-facet-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-facet-remove{all:unset;cursor:pointer;display:grid;place-items:center;width:24px;height:24px;border-radius:2px;font-size:15px;line-height:1;opacity:.7}.fd-facet-remove:hover,.fd-facet-remove:focus-visible{opacity:1;background:var(--fd-surface)}.fd-search-input{flex:1 1 140px;min-width:100px;border:none;outline:none;background:none;font:inherit;font-size:14px;color:var(--fd-text);padding:5px 4px}.fd-form .fd-search-input:focus-visible{outline:none}.fd-search-toggle{all:unset;cursor:pointer;display:grid;place-items:center;width:30px;height:28px;border-radius:3px;color:var(--fd-muted)}.fd-search-toggle:before{content:"";width:7px;height:7px;border-right:1.5px solid currentColor;border-bottom:1.5px solid currentColor;transform:translateY(-2px) rotate(45deg)}.fd-search-toggle[aria-expanded=true]:before{transform:translateY(2px) rotate(-135deg)}.fd-search-toggle:hover,.fd-search-toggle[aria-expanded=true]{background:var(--fd-page);color:var(--fd-text)}.fd-search-toggle:focus-visible{outline:2px solid var(--fd-focus)}.fd-search-suggestions,.fd-search-panel{position:absolute;z-index:30;inset-inline:0;top:calc(100% + 4px);box-sizing:border-box;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);box-shadow:0 10px 28px #0f172a24}.fd-search-suggestions{list-style:none;margin:0;padding:4px 0}.fd-search-suggestions [role=option]{padding:7px 12px;cursor:pointer;font-size:14px}.fd-search-suggestions [role=option][aria-selected=true]{background:var(--fd-accent-soft)}.fd-search-panel{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);padding-block:6px}.fd-search-group{display:flex;flex-direction:column;align-items:stretch;gap:1px;padding:4px 10px 8px;min-width:0}.fd-search-group+.fd-search-group{border-inline-start:1px solid var(--fd-border)}@container fd-search (max-width: 540px){.fd-search-panel{grid-auto-flow:row}.fd-search-group+.fd-search-group{border-inline-start:none;border-block-start:1px solid var(--fd-border);padding-block-start:8px}}.fd-search-heading{display:flex;align-items:center;gap:6px;font-weight:600;font-size:13.5px;padding:4px 6px 6px}.fd-search-heading svg{width:15px;height:15px}.fd-search-group[data-group-kind=filters] .fd-search-heading svg{color:var(--fd-accent)}.fd-search-group[data-group-kind=groupBy] .fd-search-heading svg{color:var(--fd-success)}.fd-search-group[data-group-kind=favourites] .fd-search-heading svg{color:var(--fd-warning)}.fd-search-option{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:6px;padding:5px 6px;border-radius:4px;font-size:14px;color:var(--fd-text)}.fd-search-option:before{content:"";width:14px;flex:none;text-align:center;color:var(--fd-accent);font-weight:700}.fd-search-option[aria-pressed=true]:before{content:"\u2713"}.fd-search-option:hover,.fd-search-option:focus-visible{background:var(--fd-page)}.fd-search-add{color:var(--fd-muted);margin-block-start:4px}.fd-search-add:before{content:"+";color:var(--fd-muted);font-weight:400}.fd-custom-filter,.fd-favourite-form{display:grid;gap:6px;padding:6px}.fd-custom-filter .fd-input,.fd-favourite-form .fd-input{width:100%;box-sizing:border-box;min-height:30px;border:1px solid var(--fd-border);border-radius:var(--fd-control-radius);padding:3px 6px;font:inherit;font-size:13.5px;background:var(--fd-surface);color:var(--fd-text)}.fd-favourite-default{display:flex;align-items:center;gap:6px;font-size:13.5px}.fd-favourite-list{list-style:none;margin:0;padding:0}.fd-favourite{display:flex;align-items:center}.fd-favourite .fd-search-option{flex:1;min-width:0}.fd-favourite .fd-search-option[data-default=true]:before{content:"\u2605";color:var(--fd-warning)}.fd-favourite-remove{all:unset;cursor:pointer;width:24px;height:24px;display:grid;place-items:center;border-radius:4px;color:var(--fd-muted)}.fd-favourite-remove:hover{background:var(--fd-page);color:var(--fd-error)}.fd-favourites-none{margin:0;padding:4px 6px;color:var(--fd-muted);font-size:13px}.fd-list-selection{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:3px 4px 3px 10px;border-radius:var(--fd-control-radius);background:var(--fd-accent-soft)}.fd-list-count{font-weight:600;font-size:13.5px;color:var(--fd-accent);font-variant-numeric:tabular-nums}.fd-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-pager-text{color:var(--fd-muted);font-size:13.5px;font-variant-numeric:tabular-nums;margin-inline-end:6px;white-space:nowrap}.fd-pager-button{min-width:32px;padding-inline:0;font-size:18px;line-height:1}.fd-list-scroll{overflow-x:auto;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius)}.fd-list-table{width:100%;border-collapse:collapse;font-size:14px}.fd-list-table th{text-align:start;font-weight:600;color:var(--fd-text);padding:8px 10px;border-block-end:1px solid var(--fd-border-strong);white-space:nowrap;background:var(--fd-surface)}.fd-list-head{font-size:13px}.fd-list-table td{padding:7px 10px;border-block-end:1px solid var(--fd-border);max-width:28em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-list-table tbody tr:last-child td{border-block-end:none}.fd-list-table .fd-num{text-align:end;font-variant-numeric:tabular-nums}.fd-list-table th.fd-list-check,.fd-list-table td.fd-list-check{width:36px;padding-inline:10px 0}.fd-list-checkbox{width:16px;height:16px;margin:0;vertical-align:middle;accent-color:var(--fd-accent);cursor:pointer}.fd-list-sort{all:unset;box-sizing:border-box;width:100%;cursor:pointer;display:flex;align-items:center;gap:4px;font:inherit;color:inherit}.fd-list-sort:after{content:"";width:0;height:0;border-inline:4px solid transparent;opacity:0}.fd-list-sort:hover:after{opacity:.35;border-block-start:5px solid currentColor}.fd-list-table th[aria-sort=ascending] .fd-list-sort:after{opacity:1;border-block-start:none;border-block-end:5px solid currentColor}.fd-list-table th[aria-sort=descending] .fd-list-sort:after{opacity:1;border-block-end:none;border-block-start:5px solid currentColor}.fd-list-table th.fd-num .fd-list-sort{justify-content:flex-end}.fd-list-table th.fd-num .fd-list-sort:after{order:-1}.fd-list-sort:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-list-row:hover td{background:var(--fd-page)}.fd-list-openable{cursor:pointer}.fd-list-row[aria-selected=true] td{background:var(--fd-accent-soft)}.fd-list-row:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-list-table[aria-busy=true] tbody{opacity:.6;transition:opacity .2s .15s}.fd-list-group td{padding:0;background:var(--fd-page)}.fd-group-toggle{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:8px;width:100%;padding:8px 10px;padding-inline-start:calc(12px + var(--fd-level, 0) * 22px);font-weight:600;font-size:13.5px;color:var(--fd-text)}.fd-group-toggle:before{content:"";flex:none;width:6px;height:6px;border-top:1.5px solid currentColor;border-right:1.5px solid currentColor;transform:rotate(45deg);transition:transform .12s}.fd-group-toggle:dir(rtl):before{transform:rotate(-135deg)}.fd-group-toggle[aria-expanded=true]:before{transform:rotate(135deg)}.fd-group-toggle:hover{background:var(--fd-accent-soft)}.fd-group-toggle:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-group-count{color:var(--fd-muted);font-weight:400;font-variant-numeric:tabular-nums}.fd-list-more td{padding:4px 10px;padding-inline-start:calc(46px + var(--fd-level, 0) * 22px)}.fd-list-empty,.fd-list-failed{margin:0;padding:28px 12px;text-align:center;color:var(--fd-muted)}.fd-list-failed{color:var(--fd-error)}.fd-list-table [data-width]{box-sizing:content-box;width:calc(var(--fd-col-width) * 1ch);max-width:calc(var(--fd-col-width) * 1ch);overflow:hidden;text-overflow:ellipsis}.fd-list-table th[data-width] .fd-list-sort{min-width:0}.fd-list-table th[data-width] .fd-list-head{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis}.fd-list-table [data-width-px]{box-sizing:border-box;width:var(--fd-col-px);min-width:var(--fd-col-px);max-width:var(--fd-col-px);overflow:hidden;text-overflow:ellipsis}.fd-list-table th[data-width-px] .fd-list-sort{min-width:0}.fd-list-table th[data-width-px] .fd-list-head{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis}.fd-list-table[data-fixed]{width:max-content}.fd-list-row[aria-current=true] td{background:var(--fd-accent-soft)}.fd-list-lead{width:14px;height:14px;margin-inline-end:6px;vertical-align:-2px;flex:none;stroke-width:2.2}.fd-list-dot{display:inline-block;width:8px;height:8px;margin-inline-end:6px;border-radius:50%;vertical-align:1px;background:var(--fd-dot, var(--fd-border-strong))}.fd-list-dot[data-tone=muted]{--fd-dot: var(--fd-border-strong)}.fd-list-dot[data-tone=danger]{--fd-dot: var(--fd-error)}.fd-list-dot[data-tone=success]{--fd-dot: var(--fd-success)}.fd-list-dot[data-tone=warning]{--fd-dot: #d97706}.fd-list-dot[data-tone=info]{--fd-dot: var(--fd-info)}@media(forced-colors:active){.fd-list-dot{background:CanvasText}}.fd-list-table .fd-list-tree{width:1%;padding-inline:10px 4px;white-space:nowrap}.fd-list-folds{display:inline-flex;gap:6px;vertical-align:middle}.fd-list-fold{all:unset;box-sizing:border-box;cursor:pointer;display:grid;place-items:center;width:24px;height:24px;border:1px solid var(--fd-text);border-radius:2px;color:var(--fd-text);font-size:18px;font-weight:400;line-height:1}.fd-list-fold:hover{background:var(--fd-page)}.fd-list-fold:focus-visible,.fd-list-twisty:focus-visible{outline:2px solid var(--fd-focus);outline-offset:1px}.fd-list-row[data-depth]>td[data-name]{padding-inline-start:calc(10px + var(--fd-depth, 0) * 20px)}.fd-list-twisty,.fd-list-twisty-room{display:inline-block;width:20px;height:20px;margin-inline-end:2px;vertical-align:middle}.fd-list-twisty{all:unset;display:inline-grid;place-items:center;width:20px;height:20px;margin-inline-end:2px;vertical-align:middle;cursor:pointer;border-radius:2px;color:var(--fd-muted)}.fd-list-twisty:before{content:"";width:6px;height:6px;border-top:1.5px solid currentColor;border-right:1.5px solid currentColor;transform:rotate(45deg);transition:transform .12s}.fd-list-twisty:dir(rtl):before{transform:rotate(-135deg)}.fd-list-twisty[aria-expanded=true]:before{transform:rotate(135deg)}.fd-list-twisty:hover{background:var(--fd-page);color:var(--fd-text)}.fd-list[data-search=fields] .fd-list-bar{gap:16px}.fd-list[data-search=fields] .fd-list-records>.fd-pager{justify-self:end}.fd-form[data-fd-theme=fluent] .fd-list-table th{position:relative;box-sizing:border-box;height:39px;padding-block:0;color:var(--fd-muted);border-block-end:1px solid var(--fd-border)}.fd-form[data-fd-theme=fluent] .fd-list-head{font-size:12px;font-weight:600}.fd-form[data-fd-theme=fluent] .fd-list-table thead th:not(:first-child):after{content:"";position:absolute;inset-inline-end:var(--fd-rule-in, 0px);inset-block:10px;width:1px;background:var(--fd-border)}.fd-form[data-fd-theme=fluent] .fd-list-table thead th.fd-list-tree:after,.fd-form[data-fd-theme=fluent] .fd-list-table thead th.fd-list-check:after{content:none}.fd-form[data-fd-theme=fluent] .fd-list-table thead th[data-rule=none]:after{content:none}.fd-form[data-fd-theme=fluent] .fd-list-table td{height:36px;padding-block:0;padding-inline:3px 8px;border-block-end:0}.fd-form[data-fd-theme=fluent] .fd-list-table th{padding-inline:7px 8px}.fd-form[data-fd-theme=fluent] .fd-list-row:hover td{background:var(--fd-fill, var(--fd-page))}.fd-form[data-fd-theme=fluent] .fd-list-row[aria-current=true] td{background:var(--fd-accent-soft)}.fd-form[data-fd-theme=fluent] .fd-list-table .fd-list-tree{padding-inline:15px 7px}.fd-form[data-fd-theme=fluent] .fd-list-folds{gap:4px}.fd-form[data-fd-theme=fluent] .fd-list-fold{width:25px;height:22px}.fd-form[data-fd-theme=fluent] .fd-list-row[data-depth]>td[data-name]{padding-inline-start:calc(3px + var(--fd-depth, 0) * 20px)}.fd-form[data-fd-theme=fluent] :is(.fd-list-twisty,.fd-list-twisty-room){width:24px;margin-inline-end:3px}.fd-form[data-fd-theme=fluent] .fd-list-table th[data-name]{padding-inline-start:30px}.fd-form[data-fd-theme=fluent] .fd-list-lead{margin-inline-end:4px}.fd-form[data-fd-theme=fluent] .fd-list-scroll:has(>.fd-list-table[data-fixed]){padding-inline-end:9px}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar{width:15px;height:15px}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-track,.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-corner{background:color-mix(in srgb,var(--fd-text) 2.2%,var(--fd-surface))}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-track:horizontal{border-top:1px solid color-mix(in srgb,var(--fd-text) 10%,var(--fd-surface));border-bottom:1px solid color-mix(in srgb,var(--fd-text) 7.5%,var(--fd-surface))}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-track:vertical{border-left:1px solid color-mix(in srgb,var(--fd-text) 10%,var(--fd-surface));border-right:1px solid color-mix(in srgb,var(--fd-text) 7.5%,var(--fd-surface))}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-thumb{border:solid transparent;border-width:4px 3px 3px;border-radius:8px;background:color-mix(in srgb,var(--fd-text) 24.5%,var(--fd-surface)) padding-box}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-thumb:vertical{border-width:3px 3px 3px 4px}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-thumb:hover{background-color:color-mix(in srgb,var(--fd-text) 40%,var(--fd-surface))}.fd-form[data-fd-theme=fluent] .fd-list-scroll::-webkit-scrollbar-button{display:none}';function Bo(e){if(e.getElementById("fd-list-styles"))return;let t=e.createElement("style");t.id="fd-list-styles",t.textContent=om,e.head.append(t)}var am=[["ilike","opContains"],["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],sm=[["ilike","opContains"],["set","opSet"],["notset","opNotSet"]],dm=[["=","opIs"],["!=","opIsNot"],["set","opSet"],["notset","opNotSet"]],lm=[["=","opIs"],["!=","opIsNot"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]],cm=[["=","opIs"],[">","opGreater"],["<","opLess"],["set","opSet"],["notset","opNotSet"]];function ps(e){switch(e.type){case"char":case"text":case"html":return am;case"many2one":case"many2many":return sm;case"selection":return dm;case"integer":case"float":case"monetary":return lm;case"date":case"datetime":return cm;case"boolean":return[["=","opIs"]];default:return[]}}function zc(e){let{page:t,el:n,labels:r}=e,i=Object.entries(t.fields).filter(([,h])=>ps(h).length),o=n("select",{class:"fd-input","aria-label":r.field},...i.map(([h,v])=>n("option",{value:h},v.label))),a=n("select",{class:"fd-input","aria-label":r.condition}),s=n("span",{class:"fd-custom-filter-value"}),d=n("button",{type:"button",class:"fd-button fd-button-primary"},r.apply),l=n("div",{class:"fd-custom-filter",hidden:""},o,a,s,d),c=n("button",{type:"button",class:"fd-search-option fd-search-add","aria-expanded":"false"},r.addCustomFilter),f=n("input",{class:"fd-input","aria-label":r.value}),y=()=>t.fields[o.value];function u(){a.replaceChildren(...ps(y()).map(([h,v])=>n("option",{value:h},r[v]))),k()}function k(){let h=y();if(h.type==="selection")f=n("select",{class:"fd-input","aria-label":r.value},...h.options.map(v=>n("option",{value:String(v.value)},v.label)));else if(h.type==="boolean")f=n("select",{class:"fd-input","aria-label":r.value},n("option",{value:"true"},r.yes),n("option",{value:"false"},r.no));else{let v=["integer","float","monetary"].includes(h.type)?"number":h.type==="date"?"date":h.type==="datetime"?"datetime-local":"text";f=n("input",{class:"fd-input",type:v,"aria-label":r.value})}s.replaceChildren(f),s.hidden=a.value==="set"||a.value==="notset"}return o.addEventListener("change",u),a.addEventListener("change",()=>s.hidden=a.value==="set"||a.value==="notset"),c.addEventListener("click",()=>{l.hidden=!l.hidden,c.setAttribute("aria-expanded",String(!l.hidden)),l.hidden||o.focus()}),d.addEventListener("click",()=>{let h=y(),v=a.value,b=r[ps(h).find(([x])=>x===v)?.[1]??"opIs"],E=null,m="";if(!s.hidden){let x=f.value.trim();if(!x)return f.focus();if(h.type==="selection"){let g=h.options.find($=>String($.value)===x);E=g?.value??x,m=g?.label??x}else if(h.type==="boolean")E=x==="true",m=E?r.yes:r.no;else if(["integer","float","monetary"].includes(h.type)){if(E=Number(x),!Number.isFinite(E))return f.focus();m=x}else E=x,m=x}e.add({kind:"custom",label:[h.label,b,m].filter(Boolean).join(" "),filter:[{field:o.value,op:v,value:E}]}),l.hidden=!0,c.setAttribute("aria-expanded","false")}),u(),{button:c,form:l}}function fm(e,t){let n=` ${t.or} `;switch(e.kind){case"field":return`${e.label}: ${e.values.map(r=>r.label).join(n)}`;case"filters":return e.labels.join(n);case"groupBy":return e.labels.join(" > ");case"custom":return e.label}}function Bc(e){let{page:t,node:n,doc:r,el:i,labels:o,fill:a,uid:s}=e,d=e.facets,l=C=>{let z=rt(r,C,e.icons);return z?.setAttribute("aria-hidden","true"),z?[z]:[]};function c(C){d=C,m(),j(),e.onChange(d)}let f=s(`${n.id}-suggestions`),y=s(`${n.id}-search-panel`),u=i("input",{class:"fd-search-input",role:"combobox",autocomplete:"off",placeholder:o.search,"aria-label":o.searchLabel,"aria-autocomplete":"list","aria-expanded":"false","aria-controls":f}),k=i("div",{class:"fd-facets"}),h=i("ul",{class:"fd-search-suggestions",role:"listbox",id:f,"aria-label":o.searchLabel,hidden:""}),v=i("button",{type:"button",class:"fd-search-toggle","aria-label":o.searchOptions,"aria-expanded":"false","aria-controls":y}),b=[],E=0;function m(){k.replaceChildren(...d.map((C,z)=>{let M=fm(C,o),te=i("button",{type:"button",class:"fd-facet-remove","aria-label":a(o.removeFacet,{label:M})},"\xD7");te.addEventListener("click",()=>{c(d.filter((G,_)=>_!==z)),u.focus()});let Y=C.kind==="groupBy"?"layers":C.kind==="field"?"":"filter";return i("span",{class:"fd-facet","data-kind":C.kind},...Y?l(Y):[],i("span",{class:"fd-facet-text"},M),te)}))}function x(){h.replaceChildren(...b.map((C,z)=>{let M=i("li",{role:"option",id:`${f}-${z}`,"aria-selected":String(z===E)},C.label);return M.addEventListener("mousedown",te=>te.preventDefault()),M.addEventListener("click",()=>$(C)),M})),h.hidden=b.length===0,u.setAttribute("aria-expanded",String(!h.hidden)),h.hidden?u.removeAttribute("aria-activedescendant"):u.setAttribute("aria-activedescendant",`${f}-${E}`)}function g(){b=[],x()}function $(C){let z={op:C.op,value:C.value,label:C.valueLabel},M=d.findIndex(Y=>Y.kind==="field"&&Y.field===C.field),te=[...d];if(M<0)te.push({kind:"field",field:C.field,label:C.fieldLabel,values:[z]});else{let Y=te[M];Y.values.some(_=>_.op===z.op&&JSON.stringify(_.value)===JSON.stringify(z.value))||(te[M]={...Y,values:[...Y.values,z]})}u.value="",g(),c(te)}u.addEventListener("input",()=>{b=Lr(u.value,t,n,{searchFor:o.searchFor}),E=0,x()}),u.addEventListener("blur",g),u.addEventListener("keydown",C=>{C.isComposing||((C.key==="ArrowDown"||C.key==="ArrowUp")&&b.length?(C.preventDefault(),E=(E+(C.key==="ArrowDown"?1:b.length-1))%b.length,x()):C.key==="Enter"?(C.preventDefault(),b.length&&$(b[E])):C.key==="Backspace"&&!u.value&&d.length?c(d.slice(0,-1)):C.key==="Escape"&&!h.hidden&&(C.preventDefault(),g()))});let A=(C,z,M)=>i("div",{class:"fd-search-heading",id:M},...l(C),z),w=(C,z)=>{let M=d.findIndex(Q=>Q.kind===C),te=M<0?[]:C==="filters"?d[M].ids:d[M].fields,Y=te.includes(z)?te.filter(Q=>Q!==z):[...te,z],G=C==="filters"?{kind:C,ids:Y,labels:Y.map(Q=>n.filters?.find($e=>$e.id===Q)?.label??Q)}:{kind:C,fields:Y,labels:Y.map(Q=>t.fields[Q]?.label??Q)},_=[...d];M<0?_.push(G):Y.length?_[M]=G:_.splice(M,1),c(_)},L=(n.filters??[]).map(C=>{let z=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-filter":C.id},C.label);return z.addEventListener("click",()=>w("filters",C.id)),z}),S=(n.groupBy??[]).map(C=>{let z=i("button",{type:"button",class:"fd-search-option","aria-pressed":"false","data-group":C},t.fields[C].label);return z.addEventListener("click",()=>w("groupBy",C)),z}),I=zc({page:t,el:i,labels:o,add:C=>c([...d,C])}),F=jc({page:t,el:i,labels:o,fill:a,preferences:e.preferences,current:()=>d,apply:c}),D=(C,z,M,...te)=>i("div",{class:"fd-search-group","data-group-kind":C,role:"group","aria-labelledby":`${y}-${C}`},A(z,M,`${y}-${C}`),...te),W=i("div",{class:"fd-search-panel",id:y,hidden:""},D("filters","filter",o.filters,...L,I.button,I.form),...S.length?[D("groupBy","layers",o.groupBy,...S)]:[],D("favourites","star",o.favourites,F.list,F.none,F.open,F.form));function j(){let C=d.find(M=>M.kind==="filters")?.ids??[],z=d.find(M=>M.kind==="groupBy")?.fields??[];for(let M of L)M.setAttribute("aria-pressed",String(C.includes(M.dataset.filter??"")));for(let M of S)M.setAttribute("aria-pressed",String(z.includes(M.dataset.group??"")))}function O(C){W.hidden=!C,v.setAttribute("aria-expanded",String(C)),C&&g()}v.addEventListener("click",()=>O(W.hidden)),W.addEventListener("keydown",C=>{C.key==="Escape"&&(C.preventDefault(),O(!1),v.focus())});let B=i("div",{class:"fd-search"},i("div",{class:"fd-search-field"},...l("search"),k,u,v),h,W),H=C=>{!W.hidden&&!B.contains(C.target)&&O(!1)};return r.addEventListener("pointerdown",H),m(),j(),{element:B,add(C){let z=C.kind==="custom"?C.label:null;c([...d.filter(M=>!(z!==null&&M.kind==="custom"&&M.label===z)),C])},destroy:()=>r.removeEventListener("pointerdown",H)}}var um=new Set(["integer","float","monetary"]),pm=new Set(["one2many","many2many","binary","image","html","json","properties"]),mm=new Set(["info","success","warning","danger","muted"]),gm=/^#[0-9a-fA-F]{6}$/,ms=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&"id"in e?e.id:e,hm=e=>!!e&&typeof e.then=="function";function qc(e){let{page:t,node:n,form:r,el:i,labels:o,fill:a,locale:s,doc:d}=e;Bo(d);let l=n.pageSize??40,c=n.sort??[],f=c,y=0,u=0,k=[],h=new WeakMap,v=()=>[...G.querySelectorAll(".fd-list-row")].map(U=>h.get(U)),b=t.data.kind==="record"?t.data.model:"",E=Hc(n,e.preferences,t),m=new Set,x=0,g=!1,$=n.choose!==!1,A=n.search==="fields",w=n.parentField&&t.fields[n.parentField]?n.parentField:null,L=U=>n.cells?.[U],S=Object.values(n.cells??{}).flatMap(U=>U.lead?[U.lead.field]:[]),I=[...new Set([...n.columns.flatMap(U=>[U,...no(t.fields[U])]),...S,...w?[w]:[]])],F=(U,de)=>It(t.fields[U],de[U],de,s),D=U=>L(U)?.align?L(U)?.align==="end":um.has(t.fields[U].type),W=(U,de)=>{let Fe=L(de)?.width;return Fe?typeof Fe=="string"?(U.setAttribute("data-width-px",""),U.style.setProperty("--fd-col-px",Fe),U):(U.setAttribute("data-width",String(Fe)),U.style.setProperty("--fd-col-width",String(Fe)),U):U},j=n.columns.find(U=>t.fields[U].type==="char")??n.columns[0],O=n.columns.every(U=>L(U)?.width),B=n.sortable!==!1,H=null,C=($?1:0)+(w?1:0),z=i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":o.selectAll}),M=n.columns.map(U=>{let de=t.fields[U],Fe=W(i("th",{scope:"col","data-field":U,class:D(U)?"fd-num":void 0,"data-name":w&&U===j?"":void 0}),U),je=L(U)?.rule;je===!1?Fe.setAttribute("data-rule","none"):je&&Fe.style.setProperty("--fd-rule-in",je);let Ke=L(U)?.width,He=typeof Ke=="number"?de.label.length>Ke:typeof Ke=="string"?de.label.length*6.5>Number.parseInt(Ke,10)-16:!1,pt=i("span",{class:"fd-list-head",title:He?de.label:void 0},de.label);if(pm.has(de.type)||!B)Fe.append(pt);else{let Qe=i("button",{type:"button",class:"fd-list-sort"},pt);Qe.addEventListener("click",()=>{let Je=f[0]?.field===U?!f[0].desc:!1;f=[{field:U,...Je?{desc:Je}:{}},...c.filter(zt=>zt.field!==U)],y=0,ce()}),Fe.append(Qe)}return Fe}),te=i("button",{type:"button",class:"fd-list-fold","aria-label":o.expandAll,title:o.expandAll},i("span",{"aria-hidden":"true"},"+")),Y=i("button",{type:"button",class:"fd-list-fold","aria-label":o.collapseAll,title:o.collapseAll},i("span",{"aria-hidden":"true"},"\u2212")),G=i("tbody"),_=i("table",{class:"fd-list-table","aria-label":t.title,"data-fixed":O?"":void 0,"data-sortable":B?void 0:"false"},i("thead",{},i("tr",{},...$?[i("th",{class:"fd-list-check",scope:"col"},z)]:[],...w?[i("th",{class:"fd-list-tree",scope:"col"},i("span",{class:"fd-list-folds"},te,Y))]:[],...M)),G),Q=i("p",{class:"fd-list-empty",hidden:""},o.noRecords),$e=i("button",{type:"button",class:"fd-button fd-button-link"},o.retry),Ne=i("p",{class:"fd-list-failed",role:"alert",hidden:""},o.loadFailed," ",$e);$e.addEventListener("click",()=>{ce()});function Ie(U,de){let Fe=L(U),je=F(U,de),Ke=[],He=Fe?.lead?.looks[String(ms(de[Fe.lead.field]))],pt=He?rt(d,He.icon,e.icons):null;if(pt&&(pt.setAttribute("aria-hidden","true"),pt.classList.add("fd-list-lead"),He?.colour&&(pt.style.color=He.colour),Ke.push(pt)),Fe?.widget==="dot"&&je){let Qe=String(ms(de[U])),Je=Fe.options?.colours??{},zt=Fe.options?.tones??{},Nt=typeof Je[Qe]=="string"&&gm.test(Je[Qe])?Je[Qe]:null,Wt=typeof zt[Qe]=="string"&&mm.has(zt[Qe])?zt[Qe]:"muted",nn=i("span",{class:"fd-list-dot","aria-hidden":"true","data-tone":Nt?void 0:Wt});Nt&&nn.style.setProperty("--fd-dot",Nt),Ke.push(nn)}return[...Ke,i("bdi",{},je)]}let Pe=()=>{for(let U of G.querySelectorAll(".fd-list-row"))H!==null&&U.dataset.id===String(H)?U.setAttribute("aria-current","true"):U.removeAttribute("aria-current")};async function ee(U,de=!0){let Fe=e.onOpenRecord?.(U);if(!hm(Fe))return;de&&(H=U),Pe();try{await Fe}catch{}if(H===U&&(H=null),Pe(),g)return;await ce();let je=d.activeElement;g||je&&je!==d.body&&!Mt.contains(je)||[...G.querySelectorAll(".fd-list-row")].find(Ke=>Ke.dataset.id===String(U)&&!Ke.hidden)?.focus()}let ge=(U,de)=>{let Fe=de?U.nextElementSibling:U.previousElementSibling;for(;Fe&&Fe.hidden;)Fe=de?Fe.nextElementSibling:Fe.previousElementSibling;return Fe};function ke(U,de=0){let Fe=F(j,U.values)||String(U.id),je=$?i("input",{type:"checkbox",class:"fd-list-checkbox","aria-label":a(o.selectRecord,{name:Fe})}):null;je&&(je.checked=m.has(U.id),je.addEventListener("change",()=>{je.checked?m.add(U.id):m.delete(U.id),De(),bt?.chosenChanged()}));let Ke=i("tr",{class:e.onOpenRecord?"fd-list-row fd-list-openable":"fd-list-row",tabindex:"0","data-id":String(U.id),"data-level":de?String(de):void 0,"aria-current":H!==null&&String(H)===String(U.id)?"true":void 0},...je?[i("td",{class:"fd-list-check"},je)]:[],...w?[i("td",{class:"fd-list-tree"})]:[],...n.columns.map(He=>W(i("td",{class:D(He)?"fd-num":void 0,"data-name":w&&He===j?"":void 0},...Ie(He,U.values)),He)));return Ke.addEventListener("click",He=>{let pt=He.target.closest("td");if(pt?.classList.contains("fd-list-check")){He.target===pt&&je?.click();return}He.target.closest(".fd-list-twisty")||ee(U.id)}),Ke.addEventListener("keydown",He=>{if(He.target!==Ke)return;let pt=Ke.closest("[dir]")?.getAttribute("dir")==="rtl"?"ArrowLeft":"ArrowRight";He.key==="Enter"?(He.preventDefault(),ee(U.id)):He.key===" "&&je?(He.preventDefault(),je.click()):He.key==="ArrowDown"||He.key==="ArrowUp"?(He.preventDefault(),ge(Ke,He.key==="ArrowDown")?.focus()):(He.key==="ArrowRight"||He.key==="ArrowLeft")&&Ke.hasAttribute("data-parent-of")&&(He.preventDefault(),Se(String(U.id),He.key!==pt))}),Ke.addEventListener("mouseenter",()=>bt?.highlight(U.id)),Ke.addEventListener("mouseleave",()=>bt?.highlight(null)),Ke.addEventListener("focus",()=>bt?.highlight(U.id)),h.set(Ke,U),Ke}let Oe=new Set;function Xe(U){if(!w)return U.map(Qe=>ke(Qe));let de=new Set(U.map(Qe=>String(Qe.id))),Fe=Qe=>{let Je=ms(Qe.values[w]);return Je!=null&&de.has(String(Je))&&String(Je)!==String(Qe.id)?String(Je):null},je=new Map;for(let Qe of U){let Je=Fe(Qe);Je&&je.set(Je,[...je.get(Je)??[],Qe])}let Ke=[],He=new Set,pt=(Qe,Je,zt)=>{let Nt=String(Qe.id);if(He.has(Nt))return;He.add(Nt);let Wt=ke(Qe);Wt.style.setProperty("--fd-depth",String(Je)),Wt.setAttribute("data-depth",String(Je)),Wt.hidden=zt;let nn=je.get(Nt)??[],Tn=Wt.querySelector(":scope > td[data-name]");if(nn.length){Wt.setAttribute("data-parent-of",String(nn.length)),Wt.setAttribute("aria-expanded",String(!Oe.has(Nt)));let sn=i("button",{type:"button",class:"fd-list-twisty",tabindex:"-1","aria-expanded":String(!Oe.has(Nt)),"aria-label":F(j,Qe.values)||Nt});sn.addEventListener("click",()=>Se(Nt,sn.getAttribute("aria-expanded")==="true")),Tn?.prepend(sn)}else Tn?.prepend(i("span",{class:"fd-list-twisty-room","aria-hidden":"true"}));Ke.push(Wt);for(let sn of nn)pt(sn,Je+1,zt||Oe.has(Nt))};for(let Qe of U)Fe(Qe)||pt(Qe,0,!1);for(let Qe of U)pt(Qe,0,!1);return Ke}function Se(U,de){de?Oe.add(U):Oe.delete(U),tt()}function tt(){let U=[];for(let de of G.querySelectorAll(":scope > .fd-list-row[data-depth]")){let Fe=Number(de.dataset.depth);for(;U.length&&U[U.length-1].depth>=Fe;)U.pop();de.hidden=U.some(He=>He.closed);let je=de.dataset.id??"",Ke=de.querySelector(":scope > td > .fd-list-twisty");Ke?.setAttribute("aria-expanded",String(!Oe.has(je))),Ke&&de.setAttribute("aria-expanded",String(!Oe.has(je))),de.hasAttribute("data-parent-of")&&U.push({depth:Fe,closed:Oe.has(je)})}}te.addEventListener("click",()=>{Oe.clear(),tt()}),Y.addEventListener("click",()=>{for(let U of G.querySelectorAll(":scope > .fd-list-row[data-parent-of]"))Oe.add(U.dataset.id??"");tt()});let Z=i("span",{class:"fd-list-count",role:"status"}),re=i("button",{type:"button",class:"fd-button fd-button-link"},o.clearSelection),ae=(n.actions??[]).map(U=>{let de=i("button",{type:"button",class:`fd-button fd-button-${U.style??"secondary"}`,"data-node":U.id},...e.withIcon(U.icon,U.label));return de.addEventListener("click",()=>{e.press(de,async()=>{let Fe=await r.runAction(U.id,{recordIds:[...m]});return await Promise.all([ce(),bt?.reload()]),Fe})}),de}),Re=i("div",{class:"fd-list-selection",hidden:""},Z,...ae,re);re.addEventListener("click",()=>{m.clear();for(let U of G.querySelectorAll(".fd-list-checkbox"))U.checked=!1;De()}),z.addEventListener("change",()=>{for(let U of v())z.checked?m.add(U.id):m.delete(U.id);for(let U of G.querySelectorAll(".fd-list-checkbox"))U.checked=z.checked;De()});function De(){let U=v(),de=U.filter(Fe=>m.has(Fe.id)).length;if(z.checked=U.length>0&&de===U.length,z.indeterminate=de>0&&de<U.length,Re.hidden=m.size===0,Z.textContent=a(o.selected,{n:m.size}),!!$)for(let Fe of G.querySelectorAll(".fd-list-row"))Fe.setAttribute("aria-selected",String([...m].some(je=>String(je)===Fe.dataset.id)))}let gt=i("span",{class:"fd-pager-text"}),Ge=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.previousPage},"\u2039"),Ae=i("button",{type:"button",class:"fd-button fd-pager-button","aria-label":o.nextPage},"\u203A"),Ve=i("div",{class:"fd-pager",role:"group"},gt,Ge,Ae);Ge.addEventListener("click",()=>{y=Math.max(0,y-l),ce()}),Ae.addEventListener("click",()=>{y+=l,ce()});function pe(){Ve.hidden=u===0||A&&y===0&&u<=l,gt.textContent=a(o.range,{from:y+1,to:Math.min(y+k.length,u),total:u}),Ge.disabled=y===0,Ae.disabled=y+l>=u}function le(){for(let U of M){let de=!f[0]?.near&&f[0]?.field===U.dataset.field?f[0]:null;de?U.setAttribute("aria-sort",de.desc?"descending":"ascending"):U.removeAttribute("aria-sort")}}function me(){if(Kt==="list"){let U=new Set(v().map(de=>de.id));for(let de of[...m])U.has(de)||m.delete(de)}De(),bt?.chosenChanged()}let he=U=>({page:t,el:i,labels:o,fill:a,dataSource:U,model:b,fields:I,columns:n.columns.length+C,pageSize:l,sort:()=>f,recordRow:ke,changed:me});async function ce(){let U=++x;le(),_.setAttribute("aria-busy","true");let de=[];try{let Fe=[...e.fixedFilter??[],...ri(E,n)],je=_i(E),Ke=e.dataSource;if(je.length&&Ke?.groups&&Ke.list){let He=await Ke.groups({model:b,field:je[0],filter:Fe});if(U!==x||g)return;k=[],u=0,de=He.map(pt=>us(he(Ke),pt,0,Fe,je))}else{let He=Ke?.list?await Ke.list({model:b,fields:I,filter:Fe,sort:f,offset:y,limit:l}):{records:[],total:0};if(U!==x||g)return;if(!He.records.length&&He.total>0&&y>0)return y=Math.floor((He.total-1)/l)*l,ce();k=He.records,u=He.total,de=Xe(k)}Ne.hidden=!0}catch{if(U!==x||g)return;k=[],u=0,Ne.hidden=!1}G.replaceChildren(...de),Q.hidden=de.length>0||!Ne.hidden,_.removeAttribute("aria-busy"),pe(),me()}let Ze=U=>{E=U,y=0,ce(),bt?.reload()},vt=n.search==="fields"?Dr.loaded:void 0,Tt=vt?vt.filterBar({page:t,node:n,doc:d,el:i,labels:o,fill:a,uid:e.uid,icons:e.icons,preferences:e.preferences,dataSource:e.dataSource,model:b,fixedFilter:()=>e.fixedFilter??[],facets:E,onChange:Ze}):Bc({page:t,node:n,doc:d,el:i,labels:o,fill:a,uid:e.uid,icons:e.icons,preferences:e.preferences,facets:E,onChange:Ze}),an=n.map?e.views?.map:void 0,Kt=an?n.map?.view??"list":"list",bt=null,Ht=i("div",{class:"fd-list-map"}),en=()=>[...e.fixedFilter??[],...ri(E,n)];function Dt(){bt||!an||(bt=an({page:t,node:n,dataSource:e.dataSource,document:d,locale:s,icons:e.icons,filter:en,isChosen:U=>m.has(U),choose(U,de){de?m.add(U):m.delete(U);for(let Fe of G.querySelectorAll(".fd-list-row")){if(Fe.dataset.id!==String(U))continue;let je=Fe.querySelector(".fd-list-checkbox");je&&(je.checked=de)}De(),bt?.chosenChanged()},...e.onOpenRecord?{open:U=>{ee(U)}}:{},highlight(U){for(let de of G.querySelectorAll(".fd-list-row")){let Fe=U!==null&&de.dataset.id===String(U);de.classList.toggle("fd-list-hot",Fe),Fe&&Kt==="both"&&de.scrollIntoView({block:"nearest"})}},addSearch:({label:U,filter:de})=>Tt.add({kind:"custom",label:U,filter:de}),sort:()=>f,sortBy(U){f=U??c,y=0,ce(),bt?.reload()},actions:(n.actions??[]).map(U=>({id:U.id,label:U.label,...U.style?{style:U.style}:{}})),act:(U,de,Fe)=>e.press(Fe,async()=>{let je=await r.runAction(U,{recordIds:de});return await Promise.all([ce(),bt?.reload()]),je})}),Ht.append(bt.element),bt.reload())}let jt=["list","map","both"].map(U=>{let de=i("button",{type:"button",class:"fd-button fd-list-view","data-view":U,"aria-pressed":"false"},U==="list"?o.viewList:U==="map"?o.viewMap:o.viewBoth);return de.addEventListener("click",()=>tn(U)),de}),Gn=i("div",{class:"fd-list-views",role:"group","aria-label":o.showAs},...jt);Gn.hidden=!an;function tn(U){Kt=U,Mt.dataset.view=Kt;for(let de of jt)de.setAttribute("aria-pressed",String(de.dataset.view===Kt));Kt!=="list"&&(Dt(),bt?.shown())}let Mt=i("div",{class:"fd-list","data-node":n.id,"data-search":A?"fields":void 0,"data-choose":$?void 0:"none"},i("div",{class:"fd-list-bar"},Tt.element,Gn,...A?[]:[Ve]),...$?[Re]:[],i("div",{class:"fd-list-body"},i("div",{class:"fd-list-records"},i("div",{class:"fd-list-scroll"},_),Q,Ne,...A?[Ve]:[]),Ht));return tn(Kt),ce(),{element:Mt,reload:async()=>{await Promise.all([ce(),bt?.reload()])},open:(U,de)=>ee(U,de?.lit!==!1),destroy(){g=!0,Tt.destroy(),bt?.destroy()}}}function qo(e,t){let n=e.style??"card",r=n==="plain"&&!e.title,i=pn(e.columns),o=e.colspan??1,a=r&&t.columns>1?o===1&&i>1?"shared":"tracks":void 0;return{style:n,arrangement:r,at:a,inner:{columns:a==="tracks"?Math.min(o,t.columns):i,onPage:t.onPage&&(n==="plain"||n==="line"),labels:e.labels??t.labels,quiet:e.quiet??t.quiet,reason:e.readonlyReason??t.reason}}}var bm=new Set(["one2many","matrix"]);function Ei(e,t,n){if(t==="boolean"&&e.widget==="tick")return"after";let r=e.labels??n;return r==="beside"&&bm.has(t)?"above":r}async function _c(e,t){let{options:n}=e,r=n.onOpen?.(t);if(r)return r;let i=await Li(n,t.version===void 0?{id:t.page}:{id:t.page,version:t.version});if(!i)throw new Error(e.missing(t.page));let o=n.page.look,a={...n,page:o&&!i.look?{...i,look:o}:i,form:void 0,recordId:t.recordId??null,values:t.values,listFilter:t.filter,drafts:void 0,autosave:void 0,readonly:void 0,editSwitch:void 0,saveStatus:void 0,records:void 0,breadcrumbs:void 0},s=t.title??e.title(i),d={...a,host:{...n.host,say:e.say,post:e.post}},l=t.as==="page"?await ym(e,{...a,host:{...n.host,post:e.post}}):t.as==="panel"?await ls({...d,title:s,side:t.side}):await Wr({...d,title:s,size:i.layout.type==="sheet"?"large":"medium"}),c=fs(i),f=c?l.values[c]:void 0;return{...l,...typeof f=="string"&&f?{label:f}:{}}}function ym(e,t){let{place:n,root:r}=e,i=n.ownerDocument,o=i.activeElement;return new Promise(a=>{let s=!1,d=u=>{if(s)return;s=!0;let k=c.form.getState();c.destroy(),r.hidden=!1,o?.isConnected&&o.focus(),a({saved:u,recordId:k.recordId??null,values:k.values})};r.hidden=!0;let l=e.options.breadcrumbs?[...e.options.breadcrumbs,{label:e.name(),open:()=>d(!1)}]:void 0,c=Si(n,{...t,breadcrumbs:l,host:{...t.host,close:()=>d(!1)}}),f=i.createElement("button");f.type="button",f.className="fd-button fd-button-link fd-back",f.textContent=e.back,f.addEventListener("click",()=>d(!1)),c.element.querySelector(".fd-breadcrumbs")||c.element.prepend(f);let y=()=>{c.form.settled().then(()=>d(!0))};c.on("save",y),c.on("send",y),(jo(c.element)??c.element.querySelector(ki)??f).focus()})}function Uc(e,t,n){let r=t("div",{class:"fd-says",role:"status","aria-live":"polite"});return e.append(r),(i,o)=>{let a=t("button",{type:"button",class:"fd-alert-close","aria-label":n},"\xD7"),s=t("div",{class:"fd-say","data-tone":o},t("span",{},i),a);s.style.setProperty("--fd-tone",`var(--fd-${o==="danger"?"error":o})`);let d,l=()=>clearTimeout(d),c=()=>{l(),s.remove()},f=()=>{l(),d=setTimeout(c,o==="warning"||o==="danger"?1e4:6e3)};for(a.addEventListener("click",c),s.addEventListener("mouseenter",l),s.addEventListener("focusin",l),s.addEventListener("mouseleave",f),s.addEventListener("focusout",f),r.append(s);r.children.length>4;)r.firstElementChild?.remove();xm(r,t,i),f()}}function xm(e,t,n){let r=[...e.ownerDocument.querySelectorAll('[aria-modal="true"]')].filter(a=>!a.contains(e)),i=r[r.length-1];if(!i)return;let o=i.querySelector(":scope > .fd-says-echo");o||(o=t("div",{class:"fd-says-echo fd-sr-only",role:"status","aria-live":"polite"}),i.append(o)),o.textContent=n}var Hr=64;function Kc(e,t){let n=()=>e.closest("[dir]")?.getAttribute("dir")==="rtl",r=y=>t("button",{type:"button",class:`fd-tabs-scroll fd-tabs-${y}`,tabindex:"-1","aria-hidden":"true",hidden:""}),i=r("before"),o=r("after"),a=t("div",{class:"fd-tabbar"},i,e,o),s=y=>e.scrollBy({left:y*(n()?-1:1)*Math.max(e.clientWidth-2*Hr,Hr),behavior:"smooth"});i.addEventListener("click",()=>s(-1)),o.addEventListener("click",()=>s(1));function d(){let y=Math.abs(e.scrollLeft),u=y>1,k=y+e.clientWidth<e.scrollWidth-1;at(i,!u),at(o,!k);let h=[u&&"start",k&&"end"].filter(Boolean).join(" ");yt(a,"data-more",h||null)}function l(y){if(!e.clientWidth||e.scrollWidth<=e.clientWidth)return;let u=e.getBoundingClientRect(),k=y.getBoundingClientRect();k.left<u.left+Hr?e.scrollLeft+=k.left-u.left-Hr:k.right>u.right-Hr&&(e.scrollLeft+=k.right-u.right+Hr),d()}e.addEventListener("scroll",d,{passive:!0});let c=e.ownerDocument.defaultView,f=c&&"ResizeObserver"in c?new c.ResizeObserver(()=>d()):null;return f?.observe(e),{element:a,measure:d,reveal:l,destroy:()=>f?.disconnect()}}function gs(e,t,n,r){let i=xr(n);if(!i.some(s=>s.field))return{nodes:[n],update:()=>{}};let o=[];return{nodes:i.map(s=>{if(!s.field)return s.text;let d=e.createElement("bdi");return d.className="fd-value",d.dataset.field=s.field,o.push({field:s.field,span:d}),d}),update(s){for(let{field:d,span:l}of o){let c=t[d],f=c?It(c,s[d],s,r):"";l.textContent!==f&&(l.textContent=f)}}}}var vm=e=>/^image\//.test(e.type)||/pdf/i.test(e.type)||/\.pdf$/i.test(e.name),wm=e=>(Array.isArray(e)?e:e?[e]:[]).filter(t=>t&&typeof t=="object"&&"name"in t);function Gc(e){let{el:t,form:n,labels:r,node:i}=e,o=t("span",{class:"fd-attachment-name",dir:"auto"}),a=t("span",{class:"fd-attachment-count",dir:"ltr"}),s=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.previousAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u2039")),d=t("button",{type:"button",class:"fd-button fd-record-step","aria-label":r.nextAttachment},t("span",{"aria-hidden":"true",class:"fd-record-arrow"},"\u203A")),l=t("a",{class:"fd-button fd-button-link fd-attachment-open",target:"_blank",rel:"noopener"},r.openAttachment),c=t("div",{class:"fd-attachment-body"}),f=t("aside",{class:"fd-attachment-preview",hidden:""},t("div",{class:"fd-attachment-head"},o,a,s,d,l),c),y=[],u=0,k=null,h,v=0,b,E;function m(){k?.free(),k=null;let w=y[u];if(!w)return c.replaceChildren();let L=Ma(e.doc,w);k=L,c.replaceChildren(...L?[L.element]:[]),$t(o,w.name),$t(a,y.length>1?e.fill(r.recordAt,{n:u+1,total:y.length}):""),at(s,y.length<2),at(d,y.length<2),yt(l,"href",L?.url??null),yt(f,"aria-label",e.fill(r.attachment,{name:w.name}))}let x=w=>{u=(u+w+y.length)%y.length,m()};s.addEventListener("click",()=>x(-1)),d.addEventListener("click",()=>x(1));let g=w=>{y=w.filter(vm),u=0,m(),$()},$=()=>at(f,n.node("#preview").invisible||!y.length);function A(w){let L=e.dataSource,S=++v;if(h=w.recordId,w.recordId==null||!L?.attachments||e.page.data.kind!=="record")return g([]);L.attachments({model:e.page.data.model,id:w.recordId,fields:e.page.fields}).then(I=>S===v&&g(I),()=>S===v&&g([]))}return{element:f,update(w){if(i.field){let L=w.values[i.field];L!==E&&(E=L,g(wm(L)))}else w.status!=="loading"&&w.status!=="idle"&&(w.recordId!==h||w.status==="saved"&&b!=="saved")&&A(w);b=w.status,$()},destroy:()=>k?.free()}}var km='.fd-record-bar{display:flex;flex-wrap:wrap;align-items:center;gap:6px 12px;min-height:46px;box-sizing:border-box;padding:6px 16px;background:var(--fd-surface);border-block-end:1px solid var(--fd-border)}.fd-form>.fd-content>.fd-record-bar{margin:-4px 0 12px;border-radius:var(--fd-radius);border:1px solid var(--fd-border)}.fd-breadcrumbs{min-width:0}.fd-breadcrumbs ol{display:flex;flex-wrap:wrap;align-items:center;list-style:none;margin:0;padding:0;font-size:17px;line-height:1.3}.fd-breadcrumbs li{display:flex;align-items:center;min-width:0}.fd-breadcrumbs li+li:before{content:"/";color:var(--fd-muted);padding-inline:8px}.fd-crumb{all:unset;cursor:pointer;color:var(--fd-accent);border-radius:2px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-crumb:hover{text-decoration:underline}.fd-crumb:focus-visible{outline:2px solid var(--fd-focus);outline-offset:2px}.fd-crumb-current{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fd-record-actions{position:relative}.fd-record-actions[hidden]{display:none}.fd-record-gear{display:inline-flex;align-items:center;gap:6px}.fd-record-gear svg{width:16px;height:16px;flex:none}.fd-record-menu{position:absolute;z-index:40;inset-block-start:calc(100% + 4px);inset-inline-start:0;display:grid;min-width:220px;max-width:min(320px,90vw);padding:4px;box-sizing:border-box;background:var(--fd-surface);color:var(--fd-text);border:1px solid var(--fd-border);border-radius:max(var(--fd-control-radius),4px);box-shadow:0 8px 24px #00000029}.fd-record-menu[data-end]{inset-inline-start:auto;inset-inline-end:0}.fd-record-menu[hidden],.fd-record-menu [hidden]{display:none}.fd-record-menu [role=group]{display:grid}.fd-record-menu-heading{padding:6px 12px 2px;font-size:12px;font-weight:600;letter-spacing:.04em;text-transform:uppercase;color:var(--fd-muted)}.fd-record-menu-rule{margin:4px 0;border-block-start:1px solid var(--fd-border)}.fd-record-menu-item{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:8px;min-height:34px;padding:6px 12px;border-radius:3px;cursor:pointer;color:var(--fd-text)}.fd-record-menu-item svg{width:16px;height:16px;flex:none;color:var(--fd-muted)}.fd-record-menu-item:hover,.fd-record-menu-item:focus{background:var(--fd-accent-soft)}.fd-record-menu-item:focus-visible{outline:2px solid var(--fd-focus);outline-offset:-2px}.fd-record-menu-danger{color:var(--fd-error)}.fd-record-pager{display:flex;align-items:center;gap:4px;margin-inline-start:auto}.fd-record-pager[hidden]{display:none}.fd-record-pager-text{padding-inline-end:6px;font-variant-numeric:tabular-nums;color:var(--fd-muted);white-space:nowrap}.fd-record-step{min-width:34px;padding-inline:8px;font-size:18px;line-height:1}.fd-record-step[aria-disabled=true]{opacity:.5;cursor:default}@container fd-form (max-width: 520px){.fd-record-bar{padding-inline:12px;gap:6px 8px}.fd-record-gear-words{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}.fd-breadcrumbs ol{flex-wrap:nowrap;font-size:15px}.fd-breadcrumbs li:not(:nth-last-child(-n+2)){display:none}.fd-breadcrumbs li:nth-last-child(2):before{content:"\u2039";padding-inline:0 6px;font-size:20px;color:var(--fd-accent)}}.fd-attachment-preview{display:grid;grid-template-rows:auto minmax(0,1fr);min-width:0;background:var(--fd-surface);border:1px solid var(--fd-border);border-radius:var(--fd-radius);overflow:hidden}.fd-attachment-preview[hidden]{display:none}.fd-attachment-head{display:flex;align-items:center;gap:6px;padding:6px 8px 6px 12px;padding-inline:12px 8px;border-block-end:1px solid var(--fd-border);min-width:0}.fd-attachment-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:600}.fd-attachment-count{color:var(--fd-muted);font-variant-numeric:tabular-nums;white-space:nowrap}.fd-attachment-head [hidden]{display:none}.fd-attachment-body{display:grid;min-height:0;background:var(--fd-page)}.fd-attachment-body>iframe{width:100%;height:100%;min-height:70vh;border:0;background:#fff}.fd-attachment-body>img{display:block;max-width:100%;max-height:80vh;margin:auto;object-fit:contain}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){max-width:none;grid-template-columns:minmax(0,3fr) minmax(320px,2fr);grid-template-rows:auto 1fr}.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden]))>:is(.fd-card,.fd-side){grid-column:1}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:2;grid-row:1 / span 2;position:sticky;top:8px;height:calc(100vh - 16px);max-height:1200px}@container (max-width: 1000px){.fd-sheet-layout.fd-has-preview:has(>.fd-attachment-preview:not([hidden])){grid-template-columns:minmax(0,1fr)}.fd-sheet-layout.fd-has-preview>.fd-attachment-preview{grid-column:1;grid-row:auto;position:static;height:auto}.fd-attachment-body>iframe{min-height:60vh}}@container (max-width: 1000px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr) minmax(240px,300px)}}@container (max-width: 600px){.fd-sheet-layout.fd-has-side[data-side-beside=always]:not(:has(>.fd-attachment-preview:not([hidden]))){grid-template-columns:minmax(0,1fr)}}';function Jc(e){if(e.getElementById("fd-record-styles"))return;let t=e.createElement("style");t.id="fd-record-styles",t.textContent=km,(e.head??e.documentElement).append(t)}var Sm=0;function Si(e,t){let n={...t},r=e.ownerDocument,i=Qr(n.page,n.parent?{parent:n.parent.fields}:{});if(!i.ok)throw new Error(`This page cannot be shown:
|
|
63
|
+
${i.issues.map(T=>` ${T.path}: ${T.message}`).join(`
|
|
64
|
+
`)}`);let o=n.locale??i.page.language,a=o?ei(i.page,o):i.page,s=n.translate?wr(a,n.translate):a,d=T=>{let q=o?ei(T,o):T;return n.translate?wr(q,n.translate):q},l=vi(o),c=n.preferences??ns(),f=Dc(n,(T,q)=>k.say(T,q)),y=!n.form,u={...Zt[l],...n.labels},k={open:T=>_c({options:n,place:e,root:O,title:q=>d(q).title||q.id,back:u.back,missing:q=>L(u.pageMissing,{page:q}),say:(q,ne)=>k.say(q,ne),post:q=>h.post(q),name:()=>Gn()||u.newRecord},T),say:(T,q)=>H(T,q),ask:T=>B(T),show:T=>{if(!C.get(T)?.())throw new Error(`No tab "${T}" can be shown here`)},openUrl:(T,q)=>q?r.defaultView?.open(T,"_blank","noopener,noreferrer"):r.defaultView?.location.assign(T),...n.host},h=n.form??Yi({...n,page:s,host:k,messages:n.messages??qt[l]}),v=ot[l],b=n.dir??(o&&Zn(o)?"rtl":void 0),E=`fd${++Sm}`,m=[],x=m,g=[],$=!1,A=T=>`${E}-${T.replace(/[^A-Za-z0-9_-]/g,"_")}`,w=A,L=(T,q)=>T.replace(/\{(\w+)\}/g,(ne,oe)=>String(q[oe]??""));wo(r),Jc(r);function S(T,q={},...ne){let oe=r.createElement(T);for(let[be,Le]of Object.entries(q))Le!==void 0&&oe.setAttribute(be,Le);return oe.append(...ne),oe}function I(T,q){let ne=rt(r,T,n.icons),oe=S("bdi",{},q);return ne?[ne,oe]:[oe]}function F(T){let q=T.count!==void 0?[S("span",{class:"fd-tab-count","aria-hidden":"true"},"0")]:[];if(!T.iconOnly)return[...I(T.icon,T.label),...q];let ne=rt(r,T.icon,n.icons);return[...ne?[ne]:[],...q]}function D(T,q){let ne=Fm(T),oe=q?ne.toLocaleLowerCase().indexOf(q):-1;return oe===-1?[ne]:[S("span",{class:"fd-label-words"},ne.slice(0,oe),S("span",{class:"fd-access-key"},ne.slice(oe,oe+1)),ne.slice(oe+1))]}let W={doc:r,labels:v,icons:n.icons,withIcon:I,el:S},j=n.theme??s.look?.theme,O=S("form",{class:"fd-form",novalidate:"","data-fd-skin":Un(n.skin??s.look?.skin,j),dir:b,lang:o,"data-max-width":s.maxWidth});cr(O,j?{...s.look,theme:j}:s.look),Kn(O,n.tokens);let B=n.confirm??qr,H=Uc(O,S,u.dismiss),C=new Map,z=new Map;async function M(T,q){if(!T.hasAttribute("aria-busy")){T.setAttribute("aria-busy","true"),T.setAttribute("aria-disabled","true");try{let{reason:ne}=await q();(ne==="check"||ne==="save")&&(h.getState().saveProblem||ce(Ve(h.getState())),bt())}finally{T.removeAttribute("aria-busy"),T.removeAttribute("aria-disabled")}}}let te=[],Y=[],G=[],_=new Map,Q=()=>xn(h.getState()),$e=null,Ne=!1,Ie=!1,Pe=!1;function ee(T,q){q&&T.style.setProperty("--fd-span",String(q))}let ge=T=>({columns:1,onPage:T,labels:s.look?.labels});function ke(T){let{form:q,page:ne}=T,oe=V=>A(T.prefix+V),be=V=>x.push(T.root?V:()=>V(q.getState()));function Le(V,ie,ue={}){let fe=ne.fields[V.field],Ce=oe(V.id),We=Ei(V,fe.type,ie),we=S("div",{class:"fd-field","data-node":V.id,"data-field":V.field,"data-path":T.path+V.field,"data-type":fe.type,"data-labels":We,"data-focus":V.focus&&T.root?"":void 0});V.colspan&&we.style.setProperty("--fd-span",String(V.colspan));let Ye=V.label??fe.label,st=S("label",{class:"fd-label",id:`${Ce}-label`,for:Ce},...D(Ye,V.hotkey)),dt=n.showValid&&!Rm.has(fe.type)?rt(r,"check"):null;dt&&(dt.classList.add("fd-valid-mark"),st.append(dt));let ze=Xt({form:q,name:V.field,field:fe,node:V,id:Ce,document:r,labels:v,preferences:c,locale:l,dialogs:f},n.widgets);Ac(we,ze),V.focus&&T.root&&te.push({wrapper:we,focus:()=>ze.focus()}),V.hotkey&&(Y.push({key:V.hotkey,wrapper:we,focus:()=>ze.focus()}),(ze.element.matches(Yc)?ze.element:ze.element.querySelector(Yc))?.setAttribute("aria-keyshortcuts",In(V.hotkey)));let Bt=ze.element.matches(Xc)?ze.element:ze.element.querySelector(Xc);We==="hidden"&&!V.placeholder&&Bt?.setAttribute("placeholder",Ye);let qe=Bt?.getAttribute("placeholder")??null,wt=V.placeholderWhen?.length?Bt:null,Rt=V.quiet??ue.quiet,Ft=fo(fe,V),kt=()=>Rt??O.getAttribute("data-fd-skin")==="quiet",Gt=!!V.placeholder||We==="hidden"||fe.type==="json"||fe.type==="properties",ft=ne.look?.quietHints===!1?null:Zc(Ye,l,u),on=()=>!Gt&&we.hasAttribute("data-quiet")?ft:qe,vn=V.placeholder||(We==="hidden"?Ye:ft??""),Kr=ze.element instanceof HTMLSelectElement?ze.element.querySelector(':scope > option[value=""]'):null,Mn=ze.element.matches(".fd-richtext")?ze.element:ze.element.querySelector(":scope > .fd-richtext"),hs=ze.element.querySelector(":scope > .fd-dot-label"),bs=()=>{let et=kt(),Vt=Ft&&et;we.toggleAttribute("data-in-quiet",et),we.toggleAttribute("data-quiet",Vt),Bt&&!wt&&yt(Bt,"placeholder",on()),Kr&&(Kr.textContent=Vt?vn:""),Mn&&!V.placeholder&&(yt(Mn,"data-placeholder",Vt?ft:null),yt(Mn,"aria-placeholder",Vt?ft:null)),hs&&yt(hs,"data-hint",Vt?vn:null)};G.push(bs),bs(),["INPUT","SELECT","TEXTAREA"].includes(ze.element.tagName)||((ze.element.getAttribute("role")?ze.element:ze.element.querySelector(`[id="${Ce}"][role]`))?.setAttribute("aria-labelledby",st.id),st.addEventListener("click",Vt=>{Vt.target.closest?.(".fd-help-tip-wrap, .fd-lock-wrap")||ze.focus()}));let Ri=V.help??fe.help,ys=V.helpShown??ne.look?.helpShown??"below",Go=Ri&&ys!=="tooltip"?S("div",{class:"fd-help",id:`${Ce}-help`},Ri):null,Yn=Ri&&ys!=="below"?p(`${Ce}-tip`,Ri,L(u.helpFor,{label:Ye})):null;Yn&&We==="hidden"?ze.element.after(Yn.element):Yn&&(st.append(Yn.element),st.dir="auto");let Gr=V.readonlyReason??ue.reason,tf=V.readonly===!0||fe.readonly===!0||fe.compute!==void 0,Jr=null,Nn=null,Yr=!1,nf=()=>{if(Nn)return Nn;let et=rt(r,"lock",n.icons)??"";return Jr=Gr?R(`${Ce}-lock`,Gr,L(u.locked,{label:Ye}),"fd-lock",et):null,Nn=Jr?.element??S("span",{class:"fd-lock-wrap"},S("span",{class:"fd-lock","aria-hidden":"true"},et)),ne.look?.lockAt==="value"?(ze.element.before(Nn),we.setAttribute("data-lock-at","value")):We==="hidden"?ze.element.after(Nn):st.insertBefore(Nn,Yn&&We!=="after"?Yn.element:null),Nn},Jo=et=>Jr?.point(et&&Yr&&we.hasAttribute("data-in-quiet"));if(Gr)for(let[et,Vt]of[["mouseenter",!0],["mouseleave",!1],["focusin",!0],["focusout",!1]])ze.element.addEventListener(et,()=>Jo(Vt));let Fi=S("div",{class:"fd-error",id:`${Ce}-error`,hidden:""}),Ai=S("div",{class:"fd-warning",id:`${Ce}-warning`,role:"status",hidden:""});we.append(...We==="after"?[ze.element,st]:[st,ze.element],...Go?[Go]:[],Fi,Ai);let Xn=ne.look?.readonlyShown==="text"&&rs(fe,V)?is({document:r,field:fe,node:V,id:Ce,locale:l,labels:v,dialogs:f}):null;if(Xn&&ze.element.after(Xn.element),Xn&&Gr)for(let[et,Vt]of[["mouseenter",!0],["mouseleave",!1]])Xn.element.addEventListener(et,()=>Jo(Vt));ze.destroy&&g.push(()=>ze.destroy?.());let Yo=!1,xs="";we.addEventListener("focusin",()=>Yo=!0),we.addEventListener("focusout",et=>{we.contains(et.relatedTarget)||(Yo=!1,queueMicrotask(()=>vs(q.getState())))});let $i;we.addEventListener("focusin",et=>{we.contains(et.relatedTarget)||($i=q.getState().values[V.field])}),g.push(q.on("open",({values:et})=>{we.contains(r.activeElement)&&($i=et[V.field])})),we.addEventListener("keydown",et=>{et.key!=="Escape"||et.defaultPrevented||!we.hasAttribute("data-quiet")||JSON.stringify(q.getState().values[V.field]??null)!==JSON.stringify($i??null)&&(et.preventDefault(),et.stopPropagation(),q.setValue(V.field,$i??null))});let rf=V.tones!==void 0||V.bold!==void 0,vs=et=>{let Vt=q.node(V.id);if(at(we,Vt.invisible),we.classList.toggle("fd-required",Vt.required),rf){let Pn=q.fieldTone(V.id);yt(we,"data-tone",Pn.tone),we.classList.toggle("fd-value-bold",Pn.bold)}wt&&yt(wt,"placeholder",q.placeholder(V.id)??on());let hr=et.errors[V.field];at(Fi,!hr),$t(Fi,hr??"");let ws=et.warnings[V.field]??"";(!Yo||!ws)&&(xs=ws);let Xo=[hr?"":xs,et.warning&&et.warningField===V.field?et.warning:""].filter(Boolean).join(" ");if(at(Ai,!Xo),$t(Ai,Xo),dt){let Pn=et.values[V.field],of=Pn!=null&&Pn!==""&&!(Array.isArray(Pn)&&!Pn.length),Ss=!Vt.readonly&&!hr&&of&&et.dirty.includes(V.field)&&q.problem(V.field)===null;we.classList.toggle("fd-valid",Ss),dt.toggleAttribute("hidden",!Ss)}let br=Vt.readonly||ae||T.locked(),ks=we.hasAttribute("data-quiet");Yr=br&&!ae;let Zo=Yr&&(!!Gr||we.hasAttribute("data-in-quiet")&&!tf);(Zo||Nn)&&at(nf(),!Zo),Yr||Jo(!1),yt(we,"data-locked",ks&&Zo?"":null),yt(we,"data-empty",ks&&Lm(et.values[V.field])?"":null),Xn&&(at(ze.element,br),at(Xn.element,!br),yt(we,"data-read-text",br?"":null),br&&Xn.update(et.values[V.field],et.values)),ze.update({value:et.values[V.field],values:et.values,readonly:br,required:Vt.required,invalid:!!hr,describedBy:[Go?.id??Yn?.bubble.id,Jr&&Yr?Jr.bubble.id:void 0,hr?Fi.id:void 0,Xo?Ai.id:void 0].filter(Boolean).join(" ")||void 0})};return be(vs),we}function p(V,ie,ue){return R(V,ie,ue,"fd-help-tip","?")}function R(V,ie,ue,fe,Ce){let We=S("span",{class:"fd-help-bubble",role:"tooltip",id:V,hidden:""},ie),we=S("button",{type:"button",class:fe,"aria-label":ue,"aria-expanded":"false","aria-controls":V},Ce);fe==="fd-lock"&&we.setAttribute("aria-describedby",V);let Ye=!1,st=dt=>{We.hidden=!dt,we.setAttribute("aria-expanded",String(dt)),dt&&P(We)};return we.addEventListener("mouseenter",()=>st(!0)),we.addEventListener("mouseleave",()=>st(Ye)),we.addEventListener("focus",()=>st(!0)),we.addEventListener("blur",()=>(Ye=!1,st(!1))),we.addEventListener("click",dt=>{dt.preventDefault(),Ye=!Ye,st(Ye)}),we.addEventListener("keydown",dt=>{dt.key!=="Escape"||We.hidden||(dt.stopPropagation(),Ye=!1,st(!1))}),{element:S("span",{class:fe==="fd-lock"?"fd-lock-wrap":"fd-help-tip-wrap"},we,We),bubble:We,point:dt=>st(dt||Ye)}}function P(V){V.style.transform="";let ie=V.getBoundingClientRect(),ue=r.documentElement.clientWidth,fe=8,Ce=ie.right>ue-fe?ue-fe-ie.right:ie.left<fe?fe-ie.left:0;Ce&&(V.style.transform=`translateX(${Math.round(Ce)}px)`)}function N(V,ie){be(()=>at(V,q.node(ie).invisible))}function K(V){let ie=go(V)?Qt.loaded:void 0;if(ie){let fe=ie.richButton({doc:r,el:S,form:q,labels:u,icons:n.icons,uid:oe,withIcon:I,press:M,say:(Ce,We)=>k.say(Ce,We),watch:be,cleanups:g},V);return ee(fe,V.colspan),nt(V,fe)}let ue=S("button",{type:"button",class:`fd-button fd-button-${V.style??"secondary"}`,"data-node":V.id},...I(V.icon,V.label));return V.hotkey&&Rn(ue,V.hotkey,V.label),ee(ue,V.colspan),ue.addEventListener("click",()=>{ho(V,q,(fe,Ce)=>k.say(fe,Ce),u)||M(ue,()=>q.runAction(V.id))}),N(ue,V.id),nt(V,ue)}function J(V,ie=!1){let ue=V.style??"paragraph",fe=gs(r,ne.fields,V.text,l),Ce=Mc(r,fe.nodes),We=ie?S("span",{class:`fd-oneline-words fd-text-${ue}`,"data-node":V.id},...Ce):ue==="alert"?S("div",{class:`fd-alert fd-text-alert fd-tone-${V.tone??"info"}`,role:"status","data-node":V.id},S("span",{class:"fd-alert-message"},...Ce)):ue==="help"?Nc(W,V,Ce):S(ue==="heading"?"h3":"p",{class:`fd-text-${ue}`,"data-node":V.id},...Ce);return ee(We,V.colspan),N(We,V.id),be(we=>fe.update(we.values)),We}function X(V){let ie=S("div",{class:"fd-slot","data-slot":V.name,"data-node":V.id}),ue=n.slots?.[V.name]?.(ie,{form:q,name:V.name});return ue&&g.push(ue),N(ie,V.id),ie}function se(V,ie,ue){let fe=S("div",{class:"fd-grid"});if(ie!==null&&(fe.style.setProperty("--fd-columns",String(pn(ie))),pn(ie)===12&&fe.setAttribute("data-twelfths",""),typeof ie=="object"))for(let Ce of["medium","narrow"]){let We=ie[Ce];We!==void 0&&(fe.setAttribute(`data-columns-${Ce}`,String(We)),fe.style.setProperty(`--fd-columns-${Ce}`,String(We)))}return fe.append(...V.map(Ce=>Pt(Ce,ue))),fe}function Ee(V,ie){let[ue]=V.children;if(!ie.arrangement||ie.at==="tracks"||pn(V.columns)!==12||V.children.length<2||ue?.type!=="field"||V.children.reduce((We,we)=>We+(we.colspan??1),0)>12)return null;let fe=ne.fields[ue.field]?.type,Ce=fe?Ei(ue,fe,ie.inner.labels):"hidden";return Ce===void 0?"skin":Ce==="beside"?"beside":null}function xe(V,ie){let ue=S("div",{class:"fd-field fd-oneline","data-node":V.id,"data-style":"inline","data-labels":ie.labels});ee(ue,V.colspan);let fe=S("div",{class:"fd-oneline-row",role:"group"},...Qc(V.children).map(We=>{let we=We.map(Ye=>Pt(Ye,{columns:1,onPage:!1,inline:!0,quiet:V.quiet??ie.quiet,reason:V.readonlyReason??ie.reason}));return we.length===1?we[0]:S("span",{class:"fd-oneline-pair"},...we)}));if(V.title){let We=S("span",{class:"fd-label",id:oe(`${V.id}-label`)},V.title);fe.setAttribute("aria-labelledby",We.id),ue.append(We)}ue.append(fe),N(ue,V.id);let Ce=()=>ue.toggleAttribute("data-in-quiet",V.quiet??ie.quiet??O.getAttribute("data-fd-skin")==="quiet");return G.push(Ce),Ce(),ue}function ye(V,ie){if(V.style==="inline")return xe(V,ie);let ue=qo(V,ie),fe=S(ue.arrangement?"div":"fieldset",{class:"fd-section","data-node":V.id,"data-style":ue.style,"data-place":ue.at,"data-on-page":ue.style==="card"&&ie.onPage?"":void 0});ee(fe,V.colspan);let Ce=Ee(V,ue);Ce&&fe.setAttribute("data-row",Ce),V.labelWidth&&fe.style.setProperty("--fd-label-width",`${V.labelWidth}px`);let We=V.description?S("p",{class:"fd-section-description"},V.description):null,we=se(V.children,ue.at==="tracks"?null:V.columns,ue.inner);Tc(we,V);let Ye=$c(V,we),st=V.title&&(Ho(V)||Ye.length)?Qt.loaded:void 0;if(st){we.id=oe(`${V.id}-content`);let dt=st.sectionHeading(W,V,fe,we,We,Ye);V.collapsible&&_.set(fe,()=>dt.show(!0)),fe.append(dt.legend)}else if(V.title&&V.collapsible){we.id=oe(`${V.id}-content`);let dt=S("button",{type:"button",class:"fd-section-toggle","aria-controls":we.id},S("span",{class:"fd-section-chevron","aria-hidden":"true"}),...I(V.icon,V.title)),ze=V.collapsed!==!0,Bt=qe=>{ze=qe,dt.setAttribute("aria-expanded",String(ze)),we.hidden=!ze,We&&(We.hidden=!ze),fe.classList.toggle("fd-section-folded",!ze)};dt.addEventListener("click",()=>Bt(!ze)),_.set(fe,()=>Bt(!0)),Bt(ze),fe.append(S("legend",{class:"fd-section-title"},dt))}else V.title&&fe.append(S("legend",{class:"fd-section-title"},...I(V.icon,V.title)));return We&&fe.append(We),fe.append(we),N(fe,V.id),fe}function ve(V,ie){let ue=S("div",{class:"fd-tabs","data-node":V.id});ee(ue,V.colspan);let fe=S("div",{class:"fd-tablist",role:"tablist"}),Ce=null,We=V.children[0].id,we=qe=>{Ce=We=qe,Q(),q.shown(qe)},Ye=V.children.map(qe=>{let wt=oe(`${qe.id}-tab`),Rt=oe(`${qe.id}-panel`),Ft=S("button",{type:"button",class:"fd-tab",role:"tab",id:wt,"aria-controls":Rt,"data-node":qe.id},...F(qe));qe.iconOnly&&(Ft.classList.add("fd-tab-icon-only"),Ft.setAttribute("aria-label",qe.label),Ft.title=qe.label);let kt=S("div",{class:"fd-tabpanel",role:"tabpanel",id:Rt,"aria-labelledby":wt}),Gt=[],ft=!1,on=()=>{if(ft)return;ft=!0;let Mn=x;x=Gt;try{kt.append(se(qe.children,1,{columns:1,onPage:ie.onPage,labels:ie.labels,quiet:ie.quiet,reason:ie.reason}))}finally{x=Mn}},vn=()=>!q.node(qe.id).invisible&&(we(qe.id),!0);Ft.addEventListener("click",()=>we(qe.id)),C.has(qe.id)||C.set(qe.id,vn);let Kr=mt(qe.children);if(T.root)for(let Mn of Kr)z.has(Mn)||z.set(Mn,vn);return fe.append(Ft),{tab:qe,button:Ft,panel:kt,own:Gt,build:on,fields:Kr}});fe.addEventListener("keydown",qe=>{let wt=Ye.filter(ft=>!ft.button.hidden),Rt=wt.findIndex(ft=>ft.tab.id===We),Ft={ArrowRight:1,ArrowLeft:-1,Home:-Rt,End:wt.length-1-Rt}[qe.key];if(Ft===void 0||Rt===-1)return;qe.preventDefault();let kt=O.getAttribute("dir")==="rtl"&&(qe.key==="ArrowRight"||qe.key==="ArrowLeft"),Gt=wt[(Rt+(kt?-Ft:Ft)+wt.length)%wt.length];we(Gt.tab.id),Gt.button.focus()});let st=Kc(fe,S);g.push(st.destroy);let dt=V.place==="head"&&$e&&T.root?$e:null;dt?(ue.classList.add("fd-tabs-in-head"),dt.tabs.append(st.element),ue.append(...Ye.map(qe=>qe.panel))):ue.append(st.element,...Ye.map(qe=>qe.panel));for(let qe of Ye){let wt=qe.tab.count;if(wt===void 0)continue;let Rt=qe.button.querySelector(".fd-tab-count");be(Ft=>{let kt=Ft.values[wt],Gt=Array.isArray(kt)?kt.length:typeof kt=="number"?kt:Number(kt??0)||0;$t(Rt,String(Gt)),yt(qe.button,"aria-label",L(u.countOf,{label:qe.tab.label,count:Gt}))})}let ze="",Bt="";return be(qe=>{let wt=q.node(V.id).invisible;at(ue,wt),dt&&at(st.element,wt);let Rt=Ye.filter(ft=>!q.node(ft.tab.id).invisible);Ce!==null&&Rt.some(ft=>ft.tab.id===Ce)?We=Ce:Rt.length&&(We=Rt[0].tab.id);let kt=q.getState().errors;for(let ft of Ye){let on=ft.tab.id===We;if(at(ft.button,!Rt.includes(ft)),yt(ft.button,"aria-selected",String(on)),ft.button.tabIndex!==(on?0:-1)&&(ft.button.tabIndex=on?0:-1),yt(ft.button,"data-problem",ft.fields.some(vn=>kt[vn])?"":null),at(ft.panel,!on),on&&!wt){ft.build();for(let vn of ft.own)vn(qe)}}let Gt=Rt.map(ft=>ft.tab.id).join(" ");if(Gt!==ze&&(ze=Gt,st.measure()),We!==Bt&&fe.clientWidth){Bt=We;let ft=Ye.find(on=>on.tab.id===We);ft&&st.reveal(ft.button)}}),ue}function mt(V){return V.flatMap(ie=>ie.type==="field"?[ie.field]:ie.type==="section"?mt(ie.children):ie.type==="tabs"?ie.children.flatMap(ue=>mt(ue.children)):[])}function Pt(V,ie){return nt(V,Ot(V,ie))}function nt(V,ie){return V.hideOn?.length&&(ie.dataset.hideOn=V.hideOn.join(" ")),ie}function Ot(V,ie){switch(V.type){case"field":return Le(V,ie.labels,ie);case"button":return K(V);case"text":return J(V,ie.inline);case"slot":return X(V);case"section":return ye(V,ie);case"tabs":return ve(V,ie);case"divider":case"spacer":case"image":return Ur(V);case"form":return Ko(V,ie);case"map":return rn(V)}}function rn(V){if(!n.maps)return $||console.warn("[Fieldia] This page has a map: give the viewer `maps` (mapParts from @fieldia/map) to draw it."),$=!0,S("div",{class:"fd-map-part","data-node":V.id,hidden:""});let ie=n.maps({node:V,page:ne,form:q,document:r,locale:l,icons:n.icons});return ie.element.classList.add("fd-map-part"),ie.element.dataset.node=V.id,ee(ie.element,V.colspan??12),be(ue=>ie.update(ue)),ie.destroy&&g.push(()=>ie.destroy?.()),N(ie.element,V.id),ie.element}function Ur(V){let ie=V.type==="divider"?S("hr",{class:"fd-divider","data-node":V.id}):V.type==="spacer"?S("div",{class:"fd-block fd-spacer","aria-hidden":"true","data-node":V.id}):gr(V);return V.type!=="divider"&&V.colspan&&ie.style.setProperty("--fd-span",String(V.colspan)),N(ie,V.id),ie}function gr(V){let ie=S("img",{class:"fd-image",src:V.src,alt:V.alt,loading:"lazy"}),ue=V.href&&/^(https?:\/\/|mailto:)/i.test(V.href)?V.href:void 0,fe=S("figure",{class:"fd-block fd-figure","data-node":V.id,"data-align":V.align},ue?S("a",{href:ue,target:"_blank",rel:"noopener noreferrer"},ie):ie,...V.caption?[S("figcaption",{class:"fd-caption"},V.caption)]:[]),Ce=typeof V.width=="number"?`${V.width}px`:V.width&&{small:"160px",medium:"320px",large:"480px",full:"100%"}[V.width];return Ce&&fe.style.setProperty("--fd-image-width",Ce),fe}function Ko(V,ie){let ue=S("fieldset",{class:"fd-section fd-form-part","data-node":V.id,"data-style":"card","data-on-page":ie.onPage?"":void 0,"aria-busy":"true"});ee(ue,V.colspan);let fe=S("p",{class:"fd-form-part-note"},u.loading);ue.append(fe),N(ue,V.id);let Ce=Ye=>{ue.removeAttribute("aria-busy"),fe.textContent=Ye,fe.classList.add("fd-form-part-problem")},We=Ye=>{if(Ie)return;if(!Ye)return Ce(L(u.formMissing,{page:V.page}));let st=d(Ye),dt=st.title||Ye.id,ze=T.chain.findIndex(kt=>kt.id===Ye.id);if(ze!==-1)return Ce(L(u.formInItself,{page:dt,chain:[...T.chain.slice(ze).map(kt=>kt.title),dt].join(" \u2192 ")}));if(Ye.layout.type!=="sections"&&Ye.layout.type!=="tabs")return Ce(L(u.formNotPlaceable,{page:dt}));let Bt=Qr(st),qe;try{if(!Bt.ok)throw new Error(Bt.issues.map(kt=>`${kt.path}: ${kt.message}`).join("; "));qe=q.embed(V.id,st)}catch(kt){return console.warn(`Fieldia: the saved form "${Ye.id}" cannot be shown: ${kt.message}`),Ce(L(u.formBroken,{page:dt}))}let wt=V.title??st.title??"";ue.setAttribute("data-title",wt),wt&&ue.prepend(S("legend",{class:"fd-section-title"},...I(void 0,wt)));let Rt=ke({root:!1,form:qe,page:st,prefix:`${T.prefix}${V.id}-`,chain:[...T.chain,{id:Ye.id,title:dt}],locked:()=>T.locked()||q.node(V.id).readonly,path:`${T.path}${V.name}.`}),Ft=st.layout;fe.replaceWith(Rt.grid(Ft.type==="tabs"?[Ft]:Ft.children,1,{columns:1,onPage:!1,labels:ie.labels,quiet:ie.quiet})),ue.removeAttribute("aria-busy"),g.push(qe.subscribe(Q)),Ne&&Q()},we;try{we=Li(n,V.version===void 0?{id:V.page}:{id:V.page,version:V.version})}catch{we=null}return we instanceof Promise?we.then(We,()=>We(null)):We(we),ue}return{item:Pt,grid:se,fieldItem:Le,buttonItem:K,hideWhen:N,slotItem:X}}let{item:Oe,grid:Xe,fieldItem:Se,buttonItem:tt,hideWhen:Z,slotItem:re}=ke({root:!0,form:h,page:s,prefix:"",chain:[{id:s.id,title:s.title||s.id}],locked:()=>!1,path:""}),ae=n.readonly===!0,Re=n.editSwitch?S("button",{type:"button",class:"fd-button fd-edit-switch"}):null;Re?.addEventListener("click",async()=>{if(ae)ae=!1;else{if(h.getState().dirty.length&&!await h.save()){h.getState().saveProblem||ce(Ve(h.getState())),bt();return}ae=!0}O.toggleAttribute("data-readonly",ae),h.setEditing(!ae),xn(h.getState())}),O.toggleAttribute("data-readonly",ae),h.setEditing(!ae),m.push(()=>{Re&&(Re.textContent=ae?u.edit:u.done,Re.classList.toggle("fd-button-primary",ae))});let De=S("div",{class:"fd-status",role:"status","aria-live":"polite"}),gt=S("button",{type:"button",class:"fd-button fd-button-link fd-retry",hidden:""},u.retry);gt.addEventListener("click",()=>{jt()});let Ge=S("div",{class:"fd-status-box"},De,gt),Ae=()=>s.data.kind==="responses"?u.notSent:u.notSaved;function Ve(T){let q=[...O.querySelectorAll(".fd-field[data-path]")],ne=[];for(let be of Object.keys(T.errors)){let Le;for(let K=be;K&&!Le;K=K.slice(0,Math.max(0,K.lastIndexOf("."))))Le=q.find(J=>J.getAttribute("data-path")===K&&!J.hidden);let p=be.split(".")[0],R=Le?.querySelector(":scope > .fd-label")?.firstChild?.textContent??s.fields[p]?.label??p,P=Le?.closest(".fd-form-part")?.getAttribute("data-title"),N=P?`${R} (${P})`:R;ne.some(K=>K.name===N)||ne.push({name:N,at:Le?q.indexOf(Le):1/0})}let oe=ne.sort((be,Le)=>be.at-Le.at).map(be=>be.name);return oe.length?L(u.checkFields,{what:Ae(),fields:oe.join(", ")}):Ae()}let pe;m.push(T=>{let q=T.saveProblem,ne=T.status==="saving"?u.saving:T.status==="saved"?u.saved:T.status==="loading"?u.loading:T.status==="error"&&q?q.kind==="fields"?Ve(T):q.kind==="other"?q.message:Ae():T.status==="error"?T.error??"":"";yt(De,"aria-live",T.status==="error"&&q?"off":"polite"),$t(De,ne),at(gt,!(T.status==="error"&&q?.kind==="other")),De.classList.toggle("fd-status-error",T.status==="error"),De.classList.toggle("fd-status-saved",T.status==="saved"),n.saveStatus==="toast"&&(clearTimeout(pe),Ge.hidden=!ne,T.status==="saved"&&(pe=setTimeout(()=>Ge.hidden=!0,2500)))});let le=S("button",{type:"button",class:"fd-button fd-retry"},u.retry);le.addEventListener("click",()=>{jt()});let me=S("div",{class:"fd-banner fd-tone-warning",role:"alert",hidden:""},S("span",{class:"fd-banner-text"},u.offline),le),he=S("div",{class:"fd-announce",role:"alert","aria-live":"assertive"});function ce(T){he.textContent="",setTimeout(()=>he.textContent=T,0)}let Ze=null;m.push(T=>{T.saveProblem!==Ze&&(Ze=T.saveProblem,me.hidden=Ze?.kind!=="network",Ze&&(Ze.kind==="rule"?qr(Ze.message,!1):Ze.kind==="fields"?ce(Ve(T)):Ze.kind==="other"&&ce(Ze.message)))});let vt=S("div",{class:"fd-draft",hidden:""}),Tt=S("span"),an=S("button",{type:"button",class:"fd-button fd-button-primary"},u.restore),Kt=S("button",{type:"button",class:"fd-button fd-button-link"},u.discardDraft);an.addEventListener("click",()=>h.restoreDraft()),Kt.addEventListener("click",()=>h.discardDraft()),vt.append(Tt,an,Kt),m.push(T=>{at(vt,!T.draft),T.draft&&(Tt.textContent=L(u.draftFound,{time:new Date(T.draft.savedAt).toLocaleString()}))});function bt(){if(![...O.querySelectorAll('[aria-invalid="true"]')].find(oe=>!oe.closest(".fd-tabpanel[hidden]"))){let oe=h.getState().errors,be=[...z.keys()].find(Le=>oe[Le]);be&&z.get(be)?.()}let q=[...O.querySelectorAll('[aria-invalid="true"]')].find(oe=>!oe.closest(".fd-tabpanel[hidden]"))??null;if(!q)return;for(let oe=q.closest(".fd-section-folded");oe;oe=oe.parentElement?.closest(".fd-section-folded")??null)_.get(oe)?.();if(!q.dispatchEvent(new CustomEvent("fd-focus-problem",{cancelable:!0})))return;(q.matches("input, select, textarea, button")?q:q.querySelector("input, select, textarea, button"))?.focus()}let Ht=S("div",{class:"fd-done",hidden:""},S("p",{class:"fd-done-title"},u.submitted)),en=S("button",{type:"button",class:"fd-button"},u.submitAnother);Ht.append(en);let Dt=S("div",{class:"fd-content"});async function jt(){if(!await h.save()){h.getState().saveProblem||ce(Ve(h.getState())),bt();return}s.data.kind==="responses"&&(Dt.hidden=!0,Ht.hidden=!1)}en.addEventListener("click",()=>{h.reset(),Dt.hidden=!1,Ht.hidden=!0});function Gn(){let T=h.getState();if(T.recordId==null)return"";let q=s.layout.type==="sheet"?s.layout.title?.field:void 0;return(q?It(s.fields[q],T.values[q],T.values,l):"")||s.title||""}function tn(T){if(s.data.kind!=="record")return null;let q=vl({doc:r,el:S,form:h,toolbar:T,records:n.records,breadcrumbs:n.breadcrumbs,labels:u,icons:n.icons,uid:w,fill:L,withIcon:I,press:M,name:Gn,render:Q,async leave(){if(!h.getState().dirty.length)return!0;let ne=await h.save();return ne||(h.getState().saveProblem||ce(Ve(h.getState())),bt()),ne}});return q?(m.push(q.update),g.push(q.destroy),q.element):null}function Mt(){if(!s.title&&!s.description)return null;let T=S("header",{class:"fd-page-head"});return s.title&&T.append(S("h1",{class:"fd-page-title"},s.title)),s.description&&T.append(S("p",{class:"fd-page-description"},s.description)),T}function U(T){return!T?.length||n.showActions===!1?null:S("div",{class:"fd-actions fd-actions-end fd-page-footer"},Ge,...T.map(tt))}function de(T){let q=S("div",{class:"fd-sections","data-node":T.id},...T.children.map(Le=>Oe(Le,ge(!0)))),ne=U(T.footer);if(ne)return S("div",{},q,ne);let oe=S("button",{type:"submit",class:"fd-button fd-button-primary"},s.data.kind==="responses"?u.submit:u.save),be=S("div",{class:"fd-actions fd-actions-end"},Ge,oe);if(s.data.kind==="record"){let Le=S("button",{type:"button",class:"fd-button"},u.discard);Le.addEventListener("click",()=>h.reset()),be.insertBefore(Le,oe),m.push(p=>{let R=p.dirty.length>0&&p.status!=="saving"&&!ae;at(oe,!R),at(Le,!R)})}else m.push(()=>at(oe,ae));return Re&&be.prepend(Re),n.showActions===!1?S("div",{},q):s.actionsPosition==="top"?(be.classList.add("fd-actions-top"),S("div",{},be,q)):S("div",{},q,be)}function Fe(T){let q=S("div",{class:"fd-wizard","data-node":T.id}),ne=S("div",{class:"fd-progress-text"}),oe=S("span");q.append(S("div",{class:"fd-progress"},ne,S("div",{class:"fd-progress-bar"},oe)));let be=T.clickable?S("ol",{class:"fd-steps-list"}):null,Le=new Map;if(be){for(let X of T.children){let se=S("button",{type:"button",class:"fd-step-link"},...I(X.icon,X.label));se.addEventListener("click",()=>{h.goTo(X.id)?J():bt()}),Le.set(X.id,se),be.append(S("li",{},se))}q.append(S("nav",{class:"fd-steps","aria-label":u.steps},be))}let p=T.children.map(X=>{let se=S("section",{class:"fd-step","data-node":X.id,"aria-labelledby":w(`${X.id}-title`)});return se.append(S("h2",{class:"fd-step-title",id:w(`${X.id}-title`)},...I(X.icon,X.label))),X.description&&se.append(S("p",{class:"fd-section-description"},X.description)),se.append(Xe(X.children,1,ge(!1))),q.append(se),{step:X,panel:se}}),R=S("button",{type:"button",class:"fd-button"},T.backLabel??u.back),P=S("button",{type:"button",class:"fd-button fd-button-link"},u.skip),N=S("button",{type:"submit",class:"fd-button fd-button-primary"});q.append(S("div",{class:"fd-wizard-nav"},R,S("span",{class:"fd-spacer"}),Ge,P,N)),R.addEventListener("click",()=>{h.back()&&J()}),P.addEventListener("click",()=>{h.skip()&&J()});let K=()=>{let X=h.steps();return X.indexOf(h.getState().step??"")===X.length-1};Qe=async()=>{if(K())return jt();h.next()?J():bt()};function J(){p.find(se=>se.step.id===h.getState().step)?.panel.querySelector("input, select, textarea, [role=radio]")?.focus()}return m.push(X=>{let se=h.steps(),Ee=Math.max(0,se.indexOf(X.step??""));ne.textContent=L(u.stepOf,{n:Ee+1,total:se.length}),oe.style.width=`${(Ee+1)/Math.max(1,se.length)*100}%`;for(let{step:ye,panel:ve}of p)ve.hidden=ye.id!==X.step;let xe=Ee===se.length-1;R.hidden=Ee===0,P.hidden=xe||!T.children.find(ye=>ye.id===X.step)?.optional,N.textContent=xe?T.finishLabel??u.submit:T.nextLabel??u.next;for(let[ye,ve]of Le){let mt=se.indexOf(ye);ve.parentElement.hidden=mt===-1,ve.classList.toggle("fd-step-done",mt!==-1&&mt<Ee),ve.classList.toggle("fd-step-skipped",X.skipped.includes(ye)),ye===X.step?ve.setAttribute("aria-current","step"):ve.removeAttribute("aria-current")}}),q}function je(T){let q=T.head?Qt.loaded:void 0;if(q)return He(T,q);let ne=S("div",{class:"fd-sheet-page","data-node":T.id}),oe=S("div",{class:"fd-actions"}),be=S("button",{type:"submit",class:"fd-button fd-button-primary"},u.save),Le=S("button",{type:"button",class:"fd-button"},u.discard);Le.addEventListener("click",()=>h.reset());let p=s.actionsPosition==="bottom",R=S("div",{class:"fd-actions fd-actions-end fd-sheet-foot"}),P=U(T.footer);n.showActions===!1||P?oe.append(...(T.buttons??[]).map(tt)):p?(oe.append(...(T.buttons??[]).map(tt)),R.append(Ge,Le,be)):oe.append(be,Le,...(T.buttons??[]).map(tt),Ge),Re&&n.showActions!==!1&&oe.prepend(Re),m.push(xe=>{let ye=xe.dirty.length>0&&xe.status!=="saving"&&!ae;be.hidden=!ye,Le.hidden=!ye});let N=S("div",{class:"fd-header"},oe),K=T.statusbar?.position==="title";T.statusbar&&!K&&N.append(pt(T.statusbar));let J=S("div",{class:"fd-card"}),X=[...T.ribbon?[T.ribbon]:[],...T.ribbons??[]];if(X.length){let xe=S("div",{class:"fd-ribbon-frame"}),ye=X.map(ve=>{let mt=S("div",{class:`fd-ribbon fd-tone-${ve.tone??"muted"}`,"data-node":ve.id,title:ve.tooltip},ve.label);return xe.append(mt),{ribbon:ve,element:mt}});m.push(ve=>{let mt=!1;for(let{ribbon:Pt,element:nt}of ye){let Ot=!mt&&!h.node(Pt.id).invisible;if(mt||(mt=Ot),at(nt,!Ot),!Ot)continue;let rn=Pt.labelField?It(s.fields[Pt.labelField],ve.values[Pt.labelField],ve.values,l):"";$t(nt,rn||Pt.label)}}),J.append(xe)}if(T.statButtons?.length){let xe=S("div",{class:"fd-stats"}),ye=(ve,mt)=>ve&&s.fields[ve]?It(s.fields[ve],mt[ve],mt,l):"";for(let ve of T.statButtons){let mt=S("span",{class:"fd-stat-value"}),Pt=S("span",{class:"fd-stat-label"},ve.label),nt=ve.secondField&&ve.secondLabel!==void 0?{value:S("span",{class:"fd-stat-value"}),label:S("span",{class:"fd-stat-label"},ve.secondLabel)}:null,Ot=rt(r,ve.icon,n.icons),rn=nt?S("span",{class:"fd-stat-words fd-stat-pair"},S("span",{class:"fd-stat-row"},Pt,mt),S("span",{class:"fd-stat-row"},nt.label,nt.value)):S("span",{class:"fd-stat-words"},mt,Pt),Ur=ve.help?w(`${ve.id}-help`):void 0,gr=S("button",{type:"button",class:"fd-stat","data-node":ve.id,title:ve.help||void 0,"aria-describedby":Ur},...Ot?[Ot,rn]:[rn]);Ur&&xe.append(S("span",{class:"fd-sr-only",id:Ur},ve.help)),gr.addEventListener("click",()=>{M(gr,()=>h.runAction(ve.id))}),m.push(Ko=>{gr.hidden=h.node(ve.id).invisible;let V=Ko.values,ie=ye(ve.unitField,V)||ve.unit||"",ue=ye(ve.field,V),fe=ye(ve.secondField,V);nt?($t(mt,ue),$t(nt.value,[fe,ie].filter(Boolean).join(" "))):$t(mt,[[ue,fe].filter(Boolean).join(" / "),ue||fe?ie:""].filter(Boolean).join(" ")),$t(Pt,ye(ve.labelField,V)||ve.label)}),xe.append(gr)}m.push(()=>{xe.hidden=[...xe.querySelectorAll(":scope > .fd-stat")].every(ve=>ve.hidden)}),J.append(xe)}if(J.append(...Ke(T)),T.badges?.length){let xe=S("div",{class:"fd-badges"});for(let ye of T.badges){let ve=S("span",{class:`fd-badge fd-tone-${ye.tone??"muted"}`,"data-node":ye.id},...I(ye.icon,ye.label));Z(ve,ye.id),xe.append(ve)}m.push(()=>{xe.hidden=[...xe.children].every(ye=>ye.hidden)}),J.append(xe)}if(T.title){let xe=S("div",{class:"fd-title"});T.title.label&&xe.append(S("label",{class:"fd-title-label",for:w("#title")},T.title.label)),T.title.above?.length&&xe.append(S("div",{class:"fd-title-above"},...T.title.above.map(nt=>Se(nt))));let ye=Se({type:"field",id:"#title",field:T.title.field,placeholder:T.title.placeholder,...T.title.placeholderWhen?{placeholderWhen:T.title.placeholderWhen}:{},...T.title.focus?{focus:!0}:{}}),ve=T.title.before??[],mt=T.title.after??[];if(ve.length||mt.length){ye.classList.add("fd-title-name");let nt=Ot=>{let rn=Se(Ot);return rn.classList.add("fd-title-side"),rn};xe.append(S("div",{class:"fd-title-line"},...ve.map(nt),ye,...mt.map(nt)))}else xe.append(ye);T.title.subtitleField&&xe.append(Se({type:"field",id:"#subtitle",field:T.title.subtitleField})),T.title.below?.length&&xe.append(S("div",{class:"fd-title-below"},...T.title.below.map(nt=>Se(nt))));let Pt=S("div",{class:"fd-title-row"},xe);if(T.title.avatarField){let nt=Se({type:"field",id:"#avatar",field:T.title.avatarField});nt.classList.add("fd-avatar"),Pt.append(nt)}J.append(Pt)}T.statusbar&&K&&J.append(S("div",{class:"fd-title-statusbar"},pt(T.statusbar))),J.append(Xe(T.children,1,ge(!1))),P&&J.append(P),p&&n.showActions!==!1&&(J.append(R),m.push(xe=>{R.hidden=xe.dirty.length===0&&!De.textContent}));let se=S("div",{class:"fd-sheet-layout"},J);if(T.attachmentPreview){let xe=Gc({doc:r,el:S,form:h,page:s,node:T.attachmentPreview,dataSource:n.dataSource,labels:u,fill:L});se.classList.add("fd-has-preview"),se.append(xe.element),m.push(xe.update),g.push(xe.destroy)}T.sidePanel&&(se.classList.add("fd-has-side"),T.sidePanelBeside&&se.setAttribute("data-side-beside",T.sidePanelBeside),se.append(S("aside",{class:"fd-side"},re(T.sidePanel))));let Ee=tn(T.toolbar);return ne.append(...Ee?[Ee]:[],N,se),ne}function Ke(T){return(T.alerts??[]).map(q=>{let ne=gs(r,s.fields,q.message,l),oe=S("span",{class:"fd-alert-message"},...ne.nodes),be=!1,Le=S("div",{class:`fd-alert fd-tone-${q.tone??"info"}`,role:"status","data-node":q.id},oe);if(q.buttons?.length&&Le.append(S("span",{class:"fd-alert-actions"},...q.buttons.map(p=>tt({...p,style:p.style??"link"})))),m.push(p=>{ne.update(p.values);let R=q.messageField?p.values[q.messageField]:null,P=typeof R=="string"?R.trim():"";P?$t(oe,P):be&&oe.replaceChildren(...ne.nodes),be=!!P}),q.dismissible){let p=!1,R=S("button",{type:"button",class:"fd-alert-close","aria-label":u.dismiss},"\xD7");R.addEventListener("click",()=>{p=!0,Le.hidden=!0}),Le.append(R),m.push(()=>{Le.hidden=p||h.node(q.id).invisible})}else Z(Le,q.id);return Le})}function He(T,q){let ne=S("div",{class:"fd-sheet-page fd-head-page","data-node":T.id}),oe=q.recordHead({doc:r,el:S,form:h,page:s,sheet:T,head:T.head,labels:u,locale:l,icons:n.icons,uid:w,fill:L,withIcon:I,press:M,say:(P,N)=>k.say(P,N),fieldItem:Se,item:Oe,buttonItem:tt,watch:P=>m.push(P),cleanups:g,showTab:P=>C.get(P)?.()??!1,unfold(P){for(let N=P.closest(".fd-section-folded");N;N=N.parentElement?.closest(".fd-section-folded")??null)_.get(N)?.()},root:()=>O});$e=oe;let be;try{be=Xe(T.children,1,ge(!1))}finally{$e=null}let Le=S("div",{class:"fd-head-body"},...Ke(T),be),p=T.sidePanel?S("aside",{class:"fd-side"},re(T.sidePanel)):null,R=tn(T.toolbar?{...T.toolbar,menu:void 0}:void 0);return ne.append(...R?[R]:[],oe.element,p?S("div",{class:"fd-head-layout"},Le,p):Le),ne}function pt(T){let q=s.fields[T.field],ne={clickable:T.clickable===!0};T.visibleStates&&(ne.visibleStates=T.visibleStates);for(let Le of["durationsField","fold","saves"])T[Le]!==void 0&&(ne[Le]=T[Le]);let oe={type:"field",id:"#statusbar",field:T.field,widget:"statusbar",options:ne},be=Xt({form:h,name:T.field,field:q,node:oe,id:w("statusbar"),document:r,labels:v,preferences:c,locale:l,dialogs:f},n.widgets);return be.destroy&&g.push(()=>be.destroy?.()),m.push(Le=>{at(be.element,h.node("#statusbar").invisible),be.update({value:Le.values[T.field],values:Le.values,readonly:h.node("#statusbar").readonly||ae,required:!1,invalid:!1})}),be.element}let Qe=null,Je=s.layout,zt=null,Nt=null;function Wt(){let T;if(Je.type==="sheet")T=je(Je);else if(Je.type==="wizard")T=Fe(Je);else if(Je.type==="tabs")T=de({id:`${Je.id}-page`,children:[Je]});else if(Je.type==="list"){let oe=qc({page:s,node:Je,form:h,dataSource:n.dataSource,doc:r,el:S,labels:u,locale:l,fill:L,press:M,withIcon:I,uid:w,icons:n.icons,preferences:c,onOpenRecord:n.onOpenRecord,...n.listFilter?{fixedFilter:n.listFilter}:{},...n.listViews?{views:n.listViews}:{}});g.push(oe.destroy),zt=oe.reload,Nt=oe.open,T=oe.element}else T=de(Je);let q=Je.type==="sheet"?null:Mt(),ne=Je.type==="sections"||Je.type==="tabs"?tn(void 0):null;Dt.append(...ne?[ne]:[],...q?[q]:[],me,vt,T),nn=!0}let nn=!1,Tn=T=>nn?T():jr.then(T),sn=fr(s,n.widgets,n.slots).filter(T=>!T.loaded),jr=Promise.resolve();sn.length?(O.setAttribute("aria-busy","true"),jr=Pr(sn).then(()=>{Ie||(Wt(),O.removeAttribute("aria-busy"),xn(h.getState()),Pe&&mr(!0))})):Wt(),O.append(Dt,Ht,he),n.saveStatus==="toast"?(Ge.classList.add("fd-toast"),O.append(Ge)):n.saveStatus==="bar"&&(Ge.classList.add("fd-status-bar"),Dt.prepend(Ge)),O.addEventListener("mouseover",T=>{let q=T.target;if(q.tagName!=="INPUT"||!q.classList.contains("fd-input")||q.title&&!q.hasAttribute("data-cut-title"))return;let ne=q.scrollWidth>q.clientWidth&&q.value!=="";yt(q,"title",ne?q.value:null),yt(q,"data-cut-title",ne?"":null)}),O.addEventListener("submit",T=>{T.preventDefault(),Je.type!=="list"&&(Qe?Qe():jt())});function Uo(){let T=r.activeElement;T&&O.contains(T)&&(T.tagName==="INPUT"||T.tagName==="TEXTAREA")&&T.dispatchEvent(new Event("change",{bubbles:!0}))}function zr(T){let q=[...O.querySelectorAll(".fd-field")].filter(be=>!be.closest('[hidden], [data-type="one2many"] .fd-field, .fd-form-dialog')&&!be.parentElement?.closest('[data-type="one2many"]')),ne=T.closest(".fd-field"),oe=q.slice(q.indexOf(ne)+1);for(let be of oe){let Le=be.querySelector('input:not([type="hidden"]):not([readonly]):not([disabled]), select:not([disabled]), textarea:not([readonly]), [contenteditable="true"]');if(Le)return Le}return null}O.addEventListener("keydown",T=>{if(T.isComposing||T.key!=="Enter"||Je.type==="list"||T.target.closest(".fd-slot"))return;let q=n.keys??{};if(T.ctrlKey||T.metaKey){if(q.saveWithCtrlEnter===!1||n.showActions===!1||T.target.closest(".ag-root-wrapper"))return;T.preventDefault(),Uo(),Qe?Qe():jt();return}let ne=T.target,oe=ne.getAttribute("aria-multiline")==="false";T.defaultPrevented&&!oe||!q.enterMovesToNext||T.shiftKey||T.altKey||ne.tagName!=="INPUT"&&ne.tagName!=="SELECT"&&!oe||ne.closest('[data-type="one2many"]')||["button","submit","reset","file"].includes(ne.type)||(T.preventDefault(),zr(ne)?.focus())});function ur(T){let q=T instanceof Element?T.closest(".fd-form"):null;if(q)return q===O&&!O.querySelector(":scope > .fd-dialog-backdrop");let ne=[...r.querySelectorAll('[aria-modal="true"]')].filter(be=>!be.closest("[hidden]"));return(ne[ne.length-1]??r).querySelector(".fd-form")===O}let Br=T=>{if(T.key==="Alt"){ur(T.target)&&O.setAttribute("data-hotkeys","");return}let q=bo(T);if(!q||!ur(T.target))return;let ne=[...O.querySelectorAll(`button[data-hotkey="${q}"]`)].find(be=>be.closest(".fd-form")===O&&!be.closest("[hidden]")&&!be.disabled&&!be.hasAttribute("aria-busy")),oe=ne?void 0:Y.find(be=>be.key===q&&be.wrapper.isConnected&&!be.wrapper.closest("[hidden]"));if(oe){T.preventDefault(),O.removeAttribute("data-hotkeys"),oe.focus();return}ne&&(T.preventDefault(),O.removeAttribute("data-hotkeys"),ne.click())},pr=()=>O.removeAttribute("data-hotkeys"),_t=T=>T.key==="Alt"&&pr();r.addEventListener("keydown",Br),r.addEventListener("keyup",_t),r.defaultView?.addEventListener("blur",pr),g.push(()=>{r.removeEventListener("keydown",Br),r.removeEventListener("keyup",_t),r.defaultView?.removeEventListener("blur",pr)});function qr(T,q=!0){return new Promise(ne=>{let oe=S("p",{id:`${E}-confirm`},T),be=S("button",{type:"button",class:"fd-button"},u.cancel),Le=S("button",{type:"button",class:"fd-button fd-button-primary"},u.ok),p=S("div",{class:"fd-dialog",role:"alertdialog","aria-modal":"true","aria-labelledby":oe.id},oe,S("div",{class:"fd-actions fd-actions-end"},...q?[be,Le]:[Le])),R=S("div",{class:"fd-dialog-backdrop"},p),P=O.ownerDocument,N=P.activeElement,K=J=>{R.remove(),((Ee=>!!Ee&&Ee!==P.body&&Ee.isConnected&&!Ee.closest("[hidden]"))(N)?N:O.querySelector('button[type="submit"]:not([hidden])'))?.focus(),ne(J)};be.addEventListener("click",()=>K(!1)),Le.addEventListener("click",()=>K(!0)),R.addEventListener("keydown",J=>{J.stopPropagation(),J.key==="Escape"?(J.preventDefault(),K(!1)):hn(p,J)}),O.append(R),Le.focus()})}function xn(T){for(let q of m)q(T)}e.append(O);let _r=h.subscribe(xn);g.push(h.on("run",({result:T})=>{(T.reason==="cannot"||T.reason==="app"&&T.error!==void 0)&&k.say(T.message??"",T.reason==="app"?"danger":"warning")})),xn(h.getState());function Jn(){for(let T of G)T();Ne&&Q()}Ne=!0;function mr(T){te.length&&queueMicrotask(()=>{if(Ie||!O.isConnected||O.closest("[hidden]")||typeof O.checkVisibility=="function"&&!O.checkVisibility())return;let q=r.activeElement;!(!q||q===r.body||q===r.documentElement)&&!(T&&O.contains(q))||te.find(oe=>!oe.wrapper.closest("[hidden]"))?.focus()})}return g.push(h.on("open",()=>{let T=!Pe;Pe=!0,mr(T)})),h.getState().status==="idle"&&h.load(),{form:h,element:O,setSkin(T){O.setAttribute("data-fd-skin",T),Jn()},setTheme(T){T?O.setAttribute("data-fd-theme",T):O.removeAttribute("data-fd-theme"),O.setAttribute("data-fd-skin",Un(n.skin??s.look?.skin,T??void 0)),Jn()},setTokens(T){n.tokens=T??void 0,Kn(O,T)},async save(){let T=await h.save();return T||bt(),T},check(){let T=h.validate();return T||bt(),T},setReadonly(T){ae=T,O.toggleAttribute("data-readonly",ae),h.setEditing(!ae),xn(h.getState())},isReadonly:()=>ae,reload:()=>Tn(async()=>{if(zt)return zt();await h.run([{do:"reload"}])}),openRecord:(T,q)=>Tn(async()=>{await Nt?.(T,q)}),on:(T,q)=>{let ne=h.on(T,q);return g.push(ne),ne},setValues:T=>h.setValues(T),run:(T,q)=>h.run(T,q),drawn:jr,destroy(){Ie=!0,_r();for(let T of g)T();O.remove(),y&&h.dispose()}}}var Yc='input:not([type="hidden"]), select, textarea, button, [contenteditable="true"], [tabindex="0"]',Xc='input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]), textarea',Lm=e=>e==null||e===""||Array.isArray(e)&&!e.length;function Em(e,t){return(t==="en"||t==="fr")&&/^\p{Lu}\p{Ll}/u.test(e)?e[0].toLocaleLowerCase(t)+e.slice(1):e}function Zc(e,t,n=Zt[t]){return/[?؟]\s*$/.test(e)?n.quietAnswer:n.quietHint.replace("{label}",Em(e,t))}var Rm=new Set(["boolean","one2many","binary","image","html","json","properties"]);function Fm(e){return e.replace(/\s+([^\p{L}\p{N}\s]{1,3})$/u,"\xA0$1")}function Qc(e){let t=[],n=0;for(;n<e.length;){let r=[e[n]],i=e[n].type==="field";if(!i&&e[n].type==="text"&&e[n+1]?.type==="field"&&(r.push(e[++n]),i=!0),n++,i)for(;e[n]?.type==="text"&&e[n+1]?.type!=="field";)r.push(e[n++]);t.push(r)}return t}function _o(e,t){qt[e]={...qt.en,...t.messages},ot[e]={...ot.en,...t.widgets},Zt[e]={...Zt.en,...t.viewer}}var Am="0.20.0";zl();var ef=globalThis;for(let[e,t]of ef.FieldiaLanguages??[])_o(e,t);delete ef.FieldiaLanguages;return uf($m);})();
|
|
65
65
|
//# sourceMappingURL=fieldia.js.map
|