@streamline-pulse/formkrafter-wc 0.2.0 → 0.3.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.
Files changed (106) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/fk-brick-actions_18.cjs.entry.js +188 -22407
  3. package/dist/cjs/formkrafter-wc.cjs.js +2 -2
  4. package/dist/cjs/index-Bhy1RJMV.js +3042 -0
  5. package/dist/cjs/{index-CbyFxLc_.js → index-CImTe9BG.js} +14 -2
  6. package/dist/cjs/index-CdaT3-qx.js +5444 -0
  7. package/dist/cjs/{index-Can2MpG5.js → index-CkPPRg03.js} +27 -17
  8. package/dist/cjs/index-DHgK3reD.js +12233 -0
  9. package/dist/cjs/index-Ds0sDbXV.js +4019 -0
  10. package/dist/cjs/index-c9BL7y3N.js +1922 -0
  11. package/dist/cjs/index.cjs.js +2 -2
  12. package/dist/cjs/loader.cjs.js +2 -2
  13. package/dist/collection/components/fk-code-editor/fk-code-editor.js +17 -8
  14. package/dist/collection/components/fk-file-input/fk-file-input.js +67 -24
  15. package/dist/collection/components/fk-property-panel/fk-property-panel.js +5 -1
  16. package/dist/collection/components/fk-select-input/fk-select-input.css +9 -0
  17. package/dist/collection/components/fk-select-input/fk-select-input.js +118 -20
  18. package/dist/collection/components/fk-stepper/fk-stepper.css +14 -0
  19. package/dist/collection/components/fk-stepper/fk-stepper.js +4 -1
  20. package/dist/collection/components/fk-tabs/fk-tabs.js +15 -2
  21. package/dist/collection/i18n/i18n.js +8 -0
  22. package/dist/collection/registry/default-bricks.js +16 -14
  23. package/dist/components/fk-brick-actions.js +1 -1
  24. package/dist/components/fk-brick-list.js +1 -1
  25. package/dist/components/fk-brick-mold-item.js +1 -1
  26. package/dist/components/fk-brick-not-found.js +1 -1
  27. package/dist/components/fk-brick-render.js +1 -1
  28. package/dist/components/fk-code-editor.js +1 -1
  29. package/dist/components/fk-data-grid.js +1 -1
  30. package/dist/components/fk-drop-area.js +1 -1
  31. package/dist/components/fk-empty-form.js +1 -1
  32. package/dist/components/fk-file-input.js +1 -1
  33. package/dist/components/fk-form-builder.js +1 -1
  34. package/dist/components/fk-form-render.js +1 -1
  35. package/dist/components/fk-property-panel.js +1 -1
  36. package/dist/components/fk-rules-editor.js +1 -1
  37. package/dist/components/fk-select-input.js +1 -1
  38. package/dist/components/fk-signature-input.js +1 -1
  39. package/dist/components/fk-stepper.js +1 -1
  40. package/dist/components/fk-tabs.js +1 -1
  41. package/dist/components/index.js +1 -1
  42. package/dist/components/{p-B0YjIsVn.js → p--vL6GR31.js} +1 -1
  43. package/dist/components/p-4COASNrZ.js +1 -0
  44. package/dist/components/p-BB4Llg42.js +1 -0
  45. package/dist/components/p-BGkZP87K.js +1 -0
  46. package/dist/components/p-BOmBVgfJ.js +1 -0
  47. package/dist/components/p-BWdm2a6q.js +1 -0
  48. package/dist/components/{p-GjmAhT2E.js → p-B_-x-GlA.js} +1 -1
  49. package/dist/components/p-Br1s4Ujx.js +1 -0
  50. package/dist/components/p-C-wnqV3i.js +1 -0
  51. package/dist/components/{p-BDvqHJih.js → p-CIfjRTky.js} +1 -1
  52. package/dist/components/{p-LXnm2ogM.js → p-CKMHMpID.js} +1 -1
  53. package/dist/components/p-CUF31e-P.js +1 -0
  54. package/dist/components/p-D6n74M9d.js +1 -0
  55. package/dist/components/{p-CXEvsomA.js → p-DFe3zZCI.js} +1 -1
  56. package/dist/components/p-DMCkrZqi.js +1 -0
  57. package/dist/components/p-DOInQkG6.js +1 -0
  58. package/dist/components/{p-BVBfbMl_.js → p-DYchD23x.js} +1 -1
  59. package/dist/components/p-DtcM1yw5.js +1 -0
  60. package/dist/components/p-NDbmiiYk.js +1 -0
  61. package/dist/components/p-PAr7WoWG.js +1 -0
  62. package/dist/components/{p-y0xDvzJR.js → p-YyGnQmX-.js} +1 -1
  63. package/dist/components/{p-C85zhhpr.js → p-fDJP6whN.js} +1 -1
  64. package/dist/components/p-swxZqinH.js +1 -0
  65. package/dist/components/{p-BSPTuA1p.js → p-v7LxwCAc.js} +1 -1
  66. package/dist/components/p-wuC5rVU7.js +1 -0
  67. package/dist/esm/fk-brick-actions_18.entry.js +188 -22407
  68. package/dist/esm/formkrafter-wc.js +3 -3
  69. package/dist/esm/index-BAcz7b5u.js +5416 -0
  70. package/dist/esm/index-BkRMoLXK.js +3029 -0
  71. package/dist/esm/index-CGMDfZ5m.js +1808 -0
  72. package/dist/esm/{index-BB2OOj__.js → index-D7Cta1UB.js} +27 -17
  73. package/dist/esm/index-DtcM1yw5.js +3991 -0
  74. package/dist/esm/index-DuVf3NlP.js +12222 -0
  75. package/dist/esm/{index-DMDO6w5-.js → index-qLZlXROB.js} +14 -2
  76. package/dist/esm/index.js +2 -2
  77. package/dist/esm/loader.js +3 -3
  78. package/dist/formkrafter-wc/formkrafter-wc.css +1 -1
  79. package/dist/formkrafter-wc/formkrafter-wc.esm.js +1 -1
  80. package/dist/formkrafter-wc/index.esm.js +1 -1
  81. package/dist/formkrafter-wc/p-4COASNrZ.js +1 -0
  82. package/dist/formkrafter-wc/p-6d29555b.entry.js +1 -0
  83. package/dist/formkrafter-wc/p-C-wnqV3i.js +1 -0
  84. package/dist/formkrafter-wc/p-DMCkrZqi.js +1 -0
  85. package/dist/formkrafter-wc/p-DOInQkG6.js +1 -0
  86. package/dist/formkrafter-wc/{p-Bp_A8oL5.js → p-Ddu6BquK.js} +4 -4
  87. package/dist/formkrafter-wc/p-DtcM1yw5.js +1 -0
  88. package/dist/formkrafter-wc/p-qLZlXROB.js +2 -0
  89. package/dist/types/components/fk-code-editor/fk-code-editor.d.ts +2 -1
  90. package/dist/types/components/fk-file-input/fk-file-input.d.ts +7 -3
  91. package/dist/types/components/fk-select-input/fk-select-input.d.ts +9 -0
  92. package/dist/types/components.d.ts +22 -4
  93. package/package.json +2 -2
  94. package/dist/components/p-B1t0M_hN.js +0 -1
  95. package/dist/components/p-B21cOFRx.js +0 -1
  96. package/dist/components/p-B7ED8qMb.js +0 -1
  97. package/dist/components/p-BrOXMyOG.js +0 -1
  98. package/dist/components/p-CMQ_4Zfv.js +0 -1
  99. package/dist/components/p-Cq9HSEn8.js +0 -1
  100. package/dist/components/p-D7bf2ztq.js +0 -1
  101. package/dist/components/p-DIPoAaGe.js +0 -1
  102. package/dist/components/p-DYBirEew.js +0 -1
  103. package/dist/components/p-DluDp8V5.js +0 -1
  104. package/dist/components/p-Do6-yRva.js +0 -1
  105. package/dist/formkrafter-wc/p-0de7cbe1.entry.js +0 -1
  106. package/dist/formkrafter-wc/p-DMDO6w5-.js +0 -2
@@ -0,0 +1 @@
1
+ function t(t,n,e){const o="undefined"!=typeof HTMLElement?HTMLElement.prototype:null;for(;t&&t!==o;){const o=Object.getOwnPropertyDescriptor(t,n);if(o&&(!e||o.get))return o;t=Object.getPrototypeOf(t)}}var n=(n,e)=>{var o;Object.entries(null!=(o=e.o.t)?o:{}).map((([o,[l]])=>{if(31&l||32&l){const l=n[o],s=t(Object.getPrototypeOf(n),o,!0)||Object.getOwnPropertyDescriptor(n,o);s&&Object.defineProperty(n,o,{get(){return s.get.call(this)},set(t){s.set.call(this,t)},configurable:!0,enumerable:!0}),e.l.has(o)?n[o]=e.l.get(o):void 0!==l&&(n[o]=l)}}))},e=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},o=(t,n)=>n in t,l=(t,n)=>(0,console.error)(t,n),s=new Map,i="http://www.w3.org/1999/xlink",r="undefined"!=typeof window?window:{},c=r.HTMLElement||class{},f={i:0,u:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,n,e,o)=>t.addEventListener(n,e,o),rel:(t,n,e,o)=>t.removeEventListener(n,e,o),ce:(t,n)=>new CustomEvent(t,n)},u=(()=>{var t;let n=!1;try{null==(t=r.document)||t.addEventListener("e",null,Object.defineProperty({},"passive",{get(){n=!0}}))}catch(t){}return n})(),a=(()=>{try{return!!r.document.adoptedStyleSheets&&(new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync)}catch(t){}return!1})(),d=!!a&&(()=>!!r.document&&Object.getOwnPropertyDescriptor(r.document.adoptedStyleSheets,"length").writable)(),p=!1,h=[],v=[],b=(t,n)=>e=>{t.push(e),p||(p=!0,n&&4&f.i?$(y):f.raf(y))},m=t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(t){l(t)}t.length=0},y=()=>{m(h),m(v),(p=h.length>0)&&f.raf(y)},$=t=>Promise.resolve(undefined).then(t),g=b(v,!0),w=t=>{const n=new URL(t,f.u);return n.origin!==r.location.origin?n.href:n.pathname},j=t=>f.u=t,O=t=>{const n=E(t,"childNodes");t.tagName&&t.tagName.includes("-")&&t["s-cr"]&&"SLOT-FB"!==t.tagName&&S(n,t.tagName).forEach((t=>{1===t.nodeType&&"SLOT-FB"===t.tagName&&(t.hidden=!!k(t,M(t),!1).length)}));let e=0;for(e=0;e<n.length;e++){const t=n[e];1===t.nodeType&&E(t,"childNodes").length&&O(t)}};function S(t,n,e){let o,l=0,s=[];for(;l<t.length;l++){if(o=t[l],o["s-sr"]&&(!n||o["s-hn"]===n)&&(void 0===e||M(o)===e)&&(s.push(o),void 0!==e))return s;s=[...s,...S(o.childNodes,n,e)]}return s}var k=(t,n,e=!0)=>{const o=[];(e&&t["s-sr"]||!t["s-sr"])&&o.push(t);let l=t;for(;l=l.nextSibling;)M(l)!==n||!e&&l["s-sr"]||o.push(l);return o},N=(t,n)=>1===t.nodeType?null===t.getAttribute("slot")&&""===n||t.getAttribute("slot")===n:t["s-sn"]===n||""===n,M=t=>"string"==typeof t["s-sn"]?t["s-sn"]:1===t.nodeType&&t.getAttribute("slot")||void 0;function E(t,n){if("__"+n in t){const e=t["__"+n];return"function"!=typeof e?e:e.bind(t)}return"function"!=typeof t[n]?t[n]:t[n].bind(t)}var _,A,C,L=new WeakMap,x=t=>"sc-"+t.p,R=t=>"object"==(t=typeof t)||"function"===t,T=(t,n,...e)=>{let o=null,l=null,s=null,i=!1,r=!1;const c=[],f=n=>{for(let e=0;e<n.length;e++)o=n[e],Array.isArray(o)?f(o):null!=o&&"boolean"!=typeof o&&((i="function"!=typeof t&&!R(o))&&(o=String(o)),i&&r?c[c.length-1].h+=o:c.push(i?F(null,o):o),r=i)};if(f(e),n){n.key&&(l=n.key),n.name&&(s=n.name);{const t=n.className||n.class;t&&(n.class="object"!=typeof t?t:Object.keys(t).filter((n=>t[n])).join(" "))}}const u=F(t,null);return u.v=n,c.length>0&&(u.m=c),u.$=l,u.j=s,u},F=(t,n)=>({i:0,O:t,h:null!=n?n:null,S:null,m:null,v:null,$:null,j:null}),D={},H=t=>{if(!t)return;const n=Object.keys(t);if(0===n.length)return;let e=!1;for(const o of n){if(e)break;for(const n of t[o])if("string"==typeof n){e=!0;break}}if(!e)return t;const o={};for(const e of n)o[e]=t[e].map((t=>"string"==typeof t?{[t]:0}:t));return o},P=(t,n)=>null==t||R(t)?t:4&n?"false"!==t&&(""===t||!!t):1&n?String(t):t,W=(t,n)=>{const e=t;return{emit:t=>U(e,n,{bubbles:!0,composed:!0,cancelable:!0,detail:t})}},U=(t,n,e)=>{const o=f.ce(n,e);return t.dispatchEvent(o),o},B=(t,n,l,s,c,u)=>{if(l===s)return;let a=o(t,n),d=n.toLowerCase();if("class"===n){const n=t.classList,e=q(l);let o=q(s);n.remove(...e.filter((t=>t&&!o.includes(t)))),n.add(...o.filter((t=>t&&!e.includes(t))))}else if("style"===n){for(const n in l)s&&null!=s[n]||(n.includes("-")?t.style.removeProperty(n):t.style[n]="");for(const n in s)l&&s[n]===l[n]||(n.includes("-")?t.style.setProperty(n,s[n]):t.style[n]=s[n])}else if("key"===n);else if("ref"===n)s&&dt(s,t);else if(t.__lookupSetter__(n)||"o"!==n[0]||"n"!==n[1]){if("a"===n[0]&&n.startsWith("attr:")){const o=n.slice(5);let l;{const n=e(t);if(n&&n.o&&n.o.t){const t=n.o.t[o];t&&t[1]&&(l=t[1])}}return l||(l=o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()),void(null==s||!1===s?!1===s&&""!==t.getAttribute(l)||t.removeAttribute(l):t.setAttribute(l,!0===s?"":s))}if("p"===n[0]&&n.startsWith("prop:")){const e=n.slice(5);try{t[e]=s}catch(t){}return}{const e=R(s);if((a||e&&null!==s)&&!c)try{if(t.tagName.includes("-"))t[n]!==s&&(t[n]=s);else{const e=null==s?"":s;"list"===n?a=!1:null!=l&&t[n]===e||("function"==typeof t.__lookupSetter__(n)?t[n]=e:t.setAttribute(n,e))}}catch(t){}let o=!1;d!==(d=d.replace(/^xlink\:?/,""))&&(n=d,o=!0),null==s||!1===s?!1===s&&""!==t.getAttribute(n)||(o?t.removeAttributeNS(i,n):t.removeAttribute(n)):(!a||4&u||c)&&!e&&1===t.nodeType&&(s=!0===s?"":s,o?t.setAttributeNS(i,n,s):t.setAttribute(n,s))}}else if(n="-"===n[2]?n.slice(3):o(r,d)?d.slice(2):d[2]+n.slice(3),l||s){const e=n.endsWith(z);n=n.replace(Y,""),l&&f.rel(t,n,l,e),s&&f.ael(t,n,s,e)}},V=/\s/,q=t=>("object"==typeof t&&t&&"baseVal"in t&&(t=t.baseVal),t&&"string"==typeof t?t.split(V):[]),z="Capture",Y=new RegExp(z+"$"),I=(t,n,e)=>{const o=11===n.S.nodeType&&n.S.host?n.S.host:n.S,l=t&&t.v||{},s=n.v||{};for(const t of Z(Object.keys(l)))t in s||B(o,t,l[t],void 0,e,n.i);for(const t of Z(Object.keys(s)))B(o,t,l[t],s[t],e,n.i)};function Z(t){return t.includes("ref")?[...t.filter((t=>"ref"!==t)),"ref"]:t}var G=!1,J=!1,K=!1,Q=!1,X=[],tt=[],nt=(t,n,e)=>{var o;const l=n.m[e];let s,i,c,f=0;if(G||(K=!0,"slot"===l.O&&(l.i|=l.m?2:1)),null!=l.h)s=l.S=r.document.createTextNode(l.h);else if(1&l.i)s=l.S=r.document.createTextNode(""),I(null,l,Q);else{if(Q||(Q="svg"===l.O),!r.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");if(s=l.S=r.document.createElementNS(Q?"http://www.w3.org/2000/svg":"http://www.w3.org/1999/xhtml",!G&&2&l.i?"slot-fb":l.O),Q&&"foreignObject"===l.O&&(Q=!1),I(null,l,Q),null!=(u=_)&&void 0!==u&&s["s-si"]!==_&&s.classList.add(s["s-si"]=_),l.m){const n="template"===l.O?s.content:s;for(f=0;f<l.m.length;++f)i=nt(t,l,f),i&&n.appendChild(i)}"svg"===l.O?Q=!1:"foreignObject"===s.tagName&&(Q=!0)}var u;return s["s-hn"]=C,3&l.i&&(s["s-sr"]=!0,s["s-cr"]=A,s["s-sn"]=l.j||"",s["s-rf"]=null==(o=l.v)?void 0:o.ref,function(t){if(t.assignedElements||t.assignedNodes||!t["s-sr"])return;const n=n=>function(t){const e=[],o=this["s-sn"];(null==t?void 0:t.flatten)&&console.error("\n Flattening is not supported for Stencil non-shadow slots.\n You can use `.childNodes` to nested slot fallback content.\n If you have a particular use case, please open an issue on the Stencil repo.\n ");const l=this["s-cr"].parentElement;return(l.__childNodes?l.childNodes:(t=>{const n=[];for(let e=0;e<t.length;e++){const o=t[e]["s-nr"]||void 0;o&&o.isConnected&&n.push(o)}return n})(l.childNodes)).forEach((t=>{o===M(t)&&e.push(t)})),n?e.filter((t=>1===t.nodeType)):e}.bind(t);t.assignedElements=n(!0),t.assignedNodes=n(!1)}(s),c=t&&t.m&&t.m[e],c&&c.O===l.O&&t.S&&et(t.S),ht(A,s,n.S,null==t?void 0:t.S)),s},et=t=>{f.i|=1;const n=t.closest(C.toLowerCase());if(null!=n){const e=Array.from(n.__childNodes||n.childNodes).find((t=>t["s-cr"])),o=Array.from(t.__childNodes||t.childNodes);for(const t of e?o.reverse():o)null!=t["s-sh"]&&(pt(n,t,null!=e?e:null),t["s-sh"]=void 0,K=!0)}f.i&=-2},ot=(t,n)=>{f.i|=1;const e=Array.from(t.__childNodes||t.childNodes);if(t["s-sr"]){let n=t;for(;n=n.nextSibling;)n&&n["s-sn"]===t["s-sn"]&&n["s-sh"]===C&&e.push(n)}for(let t=e.length-1;t>=0;t--){const o=e[t];o["s-hn"]!==C&&o["s-ol"]&&(pt(rt(o).parentNode,o,rt(o)),o["s-ol"].remove(),o["s-ol"]=void 0,o["s-sh"]=void 0,K=!0),n&&ot(o,n)}f.i&=-2},lt=(t,n,e,o,l,s)=>{let i,r=t["s-cr"]&&t["s-cr"].parentNode||t;for("template"===e.O&&(r=r.content);l<=s;++l)o[l]&&(i=nt(null,e,l),i&&(o[l].S=i,pt(r,i,rt(n))))},st=(t,n,e)=>{for(let o=n;o<=e;++o){const n=t[o];if(n){const t=n.S;at(n),t&&(J=!0,t["s-ol"]?t["s-ol"].remove():ot(t,!0),t.remove())}}},it=(t,n,e=!1)=>t.O===n.O&&("slot"===t.O?t.j===n.j:e?(e&&!t.$&&n.$&&(t.$=n.$),!0):t.$===n.$),rt=t=>t&&t["s-ol"]||t,ct=(t,n,e=!1)=>{const o=n.S=t.S,l=t.m,s=n.m,i=n.O,r=n.h;let c;null==r?(Q="svg"===i||"foreignObject"!==i&&Q,"slot"!==i||G||t.j!==n.j&&(n.S["s-sn"]=n.j||"",et(n.S.parentElement)),I(t,n,Q),null!==l&&null!==s?((t,n,e,o,l=!1)=>{let s,i,r=0,c=0,f=0,u=0,a=n.length-1,d=n[0],p=n[a],h=o.length-1,v=o[0],b=o[h];const m="template"===e.O?t.content:t;for(;r<=a&&c<=h;)if(null==d)d=n[++r];else if(null==p)p=n[--a];else if(null==v)v=o[++c];else if(null==b)b=o[--h];else if(it(d,v,l))ct(d,v,l),d=n[++r],v=o[++c];else if(it(p,b,l))ct(p,b,l),p=n[--a],b=o[--h];else if(it(d,b,l))"slot"!==d.O&&"slot"!==b.O||ot(d.S.parentNode,!1),ct(d,b,l),pt(m,d.S,p.S.nextSibling),d=n[++r],b=o[--h];else if(it(p,v,l))"slot"!==d.O&&"slot"!==b.O||ot(p.S.parentNode,!1),ct(p,v,l),pt(m,p.S,d.S),p=n[--a],v=o[++c];else{for(f=-1,u=r;u<=a;++u)if(n[u]&&null!==n[u].$&&n[u].$===v.$){f=u;break}f>=0?(i=n[f],i.O!==v.O?s=nt(n&&n[c],e,f):(ct(i,v,l),n[f]=void 0,s=i.S),v=o[++c]):(s=nt(n&&n[c],e,c),v=o[++c]),s&&pt(rt(d.S).parentNode,s,rt(d.S))}r>a?lt(t,null==o[h+1]?null:o[h+1].S,e,o,c,h):c>h&&st(n,r,a)})(o,l,n,s,e):null!==s?(null!==t.h&&(o.textContent=""),lt(o,null,n,s,0,s.length-1)):!e&&null!==l&&st(l,0,l.length-1),Q&&"svg"===i&&(Q=!1)):(c=o["s-cr"])?c.parentNode.textContent=r:t.h!==r&&(o.data=r)},ft=[],ut=t=>{let n,e,o;const l=t.__childNodes||t.childNodes;for(const t of l){if(t["s-sr"]&&(n=t["s-cr"])&&n.parentNode){e=n.parentNode.__childNodes||n.parentNode.childNodes;const l=t["s-sn"];for(o=e.length-1;o>=0;o--)if(n=e[o],!(n["s-cn"]||n["s-nr"]||n["s-hn"]===t["s-hn"]||n["s-sh"]&&n["s-sh"]===t["s-hn"]))if(N(n,l)){let e=ft.find((t=>t.k===n));J=!0,n["s-sn"]=n["s-sn"]||l,e?(e.k["s-sh"]=t["s-hn"],e.N=t):(n["s-sh"]=t["s-hn"],ft.push({N:t,k:n})),n["s-sr"]&&ft.map((t=>{N(t.k,n["s-sn"])&&(e=ft.find((t=>t.k===n)),e&&!t.N&&(t.N=e.N))}))}else ft.some((t=>t.k===n))||ft.push({k:n})}1===t.nodeType&&ut(t)}},at=t=>{t.v&&t.v.ref&&X.push((()=>t.v.ref(null))),t.m&&t.m.map(at)},dt=(t,n)=>{tt.push((()=>t(n)))},pt=(t,n,e,o)=>{if("string"==typeof n["s-sn"]&&n["s-sr"]&&n["s-cr"])ht(n["s-cr"],n,t,n.parentElement);else if("string"==typeof n["s-sn"]){t.insertBefore(n,e);const{slotNode:l}=function(t,n){var e;if(!(n=n||(null==(e=t["s-ol"])?void 0:e.parentElement)))return{slotNode:null,slotName:""};const o=t["s-sn"]=M(t)||"";return{slotNode:S(E(n,"childNodes"),n.tagName,o)[0],slotName:o}}(n);return l&&!o&&l.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1,composed:!1})),n}return t.__insertBefore?t.__insertBefore(n,e):null==t?void 0:t.insertBefore(n,e)};function ht(t,n,e,o){var l,s;let i;if(t&&"string"==typeof n["s-sn"]&&n["s-sr"]&&t.parentNode&&t.parentNode["s-sc"]&&(i=n["s-si"]||t.parentNode["s-sc"])){const t=n["s-sn"],r=n["s-hn"];if(null==(l=e.classList)||l.add(i+"-s"),o&&(null==(s=o.classList)?void 0:s.contains(i+"-s"))){let n=(o.__childNodes||o.childNodes)[0],e=!1;for(;n;){if(n["s-sn"]!==t&&n["s-hn"]===r&&n["s-sr"]){e=!0;break}n=n.nextSibling}e||o.classList.remove(i+"-s")}}}var vt=(t,n,e=!1)=>{var o,l,s,i,c;const u=t.$hostElement$,a=t.o,d=t.M||F(null,null);var p;const h=(p=n)&&p.O===D?n:T(null,null,n);if(C=u.tagName,e&&h.v)for(const t of Object.keys(h.v))u.hasAttribute(t)&&!["key","ref","style","class"].includes(t)&&(h.v[t]=u[t]);if(h.O=null,h.i|=4,t.M=h,h.S=d.S=u,_=u["s-sc"],G=false,A=u["s-cr"],J=!1,ct(d,h,e),f.i|=1,K){ut(h.S);for(const t of ft){const n=t.k;if(!n["s-ol"]&&r.document){const t=r.document.createTextNode("");t["s-nr"]=n,pt(n.parentNode,n["s-ol"]=t,n,e)}}for(const t of ft){const n=t.k,c=t.N;if(1===n.nodeType&&e&&(n["s-ih"]=null!=(o=n.hidden)&&o),c){const t=c.parentNode;let o=c.nextSibling;if(o&&1===o.nodeType){let e=null==(l=n["s-ol"])?void 0:l.previousSibling;for(;e;){let l=null!=(s=e["s-nr"])?s:null;if(l&&l["s-sn"]===n["s-sn"]&&t===(l.__parentNode||l.parentNode)){for(l=l.nextSibling;l===n||(null==l?void 0:l["s-sr"]);)l=null==l?void 0:l.nextSibling;if(!l||!l["s-nr"]){o=l;break}}e=e.previousSibling}}if((!o&&t!==(n.__parentNode||n.parentNode)||(n.__nextSibling||n.nextSibling)!==o)&&n!==o){if(pt(t,n,o,e),8===n.nodeType&&n.nodeValue.startsWith("s-nt-")){const t=r.document.createTextNode(n.nodeValue.replace(/^s-nt-/,""));t["s-hn"]=n["s-hn"],t["s-sn"]=n["s-sn"],t["s-sh"]=n["s-sh"],t["s-sr"]=n["s-sr"],t["s-ol"]=n["s-ol"],t["s-ol"]["s-nr"]=t,pt(n.parentNode,t,n,e),n.parentNode.removeChild(n)}1===n.nodeType&&"SLOT-FB"!==n.tagName&&(n.hidden=null!=(i=n["s-ih"])&&i)}n&&"function"==typeof c["s-rf"]&&c["s-rf"](c)}else 1===n.nodeType&&(n.hidden=!0)}}if(J&&O(h.S),f.i&=-2,ft.length=0,!G&&!(1&a.i)&&u["s-cr"]){const t=h.S.__childNodes||h.S.childNodes;for(const n of t)if(n["s-hn"]!==C&&!n["s-sh"])if(e&&null==n["s-ih"]&&(n["s-ih"]=null!=(c=n.hidden)&&c),1===n.nodeType)n.hidden=!0;else if(3===n.nodeType&&n.nodeValue.trim()){const t=r.document.createComment("s-nt-"+n.nodeValue);t["s-sn"]=n["s-sn"],pt(n.parentNode,t,n,e),n.parentNode.removeChild(n)}}A=void 0,X.forEach((t=>t())),X.length=0,tt.forEach((t=>t())),tt.length=0},bt=(t,n)=>{if(n&&!t._&&n["s-p"]){const e=n["s-p"].push(new Promise((o=>t._=()=>{n["s-p"].splice(e-1,1),o()})))}},mt=(t,n)=>{if(t.i|=16,4&t.i)return void(t.i|=512);bt(t,t.A);const e=()=>yt(t,n);if(!n)return g(e);queueMicrotask((()=>{e()}))},yt=(t,n)=>{const e=t.$hostElement$,o=e;if(!o)throw new Error(`Can't render component <${e.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return l=kt(o,n?"componentWillLoad":"componentWillUpdate",void 0,e),l=$t(l,(()=>kt(o,"componentWillRender",void 0,e))),$t(l,(()=>wt(t,o,n)))},$t=(t,n)=>gt(t)?t.then(n).catch((t=>{console.error(t),n()})):n(),gt=t=>t instanceof Promise||t&&t.then&&"function"==typeof t.then,wt=async(t,n,e)=>{var o;const l=t.$hostElement$,i=l["s-rc"];e&&(t=>{const n=t.o,e=t.$hostElement$,o=n.i,l=((t,n)=>{var e,o,l;const i=x(n),c=s.get(i);if(!r.document)return i;if(t=11===t.nodeType?t:r.document,c)if("string"==typeof c){let l,s=L.get(t=t.head||t);if(s||L.set(t,s=new Set),!s.has(i)){l=r.document.createElement("style"),l.textContent=c;const u=null!=(e=f.C)?e:function(){var t,n,e;return null!=(e=null==(n=null==(t=r.document.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?e:void 0}();if(null!=u&&l.setAttribute("nonce",u),!(1&n.i))if("HEAD"===t.nodeName){const n=t.querySelectorAll("link[rel=preconnect]"),e=n.length>0?n[n.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(null==e?void 0:e.parentNode)===t?e:null)}else if("host"in t)if(a){const n=new(null!=(o=t.defaultView)?o:t.ownerDocument.defaultView).CSSStyleSheet;n.replaceSync(c),d?t.adoptedStyleSheets.unshift(n):t.adoptedStyleSheets=[n,...t.adoptedStyleSheets]}else{const n=t.querySelector("style");n?n.textContent=c+n.textContent:t.prepend(l)}else t.append(l);1&n.i&&t.insertBefore(l,null),4&n.i&&(l.textContent+="slot-fb{display:contents}slot-fb[hidden]{display:none}"),s&&s.add(i)}}else{let n=L.get(t);if(n||L.set(t,n=new Set),!n.has(i)){const e=null!=(l=t.defaultView)?l:t.ownerDocument.defaultView;let o;if(c.constructor===e.CSSStyleSheet)o=c;else{o=new e.CSSStyleSheet;for(let t=0;t<c.cssRules.length;t++)o.insertRule(c.cssRules[t].cssText,t)}d?t.adoptedStyleSheets.push(o):t.adoptedStyleSheets=[...t.adoptedStyleSheets,o],n.add(i)}}return i})(e.getRootNode(),n);10&o&&(e["s-sc"]=l,e.classList.add(l+"-h"))})(t);jt(t,n,l,e),i&&(i.map((t=>t())),l["s-rc"]=void 0);{const n=null!=(o=l["s-p"])?o:[],e=()=>Ot(t);0===n.length?e():(Promise.all(n).then(e).catch(e),t.i|=4,n.length=0)}},jt=(t,n,e,o)=>{try{n=n.render(),t.i&=-17,t.i|=2,vt(t,n,o)}catch(n){l(n,t.$hostElement$)}return null},Ot=t=>{const n=t.$hostElement$,e=n,o=t.A;kt(e,"componentDidRender",void 0,n),64&t.i?kt(e,"componentDidUpdate",void 0,n):(t.i|=64,Nt(n),kt(e,"componentDidLoad",void 0,n),t.L(n),o||St()),t._&&(t._(),t._=void 0),512&t.i&&$((()=>mt(t,!1))),t.i&=-517},St=()=>{$((()=>U(r,"appload",{detail:{namespace:"formkrafter-wc"}})))},kt=(t,n,e,o)=>{if(t&&t[n])try{return t[n](e)}catch(t){l(t,o)}},Nt=t=>t.classList.add("hydrated"),Mt=(t,n,o,s)=>{const i=e(t);if(!i)return;const r=t,c=i.l.get(n),f=i.i,u=r;o=P(o,s.t[n][0]);const a=Number.isNaN(c)&&Number.isNaN(o);if(o!==c&&!a){if(i.l.set(n,o),s.R){const t=s.R[n];t&&t.map((t=>{try{const[[e,l]]=Object.entries(t);(128&f||1&l)&&(u?u[e](o,c,n):i.T.push((()=>{i.F[e](o,c,n)})))}catch(t){l(t,r)}}))}if(2&f){if(u.componentShouldUpdate&&!1===u.componentShouldUpdate(o,c,n)&&!(16&f))return;16&f||mt(i,!1)}}},Et=(n,o)=>{var l,s;const i=n.prototype;{n.watchers&&!o.R&&(o.R=H(n.watchers)),n.deserializers&&!o.D&&(o.D=n.deserializers),n.serializers&&!o.H&&(o.H=n.serializers);const r=Object.entries(null!=(l=o.t)?l:{});r.map((([n,[l]])=>{if(31&l||32&l){const{get:s,set:r}=t(i,n)||{};s&&(o.t[n][0]|=2048),r&&(o.t[n][0]|=4096),Object.defineProperty(i,n,{get(){return s?s.apply(this):(t=n,e(this).l.get(t));var t},configurable:!0,enumerable:!0}),Object.defineProperty(i,n,{set(t){const s=e(this);if(s){if(r)return void 0===(32&l?this[n]:s.$hostElement$[n])&&s.l.get(n)&&(t=s.l.get(n)),r.apply(this,[P(t,l)]),void Mt(this,n,t=32&l?this[n]:s.$hostElement$[n],o);Mt(this,n,t,o)}}})}}));{const t=new Map;i.attributeChangedCallback=function(n,l,s){f.jmp((()=>{var c;const f=t.get(n),u=e(this);if(this.hasOwnProperty(f),i.hasOwnProperty(f)&&"number"==typeof this[f]&&this[f]==s)return;if(null==f){const t=null==u?void 0:u.i;if(u&&t&&!(8&t)&&s!==l){const e=this,i=null==(c=o.R)?void 0:c[n];null==i||i.forEach((o=>{const[[i,r]]=Object.entries(o);null!=e[i]&&(128&t||1&r)&&e[i].call(e,s,l,n)}))}return}const a=r.find((([t])=>t===f)),d=a&&4&a[1][0],p=d&&null===s&&void 0===this[f];d&&(s=null!==s&&"false"!==s);const h=Object.getOwnPropertyDescriptor(i,f);p||s==this[f]||h.get&&!h.set||(this[f]=s)}))},n.observedAttributes=Array.from(new Set([...Object.keys(null!=(s=o.R)?s:{}),...r.filter((([t,n])=>31&n[0])).map((([n,e])=>{const o=e[1]||n;return t.set(o,n),o}))]))}}return n},_t=(t,o)=>{const i={i:o[0],p:o[1]};try{i.t=o[2],i.P=o[3],i.R=H(t.R),i.D=t.D,i.H=t.H;const c=t.prototype.connectedCallback,u=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){((t,e)=>{const o={i:0,$hostElement$:t,o:e,l:new Map,W:new Map};o.U=new Promise((t=>o.L=t)),t["s-p"]=[],t["s-rc"]=[];const l=o;t.__stencil__getHostRef=()=>l,512&e.i&&n(t,o)})(this,i)},connectedCallback(){if(!this.__hasHostListenerAttached){const t=e(this);if(!t)return;At(this,t,i.P),this.__hasHostListenerAttached=!0}(t=>{if(!(1&f.i)){const n=e(t);if(!n)return;const o=n.o,i=()=>{};if(1&n.i)At(t,n,o.P),(null==n?void 0:n.F)||(null==n?void 0:n.U)&&n.U.then((()=>{}));else{n.i|=1,12&o.i&&(t=>{if(!r.document)return;const n=t["s-cr"]=r.document.createComment("");n["s-cn"]=!0,pt(t,n,t.firstChild)})(t);{let e=t;for(;e=e.parentNode||e.host;)if(e["s-p"]){bt(n,n.A=e);break}}o.t&&Object.entries(o.t).map((([n,[e]])=>{if(31&e&&Object.prototype.hasOwnProperty.call(t,n)){const e=t[n];delete t[n],t[n]=e}})),(async(t,n,e)=>{let o;try{if(!(32&n.i)&&(n.i|=32,o=t.constructor,customElements.whenDefined(t.localName).then((()=>n.i|=128)),o&&o.style)){let t;"string"==typeof o.style&&(t=o.style);const n=x(e);if(!s.has(n)){const o=()=>{};((t,n,e)=>{let o=s.get(t);a&&e?(o=o||new CSSStyleSheet,"string"==typeof o?o=n:o.replaceSync(n)):o=n,s.set(t,o)})(n,t,!!(1&e.i)),o()}}const l=n.A,i=()=>mt(n,!0);l&&l["s-rc"]?l["s-rc"].push(i):i()}catch(e){l(e,t),n._&&(n._(),n._=void 0),n.L&&n.L(t)}})(t,n,o)}i()}})(this),c&&c.call(this)},disconnectedCallback(){(async t=>{if(!(1&f.i)){const n=e(t);(null==n?void 0:n.B)&&(n.B.map((t=>t())),n.B=void 0)}L.has(t)&&L.delete(t),t.shadowRoot&&L.has(t.shadowRoot)&&L.delete(t.shadowRoot)})(this),u&&u.call(this)},__attachShadow(){this.shadowRoot=this}}),Object.defineProperty(t,"is",{value:i.p,configurable:!0}),Et(t,i)}catch(n){return l(n),t}},At=(t,n,e)=>{e&&r.document&&e.map((([e,o,l])=>{const s=Lt(r.document,t,e),i=Ct(n,l),c=xt(e);f.ael(s,o,i,c),(n.B=n.B||[]).push((()=>f.rel(s,o,i,c)))}))},Ct=(t,n)=>e=>{try{t.$hostElement$[n](e)}catch(n){l(n,t.$hostElement$)}},Lt=(t,n,e)=>4&e?t:n,xt=t=>u?{passive:!!(1&t),capture:!!(2&t)}:!!(2&t),Rt=t=>f.C=t,Tt=t=>Object.assign(f,t),Ft=new WeakMap;function Dt(t,n){let e=Ft.get(n);e||(e={i:0,o:{i:0,p:n.tagName},$hostElement$:n},Ft.set(n,e)),vt(e,t)}function Ht(t){return t}export{c as H,D as a,Rt as b,W as c,Tt as d,w as g,T as h,_t as p,Dt as r,j as s,Ht as t}
@@ -0,0 +1 @@
1
+ import{t,p as e,H as s,c as r,h as i}from"./p-BB4Llg42.js";import{b as p,v as o}from"./p-CKMHMpID.js";import{a}from"./p-BOmBVgfJ.js";const c=e(class extends s{constructor(t){super(),!1!==t&&this.__registerHost(),this.stepTouch=r(this,"stepTouch"),this.stepperSubmit=r(this,"stepperSubmit"),this.stepLabels=[],this.editable=!1,this.active=0,this.next=t=>{t.preventDefault(),!this.config("validateSteps",!1)||this.stepValid(this.active)?this.active=Math.min(this.active+1,this.stepLabels.length-1):this.stepTouch.emit({keys:this.stepKeys(this.active)})},this.back=t=>{t.preventDefault(),this.active=Math.max(this.active-1,0)},this.submit=t=>{t.preventDefault(),!this.config("validateSteps",!1)||this.stepValid(this.active)?this.stepperSubmit.emit():this.stepTouch.emit({keys:this.stepKeys(this.active)})}}clampActive(){this.active>Math.max(this.stepLabels.length-1,0)&&(this.active=0)}componentDidRender(){const t=this.host.querySelector(".fk-stepper__body");t&&Array.from(t.children).forEach(((t,e)=>{const s=t;this.editable?s.style.removeProperty("display"):s.style.display=e===this.active?"":"none"}))}config(t,e){var s,r;const i=null===(r=null===(s=this.spec)||void 0===s?void 0:s.configs)||void 0===r?void 0:r[t];return"boolean"==typeof i?i:e}stepSpec(t){var e,s,r;const i=null===(s=null===(e=this.spec)||void 0===e?void 0:e.children)||void 0===s?void 0:s[t];if(i&&this.spec)return(null===(r=this.stepCache)||void 0===r?void 0:r.source)!==this.spec&&(this.stepCache={source:this.spec,specs:[]}),this.stepCache.specs[t]||(this.stepCache.specs[t]={type:"panel",id:"step",name:"Step",configs:{key:`step_${t}`},children:[i]}),this.stepCache.specs[t]}stepKeys(t){var e,s,r;const i=null===(s=null===(e=this.spec)||void 0===e?void 0:e.children)||void 0===s?void 0:s[t];if(!i)return[];const o=[];for(const t of p(i))(null===(r=t.configs)||void 0===r?void 0:r.key)&&o.push(t.configs.key);return o}stepValid(t){var e;const s=this.stepSpec(t);if(!s)return!0;const r=Object.fromEntries(Object.entries(null!==(e=this.dataMap)&&void 0!==e?e:{}).filter((([,t])=>""!==t&&null!=t)));return o(s,r,this.locale).valid}goToStep(t){if(this.editable||t<=this.active)this.active=t;else if(this.config("allowStepClick",!0)){if(this.config("validateSteps",!1))for(let e=this.active;e<t;e++)if(!this.stepValid(e))return this.active=e,void this.stepTouch.emit({keys:this.stepKeys(e)});this.active=t}}render(){const t=Math.max(this.stepLabels.length-1,0),e=!this.editable&&this.config("showSubmit",!1)&&this.active===t;return i("div",{key:"3a5a9d1aa6e870241cf5a353359fe89a7c4a376a",class:"fk-stepper"},i("ol",{key:"8d6b154016d12cd00827b8bddbe4d476dc378fab",class:"fk-stepper__nav"},this.stepLabels.map(((t,e)=>i("li",{key:`${e}-${t}`,class:{"fk-stepper__step":!0,"fk-stepper__step--active":e===this.active,"fk-stepper__step--done":!this.editable&&e<this.active}},i("button",{type:"button",class:"fk-stepper__step-button","aria-current":e===this.active?"step":void 0,onClick:t=>{t.preventDefault(),this.goToStep(e)}},i("span",{class:"fk-stepper__index"},e+1),i("span",{class:"fk-stepper__label"},t)))))),i("div",{key:"cd902a9df2d72a4d7f452e7621287df50a89d3c4",class:"fk-stepper__body"},i("slot",{key:"ab689448817eaf7b5ddfc9146e18411fe6b5924c"})),!this.editable&&this.stepLabels.length>1?i("div",{class:"fk-stepper__actions"},i("button",{type:"button",class:"fk-stepper__button",disabled:0===this.active,onClick:this.back},a("stepper.back")),this.active<t?i("button",{type:"button",class:"fk-stepper__button fk-stepper__button--primary",onClick:this.next},a("stepper.next")):null,e?i("button",{type:"button",class:"fk-stepper__button fk-stepper__button--primary",onClick:this.submit},a("stepper.submit")):null):null)}get host(){return this}static get watchers(){return{stepLabels:[{clampActive:0}]}}static get style(){return".sc-fk-stepper-h{display:block}.fk-stepper.sc-fk-stepper{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-stepper__nav.sc-fk-stepper{display:flex;flex-wrap:wrap;gap:calc(var(--fk-spacing) * 1.5);margin:0;padding:0 0 var(--fk-spacing);list-style:none;border-bottom:1px solid var(--fk-color-border)}.fk-stepper__step.sc-fk-stepper{display:flex;align-items:center;gap:calc(var(--fk-spacing) / 2);cursor:pointer;color:var(--fk-color-muted);font-size:0.85rem}.fk-stepper__index.sc-fk-stepper{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;border:1px solid var(--fk-color-border);font-size:0.72rem;font-weight:700}.fk-stepper__step--active.sc-fk-stepper{color:var(--fk-color-text);font-weight:600}.fk-stepper__step--active.sc-fk-stepper .fk-stepper__index.sc-fk-stepper{border-color:var(--fk-color-primary);background:var(--fk-color-primary);color:#ffffff}.fk-stepper__step--done.sc-fk-stepper .fk-stepper__index.sc-fk-stepper{border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-stepper__actions.sc-fk-stepper{display:flex;justify-content:space-between;padding-top:var(--fk-spacing);border-top:1px solid var(--fk-color-border)}.fk-stepper__button.sc-fk-stepper{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) calc(var(--fk-spacing) * 1.5);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface);color:var(--fk-color-text);cursor:pointer}.fk-stepper__button--primary.sc-fk-stepper{border-color:var(--fk-color-primary);background:var(--fk-color-primary);color:#ffffff}.fk-stepper__button.sc-fk-stepper:disabled{opacity:0.45;cursor:not-allowed}.fk-stepper__step-button.sc-fk-stepper{all:unset;display:inline-flex;align-items:center;gap:inherit;cursor:pointer}.fk-stepper__step-button.sc-fk-stepper:focus-visible{outline:2px solid color-mix(in srgb, var(--fk-color-primary) 55%, transparent);outline-offset:2px;border-radius:calc(var(--fk-radius) / 2)}"}},[262,"fk-stepper",{stepLabels:[16],editable:[4],spec:[16],dataMap:[16],locale:[1],active:[32]},void 0,{stepLabels:[{clampActive:0}]}]);function n(){"undefined"!=typeof customElements&&["fk-stepper"].forEach((e=>{"fk-stepper"===e&&(customElements.get(t(e))||customElements.define(t(e),c))}))}n();export{c as F,n as d}
@@ -0,0 +1 @@
1
+ var e;const a={"palette.search":"Search bricks…","palette.empty":"No brick matches “{query}”","builder.undo":"Undo","builder.redo":"Redo","builder.copyJson":"Copy JSON","builder.importJson":"Import JSON","builder.importInvalid":"Invalid form JSON","builder.pasteHint":"Press Ctrl+V to paste a spec","builder.copied":"Copied!","builder.downloadJson":"Download .json","builder.hint":"Select a brick to edit its properties","drop.hint":"Drop a brick here","empty.title":"Your form is empty","empty.hint":"Drag a brick from the palette to get started","actions.move":"Move","actions.duplicate":"Duplicate","actions.delete":"Delete","stepper.back":"← Back","stepper.next":"Next →","stepper.submit":"Submit","panel.cfg.validateSteps":"Validate each step","panel.cfg.allowStepClick":"Allow clicking steps to jump","panel.cfg.showSubmit":"Submit button on last step","panel.cfg.validateTabs":"Validate tab before leaving it","signature.clear":"Clear","panel.tab.config":"Config","panel.tab.validation":"Validation","panel.tab.styles":"Styles","panel.tab.rules":"Rules","panel.key":"Key","panel.label":"Label","panel.placeholder":"Placeholder","panel.prefix":"Prefix","panel.suffix":"Suffix","panel.accept":"Accepted file types","panel.uploadUrl":"Upload URL","panel.cfg.multiple":"Allow multiple files","panel.optionsSource":"Options source","panel.options":"Options (one per line)","panel.content":"Content","panel.dataKey":"Data key","panel.url":"URL","panel.headers":"Headers ({token} reads form data)","panel.searchParam":"Server search param","panel.labelKey":"Label key","panel.valueKey":"Value key","panel.errorMessage":"Error message","panel.required":"Required","panel.minLength":"Min length","panel.maxLength":"Max length","panel.min":"Min","panel.max":"Max","panel.pattern":"Pattern (regex)","panel.minItems":"Min items","panel.maxItems":"Max items","panel.emailFormat":"Email format","panel.urlFormat":"URL format","panel.custom":"Custom (JavaScript)","panel.fallbackMessage":"Fallback message","panel.styleProperty":"property","panel.styleValue":"value","file.choose":"Choose a file…","file.uploading":"Uploading…","file.remove":"Remove file","file.addAnother":"+ Add a file","address.street":"Street","address.city":"City","address.zip":"Postal code","address.country":"Country","grid.addRow":"+ Add row","grid.removeRow":"Remove row","grid.empty":"No rows yet","grid.columns":"Row template","select.search":"Search…","select.empty":"No options","select.clear":"Clear","rules.when":"When","rules.then":"Then","rules.addRule":"+ Add rule","rules.addEffect":"+ Effect","rules.removeRule":"Remove rule","rules.removeEffect":"Remove effect","rules.mode.simple":"simple","rules.mode.json":"json","rules.mode.js":"JS","category.Inputs":"Inputs","category.Layout":"Layout","category.Data":"Data","brick.text.name":"Text","brick.email.name":"Email","brick.password.name":"Password","brick.url.name":"URL","brick.phone.name":"Phone","brick.textarea.name":"Text area","brick.number.name":"Number","brick.date.name":"Date","brick.time.name":"Time","brick.datetime.name":"Date / Time","brick.select.name":"Select","brick.multi-select.name":"Multi select","brick.radio.name":"Radio","brick.select-boxes.name":"Select boxes","brick.checkbox.name":"Checkbox","brick.tags.name":"Tags","brick.signature.name":"Signature","brick.data-grid.name":"Data grid","brick.address.name":"Address","brick.file.name":"File","brick.hidden.name":"Hidden","brick.content.name":"Content","brick.recap.name":"Recap","recap.empty":"Nothing to summarize yet.","recap.yes":"Yes","recap.no":"No","panel.cfg.showEmpty":"Show empty fields","panel.cfg.groupBySections":"Group by section","brick.group.name":"Group","brick.row.name":"Row","brick.column.name":"Column","brick.stepper.name":"Stepper","brick.tabs.name":"Tabs"},r={"palette.search":"Rechercher une brique…","palette.empty":"Aucune brique ne correspond à « {query} »","builder.undo":"Annuler","builder.redo":"Rétablir","builder.copyJson":"Copier le JSON","builder.importJson":"Importer le JSON","builder.importInvalid":"JSON de formulaire invalide","builder.pasteHint":"Collez avec Ctrl+V pour importer une spec","builder.copied":"Copié !","builder.downloadJson":"Télécharger le .json","builder.hint":"Sélectionnez une brique pour éditer ses propriétés","drop.hint":"Déposez une brique ici","empty.title":"Votre formulaire est vide","empty.hint":"Glissez une brique depuis la palette pour commencer","actions.move":"Déplacer","actions.duplicate":"Dupliquer","actions.delete":"Supprimer","stepper.back":"← Précédent","stepper.next":"Suivant →","stepper.submit":"Envoyer","panel.cfg.validateSteps":"Valider chaque étape","panel.cfg.allowStepClick":"Autoriser le saut d’étapes au clic","panel.cfg.showSubmit":"Bouton d’envoi à la dernière étape","panel.cfg.validateTabs":"Valider l’onglet avant de le quitter","signature.clear":"Effacer","panel.tab.config":"Config","panel.tab.validation":"Validation","panel.tab.styles":"Styles","panel.tab.rules":"Règles","panel.key":"Clé","panel.label":"Libellé","panel.placeholder":"Placeholder","panel.prefix":"Préfixe","panel.suffix":"Suffixe","panel.accept":"Types de fichiers acceptés","panel.uploadUrl":"URL d'upload","panel.cfg.multiple":"Autoriser plusieurs fichiers","panel.optionsSource":"Source des options","panel.options":"Options (une par ligne)","panel.content":"Contenu","panel.dataKey":"Clé de données","panel.url":"URL","panel.headers":"En-têtes ({token} lit les données du formulaire)","panel.searchParam":"Paramètre de recherche serveur","panel.labelKey":"Clé du libellé","panel.valueKey":"Clé de la valeur","panel.errorMessage":"Message d'erreur","panel.required":"Obligatoire","panel.minLength":"Longueur min","panel.maxLength":"Longueur max","panel.min":"Min","panel.max":"Max","panel.pattern":"Motif (regex)","panel.minItems":"Éléments min","panel.maxItems":"Éléments max","panel.emailFormat":"Format email","panel.urlFormat":"Format URL","panel.custom":"Personnalisé (JavaScript)","panel.fallbackMessage":"Message par défaut","panel.styleProperty":"propriété","panel.styleValue":"valeur","file.choose":"Choisir un fichier…","file.uploading":"Envoi en cours…","file.remove":"Retirer le fichier","file.addAnother":"+ Ajouter un fichier","address.street":"Rue","address.city":"Ville","address.zip":"Code postal","address.country":"Pays","grid.addRow":"+ Ajouter une ligne","grid.removeRow":"Supprimer la ligne","grid.empty":"Aucune ligne","grid.columns":"Modèle de ligne","select.search":"Rechercher…","select.empty":"Aucune option","select.clear":"Effacer","rules.when":"Quand","rules.then":"Alors","rules.addRule":"+ Ajouter une règle","rules.addEffect":"+ Effet","rules.removeRule":"Supprimer la règle","rules.removeEffect":"Supprimer l'effet","rules.mode.simple":"simple","rules.mode.json":"json","rules.mode.js":"JS","category.Inputs":"Champs","category.Layout":"Mise en page","category.Data":"Données","brick.text.name":"Texte","brick.email.name":"Email","brick.password.name":"Mot de passe","brick.url.name":"URL","brick.phone.name":"Téléphone","brick.textarea.name":"Zone de texte","brick.number.name":"Nombre","brick.date.name":"Date","brick.time.name":"Heure","brick.datetime.name":"Date / Heure","brick.select.name":"Liste déroulante","brick.multi-select.name":"Sélection multiple","brick.radio.name":"Boutons radio","brick.select-boxes.name":"Cases à cocher","brick.checkbox.name":"Case à cocher","brick.tags.name":"Étiquettes","brick.signature.name":"Signature","brick.data-grid.name":"Grille de données","brick.address.name":"Adresse","brick.file.name":"Fichier","brick.hidden.name":"Caché","brick.content.name":"Contenu","brick.recap.name":"Récapitulatif","recap.empty":"Rien à récapituler pour le moment.","recap.yes":"Oui","recap.no":"Non","panel.cfg.showEmpty":"Afficher les champs vides","panel.cfg.groupBySections":"Regrouper par section","brick.group.name":"Groupe","brick.row.name":"Ligne","brick.column.name":"Colonne","brick.stepper.name":"Étapes","brick.tabs.name":"Onglets"},l=Symbol.for("formkrafter.wc.i18n"),t=globalThis,n=null!==(e=t[l])&&void 0!==e?e:t[l]={current:Object.assign({},a)};function i(e={}){n.current=Object.assign(Object.assign({},a),e)}function o(e,a){var r;let l=null!==(r=n.current[e])&&void 0!==r?r:e;for(const[e,r]of Object.entries(null!=a?a:{}))l=l.replace(`{${e}}`,String(r));return l}function s(e,a){var r;return null!==(r=n.current[e])&&void 0!==r?r:a}export{o as a,r as b,s as f,i as s}
@@ -0,0 +1 @@
1
+ import{t as i,p as t,H as s,c as e,h as r}from"./p-BB4Llg42.js";import{g as o,r as n}from"./p-CKMHMpID.js";import{b as a}from"./p-gPc0o8Jb.js";import{d as l}from"./p-DYchD23x.js";import{d as c}from"./p-NDbmiiYk.js";import{d as h}from"./p-YyGnQmX-.js";function d(i,t){var s;if((null===(s=i.configs)||void 0===s?void 0:s.key)&&t)return i.unWrapData?t:t[i.configs.key]}const u=t(class extends s{constructor(i){super(),!1!==i&&this.__registerHost(),this.brickDataChange=e(this,"brickDataChange"),this.brickConfigsChange=e(this,"brickConfigsChange"),this.brickStylesChange=e(this,"brickStylesChange"),this.brickValidationsChange=e(this,"brickValidationsChange"),this.brickRulesChange=e(this,"brickRulesChange"),this.brickRemove=e(this,"brickRemove"),this.brickDuplicate=e(this,"brickDuplicate"),this.path="0",this.editable=!1,this.errors={}}render(){var i,t,s,e,l,c;const h=this.brickSpec;if(!h)return null;const u=a(h.type,h.id);if(!u)return r("fk-brick-not-found",null,`${h.type}:${h.id}`);const k=this.editable&&(null===(i=h.editable)||void 0===i||i),f=o(h.rules,this.dataMap);if(!k&&!0===f.hidden)return null;const p="panel"===h.type||"collection"===h.type,b=null===(t=h.configs)||void 0===t?void 0:t.uid,m=(null!==(s=h.children)&&void 0!==s?s:[]).map(((i,t)=>{var s;return r("fk-brick-render",{brickSpec:i,rootSpec:null!==(s=this.rootSpec)&&void 0!==s?s:this.brickSpec,data:this.data,dataMap:this.dataMap,errors:this.errors,locale:this.locale,path:`${this.path}.${t}`,editable:this.editable,selectedUid:this.selectedUid,utils:this.utils})}));k&&p&&m.push(r("fk-drop-area",{path:this.path}));const v={brickSpec:h,configsForm:h.configsForm,configs:n(h.configs,this.locale),locale:this.locale,styles:null!==(e=h.styles)&&void 0!==e?e:{},data:d(h,this.data),dataMap:this.dataMap,rootSpec:null!==(l=this.rootSpec)&&void 0!==l?l:this.brickSpec,error:(null===(c=h.configs)||void 0===c?void 0:c.key)?this.errors[h.configs.key]:void 0,disabled:!k&&!0===f.disabled,path:this.path,editable:k,children:m,validations:h.validations,rules:h.rules,utils:this.utils,onDataChange:i=>{const t=function(i,t){var s;if(null===(s=i.configs)||void 0===s?void 0:s.key)return i.unWrapData?t:{[i.configs.key]:t}}(h,i);void 0!==t&&this.brickDataChange.emit(t)},onConfigsChange:(i,t)=>this.brickConfigsChange.emit({configs:i,uid:null!=t?t:b}),onStylesChange:(i,t)=>this.brickStylesChange.emit({styles:i,uid:null!=t?t:b}),onValidationsChange:(i,t)=>this.brickValidationsChange.emit({validations:i,uid:null!=t?t:b}),onRulesChange:(i,t)=>this.brickRulesChange.emit({rules:i,uid:null!=t?t:b}),onDelete:i=>this.brickRemove.emit({path:i}),onDuplicate:i=>this.brickDuplicate.emit({path:i})},g=k?u.renderBuilder(v):u.render(v);return k&&"0"!==this.path?r("fk-brick-actions",{path:this.path,selected:void 0!==b&&b===this.selectedUid},g):g}},[0,"fk-brick-render",{brickSpec:[16],rootSpec:[16],data:[16],dataMap:[16],path:[1],editable:[4],selectedUid:[1,"selected-uid"],errors:[16],locale:[1],utils:[16]}]);function k(){"undefined"!=typeof customElements&&["fk-brick-render","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((t=>{switch(t){case"fk-brick-render":customElements.get(i(t))||customElements.define(i(t),u);break;case"fk-brick-actions":customElements.get(i(t))||l();break;case"fk-brick-not-found":customElements.get(i(t))||c();break;case"fk-brick-render":customElements.get(i(t))||k();break;case"fk-drop-area":customElements.get(i(t))||h()}}))}k();export{u as F,k as d}
@@ -1 +1 @@
1
- import{t,p as s,H as e,c as r,h as i}from"./p-BrOXMyOG.js";import{i as a,g as o,v as c}from"./p-LXnm2ogM.js";import{d as n}from"./p-BVBfbMl_.js";import{d as h}from"./p-CMQ_4Zfv.js";import{d}from"./p-DluDp8V5.js";import{d as l}from"./p-y0xDvzJR.js";const f=s(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.formDataChange=r(this,"formDataChange"),this.formSubmit=r(this,"formSubmit"),this.editable=!1,this.currentData={},this.touched={},this.utils={validateForm:()=>({isValid:this.runValidation().valid})}}componentWillLoad(){this.currentData=Object.assign({},this.data)}syncData(t){this.currentData=Object.assign({},t)}publicData(){return Object.fromEntries(Object.entries(this.currentData).filter((([t])=>!t.startsWith("_"))))}handleBrickDataChange(t){t.stopPropagation(),this.currentData=this.applyValueEffects(Object.assign(Object.assign({},this.currentData),t.detail));const s=Object.assign({},this.touched);for(const e of Object.keys(t.detail))s[e]=!0;this.touched=s;const{valid:e,errors:r}=this.runValidation();this.formDataChange.emit({data:this.publicData(),isValid:e,errors:r})}applyValueEffects(t){var s,e;let r=t;for(const{brick:t}of a(this.spec)){const i=null===(s=t.configs)||void 0===s?void 0:s.key;if(!i||!(null===(e=t.rules)||void 0===e?void 0:e.length))continue;const a=o(t.rules,r);void 0!==a.value&&r[i]!==a.value&&(r=Object.assign(Object.assign({},r),{[i]:a.value}))}return r}async validate(){var t;const s={};for(const{brick:e}of a(this.spec)){const r=null===(t=e.configs)||void 0===t?void 0:t.key;r&&(s[r]=!0)}this.touched=s;const e=this.runValidation(),r=Object.assign({},e.errors);let i=e.valid;const o=Array.from(this.host.querySelectorAll("fk-data-grid"));for(const t of o){const s=await t.validateRows();i=i&&s.valid,Object.assign(r,s.errors)}const c={valid:i,errors:r};return this.formDataChange.emit({data:this.publicData(),isValid:c.valid,errors:c.errors}),c}handleStepTouch(t){t.stopPropagation();const s=Object.assign({},this.touched);for(const e of t.detail.keys)s[e]=!0;this.touched=s}async handleStepperSubmit(t){t.stopPropagation();const s=await this.validate();this.formSubmit.emit({data:this.publicData(),isValid:s.valid,errors:s.errors})}runValidation(){const t=Object.fromEntries(Object.entries(this.currentData).filter((([,t])=>""!==t&&null!=t)));return c(this.spec,t,this.locale)}visibleErrors(){if(this.editable)return{};const t={};for(const[s,e]of Object.entries(this.runValidation().errors))this.touched[s]&&(t[s]=e);return t}render(){return this.spec?i("form",{class:"fk-form",onSubmit:t=>t.preventDefault()},i("fk-brick-render",{brickSpec:this.spec,rootSpec:this.spec,data:this.currentData,dataMap:this.currentData,errors:this.visibleErrors(),locale:this.locale,path:"0",editable:this.editable,selectedUid:this.selectedUid,utils:this.utils})):null}get host(){return this}static get watchers(){return{data:[{syncData:0}]}}static get style(){return".fk-form.sc-fk-form-render{display:flex;flex-direction:column;gap:var(--fk-spacing);font-family:var(--fk-font);color:var(--fk-color-text)}"}},[2,"fk-form-render",{spec:[16],data:[16],editable:[4],selectedUid:[1,"selected-uid"],locale:[1],currentData:[32],touched:[32],validate:[64]},[[0,"brickDataChange","handleBrickDataChange"],[0,"stepTouch","handleStepTouch"],[0,"stepperSubmit","handleStepperSubmit"]],{data:[{syncData:0}]}]);function u(){"undefined"!=typeof customElements&&["fk-form-render","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((s=>{switch(s){case"fk-form-render":customElements.get(t(s))||customElements.define(t(s),f);break;case"fk-brick-actions":customElements.get(t(s))||n();break;case"fk-brick-not-found":customElements.get(t(s))||h();break;case"fk-brick-render":customElements.get(t(s))||d();break;case"fk-drop-area":customElements.get(t(s))||l()}}))}u();export{f as F,u as d}
1
+ import{t,p as s,H as e,c as r,h as i}from"./p-BB4Llg42.js";import{i as a,g as o,v as c}from"./p-CKMHMpID.js";import{d as n}from"./p-DYchD23x.js";import{d as h}from"./p-NDbmiiYk.js";import{d}from"./p-BWdm2a6q.js";import{d as l}from"./p-YyGnQmX-.js";const f=s(class extends e{constructor(t){super(),!1!==t&&this.__registerHost(),this.formDataChange=r(this,"formDataChange"),this.formSubmit=r(this,"formSubmit"),this.editable=!1,this.currentData={},this.touched={},this.utils={validateForm:()=>({isValid:this.runValidation().valid})}}componentWillLoad(){this.currentData=Object.assign({},this.data)}syncData(t){this.currentData=Object.assign({},t)}publicData(){return Object.fromEntries(Object.entries(this.currentData).filter((([t])=>!t.startsWith("_"))))}handleBrickDataChange(t){t.stopPropagation(),this.currentData=this.applyValueEffects(Object.assign(Object.assign({},this.currentData),t.detail));const s=Object.assign({},this.touched);for(const e of Object.keys(t.detail))s[e]=!0;this.touched=s;const{valid:e,errors:r}=this.runValidation();this.formDataChange.emit({data:this.publicData(),isValid:e,errors:r})}applyValueEffects(t){var s,e;let r=t;for(const{brick:t}of a(this.spec)){const i=null===(s=t.configs)||void 0===s?void 0:s.key;if(!i||!(null===(e=t.rules)||void 0===e?void 0:e.length))continue;const a=o(t.rules,r);void 0!==a.value&&r[i]!==a.value&&(r=Object.assign(Object.assign({},r),{[i]:a.value}))}return r}async validate(){var t;const s={};for(const{brick:e}of a(this.spec)){const r=null===(t=e.configs)||void 0===t?void 0:t.key;r&&(s[r]=!0)}this.touched=s;const e=this.runValidation(),r=Object.assign({},e.errors);let i=e.valid;const o=Array.from(this.host.querySelectorAll("fk-data-grid"));for(const t of o){const s=await t.validateRows();i=i&&s.valid,Object.assign(r,s.errors)}const c={valid:i,errors:r};return this.formDataChange.emit({data:this.publicData(),isValid:c.valid,errors:c.errors}),c}handleStepTouch(t){t.stopPropagation();const s=Object.assign({},this.touched);for(const e of t.detail.keys)s[e]=!0;this.touched=s}async handleStepperSubmit(t){t.stopPropagation();const s=await this.validate();this.formSubmit.emit({data:this.publicData(),isValid:s.valid,errors:s.errors})}runValidation(){const t=Object.fromEntries(Object.entries(this.currentData).filter((([,t])=>""!==t&&null!=t)));return c(this.spec,t,this.locale)}visibleErrors(){if(this.editable)return{};const t={};for(const[s,e]of Object.entries(this.runValidation().errors))this.touched[s]&&(t[s]=e);return t}render(){return this.spec?i("form",{class:"fk-form",onSubmit:t=>t.preventDefault()},i("fk-brick-render",{brickSpec:this.spec,rootSpec:this.spec,data:this.currentData,dataMap:this.currentData,errors:this.visibleErrors(),locale:this.locale,path:"0",editable:this.editable,selectedUid:this.selectedUid,utils:this.utils})):null}get host(){return this}static get watchers(){return{data:[{syncData:0}]}}static get style(){return".fk-form.sc-fk-form-render{display:flex;flex-direction:column;gap:var(--fk-spacing);font-family:var(--fk-font);color:var(--fk-color-text)}"}},[2,"fk-form-render",{spec:[16],data:[16],editable:[4],selectedUid:[1,"selected-uid"],locale:[1],currentData:[32],touched:[32],validate:[64]},[[0,"brickDataChange","handleBrickDataChange"],[0,"stepTouch","handleStepTouch"],[0,"stepperSubmit","handleStepperSubmit"]],{data:[{syncData:0}]}]);function m(){"undefined"!=typeof customElements&&["fk-form-render","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((s=>{switch(s){case"fk-form-render":customElements.get(t(s))||customElements.define(t(s),f);break;case"fk-brick-actions":customElements.get(t(s))||n();break;case"fk-brick-not-found":customElements.get(t(s))||h();break;case"fk-brick-render":customElements.get(t(s))||d();break;case"fk-drop-area":customElements.get(t(s))||l()}}))}m();export{f as F,m as d}
@@ -0,0 +1 @@
1
+ import{t,p as e,H as o,c as r}from"./p-BB4Llg42.js";let s;const i=e(class extends o{constructor(t){super(),!1!==t&&this.__registerHost(),this.codeChange=r(this,"codeChange"),this.value="",this.placeholder="",this.disconnected=!1}async componentDidLoad(){const[{EditorState:t},{EditorView:e,keymap:o,lineNumbers:r,placeholder:i},{defaultKeymap:c,history:n,historyKeymap:d},{defaultHighlightStyle:a,syntaxHighlighting:l},{javascript:h}]=await(null!=s?s:s=Promise.all([import("./p-DtcM1yw5.js"),import("./p-DMCkrZqi.js").then((function(t){return t.i})),import("./p-C-wnqV3i.js"),import("./p-4COASNrZ.js").then((function(t){return t.v})),import("./p-DOInQkG6.js")]));this.disconnected||(this.view=new e({parent:this.host,state:t.create({doc:this.value,extensions:[r(),n(),o.of([...c,...d]),h(),l(a),i(this.placeholder),e.domEventHandlers({blur:()=>this.emitIfChanged()})]})}))}syncValue(t){if(!this.view||this.view.hasFocus)return;const e=this.view.state.doc.toString();e!==t&&this.view.dispatch({changes:{from:0,to:e.length,insert:t}})}emitIfChanged(){if(!this.view)return;const t=this.view.state.doc.toString();t!==this.value&&this.codeChange.emit(t)}disconnectedCallback(){var t;this.disconnected=!0,null===(t=this.view)||void 0===t||t.destroy(),this.view=void 0}render(){return null}get host(){return this}static get watchers(){return{value:[{syncValue:0}]}}static get style(){return".sc-fk-code-editor-h{display:block}.sc-fk-code-editor-h .cm-editor.sc-fk-code-editor{min-height:88px;font-size:0.75rem;border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 2);background:var(--fk-color-surface)}.sc-fk-code-editor-h .cm-editor.cm-focused.sc-fk-code-editor{outline:none;border-color:var(--fk-color-primary)}.sc-fk-code-editor-h .cm-gutters.sc-fk-code-editor{border-right:1px solid var(--fk-color-border);background:color-mix(in srgb, var(--fk-color-surface) 70%, transparent);color:var(--fk-color-muted)}.sc-fk-code-editor-h .cm-content.sc-fk-code-editor{font-family:ui-monospace, SFMono-Regular, Menlo, monospace}"}},[2,"fk-code-editor",{value:[1],placeholder:[1]},void 0,{value:[{syncValue:0}]}]);function c(){"undefined"!=typeof customElements&&["fk-code-editor"].forEach((e=>{"fk-code-editor"===e&&(customElements.get(t(e))||customElements.define(t(e),i))}))}c();export{i as F,c as d}
@@ -0,0 +1 @@
1
+ import{StateField as t,Facet as e,Annotation as r,EditorSelection as n,countColumn as o,Text as l,findClusterBreak as u,Transaction as i,CharCategory as s,combineConfig as f,StateEffect as a,ChangeSet as c,ChangeDesc as h}from"./p-DtcM1yw5.js";import{E as d,D as p}from"./p-DMCkrZqi.js";import{I as m,g as k,i as y,s as w,N as v,m as M,a as g,b as A}from"./p-4COASNrZ.js";const D=t=>{let{state:e}=t,r=e.doc.lineAt(e.selection.main.from),n=R(t.state,r.from);return n.line?C(t):!!n.block&&B(t)};function E(t,e){return({state:r,dispatch:n})=>{if(r.readOnly)return!1;let o=t(e,r);return!!o&&(n(r.update(o)),!0)}}const C=E(N,0),S=E(N,1),I=E(N,2),b=E(L,0),V=E(L,1),U=E(L,2),B=E(((t,e)=>L(t,e,function(t){let e=[];for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from),o=r.to<=n.to?n:t.doc.lineAt(r.to);o.from>n.from&&o.from==r.to&&(o=r.to==n.to+1?n:t.doc.lineAt(r.to-1));let l=e.length-1;l>=0&&e[l].to>n.from?e[l].to=o.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:o.to})}return e}(e))),0);function R(t,e){let r=t.languageDataAt("commentTokens",e,1);return r.length?r[0]:{}}const j=50;function L(t,e,r=e.selection.ranges){let n=r.map((t=>R(e,t.from).block));if(!n.every((t=>t)))return null;let o=r.map(((t,r)=>function(t,{open:e,close:r},n,o){let l,u,i=t.sliceDoc(n-j,n),s=t.sliceDoc(o,o+j),f=/\s*$/.exec(i)[0].length,a=/^\s*/.exec(s)[0].length,c=i.length-f;if(i.slice(c-e.length,c)==e&&s.slice(a,a+r.length)==r)return{open:{pos:n-f,margin:f&&1},close:{pos:o+a,margin:a&&1}};o-n<=2*j?l=u=t.sliceDoc(n,o):(l=t.sliceDoc(n,n+j),u=t.sliceDoc(o-j,o));let h=/^\s*/.exec(l)[0].length,d=/\s*$/.exec(u)[0].length,p=u.length-d-r.length;return l.slice(h,h+e.length)==e&&u.slice(p,p+r.length)==r?{open:{pos:n+h+e.length,margin:/\s/.test(l.charAt(h+e.length))?1:0},close:{pos:o-d-r.length,margin:/\s/.test(u.charAt(p-1))?1:0}}:null}(e,n[r],t.from,t.to)));if(2!=t&&!o.every((t=>t)))return{changes:e.changes(r.map(((t,e)=>o[e]?[]:[{from:t.from,insert:n[e].open+" "},{from:t.to,insert:" "+n[e].close}])))};if(1!=t&&o.some((t=>t))){let t=[];for(let e,r=0;r<o.length;r++)if(e=o[r]){let o=n[r],{open:l,close:u}=e;t.push({from:l.pos-o.open.length,to:l.pos+l.margin},{from:u.pos-u.margin,to:u.pos+o.close.length})}return{changes:t}}return null}function N(t,e,r=e.selection.ranges){let n=[],o=-1;t:for(let{from:t,to:l}of r){let r,u=n.length,i=1e9;for(let u=t;u<=l;){let s=e.doc.lineAt(u);if(null==r&&(r=R(e,s.from).line,!r))continue t;if(s.from>o&&(t==l||l>s.from)){o=s.from;let t=/^\s*/.exec(s.text)[0].length,e=t==s.length,l=s.text.slice(t,t+r.length)==r?t:-1;t<s.text.length&&t<i&&(i=t),n.push({line:s,comment:l,token:r,indent:t,empty:e,single:!1})}u=s.to+1}if(i<1e9)for(let t=u;t<n.length;t++)n[t].indent<n[t].line.text.length&&(n[t].indent=i);n.length==u+1&&(n[u].single=!0)}if(2!=t&&n.some((t=>t.comment<0&&(!t.empty||t.single)))){let t=[];for(let{line:e,token:r,indent:o,empty:l,single:u}of n)!u&&l||t.push({from:e.from+o,insert:r+" "});let r=e.changes(t);return{changes:r,selection:e.selection.map(r,1)}}if(1!=t&&n.some((t=>t.comment>=0))){let t=[];for(let{line:e,comment:r,token:o}of n)if(r>=0){let n=e.from+r,l=n+o.length;" "==e.text[l-e.from]&&l++,t.push({from:n,to:l})}return{changes:t}}return null}const O=r.define(),T=r.define(),$=e.define(),J=e.define({combine:t=>f(t,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(r,n)=>t(r,n)||e(r,n)})}),z=t.define({create:()=>it.empty,update(t,e){let r=e.state.facet(J),n=e.annotation(O);if(n){let o=Q.fromTransaction(e,n.selection),l=n.side,u=0==l?t.undone:t.done;return u=o?X(u,u.length,r.minDepth,o):rt(u,e.startState.selection),new it(0==l?n.rest:u,0==l?u:n.rest)}let o=e.annotation(T);if("full"!=o&&"before"!=o||(t=t.isolate()),!1===e.annotation(i.addToHistory))return e.changes.empty?t:t.addMapping(e.changes.desc);let l=Q.fromTransaction(e),u=e.annotation(i.time),s=e.annotation(i.userEvent);return l?t=t.addChanges(l,u,s,r,e):e.selection&&(t=t.addSelection(e.startState.selection,u,s,r.newGroupDelay)),"full"!=o&&"after"!=o||(t=t.isolate()),t},toJSON:t=>({done:t.done.map((t=>t.toJSON())),undone:t.undone.map((t=>t.toJSON()))}),fromJSON:t=>new it(t.done.map(Q.fromJSON),t.undone.map(Q.fromJSON))});function x(t={}){return[z,J.of(t),d.domEventHandlers({beforeinput(t,e){let r="historyUndo"==t.inputType?P:"historyRedo"==t.inputType?Z:null;return!!r&&(t.preventDefault(),r(e))}})]}const G=z;function H(t,e){return function({state:r,dispatch:n}){if(!e&&r.readOnly)return!1;let o=r.field(z,!1);if(!o)return!1;let l=o.pop(t,r,e);return!!l&&(n(l),!0)}}const P=H(0,!1),Z=H(1,!1),q=H(0,!0),W=H(1,!0);function _(t){return function(e){let r=e.field(z,!1);if(!r)return 0;let n=0==t?r.done:r.undone;return n.length-(n.length&&!n[0].changes?1:0)}}const F=_(0),K=_(1);class Q{constructor(t,e,r,n,o){this.changes=t,this.effects=e,this.mapped=r,this.startSelection=n,this.selectionsAfter=o}setSelAfter(t){return new Q(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,r;return{changes:null===(t=this.changes)||void 0===t?void 0:t.toJSON(),mapped:null===(e=this.mapped)||void 0===e?void 0:e.toJSON(),startSelection:null===(r=this.startSelection)||void 0===r?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map((t=>t.toJSON()))}}static fromJSON(t){return new Q(t.changes&&c.fromJSON(t.changes),[],t.mapped&&h.fromJSON(t.mapped),t.startSelection&&n.fromJSON(t.startSelection),t.selectionsAfter.map(n.fromJSON))}static fromTransaction(t,e){let r=tt;for(let e of t.startState.facet($)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new Q(t.changes.invert(t.startState.doc),r,void 0,e||t.startState.selection,tt)}static selection(t){return new Q(void 0,tt,void 0,void 0,t)}}function X(t,e,r,n){let o=t.slice(e+1>r+20?e-r-1:0,e);return o.push(n),o}function Y(t,e){return t.length?e.length?t.concat(e):t:e}const tt=[],et=200;function rt(t,e){if(t.length){let r=t[t.length-1],n=r.selectionsAfter.slice(Math.max(0,r.selectionsAfter.length-et));return n.length&&n[n.length-1].eq(e)?t:(n.push(e),X(t,t.length-1,1e9,r.setSelAfter(n)))}return[Q.selection([e])]}function nt(t){let e=t[t.length-1],r=t.slice();return r[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),r}function ot(t,e){if(!t.length)return t;let r=t.length,n=tt;for(;r;){let o=lt(t[r-1],e,n);if(o.changes&&!o.changes.empty||o.effects.length){let e=t.slice(0,r);return e[r-1]=o,e}e=o.mapped,r--,n=o.selectionsAfter}return n.length?[Q.selection(n)]:tt}function lt(t,e,r){let n=Y(t.selectionsAfter.length?t.selectionsAfter.map((t=>t.map(e))):tt,r);if(!t.changes)return Q.selection(n);let o=t.changes.map(e),l=e.mapDesc(t.changes,!0),u=t.mapped?t.mapped.composeDesc(l):l;return new Q(o,a.mapEffects(t.effects,e),u,t.startSelection.map(l),n)}const ut=/^(input\.type|delete)($|\.)/;class it{constructor(t,e,r=0,n){this.done=t,this.undone=e,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new it(this.done,this.undone):this}addChanges(t,e,r,n,o){let l=this.done,u=l[l.length-1];return l=u&&u.changes&&!u.changes.empty&&t.changes&&(!r||ut.test(r))&&(!u.selectionsAfter.length&&e-this.prevTime<n.newGroupDelay&&n.joinToEvent(o,function(t,e){let r=[],n=!1;return t.iterChangedRanges(((t,e)=>r.push(t,e))),e.iterChangedRanges(((t,e,o,l)=>{for(let t=0;t<r.length;){let e=r[t++],u=r[t++];l>=e&&o<=u&&(n=!0)}})),n}(u.changes,t.changes))||"input.type.compose"==r)?X(l,l.length-1,n.minDepth,new Q(t.changes.compose(u.changes),Y(a.mapEffects(t.effects,u.changes),u.effects),u.mapped,u.startSelection,tt)):X(l,l.length,n.minDepth,t),new it(l,tt,e,r)}addSelection(t,e,r,n){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:tt;return o.length>0&&e-this.prevTime<n&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&(l=o[o.length-1]).ranges.length==(u=t).ranges.length&&0===l.ranges.filter(((t,e)=>t.empty!=u.ranges[e].empty)).length?this:new it(rt(this.done,t),this.undone,e,r);var l,u}addMapping(t){return new it(ot(this.done,t),ot(this.undone,t),this.prevTime,this.prevUserEvent)}pop(t,e,r){let n=0==t?this.done:this.undone;if(0==n.length)return null;let o=n[n.length-1],l=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):e.selection);if(r&&o.selectionsAfter.length)return e.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:O.of({side:t,rest:nt(n),selection:l}),userEvent:0==t?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let r=1==n.length?tt:n.slice(0,n.length-1);return o.mapped&&(r=ot(r,o.mapped)),e.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:O.of({side:t,rest:r,selection:l}),filter:!1,userEvent:0==t?"undo":"redo",scrollIntoView:!0})}return null}}it.empty=new it(tt,tt);const st=[{key:"Mod-z",run:P,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Z,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Z,preventDefault:!0},{key:"Mod-u",run:q,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:W,preventDefault:!0}];function ft(t,e){return n.create(t.ranges.map(e),t.mainIndex)}function at(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function ct({state:t,dispatch:e},r){let n=ft(t.selection,r);return!n.eq(t.selection,!0)&&(e(at(t,n)),!0)}function ht(t,e){return n.cursor(e?t.to:t.from)}function dt(t,e){return ct(t,(r=>r.empty?t.moveByChar(r,e):ht(r,e)))}function pt(t){return t.textDirectionAt(t.state.selection.main.head)==p.LTR}const mt=t=>dt(t,!pt(t)),kt=t=>dt(t,pt(t)),yt=t=>dt(t,!0),wt=t=>dt(t,!1);function vt(t,e,r){let o=e.head,l=t.doc.lineAt(o);return o=o==(r?l.to:l.from)?r?Math.min(t.doc.length,l.to+1):Math.max(0,l.from-1):l.from+u(l.text,o-l.from,r),n.cursor(o,r?-1:1)}function Mt(t,e){return ct(t,(r=>r.empty?vt(t.state,r,e):ht(r,e)))}const gt=t=>Mt(t,!0),At=t=>Mt(t,!1);function Dt(t,e){return ct(t,(r=>r.empty?t.moveByGroup(r,e):ht(r,e)))}const Et=t=>Dt(t,!pt(t)),Ct=t=>Dt(t,pt(t)),St=t=>Dt(t,!0),It=t=>Dt(t,!1);function bt(t,e,r){let n=t.state.charCategorizer(e),o=n(r),l=o!=s.Space;return t=>{let e=n(t);return e!=s.Space?l&&e==o:(l=!1,!0)}}const Vt=t=>ct(t,(e=>e.empty?t.moveByChar(e,!0,(r=>bt(t,e.head,r))):ht(e,!0))),Ut="undefined"!=typeof Intl&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function Bt(t,e,r){let o=t.state.charCategorizer(e.from),l=s.Space,u=e.from,i=0,f=!1,a=!1,c=!1,h=e=>{if(f)return!1;u+=r?e.length:-e.length;let n,h=o(e);if(h==s.Word&&e.charCodeAt(0)<128&&/[\W_]/.test(e)&&(h=-1),l==s.Space&&(l=h),l!=h)return!1;if(l==s.Word)if(e.toLowerCase()==e){if(!r&&a)return!1;c=!0}else if(c){if(r)return!1;f=!0}else{if(a&&r&&o(n=t.state.sliceDoc(u,u+1))==s.Word&&n.toLowerCase()==n)return!1;a=!0}return i++,!0},d=t.moveByChar(e,r,(t=>(h(t),h)));if(Ut&&l==s.Word&&d.from==e.from+i*(r?1:-1)){let o=Math.min(e.head,d.head),l=Math.max(e.head,d.head),u=t.state.sliceDoc(o,l);if(u.length>1&&/[\u4E00-\uffff]/.test(u)){let t=Array.from(Ut.segment(u));if(t.length>1)return r?n.cursor(e.head+t[1].index,-1):n.cursor(d.head+t[t.length-1].index,1)}}return d}function Rt(t,e){return ct(t,(r=>r.empty?Bt(t,r,e):ht(r,e)))}const jt=t=>Rt(t,!0),Lt=t=>Rt(t,!1);function Nt(t,e,r){if(e.type.prop(r))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Ot(t,e,r){let o,l,u=w(t).resolveInner(e.head),i=r?v.closedBy:v.openedBy;for(let n=e.head;;){let e=r?u.childAfter(n):u.childBefore(n);if(!e)break;Nt(t,e,i)?u=e:n=r?e.to:e.from}return l=u.type.prop(i)&&(o=r?M(t,u.from,1):M(t,u.to,-1))&&o.matched?r?o.end.to:o.end.from:r?u.to:u.from,n.cursor(l,r?-1:1)}const Tt=t=>ct(t,(e=>Ot(t.state,e,!pt(t)))),$t=t=>ct(t,(e=>Ot(t.state,e,pt(t))));function Jt(t,e){return ct(t,(r=>{if(!r.empty)return ht(r,e);let n=t.moveVertically(r,e);return n.head!=r.head?n:t.moveToLineBoundary(r,e)}))}const zt=t=>Jt(t,!1),xt=t=>Jt(t,!0);function Gt(t){let e,r=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,o=0;if(r){for(let e of t.state.facet(d.scrollMargins)){let r=e(t);(null==r?void 0:r.top)&&(n=Math.max(null==r?void 0:r.top,n)),(null==r?void 0:r.bottom)&&(o=Math.max(null==r?void 0:r.bottom,o))}e=t.scrollDOM.clientHeight-n-o}else e=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:o,selfScroll:r,height:Math.max(t.defaultLineHeight,e-5)}}function Ht(t,e){let r,n=Gt(t),{state:o}=t,l=ft(o.selection,(r=>r.empty?t.moveVertically(r,e,n.height):ht(r,e)));if(l.eq(o.selection))return!1;if(n.selfScroll){let e=t.coordsAtPos(o.selection.main.head),u=t.scrollDOM.getBoundingClientRect(),i=u.top+n.marginTop;e&&e.top>i&&e.bottom<u.bottom-n.marginBottom&&(r=d.scrollIntoView(l.main.head,{y:"start",yMargin:e.top-i}))}return t.dispatch(at(o,l),{effects:r}),!0}const Pt=t=>Ht(t,!1),Zt=t=>Ht(t,!0);function qt(t,e,r){let o=t.lineBlockAt(e.head),l=t.moveToLineBoundary(e,r);if(l.head==e.head&&l.head!=(r?o.to:o.from)&&(l=t.moveToLineBoundary(e,r,!1)),!r&&l.head==o.from&&o.length){let r=/^\s*/.exec(t.state.sliceDoc(o.from,Math.min(o.from+100,o.to)))[0].length;r&&e.head!=o.from+r&&(l=n.cursor(o.from+r))}return l}const Wt=t=>ct(t,(e=>qt(t,e,!0))),_t=t=>ct(t,(e=>qt(t,e,!1))),Ft=t=>ct(t,(e=>qt(t,e,!pt(t)))),Kt=t=>ct(t,(e=>qt(t,e,pt(t)))),Qt=t=>ct(t,(e=>n.cursor(t.lineBlockAt(e.head).from,1))),Xt=t=>ct(t,(e=>n.cursor(t.lineBlockAt(e.head).to,-1)));function Yt(t,e,r){let o=!1,l=ft(t.selection,(e=>{let l=M(t,e.head,-1)||M(t,e.head,1)||e.head>0&&M(t,e.head-1,1)||e.head<t.doc.length&&M(t,e.head+1,-1);if(!l||!l.end)return e;o=!0;let u=l.start.from==e.head?l.end.to:l.end.from;return r?n.range(e.anchor,u):n.cursor(u)}));return!!o&&(e(at(t,l)),!0)}const te=({state:t,dispatch:e})=>Yt(t,e,!1),ee=({state:t,dispatch:e})=>Yt(t,e,!0);function re(t,e,r){let o=ft(t.state.selection,(t=>{t.undirectional&&t.head>=t.anchor!=e&&(t=n.range(t.head,t.anchor));let o=r(t);return n.range(t.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)}));return!o.eq(t.state.selection)&&(t.dispatch(at(t.state,o)),!0)}function ne(t,e){return re(t,e,(r=>t.moveByChar(r,e)))}const oe=t=>ne(t,!pt(t)),le=t=>ne(t,pt(t)),ue=t=>ne(t,!0),ie=t=>ne(t,!1),se=t=>re(t,!0,(e=>vt(t.state,e,!0))),fe=t=>re(t,!1,(e=>vt(t.state,e,!1)));function ae(t,e){return re(t,e,(r=>t.moveByGroup(r,e)))}const ce=t=>ae(t,!pt(t)),he=t=>ae(t,pt(t)),de=t=>ae(t,!0),pe=t=>ae(t,!1),me=t=>re(t,!0,(e=>t.moveByChar(e,!0,(r=>bt(t,e.head,r)))));function ke(t,e){return re(t,e,(r=>Bt(t,r,e)))}const ye=t=>ke(t,!0),we=t=>ke(t,!1),ve=t=>{let e=!pt(t);return re(t,e,(r=>Ot(t.state,r,e)))},Me=t=>{let e=pt(t);return re(t,e,(r=>Ot(t.state,r,e)))};function ge(t,e){return re(t,e,(r=>t.moveVertically(r,e)))}const Ae=t=>ge(t,!1),De=t=>ge(t,!0);function Ee(t,e){return re(t,e,(r=>t.moveVertically(r,e,Gt(t).height)))}const Ce=t=>Ee(t,!1),Se=t=>Ee(t,!0),Ie=t=>re(t,!0,(e=>qt(t,e,!0))),be=t=>re(t,!1,(e=>qt(t,e,!1))),Ve=t=>{let e=!pt(t);return re(t,e,(r=>qt(t,r,e)))},Ue=t=>{let e=pt(t);return re(t,e,(r=>qt(t,r,e)))},Be=t=>re(t,!1,(e=>n.cursor(t.lineBlockAt(e.head).from))),Re=t=>re(t,!0,(e=>n.cursor(t.lineBlockAt(e.head).to))),je=({state:t,dispatch:e})=>(e(at(t,{anchor:0})),!0),Le=({state:t,dispatch:e})=>(e(at(t,{anchor:t.doc.length})),!0),Ne=({state:t,dispatch:e})=>(e(at(t,{anchor:t.selection.main.anchor,head:0})),!0),Oe=({state:t,dispatch:e})=>(e(at(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Te=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),$e=({state:t,dispatch:e})=>{let r=ir(t).map((({from:e,to:r})=>n.range(e,Math.min(r+1,t.doc.length))));return e(t.update({selection:n.create(r),userEvent:"select"})),!0},Je=({state:t,dispatch:e})=>{let r=ft(t.selection,(e=>{let r=w(t),o=r.resolveStack(e.from,1);if(e.empty){let t=r.resolveStack(e.from,-1);t.node.from>=o.node.from&&t.node.to<=o.node.to&&(o=t)}for(let t=o;t;t=t.next){let{node:r}=t;if((r.from<e.from&&r.to>=e.to||r.to>e.to&&r.from<=e.from)&&t.next)return n.range(r.to,r.from)}return e}));return!r.eq(t.selection)&&(e(at(t,r)),!0)};function ze(t,e){let{state:r}=t,o=r.selection,l=r.selection.ranges.slice();for(let n of r.selection.ranges){let o=r.doc.lineAt(n.head);if(e?o.to<t.state.doc.length:o.from>0)for(let r=n;;){let n=t.moveVertically(r,e);if(n.head<o.from||n.head>o.to){l.some((t=>t.head==n.head))||l.push(n);break}if(n.head==r.head)break;r=n}}return l.length!=o.ranges.length&&(t.dispatch(at(r,n.create(l,l.length-1))),!0)}const xe=t=>ze(t,!1),Ge=t=>ze(t,!0),He=({state:t,dispatch:e})=>{let r=t.selection,o=null;return r.ranges.length>1?o=n.create([r.main]):r.main.empty||(o=n.create([n.cursor(r.main.head)])),!!o&&(e(at(t,o)),!0)};function Pe(t,e){if(t.state.readOnly)return!1;let r="delete.selection",{state:o}=t,l=o.changeByRange((o=>{let{from:l,to:u}=o;if(l==u){let n=e(o);n<l?(r="delete.backward",n=Ze(t,n,!1)):n>l&&(r="delete.forward",n=Ze(t,n,!0)),l=Math.min(l,n),u=Math.max(u,n)}else l=Ze(t,l,!1),u=Ze(t,u,!0);return l==u?{range:o}:{changes:{from:l,to:u},range:n.cursor(l,l<o.head?-1:1)}}));return!l.changes.empty&&(t.dispatch(o.update(l,{scrollIntoView:!0,userEvent:r,effects:"delete.selection"==r?d.announce.of(o.phrase("Selection deleted")):void 0})),!0)}function Ze(t,e,r){if(t instanceof d)for(let n of t.state.facet(d.atomicRanges).map((e=>e(t))))n.between(e,e,((t,n)=>{t<e&&n>e&&(e=r?n:t)}));return e}const qe=(t,e,r)=>Pe(t,(n=>{let l,i,s=n.from,{state:f}=t,a=f.doc.lineAt(s);if(r&&!e&&s>a.from&&s<a.from+200&&!/[^ \t]/.test(l=a.text.slice(0,s-a.from))){if("\t"==l[l.length-1])return s-1;let t=o(l,f.tabSize)%g(f)||g(f);for(let e=0;e<t&&" "==l[l.length-1-e];e++)s--;i=s}else i=u(a.text,s-a.from,e,e)+a.from,i==s&&a.number!=(e?f.doc.lines:1)?i+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(i-a.from,s-a.from))&&(i=u(a.text,i-a.from,!1,!1)+a.from);return i})),We=t=>qe(t,!1,!0),_e=t=>qe(t,!1,!1),Fe=t=>qe(t,!0,!1),Ke=(t,e)=>Pe(t,(r=>{let n=r.head,{state:o}=t,l=o.doc.lineAt(n),i=o.charCategorizer(n);for(let t=null;;){if(n==(e?l.to:l.from)){n==r.head&&l.number!=(e?o.doc.lines:1)&&(n+=e?1:-1);break}let s=u(l.text,n-l.from,e)+l.from,f=l.text.slice(Math.min(n,s)-l.from,Math.max(n,s)-l.from),a=i(f);if(null!=t&&a!=t)break;" "==f&&n==r.head||(t=a),n=s}return n})),Qe=t=>Ke(t,!1),Xe=t=>Ke(t,!0),Ye=t=>Pe(t,(e=>t.moveByChar(e,!0,(r=>bt(t,e.head,r))).head)),tr=t=>Pe(t,(e=>{let r=t.lineBlockAt(e.head).to;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)})),er=t=>Pe(t,(e=>{let r=t.lineBlockAt(e.head).from;return e.head>r?r:Math.max(0,e.head-1)})),rr=t=>Pe(t,(e=>{let r=t.moveToLineBoundary(e,!1).head;return e.head>r?r:Math.max(0,e.head-1)})),nr=t=>Pe(t,(e=>{let r=t.moveToLineBoundary(e,!0).head;return e.head<r?r:Math.min(t.state.doc.length,e.head+1)})),or=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=[];for(let e=0,n="",o=t.doc.iter();;){if(o.next(),o.lineBreak||o.done){let t=n.search(/\s+$/);if(t>-1&&r.push({from:e-(n.length-t),to:e}),o.done)break;n=""}else n=o.value;e+=o.value.length}return!!r.length&&(e(t.update({changes:r,userEvent:"delete"})),!0)},lr=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:l.of(["",""])},range:n.cursor(t.from)})));return e(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0},ur=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange((e=>{if(!e.empty||0==e.from||e.from==t.doc.length)return{range:e};let r=e.from,o=t.doc.lineAt(r),l=r==o.from?r-1:u(o.text,r-o.from,!1)+o.from,i=r==o.to?r+1:u(o.text,r-o.from,!0)+o.from;return{changes:{from:l,to:i,insert:t.doc.slice(r,i).append(t.doc.slice(l,r))},range:n.cursor(i)}}));return!r.changes.empty&&(e(t.update(r,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function ir(t){let e=[],r=-1;for(let n of t.selection.ranges){let o=t.doc.lineAt(n.from),l=t.doc.lineAt(n.to);if(n.empty||n.to!=l.from||(l=t.doc.lineAt(n.to-1)),r>=o.number){let t=e[e.length-1];t.to=l.to,t.ranges.push(n)}else e.push({from:o.from,to:l.to,ranges:[n]});r=l.number+1}return e}function sr(t,e,r){if(t.readOnly)return!1;let o=[],l=[];for(let e of ir(t)){if(r?e.to==t.doc.length:0==e.from)continue;let u=t.doc.lineAt(r?e.to+1:e.from-1),i=u.length+1;if(r){o.push({from:e.to,to:u.to},{from:e.from,insert:u.text+t.lineBreak});for(let r of e.ranges)l.push(n.range(Math.min(t.doc.length,r.anchor+i),Math.min(t.doc.length,r.head+i)))}else{o.push({from:u.from,to:e.from},{from:e.to,insert:t.lineBreak+u.text});for(let t of e.ranges)l.push(n.range(t.anchor-i,t.head-i))}}return!!o.length&&(e(t.update({changes:o,scrollIntoView:!0,selection:n.create(l,t.selection.mainIndex),userEvent:"move.line"})),!0)}const fr=({state:t,dispatch:e})=>sr(t,e,!1),ar=({state:t,dispatch:e})=>sr(t,e,!0);function cr(t,e,r){if(t.readOnly)return!1;let n=[];for(let e of ir(t))n.push(r?{from:e.from,insert:t.doc.slice(e.from,e.to)+t.lineBreak}:{from:e.to,insert:t.lineBreak+t.doc.slice(e.from,e.to)});let o=t.changes(n);return e(t.update({changes:o,selection:t.selection.map(o,r?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const hr=({state:t,dispatch:e})=>cr(t,e,!1),dr=({state:t,dispatch:e})=>cr(t,e,!0),pr=t=>{if(t.state.readOnly)return!1;let{state:e}=t,r=e.changes(ir(e).map((({from:t,to:r})=>(t>0?t--:r<e.doc.length&&r++,{from:t,to:r})))),n=ft(e.selection,(e=>{let r;if(t.lineWrapping){let n=t.lineBlockAt(e.head),o=t.coordsAtPos(e.head,e.assoc||1);o&&(r=n.bottom+t.documentTop-o.bottom+t.defaultLineHeight/2)}return t.moveVertically(e,!0,r)})).map(r);return t.dispatch({changes:r,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0},mr=({state:t,dispatch:e})=>(e(t.update(t.replaceSelection(t.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0),kr=({state:t,dispatch:e})=>(e(t.update(t.changeByRange((e=>{let r=/^\s*/.exec(t.doc.lineAt(e.from).text)[0];return{changes:{from:e.from,to:e.to,insert:t.lineBreak+r},range:n.cursor(e.from+r.length+1)}})),{scrollIntoView:!0,userEvent:"input"})),!0),yr=vr(!1),wr=vr(!0);function vr(t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let u=e.changeByRange((r=>{let{from:u,to:i}=r,s=e.doc.lineAt(u),f=!t&&u==i&&function(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let r,n=w(t).resolveInner(e),o=n.childBefore(e),l=n.childAfter(e);return o&&l&&o.to<=e&&l.from>=e&&(r=o.type.prop(v.closedBy))&&r.indexOf(l.name)>-1&&t.doc.lineAt(o.to).from==t.doc.lineAt(l.from).from&&!/\S/.test(t.sliceDoc(o.to,l.from))?{from:o.to,to:l.from}:null}(e,u);t&&(u=i=(i<=s.to?s:e.doc.lineAt(i)).to);let a=new m(e,{simulateBreak:u,simulateDoubleBreak:!!f}),c=k(a,u);for(null==c&&(c=o(/^\s*/.exec(e.doc.lineAt(u).text)[0],e.tabSize));i<s.to&&/\s/.test(s.text[i-s.from]);)i++;f?({from:u,to:i}=f):u>s.from&&u<s.from+100&&!/\S/.test(s.text.slice(0,u))&&(u=s.from);let h=["",y(e,c)];return f&&h.push(y(e,a.lineIndent(s.from,-1))),{changes:{from:u,to:i,insert:l.of(h)},range:n.cursor(u+1+h[1].length)}}));return r(e.update(u,{scrollIntoView:!0,userEvent:"input"})),!0}}function Mr(t,e){let r=-1;return t.changeByRange((o=>{let l=[];for(let n=o.from;n<=o.to;){let u=t.doc.lineAt(n);u.number>r&&(o.empty||o.to>u.from)&&(e(u,l,o),r=u.number),n=u.to+1}let u=t.changes(l);return{changes:l,range:n.range(u.mapPos(o.anchor,1),u.mapPos(o.head,1))}}))}const gr=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Object.create(null),n=new m(t,{overrideIndentation:t=>{let e=r[t];return null==e?-1:e}}),o=Mr(t,((e,o,l)=>{let u=k(n,e.from);if(null==u)return;/\S/.test(e.text)||(u=0);let i=/^\s*/.exec(e.text)[0],s=y(t,u);(i!=s||l.from<e.from+i.length)&&(r[e.from]=u,o.push({from:e.from,to:e.from+i.length,insert:s}))}));return o.changes.empty||e(t.update(o,{userEvent:"indent"})),!0},Ar=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Mr(t,((e,r)=>{r.push({from:e.from,insert:t.facet(A)})})),{userEvent:"input.indent"})),!0),Dr=({state:t,dispatch:e})=>!t.readOnly&&(e(t.update(Mr(t,((e,r)=>{let n=/^\s*/.exec(e.text)[0];if(!n)return;let l=o(n,t.tabSize),u=0,i=y(t,Math.max(0,l-g(t)));for(;u<n.length&&u<i.length&&n.charCodeAt(u)==i.charCodeAt(u);)u++;r.push({from:e.from+u,to:e.from+n.length,insert:i.slice(u)})})),{userEvent:"delete.dedent"})),!0),Er=t=>(t.setTabFocusMode(),!0),Cr=t=>(t.setTabFocusMode(2e3),!0),Sr=({state:t,dispatch:e})=>t.selection.ranges.some((t=>!t.empty))?Ar({state:t,dispatch:e}):(e(t.update(t.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0),Ir=[{key:"Ctrl-b",run:mt,shift:oe,preventDefault:!0},{key:"Ctrl-f",run:kt,shift:le},{key:"Ctrl-p",run:zt,shift:Ae},{key:"Ctrl-n",run:xt,shift:De},{key:"Ctrl-a",run:Qt,shift:Be},{key:"Ctrl-e",run:Xt,shift:Re},{key:"Ctrl-d",run:Fe},{key:"Ctrl-h",run:We},{key:"Ctrl-k",run:tr},{key:"Ctrl-Alt-h",run:Qe},{key:"Ctrl-o",run:lr},{key:"Ctrl-t",run:ur},{key:"Ctrl-v",run:Zt}],br=[{key:"ArrowLeft",run:mt,shift:oe,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Et,shift:ce,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Ft,shift:Ve,preventDefault:!0},{key:"ArrowRight",run:kt,shift:le,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ct,shift:he,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Kt,shift:Ue,preventDefault:!0},{key:"ArrowUp",run:zt,shift:Ae,preventDefault:!0},{mac:"Cmd-ArrowUp",run:je,shift:Ne},{mac:"Ctrl-ArrowUp",run:Pt,shift:Ce},{key:"ArrowDown",run:xt,shift:De,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Le,shift:Oe},{mac:"Ctrl-ArrowDown",run:Zt,shift:Se},{key:"PageUp",run:Pt,shift:Ce},{key:"PageDown",run:Zt,shift:Se},{key:"Home",run:_t,shift:be,preventDefault:!0},{key:"Mod-Home",run:je,shift:Ne},{key:"End",run:Wt,shift:Ie,preventDefault:!0},{key:"Mod-End",run:Le,shift:Oe},{key:"Enter",run:yr,shift:yr},{key:"Mod-a",run:Te},{key:"Backspace",run:We,shift:We,preventDefault:!0},{key:"Delete",run:Fe,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Qe,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Xe,preventDefault:!0},{mac:"Mod-Backspace",run:rr,preventDefault:!0},{mac:"Mod-Delete",run:nr,preventDefault:!0}].concat(Ir.map((t=>({mac:t.key,run:t.run,shift:t.shift})))),Vr=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:Tt,shift:ve},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:$t,shift:Me},{key:"Alt-ArrowUp",run:fr},{key:"Shift-Alt-ArrowUp",run:hr},{key:"Alt-ArrowDown",run:ar},{key:"Shift-Alt-ArrowDown",run:dr},{key:"Mod-Alt-ArrowUp",run:xe},{key:"Mod-Alt-ArrowDown",run:Ge},{key:"Escape",run:He},{key:"Mod-Enter",run:wr},{key:"Alt-l",mac:"Ctrl-l",run:$e},{key:"Mod-i",run:Je,preventDefault:!0},{key:"Mod-[",run:Dr},{key:"Mod-]",run:Ar},{key:"Mod-Alt-\\",run:gr},{key:"Shift-Mod-k",run:pr},{key:"Shift-Mod-\\",run:te},{key:"Mod-/",run:D},{key:"Alt-A",run:b},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Er}].concat(br),Ur={key:"Tab",run:Ar,shift:Dr};export{xe as addCursorAbove,Ge as addCursorBelow,V as blockComment,U as blockUncomment,dr as copyLineDown,hr as copyLineUp,wt as cursorCharBackward,At as cursorCharBackwardLogical,yt as cursorCharForward,gt as cursorCharForwardLogical,mt as cursorCharLeft,kt as cursorCharRight,Le as cursorDocEnd,je as cursorDocStart,It as cursorGroupBackward,St as cursorGroupForward,Vt as cursorGroupForwardWin,Et as cursorGroupLeft,Ct as cursorGroupRight,_t as cursorLineBoundaryBackward,Wt as cursorLineBoundaryForward,Ft as cursorLineBoundaryLeft,Kt as cursorLineBoundaryRight,xt as cursorLineDown,Xt as cursorLineEnd,Qt as cursorLineStart,zt as cursorLineUp,te as cursorMatchingBracket,Zt as cursorPageDown,Pt as cursorPageUp,Lt as cursorSubwordBackward,jt as cursorSubwordForward,Tt as cursorSyntaxLeft,$t as cursorSyntaxRight,Vr as defaultKeymap,We as deleteCharBackward,_e as deleteCharBackwardStrict,Fe as deleteCharForward,Qe as deleteGroupBackward,Xe as deleteGroupForward,Ye as deleteGroupForwardWin,pr as deleteLine,rr as deleteLineBoundaryBackward,nr as deleteLineBoundaryForward,tr as deleteToLineEnd,er as deleteToLineStart,or as deleteTrailingWhitespace,Ir as emacsStyleKeymap,x as history,G as historyField,st as historyKeymap,Dr as indentLess,Ar as indentMore,gr as indentSelection,Ur as indentWithTab,wr as insertBlankLine,mr as insertNewline,yr as insertNewlineAndIndent,kr as insertNewlineKeepIndent,Sr as insertTab,$ as invertedEffects,T as isolateHistory,S as lineComment,I as lineUncomment,ar as moveLineDown,fr as moveLineUp,Z as redo,K as redoDepth,W as redoSelection,Te as selectAll,ie as selectCharBackward,fe as selectCharBackwardLogical,ue as selectCharForward,se as selectCharForwardLogical,oe as selectCharLeft,le as selectCharRight,Oe as selectDocEnd,Ne as selectDocStart,pe as selectGroupBackward,de as selectGroupForward,me as selectGroupForwardWin,ce as selectGroupLeft,he as selectGroupRight,$e as selectLine,be as selectLineBoundaryBackward,Ie as selectLineBoundaryForward,Ve as selectLineBoundaryLeft,Ue as selectLineBoundaryRight,De as selectLineDown,Re as selectLineEnd,Be as selectLineStart,Ae as selectLineUp,ee as selectMatchingBracket,Se as selectPageDown,Ce as selectPageUp,Je as selectParentSyntax,we as selectSubwordBackward,ye as selectSubwordForward,ve as selectSyntaxLeft,Me as selectSyntaxRight,He as simplifySelection,lr as splitLine,br as standardKeymap,Cr as temporarilySetTabFocusMode,b as toggleBlockComment,B as toggleBlockCommentByLine,D as toggleComment,C as toggleLineComment,Er as toggleTabFocusMode,ur as transposeChars,P as undo,F as undoDepth,q as undoSelection}
@@ -1 +1 @@
1
- import{t,p as e,H as r,h as a,a as c}from"./p-BrOXMyOG.js";import{a as s}from"./p-gPc0o8Jb.js";import{f as o,a as i}from"./p-D7bf2ztq.js";import{d as l}from"./p-B0YjIsVn.js";const f=e(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.query="",this.collapsed={}}toggle(t){this.collapsed=Object.assign(Object.assign({},this.collapsed),{[t]:!this.collapsed[t]})}render(){const t=s(),e=this.query.trim().toLowerCase(),r=Object.entries(t).map((([t,r])=>({category:t,molds:e?r.filter((r=>[r.name,o(`brick.${r.id}.name`,r.name),r.id,t,o(`category.${t}`,t)].some((t=>t.toLowerCase().includes(e))))):r}))).filter((t=>t.molds.length>0));return a(c,{key:"93facfae49363bb2fe1ceeb5ab84105fc5f339fa"},a("div",{key:"dc68df2c48929c7e5d6c4037b755761f0f581898",class:"fk-palette"},a("input",{key:"6acf14db7433b4a4bfb4cca2ca0fd51465785d7f",class:"fk-palette__search",type:"search",placeholder:i("palette.search"),value:this.query,onInput:t=>this.query=t.target.value}),r.map((({category:t,molds:r})=>{const c=!e&&this.collapsed[t];return a("section",{class:"fk-palette__group",key:t},a("button",{type:"button",class:"fk-palette__category",onClick:()=>this.toggle(t)},a("span",{class:{"fk-palette__chevron":!0,"fk-palette__chevron--collapsed":c}},"▾"),o(`category.${t}`,t),a("span",{class:"fk-palette__count"},r.length)),c?null:a("div",{class:"fk-palette__items"},r.map((t=>a("fk-brick-mold-item",{brickMold:t,key:`${t.type}:${t.id}`})))))})),0===r.length?a("p",{class:"fk-palette__empty"},i("palette.empty",{query:this.query})):null))}static get style(){return".fk-palette.sc-fk-brick-list{display:flex;flex-direction:column;gap:var(--fk-spacing);font-family:var(--fk-font)}.fk-palette__search.sc-fk-brick-list{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 1.5);background:var(--fk-color-surface);color:var(--fk-color-text)}.fk-palette__search.sc-fk-brick-list:focus{outline:none;border-color:var(--fk-color-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--fk-color-primary) 20%, transparent)}.fk-palette__category.sc-fk-brick-list{display:flex;align-items:center;gap:calc(var(--fk-spacing) / 2);width:100%;margin:0 0 calc(var(--fk-spacing) / 2);padding:calc(var(--fk-spacing) / 2) 0;border:none;background:transparent;font:inherit;font-size:0.7rem;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:var(--fk-color-muted);cursor:pointer}.fk-palette__category.sc-fk-brick-list:hover{color:var(--fk-color-text)}.fk-palette__chevron.sc-fk-brick-list{display:inline-block;transition:transform 120ms ease}.fk-palette__chevron--collapsed.sc-fk-brick-list{transform:rotate(-90deg)}.fk-palette__count.sc-fk-brick-list{margin-left:auto;font-weight:600;color:var(--fk-color-muted)}.fk-palette__items.sc-fk-brick-list{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));gap:calc(var(--fk-spacing) / 2)}.fk-palette__empty.sc-fk-brick-list{margin:0;font-size:0.8rem;color:var(--fk-color-muted)}"}},[2,"fk-brick-list",{query:[32],collapsed:[32]}]);function n(){"undefined"!=typeof customElements&&["fk-brick-list","fk-brick-mold-item"].forEach((e=>{switch(e){case"fk-brick-list":customElements.get(t(e))||customElements.define(t(e),f);break;case"fk-brick-mold-item":customElements.get(t(e))||l()}}))}n();export{f as F,n as d}
1
+ import{t,p as e,H as r,h as a,a as c}from"./p-BB4Llg42.js";import{a as s}from"./p-gPc0o8Jb.js";import{f as o,a as l}from"./p-BOmBVgfJ.js";import{d as i}from"./p--vL6GR31.js";const f=e(class extends r{constructor(t){super(),!1!==t&&this.__registerHost(),this.query="",this.collapsed={}}toggle(t){this.collapsed=Object.assign(Object.assign({},this.collapsed),{[t]:!this.collapsed[t]})}render(){const t=s(),e=this.query.trim().toLowerCase(),r=Object.entries(t).map((([t,r])=>({category:t,molds:e?r.filter((r=>[r.name,o(`brick.${r.id}.name`,r.name),r.id,t,o(`category.${t}`,t)].some((t=>t.toLowerCase().includes(e))))):r}))).filter((t=>t.molds.length>0));return a(c,{key:"93facfae49363bb2fe1ceeb5ab84105fc5f339fa"},a("div",{key:"dc68df2c48929c7e5d6c4037b755761f0f581898",class:"fk-palette"},a("input",{key:"6acf14db7433b4a4bfb4cca2ca0fd51465785d7f",class:"fk-palette__search",type:"search",placeholder:l("palette.search"),value:this.query,onInput:t=>this.query=t.target.value}),r.map((({category:t,molds:r})=>{const c=!e&&this.collapsed[t];return a("section",{class:"fk-palette__group",key:t},a("button",{type:"button",class:"fk-palette__category",onClick:()=>this.toggle(t)},a("span",{class:{"fk-palette__chevron":!0,"fk-palette__chevron--collapsed":c}},"▾"),o(`category.${t}`,t),a("span",{class:"fk-palette__count"},r.length)),c?null:a("div",{class:"fk-palette__items"},r.map((t=>a("fk-brick-mold-item",{brickMold:t,key:`${t.type}:${t.id}`})))))})),0===r.length?a("p",{class:"fk-palette__empty"},l("palette.empty",{query:this.query})):null))}static get style(){return".fk-palette.sc-fk-brick-list{display:flex;flex-direction:column;gap:var(--fk-spacing);font-family:var(--fk-font)}.fk-palette__search.sc-fk-brick-list{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:calc(var(--fk-radius) / 1.5);background:var(--fk-color-surface);color:var(--fk-color-text)}.fk-palette__search.sc-fk-brick-list:focus{outline:none;border-color:var(--fk-color-primary);box-shadow:0 0 0 2px color-mix(in srgb, var(--fk-color-primary) 20%, transparent)}.fk-palette__category.sc-fk-brick-list{display:flex;align-items:center;gap:calc(var(--fk-spacing) / 2);width:100%;margin:0 0 calc(var(--fk-spacing) / 2);padding:calc(var(--fk-spacing) / 2) 0;border:none;background:transparent;font:inherit;font-size:0.7rem;font-weight:700;letter-spacing:0.08em;text-transform:uppercase;color:var(--fk-color-muted);cursor:pointer}.fk-palette__category.sc-fk-brick-list:hover{color:var(--fk-color-text)}.fk-palette__chevron.sc-fk-brick-list{display:inline-block;transition:transform 120ms ease}.fk-palette__chevron--collapsed.sc-fk-brick-list{transform:rotate(-90deg)}.fk-palette__count.sc-fk-brick-list{margin-left:auto;font-weight:600;color:var(--fk-color-muted)}.fk-palette__items.sc-fk-brick-list{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr));gap:calc(var(--fk-spacing) / 2)}.fk-palette__empty.sc-fk-brick-list{margin:0;font-size:0.8rem;color:var(--fk-color-muted)}"}},[2,"fk-brick-list",{query:[32],collapsed:[32]}]);function n(){"undefined"!=typeof customElements&&["fk-brick-list","fk-brick-mold-item"].forEach((e=>{switch(e){case"fk-brick-list":customElements.get(t(e))||customElements.define(t(e),f);break;case"fk-brick-mold-item":customElements.get(t(e))||i()}}))}n();export{f as F,n as d}
@@ -9,4 +9,4 @@ function t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"de
9
9
  * https://github.com/Starcounter-Jack/JSON-Patch
10
10
  * (c) 2017-2021 Joachim Wester
11
11
  * MIT license
12
- */function gs(t,e){e.unobserve()}function bs(t,e){var i,r=function(t){return ys.get(t)}(t);if(r){var n=function(t,e){return t.observers.get(e)}(r,e);i=n&&n.observer}else r=new $s(t),ys.set(t,r);if(i)return i;if(i={},r.value=Yn(t),e){i.callback=e,i.next=null;var s=function(){_s(i)},o=function(){clearTimeout(i.next),i.next=setTimeout(s)};"undefined"!=typeof window&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return i.patches=[],i.object=t,i.unobserve=function(){_s(i),clearTimeout(i.next),function(t,e){t.observers.delete(e.callback)}(r,i),"undefined"!=typeof window&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},r.observers.set(e,new ws(e,i)),i}function _s(t,e){void 0===e&&(e=!1);var i=ys.get(t.object);Es(i.value,t.object,t.patches,"",e),t.patches.length&&fs(i.value,t.patches);var r=t.patches;return r.length>0&&(t.patches=[],t.callback&&t.callback(r)),r}function Es(t,e,i,r,n){if(e!==t){"function"==typeof e.toJSON&&(e=e.toJSON());for(var s=Qn(e),o=Qn(t),a=!1,h=o.length-1;h>=0;h--){var u=t[f=o[h]];if(!Xn(e,f)||void 0===e[f]&&void 0!==u&&!1===Array.isArray(e))Array.isArray(t)===Array.isArray(e)?(n&&i.push({op:"test",path:r+"/"+es(f),value:Yn(u)}),i.push({op:"remove",path:r+"/"+es(f)}),a=!0):(n&&i.push({op:"test",path:r,value:t}),i.push({op:"replace",path:r,value:e}));else{var c=e[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?Es(u,c,i,r+"/"+es(f),n):u!==c&&(n&&i.push({op:"test",path:r+"/"+es(f),value:Yn(u)}),i.push({op:"replace",path:r+"/"+es(f),value:Yn(c)}))}}if(a||s.length!=o.length)for(h=0;h<s.length;h++){var f;Xn(t,f=s[h])||void 0===e[f]||i.push({op:"add",path:r+"/"+es(f),value:Yn(e[f])})}}}function Os(t,e,i){void 0===i&&(i=!1);var r=[];return Es(t,e,r,"",i),r}var js=Object.assign({},vs,Object.freeze({__proto__:null,compare:Os,generate:_s,observe:bs,unobserve:gs}),{JsonPatchError:ss,deepClone:Yn,escapePathComponent:es,unescapePathComponent:is}),xs=Object.freeze({__proto__:null,JsonPatchError:ss,_areEquals:ms,applyOperation:cs,applyPatch:fs,applyReducer:ls,compare:Os,deepClone:Yn,default:js,escapePathComponent:es,generate:_s,getValueByPointer:us,observe:bs,unescapePathComponent:is,unobserve:gs,validate:ps,validator:ds});function Ss(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Object.keys(t).length>0&&Object.values(t).every((t=>"string"==typeof t))}function ks(t,e){return Ss(t)?e&&void 0!==t[e]?t[e]:Object.values(t)[0]:t}function Ps(t,e){if(!t)return t;const i={};for(const[r,n]of Object.entries(t))i[r]=ks(n,e);return i}var Is={en:{required:"This field is required",minLength:"Must be at least {value} characters",maxLength:"Must be at most {value} characters",min:"Must be at least {value}",max:"Must be at most {value}",pattern:"Invalid format",minItems:"Select at least {value} item(s)",maxItems:"Select at most {value} item(s)",email:"Invalid email address",url:"Invalid URL",type:"Invalid value",custom:"Invalid value"},fr:{required:"Ce champ est obligatoire",minLength:"Minimum {value} caractères",maxLength:"Maximum {value} caractères",min:"Minimum {value}",max:"Maximum {value}",pattern:"Format invalide",minItems:"Sélectionnez au moins {value} élément(s)",maxItems:"Sélectionnez au plus {value} élément(s)",email:"Adresse email invalide",url:"URL invalide",type:"Valeur invalide",custom:"Valeur invalide"}};function As(t,e,i){return((Is[e??"en"]??Is.en)[t]??Is.en[t]??"Invalid value").replace("{value}",String(i??""))}function*Cs(t,e="0"){if(t){yield{brick:t,path:e};for(const[i,r]of(t.children??[]).entries())yield*Cs(r,`${e}.${i}`)}}function*Ns(t){if(t&&(yield t,"collection"!==t.type))for(const e of t.children??[])yield*Ns(e)}class Ts{type;dataType;id;name;configsForm;category;styles;unWrapData;isPrivate;validators;defaultConfigs;constructor(t){this.type=t.type,this.dataType=t.dataType,this.id=t.id,this.name=t.name,this.configsForm=t.configsForm,this.category=t.category,this.styles=t.styles,this.unWrapData=t.unWrapData??!1,this.isPrivate=t.isPrivate??!1,this.validators=t.validators??[],this.defaultConfigs=t.defaultConfigs}getBrickEmptySpec(){return{type:this.type,dataType:this.dataType,id:this.id,name:this.name,...void 0!==this.category?{category:this.category}:{},...void 0!==this.configsForm?{configsForm:this.configsForm}:{},...void 0!==this.styles?{styles:this.styles}:{},...void 0!==this.defaultConfigs?{configs:{...this.defaultConfigs}}:{},validators:this.validators}}}var Ms=new Set(["__proto__","constructor","prototype"]);class Rs{value;constructor(t){this.value=t}}var Ds=(t,e,i)=>{t.scopes[t.scopes.length-1].set(e,i)},zs=t=>{if("number"==typeof t)return t;const e=String(t);if(Ms.has(e))throw new Error(`Access to "${e}" is not allowed`);return e},Ls=(t,e)=>({object:Us(t,e.object),prop:zs(e.computed?Us(t,e.property):e.property.name),optional:!0===e.optional}),Us=(t,e)=>{if(++t.steps>1e5)throw new Error("Sandbox execution budget exceeded");switch(e.type){case"Program":case"BlockStatement":for(const i of e.body){const e=Us(t,i);if(e instanceof Rs)return e}return;case"ReturnStatement":return new Rs(e.argument?Us(t,e.argument):void 0);case"IfStatement":return Us(t,e.test)?Us(t,e.consequent):e.alternate?Us(t,e.alternate):void 0;case"VariableDeclaration":for(const i of e.declarations){const e=i.id;if("Identifier"!==e.type)throw new Error("Only simple variable names are supported");Ds(t,e.name,i.init?Us(t,i.init):void 0)}return;case"ExpressionStatement":return void Us(t,e.expression);case"Literal":return e.value;case"TemplateLiteral":{const i=e.expressions;let r="";return e.quasis.forEach(((e,n)=>{r+=e.value.cooked??"",n<i.length&&(r+=String(Us(t,i[n])))})),r}case"Identifier":return((t,e)=>{for(let i=t.scopes.length-1;i>=0;i--)if(t.scopes[i].has(e))return t.scopes[i].get(e);throw new Error(`Unknown identifier "${e}"`)})(t,e.name);case"ThisExpression":return;case"ChainExpression":return Us(t,e.expression);case"MemberExpression":return((t,e)=>{const{object:i,prop:r,optional:n}=Ls(t,e);if(null==i){if(n)return;throw new Error(`Cannot read "${String(r)}" of ${String(i)}`)}return i[r]})(t,e);case"CallExpression":{const i=e.callee,r=[];for(const i of e.arguments)if("SpreadElement"===i.type){const e=Us(t,i.argument);Array.isArray(e)&&r.push(...e)}else r.push(Us(t,i));if("MemberExpression"===i.type){const{object:n,prop:s,optional:o}=Ls(t,i);if(null==n){if(o||!0===e.optional)return;throw new Error(`Cannot call "${String(s)}" of ${String(n)}`)}const a=n[s];if("function"!=typeof a){if(!0===e.optional&&null==a)return;throw new Error(`"${String(s)}" is not a function`)}if(a===Function||a===eval)throw new Error("This function is not allowed");return a.apply(n,r)}const n=Us(t,i);if("function"!=typeof n){if(!0===e.optional&&null==n)return;throw new Error("Value is not a function")}if(n===Function||n===eval)throw new Error("This function is not allowed");return n(...r)}case"ArrowFunctionExpression":{const i=e.params,r=e.body,n=[...t.scopes];return(...s)=>{const o=new Map;i.forEach(((t,e)=>{if("Identifier"!==t.type)throw new Error("Only simple parameters are supported");o.set(t.name,s[e])}));const a={steps:t.steps,scopes:[...n,o]},h=Us(a,r);return t.steps=a.steps,h instanceof Rs?h.value:!0===e.expression?h:void 0}}case"BinaryExpression":{const i=Us(t,e.left),r=Us(t,e.right);switch(e.operator){case"===":return i===r;case"!==":return i!==r;case"==":return i==r;case"!=":return i!=r;case"<":return i<r;case"<=":return i<=r;case">":return i>r;case">=":return i>=r;case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r;case"%":return i%r;case"**":return i**r;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"LogicalExpression":{const i=Us(t,e.left);switch(e.operator){case"&&":return i&&Us(t,e.right);case"||":return i||Us(t,e.right);case"??":return i??Us(t,e.right);default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"UnaryExpression":{const i=Us(t,e.argument);switch(e.operator){case"!":return!i;case"-":return-i;case"+":return+i;case"typeof":return typeof i;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"ConditionalExpression":return Us(t,e.test)?Us(t,e.consequent):Us(t,e.alternate);case"AssignmentExpression":{const i=e.left;if("Identifier"!==i.type||"="!==e.operator)throw new Error("Only simple assignments are supported");const r=Us(t,e.right);return((t,e,i)=>{for(let r=t.scopes.length-1;r>=0;r--)if(t.scopes[r].has(e))return void t.scopes[r].set(e,i);throw new Error(`Cannot assign to unknown identifier "${e}"`)})(t,i.name,r),r}case"ArrayExpression":{const i=[];for(const r of e.elements)if(r)if("SpreadElement"===r.type){const e=Us(t,r.argument);Array.isArray(e)&&i.push(...e)}else i.push(Us(t,r));return i}case"ObjectExpression":{const i={};for(const r of e.properties){if("SpreadElement"===r.type){const e=Us(t,r.argument);if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))i[String(zs(t))]=r;continue}const e=r.key,n=zs(r.computed?Us(t,e):"Identifier"===e.type?e.name:e.value);i[String(n)]=Us(t,r.value)}return i}default:throw new Error(`Unsupported syntax: ${e.type}`)}},qs={undefined:void 0,NaN:NaN,Infinity:1/0,Math,JSON,Number,String,Boolean,Array,Object,Date,parseInt,parseFloat,isNaN,isFinite},Bs=Symbol.for("formkrafter.core.services"),Fs=globalThis,Vs=Fs[Bs]??={jsRunnerService:new class{validateJs(t,e={ecmaVersion:"latest",allowReturnOutsideFunction:!0}){try{return Xt(t,e),{valide:!0}}catch(t){return{valide:!1,error:t instanceof Error?t:new Error(String(t))}}}eval(t,e={}){return function(t,e={}){const i=Xt(t,{ecmaVersion:"latest",allowReturnOutsideFunction:!0}),r={steps:0,scopes:[new Map(Object.entries({...qs,...e})),new Map]},n=Us(r,i);return n instanceof Rs?n.value:void 0}(t,e)}},dataSourceService:new class{defaults;cache=new Map;constructor(t={}){this.defaults=t}fetchOptions(t,e){const i={...this.defaults.headers,...e?.headers},r={};Object.keys(i).length&&(r.headers=i),this.defaults.credentials&&(r.credentials=this.defaults.credentials);const n=`${t}|${JSON.stringify(r)}`;let s=this.cache.get(n);return s||(s=fetch(t,Object.keys(r).length?r:void 0).then((e=>{if(!e.ok)throw new Error(`Data source request failed (${e.status}): ${t}`);return e.json()})).then((t=>Array.isArray(t)?t:[])).catch((t=>{throw this.cache.delete(n),t})),this.cache.set(n,s)),s}},fileUploadService:new class{async upload(t){const e=globalThis.btoa;if(!e)throw new Error("No base64 encoder available");const i=new Uint8Array(await t.arrayBuffer());let r="";for(const t of i)r+=String.fromCharCode(t);return{name:t.name,type:t.type,size:t.size,url:`data:${t.type};base64,${e(r)}`}}}},Gs=(t,e)=>{try{return Vs.jsRunnerService.eval(t,{dataMap:e??{}})}catch(t){return t instanceof Error?t:new Error(String(t))}},Hs=(t,e)=>((t,e)=>((t,e)=>t?.filter((t=>((t,e)=>"jsonLogic"===t.type?null!=t.logic&&!0===n.apply(t.logic,e):"javaScript"===t.type&&!!t.code&&!0===Gs(t.code,e))(t,e))))(t,e)?.map((t=>t.effects)).flat().filter((t=>null!=t)))(t,e)?.map((t=>{let i;return t.property?("boolean"===t.property.type?i=t.boolean:"logic"===t.property.type&&null!=t.logic?i=n.apply(t.logic,e):"code"===t.property.type&&t.code?i=Gs(t.code,e):"string"===t.property.type&&(i=t.string),{[t.property.target]:i}):{}})).flat().reduce(((t,e)=>({...t,...e})),{})??{hidden:!1},Ks=new Un.Ajv({allErrors:!0});Wn(Ks,["email","uri"]),Fn(Ks);var Ws=new WeakMap,Js=t=>{if("required"===t.keyword)return t.params.missingProperty;if("errorMessage"===t.keyword){const e=t.params.errors?.[0];return e?Js(e):void 0}return t.instancePath.split("/").filter(Boolean)[0]},Zs=(t,e,i)=>{const r={},n=((t,e)=>{let i=Ws.get(t);i||(i=new Map,Ws.set(t,i));const r=e??"";let n=i.get(r);if(!n){const s=function(t,e){if(!t)return;const i={},r=[],n={},s=t=>{const i=ks(t,e);return"string"==typeof i?i:void 0};for(const o of Ns(t)){const t=o.configs?.key,a=o.dataType;if(!t||!a||"void"===a)continue;const h=o.validations?.find((t=>"required"===t.validator)),u={type:a,nullable:!h},c={type:As("type",e)};for(const t of o.validations??[]){const{validator:i,value:r}=t,n=s(t.message)??As(i,e,r);"minLength"===i&&null!=r?(u.minLength=Number(r),c.minLength=n):"maxLength"===i&&null!=r?(u.maxLength=Number(r),c.maxLength=n):"min"===i&&null!=r?(u.minimum=Number(r),c.minimum=n):"max"===i&&null!=r?(u.maximum=Number(r),c.maximum=n):"pattern"===i&&"string"==typeof r&&r?(u.pattern=r,c.pattern=n):"minItems"===i&&null!=r?(u.minItems=Number(r),c.minItems=n):"maxItems"===i&&null!=r?(u.maxItems=Number(r),c.maxItems=n):"email"===i?(u.format="email",c.format=n):"url"===i&&(u.format="uri",c.format=n)}u.errorMessage=c,i[t]=u,h&&(r.push(t),n[t]=s(h.message)??As("required",e))}return{type:"object",properties:i,required:r,...Object.keys(n).length?{errorMessage:{required:n}}:{},additionalProperties:!1}}(t,e);if(!s)return;try{n=Ks.compile(s)}catch{return}i.set(r,n)}return n})(t,i);if(n&&!n(e))for(const t of n.errors??[]){const e=Js(t);e&&!(e in r)&&t.message&&(r[e]=t.message)}for(const[n,s]of Object.entries(((t,e,i)=>{const r={},n=e??{};for(const e of Ns(t)){const t=e.configs?.key;if(t)for(const s of e.validations??[]){if("custom"!==s.validator||!s.customValidator)continue;const e=Gs(`const value = dataMap?.[${JSON.stringify(t)}];\n${s.customValidator}`,n);if(!0!==e&&null!=e&&!(t in r))if("string"==typeof e)r[t]=e;else if(e instanceof Error)r[t]=e.message;else{const e=ks(s.message,i);r[t]="string"==typeof e?e:As("custom",i)}}}return r})(t,e,i)))n in r||(r[n]=s);const s="object"==typeof e&&null!==e?e:void 0;for(const e of((t,e)=>{const i=new Set,r=(t,n)=>{const s=n||!!t.rules?.length&&!0===Hs(t.rules,e).hidden,o=t.configs?.key;if(s&&o&&i.add(o),"collection"!==t.type)for(const e of t.children??[])r(e,s)};return r(t,!1),i})(t,s))delete r[e];return{valid:0===Object.keys(r).length,errors:r}};function Xs(t){return t.split(".").slice(1).map((t=>`/children/${t}`)).join("")}function Qs(t,e){if(t.configs?.uid===e)return"";for(const[i,r]of(t.children??[]).entries()){const t=Qs(r,e);if(void 0!==t)return`/children/${i}${t}`}}function Ys(t,e){let i=t;for(const t of e.split(".").slice(1))i=i?.children?.[Number(t)];return i}var to=(js??xs).applyPatch,eo=(t,e,i)=>({spec:to(t,e,!0,!1).newDocument,patches:e,inverse:i}),io=(t,e)=>{const i=Ys(t,e);if(!i)throw new Error(`No brick at path "${e}"`);return i},ro=(t,e)=>{const i=Qs(t,e);if(void 0===i)throw new Error(`No brick with uid "${e}"`);let r=t;for(const t of i.split("/children/").slice(1))r=r.children[Number(t)];return{pointer:i,brick:r}},no=t=>JSON.parse(JSON.stringify(t));function so(t,e,i,r){const n=io(t,i),s=Xs(i),o=no(e);if(!n.children){const e=`${s}/children`;return eo(t,[{op:"add",path:e,value:[o]}],[{op:"remove",path:e}])}const a=`${s}/children/${Math.min(r??n.children.length,n.children.length)}`;return eo(t,[{op:"add",path:a,value:o}],[{op:"remove",path:a}])}function oo(t,e){if("0"===e)throw new Error("Cannot remove the root brick");const i=io(t,e),r=Xs(e);return eo(t,[{op:"remove",path:r}],[{op:"add",path:r,value:i}])}function ao(t,e,i){if("0"===e||"0"===i)throw new Error("Cannot move the root brick");const r=io(t,e),n=e.split(".").map(Number),s=i.split(".").map(Number),o=n.length-1,a=n[o],h=s.length>o&&n.slice(0,o).every(((t,e)=>t===s[e])),u=[...s];if(h){if(u[o]===a&&u.length>n.length)throw new Error(`Cannot move a brick into its own subtree ("${e}" → "${i}")`);u[o]>a&&(u[o]-=1)}const c=Xs(e),f=Xs(u.join("."));return eo(t,[{op:"remove",path:c},{op:"add",path:f,value:r}],[{op:"remove",path:f},{op:"add",path:c,value:r}])}var ho=t=>({...t,...t.configs?{configs:{...t.configs,uid:crypto.randomUUID()}}:{},...t.children?{children:t.children.map(ho)}:{}});function uo(t,e){if("0"===e)throw new Error("Cannot duplicate the root brick");const i=io(t,e),r=e.split("."),n=Number(r[r.length-1])+1,s=Xs([...r.slice(0,-1),String(n)].join(".")),o=ho(no(i));return eo(t,[{op:"add",path:s,value:o}],[{op:"remove",path:s}])}var co=(t,e,i,r,n)=>{const s=`${e}/${i}`;return void 0===n?eo(t,[{op:"add",path:s,value:r}],[{op:"remove",path:s}]):eo(t,[{op:"replace",path:s,value:r}],[{op:"replace",path:s,value:n}])};function fo(t,e,i){const{pointer:r,brick:n}=ro(t,e),s={...n.configs,...i};return co(t,r,"configs",s,n.configs)}function lo(t,e,i){const{pointer:r,brick:n}=ro(t,e),s={...n.styles,...i};return co(t,r,"styles",s,n.styles)}function po(t,e,i){const{pointer:r,brick:n}=ro(t,e);return co(t,r,"validations",i,n.validations)}function mo(t,e,i){const{pointer:r,brick:n}=ro(t,e);return co(t,r,"rules",i,n.rules)}class vo{past=[];future=[];record(t){this.past.push({patches:t.patches,inverse:t.inverse}),this.future=[]}get canUndo(){return this.past.length>0}get canRedo(){return this.future.length>0}undo(t){const e=this.past.pop();if(e)return this.future.push(e),to(t,e.inverse,!0,!1).newDocument}redo(t){const e=this.future.pop();if(e)return this.past.push(e),to(t,e.patches,!0,!1).newDocument}clear(){this.past=[],this.future=[]}}export{Ts as B,vo as S,Ss as a,Ns as b,so as c,Ys as d,oo as e,uo as f,Hs as g,lo as h,Cs as i,po as j,mo as k,Gs as l,ao as m,ks as n,Ps as r,Vs as s,fo as u,Zs as v}
12
+ */function gs(t,e){e.unobserve()}function bs(t,e){var i,r=function(t){return ys.get(t)}(t);if(r){var n=function(t,e){return t.observers.get(e)}(r,e);i=n&&n.observer}else r=new $s(t),ys.set(t,r);if(i)return i;if(i={},r.value=Yn(t),e){i.callback=e,i.next=null;var s=function(){_s(i)},o=function(){clearTimeout(i.next),i.next=setTimeout(s)};"undefined"!=typeof window&&(window.addEventListener("mouseup",o),window.addEventListener("keyup",o),window.addEventListener("mousedown",o),window.addEventListener("keydown",o),window.addEventListener("change",o))}return i.patches=[],i.object=t,i.unobserve=function(){_s(i),clearTimeout(i.next),function(t,e){t.observers.delete(e.callback)}(r,i),"undefined"!=typeof window&&(window.removeEventListener("mouseup",o),window.removeEventListener("keyup",o),window.removeEventListener("mousedown",o),window.removeEventListener("keydown",o),window.removeEventListener("change",o))},r.observers.set(e,new ws(e,i)),i}function _s(t,e){void 0===e&&(e=!1);var i=ys.get(t.object);Es(i.value,t.object,t.patches,"",e),t.patches.length&&fs(i.value,t.patches);var r=t.patches;return r.length>0&&(t.patches=[],t.callback&&t.callback(r)),r}function Es(t,e,i,r,n){if(e!==t){"function"==typeof e.toJSON&&(e=e.toJSON());for(var s=Qn(e),o=Qn(t),a=!1,h=o.length-1;h>=0;h--){var u=t[f=o[h]];if(!Xn(e,f)||void 0===e[f]&&void 0!==u&&!1===Array.isArray(e))Array.isArray(t)===Array.isArray(e)?(n&&i.push({op:"test",path:r+"/"+es(f),value:Yn(u)}),i.push({op:"remove",path:r+"/"+es(f)}),a=!0):(n&&i.push({op:"test",path:r,value:t}),i.push({op:"replace",path:r,value:e}));else{var c=e[f];"object"==typeof u&&null!=u&&"object"==typeof c&&null!=c&&Array.isArray(u)===Array.isArray(c)?Es(u,c,i,r+"/"+es(f),n):u!==c&&(n&&i.push({op:"test",path:r+"/"+es(f),value:Yn(u)}),i.push({op:"replace",path:r+"/"+es(f),value:Yn(c)}))}}if(a||s.length!=o.length)for(h=0;h<s.length;h++){var f;Xn(t,f=s[h])||void 0===e[f]||i.push({op:"add",path:r+"/"+es(f),value:Yn(e[f])})}}}function Os(t,e,i){void 0===i&&(i=!1);var r=[];return Es(t,e,r,"",i),r}var js=Object.assign({},vs,Object.freeze({__proto__:null,compare:Os,generate:_s,observe:bs,unobserve:gs}),{JsonPatchError:ss,deepClone:Yn,escapePathComponent:es,unescapePathComponent:is}),xs=Object.freeze({__proto__:null,JsonPatchError:ss,_areEquals:ms,applyOperation:cs,applyPatch:fs,applyReducer:ls,compare:Os,deepClone:Yn,default:js,escapePathComponent:es,generate:_s,getValueByPointer:us,observe:bs,unescapePathComponent:is,unobserve:gs,validate:ps,validator:ds});function Ss(t){return"object"==typeof t&&null!==t&&!Array.isArray(t)&&Object.keys(t).length>0&&Object.values(t).every((t=>"string"==typeof t))}function ks(t,e){return Ss(t)?e&&void 0!==t[e]?t[e]:Object.values(t)[0]:t}function Ps(t,e){if(!t)return t;const i={};for(const[r,n]of Object.entries(t))i[r]=ks(n,e);return i}var Is={en:{required:"This field is required",minLength:"Must be at least {value} characters",maxLength:"Must be at most {value} characters",min:"Must be at least {value}",max:"Must be at most {value}",pattern:"Invalid format",minItems:"Select at least {value} item(s)",maxItems:"Select at most {value} item(s)",email:"Invalid email address",url:"Invalid URL",type:"Invalid value",custom:"Invalid value"},fr:{required:"Ce champ est obligatoire",minLength:"Minimum {value} caractères",maxLength:"Maximum {value} caractères",min:"Minimum {value}",max:"Maximum {value}",pattern:"Format invalide",minItems:"Sélectionnez au moins {value} élément(s)",maxItems:"Sélectionnez au plus {value} élément(s)",email:"Adresse email invalide",url:"URL invalide",type:"Valeur invalide",custom:"Valeur invalide"}};function As(t,e,i){return((Is[e??"en"]??Is.en)[t]??Is.en[t]??"Invalid value").replace("{value}",String(i??""))}function*Cs(t,e="0"){if(t){yield{brick:t,path:e};for(const[i,r]of(t.children??[]).entries())yield*Cs(r,`${e}.${i}`)}}function*Ns(t){if(t&&(yield t,"collection"!==t.type))for(const e of t.children??[])yield*Ns(e)}class Ts{type;dataType;id;name;configsForm;category;styles;unWrapData;isPrivate;validators;defaultConfigs;constructor(t){this.type=t.type,this.dataType=t.dataType,this.id=t.id,this.name=t.name,this.configsForm=t.configsForm,this.category=t.category,this.styles=t.styles,this.unWrapData=t.unWrapData??!1,this.isPrivate=t.isPrivate??!1,this.validators=t.validators??[],this.defaultConfigs=t.defaultConfigs}getBrickEmptySpec(){return{type:this.type,dataType:this.dataType,id:this.id,name:this.name,...void 0!==this.category?{category:this.category}:{},...void 0!==this.configsForm?{configsForm:this.configsForm}:{},...void 0!==this.styles?{styles:this.styles}:{},...void 0!==this.defaultConfigs?{configs:{...this.defaultConfigs}}:{},validators:this.validators}}}var Ms=new Set(["__proto__","constructor","prototype"]);class Rs{value;constructor(t){this.value=t}}var Ds=(t,e,i)=>{t.scopes[t.scopes.length-1].set(e,i)},zs=t=>{if("number"==typeof t)return t;const e=String(t);if(Ms.has(e))throw new Error(`Access to "${e}" is not allowed`);return e},Ls=(t,e)=>({object:Us(t,e.object),prop:zs(e.computed?Us(t,e.property):e.property.name),optional:!0===e.optional}),Us=(t,e)=>{if(++t.steps>1e5)throw new Error("Sandbox execution budget exceeded");switch(e.type){case"Program":case"BlockStatement":for(const i of e.body){const e=Us(t,i);if(e instanceof Rs)return e}return;case"ReturnStatement":return new Rs(e.argument?Us(t,e.argument):void 0);case"IfStatement":return Us(t,e.test)?Us(t,e.consequent):e.alternate?Us(t,e.alternate):void 0;case"VariableDeclaration":for(const i of e.declarations){const e=i.id;if("Identifier"!==e.type)throw new Error("Only simple variable names are supported");Ds(t,e.name,i.init?Us(t,i.init):void 0)}return;case"ExpressionStatement":return void Us(t,e.expression);case"Literal":return e.value;case"TemplateLiteral":{const i=e.expressions;let r="";return e.quasis.forEach(((e,n)=>{r+=e.value.cooked??"",n<i.length&&(r+=String(Us(t,i[n])))})),r}case"Identifier":return((t,e)=>{for(let i=t.scopes.length-1;i>=0;i--)if(t.scopes[i].has(e))return t.scopes[i].get(e);throw new Error(`Unknown identifier "${e}"`)})(t,e.name);case"ThisExpression":return;case"ChainExpression":return Us(t,e.expression);case"MemberExpression":return((t,e)=>{const{object:i,prop:r,optional:n}=Ls(t,e);if(null==i){if(n)return;throw new Error(`Cannot read "${String(r)}" of ${String(i)}`)}return i[r]})(t,e);case"CallExpression":{const i=e.callee,r=[];for(const i of e.arguments)if("SpreadElement"===i.type){const e=Us(t,i.argument);Array.isArray(e)&&r.push(...e)}else r.push(Us(t,i));if("MemberExpression"===i.type){const{object:n,prop:s,optional:o}=Ls(t,i);if(null==n){if(o||!0===e.optional)return;throw new Error(`Cannot call "${String(s)}" of ${String(n)}`)}const a=n[s];if("function"!=typeof a){if(!0===e.optional&&null==a)return;throw new Error(`"${String(s)}" is not a function`)}if(a===Function||a===eval)throw new Error("This function is not allowed");return a.apply(n,r)}const n=Us(t,i);if("function"!=typeof n){if(!0===e.optional&&null==n)return;throw new Error("Value is not a function")}if(n===Function||n===eval)throw new Error("This function is not allowed");return n(...r)}case"ArrowFunctionExpression":{const i=e.params,r=e.body,n=[...t.scopes];return(...s)=>{const o=new Map;i.forEach(((t,e)=>{if("Identifier"!==t.type)throw new Error("Only simple parameters are supported");o.set(t.name,s[e])}));const a={steps:t.steps,scopes:[...n,o]},h=Us(a,r);return t.steps=a.steps,h instanceof Rs?h.value:!0===e.expression?h:void 0}}case"BinaryExpression":{const i=Us(t,e.left),r=Us(t,e.right);switch(e.operator){case"===":return i===r;case"!==":return i!==r;case"==":return i==r;case"!=":return i!=r;case"<":return i<r;case"<=":return i<=r;case">":return i>r;case">=":return i>=r;case"+":return i+r;case"-":return i-r;case"*":return i*r;case"/":return i/r;case"%":return i%r;case"**":return i**r;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"LogicalExpression":{const i=Us(t,e.left);switch(e.operator){case"&&":return i&&Us(t,e.right);case"||":return i||Us(t,e.right);case"??":return i??Us(t,e.right);default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"UnaryExpression":{const i=Us(t,e.argument);switch(e.operator){case"!":return!i;case"-":return-i;case"+":return+i;case"typeof":return typeof i;default:throw new Error(`Unsupported operator "${String(e.operator)}"`)}}case"ConditionalExpression":return Us(t,e.test)?Us(t,e.consequent):Us(t,e.alternate);case"AssignmentExpression":{const i=e.left;if("Identifier"!==i.type||"="!==e.operator)throw new Error("Only simple assignments are supported");const r=Us(t,e.right);return((t,e,i)=>{for(let r=t.scopes.length-1;r>=0;r--)if(t.scopes[r].has(e))return void t.scopes[r].set(e,i);throw new Error(`Cannot assign to unknown identifier "${e}"`)})(t,i.name,r),r}case"ArrayExpression":{const i=[];for(const r of e.elements)if(r)if("SpreadElement"===r.type){const e=Us(t,r.argument);Array.isArray(e)&&i.push(...e)}else i.push(Us(t,r));return i}case"ObjectExpression":{const i={};for(const r of e.properties){if("SpreadElement"===r.type){const e=Us(t,r.argument);if(e&&"object"==typeof e)for(const[t,r]of Object.entries(e))i[String(zs(t))]=r;continue}const e=r.key,n=zs(r.computed?Us(t,e):"Identifier"===e.type?e.name:e.value);i[String(n)]=Us(t,r.value)}return i}default:throw new Error(`Unsupported syntax: ${e.type}`)}},qs={undefined:void 0,NaN:NaN,Infinity:1/0,Math,JSON,Number,String,Boolean,Array,Object,Date,parseInt,parseFloat,isNaN,isFinite},Bs=Symbol.for("formkrafter.core.services"),Fs=globalThis,Vs=Fs[Bs]??={jsRunnerService:new class{validateJs(t,e={ecmaVersion:"latest",allowReturnOutsideFunction:!0}){try{return Xt(t,e),{valide:!0}}catch(t){return{valide:!1,error:t instanceof Error?t:new Error(String(t))}}}eval(t,e={}){return function(t,e={}){const i=Xt(t,{ecmaVersion:"latest",allowReturnOutsideFunction:!0}),r={steps:0,scopes:[new Map(Object.entries({...qs,...e})),new Map]},n=Us(r,i);return n instanceof Rs?n.value:void 0}(t,e)}},dataSourceService:new class{defaults;cache=new Map;constructor(t={}){this.defaults=t}fetchOptions(t,e){const i={...this.defaults.headers,...e?.headers},r={};Object.keys(i).length&&(r.headers=i),this.defaults.credentials&&(r.credentials=this.defaults.credentials);const n=`${t}|${JSON.stringify(r)}`;let s=this.cache.get(n);return s||(s=fetch(t,Object.keys(r).length?r:void 0).then((e=>{if(!e.ok)throw new Error(`Data source request failed (${e.status}): ${t}`);return e.json()})).then((t=>Array.isArray(t)?t:[])).catch((t=>{throw this.cache.delete(n),t})),this.cache.set(n,s)),s}},fileUploadService:new class{async upload(t){const e=globalThis.btoa;if(!e)throw new Error("No base64 encoder available");const i=new Uint8Array(await t.arrayBuffer());let r="";for(const t of i)r+=String.fromCharCode(t);return{name:t.name,type:t.type,size:t.size,url:`data:${t.type};base64,${e(r)}`}}}},Gs=(t,e)=>{try{return Vs.jsRunnerService.eval(t,{dataMap:e??{}})}catch(t){return t instanceof Error?t:new Error(String(t))}},Hs=(t,e)=>((t,e)=>((t,e)=>t?.filter((t=>((t,e)=>"jsonLogic"===t.type?null!=t.logic&&!0===n.apply(t.logic,e):"javaScript"===t.type&&!!t.code&&!0===Gs(t.code,e))(t,e))))(t,e)?.map((t=>t.effects)).flat().filter((t=>null!=t)))(t,e)?.map((t=>{let i;return t.property?("boolean"===t.property.type?i=t.boolean:"logic"===t.property.type&&null!=t.logic?i=n.apply(t.logic,e):"code"===t.property.type&&t.code?i=Gs(t.code,e):"string"===t.property.type&&(i=t.string),{[t.property.target]:i}):{}})).flat().reduce(((t,e)=>({...t,...e})),{})??{hidden:!1},Ks=new Un.Ajv({allErrors:!0});Wn(Ks,["email","uri"]),Fn(Ks);var Ws=new WeakMap,Js=t=>{if("required"===t.keyword)return t.params.missingProperty;if("errorMessage"===t.keyword){const e=t.params.errors?.[0];return e?Js(e):void 0}return t.instancePath.split("/").filter(Boolean)[0]},Zs=(t,e,i)=>{const r={},n=((t,e)=>{let i=Ws.get(t);i||(i=new Map,Ws.set(t,i));const r=e??"";let n=i.get(r);if(!n){const s=function(t,e){if(!t)return;const i={},r=[],n={},s=t=>{const i=ks(t,e);return"string"==typeof i?i:void 0};for(const o of Ns(t)){const t=o.configs?.key,a=!0===o.configs?.multiple&&"object"===o.dataType?"array":o.dataType;if(!t||!a||"void"===a)continue;const h=o.validations?.find((t=>"required"===t.validator)),u={type:a,nullable:!h},c={type:As("type",e)};for(const t of o.validations??[]){const{validator:i,value:r}=t,n=s(t.message)??As(i,e,r);"minLength"===i&&null!=r?(u.minLength=Number(r),c.minLength=n):"maxLength"===i&&null!=r?(u.maxLength=Number(r),c.maxLength=n):"min"===i&&null!=r?(u.minimum=Number(r),c.minimum=n):"max"===i&&null!=r?(u.maximum=Number(r),c.maximum=n):"pattern"===i&&"string"==typeof r&&r?(u.pattern=r,c.pattern=n):"minItems"===i&&null!=r?(u.minItems=Number(r),c.minItems=n):"maxItems"===i&&null!=r?(u.maxItems=Number(r),c.maxItems=n):"email"===i?(u.format="email",c.format=n):"url"===i&&(u.format="uri",c.format=n)}u.errorMessage=c,i[t]=u,h&&(r.push(t),n[t]=s(h.message)??As("required",e))}return{type:"object",properties:i,required:r,...Object.keys(n).length?{errorMessage:{required:n}}:{},additionalProperties:!1}}(t,e);if(!s)return;try{n=Ks.compile(s)}catch{return}i.set(r,n)}return n})(t,i);if(n&&!n(e))for(const t of n.errors??[]){const e=Js(t);e&&!(e in r)&&t.message&&(r[e]=t.message)}for(const[n,s]of Object.entries(((t,e,i)=>{const r={},n=e??{};for(const e of Ns(t)){const t=e.configs?.key;if(t)for(const s of e.validations??[]){if("custom"!==s.validator||!s.customValidator)continue;const e=Gs(`const value = dataMap?.[${JSON.stringify(t)}];\n${s.customValidator}`,n);if(!0!==e&&null!=e&&!(t in r))if("string"==typeof e)r[t]=e;else if(e instanceof Error)r[t]=e.message;else{const e=ks(s.message,i);r[t]="string"==typeof e?e:As("custom",i)}}}return r})(t,e,i)))n in r||(r[n]=s);const s="object"==typeof e&&null!==e?e:void 0;for(const e of((t,e)=>{const i=new Set,r=(t,n)=>{const s=n||!!t.rules?.length&&!0===Hs(t.rules,e).hidden,o=t.configs?.key;if(s&&o&&i.add(o),"collection"!==t.type)for(const e of t.children??[])r(e,s)};return r(t,!1),i})(t,s))delete r[e];return{valid:0===Object.keys(r).length,errors:r}};function Xs(t){return t.split(".").slice(1).map((t=>`/children/${t}`)).join("")}function Qs(t,e){if(t.configs?.uid===e)return"";for(const[i,r]of(t.children??[]).entries()){const t=Qs(r,e);if(void 0!==t)return`/children/${i}${t}`}}function Ys(t,e){let i=t;for(const t of e.split(".").slice(1))i=i?.children?.[Number(t)];return i}var to=(js??xs).applyPatch,eo=(t,e,i)=>({spec:to(t,e,!0,!1).newDocument,patches:e,inverse:i}),io=(t,e)=>{const i=Ys(t,e);if(!i)throw new Error(`No brick at path "${e}"`);return i},ro=(t,e)=>{const i=Qs(t,e);if(void 0===i)throw new Error(`No brick with uid "${e}"`);let r=t;for(const t of i.split("/children/").slice(1))r=r.children[Number(t)];return{pointer:i,brick:r}},no=t=>JSON.parse(JSON.stringify(t));function so(t,e,i,r){const n=io(t,i),s=Xs(i),o=no(e);if(!n.children){const e=`${s}/children`;return eo(t,[{op:"add",path:e,value:[o]}],[{op:"remove",path:e}])}const a=`${s}/children/${Math.min(r??n.children.length,n.children.length)}`;return eo(t,[{op:"add",path:a,value:o}],[{op:"remove",path:a}])}function oo(t,e){if("0"===e)throw new Error("Cannot remove the root brick");const i=io(t,e),r=Xs(e);return eo(t,[{op:"remove",path:r}],[{op:"add",path:r,value:i}])}function ao(t,e,i){if("0"===e||"0"===i)throw new Error("Cannot move the root brick");const r=io(t,e),n=e.split(".").map(Number),s=i.split(".").map(Number),o=n.length-1,a=n[o],h=s.length>o&&n.slice(0,o).every(((t,e)=>t===s[e])),u=[...s];if(h){if(u[o]===a&&u.length>n.length)throw new Error(`Cannot move a brick into its own subtree ("${e}" → "${i}")`);u[o]>a&&(u[o]-=1)}const c=Xs(e),f=Xs(u.join("."));return eo(t,[{op:"remove",path:c},{op:"add",path:f,value:r}],[{op:"remove",path:f},{op:"add",path:c,value:r}])}var ho=t=>({...t,...t.configs?{configs:{...t.configs,uid:crypto.randomUUID()}}:{},...t.children?{children:t.children.map(ho)}:{}});function uo(t,e){if("0"===e)throw new Error("Cannot duplicate the root brick");const i=io(t,e),r=e.split("."),n=Number(r[r.length-1])+1,s=Xs([...r.slice(0,-1),String(n)].join(".")),o=ho(no(i));return eo(t,[{op:"add",path:s,value:o}],[{op:"remove",path:s}])}var co=(t,e,i,r,n)=>{const s=`${e}/${i}`;return void 0===n?eo(t,[{op:"add",path:s,value:r}],[{op:"remove",path:s}]):eo(t,[{op:"replace",path:s,value:r}],[{op:"replace",path:s,value:n}])};function fo(t,e,i){const{pointer:r,brick:n}=ro(t,e),s={...n.configs,...i};return co(t,r,"configs",s,n.configs)}function lo(t,e,i){const{pointer:r,brick:n}=ro(t,e),s={...n.styles,...i};return co(t,r,"styles",s,n.styles)}function po(t,e,i){const{pointer:r,brick:n}=ro(t,e);return co(t,r,"validations",i,n.validations)}function mo(t,e,i){const{pointer:r,brick:n}=ro(t,e);return co(t,r,"rules",i,n.rules)}class vo{past=[];future=[];record(t){this.past.push({patches:t.patches,inverse:t.inverse}),this.future=[]}get canUndo(){return this.past.length>0}get canRedo(){return this.future.length>0}undo(t){const e=this.past.pop();if(e)return this.future.push(e),to(t,e.inverse,!0,!1).newDocument}redo(t){const e=this.future.pop();if(e)return this.past.push(e),to(t,e.patches,!0,!1).newDocument}clear(){this.past=[],this.future=[]}}export{Ts as B,vo as S,Ss as a,Ns as b,so as c,Ys as d,oo as e,uo as f,Hs as g,lo as h,Cs as i,po as j,mo as k,Gs as l,ao as m,ks as n,Ps as r,Vs as s,fo as u,Zs as v}
@@ -0,0 +1 @@
1
+ import{t as r,p as i,H as t,c as a,h as s}from"./p-BB4Llg42.js";import{v as o}from"./p-CKMHMpID.js";import{a as d}from"./p-BOmBVgfJ.js";import{d as e}from"./p-DYchD23x.js";import{d as c}from"./p-NDbmiiYk.js";import{d as n}from"./p-BWdm2a6q.js";import{d as l}from"./p-YyGnQmX-.js";const f=i(class extends t{constructor(r){super(),!1!==r&&this.__registerHost(),this.gridValueChange=a(this,"gridValueChange"),this.disabled=!1,this.touched={},this.addRow=r=>{r.preventDefault(),this.gridValueChange.emit([...this.rows(),{}])}}rows(){return Array.isArray(this.value)?this.value:[]}rowSpec(){var r,i;return(null===(r=this.rowSpecCache)||void 0===r?void 0:r.source)!==this.spec&&(this.rowSpecCache={source:this.spec,rowSpec:{type:"panel",id:"grid-row",name:"Row",configs:{key:"row"},children:null!==(i=this.spec.children)&&void 0!==i?i:[]}}),this.rowSpecCache.rowSpec}rowErrors(r){const i=Object.fromEntries(Object.entries(r).filter((([,r])=>""!==r&&null!=r)));return o(this.rowSpec(),i,this.locale).errors}visibleRowErrors(r){var i,t;const a=null!==(i=this.rows()[r])&&void 0!==i?i:{},s=null!==(t=this.touched[r])&&void 0!==t?t:{},o={};for(const[r,i]of Object.entries(this.rowErrors(a)))s[r]&&(o[r]=i);return o}handleRowChange(r){var i,t;r.stopPropagation();const a=r.target.closest("[data-grid-row]"),s=Number(null!==(i=null==a?void 0:a.getAttribute("data-grid-row"))&&void 0!==i?i:-1);if(s<0)return;const o=Object.assign({},null!==(t=this.touched[s])&&void 0!==t?t:{});for(const i of Object.keys(r.detail))o[i]=!0;this.touched=Object.assign(Object.assign({},this.touched),{[s]:o});const d=this.rows().map(((i,t)=>t===s?Object.assign(Object.assign({},i),r.detail):i));this.gridValueChange.emit(d)}async validateRows(){var r,i;const t=this.rows(),a=null!==(i=null===(r=this.spec.configs)||void 0===r?void 0:r.key)&&void 0!==i?i:"grid",s={},o={};return t.forEach(((r,i)=>{var t,d;const e={};for(const r of null!==(t=this.spec.children)&&void 0!==t?t:[])(null===(d=r.configs)||void 0===d?void 0:d.key)&&(e[r.configs.key]=!0);s[i]=e;for(const[t,s]of Object.entries(this.rowErrors(r)))o[`${a}[${i}].${t}`]=s})),this.touched=s,{valid:0===Object.keys(o).length,errors:o}}removeRow(r){const i=this.rows().filter(((i,t)=>t!==r)),t={};for(const[i,a]of Object.entries(this.touched)){const s=Number(i);s<r?t[s]=a:s>r&&(t[s-1]=a)}this.touched=t,this.gridValueChange.emit(i.length?i:void 0)}render(){var r;const i=null!==(r=this.spec.children)&&void 0!==r?r:[],t=this.rows();return s("div",{key:"1c77d72cd1482d673ffdb5b7d67ca200e55919d7",class:"fk-grid"},0===t.length?s("p",{class:"fk-grid__empty"},d("grid.empty")):null,t.map(((r,t)=>s("div",{class:"fk-grid__row","data-grid-row":t,key:t},s("div",{class:"fk-grid__cells"},i.map(((i,a)=>s("fk-brick-render",{brickSpec:i,data:r,dataMap:r,errors:this.visibleRowErrors(t),locale:this.locale,path:`grid.${t}.${a}`,utils:this.utils})))),s("button",{type:"button",class:"fk-grid__remove",title:d("grid.removeRow"),disabled:this.disabled,onClick:r=>{r.preventDefault(),this.removeRow(t)}},"✕")))),s("button",{key:"9bf04c364b3262c436ffb580daf802d15f29de57",type:"button",class:"fk-grid__add",disabled:this.disabled,onClick:this.addRow},d("grid.addRow")))}static get style(){return".sc-fk-data-grid-h{display:block}.fk-grid.sc-fk-data-grid{display:flex;flex-direction:column;gap:var(--fk-spacing)}.fk-grid__empty.sc-fk-data-grid{margin:0;padding:var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);font-size:0.85rem;color:var(--fk-color-muted);text-align:center}.fk-grid__row.sc-fk-data-grid{display:flex;align-items:flex-start;gap:var(--fk-spacing);padding:var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:color-mix(in srgb, var(--fk-color-surface) 60%, transparent)}.fk-grid__cells.sc-fk-data-grid{display:flex;flex:1;flex-wrap:wrap;gap:var(--fk-spacing);min-width:0}.fk-grid__cells.sc-fk-data-grid>*.sc-fk-data-grid{flex:1;min-width:160px}.fk-grid__remove.sc-fk-data-grid{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;border-radius:calc(var(--fk-radius) / 2)}.fk-grid__remove.sc-fk-data-grid:hover:not(:disabled){color:var(--fk-color-danger);background:color-mix(in srgb, var(--fk-color-danger) 10%, transparent)}.fk-grid__add.sc-fk-data-grid{align-self:flex-start;font:inherit;font-size:0.8rem;font-weight:600;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-grid__add.sc-fk-data-grid:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}"}},[2,"fk-data-grid",{spec:[16],value:[16],disabled:[4],locale:[1],utils:[16],touched:[32],validateRows:[64]},[[0,"brickDataChange","handleRowChange"]]]);function k(){"undefined"!=typeof customElements&&["fk-data-grid","fk-brick-actions","fk-brick-not-found","fk-brick-render","fk-drop-area"].forEach((i=>{switch(i){case"fk-data-grid":customElements.get(r(i))||customElements.define(r(i),f);break;case"fk-brick-actions":customElements.get(r(i))||e();break;case"fk-brick-not-found":customElements.get(r(i))||c();break;case"fk-brick-render":customElements.get(r(i))||n();break;case"fk-drop-area":customElements.get(r(i))||l()}}))}k();export{f as F,k as d}
@@ -0,0 +1 @@
1
+ import{t as i,p as e,H as s,c as t,h as r}from"./p-BB4Llg42.js";import{s as o}from"./p-CKMHMpID.js";import{a as l,f as a}from"./p-BOmBVgfJ.js";const f=e(class extends s{constructor(i){super(),!1!==i&&this.__registerHost(),this.fileValueChange=t(this,"fileValueChange"),this.disabled=!1,this.multiple=!1,this.uploading=!1,this.handleFile=async i=>{var e;const s=i.target,t=Array.from(null!==(e=s.files)&&void 0!==e?e:[]);if(t.length){this.uploading=!0,this.uploadError=void 0;try{const i=[];for(const e of this.multiple?t:t.slice(0,1))i.push(await o.fileUploadService.upload(e,{url:this.uploadUrl}));this.emitFiles(this.multiple?[...this.files,...i]:i)}catch(i){this.uploadError=i instanceof Error?i.message:String(i)}finally{this.uploading=!1,s.value=""}}},this.handleRemove=async i=>{var e,s;this.removingUrl=i.url,this.uploadError=void 0;try{await(null===(s=(e=o.fileUploadService).remove)||void 0===s?void 0:s.call(e,i,{url:this.uploadUrl}))}catch(i){this.uploadError=i instanceof Error?i.message:String(i)}finally{this.removingUrl=void 0,this.emitFiles(this.files.filter((e=>e!==i)))}}}get files(){return Array.isArray(this.value)?this.value:this.value?[this.value]:[]}emitFiles(i){this.fileValueChange.emit(this.multiple?i.length?i:void 0:i[0])}formatSize(i){return i<1024?`${i} B`:i<1048576?`${(i/1024).toFixed(1)} KB`:`${(i/1048576).toFixed(1)} MB`}renderFile(i){const e=void 0!==this.removingUrl&&this.removingUrl===i.url;return r("div",{class:"fk-file__selected",key:`${i.url}:${i.name}`},r("span",{class:"fk-file__icon","aria-hidden":"true"},r("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},r("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),r("polyline",{points:"14 2 14 8 20 8"}))),r("span",{class:"fk-file__meta"},r("span",{class:"fk-file__name",title:i.name},i.name),r("span",{class:"fk-file__size"},this.formatSize(i.size))),r("button",{type:"button",class:"fk-file__remove",title:l("file.remove"),disabled:this.disabled||e,onClick:e=>{e.preventDefault(),this.handleRemove(i)}},e?"…":"✕"))}render(){const i=this.files,e=this.multiple||0===i.length;return r("div",{key:"883cb0627b948d807f59ed5c62e44b0db421c3c6",class:"fk-file"},i.map((i=>this.renderFile(i))),e?r("button",{type:"button",class:"fk-file__choose",disabled:this.disabled||this.uploading,onClick:i=>{var e;i.preventDefault(),null===(e=this.inputEl)||void 0===e||e.click()}},this.uploading?l("file.uploading"):this.multiple&&i.length?a("file.addAnother","+ Add a file"):l("file.choose")):null,r("input",{key:"a35947614d82f94eba8453b1f43382d2754cb36f",class:"fk-file__native",type:"file",accept:this.accept,multiple:this.multiple,disabled:this.disabled,ref:i=>this.inputEl=i,onChange:this.handleFile}),this.uploadError?r("span",{class:"fk-field__error"},this.uploadError):null)}static get style(){return".sc-fk-file-input-h{display:block}.fk-file.sc-fk-file-input{display:flex;flex-direction:column;gap:calc(var(--fk-spacing) / 2);align-items:flex-start}.fk-file__native.sc-fk-file-input{display:none}.fk-file__choose.sc-fk-file-input{font:inherit;font-size:0.85rem;padding:calc(var(--fk-spacing) / 1.5) var(--fk-spacing);border:1px dashed var(--fk-color-border);border-radius:var(--fk-radius);background:transparent;color:var(--fk-color-muted);cursor:pointer}.fk-file__choose.sc-fk-file-input:hover:not(:disabled){border-color:var(--fk-color-primary);color:var(--fk-color-primary)}.fk-file__choose.sc-fk-file-input:disabled{opacity:0.55;cursor:not-allowed}.fk-file__selected.sc-fk-file-input{display:flex;align-items:center;gap:var(--fk-spacing);width:100%;box-sizing:border-box;padding:calc(var(--fk-spacing) * 0.75) var(--fk-spacing);border:1px solid var(--fk-color-border);border-radius:var(--fk-radius);background:var(--fk-color-surface)}.fk-file__icon.sc-fk-file-input{display:inline-flex;flex-shrink:0;color:var(--fk-color-primary)}.fk-file__meta.sc-fk-file-input{display:flex;flex-direction:column;gap:2px;flex:1;min-width:0}.fk-file__name.sc-fk-file-input{font-size:0.85rem;font-weight:600;color:var(--fk-color-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fk-file__size.sc-fk-file-input{font-size:0.72rem;color:var(--fk-color-muted);white-space:nowrap}.fk-file__remove.sc-fk-file-input{border:none;background:transparent;color:var(--fk-color-muted);font-size:0.8rem;cursor:pointer;padding:4px 6px;border-radius:calc(var(--fk-radius) / 2);flex-shrink:0}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){background:color-mix(in srgb, var(--fk-color-danger) 12%, transparent)}.fk-file__remove.sc-fk-file-input:hover:not(:disabled){color:var(--fk-color-danger)}"}},[2,"fk-file-input",{value:[16],disabled:[4],accept:[1],uploadUrl:[1,"upload-url"],multiple:[4],uploading:[32],removingUrl:[32],uploadError:[32]}]);function n(){"undefined"!=typeof customElements&&["fk-file-input"].forEach((e=>{"fk-file-input"===e&&(customElements.get(i(e))||customElements.define(i(e),f))}))}n();export{f as F,n as d}
@@ -1 +1 @@
1
- import{t as e,p as t,H as f,h as r,a as s}from"./p-BrOXMyOG.js";import{a as c}from"./p-D7bf2ztq.js";const a=t(class extends f{constructor(e){super(),!1!==e&&this.__registerHost()}render(){return r(s,{key:"1b0ab4cd1d988a4800deeb6e3cfd8f5074520f6b"},r("div",{key:"65b551e1cab6162514ad941b21e318c5f19b824a",class:"fk-empty"},r("p",{key:"c4eba1c6fecb4f2669f1c4dfb09cd816790a5ebf",class:"fk-empty__title"},c("empty.title")),r("p",{key:"751bb3a2fc07982c90a214bd1e71592ec03d988d",class:"fk-empty__hint"},c("empty.hint"))))}static get style(){return".fk-empty.sc-fk-empty-form{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--fk-spacing) / 2);min-height:160px;border:2px dashed var(--fk-color-border);border-radius:var(--fk-radius);color:var(--fk-color-muted);text-align:center}.fk-empty__title.sc-fk-empty-form{margin:0;font-weight:600}.fk-empty__hint.sc-fk-empty-form{margin:0;font-size:0.875rem}"}},[2,"fk-empty-form"]);function m(){"undefined"!=typeof customElements&&["fk-empty-form"].forEach((t=>{"fk-empty-form"===t&&(customElements.get(e(t))||customElements.define(e(t),a))}))}m();export{a as F,m as d}
1
+ import{t as e,p as t,H as f,h as r,a as s}from"./p-BB4Llg42.js";import{a as c}from"./p-BOmBVgfJ.js";const m=t(class extends f{constructor(e){super(),!1!==e&&this.__registerHost()}render(){return r(s,{key:"1b0ab4cd1d988a4800deeb6e3cfd8f5074520f6b"},r("div",{key:"65b551e1cab6162514ad941b21e318c5f19b824a",class:"fk-empty"},r("p",{key:"c4eba1c6fecb4f2669f1c4dfb09cd816790a5ebf",class:"fk-empty__title"},c("empty.title")),r("p",{key:"751bb3a2fc07982c90a214bd1e71592ec03d988d",class:"fk-empty__hint"},c("empty.hint"))))}static get style(){return".fk-empty.sc-fk-empty-form{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:calc(var(--fk-spacing) / 2);min-height:160px;border:2px dashed var(--fk-color-border);border-radius:var(--fk-radius);color:var(--fk-color-muted);text-align:center}.fk-empty__title.sc-fk-empty-form{margin:0;font-weight:600}.fk-empty__hint.sc-fk-empty-form{margin:0;font-size:0.875rem}"}},[2,"fk-empty-form"]);function a(){"undefined"!=typeof customElements&&["fk-empty-form"].forEach((t=>{"fk-empty-form"===t&&(customElements.get(e(t))||customElements.define(e(t),m))}))}a();export{m as F,a as d}