@enablerr-ui/detail 0.3.45 → 0.3.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +3 -7
- package/package.json +1 -1
package/dist/index.min.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
System.register(["@enablerr-ui/form","@enablerr-ui/layout","@enablerr-ui/auth","@enablerr-ui/task"],function(exports){"use strict";var Request,Storage,task_notification,currentRoles,TextArea,toasts,settings,Page,getAttractions,PopOver,user,taskClipboard;return{setters:[function(t){Request=t.Request,Storage=t.Storage,task_notification=t.task_notification,currentRoles=t.currentRoles,TextArea=t.TextArea,toasts=t.toasts,settings=t.settings,Page=t.Page},function(t){getAttractions=t.getAttractions,PopOver=t.PopOver},function(t){user=t.user},function(t){taskClipboard=t.taskClipboard}],execute:function(){function _mergeNamespaces(t,e){return e.forEach(function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach(function(n){if("default"!==n&&!(n in t)){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})}),Object.freeze(t)}const version=exports("version","0.3.45"),checkDate=exports("checkDate",(t,e)=>"string"!=typeof t||t.length<20||!(e=t.split(" · "))?t:e.map(t=>2===t.split("T").length&&3===t.split("T")[0].split("-").length?new Date(t).toLocaleDateString():t).filter(t=>!!t).join(" · ")),checkDateTime=t=>{try{return new Date(t).toLocaleString()}catch{return t}},checkDateRange=(t,e)=>{let n,r;try{n=e[t+"_from"],n=new Date(n||"").toLocaleDateString(),"Invalid Date"===n&&(n=" ")}catch{n=" "}try{r=e[t+"_to"],r=new Date(r||"").toLocaleDateString(),"Invalid Date"===r&&(r="")}catch{r=""}return[n,r].filter(t=>""!==t).join(" - ").trim()},checkBoolean=t=>t?"(ja)":"(nein)",getRecordDescription=(t,e)=>{if(!t.display&&!t.items)return"";const n={...e};return(t.display?.reduce((e,r)=>{let[o,i]=r.split(".");if(t.list?.find(({name:t})=>t===o)&&i&&void 0!==n[o]){const t=`${o}_${i}`;n[t]=n[o][i],o=t}return e.find(t=>t===o)||e.push(o),e},[]).map(t=>"boolean"==typeof n[t]?checkBoolean(n[t]):checkDate(n["_"+t]||n[t]))||t.items.map(t=>"object"===t.type?e["_"+t.name]:"list"===t.type?"":("boolean"==typeof e[t.name]&&checkBoolean(e[t.name]),e[t.name]))).map(t=>t?.toString().split(" · ").filter(t=>!!t&&!checkObjectId(t)).join(" · ")).filter(t=>!!t).join(" • ")},checkObjectId=t=>/^[0-9a-f]{24}/.test(t),getData=(t,e)=>{try{return e.split(".").reduce((t,e)=>t[e],t)??""}catch{return""}},addDays=function(t,e){var n=new Date(t);return n.setDate(n.getDate()+Number(e)),n};function noop(){}function is_promise(t){return t&&"object"==typeof t&&"function"==typeof t.then}function run(t){return t()}function blank_object(){return Object.create(null)}function run_all(t){t.forEach(run)}function is_function(t){return"function"==typeof t}function safe_not_equal(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function is_empty(t){return 0===Object.keys(t).length}function subscribe(t,...e){if(null==t)return noop;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function component_subscribe(t,e,n){t.$$.on_destroy.push(subscribe(e,n))}function null_to_empty(t){return null==t?"":t}function set_store_value(t,e,n=e){return t.set(n),e}function append(t,e){t.appendChild(e)}function insert(t,e,n){t.insertBefore(e,n||null)}function detach(t){t.parentNode.removeChild(t)}function destroy_each(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function element(t){return document.createElement(t)}function svg_element(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function text(t){return document.createTextNode(t)}function space(){return text(" ")}function empty(){return text("")}function listen(t,e,n,r){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n,r)}function prevent_default(t){return function(e){return e.preventDefault(),t.call(this,e)}}function stop_propagation(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function attr(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function children(t){return Array.from(t.childNodes)}function set_data(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function set_input_value(t,e){t.value=null==e?"":e}function set_style(t,e,n,r){t.style.setProperty(e,n,r?"important":"")}function toggle_class(t,e,n){t.classList[n?"add":"remove"](e)}function custom_event(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!1,e),n}let current_component;function set_current_component(t){current_component=t}function get_current_component(){if(!current_component)throw new Error("Function called outside component initialization");return current_component}function onMount(t){get_current_component().$$.on_mount.push(t)}function onDestroy(t){get_current_component().$$.on_destroy.push(t)}function createEventDispatcher(){const t=get_current_component();return(e,n)=>{const r=t.$$.callbacks[e];if(r){const o=custom_event(e,n);r.slice().forEach(e=>{e.call(t,o)})}}}function bubble(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach(t=>t(e))}const dirty_components=[],binding_callbacks=[],render_callbacks=[],flush_callbacks=[],resolved_promise=Promise.resolve();let update_scheduled=!1;function schedule_update(){update_scheduled||(update_scheduled=!0,resolved_promise.then(flush))}function tick(){return schedule_update(),resolved_promise}function add_render_callback(t){render_callbacks.push(t)}function add_flush_callback(t){flush_callbacks.push(t)}let flushing=!1;const seen_callbacks=new Set;function flush(){if(!flushing){flushing=!0;do{for(let t=0;t<dirty_components.length;t+=1){const e=dirty_components[t];set_current_component(e),update(e.$$)}for(set_current_component(null),dirty_components.length=0;binding_callbacks.length;)binding_callbacks.pop()();for(let t=0;t<render_callbacks.length;t+=1){const e=render_callbacks[t];seen_callbacks.has(e)||(seen_callbacks.add(e),e())}render_callbacks.length=0}while(dirty_components.length);for(;flush_callbacks.length;)flush_callbacks.pop()();update_scheduled=!1,flushing=!1,seen_callbacks.clear()}}function update(t){if(null!==t.fragment){t.update(),run_all(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(add_render_callback)}}const outroing=new Set;let outros;function group_outros(){outros={r:0,c:[],p:outros}}function check_outros(){outros.r||run_all(outros.c),outros=outros.p}function transition_in(t,e){t&&t.i&&(outroing.delete(t),t.i(e))}function transition_out(t,e,n,r){if(t&&t.o){if(outroing.has(t))return;outroing.add(t),outros&&outros.c.push(()=>{outroing.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}function handle_promise(t,e){const n=e.token={};function r(t,r,o,i){if(e.token!==n)return;e.resolved=i;let a=e.ctx;void 0!==o&&(a=a.slice(),a[o]=i);const s=t&&(e.current=t)(a);let c=!1;e.block&&(e.blocks?e.blocks.forEach((t,n)=>{n!==r&&t&&(group_outros(),transition_out(t,1,1,()=>{e.blocks[n]===t&&(e.blocks[n]=null)}),check_outros())}):e.block.d(1),s.c(),transition_in(s,1),s.m(e.mount(),e.anchor),c=!0),e.block=s,e.blocks&&(e.blocks[r]=s),c&&flush()}if(is_promise(t)){const n=get_current_component();if(t.then(t=>{set_current_component(n),r(e.then,1,e.value,t),set_current_component(null)},t=>{if(set_current_component(n),r(e.catch,2,e.error,t),set_current_component(null),!e.hasCatch)throw t}),e.current!==e.pending)return r(e.pending,0),!0}else{if(e.current!==e.then)return r(e.then,1,e.value,t),!0;e.resolved=t}}function update_await_block_branch(t,e,n){const r=e.slice(),{resolved:o}=t;t.current===t.then&&(r[t.value]=o),t.current===t.catch&&(r[t.error]=o),t.block.p(r,n)}const globals="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function outro_and_destroy_block(t,e){transition_out(t,1,1,()=>{e.delete(t.key)})}function update_keyed_each(t,e,n,r,o,i,a,s,c,l,d,u){let h=t.length,m=i.length,f=h;const p={};for(;f--;)p[t[f].key]=f;const _=[],g=new Map,w=new Map;for(f=m;f--;){const t=u(o,i,f),s=n(t);let c=a.get(s);c?r&&c.p(t,e):(c=l(s,t),c.c()),g.set(s,_[f]=c),s in p&&w.set(s,Math.abs(f-p[s]))}const $=new Set,y=new Set;function b(t){transition_in(t,1),t.m(s,d),a.set(t.key,t),d=t.first,m--}for(;h&&m;){const e=_[m-1],n=t[h-1],r=e.key,o=n.key;e===n?(d=e.first,h--,m--):g.has(o)?!a.has(r)||$.has(r)?b(e):y.has(o)?h--:w.get(r)>w.get(o)?(y.add(r),b(e)):($.add(o),h--):(c(n,a),h--)}for(;h--;){const e=t[h];g.has(e.key)||c(e,a)}for(;m;)b(_[m-1]);return _}function bind(t,e,n){const r=t.$$.props[e];void 0!==r&&(t.$$.bound[r]=n,n(t.$$.ctx[r]))}function create_component(t){t&&t.c()}function mount_component(t,e,n,r){const{fragment:o,on_mount:i,on_destroy:a,after_update:s}=t.$$;o&&o.m(e,n),r||add_render_callback(()=>{const e=i.map(run).filter(is_function);a?a.push(...e):run_all(e),t.$$.on_mount=[]}),s.forEach(add_render_callback)}function destroy_component(t,e){const n=t.$$;null!==n.fragment&&(run_all(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function make_dirty(t,e){-1===t.$$.dirty[0]&&(dirty_components.push(t),schedule_update(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function init(t,e,n,r,o,i,a=[-1]){const s=current_component;set_current_component(t);const c=t.$$={fragment:null,ctx:null,props:i,update:noop,not_equal:o,bound:blank_object(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(s?s.$$.context:e.context||[]),callbacks:blank_object(),dirty:a,skip_bound:!1};let l=!1;if(c.ctx=n?n(t,e.props||{},(e,n,...r)=>{const i=r.length?r[0]:n;return c.ctx&&o(c.ctx[e],c.ctx[e]=i)&&(!c.skip_bound&&c.bound[e]&&c.bound[e](i),l&&make_dirty(t,e)),n}):[],c.update(),l=!0,run_all(c.before_update),c.fragment=!!r&&r(c.ctx),e.target){if(e.hydrate){const t=children(e.target);c.fragment&&c.fragment.l(t),t.forEach(detach)}else c.fragment&&c.fragment.c();e.intro&&transition_in(t.$$.fragment),mount_component(t,e.target,e.anchor,e.customElement),flush()}set_current_component(s)}class SvelteComponent{$destroy(){destroy_component(this,1),this.$destroy=noop}$on(t,e){const n=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return n.push(e),()=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){this.$$set&&!is_empty(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function create_fragment$T(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("polygon"),attr(n,"d","M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"),attr(r,"points","12 15 17 21 7 21 12 15"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-airplay "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-airplay "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$T(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class AirplayIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$T,create_fragment$T,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$S(t){let e,n,r,o,i;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("line"),o=svg_element("line"),attr(n,"d","M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"),attr(r,"x1","12"),attr(r,"y1","9"),attr(r,"x2","12"),attr(r,"y2","13"),attr(o,"x1","12"),attr(o,"y1","17"),attr(o,"x2","12.01"),attr(o,"y2","17"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",i="feather feather-alert-triangle "+t[2])},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&i!==(i="feather feather-alert-triangle "+t[2])&&attr(e,"class",i)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$S(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class AlertTriangleIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$S,create_fragment$S,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$R(t){let e,n,r,o,i;return{c(){e=svg_element("svg"),n=svg_element("circle"),r=svg_element("polyline"),o=svg_element("line"),attr(n,"cx","12"),attr(n,"cy","12"),attr(n,"r","10"),attr(r,"points","8 12 12 16 16 12"),attr(o,"x1","12"),attr(o,"y1","8"),attr(o,"x2","12"),attr(o,"y2","16"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",i="feather feather-arrow-down-circle "+t[2])},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&i!==(i="feather feather-arrow-down-circle "+t[2])&&attr(e,"class",i)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$R(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class ArrowDownCircleIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$R,create_fragment$R,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$Q(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("path"),attr(n,"d","M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"),attr(r,"d","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-book-open "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-book-open "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$Q(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class BookOpenIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$Q,create_fragment$Q,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$P(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("circle"),attr(n,"d","M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"),attr(r,"cx","12"),attr(r,"cy","13"),attr(r,"r","4"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-camera "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-camera "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$P(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class CameraIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$P,create_fragment$P,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$O(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("polyline"),attr(n,"d","M22 11.08V12a10 10 0 1 1-5.93-9.14"),attr(r,"points","22 4 12 14.01 9 11.01"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-check-circle "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-check-circle "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$O(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class CheckCircleIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$O,create_fragment$O,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$N(t){let e,n,r;return{c(){e=svg_element("svg"),n=svg_element("path"),attr(n,"d","M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",r="feather feather-command "+t[2])},m(t,r){insert(t,e,r),append(e,n)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&r!==(r="feather feather-command "+t[2])&&attr(e,"class",r)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$N(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class CommandIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$N,create_fragment$N,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$M(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("polyline"),r=svg_element("path"),attr(n,"points","9 10 4 15 9 20"),attr(r,"d","M20 4v7a4 4 0 0 1-4 4H4"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-corner-down-left "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-corner-down-left "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$M(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class CornerDownLeftIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$M,create_fragment$M,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$L(t){let e,n,r,o,i;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("line"),o=svg_element("line"),attr(n,"d","M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"),attr(r,"x1","18"),attr(r,"y1","9"),attr(r,"x2","12"),attr(r,"y2","15"),attr(o,"x1","12"),attr(o,"y1","9"),attr(o,"x2","18"),attr(o,"y2","15"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",i="feather feather-delete "+t[2])},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&i!==(i="feather feather-delete "+t[2])&&attr(e,"class",i)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$L(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class DeleteIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$L,create_fragment$L,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$K(t){let e,n,r,o,i;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("polyline"),o=svg_element("line"),attr(n,"d","M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"),attr(r,"points","15 3 21 3 21 9"),attr(o,"x1","10"),attr(o,"y1","14"),attr(o,"x2","21"),attr(o,"y2","3"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",i="feather feather-external-link "+t[2])},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&i!==(i="feather feather-external-link "+t[2])&&attr(e,"class",i)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$K(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class ExternalLinkIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$K,create_fragment$K,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$J(t){let e,n,r,o,i,a;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("polyline"),o=svg_element("line"),i=svg_element("line"),attr(n,"d","M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"),attr(r,"points","14 2 14 8 20 8"),attr(o,"x1","12"),attr(o,"y1","18"),attr(o,"x2","12"),attr(o,"y2","12"),attr(i,"x1","9"),attr(i,"y1","15"),attr(i,"x2","15"),attr(i,"y2","15"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",a="feather feather-file-plus "+t[2])},m(t,a){insert(t,e,a),append(e,n),append(e,r),append(e,o),append(e,i)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&a!==(a="feather feather-file-plus "+t[2])&&attr(e,"class",a)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$J(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class FilePlusIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$J,create_fragment$J,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$I(t){let e,n,r,o,i;return{c(){e=svg_element("svg"),n=svg_element("circle"),r=svg_element("line"),o=svg_element("path"),attr(n,"cx","12"),attr(n,"cy","12"),attr(n,"r","10"),attr(r,"x1","2"),attr(r,"y1","12"),attr(r,"x2","22"),attr(r,"y2","12"),attr(o,"d","M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",i="feather feather-globe "+t[2])},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&i!==(i="feather feather-globe "+t[2])&&attr(e,"class",i)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$I(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class GlobeIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$I,create_fragment$I,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$H(t){let e,n,r,o,i,a,s,c;return{c(){e=svg_element("svg"),n=svg_element("line"),r=svg_element("line"),o=svg_element("line"),i=svg_element("line"),a=svg_element("line"),s=svg_element("line"),attr(n,"x1","8"),attr(n,"y1","6"),attr(n,"x2","21"),attr(n,"y2","6"),attr(r,"x1","8"),attr(r,"y1","12"),attr(r,"x2","21"),attr(r,"y2","12"),attr(o,"x1","8"),attr(o,"y1","18"),attr(o,"x2","21"),attr(o,"y2","18"),attr(i,"x1","3"),attr(i,"y1","6"),attr(i,"x2","3.01"),attr(i,"y2","6"),attr(a,"x1","3"),attr(a,"y1","12"),attr(a,"x2","3.01"),attr(a,"y2","12"),attr(s,"x1","3"),attr(s,"y1","18"),attr(s,"x2","3.01"),attr(s,"y2","18"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",c="feather feather-list "+t[2])},m(t,c){insert(t,e,c),append(e,n),append(e,r),append(e,o),append(e,i),append(e,a),append(e,s)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&c!==(c="feather feather-list "+t[2])&&attr(e,"class",c)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$H(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class ListIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$H,create_fragment$H,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$G(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("polyline"),attr(n,"d","M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"),attr(r,"points","22,6 12,13 2,6"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-mail "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-mail "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$G(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class MailIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$G,create_fragment$G,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$F(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("path"),r=svg_element("circle"),attr(n,"d","M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"),attr(r,"cx","12"),attr(r,"cy","10"),attr(r,"r","3"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-map-pin "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-map-pin "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$F(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class MapPinIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$F,create_fragment$F,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$E(t){let e,n,r,o,i;return{c(){e=svg_element("svg"),n=svg_element("polyline"),r=svg_element("line"),o=svg_element("path"),attr(n,"points","23 7 23 1 17 1"),attr(r,"x1","16"),attr(r,"y1","8"),attr(r,"x2","23"),attr(r,"y2","1"),attr(o,"d","M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",i="feather feather-phone-outgoing "+t[2])},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&i!==(i="feather feather-phone-outgoing "+t[2])&&attr(e,"class",i)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$E(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class PhoneOutgoingIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$E,create_fragment$E,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$D(t){let e,n,r,o,i;return{c(){e=svg_element("svg"),n=svg_element("polyline"),r=svg_element("path"),o=svg_element("rect"),attr(n,"points","6 9 6 2 18 2 18 9"),attr(r,"d","M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"),attr(o,"x","6"),attr(o,"y","14"),attr(o,"width","12"),attr(o,"height","8"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",i="feather feather-printer "+t[2])},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&i!==(i="feather feather-printer "+t[2])&&attr(e,"class",i)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$D(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class PrinterIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$D,create_fragment$D,safe_not_equal,{size:0,strokeWidth:1,class:2})}}function create_fragment$C(t){let e,n,r,o;return{c(){e=svg_element("svg"),n=svg_element("circle"),r=svg_element("line"),attr(n,"cx","11"),attr(n,"cy","11"),attr(n,"r","8"),attr(r,"x1","21"),attr(r,"y1","21"),attr(r,"x2","16.65"),attr(r,"y2","16.65"),attr(e,"xmlns","http://www.w3.org/2000/svg"),attr(e,"width",t[0]),attr(e,"height",t[0]),attr(e,"fill","none"),attr(e,"viewBox","0 0 24 24"),attr(e,"stroke","currentColor"),attr(e,"stroke-width",t[1]),attr(e,"stroke-linecap","round"),attr(e,"stroke-linejoin","round"),attr(e,"class",o="feather feather-search "+t[2])},m(t,o){insert(t,e,o),append(e,n),append(e,r)},p(t,[n]){1&n&&attr(e,"width",t[0]),1&n&&attr(e,"height",t[0]),2&n&&attr(e,"stroke-width",t[1]),4&n&&o!==(o="feather feather-search "+t[2])&&attr(e,"class",o)},i:noop,o:noop,d(t){t&&detach(e)}}}function instance$C(t,e,n){let{size:r="100%"}=e,{strokeWidth:o=2}=e,{class:i=""}=e;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),t.$$set=t=>{"size"in t&&n(0,r=t.size),"strokeWidth"in t&&n(1,o=t.strokeWidth),"class"in t&&n(2,i=t.class)},[r,o,i]}class SearchIcon extends SvelteComponent{constructor(t){super(),init(this,t,instance$C,create_fragment$C,safe_not_equal,{size:0,strokeWidth:1,class:2})}}const{document:document_1$g}=globals;function add_css$x(){var t=element("style");t.id="svelte-47aais-style",t.textContent=".feather.svelte-47aais.svelte-47aais{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-47aais.svelte-47aais{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-47aais .editRow.svelte-47aais{width:1em}.eList.svelte-47aais table.svelte-47aais{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-47aais table thead.svelte-47aais{position:sticky;top:0;background:#326173;color:white}.eList.svelte-47aais table thead tr.svelte-47aais{height:2.3em}.eList.svelte-47aais table tbody tr.svelte-47aais{height:2.75em !important}th.svelte-47aais.svelte-47aais,td.svelte-47aais.svelte-47aais{padding-left:0.4em;padding-right:0.4em}td.number.svelte-47aais.svelte-47aais{text-align:end}tr.pointer.svelte-47aais.svelte-47aais:hover{background-color:#DAE1E5}tr.active.svelte-47aais.svelte-47aais{color:#326173;background-color:#fcebd5}tr.blocked.svelte-47aais.svelte-47aais{color:red !important}tr.undeliverable.svelte-47aais.svelte-47aais{color:orange}",append(document_1$g.head,t)}function get_then_context$4(t){t[49]=t[50].items}function get_each_context$e(t,e,n){const r=t.slice();return r[51]=e[n],r[53]=n,r}function get_each_context_1$9(t,e,n){const r=t.slice();return r[54]=e[n],r}function get_each_context_2$6(t,e,n){const r=t.slice();return r[54]=e[n],r}function create_catch_block$d(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$d(t){let e,n,r,o,i,a;get_then_context$4(t);let s=t[5]?.length&&create_if_block_5$7(t),c=t[49]?.length&&create_if_block_3$8(t),l=t[5]?.length&&create_if_block$x(t);return{c(){s&&s.c(),e=space(),n=element("div"),r=element("table"),c&&c.c(),o=space(),i=element("tbody"),l&&l.c(),attr(r,"striped",""),attr(r,"class","svelte-47aais"),attr(n,"class","eList svelte-47aais")},m(t,d){s&&s.m(t,d),insert(t,e,d),insert(t,n,d),append(n,r),c&&c.m(r,null),append(r,o),append(r,i),l&&l.m(i,null),a=!0},p(t,n){get_then_context$4(t),t[5]?.length?s?(s.p(t,n),32&n[0]&&transition_in(s,1)):(s=create_if_block_5$7(t),s.c(),transition_in(s,1),s.m(e.parentNode,e)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros()),t[49]?.length?c?c.p(t,n):(c=create_if_block_3$8(t),c.c(),c.m(r,o)):c&&(c.d(1),c=null),t[5]?.length?l?(l.p(t,n),32&n[0]&&transition_in(l,1)):(l=create_if_block$x(t),l.c(),transition_in(l,1),l.m(i,null)):l&&(group_outros(),transition_out(l,1,1,()=>{l=null}),check_outros())},i(t){a||(transition_in(s),transition_in(l),a=!0)},o(t){transition_out(s),transition_out(l),a=!1},d(t){s&&s.d(t),t&&detach(e),t&&detach(n),c&&c.d(),l&&l.d()}}}function create_if_block_5$7(t){let e,n,r,o,i,a,s,c,l,d,u,h=t[6]&&create_if_block_6$5(t);function m(e){t[33](e)}let f={id:t[10]};return void 0!==t[3]&&(f.value=t[3]),o=new t[8]({props:f}),binding_callbacks.push(()=>bind(o,"value",m)),o.$on("input",t[14]),c=new DeleteIcon({props:{size:"18"}}),{c(){h&&h.c(),e=space(),n=element("div"),r=text("Suchen: "),create_component(o.$$.fragment),a=space(),s=element("span"),create_component(c.$$.fragment),attr(s,"class","feather pointer svelte-47aais"),set_style(n,"margin-bottom","1em"),set_style(n,"position","relative")},m(i,m){h&&h.m(i,m),insert(i,e,m),insert(i,n,m),append(n,r),mount_component(o,n,null),append(n,a),append(n,s),mount_component(c,s,null),l=!0,d||(u=listen(s,"click",t[16]),d=!0)},p(t,n){t[6]?h?64&n[0]&&transition_in(h,1):(h=create_if_block_6$5(t),h.c(),transition_in(h,1),h.m(e.parentNode,e)):h&&(group_outros(),transition_out(h,1,1,()=>{h=null}),check_outros());const r={};!i&&8&n[0]&&(i=!0,r.value=t[3],add_flush_callback(()=>i=!1)),o.$set(r)},i(t){l||(transition_in(h),transition_in(o.$$.fragment,t),transition_in(c.$$.fragment,t),l=!0)},o(t){transition_out(h),transition_out(o.$$.fragment,t),transition_out(c.$$.fragment,t),l=!1},d(t){h&&h.d(t),t&&detach(e),t&&detach(n),destroy_component(o),destroy_component(c),d=!1,u()}}}function create_if_block_6$5(t){let e,n;return e=new t[7]({}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_3$8(t){let e,n,r,o=t[4]&&t[0]&&create_if_block_4$8(),i=t[49],a=[];for(let e=0;e<i.length;e+=1)a[e]=create_each_block_2$6(get_each_context_2$6(t,i,e));return{c(){e=element("thead"),n=element("tr"),o&&o.c(),r=space();for(let t=0;t<a.length;t+=1)a[t].c();attr(n,"class","svelte-47aais"),attr(e,"class","svelte-47aais")},m(t,i){insert(t,e,i),append(e,n),o&&o.m(n,null),append(n,r);for(let t=0;t<a.length;t+=1)a[t].m(n,null)},p(t,e){if(t[4]&&t[0]?o||(o=create_if_block_4$8(),o.c(),o.m(n,r)):o&&(o.d(1),o=null),8196&e[0]){let r;for(i=t[49],r=0;r<i.length;r+=1){const o=get_each_context_2$6(t,i,r);a[r]?a[r].p(o,e):(a[r]=create_each_block_2$6(o),a[r].c(),a[r].m(n,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=i.length}},d(t){t&&detach(e),o&&o.d(),destroy_each(a,t)}}}function create_if_block_4$8(t){let e;return{c(){e=element("th"),attr(e,"class","svelte-47aais")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_each_block_2$6(t){let e,n,r=t[54]?.designation+"";return{c(){e=element("th"),n=text(r),attr(e,"class","svelte-47aais")},m(t,r){insert(t,e,r),append(e,n)},p(t,e){4&e[0]&&r!==(r=t[54]?.designation+"")&&set_data(n,r)},d(t){t&&detach(e)}}}function create_if_block$x(t){let e,n,r=[],o=new Map,i=t[5];const a=t=>t[51]?._id;for(let e=0;e<i.length;e+=1){let n=get_each_context$e(t,i,e),s=a(n);o.set(s,r[e]=create_each_block$e(s,n))}return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=empty()},m(t,o){for(let e=0;e<r.length;e+=1)r[e].m(t,o);insert(t,e,o),n=!0},p(t,n){178239&n[0]&&(i=t[5],group_outros(),r=update_keyed_each(r,n,a,1,t,i,o,e.parentNode,outro_and_destroy_block,create_each_block$e,e,get_each_context$e),check_outros())},i(t){if(!n){for(let t=0;t<i.length;t+=1)transition_in(r[t]);n=!0}},o(t){for(let t=0;t<r.length;t+=1)transition_out(r[t]);n=!1},d(t){for(let e=0;e<r.length;e+=1)r[e].d(t);t&&detach(e)}}}function create_if_block_1$l(t){let e,n,r,o,i,a,s=t[4]&&t[0]&&create_if_block_2$d(t),c=t[49],l=[];for(let e=0;e<c.length;e+=1)l[e]=create_each_block_1$9(get_each_context_1$9(t,c,e));return{c(){e=element("tr"),s&&s.c(),n=space();for(let t=0;t<l.length;t+=1)l[t].c();r=space(),attr(e,"class","pointer svelte-47aais"),toggle_class(e,"active",t[51]._id===t[1]),toggle_class(e,"blocked",!!t[51].blocked),toggle_class(e,"undeliverable",!!t[51].undeliverable)},m(c,d){insert(c,e,d),s&&s.m(e,null),append(e,n);for(let t=0;t<l.length;t+=1)l[t].m(e,null);append(e,r),o=!0,i||(a=listen(e,"click",stop_propagation(function(){is_function(t[12](t[51],t[53]))&&t[12](t[51],t[53]).apply(this,arguments)})),i=!0)},p(o,i){if((t=o)[4]&&t[0]?s?(s.p(t,i),17&i[0]&&transition_in(s,1)):(s=create_if_block_2$d(t),s.c(),transition_in(s,1),s.m(e,n)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros()),10276&i[0]){let n;for(c=t[49],n=0;n<c.length;n+=1){const o=get_each_context_1$9(t,c,n);l[n]?l[n].p(o,i):(l[n]=create_each_block_1$9(o),l[n].c(),l[n].m(e,r))}for(;n<l.length;n+=1)l[n].d(1);l.length=c.length}34&i[0]&&toggle_class(e,"active",t[51]._id===t[1]),32&i[0]&&toggle_class(e,"blocked",!!t[51].blocked),32&i[0]&&toggle_class(e,"undeliverable",!!t[51].undeliverable)},i(t){o||(transition_in(s),o=!0)},o(t){transition_out(s),o=!1},d(t){t&&detach(e),s&&s.d(),destroy_each(l,t),i=!1,a()}}}function create_if_block_2$d(t){let e,n,r,o,i;return n=new ExternalLinkIcon({props:{size:"18"}}),{c(){e=element("td"),create_component(n.$$.fragment),attr(e,"class","editRow svelte-47aais"),set_style(e,"color","#326173")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",stop_propagation(function(){is_function(t[17](t[51]))&&t[17](t[51]).apply(this,arguments)})),o=!0)},p(e,n){t=e},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_each_block_1$9(t){let e,n,r,o=t[11](t[51],t[54])+"";return{c(){e=element("td"),n=text(o),attr(e,"class",r=null_to_empty(t[54].type)+" svelte-47aais")},m(t,r){insert(t,e,r),append(e,n)},p(t,i){36&i[0]&&o!==(o=t[11](t[51],t[54])+"")&&set_data(n,o),4&i[0]&&r!==(r=null_to_empty(t[54].type)+" svelte-47aais")&&attr(e,"class",r)},d(t){t&&detach(e)}}}function create_each_block$e(t,e){let n,r,o,i=e[15](e[51],e[49],e[3]),a=i&&create_if_block_1$l(e);return{key:t,first:null,c(){n=empty(),a&&a.c(),r=empty(),this.first=n},m(t,e){insert(t,n,e),a&&a.m(t,e),insert(t,r,e),o=!0},p(t,n){e=t,44&n[0]&&(i=e[15](e[51],e[49],e[3])),i?a?(a.p(e,n),44&n[0]&&transition_in(a,1)):(a=create_if_block_1$l(e),a.c(),transition_in(a,1),a.m(r.parentNode,r)):a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros())},i(t){o||(transition_in(a),o=!0)},o(t){transition_out(a),o=!1},d(t){t&&detach(n),a&&a.d(t),t&&detach(r)}}}function create_pending_block$d(t){let e,n;return e=new t[7]({}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p:noop,i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$B(t){let e,n,r,o={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$d,then:create_then_block$d,catch:create_catch_block$d,value:50,blocks:[,,,]};return handle_promise(n=t[2]&&t[13](),o),{c(){e=empty(),o.block.c()},m(t,n){insert(t,e,n),o.block.m(t,o.anchor=n),o.mount=()=>e.parentNode,o.anchor=e,r=!0},p(e,r){t=e,o.ctx=t,4&r[0]&&n!==(n=t[2]&&t[13]())&&handle_promise(n,o)||update_await_block_branch(o,t,r)},i(t){r||(transition_in(o.block),r=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(o.blocks[t])}r=!1},d(t){t&&detach(e),o.block.d(t),o.token=null,o=null}}}const getDisplayItems=exports("getDisplayItems",async(t,e,n)=>{if(!t)return;let r=[];for(const o of t){if("_total"===o){r.push({name:"_total",designation:"Betrag",type:"number"});continue}if("__total"===o){r.push({name:"__total",designation:"Total CHF",type:"number",decimals:2});continue}const[t,i]=o.split(".");let a=e.list?.find(e=>e.name===t)?.item?.find(t=>t.name===i);if(a&&(a={...a},a.name=`${t}_${i}`,n=n.map(e=>(e[t]&&(e[a.name]=e["_"+t]?e["_"+t][i]:e[t][i]),e))),a||(a=e.items.find(e=>e.name===t)),!a){const e=(await Request.getSchemaByClass(t)).items.find(t=>t.name===i);e&&(a={name:t,designation:e.designation,type:e.type,decimals:e.properties?.decimals||0})}r.find(e=>e?.name===t)||r.push(a)}return r.length?r:e.items});function instance$B(t,e,n){let r;let o=JSON.parse(Storage.getItem("Locale")).id;const i=createEventDispatcher(),{Loading:a,TextField:s}=getAttractions,{currentTasks:c}=user;component_subscribe(t,c,t=>n(37,r=t));let l,d,u,h,{inputList:m}=e,{eventId:f}=e,{prevEventId:p}=e,{record:_}=e,{className:g}=e,{rowId:w}=e,{filterForReady:$=!1}=e,{filter:y}=e,{query:b}=e,{refStatus:v}=e,{showEdit:I=!1}=e,{praefix:C=""}=e,{selectionFields:E=!1}=e,{deList:A}=e,{stopAggregation:S=!1}=e,{shouldBlock:k}=e,{inputSearch:T=""}=e,R=!0,N=T,D=g+Math.floor(9e3*Math.random()+1e3).toString()+"search",x=!1,O=!0;const M=(t,e)=>{if(!e)return;let n=t[e.name];if("__total"===e.name&&void 0===n&&(n=1.081*t._total),!n&&e.name.includes("_")&&!e.name.startsWith("_")){const[r,o]=e.name.split("_");try{n=t[r][o]}catch{}}if(Array.isArray(n)){const t=t=>t.replaceAll(" ",String.fromCharCode(160));if(n.length&&Array.isArray(n[0].serialno)){let e=[];for(const r of n)e=e.concat(r.serialno.map(t));n=e.join(", ")}else n=n.map(t),n.length>3&&(n=n.slice(0,3),n=n.concat("...")),n=n.join(", ")}if(!n&&e.name.split("_").length>1){const[r,o]=e.name.split("_");try{n=t[r][0][o],Array.isArray(n)&&(n=n.join(", "))}catch{}}return"number"===e.type&&(n||(n=t[`_${e.name}`]),n=Number(n)?Number(n).toLocaleString(o,{minimumFractionDigits:e.properties?.decimals||e.decimals||0,maximumFractionDigits:e.properties?.decimals||e.decimals||0}):""),"boolean"===e.type&&"Aktiv"===n&&(n=!1),"number"===e.type?n:"boolean"==typeof n||"boolean"===e.type?checkBoolean(n):checkDate(t[`_${e.name}`]||n||"")},P=Request.getSchemaByClass(g),B=async(t,e)=>{if(!t)return[];if(y){let e;const n=y.startsWith("!");n&&(e=y.replace("!",""));const r=y.startsWith("$");if(e&&!r&&(t=t.filter(t=>r?t[e]===w:n?!t[e]:!!t[e])),r){e=y.replace("$","");const[n,r]=e.split(".");if(_[r]){const e=await Request.getSectionView(n,{[r]:_[r]});t=t.filter(t=>e.find(e=>e._id==t[n]))}else t=[]}}if(v&&!b)return n(18,v=[].concat(v)),t.filter(t=>!!v.find(e=>t._task.status===e));if("Information"===e.state.task)return t;if(p){const e=await Request.getEvent(p);if("report"===e?.output?.type)return t;if(e?.input?.class?.length&&e.input.class[0].name===g)return"Information"===e.state.task?t.filter(t=>"Closed"!==t._task.status):t.filter(t=>"Ready"===t._task.status)}return t.filter(t=>"WaitingForApproval"===t._task.status||"Ready"===t._task.status||"Closing"===t._task.status)},F=(t,e)=>{if(t){let n,r="1";if("string"==typeof t)n=t;else{const e=Object.keys(t);n=e[0],r=e[1]}"date"===n&&(r="-1");const i=new Intl.Collator(o,{numeric:!0});return 1==r?e.sort((t,e)=>i.compare(t[n],e[n])):e.sort((t,e)=>i.compare(e[n],t[n]))}return e},L=async t=>{let e,r=0;O=!1;const o=t=>new Promise(e=>setTimeout(e,t)),i=await P;for(;r++<200&&!S&&!(e=await q(t,i.id));)await o(500);n(6,x=!1),S&&Request.readTasksByAggregationId(t,!0),e&&(n(5,u=F(d.displaySort,e.data)),window.setTimeout(()=>{const t=document.querySelector("tr.active");t&&t.scrollIntoView({block:"end",behavior:"smooth"}),O=!0},100))},q=async(t,e)=>await Request.readTasksByAggregationId(t,!1,e),V=async(t,e,n,r)=>{const{value:o,refClass:i}=r,[a,s]=n.split("."),c=o?.get(C),l=c&&await getTaskFull(a,c);if(!l)return t;const d=l[s];return d?.length?d.map(n=>{let r=t?.find(t=>t._id===n[e])||{};r={...r};for(const t in r)n[t]&&(r[t]=n[t]);for(const t in n)n[t]&&(r[t]=n[t]);return setTaskSelection(i+r._id.toString(),r),r}):t};onMount(()=>{window.setTimeout(()=>{const t=document.querySelector("tr.active");t?t.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(D)?.focus()},200)}),task_notification.subscribe(async t=>{if(!t)return;const e=await P;t.eventId===e.id&&(refreshList(e.class,t.eventId),n(2,R=!n(2,R=!1)))});return t.$$set=t=>{"inputList"in t&&n(20,m=t.inputList),"eventId"in t&&n(21,f=t.eventId),"prevEventId"in t&&n(22,p=t.prevEventId),"record"in t&&n(23,_=t.record),"className"in t&&n(24,g=t.className),"rowId"in t&&n(1,w=t.rowId),"filterForReady"in t&&n(25,$=t.filterForReady),"filter"in t&&n(26,y=t.filter),"query"in t&&n(27,b=t.query),"refStatus"in t&&n(18,v=t.refStatus),"showEdit"in t&&n(0,I=t.showEdit),"praefix"in t&&n(28,C=t.praefix),"selectionFields"in t&&n(29,E=t.selectionFields),"deList"in t&&n(30,A=t.deList),"stopAggregation"in t&&n(19,S=t.stopAggregation),"shouldBlock"in t&&n(31,k=t.shouldBlock),"inputSearch"in t&&n(32,T=t.inputSearch)},[I,w,R,N,l,u,x,a,s,c,D,M,(t,e)=>r=>{n(19,S=!0);const o=O?t:h[e];i("choose",{row:o})},async()=>{d=await P,n(4,l=(t=>!r?.length||!!r.find(e=>e===t))(d.id)),b&&n(5,u=h=await Request.getTasksFiltered(d.class,b)),u||n(5,u=h=F(d.displaySort,await m||await getList(d.class,d.id))),500!==u?.length||b||(n(6,x=!0),Request.getTasksList(d.id,!1,!0).then(({aggregationId:t})=>L(t)));let t,e=!1,o="";const a=E&&E?.find(t=>d.class===t.refClass.split(":")[0]),s=a?.value?.get&&a.value.get(C);if(s){const[r,i]=a.refClass.split(":");d.class===r&&n(5,u=await V(u,r,i,a)),e=a.parentClass?.find(t=>"quantity"===t.name),o=a.className,t=await Request.getCountedSection(o,i.split(".")[0],s,r,"quantity")}n(0,I&&=!a),!a&&(y||$||v)&&n(5,u=await B(u,d));const{display:c}=d;let f=await getDisplayItems(c,d,u);return!I&&e?(f=f.concat([{name:"quantity",designation:"h-Soll",type:"number",decimals:2},{name:"ist",designation:"h-Ist",type:"number",decimals:2}]),n(5,u=u.map(e=>{const n=t.find(t=>t._id===e._id);return n&&(e.ist=n.quantity.$numberDecimal),e})),t.map(t=>{if(!u.find(e=>e._id===t._id)){const e=h.find(e=>e._id===t._id);e&&(e.ist=t.quantity.$numberDecimal),u.push(e)}}),i("init",u)):A&&n(5,u=u.filter(t=>!A.find(e=>e?._id===t._id))),k&&n(5,u=u.filter(t=>!t[k])),{items:f}},({detail:{value:t}})=>{n(3,N=t)},(t,e,n)=>{if(!t)return!1;if(!n)return!0;"string"!=typeof n&&(n=n.toString()),n=n.toLowerCase();let r=!1;for(const o of e){const e=M(t,o).toLowerCase();!r&&e.includes(n)&&(r=!0)}return r},()=>{n(3,N="")},async t=>{let e=t._task;e||(e=await getTask(g,"",t._id,!0),e=e._task),window.open(`/task/${e.event}/${e.task_id||e._id}/task?view=standalone`,"_blank")},v,S,m,f,p,_,g,$,y,b,C,E,A,k,T,function(t){N=t,n(3,N)}]}class List$1 extends SvelteComponent{constructor(t){super(),document_1$g.getElementById("svelte-47aais-style")||add_css$x(),init(this,t,instance$B,create_fragment$B,safe_not_equal,{inputList:20,eventId:21,prevEventId:22,record:23,className:24,rowId:1,filterForReady:25,filter:26,query:27,refStatus:18,showEdit:0,praefix:28,selectionFields:29,deList:30,stopAggregation:19,shouldBlock:31,inputSearch:32},[-1,-1])}}function add_css$w(){var t=element("style");t.id="svelte-jb5mrh-style",t.textContent=".eList .flex button.btn{width:max-content !important}.dialog.eList{max-height:90vh}.form--buttons.svelte-jb5mrh{display:flex;gap:1em;padding:0.5em 0}",append(document.head,t)}function create_catch_block$c(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$c(t){let e,n,r=t[45]&&create_if_block$w(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){t[45]?r?(r.p(t,n),16&n[0]&&transition_in(r,1)):(r=create_if_block$w(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_if_block$w(t){let e,n;return e=new t[25]({props:{title:t[20]?"Auswahl":t[0],class:"eList "+(t[18]?"form":""),$$slots:{default:[create_default_slot$i]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1048577&n[0]&&(r.title=t[20]?"Auswahl":t[0]),262144&n[0]&&(r.class="eList "+(t[18]?"form":"")),33554430&n[0]|32768&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_else_block_1$5(t){let e,n;return e=new Index({props:{schema:t[2],recID:t[1],readonly:t[19]}}),e.$on("choose",function(){is_function(t[34](t[45]))&&t[34](t[45]).apply(this,arguments)}),e.$on("back",t[31]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(n,r){t=n;const o={};4&r[0]&&(o.schema=t[2]),2&r[0]&&(o.recID=t[1]),524288&r[0]&&(o.readonly=t[19]),e.$set(o)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_1$k(t){let e,n,r,o,i,a,s;e=new t[26]({props:{text:t[20]?"Zusätzliche Auswahl":""}});const c=[create_if_block_2$c,create_else_block$g],l=[];function d(t,e){return t[20]?0:1}return r=d(t),o=l[r]=c[r](t),a=new List$1({props:{inputSearch:t[15],record:t[3],eventId:t[2].id,className:t[2].class,prevEventId:t[14],filterForReady:t[5],filter:t[6],query:t[7],refStatus:t[8],praefix:t[9],selectionFields:t[10],rowId:t[1],shouldBlock:t[16],deList:t[12],stopAggregation:t[24],showEdit:t[11]}}),a.$on("edit",t[35]),a.$on("choose",t[38]),a.$on("init",t[36]),{c(){create_component(e.$$.fragment),n=space(),o.c(),i=space(),create_component(a.$$.fragment)},m(t,o){mount_component(e,t,o),insert(t,n,o),l[r].m(t,o),insert(t,i,o),mount_component(a,t,o),s=!0},p(t,n){const s={};1048576&n[0]&&(s.text=t[20]?"Zusätzliche Auswahl":""),e.$set(s);let u=r;r=d(t),r===u?l[r].p(t,n):(group_outros(),transition_out(l[u],1,1,()=>{l[u]=null}),check_outros(),o=l[r],o?o.p(t,n):(o=l[r]=c[r](t),o.c()),transition_in(o,1),o.m(i.parentNode,i));const h={};32768&n[0]&&(h.inputSearch=t[15]),8&n[0]&&(h.record=t[3]),4&n[0]&&(h.eventId=t[2].id),4&n[0]&&(h.className=t[2].class),16384&n[0]&&(h.prevEventId=t[14]),32&n[0]&&(h.filterForReady=t[5]),64&n[0]&&(h.filter=t[6]),128&n[0]&&(h.query=t[7]),256&n[0]&&(h.refStatus=t[8]),512&n[0]&&(h.praefix=t[9]),1024&n[0]&&(h.selectionFields=t[10]),2&n[0]&&(h.rowId=t[1]),65536&n[0]&&(h.shouldBlock=t[16]),4096&n[0]&&(h.deList=t[12]),16777216&n[0]&&(h.stopAggregation=t[24]),2048&n[0]&&(h.showEdit=t[11]),a.$set(h)},i(t){s||(transition_in(e.$$.fragment,t),transition_in(o),transition_in(a.$$.fragment,t),s=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(o),transition_out(a.$$.fragment,t),s=!1},d(t){destroy_component(e,t),t&&detach(n),l[r].d(t),t&&detach(i),destroy_component(a,t)}}}function create_else_block$g(t){let e,n,r,o;n=new t[27]({props:{outline:!0,$$slots:{default:[create_default_slot_3$3]},$$scope:{ctx:t}}}),n.$on("click",t[32]);let i=t[29]&&t[13]&&create_if_block_4$7(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i&&i.c(),attr(e,"class","form--buttons svelte-jb5mrh")},m(t,a){insert(t,e,a),mount_component(n,e,null),append(e,r),i&&i.m(e,null),o=!0},p(t,r){const o={};32768&r[1]&&(o.$$scope={dirty:r,ctx:t}),n.$set(o),t[29]&&t[13]?i?(i.p(t,r),8192&r[0]&&transition_in(i,1)):(i=create_if_block_4$7(t),i.c(),transition_in(i,1),i.m(e,null)):i&&(group_outros(),transition_out(i,1,1,()=>{i=null}),check_outros())},i(t){o||(transition_in(n.$$.fragment,t),transition_in(i),o=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),o=!1},d(t){t&&detach(e),destroy_component(n),i&&i.d()}}}function create_if_block_2$c(t){let e,n,r,o,i,a,s=t[23]&&create_if_block_3$7(t);return r=new t[27]({props:{outline:!0,$$slots:{default:[create_default_slot_1$d]},$$scope:{ctx:t}}}),r.$on("click",t[32]),i=new t[26]({props:{text:"Liste aus "+t[17]}}),{c(){s&&s.c(),e=space(),n=element("div"),create_component(r.$$.fragment),o=space(),create_component(i.$$.fragment),attr(n,"class","form--buttons svelte-jb5mrh")},m(t,c){s&&s.m(t,c),insert(t,e,c),insert(t,n,c),mount_component(r,n,null),insert(t,o,c),mount_component(i,t,c),a=!0},p(t,n){t[23]?s?(s.p(t,n),8388608&n[0]&&transition_in(s,1)):(s=create_if_block_3$7(t),s.c(),transition_in(s,1),s.m(e.parentNode,e)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros());const o={};32768&n[1]&&(o.$$scope={dirty:n,ctx:t}),r.$set(o);const a={};131072&n[0]&&(a.text="Liste aus "+t[17]),i.$set(a)},i(t){a||(transition_in(s),transition_in(r.$$.fragment,t),transition_in(i.$$.fragment,t),a=!0)},o(t){transition_out(s),transition_out(r.$$.fragment,t),transition_out(i.$$.fragment,t),a=!1},d(t){s&&s.d(t),t&&detach(e),t&&detach(n),destroy_component(r),t&&detach(o),destroy_component(i,t)}}}function create_default_slot_3$3(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_4$7(t){let e,n;return e=new t[27]({props:{filled:!0,$$slots:{default:[create_default_slot_2$8]},$$scope:{ctx:t}}}),e.$on("click",t[33]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};32768&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_2$8(t){let e;return{c(){e=text("Neu")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_3$7(t){let e,n;return e=new InputFormField({props:{item:t[21],record:{_id:"",[t[21].name]:""},noForm:"true",classId:"sel_"+t[21].name,eventId:t[22],required:!1,hidden:!1,readonly:!1,deList:t[23]}}),e.$on("notify",t[37]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};2097152&n[0]&&(r.item=t[21]),2097152&n[0]&&(r.record={_id:"",[t[21].name]:""}),2097152&n[0]&&(r.classId="sel_"+t[21].name),4194304&n[0]&&(r.eventId=t[22]),8388608&n[0]&&(r.deList=t[23]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_1$d(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot$i(t){let e,n,r,o;const i=[create_if_block_1$k,create_else_block_1$5],a=[];function s(t,e){return t[45].length&&!t[18]?0:1}return e=s(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?a[e].p(t,o):(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros(),n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function create_pending_block$c(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_fragment$A(t){let e,n,r,o={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$c,then:create_then_block$c,catch:create_catch_block$c,value:45,blocks:[,,,]};return handle_promise(n=t[30](t[4]),o),{c(){e=empty(),o.block.c()},m(t,n){insert(t,e,n),o.block.m(t,o.anchor=n),o.mount=()=>e.parentNode,o.anchor=e,r=!0},p(e,r){t=e,o.ctx=t,16&r[0]&&n!==(n=t[30](t[4]))&&handle_promise(n,o)||update_await_block_branch(o,t,r)},i(t){r||(transition_in(o.block),r=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(o.blocks[t])}r=!1},d(t){t&&detach(e),o.block.d(t),o.token=null,o=null}}}function instance$A(t,e,n){let r;const{Dialog:o,Divider:i,Button:a}=getAttractions,s=createEventDispatcher(),{currentTasks:c}=user;component_subscribe(t,c,t=>n(41,r=t));let{title:l}=e,{schema:d}=e,{record:u}=e,{recID:h}=e,{isOpening:m=!0}=e,{filterForReady:f=!1}=e,{filter:p}=e,{query:_}=e,{refStatus:g}=e,{praefix:w=""}=e,{selectionFields:$=!1}=e,{showEdit:y=!0}=e,{deList:b}=e,{newAllowed:v=!0}=e,{prevEventId:I}=e,{inputSearch:C}=e,{shouldBlock:E}=e,A=d.id;d.class;let S,k,T,R,N,D,x,O="",M=!1,P=!1;l??=d.identity.designation;const B=!r?.length||r.find(t=>t===A);return t.$$set=t=>{"title"in t&&n(0,l=t.title),"schema"in t&&n(2,d=t.schema),"record"in t&&n(3,u=t.record),"recID"in t&&n(1,h=t.recID),"isOpening"in t&&n(4,m=t.isOpening),"filterForReady"in t&&n(5,f=t.filterForReady),"filter"in t&&n(6,p=t.filter),"query"in t&&n(7,_=t.query),"refStatus"in t&&n(8,g=t.refStatus),"praefix"in t&&n(9,w=t.praefix),"selectionFields"in t&&n(10,$=t.selectionFields),"showEdit"in t&&n(11,y=t.showEdit),"deList"in t&&n(12,b=t.deList),"newAllowed"in t&&n(13,v=t.newAllowed),"prevEventId"in t&&n(14,I=t.prevEventId),"inputSearch"in t&&n(15,C=t.inputSearch),"shouldBlock"in t&&n(16,E=t.shouldBlock)},[l,h,d,u,m,f,p,_,g,w,$,y,b,v,I,C,E,O,M,S,T,N,D,x,P,o,i,a,c,B,async t=>{if(!t)return!1;const e=await getList(d.class,d.id);if(k=$&&$?.find(t=>d.class===t.refClass.split(":")[0]),n(20,T=k?.value?.get&&k.value.get(w)),T){R=k.refClass;const[t,e]=R.split(":"),[r]=e.split(".");n(21,N=k.parentClass.find(e=>e.name===t));const o=await Request.getSchemaByClass(N.refClass);n(22,D=o.id),n(17,O=k.parentClass.find(t=>t.name===r).designation)}return e},()=>{n(18,M=!1),h||s("back"),y||s("back")},()=>{n(24,P=!0),n(18,M=!1),s("back")},()=>{n(24,P=!0),n(1,h=!1),n(19,S=!1),n(18,M=!0)},t=>({detail:{row:t}})=>{let e=d.display;e&&e.length&&e.map(e=>{const[n,r]=e.split(".");let o=d.list?.find(t=>t.name===n)?.item.find(t=>t.name===r);if(o){t[`${n}_${r}`]=t[n][r]}}),s("choose",{row:t})},({detail:t})=>{n(19,S=!!t._task.visum||"Closed"===t._task.status),n(1,h=t._docId),n(18,M=!0)},({detail:t})=>{T&&n(23,x=t)},({detail:t})=>{if(!t.value)return;const e={_id:t.value};s("choose",{row:e})},function(e){bubble(t,e)}]}class FormList extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-jb5mrh-style")||add_css$w(),init(this,t,instance$A,create_fragment$A,safe_not_equal,{title:0,schema:2,record:3,recID:1,isOpening:4,filterForReady:5,filter:6,query:7,refStatus:8,praefix:9,selectionFields:10,showEdit:11,deList:12,newAllowed:13,prevEventId:14,inputSearch:15,shouldBlock:16},[-1,-1])}}const{document:document_1$f}=globals;function add_css$v(){var t=element("style");t.id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl .editRow.svelte-14hcfjl{width:1em}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",append(document_1$f.head,t)}function get_then_context$3(t){t[28]=t[30].list,t[29]=t[30].items}function get_each_context$d(t,e,n){const r=t.slice();return r[31]=e[n],r}function get_each_context_1$8(t,e,n){const r=t.slice();return r[34]=e[n],r}function get_each_context_2$5(t,e,n){const r=t.slice();return r[34]=e[n],r}function create_catch_block$b(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$b(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w;function $(e){t[25](e)}get_then_context$3(t),n=new t[7]({props:{outline:!0,$$slots:{default:[create_default_slot_1$c]},$$scope:{ctx:t}}}),n.$on("click",t[24]);let y={id:t[8]};void 0!==t[1]&&(y.value=t[1]),a=new t[6]({props:y}),binding_callbacks.push(()=>bind(a,"value",$)),a.$on("input",t[12]),d=new DeleteIcon({props:{size:"18"}});let b=t[29]?.length&&create_if_block_2$b(t),v=t[28]?.length&&create_if_block$v(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),o=element("div"),i=text("Suchen: "),create_component(a.$$.fragment),c=space(),l=element("span"),create_component(d.$$.fragment),u=space(),h=element("div"),m=element("table"),b&&b.c(),f=space(),p=element("tbody"),v&&v.c(),attr(e,"class","form--buttons svelte-14hcfjl"),attr(l,"class","feather pointer svelte-14hcfjl"),set_style(o,"margin-bottom","1em"),set_style(o,"position","relative"),attr(m,"striped",""),attr(m,"class","svelte-14hcfjl"),attr(h,"class","eList svelte-14hcfjl")},m(s,$){insert(s,e,$),mount_component(n,e,null),insert(s,r,$),insert(s,o,$),append(o,i),mount_component(a,o,null),append(o,c),append(o,l),mount_component(d,l,null),insert(s,u,$),insert(s,h,$),append(h,m),b&&b.m(m,null),append(m,f),append(m,p),v&&v.m(p,null),_=!0,g||(w=listen(l,"click",t[14]),g=!0)},p(t,e){get_then_context$3(t);const r={};256&e[1]&&(r.$$scope={dirty:e,ctx:t}),n.$set(r);const o={};!s&&2&e[0]&&(s=!0,o.value=t[1],add_flush_callback(()=>s=!1)),a.$set(o),t[29]?.length&&b.p(t,e),t[28]?.length&&v.p(t,e)},i(t){_||(transition_in(n.$$.fragment,t),transition_in(a.$$.fragment,t),transition_in(d.$$.fragment,t),transition_in(v),_=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(a.$$.fragment,t),transition_out(d.$$.fragment,t),transition_out(v),_=!1},d(t){t&&detach(e),destroy_component(n),t&&detach(r),t&&detach(o),destroy_component(a),destroy_component(d),t&&detach(u),t&&detach(h),b&&b.d(),v&&v.d(),g=!1,w()}}}function create_default_slot_1$c(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_2$b(t){let e,n,r,o,i=t[29],a=[];for(let e=0;e<i.length;e+=1)a[e]=create_each_block_2$5(get_each_context_2$5(t,i,e));return{c(){e=element("thead"),n=element("tr"),r=element("th"),o=space();for(let t=0;t<a.length;t+=1)a[t].c();attr(r,"class","svelte-14hcfjl"),attr(n,"class","svelte-14hcfjl"),attr(e,"class","svelte-14hcfjl")},m(t,i){insert(t,e,i),append(e,n),append(n,r),append(n,o);for(let t=0;t<a.length;t+=1)a[t].m(n,null)},p(t,e){if(2048&e[0]){let r;for(i=t[29],r=0;r<i.length;r+=1){const o=get_each_context_2$5(t,i,r);a[r]?a[r].p(o,e):(a[r]=create_each_block_2$5(o),a[r].c(),a[r].m(n,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=i.length}},d(t){t&&detach(e),destroy_each(a,t)}}}function create_each_block_2$5(t){let e,n,r=t[34]?.designation+"";return{c(){e=element("th"),n=text(r),attr(e,"class","svelte-14hcfjl")},m(t,r){insert(t,e,r),append(e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block$v(t){let e,n,r=t[28],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block$d(get_each_context$d(t,r,e));const i=t=>transition_out(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=empty()},m(t,r){for(let e=0;e<o.length;e+=1)o[e].m(t,r);insert(t,e,r),n=!0},p(t,n){if(44547&n[0]){let a;for(r=t[28],a=0;a<r.length;a+=1){const i=get_each_context$d(t,r,a);o[a]?(o[a].p(i,n),transition_in(o[a],1)):(o[a]=create_each_block$d(i),o[a].c(),transition_in(o[a],1),o[a].m(e.parentNode,e))}for(group_outros(),a=r.length;a<o.length;a+=1)i(a);check_outros()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)transition_out(o[t]);n=!1},d(t){destroy_each(o,t),t&&detach(e)}}}function create_if_block_1$j(t){let e,n,r,o,i,a,s,c;r=new ExternalLinkIcon({props:{size:"18"}});let l=t[29],d=[];for(let e=0;e<l.length;e+=1)d[e]=create_each_block_1$8(get_each_context_1$8(t,l,e));return{c(){e=element("tr"),n=element("td"),create_component(r.$$.fragment),o=space();for(let t=0;t<d.length;t+=1)d[t].c();i=space(),attr(n,"class","editRow svelte-14hcfjl"),attr(e,"class","pointer svelte-14hcfjl"),toggle_class(e,"active",t[31]._id===t[0])},m(l,u){insert(l,e,u),append(e,n),mount_component(r,n,null),append(e,o);for(let t=0;t<d.length;t+=1)d[t].m(e,null);append(e,i),a=!0,s||(c=listen(n,"click",t[15](t[31])),s=!0)},p(n,r){if(t=n,3584&r[0]){let n;for(l=t[29],n=0;n<l.length;n+=1){const o=get_each_context_1$8(t,l,n);d[n]?d[n].p(o,r):(d[n]=create_each_block_1$8(o),d[n].c(),d[n].m(e,i))}for(;n<d.length;n+=1)d[n].d(1);d.length=l.length}2049&r[0]&&toggle_class(e,"active",t[31]._id===t[0])},i(t){a||(transition_in(r.$$.fragment,t),a=!0)},o(t){transition_out(r.$$.fragment,t),a=!1},d(t){t&&detach(e),destroy_component(r),destroy_each(d,t),s=!1,c()}}}function create_each_block_1$8(t){let e,n,r,o,i=t[9](t[31],t[34])+"";return{c(){e=element("td"),n=text(i),attr(e,"class","svelte-14hcfjl")},m(i,a){insert(i,e,a),append(e,n),r||(o=listen(e,"click",stop_propagation(t[10](t[31]))),r=!0)},p(e,n){t=e},d(t){t&&detach(e),r=!1,o()}}}function create_each_block$d(t){let e,n,r=t[13](t[31],t[29],t[1]),o=r&&create_if_block_1$j(t);return{c(){o&&o.c(),e=empty()},m(t,r){o&&o.m(t,r),insert(t,e,r),n=!0},p(t,n){2&n[0]&&(r=t[13](t[31],t[29],t[1])),r?o?(o.p(t,n),2&n[0]&&transition_in(o,1)):(o=create_if_block_1$j(t),o.c(),transition_in(o,1),o.m(e.parentNode,e)):o&&(group_outros(),transition_out(o,1,1,()=>{o=null}),check_outros())},i(t){n||(transition_in(o),n=!0)},o(t){transition_out(o),n=!1},d(t){o&&o.d(t),t&&detach(e)}}}function create_pending_block$b(t){let e,n;return e=new t[5]({}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p:noop,i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot$h(t){let e,n,r,o;e=new t[4]({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$b,then:create_then_block$b,catch:create_catch_block$b,value:30,blocks:[,,,]};return handle_promise(t[11](),i),{c(){create_component(e.$$.fragment),n=space(),r=empty(),i.block.c()},m(t,a){mount_component(e,t,a),insert(t,n,a),insert(t,r,a),i.block.m(t,i.anchor=a),i.mount=()=>r.parentNode,i.anchor=r,o=!0},p(e,n){update_await_block_branch(i,t=e,n)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(i.block),o=!0)},o(t){transition_out(e.$$.fragment,t);for(let t=0;t<3;t+=1){transition_out(i.blocks[t])}o=!1},d(t){destroy_component(e,t),t&&detach(n),t&&detach(r),i.block.d(t),i.token=null,i=null}}}function create_fragment$z(t){let e,n;return e=new t[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[create_default_slot$h]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};3&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function instance$z(t,e,n){const r=createEventDispatcher(),{Dialog:o,Divider:i,Loading:a,TextField:s,Button:c}=getAttractions;let{item:l}=e,{classId:d}=e,{className:u}=e,{rowId:h}=e,{viewName:m}=e,{viewValue:f}=e,{recordId:p}=e,{filter:_}=e,{multiValues:g}=e,w="",$=d+Math.floor(9e3*Math.random()+1e3).toString()+"search";const y=(t,e)=>{if(!e)return;const n=t[e.name];return"boolean"==typeof n?checkBoolean(n):checkDate(t[`_${e.name}`]||t[e.name]||"")},b=Request.getSchemaByClass(u);onMount(()=>{window.setTimeout(()=>{const t=document.querySelector("tr.active");t?t.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById($)?.focus()},200)}),task_notification.subscribe(async t=>{if(!t)return;const e=await b;t.eventId===e.id&&refreshList(e.class,t.eventId)});return t.$$set=t=>{"item"in t&&n(16,l=t.item),"classId"in t&&n(17,d=t.classId),"className"in t&&n(18,u=t.className),"rowId"in t&&n(0,h=t.rowId),"viewName"in t&&n(19,m=t.viewName),"viewValue"in t&&n(20,f=t.viewValue),"recordId"in t&&n(21,p=t.recordId),"filter"in t&&n(22,_=t.filter),"multiValues"in t&&n(23,g=t.multiValues)},[h,w,r,o,i,a,s,c,$,y,t=>()=>r("choose",{row:t}),async()=>{const t=await b;let e=[];if(l.lookup){const n="."+d+"#"+l.lookup,r=document.querySelector(n);let o=r?.value||p;if(g.has(l.lookup)){const n=g.get(l.lookup)[0];e=n?await Request.getSectionView(l.name,{[l.lookup]:n},!0):await getList(l.name,t.id)}else if(o&&24===o.toString().length){const t=await getTaskFull(l.lookup,o);if(t){const n=t[l.name]?.map(t=>t[l.name]);n&&(e=await Request.getSectionView(l.name,{_id:{$in:n}},!0))}}}else{const n="."+d+"#"+m.split(":")[0],r=document.querySelector(n);let o={[m]:r?.value||p};if(l.refItem){const t="."+d+"#"+l.refItem;try{const e=document.querySelector(t);if(e){const t={$or:[{[l.refItem]:e.value},{[l.refItem]:{$exists:!0,$eq:""}}]};o={...o,...t}}}catch{}}o[m]&&(e=await Request.getSectionView(t.class,o,!0)),_&&(e=e.filter(t=>t._id!=_))}const n=t.display;return{list:e,items:await getDisplayItems(n,t,e)}},({detail:{value:t}})=>{n(1,w=t)},(t,e,n)=>{if(!n)return!0;for(const r of e)if(y(t,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{n(1,w="")},t=>async()=>{const e=await Request.getTaskByDocId(t._id,!0),n=`/task/${e.event}/${e._id}/task?view=standalone`;window.open(n)},l,d,u,m,f,p,_,g,()=>r("back"),function(t){w=t,n(1,w)}]}class ViewList extends SvelteComponent{constructor(t){super(),document_1$f.getElementById("svelte-14hcfjl-style")||add_css$v(),init(this,t,instance$z,create_fragment$z,safe_not_equal,{item:16,classId:17,className:18,rowId:0,viewName:19,viewValue:20,recordId:21,filter:22,multiValues:23},[-1,-1])}}const{document:document_1$e}=globals;function add_css$u(){var t=element("style");t.id="svelte-jox15l-style",t.textContent=".feather.svelte-jox15l{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-jox15l{position:absolute;top:0.75em;right:0.5em;color:#4300b0}.text-field textarea:invalid{border-bottom:1px #b80000 solid !important;background-color:#fbeeee !important}",append(document_1$e.head,t)}function create_catch_block$a(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$a(t){let e,n,r=t[72]&&create_if_block$u(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,e){t[72]&&r.p(t,e)},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_if_block$u(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w,$;function y(e){t[55](e)}function b(e){t[56](e)}let v={class:"full-width",id:t[32],rows:"1",required:t[2],disabled:t[3],placeholder:t[34],style:"height:2.8em; padding-left:2em;padding-right:2em;overflow-y:hidden; resize:none;"};void 0!==t[1]&&(v.value=t[1]),void 0!==t[25]&&(v.overwrite=t[25]),n=new TextArea({props:v}),binding_callbacks.push(()=>bind(n,"value",y)),binding_callbacks.push(()=>bind(n,"overwrite",b)),n.$on("click",t[37]()),n.$on("blur",t[44]);const I=[create_if_block_5$6,create_if_block_6$4],C=[];function E(t,e){return!t[3]||t[16]?0:t[22]&&t[0]?1:-1}~(a=E(t))&&(s=C[a]=I[a](t));let A=(!t[3]||t[16]||t[17])&&create_if_block_4$6(t);function S(e){t[57](e)}let k={class:"tModal",noClickaway:!0,$$slots:{default:[create_default_slot_2$7]},$$scope:{ctx:t}};void 0!==t[19]&&(k.open=t[19]),m=new t[28]({props:k}),binding_callbacks.push(()=>bind(m,"open",S));let T=t[20]&&create_if_block_1$i(t);return{c(){e=element("div"),create_component(n.$$.fragment),i=space(),s&&s.c(),c=space(),l=element("input"),u=space(),A&&A.c(),h=space(),create_component(m.$$.fragment),p=space(),T&&T.c(),_=empty(),attr(l,"class",d=null_to_empty(t[9]||t[10])+" svelte-jox15l"),attr(l,"id",t[5]),attr(l,"name",t[5]),l.value=t[0],l.hidden=!0,set_style(e,"position","relative")},m(r,o){insert(r,e,o),mount_component(n,e,null),append(e,i),~a&&C[a].m(e,null),append(e,c),append(e,l),append(e,u),A&&A.m(e,null),insert(r,h,o),mount_component(m,r,o),insert(r,p,o),T&&T.m(r,o),insert(r,_,o),g=!0,w||($=listen(e,"keydown",t[38]),w=!0)},p(t,i){const u={};4&i[0]&&(u.required=t[2]),8&i[0]&&(u.disabled=t[3]),!r&&2&i[0]&&(r=!0,u.value=t[1],add_flush_callback(()=>r=!1)),!o&&33554432&i[0]&&(o=!0,u.overwrite=t[25],add_flush_callback(()=>o=!1)),n.$set(u);let h=a;a=E(t),a===h?~a&&C[a].p(t,i):(s&&(group_outros(),transition_out(C[h],1,1,()=>{C[h]=null}),check_outros()),~a?(s=C[a],s?s.p(t,i):(s=C[a]=I[a](t),s.c()),transition_in(s,1),s.m(e,c)):s=null),(!g||1536&i[0]&&d!==(d=null_to_empty(t[9]||t[10])+" svelte-jox15l"))&&attr(l,"class",d),(!g||32&i[0])&&attr(l,"id",t[5]),(!g||32&i[0])&&attr(l,"name",t[5]),(!g||1&i[0]&&l.value!==t[0])&&(l.value=t[0]),!t[3]||t[16]||t[17]?A?(A.p(t,i),196616&i[0]&&transition_in(A,1)):(A=create_if_block_4$6(t),A.c(),transition_in(A,1),A.m(e,null)):A&&(group_outros(),transition_out(A,1,1,()=>{A=null}),check_outros());const p={};93126097&i[0]|2048&i[2]&&(p.$$scope={dirty:i,ctx:t}),!f&&524288&i[0]&&(f=!0,p.open=t[19],add_flush_callback(()=>f=!1)),m.$set(p),t[20]?T?(T.p(t,i),1048576&i[0]&&transition_in(T,1)):(T=create_if_block_1$i(t),T.c(),transition_in(T,1),T.m(_.parentNode,_)):T&&(group_outros(),transition_out(T,1,1,()=>{T=null}),check_outros())},i(t){g||(transition_in(n.$$.fragment,t),transition_in(s),transition_in(A),transition_in(m.$$.fragment,t),transition_in(T),g=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(s),transition_out(A),transition_out(m.$$.fragment,t),transition_out(T),g=!1},d(t){t&&detach(e),destroy_component(n),~a&&C[a].d(),A&&A.d(),t&&detach(h),destroy_component(m,t),t&&detach(p),T&&T.d(t),t&&detach(_),w=!1,$()}}}function create_if_block_6$4(t){let e,n,r,o,i;return n=new ExternalLinkIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-jox15l")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[43]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_if_block_5$6(t){let e,n,r,o,i;return n=new SearchIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-jox15l")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=[listen(e,"click",t[37](!0)),listen(e,"choose",t[40])],o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,run_all(i)}}}function create_if_block_4$6(t){let e,n,r,o,i;return n=new DeleteIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 pointer svelte-jox15l")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[42]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_if_block_2$a(t){let e,n,r,o;const i=[create_if_block_3$6,create_else_block$f],a=[];function s(t,e){return t[6].lookup||t[4]&&!t[6].constraint?0:1}return e=s(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?a[e].p(t,o):(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros(),n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function create_else_block$f(t){let e,n;return e=new FormList({props:{title:t[6].designation,newAllowed:t[23],prevEventId:t[11],schema:t[18],filter:t[33],query:t[35](),record:t[7],recID:t[0],isOpening:t[19],filterForReady:t[24],refStatus:t[6].refStatus,selectionFields:t[14],deList:t[15],praefix:t[13],shouldBlock:t[26],inputSearch:t[39]()}}),e.$on("choose",t[40]),e.$on("back",t[41]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};64&n[0]&&(r.title=t[6].designation),8388608&n[0]&&(r.newAllowed=t[23]),2048&n[0]&&(r.prevEventId=t[11]),262144&n[0]&&(r.schema=t[18]),128&n[0]&&(r.record=t[7]),1&n[0]&&(r.recID=t[0]),524288&n[0]&&(r.isOpening=t[19]),16777216&n[0]&&(r.filterForReady=t[24]),64&n[0]&&(r.refStatus=t[6].refStatus),16384&n[0]&&(r.selectionFields=t[14]),32768&n[0]&&(r.deList=t[15]),8192&n[0]&&(r.praefix=t[13]),67108864&n[0]&&(r.shouldBlock=t[26]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_3$6(t){let e,n;return e=new ViewList({props:{item:t[6],className:t[18].class,classId:t[10],rowId:t[0],recordId:t[12],viewName:t[4],viewValue:"",multiValues:t[8]}}),e.$on("choose",t[40]),e.$on("back",t[41]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};64&n[0]&&(r.item=t[6]),262144&n[0]&&(r.className=t[18].class),1024&n[0]&&(r.classId=t[10]),1&n[0]&&(r.rowId=t[0]),4096&n[0]&&(r.recordId=t[12]),16&n[0]&&(r.viewName=t[4]),256&n[0]&&(r.multiValues=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_2$7(t){let e,n,r=t[19]&&create_if_block_2$a(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){t[19]?r?(r.p(t,n),524288&n[0]&&transition_in(r,1)):(r=create_if_block_2$a(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_if_block_1$i(t){let e,n,r;function o(e){t[58](e)}let i={class:"tModal",noClickaway:!0,$$slots:{default:[create_default_slot$g]},$$scope:{ctx:t}};return void 0!==t[20]&&(i.open=t[20]),e=new t[28]({props:i}),binding_callbacks.push(()=>bind(e,"open",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};2359297&r[0]|2048&r[2]&&(o.$$scope={dirty:r,ctx:t}),!n&&1048576&r[0]&&(n=!0,o.open=t[20],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_default_slot_1$b(t){let e,n;return e=new Index({props:{schema:t[18],recID:t[0],readonly:!0}}),e.$on("back",t[41]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};262144&n[0]&&(r.schema=t[18]),1&n[0]&&(r.recID=t[0]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot$g(t){let e,n;return e=new t[27]({props:{title:t[21],$$slots:{default:[create_default_slot_1$b]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};2097152&n[0]&&(r.title=t[21]),262145&n[0]|2048&n[2]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_pending_block$a(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_fragment$y(t){let e,n,r={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$a,then:create_then_block$a,catch:create_catch_block$a,value:72,blocks:[,,,]};return handle_promise(t[36](),r),{c(){e=empty(),r.block.c()},m(t,o){insert(t,e,o),r.block.m(t,r.anchor=o),r.mount=()=>e.parentNode,r.anchor=e,n=!0},p(e,n){update_await_block_branch(r,t=e,n)},i(t){n||(transition_in(r.block),n=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(r.blocks[t])}n=!1},d(t){t&&detach(e),r.block.d(t),r.token=null,r=null}}}function instance$y(t,e,n){let r,o,i,a;component_subscribe(t,currentRoles,t=>n(54,r=t));const s=createEventDispatcher(),{Dialog:c,Modal:l}=getAttractions,{currentTasks:d,environment:u,loggedIn:h}=user;component_subscribe(t,d,t=>n(60,o=t)),component_subscribe(t,u,t=>n(62,a=t)),component_subscribe(t,h,t=>n(61,i=t));let{id:m}=e,{item:f}=e,{fullRecord:p}=e,{value:_=""}=e,{multiValues:g}=e,{desc:w=""}=e,{noForm:$=!1}=e,{classId:y}=e,{eventId:b}=e,{recordId:v}=e,{withRefValue:I=!1}=e,{refValue:C=""}=e,{shortEdit:E}=e,{required:A}=e,{disabled:S}=e,{readonly:k}=e,{praefix:T}=e,{selectionFields:R}=e,{formnovalidate:N}=e,{selection:D}=e,{deList:x}=e,{isTemplate:O}=e,{noList:M=!1}=e,{multi:P=!1}=e,{initFinished:B}=e;const F="comment_"+m,L=f.filter;let q,V,H,U,z,W,j=!1,G=!0,X=!0,Q=!0,Y=!1,Z="";k||=v&&f.asInput,S||=k,!D&&f.selection&&1===f.selection.split(":").length&&(D=f.selection);const K=k||S||f.lookup||D&&!f.constraint?"":"Suchbegriff ⏎",J=()=>{f.refItem&&f.refItem.startsWith("owner")&&(n(46,C=a.owner[f.refClass]),C||n(46,C=((t,e)=>{try{return t.split(".").reduce((t,e)=>t[e],e)}catch(t){return""}})(f.refItem,a)),C&&(n(45,I=!0),s("change",{value:C})))},tt=async t=>{t.items.filter(t=>t.properties?.default).forEach(e=>{s("defPrep",{className:t.class,itemName:e.name,value:e.properties.default})})},et=async t=>{const e=()=>{n(19,j=!0)};if(9==t.which)return;if(_)return t.preventDefault();if(13!=t.which)return;t.preventDefault();const r=H.items.find(t=>t.properties?.search);if(!r)return e();const o=t.srcElement.value,{name:i,checkOn:a,refClass:s,properties:c}=r;let{search:l}=c;!0===l&&(l={}),"number"==typeof l&&(l={min:l});const{min:d=3,start:u=!1,end:h=!1}=l;if(o.length<d)return e();const m=(u?"^":"")+o+(h?"$":"");let f={[i]:{$regex:m,$options:"i"}};a&&(f=[{$lookup:{from:s,localField:i,foreignField:"_id",as:s}},{$match:{[s+"."+a]:{$regex:m,$options:"i"}}}]);const p=await Request.getSectionView(H.class,f);1!==p?.length?e():n(0,_=p[0]._id)},nt=t=>{t&&(n(53,Z=n(1,w=getRecordDescription(H,t))),s("setRefDesc",w.split(" •")[0]),s("change",{value:_,description:w}),s("task",{row:t,eventId:H.id}))},rt=()=>{n(19,j=!1),n(20,q=!1)};return t.$$set=t=>{"id"in t&&n(5,m=t.id),"item"in t&&n(6,f=t.item),"fullRecord"in t&&n(7,p=t.fullRecord),"value"in t&&n(0,_=t.value),"multiValues"in t&&n(8,g=t.multiValues),"desc"in t&&n(1,w=t.desc),"noForm"in t&&n(9,$=t.noForm),"classId"in t&&n(10,y=t.classId),"eventId"in t&&n(11,b=t.eventId),"recordId"in t&&n(12,v=t.recordId),"withRefValue"in t&&n(45,I=t.withRefValue),"refValue"in t&&n(46,C=t.refValue),"shortEdit"in t&&n(49,E=t.shortEdit),"required"in t&&n(2,A=t.required),"disabled"in t&&n(3,S=t.disabled),"readonly"in t&&n(48,k=t.readonly),"praefix"in t&&n(13,T=t.praefix),"selectionFields"in t&&n(14,R=t.selectionFields),"formnovalidate"in t&&n(50,N=t.formnovalidate),"selection"in t&&n(4,D=t.selection),"deList"in t&&n(15,x=t.deList),"isTemplate"in t&&n(16,O=t.isTemplate),"noList"in t&&n(51,M=t.noList),"multi"in t&&n(17,P=t.multi),"initFinished"in t&&n(47,B=t.initFinished)},t.$$.update=()=>{if(4&t.$$.dirty[0]|524288&t.$$.dirty[1]&&n(2,A=A&&!N),49152&t.$$.dirty[1]&&I&&n(0,_=C),3&t.$$.dirty[0]|4194304&t.$$.dirty[1]&&!w&&_&&Z&&n(1,w=Z),399425&t.$$.dirty[0]|1114112&t.$$.dirty[1]&&_&&H){let t=!1;if(!Array.isArray(_)){const e=f.properties?.prefetch?500:0;if(v||f.asInput||f.upate||!1!==f.refItem||!0===P||!1===f.refItem&&B)if(e){const e="p$"+f.refClass+"$"+b,n=getList2(e);n?n.then(t=>{const e=t.find(({_id:t})=>t===_);e?nt(e):getTask(f.refClass,H.id,_,!!f.lookup||M).then(nt)}):t=!0}else t=!0;t&&getTask(f.refClass,H.id,_,!!f.lookup||M).then(nt),n(47,B=!0)}}if(65&t.$$.dirty[0]|10485760&t.$$.dirty[1]&&_&&U&&f.name===U.input?.at(0)&&U.inputLookup?.length){const{domain:t}=U.inputLookup[0]||{};"user"===t&&(r.some(t=>U.authorization?.find(e=>e.role===t&&!e.constraint))||n(3,S=!0))}262145&t.$$.dirty[0]&&!_&&H&&nt({})},[_,w,A,S,D,m,f,p,g,$,y,b,v,T,R,x,O,P,H,j,q,V,z,G,X,Q,Y,c,l,d,u,h,F,L,K,()=>{if(!f.query)return;const[t,e]=f.query.split(".");if(!p[e])return;let n=[{$lookup:{from:t,localField:t,foreignField:"_id",as:"__"+t}},{$unwind:{path:"$__"+t,preserveNullAndEmptyArrays:!0}},{$match:{["__"+t+"."+e]:p[e]}}];return f.refStatus&&(n=n.concat([{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":f.refStatus}}])),n},async()=>{try{const t=await Request.getEvent(b);if(W="report"===t.output.type,n(24,X=!f.asInput),n(23,G=t.output?.class[0].name!==f.refClass),n(18,H=await Request.getSchemaByClass(f.refClass)),H?.blocked)return s("initFail",!0),!1;if(W||n(26,Y=((t,e)=>{let n=e.items.find(t=>!!t.properties?.blocking);if(!n)return!1;if(t.input?.class?.find(t=>t.name===e.class))return n.name;const r=t.output?.class.at(0)?.list||[];for(const t of r){const e=t.item.find(t=>t.name===f.name);if(e?.properties?.blocking)return n.name}return!1})(t,H)),tt(H),n(22,z=(t=>!o?.length||!!o.find(e=>e===t))(H.id)),n(52,U=await Request.getSchema(b)),b&&v&&_&&!S&&U.input?.find(t=>t===f.refClass)&&n(3,S=!0),t.input?.class&&t.input.class[0]&&(t.input.class[0].name===f.refClass&&t.input.class[0].readonly&&n(3,S=!0),v&&t.input.class[0].name===f.refClass&&t.input.class[0].writeState)){(await Request.getTaskByDocId(v,!0)).status===t.input.class[0].writeState&&n(3,S=n(48,k=!1))}if(f.properties?.query?.lookup){const{domain:t,value:e}=f.properties.query.lookup;if("user"===t){const t=i.user,o={[e]:t},a=await Request.getSectionView(f.refClass,o);if(a?.length){const[{_id:t}]=a;t&&(n(46,C=t),n(45,I=!0),s("change",{value:C}))}r.some(t=>H.authorization?.find(e=>e.role===t&&!e.constraint))||n(3,S=!0)}}else J();if(!C&&f.filter&&(""===T||void 0===T)){const t=f.filter,e=!0;t.startsWith("!")&&(e=!1,t=t.slice(1));const r=await Request.getOneAndOnly(f.refClass,{[f.filter]:e});r&&(n(46,C=r._id),n(45,I=!0),s("change",{value:C}))}return n(21,V=H.identity.designation),!0}catch{return s("initFail",!0),!1}},t=>e=>{if(e.stopPropagation(),!0===t&&n(19,j=!0),t&&"BUTTON"===e.explicitOriginalTarget?.nodeName){const e=document.getElementById(t);return e?.blur()}(f.lookup||D&&!f.constraint||_)&&n(19,j=!0)},et,()=>{if(_)return"";const t=document.getElementById(F);return n(1,w=""),t?.value||""},({detail:t})=>{n(0,_=t.row._id),rt()},rt,()=>{(W||z)&&(P?s("change",{value:_,delete:!0}):(n(0,_=""),n(1,w=""),n(25,Q=!0),s("change",{value:_,description:w}),s("task",{row:{_task:{event:H.id,_id:!1}}})))},async()=>{if(!_)return;let t=await getTask(f.refClass,H.id,_);t._task||(t={_task:await Request.getTaskByDocId(_,!0)});const e=t._task.task_id||t._task._id,n=`/task/${t._task.event}/${e}/task?view=standalone`;window.open(n)},t=>{_||w&&et({which:13,preventDefault:()=>{},srcElement:{value:w}})},I,C,B,k,E,N,M,U,Z,r,function(t){w=t,n(1,w),n(0,_),n(53,Z),n(45,I),n(46,C)},function(t){Q=t,n(25,Q)},function(t){j=t,n(19,j)},function(t){q=t,n(20,q)}]}class InputReference extends SvelteComponent{constructor(t){super(),document_1$e.getElementById("svelte-jox15l-style")||add_css$u(),init(this,t,instance$y,create_fragment$y,safe_not_equal,{id:5,item:6,fullRecord:7,value:0,multiValues:8,desc:1,noForm:9,classId:10,eventId:11,recordId:12,withRefValue:45,refValue:46,shortEdit:49,required:2,disabled:3,readonly:48,praefix:13,selectionFields:14,formnovalidate:50,selection:4,deList:15,isTemplate:16,noList:51,multi:17,initFinished:47},[-1,-1,-1])}}function add_css$t(){var t=element("style");t.id="svelte-1m792ni-style",t.textContent=".field .card{padding:1em !important;margin-bottom:1em !important}",append(document.head,t)}function get_each_context$c(t,e,n){const r=t.slice();return r[40]=e[n],r[42]=n,r}function create_catch_block$9(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$9(t){let e,n;return e=new t[16]({props:{outline:!0,$$slots:{default:[create_default_slot_3$2]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};8191&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_1$h(t){let e,n,r,o,i;return n=new ListIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",function(){is_function(t[22](t[0]))&&t[22](t[0]).apply(this,arguments)}),o=!0)},p(e,n){t=e},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_each_block$c(t){let e,n;return e=new InputReference({props:{classId:t[6],eventId:t[7],required:t[9],disabled:t[1],formnovalidate:t[12],readonly:t[10],id:t[2]+"."+t[42],item:t[3],desc:t[4],value:t[40],noForm:t[5],praefix:t[11],recordId:t[8],multi:!0}}),e.$on("change",t[24]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};64&n[0]&&(r.classId=t[6]),128&n[0]&&(r.eventId=t[7]),512&n[0]&&(r.required=t[9]),2&n[0]&&(r.disabled=t[1]),4096&n[0]&&(r.formnovalidate=t[12]),1024&n[0]&&(r.readonly=t[10]),4&n[0]&&(r.id=t[2]+"."+t[42]),8&n[0]&&(r.item=t[3]),16&n[0]&&(r.desc=t[4]),1&n[0]&&(r.value=t[40]),32&n[0]&&(r.noForm=t[5]),2048&n[0]&&(r.praefix=t[11]),256&n[0]&&(r.recordId=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_3$2(t){let e,n,r,o=!t[10]&&create_if_block_1$h(t),i=[].concat(t[0]),a=[];for(let e=0;e<i.length;e+=1)a[e]=create_each_block$c(get_each_context$c(t,i,e));const s=t=>transition_out(a[t],1,1,()=>{a[t]=null});return{c(){o&&o.c(),e=space();for(let t=0;t<a.length;t+=1)a[t].c();n=empty()},m(t,i){o&&o.m(t,i),insert(t,e,i);for(let e=0;e<a.length;e+=1)a[e].m(t,i);insert(t,n,i),r=!0},p(t,r){if(t[10]?o&&(group_outros(),transition_out(o,1,1,()=>{o=null}),check_outros()):o?(o.p(t,r),1024&r[0]&&transition_in(o,1)):(o=create_if_block_1$h(t),o.c(),transition_in(o,1),o.m(e.parentNode,e)),16785407&r[0]){let e;for(i=[].concat(t[0]),e=0;e<i.length;e+=1){const o=get_each_context$c(t,i,e);a[e]?(a[e].p(o,r),transition_in(a[e],1)):(a[e]=create_each_block$c(o),a[e].c(),transition_in(a[e],1),a[e].m(n.parentNode,n))}for(group_outros(),e=i.length;e<a.length;e+=1)s(e);check_outros()}},i(t){if(!r){transition_in(o);for(let t=0;t<i.length;t+=1)transition_in(a[t]);r=!0}},o(t){transition_out(o),a=a.filter(Boolean);for(let t=0;t<a.length;t+=1)transition_out(a[t]);r=!1},d(t){o&&o.d(t),t&&detach(e),destroy_each(a,t),t&&detach(n)}}}function create_pending_block$9(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_if_block$t(t){let e,n;return e=new t[18]({props:{title:t[14].designation,class:"eList",$$slots:{default:[create_default_slot_1$a]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};16384&n[0]&&(r.title=t[14].designation),49480&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_2$6(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_1$a(t){let e,n,r,o,i;return n=new t[19]({props:{outline:!0,$$slots:{default:[create_default_slot_2$6]},$$scope:{ctx:t}}}),n.$on("click",t[25]),o=new List$1({props:{item:t[3],className:t[14].class,classId:t[6],rowId:t[15],recordId:t[8],inputList:t[21]()}}),o.$on("choose",t[23]),o.$on("back",t[25]),{c(){e=element("div"),create_component(n.$$.fragment),r=space(),create_component(o.$$.fragment),attr(e,"class","form--buttons")},m(t,a){insert(t,e,a),mount_component(n,e,null),insert(t,r,a),mount_component(o,t,a),i=!0},p(t,e){const r={};4096&e[1]&&(r.$$scope={dirty:e,ctx:t}),n.$set(r);const i={};8&e[0]&&(i.item=t[3]),16384&e[0]&&(i.className=t[14].class),64&e[0]&&(i.classId=t[6]),32768&e[0]&&(i.rowId=t[15]),256&e[0]&&(i.recordId=t[8]),o.$set(i)},i(t){i||(transition_in(n.$$.fragment,t),transition_in(o.$$.fragment,t),i=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(o.$$.fragment,t),i=!1},d(t){t&&detach(e),destroy_component(n),t&&detach(r),destroy_component(o,t)}}}function create_default_slot$f(t){let e,n,r=t[13]&&create_if_block$t(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){t[13]?r?(r.p(t,n),8192&n[0]&&transition_in(r,1)):(r=create_if_block$t(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_fragment$x(t){let e,n,r,o,i={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$9,then:create_then_block$9,catch:create_catch_block$9,value:39,blocks:[,,,]};function a(e){t[34](e)}handle_promise(t[20](),i);let s={class:"tModal",noClickaway:!0,$$slots:{default:[create_default_slot$f]},$$scope:{ctx:t}};return void 0!==t[13]&&(s.open=t[13]),n=new t[17]({props:s}),binding_callbacks.push(()=>bind(n,"open",a)),{c(){i.block.c(),e=space(),create_component(n.$$.fragment)},m(t,r){i.block.m(t,i.anchor=r),i.mount=()=>e.parentNode,i.anchor=e,insert(t,e,r),mount_component(n,t,r),o=!0},p(e,o){update_await_block_branch(i,t=e,o);const a={};57672&o[0]|4096&o[1]&&(a.$$scope={dirty:o,ctx:t}),!r&&8192&o[0]&&(r=!0,a.open=t[13],add_flush_callback(()=>r=!1)),n.$set(a)},i(t){o||(transition_in(i.block),transition_in(n.$$.fragment,t),o=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(i.blocks[t])}transition_out(n.$$.fragment,t),o=!1},d(t){i.block.d(t),i.token=null,i=null,t&&detach(e),destroy_component(n,t)}}}function instance$x(t,e,n){const r=createEventDispatcher(),{Card:o,Modal:i,Dialog:a,Button:s}=getAttractions;let c,l,{id:d}=e,{item:u}=e,{record:h}=e,{values:m=[]}=e,{desc:f=""}=e,{noForm:p=!1}=e,{classId:_}=e,{eventId:g}=e,{recordId:w}=e,{withRefValue:$=!1}=e,{refValue:y=""}=e,{required:b}=e,{disabled:v}=e,{readonly:I}=e,{praefix:C}=e,{selectionFields:E}=e,{formnovalidate:A}=e,{selection:S}=e,{deList:k}=e,{isTemplate:T}=e,{noList:R=!1}=e,N=!1;const{lookup:D,filter:x,constraint:O}=u.properties.multi;v=!0;const M=()=>{n(13,N=!1)};return t.$$set=t=>{"id"in t&&n(2,d=t.id),"item"in t&&n(3,u=t.item),"record"in t&&n(26,h=t.record),"values"in t&&n(0,m=t.values),"desc"in t&&n(4,f=t.desc),"noForm"in t&&n(5,p=t.noForm),"classId"in t&&n(6,_=t.classId),"eventId"in t&&n(7,g=t.eventId),"recordId"in t&&n(8,w=t.recordId),"withRefValue"in t&&n(27,$=t.withRefValue),"refValue"in t&&n(28,y=t.refValue),"required"in t&&n(9,b=t.required),"disabled"in t&&n(1,v=t.disabled),"readonly"in t&&n(10,I=t.readonly),"praefix"in t&&n(11,C=t.praefix),"selectionFields"in t&&n(29,E=t.selectionFields),"formnovalidate"in t&&n(12,A=t.formnovalidate),"selection"in t&&n(30,S=t.selection),"deList"in t&&n(31,k=t.deList),"isTemplate"in t&&n(32,T=t.isTemplate),"noList"in t&&n(33,R=t.noList)},[m,v,d,u,f,p,_,g,w,b,I,C,A,N,c,l,o,i,a,s,async()=>{n(0,m=[].concat(m)),n(14,c=await Request.getSchemaByClass(u.refClass))},async()=>{let t=await getList(c.class,c.id);if(!t?.length)return[];if(D&&(t=t.filter(t=>h[D]===t[D])),O&&t?.length){const{refClass:e,refStatus:n}=O,r=[{$match:{[c.class]:{$in:t.map(({_id:t})=>t)}}},{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":n}}],o=await Request.getSectionView(e,r);t=t.filter(t=>!!o.find(e=>e.project==t._id))}if(x)for(const e in x)t=t.filter(t=>{let[n,r]=e.split(".");if(r||(r=n,n=""),n){if(t[n][0]&&t[n][0][r].length)return!0}else if(t[r])return!0;return!1});return t},t=>()=>{I||(t=[].concat(t),n(13,N=!0),n(15,l=t))},({detail:t})=>{const e=t.row._id;n(0,m=[].concat(m)),Array.isArray(m)&&!m.find(t=>t===e)&&n(0,m=m.concat(t.row._id)),M()},({detail:t})=>{n(0,m=[].concat(m)),t.delete&&n(0,m=m.filter(e=>e!==t.value)),t.value=m,r("change",t),r("multi",{lookup:D,filter:x,name:u.name,value:m})},M,h,$,y,E,S,k,T,R,function(t){N=t,n(13,N)}]}class InputReferenceMulti extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-1m792ni-style")||add_css$t(),init(this,t,instance$x,create_fragment$x,safe_not_equal,{id:2,item:3,record:26,values:0,desc:4,noForm:5,classId:6,eventId:7,recordId:8,withRefValue:27,refValue:28,required:9,disabled:1,readonly:10,praefix:11,selectionFields:29,formnovalidate:12,selection:30,deList:31,isTemplate:32,noList:33},[-1,-1])}}const numberRegex=/\d+/g,formatSpecifierRegex=/%[HMSpPdmyY%]/g;function parseDateTime(t,e,n){const r=Math.floor((new Date).getFullYear()/100);let o=!1;if(""===t)return null;const i=e.split(formatSpecifierRegex);let a=0,s=0;const c=new Date(0);for(const l of i){if(!t.startsWith(l,a))return n;if(a+=l.length,a===t.length){if(s!==e.length)return n;break}if("%"!==e[s+l.length])break;if(s+=l.length+1,"%"===e[s]){if("%"!==t[a])return n;a++}else if("p"===e[s].toLowerCase()){const e=t.substr(a,2).toUpperCase();if("AM"===e)o=!1,c.getHours()>=12&&c.setHours(c.getHours()-12);else{if("PM"!==e)return n;o=!0,c.getHours()<12&&c.setHours(c.getHours()+12)}}else{numberRegex.lastIndex=a;const i=numberRegex.exec(t);if(null==i)return n;switch(e[s]){case"H":c.setHours(parseInt(i[0])+12*o);break;case"M":c.setMinutes(i[0]);break;case"S":c.setSeconds(i[0]);break;case"d":c.setDate(i[0]);break;case"m":c.setMonth(i[0]-1);break;case"y":c.setFullYear(100*r+parseInt(i[0]));break;case"Y":c.setFullYear(i[0])}a+=i[0].length}s++}return isNaN(c.valueOf())?n:c}function formatDateTime(t,e){if(null==t)return null;let n=t.getHours();return/%p/i.test(e)&&(n%=12,0===n&&(n=12)),e.replace("%Y",t.getFullYear()).replace("%y",(t.getFullYear()%100).toString().padStart(2,"0")).replace("%m",(t.getMonth()+1).toString().padStart(2,"0")).replace("%d",t.getDate().toString().padStart(2,"0")).replace("%H",n.toString().padStart(2,"0")).replace("%M",t.getMinutes().toString().padStart(2,"0")).replace("%S",t.getSeconds().toString().padStart(2,"0")).replace("%p",t.getHours()<12?"am":"pm").replace("%P",t.getHours()<12?"AM":"PM").replace("%%","%")}function applyDate(t,e){return null==t||null==e?t:(e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e)}function applyTime(t,e){return null==t||null==e?t:(e.setHours(t.getHours(),t.getMinutes(),t.getSeconds()),e)}const{document:document_1$d}=globals;function add_css$s(){var t=element("style");t.id="svelte-1phofh5-style",t.textContent="form.svelte-1phofh5.svelte-1phofh5{min-width:25em}@media only screen and (min-width: 600px){form.svelte-1phofh5.svelte-1phofh5{min-width:30em}}.fEmbedded.svelte-1phofh5.svelte-1phofh5,.fTask.svelte-1phofh5.svelte-1phofh5{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-1phofh5.svelte-1phofh5{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-1phofh5.svelte-1phofh5{height:fit-content;max-height:70vh}.sTask.svelte-1phofh5.svelte-1phofh5{height:95%;display:inline-grid;min-width:40em}.sTask.svelte-1phofh5 .btn.svelte-1phofh5{display:initial !important}.form--buttons.svelte-1phofh5.svelte-1phofh5{display:flex;gap:1em;padding-bottom:0.5em}",append(document_1$d.head,t)}function get_each_context$b(t,e,n){const r=t.slice();return r[17]=e[n],r}function get_each_context_1$7(t,e,n){const r=t.slice();return r[20]=e[n],r}function create_catch_block$8(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$8(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f=t[0].items,p=[];for(let e=0;e<f.length;e+=1)p[e]=create_each_block_1$7(get_each_context_1$7(t,f,e));const _=t=>transition_out(p[t],1,1,()=>{p[t]=null});let g=t[0].list&&create_if_block$s(t);return c=new t[5]({props:{outline:!0,$$slots:{default:[create_default_slot_1$9]},$$scope:{ctx:t}}}),c.$on("click",t[9]),d=new t[5]({props:{disabled:t[2],class:"close",form:t[6],filled:!0,type:"submit",$$slots:{default:[create_default_slot$e]},$$scope:{ctx:t}}}),{c(){e=element("form"),n=element("input"),o=space();for(let t=0;t<p.length;t+=1)p[t].c();i=space(),g&&g.c(),a=space(),s=element("div"),create_component(c.$$.fragment),l=space(),create_component(d.$$.fragment),attr(n,"class",null_to_empty(t[6])+" svelte-1phofh5"),attr(n,"name","_id"),attr(n,"type","hidden"),n.value=r=t[1]._id||"",attr(e,"class","fTask svelte-1phofh5"),attr(e,"id",t[6]),attr(s,"class","form--buttons svelte-1phofh5")},m(r,f){insert(r,e,f),append(e,n),append(e,o);for(let t=0;t<p.length;t+=1)p[t].m(e,null);append(e,i),g&&g.m(e,null),insert(r,a,f),insert(r,s,f),mount_component(c,s,null),append(s,l),mount_component(d,s,null),u=!0,h||(m=[listen(e,"keydown",t[8]),listen(e,"submit",prevent_default(t[10]))],h=!0)},p(t,o){if((!u||2&o&&r!==(r=t[1]._id||""))&&(n.value=r),75&o){let n;for(f=t[0].items,n=0;n<f.length;n+=1){const r=get_each_context_1$7(t,f,n);p[n]?(p[n].p(r,o),transition_in(p[n],1)):(p[n]=create_each_block_1$7(r),p[n].c(),transition_in(p[n],1),p[n].m(e,i))}for(group_outros(),n=f.length;n<p.length;n+=1)_(n);check_outros()}t[0].list?g?(g.p(t,o),1&o&&transition_in(g,1)):(g=create_if_block$s(t),g.c(),transition_in(g,1),g.m(e,null)):g&&(group_outros(),transition_out(g,1,1,()=>{g=null}),check_outros());const a={};8388608&o&&(a.$$scope={dirty:o,ctx:t}),c.$set(a);const s={};4&o&&(s.disabled=t[2]),8388608&o&&(s.$$scope={dirty:o,ctx:t}),d.$set(s)},i(t){if(!u){for(let t=0;t<f.length;t+=1)transition_in(p[t]);transition_in(g),transition_in(c.$$.fragment,t),transition_in(d.$$.fragment,t),u=!0}},o(t){p=p.filter(Boolean);for(let t=0;t<p.length;t+=1)transition_out(p[t]);transition_out(g),transition_out(c.$$.fragment,t),transition_out(d.$$.fragment,t),u=!1},d(t){t&&detach(e),destroy_each(p,t),g&&g.d(),t&&detach(a),t&&detach(s),destroy_component(c),destroy_component(d),h=!1,run_all(m)}}}function create_if_block_1$g(t){let e,n;return e=new InputFormField({props:{classId:t[6],item:t[20],selection:t[20].selection,record:t[1],disabled:t[3],eventId:t[0].id,required:!1,isTemplate:!0}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1&n&&(r.item=t[20]),1&n&&(r.selection=t[20].selection),2&n&&(r.record=t[1]),8&n&&(r.disabled=t[3]),1&n&&(r.eventId=t[0].id),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_each_block_1$7(t){let e,n,r=checkType(!0,t[20]),o=r&&create_if_block_1$g(t);return{c(){o&&o.c(),e=empty()},m(t,r){o&&o.m(t,r),insert(t,e,r),n=!0},p(t,n){1&n&&(r=checkType(!0,t[20])),r?o?(o.p(t,n),1&n&&transition_in(o,1)):(o=create_if_block_1$g(t),o.c(),transition_in(o,1),o.m(e.parentNode,e)):o&&(group_outros(),transition_out(o,1,1,()=>{o=null}),check_outros())},i(t){n||(transition_in(o),n=!0)},o(t){transition_out(o),n=!1},d(t){o&&o.d(t),t&&detach(e)}}}function create_if_block$s(t){let e,n,r=t[0].list,o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block$b(get_each_context$b(t,r,e));const i=t=>transition_out(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=empty()},m(t,r){for(let e=0;e<o.length;e+=1)o[e].m(t,r);insert(t,e,r),n=!0},p(t,n){if(75&n){let a;for(r=t[0].list,a=0;a<r.length;a+=1){const i=get_each_context$b(t,r,a);o[a]?(o[a].p(i,n),transition_in(o[a],1)):(o[a]=create_each_block$b(i),o[a].c(),transition_in(o[a],1),o[a].m(e.parentNode,e))}for(group_outros(),a=r.length;a<o.length;a+=1)i(a);check_outros()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)transition_out(o[t]);n=!1},d(t){destroy_each(o,t),t&&detach(e)}}}function create_each_block$b(t){let e,n,r,o;return e=new t[4]({props:{text:t[17].designation}}),r=new InputObject({props:{classId:t[6],list:t[17],eventId:t[0].id,schema:t[17].item,record:t[1],disabled:t[3],required:!1,open:!0,isTemplate:!0}}),{c(){create_component(e.$$.fragment),n=space(),create_component(r.$$.fragment)},m(t,i){mount_component(e,t,i),insert(t,n,i),mount_component(r,t,i),o=!0},p(t,n){const o={};1&n&&(o.text=t[17].designation),e.$set(o);const i={};1&n&&(i.list=t[17]),1&n&&(i.eventId=t[0].id),1&n&&(i.schema=t[17].item),2&n&&(i.record=t[1]),8&n&&(i.disabled=t[3]),r.$set(i)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(r.$$.fragment,t),o=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(r.$$.fragment,t),o=!1},d(t){destroy_component(e,t),t&&detach(n),destroy_component(r,t)}}}function create_default_slot_1$9(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot$e(t){let e;return{c(){e=text("Speichern")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_pending_block$8(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_fragment$w(t){let e,n,r,o={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$8,then:create_then_block$8,catch:create_catch_block$8,value:16,blocks:[,,,]};return handle_promise(t[7](),o),{c(){e=space(),n=element("section"),o.block.c(),document_1$d.title="Vorgaben",attr(n,"class","sTask svelte-1phofh5")},m(t,i){insert(t,e,i),insert(t,n,i),o.block.m(n,o.anchor=null),o.mount=()=>n,o.anchor=null,r=!0},p(e,[n]){update_await_block_branch(o,t=e,n)},i(t){r||(transition_in(o.block),r=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(o.blocks[t])}r=!1},d(t){t&&detach(e),t&&detach(n),o.block.d(),o.token=null,o=null}}}const checkType=(t,{type:e="",properties:n={}})=>!t||"list"!==e&&("time"===n.format&&(e="time"),!["date","datetime","time"].includes(e)&&(!n.readonly&&!n.hidden));function instance$w(t,e,n){let r,o,i;component_subscribe(t,settings,t=>n(11,o=t)),component_subscribe(t,currentRoles,t=>n(12,i=t));const{Divider:a,Button:s,FormField:c}=getAttractions,l=JSON.parse(Storage.getItem("Locale"));let{schema:d}=e,{record:u}=e,h="template-"+d.class+Math.floor(9e3*Math.random()+1e3).toString(),m=!1;const f=()=>window.history.back(),p=(t,e,n=!1)=>{const r=e.id,o=t.find(t=>t.name===r);let i=e.value;if(!n&&o&&o.properties?.multi&&(i=u[r]),i&&o&&o.type.startsWith("date"))try{return parseDateTime(i,"%d.%m.%Y").toISOString()}catch{return new Date(i).toISOString()}if(o&&"boolean"===o.type&&(i=!!e.checked),o&&"number"===o.type){const t=Number("1.1").toLocaleString(l.id).substring(1,2);try{i=Number(i.replace(t,".")).toString()}catch{}}return i};return t.$$set=t=>{"schema"in t&&n(0,d=t.schema),"record"in t&&n(1,u=t.record)},t.$$.update=()=>{4&t.$$.dirty&&n(3,r=m)},[d,u,m,r,a,s,h,async()=>{const t=await Request.getEvent(d.id);if(t.trigger?.startOn&&!t.trigger?.startOn?.some(t=>"Manual"===t.type)&&n(2,m=!0),o.role?.length&&d.authorization?.length){const t=d.authorization.some(t=>i?.find(e=>e===t.role&&"edit"===t.activity));n(2,m||=!t)}},t=>{"button"!==t.srcElement?.type&&"textarea"!==t.srcElement?.type&&13==t.which&&t.preventDefault()},f,async t=>{const e={};Array.from(document.querySelectorAll("form#"+h+" ."+h)).map(t=>{const n=t.id||t.name;if(n)if(n.includes(".")){const[r,o]=n.split("."),i=d.list.find(t=>t.name===r);e[n]=p(i.item,t)}else e[n]=p(d.items,t)}),await Request.saveTemplate(d.class,e),toasts.success("Die Vorgaben wurden gespeichert.",2e3),f()}]}class Template$1 extends SvelteComponent{constructor(t){super(),document_1$d.getElementById("svelte-1phofh5-style")||add_css$s(),init(this,t,instance$w,create_fragment$w,safe_not_equal,{schema:0,record:1})}}const{document:document_1$c}=globals;function add_css$r(){var t=element("style");t.id="svelte-148ktt9-style",t.textContent=".accordion.svelte-148ktt9{display:flex}.formList .accordion > .btn{display:inline-block;width:97%;margin-bottom:1em;background-color:#F5F5F5}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}",append(document_1$c.head,t)}function get_each_context$a(t,e,n){const r=t.slice();return r[28]=e[n],r}function create_if_block$r(t){let e,n;return e=new InputFormField({props:{classId:t[2],item:t[28],listName:t[1].name,eventId:t[3],record:t[0],disabled:t[4],required:t[5],currency:t[8]}}),e.$on("notify",t[14]),e.$on("defPrep",t[16]),e.$on("task",t[21]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4&n[0]&&(r.classId=t[2]),2&n[0]&&(r.item=t[28]),2&n[0]&&(r.listName=t[1].name),8&n[0]&&(r.eventId=t[3]),1&n[0]&&(r.record=t[0]),16&n[0]&&(r.disabled=t[4]),32&n[0]&&(r.required=t[5]),256&n[0]&&(r.currency=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_each_block$a(t){let e,n,r=checkType(t[7],t[28]),o=r&&create_if_block$r(t);return{c(){o&&o.c(),e=empty()},m(t,r){o&&o.m(t,r),insert(t,e,r),n=!0},p(t,n){130&n[0]&&(r=checkType(t[7],t[28])),r?o?(o.p(t,n),130&n[0]&&transition_in(o,1)):(o=create_if_block$r(t),o.c(),transition_in(o,1),o.m(e.parentNode,e)):o&&(group_outros(),transition_out(o,1,1,()=>{o=null}),check_outros())},i(t){n||(transition_in(o),n=!0)},o(t){transition_out(o),n=!1},d(t){o&&o.d(t),t&&detach(e)}}}function create_default_slot_2$5(t){let e,n,r,o=t[1].item,i=[];for(let e=0;e<o.length;e+=1)i[e]=create_each_block$a(get_each_context$a(t,o,e));const a=t=>transition_out(i[t],1,1,()=>{i[t]=null});return{c(){e=element("div");for(let t=0;t<i.length;t+=1)i[t].c();attr(e,"id",n=`accordion-content-${t[2]}-${t[1].name}`)},m(t,n){insert(t,e,n);for(let t=0;t<i.length;t+=1)i[t].m(e,null);r=!0},p(t,s){if(82367&s[0]){let n;for(o=t[1].item,n=0;n<o.length;n+=1){const r=get_each_context$a(t,o,n);i[n]?(i[n].p(r,s),transition_in(i[n],1)):(i[n]=create_each_block$a(r),i[n].c(),transition_in(i[n],1),i[n].m(e,null))}for(group_outros(),n=o.length;n<i.length;n+=1)a(n);check_outros()}(!r||6&s[0]&&n!==(n=`accordion-content-${t[2]}-${t[1].name}`))&&attr(e,"id",n)},i(t){if(!r){for(let t=0;t<o.length;t+=1)transition_in(i[t]);r=!0}},o(t){i=i.filter(Boolean);for(let t=0;t<i.length;t+=1)transition_out(i[t]);r=!1},d(t){t&&detach(e),destroy_each(i,t)}}}function create_default_slot_1$8(t){let e,n,r=t[13](t[9])+"";return{c(){e=element("span"),n=text(r)},m(t,r){insert(t,e,r),append(e,n)},p(t,e){512&e[0]&&r!==(r=t[13](t[9])+"")&&set_data(n,r)},d(t){t&&detach(e)}}}function create_handle_slot$1(t){let e,n,r;return n=new t[10]({props:{$$slots:{default:[create_default_slot_1$8]},$$scope:{ctx:t}}}),n.$on("click",function(){is_function(t[15](t[27]))&&t[15](t[27]).apply(this,arguments)}),{c(){e=element("div"),create_component(n.$$.fragment),attr(e,"class","accordion svelte-148ktt9"),attr(e,"slot","handle")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p(e,r){t=e;const o={};512&r[0]|1&r[1]&&(o.$$scope={dirty:r,ctx:t}),n.$set(o)},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_default_slot$d(t){let e,n;return e=new t[12]({props:{open:t[6],$$slots:{handle:[create_handle_slot$1,({toggle:t})=>({27:t}),({toggle:t})=>[t?134217728:0]],default:[create_default_slot_2$5,({toggle:t})=>({27:t}),({toggle:t})=>[t?134217728:0]]},$$scope:{ctx:t}}}),e.$on("panel-open",t[17]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};64&n[0]&&(r.open=t[6]),134218687&n[0]|1&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$v(t){let e,n,r;return n=new t[11]({props:{$$slots:{default:[create_default_slot$d]},$$scope:{ctx:t}}}),{c(){e=element("div"),create_component(n.$$.fragment),attr(e,"class","formList")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p(t,e){const r={};1023&e[0]|1&e[1]&&(r.$$scope={dirty:e,ctx:t}),n.$set(r)},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function instance$v(t,e,n){const{Button:r,Accordion:o,AccordionSection:i}=getAttractions;let{list:a}=e,{schema:s}=e,{record:c}=e,{classId:l}=e,{eventId:d}=e,{disabled:u}=e,{required:h}=e,{open:m=!1}=e,{template:f={}}=e,{isTemplate:p=!1}=e,{currency:_}=e,{update:g=!1}=e,w=new Map;const $={};let y=c[a.name]||{};c[a.name]=y;const b=t=>$[t]?.split(" • ").filter(t=>!!t).slice(0,2).join(" · "),v=t=>{if(!t)return;const{style:e,scrollHeight:n}=t;n&&(e.height=`${n}px`)};return t.$$set=t=>{"list"in t&&n(1,a=t.list),"schema"in t&&n(18,s=t.schema),"record"in t&&n(0,c=t.record),"classId"in t&&n(2,l=t.classId),"eventId"in t&&n(3,d=t.eventId),"disabled"in t&&n(4,u=t.disabled),"required"in t&&n(5,h=t.required),"open"in t&&n(6,m=t.open),"template"in t&&n(19,f=t.template),"isTemplate"in t&&n(7,p=t.isTemplate),"currency"in t&&n(8,_=t.currency),"update"in t&&n(20,g=t.update)},t.$$.update=()=>{1048579&t.$$.dirty[0]&&g&&c&&n(9,y=c[a.name]||{})},[c,a,l,d,u,h,m,p,_,y,r,o,i,t=>s.filter(e=>void 0!==t[e.name]&&"textarea"!==e.properties?.format&&"html"!==e.properties?.format).map(e=>"object"===e.type?b(e.name):"boolean"===e.type?checkBoolean(t[e.name]):"date"===e.type?checkDate(t[e.name]):"datetime"===e.type?checkDateTime(t[e.name]):t[e.name]).filter(t=>!!t).join(" • ")||"+",({detail:t})=>{const[e,r]=t.itemName.split(".");if(!r)return;t.desc&&($[r]=t.desc);const o=c[e];n(0,c[e]={...o,[r]:t.value},c),n(9,y=c[e])},t=>e=>{(()=>{const t=f[a.name]||{};for(const e in t)f[a.name][e]&&!c[a.name][e]&&n(0,c[a.name][e]=f[a.name][e],c)})(),t(e);const r=`#accordion-content-${l}-${a.name} > div.form-field:last-child`,o=document.querySelector(r);tick().then(()=>{const t=`#accordion-content-${l}-${a.name} textarea`;Array.from(document.querySelectorAll(t)).forEach(v)}).then(()=>o.scrollIntoView({behavior:"smooth",block:"end"}))},async({detail:{className:t,itemName:e,value:n}})=>{if(w.has(t))return;if(!0!==n&&(n=(n=[].concat(n)).some(t=>t===className+"."+a.name)),!n)return;const r={[e]:!0},o=await Request.getSectionView(t,r);o?.length&&w.set(t,o[0])},()=>{setTimeout(()=>{Array.from(w).forEach(([t,e])=>{c[a.name][t]||n(0,c[a.name][t]=e._id,c)})},500)},s,f,g,function(e){bubble(t,e)}]}class InputObject extends SvelteComponent{constructor(t){super(),document_1$c.getElementById("svelte-148ktt9-style")||add_css$r(),init(this,t,instance$v,create_fragment$v,safe_not_equal,{list:1,schema:18,record:0,classId:2,eventId:3,disabled:4,required:5,open:6,template:19,isTemplate:7,currency:8,update:20},[-1,-1])}}const{document:document_1$b}=globals;function add_css$q(){var t=element("style");t.id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",append(document_1$b.head,t)}function get_then_context$2(t){t[0]=t[23].list,t[22]=t[23].items}function get_each_context$9(t,e,n){const r=t.slice();return r[24]=e[n],r}function get_each_context_1$6(t,e,n){const r=t.slice();return r[27]=e[n],r}function get_each_context_2$4(t,e,n){const r=t.slice();return r[27]=e[n],r}function create_catch_block$7(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$7(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w;function $(e){t[19](e)}get_then_context$2(t),n=new t[7]({props:{outline:!0,$$slots:{default:[create_default_slot_1$7]},$$scope:{ctx:t}}}),n.$on("click",t[18]);let y={id:t[8]};void 0!==t[1]&&(y.value=t[1]),a=new t[6]({props:y}),binding_callbacks.push(()=>bind(a,"value",$)),a.$on("input",t[12]),d=new DeleteIcon({props:{size:"18"}});let b=t[22]?.length&&create_if_block_2$9(t),v=t[0]?.length&&create_if_block$q(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),o=element("div"),i=text("Suchen: "),create_component(a.$$.fragment),c=space(),l=element("span"),create_component(d.$$.fragment),u=space(),h=element("div"),m=element("table"),b&&b.c(),f=space(),p=element("tbody"),v&&v.c(),attr(e,"class","form--buttons svelte-14hcfjl"),attr(l,"class","feather pointer svelte-14hcfjl"),set_style(o,"margin-bottom","1em"),set_style(o,"position","relative"),attr(m,"striped",""),attr(m,"class","svelte-14hcfjl"),attr(h,"class","eList svelte-14hcfjl")},m(s,$){insert(s,e,$),mount_component(n,e,null),insert(s,r,$),insert(s,o,$),append(o,i),mount_component(a,o,null),append(o,c),append(o,l),mount_component(d,l,null),insert(s,u,$),insert(s,h,$),append(h,m),b&&b.m(m,null),append(m,f),append(m,p),v&&v.m(p,null),_=!0,g||(w=listen(l,"click",t[14]),g=!0)},p(t,e){get_then_context$2(t);const r={};2&e[1]&&(r.$$scope={dirty:e,ctx:t}),n.$set(r);const o={};!s&&2&e[0]&&(s=!0,o.value=t[1],add_flush_callback(()=>s=!1)),a.$set(o),t[22]?.length&&b.p(t,e),t[0]?.length&&v.p(t,e)},i(t){_||(transition_in(n.$$.fragment,t),transition_in(a.$$.fragment,t),transition_in(d.$$.fragment,t),_=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(a.$$.fragment,t),transition_out(d.$$.fragment,t),_=!1},d(t){t&&detach(e),destroy_component(n),t&&detach(r),t&&detach(o),destroy_component(a),destroy_component(d),t&&detach(u),t&&detach(h),b&&b.d(),v&&v.d(),g=!1,w()}}}function create_default_slot_1$7(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_2$9(t){let e,n,r=t[22],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block_2$4(get_each_context_2$4(t,r,e));return{c(){e=element("thead"),n=element("tr");for(let t=0;t<o.length;t+=1)o[t].c();attr(n,"class","svelte-14hcfjl"),attr(e,"class","svelte-14hcfjl")},m(t,r){insert(t,e,r),append(e,n);for(let t=0;t<o.length;t+=1)o[t].m(n,null)},p(t,e){if(2048&e[0]){let i;for(r=t[22],i=0;i<r.length;i+=1){const a=get_each_context_2$4(t,r,i);o[i]?o[i].p(a,e):(o[i]=create_each_block_2$4(a),o[i].c(),o[i].m(n,null))}for(;i<o.length;i+=1)o[i].d(1);o.length=r.length}},d(t){t&&detach(e),destroy_each(o,t)}}}function create_each_block_2$4(t){let e,n,r=t[27]?.designation+"";return{c(){e=element("th"),n=text(r),attr(e,"class","svelte-14hcfjl")},m(t,r){insert(t,e,r),append(e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block$q(t){let e,n=t[0],r=[];for(let e=0;e<n.length;e+=1)r[e]=create_each_block$9(get_each_context$9(t,n,e));return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=empty()},m(t,n){for(let e=0;e<r.length;e+=1)r[e].m(t,n);insert(t,e,n)},p(t,o){if(11778&o[0]){let i;for(n=t[0],i=0;i<n.length;i+=1){const a=get_each_context$9(t,n,i);r[i]?r[i].p(a,o):(r[i]=create_each_block$9(a),r[i].c(),r[i].m(e.parentNode,e))}for(;i<r.length;i+=1)r[i].d(1);r.length=n.length}},d(t){destroy_each(r,t),t&&detach(e)}}}function create_if_block_1$f(t){let e,n,r=t[22],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block_1$6(get_each_context_1$6(t,r,e));return{c(){e=element("tr");for(let t=0;t<o.length;t+=1)o[t].c();n=space(),attr(e,"class","pointer svelte-14hcfjl")},m(t,r){insert(t,e,r);for(let t=0;t<o.length;t+=1)o[t].m(e,null);append(e,n)},p(t,i){if(3584&i[0]){let a;for(r=t[22],a=0;a<r.length;a+=1){const s=get_each_context_1$6(t,r,a);o[a]?o[a].p(s,i):(o[a]=create_each_block_1$6(s),o[a].c(),o[a].m(e,n))}for(;a<o.length;a+=1)o[a].d(1);o.length=r.length}},d(t){t&&detach(e),destroy_each(o,t)}}}function create_each_block_1$6(t){let e,n,r,o,i=t[9](t[24],t[27])+"";return{c(){e=element("td"),n=text(i),attr(e,"class","svelte-14hcfjl")},m(i,a){insert(i,e,a),append(e,n),r||(o=listen(e,"click",stop_propagation(t[10](t[24]))),r=!0)},p(e,n){t=e},d(t){t&&detach(e),r=!1,o()}}}function create_each_block$9(t){let e,n=t[13](t[24],t[22],t[1]),r=n&&create_if_block_1$f(t);return{c(){r&&r.c(),e=empty()},m(t,n){r&&r.m(t,n),insert(t,e,n)},p(t,o){2&o[0]&&(n=t[13](t[24],t[22],t[1])),n?r?r.p(t,o):(r=create_if_block_1$f(t),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},d(t){r&&r.d(t),t&&detach(e)}}}function create_pending_block$7(t){let e,n;return e=new t[5]({}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p:noop,i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot$c(t){let e,n,r,o;e=new t[4]({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$7,then:create_then_block$7,catch:create_catch_block$7,value:23,blocks:[,,,]};return handle_promise(t[11](),i),{c(){create_component(e.$$.fragment),n=space(),r=empty(),i.block.c()},m(t,a){mount_component(e,t,a),insert(t,n,a),insert(t,r,a),i.block.m(t,i.anchor=a),i.mount=()=>r.parentNode,i.anchor=r,o=!0},p(e,n){update_await_block_branch(i,t=e,n)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(i.block),o=!0)},o(t){transition_out(e.$$.fragment,t);for(let t=0;t<3;t+=1){transition_out(i.blocks[t])}o=!1},d(t){destroy_component(e,t),t&&detach(n),t&&detach(r),i.block.d(t),i.token=null,i=null}}}function create_fragment$u(t){let e,n;return e=new t[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[create_default_slot$c]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};2&n[0]|2&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function instance$u(t,e,n){const r=createEventDispatcher(),{Dialog:o,Divider:i,Loading:a,TextField:s,Button:c}=getAttractions;let{item:l}=e,{className:d}=e,{classId:u}=e,{list:h}=e,m="",f=u+Math.floor(9e3*Math.random()+1e3).toString()+"search";const p=(t,e)=>{if(!e)return;const n=t[e.name];return"boolean"==typeof n?checkBoolean(n):checkDate(t[`_${e.name}`]||t[e.name]||"")},_=Request.getSchemaByClass(d);onMount(()=>{window.setTimeout(()=>{const t=document.querySelector("tr.active");t?t.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(f)?.focus()},200)});return t.$$set=t=>{"item"in t&&n(15,l=t.item),"className"in t&&n(16,d=t.className),"classId"in t&&n(17,u=t.classId),"list"in t&&n(0,h=t.list)},[h,m,r,o,i,a,s,c,f,p,t=>()=>r("choose",{row:t}),async()=>{const t=await _,e=t.display;let n=await getDisplayItems(e,t,h);return{list:h,items:n}},({detail:{value:t}})=>{n(1,m=t)},(t,e,n)=>{if(!n)return!0;for(const r of e)if(p(t,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{n(1,m="")},l,d,u,()=>r("back"),function(t){m=t,n(1,m)}]}class ViewList3 extends SvelteComponent{constructor(t){super(),document_1$b.getElementById("svelte-14hcfjl-style")||add_css$q(),init(this,t,instance$u,create_fragment$u,safe_not_equal,{item:15,className:16,classId:17,list:0},[-1,-1])}}const{document:document_1$a}=globals;function add_css$p(){var t=element("style");t.id="svelte-16mo2c-style",t.textContent=".feather2.svelte-16mo2c{position:absolute;top:1em;right:0.5em;color:#4300b0}",append(document_1$a.head,t)}function get_each_context$8(t,e,n){const r=t.slice();return r[11]=e[n],r}function get_each_context_1$5(t,e,n){const r=t.slice();return r[3]=e[n],r}function create_catch_block$6(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$6(t){let e,n,r,o=t[7].items,i=[];for(let e=0;e<o.length;e+=1)i[e]=create_each_block_1$5(get_each_context_1$5(t,o,e));const a=t=>transition_out(i[t],1,1,()=>{i[t]=null});let s=t[7].list&&create_if_block_1$e(t);return{c(){for(let t=0;t<i.length;t+=1)i[t].c();e=space(),s&&s.c(),n=empty()},m(t,o){for(let e=0;e<i.length;e+=1)i[e].m(t,o);insert(t,e,o),s&&s.m(t,o),insert(t,n,o),r=!0},p(t,r){if(30327783&r[0]){let n;for(o=t[7].items,n=0;n<o.length;n+=1){const a=get_each_context_1$5(t,o,n);i[n]?(i[n].p(a,r),transition_in(i[n],1)):(i[n]=create_each_block_1$5(a),i[n].c(),transition_in(i[n],1),i[n].m(e.parentNode,e))}for(group_outros(),n=o.length;n<i.length;n+=1)a(n);check_outros()}t[7].list?s?(s.p(t,r),128&r[0]&&transition_in(s,1)):(s=create_if_block_1$e(t),s.c(),transition_in(s,1),s.m(n.parentNode,n)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros())},i(t){if(!r){for(let t=0;t<o.length;t+=1)transition_in(i[t]);transition_in(s),r=!0}},o(t){i=i.filter(Boolean);for(let t=0;t<i.length;t+=1)transition_out(i[t]);transition_out(s),r=!1},d(t){destroy_each(i,t),t&&detach(e),s&&s.d(t),t&&detach(n)}}}function create_if_block_3$5(t){let e,n,r,o;const i=[create_if_block_4$5,create_if_block_6$3],a=[];function s(t,e){return t[3].name!==t[14]||t[15]?"lookup"!==t[3].properties?.format?1:-1:0}return~(e=s(t))&&(n=a[e]=i[e](t)),{c(){n&&n.c(),r=empty()},m(t,n){~e&&a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?~e&&a[e].p(t,o):(n&&(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros()),~e?(n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r)):n=null)},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){~e&&a[e].d(t),t&&detach(r)}}}function create_if_block_6$3(t){let e,n;return e=new InputFormField({props:{classId:t[8],item:t[3],record:t[6],disabled:t[3].name===t[14]&&t[15]||t[0],eventId:t[5],currency:t[2],changeValue:t[9]}}),e.$on("notify",t[17]),e.$on("multi",t[18]),e.$on("defPrep",t[19]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};256&n[0]&&(r.classId=t[8]),128&n[0]&&(r.item=t[3]),64&n[0]&&(r.record=t[6]),129&n[0]&&(r.disabled=t[3].name===t[14]&&t[15]||t[0]),32&n[0]&&(r.eventId=t[5]),4&n[0]&&(r.currency=t[2]),512&n[0]&&(r.changeValue=t[9]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_4$5(t){let e,n,r,o;n=new InputFormField({props:{classId:t[8],item:t[3],record:t[6],disabled:t[0]||!!t[1],required:!0,eventId:t[5],currency:t[2],changeValue:t[9]}}),n.$on("notify",t[17]),n.$on("multi",t[18]),n.$on("defPrep",t[19]),n.$on("record",t[23]),n.$on("objRecord",t[24]);let i=t[1]&&create_if_block_5$5(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i&&i.c(),set_style(e,"padding-top",".25em"),set_style(e,"background-color","lightyellow"),set_style(e,"position","relative")},m(t,a){insert(t,e,a),mount_component(n,e,null),append(e,r),i&&i.m(e,null),o=!0},p(t,r){const o={};256&r[0]&&(o.classId=t[8]),128&r[0]&&(o.item=t[3]),64&r[0]&&(o.record=t[6]),3&r[0]&&(o.disabled=t[0]||!!t[1]),32&r[0]&&(o.eventId=t[5]),4&r[0]&&(o.currency=t[2]),512&r[0]&&(o.changeValue=t[9]),n.$set(o),t[1]?i?(i.p(t,r),2&r[0]&&transition_in(i,1)):(i=create_if_block_5$5(t),i.c(),transition_in(i,1),i.m(e,null)):i&&(group_outros(),transition_out(i,1,1,()=>{i=null}),check_outros())},i(t){o||(transition_in(n.$$.fragment,t),transition_in(i),o=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),o=!1},d(t){t&&detach(e),destroy_component(n),i&&i.d()}}}function create_if_block_5$5(t){let e,n,r,o,i;return n=new DeleteIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 pointer svelte-16mo2c")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[22]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_each_block_1$5(t){let e,n,r="list"!==t[3].type&&create_if_block_3$5(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){"list"!==t[3].type?r?(r.p(t,n),128&n[0]&&transition_in(r,1)):(r=create_if_block_3$5(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_if_block_1$e(t){let e,n,r=t[7].list,o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block$8(get_each_context$8(t,r,e));const i=t=>transition_out(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=empty()},m(t,r){for(let e=0;e<o.length;e+=1)o[e].m(t,r);insert(t,e,r),n=!0},p(t,n){if(485&n[0]){let a;for(r=t[7].list,a=0;a<r.length;a+=1){const i=get_each_context$8(t,r,a);o[a]?(o[a].p(i,n),transition_in(o[a],1)):(o[a]=create_each_block$8(i),o[a].c(),transition_in(o[a],1),o[a].m(e.parentNode,e))}for(group_outros(),a=r.length;a<o.length;a+=1)i(a);check_outros()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)transition_out(o[t]);n=!1},d(t){destroy_each(o,t),t&&detach(e)}}}function create_if_block_2$8(t){let e,n,r,o;return e=new t[12]({props:{text:t[11].designation}}),r=new InputObject({props:{classId:t[8],list:t[11],eventId:t[5],schema:t[11].item,record:t[6],disabled:t[0],currency:t[2],update:!0}}),{c(){create_component(e.$$.fragment),n=space(),create_component(r.$$.fragment)},m(t,i){mount_component(e,t,i),insert(t,n,i),mount_component(r,t,i),o=!0},p(t,n){const o={};128&n[0]&&(o.text=t[11].designation),e.$set(o);const i={};256&n[0]&&(i.classId=t[8]),128&n[0]&&(i.list=t[11]),32&n[0]&&(i.eventId=t[5]),128&n[0]&&(i.schema=t[11].item),64&n[0]&&(i.record=t[6]),1&n[0]&&(i.disabled=t[0]),4&n[0]&&(i.currency=t[2]),r.$set(i)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(r.$$.fragment,t),o=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(r.$$.fragment,t),o=!1},d(t){destroy_component(e,t),t&&detach(n),destroy_component(r,t)}}}function create_each_block$8(t){let e,n,r="array"!==t[11].type&&create_if_block_2$8(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){"array"!==t[11].type?r?(r.p(t,n),128&n[0]&&transition_in(r,1)):(r=create_if_block_2$8(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_pending_block$6(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_if_block$p(t){let e,n;return e=new ViewList3({props:{item:t[3],className:t[4],classId:t[8],list:t[11]}}),e.$on("choose",t[20]),e.$on("back",t[21]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};8&n[0]&&(r.item=t[3]),16&n[0]&&(r.className=t[4]),256&n[0]&&(r.classId=t[8]),2048&n[0]&&(r.list=t[11]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot$b(t){let e,n,r=t[10]&&create_if_block$p(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){t[10]?r?(r.p(t,n),1024&n[0]&&transition_in(r,1)):(r=create_if_block$p(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_fragment$t(t){let e,n,r,o,i,a,s={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$6,then:create_then_block$6,catch:create_catch_block$6,value:54,blocks:[,,,]};function c(e){t[30](e)}handle_promise(t[16](),s),n=new t[12]({});let l={class:"tModal",noClickaway:!0,$$slots:{default:[create_default_slot$b]},$$scope:{ctx:t}};return void 0!==t[10]&&(l.open=t[10]),o=new t[13]({props:l}),binding_callbacks.push(()=>bind(o,"open",c)),{c(){s.block.c(),e=space(),create_component(n.$$.fragment),r=space(),create_component(o.$$.fragment)},m(t,i){s.block.m(t,s.anchor=i),s.mount=()=>e.parentNode,s.anchor=e,insert(t,e,i),mount_component(n,t,i),insert(t,r,i),mount_component(o,t,i),a=!0},p(e,n){update_await_block_branch(s,t=e,n);const r={};3352&n[0]|268435456&n[1]&&(r.$$scope={dirty:n,ctx:t}),!i&&1024&n[0]&&(i=!0,r.open=t[10],add_flush_callback(()=>i=!1)),o.$set(r)},i(t){a||(transition_in(s.block),transition_in(n.$$.fragment,t),transition_in(o.$$.fragment,t),a=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(s.blocks[t])}transition_out(n.$$.fragment,t),transition_out(o.$$.fragment,t),a=!1},d(t){s.block.d(t),s.token=null,s=null,t&&detach(e),destroy_component(n,t),t&&detach(r),destroy_component(o,t)}}}function instance$t(t,e,n){const{Divider:r,FormField:o,Modal:i}=getAttractions,a=createEventDispatcher();let s,c,l,d,u,{required:h}=e,{disabled:m}=e,{readonly:f}=e,{id:p}=e,{item:_}=e,{value:g}=e,{refValue:w}=e,{currency:$}=e,y={},b=[],v=[],I={},C=new Map,E=!1,A="";const S=_.checkOn,k=g,T=t=>{s.items.filter(e=>"object"==typeof(e.properties&&e.properties[t])).map(e=>{const n=e.properties[t].refItem||"",[r,o]=n.split(".");b.push({action:t,itemName:e.name,refObj:r,refName:o,op:e.properties[t].invert?"!":""})})},R=()=>{s.items.filter(t=>t.lookup).forEach(t=>{v.push({name:t.name,lookup:t.lookup})}),s.items.filter(t=>t.properties?.lookup).forEach(t=>{v.push({name:t.name,lookup:t.properties.lookup.split(":").at(-1)})})},N=async t=>{const e=b.filter(e=>e.refObj===t);if(e?.length){n(9,I={});for(const t of e){const{itemName:e,refObj:r,refName:o,op:i}=t;let{action:a}=t;if(!r)break;let s,l,d=!o&&y[r];const u=y[r];u&&o&&(d=(await getTaskFull(r,u))[o]),Array.isArray(d)&&0===d.length&&(d=!1),"!"===i&&(d=!d),"required"!==a&&"readonly"!==a||(a="required"===a?a:"disabled",setTimeout(()=>{s=`#${c} .form-field.${e} .field textarea`,l=document.querySelector(s),l||(s=`#${c} .form-field.${e} .field input`,l=document.querySelector(s)),l&&d&&l.setAttribute(a,""),l&&!d&&l.removeAttribute(a)},0)),"hidden"===a&&(s=`#${c} .form-field.${e}`,l=document.querySelector(s),l?.classList?.toggle("hidden",!!d),d&&n(9,I[e]="",I))}}};onMount(()=>{D()});const D=async()=>{const t=t=>new Promise(e=>setTimeout(e,t));let e,n=0;for(;!(e=document.getElementById(c))&&++n<20;)await t(50);e&&((()=>{if(recID)return;const t=new Set;for(const e of b)t.add(e.refObj||l);Array.from(t).forEach(t=>N(t))})(),x())},x=()=>{setTimeout(()=>{Array.from(C).forEach(([t,e])=>{y[t]||n(6,y[t]=e._id,y)})},250)},O=async t=>{if(!t.value)return void P();const e={[t.itemName]:{$regex:`(?i)${t.value}`}},r=await Request.getSectionView(l,e);r?.length?(n(11,A=r),n(10,E=!0)):(n(1,g=""),n(25,w=""),a("setRefValue",w))},M=()=>{n(10,E=!1)},P=()=>{n(1,g=""),n(25,w=g),n(6,y={}),a("setRefValue",w)};return t.$$set=t=>{"required"in t&&n(26,h=t.required),"disabled"in t&&n(0,m=t.disabled),"readonly"in t&&n(27,f=t.readonly),"id"in t&&n(28,p=t.id),"item"in t&&n(3,_=t.item),"value"in t&&n(1,g=t.value),"refValue"in t&&n(25,w=t.refValue),"currency"in t&&n(2,$=t.currency)},t.$$.update=()=>{134217729&t.$$.dirty[0]&&n(0,m=m||f),536871024&t.$$.dirty[0]&&y&&a("safeReference",{record:y,class:l,event:d,taskId:u})},[m,g,$,_,l,d,y,s,c,I,E,A,r,i,S,k,async()=>{try{if(g){const t=await Request.getTask(_.refClass,g);delete t._task,n(6,y=t),n(29,u=(await Request.getTaskByDocId(t._id,!0))._id)}else n(6,y={})}catch{}return n(7,s=await Request.getSchemaByClass(_.refClass)),n(8,c="form-"+s.class+Math.floor(9e3*Math.random()+1e3).toString()),n(4,l=s.class),s.identity.designation,n(5,d=s.id),["readonly","hidden","required"].map(T),R(),!0},async({detail:t})=>{const{itemName:e,value:r}=t;if(n(6,y[e]=r,y),e===S)return O(t);N(e)},async({detail:t})=>{if(!(s.input?.length&&s.input.length>1))return;if(prevSchema?.class!==s.input[0])return;const{value:e,lookup:r,view:o}=t,[i]=r.split(":"),a=(await Request.getSectionView(i,{[o]:{$in:e}})).map(t=>t._id);for(const t of s.input.slice(1)){n(6,y[t]=[],y);const e=await Request.getSchemaByClass(t);e.id;let r=await Request.getTasks(e.id);if(r=r.data.filter(t=>"Ready"===t._task?.status&&a.includes(t[i])),r?.length){const e=r.map(t=>t._id),o=await Request.getSectionView(t,{_id:{$in:e}});for(const e of o)e[t]=e._id;n(6,y[t]=o,y)}}},async({detail:{className:t,itemName:e,value:n}})=>{if(C.has(t))return;if(!0!==n&&(n=(n=[].concat(n)).some(t=>t===l)),!n)return;const r={[e]:!0},o=await Request.getSectionView(t,r);o?.length&&C.set(t,o[0])},async({detail:t})=>{const e=await Request.getSectionView(l,{_id:t.row._id});e?.length&&(n(1,g=e[0]._id),n(25,w=g),a("setRefValue",w),n(6,y=e[0])),M()},M,P,({detail:t})=>{n(6,y[t.itemName]=t.value,y)},({detail:t})=>{for(const e of t.items)n(6,y[t.listName][e.name]=e.value,y)},w,h,f,p,u,function(t){E=t,n(10,E)}]}class InputObjectReference extends SvelteComponent{constructor(t){super(),document_1$a.getElementById("svelte-16mo2c-style")||add_css$p(),init(this,t,instance$t,create_fragment$t,safe_not_equal,{required:26,disabled:0,readonly:27,id:28,item:3,value:1,refValue:25,currency:2},[-1,-1])}}function add_css$o(){var t=element("style");t.id="svelte-1fuww0c-style",t.textContent=".feather.svelte-1fuww0c{position:absolute;top:0.75em;right:-1em;color:#4300b0}",append(document.head,t)}function create_if_block_1$d(t){let e,n;return{c(){e=element("span"),n=text(t[4]),attr(e,"class","item")},m(t,r){insert(t,e,r),append(e,n)},p(t,e){16&e[0]&&set_data(n,t[4])},d(t){t&&detach(e)}}}function create_if_block$o(t){let e,n,r,o,i;return n=new ArrowDownCircleIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"title","Übernehmen"),attr(e,"class","pointer feather svelte-1fuww0c")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[17]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_default_slot$a(t){let e,n,r,o=t[6]&&create_if_block_1$d(t),i=t[14]&&create_if_block$o(t);return{c(){o&&o.c(),e=space(),i&&i.c(),n=empty()},m(t,a){o&&o.m(t,a),insert(t,e,a),i&&i.m(t,a),insert(t,n,a),r=!0},p(t,n){t[6]?o?o.p(t,n):(o=create_if_block_1$d(t),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),t[14]&&i.p(t,n)},i(t){r||(transition_in(i),r=!0)},o(t){transition_out(i),r=!1},d(t){o&&o.d(t),t&&detach(e),i&&i.d(t),t&&detach(n)}}}function create_fragment$s(t){let e,n,r;return n=new t[10]({props:{withItem:!0,itemLeft:!0,lang:t[11].id,class:"left",type:"string",inputClass:"txt-right"+(t[1]?"":" "+t[2]),id:t[0],name:t[0],value:t[9],step:t[12],pattern:t[7],placeholder:t[13],readonly:t[8],disabled:t[3],required:t[5],$$slots:{default:[create_default_slot$a]},$$scope:{ctx:t}}}),n.$on("change",t[15]),n.$on("focus",t[16]),{c(){e=element("div"),create_component(n.$$.fragment),set_style(e,"position","relative"),set_style(e,"max-width","10em")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p(t,e){const r={};6&e[0]&&(r.inputClass="txt-right"+(t[1]?"":" "+t[2])),1&e[0]&&(r.id=t[0]),1&e[0]&&(r.name=t[0]),512&e[0]&&(r.value=t[9]),128&e[0]&&(r.pattern=t[7]),256&e[0]&&(r.readonly=t[8]),8&e[0]&&(r.disabled=t[3]),32&e[0]&&(r.required=t[5]),80&e[0]|32&e[1]&&(r.$$scope={dirty:e,ctx:t}),n.$set(r)},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function instance$s(t,e,n){const r=createEventDispatcher(),{TextField:o}=getAttractions;let{id:i}=e,{item:a}=e,{value:s}=e,{noForm:c=!1}=e,{classId:l}=e,{disabled:d}=e,{formnovalidate:u}=e,{currency:h}=e,{praefix:m}=e,{notifyList:f}=e;const p=JSON.parse(Storage.getItem("Locale"));let _=["price","amount","amountValue","taxValue","total","__total"].find(t=>t===a.name?.split("-")[0])||a.properties?.currency;!1===a.properties?.currency&&(_=!1);const g=Number("1.1").toLocaleString(p.id).substring(1,2),{properties:w={}}=a;let{min:$,max:y,step:b,pattern:v,decimals:I=0,unit:C="",placeholder:E,hint:A,readonly:S,negative:k,required:T=!1,transfer:R}=w,N="";s=s?Number(s.toString().replace(",",".")):0,S=!0===S||void 0;const D=t=>Number(t.toString()).toFixed(I).toString().replace(".",g);v||(v=I?`[0-9]+([${g}][0-9]{1,${I}})?`:"[0-9]*"),k&&(v="-?"+v);return t.$$set=t=>{"id"in t&&n(0,i=t.id),"item"in t&&n(19,a=t.item),"value"in t&&n(18,s=t.value),"noForm"in t&&n(1,c=t.noForm),"classId"in t&&n(2,l=t.classId),"disabled"in t&&n(3,d=t.disabled),"formnovalidate"in t&&n(20,u=t.formnovalidate),"currency"in t&&n(4,h=t.currency),"praefix"in t&&n(21,m=t.praefix),"notifyList"in t&&n(22,f=t.notifyList)},t.$$.update=()=>{1048608&t.$$.dirty[0]&&n(5,T=T&&!u),262144&t.$$.dirty[0]&&(t=>{n(9,N=D(t.toString().replace(",",".")))})(s),4194304&t.$$.dirty[0]&&(async()=>{const t=a.properties?.value?.formula;if(t)void 0!==m&&""!==m?t?.operator?.multiply&&r("formula",{item:a}):t?.operator&&r("formula",{item:a})})()},[i,c,l,d,h,T,_,v,S,N,o,p,b,E,R,({detail:t})=>r("blur",{value:D(t.value)}),({detail:t})=>{S||+s||n(9,N="")},({detail:t})=>{const e=[].concat(R.target);for(const t of e)r("record",{itemName:t,value:s}),r("listRecord",{itemName:t,decimals:a.properties?.decimals,value:s})},s,a,u,m,f]}class InputNumber extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-1fuww0c-style")||add_css$o(),init(this,t,instance$s,create_fragment$s,safe_not_equal,{id:0,item:19,value:18,noForm:1,classId:2,disabled:3,formnovalidate:20,currency:4,praefix:21,notifyList:22},[-1,-1])}}const{document:document_1$9}=globals;function add_css$n(){var t=element("style");t.id="svelte-1m010ne-style",t.textContent=".feather.svelte-1m010ne.svelte-1m010ne{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-1m010ne.svelte-1m010ne{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-1m010ne table.svelte-1m010ne{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-1m010ne table thead.svelte-1m010ne{position:sticky;top:0;background:#326173;color:white}.eList.svelte-1m010ne table tbody tr.svelte-1m010ne{height:2.3em}th.svelte-1m010ne.svelte-1m010ne,td.svelte-1m010ne.svelte-1m010ne{padding-left:0.4em;padding-right:0.4em}tr.active.svelte-1m010ne.svelte-1m010ne{color:#326173;background-color:#fcebd5}.dialog.eList{max-height:90vh}.checkbox.round > .selector{border-color:#326173 !important}.form--buttons.svelte-1m010ne.svelte-1m010ne{display:flex;gap:1em;padding:0.5em 0}",append(document_1$9.head,t)}function get_then_context$1(t){t[34]=t[36].list,t[35]=t[36].items}function get_each_context$7(t,e,n){const r=t.slice();return r[37]=e[n],r[39]=n,r}function get_each_context_1$4(t,e,n){const r=t.slice();return r[40]=e[n],r[42]=n,r}function get_each_context_2$3(t,e,n){const r=t.slice();return r[40]=e[n],r}function create_catch_block$5(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$5(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w,$;get_then_context$1(t),n=new t[9]({props:{outline:!0,$$slots:{default:[create_default_slot_2$4]},$$scope:{ctx:t}}}),n.$on("click",t[31]);let y=!t[2]&&create_if_block_5$4(t);function b(e){t[32](e)}let v={id:t[12]};void 0!==t[3]&&(v.value=t[3]),s=new t[7]({props:v}),binding_callbacks.push(()=>bind(s,"value",b)),s.$on("input",t[15]),u=new DeleteIcon({props:{size:"18"}});let I=t[35]?.length&&create_if_block_3$4(t),C=t[34]?.length&&create_if_block$n(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),y&&y.c(),o=space(),i=element("div"),a=text("Suchen: "),create_component(s.$$.fragment),l=space(),d=element("span"),create_component(u.$$.fragment),h=space(),m=element("div"),f=element("table"),I&&I.c(),p=space(),_=element("tbody"),C&&C.c(),attr(e,"class","form--buttons svelte-1m010ne"),attr(d,"class","feather pointer svelte-1m010ne"),set_style(i,"margin-bottom","1em"),set_style(i,"position","relative"),attr(f,"striped",""),attr(f,"class","svelte-1m010ne"),attr(m,"class","eList svelte-1m010ne")},m(c,b){insert(c,e,b),mount_component(n,e,null),append(e,r),y&&y.m(e,null),insert(c,o,b),insert(c,i,b),append(i,a),mount_component(s,i,null),append(i,l),append(i,d),mount_component(u,d,null),insert(c,h,b),insert(c,m,b),append(m,f),I&&I.m(f,null),append(f,p),append(f,_),C&&C.m(_,null),g=!0,w||($=listen(d,"click",t[17]),w=!0)},p(t,r){get_then_context$1(t);const o={};16384&r[1]&&(o.$$scope={dirty:r,ctx:t}),n.$set(o),t[2]?y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros()):y?(y.p(t,r),4&r[0]&&transition_in(y,1)):(y=create_if_block_5$4(t),y.c(),transition_in(y,1),y.m(e,null));const i={};!c&&8&r[0]&&(c=!0,i.value=t[3],add_flush_callback(()=>c=!1)),s.$set(i),t[35]?.length&&I.p(t,r),t[34]?.length&&C.p(t,r)},i(t){g||(transition_in(n.$$.fragment,t),transition_in(y),transition_in(s.$$.fragment,t),transition_in(u.$$.fragment,t),transition_in(I),transition_in(C),g=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(y),transition_out(s.$$.fragment,t),transition_out(u.$$.fragment,t),transition_out(I),transition_out(C),g=!1},d(t){t&&detach(e),destroy_component(n),y&&y.d(),t&&detach(o),t&&detach(i),destroy_component(s),destroy_component(u),t&&detach(h),t&&detach(m),I&&I.d(),C&&C.d(),w=!1,$()}}}function create_default_slot_2$4(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_5$4(t){let e,n;return e=new t[9]({props:{disabled:!t[34].length,filled:!0,$$slots:{default:[create_default_slot_1$6]},$$scope:{ctx:t}}}),e.$on("click",t[18](t[34])),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};16384&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_1$6(t){let e;return{c(){e=text("Bestätigen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_3$4(t){let e,n,r,o,i=!t[2]&&create_if_block_4$4(t),a=t[35],s=[];for(let e=0;e<a.length;e+=1)s[e]=create_each_block_2$3(get_each_context_2$3(t,a,e));return{c(){e=element("thead"),n=element("tr"),i&&i.c(),r=space();for(let t=0;t<s.length;t+=1)s[t].c();attr(n,"class","svelte-1m010ne"),attr(e,"class","svelte-1m010ne")},m(t,a){insert(t,e,a),append(e,n),i&&i.m(n,null),append(n,r);for(let t=0;t<s.length;t+=1)s[t].m(n,null);o=!0},p(t,e){if(t[2]?i&&(group_outros(),transition_out(i,1,1,()=>{i=null}),check_outros()):i?(i.p(t,e),4&e[0]&&transition_in(i,1)):(i=create_if_block_4$4(t),i.c(),transition_in(i,1),i.m(n,r)),16384&e[0]){let r;for(a=t[35],r=0;r<a.length;r+=1){const o=get_each_context_2$3(t,a,r);s[r]?s[r].p(o,e):(s[r]=create_each_block_2$3(o),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=a.length}},i(t){o||(transition_in(i),o=!0)},o(t){transition_out(i),o=!1},d(t){t&&detach(e),i&&i.d(),destroy_each(s,t)}}}function create_if_block_4$4(t){let e,n,r,o,i;return n=new CheckCircleIcon({props:{size:"20"}}),{c(){e=element("th"),create_component(n.$$.fragment),attr(e,"class","svelte-1m010ne")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[19](t[34])),o=!0)},p(e,n){t=e},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_each_block_2$3(t){let e,n,r=t[40]+"";return{c(){e=element("th"),n=text(r),attr(e,"class","svelte-1m010ne")},m(t,r){insert(t,e,r),append(e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block$n(t){let e,n,r=t[34],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block$7(get_each_context$7(t,r,e));const i=t=>transition_out(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=empty()},m(t,r){for(let e=0;e<o.length;e+=1)o[e].m(t,r);insert(t,e,r),n=!0},p(t,n){if(1138717&n[0]){let a;for(r=t[34],a=0;a<r.length;a+=1){const i=get_each_context$7(t,r,a);o[a]?(o[a].p(i,n),transition_in(o[a],1)):(o[a]=create_each_block$7(i),o[a].c(),transition_in(o[a],1),o[a].m(e.parentNode,e))}for(group_outros(),a=r.length;a<o.length;a+=1)i(a);check_outros()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)transition_out(o[t]);n=!1},d(t){destroy_each(o,t),t&&detach(e)}}}function create_if_block_1$c(t){let e,n,r,o,i,a,s,c=t[0],l=create_key_block$1(t),d=t[35],u=[];for(let e=0;e<d.length;e+=1)u[e]=create_each_block_1$4(get_each_context_1$4(t,d,e));return{c(){e=element("tr"),l.c(),n=space();for(let t=0;t<u.length;t+=1)u[t].c();r=space(),attr(e,"style",o=t[2]?"cursor: default;":"cursor: zoom-in;"),attr(e,"title","übernimmt den Wert direkt"),attr(e,"class","svelte-1m010ne"),toggle_class(e,"active",t[0].includes(Array.isArray(t[37])?t[37][0]:t[37]))},m(o,c){insert(o,e,c),l.m(e,null),append(e,n);for(let t=0;t<u.length;t+=1)u[t].m(e,null);append(e,r),i=!0,a||(s=listen(e,"click",t[20](t[37])),a=!0)},p(a,s){if(t=a,1&s[0]&&safe_not_equal(c,c=t[0])?(group_outros(),transition_out(l,1,1,noop),check_outros(),l=create_key_block$1(t),l.c(),transition_in(l),l.m(e,n)):l.p(t,s),16400&s[0]){let n;for(d=t[35],n=0;n<d.length;n+=1){const o=get_each_context_1$4(t,d,n);u[n]?u[n].p(o,s):(u[n]=create_each_block_1$4(o),u[n].c(),u[n].m(e,r))}for(;n<u.length;n+=1)u[n].d(1);u.length=d.length}(!i||4&s[0]&&o!==(o=t[2]?"cursor: default;":"cursor: zoom-in;"))&&attr(e,"style",o),16385&s[0]&&toggle_class(e,"active",t[0].includes(Array.isArray(t[37])?t[37][0]:t[37]))},i(t){i||(transition_in(l),i=!0)},o(t){transition_out(l),i=!1},d(t){t&&detach(e),l.d(t),destroy_each(u,t),a=!1,s()}}}function create_if_block_2$7(t){let e,n,r;return n=new t[11]({props:{name:t[13],data:t[39],checked:t[0].includes(Array.isArray(t[37])?t[37][0]:t[37]),round:!0}}),{c(){e=element("td"),create_component(n.$$.fragment),attr(e,"title","Wählt den Wert aus"),attr(e,"class","svelte-1m010ne")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p(t,e){const r={};1&e[0]&&(r.checked=t[0].includes(Array.isArray(t[37])?t[37][0]:t[37])),n.$set(r)},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_key_block$1(t){let e,n,r=!t[2]&&create_if_block_2$7(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){t[2]?r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros()):r?(r.p(t,n),4&n[0]&&transition_in(r,1)):(r=create_if_block_2$7(t),r.c(),transition_in(r,1),r.m(e.parentNode,e))},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_each_block_1$4(t){let e,n,r=(Array.isArray(t[37])?t[37][t[42]]:t[4][t[39]]?t[4][t[39]][t[42]]:t[37])+"";return{c(){e=element("td"),n=text(r),attr(e,"class","svelte-1m010ne")},m(t,r){insert(t,e,r),append(e,n)},p(t,e){16&e[0]&&r!==(r=(Array.isArray(t[37])?t[37][t[42]]:t[4][t[39]]?t[4][t[39]][t[42]]:t[37])+"")&&set_data(n,r)},d(t){t&&detach(e)}}}function create_each_block$7(t){let e,n,r=t[16](t[37],t[3]),o=r&&create_if_block_1$c(t);return{c(){o&&o.c(),e=empty()},m(t,r){o&&o.m(t,r),insert(t,e,r),n=!0},p(t,n){8&n[0]&&(r=t[16](t[37],t[3])),r?o?(o.p(t,n),8&n[0]&&transition_in(o,1)):(o=create_if_block_1$c(t),o.c(),transition_in(o,1),o.m(e.parentNode,e)):o&&(group_outros(),transition_out(o,1,1,()=>{o=null}),check_outros())},i(t){n||(transition_in(o),n=!0)},o(t){transition_out(o),n=!1},d(t){o&&o.d(t),t&&detach(e)}}}function create_pending_block$5(t){let e,n;return e=new t[6]({}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p:noop,i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot$9(t){let e,n,r,o;e=new t[10]({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$5,then:create_then_block$5,catch:create_catch_block$5,value:36,blocks:[,,,]};return handle_promise(t[14](),i),{c(){create_component(e.$$.fragment),n=space(),r=empty(),i.block.c()},m(t,a){mount_component(e,t,a),insert(t,n,a),insert(t,r,a),i.block.m(t,i.anchor=a),i.mount=()=>r.parentNode,i.anchor=r,o=!0},p(e,n){update_await_block_branch(i,t=e,n)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(i.block),o=!0)},o(t){transition_out(e.$$.fragment,t);for(let t=0;t<3;t+=1){transition_out(i.blocks[t])}o=!1},d(t){destroy_component(e,t),t&&detach(n),t&&detach(r),i.block.d(t),i.token=null,i=null}}}function create_fragment$r(t){let e,n;return e=new t[8]({props:{title:t[1]||"Auswahl",class:"eList",$$slots:{default:[create_default_slot$9]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};2&n[0]&&(r.title=t[1]||"Auswahl"),29&n[0]|16384&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function instance$r(t,e,n){const r=createEventDispatcher(),{Loading:o,TextField:i,Dialog:a,Button:s,Divider:c,Checkbox:l}=getAttractions;let{classId:d}=e,{id:u}=e,{designation:h}=e,{selection:m}=e,{refDoc:f}=e,{tableName:p}=e,{idName:_}=e,{target:g}=e,{view:w}=e,{unique:$}=e,{uniqueView:y}=e,{status:b}=e,{single:v}=e;m||=[];let I="",C=d+Math.floor(9e3*Math.random()+1e3).toString()+"search",E=[];const A=p+_+g+"checkbox",S=(t,e)=>t>e?1:e>t?-1:0;onMount(()=>{window.setTimeout(()=>{const t=document.querySelector("tr.active");t?t.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(C)?.focus()},200)});return t.$$set=t=>{"classId"in t&&n(22,d=t.classId),"id"in t&&n(23,u=t.id),"designation"in t&&n(1,h=t.designation),"selection"in t&&n(0,m=t.selection),"refDoc"in t&&n(24,f=t.refDoc),"tableName"in t&&n(25,p=t.tableName),"idName"in t&&n(26,_=t.idName),"target"in t&&n(21,g=t.target),"view"in t&&n(27,w=t.view),"unique"in t&&n(28,$=t.unique),"uniqueView"in t&&n(29,y=t.uniqueView),"status"in t&&n(30,b=t.status),"single"in t&&n(2,v=t.single)},[m,h,v,I,E,r,o,i,a,s,c,l,C,A,async()=>{let t=[],e=[],r={};if(n(4,E=[]),_)if(w){if(u){const e=d.split("-")[1].slice(0,-4),n="input."+d+"[name='_id']",o=document.querySelector(n).value;r={[_]:u},b&&(r.$or=[{status:!0},{[e]:o}]),t=await Request.getSectionView(p,r),t=t.sort((t,n)=>{const r=t=>(t[e]||"z").toString()+t[g];return S(r(t),r(n))})}}else y?u&&(r={[_]:u,status:!0},Object.entries(y).map(([t,n])=>{n?.length&&(r[t]={$in:n}),e.push(t)}),t=await Request.getSectionView(p,r),t=t.sort((t,e)=>{const n=t=>(m.includes(t[g])?"0-":"1-")+t[g];return S(n(t),n(e))}),n(4,E=t.map(t=>{const n=[t[g]];return e.map(e=>n.push(t[e])),n}))):$?(t=await Request.getSection(p,_,u,$),t=t.sort((t,e)=>S(t,e))):(t=await Request.getSection(p,_,u,!1,b),t=t.sort((t,e)=>{const n=t=>(m.includes(t[g])?"0-":"1-")+t[g];return S(n(t),n(e))}));else r={},u&&!Array.isArray(u)&&(r._id=u),t=await Request.getSectionView(p,r);const o=await Request.getSchemaByClass(p),i=[];if(f){const e=o.items[0].name,r=o.items[1].name,i=o.list[0].name,a=t.find(t=>t[e]===f);t=a?a[i]:[],n(21,g=r)}let a;return t.map(t=>{let e=t[g];if(e||p!==g||(n(21,g=o.items[0].name),e=t[g]),Array.isArray(e))for(const t of e){let e=t;"string"!=typeof t&&(e=Array.from(Object.values(t)).filter(t=>!!t&&24!==t?.length).join(", ")),i.push(e||[])}else f&&(e=o.list[0].item.map(e=>t[e.name]||"")),i.push(e||[])}),a=f?o.list[0].item.map(t=>t.designation):[o.items.find(t=>t.name===g)?.designation],e=e.map(t=>o.items.find(e=>e.name===t)?.designation),{list:f?i:i.flat(),items:[...a,...e]}},({detail:{value:t}})=>{n(3,I=t)},(t,e)=>{if(!e)return!0;return!!(Array.isArray(t)?t.join(" "):t).toLowerCase().includes(e.toLowerCase())},()=>{n(3,I="")},t=>()=>{const e=document.getElementsByName(A),n=[];e.forEach((e,r)=>{e.checked&&n.push(t[+e.attributes.data.value])}),r("choose",{list:n})},t=>()=>{document.getElementsByName(A).forEach((t,e)=>{t.checked=!t.checked})},t=>e=>{if("TD"===e.target?.nodeName){const e=Array.isArray(t)?t[0]:t;v?r("choose",{list:[].concat(e)}):(n(0,m=m.includes(e)?m.filter(t=>t!==e):m.concat(e)),r("choose",{list:m}))}},g,d,u,f,p,_,w,$,y,b,()=>r("back"),function(t){I=t,n(3,I)}]}class ComposedList extends SvelteComponent{constructor(t){super(),document_1$9.getElementById("svelte-1m010ne-style")||add_css$n(),init(this,t,instance$r,create_fragment$r,safe_not_equal,{classId:22,id:23,designation:1,selection:0,refDoc:24,tableName:25,idName:26,target:21,view:27,unique:28,uniqueView:29,status:30,single:2},[-1,-1])}}const{document:document_1$8}=globals;function add_css$m(){var t=element("style");t.id="svelte-1rbaejz-style",t.textContent=".feather.svelte-1rbaejz{position:absolute;top:1em;right:0.5em;color:#4300b0}.showNumber.svelte-1rbaejz{position:absolute;display:inline-block;width:3.5em;text-align:right;top:1em;left:-4em;color:#4300b0}.showNumber.disabled.svelte-1rbaejz{color:#888 !important}.autocomplete .notice,.autocomplete .load-more-options,.autocomplete .show-on-focus,.autocomplete.disabled .chip button.btn,.autocomplete.disabled .chip+.autocomplete-field input{display:none}.autocomplete-field input.invalid{border:1px red solid !important}.autocomplete.disabled .chip{height:2.25em !important;padding-right:0.75em !important}",append(document_1$8.head,t)}function create_if_block_5$3(t){let e,n,r,o,i,a=t[7].length+"";return{c(){e=element("span"),n=text("("),r=text(a),o=text(")"),attr(e,"class",i=null_to_empty(t[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")},m(t,i){insert(t,e,i),append(e,n),append(e,r),append(e,o)},p(t,n){128&n[0]&&a!==(a=t[7].length+"")&&set_data(r,a),2&n[0]&&i!==(i=null_to_empty(t[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")&&attr(e,"class",i)},d(t){t&&detach(e)}}}function create_load_more_options_message_slot$1(t){let e;return{c(){e=element("div"),attr(e,"class","load-more-options"),attr(e,"slot","load-more-options-message")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_1$b(t){let e,n,r,o;const i=[create_if_block_2$6,create_if_block_3$3,create_if_block_4$3],a=[];function s(t,e){return!t[16].single&&t[7]?.length?0:t[17]?1:t[14]&&t[16].view&&t[16].maxItem?2:-1}return~(e=s(t))&&(n=a[e]=i[e](t)),{c(){n&&n.c(),r=empty()},m(t,n){~e&&a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?~e&&a[e].p(t,o):(n&&(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros()),~e?(n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r)):n=null)},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){~e&&a[e].d(t),t&&detach(r)}}}function create_if_block_4$3(t){let e,n,r,o,i;return n=new ArrowDownCircleIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"title","Übernehmen"),attr(e,"class","feather pointer svelte-1rbaejz")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[26]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_if_block_3$3(t){let e,n,r,o,i;return n=new CommandIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"title",t[17].title||"Generieren"),attr(e,"class","feather pointer svelte-1rbaejz")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[25]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_if_block_2$6(t){let e,n,r,o,i;return n=new DeleteIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"title","Löschen"),attr(e,"class","feather pointer svelte-1rbaejz")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[27]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_if_block$m(t){let e,n,r;function o(e){t[37](e)}let i={class:"tModal",noClickaway:!0,$$slots:{default:[create_default_slot$8]},$$scope:{ctx:t}};return void 0!==t[10]&&(i.open=t[10]),e=new t[11]({props:i}),binding_callbacks.push(()=>bind(e,"open",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};53&r[0]|32768&r[1]&&(o.$$scope={dirty:r,ctx:t}),!n&&1024&r[0]&&(n=!0,o.open=t[10],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_default_slot$8(t){let e,n;return e=new ComposedList({props:{classId:t[2],selection:t[0],refDoc:t[19],view:t[15],status:t[18],unique:t[16].unique&&t[4].name,uniqueView:t[16].view&&{[t[16].view]:t[5][t[16].view]},id:t[5][t[21]||t[20]],tableName:t[20],idName:t[21],designation:t[4].designation,target:t[4].name,single:t[16].single}}),e.$on("choose",t[24]),e.$on("back",t[23]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4&n[0]&&(r.classId=t[2]),1&n[0]&&(r.selection=t[0]),16&n[0]&&(r.unique=t[16].unique&&t[4].name),32&n[0]&&(r.uniqueView=t[16].view&&{[t[16].view]:t[5][t[16].view]}),32&n[0]&&(r.id=t[5][t[21]||t[20]]),16&n[0]&&(r.designation=t[4].designation),16&n[0]&&(r.target=t[4].name),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$q(t){let e,n,r,o,i,a,s,c,l,d=!t[16].single&&t[7]?.length&&create_if_block_5$3(t);function u(e){t[35](e)}function h(e){t[36](e)}let m={id:t[3],name:t[3],class:t[3],readonly:t[13],disabled:t[1],required:t[6],placeholder:t[8],getOptions:getOptions,minSearchLength:"3",$$slots:{"load-more-options-message":[create_load_more_options_message_slot$1]},$$scope:{ctx:t}};void 0!==t[7]&&(m.selection=t[7]),void 0!==t[9]&&(m.maxOptions=t[9]),r=new t[12]({props:m}),binding_callbacks.push(()=>bind(r,"selection",u)),binding_callbacks.push(()=>bind(r,"maxOptions",h)),r.$on("change",t[22]);let f=!t[1]&&create_if_block_1$b(t),p=t[10]&&create_if_block$m(t);return{c(){e=element("div"),d&&d.c(),n=space(),create_component(r.$$.fragment),a=space(),f&&f.c(),s=space(),p&&p.c(),c=empty(),set_style(e,"position","relative")},m(t,o){insert(t,e,o),d&&d.m(e,null),append(e,n),mount_component(r,e,null),append(e,a),f&&f.m(e,null),insert(t,s,o),p&&p.m(t,o),insert(t,c,o),l=!0},p(t,a){!t[16].single&&t[7]?.length?d?d.p(t,a):(d=create_if_block_5$3(t),d.c(),d.m(e,n)):d&&(d.d(1),d=null);const s={};8&a[0]&&(s.id=t[3]),8&a[0]&&(s.name=t[3]),8&a[0]&&(s.class=t[3]),2&a[0]&&(s.disabled=t[1]),64&a[0]&&(s.required=t[6]),256&a[0]&&(s.placeholder=t[8]),32768&a[1]&&(s.$$scope={dirty:a,ctx:t}),!o&&128&a[0]&&(o=!0,s.selection=t[7],add_flush_callback(()=>o=!1)),!i&&512&a[0]&&(i=!0,s.maxOptions=t[9],add_flush_callback(()=>i=!1)),r.$set(s),t[1]?f&&(group_outros(),transition_out(f,1,1,()=>{f=null}),check_outros()):f?(f.p(t,a),2&a[0]&&transition_in(f,1)):(f=create_if_block_1$b(t),f.c(),transition_in(f,1),f.m(e,null)),t[10]?p?(p.p(t,a),1024&a[0]&&transition_in(p,1)):(p=create_if_block$m(t),p.c(),transition_in(p,1),p.m(c.parentNode,c)):p&&(group_outros(),transition_out(p,1,1,()=>{p=null}),check_outros())},i(t){l||(transition_in(r.$$.fragment,t),transition_in(f),transition_in(p),l=!0)},o(t){transition_out(r.$$.fragment,t),transition_out(f),transition_out(p),l=!1},d(t){t&&detach(e),d&&d.d(),destroy_component(r),f&&f.d(),t&&detach(s),p&&p.d(t),t&&detach(c)}}}async function*getOptions(t){yield[{name:t}]}function instance$q(t,e,n){const r=createEventDispatcher(),{Modal:o,Autocomplete:i}=getAttractions;let{classId:a}=e,{id:s}=e,{item:c}=e,{record:l}=e,{value:d}=e,{noForm:u=!1}=e,{disabled:h}=e,{formnovalidate:m}=e,{numberInput:f}=e,{praefix:p}=e,{toDelete:_}=e,{reqQuantity:g}=e,{notifyList:w}=e;const{properties:$={}}=c;let{placeholder:y,hint:b,readonly:v,required:I=!1,lookup:C="",view:E=!1,multi:A,max:S=1e3,generate:k=!1,status:T=!0,refDoc:R}=$;const[N,D]=C.split(":");let x=!1,O=d.map&&d.map(t=>({name:t}))||[];h||=v,h&&(y="");const M=({detail:t})=>{let e=[];t.value.map(t=>{const n=t.name?.split(",");e=e.concat(n)}),n(7,O=e.map(t=>({name:t.trim()})));const o=O.map(t=>t.name);r("blur",{value:o}),r("multi",{view:A.view,lookup:C,name:c.name,value:o})};onMount(async()=>{r("multi",{view:A.view,lookup:C,name:c.name,value:d});const t=document.getElementById(s);t.classList.add(a),!v&&C&&t.addEventListener("focus",P)});const P=()=>{if(C){document.getElementById(s).blur();const t=g||S;(A.unique||O.length<t)&&n(10,x=!0)}},B=()=>{n(10,x&&=!1)},F=({detail:t})=>{const e=t.list.map(t=>Array.isArray(t)?t[0]:t);n(7,O=e.map(t=>({name:t}))),r("blur",{value:e}),r("multi",{view:A.view,lookup:C,name:c.name,value:e}),B()},L=async()=>{const t={[D]:l[D]},e=await Request.getSectionView(N,t),n=Array.from({length:e.length},(t,n)=>e[n][c.name]);F({detail:{name:c.name,list:n}})},q=(t=!1)=>{if(h||!A.required)return;const e=A.maxItem;if(!e||A.unique)return;n(9,S=!1!==t?t:g||l[e]||0);const o=O?.length!=S,i=document.getElementById(s);i?.classList?.toggle("invalid",o),r("invalid",{idx:p,value:o})};return t.$$set=t=>{"classId"in t&&n(2,a=t.classId),"id"in t&&n(3,s=t.id),"item"in t&&n(4,c=t.item),"record"in t&&n(5,l=t.record),"value"in t&&n(0,d=t.value),"noForm"in t&&n(28,u=t.noForm),"disabled"in t&&n(1,h=t.disabled),"formnovalidate"in t&&n(29,m=t.formnovalidate),"numberInput"in t&&n(30,f=t.numberInput),"praefix"in t&&n(31,p=t.praefix),"toDelete"in t&&n(32,_=t.toDelete),"reqQuantity"in t&&n(33,g=t.reqQuantity),"notifyList"in t&&n(34,w=t.notifyList)},t.$$.update=()=>{48&t.$$.dirty[0]&&l&&""===l[c.name]&&n(7,O=[]),48&t.$$.dirty[0]&&l&&Array.isArray(l[c.name])&&n(7,O=l[c.name].map(t=>({name:t}))),16&t.$$.dirty[0]|2&t.$$.dirty[1]&&_&&_===c.name&&n(7,O=[]),128&t.$$.dirty[0]&&O&&(n(0,d=O.map&&O.map(t=>t.name)||[]),q()),1073741824&t.$$.dirty[0]&&((t={})=>{const{item:e,value:n,idx:r}=t;void 0!==p&&p!==r||e&&e.name===A.maxItem&&q(n)})(f),536870976&t.$$.dirty[0]&&n(6,I=I&&!m),8&t.$$.dirty[1]&&(async t=>{if(void 0===p)return;const{itemName:e,value:o}=t||{};if(o){if(c.refItem&&c.refItem?.split(".")[0]===e){let[t,e]=c.refItem.split(".");if(Array.isArray(o)){if(t=t.slice(0,-1),!o.length)return r("record",{itemName:"quantity",value:0}),void n(7,O=[]);const i={_id:{$in:o}},a=await Request.getSectionView(t,i);let s=[];for(const t of a)t[e]&&(s=s.concat(t[e][0][c.name]));if(!s.length)return;r("record",{itemName:"quantity",value:s.length}),n(7,O=s.map(t=>({name:t}))),M({detail:{value:O}})}else{const i=await Request.getTask(t,o);if(!i||!i[e])return;const a=i[e];if(!Array.isArray(a)&&!a.length)return;const s=a[p][c.name];r("record",{itemName:"quantity",value:s?.length||0}),n(7,O=s&&s.map(t=>({name:t})))}}if(c.refItem2&&c.refItem2?.split(".")[0]===e){let[t,e]=c.refItem2.split(".");if(Array.isArray(o))if(Array.isArray(o)){if(t=t.slice(0,-1),!o.length)return r("record",{itemName:"quantity",value:0}),void n(7,O=[]);const i={_id:{$in:o}},a=await Request.getSectionView(t,i);let s=[];for(const t of a)t[e]&&(s=s.concat(t[e][0][c.name]));if(!s.length)return;r("record",{itemName:"quantity",value:s.length}),n(7,O=s.map(t=>({name:t}))),M({detail:{value:O}})}else{const i=await Request.getTask(t,o);if(!i||!i[e])return;const a=i[e];if(!Array.isArray(a)&&!a.length)return;const s=a[p][c.name];r("record",{itemName:"quantity",value:s?.length||0}),n(7,O=s&&s.map(t=>({name:t})))}}setTimeout(q,250)}})(w)},[d,h,a,s,c,l,I,O,y,S,x,o,i,v,C,E,A,k,T,R,N,D,M,B,F,()=>{const t=l[k.itemQuantity]||g;if(!t)return;const e=k.prefix||"",n=l[k.variable]||"",r=k.len||5,o=Array.from({length:t},(t,o)=>e+n+"-"+o.toString().padStart(r,"0"));F({detail:{name:c.name,list:o}})},async()=>{if(!0===E)return L();const t=g||l[A.maxItem];if(!t)return;let e={};D&&(e={[D]:l[D]}),T&&(e.status=!0);const n=[].concat(l[A.view]||[]);n.length&&(e[A.view]={$in:n});const r=await Request.getSectionView(N,e),o=Array.from({length:t<r.length?t:r.length},(t,e)=>r[e][c.name]);F({detail:{name:c.name,list:o}})},()=>{F({detail:{name:c.name,list:[]}})},u,m,f,p,_,g,w,function(t){O=t,n(7,O),n(5,l),n(4,c),n(32,_)},function(t){S=t,n(9,S)},function(t){x=t,n(10,x)}]}class InputMulti extends SvelteComponent{constructor(t){super(),document_1$8.getElementById("svelte-1rbaejz-style")||add_css$m(),init(this,t,instance$q,create_fragment$q,safe_not_equal,{classId:2,id:3,item:4,record:5,value:0,noForm:28,disabled:1,formnovalidate:29,numberInput:30,praefix:31,toDelete:32,reqQuantity:33,notifyList:34},[-1,-1])}}function add_css$l(){var t=element("style");t.id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",append(document.head,t)}function create_else_block$e(t){let e,n,r;return n=new MapPinIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 svelte-9up2nn")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_if_block$l(t){let e,n,r,o,i;return n=new MapPinIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-9up2nn")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[9]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$p(t){let e,n,r,o,i,a;n=new t[8]({props:{inputClass:t[0],disabled:t[1],formnovalidate:t[2],readonly:t[3],required:t[4],id:t[5],name:t[6],value:t[7]}}),n.$on("change",t[12]);const s=[create_if_block$l,create_else_block$e],c=[];function l(t,e){return t[7]?0:1}return o=l(t),i=c[o]=s[o](t),{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i.c(),set_style(e,"position","relative")},m(t,i){insert(t,e,i),mount_component(n,e,null),append(e,r),c[o].m(e,null),a=!0},p(t,[r]){const a={};1&r&&(a.inputClass=t[0]),2&r&&(a.disabled=t[1]),4&r&&(a.formnovalidate=t[2]),8&r&&(a.readonly=t[3]),16&r&&(a.required=t[4]),32&r&&(a.id=t[5]),64&r&&(a.name=t[6]),128&r&&(a.value=t[7]),n.$set(a);let d=o;o=l(t),o===d?c[o].p(t,r):(group_outros(),transition_out(c[d],1,1,()=>{c[d]=null}),check_outros(),i=c[o],i?i.p(t,r):(i=c[o]=s[o](t),i.c()),transition_in(i,1),i.m(e,null))},i(t){a||(transition_in(n.$$.fragment,t),transition_in(i),a=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),a=!1},d(t){t&&detach(e),destroy_component(n),c[o].d()}}}const getMapLink=exports("getMapLink",async t=>{const{street:e,houseNo:n,postcode:r,location:o,country:i}=t,a=[e&&n?e+" "+n:e,r&&o?r+" "+o:r||o||"",i&&(await Request.getTask("country",i)).designation].filter(t=>!!t).join(", ");return"https://bing.com/maps/default.aspx?where1="+encodeURIComponent(a)});function instance$p(t,e,n){const{TextField:r}=getAttractions;let{inputClass:o}=e,{disabled:i}=e,{formnovalidate:a}=e,{readonly:s}=e,{required:c}=e,{id:l}=e,{name:d}=e,{value:u}=e,{record:h}=e,{item:m}=e;return t.$$set=t=>{"inputClass"in t&&n(0,o=t.inputClass),"disabled"in t&&n(1,i=t.disabled),"formnovalidate"in t&&n(2,a=t.formnovalidate),"readonly"in t&&n(3,s=t.readonly),"required"in t&&n(4,c=t.required),"id"in t&&n(5,l=t.id),"name"in t&&n(6,d=t.name),"value"in t&&n(7,u=t.value),"record"in t&&n(10,h=t.record),"item"in t&&n(11,m=t.item)},[o,i,a,s,c,l,d,u,r,async()=>{if(!u)return;const t=d.includes(".")?h[d.split(".")[0]]:h,e=await getMapLink(t);window.open(e,"_blank")},h,m,function(e){bubble(t,e)}]}class InputMap extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-9up2nn-style")||add_css$l(),init(this,t,instance$p,create_fragment$p,safe_not_equal,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,record:10,item:11})}}const{document:document_1$7}=globals;function add_css$k(){var t=element("style");t.id="svelte-wpjws5-style",t.textContent=".feather.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:light-gray;margin-left:-2em}.inputAutoComplete .autocomplete .chip,.inputAutoComplete .autocomplete .shown-on-focus{display:none !important}",append(document_1$7.head,t)}function create_load_more_options_message_slot(t){let e;return{c(){e=element("div"),attr(e,"class","load-more-options"),attr(e,"slot","load-more-options-message")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block$k(t){let e,n,r,o;const i=[create_if_block_1$a,create_else_block$d],a=[];function s(t,e){return t[0]?0:1}return e=s(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?a[e].p(t,o):(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros(),n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function create_else_block$d(t){let e,n,r;return n=new MapPinIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 svelte-wpjws5")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_if_block_1$a(t){let e,n,r,o,i;return n=new MapPinIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-wpjws5")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[8]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$o(t){let e,n,r,o,i,a,s;function c(e){t[17](e)}function l(e){t[18](e)}function d(e){t[19](e)}let u={id:t[1],name:t[1],class:t[1],minSearchLength:"1",maxOptions:"1",getOptions:t[7],$$slots:{"load-more-options-message":[create_load_more_options_message_slot]},$$scope:{ctx:t}};void 0!==t[0]&&(u.value=t[0]),void 0!==t[2]&&(u.selection=t[2]),void 0!==t[3]&&(u.searchQuery=t[3]),n=new t[4]({props:u}),binding_callbacks.push(()=>bind(n,"value",c)),binding_callbacks.push(()=>bind(n,"selection",l)),binding_callbacks.push(()=>bind(n,"searchQuery",d)),n.$on("change",t[6]);let h=t[5]&&create_if_block$k(t);return{c(){e=element("div"),create_component(n.$$.fragment),a=space(),h&&h.c(),set_style(e,"position","relative"),attr(e,"class","inputAutoComplete")},m(t,r){insert(t,e,r),mount_component(n,e,null),append(e,a),h&&h.m(e,null),s=!0},p(t,e){const a={};2&e[0]&&(a.id=t[1]),2&e[0]&&(a.name=t[1]),2&e[0]&&(a.class=t[1]),16&e[1]&&(a.$$scope={dirty:e,ctx:t}),!r&&1&e[0]&&(r=!0,a.value=t[0],add_flush_callback(()=>r=!1)),!o&&4&e[0]&&(o=!0,a.selection=t[2],add_flush_callback(()=>o=!1)),!i&&8&e[0]&&(i=!0,a.searchQuery=t[3],add_flush_callback(()=>i=!1)),n.$set(a),t[5]&&h.p(t,e)},i(t){s||(transition_in(n.$$.fragment,t),transition_in(h),s=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(h),s=!1},d(t){t&&detach(e),destroy_component(n),h&&h.d()}}}function instance$o(t,e,n){const{Autocomplete:r}=getAttractions,o=createEventDispatcher();let{classId:i}=e,{id:a}=e,{item:s}=e,{name:c}=e,{listName:l}=e,{record:d}=e,{value:u}=e,{noForm:h=!1}=e,{disabled:m}=e,{formnovalidate:f}=e;const{autocomplete:{input:p,min:_,url:g,output:w},format:$}=s.properties,y=[].concat(p),{name:b}=w,v="map"===$;let I,C=u,E=!1;onMount(()=>{const t=document.querySelector("."+s.name+" .autocomplete input");t&&(t.addEventListener("focus",k),t.addEventListener("keyup",S),t.addEventListener("keydown",A));const e=document.getElementById(a);e&&e.classList.add(i)});const A=t=>{E=8===t.keyCode||32===t.keyCode},S=t=>{8===t.keyCode&&""===C&&n(0,u="")},k=async()=>{if(_){const t=y[0].name;if((l?d[l][t]:d[t]).length!==_)return}const t=await T();if(t?.length)if(1===t.length){if(u.startsWith(t[0].name))return;n(3,C=n(0,u=t[0].name)),N(u)}else t.find(t=>(C||"").startsWith(t.name))||u||n(3,C=" ");else u||n(3,C="")},T=async(t="")=>{const e=await fetch(g+"?"+R()+"&name=%5E"+t.trim());if(!e.ok)return;const n=e.headers.get("Content-Type").split(";")[0];let r=[];try{if("text/json"===n){const t=await e.text();r=JSON.parse(t||[])}else"application/json"===n&&(r=await e.json())}catch{}return r.map(t=>({name:t[b]}))},R=()=>y.map(({name:t,refItem:e})=>`${e}=${(l?d[l][t]:d[t]).split(" ")[0]}`).join("&"),N=t=>{o("blur",{value:t})};return t.$$set=t=>{"classId"in t&&n(9,i=t.classId),"id"in t&&n(1,a=t.id),"item"in t&&n(10,s=t.item),"name"in t&&n(11,c=t.name),"listName"in t&&n(12,l=t.listName),"record"in t&&n(13,d=t.record),"value"in t&&n(0,u=t.value),"noForm"in t&&n(14,h=t.noForm),"disabled"in t&&n(15,m=t.disabled),"formnovalidate"in t&&n(16,f=t.formnovalidate)},[u,a,I,C,r,v,({detail:{value:t}})=>{t.length&&n(3,C=n(0,u=t[0].name)),n(2,I=[]),N(u)},async function*(t){if(E||u&&t.startsWith(u))return n(0,u=t),void N(u);const e=await T(t);if(!e?.length)return n(0,u=t),void N(u);1===e.length?(n(3,C=n(0,u=e[0].name)),n(2,I=[]),N(u)):yield e},async()=>{if(!u)return;const t=c.includes(".")?d[c.split(".")[0]]:d,e=await getMapLink(t);window.open(e,"_blank")},i,s,c,l,d,h,m,f,function(t){u=t,n(0,u)},function(t){I=t,n(2,I)},function(t){C=t,n(3,C)}]}class InputAutocomplete extends SvelteComponent{constructor(t){super(),document_1$7.getElementById("svelte-wpjws5-style")||add_css$k(),init(this,t,instance$o,create_fragment$o,safe_not_equal,{classId:9,id:1,item:10,name:11,listName:12,record:13,value:0,noForm:14,disabled:15,formnovalidate:16},[-1,-1])}}const{document:document_1$6}=globals;function add_css$j(){var t=element("style");t.id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",append(document_1$6.head,t)}function get_then_context(t){t[26]=t[28].list,t[27]=t[28].items}function get_each_context$6(t,e,n){const r=t.slice();return r[29]=e[n],r}function get_each_context_1$3(t,e,n){const r=t.slice();return r[32]=e[n],r}function get_each_context_2$2(t,e,n){const r=t.slice();return r[32]=e[n],r}function create_catch_block$4(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$4(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w;function $(e){t[23](e)}get_then_context(t),n=new t[7]({props:{outline:!0,$$slots:{default:[create_default_slot_1$5]},$$scope:{ctx:t}}}),n.$on("click",t[22]);let y={id:t[8]};void 0!==t[1]&&(y.value=t[1]),a=new t[6]({props:y}),binding_callbacks.push(()=>bind(a,"value",$)),a.$on("input",t[12]),d=new DeleteIcon({props:{size:"18"}});let b=t[27]?.length&&create_if_block_2$5(t),v=t[26]?.length&&create_if_block$j(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),o=element("div"),i=text("Suchen: "),create_component(a.$$.fragment),c=space(),l=element("span"),create_component(d.$$.fragment),u=space(),h=element("div"),m=element("table"),b&&b.c(),f=space(),p=element("tbody"),v&&v.c(),attr(e,"class","form--buttons svelte-14hcfjl"),attr(l,"class","feather pointer svelte-14hcfjl"),set_style(o,"margin-bottom","1em"),set_style(o,"position","relative"),attr(m,"striped",""),attr(m,"class","svelte-14hcfjl"),attr(h,"class","eList svelte-14hcfjl")},m(s,$){insert(s,e,$),mount_component(n,e,null),insert(s,r,$),insert(s,o,$),append(o,i),mount_component(a,o,null),append(o,c),append(o,l),mount_component(d,l,null),insert(s,u,$),insert(s,h,$),append(h,m),b&&b.m(m,null),append(m,f),append(m,p),v&&v.m(p,null),_=!0,g||(w=listen(l,"click",t[14]),g=!0)},p(t,e){get_then_context(t);const r={};64&e[1]&&(r.$$scope={dirty:e,ctx:t}),n.$set(r);const o={};!s&&2&e[0]&&(s=!0,o.value=t[1],add_flush_callback(()=>s=!1)),a.$set(o),t[27]?.length&&b.p(t,e),t[26]?.length&&v.p(t,e)},i(t){_||(transition_in(n.$$.fragment,t),transition_in(a.$$.fragment,t),transition_in(d.$$.fragment,t),_=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(a.$$.fragment,t),transition_out(d.$$.fragment,t),_=!1},d(t){t&&detach(e),destroy_component(n),t&&detach(r),t&&detach(o),destroy_component(a),destroy_component(d),t&&detach(u),t&&detach(h),b&&b.d(),v&&v.d(),g=!1,w()}}}function create_default_slot_1$5(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_2$5(t){let e,n,r=t[27],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block_2$2(get_each_context_2$2(t,r,e));return{c(){e=element("thead"),n=element("tr");for(let t=0;t<o.length;t+=1)o[t].c();attr(n,"class","svelte-14hcfjl"),attr(e,"class","svelte-14hcfjl")},m(t,r){insert(t,e,r),append(e,n);for(let t=0;t<o.length;t+=1)o[t].m(n,null)},p(t,e){if(2048&e[0]){let i;for(r=t[27],i=0;i<r.length;i+=1){const a=get_each_context_2$2(t,r,i);o[i]?o[i].p(a,e):(o[i]=create_each_block_2$2(a),o[i].c(),o[i].m(n,null))}for(;i<o.length;i+=1)o[i].d(1);o.length=r.length}},d(t){t&&detach(e),destroy_each(o,t)}}}function create_each_block_2$2(t){let e,n,r=t[32]?.designation+"";return{c(){e=element("th"),n=text(r),attr(e,"class","svelte-14hcfjl")},m(t,r){insert(t,e,r),append(e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block$j(t){let e,n=t[26],r=[];for(let e=0;e<n.length;e+=1)r[e]=create_each_block$6(get_each_context$6(t,n,e));return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=empty()},m(t,n){for(let e=0;e<r.length;e+=1)r[e].m(t,n);insert(t,e,n)},p(t,o){if(11779&o[0]){let i;for(n=t[26],i=0;i<n.length;i+=1){const a=get_each_context$6(t,n,i);r[i]?r[i].p(a,o):(r[i]=create_each_block$6(a),r[i].c(),r[i].m(e.parentNode,e))}for(;i<r.length;i+=1)r[i].d(1);r.length=n.length}},d(t){destroy_each(r,t),t&&detach(e)}}}function create_if_block_1$9(t){let e,n,r=t[27],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block_1$3(get_each_context_1$3(t,r,e));return{c(){e=element("tr");for(let t=0;t<o.length;t+=1)o[t].c();n=space(),attr(e,"class","pointer svelte-14hcfjl"),toggle_class(e,"active",t[29]._id===t[0])},m(t,r){insert(t,e,r);for(let t=0;t<o.length;t+=1)o[t].m(e,null);append(e,n)},p(t,i){if(3584&i[0]){let a;for(r=t[27],a=0;a<r.length;a+=1){const s=get_each_context_1$3(t,r,a);o[a]?o[a].p(s,i):(o[a]=create_each_block_1$3(s),o[a].c(),o[a].m(e,n))}for(;a<o.length;a+=1)o[a].d(1);o.length=r.length}2049&i[0]&&toggle_class(e,"active",t[29]._id===t[0])},d(t){t&&detach(e),destroy_each(o,t)}}}function create_each_block_1$3(t){let e,n,r,o,i=t[9](t[29],t[32])+"";return{c(){e=element("td"),n=text(i),attr(e,"class","svelte-14hcfjl")},m(i,a){insert(i,e,a),append(e,n),r||(o=listen(e,"click",stop_propagation(t[10](t[29]))),r=!0)},p(e,n){t=e},d(t){t&&detach(e),r=!1,o()}}}function create_each_block$6(t){let e,n=t[13](t[29],t[27],t[1]),r=n&&create_if_block_1$9(t);return{c(){r&&r.c(),e=empty()},m(t,n){r&&r.m(t,n),insert(t,e,n)},p(t,o){2&o[0]&&(n=t[13](t[29],t[27],t[1])),n?r?r.p(t,o):(r=create_if_block_1$9(t),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},d(t){r&&r.d(t),t&&detach(e)}}}function create_pending_block$4(t){let e,n;return e=new t[5]({}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p:noop,i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot$7(t){let e,n,r,o;e=new t[4]({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$4,then:create_then_block$4,catch:create_catch_block$4,value:28,blocks:[,,,]};return handle_promise(t[11](),i),{c(){create_component(e.$$.fragment),n=space(),r=empty(),i.block.c()},m(t,a){mount_component(e,t,a),insert(t,n,a),insert(t,r,a),i.block.m(t,i.anchor=a),i.mount=()=>r.parentNode,i.anchor=r,o=!0},p(e,n){update_await_block_branch(i,t=e,n)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(i.block),o=!0)},o(t){transition_out(e.$$.fragment,t);for(let t=0;t<3;t+=1){transition_out(i.blocks[t])}o=!1},d(t){destroy_component(e,t),t&&detach(n),t&&detach(r),i.block.d(t),i.token=null,i=null}}}function create_fragment$n(t){let e,n;return e=new t[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[create_default_slot$7]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};3&n[0]|64&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function instance$n(t,e,n){const r=createEventDispatcher(),{Dialog:o,Divider:i,Loading:a,TextField:s,Button:c}=getAttractions;let{item:l}=e,{className:d}=e,{classId:u}=e,{rowId:h}=e,{viewName:m}=e,{viewValue:f}=e,{recordId:p}=e,{filter:_}=e,g="",w=u+Math.floor(9e3*Math.random()+1e3).toString()+"search";const $=(t,e)=>{if(!e)return;const n=t[e.name];return"boolean"==typeof n?checkBoolean(n):checkDate(t[`_${e.name}`]||t[e.name]||"")},y=Request.getSchemaByClass(d);onMount(()=>{window.setTimeout(()=>{const t=document.querySelector("tr.active");t?t.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(w)?.focus()},200)}),task_notification.subscribe(async t=>{if(!t)return;const e=await y;t.eventId===e.id&&refreshList(e.class,t.eventId)});return t.$$set=t=>{"item"in t&&n(15,l=t.item),"className"in t&&n(16,d=t.className),"classId"in t&&n(17,u=t.classId),"rowId"in t&&n(0,h=t.rowId),"viewName"in t&&n(18,m=t.viewName),"viewValue"in t&&n(19,f=t.viewValue),"recordId"in t&&n(20,p=t.recordId),"filter"in t&&n(21,_=t.filter)},[h,g,r,o,i,a,s,c,w,$,t=>()=>r("choose",{row:t}),async()=>{const t=await y,e="."+u+"#"+m;document.querySelector(e);let n={[m]:f},r=[];n[m]&&(r=await Request.getSectionView(t.class,n,!0)),_&&(r=r.filter(t=>t._id!=_));const o=t.display;return{list:r,items:await getDisplayItems(o,t,r)}},({detail:{value:t}})=>{n(1,g=t)},(t,e,n)=>{if(!n)return!0;for(const r of e)if($(t,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{n(1,g="")},l,d,u,m,f,p,_,()=>r("back"),function(t){g=t,n(1,g)}]}class ViewList2 extends SvelteComponent{constructor(t){super(),document_1$6.getElementById("svelte-14hcfjl-style")||add_css$j(),init(this,t,instance$n,create_fragment$n,safe_not_equal,{item:15,className:16,classId:17,rowId:0,viewName:18,viewValue:19,recordId:20,filter:21},[-1,-1])}}function add_css$i(){var t=element("style");t.id="svelte-wbrqzu-style",t.textContent=".feather.svelte-wbrqzu{position:absolute;top:0.75em;left:0.5em;color:#4300b0}",append(document.head,t)}function create_catch_block$3(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$3(t){let e,n,r,o,i;function a(e){t[21](e)}let s={id:t[2],name:t[3].name,inputClass:t[5]||t[1],disabled:t[6],formnovalidate:t[7],readonly:t[13],pattern:t[12],required:t[14],style:"padding-left:2em;"};void 0!==t[0]&&(s.value=t[0]),n=new t[10]({props:s}),binding_callbacks.push(()=>bind(n,"value",a));let c=!t[6]&&create_if_block_1$8(t);return{c(){e=element("div"),create_component(n.$$.fragment),o=space(),c&&c.c(),set_style(e,"position","relative")},m(t,r){insert(t,e,r),mount_component(n,e,null),append(e,o),c&&c.m(e,null),i=!0},p(t,o){const i={};4&o&&(i.id=t[2]),8&o&&(i.name=t[3].name),34&o&&(i.inputClass=t[5]||t[1]),64&o&&(i.disabled=t[6]),128&o&&(i.formnovalidate=t[7]),!r&&1&o&&(r=!0,i.value=t[0],add_flush_callback(()=>r=!1)),n.$set(i),t[6]?c&&(group_outros(),transition_out(c,1,1,()=>{c=null}),check_outros()):c?(c.p(t,o),64&o&&transition_in(c,1)):(c=create_if_block_1$8(t),c.c(),transition_in(c,1),c.m(e,null))},i(t){i||(transition_in(n.$$.fragment,t),transition_in(c),i=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(c),i=!1},d(t){t&&detach(e),destroy_component(n),c&&c.d()}}}function create_if_block_1$8(t){let e,n,r,o,i;return n=new SearchIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-wbrqzu")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[17]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_pending_block$3(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_if_block$i(t){let e,n,r;function o(e){t[22](e)}let i={class:"tModal",noClickaway:!0,$$slots:{default:[create_default_slot$6]},$$scope:{ctx:t}};return void 0!==t[8]&&(i.open=t[8]),e=new t[11]({props:i}),binding_callbacks.push(()=>bind(e,"open",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};268435994&r&&(o.$$scope={dirty:r,ctx:t}),!n&&256&r&&(n=!0,o.open=t[8],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_default_slot$6(t){let e,n;return e=new ViewList2({props:{item:t[3],className:t[3].refClass,classId:t[1],rowId:"",recordId:t[4]._id,viewName:t[15].selection,viewValue:t[9],filter:t[4]._id}}),e.$on("choose",t[18]),e.$on("back",t[19]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};8&n&&(r.item=t[3]),8&n&&(r.className=t[3].refClass),2&n&&(r.classId=t[1]),16&n&&(r.recordId=t[4]._id),512&n&&(r.viewValue=t[9]),16&n&&(r.filter=t[4]._id),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$m(t){let e,n,r,o={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$3,then:create_then_block$3,catch:create_catch_block$3,value:27,blocks:[,,,]};handle_promise(t[16](),o);let i=t[8]&&create_if_block$i(t);return{c(){o.block.c(),e=space(),i&&i.c(),n=empty()},m(t,a){o.block.m(t,o.anchor=a),o.mount=()=>e.parentNode,o.anchor=e,insert(t,e,a),i&&i.m(t,a),insert(t,n,a),r=!0},p(e,[r]){update_await_block_branch(o,t=e,r),t[8]?i?(i.p(t,r),256&r&&transition_in(i,1)):(i=create_if_block$i(t),i.c(),transition_in(i,1),i.m(n.parentNode,n)):i&&(group_outros(),transition_out(i,1,1,()=>{i=null}),check_outros())},i(t){r||(transition_in(o.block),transition_in(i),r=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(o.blocks[t])}transition_out(i),r=!1},d(t){o.block.d(t),o.token=null,o=null,t&&detach(e),i&&i.d(t),t&&detach(n)}}}function instance$m(t,e,n){const{TextField:r,Modal:o}=getAttractions;let{classId:i}=e,{id:a}=e,{item:s}=e,{record:c}=e,{value:l}=e,{noForm:d=!1}=e,{disabled:u}=e,{formnovalidate:h}=e,{praefix:m}=e;const{properties:f={}}=s;let p,{pattern:_,placeholder:g,readonly:w,required:$=!1,view:y}=f,b=!1;const v=()=>{n(8,b=!1)};return t.$$set=t=>{"classId"in t&&n(1,i=t.classId),"id"in t&&n(2,a=t.id),"item"in t&&n(3,s=t.item),"record"in t&&n(4,c=t.record),"value"in t&&n(0,l=t.value),"noForm"in t&&n(5,d=t.noForm),"disabled"in t&&n(6,u=t.disabled),"formnovalidate"in t&&n(7,h=t.formnovalidate),"praefix"in t&&n(20,m=t.praefix)},[l,i,a,s,c,d,u,h,b,p,r,o,_,w,$,y,async()=>(n(9,p=c[y.selection]),!0),()=>{n(8,b=!0)},({detail:t})=>{n(0,l=t.row[y.value?y.value:"_id"]),v()},v,m,function(t){l=t,n(0,l)},function(t){b=t,n(8,b)}]}class InputView extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-wbrqzu-style")||add_css$i(),init(this,t,instance$m,create_fragment$m,safe_not_equal,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7,praefix:20})}}function add_css$h(){var t=element("style");t.id="svelte-5xpzvo-style",t.textContent="select.svelte-5xpzvo{padding:0 0.625em 0.0625em;box-sizing:border-box;width:100%;border:0 solid rgba(0, 0, 0, 0.42);border-bottom-width:0px;border-bottom-width:0.0625em;border-top-left-radius:0.375em;border-top-right-radius:0.375em;background-color:#f5f5f5;outline:none;font-size:1rem;font-weight:300;height:2.8em}select.svelte-5xpzvo:focus{border:none;border-bottom:2px solid #4300b0}",append(document.head,t)}function get_each_context$5(t,e,n){const r=t.slice();return r[12]=e[n][0],r[13]=e[n][1],r}function create_if_block$h(t){let e;function n(t,e){return t[5]&&!0!==t[8]?create_if_block_1$7:create_else_block$c}let r=n(t),o=r(t);return{c(){o.c(),e=empty()},m(t,n){o.m(t,n),insert(t,e,n)},p(t,i){r!==(r=n(t))&&(o.d(1),o=r(t),o&&(o.c(),o.m(e.parentNode,e)))},d(t){o.d(t),t&&detach(e)}}}function create_else_block$c(t){let e;return{c(){e=element("option"),e.textContent="- ",e.selected=!0,e.__value="",e.value=e.__value},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_1$7(t){let e;return{c(){e=element("option"),e.textContent="-- Bitte wählen -- ",e.disabled=!0,e.selected=!0,e.__value="",e.value=e.__value},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_each_block$5(t){let e,n,r,o,i=t[12]+"";return{c(){e=element("option"),n=text(i),e.__value=r=t[13],e.value=e.__value,e.selected=o=t[0]==t[13]},m(t,r){insert(t,e,r),append(e,n)},p(t,a){64&a&&i!==(i=t[12]+"")&&set_data(n,i),64&a&&r!==(r=t[13])&&(e.__value=r,e.value=e.__value),65&a&&o!==(o=t[0]==t[13])&&(e.selected=o)},d(t){t&&detach(e)}}}function create_fragment$l(t){let e,n,r,o,i,a=!t[7]&&create_if_block$h(t),s=t[6],c=[];for(let e=0;e<s.length;e+=1)c[e]=create_each_block$5(get_each_context$5(t,s,e));return{c(){e=element("select"),a&&a.c(),n=empty();for(let t=0;t<c.length;t+=1)c[t].c();attr(e,"class",r=null_to_empty(t[3]||t[4])+" svelte-5xpzvo"),attr(e,"id",t[2]),attr(e,"name",t[2]),e.disabled=t[1],e.required=t[5]},m(r,s){insert(r,e,s),a&&a.m(e,null),append(e,n);for(let t=0;t<c.length;t+=1)c[t].m(e,null);o||(i=listen(e,"change",t[9]),o=!0)},p(t,[n]){if(t[7]||a.p(t,n),65&n){let r;for(s=t[6],r=0;r<s.length;r+=1){const o=get_each_context$5(t,s,r);c[r]?c[r].p(o,n):(c[r]=create_each_block$5(o),c[r].c(),c[r].m(e,null))}for(;r<c.length;r+=1)c[r].d(1);c.length=s.length}24&n&&r!==(r=null_to_empty(t[3]||t[4])+" svelte-5xpzvo")&&attr(e,"class",r),4&n&&attr(e,"id",t[2]),4&n&&attr(e,"name",t[2]),2&n&&(e.disabled=t[1]),32&n&&(e.required=t[5])},i:noop,o:noop,d(t){t&&detach(e),a&&a.d(),destroy_each(c,t),o=!1,i()}}}function instance$l(t,e,n){const r=createEventDispatcher();let{id:o}=e,{item:i}=e,{value:a}=e,{noForm:s=!1}=e,{classId:c}=e,{disabled:l}=e,{required:d}=e,{enum:u,regulation:h,readonly:m}=i.properties;u&&(u=u.map(t=>[t,t])),"businessMonth"===h&&(a||=1,u=[["Januar",1],["Februar",2],["März",3],["April",4],["Mai",5],["Juni",6],["Juli",7],["August",8],["September",9],["Oktober",10],["November",11],["Dezember",12]]),"financialAccounting"===h&&(a||=2024,u=[["2024/2025",2024]]),"valueAddedTax"===h&&(a||=0,u=[["0% Steuerbefreit",0],["8.1% Normalsatz",.081],["2.6% Reduzierter Satz",.026],["3.8% Beherbergung",.038]]),l||=!!m,l||(l=void 0);return t.$$set=t=>{"id"in t&&n(2,o=t.id),"item"in t&&n(10,i=t.item),"value"in t&&n(0,a=t.value),"noForm"in t&&n(3,s=t.noForm),"classId"in t&&n(4,c=t.classId),"disabled"in t&&n(1,l=t.disabled),"required"in t&&n(5,d=t.required)},[a,l,o,s,c,d,u,h,m,t=>r("blur",{value:t.srcElement.value}),i]}class InputSelect extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-5xpzvo-style")||add_css$h(),init(this,t,instance$l,create_fragment$l,safe_not_equal,{id:2,item:10,value:0,noForm:3,classId:4,disabled:1,required:5})}}function create_if_block$g(t){let e,n,r,o,i;return n=new ArrowDownCircleIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"title","Übernehmen"),attr(e,"class","pointer feather")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[12]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$k(t){let e,n,r,o,i,a,s,c,l;o=new t[8]({props:{id:"dp-"+t[1]+(t[2]?"-"+t[2]:""),value:t[0],readonly:t[5],required:t[7],disabled:t[6],noCalendar:t[9],closeOnSelection:!0}}),o.$on("change",t[11]);let d=t[10]&&create_if_block$g(t);return{c(){e=element("input"),r=space(),create_component(o.$$.fragment),i=space(),d&&d.c(),a=empty(),attr(e,"type","string"),attr(e,"class",n=t[3]||t[4]),attr(e,"id",t[1]),attr(e,"name",t[1]),e.hidden=!0},m(n,u){insert(n,e,u),set_input_value(e,t[0]),insert(n,r,u),mount_component(o,n,u),insert(n,i,u),d&&d.m(n,u),insert(n,a,u),s=!0,c||(l=listen(e,"input",t[18]),c=!0)},p(t,[r]){(!s||24&r&&n!==(n=t[3]||t[4]))&&attr(e,"class",n),(!s||2&r)&&attr(e,"id",t[1]),(!s||2&r)&&attr(e,"name",t[1]),1&r&&set_input_value(e,t[0]);const i={};6&r&&(i.id="dp-"+t[1]+(t[2]?"-"+t[2]:"")),1&r&&(i.value=t[0]),32&r&&(i.readonly=t[5]),128&r&&(i.required=t[7]),64&r&&(i.disabled=t[6]),o.$set(i),t[10]&&d.p(t,r)},i(t){s||(transition_in(o.$$.fragment,t),transition_in(d),s=!0)},o(t){transition_out(o.$$.fragment,t),transition_out(d),s=!1},d(t){t&&detach(e),t&&detach(r),destroy_component(o,t),t&&detach(i),d&&d.d(t),t&&detach(a),c=!1,l()}}}let preValue=new Map;function instance$k(t,e,n){const r=createEventDispatcher(),{DatePicker:o}=getAttractions;let{value:i}=e,{id:a}=e,{item:s}=e,{record:c}=e,{praefix:l}=e,{noForm:d=!1}=e,{classId:u}=e,{eventId:h}=e,{readonly:m}=e,{disabled:f}=e,{required:p}=e,{notifyList:_}=e,{dateInput:g}=e;i||(i=void 0);let w=null;const $=(void 0===l?"":l.toString())+"-"+h+"-"+s.name,y=s.properties?.noCalendar||!1,b=s.properties?.transfer,v=({detail:t})=>{try{n(0,i=applyDate(t.value,i)),void 0!==l&&preValue.set($,new Date(i.valueOf())),I(i)}catch{n(0,i=void 0)}},I=t=>{r("change",{value:new Date(t.valueOf())})};if(void 0!==l&&!i){const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0);i=applyDate(e,i)}return t.$$set=t=>{"value"in t&&n(0,i=t.value),"id"in t&&n(1,a=t.id),"item"in t&&n(13,s=t.item),"record"in t&&n(14,c=t.record),"praefix"in t&&n(2,l=t.praefix),"noForm"in t&&n(3,d=t.noForm),"classId"in t&&n(4,u=t.classId),"eventId"in t&&n(15,h=t.eventId),"readonly"in t&&n(5,m=t.readonly),"disabled"in t&&n(6,f=t.disabled),"required"in t&&n(7,p=t.required),"notifyList"in t&&n(16,_=t.notifyList),"dateInput"in t&&n(17,g=t.dateInput)},t.$$.update=()=>{if(1&t.$$.dirty&&i&&!b&&preValue.has($)&&n(0,i=preValue.get($)),65536&t.$$.dirty&&(async t=>{if(null===w){const t=(await Request.getEvent(h)).output.class[0].item;w=t.find(t=>t.properties?.value?.formula)}w&&w.properties.value.formula.argument[0].refItem===s.name&&(t&&t.itemName!==s.name&&!w.properties.value.formula.argument[1].value&&t.itemName!==w.properties.value.formula.argument[1].refItem.split(".")[0]||r("formula",{item:w}))})(_),131072&t.$$.dirty&&((t={})=>{let{ref:e,val:n,t:r,l:o,n:i}=t;if(i&&(n=i),!n||isNaN(new Date(n)))return;if(r)return;if(!e)return;const[a,c]=e.split(".");a===o&&c===s.name&&null!=l&&v({detail:{value:new Date(n)}})})(g),24673&t.$$.dirty&&c&&c[s.name])try{f||m||n(0,i=applyDate(c[s.name],i))}catch{}},[i,a,l,d,u,m,f,p,o,y,b,v,()=>{r("record",{target:b.target,value:i.toISOString()})},s,c,h,_,g,function(){i=this.value,n(0,i),n(14,c),n(13,s),n(6,f),n(5,m)}]}class InputDate extends SvelteComponent{constructor(t){super(),init(this,t,instance$k,create_fragment$k,safe_not_equal,{value:0,id:1,item:13,record:14,praefix:2,noForm:3,classId:4,eventId:15,readonly:5,disabled:6,required:7,notifyList:16,dateInput:17})}}function create_default_slot_2$3(t){let e;return{c(){e=text("Stunden")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_hours_label_slot(t){let e,n;return e=new t[4]({props:{slot:"hours-label",$$slots:{default:[create_default_slot_2$3]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_1$4(t){let e;return{c(){e=text("Minuten")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_minutes_label_slot(t){let e,n;return e=new t[4]({props:{slot:"minutes-label",$$slots:{default:[create_default_slot_1$4]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot$5(t){let e;return{c(){e=text("Jetzt")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_now_label_slot(t){let e,n;return e=new t[4]({props:{slot:"now-label",$$slots:{default:[create_default_slot$5]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$j(t){let e,n,r,o,i,a,s,c,l;return o=new t[5]({props:{value:t[0],closeOnSelection:!0}}),o.$on("change",t[8]),a=new t[6]({props:{value:t[0],$$slots:{"now-label":[create_now_label_slot],"minutes-label":[create_minutes_label_slot],"hours-label":[create_hours_label_slot]},$$scope:{ctx:t}}}),a.$on("change",t[7]),{c(){e=element("input"),r=space(),create_component(o.$$.fragment),i=space(),create_component(a.$$.fragment),attr(e,"type","string"),attr(e,"class",n=t[2]||t[3]),attr(e,"id",t[1]),attr(e,"name",t[1]),e.hidden=!0},m(n,d){insert(n,e,d),set_input_value(e,t[0]),insert(n,r,d),mount_component(o,n,d),insert(n,i,d),mount_component(a,n,d),s=!0,c||(l=listen(e,"input",t[9]),c=!0)},p(t,[r]){(!s||12&r&&n!==(n=t[2]||t[3]))&&attr(e,"class",n),(!s||2&r)&&attr(e,"id",t[1]),(!s||2&r)&&attr(e,"name",t[1]),1&r&&set_input_value(e,t[0]);const i={};1&r&&(i.value=t[0]),o.$set(i);const c={};1&r&&(c.value=t[0]),4096&r&&(c.$$scope={dirty:r,ctx:t}),a.$set(c)},i(t){s||(transition_in(o.$$.fragment,t),transition_in(a.$$.fragment,t),s=!0)},o(t){transition_out(o.$$.fragment,t),transition_out(a.$$.fragment,t),s=!1},d(t){t&&detach(e),t&&detach(r),destroy_component(o,t),t&&detach(i),destroy_component(a,t),c=!1,l()}}}function instance$j(t,e,n){const r=createEventDispatcher(),{Label:o,DatePicker:i,TimePicker:a}=getAttractions;let{value:s}=e,{id:c}=e,{noForm:l=!1}=e,{classId:d}=e;const u=t=>r("change",{value:t});return t.$$set=t=>{"value"in t&&n(0,s=t.value),"id"in t&&n(1,c=t.id),"noForm"in t&&n(2,l=t.noForm),"classId"in t&&n(3,d=t.classId)},[s,c,l,d,o,i,a,({detail:t})=>{n(0,s=applyTime(t.value,s)),u(s)},({detail:t})=>{n(0,s=applyDate(t.value,s)),u(s)},function(){s=this.value,n(0,s)}]}class InputDateTime extends SvelteComponent{constructor(t){super(),init(this,t,instance$j,create_fragment$j,safe_not_equal,{value:0,id:1,noForm:2,classId:3})}}function add_css$g(){var t=element("style");t.id="svelte-7itxk4-style",t.textContent="div.date-picker.moveLeft div.dropdown.calendar{left:-3em !important}",append(document.head,t)}function create_fragment$i(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_;return u=new t[9]({props:{format:t[5],required:t[3],disabled:t[4],value:t[7],noCalendar:t[10],closeOnSelection:!0}}),u.$on("change",t[11]),m=new t[9]({props:{format:t[6],required:t[3],disabled:t[4],value:t[8],noCalendar:t[10],class:"moveLeft",closeOnSelection:!0}}),m.$on("change",t[12]),{c(){e=element("input"),i=space(),a=element("input"),d=space(),create_component(u.$$.fragment),h=text(" /\n"),create_component(m.$$.fragment),attr(e,"type","string"),attr(e,"class",n=t[1]||t[2]),attr(e,"id",r=t[0]+"_from"),attr(e,"name",o=t[0]+"_from"),e.hidden=!0,attr(a,"type","string"),attr(a,"class",s=t[1]||t[2]),attr(a,"id",c=t[0]+"_to"),attr(a,"name",l=t[0]+"_to"),a.hidden=!0},m(n,r){insert(n,e,r),set_input_value(e,t[7]),insert(n,i,r),insert(n,a,r),set_input_value(a,t[8]),insert(n,d,r),mount_component(u,n,r),insert(n,h,r),mount_component(m,n,r),f=!0,p||(_=[listen(e,"input",t[15]),listen(a,"input",t[16])],p=!0)},p(t,[i]){(!f||6&i&&n!==(n=t[1]||t[2]))&&attr(e,"class",n),(!f||1&i&&r!==(r=t[0]+"_from"))&&attr(e,"id",r),(!f||1&i&&o!==(o=t[0]+"_from"))&&attr(e,"name",o),128&i&&set_input_value(e,t[7]),(!f||6&i&&s!==(s=t[1]||t[2]))&&attr(a,"class",s),(!f||1&i&&c!==(c=t[0]+"_to"))&&attr(a,"id",c),(!f||1&i&&l!==(l=t[0]+"_to"))&&attr(a,"name",l),256&i&&set_input_value(a,t[8]);const d={};32&i&&(d.format=t[5]),8&i&&(d.required=t[3]),16&i&&(d.disabled=t[4]),128&i&&(d.value=t[7]),u.$set(d);const h={};64&i&&(h.format=t[6]),8&i&&(h.required=t[3]),16&i&&(h.disabled=t[4]),256&i&&(h.value=t[8]),m.$set(h)},i(t){f||(transition_in(u.$$.fragment,t),transition_in(m.$$.fragment,t),f=!0)},o(t){transition_out(u.$$.fragment,t),transition_out(m.$$.fragment,t),f=!1},d(t){t&&detach(e),t&&detach(i),t&&detach(a),t&&detach(d),destroy_component(u,t),t&&detach(h),destroy_component(m,t),p=!1,run_all(_)}}}function getDates(t){const e=new Date;let n=e.getFullYear();const r=e.getMonth();e.getDate();let o,i;switch(t){case"currentMonth":o=i=r;break;case"currentYear":o=0,i=o+11;break;case"lastSemiYear":o=r<6?6:0,i=o+5,o>5&&--n;break;case"lastQuarter":o=r<3?9:r<6?0:r<9?3:6,i=o+2,o>8&&--n;break;case"lastMonth":o=i=0===r?11:r-1,11===o&&--n;break;default:o=0,i=o+11,--n}return{first:new Date(n,o,1),last:new Date(n,i+1,0)}}function instance$i(t,e,n){const r=createEventDispatcher(),{DatePicker:o}=getAttractions;let{value:i}=e,{id:a}=e,{item:s}=e,{noForm:c=!1}=e,{classId:l}=e,{required:d}=e,{disabled:u}=e;const{noCalendar:h,preset:m}=s.properties||{};let f="%d.%m.%Y",p="%d.%m.%Y",_=i?.from,g=i?.to;if(m){const{first:t,last:e}=getDates(m);t&&(_=t),e&&(g=e)}"Invalid Date"===_?.toString()&&(_=void 0),"Invalid Date"===g?.toString()&&(g=void 0),u&&(void 0===_&&(f=""),void 0===g&&(p=""));return t.$$set=t=>{"value"in t&&n(13,i=t.value),"id"in t&&n(0,a=t.id),"item"in t&&n(14,s=t.item),"noForm"in t&&n(1,c=t.noForm),"classId"in t&&n(2,l=t.classId),"required"in t&&n(3,d=t.required),"disabled"in t&&n(4,u=t.disabled)},[a,c,l,d,u,f,p,_,g,o,h,({detail:t})=>{n(7,_=applyDate(t.value,_)),g&&_&&g.valueOf()-_.valueOf()<0&&n(7,_=void 0),r("change",{value:_,range:"_from"})},({detail:t})=>{n(8,g=applyDate(t.value,g)),g&&_&&g.valueOf()-_.valueOf()<0&&n(8,g=void 0),r("change",{value:g,range:"_to"})},i,s,function(){_=this.value,n(7,_)},function(){g=this.value,n(8,g)}]}class InputDateRange extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-7itxk4-style")||add_css$g(),init(this,t,instance$i,create_fragment$i,safe_not_equal,{value:13,id:0,item:14,noForm:1,classId:2,required:3,disabled:4})}}const xml2json=(t,e)=>{var n={toObj:function(t){var e={};if(1==t.nodeType){if(t.attributes.length)for(var r=0;r<t.attributes.length;r++)e["@"+t.attributes[r].nodeName]=(t.attributes[r].nodeValue||"").toString();if(t.firstChild){for(var o=0,i=0,a=!1,s=t.firstChild;s;s=s.nextSibling)1==s.nodeType?a=!0:3==s.nodeType&&s.nodeValue.match(/[^ \f\n\r\t\v]/)?o++:4==s.nodeType&&i++;if(a)if(o<2&&i<2){n.removeWhite(t);for(s=t.firstChild;s;s=s.nextSibling)3==s.nodeType?e["#text"]=n.escape(s.nodeValue):4==s.nodeType?e["#cdata"]=n.escape(s.nodeValue):e[s.nodeName]?e[s.nodeName]instanceof Array?e[s.nodeName][e[s.nodeName].length]=n.toObj(s):e[s.nodeName]=[e[s.nodeName],n.toObj(s)]:e[s.nodeName]=n.toObj(s)}else t.attributes.length?e["#text"]=n.escape(n.innerXml(t)):e=n.escape(n.innerXml(t));else if(o)t.attributes.length?e["#text"]=n.escape(n.innerXml(t)):e=n.escape(n.innerXml(t));else if(i)if(i>1)e=n.escape(n.innerXml(t));else for(s=t.firstChild;s;s=s.nextSibling)e["#cdata"]=n.escape(s.nodeValue)}t.attributes.length||t.firstChild||(e=null)}else 9==t.nodeType&&(e=n.toObj(t.documentElement));return e},toJson:function(t,e,r){var o=e?'"'+e+'"':"";if(t instanceof Array){for(var i=0,a=t.length;i<a;i++)t[i]=n.toJson(t[i],"",r+"\t");o+=(e?":[":"[")+(t.length>1?"\n"+r+"\t"+t.join(",\n"+r+"\t")+"\n"+r:t.join(""))+"]"}else if(null==t)o+=(e&&":")+"null";else if("object"==typeof t){var s=[];for(var c in t)s[s.length]=n.toJson(t[c],c,r+"\t");o+=(e?":{":"{")+(s.length>1?"\n"+r+"\t"+s.join(",\n"+r+"\t")+"\n"+r:s.join(""))+"}"}else o+="string"==typeof t?(e&&":")+'"'+t.toString()+'"':(e&&":")+t.toString();return o},innerXml:function(t){var e="";if("innerHTML"in t)e=t.innerHTML;else for(var n=function(t){var e="";if(1==t.nodeType){e+="<"+t.nodeName;for(var r=0;r<t.attributes.length;r++)e+=" "+t.attributes[r].nodeName+'="'+(t.attributes[r].nodeValue||"").toString()+'"';if(t.firstChild){e+=">";for(var o=t.firstChild;o;o=o.nextSibling)e+=n(o);e+="</"+t.nodeName+">"}else e+="/>"}else 3==t.nodeType?e+=t.nodeValue:4==t.nodeType&&(e+="<![CDATA["+t.nodeValue+"]]>");return e},r=t.firstChild;r;r=r.nextSibling)e+=n(r);return e},escape:function(t){return t.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(t){t.normalize();for(var e=t.firstChild;e;)if(3==e.nodeType)if(e.nodeValue.match(/[^ \f\n\r\t\v]/))e=e.nextSibling;else{var r=e.nextSibling;t.removeChild(e),e=r}else 1==e.nodeType?(n.removeWhite(e),e=e.nextSibling):e=e.nextSibling;return t}};return t=(new window.DOMParser).parseFromString(t,"text/xml"),n.toObj(n.removeWhite(t))};var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},requirejs,require,define;function getDefaultExportFromCjs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function createCommonjsModule(t){var e={exports:{}};return t(e,e.exports),e.exports
|
|
2
|
-
/** vim: et:ts=4:sw=4:sts=4
|
|
3
|
-
* @license RequireJS 2.3.7 Copyright jQuery Foundation and other contributors.
|
|
4
|
-
* Released under MIT license, https://github.com/requirejs/requirejs/blob/master/LICENSE
|
|
5
|
-
*/}function add_css$f(){var t=element("style");t.id="svelte-157hlzf-style",t.textContent="label.file-dropzone{margin-top:0 !important}",append(document.head,t)}function create_else_block$b(t){let e,n,r,o,i;function a(e){t[13](e)}let s={class:t[0],id:t[1],name:t[2],accept:".xml",max:"1",beforeChange:t[9]};return void 0!==t[3]&&(s.files=t[3]),e=new t[5]({props:s}),binding_callbacks.push(()=>bind(e,"files",a)),e.$on("change",t[8]),o=new t[6]({props:{inputClass:t[0],hidden:!0,id:t[1],name:t[1],value:t[4]}}),{c(){create_component(e.$$.fragment),r=space(),create_component(o.$$.fragment)},m(t,n){mount_component(e,t,n),insert(t,r,n),mount_component(o,t,n),i=!0},p(t,r){const i={};1&r&&(i.class=t[0]),2&r&&(i.id=t[1]),4&r&&(i.name=t[2]),!n&&8&r&&(n=!0,i.files=t[3],add_flush_callback(()=>n=!1)),e.$set(i);const a={};1&r&&(a.inputClass=t[0]),2&r&&(a.id=t[1]),2&r&&(a.name=t[1]),16&r&&(a.value=t[4]),o.$set(a)},i(t){i||(transition_in(e.$$.fragment,t),transition_in(o.$$.fragment,t),i=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(o.$$.fragment,t),i=!1},d(t){destroy_component(e,t),t&&detach(r),destroy_component(o,t)}}}function create_if_block$f(t){let e,n;return e=new t[6]({props:{inputClass:t[0],readonly:!0,id:t[1],name:t[1],value:t[4]}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1&n&&(r.inputClass=t[0]),2&n&&(r.id=t[1]),2&n&&(r.name=t[1]),16&n&&(r.value=t[4]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$h(t){let e,n,r,o;const i=[create_if_block$f,create_else_block$b],a=[];return e=function(t){return t[7]?0:1}(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,[e]){n.p(t,e)},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function instance$h(t,e,n){const{FileDropzone:r,TextField:o}=getAttractions,i=createEventDispatcher();let{classId:a}=e,{eventId:s}=e,{record:c}=e,{item:l}=e,{id:d}=e,{name:u}=e;const h="camt53"===l.properties?.type;let m=[],f=c[l.name]||"",p=!!c._id;const _=t=>{if(!t?.length)return"";if(t.length<14)return"";const e=t.replaceAll(" ","").slice(-14),n=e.slice(-8),r=e.slice(0,4);let o="";for(let t=0;t<r.length/2;t++){const e=2*t,n=r.substring(e,e+2);o+=String.fromCharCode(n)}return o+n};return t.$$set=t=>{"classId"in t&&n(0,a=t.classId),"eventId"in t&&n(10,s=t.eventId),"record"in t&&n(11,c=t.record),"item"in t&&n(12,l=t.item),"id"in t&&n(1,d=t.id),"name"in t&&n(2,u=t.name)},[a,d,u,m,f,r,o,p,async()=>{const{list:t}=l.properties,e=m[0];if(e){n(4,f=e.name);const r=await e.text();if(h)return(async()=>{})();const o=[],a=xml2json(r).BkToCstmrDbtCdtNtfctn.Ntfctn,s=[].concat(a.Ntry);for(const t of s){let e=[].concat(t.NtryDtls.TxDtls);for(const n of e){const e=n.RmtInf?.Strd?.CdtrRefInf?.Ref||n.Refs.EndToEndId||"",r={date:t.ValDt.Dt,branchName:n.RltdPties?.Dbtr?.Nm||"",amount:n.AmtDtls?.TxAmt?.Amt["#text"]||n.Amt["#text"],reference:e,invoiceId:_(e),information:n.RmtInf?.Ustrd||""};o.push(r)}}o.length&&i("record",{itemName:t,value:o})}},()=>{n(3,m)},s,c,l,function(t){m=t,n(3,m)}]}!function(global,setTimeout){var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.3.7",commentRegExp=/\/\*[\s\S]*?\*\/|([^:"'=]|^)\/\/.*$/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,isBrowser=!("undefined"==typeof window||"undefined"==typeof navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),contexts={},cfg={},globalDefQueue=[],useInteractive=!1,disallowedProps=["__proto__","constructor"];function commentReplace(t,e){return e||""}function isFunction(t){return"[object Function]"===ostring.call(t)}function isArray(t){return"[object Array]"===ostring.call(t)}function each(t,e){if(t)for(var n=0;n<t.length&&(!t[n]||!e(t[n],n,t));n+=1);}function eachReverse(t,e){if(t)for(var n=t.length-1;-1<n&&(!t[n]||!e(t[n],n,t));--n);}function hasProp(t,e){return hasOwn.call(t,e)}function getOwn(t,e){return hasProp(t,e)&&t[e]}function eachProp(t,e){for(var n in t)if(hasProp(t,n)&&-1==disallowedProps.indexOf(n)&&e(t[n],n))break}function mixin(t,e,n,r){e&&eachProp(e,function(e,o){!n&&hasProp(t,o)||(!r||"object"!=typeof e||!e||isArray(e)||isFunction(e)||e instanceof RegExp?t[o]=e:(t[o]||(t[o]={}),mixin(t[o],e,n,r)))})}function bind(t,e){return function(){return e.apply(t,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(t){throw t}function getGlobal(t){var e;return t&&(e=global,each(t.split("."),function(t){e=e[t]}),e)}function makeError(t,e,n,r){return(e=new Error(e+"\nhttps://requirejs.org/docs/errors.html#"+t)).requireType=t,e.requireModules=r,n&&(e.originalError=n),e}if(void 0===define){if(void 0!==requirejs){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}void 0===require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(t,e,n,r){var o,i=defContextName;return isArray(t)||"string"==typeof t||(o=t,isArray(e)?(t=e,e=n,n=r):t=[]),o&&o.context&&(i=o.context),r=(r=getOwn(contexts,i))||(contexts[i]=req.s.newContext(i)),o&&r.configure(o),r.require(t,e,n)},req.config=function(t){return req(t)},req.nextTick=void 0!==setTimeout?function(t){setTimeout(t,4)}:function(t){t()},require=require||req,req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(t){req[t]=function(){var e=contexts[defContextName];return e.require[t].apply(e,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement)&&(head=s.head=baseElement.parentNode),req.onError=defaultOnError,req.createNode=function(t,e,n){var r=t.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return r.type=t.scriptType||"text/javascript",r.charset="utf-8",r.async=!0,r},req.load=function(t,e,n){var r,o=t&&t.config||{};if(isBrowser)return(r=req.createNode(o,e,n)).setAttribute("data-requirecontext",t.contextName),r.setAttribute("data-requiremodule",e),!r.attachEvent||r.attachEvent.toString&&r.attachEvent.toString().indexOf("[native code")<0||isOpera?(r.addEventListener("load",t.onScriptLoad,!1),r.addEventListener("error",t.onScriptError,!1)):(useInteractive=!0,r.attachEvent("onreadystatechange",t.onScriptLoad)),r.src=n,o.onNodeCreated&&o.onNodeCreated(r,o,e,n),currentlyAddingScript=r,baseElement?head.insertBefore(r,baseElement):head.appendChild(r),currentlyAddingScript=null,r;if(isWebWorker)try{setTimeout(function(){},0),importScripts(n),t.completeLoad(e)}catch(r){t.onError(makeError("importscripts","importScripts failed for "+e+" at "+n,r,[e]))}},isBrowser&&!cfg.skipDataMain&&eachReverse(scripts(),function(t){if(head=head||t.parentNode,dataMain=t.getAttribute("data-main"))return mainScript=dataMain,cfg.baseUrl||-1!==mainScript.indexOf("!")||(mainScript=(src=mainScript.split("/")).pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(t,e,n){var r,o;"string"!=typeof t&&(n=e,e=t,t=null),isArray(e)||(n=e,e=null),!e&&isFunction(n)&&(e=[],n.length)&&(n.toString().replace(commentRegExp,commentReplace).replace(cjsRequireRegExp,function(t,n){e.push(n)}),e=(1===n.length?["require"]:["require","exports","module"]).concat(e)),useInteractive&&(r=currentlyAddingScript||getInteractiveScript())&&(t=t||r.getAttribute("data-requiremodule"),o=contexts[r.getAttribute("data-requirecontext")]),o?(o.defQueue.push([t,e,n]),o.defQueueMap[t]=!0):globalDefQueue.push([t,e,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}function newContext(t){var e,n,r,o,i,a={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},s={},c={},l={},d=[],u={},h={},m={},f=1,p=1;function _(t,e,n){var r,o,i,s,c,l,d,u,h,m=e&&e.split("/"),f=a.map,p=f&&f["*"];if(t){e=(t=t.split("/")).length-1,a.nodeIdCompat&&jsSuffixRegExp.test(t[e])&&(t[e]=t[e].replace(jsSuffixRegExp,""));for(var _,g=t="."===t[0].charAt(0)&&m?m.slice(0,m.length-1).concat(t):t,w=0;w<g.length;w++)"."===(_=g[w])?(g.splice(w,1),--w):".."!==_||0===w||1===w&&".."===g[2]||".."===g[w-1]||0<w&&(g.splice(w-1,2),w-=2);t=t.join("/")}if(n&&f&&(m||p)){t:for(i=(o=t.split("/")).length;0<i;--i){if(c=o.slice(0,i).join("/"),m)for(s=m.length;0<s;--s)if(r=(r=getOwn(f,m.slice(0,s).join("/")))&&getOwn(r,c)){l=r,d=i;break t}!u&&p&&getOwn(p,c)&&(u=getOwn(p,c),h=i)}!l&&u&&(l=u,d=h),l&&(o.splice(0,d,l),t=o.join("/"))}return getOwn(a.pkgs,t)||t}function g(t){isBrowser&&each(scripts(),function(e){if(e.getAttribute("data-requiremodule")===t&&e.getAttribute("data-requirecontext")===r.contextName)return e.parentNode.removeChild(e),!0})}function w(t){var e=getOwn(a.paths,t);return e&&isArray(e)&&1<e.length&&(e.shift(),r.require.undef(t),r.makeRequire(null,{skipMap:!0})([t]),1)}function $(t){var e,n=t?t.indexOf("!"):-1;return-1<n&&(e=t.substring(0,n),t=t.substring(n+1,t.length)),[e,t]}function y(t,e,n,o){var i,a,s,c=null,l=e?e.name:null,d=t,h=!0,m="";return t||(h=!1,t="_@r"+(f+=1)),c=(s=$(t))[0],t=s[1],c&&(c=_(c,l,o),a=getOwn(u,c)),t&&(c?m=n?t:a&&a.normalize?a.normalize(t,function(t){return _(t,l,o)}):-1===t.indexOf("!")?_(t,l,o):t:(c=(s=$(m=_(t,l,o)))[0],n=!0,i=r.nameToUrl(m=s[1]))),{prefix:c,name:m,parentMap:e,unnormalized:!!(t=!c||a||n?"":"_unnormalized"+(p+=1)),url:i,originalName:d,isDefine:h,id:(c?c+"!"+m:m)+t}}function b(t){var e=t.id;return getOwn(s,e)||(s[e]=new r.Module(t))}function v(t,e,n){var r=t.id,o=getOwn(s,r);!hasProp(u,r)||o&&!o.defineEmitComplete?(o=b(t)).error&&"error"===e?n(o.error):o.on(e,n):"defined"===e&&n(u[r])}function I(t,e){var n=t.requireModules,r=!1;e?e(t):(each(n,function(e){(e=getOwn(s,e))&&(e.error=t,e.events.error)&&(r=!0,e.emit("error",t))}),r||req.onError(t))}function C(){globalDefQueue.length&&(each(globalDefQueue,function(t){var e=t[0];"string"==typeof e&&(r.defQueueMap[e]=!0),d.push(t)}),globalDefQueue=[])}function E(t){delete s[t],delete c[t]}function A(){var t,n=1e3*a.waitSeconds,o=n&&r.startTime+n<(new Date).getTime(),l=[],d=[],h=!1,m=!0;if(!e){if(e=!0,eachProp(c,function(e){var n=e.map,r=n.id;if(e.enabled&&(n.isDefine||d.push(e),!e.error))if(!e.inited&&o)w(r)?h=t=!0:(l.push(r),g(r));else if(!e.inited&&e.fetched&&n.isDefine&&(h=!0,!n.prefix))return m=!1}),o&&l.length)return(n=makeError("timeout","Load timeout for modules: "+l,null,l)).contextName=r.contextName,I(n);m&&each(d,function(t){!function t(e,n,r){var o=e.map.id;e.error?e.emit("error",e.error):(n[o]=!0,each(e.depMaps,function(o,i){o=o.id;var a=getOwn(s,o);!a||e.depMatched[i]||r[o]||(getOwn(n,o)?(e.defineDep(i,u[o]),e.check()):t(a,n,r))}),r[o]=!0)}(t,{},{})}),o&&!t||!h||(isBrowser||isWebWorker)&&(i=i||setTimeout(function(){i=0,A()},50)),e=!1}}function S(t){hasProp(u,t[0])||b(y(t[0],null,!0)).init(t[1],t[2])}function k(t,e,n,r){t.detachEvent&&!isOpera?r&&t.detachEvent(r,e):t.removeEventListener(n,e,!1)}function T(t){return k(t=t.currentTarget||t.srcElement,r.onScriptLoad,"load","onreadystatechange"),k(t,r.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function R(){var t;for(C();d.length;){if(null===(t=d.shift())[0])return I(makeError("mismatch","Mismatched anonymous define() module: "+t[t.length-1]));S(t)}r.defQueueMap={}}return o={require:function(t){return t.require||(t.require=r.makeRequire(t.map))},exports:function(t){if(t.usingExports=!0,t.map.isDefine)return t.exports?u[t.map.id]=t.exports:t.exports=u[t.map.id]={}},module:function(t){return t.module||(t.module={id:t.map.id,uri:t.map.url,config:function(){return getOwn(a.config,t.map.id)||{}},exports:t.exports||(t.exports={})})}},(n=function(t){this.events=getOwn(l,t.id)||{},this.map=t,this.shim=getOwn(a.shim,t.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0}).prototype={init:function(t,e,n,r){r=r||{},this.inited||(this.factory=e,n?this.on("error",n):this.events.error&&(n=bind(this,function(t){this.emit("error",t)})),this.depMaps=t&&t.slice(0),this.errback=n,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check())},defineDep:function(t,e){this.depMatched[t]||(this.depMatched[t]=!0,--this.depCount,this.depExports[t]=e)},fetch:function(){if(!this.fetched){this.fetched=!0,r.startTime=(new Date).getTime();var t=this.map;if(!this.shim)return t.prefix?this.callPlugin():this.load();r.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return t.prefix?this.callPlugin():this.load()}))}},load:function(){var t=this.map.url;h[t]||(h[t]=!0,r.load(this.map.id,t))},check:function(){if(this.enabled&&!this.enabling){var t,e,n=this.map.id,o=this.depExports,i=this.exports,a=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,this.depCount<1&&!this.defined){if(isFunction(a)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{i=r.execCb(n,a,o,i)}catch(n){t=n}else i=r.execCb(n,a,o,i);if(this.map.isDefine&&void 0===i&&((o=this.module)?i=o.exports:this.usingExports&&(i=this.exports)),t)return t.requireMap=this.map,t.requireModules=this.map.isDefine?[this.map.id]:null,t.requireType=this.map.isDefine?"define":"require",I(this.error=t)}else i=a;this.exports=i,this.map.isDefine&&!this.ignore&&(u[n]=i,req.onResourceLoad)&&(e=[],each(this.depMaps,function(t){e.push(t.normalizedMap||t)}),req.onResourceLoad(r,this.map,e)),E(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else hasProp(r.defQueueMap,n)||this.fetch()}},callPlugin:function(){var t=this.map,e=t.id,n=y(t.prefix);this.depMaps.push(n),v(n,"defined",bind(this,function(n){var o,i,c=getOwn(m,this.map.id),l=this.map.name,d=this.map.parentMap?this.map.parentMap.name:null,u=r.makeRequire(t.parentMap,{enableBuildCallback:!0});this.map.unnormalized?(n.normalize&&(l=n.normalize(l,function(t){return _(t,d,!0)})||""),v(i=y(t.prefix+"!"+l,this.map.parentMap,!0),"defined",bind(this,function(t){this.map.normalizedMap=i,this.init([],function(){return t},null,{enabled:!0,ignore:!0})})),(l=getOwn(s,i.id))&&(this.depMaps.push(i),this.events.error&&l.on("error",bind(this,function(t){this.emit("error",t)})),l.enable())):c?(this.map.url=r.nameToUrl(c),this.load()):((o=bind(this,function(t){this.init([],function(){return t},null,{enabled:!0})})).error=bind(this,function(t){this.inited=!0,(this.error=t).requireModules=[e],eachProp(s,function(t){0===t.map.id.indexOf(e+"_unnormalized")&&E(t.map.id)}),I(t)}),o.fromText=bind(this,function(n,i){var s=t.name,c=y(s),l=useInteractive;i&&(n=i),l&&(useInteractive=!1),b(c),hasProp(a.config,e)&&(a.config[s]=a.config[e]);try{req.exec(n)}catch(n){return I(makeError("fromtexteval","fromText eval for "+e+" failed: "+n,n,[e]))}l&&(useInteractive=!0),this.depMaps.push(c),r.completeLoad(s),u([s],o)}),n.load(t.name,u,o,a))})),r.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){(c[this.map.id]=this).enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(t,e){var n,i;if("string"==typeof t){if(t=y(t,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[e]=t,i=getOwn(o,t.id))return void(this.depExports[e]=i(this));this.depCount+=1,v(t,"defined",bind(this,function(t){this.undefed||(this.defineDep(e,t),this.check())})),this.errback?v(t,"error",bind(this,this.errback)):this.events.error&&v(t,"error",bind(this,function(t){this.emit("error",t)}))}i=t.id,n=s[i],hasProp(o,i)||!n||n.enabled||r.enable(t,this)})),eachProp(this.pluginMaps,bind(this,function(t){var e=getOwn(s,t.id);e&&!e.enabled&&r.enable(t,this)})),this.enabling=!1,this.check()},on:function(t,e){(this.events[t]||(this.events[t]=[])).push(e)},emit:function(t,e){each(this.events[t],function(t){t(e)}),"error"===t&&delete this.events[t]}},(r={config:a,contextName:t,registry:s,defined:u,urlFetched:h,defQueue:d,defQueueMap:{},Module:n,makeModuleMap:y,nextTick:req.nextTick,onError:I,configure:function(t){t.baseUrl&&"/"!==t.baseUrl.charAt(t.baseUrl.length-1)&&(t.baseUrl+="/"),"string"==typeof t.urlArgs&&(e=t.urlArgs,t.urlArgs=function(t,n){return(-1===n.indexOf("?")?"?":"&")+e});var e,n=a.shim,o={paths:!0,bundles:!0,config:!0,map:!0};eachProp(t,function(t,e){o[e]?(a[e]||(a[e]={}),mixin(a[e],t,!0,!0)):a[e]=t}),t.bundles&&eachProp(t.bundles,function(t,e){each(t,function(t){t!==e&&(m[t]=e)})}),t.shim&&(eachProp(t.shim,function(t,e){!(t=isArray(t)?{deps:t}:t).exports&&!t.init||t.exportsFn||(t.exportsFn=r.makeShimExports(t)),n[e]=t}),a.shim=n),t.packages&&each(t.packages,function(t){var e=(t="string"==typeof t?{name:t}:t).name;t.location&&(a.paths[e]=t.location),a.pkgs[e]=t.name+"/"+(t.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}),eachProp(s,function(t,e){t.inited||t.map.unnormalized||(t.map=y(e,null,!0))}),(t.deps||t.callback)&&r.require(t.deps||[],t.callback)},makeShimExports:function(t){return function(){var e;return(e=t.init?t.init.apply(global,arguments):e)||t.exports&&getGlobal(t.exports)}},makeRequire:function(e,n){function i(a,c,l){var d,h;return n.enableBuildCallback&&c&&isFunction(c)&&(c.__requireJsBuild=!0),"string"==typeof a?isFunction(c)?I(makeError("requireargs","Invalid require call"),l):e&&hasProp(o,a)?o[a](s[e.id]):req.get?req.get(r,a,e,i):(d=y(a,e,!1,!0).id,hasProp(u,d)?u[d]:I(makeError("notloaded",'Module name "'+d+'" has not been loaded yet for context: '+t+(e?"":". Use require([])")))):(R(),r.nextTick(function(){R(),(h=b(y(null,e))).skipMap=n.skipMap,h.init(a,c,l,{enabled:!0}),A()}),i)}return n=n||{},mixin(i,{isBrowser:isBrowser,toUrl:function(t){var n,o=t.lastIndexOf("."),i=t.split("/")[0];return-1!==o&&(!("."===i||".."===i)||1<o)&&(n=t.substring(o,t.length),t=t.substring(0,o)),r.nameToUrl(_(t,e&&e.id,!0),n,!0)},defined:function(t){return hasProp(u,y(t,e,!1,!0).id)},specified:function(t){return t=y(t,e,!1,!0).id,hasProp(u,t)||hasProp(s,t)}}),e||(i.undef=function(t){C();var n=y(t,e,!0),o=getOwn(s,t);o.undefed=!0,g(t),delete u[t],delete h[n.url],delete l[t],eachReverse(d,function(e,n){e[0]===t&&d.splice(n,1)}),delete r.defQueueMap[t],o&&(o.events.defined&&(l[t]=o.events),E(t))}),i},enable:function(t){getOwn(s,t.id)&&b(t).enable()},completeLoad:function(t){var e,n,o,i=getOwn(a.shim,t)||{},c=i.exports;for(C();d.length;){if(null===(n=d.shift())[0]){if(n[0]=t,e)break;e=!0}else n[0]===t&&(e=!0);S(n)}if(r.defQueueMap={},o=getOwn(s,t),!e&&!hasProp(u,t)&&o&&!o.inited){if(!(!a.enforceDefine||c&&getGlobal(c)))return w(t)?void 0:I(makeError("nodefine","No define call for "+t,null,[t]));S([t,i.deps||[],i.exportsFn])}A()},nameToUrl:function(t,e,n){var o,i,s,c,l,d=getOwn(a.pkgs,t);if(d=getOwn(m,t=d||t))return r.nameToUrl(d,e,n);if(req.jsExtRegExp.test(t))c=t+(e||"");else{for(o=a.paths,s=(i=t.split("/")).length;0<s;--s)if(l=getOwn(o,i.slice(0,s).join("/"))){isArray(l)&&(l=l[0]),i.splice(0,s,l);break}c=i.join("/"),c=("/"===(c+=e||(/^data\:|^blob\:|\?/.test(c)||n?"":".js")).charAt(0)||c.match(/^[\w\+\.\-]+:/)?"":a.baseUrl)+c}return a.urlArgs&&!/^blob\:/.test(c)?c+a.urlArgs(t,c):c},load:function(t,e){req.load(r,t,e)},execCb:function(t,e,n,r){return e.apply(r,n)},onScriptLoad:function(t){"load"!==t.type&&!readyRegExp.test((t.currentTarget||t.srcElement).readyState)||(interactiveScript=null,t=T(t),r.completeLoad(t.id))},onScriptError:function(t){var e,n=T(t);if(!w(n.id))return e=[],eachProp(s,function(t,r){0!==r.indexOf("_@r")&&each(t.depMaps,function(t){if(t.id===n.id)return e.push(r),!0})}),I(makeError("scripterror",'Script error for "'+n.id+(e.length?'", needed by: '+e.join(", "):'"'),t,[n.id]))}}).require=r.makeRequire(),r}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState||eachReverse(scripts(),function(t){if("interactive"===t.readyState)return interactiveScript=t}),interactiveScript}}(commonjsGlobal,"undefined"==typeof setTimeout?void 0:setTimeout);class InputFile extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-157hlzf-style")||add_css$f(),init(this,t,instance$h,create_fragment$h,safe_not_equal,{classId:0,eventId:10,record:11,item:12,id:1,name:2})}}const readSwissQR=t=>{const e={},n=t.replaceAll("\r","").split("\n");return n?(e.iban=n[3],e.supplierText=n[5]+", "+n[6]+", "+n[7]+", "+n[8]+", "+n[9],e.supplier={company:{}},e.supplier.company.companyName=n[5],e.supplier.company.postcode=n[8],e.amount=n[18],e.amountOrg=n[18],e.currency={},e.currency.designation=n[19],e.reference=n[28],e.additionalInfo=n[29],e.extReference=getQrInfo(10,n[31]),e.amountVat=getVat(getQrInfo(32,n[31]),e.amount)||getVat(getQrInfo(33,n[31]),e.amount),e):e},getQrInfo=(t,e)=>{if(!t)return"";if(!e)return"";const n=e.split("/"+t+"/")[1];return n?.split("/")[0]||""},getVat=(t,e)=>{if(!t)return"";let n=0;if(t.includes(":")){const e=t.split(";");for(const t of e)n+=t.split(":")[1]}else n=+e/(+t+100)*+t;return n},{document:document_1$5}=globals;function add_css$e(){var t=element("style");t.id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",append(document_1$5.head,t)}function create_else_block$a(t){let e,n,r,o,i;function a(e){t[14](e)}let s={class:t[0],id:t[1],name:t[2],accept:"application/pdf",max:"1",beforeChange:t[10]};return void 0!==t[3]&&(s.files=t[3]),e=new t[5]({props:s}),binding_callbacks.push(()=>bind(e,"files",a)),e.$on("change",t[8]),o=new t[6]({props:{inputClass:t[0],hidden:!0,id:t[1],name:t[1],value:t[4]}}),{c(){create_component(e.$$.fragment),r=space(),create_component(o.$$.fragment)},m(t,n){mount_component(e,t,n),insert(t,r,n),mount_component(o,t,n),i=!0},p(t,r){const i={};1&r&&(i.class=t[0]),2&r&&(i.id=t[1]),4&r&&(i.name=t[2]),!n&&8&r&&(n=!0,i.files=t[3],add_flush_callback(()=>n=!1)),e.$set(i);const a={};1&r&&(a.inputClass=t[0]),2&r&&(a.id=t[1]),2&r&&(a.name=t[1]),16&r&&(a.value=t[4]),o.$set(a)},i(t){i||(transition_in(e.$$.fragment,t),transition_in(o.$$.fragment,t),i=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(o.$$.fragment,t),i=!1},d(t){destroy_component(e,t),t&&detach(r),destroy_component(o,t)}}}function create_if_block$e(t){let e,n,r,o;n=new t[6]({props:{inputClass:t[0],readonly:!0,id:t[1],name:t[1],value:t[4]}});let i=t[4]&&create_if_block_1$6(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i&&i.c(),set_style(e,"position","relative")},m(t,a){insert(t,e,a),mount_component(n,e,null),append(e,r),i&&i.m(e,null),o=!0},p(t,r){const o={};1&r&&(o.inputClass=t[0]),2&r&&(o.id=t[1]),2&r&&(o.name=t[1]),16&r&&(o.value=t[4]),n.$set(o),t[4]?i?(i.p(t,r),16&r&&transition_in(i,1)):(i=create_if_block_1$6(t),i.c(),transition_in(i,1),i.m(e,null)):i&&(group_outros(),transition_out(i,1,1,()=>{i=null}),check_outros())},i(t){o||(transition_in(n.$$.fragment,t),transition_in(i),o=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),o=!1},d(t){t&&detach(e),destroy_component(n),i&&i.d()}}}function create_if_block_1$6(t){let e,n,r,o,i;return n=new AirplayIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-o0hiko")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[9]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$g(t){let e,n,r,o;const i=[create_if_block$e,create_else_block$a],a=[];return e=function(t){return t[7]?0:1}(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,[e]){n.p(t,e)},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}let _PDF_QR_JS;function instance$g(t,e,n){const{FileDropzone:r,TextField:o}=getAttractions,i=createEventDispatcher();let{classId:a}=e,{eventId:s}=e,{record:c}=e,{item:l}=e,{id:d}=e,{name:u}=e,h=[],m=c[l.name]||"",f=!!c._id;const p={scale:{once:!1,value:1,start:1,step:.2,stop:1.6},resultOpts:{singleCodeInPage:!0,multiCodesInPage:!1,maxCodesInPage:1},improve:!0,jsQR:{}};var _=async function(t){if(!t.success)return;const e=await Request.getSchema(s),r=t.codes?.filter(t=>!!t)?.at(0);if(!r?.length)return;if(!r.startsWith("SPC"))return;const o=readSwissQR(r);for(const t in o){if(e.items.find(e=>e.name===t)){if("object"==typeof o[t]){let e={};for(const r in o[t])if("object"==typeof o[t][r])for(const i in o[t][r]){o[t][r][i]&&(e[i]=o[t][r][i]);const a=await Request.getSectionView(r,e);if(a?.length){const e=await Request.getSectionView(t,{[r]:a[0]._id});e?.length&&n(11,c[t]=e[0]._id,c)}}else{o[t][r]&&(e[r]=o[t][r]);const i=await Request.getSectionView(t,e);i?.length&&n(11,c[t]=i[0]._id,c)}}else o[t]&&n(11,c[t]=o[t],c);i("record",{itemName:t,value:c[t]})}}};return onMount(()=>{if(_PDF_QR_JS)return;let t=document.createElement("script");t.src="/QR/pdf-qr2.js",document.head.append(t),t.onload=function(){_PDF_QR_JS=PDF_QR_JS}}),onDestroy(()=>{}),t.$$set=t=>{"classId"in t&&n(0,a=t.classId),"eventId"in t&&n(12,s=t.eventId),"record"in t&&n(11,c=t.record),"item"in t&&n(13,l=t.item),"id"in t&&n(1,d=t.id),"name"in t&&n(2,u=t.name)},[a,d,u,h,m,r,o,f,async t=>{const e=h[0];if(!e){i("record",{itemName:"$file",value:!1});const t=await Request.getSchema(s);for(const e of t.items)i("record",{itemName:e.name,value:""});return}const r=URL.createObjectURL(e);n(4,m=e.name),i("record",{itemName:"$file",value:{fileName:m,file:e}}),_PDF_QR_JS.decodeDocument(r,p,_)},async()=>{if(!c?._id)return;const t=await Request.getTaskByDocId(c._id,!0);if(!t)return;const e=await Request.getUserReports(t._id);if(!e?.length)return;let n="/viewer/doc/index.html?file="+("/api/userreport/"+e[0]._id)+"&type=pdf";window.open(n,"","popup=yes toolbar=no width=800 height=1024")},()=>{n(3,h)},c,s,l,function(t){h=t,n(3,h)}]}class InputFileQR extends SvelteComponent{constructor(t){super(),document_1$5.getElementById("svelte-o0hiko-style")||add_css$e(),init(this,t,instance$g,create_fragment$g,safe_not_equal,{classId:0,eventId:12,record:11,item:13,id:1,name:2})}}const{document:document_1$4}=globals;function add_css$d(){var t=element("style");t.id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",append(document_1$4.head,t)}function create_else_block_1$4(t){let e,n,r,o,i;function a(e){t[18](e)}let s={class:t[0],id:t[1],name:t[2],accept:t[3],max:"1",beforeChange:t[12]};return void 0!==t[4]&&(s.files=t[4]),e=new t[7]({props:s}),binding_callbacks.push(()=>bind(e,"files",a)),e.$on("change",t[9]),o=new t[8]({props:{inputClass:t[0],hidden:!0,id:t[1],name:t[1],value:t[5]}}),{c(){create_component(e.$$.fragment),r=space(),create_component(o.$$.fragment)},m(t,n){mount_component(e,t,n),insert(t,r,n),mount_component(o,t,n),i=!0},p(t,r){const i={};1&r&&(i.class=t[0]),2&r&&(i.id=t[1]),4&r&&(i.name=t[2]),8&r&&(i.accept=t[3]),!n&&16&r&&(n=!0,i.files=t[4],add_flush_callback(()=>n=!1)),e.$set(i);const a={};1&r&&(a.inputClass=t[0]),2&r&&(a.id=t[1]),2&r&&(a.name=t[1]),32&r&&(a.value=t[5]),o.$set(a)},i(t){i||(transition_in(e.$$.fragment,t),transition_in(o.$$.fragment,t),i=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(o.$$.fragment,t),i=!1},d(t){destroy_component(e,t),t&&detach(r),destroy_component(o,t)}}}function create_if_block$d(t){let e,n,r,o;n=new t[8]({props:{inputClass:t[0],readonly:!0,id:t[1],name:t[1],value:t[5]}});let i=t[5]&&create_if_block_1$5(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i&&i.c(),set_style(e,"position","relative")},m(t,a){insert(t,e,a),mount_component(n,e,null),append(e,r),i&&i.m(e,null),o=!0},p(t,r){const o={};1&r&&(o.inputClass=t[0]),2&r&&(o.id=t[1]),2&r&&(o.name=t[1]),32&r&&(o.value=t[5]),n.$set(o),t[5]?i?(i.p(t,r),32&r&&transition_in(i,1)):(i=create_if_block_1$5(t),i.c(),transition_in(i,1),i.m(e,null)):i&&(group_outros(),transition_out(i,1,1,()=>{i=null}),check_outros())},i(t){o||(transition_in(n.$$.fragment,t),transition_in(i),o=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),o=!1},d(t){t&&detach(e),destroy_component(n),i&&i.d()}}}function create_if_block_1$5(t){let e,n,r,o,i;const a=[create_if_block_2$4,create_else_block$9],s=[];function c(t,n){return 32&n&&(e=!!t[5].endsWith(".mp4")),e?0:1}return n=c(t,-1),r=s[n]=a[n](t),{c(){r.c(),o=empty()},m(t,e){s[n].m(t,e),insert(t,o,e),i=!0},p(t,e){let i=n;n=c(t,e),n===i?s[n].p(t,e):(group_outros(),transition_out(s[i],1,1,()=>{s[i]=null}),check_outros(),r=s[n],r?r.p(t,e):(r=s[n]=a[n](t),r.c()),transition_in(r,1),r.m(o.parentNode,o))},i(t){i||(transition_in(r),i=!0)},o(t){transition_out(r),i=!1},d(t){s[n].d(t),t&&detach(o)}}}function create_else_block$9(t){let e,n,r,o,i;return n=new AirplayIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-o0hiko")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[10]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_if_block_2$4(t){let e,n={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$2,then:create_then_block$2,catch:create_catch_block$2,value:23};return handle_promise(t[11](),n),{c(){e=empty(),n.block.c()},m(t,r){insert(t,e,r),n.block.m(t,n.anchor=r),n.mount=()=>e.parentNode,n.anchor=e},p(e,r){update_await_block_branch(n,t=e,r)},i:noop,o:noop,d(t){t&&detach(e),n.block.d(t),n.token=null,n=null}}}function create_catch_block$2(t){return{c:noop,m:noop,p:noop,d:noop}}function create_then_block$2(t){let e,n,r,o;return{c(){e=element("video"),n=element("source"),o=text("\n Your browser does not support HTML video."),n.src!==(r=t[23])&&attr(n,"src",r),attr(n,"type","video/mp4"),attr(e,"width","500"),e.controls=!0,set_style(e,"margin-top","1em")},m(t,r){insert(t,e,r),append(e,n),append(e,o)},p:noop,d(t){t&&detach(e)}}}function create_pending_block$2(t){return{c:noop,m:noop,p:noop,d:noop}}function create_fragment$f(t){let e,n,r,o;const i=[create_if_block$d,create_else_block_1$4],a=[];function s(t,e){return t[6]?0:1}return e=s(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,[o]){let c=e;e=s(t),e===c?a[e].p(t,o):(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros(),n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function instance$f(t,e,n){const{FileDropzone:r,TextField:o}=getAttractions,i=createEventDispatcher();let{classId:a}=e,{eventId:s}=e,{record:c}=e,{item:l}=e,{id:d}=e,{name:u}=e,{praefix:h}=e,{recordId:m}=e,{fileType:f="application/pdf"}=e,p=[],_="",g=!1;return onMount(()=>{(async()=>{if(!m)return;const t=await Request.getTaskByDocId(m,!0);if(!t)return i("listRecord",{itemName:"fileName",value:"",string:!0});const e=c[l.name];if(!e)return i("listRecord",{itemName:"fileName",value:"",string:!0});const r=await Request.getUserReports(t._id);if(!r?.length)return i("listRecord",{itemName:"fileName",value:"",string:!0});let o=r.find(t=>t.fileName===e);if(!o)return i("listRecord",{itemName:"fileName",value:"",string:!0});n(5,_=o.fileName),n(6,g=void 0===h?!!m:!!_)})()}),onDestroy(()=>{}),t.$$set=t=>{"classId"in t&&n(0,a=t.classId),"eventId"in t&&n(13,s=t.eventId),"record"in t&&n(14,c=t.record),"item"in t&&n(15,l=t.item),"id"in t&&n(1,d=t.id),"name"in t&&n(2,u=t.name),"praefix"in t&&n(16,h=t.praefix),"recordId"in t&&n(17,m=t.recordId),"fileType"in t&&n(3,f=t.fileType)},[a,d,u,f,p,_,g,r,o,async t=>{const e=p[0];URL.createObjectURL(e),n(5,_=e.name),i("record",{itemName:"$file",value:{fileName:_,file:e}}),void 0!==h&&i("listRecord",{itemName:"fileName",value:_,string:!0})},async()=>{if(!m)return;let t;const e=await Request.getTaskByDocId(m,!0);if(!e)return;const n=await Request.getUserReports(e._id);if(!n?.length)return;let r=n.find(t=>t.fileName===_);r||(r=n[0]);t="/viewer/doc/index.html?file="+("/api/userreport/"+r._id)+"&type=pdf",window.open(t,"","popup=yes toolbar=no width=800 height=1024")},async()=>{const t=await Request.getTaskByDocId(m,!0);if(!t)return"";const e=await Request.getUserReports(t._id);if(!e?.length)return"";let n=e.find(t=>t.fileName===_);return n||(n=e[0]),"/api/userreport/"+n._id},()=>{n(4,p)},s,c,l,h,m,function(t){p=t,n(4,p)}]}class InputFilePDF extends SvelteComponent{constructor(t){super(),document_1$4.getElementById("svelte-o0hiko-style")||add_css$d(),init(this,t,instance$f,create_fragment$f,safe_not_equal,{classId:0,eventId:13,record:14,item:15,id:1,name:2,praefix:16,recordId:17,fileType:3})}}function add_css$c(){var t=element("style");t.id="svelte-vvt0yv-style",t.textContent=".text-field input.invalid{border:1px red solid !important}",append(document.head,t)}function create_fragment$e(t){let e,n,r;return n=new t[5]({props:{type:"string",inputClass:t[2],id:t[0],name:t[0],value:t[1],pattern:pattern,placeholder:placeholder,readonly:t[3],disabled:t[4]}}),n.$on("change",t[6]),{c(){e=element("div"),create_component(n.$$.fragment),set_style(e,"max-width","4em")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p(t,[e]){const r={};4&e&&(r.inputClass=t[2]),1&e&&(r.id=t[0]),1&e&&(r.name=t[0]),2&e&&(r.value=t[1]),8&e&&(r.readonly=t[3]),16&e&&(r.disabled=t[4]),n.$set(r)},i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}const pattern="([01][0-9]|2[0-3]):([0-5][0-9])",placeholder="";function instance$e(t,e,n){const r=createEventDispatcher(),{TextField:o}=getAttractions;let{id:i}=e,{item:a}=e,{value:s}=e,{inputClass:c}=e,{readonly:l}=e,{disabled:d}=e,{praefix:u}=e;const h=t=>{if(!t)return"";const[e,n]=t.split(":");return 4===e.length?`${e.substr(0,2)}:${e.substring(2,4)}`:3===e.length?e.substring(0,2)>23?`0${e.substring(0,1)}:${e.substring(1,3)}`:`${e.substring(0,2)}:${e.substring(2,3)}0`:2===e.length?e>23?`0${e.substring(0,1)}:${e.substring(1,2)}0`:`${e}:${(n||"0").padStart(2,"0")}`:`0${e}:${(n||"0").padStart(2,"0")}`};return t.$$set=t=>{"id"in t&&n(0,i=t.id),"item"in t&&n(7,a=t.item),"value"in t&&n(1,s=t.value),"inputClass"in t&&n(2,c=t.inputClass),"readonly"in t&&n(3,l=t.readonly),"disabled"in t&&n(4,d=t.disabled),"praefix"in t&&n(8,u=t.praefix)},[i,s,c,l,d,o,({detail:t})=>{r("blur",{value:h(t.value)}),r("checkRange",{idx:u,fieldId:i,value:t.value})},a,u]}class InputTime extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-vvt0yv-style")||add_css$c(),init(this,t,instance$e,create_fragment$e,safe_not_equal,{id:0,item:7,value:1,inputClass:2,readonly:3,disabled:4,praefix:8})}}const{document:document_1$3}=globals;function add_css$b(){var t=element("style");t.id="svelte-1r8jgd4-style",t.textContent=".feather.svelte-1r8jgd4{position:absolute;top:0;left:-1.5em;color:#4300b0}div.lookup.svelte-1r8jgd4{margin-top:0.75em;color:#aaa}div.lookupItem.svelte-1r8jgd4{position:relative;margin-left:2em;padding-bottom:0.75em}div.form-field:has(div.lookup){margin-bottom:0.5em !important}div.field:has(div.lookupItem){background-color:#f5f5f5 !important}div.field:has(div.lookup){margin-bottom:0.25em !important}",append(document_1$3.head,t)}function get_each_context$4(t,e,n){const r=t.slice();return r[20]=e[n],r}function get_each_context_1$2(t,e,n){const r=t.slice();return r[23]=e[n],r[25]=n,r}function create_if_block$c(t){let e;return{c(){e=text(", ")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_each_block_1$2(t){let e,n,r=t[2](t[20],t[23])+"",o=t[25]&&create_if_block$c();return{c(){e=element("span"),o&&o.c(),n=text(r),attr(e,"class","lookupValue")},m(t,r){insert(t,e,r),o&&o.m(e,null),append(e,n)},p(t,e){3&e&&r!==(r=t[2](t[20],t[23])+"")&&set_data(n,r)},d(t){t&&detach(e),o&&o.d()}}}function create_each_block$4(t){let e,n,r,o,i,a,s,c,l=t[0],d=[];for(let e=0;e<l.length;e+=1)d[e]=create_each_block_1$2(get_each_context_1$2(t,l,e));return o=new ExternalLinkIcon({props:{size:"18"}}),{c(){e=element("div");for(let t=0;t<d.length;t+=1)d[t].c();n=space(),r=element("span"),create_component(o.$$.fragment),i=space(),attr(r,"class","feather pointer svelte-1r8jgd4"),attr(e,"class","lookupItem svelte-1r8jgd4")},m(l,u){insert(l,e,u);for(let t=0;t<d.length;t+=1)d[t].m(e,null);append(e,n),append(e,r),mount_component(o,r,null),append(e,i),a=!0,s||(c=listen(r,"click",function(){is_function(t[3](t[20]._id))&&t[3](t[20]._id).apply(this,arguments)}),s=!0)},p(r,o){if(t=r,7&o){let r;for(l=t[0],r=0;r<l.length;r+=1){const i=get_each_context_1$2(t,l,r);d[r]?d[r].p(i,o):(d[r]=create_each_block_1$2(i),d[r].c(),d[r].m(e,n))}for(;r<d.length;r+=1)d[r].d(1);d.length=l.length}},i(t){a||(transition_in(o.$$.fragment,t),a=!0)},o(t){transition_out(o.$$.fragment,t),a=!1},d(t){t&&detach(e),destroy_each(d,t),destroy_component(o),s=!1,c()}}}function create_fragment$d(t){let e,n,r=t[1],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block$4(get_each_context$4(t,r,e));const i=t=>transition_out(o[t],1,1,()=>{o[t]=null});return{c(){e=element("div");for(let t=0;t<o.length;t+=1)o[t].c();attr(e,"class","lookup svelte-1r8jgd4")},m(t,r){insert(t,e,r);for(let t=0;t<o.length;t+=1)o[t].m(e,null);n=!0},p(t,[n]){if(15&n){let a;for(r=t[1],a=0;a<r.length;a+=1){const i=get_each_context$4(t,r,a);o[a]?(o[a].p(i,n),transition_in(o[a],1)):(o[a]=create_each_block$4(i),o[a].c(),transition_in(o[a],1),o[a].m(e,null))}for(group_outros(),a=r.length;a<o.length;a+=1)i(a);check_outros()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)transition_out(o[t]);n=!1},d(t){t&&detach(e),destroy_each(o,t)}}}function instance$d(t,e,n){let{id:r}=e,{item:o}=e,{praefix:i}=e,{record:a}=e,{notifyList:s}=e;const{refItem:c,view:l,beforeSave:d,_state:u}=o.properties;let h=l.split(","),[m,f]=c.split(":"),p=[];const[_,g]=f.split("."),w=(t,e)=>{const[n,r]=e.split(".");return r?t[n][r]:""},$=(t=!0)=>{tick().then(()=>{const e=document.querySelector("div.form-field."+o.name);if(e&&(e.style.display=t?"none":"flex"),!t&&d){const t=e.querySelector("div label");t&&(t.style.color="red")}})};return onMount($),t.$$set=t=>{"id"in t&&n(4,r=t.id),"item"in t&&n(5,o=t.item),"praefix"in t&&n(6,i=t.praefix),"record"in t&&n(7,a=t.record),"notifyList"in t&&n(8,s=t.notifyList)},t.$$.update=()=>{256&t.$$.dirty&&(async t=>{const{itemName:e,value:r}=t||{};if(e!==m)return;if(n(1,p=[]),!r)return;if(!!d==!!a._id)return $();if(!a._id&&!a[m])return $();const o=!h.some(t=>t.includes(":")),i=g?g+"."+m:m;let s={[i]:a[m]||a._id};if(u&&(s=[{$match:s},{$addFields:{_ids:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_ids",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":u}}]),n(1,p=await Request.getSectionView(_,s,o)),!o&&p.length){const t=h.find(t=>t.includes(":")).split(":")[0];n(1,p=p.map(e=>{const n=e[t].find(e=>e[t]===a._id);return n._id=e._id,n})),n(0,h=h.map(t=>t.split(":")[1]))}$(!p.length)})(s)},[h,p,(t,e)=>"boolean"===o.type?t[e]?"ja":"nein":"object"===o.type?"(ja)":t["_"+e]||checkDate(t[e])||t[e]||w(t,e),t=>async()=>{const e=await Request.getTaskByDocId(t,!0);if(!e)return;const n=e._id,r=`/task/${e.event}/${n}/task?view=standalone`;window.open(r)},r,o,i,a,s]}class InputLookup extends SvelteComponent{constructor(t){super(),document_1$3.getElementById("svelte-1r8jgd4-style")||add_css$b(),init(this,t,instance$d,create_fragment$d,safe_not_equal,{id:4,item:5,praefix:6,record:7,notifyList:8})}}function add_css$a(){var t=element("style");t.id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",append(document.head,t)}function create_else_block$8(t){let e,n,r;return n=new GlobeIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 svelte-9up2nn")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_if_block$b(t){let e,n,r,o,i;return n=new GlobeIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-9up2nn")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[9]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$c(t){let e,n,r,o,i,a;n=new t[8]({props:{inputClass:t[0],disabled:t[1],formnovalidate:t[2],readonly:t[3],required:t[4],id:t[5],name:t[6],value:t[7]}}),n.$on("change",t[10]);const s=[create_if_block$b,create_else_block$8],c=[];function l(t,e){return t[7]?0:1}return o=l(t),i=c[o]=s[o](t),{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i.c(),set_style(e,"position","relative")},m(t,i){insert(t,e,i),mount_component(n,e,null),append(e,r),c[o].m(e,null),a=!0},p(t,[r]){const a={};1&r&&(a.inputClass=t[0]),2&r&&(a.disabled=t[1]),4&r&&(a.formnovalidate=t[2]),8&r&&(a.readonly=t[3]),16&r&&(a.required=t[4]),32&r&&(a.id=t[5]),64&r&&(a.name=t[6]),128&r&&(a.value=t[7]),n.$set(a);let d=o;o=l(t),o===d?c[o].p(t,r):(group_outros(),transition_out(c[d],1,1,()=>{c[d]=null}),check_outros(),i=c[o],i?i.p(t,r):(i=c[o]=s[o](t),i.c()),transition_in(i,1),i.m(e,null))},i(t){a||(transition_in(n.$$.fragment,t),transition_in(i),a=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),a=!1},d(t){t&&detach(e),destroy_component(n),c[o].d()}}}function instance$c(t,e,n){const{TextField:r}=getAttractions;let{inputClass:o}=e,{disabled:i}=e,{formnovalidate:a}=e,{readonly:s}=e,{required:c}=e,{id:l}=e,{name:d}=e,{value:u}=e;return t.$$set=t=>{"inputClass"in t&&n(0,o=t.inputClass),"disabled"in t&&n(1,i=t.disabled),"formnovalidate"in t&&n(2,a=t.formnovalidate),"readonly"in t&&n(3,s=t.readonly),"required"in t&&n(4,c=t.required),"id"in t&&n(5,l=t.id),"name"in t&&n(6,d=t.name),"value"in t&&n(7,u=t.value)},[o,i,a,s,c,l,d,u,r,async()=>{if(!u)return;let t=u;t.includes("//")||(t="//"+t),window.open(t,"_blank")},function(e){bubble(t,e)}]}class InputUrl extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-9up2nn-style")||add_css$a(),init(this,t,instance$c,create_fragment$c,safe_not_equal,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7})}}function add_css$9(){var t=element("style");t.id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",append(document.head,t)}function create_else_block$7(t){let e,n,r;return n=new PhoneOutgoingIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 svelte-9up2nn")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_if_block$a(t){let e,n,r,o,i;return n=new PhoneOutgoingIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-9up2nn")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[11]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$b(t){let e,n,r,o,i,a;n=new t[10]({props:{inputClass:t[2],pattern:t[0],placeholder:t[1],disabled:t[3],formnovalidate:t[4],readonly:t[5],required:t[6],id:t[7],name:t[8],value:t[9]}}),n.$on("change",t[12]);const s=[create_if_block$a,create_else_block$7],c=[];function l(t,e){return t[9]?0:1}return o=l(t),i=c[o]=s[o](t),{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i.c(),set_style(e,"position","relative")},m(t,i){insert(t,e,i),mount_component(n,e,null),append(e,r),c[o].m(e,null),a=!0},p(t,[r]){const a={};4&r&&(a.inputClass=t[2]),1&r&&(a.pattern=t[0]),2&r&&(a.placeholder=t[1]),8&r&&(a.disabled=t[3]),16&r&&(a.formnovalidate=t[4]),32&r&&(a.readonly=t[5]),64&r&&(a.required=t[6]),128&r&&(a.id=t[7]),256&r&&(a.name=t[8]),512&r&&(a.value=t[9]),n.$set(a);let d=o;o=l(t),o===d?c[o].p(t,r):(group_outros(),transition_out(c[d],1,1,()=>{c[d]=null}),check_outros(),i=c[o],i?i.p(t,r):(i=c[o]=s[o](t),i.c()),transition_in(i,1),i.m(e,null))},i(t){a||(transition_in(n.$$.fragment,t),transition_in(i),a=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),a=!1},d(t){t&&detach(e),destroy_component(n),c[o].d()}}}function instance$b(t,e,n){const{TextField:r}=getAttractions;let{inputClass:o}=e,{disabled:i}=e,{formnovalidate:a}=e,{readonly:s}=e,{required:c}=e,{id:l}=e,{name:d}=e,{value:u}=e,{pattern:h}=e,{placeholder:m}=e;h||="(\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1))?\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*(\\d{1,2})$",m||="+41 58 234 56 78";return t.$$set=t=>{"inputClass"in t&&n(2,o=t.inputClass),"disabled"in t&&n(3,i=t.disabled),"formnovalidate"in t&&n(4,a=t.formnovalidate),"readonly"in t&&n(5,s=t.readonly),"required"in t&&n(6,c=t.required),"id"in t&&n(7,l=t.id),"name"in t&&n(8,d=t.name),"value"in t&&n(9,u=t.value),"pattern"in t&&n(0,h=t.pattern),"placeholder"in t&&n(1,m=t.placeholder)},[h,m,o,i,a,s,c,l,d,u,r,async()=>{if(!u)return;let t="tel:"+u;window.open(t,"_self")},function(e){bubble(t,e)}]}class InputTel extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-9up2nn-style")||add_css$9(),init(this,t,instance$b,create_fragment$b,safe_not_equal,{inputClass:2,disabled:3,formnovalidate:4,readonly:5,required:6,id:7,name:8,value:9,pattern:0,placeholder:1})}}function add_css$8(){var t=element("style");t.id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",append(document.head,t)}function create_else_block$6(t){let e,n,r;return n=new MailIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 svelte-9up2nn")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_if_block$9(t){let e,n,r,o,i;return n=new MailIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-9up2nn")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[12]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$a(t){let e,n,r,o,i,a;n=new t[11]({props:{type:"email",inputClass:t[0],pattern:t[9],placeholder:t[10],disabled:t[1],formnovalidate:t[2],readonly:t[3],required:t[4],id:t[5],name:t[6],multiple:t[8],value:t[7]}}),n.$on("change",t[13]);const s=[create_if_block$9,create_else_block$6],c=[];function l(t,e){return t[7]?0:1}return o=l(t),i=c[o]=s[o](t),{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i.c(),set_style(e,"position","relative")},m(t,i){insert(t,e,i),mount_component(n,e,null),append(e,r),c[o].m(e,null),a=!0},p(t,[r]){const a={};1&r&&(a.inputClass=t[0]),512&r&&(a.pattern=t[9]),1024&r&&(a.placeholder=t[10]),2&r&&(a.disabled=t[1]),4&r&&(a.formnovalidate=t[2]),8&r&&(a.readonly=t[3]),16&r&&(a.required=t[4]),32&r&&(a.id=t[5]),64&r&&(a.name=t[6]),256&r&&(a.multiple=t[8]),128&r&&(a.value=t[7]),n.$set(a);let d=o;o=l(t),o===d?c[o].p(t,r):(group_outros(),transition_out(c[d],1,1,()=>{c[d]=null}),check_outros(),i=c[o],i?i.p(t,r):(i=c[o]=s[o](t),i.c()),transition_in(i,1),i.m(e,null))},i(t){a||(transition_in(n.$$.fragment,t),transition_in(i),a=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),a=!1},d(t){t&&detach(e),destroy_component(n),c[o].d()}}}function instance$a(t,e,n){const{TextField:r}=getAttractions;let{inputClass:o}=e,{disabled:i}=e,{formnovalidate:a}=e,{readonly:s}=e,{required:c}=e,{id:l}=e,{name:d}=e,{value:u}=e,{multiple:h}=e,{pattern:m}=e,{placeholder:f}=e;return t.$$set=t=>{"inputClass"in t&&n(0,o=t.inputClass),"disabled"in t&&n(1,i=t.disabled),"formnovalidate"in t&&n(2,a=t.formnovalidate),"readonly"in t&&n(3,s=t.readonly),"required"in t&&n(4,c=t.required),"id"in t&&n(5,l=t.id),"name"in t&&n(6,d=t.name),"value"in t&&n(7,u=t.value),"multiple"in t&&n(8,h=t.multiple),"pattern"in t&&n(9,m=t.pattern),"placeholder"in t&&n(10,f=t.placeholder)},[o,i,a,s,c,l,d,u,h,m,f,r,async()=>{if(!u)return;let t="mailto:"+u;window.open(t,"_self")},function(e){bubble(t,e)}]}class InputMail extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-9up2nn-style")||add_css$8(),init(this,t,instance$a,create_fragment$a,safe_not_equal,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,multiple:8,pattern:9,placeholder:10})}}const validEvents=["Activate","AddUndo","BeforeAddUndo","BeforeExecCommand","BeforeGetContent","BeforeRenderUI","BeforeSetContent","BeforePaste","Blur","Change","ClearUndos","Click","CommentChange","CompositionEnd","CompositionStart","CompositionUpdate","ContextMenu","Copy","Cut","Dblclick","Deactivate","Dirty","Drag","DragDrop","DragEnd","DragGesture","DragOver","Drop","ExecCommand","Focus","FocusIn","FocusOut","GetContent","Hide","Init","Input","KeyDown","KeyPress","KeyUp","LoadContent","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","NodeChange","ObjectResizeStart","ObjectResized","ObjectSelected","Paste","PostProcess","PostRender","PreProcess","ProgressState","Redo","Remove","Reset","ResizeEditor","SaveContent","SelectionChange","SetAttrib","SetContent","Show","Submit","Undo","VisualAid"],bindHandlers=(t,e)=>{validEvents.forEach(n=>{t.on(n,r=>{e(n.toLowerCase(),{eventName:n,event:r,editor:t})})})};function create_else_block$5(t){let e;return{c(){e=element("textarea"),attr(e,"id",t[0]),set_style(e,"visibility","hidden")},m(n,r){insert(n,e,r),t[20](e)},p(t,n){1&n&&attr(e,"id",t[0])},d(n){n&&detach(e),t[20](null)}}}function create_if_block$8(t){let e;return{c(){e=element("div"),attr(e,"id",t[0])},m(n,r){insert(n,e,r),t[19](e)},p(t,n){1&n&&attr(e,"id",t[0])},d(n){n&&detach(e),t[19](null)}}}function create_fragment$9(t){let e;function n(t,e){return t[1]?create_if_block$8:create_else_block$5}let r=n(t),o=r(t);return{c(){e=element("div"),o.c(),attr(e,"class",t[2])},m(n,r){insert(n,e,r),o.m(e,null),t[21](e)},p(t,[i]){r===(r=n(t))&&o?o.p(t,i):(o.d(1),o=r(t),o&&(o.c(),o.m(e,null))),4&i&&attr(e,"class",t[2])},i:noop,o:noop,d(n){n&&detach(e),o.d(),t[21](null)}}}const uuid=t=>t+"_"+Math.floor(1e9*Math.random())+String(Date.now()),isDisabledOptionSupported=t=>"function"==typeof t.options.set&&t.options.isRegistered("disabled"),createScriptLoader=()=>{let t={listeners:[],scriptId:uuid("tiny-script"),scriptLoaded:!1,injected:!1};return{load:(e,n,r)=>{t.scriptLoaded?r():(t.listeners.push(r),t.injected||((e,n,r,o)=>{t.injected=!0;const i=n.createElement("script");i.referrerPolicy="origin",i.type="application/javascript",i.src=r,i.onload=()=>{o()},n.head&&n.head.appendChild(i)})(t.scriptId,e,n,()=>{t.listeners.forEach(t=>t()),t.scriptLoaded=!0}))}}};let scriptLoader=createScriptLoader();function instance$9(t,e,n){let r,o,i,{id:a=uuid("tinymce-svelte")}=e,{inline:s}=e,{disabled:c=!1}=e,{readonly:l=!1}=e,{apiKey:d="no-api-key"}=e,{licenseKey:u}=e,{channel:h="7"}=e,{scriptSrc:m}=e,{conf:f={}}=e,{modelEvents:p="change input undo redo"}=e,{value:_=""}=e,{text:g=""}=e,{cssClass:w="tinymce-wrapper"}=e,$=_,y=c,b=l;const v=(t,e)=>{var n;"function"==typeof(null===(n=t.mode)||void 0===n?void 0:n.set)&&t.mode.set(e?"readonly":"design")},I=(t,e)=>{isDisabledOptionSupported(t)?t.options.set("disabled",e):t.mode.set(e?"readonly":"design")},C=createEventDispatcher(),E=()=>{const t="undefined"!=typeof window?window:global;return t&&t.tinymce?t.tinymce:null},A=()=>{var t;const e=Object.assign(Object.assign({},f),{target:o,inline:void 0!==s?s:void 0!==f.inline&&f.inline,license_key:u,setup:t=>{t.on("PreInit",()=>{I(t,c),v(t,l)}),n(15,i=t),t.on("init",()=>{t.setContent(_),t.on(p,()=>{n(16,$=t.getContent()),$!==_&&(n(5,_=$),n(6,g=t.getContent({format:"text"})))})}),bindHandlers(t,C),"function"==typeof f.setup&&f.setup(t)}});n(4,o.style.visibility="",o),null===(t=E())||void 0===t||t.init(e)};return onMount(()=>{if(null!==E())A();else{const t=m||`https://cdn.tiny.cloud/1/${d}/tinymce/${h}/tinymce.min.js`;scriptLoader.load(r.ownerDocument,t,()=>{A()})}}),onDestroy(()=>{var t;i&&(null===(t=E())||void 0===t||t.remove(i))}),t.$$set=t=>{"id"in t&&n(0,a=t.id),"inline"in t&&n(1,s=t.inline),"disabled"in t&&n(7,c=t.disabled),"readonly"in t&&n(8,l=t.readonly),"apiKey"in t&&n(9,d=t.apiKey),"licenseKey"in t&&n(10,u=t.licenseKey),"channel"in t&&n(11,h=t.channel),"scriptSrc"in t&&n(12,m=t.scriptSrc),"conf"in t&&n(13,f=t.conf),"modelEvents"in t&&n(14,p=t.modelEvents),"value"in t&&n(5,_=t.value),"text"in t&&n(6,g=t.text),"cssClass"in t&&n(2,w=t.cssClass)},t.$$.update=()=>{491936&t.$$.dirty&&(i&&$!==_&&(i.setContent(_),n(6,g=i.getContent({format:"text"}))),i&&l!==b&&(n(18,b=l),v(i,l)),i&&c!==y&&(n(17,y=c),I(i,c)))},[a,s,w,r,o,_,g,c,l,d,u,h,m,f,p,i,$,y,b,function(t){binding_callbacks[t?"unshift":"push"](()=>{o=t,n(4,o)})},function(t){binding_callbacks[t?"unshift":"push"](()=>{o=t,n(4,o)})},function(t){binding_callbacks[t?"unshift":"push"](()=>{r=t,n(3,r)})}]}class Editor extends SvelteComponent{constructor(t){super(),init(this,t,instance$9,create_fragment$9,safe_not_equal,{id:0,inline:1,disabled:7,readonly:8,apiKey:9,licenseKey:10,channel:11,scriptSrc:12,conf:13,modelEvents:14,value:5,text:6,cssClass:2})}}function add_css$7(){var t=element("style");t.id="svelte-yi7lpi-style",t.textContent="div.tox-statusbar__text-container, div.tox-promotion{display:none !important}div.tox.tox-tinymce{border:1px #808080 solid}.tox-edit-area__iframe{background-color:#f9f3f6 !important}",append(document.head,t)}function create_if_block$7(t){let e,n,r,o,i,a,s;function c(e){t[9](e)}let l={scriptSrc:"/tinymce/tinymce.min.js",licenseKey:"gpl",conf:t[7],disabled:t[4],readonly:t[5]};return void 0!==t[0]&&(l.value=t[0]),n=new Editor({props:l}),binding_callbacks.push(()=>bind(n,"value",c)),{c(){e=element("div"),create_component(n.$$.fragment),o=space(),i=element("input"),attr(i,"class",a=t[1]||t[2]),attr(i,"id",t[3]),attr(i,"name",t[3]),i.value=t[0],i.hidden=!0,set_style(e,"min-height","10em"),set_style(e,"margin-top","-1em")},m(t,r){insert(t,e,r),mount_component(n,e,null),append(e,o),append(e,i),s=!0},p(t,e){const o={};16&e&&(o.disabled=t[4]),32&e&&(o.readonly=t[5]),!r&&1&e&&(r=!0,o.value=t[0],add_flush_callback(()=>r=!1)),n.$set(o),(!s||6&e&&a!==(a=t[1]||t[2]))&&attr(i,"class",a),(!s||8&e)&&attr(i,"id",t[3]),(!s||8&e)&&attr(i,"name",t[3]),(!s||1&e&&i.value!==t[0])&&(i.value=t[0])},i(t){s||(transition_in(n.$$.fragment,t),s=!0)},o(t){transition_out(n.$$.fragment,t),s=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_fragment$8(t){let e,n,r=t[6]&&create_if_block$7(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,[n]){t[6]?r?(r.p(t,n),64&n&&transition_in(r,1)):(r=create_if_block$7(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function instance$8(t,e,n){const r=createEventDispatcher();let o=JSON.parse(Storage.getItem("Locale")).id;o=o.startsWith("fr")?"fr_FR":o.split("-")[0];let i,{value:a=""}=e,{noForm:s}=e,{classId:c}=e,{id:l}=e,{record:d}=e,{disabled:u}=e,{readonly:h}=e;const m=(t,e)=>{if(!i)return;if(!t)return;if(!t.includes("{{"))return;const n=e.employee;if(n)try{getTaskFull("employee",n).then(e=>{if(!e)return;const n=t.replace("{{employee.firstName}}",e.firstName).replace("{{employee.lastName}}",e.lastName);r("blur",{value:n})})}catch(t){}},f={plugins:"advlist link image lists table preview emoticons fullscreen",menu:{file:{title:"File",items:"preview"}},menubar:"edit view insert format table",toolbar:"undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | bullist numlist | fullscreen",height:600,language:o};return onMount(()=>setTimeout(()=>{n(6,i=!0),m(a,d)},300)),t.$$set=t=>{"value"in t&&n(0,a=t.value),"noForm"in t&&n(1,s=t.noForm),"classId"in t&&n(2,c=t.classId),"id"in t&&n(3,l=t.id),"record"in t&&n(8,d=t.record),"disabled"in t&&n(4,u=t.disabled),"readonly"in t&&n(5,h=t.readonly)},t.$$.update=()=>{257&t.$$.dirty&&(a||d)&&m(a,d)},[a,s,c,l,u,h,i,f,d,function(t){a=t,n(0,a)}]}class InputRichtext extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-yi7lpi-style")||add_css$7(),init(this,t,instance$8,create_fragment$8,safe_not_equal,{value:0,noForm:1,classId:2,id:3,record:8,disabled:4,readonly:5})}}
|
|
1
|
+
System.register(["@enablerr-ui/form","@enablerr-ui/layout","@enablerr-ui/auth","@enablerr-ui/task"],function(e){"use strict";var t,n,r,i,o,s,a,l,c,d,u,h;return{setters:[function(e){t=e.Request,n=e.Storage,r=e.task_notification,i=e.currentRoles,o=e.TextArea,s=e.toasts,a=e.settings,l=e.Page},function(e){c=e.getAttractions,d=e.PopOver},function(e){u=e.user},function(e){h=e.taskClipboard}],execute:function(){function f(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}e("version","0.3.47");const m=e("checkDate",(e,t)=>"string"!=typeof e||e.length<20||!(t=e.split(" · "))?e:t.map(e=>2===e.split("T").length&&3===e.split("T")[0].split("-").length?new Date(e).toLocaleDateString():e).filter(e=>!!e).join(" · ")),p=e=>{try{return new Date(e).toLocaleString()}catch{return e}},g=e=>e?"(ja)":"(nein)",w=(e,t)=>{if(!e.display&&!e.items)return"";const n={...t};return(e.display?.reduce((t,r)=>{let[i,o]=r.split(".");if(e.list?.find(({name:e})=>e===i)&&o&&void 0!==n[i]){const e=`${i}_${o}`;n[e]=n[i][o],i=e}return t.find(e=>e===i)||t.push(i),t},[]).map(e=>"boolean"==typeof n[e]?g(n[e]):m(n["_"+e]||n[e]))||e.items.map(e=>"object"===e.type?t["_"+e.name]:"list"===e.type?"":("boolean"==typeof t[e.name]&&g(t[e.name]),t[e.name]))).map(e=>e?.toString().split(" · ").filter(e=>!!e&&!y(e)).join(" · ")).filter(e=>!!e).join(" • ")},y=e=>/^[0-9a-f]{24}/.test(e),v=(e,t)=>{try{return t.split(".").reduce((e,t)=>e[t],e)??""}catch{return""}};function I(){}function _(e){return e()}function C(){return Object.create(null)}function E(e){e.forEach(_)}function A(e){return"function"==typeof e}function $(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function b(e,t,n){e.$$.on_destroy.push(function(e,...t){if(null==e)return I;const n=e.subscribe(...t);return n.unsubscribe?()=>n.unsubscribe():n}(t,n))}function S(e){return null==e?"":e}function T(e,t,n=t){return e.set(n),t}function N(e,t){e.appendChild(t)}function R(e,t,n){e.insertBefore(t,n||null)}function D(e){e.parentNode.removeChild(e)}function x(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function O(e){return document.createElement(e)}function k(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function M(e){return document.createTextNode(e)}function P(){return M(" ")}function B(){return M("")}function L(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function F(e){return function(t){return t.preventDefault(),e.call(this,t)}}function V(e){return function(t){return t.stopPropagation(),e.call(this,t)}}function U(e,t,n){null==n?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}function H(e,t){t=""+t,e.wholeText!==t&&(e.data=t)}function W(e,t){e.value=null==t?"":t}function z(e,t,n,r){e.style.setProperty(t,n,r?"important":"")}function j(e,t,n){e.classList[n?"add":"remove"](t)}let q;function G(e){q=e}function X(){if(!q)throw new Error("Function called outside component initialization");return q}function Y(e){X().$$.on_mount.push(e)}function Z(e){X().$$.on_destroy.push(e)}function K(){const e=X();return(t,n)=>{const r=e.$$.callbacks[t];if(r){const i=function(e,t){const n=document.createEvent("CustomEvent");return n.initCustomEvent(e,!1,!1,t),n}(t,n);r.slice().forEach(t=>{t.call(e,i)})}}}function Q(e,t){const n=e.$$.callbacks[t.type];n&&n.slice().forEach(e=>e(t))}const J=[],ee=[],te=[],ne=[],re=Promise.resolve();let ie=!1;function oe(){ie||(ie=!0,re.then(ue))}function se(){return oe(),re}function ae(e){te.push(e)}function le(e){ne.push(e)}let ce=!1;const de=new Set;function ue(){if(!ce){ce=!0;do{for(let e=0;e<J.length;e+=1){const t=J[e];G(t),he(t.$$)}for(G(null),J.length=0;ee.length;)ee.pop()();for(let e=0;e<te.length;e+=1){const t=te[e];de.has(t)||(de.add(t),t())}te.length=0}while(J.length);for(;ne.length;)ne.pop()();ie=!1,ce=!1,de.clear()}}function he(e){if(null!==e.fragment){e.update(),E(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(ae)}}const fe=new Set;let me;function pe(){me={r:0,c:[],p:me}}function ge(){me.r||E(me.c),me=me.p}function we(e,t){e&&e.i&&(fe.delete(e),e.i(t))}function ye(e,t,n,r){if(e&&e.o){if(fe.has(e))return;fe.add(e),me&&me.c.push(()=>{fe.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}}function ve(e,t){const n=t.token={};function r(e,r,i,o){if(t.token!==n)return;t.resolved=o;let s=t.ctx;void 0!==i&&(s=s.slice(),s[i]=o);const a=e&&(t.current=e)(s);let l=!1;t.block&&(t.blocks?t.blocks.forEach((e,n)=>{n!==r&&e&&(pe(),ye(e,1,1,()=>{t.blocks[n]===e&&(t.blocks[n]=null)}),ge())}):t.block.d(1),a.c(),we(a,1),a.m(t.mount(),t.anchor),l=!0),t.block=a,t.blocks&&(t.blocks[r]=a),l&&ue()}if((i=e)&&"object"==typeof i&&"function"==typeof i.then){const n=X();if(e.then(e=>{G(n),r(t.then,1,t.value,e),G(null)},e=>{if(G(n),r(t.catch,2,t.error,e),G(null),!t.hasCatch)throw e}),t.current!==t.pending)return r(t.pending,0),!0}else{if(t.current!==t.then)return r(t.then,1,t.value,e),!0;t.resolved=e}var i}function Ie(e,t,n){const r=t.slice(),{resolved:i}=e;e.current===e.then&&(r[e.value]=i),e.current===e.catch&&(r[e.error]=i),e.block.p(r,n)}const _e="undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:global;function Ce(e,t){ye(e,1,1,()=>{t.delete(e.key)})}function Ee(e,t,n){const r=e.$$.props[t];void 0!==r&&(e.$$.bound[r]=n,n(e.$$.ctx[r]))}function Ae(e){e&&e.c()}function $e(e,t,n,r){const{fragment:i,on_mount:o,on_destroy:s,after_update:a}=e.$$;i&&i.m(t,n),r||ae(()=>{const t=o.map(_).filter(A);s?s.push(...t):E(t),e.$$.on_mount=[]}),a.forEach(ae)}function be(e,t){const n=e.$$;null!==n.fragment&&(E(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Se(e,t,n,r,i,o,s=[-1]){const a=q;G(e);const l=e.$$={fragment:null,ctx:null,props:o,update:I,not_equal:i,bound:C(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:t.context||[]),callbacks:C(),dirty:s,skip_bound:!1};let c=!1;if(l.ctx=n?n(e,t.props||{},(t,n,...r)=>{const o=r.length?r[0]:n;return l.ctx&&i(l.ctx[t],l.ctx[t]=o)&&(!l.skip_bound&&l.bound[t]&&l.bound[t](o),c&&function(e,t){-1===e.$$.dirty[0]&&(J.push(e),oe(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}(e,t)),n}):[],l.update(),c=!0,E(l.before_update),l.fragment=!!r&&r(l.ctx),t.target){if(t.hydrate){const e=function(e){return Array.from(e.childNodes)}(t.target);l.fragment&&l.fragment.l(e),e.forEach(D)}else l.fragment&&l.fragment.c();t.intro&&we(e.$$.fragment),$e(e,t.target,t.anchor,t.customElement),ue()}G(a)}class Te{$destroy(){be(this,1),this.$destroy=I}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(e){var t;this.$$set&&(t=e,0!==Object.keys(t).length)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}function Ne(e){let t,n,r,i;return{c(){t=k("svg"),n=k("path"),r=k("polygon"),U(n,"d","M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1"),U(r,"points","12 15 17 21 7 21 12 15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-airplay "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-airplay "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function Re(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class De extends Te{constructor(e){super(),Se(this,e,Re,Ne,$,{size:0,strokeWidth:1,class:2})}}function xe(e){let t,n,r,i,o;return{c(){t=k("svg"),n=k("path"),r=k("line"),i=k("line"),U(n,"d","M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"),U(r,"x1","12"),U(r,"y1","9"),U(r,"x2","12"),U(r,"y2","13"),U(i,"x1","12"),U(i,"y1","17"),U(i,"x2","12.01"),U(i,"y2","17"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-alert-triangle "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-alert-triangle "+e[2])&&U(t,"class",o)},i:I,o:I,d(e){e&&D(t)}}}function Oe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class ke extends Te{constructor(e){super(),Se(this,e,Oe,xe,$,{size:0,strokeWidth:1,class:2})}}function Me(e){let t,n,r,i,o;return{c(){t=k("svg"),n=k("circle"),r=k("polyline"),i=k("line"),U(n,"cx","12"),U(n,"cy","12"),U(n,"r","10"),U(r,"points","8 12 12 16 16 12"),U(i,"x1","12"),U(i,"y1","8"),U(i,"x2","12"),U(i,"y2","16"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-arrow-down-circle "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-arrow-down-circle "+e[2])&&U(t,"class",o)},i:I,o:I,d(e){e&&D(t)}}}function Pe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Be extends Te{constructor(e){super(),Se(this,e,Pe,Me,$,{size:0,strokeWidth:1,class:2})}}function Le(e){let t,n,r,i;return{c(){t=k("svg"),n=k("path"),r=k("path"),U(n,"d","M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"),U(r,"d","M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-book-open "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-book-open "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function Fe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ve extends Te{constructor(e){super(),Se(this,e,Fe,Le,$,{size:0,strokeWidth:1,class:2})}}function Ue(e){let t,n,r,i;return{c(){t=k("svg"),n=k("path"),r=k("circle"),U(n,"d","M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"),U(r,"cx","12"),U(r,"cy","13"),U(r,"r","4"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-camera "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-camera "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function He(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class We extends Te{constructor(e){super(),Se(this,e,He,Ue,$,{size:0,strokeWidth:1,class:2})}}function ze(e){let t,n,r,i;return{c(){t=k("svg"),n=k("path"),r=k("polyline"),U(n,"d","M22 11.08V12a10 10 0 1 1-5.93-9.14"),U(r,"points","22 4 12 14.01 9 11.01"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-check-circle "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-check-circle "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function je(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class qe extends Te{constructor(e){super(),Se(this,e,je,ze,$,{size:0,strokeWidth:1,class:2})}}function Ge(e){let t,n,r;return{c(){t=k("svg"),n=k("path"),U(n,"d","M18 3a3 3 0 0 0-3 3v12a3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3H6a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3h12a3 3 0 0 0 3-3 3 3 0 0 0-3-3z"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",r="feather feather-command "+e[2])},m(e,r){R(e,t,r),N(t,n)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&r!==(r="feather feather-command "+e[2])&&U(t,"class",r)},i:I,o:I,d(e){e&&D(t)}}}function Xe(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ye extends Te{constructor(e){super(),Se(this,e,Xe,Ge,$,{size:0,strokeWidth:1,class:2})}}function Ze(e){let t,n,r,i;return{c(){t=k("svg"),n=k("polyline"),r=k("path"),U(n,"points","9 10 4 15 9 20"),U(r,"d","M20 4v7a4 4 0 0 1-4 4H4"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-corner-down-left "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-corner-down-left "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function Ke(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Qe extends Te{constructor(e){super(),Se(this,e,Ke,Ze,$,{size:0,strokeWidth:1,class:2})}}function Je(e){let t,n,r,i,o;return{c(){t=k("svg"),n=k("path"),r=k("line"),i=k("line"),U(n,"d","M21 4H8l-7 8 7 8h13a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"),U(r,"x1","18"),U(r,"y1","9"),U(r,"x2","12"),U(r,"y2","15"),U(i,"x1","12"),U(i,"y1","9"),U(i,"x2","18"),U(i,"y2","15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-delete "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-delete "+e[2])&&U(t,"class",o)},i:I,o:I,d(e){e&&D(t)}}}function et(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class tt extends Te{constructor(e){super(),Se(this,e,et,Je,$,{size:0,strokeWidth:1,class:2})}}function nt(e){let t,n,r,i,o;return{c(){t=k("svg"),n=k("path"),r=k("polyline"),i=k("line"),U(n,"d","M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"),U(r,"points","15 3 21 3 21 9"),U(i,"x1","10"),U(i,"y1","14"),U(i,"x2","21"),U(i,"y2","3"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-external-link "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-external-link "+e[2])&&U(t,"class",o)},i:I,o:I,d(e){e&&D(t)}}}function rt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class it extends Te{constructor(e){super(),Se(this,e,rt,nt,$,{size:0,strokeWidth:1,class:2})}}function ot(e){let t,n,r,i,o,s;return{c(){t=k("svg"),n=k("path"),r=k("polyline"),i=k("line"),o=k("line"),U(n,"d","M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"),U(r,"points","14 2 14 8 20 8"),U(i,"x1","12"),U(i,"y1","18"),U(i,"x2","12"),U(i,"y2","12"),U(o,"x1","9"),U(o,"y1","15"),U(o,"x2","15"),U(o,"y2","15"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",s="feather feather-file-plus "+e[2])},m(e,s){R(e,t,s),N(t,n),N(t,r),N(t,i),N(t,o)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&s!==(s="feather feather-file-plus "+e[2])&&U(t,"class",s)},i:I,o:I,d(e){e&&D(t)}}}function st(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class at extends Te{constructor(e){super(),Se(this,e,st,ot,$,{size:0,strokeWidth:1,class:2})}}function lt(e){let t,n,r,i,o;return{c(){t=k("svg"),n=k("circle"),r=k("line"),i=k("path"),U(n,"cx","12"),U(n,"cy","12"),U(n,"r","10"),U(r,"x1","2"),U(r,"y1","12"),U(r,"x2","22"),U(r,"y2","12"),U(i,"d","M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-globe "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-globe "+e[2])&&U(t,"class",o)},i:I,o:I,d(e){e&&D(t)}}}function ct(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class dt extends Te{constructor(e){super(),Se(this,e,ct,lt,$,{size:0,strokeWidth:1,class:2})}}function ut(e){let t,n,r,i,o,s,a,l;return{c(){t=k("svg"),n=k("line"),r=k("line"),i=k("line"),o=k("line"),s=k("line"),a=k("line"),U(n,"x1","8"),U(n,"y1","6"),U(n,"x2","21"),U(n,"y2","6"),U(r,"x1","8"),U(r,"y1","12"),U(r,"x2","21"),U(r,"y2","12"),U(i,"x1","8"),U(i,"y1","18"),U(i,"x2","21"),U(i,"y2","18"),U(o,"x1","3"),U(o,"y1","6"),U(o,"x2","3.01"),U(o,"y2","6"),U(s,"x1","3"),U(s,"y1","12"),U(s,"x2","3.01"),U(s,"y2","12"),U(a,"x1","3"),U(a,"y1","18"),U(a,"x2","3.01"),U(a,"y2","18"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",l="feather feather-list "+e[2])},m(e,l){R(e,t,l),N(t,n),N(t,r),N(t,i),N(t,o),N(t,s),N(t,a)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&l!==(l="feather feather-list "+e[2])&&U(t,"class",l)},i:I,o:I,d(e){e&&D(t)}}}function ht(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class ft extends Te{constructor(e){super(),Se(this,e,ht,ut,$,{size:0,strokeWidth:1,class:2})}}function mt(e){let t,n,r,i;return{c(){t=k("svg"),n=k("path"),r=k("polyline"),U(n,"d","M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"),U(r,"points","22,6 12,13 2,6"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-mail "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-mail "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function pt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class gt extends Te{constructor(e){super(),Se(this,e,pt,mt,$,{size:0,strokeWidth:1,class:2})}}function wt(e){let t,n,r,i;return{c(){t=k("svg"),n=k("path"),r=k("circle"),U(n,"d","M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z"),U(r,"cx","12"),U(r,"cy","10"),U(r,"r","3"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-map-pin "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-map-pin "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function yt(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class vt extends Te{constructor(e){super(),Se(this,e,yt,wt,$,{size:0,strokeWidth:1,class:2})}}function It(e){let t,n,r,i,o;return{c(){t=k("svg"),n=k("polyline"),r=k("line"),i=k("path"),U(n,"points","23 7 23 1 17 1"),U(r,"x1","16"),U(r,"y1","8"),U(r,"x2","23"),U(r,"y2","1"),U(i,"d","M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-phone-outgoing "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-phone-outgoing "+e[2])&&U(t,"class",o)},i:I,o:I,d(e){e&&D(t)}}}function _t(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Ct extends Te{constructor(e){super(),Se(this,e,_t,It,$,{size:0,strokeWidth:1,class:2})}}function Et(e){let t,n,r,i,o;return{c(){t=k("svg"),n=k("polyline"),r=k("path"),i=k("rect"),U(n,"points","6 9 6 2 18 2 18 9"),U(r,"d","M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2"),U(i,"x","6"),U(i,"y","14"),U(i,"width","12"),U(i,"height","8"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",o="feather feather-printer "+e[2])},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&o!==(o="feather feather-printer "+e[2])&&U(t,"class",o)},i:I,o:I,d(e){e&&D(t)}}}function At(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class $t extends Te{constructor(e){super(),Se(this,e,At,Et,$,{size:0,strokeWidth:1,class:2})}}function bt(e){let t,n,r,i;return{c(){t=k("svg"),n=k("circle"),r=k("line"),U(n,"cx","11"),U(n,"cy","11"),U(n,"r","8"),U(r,"x1","21"),U(r,"y1","21"),U(r,"x2","16.65"),U(r,"y2","16.65"),U(t,"xmlns","http://www.w3.org/2000/svg"),U(t,"width",e[0]),U(t,"height",e[0]),U(t,"fill","none"),U(t,"viewBox","0 0 24 24"),U(t,"stroke","currentColor"),U(t,"stroke-width",e[1]),U(t,"stroke-linecap","round"),U(t,"stroke-linejoin","round"),U(t,"class",i="feather feather-search "+e[2])},m(e,i){R(e,t,i),N(t,n),N(t,r)},p(e,[n]){1&n&&U(t,"width",e[0]),1&n&&U(t,"height",e[0]),2&n&&U(t,"stroke-width",e[1]),4&n&&i!==(i="feather feather-search "+e[2])&&U(t,"class",i)},i:I,o:I,d(e){e&&D(t)}}}function St(e,t,n){let{size:r="100%"}=t,{strokeWidth:i=2}=t,{class:o=""}=t;return"100%"!==r&&(r="x"===r.slice(-1)?r.slice(0,r.length-1)+"em":parseInt(r)+"px"),e.$$set=e=>{"size"in e&&n(0,r=e.size),"strokeWidth"in e&&n(1,i=e.strokeWidth),"class"in e&&n(2,o=e.class)},[r,i,o]}class Tt extends Te{constructor(e){super(),Se(this,e,St,bt,$,{size:0,strokeWidth:1,class:2})}}const{document:Nt}=_e;function Rt(e){e[49]=e[50].items}function Dt(e,t,n){const r=e.slice();return r[51]=t[n],r[53]=n,r}function xt(e,t,n){const r=e.slice();return r[54]=t[n],r}function Ot(e,t,n){const r=e.slice();return r[54]=t[n],r}function kt(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Mt(e){let t,n,r,i,o,s;Rt(e);let a=e[5]?.length&&Pt(e),l=e[49]?.length&&Lt(e),c=e[5]?.length&&Ut(e);return{c(){a&&a.c(),t=P(),n=O("div"),r=O("table"),l&&l.c(),i=P(),o=O("tbody"),c&&c.c(),U(r,"striped",""),U(r,"class","svelte-47aais"),U(n,"class","eList svelte-47aais")},m(e,d){a&&a.m(e,d),R(e,t,d),R(e,n,d),N(n,r),l&&l.m(r,null),N(r,i),N(r,o),c&&c.m(o,null),s=!0},p(e,n){Rt(e),e[5]?.length?a?(a.p(e,n),32&n[0]&&we(a,1)):(a=Pt(e),a.c(),we(a,1),a.m(t.parentNode,t)):a&&(pe(),ye(a,1,1,()=>{a=null}),ge()),e[49]?.length?l?l.p(e,n):(l=Lt(e),l.c(),l.m(r,i)):l&&(l.d(1),l=null),e[5]?.length?c?(c.p(e,n),32&n[0]&&we(c,1)):(c=Ut(e),c.c(),we(c,1),c.m(o,null)):c&&(pe(),ye(c,1,1,()=>{c=null}),ge())},i(e){s||(we(a),we(c),s=!0)},o(e){ye(a),ye(c),s=!1},d(e){a&&a.d(e),e&&D(t),e&&D(n),l&&l.d(),c&&c.d()}}}function Pt(e){let t,n,r,i,o,s,a,l,c,d,u,h=e[6]&&Bt(e);function f(t){e[33](t)}let m={id:e[10]};return void 0!==e[3]&&(m.value=e[3]),i=new e[8]({props:m}),ee.push(()=>Ee(i,"value",f)),i.$on("input",e[14]),l=new tt({props:{size:"18"}}),{c(){h&&h.c(),t=P(),n=O("div"),r=M("Suchen: "),Ae(i.$$.fragment),s=P(),a=O("span"),Ae(l.$$.fragment),U(a,"class","feather pointer svelte-47aais"),z(n,"margin-bottom","1em"),z(n,"position","relative")},m(o,f){h&&h.m(o,f),R(o,t,f),R(o,n,f),N(n,r),$e(i,n,null),N(n,s),N(n,a),$e(l,a,null),c=!0,d||(u=L(a,"click",e[16]),d=!0)},p(e,n){e[6]?h?64&n[0]&&we(h,1):(h=Bt(e),h.c(),we(h,1),h.m(t.parentNode,t)):h&&(pe(),ye(h,1,1,()=>{h=null}),ge());const r={};!o&&8&n[0]&&(o=!0,r.value=e[3],le(()=>o=!1)),i.$set(r)},i(e){c||(we(h),we(i.$$.fragment,e),we(l.$$.fragment,e),c=!0)},o(e){ye(h),ye(i.$$.fragment,e),ye(l.$$.fragment,e),c=!1},d(e){h&&h.d(e),e&&D(t),e&&D(n),be(i),be(l),d=!1,u()}}}function Bt(e){let t,n;return t=new e[7]({}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Lt(e){let t,n,r,i=e[4]&&e[0]&&Ft(),o=e[49],s=[];for(let t=0;t<o.length;t+=1)s[t]=Vt(Ot(e,o,t));return{c(){t=O("thead"),n=O("tr"),i&&i.c(),r=P();for(let e=0;e<s.length;e+=1)s[e].c();U(n,"class","svelte-47aais"),U(t,"class","svelte-47aais")},m(e,o){R(e,t,o),N(t,n),i&&i.m(n,null),N(n,r);for(let e=0;e<s.length;e+=1)s[e].m(n,null)},p(e,t){if(e[4]&&e[0]?i||(i=Ft(),i.c(),i.m(n,r)):i&&(i.d(1),i=null),8196&t[0]){let r;for(o=e[49],r=0;r<o.length;r+=1){const i=Ot(e,o,r);s[r]?s[r].p(i,t):(s[r]=Vt(i),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=o.length}},d(e){e&&D(t),i&&i.d(),x(s,e)}}}function Ft(e){let t;return{c(){t=O("th"),U(t,"class","svelte-47aais")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Vt(e){let t,n,r=e[54]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-47aais")},m(e,r){R(e,t,r),N(t,n)},p(e,t){4&t[0]&&r!==(r=e[54]?.designation+"")&&H(n,r)},d(e){e&&D(t)}}}function Ut(e){let t,n,r=[],i=new Map,o=e[5];const s=e=>e[51]?._id;for(let t=0;t<o.length;t+=1){let n=Dt(e,o,t),a=s(n);i.set(a,r[t]=jt(a,n))}return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=B()},m(e,i){for(let t=0;t<r.length;t+=1)r[t].m(e,i);R(e,t,i),n=!0},p(e,n){178239&n[0]&&(o=e[5],pe(),r=function(e,t,n,r,i,o,s,a,l,c,d,u){let h=e.length,f=o.length,m=h;const p={};for(;m--;)p[e[m].key]=m;const g=[],w=new Map,y=new Map;for(m=f;m--;){const e=u(i,o,m),a=n(e);let l=s.get(a);l?r&&l.p(e,t):(l=c(a,e),l.c()),w.set(a,g[m]=l),a in p&&y.set(a,Math.abs(m-p[a]))}const v=new Set,I=new Set;function _(e){we(e,1),e.m(a,d),s.set(e.key,e),d=e.first,f--}for(;h&&f;){const t=g[f-1],n=e[h-1],r=t.key,i=n.key;t===n?(d=t.first,h--,f--):w.has(i)?!s.has(r)||v.has(r)?_(t):I.has(i)?h--:y.get(r)>y.get(i)?(I.add(r),_(t)):(v.add(i),h--):(l(n,s),h--)}for(;h--;){const t=e[h];w.has(t.key)||l(t,s)}for(;f;)_(g[f-1]);return g}(r,n,s,1,e,o,i,t.parentNode,Ce,jt,t,Dt),ge())},i(e){if(!n){for(let e=0;e<o.length;e+=1)we(r[e]);n=!0}},o(e){for(let e=0;e<r.length;e+=1)ye(r[e]);n=!1},d(e){for(let t=0;t<r.length;t+=1)r[t].d(e);e&&D(t)}}}function Ht(e){let t,n,r,i,o,s,a=e[4]&&e[0]&&Wt(e),l=e[49],c=[];for(let t=0;t<l.length;t+=1)c[t]=zt(xt(e,l,t));return{c(){t=O("tr"),a&&a.c(),n=P();for(let e=0;e<c.length;e+=1)c[e].c();r=P(),U(t,"class","pointer svelte-47aais"),j(t,"active",e[51]._id===e[1]),j(t,"blocked",!!e[51].blocked),j(t,"undeliverable",!!e[51].undeliverable)},m(l,d){R(l,t,d),a&&a.m(t,null),N(t,n);for(let e=0;e<c.length;e+=1)c[e].m(t,null);N(t,r),i=!0,o||(s=L(t,"click",V(function(){A(e[12](e[51],e[53]))&&e[12](e[51],e[53]).apply(this,arguments)})),o=!0)},p(i,o){if((e=i)[4]&&e[0]?a?(a.p(e,o),17&o[0]&&we(a,1)):(a=Wt(e),a.c(),we(a,1),a.m(t,n)):a&&(pe(),ye(a,1,1,()=>{a=null}),ge()),10276&o[0]){let n;for(l=e[49],n=0;n<l.length;n+=1){const i=xt(e,l,n);c[n]?c[n].p(i,o):(c[n]=zt(i),c[n].c(),c[n].m(t,r))}for(;n<c.length;n+=1)c[n].d(1);c.length=l.length}34&o[0]&&j(t,"active",e[51]._id===e[1]),32&o[0]&&j(t,"blocked",!!e[51].blocked),32&o[0]&&j(t,"undeliverable",!!e[51].undeliverable)},i(e){i||(we(a),i=!0)},o(e){ye(a),i=!1},d(e){e&&D(t),a&&a.d(),x(c,e),o=!1,s()}}}function Wt(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("td"),Ae(n.$$.fragment),U(t,"class","editRow svelte-47aais"),z(t,"color","#326173")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",V(function(){A(e[17](e[51]))&&e[17](e[51]).apply(this,arguments)})),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function zt(e){let t,n,r,i=e[11](e[51],e[54])+"";return{c(){t=O("td"),n=M(i),U(t,"class",r=S(e[54].type)+" svelte-47aais")},m(e,r){R(e,t,r),N(t,n)},p(e,o){36&o[0]&&i!==(i=e[11](e[51],e[54])+"")&&H(n,i),4&o[0]&&r!==(r=S(e[54].type)+" svelte-47aais")&&U(t,"class",r)},d(e){e&&D(t)}}}function jt(e,t){let n,r,i,o=t[15](t[51],t[49],t[3]),s=o&&Ht(t);return{key:e,first:null,c(){n=B(),s&&s.c(),r=B(),this.first=n},m(e,t){R(e,n,t),s&&s.m(e,t),R(e,r,t),i=!0},p(e,n){t=e,44&n[0]&&(o=t[15](t[51],t[49],t[3])),o?s?(s.p(t,n),44&n[0]&&we(s,1)):(s=Ht(t),s.c(),we(s,1),s.m(r.parentNode,r)):s&&(pe(),ye(s,1,1,()=>{s=null}),ge())},i(e){i||(we(s),i=!0)},o(e){ye(s),i=!1},d(e){e&&D(n),s&&s.d(e),e&&D(r)}}}function qt(e){let t,n;return t=new e[7]({}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p:I,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Gt(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:qt,then:Mt,catch:kt,value:50,blocks:[,,,]};return ve(n=e[2]&&e[13](),i),{c(){t=B(),i.block.c()},m(e,n){R(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,4&r[0]&&n!==(n=e[2]&&e[13]())&&ve(n,i)||Ie(i,e,r)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),i.block.d(e),i.token=null,i=null}}}const Xt=e("getDisplayItems",async(e,n,r)=>{if(!e)return;let i=[];for(const o of e){if("_total"===o){i.push({name:"_total",designation:"Betrag",type:"number"});continue}if("__total"===o){i.push({name:"__total",designation:"Total CHF",type:"number",decimals:2});continue}const[e,s]=o.split(".");let a=n.list?.find(t=>t.name===e)?.item?.find(e=>e.name===s);if(a&&(a={...a},a.name=`${e}_${s}`,r=r.map(t=>(t[e]&&(t[a.name]=t["_"+e]?t["_"+e][s]:t[e][s]),t))),a||(a=n.items.find(t=>t.name===e)),!a){const n=(await t.getSchemaByClass(e)).items.find(e=>e.name===s);n&&(a={name:e,designation:n.designation,type:n.type,decimals:n.properties?.decimals||0})}i.find(t=>t?.name===e)||i.push(a)}return i.length?i:n.items});function Yt(e,i,o){let s;let a=JSON.parse(n.getItem("Locale")).id;const l=K(),{Loading:d,TextField:h}=c,{currentTasks:f}=u;b(e,f,e=>o(37,s=e));let p,w,y,v,{inputList:I}=i,{eventId:_}=i,{prevEventId:C}=i,{record:E}=i,{className:A}=i,{rowId:$}=i,{filterForReady:S=!1}=i,{filter:T}=i,{query:N}=i,{refStatus:R}=i,{showEdit:D=!1}=i,{praefix:x=""}=i,{selectionFields:O=!1}=i,{deList:k}=i,{stopAggregation:M=!1}=i,{shouldBlock:P}=i,{inputSearch:B=""}=i,L=!0,F=B,V=A+Math.floor(9e3*Math.random()+1e3).toString()+"search",U=!1,H=!0;const W=(e,t)=>{if(!t)return;let n=e[t.name];if("__total"===t.name&&void 0===n&&(n=1.081*e._total),!n&&t.name.includes("_")&&!t.name.startsWith("_")){const[r,i]=t.name.split("_");try{n=e[r][i]}catch{}}if(Array.isArray(n)){const e=e=>e.replaceAll(" ",String.fromCharCode(160));if(n.length&&Array.isArray(n[0].serialno)){let t=[];for(const r of n)t=t.concat(r.serialno.map(e));n=t.join(", ")}else n=n.map(e),n.length>3&&(n=n.slice(0,3),n=n.concat("...")),n=n.join(", ")}if(!n&&t.name.split("_").length>1){const[r,i]=t.name.split("_");try{n=e[r][0][i],Array.isArray(n)&&(n=n.join(", "))}catch{}}return"number"===t.type&&(n||(n=e[`_${t.name}`]),n=Number(n)?Number(n).toLocaleString(a,{minimumFractionDigits:t.properties?.decimals||t.decimals||0,maximumFractionDigits:t.properties?.decimals||t.decimals||0}):""),"boolean"===t.type&&"Aktiv"===n&&(n=!1),"number"===t.type?n:"boolean"==typeof n||"boolean"===t.type?g(n):m(e[`_${t.name}`]||n||"")},z=t.getSchemaByClass(A),j=async(e,n)=>{if(!e)return[];if(T){let n;const r=T.startsWith("!");r&&(n=T.replace("!",""));const i=T.startsWith("$");if(n&&!i&&(e=e.filter(e=>i?e[n]===$:r?!e[n]:!!e[n])),i){n=T.replace("$","");const[r,i]=n.split(".");if(E[i]){const n=await t.getSectionView(r,{[i]:E[i]});e=e.filter(e=>n.find(t=>t._id==e[r]))}else e=[]}}if(R&&!N)return o(18,R=[].concat(R)),e.filter(e=>!!R.find(t=>e._task.status===t));if("Information"===n.state.task)return e;if(C){const n=await t.getEvent(C);if("report"===n?.output?.type)return e;if(n?.input?.class?.length&&n.input.class[0].name===A)return"Information"===n.state.task?e.filter(e=>"Closed"!==e._task.status):e.filter(e=>"Ready"===e._task.status)}return e.filter(e=>"WaitingForApproval"===e._task.status||"Ready"===e._task.status||"Closing"===e._task.status)},q=(e,t)=>{if(e){let n,r="1";if("string"==typeof e)n=e;else{const t=Object.keys(e);n=t[0],r=t[1]}"date"===n&&(r="-1");const i=new Intl.Collator(a,{numeric:!0});return 1==r?t.sort((e,t)=>i.compare(e[n],t[n])):t.sort((e,t)=>i.compare(t[n],e[n]))}return t},G=async e=>{let n,r=0;H=!1;const i=e=>new Promise(t=>setTimeout(t,e)),s=await z;for(;r++<200&&!M&&!(n=await X(e,s.id));)await i(500);o(6,U=!1),M&&t.readTasksByAggregationId(e,!0),n&&(o(5,y=q(w.displaySort,n.data)),window.setTimeout(()=>{const e=document.querySelector("tr.active");e&&e.scrollIntoView({block:"end",behavior:"smooth"}),H=!0},100))},X=async(e,n)=>await t.readTasksByAggregationId(e,!1,n),Z=async(e,t,n,r)=>{const{value:i,refClass:o}=r,[s,a]=n.split("."),l=i?.get(x),c=l&&await ym(s,l);if(!c)return e;const d=c[a];return d?.length?d.map(n=>{let r=e?.find(e=>e._id===n[t])||{};r={...r};for(const e in r)n[e]&&(r[e]=n[e]);for(const e in n)n[e]&&(r[e]=n[e]);return gm(o+r._id.toString(),r),r}):e};Y(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(V)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await z;e.eventId===t.id&&(vm(t.class,e.eventId),o(2,L=!o(2,L=!1)))});return e.$$set=e=>{"inputList"in e&&o(20,I=e.inputList),"eventId"in e&&o(21,_=e.eventId),"prevEventId"in e&&o(22,C=e.prevEventId),"record"in e&&o(23,E=e.record),"className"in e&&o(24,A=e.className),"rowId"in e&&o(1,$=e.rowId),"filterForReady"in e&&o(25,S=e.filterForReady),"filter"in e&&o(26,T=e.filter),"query"in e&&o(27,N=e.query),"refStatus"in e&&o(18,R=e.refStatus),"showEdit"in e&&o(0,D=e.showEdit),"praefix"in e&&o(28,x=e.praefix),"selectionFields"in e&&o(29,O=e.selectionFields),"deList"in e&&o(30,k=e.deList),"stopAggregation"in e&&o(19,M=e.stopAggregation),"shouldBlock"in e&&o(31,P=e.shouldBlock),"inputSearch"in e&&o(32,B=e.inputSearch)},[D,$,L,F,p,y,U,d,h,f,V,W,(e,t)=>n=>{o(19,M=!0);const r=H?e:v[t];l("choose",{row:r})},async()=>{w=await z,o(4,p=(e=>!s?.length||!!s.find(t=>t===e))(w.id)),N&&o(5,y=v=await t.getTasksFiltered(w.class,N)),y||o(5,y=v=q(w.displaySort,await I||await mm(w.class,w.id))),500!==y?.length||N||(o(6,U=!0),t.getTasksList(w.id,!1,!0).then(({aggregationId:e})=>G(e)));let e,n=!1,r="";const i=O&&O?.find(e=>w.class===e.refClass.split(":")[0]),a=i?.value?.get&&i.value.get(x);if(a){const[s,l]=i.refClass.split(":");w.class===s&&o(5,y=await Z(y,s,l,i)),n=i.parentClass?.find(e=>"quantity"===e.name),r=i.className,e=await t.getCountedSection(r,l.split(".")[0],a,s,"quantity")}o(0,D&&=!i),!i&&(T||S||R)&&o(5,y=await j(y,w));const{display:c}=w;let d=await Xt(c,w,y);return!D&&n?(d=d.concat([{name:"quantity",designation:"h-Soll",type:"number",decimals:2},{name:"ist",designation:"h-Ist",type:"number",decimals:2}]),o(5,y=y.map(t=>{const n=e.find(e=>e._id===t._id);return n&&(t.ist=n.quantity.$numberDecimal),t})),e.map(e=>{if(!y.find(t=>t._id===e._id)){const t=v.find(t=>t._id===e._id);t&&(t.ist=e.quantity.$numberDecimal),y.push(t)}}),l("init",y)):k&&o(5,y=y.filter(e=>!k.find(t=>t?._id===e._id))),P&&o(5,y=y.filter(e=>!e[P])),{items:d}},({detail:{value:e}})=>{o(3,F=e)},(e,t,n)=>{if(!e)return!1;if(!n)return!0;"string"!=typeof n&&(n=n.toString()),n=n.toLowerCase();let r=!1;for(const i of t){const t=W(e,i).toLowerCase();!r&&t.includes(n)&&(r=!0)}return r},()=>{o(3,F="")},async e=>{let t=e._task;t||(t=await pm(A,"",e._id,!0),t=t._task),window.open(`/task/${t.event}/${t.task_id||t._id}/task?view=standalone`,"_blank")},R,M,I,_,C,E,A,S,T,N,x,O,k,P,B,function(e){F=e,o(3,F)}]}class Zt extends Te{constructor(e){var t;super(),Nt.getElementById("svelte-47aais-style")||((t=O("style")).id="svelte-47aais-style",t.textContent=".feather.svelte-47aais.svelte-47aais{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-47aais.svelte-47aais{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-47aais .editRow.svelte-47aais{width:1em}.eList.svelte-47aais table.svelte-47aais{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-47aais table thead.svelte-47aais{position:sticky;top:0;background:#326173;color:white}.eList.svelte-47aais table thead tr.svelte-47aais{height:2.3em}.eList.svelte-47aais table tbody tr.svelte-47aais{height:2.75em !important}th.svelte-47aais.svelte-47aais,td.svelte-47aais.svelte-47aais{padding-left:0.4em;padding-right:0.4em}td.number.svelte-47aais.svelte-47aais{text-align:end}tr.pointer.svelte-47aais.svelte-47aais:hover{background-color:#DAE1E5}tr.active.svelte-47aais.svelte-47aais{color:#326173;background-color:#fcebd5}tr.blocked.svelte-47aais.svelte-47aais{color:red !important}tr.undeliverable.svelte-47aais.svelte-47aais{color:orange}",N(Nt.head,t)),Se(this,e,Yt,Gt,$,{inputList:20,eventId:21,prevEventId:22,record:23,className:24,rowId:1,filterForReady:25,filter:26,query:27,refStatus:18,showEdit:0,praefix:28,selectionFields:29,deList:30,stopAggregation:19,shouldBlock:31,inputSearch:32},[-1,-1])}}function Kt(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Qt(e){let t,n,r=e[45]&&Jt(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[45]?r?(r.p(e,n),16&n[0]&&we(r,1)):(r=Jt(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Jt(e){let t,n;return t=new e[25]({props:{title:e[20]?"Auswahl":e[0],class:"eList "+(e[18]?"form":""),$$slots:{default:[dn]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1048577&n[0]&&(r.title=e[20]?"Auswahl":e[0]),262144&n[0]&&(r.class="eList "+(e[18]?"form":"")),33554430&n[0]|32768&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function en(e){let t,n;return t=new Cm({props:{schema:e[2],recID:e[1],readonly:e[19]}}),t.$on("choose",function(){A(e[34](e[45]))&&e[34](e[45]).apply(this,arguments)}),t.$on("back",e[31]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(n,r){e=n;const i={};4&r[0]&&(i.schema=e[2]),2&r[0]&&(i.recID=e[1]),524288&r[0]&&(i.readonly=e[19]),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function tn(e){let t,n,r,i,o,s,a;t=new e[26]({props:{text:e[20]?"Zusätzliche Auswahl":""}});const l=[rn,nn],c=[];function d(e,t){return e[20]?0:1}return r=d(e),i=c[r]=l[r](e),s=new Zt({props:{inputSearch:e[15],record:e[3],eventId:e[2].id,className:e[2].class,prevEventId:e[14],filterForReady:e[5],filter:e[6],query:e[7],refStatus:e[8],praefix:e[9],selectionFields:e[10],rowId:e[1],shouldBlock:e[16],deList:e[12],stopAggregation:e[24],showEdit:e[11]}}),s.$on("edit",e[35]),s.$on("choose",e[38]),s.$on("init",e[36]),{c(){Ae(t.$$.fragment),n=P(),i.c(),o=P(),Ae(s.$$.fragment)},m(e,i){$e(t,e,i),R(e,n,i),c[r].m(e,i),R(e,o,i),$e(s,e,i),a=!0},p(e,n){const a={};1048576&n[0]&&(a.text=e[20]?"Zusätzliche Auswahl":""),t.$set(a);let u=r;r=d(e),r===u?c[r].p(e,n):(pe(),ye(c[u],1,1,()=>{c[u]=null}),ge(),i=c[r],i?i.p(e,n):(i=c[r]=l[r](e),i.c()),we(i,1),i.m(o.parentNode,o));const h={};32768&n[0]&&(h.inputSearch=e[15]),8&n[0]&&(h.record=e[3]),4&n[0]&&(h.eventId=e[2].id),4&n[0]&&(h.className=e[2].class),16384&n[0]&&(h.prevEventId=e[14]),32&n[0]&&(h.filterForReady=e[5]),64&n[0]&&(h.filter=e[6]),128&n[0]&&(h.query=e[7]),256&n[0]&&(h.refStatus=e[8]),512&n[0]&&(h.praefix=e[9]),1024&n[0]&&(h.selectionFields=e[10]),2&n[0]&&(h.rowId=e[1]),65536&n[0]&&(h.shouldBlock=e[16]),4096&n[0]&&(h.deList=e[12]),16777216&n[0]&&(h.stopAggregation=e[24]),2048&n[0]&&(h.showEdit=e[11]),s.$set(h)},i(e){a||(we(t.$$.fragment,e),we(i),we(s.$$.fragment,e),a=!0)},o(e){ye(t.$$.fragment,e),ye(i),ye(s.$$.fragment,e),a=!1},d(e){be(t,e),e&&D(n),c[r].d(e),e&&D(o),be(s,e)}}}function nn(e){let t,n,r,i;n=new e[27]({props:{outline:!0,$$slots:{default:[on]},$$scope:{ctx:e}}}),n.$on("click",e[32]);let o=e[29]&&e[13]&&sn(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o&&o.c(),U(t,"class","form--buttons svelte-jb5mrh")},m(e,s){R(e,t,s),$e(n,t,null),N(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};32768&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[29]&&e[13]?o?(o.p(e,r),8192&r[0]&&we(o,1)):(o=sn(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,()=>{o=null}),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function rn(e){let t,n,r,i,o,s,a=e[23]&&ln(e);return r=new e[27]({props:{outline:!0,$$slots:{default:[cn]},$$scope:{ctx:e}}}),r.$on("click",e[32]),o=new e[26]({props:{text:"Liste aus "+e[17]}}),{c(){a&&a.c(),t=P(),n=O("div"),Ae(r.$$.fragment),i=P(),Ae(o.$$.fragment),U(n,"class","form--buttons svelte-jb5mrh")},m(e,l){a&&a.m(e,l),R(e,t,l),R(e,n,l),$e(r,n,null),R(e,i,l),$e(o,e,l),s=!0},p(e,n){e[23]?a?(a.p(e,n),8388608&n[0]&&we(a,1)):(a=ln(e),a.c(),we(a,1),a.m(t.parentNode,t)):a&&(pe(),ye(a,1,1,()=>{a=null}),ge());const i={};32768&n[1]&&(i.$$scope={dirty:n,ctx:e}),r.$set(i);const s={};131072&n[0]&&(s.text="Liste aus "+e[17]),o.$set(s)},i(e){s||(we(a),we(r.$$.fragment,e),we(o.$$.fragment,e),s=!0)},o(e){ye(a),ye(r.$$.fragment,e),ye(o.$$.fragment,e),s=!1},d(e){a&&a.d(e),e&&D(t),e&&D(n),be(r),e&&D(i),be(o,e)}}}function on(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function sn(e){let t,n;return t=new e[27]({props:{filled:!0,$$slots:{default:[an]},$$scope:{ctx:e}}}),t.$on("click",e[33]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};32768&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function an(e){let t;return{c(){t=M("Neu")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ln(e){let t,n;return t=new Hd({props:{item:e[21],record:{_id:"",[e[21].name]:""},noForm:"true",classId:"sel_"+e[21].name,eventId:e[22],required:!1,hidden:!1,readonly:!1,deList:e[23]}}),t.$on("notify",e[37]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.item=e[21]),2097152&n[0]&&(r.record={_id:"",[e[21].name]:""}),2097152&n[0]&&(r.classId="sel_"+e[21].name),4194304&n[0]&&(r.eventId=e[22]),8388608&n[0]&&(r.deList=e[23]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function cn(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function dn(e){let t,n,r,i;const o=[tn,en],s=[];function a(e,t){return e[45].length&&!e[18]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function un(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function hn(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:un,then:Qt,catch:Kt,value:45,blocks:[,,,]};return ve(n=e[30](e[4]),i),{c(){t=B(),i.block.c()},m(e,n){R(e,t,n),i.block.m(e,i.anchor=n),i.mount=()=>t.parentNode,i.anchor=t,r=!0},p(t,r){e=t,i.ctx=e,16&r[0]&&n!==(n=e[30](e[4]))&&ve(n,i)||Ie(i,e,r)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),i.block.d(e),i.token=null,i=null}}}function fn(e,n,r){let i;const{Dialog:o,Divider:s,Button:a}=c,l=K(),{currentTasks:d}=u;b(e,d,e=>r(41,i=e));let{title:h}=n,{schema:f}=n,{record:m}=n,{recID:p}=n,{isOpening:g=!0}=n,{filterForReady:w=!1}=n,{filter:y}=n,{query:v}=n,{refStatus:I}=n,{praefix:_=""}=n,{selectionFields:C=!1}=n,{showEdit:E=!0}=n,{deList:A}=n,{newAllowed:$=!0}=n,{prevEventId:S}=n,{inputSearch:T}=n,{shouldBlock:N}=n,R=f.id;f.class;let D,x,O,k,M,P,B,L="",F=!1,V=!1;h??=f.identity.designation;const U=!i?.length||i.find(e=>e===R);return e.$$set=e=>{"title"in e&&r(0,h=e.title),"schema"in e&&r(2,f=e.schema),"record"in e&&r(3,m=e.record),"recID"in e&&r(1,p=e.recID),"isOpening"in e&&r(4,g=e.isOpening),"filterForReady"in e&&r(5,w=e.filterForReady),"filter"in e&&r(6,y=e.filter),"query"in e&&r(7,v=e.query),"refStatus"in e&&r(8,I=e.refStatus),"praefix"in e&&r(9,_=e.praefix),"selectionFields"in e&&r(10,C=e.selectionFields),"showEdit"in e&&r(11,E=e.showEdit),"deList"in e&&r(12,A=e.deList),"newAllowed"in e&&r(13,$=e.newAllowed),"prevEventId"in e&&r(14,S=e.prevEventId),"inputSearch"in e&&r(15,T=e.inputSearch),"shouldBlock"in e&&r(16,N=e.shouldBlock)},[h,p,f,m,g,w,y,v,I,_,C,E,A,$,S,T,N,L,F,D,O,M,P,B,V,o,s,a,d,U,async e=>{if(!e)return!1;const n=await mm(f.class,f.id);if(x=C&&C?.find(e=>f.class===e.refClass.split(":")[0]),r(20,O=x?.value?.get&&x.value.get(_)),O){k=x.refClass;const[e,n]=k.split(":"),[i]=n.split(".");r(21,M=x.parentClass.find(t=>t.name===e));const o=await t.getSchemaByClass(M.refClass);r(22,P=o.id),r(17,L=x.parentClass.find(e=>e.name===i).designation)}return n},()=>{r(18,F=!1),p||l("back"),E||l("back")},()=>{r(24,V=!0),r(18,F=!1),l("back")},()=>{r(24,V=!0),r(1,p=!1),r(19,D=!1),r(18,F=!0)},e=>({detail:{row:e}})=>{let t=f.display;t&&t.length&&t.map(t=>{const[n,r]=t.split(".");let i=f.list?.find(e=>e.name===n)?.item.find(e=>e.name===r);if(i){e[`${n}_${r}`]=e[n][r]}}),l("choose",{row:e})},({detail:e})=>{r(19,D=!!e._task.visum||"Closed"===e._task.status),r(1,p=e._docId),r(18,F=!0)},({detail:e})=>{O&&r(23,B=e)},({detail:e})=>{if(!e.value)return;const t={_id:e.value};l("choose",{row:t})},function(t){Q(e,t)}]}class mn extends Te{constructor(e){var t;super(),document.getElementById("svelte-jb5mrh-style")||((t=O("style")).id="svelte-jb5mrh-style",t.textContent=".eList .flex button.btn{width:max-content !important}.dialog.eList{max-height:90vh}.form--buttons.svelte-jb5mrh{display:flex;gap:1em;padding:0.5em 0}",N(document.head,t)),Se(this,e,fn,hn,$,{title:0,schema:2,record:3,recID:1,isOpening:4,filterForReady:5,filter:6,query:7,refStatus:8,praefix:9,selectionFields:10,showEdit:11,deList:12,newAllowed:13,prevEventId:14,inputSearch:15,shouldBlock:16},[-1,-1])}}const{document:pn}=_e;function gn(e){e[28]=e[30].list,e[29]=e[30].items}function wn(e,t,n){const r=e.slice();return r[31]=t[n],r}function yn(e,t,n){const r=e.slice();return r[34]=t[n],r}function vn(e,t,n){const r=e.slice();return r[34]=t[n],r}function In(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function _n(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[25](t)}gn(e),n=new e[7]({props:{outline:!0,$$slots:{default:[Cn]},$$scope:{ctx:e}}}),n.$on("click",e[24]);let I={id:e[8]};void 0!==e[1]&&(I.value=e[1]),s=new e[6]({props:I}),ee.push(()=>Ee(s,"value",v)),s.$on("input",e[12]),d=new tt({props:{size:"18"}});let _=e[29]?.length&&function(e){let t,n,r,i,o=e[29],s=[];for(let t=0;t<o.length;t+=1)s[t]=En(vn(e,o,t));return{c(){t=O("thead"),n=O("tr"),r=O("th"),i=P();for(let e=0;e<s.length;e+=1)s[e].c();U(r,"class","svelte-14hcfjl"),U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,o){R(e,t,o),N(t,n),N(n,r),N(n,i);for(let e=0;e<s.length;e+=1)s[e].m(n,null)},p(e,t){if(2048&t[0]){let r;for(o=e[29],r=0;r<o.length;r+=1){const i=vn(e,o,r);s[r]?s[r].p(i,t):(s[r]=En(i),s[r].c(),s[r].m(n,null))}for(;r<s.length;r+=1)s[r].d(1);s.length=o.length}},d(e){e&&D(t),x(s,e)}}}(e),C=e[28]?.length&&function(e){let t,n,r=e[28],i=[];for(let t=0;t<r.length;t+=1)i[t]=bn(wn(e,r,t));const o=e=>ye(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=B()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(44547&n[0]){let s;for(r=e[28],s=0;s<r.length;s+=1){const o=wn(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=bn(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){x(i,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),i=O("div"),o=M("Suchen: "),Ae(s.$$.fragment),l=P(),c=O("span"),Ae(d.$$.fragment),u=P(),h=O("div"),f=O("table"),_&&_.c(),m=P(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),$e(n,t,null),R(a,r,v),R(a,i,v),N(i,o),$e(s,i,null),N(i,l),N(i,c),$e(d,c,null),R(a,u,v),R(a,h,v),N(h,f),_&&_.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){gn(e);const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],le(()=>a=!1)),s.$set(i),e[29]?.length&&_.p(e,t),e[28]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),we(C),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),ye(C),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),_&&_.d(),C&&C.d(),w=!1,y()}}}function Cn(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function En(e){let t,n,r=e[34]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:I,d(e){e&&D(t)}}}function An(e){let t,n,r,i,o,s,a,l;r=new it({props:{size:"18"}});let c=e[29],d=[];for(let t=0;t<c.length;t+=1)d[t]=$n(yn(e,c,t));return{c(){t=O("tr"),n=O("td"),Ae(r.$$.fragment),i=P();for(let e=0;e<d.length;e+=1)d[e].c();o=P(),U(n,"class","editRow svelte-14hcfjl"),U(t,"class","pointer svelte-14hcfjl"),j(t,"active",e[31]._id===e[0])},m(c,u){R(c,t,u),N(t,n),$e(r,n,null),N(t,i);for(let e=0;e<d.length;e+=1)d[e].m(t,null);N(t,o),s=!0,a||(l=L(n,"click",e[15](e[31])),a=!0)},p(n,r){if(e=n,3584&r[0]){let n;for(c=e[29],n=0;n<c.length;n+=1){const i=yn(e,c,n);d[n]?d[n].p(i,r):(d[n]=$n(i),d[n].c(),d[n].m(t,o))}for(;n<d.length;n+=1)d[n].d(1);d.length=c.length}2049&r[0]&&j(t,"active",e[31]._id===e[0])},i(e){s||(we(r.$$.fragment,e),s=!0)},o(e){ye(r.$$.fragment,e),s=!1},d(e){e&&D(t),be(r),x(d,e),a=!1,l()}}}function $n(e){let t,n,r,i,o=e[9](e[31],e[34])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[31]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function bn(e){let t,n,r=e[13](e[31],e[29],e[1]),i=r&&An(e);return{c(){i&&i.c(),t=B()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){2&n[0]&&(r=e[13](e[31],e[29],e[1])),r?i?(i.p(e,n),2&n[0]&&we(i,1)):(i=An(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,()=>{i=null}),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function Sn(e){let t,n;return t=new e[5]({}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p:I,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Tn(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Sn,then:_n,catch:In,value:30,blocks:[,,,]};return ve(e[11](),o),{c(){Ae(t.$$.fragment),n=P(),r=B(),o.block.c()},m(e,s){$e(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ie(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Nn(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Tn]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};3&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Rn(e,n,i){const o=K(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:h}=n,{classId:f}=n,{className:p}=n,{rowId:w}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:I}=n,{filter:_}=n,{multiValues:C}=n,E="",A=f+Math.floor(9e3*Math.random()+1e3).toString()+"search";const $=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?g(n):m(e[`_${t.name}`]||e[t.name]||"")},b=t.getSchemaByClass(p);Y(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(A)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await b;e.eventId===t.id&&vm(t.class,e.eventId)});return e.$$set=e=>{"item"in e&&i(16,h=e.item),"classId"in e&&i(17,f=e.classId),"className"in e&&i(18,p=e.className),"rowId"in e&&i(0,w=e.rowId),"viewName"in e&&i(19,y=e.viewName),"viewValue"in e&&i(20,v=e.viewValue),"recordId"in e&&i(21,I=e.recordId),"filter"in e&&i(22,_=e.filter),"multiValues"in e&&i(23,C=e.multiValues)},[w,E,o,s,a,l,d,u,A,$,e=>()=>o("choose",{row:e}),async()=>{const e=await b;let n=[];if(h.lookup){const r="."+f+"#"+h.lookup,i=document.querySelector(r);let o=i?.value||I;if(C.has(h.lookup)){const r=C.get(h.lookup)[0];n=r?await t.getSectionView(h.name,{[h.lookup]:r},!0):await mm(h.name,e.id)}else if(o&&24===o.toString().length){const e=await ym(h.lookup,o);if(e){const r=e[h.name]?.map(e=>e[h.name]);r&&(n=await t.getSectionView(h.name,{_id:{$in:r}},!0))}}}else{const r="."+f+"#"+y.split(":")[0],i=document.querySelector(r);let o={[y]:i?.value||I};if(h.refItem){const e="."+f+"#"+h.refItem;try{const t=document.querySelector(e);if(t){const e={$or:[{[h.refItem]:t.value},{[h.refItem]:{$exists:!0,$eq:""}}]};o={...o,...e}}}catch{}}o[y]&&(n=await t.getSectionView(e.class,o,!0)),_&&(n=n.filter(e=>e._id!=_))}const r=e.display;return{list:n,items:await Xt(r,e,n)}},({detail:{value:e}})=>{i(1,E=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if($(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{i(1,E="")},e=>async()=>{const n=await t.getTaskByDocId(e._id,!0),r=`/task/${n.event}/${n._id}/task?view=standalone`;window.open(r)},h,f,p,y,v,I,_,C,()=>o("back"),function(e){E=e,i(1,E)}]}class Dn extends Te{constructor(e){var t;super(),pn.getElementById("svelte-14hcfjl-style")||((t=O("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl .editRow.svelte-14hcfjl{width:1em}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",N(pn.head,t)),Se(this,e,Rn,Nn,$,{item:16,classId:17,className:18,rowId:0,viewName:19,viewValue:20,recordId:21,filter:22,multiValues:23},[-1,-1])}}const{document:xn}=_e;function On(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function kn(e){let t,n,r=e[72]&&function(e){let t,n,r,i,s,a,l,c,d,u,h,f,m,p,g,w,y,v,I;function _(t){e[55](t)}function C(t){e[56](t)}let E={class:"full-width",id:e[32],rows:"1",required:e[2],disabled:e[3],placeholder:e[34],style:"height:2.8em; padding-left:2em;padding-right:2em;overflow-y:hidden; resize:none;"};void 0!==e[1]&&(E.value=e[1]);void 0!==e[25]&&(E.overwrite=e[25]);n=new o({props:E}),ee.push(()=>Ee(n,"value",_)),ee.push(()=>Ee(n,"overwrite",C)),n.$on("click",e[37]()),n.$on("blur",e[44]);const A=[Pn,Mn],$=[];function b(e,t){return!e[3]||e[16]?0:e[22]&&e[0]?1:-1}~(a=b(e))&&(l=$[a]=A[a](e));let T=(!e[3]||e[16]||e[17])&&Bn(e);function x(t){e[57](t)}let k={class:"tModal",noClickaway:!0,$$slots:{default:[Un]},$$scope:{ctx:e}};void 0!==e[19]&&(k.open=e[19]);m=new e[28]({props:k}),ee.push(()=>Ee(m,"open",x));let M=e[20]&&Hn(e);return{c(){t=O("div"),Ae(n.$$.fragment),s=P(),l&&l.c(),c=P(),d=O("input"),h=P(),T&&T.c(),f=P(),Ae(m.$$.fragment),g=P(),M&&M.c(),w=B(),U(d,"class",u=S(e[9]||e[10])+" svelte-1wtpa4f"),U(d,"id",e[5]),U(d,"name",e[5]),d.value=e[0],d.hidden=!0,z(t,"position","relative")},m(r,i){R(r,t,i),$e(n,t,null),N(t,s),~a&&$[a].m(t,null),N(t,c),N(t,d),N(t,h),T&&T.m(t,null),R(r,f,i),$e(m,r,i),R(r,g,i),M&&M.m(r,i),R(r,w,i),y=!0,v||(I=L(t,"keydown",e[38]),v=!0)},p(e,o){const s={};4&o[0]&&(s.required=e[2]),8&o[0]&&(s.disabled=e[3]),!r&&2&o[0]&&(r=!0,s.value=e[1],le(()=>r=!1)),!i&&33554432&o[0]&&(i=!0,s.overwrite=e[25],le(()=>i=!1)),n.$set(s);let h=a;a=b(e),a===h?~a&&$[a].p(e,o):(l&&(pe(),ye($[h],1,1,()=>{$[h]=null}),ge()),~a?(l=$[a],l?l.p(e,o):(l=$[a]=A[a](e),l.c()),we(l,1),l.m(t,c)):l=null),(!y||1536&o[0]&&u!==(u=S(e[9]||e[10])+" svelte-1wtpa4f"))&&U(d,"class",u),(!y||32&o[0])&&U(d,"id",e[5]),(!y||32&o[0])&&U(d,"name",e[5]),(!y||1&o[0]&&d.value!==e[0])&&(d.value=e[0]),!e[3]||e[16]||e[17]?T?(T.p(e,o),196616&o[0]&&we(T,1)):(T=Bn(e),T.c(),we(T,1),T.m(t,null)):T&&(pe(),ye(T,1,1,()=>{T=null}),ge());const f={};93126097&o[0]|2048&o[2]&&(f.$$scope={dirty:o,ctx:e}),!p&&524288&o[0]&&(p=!0,f.open=e[19],le(()=>p=!1)),m.$set(f),e[20]?M?(M.p(e,o),1048576&o[0]&&we(M,1)):(M=Hn(e),M.c(),we(M,1),M.m(w.parentNode,w)):M&&(pe(),ye(M,1,1,()=>{M=null}),ge())},i(e){y||(we(n.$$.fragment,e),we(l),we(T),we(m.$$.fragment,e),we(M),y=!0)},o(e){ye(n.$$.fragment,e),ye(l),ye(T),ye(m.$$.fragment,e),ye(M),y=!1},d(e){e&&D(t),be(n),~a&&$[a].d(),T&&T.d(),e&&D(f),be(m,e),e&&D(g),M&&M.d(e),e&&D(w),v=!1,I()}}}(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,t){e[72]&&r.p(e,t)},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Mn(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-1wtpa4f")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[43]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Pn(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-1wtpa4f")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=[L(t,"click",e[37](!0)),L(t,"choose",e[40])],i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,E(o)}}}function Bn(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 pointer svelte-1wtpa4f")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[42]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ln(e){let t,n,r,i;const o=[Vn,Fn],s=[];function a(e,t){return e[6].lookup||e[4]&&!e[6].constraint?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Fn(e){let t,n;return t=new mn({props:{title:e[6].designation,newAllowed:e[23],prevEventId:e[11],schema:e[18],filter:e[33],query:e[35](),record:e[7],recID:e[0],isOpening:e[19],filterForReady:e[24],refStatus:e[6].refStatus,selectionFields:e[14],deList:e[15],praefix:e[13],shouldBlock:e[26],inputSearch:e[39]()}}),t.$on("choose",e[40]),t.$on("back",e[41]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.title=e[6].designation),8388608&n[0]&&(r.newAllowed=e[23]),2048&n[0]&&(r.prevEventId=e[11]),262144&n[0]&&(r.schema=e[18]),128&n[0]&&(r.record=e[7]),1&n[0]&&(r.recID=e[0]),524288&n[0]&&(r.isOpening=e[19]),16777216&n[0]&&(r.filterForReady=e[24]),64&n[0]&&(r.refStatus=e[6].refStatus),16384&n[0]&&(r.selectionFields=e[14]),32768&n[0]&&(r.deList=e[15]),8192&n[0]&&(r.praefix=e[13]),67108864&n[0]&&(r.shouldBlock=e[26]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Vn(e){let t,n;return t=new Dn({props:{item:e[6],className:e[18].class,classId:e[10],rowId:e[0],recordId:e[12],viewName:e[4],viewValue:"",multiValues:e[8]}}),t.$on("choose",e[40]),t.$on("back",e[41]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.item=e[6]),262144&n[0]&&(r.className=e[18].class),1024&n[0]&&(r.classId=e[10]),1&n[0]&&(r.rowId=e[0]),4096&n[0]&&(r.recordId=e[12]),16&n[0]&&(r.viewName=e[4]),256&n[0]&&(r.multiValues=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Un(e){let t,n,r=e[19]&&Ln(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[19]?r?(r.p(e,n),524288&n[0]&&we(r,1)):(r=Ln(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Hn(e){let t,n,r;function i(t){e[58](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[zn]},$$scope:{ctx:e}};return void 0!==e[20]&&(o.open=e[20]),t=new e[28]({props:o}),ee.push(()=>Ee(t,"open",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};2359297&r[0]|2048&r[2]&&(i.$$scope={dirty:r,ctx:e}),!n&&1048576&r[0]&&(n=!0,i.open=e[20],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Wn(e){let t,n;return t=new Cm({props:{schema:e[18],recID:e[0],readonly:!0}}),t.$on("back",e[41]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};262144&n[0]&&(r.schema=e[18]),1&n[0]&&(r.recID=e[0]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zn(e){let t,n;return t=new e[27]({props:{title:e[21],$$slots:{default:[Wn]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};2097152&n[0]&&(r.title=e[21]),262145&n[0]|2048&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function jn(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function qn(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:jn,then:kn,catch:On,value:72,blocks:[,,,]};return ve(e[36](),r),{c(){t=B(),r.block.c()},m(e,i){R(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){Ie(r,e=t,n)},i(e){n||(we(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){ye(r.blocks[e])}n=!1},d(e){e&&D(t),r.block.d(e),r.token=null,r=null}}}function Gn(e,n,r){let o,s,a,l;b(e,i,e=>r(54,o=e));const d=K(),{Dialog:h,Modal:f}=c,{currentTasks:m,environment:p,loggedIn:g}=u;b(e,m,e=>r(60,s=e)),b(e,p,e=>r(62,l=e)),b(e,g,e=>r(61,a=e));let{id:y}=n,{item:v}=n,{fullRecord:I}=n,{value:_=""}=n,{multiValues:C}=n,{desc:E=""}=n,{noForm:A=!1}=n,{classId:$}=n,{eventId:S}=n,{recordId:T}=n,{withRefValue:N=!1}=n,{refValue:R=""}=n,{shortEdit:D}=n,{required:x}=n,{disabled:O}=n,{readonly:k}=n,{praefix:M}=n,{selectionFields:P}=n,{formnovalidate:B}=n,{selection:L}=n,{deList:F}=n,{isTemplate:V}=n,{noList:U=!1}=n,{multi:H=!1}=n,{initFinished:W}=n;const z="comment_"+y,j=v.filter;let q,G,X,Y,Z,Q,J=!1,ee=!0,te=!0,ne=!0,re=!1,ie="";k||=T&&v.asInput,O||=k,!L&&v.selection&&1===v.selection.split(":").length&&(L=v.selection);const oe=k||O||v.lookup||L&&!v.constraint?"":"Suchbegriff ⏎",se=()=>{v.refItem&&v.refItem.startsWith("owner")&&(r(46,R=l.owner[v.refClass]),R||r(46,R=((e,t)=>{try{return e.split(".").reduce((e,t)=>e[t],t)}catch(e){return""}})(v.refItem,l)),R&&(r(45,N=!0),d("change",{value:R})))},ae=async e=>{e.items.filter(e=>e.properties?.default).forEach(t=>{d("defPrep",{className:e.class,itemName:t.name,value:t.properties.default})})},le=async e=>{const n=()=>{r(19,J=!0)};if(9==e.which)return;if(_)return e.preventDefault();if(13!=e.which)return;e.preventDefault();const i=X.items.find(e=>e.properties?.search);if(!i)return n();const o=e.srcElement.value,{name:s,checkOn:a,refClass:l,properties:c}=i;let{search:d}=c;!0===d&&(d={}),"number"==typeof d&&(d={min:d});const{min:u=3,start:h=!1,end:f=!1}=d;if(o.length<u)return n();const m=(h?"^":"")+o+(f?"$":"");let p={[s]:{$regex:m,$options:"i"}};a&&(p=[{$lookup:{from:l,localField:s,foreignField:"_id",as:l}},{$match:{[l+"."+a]:{$regex:m,$options:"i"}}}]);const g=await t.getSectionView(X.class,p);1!==g?.length?n():r(0,_=g[0]._id)},ce=e=>{e&&(r(53,ie=r(1,E=w(X,e))),d("setRefDesc",E.split(" •")[0]),d("change",{value:_,description:E}),d("task",{row:e,eventId:X.id}))},de=()=>{r(19,J=!1),r(20,q=!1)};return e.$$set=e=>{"id"in e&&r(5,y=e.id),"item"in e&&r(6,v=e.item),"fullRecord"in e&&r(7,I=e.fullRecord),"value"in e&&r(0,_=e.value),"multiValues"in e&&r(8,C=e.multiValues),"desc"in e&&r(1,E=e.desc),"noForm"in e&&r(9,A=e.noForm),"classId"in e&&r(10,$=e.classId),"eventId"in e&&r(11,S=e.eventId),"recordId"in e&&r(12,T=e.recordId),"withRefValue"in e&&r(45,N=e.withRefValue),"refValue"in e&&r(46,R=e.refValue),"shortEdit"in e&&r(49,D=e.shortEdit),"required"in e&&r(2,x=e.required),"disabled"in e&&r(3,O=e.disabled),"readonly"in e&&r(48,k=e.readonly),"praefix"in e&&r(13,M=e.praefix),"selectionFields"in e&&r(14,P=e.selectionFields),"formnovalidate"in e&&r(50,B=e.formnovalidate),"selection"in e&&r(4,L=e.selection),"deList"in e&&r(15,F=e.deList),"isTemplate"in e&&r(16,V=e.isTemplate),"noList"in e&&r(51,U=e.noList),"multi"in e&&r(17,H=e.multi),"initFinished"in e&&r(47,W=e.initFinished)},e.$$.update=()=>{if(4&e.$$.dirty[0]|524288&e.$$.dirty[1]&&r(2,x=x&&!B),49152&e.$$.dirty[1]&&N&&r(0,_=R),3&e.$$.dirty[0]|4194304&e.$$.dirty[1]&&!E&&_&&ie&&r(1,E=ie),399425&e.$$.dirty[0]|1114112&e.$$.dirty[1]&&_&&X){let e=!1;if(!Array.isArray(_)){const t=v.properties?.prefetch?500:0;if(T||v.asInput||v.upate||!1!==v.refItem||!0===H||!1===v.refItem&&W)if(t){const t="p$"+v.refClass+"$"+S,n=fm(t);n?n.then(e=>{const t=e.find(({_id:e})=>e===_);t?ce(t):pm(v.refClass,X.id,_,!!v.lookup||U).then(ce)}):e=!0}else e=!0;e&&pm(v.refClass,X.id,_,!!v.lookup||U).then(ce),r(47,W=!0)}}if(65&e.$$.dirty[0]|10485760&e.$$.dirty[1]&&_&&Y&&v.name===Y.input?.at(0)&&Y.inputLookup?.length){const{domain:e}=Y.inputLookup[0]||{};"user"===e&&(o.some(e=>Y.authorization?.find(t=>t.role===e&&!t.constraint))||r(3,O=!0))}262145&e.$$.dirty[0]&&!_&&X&&ce({})},[_,E,x,O,L,y,v,I,C,A,$,S,T,M,P,F,V,H,X,J,q,G,Z,ee,te,ne,re,h,f,m,p,g,z,j,oe,()=>{if(!v.query)return;const[e,t]=v.query.split(".");if(!I[t])return;let n=[{$lookup:{from:e,localField:e,foreignField:"_id",as:"__"+e}},{$unwind:{path:"$__"+e,preserveNullAndEmptyArrays:!0}},{$match:{["__"+e+"."+t]:I[t]}}];return v.refStatus&&(n=n.concat([{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":v.refStatus}}])),n},async()=>{try{const e=await t.getEvent(S);if(Q="report"===e.output.type,r(24,te=!v.asInput),r(23,ee=e.output?.class[0].name!==v.refClass),r(18,X=await t.getSchemaByClass(v.refClass)),X?.blocked)return d("initFail",!0),!1;if(Q||r(26,re=((e,t)=>{let n=t.items.find(e=>!!e.properties?.blocking);if(!n)return!1;if(e.input?.class?.find(e=>e.name===t.class))return n.name;const r=e.output?.class.at(0)?.list||[];for(const e of r){const t=e.item.find(e=>e.name===v.name);if(t?.properties?.blocking)return n.name}return!1})(e,X)),ae(X),r(22,Z=(e=>!s?.length||!!s.find(t=>t===e))(X.id)),r(52,Y=await t.getSchema(S)),S&&T&&_&&!O&&Y.input?.find(e=>e===v.refClass)&&r(3,O=!0),e.input?.class&&e.input.class[0]&&(e.input.class[0].name===v.refClass&&e.input.class[0].readonly&&r(3,O=!0),T&&e.input.class[0].name===v.refClass&&e.input.class[0].writeState)){(await t.getTaskByDocId(T,!0)).status===e.input.class[0].writeState&&r(3,O=r(48,k=!1))}if(v.properties?.query?.lookup){const{domain:e,value:n}=v.properties.query.lookup;if("user"===e){const e=a.user,i={[n]:e},s=await t.getSectionView(v.refClass,i);if(s?.length){const[{_id:e}]=s;e&&(r(46,R=e),r(45,N=!0),d("change",{value:R}))}o.some(e=>X.authorization?.find(t=>t.role===e&&!t.constraint))||r(3,O=!0)}}else se();if(!R&&v.filter&&(""===M||void 0===M)){const e=v.filter,n=!0;e.startsWith("!")&&(n=!1,e=e.slice(1));const i=await t.getOneAndOnly(v.refClass,{[v.filter]:n});i&&(r(46,R=i._id),r(45,N=!0),d("change",{value:R}))}return r(21,G=X.identity.designation),!0}catch{return d("initFail",!0),!1}},e=>t=>{if(t.stopPropagation(),!0===e&&r(19,J=!0),e&&"BUTTON"===t.explicitOriginalTarget?.nodeName){const t=document.getElementById(e);return t?.blur()}(v.lookup||L&&!v.constraint||_)&&r(19,J=!0)},le,()=>{if(_)return"";const e=document.getElementById(z);return r(1,E=""),e?.value||""},({detail:e})=>{r(0,_=e.row._id),de()},de,()=>{(Q||Z)&&(H?d("change",{value:_,delete:!0}):(r(0,_=""),r(1,E=""),r(25,ne=!0),d("change",{value:_,description:E}),d("task",{row:{_task:{event:X.id,_id:!1}}})))},async()=>{if(!_)return;let e=await pm(v.refClass,X.id,_);e._task||(e={_task:await t.getTaskByDocId(_,!0)});const n=e._task.task_id||e._task._id,r=`/task/${e._task.event}/${n}/task?view=standalone`;window.open(r)},e=>{_||E&&le({which:13,preventDefault:()=>{},srcElement:{value:E}})},N,R,W,k,D,B,U,Y,ie,o,function(e){E=e,r(1,E),r(0,_),r(53,ie),r(45,N),r(46,R)},function(e){ne=e,r(25,ne)},function(e){J=e,r(19,J)},function(e){q=e,r(20,q)}]}class Xn extends Te{constructor(e){var t;super(),xn.getElementById("svelte-1wtpa4f-style")||((t=O("style")).id="svelte-1wtpa4f-style",t.textContent=".feather.svelte-1wtpa4f{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-1wtpa4f{z-index:10000 !important;position:absolute;top:0.75em;right:0.5em;color:#4300b0}.text-field textarea:invalid{border-bottom:1px #b80000 solid !important;background-color:#fbeeee !important}",N(xn.head,t)),Se(this,e,Gn,qn,$,{id:5,item:6,fullRecord:7,value:0,multiValues:8,desc:1,noForm:9,classId:10,eventId:11,recordId:12,withRefValue:45,refValue:46,shortEdit:49,required:2,disabled:3,readonly:48,praefix:13,selectionFields:14,formnovalidate:50,selection:4,deList:15,isTemplate:16,noList:51,multi:17,initFinished:47},[-1,-1,-1])}}function Yn(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function Zn(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Kn(e){let t,n;return t=new e[16]({props:{outline:!0,$$slots:{default:[er]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};8191&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qn(e){let t,n,r,i,o;return n=new ft({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",function(){A(e[22](e[0]))&&e[22](e[0]).apply(this,arguments)}),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Jn(e){let t,n;return t=new Xn({props:{classId:e[6],eventId:e[7],required:e[9],disabled:e[1],formnovalidate:e[12],readonly:e[10],id:e[2]+"."+e[42],item:e[3],desc:e[4],value:e[40],noForm:e[5],praefix:e[11],recordId:e[8],multi:!0}}),t.$on("change",e[24]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.classId=e[6]),128&n[0]&&(r.eventId=e[7]),512&n[0]&&(r.required=e[9]),2&n[0]&&(r.disabled=e[1]),4096&n[0]&&(r.formnovalidate=e[12]),1024&n[0]&&(r.readonly=e[10]),4&n[0]&&(r.id=e[2]+"."+e[42]),8&n[0]&&(r.item=e[3]),16&n[0]&&(r.desc=e[4]),1&n[0]&&(r.value=e[40]),32&n[0]&&(r.noForm=e[5]),2048&n[0]&&(r.praefix=e[11]),256&n[0]&&(r.recordId=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function er(e){let t,n,r,i=!e[10]&&Qn(e),o=[].concat(e[0]),s=[];for(let t=0;t<o.length;t+=1)s[t]=Jn(Yn(e,o,t));const a=e=>ye(s[e],1,1,()=>{s[e]=null});return{c(){i&&i.c(),t=P();for(let e=0;e<s.length;e+=1)s[e].c();n=B()},m(e,o){i&&i.m(e,o),R(e,t,o);for(let t=0;t<s.length;t+=1)s[t].m(e,o);R(e,n,o),r=!0},p(e,r){if(e[10]?i&&(pe(),ye(i,1,1,()=>{i=null}),ge()):i?(i.p(e,r),1024&r[0]&&we(i,1)):(i=Qn(e),i.c(),we(i,1),i.m(t.parentNode,t)),16785407&r[0]){let t;for(o=[].concat(e[0]),t=0;t<o.length;t+=1){const i=Yn(e,o,t);s[t]?(s[t].p(i,r),we(s[t],1)):(s[t]=Jn(i),s[t].c(),we(s[t],1),s[t].m(n.parentNode,n))}for(pe(),t=o.length;t<s.length;t+=1)a(t);ge()}},i(e){if(!r){we(i);for(let e=0;e<o.length;e+=1)we(s[e]);r=!0}},o(e){ye(i),s=s.filter(Boolean);for(let e=0;e<s.length;e+=1)ye(s[e]);r=!1},d(e){i&&i.d(e),e&&D(t),x(s,e),e&&D(n)}}}function tr(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function nr(e){let t,n;return t=new e[18]({props:{title:e[14].designation,class:"eList",$$slots:{default:[ir]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};16384&n[0]&&(r.title=e[14].designation),49480&n[0]|4096&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ir(e){let t,n,r,i,o;return n=new e[19]({props:{outline:!0,$$slots:{default:[rr]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new Zt({props:{item:e[3],className:e[14].class,classId:e[6],rowId:e[15],recordId:e[8],inputList:e[21]()}}),i.$on("choose",e[23]),i.$on("back",e[25]),{c(){t=O("div"),Ae(n.$$.fragment),r=P(),Ae(i.$$.fragment),U(t,"class","form--buttons")},m(e,s){R(e,t,s),$e(n,t,null),R(e,r,s),$e(i,e,s),o=!0},p(e,t){const r={};4096&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const o={};8&t[0]&&(o.item=e[3]),16384&t[0]&&(o.className=e[14].class),64&t[0]&&(o.classId=e[6]),32768&t[0]&&(o.rowId=e[15]),256&t[0]&&(o.recordId=e[8]),i.$set(o)},i(e){o||(we(n.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(n.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){e&&D(t),be(n),e&&D(r),be(i,e)}}}function or(e){let t,n,r=e[13]&&nr(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[13]?r?(r.p(e,n),8192&n[0]&&we(r,1)):(r=nr(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function sr(e){let t,n,r,i,o={ctx:e,current:null,token:null,hasCatch:!1,pending:tr,then:Kn,catch:Zn,value:39,blocks:[,,,]};function s(t){e[34](t)}ve(e[20](),o);let a={class:"tModal",noClickaway:!0,$$slots:{default:[or]},$$scope:{ctx:e}};return void 0!==e[13]&&(a.open=e[13]),n=new e[17]({props:a}),ee.push(()=>Ee(n,"open",s)),{c(){o.block.c(),t=P(),Ae(n.$$.fragment)},m(e,r){o.block.m(e,o.anchor=r),o.mount=()=>t.parentNode,o.anchor=t,R(e,t,r),$e(n,e,r),i=!0},p(t,i){Ie(o,e=t,i);const s={};57672&i[0]|4096&i[1]&&(s.$$scope={dirty:i,ctx:e}),!r&&8192&i[0]&&(r=!0,s.open=e[13],le(()=>r=!1)),n.$set(s)},i(e){i||(we(o.block),we(n.$$.fragment,e),i=!0)},o(e){for(let e=0;e<3;e+=1){ye(o.blocks[e])}ye(n.$$.fragment,e),i=!1},d(e){o.block.d(e),o.token=null,o=null,e&&D(t),be(n,e)}}}function ar(e,n,r){const i=K(),{Card:o,Modal:s,Dialog:a,Button:l}=c;let d,u,{id:h}=n,{item:f}=n,{record:m}=n,{values:p=[]}=n,{desc:g=""}=n,{noForm:w=!1}=n,{classId:y}=n,{eventId:v}=n,{recordId:I}=n,{withRefValue:_=!1}=n,{refValue:C=""}=n,{required:E}=n,{disabled:A}=n,{readonly:$}=n,{praefix:b}=n,{selectionFields:S}=n,{formnovalidate:T}=n,{selection:N}=n,{deList:R}=n,{isTemplate:D}=n,{noList:x=!1}=n,O=!1;const{lookup:k,filter:M,constraint:P}=f.properties.multi;A=!0;const B=()=>{r(13,O=!1)};return e.$$set=e=>{"id"in e&&r(2,h=e.id),"item"in e&&r(3,f=e.item),"record"in e&&r(26,m=e.record),"values"in e&&r(0,p=e.values),"desc"in e&&r(4,g=e.desc),"noForm"in e&&r(5,w=e.noForm),"classId"in e&&r(6,y=e.classId),"eventId"in e&&r(7,v=e.eventId),"recordId"in e&&r(8,I=e.recordId),"withRefValue"in e&&r(27,_=e.withRefValue),"refValue"in e&&r(28,C=e.refValue),"required"in e&&r(9,E=e.required),"disabled"in e&&r(1,A=e.disabled),"readonly"in e&&r(10,$=e.readonly),"praefix"in e&&r(11,b=e.praefix),"selectionFields"in e&&r(29,S=e.selectionFields),"formnovalidate"in e&&r(12,T=e.formnovalidate),"selection"in e&&r(30,N=e.selection),"deList"in e&&r(31,R=e.deList),"isTemplate"in e&&r(32,D=e.isTemplate),"noList"in e&&r(33,x=e.noList)},[p,A,h,f,g,w,y,v,I,E,$,b,T,O,d,u,o,s,a,l,async()=>{r(0,p=[].concat(p)),r(14,d=await t.getSchemaByClass(f.refClass))},async()=>{let e=await mm(d.class,d.id);if(!e?.length)return[];if(k&&(e=e.filter(e=>m[k]===e[k])),P&&e?.length){const{refClass:n,refStatus:r}=P,i=[{$match:{[d.class]:{$in:e.map(({_id:e})=>e)}}},{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":r}}],o=await t.getSectionView(n,i);e=e.filter(e=>!!o.find(t=>t.project==e._id))}if(M)for(const t in M)e=e.filter(e=>{let[n,r]=t.split(".");if(r||(r=n,n=""),n){if(e[n][0]&&e[n][0][r].length)return!0}else if(e[r])return!0;return!1});return e},e=>()=>{$||(e=[].concat(e),r(13,O=!0),r(15,u=e))},({detail:e})=>{const t=e.row._id;r(0,p=[].concat(p)),Array.isArray(p)&&!p.find(e=>e===t)&&r(0,p=p.concat(e.row._id)),B()},({detail:e})=>{r(0,p=[].concat(p)),e.delete&&r(0,p=p.filter(t=>t!==e.value)),e.value=p,i("change",e),i("multi",{lookup:k,filter:M,name:f.name,value:p})},B,m,_,C,S,N,R,D,x,function(e){O=e,r(13,O)}]}class lr extends Te{constructor(e){var t;super(),document.getElementById("svelte-1m792ni-style")||((t=O("style")).id="svelte-1m792ni-style",t.textContent=".field .card{padding:1em !important;margin-bottom:1em !important}",N(document.head,t)),Se(this,e,ar,sr,$,{id:2,item:3,record:26,values:0,desc:4,noForm:5,classId:6,eventId:7,recordId:8,withRefValue:27,refValue:28,required:9,disabled:1,readonly:10,praefix:11,selectionFields:29,formnovalidate:12,selection:30,deList:31,isTemplate:32,noList:33},[-1,-1])}}const cr=/\d+/g,dr=/%[HMSpPdmyY%]/g;function ur(e,t,n){const r=Math.floor((new Date).getFullYear()/100);let i=!1;if(""===e)return null;const o=t.split(dr);let s=0,a=0;const l=new Date(0);for(const c of o){if(!e.startsWith(c,s))return n;if(s+=c.length,s===e.length){if(a!==t.length)return n;break}if("%"!==t[a+c.length])break;if(a+=c.length+1,"%"===t[a]){if("%"!==e[s])return n;s++}else if("p"===t[a].toLowerCase()){const t=e.substr(s,2).toUpperCase();if("AM"===t)i=!1,l.getHours()>=12&&l.setHours(l.getHours()-12);else{if("PM"!==t)return n;i=!0,l.getHours()<12&&l.setHours(l.getHours()+12)}}else{cr.lastIndex=s;const o=cr.exec(e);if(null==o)return n;switch(t[a]){case"H":l.setHours(parseInt(o[0])+12*i);break;case"M":l.setMinutes(o[0]);break;case"S":l.setSeconds(o[0]);break;case"d":l.setDate(o[0]);break;case"m":l.setMonth(o[0]-1);break;case"y":l.setFullYear(100*r+parseInt(o[0]));break;case"Y":l.setFullYear(o[0])}s+=o[0].length}a++}return isNaN(l.valueOf())?n:l}function hr(e,t){return null==e||null==t?e:(t.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t)}const{document:fr}=_e;function mr(e,t,n){const r=e.slice();return r[17]=t[n],r}function pr(e,t,n){const r=e.slice();return r[20]=t[n],r}function gr(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function wr(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m=e[0].items,p=[];for(let t=0;t<m.length;t+=1)p[t]=vr(pr(e,m,t));const g=e=>ye(p[e],1,1,()=>{p[e]=null});let w=e[0].list&&Ir(e);return l=new e[5]({props:{outline:!0,$$slots:{default:[Cr]},$$scope:{ctx:e}}}),l.$on("click",e[9]),d=new e[5]({props:{disabled:e[2],class:"close",form:e[6],filled:!0,type:"submit",$$slots:{default:[Er]},$$scope:{ctx:e}}}),{c(){t=O("form"),n=O("input"),i=P();for(let e=0;e<p.length;e+=1)p[e].c();o=P(),w&&w.c(),s=P(),a=O("div"),Ae(l.$$.fragment),c=P(),Ae(d.$$.fragment),U(n,"class",S(e[6])+" svelte-1phofh5"),U(n,"name","_id"),U(n,"type","hidden"),n.value=r=e[1]._id||"",U(t,"class","fTask svelte-1phofh5"),U(t,"id",e[6]),U(a,"class","form--buttons svelte-1phofh5")},m(r,m){R(r,t,m),N(t,n),N(t,i);for(let e=0;e<p.length;e+=1)p[e].m(t,null);N(t,o),w&&w.m(t,null),R(r,s,m),R(r,a,m),$e(l,a,null),N(a,c),$e(d,a,null),u=!0,h||(f=[L(t,"keydown",e[8]),L(t,"submit",F(e[10]))],h=!0)},p(e,i){if((!u||2&i&&r!==(r=e[1]._id||""))&&(n.value=r),75&i){let n;for(m=e[0].items,n=0;n<m.length;n+=1){const r=pr(e,m,n);p[n]?(p[n].p(r,i),we(p[n],1)):(p[n]=vr(r),p[n].c(),we(p[n],1),p[n].m(t,o))}for(pe(),n=m.length;n<p.length;n+=1)g(n);ge()}e[0].list?w?(w.p(e,i),1&i&&we(w,1)):(w=Ir(e),w.c(),we(w,1),w.m(t,null)):w&&(pe(),ye(w,1,1,()=>{w=null}),ge());const s={};8388608&i&&(s.$$scope={dirty:i,ctx:e}),l.$set(s);const a={};4&i&&(a.disabled=e[2]),8388608&i&&(a.$$scope={dirty:i,ctx:e}),d.$set(a)},i(e){if(!u){for(let e=0;e<m.length;e+=1)we(p[e]);we(w),we(l.$$.fragment,e),we(d.$$.fragment,e),u=!0}},o(e){p=p.filter(Boolean);for(let e=0;e<p.length;e+=1)ye(p[e]);ye(w),ye(l.$$.fragment,e),ye(d.$$.fragment,e),u=!1},d(e){e&&D(t),x(p,e),w&&w.d(),e&&D(s),e&&D(a),be(l),be(d),h=!1,E(f)}}}function yr(e){let t,n;return t=new Hd({props:{classId:e[6],item:e[20],selection:e[20].selection,record:e[1],disabled:e[3],eventId:e[0].id,required:!1,isTemplate:!0}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.item=e[20]),1&n&&(r.selection=e[20].selection),2&n&&(r.record=e[1]),8&n&&(r.disabled=e[3]),1&n&&(r.eventId=e[0].id),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vr(e){let t,n,r=br(!0,e[20]),i=r&&yr(e);return{c(){i&&i.c(),t=B()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){1&n&&(r=br(!0,e[20])),r?i?(i.p(e,n),1&n&&we(i,1)):(i=yr(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,()=>{i=null}),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function Ir(e){let t,n,r=e[0].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=_r(mr(e,r,t));const o=e=>ye(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=B()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(75&n){let s;for(r=e[0].list,s=0;s<r.length;s+=1){const o=mr(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=_r(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){x(i,e),e&&D(t)}}}function _r(e){let t,n,r,i;return t=new e[4]({props:{text:e[17].designation}}),r=new Lr({props:{classId:e[6],list:e[17],eventId:e[0].id,schema:e[17].item,record:e[1],disabled:e[3],required:!1,open:!0,isTemplate:!0}}),{c(){Ae(t.$$.fragment),n=P(),Ae(r.$$.fragment)},m(e,o){$e(t,e,o),R(e,n,o),$e(r,e,o),i=!0},p(e,n){const i={};1&n&&(i.text=e[17].designation),t.$set(i);const o={};1&n&&(o.list=e[17]),1&n&&(o.eventId=e[0].id),1&n&&(o.schema=e[17].item),2&n&&(o.record=e[1]),8&n&&(o.disabled=e[3]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function Cr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Er(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Ar(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function $r(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Ar,then:wr,catch:gr,value:16,blocks:[,,,]};return ve(e[7](),i),{c(){t=P(),n=O("section"),i.block.c(),fr.title="Vorgaben",U(n,"class","sTask svelte-1phofh5")},m(e,o){R(e,t,o),R(e,n,o),i.block.m(n,i.anchor=null),i.mount=()=>n,i.anchor=null,r=!0},p(t,[n]){Ie(i,e=t,n)},i(e){r||(we(i.block),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}r=!1},d(e){e&&D(t),e&&D(n),i.block.d(),i.token=null,i=null}}}const br=(e,{type:t="",properties:n={}})=>!e||"list"!==t&&("time"===n.format&&(t="time"),!["date","datetime","time"].includes(t)&&(!n.readonly&&!n.hidden));function Sr(e,r,o){let l,d,u;b(e,a,e=>o(11,d=e)),b(e,i,e=>o(12,u=e));const{Divider:h,Button:f,FormField:m}=c,p=JSON.parse(n.getItem("Locale"));let{schema:g}=r,{record:w}=r,y="template-"+g.class+Math.floor(9e3*Math.random()+1e3).toString(),v=!1;const I=()=>window.history.back(),_=(e,t,n=!1)=>{const r=t.id,i=e.find(e=>e.name===r);let o=t.value;if(!n&&i&&i.properties?.multi&&(o=w[r]),o&&i&&i.type.startsWith("date"))try{return ur(o,"%d.%m.%Y").toISOString()}catch{return new Date(o).toISOString()}if(i&&"boolean"===i.type&&(o=!!t.checked),i&&"number"===i.type){const e=Number("1.1").toLocaleString(p.id).substring(1,2);try{o=Number(o.replace(e,".")).toString()}catch{}}return o};return e.$$set=e=>{"schema"in e&&o(0,g=e.schema),"record"in e&&o(1,w=e.record)},e.$$.update=()=>{4&e.$$.dirty&&o(3,l=v)},[g,w,v,l,h,f,y,async()=>{const e=await t.getEvent(g.id);if(e.trigger?.startOn&&!e.trigger?.startOn?.some(e=>"Manual"===e.type)&&o(2,v=!0),d.role?.length&&g.authorization?.length){const e=g.authorization.some(e=>u?.find(t=>t===e.role&&"edit"===e.activity));o(2,v||=!e)}},e=>{"button"!==e.srcElement?.type&&"textarea"!==e.srcElement?.type&&13==e.which&&e.preventDefault()},I,async e=>{const n={};Array.from(document.querySelectorAll("form#"+y+" ."+y)).map(e=>{const t=e.id||e.name;if(t)if(t.includes(".")){const[r,i]=t.split("."),o=g.list.find(e=>e.name===r);n[t]=_(o.item,e)}else n[t]=_(g.items,e)}),await t.saveTemplate(g.class,n),s.success("Die Vorgaben wurden gespeichert.",2e3),I()}]}const{document:Tr}=_e;function Nr(e,t,n){const r=e.slice();return r[28]=t[n],r}function Rr(e){let t,n;return t=new Hd({props:{classId:e[2],item:e[28],listName:e[1].name,eventId:e[3],record:e[0],disabled:e[4],required:e[5],currency:e[8]}}),t.$on("notify",e[14]),t.$on("defPrep",e[16]),t.$on("task",e[21]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4&n[0]&&(r.classId=e[2]),2&n[0]&&(r.item=e[28]),2&n[0]&&(r.listName=e[1].name),8&n[0]&&(r.eventId=e[3]),1&n[0]&&(r.record=e[0]),16&n[0]&&(r.disabled=e[4]),32&n[0]&&(r.required=e[5]),256&n[0]&&(r.currency=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Dr(e){let t,n,r=br(e[7],e[28]),i=r&&Rr(e);return{c(){i&&i.c(),t=B()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){130&n[0]&&(r=br(e[7],e[28])),r?i?(i.p(e,n),130&n[0]&&we(i,1)):(i=Rr(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,()=>{i=null}),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function xr(e){let t,n,r,i=e[1].item,o=[];for(let t=0;t<i.length;t+=1)o[t]=Dr(Nr(e,i,t));const s=e=>ye(o[e],1,1,()=>{o[e]=null});return{c(){t=O("div");for(let e=0;e<o.length;e+=1)o[e].c();U(t,"id",n=`accordion-content-${e[2]}-${e[1].name}`)},m(e,n){R(e,t,n);for(let e=0;e<o.length;e+=1)o[e].m(t,null);r=!0},p(e,a){if(82367&a[0]){let n;for(i=e[1].item,n=0;n<i.length;n+=1){const r=Nr(e,i,n);o[n]?(o[n].p(r,a),we(o[n],1)):(o[n]=Dr(r),o[n].c(),we(o[n],1),o[n].m(t,null))}for(pe(),n=i.length;n<o.length;n+=1)s(n);ge()}(!r||6&a[0]&&n!==(n=`accordion-content-${e[2]}-${e[1].name}`))&&U(t,"id",n)},i(e){if(!r){for(let e=0;e<i.length;e+=1)we(o[e]);r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)ye(o[e]);r=!1},d(e){e&&D(t),x(o,e)}}}function Or(e){let t,n,r=e[13](e[9])+"";return{c(){t=O("span"),n=M(r)},m(e,r){R(e,t,r),N(t,n)},p(e,t){512&t[0]&&r!==(r=e[13](e[9])+"")&&H(n,r)},d(e){e&&D(t)}}}function kr(e){let t,n,r;return n=new e[10]({props:{$$slots:{default:[Or]},$$scope:{ctx:e}}}),n.$on("click",function(){A(e[15](e[27]))&&e[15](e[27]).apply(this,arguments)}),{c(){t=O("div"),Ae(n.$$.fragment),U(t,"class","accordion svelte-148ktt9"),U(t,"slot","handle")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p(t,r){e=t;const i={};512&r[0]|1&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Mr(e){let t,n;return t=new e[12]({props:{open:e[6],$$slots:{handle:[kr,({toggle:e})=>({27:e}),({toggle:e})=>[e?134217728:0]],default:[xr,({toggle:e})=>({27:e}),({toggle:e})=>[e?134217728:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",e[17]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};64&n[0]&&(r.open=e[6]),134218687&n[0]|1&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Pr(e){let t,n,r;return n=new e[11]({props:{$$slots:{default:[Mr]},$$scope:{ctx:e}}}),{c(){t=O("div"),Ae(n.$$.fragment),U(t,"class","formList")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p(e,t){const r={};1023&t[0]|1&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Br(e,n,r){const{Button:i,Accordion:o,AccordionSection:s}=c;let{list:a}=n,{schema:l}=n,{record:d}=n,{classId:u}=n,{eventId:h}=n,{disabled:f}=n,{required:w}=n,{open:y=!1}=n,{template:v={}}=n,{isTemplate:I=!1}=n,{currency:_}=n,{update:C=!1}=n,E=new Map;const A={};let $=d[a.name]||{};d[a.name]=$;const b=e=>A[e]?.split(" • ").filter(e=>!!e).slice(0,2).join(" · "),S=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};return e.$$set=e=>{"list"in e&&r(1,a=e.list),"schema"in e&&r(18,l=e.schema),"record"in e&&r(0,d=e.record),"classId"in e&&r(2,u=e.classId),"eventId"in e&&r(3,h=e.eventId),"disabled"in e&&r(4,f=e.disabled),"required"in e&&r(5,w=e.required),"open"in e&&r(6,y=e.open),"template"in e&&r(19,v=e.template),"isTemplate"in e&&r(7,I=e.isTemplate),"currency"in e&&r(8,_=e.currency),"update"in e&&r(20,C=e.update)},e.$$.update=()=>{1048579&e.$$.dirty[0]&&C&&d&&r(9,$=d[a.name]||{})},[d,a,u,h,f,w,y,I,_,$,i,o,s,e=>l.filter(t=>void 0!==e[t.name]&&"textarea"!==t.properties?.format&&"html"!==t.properties?.format).map(t=>"object"===t.type?b(t.name):"boolean"===t.type?g(e[t.name]):"date"===t.type?m(e[t.name]):"datetime"===t.type?p(e[t.name]):e[t.name]).filter(e=>!!e).join(" • ")||"+",({detail:e})=>{const[t,n]=e.itemName.split(".");if(!n)return;e.desc&&(A[n]=e.desc);const i=d[t];r(0,d[t]={...i,[n]:e.value},d),r(9,$=d[t])},e=>t=>{(()=>{const e=v[a.name]||{};for(const t in e)v[a.name][t]&&!d[a.name][t]&&r(0,d[a.name][t]=v[a.name][t],d)})(),e(t);const n=`#accordion-content-${u}-${a.name} > div.form-field:last-child`,i=document.querySelector(n);se().then(()=>{const e=`#accordion-content-${u}-${a.name} textarea`;Array.from(document.querySelectorAll(e)).forEach(S)}).then(()=>i.scrollIntoView({behavior:"smooth",block:"end"}))},async({detail:{className:e,itemName:n,value:r}})=>{if(E.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===className+"."+a.name)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&E.set(e,o[0])},()=>{setTimeout(()=>{Array.from(E).forEach(([e,t])=>{d[a.name][e]||r(0,d[a.name][e]=t._id,d)})},500)},l,v,C,function(t){Q(e,t)}]}class Lr extends Te{constructor(e){var t;super(),Tr.getElementById("svelte-148ktt9-style")||((t=O("style")).id="svelte-148ktt9-style",t.textContent=".accordion.svelte-148ktt9{display:flex}.formList .accordion > .btn{display:inline-block;width:97%;margin-bottom:1em;background-color:#F5F5F5}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}",N(Tr.head,t)),Se(this,e,Br,Pr,$,{list:1,schema:18,record:0,classId:2,eventId:3,disabled:4,required:5,open:6,template:19,isTemplate:7,currency:8,update:20},[-1,-1])}}const{document:Fr}=_e;function Vr(e){e[0]=e[23].list,e[22]=e[23].items}function Ur(e,t,n){const r=e.slice();return r[24]=t[n],r}function Hr(e,t,n){const r=e.slice();return r[27]=t[n],r}function Wr(e,t,n){const r=e.slice();return r[27]=t[n],r}function zr(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function jr(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[19](t)}Vr(e),n=new e[7]({props:{outline:!0,$$slots:{default:[qr]},$$scope:{ctx:e}}}),n.$on("click",e[18]);let I={id:e[8]};void 0!==e[1]&&(I.value=e[1]),s=new e[6]({props:I}),ee.push(()=>Ee(s,"value",v)),s.$on("input",e[12]),d=new tt({props:{size:"18"}});let _=e[22]?.length&&function(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=Gr(Wr(e,r,t));return{c(){t=O("thead"),n=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n);for(let e=0;e<i.length;e+=1)i[e].m(n,null)},p(e,t){if(2048&t[0]){let o;for(r=e[22],o=0;o<r.length;o+=1){const s=Wr(e,r,o);i[o]?i[o].p(s,t):(i[o]=Gr(s),i[o].c(),i[o].m(n,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=r.length}},d(e){e&&D(t),x(i,e)}}}(e),C=e[0]?.length&&function(e){let t,n=e[0],r=[];for(let t=0;t<n.length;t+=1)r[t]=Zr(Ur(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=B()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(e,t,n)},p(e,i){if(11778&i[0]){let o;for(n=e[0],o=0;o<n.length;o+=1){const s=Ur(e,n,o);r[o]?r[o].p(s,i):(r[o]=Zr(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){x(r,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),i=O("div"),o=M("Suchen: "),Ae(s.$$.fragment),l=P(),c=O("span"),Ae(d.$$.fragment),u=P(),h=O("div"),f=O("table"),_&&_.c(),m=P(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),$e(n,t,null),R(a,r,v),R(a,i,v),N(i,o),$e(s,i,null),N(i,l),N(i,c),$e(d,c,null),R(a,u,v),R(a,h,v),N(h,f),_&&_.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){Vr(e);const r={};2&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],le(()=>a=!1)),s.$set(i),e[22]?.length&&_.p(e,t),e[0]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),_&&_.d(),C&&C.d(),w=!1,y()}}}function qr(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Gr(e){let t,n,r=e[27]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:I,d(e){e&&D(t)}}}function Xr(e){let t,n,r=e[22],i=[];for(let t=0;t<r.length;t+=1)i[t]=Yr(Hr(e,r,t));return{c(){t=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=P(),U(t,"class","pointer svelte-14hcfjl")},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);N(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[22],s=0;s<r.length;s+=1){const a=Hr(e,r,s);i[s]?i[s].p(a,o):(i[s]=Yr(a),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}},d(e){e&&D(t),x(i,e)}}}function Yr(e){let t,n,r,i,o=e[9](e[24],e[27])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[24]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function Zr(e){let t,n=e[13](e[24],e[22],e[1]),r=n&&Xr(e);return{c(){r&&r.c(),t=B()},m(e,n){r&&r.m(e,n),R(e,t,n)},p(e,i){2&i[0]&&(n=e[13](e[24],e[22],e[1])),n?r?r.p(e,i):(r=Xr(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t)}}}function Kr(e){let t,n;return t=new e[5]({}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p:I,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qr(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Kr,then:jr,catch:zr,value:23,blocks:[,,,]};return ve(e[11](),o),{c(){Ae(t.$$.fragment),n=P(),r=B(),o.block.c()},m(e,s){$e(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ie(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Jr(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[Qr]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};2&n[0]|2&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ei(e,n,r){const i=K(),{Dialog:o,Divider:s,Loading:a,TextField:l,Button:d}=c;let{item:u}=n,{className:h}=n,{classId:f}=n,{list:p}=n,w="",y=f+Math.floor(9e3*Math.random()+1e3).toString()+"search";const v=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?g(n):m(e[`_${t.name}`]||e[t.name]||"")},I=t.getSchemaByClass(h);Y(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(y)?.focus()},200)});return e.$$set=e=>{"item"in e&&r(15,u=e.item),"className"in e&&r(16,h=e.className),"classId"in e&&r(17,f=e.classId),"list"in e&&r(0,p=e.list)},[p,w,i,o,s,a,l,d,y,v,e=>()=>i("choose",{row:e}),async()=>{const e=await I,t=e.display;let n=await Xt(t,e,p);return{list:p,items:n}},({detail:{value:e}})=>{r(1,w=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(v(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{r(1,w="")},u,h,f,()=>i("back"),function(e){w=e,r(1,w)}]}class ti extends Te{constructor(e){var t;super(),Fr.getElementById("svelte-14hcfjl-style")||((t=O("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",N(Fr.head,t)),Se(this,e,ei,Jr,$,{item:15,className:16,classId:17,list:0},[-1,-1])}}const{document:ni}=_e;function ri(e,t,n){const r=e.slice();return r[11]=t[n],r}function ii(e,t,n){const r=e.slice();return r[3]=t[n],r}function oi(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function si(e){let t,n,r,i=e[7].items,o=[];for(let t=0;t<i.length;t+=1)o[t]=ui(ii(e,i,t));const s=e=>ye(o[e],1,1,()=>{o[e]=null});let a=e[7].list&&hi(e);return{c(){for(let e=0;e<o.length;e+=1)o[e].c();t=P(),a&&a.c(),n=B()},m(e,i){for(let t=0;t<o.length;t+=1)o[t].m(e,i);R(e,t,i),a&&a.m(e,i),R(e,n,i),r=!0},p(e,r){if(30327783&r[0]){let n;for(i=e[7].items,n=0;n<i.length;n+=1){const s=ii(e,i,n);o[n]?(o[n].p(s,r),we(o[n],1)):(o[n]=ui(s),o[n].c(),we(o[n],1),o[n].m(t.parentNode,t))}for(pe(),n=i.length;n<o.length;n+=1)s(n);ge()}e[7].list?a?(a.p(e,r),128&r[0]&&we(a,1)):(a=hi(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,()=>{a=null}),ge())},i(e){if(!r){for(let e=0;e<i.length;e+=1)we(o[e]);we(a),r=!0}},o(e){o=o.filter(Boolean);for(let e=0;e<o.length;e+=1)ye(o[e]);ye(a),r=!1},d(e){x(o,e),e&&D(t),a&&a.d(e),e&&D(n)}}}function ai(e){let t,n,r,i;const o=[ci,li],s=[];function a(e,t){return e[3].name!==e[14]||e[15]?"lookup"!==e[3].properties?.format?1:-1:0}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=B()},m(e,n){~t&&s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){~t&&s[t].d(e),e&&D(r)}}}function li(e){let t,n;return t=new Hd({props:{classId:e[8],item:e[3],record:e[6],disabled:e[3].name===e[14]&&e[15]||e[0],eventId:e[5],currency:e[2],changeValue:e[9]}}),t.$on("notify",e[17]),t.$on("multi",e[18]),t.$on("defPrep",e[19]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};256&n[0]&&(r.classId=e[8]),128&n[0]&&(r.item=e[3]),64&n[0]&&(r.record=e[6]),129&n[0]&&(r.disabled=e[3].name===e[14]&&e[15]||e[0]),32&n[0]&&(r.eventId=e[5]),4&n[0]&&(r.currency=e[2]),512&n[0]&&(r.changeValue=e[9]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ci(e){let t,n,r,i;n=new Hd({props:{classId:e[8],item:e[3],record:e[6],disabled:e[0]||!!e[1],required:!0,eventId:e[5],currency:e[2],changeValue:e[9]}}),n.$on("notify",e[17]),n.$on("multi",e[18]),n.$on("defPrep",e[19]),n.$on("record",e[23]),n.$on("objRecord",e[24]);let o=e[1]&&di(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o&&o.c(),z(t,"padding-top",".25em"),z(t,"background-color","lightyellow"),z(t,"position","relative")},m(e,s){R(e,t,s),$e(n,t,null),N(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};256&r[0]&&(i.classId=e[8]),128&r[0]&&(i.item=e[3]),64&r[0]&&(i.record=e[6]),3&r[0]&&(i.disabled=e[0]||!!e[1]),32&r[0]&&(i.eventId=e[5]),4&r[0]&&(i.currency=e[2]),512&r[0]&&(i.changeValue=e[9]),n.$set(i),e[1]?o?(o.p(e,r),2&r[0]&&we(o,1)):(o=di(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,()=>{o=null}),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function di(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 pointer svelte-16mo2c")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[22]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function ui(e){let t,n,r="list"!==e[3].type&&ai(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"list"!==e[3].type?r?(r.p(e,n),128&n[0]&&we(r,1)):(r=ai(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function hi(e){let t,n,r=e[7].list,i=[];for(let t=0;t<r.length;t+=1)i[t]=mi(ri(e,r,t));const o=e=>ye(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=B()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(485&n[0]){let s;for(r=e[7].list,s=0;s<r.length;s+=1){const o=ri(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=mi(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){x(i,e),e&&D(t)}}}function fi(e){let t,n,r,i;return t=new e[12]({props:{text:e[11].designation}}),r=new Lr({props:{classId:e[8],list:e[11],eventId:e[5],schema:e[11].item,record:e[6],disabled:e[0],currency:e[2],update:!0}}),{c(){Ae(t.$$.fragment),n=P(),Ae(r.$$.fragment)},m(e,o){$e(t,e,o),R(e,n,o),$e(r,e,o),i=!0},p(e,n){const i={};128&n[0]&&(i.text=e[11].designation),t.$set(i);const o={};256&n[0]&&(o.classId=e[8]),128&n[0]&&(o.list=e[11]),32&n[0]&&(o.eventId=e[5]),128&n[0]&&(o.schema=e[11].item),64&n[0]&&(o.record=e[6]),1&n[0]&&(o.disabled=e[0]),4&n[0]&&(o.currency=e[2]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function mi(e){let t,n,r="array"!==e[11].type&&fi(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"array"!==e[11].type?r?(r.p(e,n),128&n[0]&&we(r,1)):(r=fi(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function pi(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function gi(e){let t,n;return t=new ti({props:{item:e[3],className:e[4],classId:e[8],list:e[11]}}),t.$on("choose",e[20]),t.$on("back",e[21]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};8&n[0]&&(r.item=e[3]),16&n[0]&&(r.className=e[4]),256&n[0]&&(r.classId=e[8]),2048&n[0]&&(r.list=e[11]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wi(e){let t,n,r=e[10]&&gi(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[10]?r?(r.p(e,n),1024&n[0]&&we(r,1)):(r=gi(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function yi(e){let t,n,r,i,o,s,a={ctx:e,current:null,token:null,hasCatch:!1,pending:pi,then:si,catch:oi,value:54,blocks:[,,,]};function l(t){e[30](t)}ve(e[16](),a),n=new e[12]({});let c={class:"tModal",noClickaway:!0,$$slots:{default:[wi]},$$scope:{ctx:e}};return void 0!==e[10]&&(c.open=e[10]),i=new e[13]({props:c}),ee.push(()=>Ee(i,"open",l)),{c(){a.block.c(),t=P(),Ae(n.$$.fragment),r=P(),Ae(i.$$.fragment)},m(e,o){a.block.m(e,a.anchor=o),a.mount=()=>t.parentNode,a.anchor=t,R(e,t,o),$e(n,e,o),R(e,r,o),$e(i,e,o),s=!0},p(t,n){Ie(a,e=t,n);const r={};3352&n[0]|268435456&n[1]&&(r.$$scope={dirty:n,ctx:e}),!o&&1024&n[0]&&(o=!0,r.open=e[10],le(()=>o=!1)),i.$set(r)},i(e){s||(we(a.block),we(n.$$.fragment,e),we(i.$$.fragment,e),s=!0)},o(e){for(let e=0;e<3;e+=1){ye(a.blocks[e])}ye(n.$$.fragment,e),ye(i.$$.fragment,e),s=!1},d(e){a.block.d(e),a.token=null,a=null,e&&D(t),be(n,e),e&&D(r),be(i,e)}}}function vi(e,n,r){const{Divider:i,FormField:o,Modal:s}=c,a=K();let l,d,u,h,f,{required:m}=n,{disabled:p}=n,{readonly:g}=n,{id:w}=n,{item:y}=n,{value:v}=n,{refValue:I}=n,{currency:_}=n,C={},E=[],A=[],$={},b=new Map,S=!1,T="";const N=y.checkOn,R=v,D=e=>{l.items.filter(t=>"object"==typeof(t.properties&&t.properties[e])).map(t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");E.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})})},x=()=>{l.items.filter(e=>e.lookup).forEach(e=>{A.push({name:e.name,lookup:e.lookup})}),l.items.filter(e=>e.properties?.lookup).forEach(e=>{A.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})})},O=async e=>{const t=E.filter(t=>t.refObj===e);if(t?.length){r(9,$={});for(const e of t){const{itemName:t,refObj:n,refName:i,op:o}=e;let{action:s}=e;if(!n)break;let a,l,c=!i&&C[n];const u=C[n];u&&i&&(c=(await ym(n,u))[i]),Array.isArray(c)&&0===c.length&&(c=!1),"!"===o&&(c=!c),"required"!==s&&"readonly"!==s||(s="required"===s?s:"disabled",setTimeout(()=>{a=`#${d} .form-field.${t} .field textarea`,l=document.querySelector(a),l||(a=`#${d} .form-field.${t} .field input`,l=document.querySelector(a)),l&&c&&l.setAttribute(s,""),l&&!c&&l.removeAttribute(s)},0)),"hidden"===s&&(a=`#${d} .form-field.${t}`,l=document.querySelector(a),l?.classList?.toggle("hidden",!!c),c&&r(9,$[t]="",$))}}};Y(()=>{k()});const k=async()=>{const e=e=>new Promise(t=>setTimeout(t,e));let t,n=0;for(;!(t=document.getElementById(d))&&++n<20;)await e(50);t&&((()=>{if(recID)return;const e=new Set;for(const t of E)e.add(t.refObj||u);Array.from(e).forEach(e=>O(e))})(),M())},M=()=>{setTimeout(()=>{Array.from(b).forEach(([e,t])=>{C[e]||r(6,C[e]=t._id,C)})},250)},P=async e=>{if(!e.value)return void L();const n={[e.itemName]:{$regex:`(?i)${e.value}`}},i=await t.getSectionView(u,n);i?.length?(r(11,T=i),r(10,S=!0)):(r(1,v=""),r(25,I=""),a("setRefValue",I))},B=()=>{r(10,S=!1)},L=()=>{r(1,v=""),r(25,I=v),r(6,C={}),a("setRefValue",I)};return e.$$set=e=>{"required"in e&&r(26,m=e.required),"disabled"in e&&r(0,p=e.disabled),"readonly"in e&&r(27,g=e.readonly),"id"in e&&r(28,w=e.id),"item"in e&&r(3,y=e.item),"value"in e&&r(1,v=e.value),"refValue"in e&&r(25,I=e.refValue),"currency"in e&&r(2,_=e.currency)},e.$$.update=()=>{134217729&e.$$.dirty[0]&&r(0,p=p||g),536871024&e.$$.dirty[0]&&C&&a("safeReference",{record:C,class:u,event:h,taskId:f})},[p,v,_,y,u,h,C,l,d,$,S,T,i,s,N,R,async()=>{try{if(v){const e=await t.getTask(y.refClass,v);delete e._task,r(6,C=e),r(29,f=(await t.getTaskByDocId(e._id,!0))._id)}else r(6,C={})}catch{}return r(7,l=await t.getSchemaByClass(y.refClass)),r(8,d="form-"+l.class+Math.floor(9e3*Math.random()+1e3).toString()),r(4,u=l.class),l.identity.designation,r(5,h=l.id),["readonly","hidden","required"].map(D),x(),!0},async({detail:e})=>{const{itemName:t,value:n}=e;if(r(6,C[t]=n,C),t===N)return P(e);O(t)},async({detail:e})=>{if(!(l.input?.length&&l.input.length>1))return;if(prevSchema?.class!==l.input[0])return;const{value:n,lookup:i,view:o}=e,[s]=i.split(":"),a=(await t.getSectionView(s,{[o]:{$in:n}})).map(e=>e._id);for(const e of l.input.slice(1)){r(6,C[e]=[],C);const n=await t.getSchemaByClass(e);n.id;let i=await t.getTasks(n.id);if(i=i.data.filter(e=>"Ready"===e._task?.status&&a.includes(e[s])),i?.length){const n=i.map(e=>e._id),o=await t.getSectionView(e,{_id:{$in:n}});for(const t of o)t[e]=t._id;r(6,C[e]=o,C)}}},async({detail:{className:e,itemName:n,value:r}})=>{if(b.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===u)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&b.set(e,o[0])},async({detail:e})=>{const n=await t.getSectionView(u,{_id:e.row._id});n?.length&&(r(1,v=n[0]._id),r(25,I=v),a("setRefValue",I),r(6,C=n[0])),B()},B,L,({detail:e})=>{r(6,C[e.itemName]=e.value,C)},({detail:e})=>{for(const t of e.items)r(6,C[e.listName][t.name]=t.value,C)},I,m,g,w,f,function(e){S=e,r(10,S)}]}class Ii extends Te{constructor(e){var t;super(),ni.getElementById("svelte-16mo2c-style")||((t=O("style")).id="svelte-16mo2c-style",t.textContent=".feather2.svelte-16mo2c{position:absolute;top:1em;right:0.5em;color:#4300b0}",N(ni.head,t)),Se(this,e,vi,yi,$,{required:26,disabled:0,readonly:27,id:28,item:3,value:1,refValue:25,currency:2},[-1,-1])}}function _i(e){let t,n;return{c(){t=O("span"),n=M(e[4]),U(t,"class","item")},m(e,r){R(e,t,r),N(t,n)},p(e,t){16&t[0]&&H(n,e[4])},d(e){e&&D(t)}}}function Ci(e){let t,n,r,i=e[6]&&_i(e),o=e[14]&&function(e){let t,n,r,i,o;return n=new Be({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","pointer feather svelte-1fuww0c")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[17]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}(e);return{c(){i&&i.c(),t=P(),o&&o.c(),n=B()},m(e,s){i&&i.m(e,s),R(e,t,s),o&&o.m(e,s),R(e,n,s),r=!0},p(e,n){e[6]?i?i.p(e,n):(i=_i(e),i.c(),i.m(t.parentNode,t)):i&&(i.d(1),i=null),e[14]&&o.p(e,n)},i(e){r||(we(o),r=!0)},o(e){ye(o),r=!1},d(e){i&&i.d(e),e&&D(t),o&&o.d(e),e&&D(n)}}}function Ei(e){let t,n,r;return n=new e[10]({props:{withItem:!0,itemLeft:!0,lang:e[11].id,class:"left",type:"string",inputClass:"txt-right"+(e[1]?"":" "+e[2]),id:e[0],name:e[0],value:e[9],step:e[12],pattern:e[7],placeholder:e[13],readonly:e[8],disabled:e[3],required:e[5],$$slots:{default:[Ci]},$$scope:{ctx:e}}}),n.$on("change",e[15]),n.$on("focus",e[16]),{c(){t=O("div"),Ae(n.$$.fragment),z(t,"position","relative"),z(t,"max-width","10em")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p(e,t){const r={};6&t[0]&&(r.inputClass="txt-right"+(e[1]?"":" "+e[2])),1&t[0]&&(r.id=e[0]),1&t[0]&&(r.name=e[0]),512&t[0]&&(r.value=e[9]),128&t[0]&&(r.pattern=e[7]),256&t[0]&&(r.readonly=e[8]),8&t[0]&&(r.disabled=e[3]),32&t[0]&&(r.required=e[5]),80&t[0]|32&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Ai(e,t,r){const i=K(),{TextField:o}=c;let{id:s}=t,{item:a}=t,{value:l}=t,{noForm:d=!1}=t,{classId:u}=t,{disabled:h}=t,{formnovalidate:f}=t,{currency:m}=t,{praefix:p}=t,{notifyList:g}=t;const w=JSON.parse(n.getItem("Locale"));let y=["price","amount","amountValue","taxValue","total","__total"].find(e=>e===a.name?.split("-")[0])||a.properties?.currency;!1===a.properties?.currency&&(y=!1);const v=Number("1.1").toLocaleString(w.id).substring(1,2),{properties:I={}}=a;let{min:_,max:C,step:E,pattern:A,decimals:$=0,unit:b="",placeholder:S,hint:T,readonly:N,negative:R,required:D=!1,transfer:x}=I,O="";l=l?Number(l.toString().replace(",",".")):0,N=!0===N||void 0;const k=e=>Number(e.toString()).toFixed($).toString().replace(".",v);A||(A=$?`[0-9]+([${v}][0-9]{1,${$}})?`:"[0-9]*"),R&&(A="-?"+A);return e.$$set=e=>{"id"in e&&r(0,s=e.id),"item"in e&&r(19,a=e.item),"value"in e&&r(18,l=e.value),"noForm"in e&&r(1,d=e.noForm),"classId"in e&&r(2,u=e.classId),"disabled"in e&&r(3,h=e.disabled),"formnovalidate"in e&&r(20,f=e.formnovalidate),"currency"in e&&r(4,m=e.currency),"praefix"in e&&r(21,p=e.praefix),"notifyList"in e&&r(22,g=e.notifyList)},e.$$.update=()=>{1048608&e.$$.dirty[0]&&r(5,D=D&&!f),262144&e.$$.dirty[0]&&(e=>{r(9,O=k(e.toString().replace(",",".")))})(l),4194304&e.$$.dirty[0]&&(async()=>{const e=a.properties?.value?.formula;if(e)void 0!==p&&""!==p?e?.operator?.multiply&&i("formula",{item:a}):e?.operator&&i("formula",{item:a})})()},[s,d,u,h,m,D,y,A,N,O,o,w,E,S,x,({detail:e})=>i("blur",{value:k(e.value)}),({detail:e})=>{N||+l||r(9,O="")},({detail:e})=>{const t=[].concat(x.target);for(const e of t)i("record",{itemName:e,value:l}),i("listRecord",{itemName:e,decimals:a.properties?.decimals,value:l})},l,a,f,p,g]}class $i extends Te{constructor(e){var t;super(),document.getElementById("svelte-1fuww0c-style")||((t=O("style")).id="svelte-1fuww0c-style",t.textContent=".feather.svelte-1fuww0c{position:absolute;top:0.75em;right:-1em;color:#4300b0}",N(document.head,t)),Se(this,e,Ai,Ei,$,{id:0,item:19,value:18,noForm:1,classId:2,disabled:3,formnovalidate:20,currency:4,praefix:21,notifyList:22},[-1,-1])}}const{document:bi}=_e;function Si(e){e[34]=e[36].list,e[35]=e[36].items}function Ti(e,t,n){const r=e.slice();return r[37]=t[n],r[39]=n,r}function Ni(e,t,n){const r=e.slice();return r[40]=t[n],r[42]=n,r}function Ri(e,t,n){const r=e.slice();return r[40]=t[n],r}function Di(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function xi(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v;Si(e),n=new e[9]({props:{outline:!0,$$slots:{default:[Oi]},$$scope:{ctx:e}}}),n.$on("click",e[31]);let I=!e[2]&&ki(e);function _(t){e[32](t)}let C={id:e[12]};void 0!==e[3]&&(C.value=e[3]),a=new e[7]({props:C}),ee.push(()=>Ee(a,"value",_)),a.$on("input",e[15]),u=new tt({props:{size:"18"}});let E=e[35]?.length&&function(e){let t,n,r,i,o=!e[2]&&Pi(e),s=e[35],a=[];for(let t=0;t<s.length;t+=1)a[t]=Bi(Ri(e,s,t));return{c(){t=O("thead"),n=O("tr"),o&&o.c(),r=P();for(let e=0;e<a.length;e+=1)a[e].c();U(n,"class","svelte-1m010ne"),U(t,"class","svelte-1m010ne")},m(e,s){R(e,t,s),N(t,n),o&&o.m(n,null),N(n,r);for(let e=0;e<a.length;e+=1)a[e].m(n,null);i=!0},p(e,t){if(e[2]?o&&(pe(),ye(o,1,1,()=>{o=null}),ge()):o?(o.p(e,t),4&t[0]&&we(o,1)):(o=Pi(e),o.c(),we(o,1),o.m(n,r)),16384&t[0]){let r;for(s=e[35],r=0;r<s.length;r+=1){const i=Ri(e,s,r);a[r]?a[r].p(i,t):(a[r]=Bi(i),a[r].c(),a[r].m(n,null))}for(;r<a.length;r+=1)a[r].d(1);a.length=s.length}},i(e){i||(we(o),i=!0)},o(e){ye(o),i=!1},d(e){e&&D(t),o&&o.d(),x(a,e)}}}(e),A=e[34]?.length&&function(e){let t,n,r=e[34],i=[];for(let t=0;t<r.length;t+=1)i[t]=Hi(Ti(e,r,t));const o=e=>ye(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=B()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(1138717&n[0]){let s;for(r=e[34],s=0;s<r.length;s+=1){const o=Ti(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Hi(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){x(i,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),I&&I.c(),i=P(),o=O("div"),s=M("Suchen: "),Ae(a.$$.fragment),c=P(),d=O("span"),Ae(u.$$.fragment),h=P(),f=O("div"),m=O("table"),E&&E.c(),p=P(),g=O("tbody"),A&&A.c(),U(t,"class","form--buttons svelte-1m010ne"),U(d,"class","feather pointer svelte-1m010ne"),z(o,"margin-bottom","1em"),z(o,"position","relative"),U(m,"striped",""),U(m,"class","svelte-1m010ne"),U(f,"class","eList svelte-1m010ne")},m(l,_){R(l,t,_),$e(n,t,null),N(t,r),I&&I.m(t,null),R(l,i,_),R(l,o,_),N(o,s),$e(a,o,null),N(o,c),N(o,d),$e(u,d,null),R(l,h,_),R(l,f,_),N(f,m),E&&E.m(m,null),N(m,p),N(m,g),A&&A.m(g,null),w=!0,y||(v=L(d,"click",e[17]),y=!0)},p(e,r){Si(e);const i={};16384&r[1]&&(i.$$scope={dirty:r,ctx:e}),n.$set(i),e[2]?I&&(pe(),ye(I,1,1,()=>{I=null}),ge()):I?(I.p(e,r),4&r[0]&&we(I,1)):(I=ki(e),I.c(),we(I,1),I.m(t,null));const o={};!l&&8&r[0]&&(l=!0,o.value=e[3],le(()=>l=!1)),a.$set(o),e[35]?.length&&E.p(e,r),e[34]?.length&&A.p(e,r)},i(e){w||(we(n.$$.fragment,e),we(I),we(a.$$.fragment,e),we(u.$$.fragment,e),we(E),we(A),w=!0)},o(e){ye(n.$$.fragment,e),ye(I),ye(a.$$.fragment,e),ye(u.$$.fragment,e),ye(E),ye(A),w=!1},d(e){e&&D(t),be(n),I&&I.d(),e&&D(i),e&&D(o),be(a),be(u),e&&D(h),e&&D(f),E&&E.d(),A&&A.d(),y=!1,v()}}}function Oi(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function ki(e){let t,n;return t=new e[9]({props:{disabled:!e[34].length,filled:!0,$$slots:{default:[Mi]},$$scope:{ctx:e}}}),t.$on("click",e[18](e[34])),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};16384&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Mi(e){let t;return{c(){t=M("Bestätigen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Pi(e){let t,n,r,i,o;return n=new qe({props:{size:"20"}}),{c(){t=O("th"),Ae(n.$$.fragment),U(t,"class","svelte-1m010ne")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[19](e[34])),i=!0)},p(t,n){e=t},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Bi(e){let t,n,r=e[40]+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-1m010ne")},m(e,r){R(e,t,r),N(t,n)},p:I,d(e){e&&D(t)}}}function Li(e){let t,n,r,i,o,s,a,l=e[0],c=Vi(e),d=e[35],u=[];for(let t=0;t<d.length;t+=1)u[t]=Ui(Ni(e,d,t));return{c(){t=O("tr"),c.c(),n=P();for(let e=0;e<u.length;e+=1)u[e].c();r=P(),U(t,"style",i=e[2]?"cursor: default;":"cursor: zoom-in;"),U(t,"title","übernimmt den Wert direkt"),U(t,"class","svelte-1m010ne"),j(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},m(i,l){R(i,t,l),c.m(t,null),N(t,n);for(let e=0;e<u.length;e+=1)u[e].m(t,null);N(t,r),o=!0,s||(a=L(t,"click",e[20](e[37])),s=!0)},p(s,a){if(e=s,1&a[0]&&$(l,l=e[0])?(pe(),ye(c,1,1,I),ge(),c=Vi(e),c.c(),we(c),c.m(t,n)):c.p(e,a),16400&a[0]){let n;for(d=e[35],n=0;n<d.length;n+=1){const i=Ni(e,d,n);u[n]?u[n].p(i,a):(u[n]=Ui(i),u[n].c(),u[n].m(t,r))}for(;n<u.length;n+=1)u[n].d(1);u.length=d.length}(!o||4&a[0]&&i!==(i=e[2]?"cursor: default;":"cursor: zoom-in;"))&&U(t,"style",i),16385&a[0]&&j(t,"active",e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]))},i(e){o||(we(c),o=!0)},o(e){ye(c),o=!1},d(e){e&&D(t),c.d(e),x(u,e),s=!1,a()}}}function Fi(e){let t,n,r;return n=new e[11]({props:{name:e[13],data:e[39],checked:e[0].includes(Array.isArray(e[37])?e[37][0]:e[37]),round:!0}}),{c(){t=O("td"),Ae(n.$$.fragment),U(t,"title","Wählt den Wert aus"),U(t,"class","svelte-1m010ne")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p(e,t){const r={};1&t[0]&&(r.checked=e[0].includes(Array.isArray(e[37])?e[37][0]:e[37])),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Vi(e){let t,n,r=!e[2]&&Fi(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){e[2]?r&&(pe(),ye(r,1,1,()=>{r=null}),ge()):r?(r.p(e,n),4&n[0]&&we(r,1)):(r=Fi(e),r.c(),we(r,1),r.m(t.parentNode,t))},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Ui(e){let t,n,r=(Array.isArray(e[37])?e[37][e[42]]:e[4][e[39]]?e[4][e[39]][e[42]]:e[37])+"";return{c(){t=O("td"),n=M(r),U(t,"class","svelte-1m010ne")},m(e,r){R(e,t,r),N(t,n)},p(e,t){16&t[0]&&r!==(r=(Array.isArray(e[37])?e[37][e[42]]:e[4][e[39]]?e[4][e[39]][e[42]]:e[37])+"")&&H(n,r)},d(e){e&&D(t)}}}function Hi(e){let t,n,r=e[16](e[37],e[3]),i=r&&Li(e);return{c(){i&&i.c(),t=B()},m(e,r){i&&i.m(e,r),R(e,t,r),n=!0},p(e,n){8&n[0]&&(r=e[16](e[37],e[3])),r?i?(i.p(e,n),8&n[0]&&we(i,1)):(i=Li(e),i.c(),we(i,1),i.m(t.parentNode,t)):i&&(pe(),ye(i,1,1,()=>{i=null}),ge())},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){i&&i.d(e),e&&D(t)}}}function Wi(e){let t,n;return t=new e[6]({}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p:I,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zi(e){let t,n,r,i;t=new e[10]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Wi,then:xi,catch:Di,value:36,blocks:[,,,]};return ve(e[14](),o),{c(){Ae(t.$$.fragment),n=P(),r=B(),o.block.c()},m(e,s){$e(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ie(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function ji(e){let t,n;return t=new e[8]({props:{title:e[1]||"Auswahl",class:"eList",$$slots:{default:[zi]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};2&n[0]&&(r.title=e[1]||"Auswahl"),29&n[0]|16384&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function qi(e,n,r){const i=K(),{Loading:o,TextField:s,Dialog:a,Button:l,Divider:d,Checkbox:u}=c;let{classId:h}=n,{id:f}=n,{designation:m}=n,{selection:p}=n,{refDoc:g}=n,{tableName:w}=n,{idName:y}=n,{target:v}=n,{view:I}=n,{unique:_}=n,{uniqueView:C}=n,{status:E}=n,{single:A}=n;p||=[];let $="",b=h+Math.floor(9e3*Math.random()+1e3).toString()+"search",S=[];const T=w+y+v+"checkbox",N=(e,t)=>e>t?1:t>e?-1:0;Y(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(b)?.focus()},200)});return e.$$set=e=>{"classId"in e&&r(22,h=e.classId),"id"in e&&r(23,f=e.id),"designation"in e&&r(1,m=e.designation),"selection"in e&&r(0,p=e.selection),"refDoc"in e&&r(24,g=e.refDoc),"tableName"in e&&r(25,w=e.tableName),"idName"in e&&r(26,y=e.idName),"target"in e&&r(21,v=e.target),"view"in e&&r(27,I=e.view),"unique"in e&&r(28,_=e.unique),"uniqueView"in e&&r(29,C=e.uniqueView),"status"in e&&r(30,E=e.status),"single"in e&&r(2,A=e.single)},[p,m,A,$,S,i,o,s,a,l,d,u,b,T,async()=>{let e=[],n=[],i={};if(r(4,S=[]),y)if(I){if(f){const n=h.split("-")[1].slice(0,-4),r="input."+h+"[name='_id']",o=document.querySelector(r).value;i={[y]:f},E&&(i.$or=[{status:!0},{[n]:o}]),e=await t.getSectionView(w,i),e=e.sort((e,t)=>{const r=e=>(e[n]||"z").toString()+e[v];return N(r(e),r(t))})}}else C?f&&(i={[y]:f,status:!0},Object.entries(C).map(([e,t])=>{t?.length&&(i[e]={$in:t}),n.push(e)}),e=await t.getSectionView(w,i),e=e.sort((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return N(n(e),n(t))}),r(4,S=e.map(e=>{const t=[e[v]];return n.map(n=>t.push(e[n])),t}))):_?(e=await t.getSection(w,y,f,_),e=e.sort((e,t)=>N(e,t))):(e=await t.getSection(w,y,f,!1,E),e=e.sort((e,t)=>{const n=e=>(p.includes(e[v])?"0-":"1-")+e[v];return N(n(e),n(t))}));else i={},f&&!Array.isArray(f)&&(i._id=f),e=await t.getSectionView(w,i);const o=await t.getSchemaByClass(w),s=[];if(g){const t=o.items[0].name,n=o.items[1].name,i=o.list[0].name,s=e.find(e=>e[t]===g);e=s?s[i]:[],r(21,v=n)}let a;return e.map(e=>{let t=e[v];if(t||w!==v||(r(21,v=o.items[0].name),t=e[v]),Array.isArray(t))for(const e of t){let t=e;"string"!=typeof e&&(t=Array.from(Object.values(e)).filter(e=>!!e&&24!==e?.length).join(", ")),s.push(t||[])}else g&&(t=o.list[0].item.map(t=>e[t.name]||"")),s.push(t||[])}),a=g?o.list[0].item.map(e=>e.designation):[o.items.find(e=>e.name===v)?.designation],n=n.map(e=>o.items.find(t=>t.name===e)?.designation),{list:g?s:s.flat(),items:[...a,...n]}},({detail:{value:e}})=>{r(3,$=e)},(e,t)=>{if(!t)return!0;return!!(Array.isArray(e)?e.join(" "):e).toLowerCase().includes(t.toLowerCase())},()=>{r(3,$="")},e=>()=>{const t=document.getElementsByName(T),n=[];t.forEach((t,r)=>{t.checked&&n.push(e[+t.attributes.data.value])}),i("choose",{list:n})},e=>()=>{document.getElementsByName(T).forEach((e,t)=>{e.checked=!e.checked})},e=>t=>{if("TD"===t.target?.nodeName){const t=Array.isArray(e)?e[0]:e;A?i("choose",{list:[].concat(t)}):(r(0,p=p.includes(t)?p.filter(e=>e!==t):p.concat(t)),i("choose",{list:p}))}},v,h,f,g,w,y,I,_,C,E,()=>i("back"),function(e){$=e,r(3,$)}]}class Gi extends Te{constructor(e){var t;super(),bi.getElementById("svelte-1m010ne-style")||((t=O("style")).id="svelte-1m010ne-style",t.textContent=".feather.svelte-1m010ne.svelte-1m010ne{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-1m010ne.svelte-1m010ne{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-1m010ne table.svelte-1m010ne{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-1m010ne table thead.svelte-1m010ne{position:sticky;top:0;background:#326173;color:white}.eList.svelte-1m010ne table tbody tr.svelte-1m010ne{height:2.3em}th.svelte-1m010ne.svelte-1m010ne,td.svelte-1m010ne.svelte-1m010ne{padding-left:0.4em;padding-right:0.4em}tr.active.svelte-1m010ne.svelte-1m010ne{color:#326173;background-color:#fcebd5}.dialog.eList{max-height:90vh}.checkbox.round > .selector{border-color:#326173 !important}.form--buttons.svelte-1m010ne.svelte-1m010ne{display:flex;gap:1em;padding:0.5em 0}",N(bi.head,t)),Se(this,e,qi,ji,$,{classId:22,id:23,designation:1,selection:0,refDoc:24,tableName:25,idName:26,target:21,view:27,unique:28,uniqueView:29,status:30,single:2},[-1,-1])}}const{document:Xi}=_e;function Yi(e){let t,n,r,i,o,s=e[7].length+"";return{c(){t=O("span"),n=M("("),r=M(s),i=M(")"),U(t,"class",o=S(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")},m(e,o){R(e,t,o),N(t,n),N(t,r),N(t,i)},p(e,n){128&n[0]&&s!==(s=e[7].length+"")&&H(r,s),2&n[0]&&o!==(o=S(e[1]?"showNumber disabled":"showNumber")+" svelte-1rbaejz")&&U(t,"class",o)},d(e){e&&D(t)}}}function Zi(e){let t;return{c(){t=O("div"),U(t,"class","load-more-options"),U(t,"slot","load-more-options-message")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Ki(e){let t,n,r,i;const o=[eo,Ji,Qi],s=[];function a(e,t){return!e[16].single&&e[7]?.length?0:e[17]?1:e[14]&&e[16].view&&e[16].maxItem?2:-1}return~(t=a(e))&&(n=s[t]=o[t](e)),{c(){n&&n.c(),r=B()},m(e,n){~t&&s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?~t&&s[t].p(e,i):(n&&(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge()),~t?(n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r)):n=null)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){~t&&s[t].d(e),e&&D(r)}}}function Qi(e){let t,n,r,i,o;return n=new Be({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[26]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ji(e){let t,n,r,i,o;return n=new Ye({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"title",e[17].title||"Generieren"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[25]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function eo(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"title","Löschen"),U(t,"class","feather pointer svelte-1rbaejz")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[27]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function to(e){let t,n,r;function i(t){e[37](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[no]},$$scope:{ctx:e}};return void 0!==e[10]&&(o.open=e[10]),t=new e[11]({props:o}),ee.push(()=>Ee(t,"open",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};53&r[0]|32768&r[1]&&(i.$$scope={dirty:r,ctx:e}),!n&&1024&r[0]&&(n=!0,i.open=e[10],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function no(e){let t,n;return t=new Gi({props:{classId:e[2],selection:e[0],refDoc:e[19],view:e[15],status:e[18],unique:e[16].unique&&e[4].name,uniqueView:e[16].view&&{[e[16].view]:e[5][e[16].view]},id:e[5][e[21]||e[20]],tableName:e[20],idName:e[21],designation:e[4].designation,target:e[4].name,single:e[16].single}}),t.$on("choose",e[24]),t.$on("back",e[23]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4&n[0]&&(r.classId=e[2]),1&n[0]&&(r.selection=e[0]),16&n[0]&&(r.unique=e[16].unique&&e[4].name),32&n[0]&&(r.uniqueView=e[16].view&&{[e[16].view]:e[5][e[16].view]}),32&n[0]&&(r.id=e[5][e[21]||e[20]]),16&n[0]&&(r.designation=e[4].designation),16&n[0]&&(r.target=e[4].name),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ro(e){let t,n,r,i,o,s,a,l,c,d=!e[16].single&&e[7]?.length&&Yi(e);function u(t){e[35](t)}function h(t){e[36](t)}let f={id:e[3],name:e[3],class:e[3],readonly:e[13],disabled:e[1],required:e[6],placeholder:e[8],getOptions:io,minSearchLength:"3",$$slots:{"load-more-options-message":[Zi]},$$scope:{ctx:e}};void 0!==e[7]&&(f.selection=e[7]),void 0!==e[9]&&(f.maxOptions=e[9]),r=new e[12]({props:f}),ee.push(()=>Ee(r,"selection",u)),ee.push(()=>Ee(r,"maxOptions",h)),r.$on("change",e[22]);let m=!e[1]&&Ki(e),p=e[10]&&to(e);return{c(){t=O("div"),d&&d.c(),n=P(),Ae(r.$$.fragment),s=P(),m&&m.c(),a=P(),p&&p.c(),l=B(),z(t,"position","relative")},m(e,i){R(e,t,i),d&&d.m(t,null),N(t,n),$e(r,t,null),N(t,s),m&&m.m(t,null),R(e,a,i),p&&p.m(e,i),R(e,l,i),c=!0},p(e,s){!e[16].single&&e[7]?.length?d?d.p(e,s):(d=Yi(e),d.c(),d.m(t,n)):d&&(d.d(1),d=null);const a={};8&s[0]&&(a.id=e[3]),8&s[0]&&(a.name=e[3]),8&s[0]&&(a.class=e[3]),2&s[0]&&(a.disabled=e[1]),64&s[0]&&(a.required=e[6]),256&s[0]&&(a.placeholder=e[8]),32768&s[1]&&(a.$$scope={dirty:s,ctx:e}),!i&&128&s[0]&&(i=!0,a.selection=e[7],le(()=>i=!1)),!o&&512&s[0]&&(o=!0,a.maxOptions=e[9],le(()=>o=!1)),r.$set(a),e[1]?m&&(pe(),ye(m,1,1,()=>{m=null}),ge()):m?(m.p(e,s),2&s[0]&&we(m,1)):(m=Ki(e),m.c(),we(m,1),m.m(t,null)),e[10]?p?(p.p(e,s),1024&s[0]&&we(p,1)):(p=to(e),p.c(),we(p,1),p.m(l.parentNode,l)):p&&(pe(),ye(p,1,1,()=>{p=null}),ge())},i(e){c||(we(r.$$.fragment,e),we(m),we(p),c=!0)},o(e){ye(r.$$.fragment,e),ye(m),ye(p),c=!1},d(e){e&&D(t),d&&d.d(),be(r),m&&m.d(),e&&D(a),p&&p.d(e),e&&D(l)}}}async function*io(e){yield[{name:e}]}function oo(e,n,r){const i=K(),{Modal:o,Autocomplete:s}=c;let{classId:a}=n,{id:l}=n,{item:d}=n,{record:u}=n,{value:h}=n,{noForm:f=!1}=n,{disabled:m}=n,{formnovalidate:p}=n,{numberInput:g}=n,{praefix:w}=n,{toDelete:y}=n,{reqQuantity:v}=n,{notifyList:I}=n;const{properties:_={}}=d;let{placeholder:C,hint:E,readonly:A,required:$=!1,lookup:b="",view:S=!1,multi:T,max:N=1e3,generate:R=!1,status:D=!0,refDoc:x}=_;const[O,k]=b.split(":");let M=!1,P=h.map&&h.map(e=>({name:e}))||[];m||=A,m&&(C="");const B=({detail:e})=>{let t=[];e.value.map(e=>{const n=e.name?.split(",");t=t.concat(n)}),r(7,P=t.map(e=>({name:e.trim()})));const n=P.map(e=>e.name);i("blur",{value:n}),i("multi",{view:T.view,lookup:b,name:d.name,value:n})};Y(async()=>{i("multi",{view:T.view,lookup:b,name:d.name,value:h});const e=document.getElementById(l);e.classList.add(a),!A&&b&&e.addEventListener("focus",L)});const L=()=>{if(b){document.getElementById(l).blur();const e=v||N;(T.unique||P.length<e)&&r(10,M=!0)}},F=()=>{r(10,M&&=!1)},V=({detail:e})=>{const t=e.list.map(e=>Array.isArray(e)?e[0]:e);r(7,P=t.map(e=>({name:e}))),i("blur",{value:t}),i("multi",{view:T.view,lookup:b,name:d.name,value:t}),F()},U=async()=>{const e={[k]:u[k]},n=await t.getSectionView(O,e),r=Array.from({length:n.length},(e,t)=>n[t][d.name]);V({detail:{name:d.name,list:r}})},H=(e=!1)=>{if(m||!T.required)return;const t=T.maxItem;if(!t||T.unique)return;r(9,N=!1!==e?e:v||u[t]||0);const n=P?.length!=N,o=document.getElementById(l);o?.classList?.toggle("invalid",n),i("invalid",{idx:w,value:n})};return e.$$set=e=>{"classId"in e&&r(2,a=e.classId),"id"in e&&r(3,l=e.id),"item"in e&&r(4,d=e.item),"record"in e&&r(5,u=e.record),"value"in e&&r(0,h=e.value),"noForm"in e&&r(28,f=e.noForm),"disabled"in e&&r(1,m=e.disabled),"formnovalidate"in e&&r(29,p=e.formnovalidate),"numberInput"in e&&r(30,g=e.numberInput),"praefix"in e&&r(31,w=e.praefix),"toDelete"in e&&r(32,y=e.toDelete),"reqQuantity"in e&&r(33,v=e.reqQuantity),"notifyList"in e&&r(34,I=e.notifyList)},e.$$.update=()=>{48&e.$$.dirty[0]&&u&&""===u[d.name]&&r(7,P=[]),48&e.$$.dirty[0]&&u&&Array.isArray(u[d.name])&&r(7,P=u[d.name].map(e=>({name:e}))),16&e.$$.dirty[0]|2&e.$$.dirty[1]&&y&&y===d.name&&r(7,P=[]),128&e.$$.dirty[0]&&P&&(r(0,h=P.map&&P.map(e=>e.name)||[]),H()),1073741824&e.$$.dirty[0]&&((e={})=>{const{item:t,value:n,idx:r}=e;void 0!==w&&w!==r||t&&t.name===T.maxItem&&H(n)})(g),536870976&e.$$.dirty[0]&&r(6,$=$&&!p),8&e.$$.dirty[1]&&(async e=>{if(void 0===w)return;const{itemName:n,value:o}=e||{};if(o){if(d.refItem&&d.refItem?.split(".")[0]===n){let[e,n]=d.refItem.split(".");if(Array.isArray(o)){if(e=e.slice(0,-1),!o.length)return i("record",{itemName:"quantity",value:0}),void r(7,P=[]);const s={_id:{$in:o}},a=await t.getSectionView(e,s);let l=[];for(const e of a)e[n]&&(l=l.concat(e[n][0][d.name]));if(!l.length)return;i("record",{itemName:"quantity",value:l.length}),r(7,P=l.map(e=>({name:e}))),B({detail:{value:P}})}else{const s=await t.getTask(e,o);if(!s||!s[n])return;const a=s[n];if(!Array.isArray(a)&&!a.length)return;const l=a[w][d.name];i("record",{itemName:"quantity",value:l?.length||0}),r(7,P=l&&l.map(e=>({name:e})))}}if(d.refItem2&&d.refItem2?.split(".")[0]===n){let[e,n]=d.refItem2.split(".");if(Array.isArray(o))if(Array.isArray(o)){if(e=e.slice(0,-1),!o.length)return i("record",{itemName:"quantity",value:0}),void r(7,P=[]);const s={_id:{$in:o}},a=await t.getSectionView(e,s);let l=[];for(const e of a)e[n]&&(l=l.concat(e[n][0][d.name]));if(!l.length)return;i("record",{itemName:"quantity",value:l.length}),r(7,P=l.map(e=>({name:e}))),B({detail:{value:P}})}else{const s=await t.getTask(e,o);if(!s||!s[n])return;const a=s[n];if(!Array.isArray(a)&&!a.length)return;const l=a[w][d.name];i("record",{itemName:"quantity",value:l?.length||0}),r(7,P=l&&l.map(e=>({name:e})))}}setTimeout(H,250)}})(I)},[h,m,a,l,d,u,$,P,C,N,M,o,s,A,b,S,T,R,D,x,O,k,B,F,V,()=>{const e=u[R.itemQuantity]||v;if(!e)return;const t=R.prefix||"",n=u[R.variable]||"",r=R.len||5,i=Array.from({length:e},(e,i)=>t+n+"-"+i.toString().padStart(r,"0"));V({detail:{name:d.name,list:i}})},async()=>{if(!0===S)return U();const e=v||u[T.maxItem];if(!e)return;let n={};k&&(n={[k]:u[k]}),D&&(n.status=!0);const r=[].concat(u[T.view]||[]);r.length&&(n[T.view]={$in:r});const i=await t.getSectionView(O,n),o=Array.from({length:e<i.length?e:i.length},(e,t)=>i[t][d.name]);V({detail:{name:d.name,list:o}})},()=>{V({detail:{name:d.name,list:[]}})},f,p,g,w,y,v,I,function(e){P=e,r(7,P),r(5,u),r(4,d),r(32,y)},function(e){N=e,r(9,N)},function(e){M=e,r(10,M)}]}class so extends Te{constructor(e){var t;super(),Xi.getElementById("svelte-1rbaejz-style")||((t=O("style")).id="svelte-1rbaejz-style",t.textContent=".feather.svelte-1rbaejz{position:absolute;top:1em;right:0.5em;color:#4300b0}.showNumber.svelte-1rbaejz{position:absolute;display:inline-block;width:3.5em;text-align:right;top:1em;left:-4em;color:#4300b0}.showNumber.disabled.svelte-1rbaejz{color:#888 !important}.autocomplete .notice,.autocomplete .load-more-options,.autocomplete .show-on-focus,.autocomplete.disabled .chip button.btn,.autocomplete.disabled .chip+.autocomplete-field input{display:none}.autocomplete-field input.invalid{border:1px red solid !important}.autocomplete.disabled .chip{height:2.25em !important;padding-right:0.75em !important}",N(Xi.head,t)),Se(this,e,oo,ro,$,{classId:2,id:3,item:4,record:5,value:0,noForm:28,disabled:1,formnovalidate:29,numberInput:30,praefix:31,toDelete:32,reqQuantity:33,notifyList:34},[-1,-1])}}function ao(e){let t,n,r;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function lo(e){let t,n,r,i,o;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function co(e){let t,n,r,i,o,s;n=new e[8]({props:{inputClass:e[0],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],value:e[7]}}),n.$on("change",e[12]);const a=[lo,ao],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),$e(n,t,null),N(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(pe(),ye(l[d],1,1,()=>{l[d]=null}),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}const uo=e("getMapLink",async e=>{const{street:n,houseNo:r,postcode:i,location:o,country:s}=e,a=[n&&r?n+" "+r:n,i&&o?i+" "+o:i||o||"",s&&(await t.getTask("country",s)).designation].filter(e=>!!e).join(", ");return"https://bing.com/maps/default.aspx?where1="+encodeURIComponent(a)});function ho(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:h}=t,{record:f}=t,{item:m}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,h=e.value),"record"in e&&n(10,f=e.record),"item"in e&&n(11,m=e.item)},[i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;const e=u.includes(".")?f[u.split(".")[0]]:f,t=await uo(e);window.open(t,"_blank")},f,m,function(t){Q(e,t)}]}class fo extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",N(document.head,t)),Se(this,e,ho,co,$,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,record:10,item:11})}}const{document:mo}=_e;function po(e){let t;return{c(){t=O("div"),U(t,"class","load-more-options"),U(t,"slot","load-more-options-message")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function go(e){let t,n,r;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 svelte-wpjws5")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function wo(e){let t,n,r,i,o;return n=new vt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-wpjws5")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[8]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function yo(e){let t,n,r,i,o,s,a;function l(t){e[17](t)}function c(t){e[18](t)}function d(t){e[19](t)}let u={id:e[1],name:e[1],class:e[1],minSearchLength:"1",maxOptions:"1",getOptions:e[7],$$slots:{"load-more-options-message":[po]},$$scope:{ctx:e}};void 0!==e[0]&&(u.value=e[0]),void 0!==e[2]&&(u.selection=e[2]),void 0!==e[3]&&(u.searchQuery=e[3]),n=new e[4]({props:u}),ee.push(()=>Ee(n,"value",l)),ee.push(()=>Ee(n,"selection",c)),ee.push(()=>Ee(n,"searchQuery",d)),n.$on("change",e[6]);let h=e[5]&&function(e){let t,n,r,i;const o=[wo,go],s=[];function a(e,t){return e[0]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}(e);return{c(){t=O("div"),Ae(n.$$.fragment),s=P(),h&&h.c(),z(t,"position","relative"),U(t,"class","inputAutoComplete")},m(e,r){R(e,t,r),$e(n,t,null),N(t,s),h&&h.m(t,null),a=!0},p(e,t){const s={};2&t[0]&&(s.id=e[1]),2&t[0]&&(s.name=e[1]),2&t[0]&&(s.class=e[1]),16&t[1]&&(s.$$scope={dirty:t,ctx:e}),!r&&1&t[0]&&(r=!0,s.value=e[0],le(()=>r=!1)),!i&&4&t[0]&&(i=!0,s.selection=e[2],le(()=>i=!1)),!o&&8&t[0]&&(o=!0,s.searchQuery=e[3],le(()=>o=!1)),n.$set(s),e[5]&&h.p(e,t)},i(e){a||(we(n.$$.fragment,e),we(h),a=!0)},o(e){ye(n.$$.fragment,e),ye(h),a=!1},d(e){e&&D(t),be(n),h&&h.d()}}}function vo(e,t,n){const{Autocomplete:r}=c,i=K();let{classId:o}=t,{id:s}=t,{item:a}=t,{name:l}=t,{listName:d}=t,{record:u}=t,{value:h}=t,{noForm:f=!1}=t,{disabled:m}=t,{formnovalidate:p}=t;const{autocomplete:{input:g,min:w,url:y,output:v},format:I}=a.properties,_=[].concat(g),{name:C}=v,E="map"===I;let A,$=h,b=!1;Y(()=>{const e=document.querySelector("."+a.name+" .autocomplete input");e&&(e.addEventListener("focus",N),e.addEventListener("keyup",T),e.addEventListener("keydown",S));const t=document.getElementById(s);t&&t.classList.add(o)});const S=e=>{b=8===e.keyCode||32===e.keyCode},T=e=>{8===e.keyCode&&""===$&&n(0,h="")},N=async()=>{if(w){const e=_[0].name;if((d?u[d][e]:u[e]).length!==w)return}const e=await R();if(e?.length)if(1===e.length){if(h.startsWith(e[0].name))return;n(3,$=n(0,h=e[0].name)),x(h)}else e.find(e=>($||"").startsWith(e.name))||h||n(3,$=" ");else h||n(3,$="")},R=async(e="")=>{const t=await fetch(y+"?"+D()+"&name=%5E"+e.trim());if(!t.ok)return;const n=t.headers.get("Content-Type").split(";")[0];let r=[];try{if("text/json"===n){const e=await t.text();r=JSON.parse(e||[])}else"application/json"===n&&(r=await t.json())}catch{}return r.map(e=>({name:e[C]}))},D=()=>_.map(({name:e,refItem:t})=>`${t}=${(d?u[d][e]:u[e]).split(" ")[0]}`).join("&"),x=e=>{i("blur",{value:e})};return e.$$set=e=>{"classId"in e&&n(9,o=e.classId),"id"in e&&n(1,s=e.id),"item"in e&&n(10,a=e.item),"name"in e&&n(11,l=e.name),"listName"in e&&n(12,d=e.listName),"record"in e&&n(13,u=e.record),"value"in e&&n(0,h=e.value),"noForm"in e&&n(14,f=e.noForm),"disabled"in e&&n(15,m=e.disabled),"formnovalidate"in e&&n(16,p=e.formnovalidate)},[h,s,A,$,r,E,({detail:{value:e}})=>{e.length&&n(3,$=n(0,h=e[0].name)),n(2,A=[]),x(h)},async function*(e){if(b||h&&e.startsWith(h))return n(0,h=e),void x(h);const t=await R(e);if(!t?.length)return n(0,h=e),void x(h);1===t.length?(n(3,$=n(0,h=t[0].name)),n(2,A=[]),x(h)):yield t},async()=>{if(!h)return;const e=l.includes(".")?u[l.split(".")[0]]:u,t=await uo(e);window.open(t,"_blank")},o,a,l,d,u,f,m,p,function(e){h=e,n(0,h)},function(e){A=e,n(2,A)},function(e){$=e,n(3,$)}]}class Io extends Te{constructor(e){var t;super(),mo.getElementById("svelte-wpjws5-style")||((t=O("style")).id="svelte-wpjws5-style",t.textContent=".feather.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-wpjws5{position:absolute;top:1em;left:0.5em;color:light-gray;margin-left:-2em}.inputAutoComplete .autocomplete .chip,.inputAutoComplete .autocomplete .shown-on-focus{display:none !important}",N(mo.head,t)),Se(this,e,vo,yo,$,{classId:9,id:1,item:10,name:11,listName:12,record:13,value:0,noForm:14,disabled:15,formnovalidate:16},[-1,-1])}}const{document:_o}=_e;function Co(e){e[26]=e[28].list,e[27]=e[28].items}function Eo(e,t,n){const r=e.slice();return r[29]=t[n],r}function Ao(e,t,n){const r=e.slice();return r[32]=t[n],r}function $o(e,t,n){const r=e.slice();return r[32]=t[n],r}function bo(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function So(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y;function v(t){e[23](t)}Co(e),n=new e[7]({props:{outline:!0,$$slots:{default:[To]},$$scope:{ctx:e}}}),n.$on("click",e[22]);let I={id:e[8]};void 0!==e[1]&&(I.value=e[1]),s=new e[6]({props:I}),ee.push(()=>Ee(s,"value",v)),s.$on("input",e[12]),d=new tt({props:{size:"18"}});let _=e[27]?.length&&function(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=No($o(e,r,t));return{c(){t=O("thead"),n=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();U(n,"class","svelte-14hcfjl"),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n);for(let e=0;e<i.length;e+=1)i[e].m(n,null)},p(e,t){if(2048&t[0]){let o;for(r=e[27],o=0;o<r.length;o+=1){const s=$o(e,r,o);i[o]?i[o].p(s,t):(i[o]=No(s),i[o].c(),i[o].m(n,null))}for(;o<i.length;o+=1)i[o].d(1);i.length=r.length}},d(e){e&&D(t),x(i,e)}}}(e),C=e[26]?.length&&function(e){let t,n=e[26],r=[];for(let t=0;t<n.length;t+=1)r[t]=xo(Eo(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=B()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(e,t,n)},p(e,i){if(11779&i[0]){let o;for(n=e[26],o=0;o<n.length;o+=1){const s=Eo(e,n,o);r[o]?r[o].p(s,i):(r[o]=xo(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){x(r,e),e&&D(t)}}}(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),i=O("div"),o=M("Suchen: "),Ae(s.$$.fragment),l=P(),c=O("span"),Ae(d.$$.fragment),u=P(),h=O("div"),f=O("table"),_&&_.c(),m=P(),p=O("tbody"),C&&C.c(),U(t,"class","form--buttons svelte-14hcfjl"),U(c,"class","feather pointer svelte-14hcfjl"),z(i,"margin-bottom","1em"),z(i,"position","relative"),U(f,"striped",""),U(f,"class","svelte-14hcfjl"),U(h,"class","eList svelte-14hcfjl")},m(a,v){R(a,t,v),$e(n,t,null),R(a,r,v),R(a,i,v),N(i,o),$e(s,i,null),N(i,l),N(i,c),$e(d,c,null),R(a,u,v),R(a,h,v),N(h,f),_&&_.m(f,null),N(f,m),N(f,p),C&&C.m(p,null),g=!0,w||(y=L(c,"click",e[14]),w=!0)},p(e,t){Co(e);const r={};64&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r);const i={};!a&&2&t[0]&&(a=!0,i.value=e[1],le(()=>a=!1)),s.$set(i),e[27]?.length&&_.p(e,t),e[26]?.length&&C.p(e,t)},i(e){g||(we(n.$$.fragment,e),we(s.$$.fragment,e),we(d.$$.fragment,e),g=!0)},o(e){ye(n.$$.fragment,e),ye(s.$$.fragment,e),ye(d.$$.fragment,e),g=!1},d(e){e&&D(t),be(n),e&&D(r),e&&D(i),be(s),be(d),e&&D(u),e&&D(h),_&&_.d(),C&&C.d(),w=!1,y()}}}function To(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function No(e){let t,n,r=e[32]?.designation+"";return{c(){t=O("th"),n=M(r),U(t,"class","svelte-14hcfjl")},m(e,r){R(e,t,r),N(t,n)},p:I,d(e){e&&D(t)}}}function Ro(e){let t,n,r=e[27],i=[];for(let t=0;t<r.length;t+=1)i[t]=Do(Ao(e,r,t));return{c(){t=O("tr");for(let e=0;e<i.length;e+=1)i[e].c();n=P(),U(t,"class","pointer svelte-14hcfjl"),j(t,"active",e[29]._id===e[0])},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);N(t,n)},p(e,o){if(3584&o[0]){let s;for(r=e[27],s=0;s<r.length;s+=1){const a=Ao(e,r,s);i[s]?i[s].p(a,o):(i[s]=Do(a),i[s].c(),i[s].m(t,n))}for(;s<i.length;s+=1)i[s].d(1);i.length=r.length}2049&o[0]&&j(t,"active",e[29]._id===e[0])},d(e){e&&D(t),x(i,e)}}}function Do(e){let t,n,r,i,o=e[9](e[29],e[32])+"";return{c(){t=O("td"),n=M(o),U(t,"class","svelte-14hcfjl")},m(o,s){R(o,t,s),N(t,n),r||(i=L(t,"click",V(e[10](e[29]))),r=!0)},p(t,n){e=t},d(e){e&&D(t),r=!1,i()}}}function xo(e){let t,n=e[13](e[29],e[27],e[1]),r=n&&Ro(e);return{c(){r&&r.c(),t=B()},m(e,n){r&&r.m(e,n),R(e,t,n)},p(e,i){2&i[0]&&(n=e[13](e[29],e[27],e[1])),n?r?r.p(e,i):(r=Ro(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t)}}}function Oo(e){let t,n;return t=new e[5]({}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p:I,i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ko(e){let t,n,r,i;t=new e[4]({});let o={ctx:e,current:null,token:null,hasCatch:!1,pending:Oo,then:So,catch:bo,value:28,blocks:[,,,]};return ve(e[11](),o),{c(){Ae(t.$$.fragment),n=P(),r=B(),o.block.c()},m(e,s){$e(t,e,s),R(e,n,s),R(e,r,s),o.block.m(e,o.anchor=s),o.mount=()=>r.parentNode,o.anchor=r,i=!0},p(t,n){Ie(o,e=t,n)},i(e){i||(we(t.$$.fragment,e),we(o.block),i=!0)},o(e){ye(t.$$.fragment,e);for(let e=0;e<3;e+=1){ye(o.blocks[e])}i=!1},d(e){be(t,e),e&&D(n),e&&D(r),o.block.d(e),o.token=null,o=null}}}function Mo(e){let t,n;return t=new e[3]({props:{title:"Auswahl",class:"eList",$$slots:{default:[ko]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};3&n[0]|64&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Po(e,n,i){const o=K(),{Dialog:s,Divider:a,Loading:l,TextField:d,Button:u}=c;let{item:h}=n,{className:f}=n,{classId:p}=n,{rowId:w}=n,{viewName:y}=n,{viewValue:v}=n,{recordId:I}=n,{filter:_}=n,C="",E=p+Math.floor(9e3*Math.random()+1e3).toString()+"search";const A=(e,t)=>{if(!t)return;const n=e[t.name];return"boolean"==typeof n?g(n):m(e[`_${t.name}`]||e[t.name]||"")},$=t.getSchemaByClass(f);Y(()=>{window.setTimeout(()=>{const e=document.querySelector("tr.active");e?e.scrollIntoView({block:"end",behavior:"smooth"}):document.getElementById(E)?.focus()},200)}),r.subscribe(async e=>{if(!e)return;const t=await $;e.eventId===t.id&&vm(t.class,e.eventId)});return e.$$set=e=>{"item"in e&&i(15,h=e.item),"className"in e&&i(16,f=e.className),"classId"in e&&i(17,p=e.classId),"rowId"in e&&i(0,w=e.rowId),"viewName"in e&&i(18,y=e.viewName),"viewValue"in e&&i(19,v=e.viewValue),"recordId"in e&&i(20,I=e.recordId),"filter"in e&&i(21,_=e.filter)},[w,C,o,s,a,l,d,u,E,A,e=>()=>o("choose",{row:e}),async()=>{const e=await $,n="."+p+"#"+y;document.querySelector(n);let r={[y]:v},i=[];r[y]&&(i=await t.getSectionView(e.class,r,!0)),_&&(i=i.filter(e=>e._id!=_));const o=e.display;return{list:i,items:await Xt(o,e,i)}},({detail:{value:e}})=>{i(1,C=e)},(e,t,n)=>{if(!n)return!0;for(const r of t)if(A(e,r)?.toLowerCase()?.includes(n.toLowerCase()))return!0;return!1},()=>{i(1,C="")},h,f,p,y,v,I,_,()=>o("back"),function(e){C=e,i(1,C)}]}class Bo extends Te{constructor(e){var t;super(),_o.getElementById("svelte-14hcfjl-style")||((t=O("style")).id="svelte-14hcfjl-style",t.textContent=".feather.svelte-14hcfjl.svelte-14hcfjl{position:absolute;top:2em;right:0.5em;color:#326173}.eList.svelte-14hcfjl.svelte-14hcfjl{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-14hcfjl table.svelte-14hcfjl{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-14hcfjl table thead.svelte-14hcfjl{position:sticky;top:0;background:#326173;color:white}.eList.svelte-14hcfjl table tbody tr.svelte-14hcfjl{height:2.3em}th.svelte-14hcfjl.svelte-14hcfjl,td.svelte-14hcfjl.svelte-14hcfjl{padding-left:0.4em;padding-right:0.4em}tr.pointer.svelte-14hcfjl.svelte-14hcfjl:hover{background-color:#DAE1E5}tr.active.svelte-14hcfjl.svelte-14hcfjl{color:#326173;background-color:#fcebd5}.form--buttons.svelte-14hcfjl.svelte-14hcfjl{display:flex;gap:1em;padding:0.5em 0}",N(_o.head,t)),Se(this,e,Po,Mo,$,{item:15,className:16,classId:17,rowId:0,viewName:18,viewValue:19,recordId:20,filter:21},[-1,-1])}}function Lo(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Fo(e){let t,n,r,i,o;function s(t){e[21](t)}let a={id:e[2],name:e[3].name,inputClass:e[5]||e[1],disabled:e[6],formnovalidate:e[7],readonly:e[13],pattern:e[12],required:e[14],style:"padding-left:2em;"};void 0!==e[0]&&(a.value=e[0]),n=new e[10]({props:a}),ee.push(()=>Ee(n,"value",s));let l=!e[6]&&Vo(e);return{c(){t=O("div"),Ae(n.$$.fragment),i=P(),l&&l.c(),z(t,"position","relative")},m(e,r){R(e,t,r),$e(n,t,null),N(t,i),l&&l.m(t,null),o=!0},p(e,i){const o={};4&i&&(o.id=e[2]),8&i&&(o.name=e[3].name),34&i&&(o.inputClass=e[5]||e[1]),64&i&&(o.disabled=e[6]),128&i&&(o.formnovalidate=e[7]),!r&&1&i&&(r=!0,o.value=e[0],le(()=>r=!1)),n.$set(o),e[6]?l&&(pe(),ye(l,1,1,()=>{l=null}),ge()):l?(l.p(e,i),64&i&&we(l,1)):(l=Vo(e),l.c(),we(l,1),l.m(t,null))},i(e){o||(we(n.$$.fragment,e),we(l),o=!0)},o(e){ye(n.$$.fragment,e),ye(l),o=!1},d(e){e&&D(t),be(n),l&&l.d()}}}function Vo(e){let t,n,r,i,o;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-wbrqzu")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[17]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Uo(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Ho(e){let t,n,r;function i(t){e[22](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[Wo]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[11]({props:o}),ee.push(()=>Ee(t,"open",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};268435994&r&&(i.$$scope={dirty:r,ctx:e}),!n&&256&r&&(n=!0,i.open=e[8],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Wo(e){let t,n;return t=new Bo({props:{item:e[3],className:e[3].refClass,classId:e[1],rowId:"",recordId:e[4]._id,viewName:e[15].selection,viewValue:e[9],filter:e[4]._id}}),t.$on("choose",e[18]),t.$on("back",e[19]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};8&n&&(r.item=e[3]),8&n&&(r.className=e[3].refClass),2&n&&(r.classId=e[1]),16&n&&(r.recordId=e[4]._id),512&n&&(r.viewValue=e[9]),16&n&&(r.filter=e[4]._id),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function zo(e){let t,n,r,i={ctx:e,current:null,token:null,hasCatch:!1,pending:Uo,then:Fo,catch:Lo,value:27,blocks:[,,,]};ve(e[16](),i);let o=e[8]&&Ho(e);return{c(){i.block.c(),t=P(),o&&o.c(),n=B()},m(e,s){i.block.m(e,i.anchor=s),i.mount=()=>t.parentNode,i.anchor=t,R(e,t,s),o&&o.m(e,s),R(e,n,s),r=!0},p(t,[r]){Ie(i,e=t,r),e[8]?o?(o.p(e,r),256&r&&we(o,1)):(o=Ho(e),o.c(),we(o,1),o.m(n.parentNode,n)):o&&(pe(),ye(o,1,1,()=>{o=null}),ge())},i(e){r||(we(i.block),we(o),r=!0)},o(e){for(let e=0;e<3;e+=1){ye(i.blocks[e])}ye(o),r=!1},d(e){i.block.d(e),i.token=null,i=null,e&&D(t),o&&o.d(e),e&&D(n)}}}function jo(e,t,n){const{TextField:r,Modal:i}=c;let{classId:o}=t,{id:s}=t,{item:a}=t,{record:l}=t,{value:d}=t,{noForm:u=!1}=t,{disabled:h}=t,{formnovalidate:f}=t,{praefix:m}=t;const{properties:p={}}=a;let g,{pattern:w,placeholder:y,readonly:v,required:I=!1,view:_}=p,C=!1;const E=()=>{n(8,C=!1)};return e.$$set=e=>{"classId"in e&&n(1,o=e.classId),"id"in e&&n(2,s=e.id),"item"in e&&n(3,a=e.item),"record"in e&&n(4,l=e.record),"value"in e&&n(0,d=e.value),"noForm"in e&&n(5,u=e.noForm),"disabled"in e&&n(6,h=e.disabled),"formnovalidate"in e&&n(7,f=e.formnovalidate),"praefix"in e&&n(20,m=e.praefix)},[d,o,s,a,l,u,h,f,C,g,r,i,w,v,I,_,async()=>(n(9,g=l[_.selection]),!0),()=>{n(8,C=!0)},({detail:e})=>{n(0,d=e.row[_.value?_.value:"_id"]),E()},E,m,function(e){d=e,n(0,d)},function(e){C=e,n(8,C)}]}class qo extends Te{constructor(e){var t;super(),document.getElementById("svelte-wbrqzu-style")||((t=O("style")).id="svelte-wbrqzu-style",t.textContent=".feather.svelte-wbrqzu{position:absolute;top:0.75em;left:0.5em;color:#4300b0}",N(document.head,t)),Se(this,e,jo,zo,$,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7,praefix:20})}}function Go(e,t,n){const r=e.slice();return r[12]=t[n][0],r[13]=t[n][1],r}function Xo(e){let t;return{c(){t=O("option"),t.textContent="- ",t.selected=!0,t.__value="",t.value=t.__value},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Yo(e){let t;return{c(){t=O("option"),t.textContent="-- Bitte wählen -- ",t.disabled=!0,t.selected=!0,t.__value="",t.value=t.__value},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Zo(e){let t,n,r,i,o=e[12]+"";return{c(){t=O("option"),n=M(o),t.__value=r=e[13],t.value=t.__value,t.selected=i=e[0]==e[13]},m(e,r){R(e,t,r),N(t,n)},p(e,s){64&s&&o!==(o=e[12]+"")&&H(n,o),64&s&&r!==(r=e[13])&&(t.__value=r,t.value=t.__value),65&s&&i!==(i=e[0]==e[13])&&(t.selected=i)},d(e){e&&D(t)}}}function Ko(e){let t,n,r,i,o,s=!e[7]&&function(e){let t;function n(e,t){return e[5]&&!0!==e[8]?Yo:Xo}let r=n(e),i=r(e);return{c(){i.c(),t=B()},m(e,n){i.m(e,n),R(e,t,n)},p(e,o){r!==(r=n(e))&&(i.d(1),i=r(e),i&&(i.c(),i.m(t.parentNode,t)))},d(e){i.d(e),e&&D(t)}}}(e),a=e[6],l=[];for(let t=0;t<a.length;t+=1)l[t]=Zo(Go(e,a,t));return{c(){t=O("select"),s&&s.c(),n=B();for(let e=0;e<l.length;e+=1)l[e].c();U(t,"class",r=S(e[3]||e[4])+" svelte-5xpzvo"),U(t,"id",e[2]),U(t,"name",e[2]),t.disabled=e[1],t.required=e[5]},m(r,a){R(r,t,a),s&&s.m(t,null),N(t,n);for(let e=0;e<l.length;e+=1)l[e].m(t,null);i||(o=L(t,"change",e[9]),i=!0)},p(e,[n]){if(e[7]||s.p(e,n),65&n){let r;for(a=e[6],r=0;r<a.length;r+=1){const i=Go(e,a,r);l[r]?l[r].p(i,n):(l[r]=Zo(i),l[r].c(),l[r].m(t,null))}for(;r<l.length;r+=1)l[r].d(1);l.length=a.length}24&n&&r!==(r=S(e[3]||e[4])+" svelte-5xpzvo")&&U(t,"class",r),4&n&&U(t,"id",e[2]),4&n&&U(t,"name",e[2]),2&n&&(t.disabled=e[1]),32&n&&(t.required=e[5])},i:I,o:I,d(e){e&&D(t),s&&s.d(),x(l,e),i=!1,o()}}}function Qo(e,t,n){const r=K();let{id:i}=t,{item:o}=t,{value:s}=t,{noForm:a=!1}=t,{classId:l}=t,{disabled:c}=t,{required:d}=t,{enum:u,regulation:h,readonly:f}=o.properties;u&&(u=u.map(e=>[e,e])),"businessMonth"===h&&(s||=1,u=[["Januar",1],["Februar",2],["März",3],["April",4],["Mai",5],["Juni",6],["Juli",7],["August",8],["September",9],["Oktober",10],["November",11],["Dezember",12]]),"financialAccounting"===h&&(s||=2024,u=[["2024/2025",2024]]),"valueAddedTax"===h&&(s||=0,u=[["0% Steuerbefreit",0],["8.1% Normalsatz",.081],["2.6% Reduzierter Satz",.026],["3.8% Beherbergung",.038]]),c||=!!f,c||(c=void 0);return e.$$set=e=>{"id"in e&&n(2,i=e.id),"item"in e&&n(10,o=e.item),"value"in e&&n(0,s=e.value),"noForm"in e&&n(3,a=e.noForm),"classId"in e&&n(4,l=e.classId),"disabled"in e&&n(1,c=e.disabled),"required"in e&&n(5,d=e.required)},[s,c,i,a,l,d,u,h,f,e=>r("blur",{value:e.srcElement.value}),o]}class Jo extends Te{constructor(e){var t;super(),document.getElementById("svelte-5xpzvo-style")||((t=O("style")).id="svelte-5xpzvo-style",t.textContent="select.svelte-5xpzvo{padding:0 0.625em 0.0625em;box-sizing:border-box;width:100%;border:0 solid rgba(0, 0, 0, 0.42);border-bottom-width:0px;border-bottom-width:0.0625em;border-top-left-radius:0.375em;border-top-right-radius:0.375em;background-color:#f5f5f5;outline:none;font-size:1rem;font-weight:300;height:2.8em}select.svelte-5xpzvo:focus{border:none;border-bottom:2px solid #4300b0}",N(document.head,t)),Se(this,e,Qo,Ko,$,{id:2,item:10,value:0,noForm:3,classId:4,disabled:1,required:5})}}function es(e){let t,n,r,i,o,s,a,l,c;i=new e[8]({props:{id:"dp-"+e[1]+(e[2]?"-"+e[2]:""),value:e[0],readonly:e[5],required:e[7],disabled:e[6],noCalendar:e[9],closeOnSelection:!0}}),i.$on("change",e[11]);let d=e[10]&&function(e){let t,n,r,i,o;return n=new Be({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"title","Übernehmen"),U(t,"class","pointer feather")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[12]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}(e);return{c(){t=O("input"),r=P(),Ae(i.$$.fragment),o=P(),d&&d.c(),s=B(),U(t,"type","string"),U(t,"class",n=e[3]||e[4]),U(t,"id",e[1]),U(t,"name",e[1]),t.hidden=!0},m(n,u){R(n,t,u),W(t,e[0]),R(n,r,u),$e(i,n,u),R(n,o,u),d&&d.m(n,u),R(n,s,u),a=!0,l||(c=L(t,"input",e[18]),l=!0)},p(e,[r]){(!a||24&r&&n!==(n=e[3]||e[4]))&&U(t,"class",n),(!a||2&r)&&U(t,"id",e[1]),(!a||2&r)&&U(t,"name",e[1]),1&r&&W(t,e[0]);const o={};6&r&&(o.id="dp-"+e[1]+(e[2]?"-"+e[2]:"")),1&r&&(o.value=e[0]),32&r&&(o.readonly=e[5]),128&r&&(o.required=e[7]),64&r&&(o.disabled=e[6]),i.$set(o),e[10]&&d.p(e,r)},i(e){a||(we(i.$$.fragment,e),we(d),a=!0)},o(e){ye(i.$$.fragment,e),ye(d),a=!1},d(e){e&&D(t),e&&D(r),be(i,e),e&&D(o),d&&d.d(e),e&&D(s),l=!1,c()}}}let ts=new Map;function ns(e,n,r){const i=K(),{DatePicker:o}=c;let{value:s}=n,{id:a}=n,{item:l}=n,{record:d}=n,{praefix:u}=n,{noForm:h=!1}=n,{classId:f}=n,{eventId:m}=n,{readonly:p}=n,{disabled:g}=n,{required:w}=n,{notifyList:y}=n,{dateInput:v}=n;s||(s=void 0);let I=null;const _=(void 0===u?"":u.toString())+"-"+m+"-"+l.name,C=l.properties?.noCalendar||!1,E=l.properties?.transfer,A=({detail:e})=>{try{r(0,s=hr(e.value,s)),void 0!==u&&ts.set(_,new Date(s.valueOf())),$(s)}catch{r(0,s=void 0)}},$=e=>{i("change",{value:new Date(e.valueOf())})};if(void 0!==u&&!s){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);s=hr(t,s)}return e.$$set=e=>{"value"in e&&r(0,s=e.value),"id"in e&&r(1,a=e.id),"item"in e&&r(13,l=e.item),"record"in e&&r(14,d=e.record),"praefix"in e&&r(2,u=e.praefix),"noForm"in e&&r(3,h=e.noForm),"classId"in e&&r(4,f=e.classId),"eventId"in e&&r(15,m=e.eventId),"readonly"in e&&r(5,p=e.readonly),"disabled"in e&&r(6,g=e.disabled),"required"in e&&r(7,w=e.required),"notifyList"in e&&r(16,y=e.notifyList),"dateInput"in e&&r(17,v=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty&&s&&!E&&ts.has(_)&&r(0,s=ts.get(_)),65536&e.$$.dirty&&(async e=>{if(null===I){const e=(await t.getEvent(m)).output.class[0].item;I=e.find(e=>e.properties?.value?.formula)}I&&I.properties.value.formula.argument[0].refItem===l.name&&(e&&e.itemName!==l.name&&!I.properties.value.formula.argument[1].value&&e.itemName!==I.properties.value.formula.argument[1].refItem.split(".")[0]||i("formula",{item:I}))})(y),131072&e.$$.dirty&&((e={})=>{let{ref:t,val:n,t:r,l:i,n:o}=e;if(o&&(n=o),!n||isNaN(new Date(n)))return;if(r)return;if(!t)return;const[s,a]=t.split(".");s===i&&a===l.name&&null!=u&&A({detail:{value:new Date(n)}})})(v),24673&e.$$.dirty&&d&&d[l.name])try{g||p||r(0,s=hr(d[l.name],s))}catch{}},[s,a,u,h,f,p,g,w,o,C,E,A,()=>{i("record",{target:E.target,value:s.toISOString()})},l,d,m,y,v,function(){s=this.value,r(0,s),r(14,d),r(13,l),r(6,g),r(5,p)}]}class rs extends Te{constructor(e){super(),Se(this,e,ns,es,$,{value:0,id:1,item:13,record:14,praefix:2,noForm:3,classId:4,eventId:15,readonly:5,disabled:6,required:7,notifyList:16,dateInput:17})}}function is(e){let t;return{c(){t=M("Stunden")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function os(e){let t,n;return t=new e[4]({props:{slot:"hours-label",$$slots:{default:[is]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ss(e){let t;return{c(){t=M("Minuten")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function as(e){let t,n;return t=new e[4]({props:{slot:"minutes-label",$$slots:{default:[ss]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ls(e){let t;return{c(){t=M("Jetzt")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function cs(e){let t,n;return t=new e[4]({props:{slot:"now-label",$$slots:{default:[ls]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4096&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ds(e){let t,n,r,i,o,s,a,l,c;return i=new e[5]({props:{value:e[0],closeOnSelection:!0}}),i.$on("change",e[8]),s=new e[6]({props:{value:e[0],$$slots:{"now-label":[cs],"minutes-label":[as],"hours-label":[os]},$$scope:{ctx:e}}}),s.$on("change",e[7]),{c(){t=O("input"),r=P(),Ae(i.$$.fragment),o=P(),Ae(s.$$.fragment),U(t,"type","string"),U(t,"class",n=e[2]||e[3]),U(t,"id",e[1]),U(t,"name",e[1]),t.hidden=!0},m(n,d){R(n,t,d),W(t,e[0]),R(n,r,d),$e(i,n,d),R(n,o,d),$e(s,n,d),a=!0,l||(c=L(t,"input",e[9]),l=!0)},p(e,[r]){(!a||12&r&&n!==(n=e[2]||e[3]))&&U(t,"class",n),(!a||2&r)&&U(t,"id",e[1]),(!a||2&r)&&U(t,"name",e[1]),1&r&&W(t,e[0]);const o={};1&r&&(o.value=e[0]),i.$set(o);const l={};1&r&&(l.value=e[0]),4096&r&&(l.$$scope={dirty:r,ctx:e}),s.$set(l)},i(e){a||(we(i.$$.fragment,e),we(s.$$.fragment,e),a=!0)},o(e){ye(i.$$.fragment,e),ye(s.$$.fragment,e),a=!1},d(e){e&&D(t),e&&D(r),be(i,e),e&&D(o),be(s,e),l=!1,c()}}}function us(e,t,n){const r=K(),{Label:i,DatePicker:o,TimePicker:s}=c;let{value:a}=t,{id:l}=t,{noForm:d=!1}=t,{classId:u}=t;const h=e=>r("change",{value:e});return e.$$set=e=>{"value"in e&&n(0,a=e.value),"id"in e&&n(1,l=e.id),"noForm"in e&&n(2,d=e.noForm),"classId"in e&&n(3,u=e.classId)},[a,l,d,u,i,o,s,({detail:e})=>{var t,r;n(0,(t=e.value,r=a,a=null==t||null==r?t:(r.setHours(t.getHours(),t.getMinutes(),t.getSeconds()),r))),h(a)},({detail:e})=>{n(0,a=hr(e.value,a)),h(a)},function(){a=this.value,n(0,a)}]}class hs extends Te{constructor(e){super(),Se(this,e,us,ds,$,{value:0,id:1,noForm:2,classId:3})}}function fs(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g;return u=new e[9]({props:{format:e[5],required:e[3],disabled:e[4],value:e[7],noCalendar:e[10],closeOnSelection:!0}}),u.$on("change",e[11]),f=new e[9]({props:{format:e[6],required:e[3],disabled:e[4],value:e[8],noCalendar:e[10],class:"moveLeft",closeOnSelection:!0}}),f.$on("change",e[12]),{c(){t=O("input"),o=P(),s=O("input"),d=P(),Ae(u.$$.fragment),h=M(" /\n"),Ae(f.$$.fragment),U(t,"type","string"),U(t,"class",n=e[1]||e[2]),U(t,"id",r=e[0]+"_from"),U(t,"name",i=e[0]+"_from"),t.hidden=!0,U(s,"type","string"),U(s,"class",a=e[1]||e[2]),U(s,"id",l=e[0]+"_to"),U(s,"name",c=e[0]+"_to"),s.hidden=!0},m(n,r){R(n,t,r),W(t,e[7]),R(n,o,r),R(n,s,r),W(s,e[8]),R(n,d,r),$e(u,n,r),R(n,h,r),$e(f,n,r),m=!0,p||(g=[L(t,"input",e[15]),L(s,"input",e[16])],p=!0)},p(e,[o]){(!m||6&o&&n!==(n=e[1]||e[2]))&&U(t,"class",n),(!m||1&o&&r!==(r=e[0]+"_from"))&&U(t,"id",r),(!m||1&o&&i!==(i=e[0]+"_from"))&&U(t,"name",i),128&o&&W(t,e[7]),(!m||6&o&&a!==(a=e[1]||e[2]))&&U(s,"class",a),(!m||1&o&&l!==(l=e[0]+"_to"))&&U(s,"id",l),(!m||1&o&&c!==(c=e[0]+"_to"))&&U(s,"name",c),256&o&&W(s,e[8]);const d={};32&o&&(d.format=e[5]),8&o&&(d.required=e[3]),16&o&&(d.disabled=e[4]),128&o&&(d.value=e[7]),u.$set(d);const h={};64&o&&(h.format=e[6]),8&o&&(h.required=e[3]),16&o&&(h.disabled=e[4]),256&o&&(h.value=e[8]),f.$set(h)},i(e){m||(we(u.$$.fragment,e),we(f.$$.fragment,e),m=!0)},o(e){ye(u.$$.fragment,e),ye(f.$$.fragment,e),m=!1},d(e){e&&D(t),e&&D(o),e&&D(s),e&&D(d),be(u,e),e&&D(h),be(f,e),p=!1,E(g)}}}function ms(e,t,n){const r=K(),{DatePicker:i}=c;let{value:o}=t,{id:s}=t,{item:a}=t,{noForm:l=!1}=t,{classId:d}=t,{required:u}=t,{disabled:h}=t;const{noCalendar:f,preset:m}=a.properties||{};let p="%d.%m.%Y",g="%d.%m.%Y",w=o?.from,y=o?.to;if(m){const{first:e,last:t}=function(e){const t=new Date;let n=t.getFullYear();const r=t.getMonth();let i,o;switch(t.getDate(),e){case"currentMonth":i=o=r;break;case"currentYear":i=0,o=i+11;break;case"lastSemiYear":i=r<6?6:0,o=i+5,i>5&&--n;break;case"lastQuarter":i=r<3?9:r<6?0:r<9?3:6,o=i+2,i>8&&--n;break;case"lastMonth":i=o=0===r?11:r-1,11===i&&--n;break;default:i=0,o=i+11,--n}return{first:new Date(n,i,1),last:new Date(n,o+1,0)}}(m);e&&(w=e),t&&(y=t)}"Invalid Date"===w?.toString()&&(w=void 0),"Invalid Date"===y?.toString()&&(y=void 0),h&&(void 0===w&&(p=""),void 0===y&&(g=""));return e.$$set=e=>{"value"in e&&n(13,o=e.value),"id"in e&&n(0,s=e.id),"item"in e&&n(14,a=e.item),"noForm"in e&&n(1,l=e.noForm),"classId"in e&&n(2,d=e.classId),"required"in e&&n(3,u=e.required),"disabled"in e&&n(4,h=e.disabled)},[s,l,d,u,h,p,g,w,y,i,f,({detail:e})=>{n(7,w=hr(e.value,w)),y&&w&&y.valueOf()-w.valueOf()<0&&n(7,w=void 0),r("change",{value:w,range:"_from"})},({detail:e})=>{n(8,y=hr(e.value,y)),y&&w&&y.valueOf()-w.valueOf()<0&&n(8,y=void 0),r("change",{value:y,range:"_to"})},o,a,function(){w=this.value,n(7,w)},function(){y=this.value,n(8,y)}]}class ps extends Te{constructor(e){var t;super(),document.getElementById("svelte-7itxk4-style")||((t=O("style")).id="svelte-7itxk4-style",t.textContent="div.date-picker.moveLeft div.dropdown.calendar{left:-3em !important}",N(document.head,t)),Se(this,e,ms,fs,$,{value:13,id:0,item:14,noForm:1,classId:2,required:3,disabled:4})}}var gs={globalLocale:"en-US",globalFormat:"$0,0.00",globalRoundingMode:"HALF_EVEN",globalFormatRoundingMode:"HALF_AWAY_FROM_ZERO",globalExchangeRatesApi:{endpoint:void 0,headers:void 0,propertyPath:void 0}};function ws(e){return ws="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ws(e)}function ys(e){return function(e){if(Array.isArray(e))return e}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return vs(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vs(e,t)}(e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vs(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Is={normalizePrecision:function(e){var t=e.reduce(function(e,t){return Math.max(e.getPrecision(),t.getPrecision())});return e.map(function(e){return e.getPrecision()!==t?e.convertPrecision(t):e})},minimum:function(e){var t=ys(e),n=t[0],r=t.slice(1),i=n;return r.forEach(function(e){i=i.lessThan(e)?i:e}),i},maximum:function(e){var t=ys(e),n=t[0],r=t.slice(1),i=n;return r.forEach(function(e){i=i.greaterThan(e)?i:e}),i}};function _s(e){return!isNaN(parseInt(e))&&isFinite(e)}function Cs(e){return e%2==0}function Es(e){return _s(e)&&!Number.isInteger(e)}function As(e){return Math.abs(e)%1==.5}function $s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){var i=Object.assign(new XMLHttpRequest,{onreadystatechange:function(){4===i.readyState&&(i.status>=200&&i.status<400?n(JSON.parse(i.responseText)):r(new Error(i.statusText)))},onerror:function(){r(new Error("Network error"))}});i.open("GET",e,!0),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var n in t)e.setRequestHeader(n,t[n])}(i,t.headers),i.send()})}function bs(e){return void 0===e}function Ss(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",n={};return Object.entries(e).forEach(function(e){if("object"===ws(e[1])){var r=Ss(e[1]);Object.entries(r).forEach(function(r){n[e[0]+t+r[0]]=r[1]})}else n[e[0]]=e[1]}),n}function Ts(){var e=function(e,t){var n=function(e){return Math.pow(10,function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:0).toString();if(e.indexOf("e-")>0)return parseInt(e.split("e-")[1]);var t=e.split(".")[1];return t?t.length:0}(e))},r=Math.max(n(e),n(t));return Math.round(e*r)*Math.round(t*r)/(r*r)},t={HALF_ODD:function(e){var t=Math.round(e);return As(e)&&Cs(t)?t-1:t},HALF_EVEN:function(e){var t=Math.round(e);return As(e)?Cs(t)?t:t-1:t},HALF_UP:function(e){return Math.round(e)},HALF_DOWN:function(e){return As(e)?Math.floor(e):Math.round(e)},HALF_TOWARDS_ZERO:function(e){return As(e)?Math.sign(e)*Math.floor(Math.abs(e)):Math.round(e)},HALF_AWAY_FROM_ZERO:function(e){return As(e)?Math.sign(e)*Math.ceil(Math.abs(e)):Math.round(e)},DOWN:function(e){return Math.floor(e)}};return{add:function(e,t){return e+t},subtract:function(e,t){return e-t},multiply:function(t,n){return Es(t)||Es(n)?e(t,n):t*n},divide:function(e,t){return e/t},modulo:function(e,t){return e%t},round:function(e){return t[arguments.length>1&&void 0!==arguments[1]?arguments[1]:"HALF_EVEN"](e)}}}var Ns=Ts();function Rs(e){var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;for(var n in t)e=e.replace("{{".concat(n,"}}"),t[n]);return e};return{getExchangeRate:function(n,r){return(i=e.endpoint,!Boolean(i)||"object"!==ws(i)&&"function"!=typeof i||"function"!=typeof i.then?function(n,r){return $s(t(e.endpoint,{from:n,to:r}),{headers:e.headers})}(n,r):e.endpoint).then(function(i){return Ss(i)[t(e.propertyPath,{from:n,to:r})]});var i}}}function Ds(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Error;if(!e)throw new n(t)}function xs(e){Ds(function(e){return _s(e)&&e<=100&&e>=0}(e),"You must provide a numeric value between 0 and 100.",RangeError)}function Os(e){Ds(Number.isInteger(e),"You must provide an integer.",TypeError)}var ks=Ts(),Ms=Object.assign(function e(t){var n=Object.assign({},{amount:e.defaultAmount,currency:e.defaultCurrency,precision:e.defaultPrecision},t),r=n.amount,i=n.currency,o=n.precision;Os(r),Os(o);var s=e.globalLocale,a=e.globalFormat,l=e.globalRoundingMode,c=e.globalFormatRoundingMode,d=Object.assign({},e.globalExchangeRatesApi),u=function(t){var n=Object.assign({},Object.assign({},{amount:r,currency:i,precision:o},t),Object.assign({},{locale:this.locale},t));return Object.assign(e({amount:n.amount,currency:n.currency,precision:n.precision}),{locale:n.locale})},h=function(e){Ds(this.hasSameCurrency(e),"You must provide a Dinero instance with the same currency.",TypeError)};return{getAmount:function(){return r},getCurrency:function(){return i},getLocale:function(){return this.locale||s},setLocale:function(e){return u.call(this,{locale:e})},getPrecision:function(){return o},convertPrecision:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c;Os(e);var n=this.getPrecision(),r=e>n,i=r?ks.multiply:ks.divide,o=r?[e,n]:[n,e],s=Math.pow(10,ks.subtract.apply(ks,o));return u.call(this,{amount:ks.round(i(this.getAmount(),s),t),precision:e})},add:function(t){h.call(this,t);var n=e.normalizePrecision([this,t]);return u.call(this,{amount:ks.add(n[0].getAmount(),n[1].getAmount()),precision:n[0].getPrecision()})},subtract:function(t){h.call(this,t);var n=e.normalizePrecision([this,t]);return u.call(this,{amount:ks.subtract(n[0].getAmount(),n[1].getAmount()),precision:n[0].getPrecision()})},multiply:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return u.call(this,{amount:ks.round(ks.multiply(this.getAmount(),e),t)})},divide:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return u.call(this,{amount:ks.round(ks.divide(this.getAmount(),e),t)})},percentage:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l;return xs(e),this.multiply(ks.divide(e,100),t)},allocate:function(e){var t=this;!function(e){Ds(function(e){return e.length>0&&e.every(function(e){return e>=0})&&e.some(function(e){return e>0})}(e),"You must provide a non-empty array of numeric values greater than 0.",TypeError)}(e);for(var n=e.reduce(function(e,t){return ks.add(e,t)}),r=this.getAmount(),i=e.map(function(e){var i=Math.floor(ks.divide(ks.multiply(t.getAmount(),e),n));return r=ks.subtract(r,i),u.call(t,{amount:i})}),o=0;r>0;)e[o]>0&&(i[o]=i[o].add(u.call(this,{amount:1})),r=ks.subtract(r,1)),o+=1;return i},convert:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.endpoint,i=void 0===r?d.endpoint:r,o=n.propertyPath,s=void 0===o?d.propertyPath||"rates.{{to}}":o,a=n.headers,c=void 0===a?d.headers:a,h=n.roundingMode,f=void 0===h?l:h,m=Object.assign({},{endpoint:i,propertyPath:s,headers:c,roundingMode:f});return Rs(m).getExchangeRate(this.getCurrency(),e).then(function(n){return Ds(!bs(n),'No rate was found for the destination currency "'.concat(e,'".'),TypeError),u.call(t,{amount:ks.round(ks.multiply(t.getAmount(),parseFloat(n)),m.roundingMode),currency:e})})},equalsTo:function(e){return this.hasSameAmount(e)&&this.hasSameCurrency(e)},lessThan:function(t){h.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()<n[1].getAmount()},lessThanOrEqual:function(t){h.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()<=n[1].getAmount()},greaterThan:function(t){h.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()>n[1].getAmount()},greaterThanOrEqual:function(t){h.call(this,t);var n=e.normalizePrecision([this,t]);return n[0].getAmount()>=n[1].getAmount()},isZero:function(){return 0===this.getAmount()},isPositive:function(){return this.getAmount()>=0},isNegative:function(){return this.getAmount()<0},hasSubUnits:function(){return 0!==ks.modulo(this.getAmount(),Math.pow(10,o))},hasCents:function(){return 0!==ks.modulo(this.getAmount(),Math.pow(10,o))},hasSameCurrency:function(e){return this.getCurrency()===e.getCurrency()},hasSameAmount:function(t){var n=e.normalizePrecision([this,t]);return n[0].getAmount()===n[1].getAmount()},toFormat:function(){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,t=function(e){var t=/^(?:(\$|USD)?0(?:(,)0)?(\.)?(0+)?|0(?:(,)0)?(\.)?(0+)?\s?(dollar)?)$/gm.exec(e);return{getMatches:function(){return null!==t?t.slice(1).filter(function(e){return!bs(e)}):[]},getMinimumFractionDigits:function(){var e=function(e){return"."===e};return bs(this.getMatches().find(e))?0:this.getMatches()[Ns.add(this.getMatches().findIndex(e),1)].split("").length},getCurrencyDisplay:function(){return{USD:"code",dollar:"name",$:"symbol"}[this.getMatches().find(function(e){return"USD"===e||"dollar"===e||"$"===e})]},getStyle:function(){return bs(this.getCurrencyDisplay(this.getMatches()))?"decimal":"currency"},getUseGrouping:function(){return!bs(this.getMatches().find(function(e){return","===e}))}}}(arguments.length>0&&void 0!==arguments[0]?arguments[0]:a);return this.toRoundedUnit(t.getMinimumFractionDigits(),e).toLocaleString(this.getLocale(),{currencyDisplay:t.getCurrencyDisplay(),useGrouping:t.getUseGrouping(),minimumFractionDigits:t.getMinimumFractionDigits(),style:t.getStyle(),currency:this.getCurrency()})},toUnit:function(){return ks.divide(this.getAmount(),Math.pow(10,o))},toRoundedUnit:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:c,n=Math.pow(10,e);return ks.divide(ks.round(ks.multiply(this.toUnit(),n),t),n)},toObject:function(){return{amount:r,currency:i,precision:o}},toJSON:function(){return this.toObject()}}},{defaultAmount:0,defaultCurrency:"USD",defaultPrecision:2},gs,Is),Ps={},Bs={};!function(e){const t=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",n="["+t+"]["+(t+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",r=new RegExp("^"+n+"$");e.isExist=function(e){return void 0!==e},e.isEmptyObject=function(e){return 0===Object.keys(e).length},e.merge=function(e,t,n){if(t){const r=Object.keys(t),i=r.length;for(let o=0;o<i;o++)e[r[o]]="strict"===n?[t[r[o]]]:t[r[o]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(e){const t=r.exec(e);return!(null==t)},e.getAllMatches=function(e,t){const n=[];let r=t.exec(e);for(;r;){const i=[];i.startIndex=t.lastIndex-r[0].length;const o=r.length;for(let e=0;e<o;e++)i.push(r[e]);n.push(i),r=t.exec(e)}return n},e.nameRegexp=n}(Bs);const Ls=Bs,Fs={allowBooleanAttributes:!1,unpairedTags:[]};function Vs(e){return" "===e||"\t"===e||"\n"===e||"\r"===e}function Us(e,t){const n=t;for(;t<e.length;t++)if("?"==e[t]||" "==e[t]){const r=e.substr(n,t-n);if(t>5&&"xml"===r)return Ys("InvalidXml","XML declaration allowed only at the start of the document.",Qs(e,t));if("?"==e[t]&&">"==e[t+1]){t++;break}continue}return t}function Hs(e,t){if(e.length>t+5&&"-"===e[t+1]&&"-"===e[t+2]){for(t+=3;t<e.length;t++)if("-"===e[t]&&"-"===e[t+1]&&">"===e[t+2]){t+=2;break}}else if(e.length>t+8&&"D"===e[t+1]&&"O"===e[t+2]&&"C"===e[t+3]&&"T"===e[t+4]&&"Y"===e[t+5]&&"P"===e[t+6]&&"E"===e[t+7]){let n=1;for(t+=8;t<e.length;t++)if("<"===e[t])n++;else if(">"===e[t]&&(n--,0===n))break}else if(e.length>t+9&&"["===e[t+1]&&"C"===e[t+2]&&"D"===e[t+3]&&"A"===e[t+4]&&"T"===e[t+5]&&"A"===e[t+6]&&"["===e[t+7])for(t+=8;t<e.length;t++)if("]"===e[t]&&"]"===e[t+1]&&">"===e[t+2]){t+=2;break}return t}Ps.validate=function(e,t){t=Object.assign({},Fs,t);const n=[];let r=!1,i=!1;"\ufeff"===e[0]&&(e=e.substr(1));for(let o=0;o<e.length;o++)if("<"===e[o]&&"?"===e[o+1]){if(o+=2,o=Us(e,o),o.err)return o}else{if("<"!==e[o]){if(Vs(e[o]))continue;return Ys("InvalidChar","char '"+e[o]+"' is not expected.",Qs(e,o))}{let s=o;if(o++,"!"===e[o]){o=Hs(e,o);continue}{let a=!1;"/"===e[o]&&(a=!0,o++);let l="";for(;o<e.length&&">"!==e[o]&&" "!==e[o]&&"\t"!==e[o]&&"\n"!==e[o]&&"\r"!==e[o];o++)l+=e[o];if(l=l.trim(),"/"===l[l.length-1]&&(l=l.substring(0,l.length-1),o--),!Ks(l)){let t;return t=0===l.trim().length?"Invalid space after '<'.":"Tag '"+l+"' is an invalid name.",Ys("InvalidTag",t,Qs(e,o))}const c=js(e,o);if(!1===c)return Ys("InvalidAttr","Attributes for '"+l+"' have open quote.",Qs(e,o));let d=c.value;if(o=c.index,"/"===d[d.length-1]){const n=o-d.length;d=d.substring(0,d.length-1);const i=Gs(d,t);if(!0!==i)return Ys(i.err.code,i.err.msg,Qs(e,n+i.err.line));r=!0}else if(a){if(!c.tagClosed)return Ys("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",Qs(e,o));if(d.trim().length>0)return Ys("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",Qs(e,s));if(0===n.length)return Ys("InvalidTag","Closing tag '"+l+"' has not been opened.",Qs(e,s));{const t=n.pop();if(l!==t.tagName){let n=Qs(e,t.tagStartPos);return Ys("InvalidTag","Expected closing tag '"+t.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+l+"'.",Qs(e,s))}0==n.length&&(i=!0)}}else{const a=Gs(d,t);if(!0!==a)return Ys(a.err.code,a.err.msg,Qs(e,o-d.length+a.err.line));if(!0===i)return Ys("InvalidXml","Multiple possible root nodes found.",Qs(e,o));-1!==t.unpairedTags.indexOf(l)||n.push({tagName:l,tagStartPos:s}),r=!0}for(o++;o<e.length;o++)if("<"===e[o]){if("!"===e[o+1]){o++,o=Hs(e,o);continue}if("?"!==e[o+1])break;if(o=Us(e,++o),o.err)return o}else if("&"===e[o]){const t=Xs(e,o);if(-1==t)return Ys("InvalidChar","char '&' is not expected.",Qs(e,o));o=t}else if(!0===i&&!Vs(e[o]))return Ys("InvalidXml","Extra text at the end",Qs(e,o));"<"===e[o]&&o--}}}return r?1==n.length?Ys("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",Qs(e,n[0].tagStartPos)):!(n.length>0)||Ys("InvalidXml","Invalid '"+JSON.stringify(n.map(e=>e.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):Ys("InvalidXml","Start tag expected.",1)};const Ws='"',zs="'";function js(e,t){let n="",r="",i=!1;for(;t<e.length;t++){if(e[t]===Ws||e[t]===zs)""===r?r=e[t]:r!==e[t]||(r="");else if(">"===e[t]&&""===r){i=!0;break}n+=e[t]}return""===r&&{value:n,index:t,tagClosed:i}}const qs=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function Gs(e,t){const n=Ls.getAllMatches(e,qs),r={};for(let e=0;e<n.length;e++){if(0===n[e][1].length)return Ys("InvalidAttr","Attribute '"+n[e][2]+"' has no space in starting.",Js(n[e]));if(void 0!==n[e][3]&&void 0===n[e][4])return Ys("InvalidAttr","Attribute '"+n[e][2]+"' is without value.",Js(n[e]));if(void 0===n[e][3]&&!t.allowBooleanAttributes)return Ys("InvalidAttr","boolean attribute '"+n[e][2]+"' is not allowed.",Js(n[e]));const i=n[e][2];if(!Zs(i))return Ys("InvalidAttr","Attribute '"+i+"' is an invalid name.",Js(n[e]));if(r.hasOwnProperty(i))return Ys("InvalidAttr","Attribute '"+i+"' is repeated.",Js(n[e]));r[i]=1}return!0}function Xs(e,t){if(";"===e[++t])return-1;if("#"===e[t])return function(e,t){let n=/\d/;for("x"===e[t]&&(t++,n=/[\da-fA-F]/);t<e.length;t++){if(";"===e[t])return t;if(!e[t].match(n))break}return-1}(e,++t);let n=0;for(;t<e.length;t++,n++)if(!(e[t].match(/\w/)&&n<20)){if(";"===e[t])break;return-1}return t}function Ys(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function Zs(e){return Ls.isName(e)}function Ks(e){return Ls.isName(e)}function Qs(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Js(e){return e.startIndex+e[1].length}var ea={};const ta={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(e,t,n){return e}};ea.buildOptions=function(e){return Object.assign({},ta,e)},ea.defaultOptions=ta;var na=class{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){"__proto__"===e&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){"__proto__"===e.tagname&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};const ra=Bs;function ia(e,t){let n="";for(;t<e.length&&"'"!==e[t]&&'"'!==e[t];t++)n+=e[t];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=e[t++];let i="";for(;t<e.length&&e[t]!==r;t++)i+=e[t];return[n,i,t]}function oa(e,t){return"!"===e[t+1]&&"-"===e[t+2]&&"-"===e[t+3]}function sa(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"N"===e[t+3]&&"T"===e[t+4]&&"I"===e[t+5]&&"T"===e[t+6]&&"Y"===e[t+7]}function aa(e,t){return"!"===e[t+1]&&"E"===e[t+2]&&"L"===e[t+3]&&"E"===e[t+4]&&"M"===e[t+5]&&"E"===e[t+6]&&"N"===e[t+7]&&"T"===e[t+8]}function la(e,t){return"!"===e[t+1]&&"A"===e[t+2]&&"T"===e[t+3]&&"T"===e[t+4]&&"L"===e[t+5]&&"I"===e[t+6]&&"S"===e[t+7]&&"T"===e[t+8]}function ca(e,t){return"!"===e[t+1]&&"N"===e[t+2]&&"O"===e[t+3]&&"T"===e[t+4]&&"A"===e[t+5]&&"T"===e[t+6]&&"I"===e[t+7]&&"O"===e[t+8]&&"N"===e[t+9]}function da(e){if(ra.isName(e))return e;throw new Error(`Invalid entity name ${e}`)}var ua=function(e,t){const n={};if("O"!==e[t+3]||"C"!==e[t+4]||"T"!==e[t+5]||"Y"!==e[t+6]||"P"!==e[t+7]||"E"!==e[t+8])throw new Error("Invalid Tag instead of DOCTYPE");{t+=9;let r=1,i=!1,o=!1,s="";for(;t<e.length;t++)if("<"!==e[t]||o)if(">"===e[t]){if(o?"-"===e[t-1]&&"-"===e[t-2]&&(o=!1,r--):r--,0===r)break}else"["===e[t]?i=!0:s+=e[t];else{if(i&&sa(e,t))t+=7,[entityName,val,t]=ia(e,t+1),-1===val.indexOf("&")&&(n[da(entityName)]={regx:RegExp(`&${entityName};`,"g"),val:val});else if(i&&aa(e,t))t+=8;else if(i&&la(e,t))t+=8;else if(i&&ca(e,t))t+=9;else{if(!oa)throw new Error("Invalid DOCTYPE");o=!0}r++,s=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:t}};const ha=/^[-+]?0x[a-fA-F0-9]+$/,fa=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const ma={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};var pa=function(e){return"function"==typeof e?e:Array.isArray(e)?t=>{for(const n of e){if("string"==typeof n&&t===n)return!0;if(n instanceof RegExp&&n.test(t))return!0}}:()=>!1};const ga=Bs,wa=na,ya=ua,va=function(e,t={}){if(t=Object.assign({},ma,t),!e||"string"!=typeof e)return e;let n=e.trim();if(void 0!==t.skipLike&&t.skipLike.test(n))return e;if(t.hex&&ha.test(n))return Number.parseInt(n,16);{const r=fa.exec(n);if(r){const i=r[1],o=r[2];let s=function(e){if(e&&-1!==e.indexOf("."))return"."===(e=e.replace(/0+$/,""))?e="0":"."===e[0]?e="0"+e:"."===e[e.length-1]&&(e=e.substr(0,e.length-1)),e;return e}(r[3]);const a=r[4]||r[6];if(!t.leadingZeros&&o.length>0&&i&&"."!==n[2])return e;if(!t.leadingZeros&&o.length>0&&!i&&"."!==n[1])return e;{const r=Number(n),l=""+r;return-1!==l.search(/[eE]/)||a?t.eNotation?r:e:-1!==n.indexOf(".")?"0"===l&&""===s||l===s||i&&l==="-"+s?r:e:o?s===l||i+s===l?r:e:n===l||n===i+l?r:e}}return e}},Ia=pa;function _a(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function Ca(e,t,n,r,i,o,s){if(void 0!==e&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){s||(e=this.replaceEntitiesValue(e));const r=this.options.tagValueProcessor(t,e,n,i,o);if(null==r)return e;if(typeof r!=typeof e||r!==e)return r;if(this.options.trimValues)return ka(e,this.options.parseTagValue,this.options.numberParseOptions);return e.trim()===e?ka(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function Ea(e){if(this.options.removeNSPrefix){const t=e.split(":"),n="/"===e.charAt(0)?"/":"";if("xmlns"===t[0])return"";2===t.length&&(e=n+t[1])}return e}const Aa=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function $a(e,t,n){if(!0!==this.options.ignoreAttributes&&"string"==typeof e){const n=ga.getAllMatches(e,Aa),r=n.length,i={};for(let e=0;e<r;e++){const r=this.resolveNameSpace(n[e][1]);if(this.ignoreAttributesFn(r,t))continue;let o=n[e][4],s=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(s=this.options.transformAttributeName(s)),"__proto__"===s&&(s="#__proto__"),void 0!==o){this.options.trimValues&&(o=o.trim()),o=this.replaceEntitiesValue(o);const e=this.options.attributeValueProcessor(r,o,t);i[s]=null==e?o:typeof e!=typeof o||e!==o?e:ka(o,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(i[s]=!0)}if(!Object.keys(i).length)return;if(this.options.attributesGroupName){const e={};return e[this.options.attributesGroupName]=i,e}return i}}const ba=function(e){e=e.replace(/\r\n?/g,"\n");const t=new wa("!xml");let n=t,r="",i="";for(let o=0;o<e.length;o++){if("<"===e[o])if("/"===e[o+1]){const t=Da(e,">",o,"Closing Tag is not closed.");let s=e.substring(o+2,t).trim();if(this.options.removeNSPrefix){const e=s.indexOf(":");-1!==e&&(s=s.substr(e+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),n&&(r=this.saveTextToParentTag(r,n,i));const a=i.substring(i.lastIndexOf(".")+1);if(s&&-1!==this.options.unpairedTags.indexOf(s))throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);let l=0;a&&-1!==this.options.unpairedTags.indexOf(a)?(l=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):l=i.lastIndexOf("."),i=i.substring(0,l),n=this.tagsNodeStack.pop(),r="",o=t}else if("?"===e[o+1]){let t=xa(e,o,!1,"?>");if(!t)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,i),this.options.ignoreDeclaration&&"?xml"===t.tagName||this.options.ignorePiTags);else{const e=new wa(t.tagName);e.add(this.options.textNodeName,""),t.tagName!==t.tagExp&&t.attrExpPresent&&(e[":@"]=this.buildAttributesMap(t.tagExp,i,t.tagName)),this.addChild(n,e,i)}o=t.closeIndex+1}else if("!--"===e.substr(o+1,3)){const t=Da(e,"--\x3e",o+4,"Comment is not closed.");if(this.options.commentPropName){const s=e.substring(o+4,t-2);r=this.saveTextToParentTag(r,n,i),n.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}o=t}else if("!D"===e.substr(o+1,2)){const t=ya(e,o);this.docTypeEntities=t.entities,o=t.i}else if("!["===e.substr(o+1,2)){const t=Da(e,"]]>",o,"CDATA is not closed.")-2,s=e.substring(o+9,t);r=this.saveTextToParentTag(r,n,i);let a=this.parseTextData(s,n.tagname,i,!0,!1,!0,!0);null==a&&(a=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):n.add(this.options.textNodeName,a),o=t+2}else{let s=xa(e,o,this.options.removeNSPrefix),a=s.tagName;const l=s.rawTagName;let c=s.tagExp,d=s.attrExpPresent,u=s.closeIndex;this.options.transformTagName&&(a=this.options.transformTagName(a)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,i,!1));const h=n;if(h&&-1!==this.options.unpairedTags.indexOf(h.tagname)&&(n=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),a!==t.tagname&&(i+=i?"."+a:a),this.isItStopNode(this.options.stopNodes,i,a)){let t="";if(c.length>0&&c.lastIndexOf("/")===c.length-1)"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),c=a):c=c.substr(0,c.length-1),o=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(a))o=s.closeIndex;else{const n=this.readStopNodeData(e,l,u+1);if(!n)throw new Error(`Unexpected end of ${l}`);o=n.i,t=n.tagContent}const r=new wa(a);a!==c&&d&&(r[":@"]=this.buildAttributesMap(c,i,a)),t&&(t=this.parseTextData(t,a,i,!0,d,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),r.add(this.options.textNodeName,t),this.addChild(n,r,i)}else{if(c.length>0&&c.lastIndexOf("/")===c.length-1){"/"===a[a.length-1]?(a=a.substr(0,a.length-1),i=i.substr(0,i.length-1),c=a):c=c.substr(0,c.length-1),this.options.transformTagName&&(a=this.options.transformTagName(a));const e=new wa(a);a!==c&&d&&(e[":@"]=this.buildAttributesMap(c,i,a)),this.addChild(n,e,i),i=i.substr(0,i.lastIndexOf("."))}else{const e=new wa(a);this.tagsNodeStack.push(n),a!==c&&d&&(e[":@"]=this.buildAttributesMap(c,i,a)),this.addChild(n,e,i),n=e}r="",o=u}}else r+=e[o]}return t.child};function Sa(e,t,n){const r=this.options.updateTag(t.tagname,n,t[":@"]);!1===r||("string"==typeof r?(t.tagname=r,e.addChild(t)):e.addChild(t))}const Ta=function(e){if(this.options.processEntities){for(let t in this.docTypeEntities){const n=this.docTypeEntities[t];e=e.replace(n.regx,n.val)}for(let t in this.lastEntities){const n=this.lastEntities[t];e=e.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let t in this.htmlEntities){const n=this.htmlEntities[t];e=e.replace(n.regex,n.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function Na(e,t,n,r){return e&&(void 0===r&&(r=0===Object.keys(t.child).length),void 0!==(e=this.parseTextData(e,t.tagname,n,!1,!!t[":@"]&&0!==Object.keys(t[":@"]).length,r))&&""!==e&&t.add(this.options.textNodeName,e),e=""),e}function Ra(e,t,n){const r="*."+n;for(const n in e){const i=e[n];if(r===i||t===i)return!0}return!1}function Da(e,t,n,r){const i=e.indexOf(t,n);if(-1===i)throw new Error(r);return i+t.length-1}function xa(e,t,n,r=">"){const i=function(e,t,n=">"){let r,i="";for(let o=t;o<e.length;o++){let t=e[o];if(r)t===r&&(r="");else if('"'===t||"'"===t)r=t;else if(t===n[0]){if(!n[1])return{data:i,index:o};if(e[o+1]===n[1])return{data:i,index:o}}else"\t"===t&&(t=" ");i+=t}}(e,t+1,r);if(!i)return;let o=i.data;const s=i.index,a=o.search(/\s/);let l=o,c=!0;-1!==a&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const d=l;if(n){const e=l.indexOf(":");-1!==e&&(l=l.substr(e+1),c=l!==i.data.substr(e+1))}return{tagName:l,tagExp:o,closeIndex:s,attrExpPresent:c,rawTagName:d}}function Oa(e,t,n){const r=n;let i=1;for(;n<e.length;n++)if("<"===e[n])if("/"===e[n+1]){const o=Da(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(i--,0===i))return{tagContent:e.substring(r,n),i:o};n=o}else if("?"===e[n+1]){n=Da(e,"?>",n+1,"StopNode is not closed.")}else if("!--"===e.substr(n+1,3)){n=Da(e,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===e.substr(n+1,2)){n=Da(e,"]]>",n,"StopNode is not closed.")-2}else{const r=xa(e,n,">");if(r){(r&&r.tagName)===t&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex}}}function ka(e,t,n){if(t&&"string"==typeof e){const t=e.trim();return"true"===t||"false"!==t&&va(e,n)}return ga.isExist(e)?e:""}var Ma=class{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(e,t)=>String.fromCharCode(Number.parseInt(t,16))}},this.addExternalEntities=_a,this.parseXml=ba,this.parseTextData=Ca,this.resolveNameSpace=Ea,this.buildAttributesMap=$a,this.isItStopNode=Ra,this.replaceEntitiesValue=Ta,this.readStopNodeData=Oa,this.saveTextToParentTag=Na,this.addChild=Sa,this.ignoreAttributesFn=Ia(this.options.ignoreAttributes)}},Pa={};function Ba(e,t,n){let r;const i={};for(let o=0;o<e.length;o++){const s=e[o],a=La(s);let l="";if(l=void 0===n?a:n+"."+a,a===t.textNodeName)void 0===r?r=s[a]:r+=""+s[a];else{if(void 0===a)continue;if(s[a]){let e=Ba(s[a],t,l);const n=Va(e,t);s[":@"]?Fa(e,s[":@"],l,t):1!==Object.keys(e).length||void 0===e[t.textNodeName]||t.alwaysCreateTextNode?0===Object.keys(e).length&&(t.alwaysCreateTextNode?e[t.textNodeName]="":e=""):e=e[t.textNodeName],void 0!==i[a]&&i.hasOwnProperty(a)?(Array.isArray(i[a])||(i[a]=[i[a]]),i[a].push(e)):t.isArray(a,l,n)?i[a]=[e]:i[a]=e}}}return"string"==typeof r?r.length>0&&(i[t.textNodeName]=r):void 0!==r&&(i[t.textNodeName]=r),i}function La(e){const t=Object.keys(e);for(let e=0;e<t.length;e++){const n=t[e];if(":@"!==n)return n}}function Fa(e,t,n,r){if(t){const i=Object.keys(t),o=i.length;for(let s=0;s<o;s++){const o=i[s];r.isArray(o,n+"."+o,!0,!0)?e[o]=[t[o]]:e[o]=t[o]}}}function Va(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return 0===r||!(1!==r||!e[n]&&"boolean"!=typeof e[n]&&0!==e[n])}Pa.prettify=function(e,t){return Ba(e,t)};const{buildOptions:Ua}=ea,Ha=Ma,{prettify:Wa}=Pa,za=Ps;var ja=class{constructor(e){this.externalEntities={},this.options=Ua(e)}parse(e,t){if("string"==typeof e);else{if(!e.toString)throw new Error("XML data is accepted in String or Bytes[] form.");e=e.toString()}if(t){!0===t&&(t={});const n=za.validate(e,t);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new Ha(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(e);return this.options.preserveOrder||void 0===r?r:Wa(r,this.options)}addEntity(e,t){if(-1!==t.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==e.indexOf("&")||-1!==e.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if("&"===t)throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};function qa(e,t,n,r){let i="",o=!1;for(let s=0;s<e.length;s++){const a=e[s],l=Ga(a);if(void 0===l)continue;let c="";if(c=0===n.length?l:`${n}.${l}`,l===t.textNodeName){let e=a[l];Ya(c,t)||(e=t.tagValueProcessor(l,e),e=Za(e,t)),o&&(i+=r),i+=e,o=!1;continue}if(l===t.cdataPropName){o&&(i+=r),i+=`<![CDATA[${a[l][0][t.textNodeName]}]]>`,o=!1;continue}if(l===t.commentPropName){i+=r+`\x3c!--${a[l][0][t.textNodeName]}--\x3e`,o=!0;continue}if("?"===l[0]){const e=Xa(a[":@"],t),n="?xml"===l?"":r;let s=a[l][0][t.textNodeName];s=0!==s.length?" "+s:"",i+=n+`<${l}${s}${e}?>`,o=!0;continue}let d=r;""!==d&&(d+=t.indentBy);const u=r+`<${l}${Xa(a[":@"],t)}`,h=qa(a[l],t,c,d);-1!==t.unpairedTags.indexOf(l)?t.suppressUnpairedNode?i+=u+">":i+=u+"/>":h&&0!==h.length||!t.suppressEmptyNode?h&&h.endsWith(">")?i+=u+`>${h}${r}</${l}>`:(i+=u+">",h&&""!==r&&(h.includes("/>")||h.includes("</"))?i+=r+t.indentBy+h+r:i+=h,i+=`</${l}>`):i+=u+"/>",o=!0}return i}function Ga(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&":@"!==r)return r}}function Xa(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let i=t.attributeValueProcessor(r,e[r]);i=Za(i,t),!0===i&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${i}"`}return n}function Ya(e,t){let n=(e=e.substr(0,e.length-t.textNodeName.length-1)).substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function Za(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const Ka=function(e,t){let n="";return t.format&&t.indentBy.length>0&&(n="\n"),qa(e,t,"",n)},Qa=pa,Ja={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,t){return t},attributeValueProcessor:function(e,t){return t},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function el(e){this.options=Object.assign({},Ja,e),!0===this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Qa(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=rl),this.processTextOrObjNode=tl,this.options.format?(this.indentate=nl,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function tl(e,t,n,r){const i=this.j2x(e,n+1,r.concat(t));return void 0!==e[this.options.textNodeName]&&1===Object.keys(e).length?this.buildTextValNode(e[this.options.textNodeName],t,i.attrStr,n):this.buildObjectNode(i.val,t,i.attrStr,n)}function nl(e){return this.options.indentBy.repeat(e)}function rl(e){return!(!e.startsWith(this.options.attributeNamePrefix)||e===this.options.textNodeName)&&e.substr(this.attrPrefixLen)}el.prototype.build=function(e){return this.options.preserveOrder?Ka(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},el.prototype.j2x=function(e,t,n){let r="",i="";const o=n.join(".");for(let s in e)if(Object.prototype.hasOwnProperty.call(e,s))if(void 0===e[s])this.isAttribute(s)&&(i+="");else if(null===e[s])this.isAttribute(s)?i+="":"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if(e[s]instanceof Date)i+=this.buildTextValNode(e[s],s,"",t);else if("object"!=typeof e[s]){const n=this.isAttribute(s);if(n&&!this.ignoreAttributesFn(n,o))r+=this.buildAttrPairStr(n,""+e[s]);else if(!n)if(s===this.options.textNodeName){let t=this.options.tagValueProcessor(s,""+e[s]);i+=this.replaceEntitiesValue(t)}else i+=this.buildTextValNode(e[s],s,"",t)}else if(Array.isArray(e[s])){const r=e[s].length;let o="",a="";for(let l=0;l<r;l++){const r=e[s][l];if(void 0===r);else if(null===r)"?"===s[0]?i+=this.indentate(t)+"<"+s+"?"+this.tagEndChar:i+=this.indentate(t)+"<"+s+"/"+this.tagEndChar;else if("object"==typeof r)if(this.options.oneListGroup){const e=this.j2x(r,t+1,n.concat(s));o+=e.val,this.options.attributesGroupName&&r.hasOwnProperty(this.options.attributesGroupName)&&(a+=e.attrStr)}else o+=this.processTextOrObjNode(r,s,t,n);else if(this.options.oneListGroup){let e=this.options.tagValueProcessor(s,r);e=this.replaceEntitiesValue(e),o+=e}else o+=this.buildTextValNode(r,s,"",t)}this.options.oneListGroup&&(o=this.buildObjectNode(o,s,a,t)),i+=o}else if(this.options.attributesGroupName&&s===this.options.attributesGroupName){const t=Object.keys(e[s]),n=t.length;for(let i=0;i<n;i++)r+=this.buildAttrPairStr(t[i],""+e[s][t[i]])}else i+=this.processTextOrObjNode(e[s],s,t,n);return{attrStr:r,val:i}},el.prototype.buildAttrPairStr=function(e,t){return t=this.options.attributeValueProcessor(e,""+t),t=this.replaceEntitiesValue(t),this.options.suppressBooleanAttributes&&"true"===t?" "+e:" "+e+'="'+t+'"'},el.prototype.buildObjectNode=function(e,t,n,r){if(""===e)return"?"===t[0]?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let i="</"+t+this.tagEndChar,o="";return"?"===t[0]&&(o="?",i=""),!n&&""!==n||-1!==e.indexOf("<")?!1!==this.options.commentPropName&&t===this.options.commentPropName&&0===o.length?this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine:this.indentate(r)+"<"+t+n+o+this.tagEndChar+e+this.indentate(r)+i:this.indentate(r)+"<"+t+n+o+">"+e+i}},el.prototype.closeTag=function(e){let t="";return-1!==this.options.unpairedTags.indexOf(e)?this.options.suppressUnpairedNode||(t="/"):t=this.options.suppressEmptyNode?"/":`></${e}`,t},el.prototype.buildTextValNode=function(e,t,n,r){if(!1!==this.options.cdataPropName&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(!1!==this.options.commentPropName&&t===this.options.commentPropName)return this.indentate(r)+`\x3c!--${e}--\x3e`+this.newLine;if("?"===t[0])return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(t,e);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+i+"</"+t+this.tagEndChar}},el.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let t=0;t<this.options.entities.length;t++){const n=this.options.entities[t];e=e.replace(n.regex,n.val)}return e};for(var il={XMLParser:ja,XMLValidator:Ps,XMLBuilder:el},ol=[],sl=0;sl<256;++sl)ol.push((sl+256).toString(16).slice(1));"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);class al extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}class ll extends al{constructor(e){super(e)}}class cl extends al{constructor(e){super(e)}}const dl=e=>e.Id.IBAN?{iban:e.Id.IBAN}:{...e.Id?.Othr?.Id&&{accountNumber:String(e.Id.Othr.Id)},...e.Nm&&{name:e.Nm},...e.Ccy&&{currency:e.Ccy}},ul=e=>e.FinInstnId.BIC?{bic:e.FinInstnId.BIC}:e.FinInstnId.BICFI?{bic:e.FinInstnId.BICFI}:{abaRoutingNumber:(e.FinInstnId.Othr?.Id||e.FinInstnId.ClrSysMmbId.MmbId).toString()},hl=(e,t="USD")=>{const n=Ms({currency:t});return Math.floor(Number(e)*10**n.getPrecision())},fl=e=>{const t=e.DtTm||e.Dt;return new Date(t)},ml=e=>{const t=e.Id.toString(),n=e.ElctrncSeqNb,r=e.LglSeqNb,i=new Date(e.CreDtTm);let o,s;e.FrToDt&&(o=new Date(e.FrToDt.FrDtTm),s=new Date(e.FrToDt.ToDtTm));const a=e.TxsSummry?.TtlNtries.NbOfNtries,l=e.TxsSummry?.TtlNtries.Sum,c=e.TxsSummry?.TtlNtries.TtlNetNtryAmt;let d;c&&(d=hl(c));const u=e.TxsSummry?.TtlCdtNtries.NbOfNtries,h=e.TxsSummry?.TtlCdtNtries.Sum,f=e.TxsSummry?.TtlDbtNtries.NbOfNtries,m=e.TxsSummry?.TtlDbtNtries.Sum,p=dl(e.Acct),g=ul(e.Acct.Svcr);let w=[];Array.isArray(e.Bal)?w=e.Bal.map(pl):e.Bal&&(w=[pl(e.Bal)]);let y=[];return Array.isArray(e.Ntry)?y=e.Ntry.map(gl):e.Ntry&&(y=[gl(e.Ntry)]),{id:t,electronicSequenceNumber:n,legalSequenceNumber:r,creationDate:i,fromDate:o,toDate:s,account:p,agent:g,numOfEntries:a,sumOfEntries:l,netAmountOfEntries:d,numOfCredits:u,sumOfCredits:h,numOfDebits:f,sumOfDebits:m,balances:w,entries:y}},pl=e=>{const t=e.Amt["#text"],n=e.Amt["@_Ccy"],r=hl(t,n),i="CRDT"===e.CdtDbtInd?"credit":"debit",o=e.Tp.CdOrPrtry.Cd;return{date:fl(e.Dt),amount:r,currency:n,creditDebitIndicator:i,type:o}},gl=e=>{const t=e.NtryRef,n="CRDT"===e.CdtDbtInd?"credit":"debit",r=fl(e.BookgDt),i=!0===e.RvslInd,o=e.Amt["#text"],s=e.Amt["@_Ccy"],a=hl(o,s),l=e.BkTxCd.Prtry?.Cd,c=(e=>{if(e)return Array.isArray(e)?e.join("\n"):e})(e.AddtlNtryInf),d=e.AcctSvcrRef,u=yl(e.BkTxCd);let h=e.NtryDtls||[];Array.isArray(h)||(h=[h]);return{referenceId:t,creditDebitIndicator:n,bookingDate:r,reversal:i,amount:a,currency:s,proprietaryCode:l,transactions:h.map(e=>{let t=e.TxDtls||[];return Array.isArray(t)||(t=[t]),t.map(wl)}).flat(),additionalInformation:c,accountServicerReferenceId:d,bankTransactionCode:u}},wl=e=>{const t=e.Refs?.MsgId,n=e.Refs?.AcctSvcrRef,r=e.Refs?.PmtInfId,i=e.RmtInf?.Ustrd,o=e.Purp?.Prtry,s=e.RtrInf?.Rsn,a=e.RtrInf?.AddtlInf,l=e.Refs?.EndToEndId;let c,d,u,h,f,m,p,g;return e.RltdPties?.Dbtr&&(d=e.RltdPties.Dbtr.Nm),e.RltdPties?.DbtrAcct&&(u=dl(e.RltdPties.DbtrAcct)),e.RltdAgts?.DbtrAgt&&(h=ul(e.RltdAgts.DbtrAgt)),(d||u||h)&&(c={name:d,account:u,agent:h}),e.RltdPties?.Cdtr&&(m=e.RltdPties.Cdtr.Nm),e.RltdPties?.CdtrAcct&&(p=dl(e.RltdPties.CdtrAcct)),e.RltdAgts?.CdtrAgt&&(g=ul(e.RltdAgts.CdtrAgt)),(m||p||g)&&(f={name:m,account:p,agent:g}),{messageId:t,accountServicerReferenceId:n,endToEndId:l,paymentInformationId:r,remittanceInformation:i,proprietaryPurpose:o,returnReason:s,returnAdditionalInformation:a,debtor:c,creditor:f}},yl=e=>{const t=e?.Domn?.Cd,n=e?.Domn?.Fmly?.Cd,r=e?.Domn?.Fmly?.SubFmlyCd,i=e.Prtry?.Cd,o=e.Prtry?.Issr;return{domainCode:t,domainFamilyCode:n,domainSubFamilyCode:r,proprietaryCode:i,proprietaryCodeIssuer:o}};class vl{_messageId;_creationDate;_recipient;_statements;constructor(e){this._messageId=e.messageId,this._creationDate=e.creationDate,this._recipient=e.recipient,this._statements=e.statements}static getParser(){return new il.XMLParser({ignoreAttributes:!1,tagValueProcessor:(e,t,n,r,i)=>{if(!i||!["Cd","NtryRef"].includes(e))return t}})}static fromXML(e){const t=vl.getParser().parse(e);if(!t.Document)throw new ll("Invalid XML format");if(!(t.Document["@_xmlns"]||t.Document["@_Xmlns"]).startsWith("urn:iso:std:iso:20022:tech:xsd:camt.053.001."))throw new cl("Invalid CAMT.053 namespace");const n=t.Document.BkToCstmrStmt,r=n.GrpHdr.CreDtTm,i=new Date(r);let o=[];o=Array.isArray(n.Stmt)?n.Stmt.map(e=>ml(e)):[ml(n.Stmt)];const s=n.GrpHdr.MsgRcpt;return new vl({messageId:n.GrpHdr.MsgId.toString(),creationDate:i,recipient:s?(a=s,{id:a.Id?.OrgId?.Othr?.Id,name:a.Nm}):void 0,statements:o});var a}get balances(){return this._statements.flatMap(e=>e.balances)}get transactions(){return this._statements.flatMap(e=>e.entries).flatMap(e=>e.transactions)}get entries(){return this._statements.flatMap(e=>e.entries)}get messageId(){return this._messageId}get recipient(){return this._recipient}get creationDate(){return this._creationDate}get statements(){return this._statements}}function Il(e){let t,n,r,i,o;function s(t){e[13](t)}let a={class:e[0],id:e[1],name:e[2],accept:".xml",max:"1",beforeChange:e[9]};return void 0!==e[3]&&(a.files=e[3]),t=new e[5]({props:a}),ee.push(()=>Ee(t,"files",s)),t.$on("change",e[8]),i=new e[6]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ae(t.$$.fragment),r=P(),Ae(i.$$.fragment)},m(e,n){$e(t,e,n),R(e,r,n),$e(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),!n&&8&r&&(n=!0,o.files=e[3],le(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),16&r&&(s.value=e[4]),i.$set(s)},i(e){o||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function _l(e){let t,n;return t=new e[6]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1&n&&(r.inputClass=e[0]),2&n&&(r.id=e[1]),2&n&&(r.name=e[1]),16&n&&(r.value=e[4]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Cl(e){let t,n,r,i;const o=[_l,Il],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function El(e,t,n){const{FileDropzone:r,TextField:i}=c,o=K();let{classId:s}=t,{eventId:a}=t,{record:l}=t,{item:d}=t,{id:u}=t,{name:h}=t;const f="camt53"===d.properties?.type;let m=[],p=l[d.name]||"",g=!!l._id;const w=async(e,t)=>{const n=[],r=await(async e=>vl.fromXML(e))(t);console.log("json",r);for(const e of r._statements){new Date(e.creationDate).toISOString();for(const t of e.entries)for(const e of t.transactions){const e={};n.push(e)}}n.length&&o("record",{itemName:e,value:n})},y=e=>{if(!e?.length)return"";if(e.length<14)return"";const t=e.replaceAll(" ","").slice(-14),n=t.slice(-8),r=t.slice(0,4);let i="";for(let e=0;e<r.length/2;e++){const t=2*e,n=r.substring(t,t+2);i+=String.fromCharCode(n)}return i+n};return e.$$set=e=>{"classId"in e&&n(0,s=e.classId),"eventId"in e&&n(10,a=e.eventId),"record"in e&&n(11,l=e.record),"item"in e&&n(12,d=e.item),"id"in e&&n(1,u=e.id),"name"in e&&n(2,h=e.name)},[s,u,h,m,p,r,i,g,async()=>{const{list:e}=d.properties,t=m[0];if(t){n(4,p=t.name);const r=await t.text();if(f)return w(e,r);const i=(e=>{var t={toObj:function(e){var n={};if(1==e.nodeType){if(e.attributes.length)for(var r=0;r<e.attributes.length;r++)n["@"+e.attributes[r].nodeName]=(e.attributes[r].nodeValue||"").toString();if(e.firstChild){for(var i=0,o=0,s=!1,a=e.firstChild;a;a=a.nextSibling)1==a.nodeType?s=!0:3==a.nodeType&&a.nodeValue.match(/[^ \f\n\r\t\v]/)?i++:4==a.nodeType&&o++;if(s)if(i<2&&o<2)for(t.removeWhite(e),a=e.firstChild;a;a=a.nextSibling)3==a.nodeType?n["#text"]=t.escape(a.nodeValue):4==a.nodeType?n["#cdata"]=t.escape(a.nodeValue):n[a.nodeName]?n[a.nodeName]instanceof Array?n[a.nodeName][n[a.nodeName].length]=t.toObj(a):n[a.nodeName]=[n[a.nodeName],t.toObj(a)]:n[a.nodeName]=t.toObj(a);else e.attributes.length?n["#text"]=t.escape(t.innerXml(e)):n=t.escape(t.innerXml(e));else if(i)e.attributes.length?n["#text"]=t.escape(t.innerXml(e)):n=t.escape(t.innerXml(e));else if(o)if(o>1)n=t.escape(t.innerXml(e));else for(a=e.firstChild;a;a=a.nextSibling)n["#cdata"]=t.escape(a.nodeValue)}e.attributes.length||e.firstChild||(n=null)}else 9==e.nodeType&&(n=t.toObj(e.documentElement));return n},toJson:function(e,n,r){var i=n?'"'+n+'"':"";if(e instanceof Array){for(var o=0,s=e.length;o<s;o++)e[o]=t.toJson(e[o],"",r+"\t");i+=(n?":[":"[")+(e.length>1?"\n"+r+"\t"+e.join(",\n"+r+"\t")+"\n"+r:e.join(""))+"]"}else if(null==e)i+=(n&&":")+"null";else if("object"==typeof e){var a=[];for(var l in e)a[a.length]=t.toJson(e[l],l,r+"\t");i+=(n?":{":"{")+(a.length>1?"\n"+r+"\t"+a.join(",\n"+r+"\t")+"\n"+r:a.join(""))+"}"}else i+="string"==typeof e?(n&&":")+'"'+e.toString()+'"':(n&&":")+e.toString();return i},innerXml:function(e){var t="";if("innerHTML"in e)t=e.innerHTML;else for(var n=function(e){var t="";if(1==e.nodeType){t+="<"+e.nodeName;for(var r=0;r<e.attributes.length;r++)t+=" "+e.attributes[r].nodeName+'="'+(e.attributes[r].nodeValue||"").toString()+'"';if(e.firstChild){t+=">";for(var i=e.firstChild;i;i=i.nextSibling)t+=n(i);t+="</"+e.nodeName+">"}else t+="/>"}else 3==e.nodeType?t+=e.nodeValue:4==e.nodeType&&(t+="<![CDATA["+e.nodeValue+"]]>");return t},r=e.firstChild;r;r=r.nextSibling)t+=n(r);return t},escape:function(e){return e.replace(/[\\]/g,"\\\\").replace(/[\"]/g,'\\"').replace(/[\n]/g,"\\n").replace(/[\r]/g,"\\r")},removeWhite:function(e){e.normalize();for(var n=e.firstChild;n;)if(3==n.nodeType)if(n.nodeValue.match(/[^ \f\n\r\t\v]/))n=n.nextSibling;else{var r=n.nextSibling;e.removeChild(n),n=r}else 1==n.nodeType?(t.removeWhite(n),n=n.nextSibling):n=n.nextSibling;return e}};return e=(new window.DOMParser).parseFromString(e,"text/xml"),t.toObj(t.removeWhite(e))})(r),s=[],a=i.BkToCstmrDbtCdtNtfctn.Ntfctn,l=[].concat(a.Ntry);for(const e of l){let t=[].concat(e.NtryDtls.TxDtls);for(const n of t){const t=n.RmtInf?.Strd?.CdtrRefInf?.Ref||n.Refs.EndToEndId||"",r={date:e.ValDt.Dt,branchName:n.RltdPties?.Dbtr?.Nm||"",amount:n.AmtDtls?.TxAmt?.Amt["#text"]||n.Amt["#text"],reference:t,invoiceId:y(t),information:n.RmtInf?.Ustrd||""};s.push(r)}}s.length&&o("record",{itemName:e,value:s})}},()=>{n(3,m)},a,l,d,function(e){m=e,n(3,m)}]}class Al extends Te{constructor(e){var t;super(),document.getElementById("svelte-157hlzf-style")||((t=O("style")).id="svelte-157hlzf-style",t.textContent="label.file-dropzone{margin-top:0 !important}",N(document.head,t)),Se(this,e,El,Cl,$,{classId:0,eventId:10,record:11,item:12,id:1,name:2})}}const $l=e=>{const t={},n=e.replaceAll("\r","").split("\n");return n?(t.iban=n[3],t.supplierText=n[5]+", "+n[6]+", "+n[7]+", "+n[8]+", "+n[9],t.supplier={company:{}},t.supplier.company.companyName=n[5],t.supplier.company.postcode=n[8],t.amount=n[18],t.amountOrg=n[18],t.currency={},t.currency.designation=n[19],t.reference=n[28],t.additionalInfo=n[29],t.extReference=bl(10,n[31]),t.amountVat=Sl(bl(32,n[31]),t.amount)||Sl(bl(33,n[31]),t.amount),t):t},bl=(e,t)=>{if(!e)return"";if(!t)return"";const n=t.split("/"+e+"/")[1];return n?.split("/")[0]||""},Sl=(e,t)=>{if(!e)return"";let n=0;if(e.includes(":")){const t=e.split(";");for(const e of t)n+=e.split(":")[1]}else n=+t/(+e+100)*+e;return n},{document:Tl}=_e;function Nl(e){let t,n,r,i,o;function s(t){e[14](t)}let a={class:e[0],id:e[1],name:e[2],accept:"application/pdf",max:"1",beforeChange:e[10]};return void 0!==e[3]&&(a.files=e[3]),t=new e[5]({props:a}),ee.push(()=>Ee(t,"files",s)),t.$on("change",e[8]),i=new e[6]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[4]}}),{c(){Ae(t.$$.fragment),r=P(),Ae(i.$$.fragment)},m(e,n){$e(t,e,n),R(e,r,n),$e(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),!n&&8&r&&(n=!0,o.files=e[3],le(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),16&r&&(s.value=e[4]),i.$set(s)},i(e){o||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function Rl(e){let t,n,r,i;n=new e[6]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[4]}});let o=e[4]&&Dl(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o&&o.c(),z(t,"position","relative")},m(e,s){R(e,t,s),$e(n,t,null),N(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};1&r&&(i.inputClass=e[0]),2&r&&(i.id=e[1]),2&r&&(i.name=e[1]),16&r&&(i.value=e[4]),n.$set(i),e[4]?o?(o.p(e,r),16&r&&we(o,1)):(o=Dl(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,()=>{o=null}),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function Dl(e){let t,n,r,i,o;return n=new De({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-o0hiko")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function xl(e){let t,n,r,i;const o=[Rl,Nl],s=[];return t=function(e){return e[7]?0:1}(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[t]){n.p(e,t)},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}let Ol;function kl(e,n,r){const{FileDropzone:i,TextField:o}=c,s=K();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:h}=n,{name:f}=n,m=[],p=d[u.name]||"",g=!!d._id;const w={scale:{once:!1,value:1,start:1,step:.2,stop:1.6},resultOpts:{singleCodeInPage:!0,multiCodesInPage:!1,maxCodesInPage:1},improve:!0,jsQR:{}};var y=async function(e){if(!e.success)return;const n=await t.getSchema(l),i=e.codes?.filter(e=>!!e)?.at(0);if(!i?.length)return;if(!i.startsWith("SPC"))return;const o=$l(i);for(const e in o){if(n.items.find(t=>t.name===e)){if("object"==typeof o[e]){let n={};for(const i in o[e])if("object"==typeof o[e][i])for(const s in o[e][i]){o[e][i][s]&&(n[s]=o[e][i][s]);const a=await t.getSectionView(i,n);if(a?.length){const n=await t.getSectionView(e,{[i]:a[0]._id});n?.length&&r(11,d[e]=n[0]._id,d)}}else{o[e][i]&&(n[i]=o[e][i]);const s=await t.getSectionView(e,n);s?.length&&r(11,d[e]=s[0]._id,d)}}else o[e]&&r(11,d[e]=o[e],d);s("record",{itemName:e,value:d[e]})}}};return Y(()=>{if(Ol)return;let e=document.createElement("script");e.src="/QR/pdf-qr2.js",document.head.append(e),e.onload=function(){Ol=PDF_QR_JS}}),Z(()=>{}),e.$$set=e=>{"classId"in e&&r(0,a=e.classId),"eventId"in e&&r(12,l=e.eventId),"record"in e&&r(11,d=e.record),"item"in e&&r(13,u=e.item),"id"in e&&r(1,h=e.id),"name"in e&&r(2,f=e.name)},[a,h,f,m,p,i,o,g,async e=>{const n=m[0];if(!n){s("record",{itemName:"$file",value:!1});const e=await t.getSchema(l);for(const t of e.items)s("record",{itemName:t.name,value:""});return}const i=URL.createObjectURL(n);r(4,p=n.name),s("record",{itemName:"$file",value:{fileName:p,file:n}}),Ol.decodeDocument(i,w,y)},async()=>{if(!d?._id)return;const e=await t.getTaskByDocId(d._id,!0);if(!e)return;const n=await t.getUserReports(e._id);if(!n?.length)return;let r="/viewer/doc/index.html?file="+("/api/userreport/"+n[0]._id)+"&type=pdf";window.open(r,"","popup=yes toolbar=no width=800 height=1024")},()=>{r(3,m)},d,l,u,function(e){m=e,r(3,m)}]}class Ml extends Te{constructor(e){var t;super(),Tl.getElementById("svelte-o0hiko-style")||((t=O("style")).id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",N(Tl.head,t)),Se(this,e,kl,xl,$,{classId:0,eventId:12,record:11,item:13,id:1,name:2})}}const{document:Pl}=_e;function Bl(e){let t,n,r,i,o;function s(t){e[18](t)}let a={class:e[0],id:e[1],name:e[2],accept:e[3],max:"1",beforeChange:e[12]};return void 0!==e[4]&&(a.files=e[4]),t=new e[7]({props:a}),ee.push(()=>Ee(t,"files",s)),t.$on("change",e[9]),i=new e[8]({props:{inputClass:e[0],hidden:!0,id:e[1],name:e[1],value:e[5]}}),{c(){Ae(t.$$.fragment),r=P(),Ae(i.$$.fragment)},m(e,n){$e(t,e,n),R(e,r,n),$e(i,e,n),o=!0},p(e,r){const o={};1&r&&(o.class=e[0]),2&r&&(o.id=e[1]),4&r&&(o.name=e[2]),8&r&&(o.accept=e[3]),!n&&16&r&&(n=!0,o.files=e[4],le(()=>n=!1)),t.$set(o);const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.id=e[1]),2&r&&(s.name=e[1]),32&r&&(s.value=e[5]),i.$set(s)},i(e){o||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(r),be(i,e)}}}function Ll(e){let t,n,r,i;n=new e[8]({props:{inputClass:e[0],readonly:!0,id:e[1],name:e[1],value:e[5]}});let o=e[5]&&Fl(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o&&o.c(),z(t,"position","relative")},m(e,s){R(e,t,s),$e(n,t,null),N(t,r),o&&o.m(t,null),i=!0},p(e,r){const i={};1&r&&(i.inputClass=e[0]),2&r&&(i.id=e[1]),2&r&&(i.name=e[1]),32&r&&(i.value=e[5]),n.$set(i),e[5]?o?(o.p(e,r),32&r&&we(o,1)):(o=Fl(e),o.c(),we(o,1),o.m(t,null)):o&&(pe(),ye(o,1,1,()=>{o=null}),ge())},i(e){i||(we(n.$$.fragment,e),we(o),i=!0)},o(e){ye(n.$$.fragment,e),ye(o),i=!1},d(e){e&&D(t),be(n),o&&o.d()}}}function Fl(e){let t,n,r,i,o;const s=[Ul,Vl],a=[];function l(e,n){return 32&n&&(t=!!e[5].endsWith(".mp4")),t?0:1}return n=l(e,-1),r=a[n]=s[n](e),{c(){r.c(),i=B()},m(e,t){a[n].m(e,t),R(e,i,t),o=!0},p(e,t){let o=n;n=l(e,t),n===o?a[n].p(e,t):(pe(),ye(a[o],1,1,()=>{a[o]=null}),ge(),r=a[n],r?r.p(e,t):(r=a[n]=s[n](e),r.c()),we(r,1),r.m(i.parentNode,i))},i(e){o||(we(r),o=!0)},o(e){ye(r),o=!1},d(e){a[n].d(e),e&&D(i)}}}function Vl(e){let t,n,r,i,o;return n=new De({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-o0hiko")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[10]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Ul(e){let t,n={ctx:e,current:null,token:null,hasCatch:!1,pending:zl,then:Wl,catch:Hl,value:23};return ve(e[11](),n),{c(){t=B(),n.block.c()},m(e,r){R(e,t,r),n.block.m(e,n.anchor=r),n.mount=()=>t.parentNode,n.anchor=t},p(t,r){Ie(n,e=t,r)},i:I,o:I,d(e){e&&D(t),n.block.d(e),n.token=null,n=null}}}function Hl(e){return{c:I,m:I,p:I,d:I}}function Wl(e){let t,n,r,i;return{c(){t=O("video"),n=O("source"),i=M("\n Your browser does not support HTML video."),n.src!==(r=e[23])&&U(n,"src",r),U(n,"type","video/mp4"),U(t,"width","500"),t.controls=!0,z(t,"margin-top","1em")},m(e,r){R(e,t,r),N(t,n),N(t,i)},p:I,d(e){e&&D(t)}}}function zl(e){return{c:I,m:I,p:I,d:I}}function jl(e){let t,n,r,i;const o=[Ll,Bl],s=[];function a(e,t){return e[6]?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,[i]){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function ql(e,n,r){const{FileDropzone:i,TextField:o}=c,s=K();let{classId:a}=n,{eventId:l}=n,{record:d}=n,{item:u}=n,{id:h}=n,{name:f}=n,{praefix:m}=n,{recordId:p}=n,{fileType:g="application/pdf"}=n,w=[],y="",v=!1;return Y(()=>{(async()=>{if(!p)return;const e=await t.getTaskByDocId(p,!0);if(!e)return s("listRecord",{itemName:"fileName",value:"",string:!0});const n=d[u.name];if(!n)return s("listRecord",{itemName:"fileName",value:"",string:!0});const i=await t.getUserReports(e._id);if(!i?.length)return s("listRecord",{itemName:"fileName",value:"",string:!0});let o=i.find(e=>e.fileName===n);if(!o)return s("listRecord",{itemName:"fileName",value:"",string:!0});r(5,y=o.fileName),r(6,v=void 0===m?!!p:!!y)})()}),Z(()=>{}),e.$$set=e=>{"classId"in e&&r(0,a=e.classId),"eventId"in e&&r(13,l=e.eventId),"record"in e&&r(14,d=e.record),"item"in e&&r(15,u=e.item),"id"in e&&r(1,h=e.id),"name"in e&&r(2,f=e.name),"praefix"in e&&r(16,m=e.praefix),"recordId"in e&&r(17,p=e.recordId),"fileType"in e&&r(3,g=e.fileType)},[a,h,f,g,w,y,v,i,o,async e=>{const t=w[0];URL.createObjectURL(t),r(5,y=t.name),s("record",{itemName:"$file",value:{fileName:y,file:t}}),void 0!==m&&s("listRecord",{itemName:"fileName",value:y,string:!0})},async()=>{if(!p)return;let e;const n=await t.getTaskByDocId(p,!0);if(!n)return;const r=await t.getUserReports(n._id);if(!r?.length)return;let i=r.find(e=>e.fileName===y);i||(i=r[0]);e="/viewer/doc/index.html?file="+("/api/userreport/"+i._id)+"&type=pdf",window.open(e,"","popup=yes toolbar=no width=800 height=1024")},async()=>{const e=await t.getTaskByDocId(p,!0);if(!e)return"";const n=await t.getUserReports(e._id);if(!n?.length)return"";let r=n.find(e=>e.fileName===y);return r||(r=n[0]),"/api/userreport/"+r._id},()=>{r(4,w)},l,d,u,m,p,function(e){w=e,r(4,w)}]}class Gl extends Te{constructor(e){var t;super(),Pl.getElementById("svelte-o0hiko-style")||((t=O("style")).id="svelte-o0hiko-style",t.textContent=".feather.svelte-o0hiko{position:absolute;top:0.75em;left:-1.25em;color:#4300b0}label.file-dropzone{margin-top:0 !important}",N(Pl.head,t)),Se(this,e,ql,jl,$,{classId:0,eventId:13,record:14,item:15,id:1,name:2,praefix:16,recordId:17,fileType:3})}}function Xl(e){let t,n,r;return n=new e[5]({props:{type:"string",inputClass:e[2],id:e[0],name:e[0],value:e[1],pattern:Yl,placeholder:Zl,readonly:e[3],disabled:e[4]}}),n.$on("change",e[6]),{c(){t=O("div"),Ae(n.$$.fragment),z(t,"max-width","4em")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p(e,[t]){const r={};4&t&&(r.inputClass=e[2]),1&t&&(r.id=e[0]),1&t&&(r.name=e[0]),2&t&&(r.value=e[1]),8&t&&(r.readonly=e[3]),16&t&&(r.disabled=e[4]),n.$set(r)},i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}const Yl="([01][0-9]|2[0-3]):([0-5][0-9])",Zl="";function Kl(e,t,n){const r=K(),{TextField:i}=c;let{id:o}=t,{item:s}=t,{value:a}=t,{inputClass:l}=t,{readonly:d}=t,{disabled:u}=t,{praefix:h}=t;const f=e=>{if(!e)return"";const[t,n]=e.split(":");return 4===t.length?`${t.substr(0,2)}:${t.substring(2,4)}`:3===t.length?t.substring(0,2)>23?`0${t.substring(0,1)}:${t.substring(1,3)}`:`${t.substring(0,2)}:${t.substring(2,3)}0`:2===t.length?t>23?`0${t.substring(0,1)}:${t.substring(1,2)}0`:`${t}:${(n||"0").padStart(2,"0")}`:`0${t}:${(n||"0").padStart(2,"0")}`};return e.$$set=e=>{"id"in e&&n(0,o=e.id),"item"in e&&n(7,s=e.item),"value"in e&&n(1,a=e.value),"inputClass"in e&&n(2,l=e.inputClass),"readonly"in e&&n(3,d=e.readonly),"disabled"in e&&n(4,u=e.disabled),"praefix"in e&&n(8,h=e.praefix)},[o,a,l,d,u,i,({detail:e})=>{r("blur",{value:f(e.value)}),r("checkRange",{idx:h,fieldId:o,value:e.value})},s,h]}class Ql extends Te{constructor(e){var t;super(),document.getElementById("svelte-vvt0yv-style")||((t=O("style")).id="svelte-vvt0yv-style",t.textContent=".text-field input.invalid{border:1px red solid !important}",N(document.head,t)),Se(this,e,Kl,Xl,$,{id:0,item:7,value:1,inputClass:2,readonly:3,disabled:4,praefix:8})}}const{document:Jl}=_e;function ec(e,t,n){const r=e.slice();return r[20]=t[n],r}function tc(e,t,n){const r=e.slice();return r[23]=t[n],r[25]=n,r}function nc(e){let t,n,r=e[2](e[20],e[23])+"",i=e[25]&&function(){let e;return{c(){e=M(", ")},m(t,n){R(t,e,n)},d(t){t&&D(e)}}}();return{c(){t=O("span"),i&&i.c(),n=M(r),U(t,"class","lookupValue")},m(e,r){R(e,t,r),i&&i.m(t,null),N(t,n)},p(e,t){3&t&&r!==(r=e[2](e[20],e[23])+"")&&H(n,r)},d(e){e&&D(t),i&&i.d()}}}function rc(e){let t,n,r,i,o,s,a,l,c=e[0],d=[];for(let t=0;t<c.length;t+=1)d[t]=nc(tc(e,c,t));return i=new it({props:{size:"18"}}),{c(){t=O("div");for(let e=0;e<d.length;e+=1)d[e].c();n=P(),r=O("span"),Ae(i.$$.fragment),o=P(),U(r,"class","feather pointer svelte-1r8jgd4"),U(t,"class","lookupItem svelte-1r8jgd4")},m(c,u){R(c,t,u);for(let e=0;e<d.length;e+=1)d[e].m(t,null);N(t,n),N(t,r),$e(i,r,null),N(t,o),s=!0,a||(l=L(r,"click",function(){A(e[3](e[20]._id))&&e[3](e[20]._id).apply(this,arguments)}),a=!0)},p(r,i){if(e=r,7&i){let r;for(c=e[0],r=0;r<c.length;r+=1){const o=tc(e,c,r);d[r]?d[r].p(o,i):(d[r]=nc(o),d[r].c(),d[r].m(t,n))}for(;r<d.length;r+=1)d[r].d(1);d.length=c.length}},i(e){s||(we(i.$$.fragment,e),s=!0)},o(e){ye(i.$$.fragment,e),s=!1},d(e){e&&D(t),x(d,e),be(i),a=!1,l()}}}function ic(e){let t,n,r=e[1],i=[];for(let t=0;t<r.length;t+=1)i[t]=rc(ec(e,r,t));const o=e=>ye(i[e],1,1,()=>{i[e]=null});return{c(){t=O("div");for(let e=0;e<i.length;e+=1)i[e].c();U(t,"class","lookup svelte-1r8jgd4")},m(e,r){R(e,t,r);for(let e=0;e<i.length;e+=1)i[e].m(t,null);n=!0},p(e,[n]){if(15&n){let s;for(r=e[1],s=0;s<r.length;s+=1){const o=ec(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=rc(o),i[s].c(),we(i[s],1),i[s].m(t,null))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){e&&D(t),x(i,e)}}}function oc(e,n,r){let{id:i}=n,{item:o}=n,{praefix:s}=n,{record:a}=n,{notifyList:l}=n;const{refItem:c,view:d,beforeSave:u,_state:h}=o.properties;let f=d.split(","),[p,g]=c.split(":"),w=[];const[y,v]=g.split("."),I=(e,t)=>{const[n,r]=t.split(".");return r?e[n][r]:""},_=(e=!0)=>{se().then(()=>{const t=document.querySelector("div.form-field."+o.name);if(t&&(t.style.display=e?"none":"flex"),!e&&u){const e=t.querySelector("div label");e&&(e.style.color="red")}})};return Y(_),e.$$set=e=>{"id"in e&&r(4,i=e.id),"item"in e&&r(5,o=e.item),"praefix"in e&&r(6,s=e.praefix),"record"in e&&r(7,a=e.record),"notifyList"in e&&r(8,l=e.notifyList)},e.$$.update=()=>{256&e.$$.dirty&&(async e=>{const{itemName:n,value:i}=e||{};if(n!==p)return;if(r(1,w=[]),!i)return;if(!!u==!!a._id)return _();if(!a._id&&!a[p])return _();const o=!f.some(e=>e.includes(":")),s=v?v+"."+p:p;let l={[s]:a[p]||a._id};if(h&&(l=[{$match:l},{$addFields:{_ids:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_ids",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:{"_task.status":h}}]),r(1,w=await t.getSectionView(y,l,o)),!o&&w.length){const e=f.find(e=>e.includes(":")),t=e.split(":")[0];r(1,w=w.map(e=>{const n=e[t].find(e=>e[t]===a._id);return n._id=e._id,n})),r(0,f=f.map(e=>e.split(":")[1]))}_(!w.length)})(l)},[f,w,(e,t)=>"boolean"===o.type?e[t]?"ja":"nein":"object"===o.type?"(ja)":e["_"+t]||m(e[t])||e[t]||I(e,t),e=>async()=>{const n=await t.getTaskByDocId(e,!0);if(!n)return;const r=n._id,i=`/task/${n.event}/${r}/task?view=standalone`;window.open(i)},i,o,s,a,l]}class sc extends Te{constructor(e){var t;super(),Jl.getElementById("svelte-1r8jgd4-style")||((t=O("style")).id="svelte-1r8jgd4-style",t.textContent=".feather.svelte-1r8jgd4{position:absolute;top:0;left:-1.5em;color:#4300b0}div.lookup.svelte-1r8jgd4{margin-top:0.75em;color:#aaa}div.lookupItem.svelte-1r8jgd4{position:relative;margin-left:2em;padding-bottom:0.75em}div.form-field:has(div.lookup){margin-bottom:0.5em !important}div.field:has(div.lookupItem){background-color:#f5f5f5 !important}div.field:has(div.lookup){margin-bottom:0.25em !important}",N(Jl.head,t)),Se(this,e,oc,ic,$,{id:4,item:5,praefix:6,record:7,notifyList:8})}}function ac(e){let t,n,r;return n=new dt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function lc(e){let t,n,r,i,o;return n=new dt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[9]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function cc(e){let t,n,r,i,o,s;n=new e[8]({props:{inputClass:e[0],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],value:e[7]}}),n.$on("change",e[10]);const a=[lc,ac],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),$e(n,t,null),N(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(pe(),ye(l[d],1,1,()=>{l[d]=null}),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function dc(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:h}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,h=e.value)},[i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;let e=h;e.includes("//")||(e="//"+e),window.open(e,"_blank")},function(t){Q(e,t)}]}class uc extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",N(document.head,t)),Se(this,e,dc,cc,$,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7})}}function hc(e){let t,n,r;return n=new Ct({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function fc(e){let t,n,r,i,o;return n=new Ct({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[11]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function mc(e){let t,n,r,i,o,s;n=new e[10]({props:{inputClass:e[2],pattern:e[0],placeholder:e[1],disabled:e[3],formnovalidate:e[4],readonly:e[5],required:e[6],id:e[7],name:e[8],value:e[9]}}),n.$on("change",e[12]);const a=[fc,hc],l=[];function c(e,t){return e[9]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),$e(n,t,null),N(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};4&r&&(s.inputClass=e[2]),1&r&&(s.pattern=e[0]),2&r&&(s.placeholder=e[1]),8&r&&(s.disabled=e[3]),16&r&&(s.formnovalidate=e[4]),32&r&&(s.readonly=e[5]),64&r&&(s.required=e[6]),128&r&&(s.id=e[7]),256&r&&(s.name=e[8]),512&r&&(s.value=e[9]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(pe(),ye(l[d],1,1,()=>{l[d]=null}),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function pc(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:h}=t,{pattern:f}=t,{placeholder:m}=t;f||="(\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1))?\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*\\d\\W*(\\d{1,2})$",m||="+41 58 234 56 78";return e.$$set=e=>{"inputClass"in e&&n(2,i=e.inputClass),"disabled"in e&&n(3,o=e.disabled),"formnovalidate"in e&&n(4,s=e.formnovalidate),"readonly"in e&&n(5,a=e.readonly),"required"in e&&n(6,l=e.required),"id"in e&&n(7,d=e.id),"name"in e&&n(8,u=e.name),"value"in e&&n(9,h=e.value),"pattern"in e&&n(0,f=e.pattern),"placeholder"in e&&n(1,m=e.placeholder)},[f,m,i,o,s,a,l,d,u,h,r,async()=>{if(!h)return;let e="tel:"+h;window.open(e,"_self")},function(t){Q(e,t)}]}class gc extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",N(document.head,t)),Se(this,e,pc,mc,$,{inputClass:2,disabled:3,formnovalidate:4,readonly:5,required:6,id:7,name:8,value:9,pattern:0,placeholder:1})}}function wc(e){let t,n,r;return n=new gt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 svelte-9up2nn")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function yc(e){let t,n,r,i,o;return n=new gt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-9up2nn")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[12]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function vc(e){let t,n,r,i,o,s;n=new e[11]({props:{type:"email",inputClass:e[0],pattern:e[9],placeholder:e[10],disabled:e[1],formnovalidate:e[2],readonly:e[3],required:e[4],id:e[5],name:e[6],multiple:e[8],value:e[7]}}),n.$on("change",e[13]);const a=[yc,wc],l=[];function c(e,t){return e[7]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),$e(n,t,null),N(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),512&r&&(s.pattern=e[9]),1024&r&&(s.placeholder=e[10]),2&r&&(s.disabled=e[1]),4&r&&(s.formnovalidate=e[2]),8&r&&(s.readonly=e[3]),16&r&&(s.required=e[4]),32&r&&(s.id=e[5]),64&r&&(s.name=e[6]),256&r&&(s.multiple=e[8]),128&r&&(s.value=e[7]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(pe(),ye(l[d],1,1,()=>{l[d]=null}),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function Ic(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:h}=t,{multiple:f}=t,{pattern:m}=t,{placeholder:p}=t;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(1,o=e.disabled),"formnovalidate"in e&&n(2,s=e.formnovalidate),"readonly"in e&&n(3,a=e.readonly),"required"in e&&n(4,l=e.required),"id"in e&&n(5,d=e.id),"name"in e&&n(6,u=e.name),"value"in e&&n(7,h=e.value),"multiple"in e&&n(8,f=e.multiple),"pattern"in e&&n(9,m=e.pattern),"placeholder"in e&&n(10,p=e.placeholder)},[i,o,s,a,l,d,u,h,f,m,p,r,async()=>{if(!h)return;let e="mailto:"+h;window.open(e,"_self")},function(t){Q(e,t)}]}class _c extends Te{constructor(e){var t;super(),document.getElementById("svelte-9up2nn-style")||((t=O("style")).id="svelte-9up2nn-style",t.textContent=".feather.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:#4300b0;margin-left:-2em}.feather2.svelte-9up2nn{position:absolute;top:0.75em;left:0.5em;color:light-gray;margin-left:-2em}",N(document.head,t)),Se(this,e,Ic,vc,$,{inputClass:0,disabled:1,formnovalidate:2,readonly:3,required:4,id:5,name:6,value:7,multiple:8,pattern:9,placeholder:10})}}const Cc=["Activate","AddUndo","BeforeAddUndo","BeforeExecCommand","BeforeGetContent","BeforeRenderUI","BeforeSetContent","BeforePaste","Blur","Change","ClearUndos","Click","CommentChange","CompositionEnd","CompositionStart","CompositionUpdate","ContextMenu","Copy","Cut","Dblclick","Deactivate","Dirty","Drag","DragDrop","DragEnd","DragGesture","DragOver","Drop","ExecCommand","Focus","FocusIn","FocusOut","GetContent","Hide","Init","Input","KeyDown","KeyPress","KeyUp","LoadContent","MouseDown","MouseEnter","MouseLeave","MouseMove","MouseOut","MouseOver","MouseUp","NodeChange","ObjectResizeStart","ObjectResized","ObjectSelected","Paste","PostProcess","PostRender","PreProcess","ProgressState","Redo","Remove","Reset","ResizeEditor","SaveContent","SelectionChange","SetAttrib","SetContent","Show","Submit","Undo","VisualAid"];function Ec(e){let t;return{c(){t=O("textarea"),U(t,"id",e[0]),z(t,"visibility","hidden")},m(n,r){R(n,t,r),e[20](t)},p(e,n){1&n&&U(t,"id",e[0])},d(n){n&&D(t),e[20](null)}}}function Ac(e){let t;return{c(){t=O("div"),U(t,"id",e[0])},m(n,r){R(n,t,r),e[19](t)},p(e,n){1&n&&U(t,"id",e[0])},d(n){n&&D(t),e[19](null)}}}function $c(e){let t;function n(e,t){return e[1]?Ac:Ec}let r=n(e),i=r(e);return{c(){t=O("div"),i.c(),U(t,"class",e[2])},m(n,r){R(n,t,r),i.m(t,null),e[21](t)},p(e,[o]){r===(r=n(e))&&i?i.p(e,o):(i.d(1),i=r(e),i&&(i.c(),i.m(t,null))),4&o&&U(t,"class",e[2])},i:I,o:I,d(n){n&&D(t),i.d(),e[21](null)}}}const bc=e=>e+"_"+Math.floor(1e9*Math.random())+String(Date.now());let Sc=(()=>{let e={listeners:[],scriptId:bc("tiny-script"),scriptLoaded:!1,injected:!1};return{load:(t,n,r)=>{e.scriptLoaded?r():(e.listeners.push(r),e.injected||((t,n,r,i)=>{e.injected=!0;const o=n.createElement("script");o.referrerPolicy="origin",o.type="application/javascript",o.src=r,o.onload=()=>{i()},n.head&&n.head.appendChild(o)})(e.scriptId,t,n,()=>{e.listeners.forEach(e=>e()),e.scriptLoaded=!0}))}}})();function Tc(e,t,n){let r,i,o,{id:s=bc("tinymce-svelte")}=t,{inline:a}=t,{disabled:l=!1}=t,{readonly:c=!1}=t,{apiKey:d="no-api-key"}=t,{licenseKey:u}=t,{channel:h="7"}=t,{scriptSrc:f}=t,{conf:m={}}=t,{modelEvents:p="change input undo redo"}=t,{value:g=""}=t,{text:w=""}=t,{cssClass:y="tinymce-wrapper"}=t,v=g,I=l,_=c;const C=(e,t)=>{var n;"function"==typeof(null===(n=e.mode)||void 0===n?void 0:n.set)&&e.mode.set(t?"readonly":"design")},E=(e,t)=>{(e=>"function"==typeof e.options.set&&e.options.isRegistered("disabled"))(e)?e.options.set("disabled",t):e.mode.set(t?"readonly":"design")},A=K(),$=()=>{const e="undefined"!=typeof window?window:global;return e&&e.tinymce?e.tinymce:null},b=()=>{var e;const t=Object.assign(Object.assign({},m),{target:i,inline:void 0!==a?a:void 0!==m.inline&&m.inline,license_key:u,setup:e=>{e.on("PreInit",()=>{E(e,l),C(e,c)}),n(15,o=e),e.on("init",()=>{e.setContent(g),e.on(p,()=>{n(16,v=e.getContent()),v!==g&&(n(5,g=v),n(6,w=e.getContent({format:"text"})))})}),((e,t)=>{Cc.forEach(n=>{e.on(n,r=>{t(n.toLowerCase(),{eventName:n,event:r,editor:e})})})})(e,A),"function"==typeof m.setup&&m.setup(e)}});n(4,i.style.visibility="",i),null===(e=$())||void 0===e||e.init(t)};return Y(()=>{if(null!==$())b();else{const e=f||`https://cdn.tiny.cloud/1/${d}/tinymce/${h}/tinymce.min.js`;Sc.load(r.ownerDocument,e,()=>{b()})}}),Z(()=>{var e;o&&(null===(e=$())||void 0===e||e.remove(o))}),e.$$set=e=>{"id"in e&&n(0,s=e.id),"inline"in e&&n(1,a=e.inline),"disabled"in e&&n(7,l=e.disabled),"readonly"in e&&n(8,c=e.readonly),"apiKey"in e&&n(9,d=e.apiKey),"licenseKey"in e&&n(10,u=e.licenseKey),"channel"in e&&n(11,h=e.channel),"scriptSrc"in e&&n(12,f=e.scriptSrc),"conf"in e&&n(13,m=e.conf),"modelEvents"in e&&n(14,p=e.modelEvents),"value"in e&&n(5,g=e.value),"text"in e&&n(6,w=e.text),"cssClass"in e&&n(2,y=e.cssClass)},e.$$.update=()=>{491936&e.$$.dirty&&(o&&v!==g&&(o.setContent(g),n(6,w=o.getContent({format:"text"}))),o&&c!==_&&(n(18,_=c),C(o,c)),o&&l!==I&&(n(17,I=l),E(o,l)))},[s,a,y,r,i,g,w,l,c,d,u,h,f,m,p,o,v,I,_,function(e){ee[e?"unshift":"push"](()=>{i=e,n(4,i)})},function(e){ee[e?"unshift":"push"](()=>{i=e,n(4,i)})},function(e){ee[e?"unshift":"push"](()=>{r=e,n(3,r)})}]}class Nc extends Te{constructor(e){super(),Se(this,e,Tc,$c,$,{id:0,inline:1,disabled:7,readonly:8,apiKey:9,licenseKey:10,channel:11,scriptSrc:12,conf:13,modelEvents:14,value:5,text:6,cssClass:2})}}function Rc(e){let t,n,r,i,o,s,a;function l(t){e[9](t)}let c={scriptSrc:"/tinymce/tinymce.min.js",licenseKey:"gpl",conf:e[7],disabled:e[4],readonly:e[5]};return void 0!==e[0]&&(c.value=e[0]),n=new Nc({props:c}),ee.push(()=>Ee(n,"value",l)),{c(){t=O("div"),Ae(n.$$.fragment),i=P(),o=O("input"),U(o,"class",s=e[1]||e[2]),U(o,"id",e[3]),U(o,"name",e[3]),o.value=e[0],o.hidden=!0,z(t,"min-height","10em"),z(t,"margin-top","-1em")},m(e,r){R(e,t,r),$e(n,t,null),N(t,i),N(t,o),a=!0},p(e,t){const i={};16&t&&(i.disabled=e[4]),32&t&&(i.readonly=e[5]),!r&&1&t&&(r=!0,i.value=e[0],le(()=>r=!1)),n.$set(i),(!a||6&t&&s!==(s=e[1]||e[2]))&&U(o,"class",s),(!a||8&t)&&U(o,"id",e[3]),(!a||8&t)&&U(o,"name",e[3]),(!a||1&t&&o.value!==e[0])&&(o.value=e[0])},i(e){a||(we(n.$$.fragment,e),a=!0)},o(e){ye(n.$$.fragment,e),a=!1},d(e){e&&D(t),be(n)}}}function Dc(e){let t,n,r=e[6]&&Rc(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,[n]){e[6]?r?(r.p(e,n),64&n&&we(r,1)):(r=Rc(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function xc(e,t,r){const i=K();let o=JSON.parse(n.getItem("Locale")).id;o=o.startsWith("fr")?"fr_FR":o.split("-")[0];let s,{value:a=""}=t,{noForm:l}=t,{classId:c}=t,{id:d}=t,{record:u}=t,{disabled:h}=t,{readonly:f}=t;const m=(e,t)=>{if(!s)return;if(!e)return;if(!e.includes("{{"))return;const n=t.employee;if(n)try{ym("employee",n).then(t=>{if(!t)return;const n=e.replace("{{employee.firstName}}",t.firstName).replace("{{employee.lastName}}",t.lastName);i("blur",{value:n})})}catch(e){}},p={plugins:"advlist link image lists table preview emoticons fullscreen",menu:{file:{title:"File",items:"preview"}},menubar:"edit view insert format table",toolbar:"undo redo | styles | bold italic | alignleft aligncenter alignright alignjustify | outdent indent | bullist numlist | fullscreen",height:600,language:o};return Y(()=>setTimeout(()=>{r(6,s=!0),m(a,u)},300)),e.$$set=e=>{"value"in e&&r(0,a=e.value),"noForm"in e&&r(1,l=e.noForm),"classId"in e&&r(2,c=e.classId),"id"in e&&r(3,d=e.id),"record"in e&&r(8,u=e.record),"disabled"in e&&r(4,h=e.disabled),"readonly"in e&&r(5,f=e.readonly)},e.$$.update=()=>{257&e.$$.dirty&&(a||u)&&m(a,u)},[a,l,c,d,h,f,s,p,u,function(e){a=e,r(0,a)}]}class Oc extends Te{constructor(e){var t;super(),document.getElementById("svelte-yi7lpi-style")||((t=O("style")).id="svelte-yi7lpi-style",t.textContent="div.tox-statusbar__text-container, div.tox-promotion{display:none !important}div.tox.tox-tinymce{border:1px #808080 solid}.tox-edit-area__iframe{background-color:#f9f3f6 !important}",N(document.head,t)),Se(this,e,xc,Dc,$,{value:0,noForm:1,classId:2,id:3,record:8,disabled:4,readonly:5})}}
|
|
6
2
|
/*!
|
|
7
|
-
* Signature Pad v5.0.
|
|
3
|
+
* Signature Pad v5.0.10 | https://github.com/szimek/signature_pad
|
|
8
4
|
* (c) 2025 Szymon Nowak | Released under the MIT license
|
|
9
|
-
*/class Point{constructor(t,e,n,r){if(isNaN(t)||isNaN(e))throw new Error(`Point is invalid: (${t}, ${e})`);this.x=+t,this.y=+e,this.pressure=n||0,this.time=r||Date.now()}distanceTo(t){return Math.sqrt(Math.pow(this.x-t.x,2)+Math.pow(this.y-t.y,2))}equals(t){return this.x===t.x&&this.y===t.y&&this.pressure===t.pressure&&this.time===t.time}velocityFrom(t){return this.time!==t.time?this.distanceTo(t)/(this.time-t.time):0}}class Bezier{static fromPoints(t,e){const n=this.calculateControlPoints(t[0],t[1],t[2]).c2,r=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new Bezier(t[1],n,r,t[2],e.start,e.end)}static calculateControlPoints(t,e,n){const r=t.x-e.x,o=t.y-e.y,i=e.x-n.x,a=e.y-n.y,s=(t.x+e.x)/2,c=(t.y+e.y)/2,l=(e.x+n.x)/2,d=(e.y+n.y)/2,u=Math.sqrt(r*r+o*o),h=Math.sqrt(i*i+a*a),m=u+h==0?0:h/(u+h),f=l+(s-l)*m,p=d+(c-d)*m,_=e.x-f,g=e.y-p;return{c1:new Point(s+_,c+g),c2:new Point(l+_,d+g)}}constructor(t,e,n,r,o,i){this.startPoint=t,this.control2=e,this.control1=n,this.endPoint=r,this.startWidth=o,this.endWidth=i}length(){let t,e,n=0;for(let r=0;r<=10;r+=1){const o=r/10,i=this.point(o,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),a=this.point(o,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=i-t,o=a-e;n+=Math.sqrt(r*r+o*o)}t=i,e=a}return n}point(t,e,n,r,o){return e*(1-t)*(1-t)*(1-t)+3*n*(1-t)*(1-t)*t+3*r*(1-t)*t*t+o*t*t*t}}class SignatureEventTarget{constructor(){try{this._et=new EventTarget}catch(t){this._et=document}}addEventListener(t,e,n){this._et.addEventListener(t,e,n)}dispatchEvent(t){return this._et.dispatchEvent(t)}removeEventListener(t,e,n){this._et.removeEventListener(t,e,n)}}function throttle(t,e=250){let n,r,o,i=0,a=null;const s=()=>{i=Date.now(),a=null,n=t.apply(r,o),a||(r=null,o=[])};return function(...c){const l=Date.now(),d=e-(l-i);return r=this,o=c,d<=0||d>e?(a&&(clearTimeout(a),a=null),i=l,n=t.apply(r,o),a||(r=null,o=[])):a||(a=window.setTimeout(s,d)),n}}class SignaturePad extends SignatureEventTarget{constructor(t,e={}){var n,r,o;super(),this.canvas=t,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this._handleMouseDown=t=>{this._isLeftButtonPressed(t,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(t))},this._handleMouseMove=t=>{this._isLeftButtonPressed(t,!0)&&this._drawingStroke?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t)):this._strokeEnd(this._pointerEventToSignatureEvent(t),!1)},this._handleMouseUp=t=>{this._isLeftButtonPressed(t)||this._strokeEnd(this._pointerEventToSignatureEvent(t))},this._handleTouchStart=t=>{1!==t.targetTouches.length||this._drawingStroke||(t.cancelable&&t.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(t)))},this._handleTouchMove=t=>{1===t.targetTouches.length&&(t.cancelable&&t.preventDefault(),this._drawingStroke?this._strokeMoveUpdate(this._touchEventToSignatureEvent(t)):this._strokeEnd(this._touchEventToSignatureEvent(t),!1))},this._handleTouchEnd=t=>{0===t.targetTouches.length&&(t.cancelable&&t.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(t)))},this._handlePointerDown=t=>{!t.isPrimary||!this._isLeftButtonPressed(t)||this._drawingStroke||void 0!==this._strokePointerId&&this._strokePointerId!==this._getPointerId(t)||(this._strokePointerId=this._getPointerId(t),t.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(t)))},this._handlePointerMove=t=>{t.isPrimary&&this._strokePointerId===this._getPointerId(t)&&(this._isLeftButtonPressed(t,!0)&&this._drawingStroke?(t.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))):this._strokeEnd(this._pointerEventToSignatureEvent(t),!1))},this._handlePointerUp=t=>{t.isPrimary&&!this._isLeftButtonPressed(t)&&this._strokePointerId===this._getPointerId(t)&&(this._strokePointerId=void 0,t.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(t)))},this.velocityFilterWeight=e.velocityFilterWeight||.7,this.minWidth=e.minWidth||.5,this.maxWidth=e.maxWidth||2.5,this.throttle=null!==(n=e.throttle)&&void 0!==n?n:16,this.minDistance=null!==(r=e.minDistance)&&void 0!==r?r:5,this.dotSize=e.dotSize||0,this.penColor=e.penColor||"black",this.backgroundColor=e.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=e.compositeOperation||"source-over",this.canvasContextOptions=null!==(o=e.canvasContextOptions)&&void 0!==o?o:{},this._strokeMoveUpdate=this.throttle?throttle(SignaturePad.prototype._strokeUpdate,this.throttle):SignaturePad.prototype._strokeUpdate,this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:t,canvas:e}=this;t.fillStyle=this.backgroundColor,t.clearRect(0,0,e.width,e.height),t.fillRect(0,0,e.width,e.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0}fromDataURL(t,e={}){return new Promise((n,r)=>{const o=new Image,i=e.ratio||window.devicePixelRatio||1,a=e.width||this.canvas.width/i,s=e.height||this.canvas.height/i,c=e.xOffset||0,l=e.yOffset||0;this._reset(this._getPointGroupOptions()),o.onload=()=>{this._ctx.drawImage(o,c,l,a,s),n()},o.onerror=t=>{r(t)},o.crossOrigin="anonymous",o.src=t,this._isEmpty=!1})}toDataURL(t="image/png",e){return"image/svg+xml"===t?("object"!=typeof e&&(e=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(e))}`):("number"!=typeof e&&(e=void 0),this.canvas.toDataURL(t,e))}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const t=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!t?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var t;const e=window.document===this.canvas.ownerDocument?window:null!==(t=this.canvas.ownerDocument.defaultView)&&void 0!==t?t:this.canvas.ownerDocument;return{addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}_removeMoveUpEventListeners(){const{removeEventListener:t}=this._getListenerFunctions();t("pointermove",this._handlePointerMove),t("pointerup",this._handlePointerUp),t("mousemove",this._handleMouseMove),t("mouseup",this._handleMouseUp),t("touchmove",this._handleTouchMove),t("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(t,{clear:e=!0}={}){e&&this.clear(),this._fromData(t,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(t)}toData(){return this._data}_isLeftButtonPressed(t,e){return e?1===t.buttons:!(1&~t.buttons)}_pointerEventToSignatureEvent(t){return{event:t,type:t.type,x:t.clientX,y:t.clientY,pressure:"pressure"in t?t.pressure:0}}_touchEventToSignatureEvent(t){const e=t.changedTouches[0];return{event:t,type:t.type,x:e.clientX,y:e.clientY,pressure:e.force}}_getPointerId(t){return t.persistentDeviceId||t.pointerId}_getPointGroupOptions(t){return{penColor:t&&"penColor"in t?t.penColor:this.penColor,dotSize:t&&"dotSize"in t?t.dotSize:this.dotSize,minWidth:t&&"minWidth"in t?t.minWidth:this.minWidth,maxWidth:t&&"maxWidth"in t?t.maxWidth:this.maxWidth,velocityFilterWeight:t&&"velocityFilterWeight"in t?t.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:t&&"compositeOperation"in t?t.compositeOperation:this.compositeOperation}}_strokeBegin(t){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:t,cancelable:!0})))return;const{addEventListener:e}=this._getListenerFunctions();switch(t.event.type){case"mousedown":e("mousemove",this._handleMouseMove,{passive:!1}),e("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":e("touchmove",this._handleTouchMove,{passive:!1}),e("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":e("pointermove",this._handlePointerMove,{passive:!1}),e("pointerup",this._handlePointerUp,{passive:!1})}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r=Object.assign(Object.assign({},n),{points:[]});this._data.push(r),this._reset(n),this._strokeUpdate(t)}_strokeUpdate(t){if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(t);this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:t}));const e=this._createPoint(t.x,t.y,t.pressure),n=this._data[this._data.length-1],r=n.points,o=r.length>0&&r[r.length-1],i=!!o&&e.distanceTo(o)<=this.minDistance,a=this._getPointGroupOptions(n);if(!o||!o||!i){const t=this._addPoint(e,a);o?t&&this._drawCurve(t,a):this._drawDot(e,a),r.push({time:e.time,x:e.x,y:e.y,pressure:e.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:t}))}_strokeEnd(t,e=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(e&&this._strokeUpdate(t),this._drawingStroke=!1,this.dispatchEvent(new CustomEvent("endStroke",{detail:t})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(t){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(t.minWidth+t.maxWidth)/2,this._ctx.fillStyle=t.penColor,this._ctx.globalCompositeOperation=t.compositeOperation}_createPoint(t,e,n){const r=this.canvas.getBoundingClientRect();return new Point(t-r.left,e-r.top,n,(new Date).getTime())}_addPoint(t,e){const{_lastPoints:n}=this;if(n.push(t),n.length>2){3===n.length&&n.unshift(n[0]);const t=this._calculateCurveWidths(n[1],n[2],e),r=Bezier.fromPoints(n,t);return n.shift(),r}return null}_calculateCurveWidths(t,e,n){const r=n.velocityFilterWeight*e.velocityFrom(t)+(1-n.velocityFilterWeight)*this._lastVelocity,o=this._strokeWidth(r,n),i={end:o,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=o,i}_strokeWidth(t,e){return Math.max(e.maxWidth/(t+1),e.minWidth)}_drawCurveSegment(t,e,n){const r=this._ctx;r.moveTo(t,e),r.arc(t,e,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(t,e){const n=this._ctx,r=t.endWidth-t.startWidth,o=2*Math.ceil(t.length());n.beginPath(),n.fillStyle=e.penColor;for(let n=0;n<o;n+=1){const i=n/o,a=i*i,s=a*i,c=1-i,l=c*c,d=l*c;let u=d*t.startPoint.x;u+=3*l*i*t.control1.x,u+=3*c*a*t.control2.x,u+=s*t.endPoint.x;let h=d*t.startPoint.y;h+=3*l*i*t.control1.y,h+=3*c*a*t.control2.y,h+=s*t.endPoint.y;const m=Math.min(t.startWidth+s*r,e.maxWidth);this._drawCurveSegment(u,h,m)}n.closePath(),n.fill()}_drawDot(t,e){const n=this._ctx,r=e.dotSize>0?e.dotSize:(e.minWidth+e.maxWidth)/2;n.beginPath(),this._drawCurveSegment(t.x,t.y,r),n.closePath(),n.fillStyle=e.penColor,n.fill()}_fromData(t,e,n){for(const r of t){const{points:t}=r,o=this._getPointGroupOptions(r);if(t.length>1)for(let n=0;n<t.length;n+=1){const r=t[n],i=new Point(r.x,r.y,r.pressure,r.time);0===n&&this._reset(o);const a=this._addPoint(i,o);a&&e(a,o)}else this._reset(o),n(t[0],o)}}toSVG({includeBackgroundColor:t=!1}={}){const e=this._data,n=Math.max(window.devicePixelRatio||1,1),r=this.canvas.width/n,o=this.canvas.height/n,i=document.createElementNS("http://www.w3.org/2000/svg","svg");if(i.setAttribute("xmlns","http://www.w3.org/2000/svg"),i.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),i.setAttribute("viewBox",`0 0 ${r} ${o}`),i.setAttribute("width",r.toString()),i.setAttribute("height",o.toString()),t&&this.backgroundColor){const t=document.createElement("rect");t.setAttribute("width","100%"),t.setAttribute("height","100%"),t.setAttribute("fill",this.backgroundColor),i.appendChild(t)}return this._fromData(e,(t,{penColor:e})=>{const n=document.createElement("path");if(!(isNaN(t.control1.x)||isNaN(t.control1.y)||isNaN(t.control2.x)||isNaN(t.control2.y))){const r=`M ${t.startPoint.x.toFixed(3)},${t.startPoint.y.toFixed(3)} C ${t.control1.x.toFixed(3)},${t.control1.y.toFixed(3)} ${t.control2.x.toFixed(3)},${t.control2.y.toFixed(3)} ${t.endPoint.x.toFixed(3)},${t.endPoint.y.toFixed(3)}`;n.setAttribute("d",r),n.setAttribute("stroke-width",(2.25*t.endWidth).toFixed(3)),n.setAttribute("stroke",e),n.setAttribute("fill","none"),n.setAttribute("stroke-linecap","round"),i.appendChild(n)}},(t,{penColor:e,dotSize:n,minWidth:r,maxWidth:o})=>{const a=document.createElement("circle"),s=n>0?n:(r+o)/2;a.setAttribute("r",s.toString()),a.setAttribute("cx",t.x.toString()),a.setAttribute("cy",t.y.toString()),a.setAttribute("fill",e),i.appendChild(a)}),i.outerHTML}}const{document:document_1$2}=globals;function add_css$6(){var t=element("style");t.id="svelte-efkzkz-style",t.textContent=".feather2.svelte-efkzkz{position:absolute;top:0.25em;right:0.25em;color:#4300b0}.wrapper.svelte-efkzkz{position:relative;width:100%;height:200px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;border:1px solid #36697d}canvas.svelte-efkzkz{width:100%;height:100%;display:block;background-color:lightyellow}.signature-readonly.svelte-efkzkz{cursor:not-allowed;pointer-events:none}",append(document_1$2.head,t)}function create_if_block$6(t){let e,n,r,o,i;return n=new DeleteIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 pointer svelte-efkzkz")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[5]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$7(t){let e,n,r,o,i,a,s=!t[0]&&create_if_block$6(t);return{c(){e=element("div"),n=element("canvas"),o=space(),s&&s.c(),attr(n,"id",t[1]),attr(n,"name",t[1]),attr(n,"class",r=t[2]+" signature_pad "+t[3]+(t[0]||t[4]?" signature-readonly":"")+" svelte-efkzkz"),attr(e,"class",i=t[2]+"_wrapper wrapper svelte-efkzkz"),attr(e,"id","signature_wrapper")},m(t,r){insert(t,e,r),append(e,n),append(e,o),s&&s.m(e,null),a=!0},p(t,[o]){(!a||2&o)&&attr(n,"id",t[1]),(!a||2&o)&&attr(n,"name",t[1]),(!a||29&o&&r!==(r=t[2]+" signature_pad "+t[3]+(t[0]||t[4]?" signature-readonly":"")+" svelte-efkzkz"))&&attr(n,"class",r),t[0]?s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros()):s?(s.p(t,o),1&o&&transition_in(s,1)):(s=create_if_block$6(t),s.c(),transition_in(s,1),s.m(e,null)),(!a||4&o&&i!==(i=t[2]+"_wrapper wrapper svelte-efkzkz"))&&attr(e,"class",i)},i(t){a||(transition_in(s),a=!0)},o(t){transition_out(s),a=!1},d(t){t&&detach(e),s&&s.d()}}}const signatureMap=new Map;let signature="";function instance$7(t,e,n){const r=createEventDispatcher();let o,{id:i}=e,{name:a}=e,{value:s}=e,{record:c}=e,{classId:l}=e,{disabled:d}=e,{readonly:u}=e;const h=c._id||Math.floor(9e3*Math.random()+1e3).toString();u||=d;const m=t=>{signature=t,signatureMap.set(h,signature),r("blur",{value:signature})};return onMount(()=>{signature=s||signatureMap.get(h)||"",signatureMap.set(h,signature);const t=document.querySelector("canvas");n(8,o=new SignaturePad(t)),u||(o.addEventListener("endStroke",()=>{m(o.toDataURL("image/png"))}),o.addEventListener("afterUpdateStroke",()=>{m(o.toDataURL("image/png"))}))}),onDestroy(()=>signatureMap.forEach((t,e,n)=>{e!==h&&n.delete(e)})),t.$$set=t=>{"id"in t&&n(1,i=t.id),"name"in t&&n(2,a=t.name),"value"in t&&n(6,s=t.value),"record"in t&&n(7,c=t.record),"classId"in t&&n(3,l=t.classId),"disabled"in t&&n(4,d=t.disabled),"readonly"in t&&n(0,u=t.readonly)},t.$$.update=()=>{256&t.$$.dirty&&signature&&o&&o.fromDataURL(signature,{ratio:1})},[u,i,a,l,d,()=>{o.clear(),m("")},s,c,o]}class InputSignature extends SvelteComponent{constructor(t){super(),document_1$2.getElementById("svelte-efkzkz-style")||add_css$6(),init(this,t,instance$7,create_fragment$7,safe_not_equal,{id:1,name:2,value:6,record:7,classId:3,disabled:4,readonly:0})}}function add_css$5(){var t=element("style");t.id="svelte-bcd9jd-style",t.textContent=".feather.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:#326173}.feather2.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:light-gray}.eList.svelte-bcd9jd.svelte-bcd9jd{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-bcd9jd table.svelte-bcd9jd{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-bcd9jd table thead.svelte-bcd9jd{position:sticky;top:0;background:#326173;color:white}.eList.svelte-bcd9jd table thead tr.svelte-bcd9jd{height:2.3em}.eList.svelte-bcd9jd table tbody tr.svelte-bcd9jd{height:2.75em !important}th.svelte-bcd9jd.svelte-bcd9jd,td.svelte-bcd9jd.svelte-bcd9jd{padding-left:0.4em;padding-right:0.4em}",append(document.head,t)}function get_each_context$3(t,e,n){const r=t.slice();return r[36]=e[n],r[38]=n,r}function create_else_block_1$3(t){let e,n,r;return n=new BookOpenIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 svelte-bcd9jd"),attr(e,"title",t[21])},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_if_block_2$3(t){let e,n,r,o,i;return n=new BookOpenIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-bcd9jd"),attr(e,"title",t[21])},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[22]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_if_block$5(t){let e,n,r;function o(e){t[28](e)}let i={class:"tModal",noClickaway:!0,$$slots:{default:[create_default_slot$4]},$$scope:{ctx:t}};return void 0!==t[8]&&(i.open=t[8]),e=new t[12]({props:i}),binding_callbacks.push(()=>bind(e,"open",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};1536&r[0]|256&r[1]&&(o.$$scope={dirty:r,ctx:t}),!n&&256&r[0]&&(n=!0,o.open=t[8],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_default_slot_2$2(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_else_block$4(t){let e,n,r,o=(t[10]||"Keine Einträge gefunden!")+"";return{c(){e=element("tr"),n=element("td"),r=text(o),attr(n,"class","svelte-bcd9jd"),attr(e,"class","svelte-bcd9jd")},m(t,o){insert(t,e,o),append(e,n),append(n,r)},p(t,e){1024&e[0]&&o!==(o=(t[10]||"Keine Einträge gefunden!")+"")&&set_data(r,o)},d(t){t&&detach(e)}}}function create_if_block_1$4(t){let e,n=t[9],r=[];for(let e=0;e<n.length;e+=1)r[e]=create_each_block$3(get_each_context$3(t,n,e));return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=empty()},m(t,n){for(let e=0;e<r.length;e+=1)r[e].m(t,n);insert(t,e,n)},p(t,o){if(25166336&o[0]){let i;for(n=t[9],i=0;i<n.length;i+=1){const a=get_each_context$3(t,n,i);r[i]?r[i].p(a,o):(r[i]=create_each_block$3(a),r[i].c(),r[i].m(e.parentNode,e))}for(;i<r.length;i+=1)r[i].d(1);r.length=n.length}},d(t){destroy_each(r,t),t&&detach(e)}}}function create_each_block$3(t){let e,n,r,o,i,a,s=t[23](t[36])+"";return{c(){e=element("tr"),n=element("td"),r=text(s),o=space(),attr(n,"class","svelte-bcd9jd"),attr(e,"class","pointer svelte-bcd9jd")},m(s,c){insert(s,e,c),append(e,n),append(n,r),append(e,o),i||(a=listen(e,"click",stop_propagation(t[24](t[38]))),i=!0)},p(e,n){t=e,512&n[0]&&s!==(s=t[23](t[36])+"")&&set_data(r,s)},d(t){t&&detach(e),i=!1,a()}}}function create_default_slot_1$3(t){let e,n,r,o,i,a,s,c,l,d,u,h,m;function f(t,e){return t[9]?.length?create_if_block_1$4:create_else_block$4}n=new t[14]({props:{outline:!0,$$slots:{default:[create_default_slot_2$2]},$$scope:{ctx:t}}}),n.$on("click",t[25]),o=new t[15]({});let p=f(t),_=p(t);return{c(){e=element("div"),create_component(n.$$.fragment),r=space(),create_component(o.$$.fragment),i=space(),a=element("div"),s=element("table"),c=element("thead"),l=element("tr"),d=element("th"),d.textContent=`${t[20]}`,u=space(),h=element("tbody"),_.c(),attr(d,"class","svelte-bcd9jd"),attr(l,"class","svelte-bcd9jd"),attr(c,"class","svelte-bcd9jd"),attr(s,"striped",""),attr(s,"class","svelte-bcd9jd"),attr(a,"class","eList svelte-bcd9jd")},m(t,f){insert(t,e,f),mount_component(n,e,null),insert(t,r,f),mount_component(o,t,f),insert(t,i,f),insert(t,a,f),append(a,s),append(s,c),append(c,l),append(l,d),append(s,u),append(s,h),_.m(h,null),m=!0},p(t,e){const r={};256&e[1]&&(r.$$scope={dirty:e,ctx:t}),n.$set(r),p===(p=f(t))&&_?_.p(t,e):(_.d(1),_=p(t),_&&(_.c(),_.m(h,null)))},i(t){m||(transition_in(n.$$.fragment,t),transition_in(o.$$.fragment,t),m=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(o.$$.fragment,t),m=!1},d(t){t&&detach(e),destroy_component(n),t&&detach(r),destroy_component(o,t),t&&detach(i),t&&detach(a),_.d()}}}function create_default_slot$4(t){let e,n;return e=new t[13]({props:{title:t[21],class:"eList",$$slots:{default:[create_default_slot_1$3]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1536&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$6(t){let e,n,r,o,i,a,s,c,l;function d(e){t[26](e)}let u={id:t[2],name:t[3].name,inputClass:t[5]||t[1],disabled:t[6],formnovalidate:t[7],readonly:t[18],pattern:t[17],required:t[19],style:"padding-left:2em;"};void 0!==t[0]&&(u.value=t[0]),n=new t[11]({props:u}),binding_callbacks.push(()=>bind(n,"value",d)),n.$on("change",t[27]);const h=[create_if_block_2$3,create_else_block_1$3],m=[];function f(t,e){return t[6]||t[4]._id?1:0}i=f(t),a=m[i]=h[i](t);let p=t[8]&&create_if_block$5(t);return{c(){e=element("div"),create_component(n.$$.fragment),o=space(),a.c(),s=space(),p&&p.c(),c=empty(),set_style(e,"position","relative")},m(t,r){insert(t,e,r),mount_component(n,e,null),append(e,o),m[i].m(e,null),insert(t,s,r),p&&p.m(t,r),insert(t,c,r),l=!0},p(t,o){const s={};4&o[0]&&(s.id=t[2]),8&o[0]&&(s.name=t[3].name),34&o[0]&&(s.inputClass=t[5]||t[1]),64&o[0]&&(s.disabled=t[6]),128&o[0]&&(s.formnovalidate=t[7]),!r&&1&o[0]&&(r=!0,s.value=t[0],add_flush_callback(()=>r=!1)),n.$set(s);let l=i;i=f(t),i===l?m[i].p(t,o):(group_outros(),transition_out(m[l],1,1,()=>{m[l]=null}),check_outros(),a=m[i],a?a.p(t,o):(a=m[i]=h[i](t),a.c()),transition_in(a,1),a.m(e,null)),t[8]?p?(p.p(t,o),256&o[0]&&transition_in(p,1)):(p=create_if_block$5(t),p.c(),transition_in(p,1),p.m(c.parentNode,c)):p&&(group_outros(),transition_out(p,1,1,()=>{p=null}),check_outros())},i(t){l||(transition_in(n.$$.fragment,t),transition_in(a),transition_in(p),l=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(a),transition_out(p),l=!1},d(t){t&&detach(e),destroy_component(n),m[i].d(),t&&detach(s),p&&p.d(t),t&&detach(c)}}}function instance$6(t,e,n){let r;const{TextField:o,Modal:i,Dialog:a,Button:s,Divider:c}=getAttractions,l=createEventDispatcher(),{environment:d}=user;component_subscribe(t,d,t=>n(29,r=t));let{classId:u}=e,{id:h}=e,{item:m}=e,{record:f={}}=e,{value:p}=e,{noForm:_=!1}=e,{disabled:g}=e,{formnovalidate:w}=e;const{properties:$={}}=m;let{pattern:y,placeholder:b,readonly:v,required:I=!1,format:C}=$,E=!1;const{service:{type:A,map:S,title:k,designation:T}}=C;let R,N;const D=()=>{n(8,E=!1)};return t.$$set=t=>{"classId"in t&&n(1,u=t.classId),"id"in t&&n(2,h=t.id),"item"in t&&n(3,m=t.item),"record"in t&&n(4,f=t.record),"value"in t&&n(0,p=t.value),"noForm"in t&&n(5,_=t.noForm),"disabled"in t&&n(6,g=t.disabled),"formnovalidate"in t&&n(7,w=t.formnovalidate)},[p,u,h,m,f,_,g,w,E,R,N,o,i,a,s,c,d,y,v,I,k,T,async()=>{g||f._id||(n(9,R=[]),n(10,N=""),p.length>3&&(n(9,R=await Request.getService("address",A,p)),Array.isArray(R)||n(10,N=R.error)),n(8,E=!0))},t=>S.map(({name:e})=>t[e]).filter(t=>!!t).join(", "),t=>()=>{const e=R[t],n=[];let o="";for(const{name:t,refItem:i}of S){const[a,s]=i.split(".");s?(o=a,"owner.country"===t&&(e[t]=r.country?._id||""),n.push({name:s,value:e[t]})):l("record",{itemName:i,value:e[t]})}n.length&&l("objRecord",{listName:o,items:n}),D()},D,function(t){p=t,n(0,p)},function(e){bubble(t,e)},function(t){E=t,n(8,E)}]}class InputService extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-bcd9jd-style")||add_css$5(),init(this,t,instance$6,create_fragment$6,safe_not_equal,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7},[-1,-1])}}function add_css$4(){var t=element("style");t.id="svelte-1xgbysl-style",t.textContent=".feather.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:light-gray}",append(document.head,t)}function create_else_block$3(t){let e,n,r;return n=new ExternalLinkIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather2 svelte-1xgbysl")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_if_block$4(t){let e,n,r,o,i;return n=new ExternalLinkIcon({props:{size:"18"}}),{c(){e=element("span"),create_component(n.$$.fragment),attr(e,"class","feather pointer svelte-1xgbysl")},m(a,s){insert(a,e,s),mount_component(n,e,null),r=!0,o||(i=listen(e,"click",t[6]),o=!0)},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n),o=!1,i()}}}function create_fragment$5(t){let e,n,r,o,i,a;n=new t[5]({props:{inputClass:t[0],disabled:!0,formnovalidate:t[1],readonly:!0,id:t[2],name:t[3],value:t[4],style:"padding-left: 2em;"}});const s=[create_if_block$4,create_else_block$3],c=[];function l(t,e){return t[4]?0:1}return o=l(t),i=c[o]=s[o](t),{c(){e=element("div"),create_component(n.$$.fragment),r=space(),i.c(),set_style(e,"position","relative")},m(t,i){insert(t,e,i),mount_component(n,e,null),append(e,r),c[o].m(e,null),a=!0},p(t,[r]){const a={};1&r&&(a.inputClass=t[0]),2&r&&(a.formnovalidate=t[1]),4&r&&(a.id=t[2]),8&r&&(a.name=t[3]),16&r&&(a.value=t[4]),n.$set(a);let d=o;o=l(t),o===d?c[o].p(t,r):(group_outros(),transition_out(c[d],1,1,()=>{c[d]=null}),check_outros(),i=c[o],i?i.p(t,r):(i=c[o]=s[o](t),i.c()),transition_in(i,1),i.m(e,null))},i(t){a||(transition_in(n.$$.fragment,t),transition_in(i),a=!0)},o(t){transition_out(n.$$.fragment,t),transition_out(i),a=!1},d(t){t&&detach(e),destroy_component(n),c[o].d()}}}function instance$5(t,e,n){const{TextField:r}=getAttractions;let{inputClass:o}=e,{disabled:i}=e,{formnovalidate:a}=e,{readonly:s}=e,{required:c}=e,{id:l}=e,{name:d}=e,{value:u}=e,{record:h}=e;const m=h?.task;return t.$$set=t=>{"inputClass"in t&&n(0,o=t.inputClass),"disabled"in t&&n(7,i=t.disabled),"formnovalidate"in t&&n(1,a=t.formnovalidate),"readonly"in t&&n(8,s=t.readonly),"required"in t&&n(9,c=t.required),"id"in t&&n(2,l=t.id),"name"in t&&n(3,d=t.name),"value"in t&&n(4,u=t.value),"record"in t&&n(10,h=t.record)},[o,a,l,d,u,r,async()=>{m&&window.open(m)},i,s,c,h]}class InputTask extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-1xgbysl-style")||add_css$4(),init(this,t,instance$5,create_fragment$5,safe_not_equal,{inputClass:0,disabled:7,formnovalidate:1,readonly:8,required:9,id:2,name:3,value:4,record:10})}}function add_css$3(){var t=element("style");t.id="svelte-rxh0vh-style",t.textContent=".form-field{margin-bottom:0.5em !important}.form-field.hidden{display:none !important}.form-field > .description{padding-top:0.75em;color:black}.form-field div.field > label.checkbox{padding-top:0.5em}.form-field label.color_red{color:red}",append(document.head,t)}function create_else_block$2(t){let e,n;return e=new t[30]({props:{id:t[46](t[39]),class:t[0].name+(t[26]?" hidden ":""),nameClass:t[0].properties?.color?"color_"+t[0].properties.color:"",name:t[0].designation,help:t[0].properties?.hint,$$slots:{default:[create_default_slot_1$2,({notifyList:t})=>({24:t}),({notifyList:t})=>[t?16777216:0]]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};67108865&n[0]&&(r.class=t[0].name+(t[26]?" hidden ":"")),1&n[0]&&(r.nameClass=t[0].properties?.color?"color_"+t[0].properties.color:""),1&n[0]&&(r.name=t[0].designation),1&n[0]&&(r.help=t[0].properties?.hint),872415231&n[0]|262144&n[2]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_2$2(t){let e,n;return e=new t[33]({props:{text:t[0].designation}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1&n[0]&&(r.text=t[0].designation),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_1$3(t){let e,n,r,o;return e=new t[30]({props:{id:t[46](t[39]),class:t[0].name+(t[26]?" hidden ":""),name:t[0].designation,help:t[0].properties?.hint}}),r=new InputRichtext({props:{classId:t[9],disabled:t[3],readonly:t[25],id:t[39],name:t[0].name,value:t[28](),record:t[1],noForm:t[8]}}),r.$on("blur",t[42]()),{c(){create_component(e.$$.fragment),n=space(),create_component(r.$$.fragment)},m(t,i){mount_component(e,t,i),insert(t,n,i),mount_component(r,t,i),o=!0},p(t,n){const o={};67108865&n[0]&&(o.class=t[0].name+(t[26]?" hidden ":"")),1&n[0]&&(o.name=t[0].designation),1&n[0]&&(o.help=t[0].properties?.hint),e.$set(o);const i={};512&n[0]&&(i.classId=t[9]),8&n[0]&&(i.disabled=t[3]),33554432&n[0]&&(i.readonly=t[25]),1&n[0]&&(i.name=t[0].name),268435456&n[0]&&(i.value=t[28]()),2&n[0]&&(i.record=t[1]),256&n[0]&&(i.noForm=t[8]),r.$set(i)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(r.$$.fragment,t),o=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(r.$$.fragment,t),o=!1},d(t){destroy_component(e,t),t&&detach(n),destroy_component(r,t)}}}function create_if_block$3(t){let e,n,r,o,i,a;return e=new t[30]({props:{id:t[46](t[39]),class:t[0].name+" hidden",name:t[0].designation,help:t[0].properties?.hint,$$slots:{default:[create_default_slot$3]},$$scope:{ctx:t}}}),r=new t[33]({props:{text:t[29]}}),i=new InputObjectReference({props:{required:t[4],disabled:t[3],readonly:t[25],id:t[39],item:t[0],currency:t[19],value:t[28]()}}),i.$on("setRefValue",t[47]),i.$on("safeReference",t[52]),i.$on("objRecord",t[53]),{c(){create_component(e.$$.fragment),n=space(),create_component(r.$$.fragment),o=space(),create_component(i.$$.fragment)},m(t,s){mount_component(e,t,s),insert(t,n,s),mount_component(r,t,s),insert(t,o,s),mount_component(i,t,s),a=!0},p(t,n){const o={};1&n[0]&&(o.class=t[0].name+" hidden"),1&n[0]&&(o.name=t[0].designation),1&n[0]&&(o.help=t[0].properties?.hint),402654721&n[0]|262144&n[2]&&(o.$$scope={dirty:n,ctx:t}),e.$set(o);const a={};536870912&n[0]&&(a.text=t[29]),r.$set(a);const s={};16&n[0]&&(s.required=t[4]),8&n[0]&&(s.disabled=t[3]),33554432&n[0]&&(s.readonly=t[25]),1&n[0]&&(s.item=t[0]),524288&n[0]&&(s.currency=t[19]),268435456&n[0]&&(s.value=t[28]()),i.$set(s)},i(t){a||(transition_in(e.$$.fragment,t),transition_in(r.$$.fragment,t),transition_in(i.$$.fragment,t),a=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(r.$$.fragment,t),transition_out(i.$$.fragment,t),a=!1},d(t){destroy_component(e,t),t&&detach(n),destroy_component(r,t),t&&detach(o),destroy_component(i,t)}}}function create_else_block_1$2(t){let e,n;return e=new t[31]({props:{inputClass:t[8]||t[9],disabled:t[3],formnovalidate:t[12],readonly:t[25],pattern:t[35],required:!0===t[4],placeholder:t[37],id:t[39],name:t[38],value:t[28]()}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=!0===t[4]),268435456&n[0]&&(r.value=t[28]()),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_26(t){let e,n;return e=new InputTel({props:{inputClass:t[8]||t[9],disabled:t[3],formnovalidate:t[12],readonly:t[25],required:t[4],id:t[39],name:t[38],pattern:t[35],placeholder:t[37],value:t[28]()}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=t[4]),268435456&n[0]&&(r.value=t[28]()),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_25(t){let e,n;return e=new InputTask({props:{inputClass:t[8]||t[9],formnovalidate:t[12],id:t[39],name:t[38],value:t[28](),record:t[1],"}":!0}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),4096&n[0]&&(r.formnovalidate=t[12]),268435456&n[0]&&(r.value=t[28]()),2&n[0]&&(r.record=t[1]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_24(t){let e,n;return e=new InputUrl({props:{inputClass:t[8]||t[9],disabled:t[3],formnovalidate:t[12],readonly:t[25],required:t[4],id:t[39],name:t[38],value:t[28]()}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=t[4]),268435456&n[0]&&(r.value=t[28]()),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_23$1(t){let e,n;return e=new InputMail({props:{inputClass:t[8]||t[9],disabled:t[3],formnovalidate:t[12],readonly:t[25],required:t[4],id:t[39],name:t[38],pattern:t[35],multiple:t[36],placeholder:t[37],value:t[28]()}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=t[4]),268435456&n[0]&&(r.value=t[28]()),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_22$1(t){let e,n;return e=new InputTime({props:{inputClass:t[8]||t[9],disabled:t[3],readonly:t[25],required:t[4],id:t[39],item:t[0],value:t[28](),praefix:t[5]}}),e.$on("blur",t[42]()),e.$on("checkRange",t[71]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),8&n[0]&&(r.disabled=t[3]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=t[4]),1&n[0]&&(r.item=t[0]),268435456&n[0]&&(r.value=t[28]()),32&n[0]&&(r.praefix=t[5]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_21$1(t){let e,n;return e=new InputMap({props:{inputClass:t[8]||t[9],disabled:t[3],formnovalidate:t[12],readonly:t[25],required:t[4],id:t[39],name:t[38],value:t[28](),record:t[1],item:t[0]}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=t[4]),268435456&n[0]&&(r.value=t[28]()),2&n[0]&&(r.record=t[1]),1&n[0]&&(r.item=t[0]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_20$1(t){let e,n;return e=new InputDateTime({props:{classId:t[9],id:t[39],disabled:t[3],required:t[4],value:t[40](),noForm:t[8]}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),16&n[0]&&(r.required=t[4]),256&n[0]&&(r.noForm=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_19$1(t){let e,n;return e=new InputDateRange({props:{classId:t[9],id:t[39],item:t[0],disabled:t[3],required:t[4],value:t[41](),noForm:t[8]}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),1&n[0]&&(r.item=t[0]),8&n[0]&&(r.disabled=t[3]),16&n[0]&&(r.required=t[4]),256&n[0]&&(r.noForm=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_18$1(t){let e,n;return e=new InputDate({props:{classId:t[9],eventId:t[10],id:t[39],item:t[0],record:t[1],readonly:t[25],disabled:t[3],required:t[4],praefix:t[5],value:t[40](),noForm:t[8],notifyList:t[24],dateInput:t[23]}}),e.$on("change",t[42](!0)),e.$on("formula",t[69]),e.$on("record",t[70]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),1024&n[0]&&(r.eventId=t[10]),1&n[0]&&(r.item=t[0]),2&n[0]&&(r.record=t[1]),33554432&n[0]&&(r.readonly=t[25]),8&n[0]&&(r.disabled=t[3]),16&n[0]&&(r.required=t[4]),32&n[0]&&(r.praefix=t[5]),256&n[0]&&(r.noForm=t[8]),16777216&n[0]&&(r.notifyList=t[24]),8388608&n[0]&&(r.dateInput=t[23]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_17$1(t){let e,n;return e=new t[32]({props:{round:!0,inputClass:t[8]||t[9],disabled:t[3]||t[25],required:t[4],id:t[39],name:t[38],checked:t[28](),value:t[28](!0)}}),e.$on("change",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]&&(r.inputClass=t[8]||t[9]),33554440&n[0]&&(r.disabled=t[3]||t[25]),16&n[0]&&(r.required=t[4]),268435456&n[0]&&(r.checked=t[28]()),268435456&n[0]&&(r.value=t[28](!0)),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_16$1(t){let e,n;return e=new InputLookup({props:{id:t[39],item:t[0],praefix:t[5],record:t[1],notifyList:t[24]}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1&n[0]&&(r.item=t[0]),32&n[0]&&(r.praefix=t[5]),2&n[0]&&(r.record=t[1]),16777216&n[0]&&(r.notifyList=t[24]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_15$1(t){let e,n;return e=new InputAutocomplete({props:{classId:t[9],item:t[0],record:t[1],listName:t[6],disabled:t[3],formnovalidate:t[12],readonly:t[25],pattern:t[35],required:!0===t[4],placeholder:t[37],id:t[39],name:t[38],value:t[28]()}}),e.$on("blur",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),1&n[0]&&(r.item=t[0]),2&n[0]&&(r.record=t[1]),64&n[0]&&(r.listName=t[6]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=!0===t[4]),268435456&n[0]&&(r.value=t[28]()),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_14$2(t){let e,n;return e=new InputView({props:{classId:t[9],disabled:t[3],required:t[4],id:t[39],item:t[0],record:t[1],value:t[28](),noForm:t[8],view:t[0].properties.view,praefix:t[5]}}),e.$on("blur",t[42]()),e.$on("invalid",t[68]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),16&n[0]&&(r.required=t[4]),1&n[0]&&(r.item=t[0]),2&n[0]&&(r.record=t[1]),268435456&n[0]&&(r.value=t[28]()),256&n[0]&&(r.noForm=t[8]),1&n[0]&&(r.view=t[0].properties.view),32&n[0]&&(r.praefix=t[5]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_13$2(t){let e,n;return e=new InputMulti({props:{classId:t[9],disabled:t[3],required:t[4],id:t[39],item:t[0],record:t[1],value:t[28](),noForm:t[8],multi:t[0].properties.multi,numberInput:t[14],praefix:t[5],toDelete:t[17],reqQuantity:t[18],notifyList:t[24]}}),e.$on("blur",t[42]()),e.$on("invalid",t[67]),e.$on("record",t[43]),e.$on("multi",t[44]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),16&n[0]&&(r.required=t[4]),1&n[0]&&(r.item=t[0]),2&n[0]&&(r.record=t[1]),268435456&n[0]&&(r.value=t[28]()),256&n[0]&&(r.noForm=t[8]),1&n[0]&&(r.multi=t[0].properties.multi),16384&n[0]&&(r.numberInput=t[14]),32&n[0]&&(r.praefix=t[5]),131072&n[0]&&(r.toDelete=t[17]),262144&n[0]&&(r.reqQuantity=t[18]),16777216&n[0]&&(r.notifyList=t[24]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_12$2(t){let e,n;return e=new InputNumber({props:{classId:t[9],disabled:t[3],formnovalidate:t[12],required:t[4],readonly:t[25],id:t[39],item:t[0],currency:t[19],value:t[28](),praefix:t[5],notifyList:t[24],noForm:t[8]}}),e.$on("blur",t[42]()),e.$on("formula",t[64]),e.$on("listRecord",t[65]),e.$on("record",t[66]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),16&n[0]&&(r.required=t[4]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.item=t[0]),524288&n[0]&&(r.currency=t[19]),268435456&n[0]&&(r.value=t[28]()),32&n[0]&&(r.praefix=t[5]),16777216&n[0]&&(r.notifyList=t[24]),256&n[0]&&(r.noForm=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_11$2(t){let e,n;return e=new InputService({props:{classId:t[9],disabled:t[3],readonly:t[25],required:t[4],id:t[39],item:t[0],record:t[1],value:t[28](),noForm:t[8]}}),e.$on("change",t[42]()),e.$on("record",t[62]),e.$on("objRecord",t[63]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),33554432&n[0]&&(r.readonly=t[25]),16&n[0]&&(r.required=t[4]),1&n[0]&&(r.item=t[0]),2&n[0]&&(r.record=t[1]),268435456&n[0]&&(r.value=t[28]()),256&n[0]&&(r.noForm=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_10$2(t){let e,n;return e=new InputSelect({props:{classId:t[9],disabled:t[3],required:t[4],id:t[39],item:t[0],value:t[28](),noForm:t[8]}}),e.$on("blur",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),16&n[0]&&(r.required=t[4]),1&n[0]&&(r.item=t[0]),268435456&n[0]&&(r.value=t[28]()),256&n[0]&&(r.noForm=t[8]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_9$2(t){let e,n;return e=new InputSignature({props:{classId:t[9],disabled:t[3],readonly:t[25],id:t[39],name:t[0].name,value:t[28](),record:t[1],noForm:t[8],placeholder:t[0].properties?.placeholder}}),e.$on("blur",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.name=t[0].name),268435456&n[0]&&(r.value=t[28]()),2&n[0]&&(r.record=t[1]),256&n[0]&&(r.noForm=t[8]),1&n[0]&&(r.placeholder=t[0].properties?.placeholder),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_8$2(t){let e,n;return e=new InputFilePDF({props:{praefix:t[5],classId:t[9],disabled:t[3],readonly:t[25],item:t[0],id:t[39],name:t[0].name,eventId:t[10],record:t[1],recordId:t[2],value:t[28](),fileType:t[0].properties?.accept}}),e.$on("record",t[60]),e.$on("listRecord",t[61]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};32&n[0]&&(r.praefix=t[5]),512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.item=t[0]),1&n[0]&&(r.name=t[0].name),1024&n[0]&&(r.eventId=t[10]),2&n[0]&&(r.record=t[1]),4&n[0]&&(r.recordId=t[2]),268435456&n[0]&&(r.value=t[28]()),1&n[0]&&(r.fileType=t[0].properties?.accept),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_7$2(t){let e,n;return e=new InputFileQR({props:{praefix:t[5],classId:t[9],disabled:t[3],readonly:t[25],item:t[0],id:t[39],name:t[0].name,eventId:t[10],record:t[1],value:t[28]()}}),e.$on("record",t[59]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};32&n[0]&&(r.praefix=t[5]),512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.item=t[0]),1&n[0]&&(r.name=t[0].name),1024&n[0]&&(r.eventId=t[10]),2&n[0]&&(r.record=t[1]),268435456&n[0]&&(r.value=t[28]()),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_6$2(t){let e,n;return e=new InputFile({props:{classId:t[9],disabled:t[3],readonly:t[25],item:t[0],id:t[39],name:t[0].name,eventId:t[10],record:t[1],value:t[28]()}}),e.$on("record",t[58]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.item=t[0]),1&n[0]&&(r.name=t[0].name),1024&n[0]&&(r.eventId=t[10]),2&n[0]&&(r.record=t[1]),268435456&n[0]&&(r.value=t[28]()),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_5$2(t){let e,n;return e=new TextArea({props:{classId:t[9],disabled:t[3],readonly:t[25],id:t[39],name:t[0].name,value:t[28](),noForm:t[8],standard:!0,style:"",placeholder:t[0].properties?.placeholder}}),e.$on("blur",t[42]()),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),8&n[0]&&(r.disabled=t[3]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.name=t[0].name),268435456&n[0]&&(r.value=t[28]()),256&n[0]&&(r.noForm=t[8]),1&n[0]&&(r.placeholder=t[0].properties?.placeholder),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_4$2(t){let e,n;return e=new InputReference({props:{classId:t[9],eventId:t[10],fullRecord:t[7],required:t[4],disabled:t[3],formnovalidate:t[12],readonly:t[25],id:t[39],item:t[0],desc:t[29],value:t[28](),multiValues:t[20],noForm:t[8],praefix:t[5],selectionFields:t[11],selection:t[13],deList:t[15],recordId:t[2],isTemplate:t[16],shortEdit:t[21],initFinished:t[22]}}),e.$on("task",t[56]),e.$on("change",t[42]()),e.$on("initFail",t[45]),e.$on("defPrep",t[57]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),1024&n[0]&&(r.eventId=t[10]),128&n[0]&&(r.fullRecord=t[7]),16&n[0]&&(r.required=t[4]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.item=t[0]),536870912&n[0]&&(r.desc=t[29]),268435456&n[0]&&(r.value=t[28]()),1048576&n[0]&&(r.multiValues=t[20]),256&n[0]&&(r.noForm=t[8]),32&n[0]&&(r.praefix=t[5]),2048&n[0]&&(r.selectionFields=t[11]),8192&n[0]&&(r.selection=t[13]),32768&n[0]&&(r.deList=t[15]),4&n[0]&&(r.recordId=t[2]),65536&n[0]&&(r.isTemplate=t[16]),2097152&n[0]&&(r.shortEdit=t[21]),4194304&n[0]&&(r.initFinished=t[22]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_3$2(t){let e,n;return e=new InputReferenceMulti({props:{classId:t[9],eventId:t[10],required:t[4],disabled:t[3],formnovalidate:t[12],readonly:t[25],id:t[39],item:t[0],record:t[1],desc:t[29],values:t[28]()||[],noForm:t[8],praefix:t[5],selectionFields:t[11],selection:t[13],deList:t[15],recordId:t[2],isTemplate:t[16]}}),e.$on("task",t[54]),e.$on("change",t[42]()),e.$on("multi",t[44]),e.$on("initFail",t[45]),e.$on("defPrep",t[55]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),1024&n[0]&&(r.eventId=t[10]),16&n[0]&&(r.required=t[4]),8&n[0]&&(r.disabled=t[3]),4096&n[0]&&(r.formnovalidate=t[12]),33554432&n[0]&&(r.readonly=t[25]),1&n[0]&&(r.item=t[0]),2&n[0]&&(r.record=t[1]),536870912&n[0]&&(r.desc=t[29]),268435456&n[0]&&(r.values=t[28]()||[]),256&n[0]&&(r.noForm=t[8]),32&n[0]&&(r.praefix=t[5]),2048&n[0]&&(r.selectionFields=t[11]),8192&n[0]&&(r.selection=t[13]),32768&n[0]&&(r.deList=t[15]),4&n[0]&&(r.recordId=t[2]),65536&n[0]&&(r.isTemplate=t[16]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_1$2(t){let e,n,r,o;const i=[create_if_block_3$2,create_if_block_4$2,create_if_block_5$2,create_if_block_6$2,create_if_block_7$2,create_if_block_8$2,create_if_block_9$2,create_if_block_10$2,create_if_block_11$2,create_if_block_12$2,create_if_block_13$2,create_if_block_14$2,create_if_block_15$1,create_if_block_16$1,create_if_block_17$1,create_if_block_18$1,create_if_block_19$1,create_if_block_20$1,create_if_block_21$1,create_if_block_22$1,create_if_block_23$1,create_if_block_24,create_if_block_25,create_if_block_26,create_else_block_1$2],a=[];function s(t,e){return"object"===t[0].type&&t[0].properties?.multi?0:"object"===t[0].type?1:"textarea"===t[0].type||t[0].properties&&"textarea"===t[0].properties.format?2:"file"===t[0].type?3:"fileQR"===t[0].type?4:"filePDF"===t[0].type?5:"signature"===t[0].type?6:t[0].properties&&(t[0].properties.enum||t[0].properties.regulation)?7:t[0].properties?.format?.service?8:"number"===t[0].type?9:t[0].properties&&t[0].properties.multi?10:t[0].properties&&t[0].properties.view&&"lookup"!==t[0].properties.format?11:t[0].properties?.autocomplete?12:"lookup"===t[0].properties?.format?13:"boolean"===t[0].type?14:"date"===t[0].type?15:"dateRange"===t[0].type?16:"datetime"===t[0].type?17:"map"===t[0].properties?.format?18:"time"===t[0].properties?.format?19:"email"===t[0].type||"email"===t[0].properties?.format?20:"url"===t[0].properties?.format?21:"task"===t[0].properties?.format?22:"tel"===t[0].properties?.format?23:24}return e=s(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?a[e].p(t,o):(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros(),n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function create_default_slot$3(t){let e,n;return e=new InputReference({props:{classId:t[9],eventId:t[10],disabled:!0,readonly:!0,id:t[39],item:t[0],value:t[28](),noList:!0,withRefValue:!0,refValue:t[27]}}),e.$on("setRefDesc",t[48]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};512&n[0]&&(r.classId=t[9]),1024&n[0]&&(r.eventId=t[10]),1&n[0]&&(r.item=t[0]),268435456&n[0]&&(r.value=t[28]()),134217728&n[0]&&(r.refValue=t[27]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$4(t){let e,n,r,o;const i=[create_if_block$3,create_if_block_1$3,create_if_block_2$2,create_else_block$2],a=[];function s(t,e){return t[5]||"reference"!==t[0].saveAs||"object"!==t[0].type?"html"===t[0].properties?.format?1:"divider"===t[0].type?2:3:0}return e=s(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?a[e].p(t,o):(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros(),n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function instance$4(t,e,n){let r,o,i,a;const s=createEventDispatcher(),{FormField:c,TextField:l,DatePicker:d,TimePicker:u,Checkbox:h,Divider:m}=getAttractions,{environment:f}=user;component_subscribe(t,f,t=>n(51,a=t));let{praefix:p=""}=e,{item:_}=e,{listName:g=""}=e,{fullRecord:w}=e,{record:$}=e,{recordId:y}=e,{noForm:b=!1}=e,{classId:v}=e,{eventId:I}=e,{disabled:C}=e,{selectionFields:E}=e,{formnovalidate:A}=e,{selection:S=!1}=e,{notifyList:k}=e,{numberInput:T}=e,{deList:R}=e,{required:N}=e,{isTemplate:D}=e,{toDelete:x}=e,{reqQuantity:O}=e,{currency:M}=e,{changeValue:P}=e,{propSelection:B}=e,{multiValues:F}=e,{shortEdit:L}=e,{initFinished:q}=e,{dateInput:V}=e;y||=$._id;let{required:H,readonly:U,hidden:z,pattern:W,multiple:j,placeholder:G}=_.properties||{};if(z=!0===z,void 0!==U&&(U=!0===U),U||=y&&_.asInput,void 0===N&&(N=H),C=C||!!U,"string"==typeof _.name){const[t,e]=_.name.split("_");e&&(_.name=e)}const X=(g?g+".":"")+_.name,Q=X+(""!==p?"-"+p:""),Y=(t,e=X)=>{try{return e.split(".").reduce((t,e)=>t[e],t)}catch(t){return""}},Z=async t=>{const{list:e,values:n}=_.process;if(!t)return void s("save",{itemName:e,value:[],addToRecord:!0});const r={},o=await Request.getSchema(I);for(const t in n){const i=n[t];if(t.includes(".")){const[n,a]=t.split("."),s={[a]:i};let c=await Request.getSectionView(n,s);if(!c?.length)continue;c=c[0],r[n]=c._id;const l=o.list.find(t=>t.name===e);for(const t of l.item){const{name:e}=t;r[e]||(r[e]=c[e])}}else r[t]=i}s("save",{itemName:e,value:[r],addToRecord:!0})};let K=Y($);return t.$$set=t=>{"praefix"in t&&n(5,p=t.praefix),"item"in t&&n(0,_=t.item),"listName"in t&&n(6,g=t.listName),"fullRecord"in t&&n(7,w=t.fullRecord),"record"in t&&n(1,$=t.record),"recordId"in t&&n(2,y=t.recordId),"noForm"in t&&n(8,b=t.noForm),"classId"in t&&n(9,v=t.classId),"eventId"in t&&n(10,I=t.eventId),"disabled"in t&&n(3,C=t.disabled),"selectionFields"in t&&n(11,E=t.selectionFields),"formnovalidate"in t&&n(12,A=t.formnovalidate),"selection"in t&&n(13,S=t.selection),"notifyList"in t&&n(24,k=t.notifyList),"numberInput"in t&&n(14,T=t.numberInput),"deList"in t&&n(15,R=t.deList),"required"in t&&n(4,N=t.required),"isTemplate"in t&&n(16,D=t.isTemplate),"toDelete"in t&&n(17,x=t.toDelete),"reqQuantity"in t&&n(18,O=t.reqQuantity),"currency"in t&&n(19,M=t.currency),"changeValue"in t&&n(49,P=t.changeValue),"propSelection"in t&&n(50,B=t.propSelection),"multiValues"in t&&n(20,F=t.multiValues),"shortEdit"in t&&n(21,L=t.shortEdit),"initFinished"in t&&n(22,q=t.initFinished),"dateInput"in t&&n(23,V=t.dateInput)},t.$$.update=()=>{if(1&t.$$.dirty[0]|524288&t.$$.dirty[1]&&B&&_.properties?.selection){const{refClass:t,refItem:e,target:n}=_.properties.selection,r=B.record[t];s("propSelection",{itemName:_.name,itemType:_.type,prop:e,target:n,source:t,sourceId:r})}if(262144&t.$$.dirty[1])for(const t in P)t===X&&n(1,$[X]=P[t],$);7&t.$$.dirty[0]|1048576&t.$$.dirty[1]&&n(28,r=(t=!1)=>{let e;return y||"number"!==_.type&&"string"!==_.type||!_.refItemAlt?.startsWith||!_.refItemAlt.startsWith("owner.")||+Y($)?y||"number"!==_.type&&"string"!==_.type||!_.refItem?.startsWith||!_.refItem.startsWith("owner.")?(e=Y($),!e&&_.properties?.useId&&(e=$._id),t&&(e=!!e),void 0===e?"":e):(e=Y(a,_.refItem),void 0===e?"":e):(e=Y(a,_.refItemAlt),void 0===e?"":e)}),2&t.$$.dirty[0]&&(i=Y($))},n(29,o=((t=X)=>{let e=$["_"+t];return e=checkDate(e),void 0===e?"":e})()),[_,$,y,C,N,p,g,w,b,v,I,E,A,S,T,R,D,x,O,M,F,L,q,V,k,U,z,K,r,o,c,l,h,m,f,W,j,G,X,Q,(t=X)=>{let e=Y($);return e?new Date(e):""===p?(()=>{const t=new Date;return new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate()-1,23))})():void 0},(t=X)=>{const e=Y($,t+"_from"),n=Y($,t+"_to");return{from:void 0===e?e:new Date(e),to:void 0===n?n:new Date(n)}},t=>({detail:e})=>{let{value:r,checked:o,range:a}=e;void 0!==o&&(r=o);const c=X+(a||"");n(1,$[c]=t?formatDateTime(r,"%d.%m.%Y"):r,$);const l=Object.values($).every(t=>!t)&&r;s("notify",{oldValue:i,value:r,add:l,itemName:c,desc:e.description}),"boolean"===_.type&&_.process&&Z(o)},({detail:t})=>{s("record",t)},({detail:t})=>{s("multi",t)},()=>n(26,z=!0),()=>"object"===_.type?"comment_"+Q:Q,({detail:t})=>{n(27,K=t)},({detail:t})=>{const{designation:e}=_;n(29,o=e+": "+(t||"(Neu)"))},P,B,a,function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)},function(e){bubble(t,e)}]}class InputFormField extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-rxh0vh-style")||add_css$3(),init(this,t,instance$4,create_fragment$4,safe_not_equal,{praefix:5,item:0,listName:6,fullRecord:7,record:1,recordId:2,noForm:8,classId:9,eventId:10,disabled:3,selectionFields:11,formnovalidate:12,selection:13,notifyList:24,numberInput:14,deList:15,required:4,isTemplate:16,toDelete:17,reqQuantity:18,currency:19,changeValue:49,propSelection:50,multiValues:20,shortEdit:21,initFinished:22,dateInput:23},[-1,-1,-1])}}var Html5QrcodeSupportedFormats;!function(t){t[t.QR_CODE=0]="QR_CODE",t[t.AZTEC=1]="AZTEC",t[t.CODABAR=2]="CODABAR",t[t.CODE_39=3]="CODE_39",t[t.CODE_93=4]="CODE_93",t[t.CODE_128=5]="CODE_128",t[t.DATA_MATRIX=6]="DATA_MATRIX",t[t.MAXICODE=7]="MAXICODE",t[t.ITF=8]="ITF",t[t.EAN_13=9]="EAN_13",t[t.EAN_8=10]="EAN_8",t[t.PDF_417=11]="PDF_417",t[t.RSS_14=12]="RSS_14",t[t.RSS_EXPANDED=13]="RSS_EXPANDED",t[t.UPC_A=14]="UPC_A",t[t.UPC_E=15]="UPC_E",t[t.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(Html5QrcodeSupportedFormats||(Html5QrcodeSupportedFormats={}));var html5QrcodeSupportedFormatsTextMap=new Map([[Html5QrcodeSupportedFormats.QR_CODE,"QR_CODE"],[Html5QrcodeSupportedFormats.AZTEC,"AZTEC"],[Html5QrcodeSupportedFormats.CODABAR,"CODABAR"],[Html5QrcodeSupportedFormats.CODE_39,"CODE_39"],[Html5QrcodeSupportedFormats.CODE_93,"CODE_93"],[Html5QrcodeSupportedFormats.CODE_128,"CODE_128"],[Html5QrcodeSupportedFormats.DATA_MATRIX,"DATA_MATRIX"],[Html5QrcodeSupportedFormats.MAXICODE,"MAXICODE"],[Html5QrcodeSupportedFormats.ITF,"ITF"],[Html5QrcodeSupportedFormats.EAN_13,"EAN_13"],[Html5QrcodeSupportedFormats.EAN_8,"EAN_8"],[Html5QrcodeSupportedFormats.PDF_417,"PDF_417"],[Html5QrcodeSupportedFormats.RSS_14,"RSS_14"],[Html5QrcodeSupportedFormats.RSS_EXPANDED,"RSS_EXPANDED"],[Html5QrcodeSupportedFormats.UPC_A,"UPC_A"],[Html5QrcodeSupportedFormats.UPC_E,"UPC_E"],[Html5QrcodeSupportedFormats.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),DecodedTextType,Html5QrcodeScanType;function isValidHtml5QrcodeSupportedFormats(t){return Object.values(Html5QrcodeSupportedFormats).includes(t)}!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.URL=1]="URL"}(DecodedTextType||(DecodedTextType={})),function(t){t[t.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",t[t.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"}(Html5QrcodeScanType||(Html5QrcodeScanType={}));var Html5QrcodeConstants=function(){function t(){}return t.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",t.SCAN_DEFAULT_FPS=2,t.DEFAULT_DISABLE_FLIP=!1,t.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,t.DEFAULT_SUPPORTED_SCAN_TYPE=[Html5QrcodeScanType.SCAN_TYPE_CAMERA,Html5QrcodeScanType.SCAN_TYPE_FILE],t}(),QrcodeResultFormat=function(){function t(t,e){this.format=t,this.formatName=e}return t.prototype.toString=function(){return this.formatName},t.create=function(e){if(!html5QrcodeSupportedFormatsTextMap.has(e))throw"".concat(e," not in html5QrcodeSupportedFormatsTextMap");return new t(e,html5QrcodeSupportedFormatsTextMap.get(e))},t}(),Html5QrcodeResultFactory=function(){function t(){}return t.createFromText=function(t){return{decodedText:t,result:{text:t}}},t.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},t}(),Html5QrcodeErrorTypes;!function(t){t[t.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",t[t.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",t[t.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"}(Html5QrcodeErrorTypes||(Html5QrcodeErrorTypes={}));var Html5QrcodeErrorFactory=function(){function t(){}return t.createFrom=function(t){return{errorMessage:t,type:Html5QrcodeErrorTypes.UNKWOWN_ERROR}},t}(),BaseLoggger=function(){function t(t){this.verbose=t}return t.prototype.log=function(t){this.verbose&&console.log(t)},t.prototype.warn=function(t){this.verbose&&console.warn(t)},t.prototype.logError=function(t,e){(this.verbose||!0===e)&&console.error(t)},t.prototype.logErrors=function(t){if(0===t.length)throw"Logger#logError called without arguments";this.verbose&&console.error(t)},t}();function isNullOrUndefined(t){return null==t}var Html5QrcodeStrings=function(){function t(){}return t.codeParseError=function(t){return"QR code parse error, error = ".concat(t)},t.errorGettingUserMedia=function(t){return"Error getting userMedia, error = ".concat(t)},t.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},t.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},t.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},t.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},t.scannerPaused=function(){return"Scanner paused"},t}(),VideoConstraintsUtil=function(){function t(){}return t.isMediaStreamConstraintsValid=function(t,e){if("object"!=typeof t){var n=typeof t;return e.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(n,"."),!0),!1}for(var r=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),o=0,i=Object.keys(t);o<i.length;o++){var a=i[o];if(r.has(a))return e.logError("".concat(a," is not supported videoConstaints."),!0),!1}return!0},t}(),zxingJs_umd=createCommonjsModule(function(t,e){!function(t){function e(t){return null==t}var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])};function r(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function o(t,e){var n=Object.setPrototypeOf;n?n(t,e):t.__proto__=e}function i(t,e){void 0===e&&(e=t.constructor);var n=Error.captureStackTrace;n&&n(t,e)}var a,s=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),o(r,n.prototype),i(r),r}return r(e,t),e}(Error);class c extends s{constructor(t=void 0){super(t),this.message=t}getKind(){return this.constructor.kind}}c.kind="Exception";class l extends c{}l.kind="ArgumentException";class d extends c{}d.kind="IllegalArgumentException";class u{constructor(t){if(this.binarizer=t,null===t)throw new d("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(t,e){return this.binarizer.getBlackRow(t,e)}getBlackMatrix(){return null!==this.matrix&&void 0!==this.matrix||(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(t,e,n,r){const o=this.binarizer.getLuminanceSource().crop(t,e,n,r);return new u(this.binarizer.createBinarizer(o))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const t=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new u(this.binarizer.createBinarizer(t))}rotateCounterClockwise45(){const t=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new u(this.binarizer.createBinarizer(t))}toString(){try{return this.getBlackMatrix().toString()}catch(t){return""}}}class h extends c{static getChecksumInstance(){return new h}}h.kind="ChecksumException";class m{constructor(t){this.source=t}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class f{static arraycopy(t,e,n,r,o){for(;o--;)n[r++]=t[e++]}static currentTimeMillis(){return Date.now()}}class p extends c{}p.kind="IndexOutOfBoundsException";class _ extends p{constructor(t=void 0,e=void 0){super(e),this.index=t,this.message=e}}_.kind="ArrayIndexOutOfBoundsException";class g{static fill(t,e){for(let n=0,r=t.length;n<r;n++)t[n]=e}static fillWithin(t,e,n,r){g.rangeCheck(t.length,e,n);for(let o=e;o<n;o++)t[o]=r}static rangeCheck(t,e,n){if(e>n)throw new d("fromIndex("+e+") > toIndex("+n+")");if(e<0)throw new _(e);if(n>t)throw new _(n)}static asList(...t){return t}static create(t,e,n){return Array.from({length:t}).map(t=>Array.from({length:e}).fill(n))}static createInt32Array(t,e,n){return Array.from({length:t}).map(t=>Int32Array.from({length:e}).fill(n))}static equals(t,e){if(!t)return!1;if(!e)return!1;if(!t.length)return!1;if(!e.length)return!1;if(t.length!==e.length)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]!==e[n])return!1;return!0}static hashCode(t){if(null===t)return 0;let e=1;for(const n of t)e=31*e+n;return e}static fillUint8Array(t,e){for(let n=0;n!==t.length;n++)t[n]=e}static copyOf(t,e){return t.slice(0,e)}static copyOfUint8Array(t,e){if(t.length<=e){const n=new Uint8Array(e);return n.set(t),n}return t.slice(0,e)}static copyOfRange(t,e,n){const r=n-e,o=new Int32Array(r);return f.arraycopy(t,e,o,0,r),o}static binarySearch(t,e,n){void 0===n&&(n=g.numberComparator);let r=0,o=t.length-1;for(;r<=o;){const i=o+r>>1,a=n(e,t[i]);if(a>0)r=i+1;else{if(!(a<0))return i;o=i-1}}return-r-1}static numberComparator(t,e){return t-e}}class w{static numberOfTrailingZeros(t){let e;if(0===t)return 32;let n=31;return e=t<<16,0!==e&&(n-=16,t=e),e=t<<8,0!==e&&(n-=8,t=e),e=t<<4,0!==e&&(n-=4,t=e),e=t<<2,0!==e&&(n-=2,t=e),n-(t<<1>>>31)}static numberOfLeadingZeros(t){if(0===t)return 32;let e=1;return t>>>16==0&&(e+=16,t<<=16),t>>>24==0&&(e+=8,t<<=8),t>>>28==0&&(e+=4,t<<=4),t>>>30==0&&(e+=2,t<<=2),e-=t>>>31,e}static toHexString(t){return t.toString(16)}static toBinaryString(t){return String(parseInt(String(t),2))}static bitCount(t){return t=(t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135,t+=t>>>8,63&(t+=t>>>16)}static truncDivision(t,e){return Math.trunc(t/e)}static parseInt(t,e=void 0){return parseInt(t,e)}}w.MIN_VALUE_32_BITS=-2147483648,w.MAX_VALUE=Number.MAX_SAFE_INTEGER;class ${constructor(t,e){void 0===t?(this.size=0,this.bits=new Int32Array(1)):(this.size=t,this.bits=null==e?$.makeArray(t):e)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(t){if(t>32*this.bits.length){const e=$.makeArray(t);f.arraycopy(this.bits,0,e,0,this.bits.length),this.bits=e}}get(t){return!!(this.bits[Math.floor(t/32)]&1<<(31&t))}set(t){this.bits[Math.floor(t/32)]|=1<<(31&t)}flip(t){this.bits[Math.floor(t/32)]^=1<<(31&t)}getNextSet(t){const e=this.size;if(t>=e)return e;const n=this.bits;let r=Math.floor(t/32),o=n[r];o&=~((1<<(31&t))-1);const i=n.length;for(;0===o;){if(++r===i)return e;o=n[r]}const a=32*r+w.numberOfTrailingZeros(o);return a>e?e:a}getNextUnset(t){const e=this.size;if(t>=e)return e;const n=this.bits;let r=Math.floor(t/32),o=~n[r];o&=~((1<<(31&t))-1);const i=n.length;for(;0===o;){if(++r===i)return e;o=~n[r]}const a=32*r+w.numberOfTrailingZeros(o);return a>e?e:a}setBulk(t,e){this.bits[Math.floor(t/32)]=e}setRange(t,e){if(e<t||t<0||e>this.size)throw new d;if(e===t)return;e--;const n=Math.floor(t/32),r=Math.floor(e/32),o=this.bits;for(let i=n;i<=r;i++){const a=(2<<(i<r?31:31&e))-(1<<(i>n?0:31&t));o[i]|=a}}clear(){const t=this.bits.length,e=this.bits;for(let n=0;n<t;n++)e[n]=0}isRange(t,e,n){if(e<t||t<0||e>this.size)throw new d;if(e===t)return!0;e--;const r=Math.floor(t/32),o=Math.floor(e/32),i=this.bits;for(let a=r;a<=o;a++){const s=(2<<(a<o?31:31&e))-(1<<(a>r?0:31&t))&4294967295;if((i[a]&s)!==(n?s:0))return!1}return!0}appendBit(t){this.ensureCapacity(this.size+1),t&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(t,e){if(e<0||e>32)throw new d("Num bits must be between 0 and 32");this.ensureCapacity(this.size+e);for(let n=e;n>0;n--)this.appendBit(1==(t>>n-1&1))}appendBitArray(t){const e=t.size;this.ensureCapacity(this.size+e);for(let n=0;n<e;n++)this.appendBit(t.get(n))}xor(t){if(this.size!==t.size)throw new d("Sizes don't match");const e=this.bits;for(let n=0,r=e.length;n<r;n++)e[n]^=t.bits[n]}toBytes(t,e,n,r){for(let o=0;o<r;o++){let r=0;for(let e=0;e<8;e++)this.get(t)&&(r|=1<<7-e),t++;e[n+o]=r}}getBitArray(){return this.bits}reverse(){const t=new Int32Array(this.bits.length),e=Math.floor((this.size-1)/32),n=e+1,r=this.bits;for(let o=0;o<n;o++){let n=r[o];n=n>>1&1431655765|(1431655765&n)<<1,n=n>>2&858993459|(858993459&n)<<2,n=n>>4&252645135|(252645135&n)<<4,n=n>>8&16711935|(16711935&n)<<8,n=n>>16&65535|(65535&n)<<16,t[e-o]=n}if(this.size!==32*n){const e=32*n-this.size;let r=t[0]>>>e;for(let o=1;o<n;o++){const n=t[o];r|=n<<32-e,t[o-1]=r,r=n>>>e}t[n-1]=r}this.bits=t}static makeArray(t){return new Int32Array(Math.floor((t+31)/32))}equals(t){if(!(t instanceof $))return!1;const e=t;return this.size===e.size&&g.equals(this.bits,e.bits)}hashCode(){return 31*this.size+g.hashCode(this.bits)}toString(){let t="";for(let e=0,n=this.size;e<n;e++)7&e||(t+=" "),t+=this.get(e)?"X":".";return t}clone(){return new $(this.size,this.bits.slice())}}!function(t){t[t.OTHER=0]="OTHER",t[t.PURE_BARCODE=1]="PURE_BARCODE",t[t.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",t[t.TRY_HARDER=3]="TRY_HARDER",t[t.CHARACTER_SET=4]="CHARACTER_SET",t[t.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",t[t.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",t[t.ASSUME_GS1=7]="ASSUME_GS1",t[t.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",t[t.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",t[t.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"}(a||(a={}));var y,b=a;class v extends c{static getFormatInstance(){return new v}}v.kind="FormatException",function(t){t[t.Cp437=0]="Cp437",t[t.ISO8859_1=1]="ISO8859_1",t[t.ISO8859_2=2]="ISO8859_2",t[t.ISO8859_3=3]="ISO8859_3",t[t.ISO8859_4=4]="ISO8859_4",t[t.ISO8859_5=5]="ISO8859_5",t[t.ISO8859_6=6]="ISO8859_6",t[t.ISO8859_7=7]="ISO8859_7",t[t.ISO8859_8=8]="ISO8859_8",t[t.ISO8859_9=9]="ISO8859_9",t[t.ISO8859_10=10]="ISO8859_10",t[t.ISO8859_11=11]="ISO8859_11",t[t.ISO8859_13=12]="ISO8859_13",t[t.ISO8859_14=13]="ISO8859_14",t[t.ISO8859_15=14]="ISO8859_15",t[t.ISO8859_16=15]="ISO8859_16",t[t.SJIS=16]="SJIS",t[t.Cp1250=17]="Cp1250",t[t.Cp1251=18]="Cp1251",t[t.Cp1252=19]="Cp1252",t[t.Cp1256=20]="Cp1256",t[t.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",t[t.UTF8=22]="UTF8",t[t.ASCII=23]="ASCII",t[t.Big5=24]="Big5",t[t.GB18030=25]="GB18030",t[t.EUC_KR=26]="EUC_KR"}(y||(y={}));class I{constructor(t,e,n,...r){this.valueIdentifier=t,this.name=n,this.values="number"==typeof e?Int32Array.from([e]):e,this.otherEncodingNames=r,I.VALUE_IDENTIFIER_TO_ECI.set(t,this),I.NAME_TO_ECI.set(n,this);const o=this.values;for(let t=0,e=o.length;t!==e;t++){const e=o[t];I.VALUES_TO_ECI.set(e,this)}for(const t of r)I.NAME_TO_ECI.set(t,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(t){if(t<0||t>=900)throw new v("incorect value");const e=I.VALUES_TO_ECI.get(t);if(void 0===e)throw new v("incorect value");return e}static getCharacterSetECIByName(t){const e=I.NAME_TO_ECI.get(t);if(void 0===e)throw new v("incorect value");return e}equals(t){if(!(t instanceof I))return!1;const e=t;return this.getName()===e.getName()}}I.VALUE_IDENTIFIER_TO_ECI=new Map,I.VALUES_TO_ECI=new Map,I.NAME_TO_ECI=new Map,I.Cp437=new I(y.Cp437,Int32Array.from([0,2]),"Cp437"),I.ISO8859_1=new I(y.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),I.ISO8859_2=new I(y.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),I.ISO8859_3=new I(y.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),I.ISO8859_4=new I(y.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),I.ISO8859_5=new I(y.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),I.ISO8859_6=new I(y.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),I.ISO8859_7=new I(y.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),I.ISO8859_8=new I(y.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),I.ISO8859_9=new I(y.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),I.ISO8859_10=new I(y.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),I.ISO8859_11=new I(y.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),I.ISO8859_13=new I(y.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),I.ISO8859_14=new I(y.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),I.ISO8859_15=new I(y.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),I.ISO8859_16=new I(y.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),I.SJIS=new I(y.SJIS,20,"SJIS","Shift_JIS"),I.Cp1250=new I(y.Cp1250,21,"Cp1250","windows-1250"),I.Cp1251=new I(y.Cp1251,22,"Cp1251","windows-1251"),I.Cp1252=new I(y.Cp1252,23,"Cp1252","windows-1252"),I.Cp1256=new I(y.Cp1256,24,"Cp1256","windows-1256"),I.UnicodeBigUnmarked=new I(y.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),I.UTF8=new I(y.UTF8,26,"UTF8","UTF-8"),I.ASCII=new I(y.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),I.Big5=new I(y.Big5,28,"Big5"),I.GB18030=new I(y.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),I.EUC_KR=new I(y.EUC_KR,30,"EUC_KR","EUC-KR");class C extends c{}C.kind="UnsupportedOperationException";class E{static decode(t,e){const n=this.encodingName(e);return this.customDecoder?this.customDecoder(t,n):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(n)?this.decodeFallback(t,n):new TextDecoder(n).decode(t)}static shouldDecodeOnFallback(t){return!E.isBrowser()&&"ISO-8859-1"===t}static encode(t,e){const n=this.encodingName(e);return this.customEncoder?this.customEncoder(t,n):"undefined"==typeof TextEncoder?this.encodeFallback(t):(new TextEncoder).encode(t)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)}static encodingName(t){return"string"==typeof t?t:t.getName()}static encodingCharacterSet(t){return t instanceof I?t:I.getCharacterSetECIByName(t)}static decodeFallback(t,e){const n=this.encodingCharacterSet(e);if(E.isDecodeFallbackSupported(n)){let e="";for(let n=0,r=t.length;n<r;n++){let r=t[n].toString(16);r.length<2&&(r="0"+r),e+="%"+r}return decodeURIComponent(e)}if(n.equals(I.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(t.buffer));throw new C(`Encoding ${this.encodingName(e)} not supported by fallback.`)}static isDecodeFallbackSupported(t){return t.equals(I.UTF8)||t.equals(I.ISO8859_1)||t.equals(I.ASCII)}static encodeFallback(t){const e=btoa(unescape(encodeURIComponent(t))).split(""),n=[];for(let t=0;t<e.length;t++)n.push(e[t].charCodeAt(0));return new Uint8Array(n)}}class A{static castAsNonUtf8Char(t,e=null){const n=e?e.getName():this.ISO88591;return E.decode(new Uint8Array([t]),n)}static guessEncoding(t,e){if(null!=e&&void 0!==e.get(b.CHARACTER_SET))return e.get(b.CHARACTER_SET).toString();const n=t.length;let r=!0,o=!0,i=!0,a=0,s=0,c=0,l=0,d=0,u=0,h=0,m=0,f=0,p=0,_=0;const g=t.length>3&&239===t[0]&&187===t[1]&&191===t[2];for(let e=0;e<n&&(r||o||i);e++){const n=255&t[e];i&&(a>0?128&n?a--:i=!1:128&n&&(64&n?(a++,32&n?(a++,16&n?(a++,8&n?i=!1:l++):c++):s++):i=!1)),r&&(n>127&&n<160?r=!1:n>159&&(n<192||215===n||247===n)&&_++),o&&(d>0?n<64||127===n||n>252?o=!1:d--:128===n||160===n||n>239?o=!1:n>160&&n<224?(u++,m=0,h++,h>f&&(f=h)):n>127?(d++,h=0,m++,m>p&&(p=m)):(h=0,m=0))}return i&&a>0&&(i=!1),o&&d>0&&(o=!1),i&&(g||s+c+l>0)?A.UTF8:o&&(A.ASSUME_SHIFT_JIS||f>=3||p>=3)?A.SHIFT_JIS:r&&o?2===f&&2===u||10*_>=n?A.SHIFT_JIS:A.ISO88591:r?A.ISO88591:o?A.SHIFT_JIS:i?A.UTF8:A.PLATFORM_DEFAULT_ENCODING}static format(t,...e){let n=-1;function r(t,r,o,i,a,s){if("%%"===t)return"%";if(void 0===e[++n])return;t=i?parseInt(i.substr(1)):void 0;let c,l=a?parseInt(a.substr(1)):void 0;switch(s){case"s":c=e[n];break;case"c":c=e[n][0];break;case"f":c=parseFloat(e[n]).toFixed(t);break;case"p":c=parseFloat(e[n]).toPrecision(t);break;case"e":c=parseFloat(e[n]).toExponential(t);break;case"x":c=parseInt(e[n]).toString(l||16);break;case"d":c=parseFloat(parseInt(e[n],l||10).toPrecision(t)).toFixed(0)}c="object"==typeof c?JSON.stringify(c):(+c).toString(l);let d=parseInt(o),u=o&&o[0]+""=="0"?"0":" ";for(;c.length<d;)c=void 0!==r?c+u:u+c;return c}let o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return t.replace(o,r)}static getBytes(t,e){return E.encode(t,e)}static getCharCode(t,e=0){return t.charCodeAt(e)}static getCharAt(t){return String.fromCharCode(t)}}A.SHIFT_JIS=I.SJIS.getName(),A.GB2312="GB2312",A.ISO88591=I.ISO8859_1.getName(),A.EUC_JP="EUC_JP",A.UTF8=I.UTF8.getName(),A.PLATFORM_DEFAULT_ENCODING=A.UTF8,A.ASSUME_SHIFT_JIS=!1;class S{constructor(t=""){this.value=t}enableDecoding(t){return this.encoding=t,this}append(t){return"string"==typeof t?this.value+=t.toString():this.encoding?this.value+=A.castAsNonUtf8Char(t,this.encoding):this.value+=String.fromCharCode(t),this}appendChars(t,e,n){for(let r=e;e<e+n;r++)this.append(t[r]);return this}length(){return this.value.length}charAt(t){return this.value.charAt(t)}deleteCharAt(t){this.value=this.value.substr(0,t)+this.value.substring(t+1)}setCharAt(t,e){this.value=this.value.substr(0,t)+e+this.value.substr(t+1)}substring(t,e){return this.value.substring(t,e)}setLengthToZero(){this.value=""}toString(){return this.value}insert(t,e){this.value=this.value.substr(0,t)+e+this.value.substr(t+e.length)}}class k{constructor(t,e,n,r){if(this.width=t,this.height=e,this.rowSize=n,this.bits=r,null==e&&(e=t),this.height=e,t<1||e<1)throw new d("Both dimensions must be greater than 0");null==n&&(n=Math.floor((t+31)/32)),this.rowSize=n,null==r&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(t){const e=t.length,n=t[0].length,r=new k(n,e);for(let o=0;o<e;o++){const e=t[o];for(let t=0;t<n;t++)e[t]&&r.set(t,o)}return r}static parseFromString(t,e,n){if(null===t)throw new d("stringRepresentation cannot be null");const r=new Array(t.length);let o=0,i=0,a=-1,s=0,c=0;for(;c<t.length;)if("\n"===t.charAt(c)||"\r"===t.charAt(c)){if(o>i){if(-1===a)a=o-i;else if(o-i!==a)throw new d("row lengths do not match");i=o,s++}c++}else if(t.substring(c,c+e.length)===e)c+=e.length,r[o]=!0,o++;else{if(t.substring(c,c+n.length)!==n)throw new d("illegal character encountered: "+t.substring(c));c+=n.length,r[o]=!1,o++}if(o>i){if(-1===a)a=o-i;else if(o-i!==a)throw new d("row lengths do not match");s++}const l=new k(a,s);for(let t=0;t<o;t++)r[t]&&l.set(Math.floor(t%a),Math.floor(t/a));return l}get(t,e){const n=e*this.rowSize+Math.floor(t/32);return!!(this.bits[n]>>>(31&t)&1)}set(t,e){const n=e*this.rowSize+Math.floor(t/32);this.bits[n]|=1<<(31&t)&4294967295}unset(t,e){const n=e*this.rowSize+Math.floor(t/32);this.bits[n]&=~(1<<(31&t)&4294967295)}flip(t,e){const n=e*this.rowSize+Math.floor(t/32);this.bits[n]^=1<<(31&t)&4294967295}xor(t){if(this.width!==t.getWidth()||this.height!==t.getHeight()||this.rowSize!==t.getRowSize())throw new d("input matrix dimensions do not match");const e=new $(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let o=0,i=this.height;o<i;o++){const i=o*n,a=t.getRow(o,e).getBitArray();for(let t=0;t<n;t++)r[i+t]^=a[t]}}clear(){const t=this.bits,e=t.length;for(let n=0;n<e;n++)t[n]=0}setRegion(t,e,n,r){if(e<0||t<0)throw new d("Left and top must be nonnegative");if(r<1||n<1)throw new d("Height and width must be at least 1");const o=t+n,i=e+r;if(i>this.height||o>this.width)throw new d("The region must fit inside the matrix");const a=this.rowSize,s=this.bits;for(let n=e;n<i;n++){const e=n*a;for(let n=t;n<o;n++)s[e+Math.floor(n/32)]|=1<<(31&n)&4294967295}}getRow(t,e){null==e||e.getSize()<this.width?e=new $(this.width):e.clear();const n=this.rowSize,r=this.bits,o=t*n;for(let t=0;t<n;t++)e.setBulk(32*t,r[o+t]);return e}setRow(t,e){f.arraycopy(e.getBitArray(),0,this.bits,t*this.rowSize,this.rowSize)}rotate180(){const t=this.getWidth(),e=this.getHeight();let n=new $(t),r=new $(t);for(let t=0,o=Math.floor((e+1)/2);t<o;t++)n=this.getRow(t,n),r=this.getRow(e-1-t,r),n.reverse(),r.reverse(),this.setRow(t,r),this.setRow(e-1-t,n)}getEnclosingRectangle(){const t=this.width,e=this.height,n=this.rowSize,r=this.bits;let o=t,i=e,a=-1,s=-1;for(let t=0;t<e;t++)for(let e=0;e<n;e++){const c=r[t*n+e];if(0!==c){if(t<i&&(i=t),t>s&&(s=t),32*e<o){let t=0;for(;!(c<<31-t&4294967295);)t++;32*e+t<o&&(o=32*e+t)}if(32*e+31>a){let t=31;for(;c>>>t===0;)t--;32*e+t>a&&(a=32*e+t)}}}return a<o||s<i?null:Int32Array.from([o,i,a-o+1,s-i+1])}getTopLeftOnBit(){const t=this.rowSize,e=this.bits;let n=0;for(;n<e.length&&0===e[n];)n++;if(n===e.length)return null;const r=n/t;let o=n%t*32;const i=e[n];let a=0;for(;!(i<<31-a&4294967295);)a++;return o+=a,Int32Array.from([o,r])}getBottomRightOnBit(){const t=this.rowSize,e=this.bits;let n=e.length-1;for(;n>=0&&0===e[n];)n--;if(n<0)return null;const r=Math.floor(n/t);let o=32*Math.floor(n%t);const i=e[n];let a=31;for(;i>>>a===0;)a--;return o+=a,Int32Array.from([o,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(t){if(!(t instanceof k))return!1;const e=t;return this.width===e.width&&this.height===e.height&&this.rowSize===e.rowSize&&g.equals(this.bits,e.bits)}hashCode(){let t=this.width;return t=31*t+this.width,t=31*t+this.height,t=31*t+this.rowSize,t=31*t+g.hashCode(this.bits),t}toString(t="X ",e=" ",n="\n"){return this.buildToString(t,e,n)}buildToString(t,e,n){let r=new S;for(let o=0,i=this.height;o<i;o++){for(let n=0,i=this.width;n<i;n++)r.append(this.get(n,o)?t:e);r.append(n)}return r.toString()}clone(){return new k(this.width,this.height,this.rowSize,this.bits.slice())}}class T extends c{static getNotFoundInstance(){return new T}}T.kind="NotFoundException";class R extends m{constructor(t){super(t),this.luminances=R.EMPTY,this.buckets=new Int32Array(R.LUMINANCE_BUCKETS)}getBlackRow(t,e){const n=this.getLuminanceSource(),r=n.getWidth();null==e||e.getSize()<r?e=new $(r):e.clear(),this.initArrays(r);const o=n.getRow(t,this.luminances),i=this.buckets;for(let t=0;t<r;t++)i[(255&o[t])>>R.LUMINANCE_SHIFT]++;const a=R.estimateBlackPoint(i);if(r<3)for(let t=0;t<r;t++)(255&o[t])<a&&e.set(t);else{let t=255&o[0],n=255&o[1];for(let i=1;i<r-1;i++){const r=255&o[i+1];(4*n-t-r)/2<a&&e.set(i),t=n,n=r}}return e}getBlackMatrix(){const t=this.getLuminanceSource(),e=t.getWidth(),n=t.getHeight(),r=new k(e,n);this.initArrays(e);const o=this.buckets;for(let r=1;r<5;r++){const i=Math.floor(n*r/5),a=t.getRow(i,this.luminances),s=Math.floor(4*e/5);for(let t=Math.floor(e/5);t<s;t++)o[(255&a[t])>>R.LUMINANCE_SHIFT]++}const i=R.estimateBlackPoint(o),a=t.getMatrix();for(let t=0;t<n;t++){const n=t*e;for(let o=0;o<e;o++)(255&a[n+o])<i&&r.set(o,t)}return r}createBinarizer(t){return new R(t)}initArrays(t){this.luminances.length<t&&(this.luminances=new Uint8ClampedArray(t));const e=this.buckets;for(let t=0;t<R.LUMINANCE_BUCKETS;t++)e[t]=0}static estimateBlackPoint(t){const e=t.length;let n=0,r=0,o=0;for(let i=0;i<e;i++)t[i]>o&&(r=i,o=t[i]),t[i]>n&&(n=t[i]);let i=0,a=0;for(let n=0;n<e;n++){const e=n-r,o=t[n]*e*e;o>a&&(i=n,a=o)}if(r>i){const t=r;r=i,i=t}if(i-r<=e/16)throw new T;let s=i-1,c=-1;for(let e=i-1;e>r;e--){const o=e-r,a=o*o*(i-e)*(n-t[e]);a>c&&(s=e,c=a)}return s<<R.LUMINANCE_SHIFT}}R.LUMINANCE_BITS=5,R.LUMINANCE_SHIFT=8-R.LUMINANCE_BITS,R.LUMINANCE_BUCKETS=1<<R.LUMINANCE_BITS,R.EMPTY=Uint8ClampedArray.from([0]);class N extends R{constructor(t){super(t),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;const t=this.getLuminanceSource(),e=t.getWidth(),n=t.getHeight();if(e>=N.MINIMUM_DIMENSION&&n>=N.MINIMUM_DIMENSION){const r=t.getMatrix();let o=e>>N.BLOCK_SIZE_POWER;0!==(e&N.BLOCK_SIZE_MASK)&&o++;let i=n>>N.BLOCK_SIZE_POWER;0!==(n&N.BLOCK_SIZE_MASK)&&i++;const a=N.calculateBlackPoints(r,o,i,e,n),s=new k(e,n);N.calculateThresholdForBlock(r,o,i,e,n,a,s),this.matrix=s}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(t){return new N(t)}static calculateThresholdForBlock(t,e,n,r,o,i,a){const s=o-N.BLOCK_SIZE,c=r-N.BLOCK_SIZE;for(let o=0;o<n;o++){let l=o<<N.BLOCK_SIZE_POWER;l>s&&(l=s);const d=N.cap(o,2,n-3);for(let n=0;n<e;n++){let o=n<<N.BLOCK_SIZE_POWER;o>c&&(o=c);const s=N.cap(n,2,e-3);let u=0;for(let t=-2;t<=2;t++){const e=i[d+t];u+=e[s-2]+e[s-1]+e[s]+e[s+1]+e[s+2]}const h=u/25;N.thresholdBlock(t,o,l,h,r,a)}}}static cap(t,e,n){return t<e?e:t>n?n:t}static thresholdBlock(t,e,n,r,o,i){for(let a=0,s=n*o+e;a<N.BLOCK_SIZE;a++,s+=o)for(let o=0;o<N.BLOCK_SIZE;o++)(255&t[s+o])<=r&&i.set(e+o,n+a)}static calculateBlackPoints(t,e,n,r,o){const i=o-N.BLOCK_SIZE,a=r-N.BLOCK_SIZE,s=new Array(n);for(let o=0;o<n;o++){s[o]=new Int32Array(e);let n=o<<N.BLOCK_SIZE_POWER;n>i&&(n=i);for(let i=0;i<e;i++){let e=i<<N.BLOCK_SIZE_POWER;e>a&&(e=a);let c=0,l=255,d=0;for(let o=0,i=n*r+e;o<N.BLOCK_SIZE;o++,i+=r){for(let e=0;e<N.BLOCK_SIZE;e++){const n=255&t[i+e];c+=n,n<l&&(l=n),n>d&&(d=n)}if(d-l>N.MIN_DYNAMIC_RANGE)for(o++,i+=r;o<N.BLOCK_SIZE;o++,i+=r)for(let e=0;e<N.BLOCK_SIZE;e++)c+=255&t[i+e]}let u=c>>2*N.BLOCK_SIZE_POWER;if(d-l<=N.MIN_DYNAMIC_RANGE&&(u=l/2,o>0&&i>0)){const t=(s[o-1][i]+2*s[o][i-1]+s[o-1][i-1])/4;l<t&&(u=t)}s[o][i]=u}}return s}}N.BLOCK_SIZE_POWER=3,N.BLOCK_SIZE=1<<N.BLOCK_SIZE_POWER,N.BLOCK_SIZE_MASK=N.BLOCK_SIZE-1,N.MINIMUM_DIMENSION=5*N.BLOCK_SIZE,N.MIN_DYNAMIC_RANGE=24;class D{constructor(t,e){this.width=t,this.height=e}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(t,e,n,r){throw new C("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new C("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new C("This luminance source does not support rotation by 45 degrees.")}toString(){const t=new Uint8ClampedArray(this.width);let e=new S;for(let n=0;n<this.height;n++){const r=this.getRow(n,t);for(let t=0;t<this.width;t++){const n=255&r[t];let o;o=n<64?"#":n<128?"+":n<192?".":" ",e.append(o)}e.append("\n")}return e.toString()}}class x extends D{constructor(t){super(t.getWidth(),t.getHeight()),this.delegate=t}getRow(t,e){const n=this.delegate.getRow(t,e),r=this.getWidth();for(let t=0;t<r;t++)n[t]=255-(255&n[t]);return n}getMatrix(){const t=this.delegate.getMatrix(),e=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(e);for(let r=0;r<e;r++)n[r]=255-(255&t[r]);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(t,e,n,r){return new x(this.delegate.crop(t,e,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new x(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new x(this.delegate.rotateCounterClockwise45())}}class O extends D{constructor(t){super(t.width,t.height),this.canvas=t,this.tempCanvasElement=null,this.buffer=O.makeBufferFromCanvasImageData(t)}static makeBufferFromCanvasImageData(t){const e=t.getContext("2d").getImageData(0,0,t.width,t.height);return O.toGrayscaleBuffer(e.data,t.width,t.height)}static toGrayscaleBuffer(t,e,n){const r=new Uint8ClampedArray(e*n);for(let e=0,n=0,o=t.length;e<o;e+=4,n++){let o;o=0===t[e+3]?255:306*t[e]+601*t[e+1]+117*t[e+2]+512>>10,r[n]=o}return r}getRow(t,e){if(t<0||t>=this.getHeight())throw new d("Requested row is outside the image: "+t);const n=this.getWidth(),r=t*n;return null===e?e=this.buffer.slice(r,r+n):(e.length<n&&(e=new Uint8ClampedArray(n)),e.set(this.buffer.slice(r,r+n))),e}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(t,e,n,r){return super.crop(t,e,n,r),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(null===this.tempCanvasElement){const t=this.canvas.ownerDocument.createElement("canvas");t.width=this.canvas.width,t.height=this.canvas.height,this.tempCanvasElement=t}return this.tempCanvasElement}rotate(t){const e=this.getTempCanvasElement(),n=e.getContext("2d"),r=t*O.DEGREE_TO_RADIANS,o=this.canvas.width,i=this.canvas.height,a=Math.ceil(Math.abs(Math.cos(r))*o+Math.abs(Math.sin(r))*i),s=Math.ceil(Math.abs(Math.sin(r))*o+Math.abs(Math.cos(r))*i);return e.width=a,e.height=s,n.translate(a/2,s/2),n.rotate(r),n.drawImage(this.canvas,o/-2,i/-2),this.buffer=O.makeBufferFromCanvasImageData(e),this}invert(){return new x(this)}}O.DEGREE_TO_RADIANS=Math.PI/180;class M{constructor(t,e,n){this.deviceId=t,this.label=e,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var P,B=(globalThis||commonjsGlobal||self||window?(globalThis||commonjsGlobal||self||window||void 0).__awaiter:void 0)||function(t,e,n,r){function o(t){return t instanceof n?t:new n(function(e){e(t)})}return new(n||(n=Promise))(function(n,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){t.done?n(t.value):o(t.value).then(a,s)}c((r=r.apply(t,e||[])).next())})};class F{constructor(t,e=500,n){this.reader=t,this.timeBetweenScansMillis=e,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return"undefined"!=typeof navigator}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!(!this.isMediaDevicesSuported||!navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(t){this._timeBetweenDecodingAttempts=t<0?0:t}set hints(t){this._hints=t||null}get hints(){return this._hints}listVideoInputDevices(){return B(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const t=yield navigator.mediaDevices.enumerateDevices(),e=[];for(const n of t){const t="video"===n.kind?"videoinput":n.kind;if("videoinput"!==t)continue;const r={deviceId:n.deviceId||n.id,label:n.label||`Video device ${e.length+1}`,kind:t,groupId:n.groupId};e.push(r)}return e})}getVideoInputDevices(){return B(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(t=>new M(t.deviceId,t.label))})}findDeviceById(t){return B(this,void 0,void 0,function*(){const e=yield this.listVideoInputDevices();return e?e.find(e=>e.deviceId===t):null})}decodeFromInputVideoDevice(t,e){return B(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(t,e)})}decodeOnceFromVideoDevice(t,e){return B(this,void 0,void 0,function*(){let n;this.reset(),n=t?{deviceId:{exact:t}}:{facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,e)})}decodeOnceFromConstraints(t,e){return B(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(t);return yield this.decodeOnceFromStream(n,e)})}decodeOnceFromStream(t,e){return B(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(t,e);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(t,e,n){return B(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(t,e,n)})}decodeFromVideoDevice(t,e,n){return B(this,void 0,void 0,function*(){let r;r=t?{deviceId:{exact:t}}:{facingMode:"environment"};const o={video:r};return yield this.decodeFromConstraints(o,e,n)})}decodeFromConstraints(t,e,n){return B(this,void 0,void 0,function*(){const r=yield navigator.mediaDevices.getUserMedia(t);return yield this.decodeFromStream(r,e,n)})}decodeFromStream(t,e,n){return B(this,void 0,void 0,function*(){this.reset();const r=yield this.attachStreamToVideo(t,e);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(t,e){return B(this,void 0,void 0,function*(){const n=this.prepareVideoElement(e);return this.addVideoSource(n,t),this.videoElement=n,this.stream=t,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(t){return new Promise((e,n)=>this.playVideoOnLoad(t,()=>e()))}playVideoOnLoad(t,e){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(t),t.addEventListener("ended",this.videoEndedListener),t.addEventListener("canplay",this.videoCanPlayListener),t.addEventListener("playing",e),this.tryPlayVideo(t)}isVideoPlaying(t){return t.currentTime>0&&!t.paused&&!t.ended&&t.readyState>2}tryPlayVideo(t){return B(this,void 0,void 0,function*(){if(this.isVideoPlaying(t))console.warn("Trying to play video that is already playing.");else try{yield t.play()}catch(t){console.warn("It was not possible to play the video.")}})}getMediaElement(t,e){const n=document.getElementById(t);if(!n)throw new l(`element with id '${t}' not found`);if(n.nodeName.toLowerCase()!==e.toLowerCase())throw new l(`element with id '${t}' must be an ${e} element`);return n}decodeFromImage(t,e){if(!t&&!e)throw new l("either imageElement with a src set or an url must be provided");return e&&!t?this.decodeFromImageUrl(e):this.decodeFromImageElement(t)}decodeFromVideo(t,e){if(!t&&!e)throw new l("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrl(e):this.decodeFromVideoElement(t)}decodeFromVideoContinuously(t,e,n){if(void 0===t&&void 0===e)throw new l("Either an element with a src set or an URL must be provided");return e&&!t?this.decodeFromVideoUrlContinuously(e,n):this.decodeFromVideoElementContinuously(t,n)}decodeFromImageElement(t){if(!t)throw new l("An image element must be provided.");this.reset();const e=this.prepareImageElement(t);let n;return this.imageElement=e,n=this.isImageLoaded(e)?this.decodeOnce(e,!1,!0):this._decodeOnLoadImage(e),n}decodeFromVideoElement(t){const e=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideo(e)}decodeFromVideoElementContinuously(t,e){const n=this._decodeFromVideoElementSetup(t);return this._decodeOnLoadVideoContinuously(n,e)}_decodeFromVideoElementSetup(t){if(!t)throw new l("A video element must be provided.");this.reset();const e=this.prepareVideoElement(t);return this.videoElement=e,e}decodeFromImageUrl(t){if(!t)throw new l("An URL must be provided.");this.reset();const e=this.prepareImageElement();this.imageElement=e;const n=this._decodeOnLoadImage(e);return e.src=t,n}decodeFromVideoUrl(t){if(!t)throw new l("An URL must be provided.");this.reset();const e=this.prepareVideoElement(),n=this.decodeFromVideoElement(e);return e.src=t,n}decodeFromVideoUrlContinuously(t,e){if(!t)throw new l("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),r=this.decodeFromVideoElementContinuously(n,e);return n.src=t,r}_decodeOnLoadImage(t){return new Promise((e,n)=>{this.imageLoadedListener=()=>this.decodeOnce(t,!1,!0).then(e,n),t.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(t){return B(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(t),yield this.decodeOnce(t)})}_decodeOnLoadVideoContinuously(t,e){return B(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(t),this.decodeContinuously(t,e)})}isImageLoaded(t){return!!t.complete&&0!==t.naturalWidth}prepareImageElement(t){let e;return void 0===t&&(e=document.createElement("img"),e.width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"img")),t instanceof HTMLImageElement&&(e=t),e}prepareVideoElement(t){let e;return t||"undefined"==typeof document||(e=document.createElement("video"),e.width=200,e.height=200),"string"==typeof t&&(e=this.getMediaElement(t,"video")),t instanceof HTMLVideoElement&&(e=t),e.setAttribute("autoplay","true"),e.setAttribute("muted","true"),e.setAttribute("playsinline","true"),e}decodeOnce(t,e=!0,n=!0){this._stopAsyncDecode=!1;const r=(o,i)=>{if(this._stopAsyncDecode)return i(new T("Video stream has ended before any code could be detected.")),void(this._stopAsyncDecode=void 0);try{o(this.decode(t))}catch(t){if(e&&t instanceof T||(t instanceof h||t instanceof v)&&n)return setTimeout(r,this._timeBetweenDecodingAttempts,o,i);i(t)}};return new Promise((t,e)=>r(t,e))}decodeContinuously(t,e){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode)this._stopContinuousDecode=void 0;else try{const r=this.decode(t);e(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(t){e(null,t),(t instanceof h||t instanceof v||t instanceof T)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(t){const e=this.createBinaryBitmap(t);return this.decodeBitmap(e)}_isHTMLVideoElement(t){return 0!==t.videoWidth}drawFrameOnCanvas(t,e,n){e||(e={sx:0,sy:0,sWidth:t.videoWidth,sHeight:t.videoHeight,dx:0,dy:0,dWidth:t.videoWidth,dHeight:t.videoHeight}),n||(n=this.captureCanvasContext),n.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)}drawImageOnCanvas(t,e,n=this.captureCanvasContext){e||(e={sx:0,sy:0,sWidth:t.naturalWidth,sHeight:t.naturalHeight,dx:0,dy:0,dWidth:t.naturalWidth,dHeight:t.naturalHeight}),n||(n=this.captureCanvasContext),n.drawImage(t,e.sx,e.sy,e.sWidth,e.sHeight,e.dx,e.dy,e.dWidth,e.dHeight)}createBinaryBitmap(t){this.getCaptureCanvasContext(t),this._isHTMLVideoElement(t)?this.drawFrameOnCanvas(t):this.drawImageOnCanvas(t);const e=this.getCaptureCanvas(t),n=new O(e),r=new N(n);return new u(r)}getCaptureCanvasContext(t){if(!this.captureCanvasContext){const e=this.getCaptureCanvas(t).getContext("2d");this.captureCanvasContext=e}return this.captureCanvasContext}getCaptureCanvas(t){if(!this.captureCanvas){const e=this.createCaptureCanvas(t);this.captureCanvas=e}return this.captureCanvas}decodeBitmap(t){return this.reader.decode(t,this._hints)}createCaptureCanvas(t){if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;const e=document.createElement("canvas");let n,r;return void 0!==t&&(t instanceof HTMLVideoElement?(n=t.videoWidth,r=t.videoHeight):t instanceof HTMLImageElement&&(n=t.naturalWidth||t.width,r=t.naturalHeight||t.height)),e.style.width=n+"px",e.style.height=r+"px",e.width=n,e.height=r,e}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(t=>t.stop()),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(t,e){try{t.srcObject=e}catch(n){t.src=URL.createObjectURL(e)}}cleanVideoSource(t){try{t.srcObject=null}catch(e){t.src=""}this.videoElement.removeAttribute("src")}}class L{constructor(t,e,n=(null==e?0:8*e.length),r,o,i=f.currentTimeMillis()){this.text=t,this.rawBytes=e,this.numBits=n,this.resultPoints=r,this.format=o,this.timestamp=i,this.text=t,this.rawBytes=e,this.numBits=null==n?null==e?0:8*e.length:n,this.resultPoints=r,this.format=o,this.resultMetadata=null,this.timestamp=null==i?f.currentTimeMillis():i}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(t,e){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(t,e)}putAllMetadata(t){null!==t&&(null===this.resultMetadata?this.resultMetadata=t:this.resultMetadata=new Map(t))}addResultPoints(t){const e=this.resultPoints;if(null===e)this.resultPoints=t;else if(null!==t&&t.length>0){const n=new Array(e.length+t.length);f.arraycopy(e,0,n,0,e.length),f.arraycopy(t,0,n,e.length,t.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}!function(t){t[t.AZTEC=0]="AZTEC",t[t.CODABAR=1]="CODABAR",t[t.CODE_39=2]="CODE_39",t[t.CODE_93=3]="CODE_93",t[t.CODE_128=4]="CODE_128",t[t.DATA_MATRIX=5]="DATA_MATRIX",t[t.EAN_8=6]="EAN_8",t[t.EAN_13=7]="EAN_13",t[t.ITF=8]="ITF",t[t.MAXICODE=9]="MAXICODE",t[t.PDF_417=10]="PDF_417",t[t.QR_CODE=11]="QR_CODE",t[t.RSS_14=12]="RSS_14",t[t.RSS_EXPANDED=13]="RSS_EXPANDED",t[t.UPC_A=14]="UPC_A",t[t.UPC_E=15]="UPC_E",t[t.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(P||(P={}));var q,V=P;!function(t){t[t.OTHER=0]="OTHER",t[t.ORIENTATION=1]="ORIENTATION",t[t.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",t[t.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",t[t.ISSUE_NUMBER=4]="ISSUE_NUMBER",t[t.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",t[t.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",t[t.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",t[t.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",t[t.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",t[t.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(q||(q={}));var H,U,z,W,j,G,X=q;class Q{constructor(t,e,n,r,o=-1,i=-1){this.rawBytes=t,this.text=e,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=o,this.structuredAppendParity=i,this.numBits=null==t?0:8*t.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(t){this.numBits=t}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(t){this.errorsCorrected=t}getErasures(){return this.erasures}setErasures(t){this.erasures=t}getOther(){return this.other}setOther(t){this.other=t}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Y{exp(t){return this.expTable[t]}log(t){if(0===t)throw new d;return this.logTable[t]}static addOrSubtract(t,e){return t^e}}class Z{constructor(t,e){if(0===e.length)throw new d;this.field=t;const n=e.length;if(n>1&&0===e[0]){let t=1;for(;t<n&&0===e[t];)t++;t===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-t),f.arraycopy(e,t,this.coefficients,0,this.coefficients.length))}else this.coefficients=e}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(t){return this.coefficients[this.coefficients.length-1-t]}evaluateAt(t){if(0===t)return this.getCoefficient(0);const e=this.coefficients;let n;if(1===t){n=0;for(let t=0,r=e.length;t!==r;t++){const r=e[t];n=Y.addOrSubtract(n,r)}return n}n=e[0];const r=e.length,o=this.field;for(let i=1;i<r;i++)n=Y.addOrSubtract(o.multiply(t,n),e[i]);return n}addOrSubtract(t){if(!this.field.equals(t.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero())return t;if(t.isZero())return this;let e=this.coefficients,n=t.coefficients;if(e.length>n.length){const t=e;e=n,n=t}let r=new Int32Array(n.length);const o=n.length-e.length;f.arraycopy(n,0,r,0,o);for(let t=o;t<n.length;t++)r[t]=Y.addOrSubtract(e[t-o],n[t]);return new Z(this.field,r)}multiply(t){if(!this.field.equals(t.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero()||t.isZero())return this.field.getZero();const e=this.coefficients,n=e.length,r=t.coefficients,o=r.length,i=new Int32Array(n+o-1),a=this.field;for(let t=0;t<n;t++){const n=e[t];for(let e=0;e<o;e++)i[t+e]=Y.addOrSubtract(i[t+e],a.multiply(n,r[e]))}return new Z(a,i)}multiplyScalar(t){if(0===t)return this.field.getZero();if(1===t)return this;const e=this.coefficients.length,n=this.field,r=new Int32Array(e),o=this.coefficients;for(let i=0;i<e;i++)r[i]=n.multiply(o[i],t);return new Z(n,r)}multiplyByMonomial(t,e){if(t<0)throw new d;if(0===e)return this.field.getZero();const n=this.coefficients,r=n.length,o=new Int32Array(r+t),i=this.field;for(let t=0;t<r;t++)o[t]=i.multiply(n[t],e);return new Z(i,o)}divide(t){if(!this.field.equals(t.field))throw new d("GenericGFPolys do not have same GenericGF field");if(t.isZero())throw new d("Divide by 0");const e=this.field;let n=e.getZero(),r=this;const o=t.getCoefficient(t.getDegree()),i=e.inverse(o);for(;r.getDegree()>=t.getDegree()&&!r.isZero();){const o=r.getDegree()-t.getDegree(),a=e.multiply(r.getCoefficient(r.getDegree()),i),s=t.multiplyByMonomial(o,a),c=e.buildMonomial(o,a);n=n.addOrSubtract(c),r=r.addOrSubtract(s)}return[n,r]}toString(){let t="";for(let e=this.getDegree();e>=0;e--){let n=this.getCoefficient(e);if(0!==n){if(n<0?(t+=" - ",n=-n):t.length>0&&(t+=" + "),0===e||1!==n){const e=this.field.log(n);0===e?t+="1":1===e?t+="a":(t+="a^",t+=e)}0!==e&&(1===e?t+="x":(t+="x^",t+=e))}}return t}}class K extends c{}K.kind="ArithmeticException";class J extends Y{constructor(t,e,n){super(),this.primitive=t,this.size=e,this.generatorBase=n;const r=new Int32Array(e);let o=1;for(let n=0;n<e;n++)r[n]=o,o*=2,o>=e&&(o^=t,o&=e-1);this.expTable=r;const i=new Int32Array(e);for(let t=0;t<e-1;t++)i[r[t]]=t;this.logTable=i,this.zero=new Z(this,Int32Array.from([0])),this.one=new Z(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(t,e){if(t<0)throw new d;if(0===e)return this.zero;const n=new Int32Array(t+1);return n[0]=e,new Z(this,n)}inverse(t){if(0===t)throw new K;return this.expTable[this.size-this.logTable[t]-1]}multiply(t,e){return 0===t||0===e?0:this.expTable[(this.logTable[t]+this.logTable[e])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+w.toHexString(this.primitive)+","+this.size+")"}equals(t){return t===this}}J.AZTEC_DATA_12=new J(4201,4096,1),J.AZTEC_DATA_10=new J(1033,1024,1),J.AZTEC_DATA_6=new J(67,64,1),J.AZTEC_PARAM=new J(19,16,1),J.QR_CODE_FIELD_256=new J(285,256,0),J.DATA_MATRIX_FIELD_256=new J(301,256,1),J.AZTEC_DATA_8=J.DATA_MATRIX_FIELD_256,J.MAXICODE_FIELD_64=J.AZTEC_DATA_6;class tt extends c{}tt.kind="ReedSolomonException";class et extends c{}et.kind="IllegalStateException";class nt{constructor(t){this.field=t}decode(t,e){const n=this.field,r=new Z(n,t),o=new Int32Array(e);let i=!0;for(let t=0;t<e;t++){const e=r.evaluateAt(n.exp(t+n.getGeneratorBase()));o[o.length-1-t]=e,0!==e&&(i=!1)}if(i)return;const a=new Z(n,o),s=this.runEuclideanAlgorithm(n.buildMonomial(e,1),a,e),c=s[0],l=s[1],d=this.findErrorLocations(c),u=this.findErrorMagnitudes(l,d);for(let e=0;e<d.length;e++){const r=t.length-1-n.log(d[e]);if(r<0)throw new tt("Bad error location");t[r]=J.addOrSubtract(t[r],u[e])}}runEuclideanAlgorithm(t,e,n){if(t.getDegree()<e.getDegree()){const n=t;t=e,e=n}const r=this.field;let o=t,i=e,a=r.getZero(),s=r.getOne();for(;i.getDegree()>=(n/2|0);){let t=o,e=a;if(o=i,a=s,o.isZero())throw new tt("r_{i-1} was zero");i=t;let n=r.getZero();const c=o.getCoefficient(o.getDegree()),l=r.inverse(c);for(;i.getDegree()>=o.getDegree()&&!i.isZero();){const t=i.getDegree()-o.getDegree(),e=r.multiply(i.getCoefficient(i.getDegree()),l);n=n.addOrSubtract(r.buildMonomial(t,e)),i=i.addOrSubtract(o.multiplyByMonomial(t,e))}if(s=n.multiply(a).addOrSubtract(e),i.getDegree()>=o.getDegree())throw new et("Division algorithm failed to reduce polynomial?")}const c=s.getCoefficient(0);if(0===c)throw new tt("sigmaTilde(0) was zero");const l=r.inverse(c);return[s.multiplyScalar(l),i.multiplyScalar(l)]}findErrorLocations(t){const e=t.getDegree();if(1===e)return Int32Array.from([t.getCoefficient(1)]);const n=new Int32Array(e);let r=0;const o=this.field;for(let i=1;i<o.getSize()&&r<e;i++)0===t.evaluateAt(i)&&(n[r]=o.inverse(i),r++);if(r!==e)throw new tt("Error locator degree does not match number of roots");return n}findErrorMagnitudes(t,e){const n=e.length,r=new Int32Array(n),o=this.field;for(let i=0;i<n;i++){const a=o.inverse(e[i]);let s=1;for(let t=0;t<n;t++)if(i!==t){const n=o.multiply(e[t],a),r=1&n?-2&n:1|n;s=o.multiply(s,r)}r[i]=o.multiply(t.evaluateAt(a),o.inverse(s)),0!==o.getGeneratorBase()&&(r[i]=o.multiply(r[i],a))}return r}}!function(t){t[t.UPPER=0]="UPPER",t[t.LOWER=1]="LOWER",t[t.MIXED=2]="MIXED",t[t.DIGIT=3]="DIGIT",t[t.PUNCT=4]="PUNCT",t[t.BINARY=5]="BINARY"}(H||(H={}));class rt{decode(t){this.ddata=t;let e=t.getBits(),n=this.extractBits(e),r=this.correctBits(n),o=rt.convertBoolArrayToByteArray(r),i=rt.getEncodedData(r),a=new Q(o,i,null,null);return a.setNumBits(r.length),a}static highLevelDecode(t){return this.getEncodedData(t)}static getEncodedData(t){let e=t.length,n=H.UPPER,r=H.UPPER,o="",i=0;for(;i<e;)if(r===H.BINARY){if(e-i<5)break;let a=rt.readCode(t,i,5);if(i+=5,0===a){if(e-i<11)break;a=rt.readCode(t,i,11)+31,i+=11}for(let n=0;n<a;n++){if(e-i<8){i=e;break}const n=rt.readCode(t,i,8);o+=A.castAsNonUtf8Char(n),i+=8}r=n}else{let a=r===H.DIGIT?4:5;if(e-i<a)break;let s=rt.readCode(t,i,a);i+=a;let c=rt.getCharacter(r,s);c.startsWith("CTRL_")?(n=r,r=rt.getTable(c.charAt(5)),"L"===c.charAt(6)&&(n=r)):(o+=c,r=n)}return o}static getTable(t){switch(t){case"L":return H.LOWER;case"P":return H.PUNCT;case"M":return H.MIXED;case"D":return H.DIGIT;case"B":return H.BINARY;default:return H.UPPER}}static getCharacter(t,e){switch(t){case H.UPPER:return rt.UPPER_TABLE[e];case H.LOWER:return rt.LOWER_TABLE[e];case H.MIXED:return rt.MIXED_TABLE[e];case H.PUNCT:return rt.PUNCT_TABLE[e];case H.DIGIT:return rt.DIGIT_TABLE[e];default:throw new et("Bad table")}}correctBits(t){let e,n;this.ddata.getNbLayers()<=2?(n=6,e=J.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,e=J.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,e=J.AZTEC_DATA_10):(n=12,e=J.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),o=t.length/n;if(o<r)throw new v;let i=t.length%n,a=new Int32Array(o);for(let e=0;e<o;e++,i+=n)a[e]=rt.readCode(t,i,n);try{new nt(e).decode(a,o-r)}catch(t){throw new v(t)}let s=(1<<n)-1,c=0;for(let t=0;t<r;t++){let e=a[t];if(0===e||e===s)throw new v;1!==e&&e!==s-1||c++}let l=new Array(r*n-c),d=0;for(let t=0;t<r;t++){let e=a[t];if(1===e||e===s-1)l.fill(e>1,d,d+n-1),d+=n-1;else for(let t=n-1;t>=0;--t)l[d++]=!!(e&1<<t)}return l}extractBits(t){let e=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(e?11:14)+4*n,o=new Int32Array(r),i=new Array(this.totalBitsInLayer(n,e));if(e)for(let t=0;t<o.length;t++)o[t]=t;else{let t=r+1+2*w.truncDivision(w.truncDivision(r,2)-1,15),e=r/2,n=w.truncDivision(t,2);for(let t=0;t<e;t++){let r=t+w.truncDivision(t,15);o[e-t-1]=n-r-1,o[e+t]=n+r+1}}for(let a=0,s=0;a<n;a++){let c=4*(n-a)+(e?9:12),l=2*a,d=r-1-l;for(let e=0;e<c;e++){let n=2*e;for(let r=0;r<2;r++)i[s+n+r]=t.get(o[l+r],o[l+e]),i[s+2*c+n+r]=t.get(o[l+e],o[d-r]),i[s+4*c+n+r]=t.get(o[d-r],o[d-e]),i[s+6*c+n+r]=t.get(o[d-e],o[l+r])}s+=8*c}return i}static readCode(t,e,n){let r=0;for(let o=e;o<e+n;o++)r<<=1,t[o]&&(r|=1);return r}static readByte(t,e){let n=t.length-e;return n>=8?rt.readCode(t,e,8):rt.readCode(t,e,n)<<8-n}static convertBoolArrayToByteArray(t){let e=new Uint8Array((t.length+7)/8);for(let n=0;n<e.length;n++)e[n]=rt.readByte(t,8*n);return e}totalBitsInLayer(t,e){return((e?88:112)+16*t)*t}}rt.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],rt.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],rt.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b","\t","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],rt.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],rt.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ot{constructor(){}static round(t){return NaN===t?0:t<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:t>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:t+(t<0?-.5:.5)|0}static distance(t,e,n,r){const o=t-n,i=e-r;return Math.sqrt(o*o+i*i)}static sum(t){let e=0;for(let n=0,r=t.length;n!==r;n++)e+=t[n];return e}}class it{static floatToIntBits(t){return t}}it.MAX_VALUE=Number.MAX_SAFE_INTEGER;class at{constructor(t,e){this.x=t,this.y=e}getX(){return this.x}getY(){return this.y}equals(t){if(t instanceof at){const e=t;return this.x===e.x&&this.y===e.y}return!1}hashCode(){return 31*it.floatToIntBits(this.x)+it.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(t){const e=this.distance(t[0],t[1]),n=this.distance(t[1],t[2]),r=this.distance(t[0],t[2]);let o,i,a;if(n>=e&&n>=r?(i=t[0],o=t[1],a=t[2]):r>=n&&r>=e?(i=t[1],o=t[0],a=t[2]):(i=t[2],o=t[0],a=t[1]),this.crossProductZ(o,i,a)<0){const t=o;o=a,a=t}t[0]=o,t[1]=i,t[2]=a}static distance(t,e){return ot.distance(t.x,t.y,e.x,e.y)}static crossProductZ(t,e,n){const r=e.x,o=e.y;return(n.x-r)*(t.y-o)-(n.y-o)*(t.x-r)}}class st{constructor(t,e){this.bits=t,this.points=e}getBits(){return this.bits}getPoints(){return this.points}}class ct extends st{constructor(t,e,n,r,o){super(t,e),this.compact=n,this.nbDatablocks=r,this.nbLayers=o}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class lt{constructor(t,e,n,r){this.image=t,this.height=t.getHeight(),this.width=t.getWidth(),null==e&&(e=lt.INIT_SIZE),null==n&&(n=t.getWidth()/2|0),null==r&&(r=t.getHeight()/2|0);const o=e/2|0;if(this.leftInit=n-o,this.rightInit=n+o,this.upInit=r-o,this.downInit=r+o,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new T}detect(){let t=this.leftInit,e=this.rightInit,n=this.upInit,r=this.downInit,o=!1,i=!0,a=!1,s=!1,c=!1,l=!1,d=!1;const u=this.width,h=this.height;for(;i;){i=!1;let m=!0;for(;(m||!s)&&e<u;)m=this.containsBlackPoint(n,r,e,!1),m?(e++,i=!0,s=!0):s||e++;if(e>=u){o=!0;break}let f=!0;for(;(f||!c)&&r<h;)f=this.containsBlackPoint(t,e,r,!0),f?(r++,i=!0,c=!0):c||r++;if(r>=h){o=!0;break}let p=!0;for(;(p||!l)&&t>=0;)p=this.containsBlackPoint(n,r,t,!1),p?(t--,i=!0,l=!0):l||t--;if(t<0){o=!0;break}let _=!0;for(;(_||!d)&&n>=0;)_=this.containsBlackPoint(t,e,n,!0),_?(n--,i=!0,d=!0):d||n--;if(n<0){o=!0;break}i&&(a=!0)}if(!o&&a){const o=e-t;let i=null;for(let e=1;null===i&&e<o;e++)i=this.getBlackPointOnSegment(t,r-e,t+e,r);if(null==i)throw new T;let a=null;for(let e=1;null===a&&e<o;e++)a=this.getBlackPointOnSegment(t,n+e,t+e,n);if(null==a)throw new T;let s=null;for(let t=1;null===s&&t<o;t++)s=this.getBlackPointOnSegment(e,n+t,e-t,n);if(null==s)throw new T;let c=null;for(let t=1;null===c&&t<o;t++)c=this.getBlackPointOnSegment(e,r-t,e-t,r);if(null==c)throw new T;return this.centerEdges(c,i,s,a)}throw new T}getBlackPointOnSegment(t,e,n,r){const o=ot.round(ot.distance(t,e,n,r)),i=(n-t)/o,a=(r-e)/o,s=this.image;for(let n=0;n<o;n++){const r=ot.round(t+n*i),o=ot.round(e+n*a);if(s.get(r,o))return new at(r,o)}return null}centerEdges(t,e,n,r){const o=t.getX(),i=t.getY(),a=e.getX(),s=e.getY(),c=n.getX(),l=n.getY(),d=r.getX(),u=r.getY(),h=lt.CORR;return o<this.width/2?[new at(d-h,u+h),new at(a+h,s+h),new at(c-h,l-h),new at(o+h,i-h)]:[new at(d+h,u+h),new at(a+h,s-h),new at(c-h,l+h),new at(o-h,i-h)]}containsBlackPoint(t,e,n,r){const o=this.image;if(r){for(let r=t;r<=e;r++)if(o.get(r,n))return!0}else for(let r=t;r<=e;r++)if(o.get(n,r))return!0;return!1}}lt.INIT_SIZE=10,lt.CORR=1;class dt{static checkAndNudgePoints(t,e){const n=t.getWidth(),r=t.getHeight();let o=!0;for(let t=0;t<e.length&&o;t+=2){const i=Math.floor(e[t]),a=Math.floor(e[t+1]);if(i<-1||i>n||a<-1||a>r)throw new T;o=!1,-1===i?(e[t]=0,o=!0):i===n&&(e[t]=n-1,o=!0),-1===a?(e[t+1]=0,o=!0):a===r&&(e[t+1]=r-1,o=!0)}o=!0;for(let t=e.length-2;t>=0&&o;t-=2){const i=Math.floor(e[t]),a=Math.floor(e[t+1]);if(i<-1||i>n||a<-1||a>r)throw new T;o=!1,-1===i?(e[t]=0,o=!0):i===n&&(e[t]=n-1,o=!0),-1===a?(e[t+1]=0,o=!0):a===r&&(e[t+1]=r-1,o=!0)}}}class ut{constructor(t,e,n,r,o,i,a,s,c){this.a11=t,this.a21=e,this.a31=n,this.a12=r,this.a22=o,this.a32=i,this.a13=a,this.a23=s,this.a33=c}static quadrilateralToQuadrilateral(t,e,n,r,o,i,a,s,c,l,d,u,h,m,f,p){const _=ut.quadrilateralToSquare(t,e,n,r,o,i,a,s);return ut.squareToQuadrilateral(c,l,d,u,h,m,f,p).times(_)}transformPoints(t){const e=t.length,n=this.a11,r=this.a12,o=this.a13,i=this.a21,a=this.a22,s=this.a23,c=this.a31,l=this.a32,d=this.a33;for(let u=0;u<e;u+=2){const e=t[u],h=t[u+1],m=o*e+s*h+d;t[u]=(n*e+i*h+c)/m,t[u+1]=(r*e+a*h+l)/m}}transformPointsWithValues(t,e){const n=this.a11,r=this.a12,o=this.a13,i=this.a21,a=this.a22,s=this.a23,c=this.a31,l=this.a32,d=this.a33,u=t.length;for(let h=0;h<u;h++){const u=t[h],m=e[h],f=o*u+s*m+d;t[h]=(n*u+i*m+c)/f,e[h]=(r*u+a*m+l)/f}}static squareToQuadrilateral(t,e,n,r,o,i,a,s){const c=t-n+o-a,l=e-r+i-s;if(0===c&&0===l)return new ut(n-t,o-n,t,r-e,i-r,e,0,0,1);{const d=n-o,u=a-o,h=r-i,m=s-i,f=d*m-u*h,p=(c*m-u*l)/f,_=(d*l-c*h)/f;return new ut(n-t+p*n,a-t+_*a,t,r-e+p*r,s-e+_*s,e,p,_,1)}}static quadrilateralToSquare(t,e,n,r,o,i,a,s){return ut.squareToQuadrilateral(t,e,n,r,o,i,a,s).buildAdjoint()}buildAdjoint(){return new ut(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(t){return new ut(this.a11*t.a11+this.a21*t.a12+this.a31*t.a13,this.a11*t.a21+this.a21*t.a22+this.a31*t.a23,this.a11*t.a31+this.a21*t.a32+this.a31*t.a33,this.a12*t.a11+this.a22*t.a12+this.a32*t.a13,this.a12*t.a21+this.a22*t.a22+this.a32*t.a23,this.a12*t.a31+this.a22*t.a32+this.a32*t.a33,this.a13*t.a11+this.a23*t.a12+this.a33*t.a13,this.a13*t.a21+this.a23*t.a22+this.a33*t.a23,this.a13*t.a31+this.a23*t.a32+this.a33*t.a33)}}class ht extends dt{sampleGrid(t,e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w){const $=ut.quadrilateralToQuadrilateral(r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w);return this.sampleGridWithTransform(t,e,n,$)}sampleGridWithTransform(t,e,n,r){if(e<=0||n<=0)throw new T;const o=new k(e,n),i=new Float32Array(2*e);for(let e=0;e<n;e++){const n=i.length,a=e+.5;for(let t=0;t<n;t+=2)i[t]=t/2+.5,i[t+1]=a;r.transformPoints(i),dt.checkAndNudgePoints(t,i);try{for(let r=0;r<n;r+=2)t.get(Math.floor(i[r]),Math.floor(i[r+1]))&&o.set(r/2,e)}catch(t){throw new T}}return o}}class mt{static setGridSampler(t){mt.gridSampler=t}static getInstance(){return mt.gridSampler}}mt.gridSampler=new ht;class ft{constructor(t,e){this.x=t,this.y=e}toResultPoint(){return new at(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class pt{constructor(t){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=t}detect(){return this.detectMirror(!1)}detectMirror(t){let e=this.getMatrixCenter(),n=this.getBullsEyeCorners(e);if(t){let t=n[0];n[0]=n[2],n[2]=t}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),o=this.getMatrixCornerPoints(n);return new ct(r,o,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(t){if(!(this.isValidPoint(t[0])&&this.isValidPoint(t[1])&&this.isValidPoint(t[2])&&this.isValidPoint(t[3])))throw new T;let e=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(t[0],t[1],e),this.sampleLine(t[1],t[2],e),this.sampleLine(t[2],t[3],e),this.sampleLine(t[3],t[0],e)]);this.shift=this.getRotation(n,e);let r=0;for(let t=0;t<4;t++){let e=n[(this.shift+t)%4];this.compact?(r<<=7,r+=e>>1&127):(r<<=10,r+=(e>>2&992)+(e>>1&31))}let o=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=1+(o>>6),this.nbDataBlocks=1+(63&o)):(this.nbLayers=1+(o>>11),this.nbDataBlocks=1+(2047&o))}getRotation(t,e){let n=0;t.forEach((t,r,o)=>{n=(t>>e-2<<1)+(1&t)+(n<<3)}),n=((1&n)<<11)+(n>>1);for(let t=0;t<4;t++)if(w.bitCount(n^this.EXPECTED_CORNER_BITS[t])<=2)return t;throw new T}getCorrectedParameterData(t,e){let n,r;e?(n=7,r=2):(n=10,r=4);let o=n-r,i=new Int32Array(n);for(let e=n-1;e>=0;--e)i[e]=15&t,t>>=4;try{new nt(J.AZTEC_PARAM).decode(i,o)}catch(t){throw new T}let a=0;for(let t=0;t<r;t++)a=(a<<4)+i[t];return a}getBullsEyeCorners(t){let e=t,n=t,r=t,o=t,i=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let t=this.getFirstDifferent(e,i,1,-1),a=this.getFirstDifferent(n,i,1,1),s=this.getFirstDifferent(r,i,-1,1),c=this.getFirstDifferent(o,i,-1,-1);if(this.nbCenterLayers>2){let n=this.distancePoint(c,t)*this.nbCenterLayers/(this.distancePoint(o,e)*(this.nbCenterLayers+2));if(n<.75||n>1.25||!this.isWhiteOrBlackRectangle(t,a,s,c))break}e=t,n=a,r=s,o=c,i=!i}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new T;this.compact=5===this.nbCenterLayers;let a=new at(e.getX()+.5,e.getY()-.5),s=new at(n.getX()+.5,n.getY()+.5),c=new at(r.getX()-.5,r.getY()+.5),l=new at(o.getX()-.5,o.getY()-.5);return this.expandSquare([a,s,c,l],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let t,e,n,r;try{let o=new lt(this.image).detect();t=o[0],e=o[1],n=o[2],r=o[3]}catch(o){let i=this.image.getWidth()/2,a=this.image.getHeight()/2;t=this.getFirstDifferent(new ft(i+7,a-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new ft(i+7,a+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new ft(i-7,a+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new ft(i-7,a-7),!1,-1,-1).toResultPoint()}let o=ot.round((t.getX()+r.getX()+e.getX()+n.getX())/4),i=ot.round((t.getY()+r.getY()+e.getY()+n.getY())/4);try{let a=new lt(this.image,15,o,i).detect();t=a[0],e=a[1],n=a[2],r=a[3]}catch(a){t=this.getFirstDifferent(new ft(o+7,i-7),!1,1,-1).toResultPoint(),e=this.getFirstDifferent(new ft(o+7,i+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new ft(o-7,i+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new ft(o-7,i-7),!1,-1,-1).toResultPoint()}return o=ot.round((t.getX()+r.getX()+e.getX()+n.getX())/4),i=ot.round((t.getY()+r.getY()+e.getY()+n.getY())/4),new ft(o,i)}getMatrixCornerPoints(t){return this.expandSquare(t,2*this.nbCenterLayers,this.getDimension())}sampleGrid(t,e,n,r,o){let i=mt.getInstance(),a=this.getDimension(),s=a/2-this.nbCenterLayers,c=a/2+this.nbCenterLayers;return i.sampleGrid(t,a,a,s,s,c,s,c,c,s,c,e.getX(),e.getY(),n.getX(),n.getY(),r.getX(),r.getY(),o.getX(),o.getY())}sampleLine(t,e,n){let r=0,o=this.distanceResultPoint(t,e),i=o/n,a=t.getX(),s=t.getY(),c=i*(e.getX()-t.getX())/o,l=i*(e.getY()-t.getY())/o;for(let t=0;t<n;t++)this.image.get(ot.round(a+t*c),ot.round(s+t*l))&&(r|=1<<n-t-1);return r}isWhiteOrBlackRectangle(t,e,n,r){let o=3;t=new ft(t.getX()-o,t.getY()+o),e=new ft(e.getX()-o,e.getY()-o),n=new ft(n.getX()+o,n.getY()-o),r=new ft(r.getX()+o,r.getY()+o);let i=this.getColor(r,t);if(0===i)return!1;let a=this.getColor(t,e);return a===i&&(a=this.getColor(e,n),a===i&&(a=this.getColor(n,r),a===i))}getColor(t,e){let n=this.distancePoint(t,e),r=(e.getX()-t.getX())/n,o=(e.getY()-t.getY())/n,i=0,a=t.getX(),s=t.getY(),c=this.image.get(t.getX(),t.getY()),l=Math.ceil(n);for(let t=0;t<l;t++)a+=r,s+=o,this.image.get(ot.round(a),ot.round(s))!==c&&i++;let d=i/n;return d>.1&&d<.9?0:d<=.1===c?1:-1}getFirstDifferent(t,e,n,r){let o=t.getX()+n,i=t.getY()+r;for(;this.isValid(o,i)&&this.image.get(o,i)===e;)o+=n,i+=r;for(o-=n,i-=r;this.isValid(o,i)&&this.image.get(o,i)===e;)o+=n;for(o-=n;this.isValid(o,i)&&this.image.get(o,i)===e;)i+=r;return i-=r,new ft(o,i)}expandSquare(t,e,n){let r=n/(2*e),o=t[0].getX()-t[2].getX(),i=t[0].getY()-t[2].getY(),a=(t[0].getX()+t[2].getX())/2,s=(t[0].getY()+t[2].getY())/2,c=new at(a+r*o,s+r*i),l=new at(a-r*o,s-r*i);return o=t[1].getX()-t[3].getX(),i=t[1].getY()-t[3].getY(),a=(t[1].getX()+t[3].getX())/2,s=(t[1].getY()+t[3].getY())/2,[c,new at(a+r*o,s+r*i),l,new at(a-r*o,s-r*i)]}isValid(t,e){return t>=0&&t<this.image.getWidth()&&e>0&&e<this.image.getHeight()}isValidPoint(t){let e=ot.round(t.getX()),n=ot.round(t.getY());return this.isValid(e,n)}distancePoint(t,e){return ot.distance(t.getX(),t.getY(),e.getX(),e.getY())}distanceResultPoint(t,e){return ot.distance(t.getX(),t.getY(),e.getX(),e.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(w.truncDivision(this.nbLayers-4,8)+1)+15}}class _t{decode(t,e=null){let n=null,r=new pt(t.getBlackMatrix()),o=null,i=null;try{let t=r.detectMirror(!1);o=t.getPoints(),this.reportFoundResultPoints(e,o),i=(new rt).decode(t)}catch(t){n=t}if(null==i)try{let t=r.detectMirror(!0);o=t.getPoints(),this.reportFoundResultPoints(e,o),i=(new rt).decode(t)}catch(t){if(null!=n)throw n;throw t}let a=new L(i.getText(),i.getRawBytes(),i.getNumBits(),o,V.AZTEC,f.currentTimeMillis()),s=i.getByteSegments();null!=s&&a.putMetadata(X.BYTE_SEGMENTS,s);let c=i.getECLevel();return null!=c&&a.putMetadata(X.ERROR_CORRECTION_LEVEL,c),a}reportFoundResultPoints(t,e){if(null!=t){let n=t.get(b.NEED_RESULT_POINT_CALLBACK);null!=n&&e.forEach((t,e,r)=>{n.foundPossibleResultPoint(t)})}}reset(){}}class gt extends F{constructor(t=500){super(new _t,t)}}class wt{decode(t,e){try{return this.doDecode(t,e)}catch(n){if(e&&!0===e.get(b.TRY_HARDER)&&t.isRotateSupported()){const n=t.rotateCounterClockwise(),r=this.doDecode(n,e),o=r.getResultMetadata();let i=270;null!==o&&!0===o.get(X.ORIENTATION)&&(i+=o.get(X.ORIENTATION)%360),r.putMetadata(X.ORIENTATION,i);const a=r.getResultPoints();if(null!==a){const t=n.getHeight();for(let e=0;e<a.length;e++)a[e]=new at(t-a[e].getY()-1,a[e].getX())}return r}throw new T}}reset(){}doDecode(t,e){const n=t.getWidth(),r=t.getHeight();let o=new $(n);const i=e&&!0===e.get(b.TRY_HARDER),a=Math.max(1,r>>(i?8:5));let s;s=i?r:15;const c=Math.trunc(r/2);for(let i=0;i<s;i++){const s=Math.trunc((i+1)/2),l=c+a*(1&i?-s:s);if(l<0||l>=r)break;try{o=t.getBlackRow(l,o)}catch(t){continue}for(let t=0;t<2;t++){if(1===t&&(o.reverse(),e&&!0===e.get(b.NEED_RESULT_POINT_CALLBACK))){const t=new Map;e.forEach((e,n)=>t.set(n,e)),t.delete(b.NEED_RESULT_POINT_CALLBACK),e=t}try{const r=this.decodeRow(l,o,e);if(1===t){r.putMetadata(X.ORIENTATION,180);const t=r.getResultPoints();null!==t&&(t[0]=new at(n-t[0].getX()-1,t[0].getY()),t[1]=new at(n-t[1].getX()-1,t[1].getY()))}return r}catch(t){}}}throw new T}static recordPattern(t,e,n){const r=n.length;for(let t=0;t<r;t++)n[t]=0;const o=t.getSize();if(e>=o)throw new T;let i=!t.get(e),a=0,s=e;for(;s<o;){if(t.get(s)!==i)n[a]++;else{if(++a===r)break;n[a]=1,i=!i}s++}if(a!==r&&(a!==r-1||s!==o))throw new T}static recordPatternInReverse(t,e,n){let r=n.length,o=t.get(e);for(;e>0&&r>=0;)t.get(--e)!==o&&(r--,o=!o);if(r>=0)throw new T;wt.recordPattern(t,e+1,n)}static patternMatchVariance(t,e,n){const r=t.length;let o=0,i=0;for(let n=0;n<r;n++)o+=t[n],i+=e[n];if(o<i)return Number.POSITIVE_INFINITY;const a=o/i;n*=a;let s=0;for(let o=0;o<r;o++){const r=t[o],i=e[o]*a,c=r>i?r-i:i-r;if(c>n)return Number.POSITIVE_INFINITY;s+=c}return s/o}}class $t extends wt{static findStartPattern(t){const e=t.getSize(),n=t.getNextSet(0);let r=0,o=Int32Array.from([0,0,0,0,0,0]),i=n,a=!1;const s=6;for(let c=n;c<e;c++)if(t.get(c)!==a)o[r]++;else{if(r===s-1){let e=$t.MAX_AVG_VARIANCE,n=-1;for(let t=$t.CODE_START_A;t<=$t.CODE_START_C;t++){const r=wt.patternMatchVariance(o,$t.CODE_PATTERNS[t],$t.MAX_INDIVIDUAL_VARIANCE);r<e&&(e=r,n=t)}if(n>=0&&t.isRange(Math.max(0,i-(c-i)/2),i,!1))return Int32Array.from([i,c,n]);i+=o[0]+o[1],o=o.slice(2,o.length-1),o[r-1]=0,o[r]=0,r--}else r++;o[r]=1,a=!a}throw new T}static decodeCode(t,e,n){wt.recordPattern(t,n,e);let r=$t.MAX_AVG_VARIANCE,o=-1;for(let t=0;t<$t.CODE_PATTERNS.length;t++){const n=$t.CODE_PATTERNS[t],i=this.patternMatchVariance(e,n,$t.MAX_INDIVIDUAL_VARIANCE);i<r&&(r=i,o=t)}if(o>=0)return o;throw new T}decodeRow(t,e,n){const r=n&&!0===n.get(b.ASSUME_GS1),o=$t.findStartPattern(e),i=o[2];let a=0;const s=new Uint8Array(20);let c;switch(s[a++]=i,i){case $t.CODE_START_A:c=$t.CODE_CODE_A;break;case $t.CODE_START_B:c=$t.CODE_CODE_B;break;case $t.CODE_START_C:c=$t.CODE_CODE_C;break;default:throw new v}let l=!1,d=!1,u="",m=o[0],f=o[1];const p=Int32Array.from([0,0,0,0,0,0]);let _=0,g=0,w=i,$=0,y=!0,I=!1,C=!1;for(;!l;){const t=d;switch(d=!1,_=g,g=$t.decodeCode(e,p,f),s[a++]=g,g!==$t.CODE_STOP&&(y=!0),g!==$t.CODE_STOP&&($++,w+=$*g),m=f,f+=p.reduce((t,e)=>t+e,0),g){case $t.CODE_START_A:case $t.CODE_START_B:case $t.CODE_START_C:throw new v}switch(c){case $t.CODE_CODE_A:if(g<64)u+=C===I?String.fromCharCode(" ".charCodeAt(0)+g):String.fromCharCode(" ".charCodeAt(0)+g+128),C=!1;else if(g<96)u+=C===I?String.fromCharCode(g-64):String.fromCharCode(g+64),C=!1;else switch(g!==$t.CODE_STOP&&(y=!1),g){case $t.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case $t.CODE_FNC_2:case $t.CODE_FNC_3:break;case $t.CODE_FNC_4_A:!I&&C?(I=!0,C=!1):I&&C?(I=!1,C=!1):C=!0;break;case $t.CODE_SHIFT:d=!0,c=$t.CODE_CODE_B;break;case $t.CODE_CODE_B:c=$t.CODE_CODE_B;break;case $t.CODE_CODE_C:c=$t.CODE_CODE_C;break;case $t.CODE_STOP:l=!0}break;case $t.CODE_CODE_B:if(g<96)u+=C===I?String.fromCharCode(" ".charCodeAt(0)+g):String.fromCharCode(" ".charCodeAt(0)+g+128),C=!1;else switch(g!==$t.CODE_STOP&&(y=!1),g){case $t.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case $t.CODE_FNC_2:case $t.CODE_FNC_3:break;case $t.CODE_FNC_4_B:!I&&C?(I=!0,C=!1):I&&C?(I=!1,C=!1):C=!0;break;case $t.CODE_SHIFT:d=!0,c=$t.CODE_CODE_A;break;case $t.CODE_CODE_A:c=$t.CODE_CODE_A;break;case $t.CODE_CODE_C:c=$t.CODE_CODE_C;break;case $t.CODE_STOP:l=!0}break;case $t.CODE_CODE_C:if(g<100)g<10&&(u+="0"),u+=g;else switch(g!==$t.CODE_STOP&&(y=!1),g){case $t.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case $t.CODE_CODE_A:c=$t.CODE_CODE_A;break;case $t.CODE_CODE_B:c=$t.CODE_CODE_B;break;case $t.CODE_STOP:l=!0}}t&&(c=c===$t.CODE_CODE_A?$t.CODE_CODE_B:$t.CODE_CODE_A)}const E=f-m;if(f=e.getNextUnset(f),!e.isRange(f,Math.min(e.getSize(),f+(f-m)/2),!1))throw new T;if(w-=$*_,w%103!==_)throw new h;const A=u.length;if(0===A)throw new T;A>0&&y&&(u=c===$t.CODE_CODE_C?u.substring(0,A-2):u.substring(0,A-1));const S=(o[1]+o[0])/2,k=m+E/2,R=s.length,N=new Uint8Array(R);for(let t=0;t<R;t++)N[t]=s[t];const D=[new at(S,t),new at(k,t)];return new L(u,N,0,D,V.CODE_128,(new Date).getTime())}}$t.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],$t.MAX_AVG_VARIANCE=.25,$t.MAX_INDIVIDUAL_VARIANCE=.7,$t.CODE_SHIFT=98,$t.CODE_CODE_C=99,$t.CODE_CODE_B=100,$t.CODE_CODE_A=101,$t.CODE_FNC_1=102,$t.CODE_FNC_2=97,$t.CODE_FNC_3=96,$t.CODE_FNC_4_A=101,$t.CODE_FNC_4_B=100,$t.CODE_START_A=103,$t.CODE_START_B=104,$t.CODE_START_C=105,$t.CODE_STOP=106;class yt extends wt{constructor(t=!1,e=!1){super(),this.usingCheckDigit=t,this.extendedMode=e,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(t,e,n){let r=this.counters;r.fill(0),this.decodeRowResult="";let o,i,a=yt.findAsteriskPattern(e,r),s=e.getNextSet(a[1]),c=e.getSize();do{yt.recordPattern(e,s,r);let t=yt.toNarrowWidePattern(r);if(t<0)throw new T;o=yt.patternToChar(t),this.decodeRowResult+=o,i=s;for(let t of r)s+=t;s=e.getNextSet(s)}while("*"!==o);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let l,d=0;for(let t of r)d+=t;if(s!==c&&2*(s-i-d)<d)throw new T;if(this.usingCheckDigit){let t=this.decodeRowResult.length-1,e=0;for(let n=0;n<t;n++)e+=yt.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(n));if(this.decodeRowResult.charAt(t)!==yt.ALPHABET_STRING.charAt(e%43))throw new h;this.decodeRowResult=this.decodeRowResult.substring(0,t)}if(0===this.decodeRowResult.length)throw new T;l=this.extendedMode?yt.decodeExtended(this.decodeRowResult):this.decodeRowResult;let u=(a[1]+a[0])/2,m=i+d/2;return new L(l,null,0,[new at(u,t),new at(m,t)],V.CODE_39,(new Date).getTime())}static findAsteriskPattern(t,e){let n=t.getSize(),r=t.getNextSet(0),o=0,i=r,a=!1,s=e.length;for(let c=r;c<n;c++)if(t.get(c)!==a)e[o]++;else{if(o===s-1){if(this.toNarrowWidePattern(e)===yt.ASTERISK_ENCODING&&t.isRange(Math.max(0,i-Math.floor((c-i)/2)),i,!1))return[i,c];i+=e[0]+e[1],e.copyWithin(0,2,2+o-1),e[o-1]=0,e[o]=0,o--}else o++;e[o]=1,a=!a}throw new T}static toNarrowWidePattern(t){let e,n=t.length,r=0;do{let o=2147483647;for(let e of t)e<o&&e>r&&(o=e);r=o,e=0;let i=0,a=0;for(let o=0;o<n;o++){let s=t[o];s>r&&(a|=1<<n-1-o,e++,i+=s)}if(3===e){for(let o=0;o<n&&e>0;o++){let n=t[o];if(n>r&&(e--,2*n>=i))return-1}return a}}while(e>3);return-1}static patternToChar(t){for(let e=0;e<yt.CHARACTER_ENCODINGS.length;e++)if(yt.CHARACTER_ENCODINGS[e]===t)return yt.ALPHABET_STRING.charAt(e);if(t===yt.ASTERISK_ENCODING)return"*";throw new T}static decodeExtended(t){let e=t.length,n="";for(let r=0;r<e;r++){let e=t.charAt(r);if("+"===e||"$"===e||"%"===e||"/"===e){let o=t.charAt(r+1),i="\0";switch(e){case"+":if(!(o>="A"&&o<="Z"))throw new v;i=String.fromCharCode(o.charCodeAt(0)+32);break;case"$":if(!(o>="A"&&o<="Z"))throw new v;i=String.fromCharCode(o.charCodeAt(0)-64);break;case"%":if(o>="A"&&o<="E")i=String.fromCharCode(o.charCodeAt(0)-38);else if(o>="F"&&o<="J")i=String.fromCharCode(o.charCodeAt(0)-11);else if(o>="K"&&o<="O")i=String.fromCharCode(o.charCodeAt(0)+16);else if(o>="P"&&o<="T")i=String.fromCharCode(o.charCodeAt(0)+43);else if("U"===o)i="\0";else if("V"===o)i="@";else if("W"===o)i="`";else{if("X"!==o&&"Y"!==o&&"Z"!==o)throw new v;i=""}break;case"/":if(o>="A"&&o<="O")i=String.fromCharCode(o.charCodeAt(0)-32);else{if("Z"!==o)throw new v;i=":"}}n+=i,r++}else n+=e}return n}}yt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",yt.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],yt.ASTERISK_ENCODING=148;class bt extends wt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(t,e,n){let r=this.decodeStart(e),o=this.decodeEnd(e),i=new S;bt.decodeMiddle(e,r[1],o[0],i);let a=i.toString(),s=null;null!=n&&(s=n.get(b.ALLOWED_LENGTHS)),null==s&&(s=bt.DEFAULT_ALLOWED_LENGTHS);let c=a.length,l=!1,d=0;for(let t of s){if(c===t){l=!0;break}t>d&&(d=t)}if(!l&&c>d&&(l=!0),!l)throw new v;const u=[new at(r[1],t),new at(o[0],t)];return new L(a,null,0,u,V.ITF,(new Date).getTime())}static decodeMiddle(t,e,n,r){let o=new Int32Array(10),i=new Int32Array(5),a=new Int32Array(5);for(o.fill(0),i.fill(0),a.fill(0);e<n;){wt.recordPattern(t,e,o);for(let t=0;t<5;t++){let e=2*t;i[t]=o[e],a[t]=o[e+1]}let n=bt.decodeDigit(i);r.append(n.toString()),n=this.decodeDigit(a),r.append(n.toString()),o.forEach(function(t){e+=t})}}decodeStart(t){let e=bt.skipWhiteSpace(t),n=bt.findGuardPattern(t,e,bt.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(t,n[0]),n}validateQuietZone(t,e){let n=10*this.narrowLineWidth;n=n<e?n:e;for(let r=e-1;n>0&&r>=0&&!t.get(r);r--)n--;if(0!==n)throw new T}static skipWhiteSpace(t){const e=t.getSize(),n=t.getNextSet(0);if(n===e)throw new T;return n}decodeEnd(t){t.reverse();try{let e,n=bt.skipWhiteSpace(t);try{e=bt.findGuardPattern(t,n,bt.END_PATTERN_REVERSED[0])}catch(r){r instanceof T&&(e=bt.findGuardPattern(t,n,bt.END_PATTERN_REVERSED[1]))}this.validateQuietZone(t,e[0]);let r=e[0];return e[0]=t.getSize()-e[1],e[1]=t.getSize()-r,e}finally{t.reverse()}}static findGuardPattern(t,e,n){let r=n.length,o=new Int32Array(r),i=t.getSize(),a=!1,s=0,c=e;o.fill(0);for(let l=e;l<i;l++)if(t.get(l)!==a)o[s]++;else{if(s===r-1){if(wt.patternMatchVariance(o,n,bt.MAX_INDIVIDUAL_VARIANCE)<bt.MAX_AVG_VARIANCE)return[c,l];c+=o[0]+o[1],f.arraycopy(o,2,o,0,s-1),o[s-1]=0,o[s]=0,s--}else s++;o[s]=1,a=!a}throw new T}static decodeDigit(t){let e=bt.MAX_AVG_VARIANCE,n=-1,r=bt.PATTERNS.length;for(let o=0;o<r;o++){let r=bt.PATTERNS[o],i=wt.patternMatchVariance(t,r,bt.MAX_INDIVIDUAL_VARIANCE);i<e?(e=i,n=o):i===e&&(n=-1)}if(n>=0)return n%10;throw new T}}bt.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],bt.MAX_AVG_VARIANCE=.38,bt.MAX_INDIVIDUAL_VARIANCE=.5,bt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],bt.START_PATTERN=Int32Array.from([1,1,1,1]),bt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class vt extends wt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(t){let e,n=!1,r=0,o=Int32Array.from([0,0,0]);for(;!n;){o=Int32Array.from([0,0,0]),e=vt.findGuardPattern(t,r,!1,this.START_END_PATTERN,o);let i=e[0];r=e[1];let a=i-(r-i);a>=0&&(n=t.isRange(a,i,!1))}return e}static checkChecksum(t){return vt.checkStandardUPCEANChecksum(t)}static checkStandardUPCEANChecksum(t){let e=t.length;if(0===e)return!1;let n=parseInt(t.charAt(e-1),10);return vt.getStandardUPCEANChecksum(t.substring(0,e-1))===n}static getStandardUPCEANChecksum(t){let e=t.length,n=0;for(let r=e-1;r>=0;r-=2){let e=t.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new v;n+=e}n*=3;for(let r=e-2;r>=0;r-=2){let e=t.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new v;n+=e}return(1e3-n)%10}static decodeEnd(t,e){return vt.findGuardPattern(t,e,!1,vt.START_END_PATTERN,new Int32Array(vt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(t,e,n,r){return this.findGuardPattern(t,e,n,r,new Int32Array(r.length))}static findGuardPattern(t,e,n,r,o){let i=t.getSize(),a=0,s=e=n?t.getNextUnset(e):t.getNextSet(e),c=r.length,l=n;for(let n=e;n<i;n++)if(t.get(n)!==l)o[a]++;else{if(a===c-1){if(wt.patternMatchVariance(o,r,vt.MAX_INDIVIDUAL_VARIANCE)<vt.MAX_AVG_VARIANCE)return Int32Array.from([s,n]);s+=o[0]+o[1];let t=o.slice(2,o.length-1);for(let e=0;e<a-1;e++)o[e]=t[e];o[a-1]=0,o[a]=0,a--}else a++;o[a]=1,l=!l}throw new T}static decodeDigit(t,e,n,r){this.recordPattern(t,n,e);let o=this.MAX_AVG_VARIANCE,i=-1,a=r.length;for(let t=0;t<a;t++){let n=r[t],a=wt.patternMatchVariance(e,n,vt.MAX_INDIVIDUAL_VARIANCE);a<o&&(o=a,i=t)}if(i>=0)return i;throw new T}}vt.MAX_AVG_VARIANCE=.48,vt.MAX_INDIVIDUAL_VARIANCE=.7,vt.START_END_PATTERN=Int32Array.from([1,1,1]),vt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),vt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),vt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class It{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(t,e,n){let r=this.decodeRowStringBuffer,o=this.decodeMiddle(e,n,r),i=r.toString(),a=It.parseExtensionString(i),s=[new at((n[0]+n[1])/2,t),new at(o,t)],c=new L(i,null,0,s,V.UPC_EAN_EXTENSION,(new Date).getTime());return null!=a&&c.putAllMetadata(a),c}decodeMiddle(t,e,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let o=t.getSize(),i=e[1],a=0;for(let e=0;e<5&&i<o;e++){let o=vt.decodeDigit(t,r,i,vt.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+o%10);for(let t of r)i+=t;o>=10&&(a|=1<<4-e),4!==e&&(i=t.getNextSet(i),i=t.getNextUnset(i))}if(5!==n.length)throw new T;let s=this.determineCheckDigit(a);if(It.extensionChecksum(n.toString())!==s)throw new T;return i}static extensionChecksum(t){let e=t.length,n=0;for(let r=e-2;r>=0;r-=2)n+=t.charAt(r).charCodeAt(0)-"0".charCodeAt(0);n*=3;for(let r=e-1;r>=0;r-=2)n+=t.charAt(r).charCodeAt(0)-"0".charCodeAt(0);return n*=3,n%10}determineCheckDigit(t){for(let e=0;e<10;e++)if(t===this.CHECK_DIGIT_ENCODINGS[e])return e;throw new T}static parseExtensionString(t){if(5!==t.length)return null;let e=It.parseExtension5String(t);return null==e?null:new Map([[X.SUGGESTED_PRICE,e]])}static parseExtension5String(t){let e;switch(t.charAt(0)){case"0":e="£";break;case"5":e="$";break;case"9":switch(t){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}e="";break;default:e=""}let n=parseInt(t.substring(1)),r=n%100;return e+(n/100).toString()+"."+(r<10?"0"+r:r.toString())}}class Ct{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(t,e,n){let r=this.decodeRowStringBuffer,o=this.decodeMiddle(e,n,r),i=r.toString(),a=Ct.parseExtensionString(i),s=[new at((n[0]+n[1])/2,t),new at(o,t)],c=new L(i,null,0,s,V.UPC_EAN_EXTENSION,(new Date).getTime());return null!=a&&c.putAllMetadata(a),c}decodeMiddle(t,e,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let o=t.getSize(),i=e[1],a=0;for(let e=0;e<2&&i<o;e++){let o=vt.decodeDigit(t,r,i,vt.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+o%10);for(let t of r)i+=t;o>=10&&(a|=1<<1-e),1!==e&&(i=t.getNextSet(i),i=t.getNextUnset(i))}if(2!==n.length)throw new T;if(parseInt(n.toString())%4!==a)throw new T;return i}static parseExtensionString(t){return 2!==t.length?null:new Map([[X.ISSUE_NUMBER,parseInt(t)]])}}class Et{static decodeRow(t,e,n){let r=vt.findGuardPattern(e,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new It).decodeRow(t,e,r)}catch(n){return(new Ct).decodeRow(t,e,r)}}}Et.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class At extends vt{constructor(){super(),this.decodeRowStringBuffer="",At.L_AND_G_PATTERNS=At.L_PATTERNS.map(t=>Int32Array.from(t));for(let t=10;t<20;t++){let e=At.L_PATTERNS[t-10],n=new Int32Array(e.length);for(let t=0;t<e.length;t++)n[t]=e[e.length-t-1];At.L_AND_G_PATTERNS[t]=n}}decodeRow(t,e,n){let r=At.findStartGuardPattern(e),o=null==n?null:n.get(b.NEED_RESULT_POINT_CALLBACK);if(null!=o){const e=new at((r[0]+r[1])/2,t);o.foundPossibleResultPoint(e)}let i=this.decodeMiddle(e,r,this.decodeRowStringBuffer),a=i.rowOffset,s=i.resultString;if(null!=o){const e=new at(a,t);o.foundPossibleResultPoint(e)}let c=this.decodeEnd(e,a);if(null!=o){const e=new at((c[0]+c[1])/2,t);o.foundPossibleResultPoint(e)}let l=c[1],d=l+(l-c[0]);if(d>=e.getSize()||!e.isRange(l,d,!1))throw new T;let u=s.toString();if(u.length<8)throw new v;if(!At.checkChecksum(u))throw new h;let m=(r[1]+r[0])/2,f=(c[1]+c[0])/2,p=this.getBarcodeFormat(),_=[new at(m,t),new at(f,t)],g=new L(u,null,0,_,p,(new Date).getTime()),w=0;try{let n=Et.decodeRow(t,e,c[1]);g.putMetadata(X.UPC_EAN_EXTENSION,n.getText()),g.putAllMetadata(n.getResultMetadata()),g.addResultPoints(n.getResultPoints()),w=n.getText().length}catch(t){}let $=null==n?null:n.get(b.ALLOWED_EAN_EXTENSIONS);if(null!=$){let t=!1;for(let e in $)if(w.toString()===e){t=!0;break}if(!t)throw new T}return g}decodeEnd(t,e){return At.findGuardPattern(t,e,!1,At.START_END_PATTERN,new Int32Array(At.START_END_PATTERN.length).fill(0))}static checkChecksum(t){return At.checkStandardUPCEANChecksum(t)}static checkStandardUPCEANChecksum(t){let e=t.length;if(0===e)return!1;let n=parseInt(t.charAt(e-1),10);return At.getStandardUPCEANChecksum(t.substring(0,e-1))===n}static getStandardUPCEANChecksum(t){let e=t.length,n=0;for(let r=e-1;r>=0;r-=2){let e=t.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new v;n+=e}n*=3;for(let r=e-2;r>=0;r-=2){let e=t.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(e<0||e>9)throw new v;n+=e}return(1e3-n)%10}}class St extends At{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(t,e,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let o=t.getSize(),i=e[1],a=0;for(let e=0;e<6&&i<o;e++){let o=At.decodeDigit(t,r,i,At.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+o%10);for(let t of r)i+=t;o>=10&&(a|=1<<5-e)}n=St.determineFirstDigit(n,a),i=At.findGuardPattern(t,i,!0,At.MIDDLE_PATTERN,new Int32Array(At.MIDDLE_PATTERN.length).fill(0))[1];for(let e=0;e<6&&i<o;e++){let e=At.decodeDigit(t,r,i,At.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+e);for(let t of r)i+=t}return{rowOffset:i,resultString:n}}getBarcodeFormat(){return V.EAN_13}static determineFirstDigit(t,e){for(let n=0;n<10;n++)if(e===this.FIRST_DIGIT_ENCODINGS[n])return t=String.fromCharCode("0".charCodeAt(0)+n)+t;throw new T}}St.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class kt extends At{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(t,e,n){const r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let o=t.getSize(),i=e[1];for(let e=0;e<4&&i<o;e++){let e=At.decodeDigit(t,r,i,At.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+e);for(let t of r)i+=t}i=At.findGuardPattern(t,i,!0,At.MIDDLE_PATTERN,new Int32Array(At.MIDDLE_PATTERN.length).fill(0))[1];for(let e=0;e<4&&i<o;e++){let e=At.decodeDigit(t,r,i,At.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+e);for(let t of r)i+=t}return{rowOffset:i,resultString:n}}getBarcodeFormat(){return V.EAN_8}}class Tt extends At{constructor(){super(...arguments),this.ean13Reader=new St}getBarcodeFormat(){return V.UPC_A}decode(t,e){return this.maybeReturnResult(this.ean13Reader.decode(t))}decodeRow(t,e,n){return this.maybeReturnResult(this.ean13Reader.decodeRow(t,e,n))}decodeMiddle(t,e,n){return this.ean13Reader.decodeMiddle(t,e,n)}maybeReturnResult(t){let e=t.getText();if("0"===e.charAt(0)){let n=new L(e.substring(1),null,null,t.getResultPoints(),V.UPC_A);return null!=t.getResultMetadata()&&n.putAllMetadata(t.getResultMetadata()),n}throw new T}reset(){this.ean13Reader.reset()}}class Rt extends At{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(t,e,n){const r=this.decodeMiddleCounters.map(t=>t);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const o=t.getSize();let i=e[1],a=0;for(let e=0;e<6&&i<o;e++){const o=Rt.decodeDigit(t,r,i,Rt.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+o%10);for(let t of r)i+=t;o>=10&&(a|=1<<5-e)}return{rowOffset:i,resultString:Rt.determineNumSysAndCheckDigit(n,a)}}decodeEnd(t,e){return Rt.findGuardPatternWithoutCounters(t,e,!0,Rt.MIDDLE_END_PATTERN)}checkChecksum(t){return At.checkChecksum(Rt.convertUPCEtoUPCA(t))}static determineNumSysAndCheckDigit(t,e){for(let n=0;n<=1;n++)for(let r=0;r<10;r++)if(e===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][r])return String.fromCharCode("0".charCodeAt(0)+n)+t+String.fromCharCode("0".charCodeAt(0)+r);throw T.getNotFoundInstance()}getBarcodeFormat(){return V.UPC_E}static convertUPCEtoUPCA(t){const e=t.slice(1,7).split("").map(t=>t.charCodeAt(0)),n=new S;n.append(t.charAt(0));let r=e[5];switch(r){case 0:case 1:case 2:n.appendChars(e,0,2),n.append(r),n.append("0000"),n.appendChars(e,2,3);break;case 3:n.appendChars(e,0,3),n.append("00000"),n.appendChars(e,3,2);break;case 4:n.appendChars(e,0,4),n.append("00000"),n.append(e[4]);break;default:n.appendChars(e,0,5),n.append("0000"),n.append(r)}return t.length>=8&&n.append(t.charAt(7)),n.toString()}}Rt.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Rt.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class Nt extends wt{constructor(t){super();let n=null==t?null:t.get(b.POSSIBLE_FORMATS),r=[];e(n)?(r.push(new St),r.push(new Tt),r.push(new kt),r.push(new Rt)):(n.indexOf(V.EAN_13)>-1&&r.push(new St),n.indexOf(V.UPC_A)>-1&&r.push(new Tt),n.indexOf(V.EAN_8)>-1&&r.push(new kt),n.indexOf(V.UPC_E)>-1&&r.push(new Rt)),this.readers=r}decodeRow(t,e,n){for(let r of this.readers)try{const o=r.decodeRow(t,e,n),i=o.getBarcodeFormat()===V.EAN_13&&"0"===o.getText().charAt(0),a=null==n?null:n.get(b.POSSIBLE_FORMATS),s=null==a||a.includes(V.UPC_A);if(i&&s){const t=o.getRawBytes(),e=new L(o.getText().substring(1),t,t?t.length:null,o.getResultPoints(),V.UPC_A);return e.putAllMetadata(o.getResultMetadata()),e}return o}catch(t){}throw new T}reset(){for(let t of this.readers)t.reset()}}class Dt extends wt{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(t,e){for(let n=0;n<e.length;n++)if(wt.patternMatchVariance(t,e[n],Dt.MAX_INDIVIDUAL_VARIANCE)<Dt.MAX_AVG_VARIANCE)return n;throw new T}static count(t){return ot.sum(new Int32Array(t))}static increment(t,e){let n=0,r=e[0];for(let o=1;o<t.length;o++)e[o]>r&&(r=e[o],n=o);t[n]++}static decrement(t,e){let n=0,r=e[0];for(let o=1;o<t.length;o++)e[o]<r&&(r=e[o],n=o);t[n]--}static isFinderPattern(t){let e=t[0]+t[1],n=e/(e+t[2]+t[3]);if(n>=Dt.MIN_FINDER_PATTERN_RATIO&&n<=Dt.MAX_FINDER_PATTERN_RATIO){let e=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;for(let r of t)r>n&&(n=r),r<e&&(e=r);return n<10*e}return!1}}Dt.MAX_AVG_VARIANCE=.2,Dt.MAX_INDIVIDUAL_VARIANCE=.45,Dt.MIN_FINDER_PATTERN_RATIO=9.5/12,Dt.MAX_FINDER_PATTERN_RATIO=12.5/14;class xt{constructor(t,e){this.value=t,this.checksumPortion=e}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(t){if(!(t instanceof xt))return!1;const e=t;return this.value===e.value&&this.checksumPortion===e.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class Ot{constructor(t,e,n,r,o){this.value=t,this.startEnd=e,this.value=t,this.startEnd=e,this.resultPoints=new Array,this.resultPoints.push(new at(n,o)),this.resultPoints.push(new at(r,o))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(t){if(!(t instanceof Ot))return!1;const e=t;return this.value===e.value}hashCode(){return this.value}}class Mt{constructor(){}static getRSSvalue(t,e,n){let r=0;for(let e of t)r+=e;let o=0,i=0,a=t.length;for(let s=0;s<a-1;s++){let c;for(c=1,i|=1<<s;c<t[s];c++,i&=~(1<<s)){let t=Mt.combins(r-c-1,a-s-2);if(n&&0===i&&r-c-(a-s-1)>=a-s-1&&(t-=Mt.combins(r-c-(a-s),a-s-2)),a-s-1>1){let n=0;for(let t=r-c-(a-s-2);t>e;t--)n+=Mt.combins(r-c-t-1,a-s-3);t-=n*(a-1-s)}else r-c>e&&t--;o+=t}r-=c}return o}static combins(t,e){let n,r;t-e>e?(r=e,n=t-e):(r=t-e,n=e);let o=1,i=1;for(let e=t;e>n;e--)o*=e,i<=r&&(o/=i,i++);for(;i<=r;)o/=i,i++;return o}}class Pt{static buildBitArray(t){let e=2*t.length-1;null==t[t.length-1].getRightChar()&&(e-=1);let n=new $(12*e),r=0,o=t[0].getRightChar().getValue();for(let t=11;t>=0;--t)o&1<<t&&n.set(r),r++;for(let e=1;e<t.length;++e){let o=t[e],i=o.getLeftChar().getValue();for(let t=11;t>=0;--t)i&1<<t&&n.set(r),r++;if(null!=o.getRightChar()){let t=o.getRightChar().getValue();for(let e=11;e>=0;--e)t&1<<e&&n.set(r),r++}}return n}}class Bt{constructor(t,e){e?this.decodedInformation=null:(this.finished=t,this.decodedInformation=e)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Ft{constructor(t){this.newPosition=t}getNewPosition(){return this.newPosition}}class Lt extends Ft{constructor(t,e){super(t),this.value=e}getValue(){return this.value}isFNC1(){return this.value===Lt.FNC1}}Lt.FNC1="$";class qt extends Ft{constructor(t,e,n){super(t),n?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=e}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class Vt extends Ft{constructor(t,e,n){if(super(t),e<0||e>10||n<0||n>10)throw new v;this.firstDigit=e,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Vt.FNC1}isSecondDigitFNC1(){return this.secondDigit===Vt.FNC1}isAnyFNC1(){return this.firstDigit===Vt.FNC1||this.secondDigit===Vt.FNC1}}Vt.FNC1=10;class Ht{constructor(){}static parseFieldsInGeneralPurpose(t){if(!t)return null;if(t.length<2)throw new T;let e=t.substring(0,2);for(let n of Ht.TWO_DIGIT_DATA_LENGTH)if(n[0]===e)return n[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(2,n[2],t):Ht.processFixedAI(2,n[1],t);if(t.length<3)throw new T;let n=t.substring(0,3);for(let e of Ht.THREE_DIGIT_DATA_LENGTH)if(e[0]===n)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(3,e[2],t):Ht.processFixedAI(3,e[1],t);for(let e of Ht.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(e[0]===n)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(4,e[2],t):Ht.processFixedAI(4,e[1],t);if(t.length<4)throw new T;let r=t.substring(0,4);for(let e of Ht.FOUR_DIGIT_DATA_LENGTH)if(e[0]===r)return e[1]===Ht.VARIABLE_LENGTH?Ht.processVariableAI(4,e[2],t):Ht.processFixedAI(4,e[1],t);throw new T}static processFixedAI(t,e,n){if(n.length<t)throw new T;let r=n.substring(0,t);if(n.length<t+e)throw new T;let o=n.substring(t,t+e),i=n.substring(t+e),a="("+r+")"+o,s=Ht.parseFieldsInGeneralPurpose(i);return null==s?a:a+s}static processVariableAI(t,e,n){let r,o=n.substring(0,t);r=n.length<t+e?n.length:t+e;let i=n.substring(t,r),a=n.substring(r),s="("+o+")"+i,c=Ht.parseFieldsInGeneralPurpose(a);return null==c?s:s+c}}Ht.VARIABLE_LENGTH=[],Ht.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",Ht.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",Ht.VARIABLE_LENGTH,20],["22",Ht.VARIABLE_LENGTH,29],["30",Ht.VARIABLE_LENGTH,8],["37",Ht.VARIABLE_LENGTH,8],["90",Ht.VARIABLE_LENGTH,30],["91",Ht.VARIABLE_LENGTH,30],["92",Ht.VARIABLE_LENGTH,30],["93",Ht.VARIABLE_LENGTH,30],["94",Ht.VARIABLE_LENGTH,30],["95",Ht.VARIABLE_LENGTH,30],["96",Ht.VARIABLE_LENGTH,30],["97",Ht.VARIABLE_LENGTH,3],["98",Ht.VARIABLE_LENGTH,30],["99",Ht.VARIABLE_LENGTH,30]],Ht.THREE_DIGIT_DATA_LENGTH=[["240",Ht.VARIABLE_LENGTH,30],["241",Ht.VARIABLE_LENGTH,30],["242",Ht.VARIABLE_LENGTH,6],["250",Ht.VARIABLE_LENGTH,30],["251",Ht.VARIABLE_LENGTH,30],["253",Ht.VARIABLE_LENGTH,17],["254",Ht.VARIABLE_LENGTH,20],["400",Ht.VARIABLE_LENGTH,30],["401",Ht.VARIABLE_LENGTH,30],["402",17],["403",Ht.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",Ht.VARIABLE_LENGTH,20],["421",Ht.VARIABLE_LENGTH,15],["422",3],["423",Ht.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],Ht.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",Ht.VARIABLE_LENGTH,15],["391",Ht.VARIABLE_LENGTH,18],["392",Ht.VARIABLE_LENGTH,15],["393",Ht.VARIABLE_LENGTH,18],["703",Ht.VARIABLE_LENGTH,30]],Ht.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",Ht.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",Ht.VARIABLE_LENGTH,20],["8003",Ht.VARIABLE_LENGTH,30],["8004",Ht.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",Ht.VARIABLE_LENGTH,30],["8008",Ht.VARIABLE_LENGTH,12],["8018",18],["8020",Ht.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",Ht.VARIABLE_LENGTH,70],["8200",Ht.VARIABLE_LENGTH,70]];class Ut{constructor(t){this.buffer=new S,this.information=t}decodeAllCodes(t,e){let n=e,r=null;for(;;){let e=this.decodeGeneralPurposeField(n,r),o=Ht.parseFieldsInGeneralPurpose(e.getNewString());if(null!=o&&t.append(o),r=e.isRemaining()?""+e.getRemainingValue():null,n===e.getNewPosition())break;n=e.getNewPosition()}return t.toString()}isStillNumeric(t){if(t+7>this.information.getSize())return t+4<=this.information.getSize();for(let e=t;e<t+3;++e)if(this.information.get(e))return!0;return this.information.get(t+3)}decodeNumeric(t){if(t+7>this.information.getSize()){let e=this.extractNumericValueFromBitArray(t,4);return new Vt(this.information.getSize(),0===e?Vt.FNC1:e-1,Vt.FNC1)}let e=this.extractNumericValueFromBitArray(t,7);return new Vt(t+7,(e-8)/11,(e-8)%11)}extractNumericValueFromBitArray(t,e){return Ut.extractNumericValueFromBitArray(this.information,t,e)}static extractNumericValueFromBitArray(t,e,n){let r=0;for(let o=0;o<n;++o)t.get(e+o)&&(r|=1<<n-o-1);return r}decodeGeneralPurposeField(t,e){this.buffer.setLengthToZero(),null!=e&&this.buffer.append(e),this.current.setPosition(t);let n=this.parseBlocks();return null!=n&&n.isRemaining()?new qt(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new qt(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let t,e;do{let n=this.current.getPosition();if(this.current.isAlpha()?(e=this.parseAlphaBlock(),t=e.isFinished()):this.current.isIsoIec646()?(e=this.parseIsoIec646Block(),t=e.isFinished()):(e=this.parseNumericBlock(),t=e.isFinished()),n===this.current.getPosition()&&!t)break}while(!t);return e.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let t=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(t.getNewPosition()),t.isFirstDigitFNC1()){let e;return e=t.isSecondDigitFNC1()?new qt(this.current.getPosition(),this.buffer.toString()):new qt(this.current.getPosition(),this.buffer.toString(),t.getSecondDigit()),new Bt(!0,e)}if(this.buffer.append(t.getFirstDigit()),t.isSecondDigitFNC1()){let t=new qt(this.current.getPosition(),this.buffer.toString());return new Bt(!0,t)}this.buffer.append(t.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Bt(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let t=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(t.getNewPosition()),t.isFNC1()){let t=new qt(this.current.getPosition(),this.buffer.toString());return new Bt(!0,t)}this.buffer.append(t.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new Bt(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let t=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(t.getNewPosition()),t.isFNC1()){let t=new qt(this.current.getPosition(),this.buffer.toString());return new Bt(!0,t)}this.buffer.append(t.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new Bt(!1)}isStillIsoIec646(t){if(t+5>this.information.getSize())return!1;let e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+7>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(t,7);if(n>=64&&n<116)return!0;if(t+8>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(t,8);return r>=232&&r<253}decodeIsoIec646(t){let e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new Lt(t+5,Lt.FNC1);if(e>=5&&e<15)return new Lt(t+5,"0"+(e-5));let n,r=this.extractNumericValueFromBitArray(t,7);if(r>=64&&r<90)return new Lt(t+7,""+(r+1));if(r>=90&&r<116)return new Lt(t+7,""+(r+7));switch(this.extractNumericValueFromBitArray(t,8)){case 232:n="!";break;case 233:n='"';break;case 234:n="%";break;case 235:n="&";break;case 236:n="'";break;case 237:n="(";break;case 238:n=")";break;case 239:n="*";break;case 240:n="+";break;case 241:n=",";break;case 242:n="-";break;case 243:n=".";break;case 244:n="/";break;case 245:n=":";break;case 246:n=";";break;case 247:n="<";break;case 248:n="=";break;case 249:n=">";break;case 250:n="?";break;case 251:n="_";break;case 252:n=" ";break;default:throw new v}return new Lt(t+8,n)}isStillAlpha(t){if(t+5>this.information.getSize())return!1;let e=this.extractNumericValueFromBitArray(t,5);if(e>=5&&e<16)return!0;if(t+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(t,6);return n>=16&&n<63}decodeAlphanumeric(t){let e=this.extractNumericValueFromBitArray(t,5);if(15===e)return new Lt(t+5,Lt.FNC1);if(e>=5&&e<15)return new Lt(t+5,"0"+(e-5));let n,r=this.extractNumericValueFromBitArray(t,6);if(r>=32&&r<58)return new Lt(t+6,""+(r+33));switch(r){case 58:n="*";break;case 59:n=",";break;case 60:n="-";break;case 61:n=".";break;case 62:n="/";break;default:throw new et("Decoding invalid alphanumeric value: "+r)}return new Lt(t+6,n)}isAlphaTo646ToAlphaLatch(t){if(t+1>this.information.getSize())return!1;for(let e=0;e<5&&e+t<this.information.getSize();++e)if(2===e){if(!this.information.get(t+2))return!1}else if(this.information.get(t+e))return!1;return!0}isAlphaOr646ToNumericLatch(t){if(t+3>this.information.getSize())return!1;for(let e=t;e<t+3;++e)if(this.information.get(e))return!1;return!0}isNumericToAlphaNumericLatch(t){if(t+1>this.information.getSize())return!1;for(let e=0;e<4&&e+t<this.information.getSize();++e)if(this.information.get(t+e))return!1;return!0}}class zt{constructor(t){this.information=t,this.generalDecoder=new Ut(t)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class Wt extends zt{constructor(t){super(t)}encodeCompressedGtin(t,e){t.append("(01)");let n=t.length();t.append("9"),this.encodeCompressedGtinWithoutAI(t,e,n)}encodeCompressedGtinWithoutAI(t,e,n){for(let n=0;n<4;++n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(e+10*n,10);r/100==0&&t.append("0"),r/10==0&&t.append("0"),t.append(r)}Wt.appendCheckDigit(t,n)}static appendCheckDigit(t,e){let n=0;for(let r=0;r<13;r++){let o=t.charAt(r+e).charCodeAt(0)-"0".charCodeAt(0);n+=1&r?o:3*o}n=10-n%10,10===n&&(n=0),t.append(n)}}Wt.GTIN_SIZE=40;class jt extends Wt{constructor(t){super(t)}parseInformation(){let t=new S;t.append("(01)");let e=t.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(jt.HEADER_SIZE,4);return t.append(n),this.encodeCompressedGtinWithoutAI(t,jt.HEADER_SIZE+4,e),this.getGeneralDecoder().decodeAllCodes(t,jt.HEADER_SIZE+44)}}jt.HEADER_SIZE=4;class Gt extends zt{constructor(t){super(t)}parseInformation(){let t=new S;return this.getGeneralDecoder().decodeAllCodes(t,Gt.HEADER_SIZE)}}Gt.HEADER_SIZE=5;class Xt extends Wt{constructor(t){super(t)}encodeCompressedWeight(t,e,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(e,n);this.addWeightCode(t,r);let o=this.checkWeight(r),i=1e5;for(let e=0;e<5;++e)o/i===0&&t.append("0"),i/=10;t.append(o)}}class Qt extends Xt{constructor(t){super(t)}parseInformation(){if(this.getInformation().getSize()!=Qt.HEADER_SIZE+Xt.GTIN_SIZE+Qt.WEIGHT_SIZE)throw new T;let t=new S;return this.encodeCompressedGtin(t,Qt.HEADER_SIZE),this.encodeCompressedWeight(t,Qt.HEADER_SIZE+Xt.GTIN_SIZE,Qt.WEIGHT_SIZE),t.toString()}}Qt.HEADER_SIZE=5,Qt.WEIGHT_SIZE=15;class Yt extends Qt{constructor(t){super(t)}addWeightCode(t,e){t.append("(3103)")}checkWeight(t){return t}}class Zt extends Qt{constructor(t){super(t)}addWeightCode(t,e){e<1e4?t.append("(3202)"):t.append("(3203)")}checkWeight(t){return t<1e4?t:t-1e4}}class Kt extends Wt{constructor(t){super(t)}parseInformation(){if(this.getInformation().getSize()<Kt.HEADER_SIZE+Wt.GTIN_SIZE)throw new T;let t=new S;this.encodeCompressedGtin(t,Kt.HEADER_SIZE);let e=this.getGeneralDecoder().extractNumericValueFromBitArray(Kt.HEADER_SIZE+Wt.GTIN_SIZE,Kt.LAST_DIGIT_SIZE);t.append("(392"),t.append(e),t.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Kt.HEADER_SIZE+Wt.GTIN_SIZE+Kt.LAST_DIGIT_SIZE,null);return t.append(n.getNewString()),t.toString()}}Kt.HEADER_SIZE=8,Kt.LAST_DIGIT_SIZE=2;class Jt extends Wt{constructor(t){super(t)}parseInformation(){if(this.getInformation().getSize()<Jt.HEADER_SIZE+Wt.GTIN_SIZE)throw new T;let t=new S;this.encodeCompressedGtin(t,Jt.HEADER_SIZE);let e=this.getGeneralDecoder().extractNumericValueFromBitArray(Jt.HEADER_SIZE+Wt.GTIN_SIZE,Jt.LAST_DIGIT_SIZE);t.append("(393"),t.append(e),t.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Jt.HEADER_SIZE+Wt.GTIN_SIZE+Jt.LAST_DIGIT_SIZE,Jt.FIRST_THREE_DIGITS_SIZE);n/100==0&&t.append("0"),n/10==0&&t.append("0"),t.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Jt.HEADER_SIZE+Wt.GTIN_SIZE+Jt.LAST_DIGIT_SIZE+Jt.FIRST_THREE_DIGITS_SIZE,null);return t.append(r.getNewString()),t.toString()}}Jt.HEADER_SIZE=8,Jt.LAST_DIGIT_SIZE=2,Jt.FIRST_THREE_DIGITS_SIZE=10;class te extends Xt{constructor(t,e,n){super(t),this.dateCode=n,this.firstAIdigits=e}parseInformation(){if(this.getInformation().getSize()!=te.HEADER_SIZE+te.GTIN_SIZE+te.WEIGHT_SIZE+te.DATE_SIZE)throw new T;let t=new S;return this.encodeCompressedGtin(t,te.HEADER_SIZE),this.encodeCompressedWeight(t,te.HEADER_SIZE+te.GTIN_SIZE,te.WEIGHT_SIZE),this.encodeCompressedDate(t,te.HEADER_SIZE+te.GTIN_SIZE+te.WEIGHT_SIZE),t.toString()}encodeCompressedDate(t,e){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(e,te.DATE_SIZE);if(38400==n)return;t.append("("),t.append(this.dateCode),t.append(")");let r=n%32;n/=32;let o=n%12+1;n/=12;let i=n;i/10==0&&t.append("0"),t.append(i),o/10==0&&t.append("0"),t.append(o),r/10==0&&t.append("0"),t.append(r)}addWeightCode(t,e){t.append("("),t.append(this.firstAIdigits),t.append(e/1e5),t.append(")")}checkWeight(t){return t%1e5}}function ee(t){try{if(t.get(1))return new jt(t);if(!t.get(2))return new Gt(t);switch(Ut.extractNumericValueFromBitArray(t,1,4)){case 4:return new Yt(t);case 5:return new Zt(t)}switch(Ut.extractNumericValueFromBitArray(t,1,5)){case 12:return new Kt(t);case 13:return new Jt(t)}switch(Ut.extractNumericValueFromBitArray(t,1,7)){case 56:return new te(t,"310","11");case 57:return new te(t,"320","11");case 58:return new te(t,"310","13");case 59:return new te(t,"320","13");case 60:return new te(t,"310","15");case 61:return new te(t,"320","15");case 62:return new te(t,"310","17");case 63:return new te(t,"320","17")}}catch(e){throw console.log(e),new et("unknown decoder: "+t)}}te.HEADER_SIZE=8,te.WEIGHT_SIZE=20,te.DATE_SIZE=16;class ne{constructor(t,e,n,r){this.leftchar=t,this.rightchar=e,this.finderpattern=n,this.maybeLast=r}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(t,e){return t instanceof ne&&ne.equalsOrNull(t.leftchar,e.leftchar)&&ne.equalsOrNull(t.rightchar,e.rightchar)&&ne.equalsOrNull(t.finderpattern,e.finderpattern)}static equalsOrNull(t,e){return null===t?null===e:ne.equals(t,e)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class re{constructor(t,e,n){this.pairs=t,this.rowNumber=e,this.wasReversed=n}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(t){return this.checkEqualitity(this,t)}toString(){return"{ "+this.pairs+" }"}equals(t,e){return t instanceof re&&this.checkEqualitity(t,e)&&t.wasReversed===e.wasReversed}checkEqualitity(t,e){if(!t||!e)return;let n;return t.forEach((t,r)=>{e.forEach(e=>{t.getLeftChar().getValue()===e.getLeftChar().getValue()&&t.getRightChar().getValue()===e.getRightChar().getValue()&&t.getFinderPatter().getValue()===e.getFinderPatter().getValue()&&(n=!0)})}),n}}class oe extends Dt{constructor(t){super(...arguments),this.pairs=new Array(oe.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=!0===t}decodeRow(t,e,n){this.pairs.length=0,this.startFromEven=!1;try{return oe.constructResult(this.decodeRow2pairs(t,e))}catch(t){this.verbose&&console.log(t)}return this.pairs.length=0,this.startFromEven=!0,oe.constructResult(this.decodeRow2pairs(t,e))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(t,e){let n,r=!1;for(;!r;)try{this.pairs.push(this.retrieveNextPair(e,this.pairs,t))}catch(t){if(t instanceof T){if(!this.pairs.length)throw new T;r=!0}}if(this.checkChecksum())return this.pairs;if(n=!!this.rows.length,this.storeRow(t,!1),n){let t=this.checkRowsBoolean(!1);if(null!=t)return t;if(t=this.checkRowsBoolean(!0),null!=t)return t}throw new T}checkRowsBoolean(t){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,t&&(this.rows=this.rows.reverse());let e=null;try{e=this.checkRows(new Array,0)}catch(t){this.verbose&&console.log(t)}return t&&(this.rows=this.rows.reverse()),e}checkRows(t,e){for(let n=e;n<this.rows.length;n++){let e=this.rows[n];this.pairs.length=0;for(let e of t)this.pairs.push(e.getPairs());if(this.pairs.push(e.getPairs()),!oe.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let r=new Array(t);r.push(e);try{return this.checkRows(r,n+1)}catch(t){this.verbose&&console.log(t)}}throw new T}static isValidSequence(t){for(let e of oe.FINDER_PATTERN_SEQUENCES){if(t.length>e.length)continue;let n=!0;for(let r=0;r<t.length;r++)if(t[r].getFinderPattern().getValue()!=e[r]){n=!1;break}if(n)return!0}return!1}storeRow(t,e){let n=0,r=!1,o=!1;for(;n<this.rows.length;){let e=this.rows[n];if(e.getRowNumber()>t){o=e.isEquivalent(this.pairs);break}r=e.isEquivalent(this.pairs),n++}o||r||oe.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new re(this.pairs,t,e)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(t,e){for(let n of e)if(n.getPairs().length!==t.length)for(let e of n.getPairs())for(let n of t)if(ne.equals(e,n))break}static isPartialRow(t,e){for(let n of e){let e=!0;for(let r of t){let t=!1;for(let e of n.getPairs())if(r.equals(e)){t=!0;break}if(!t){e=!1;break}}if(e)return!0}return!1}getRows(){return this.rows}static constructResult(t){let e=ee(Pt.buildBitArray(t)).parseInformation(),n=t[0].getFinderPattern().getResultPoints(),r=t[t.length-1].getFinderPattern().getResultPoints(),o=[n[0],n[1],r[0],r[1]];return new L(e,null,null,o,V.RSS_EXPANDED,null)}checkChecksum(){let t=this.pairs.get(0),e=t.getLeftChar(),n=t.getRightChar();if(null==n)return!1;let r=n.getChecksumPortion(),o=2;for(let t=1;t<this.pairs.size();++t){let e=this.pairs.get(t);r+=e.getLeftChar().getChecksumPortion(),o++;let n=e.getRightChar();null!=n&&(r+=n.getChecksumPortion(),o++)}return r%=211,211*(o-4)+r==e.getValue()}static getNextSecondBar(t,e){let n;return t.get(e)?(n=t.getNextUnset(e),n=t.getNextSet(n)):(n=t.getNextSet(e),n=t.getNextUnset(n)),n}retrieveNextPair(t,e,n){let r,o=e.length%2==0;this.startFromEven&&(o=!o);let i=!0,a=-1;do{this.findNextPair(t,e,a),r=this.parseFoundFinderPattern(t,n,o),null==r?a=oe.getNextSecondBar(t,this.startEnd[0]):i=!1}while(i);let s,c=this.decodeDataCharacter(t,r,o,!0);if(!this.isEmptyPair(e)&&e[e.length-1].mustBeLast())throw new T;try{s=this.decodeDataCharacter(t,r,o,!1)}catch(t){s=null,this.verbose&&console.log(t)}return new ne(c,s,r,!0)}isEmptyPair(t){return 0===t.length}findNextPair(t,e,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let o,i=t.getSize();o=n>=0?n:this.isEmptyPair(e)?0:e[e.length-1].getFinderPattern().getStartEnd()[1];let a=e.length%2!=0;this.startFromEven&&(a=!a);let s=!1;for(;o<i&&(s=!t.get(o),s);)o++;let c=0,l=o;for(let e=o;e<i;e++)if(t.get(e)!=s)r[c]++;else{if(3==c){if(a&&oe.reverseCounters(r),oe.isFinderPattern(r))return this.startEnd[0]=l,void(this.startEnd[1]=e);a&&oe.reverseCounters(r),l+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,c--}else c++;r[c]=1,s=!s}throw new T}static reverseCounters(t){let e=t.length;for(let n=0;n<e/2;++n){let r=t[n];t[n]=t[e-n-1],t[e-n-1]=r}}parseFoundFinderPattern(t,e,n){let r,o,i;if(n){let e=this.startEnd[0]-1;for(;e>=0&&!t.get(e);)e--;e++,r=this.startEnd[0]-e,o=e,i=this.startEnd[1]}else o=this.startEnd[0],i=t.getNextUnset(this.startEnd[1]+1),r=i-this.startEnd[1];let a,s=this.getDecodeFinderCounters();f.arraycopy(s,0,s,1,s.length-1),s[0]=r;try{a=this.parseFinderValue(s,oe.FINDER_PATTERNS)}catch(t){return null}return new Ot(a,[o,i],o,i,e)}decodeDataCharacter(t,e,n,r){let o=this.getDataCharacterCounters();for(let t=0;t<o.length;t++)o[t]=0;if(r)oe.recordPatternInReverse(t,e.getStartEnd()[0],o);else{oe.recordPattern(t,e.getStartEnd()[1],o);for(let t=0,e=o.length-1;t<e;t++,e--){let n=o[t];o[t]=o[e],o[e]=n}}let i=17,a=ot.sum(new Int32Array(o))/i,s=(e.getStartEnd()[1]-e.getStartEnd()[0])/15;if(Math.abs(a-s)/s>.3)throw new T;let c=this.getOddCounts(),l=this.getEvenCounts(),d=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let t=0;t<o.length;t++){let e=1*o[t]/a,n=e+.5;if(n<1){if(e<.3)throw new T;n=1}else if(n>8){if(e>8.7)throw new T;n=8}let r=t/2;1&t?(l[r]=n,u[r]=e-n):(c[r]=n,d[r]=e-n)}this.adjustOddEvenCounts(i);let h=4*e.getValue()+(n?0:2)+(r?0:1)-1,m=0,f=0;for(let t=c.length-1;t>=0;t--){if(oe.isNotA1left(e,n,r)){let e=oe.WEIGHTS[h][2*t];f+=c[t]*e}m+=c[t]}let p=0;for(let t=l.length-1;t>=0;t--)if(oe.isNotA1left(e,n,r)){let e=oe.WEIGHTS[h][2*t+1];p+=l[t]*e}let _=f+p;if(1&m||m>13||m<4)throw new T;let g=(13-m)/2,w=oe.SYMBOL_WIDEST[g],$=9-w,y=Mt.getRSSvalue(c,w,!0),b=Mt.getRSSvalue(l,$,!1),v=oe.EVEN_TOTAL_SUBSET[g],I=oe.GSUM[g];return new xt(y*v+b+I,_)}static isNotA1left(t,e,n){return!(0==t.getValue()&&e&&n)}adjustOddEvenCounts(t){let e=ot.sum(new Int32Array(this.getOddCounts())),n=ot.sum(new Int32Array(this.getEvenCounts())),r=!1,o=!1;e>13?o=!0:e<4&&(r=!0);let i=!1,a=!1;n>13?a=!0:n<4&&(i=!0);let s=e+n-t,c=!(1&~e),l=!(1&n);if(1==s)if(c){if(l)throw new T;o=!0}else{if(!l)throw new T;a=!0}else if(-1==s)if(c){if(l)throw new T;r=!0}else{if(!l)throw new T;i=!0}else{if(0!=s)throw new T;if(c){if(!l)throw new T;e<n?(r=!0,a=!0):(o=!0,i=!0)}else if(l)throw new T}if(r){if(o)throw new T;oe.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&oe.decrement(this.getOddCounts(),this.getOddRoundingErrors()),i){if(a)throw new T;oe.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&oe.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}oe.SYMBOL_WIDEST=[7,5,4,3,1],oe.EVEN_TOTAL_SUBSET=[4,20,52,104,204],oe.GSUM=[0,348,1388,2948,3988],oe.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],oe.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],oe.FINDER_PAT_A=0,oe.FINDER_PAT_B=1,oe.FINDER_PAT_C=2,oe.FINDER_PAT_D=3,oe.FINDER_PAT_E=4,oe.FINDER_PAT_F=5,oe.FINDER_PATTERN_SEQUENCES=[[oe.FINDER_PAT_A,oe.FINDER_PAT_A],[oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B],[oe.FINDER_PAT_A,oe.FINDER_PAT_C,oe.FINDER_PAT_B,oe.FINDER_PAT_D],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_C],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_D,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_E,oe.FINDER_PAT_B,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_D],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_E],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F],[oe.FINDER_PAT_A,oe.FINDER_PAT_A,oe.FINDER_PAT_B,oe.FINDER_PAT_B,oe.FINDER_PAT_C,oe.FINDER_PAT_D,oe.FINDER_PAT_D,oe.FINDER_PAT_E,oe.FINDER_PAT_E,oe.FINDER_PAT_F,oe.FINDER_PAT_F]],oe.MAX_PAIRS=11;class ie extends xt{constructor(t,e,n){super(t,e),this.count=0,this.finderPattern=n}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class ae extends Dt{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(t,e,n){const r=this.decodePair(e,!1,t,n);ae.addOrTally(this.possibleLeftPairs,r),e.reverse();let o=this.decodePair(e,!0,t,n);ae.addOrTally(this.possibleRightPairs,o),e.reverse();for(let t of this.possibleLeftPairs)if(t.getCount()>1)for(let e of this.possibleRightPairs)if(e.getCount()>1&&ae.checkChecksum(t,e))return ae.constructResult(t,e);throw new T}static addOrTally(t,e){if(null==e)return;let n=!1;for(let r of t)if(r.getValue()===e.getValue()){r.incrementCount(),n=!0;break}n||t.push(e)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(t,e){let n=4537077*t.getValue()+e.getValue(),r=new String(n).toString(),o=new S;for(let t=13-r.length;t>0;t--)o.append("0");o.append(r);let i=0;for(let t=0;t<13;t++){let e=o.charAt(t).charCodeAt(0)-"0".charCodeAt(0);i+=1&t?e:3*e}i=10-i%10,10===i&&(i=0),o.append(i.toString());let a=t.getFinderPattern().getResultPoints(),s=e.getFinderPattern().getResultPoints();return new L(o.toString(),null,0,[a[0],a[1],s[0],s[1]],V.RSS_14,(new Date).getTime())}static checkChecksum(t,e){let n=(t.getChecksumPortion()+16*e.getChecksumPortion())%79,r=9*t.getFinderPattern().getValue()+e.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(t,e,n,r){try{let o=this.findFinderPattern(t,e),i=this.parseFoundFinderPattern(t,n,e,o),a=null==r?null:r.get(b.NEED_RESULT_POINT_CALLBACK);if(null!=a){let r=(o[0]+o[1])/2;e&&(r=t.getSize()-1-r),a.foundPossibleResultPoint(new at(r,n))}let s=this.decodeDataCharacter(t,i,!0),c=this.decodeDataCharacter(t,i,!1);return new ie(1597*s.getValue()+c.getValue(),s.getChecksumPortion()+4*c.getChecksumPortion(),i)}catch(t){return null}}decodeDataCharacter(t,e,n){let r=this.getDataCharacterCounters();for(let t=0;t<r.length;t++)r[t]=0;if(n)wt.recordPatternInReverse(t,e.getStartEnd()[0],r);else{wt.recordPattern(t,e.getStartEnd()[1]+1,r);for(let t=0,e=r.length-1;t<e;t++,e--){let n=r[t];r[t]=r[e],r[e]=n}}let o=n?16:15,i=ot.sum(new Int32Array(r))/o,a=this.getOddCounts(),s=this.getEvenCounts(),c=this.getOddRoundingErrors(),l=this.getEvenRoundingErrors();for(let t=0;t<r.length;t++){let e=r[t]/i,n=Math.floor(e+.5);n<1?n=1:n>8&&(n=8);let o=Math.floor(t/2);1&t?(s[o]=n,l[o]=e-n):(a[o]=n,c[o]=e-n)}this.adjustOddEvenCounts(n,o);let d=0,u=0;for(let t=a.length-1;t>=0;t--)u*=9,u+=a[t],d+=a[t];let h=0,m=0;for(let t=s.length-1;t>=0;t--)h*=9,h+=s[t],m+=s[t];let f=u+3*h;if(n){if(1&d||d>12||d<4)throw new T;let t=(12-d)/2,e=ae.OUTSIDE_ODD_WIDEST[t],n=9-e,r=Mt.getRSSvalue(a,e,!1),o=Mt.getRSSvalue(s,n,!0),i=ae.OUTSIDE_EVEN_TOTAL_SUBSET[t],c=ae.OUTSIDE_GSUM[t];return new xt(r*i+o+c,f)}{if(1&m||m>10||m<4)throw new T;let t=(10-m)/2,e=ae.INSIDE_ODD_WIDEST[t],n=9-e,r=Mt.getRSSvalue(a,e,!0),o=Mt.getRSSvalue(s,n,!1),i=ae.INSIDE_ODD_TOTAL_SUBSET[t],c=ae.INSIDE_GSUM[t];return new xt(o*i+r+c,f)}}findFinderPattern(t,e){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=t.getSize(),o=!1,i=0;for(;i<r&&(o=!t.get(i),e!==o);)i++;let a=0,s=i;for(let e=i;e<r;e++)if(t.get(e)!==o)n[a]++;else{if(3===a){if(Dt.isFinderPattern(n))return[s,e];s+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,a--}else a++;n[a]=1,o=!o}throw new T}parseFoundFinderPattern(t,e,n,r){let o=t.get(r[0]),i=r[0]-1;for(;i>=0&&o!==t.get(i);)i--;i++;const a=r[0]-i,s=this.getDecodeFinderCounters(),c=new Int32Array(s.length);f.arraycopy(s,0,c,1,s.length-1),c[0]=a;const l=this.parseFinderValue(c,ae.FINDER_PATTERNS);let d=i,u=r[1];return n&&(d=t.getSize()-1-d,u=t.getSize()-1-u),new Ot(l,[i,r[1]],d,u,e)}adjustOddEvenCounts(t,e){let n=ot.sum(new Int32Array(this.getOddCounts())),r=ot.sum(new Int32Array(this.getEvenCounts())),o=!1,i=!1,a=!1,s=!1;t?(n>12?i=!0:n<4&&(o=!0),r>12?s=!0:r<4&&(a=!0)):(n>11?i=!0:n<5&&(o=!0),r>10?s=!0:r<4&&(a=!0));let c=n+r-e,l=(1&n)==(t?1:0),d=!(1&~r);if(1===c)if(l){if(d)throw new T;i=!0}else{if(!d)throw new T;s=!0}else if(-1===c)if(l){if(d)throw new T;o=!0}else{if(!d)throw new T;a=!0}else{if(0!==c)throw new T;if(l){if(!d)throw new T;n<r?(o=!0,s=!0):(i=!0,a=!0)}else if(d)throw new T}if(o){if(i)throw new T;Dt.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&Dt.decrement(this.getOddCounts(),this.getOddRoundingErrors()),a){if(s)throw new T;Dt.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&Dt.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}ae.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],ae.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],ae.OUTSIDE_GSUM=[0,161,961,2015,2715],ae.INSIDE_GSUM=[0,336,1036,1516],ae.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],ae.INSIDE_ODD_WIDEST=[2,4,6,8],ae.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class se extends wt{constructor(t,e){super(),this.readers=[],this.verbose=!0===e;const n=t?t.get(b.POSSIBLE_FORMATS):null,r=t&&void 0!==t.get(b.ASSUME_CODE_39_CHECK_DIGIT);n?((n.includes(V.EAN_13)||n.includes(V.UPC_A)||n.includes(V.EAN_8)||n.includes(V.UPC_E))&&this.readers.push(new Nt(t)),n.includes(V.CODE_39)&&this.readers.push(new yt(r)),n.includes(V.CODE_128)&&this.readers.push(new $t),n.includes(V.ITF)&&this.readers.push(new bt),n.includes(V.RSS_14)&&this.readers.push(new ae),n.includes(V.RSS_EXPANDED)&&this.readers.push(new oe(this.verbose))):(this.readers.push(new Nt(t)),this.readers.push(new yt),this.readers.push(new Nt(t)),this.readers.push(new $t),this.readers.push(new bt),this.readers.push(new ae),this.readers.push(new oe(this.verbose)))}decodeRow(t,e,n){for(let r=0;r<this.readers.length;r++)try{return this.readers[r].decodeRow(t,e,n)}catch(t){}throw new T}reset(){this.readers.forEach(t=>t.reset())}}class ce extends F{constructor(t=500,e){super(new se(e),t,e)}}class le{constructor(t,e,n){this.ecCodewords=t,this.ecBlocks=[e],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class de{constructor(t,e){this.count=t,this.dataCodewords=e}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ue{constructor(t,e,n,r,o,i){this.versionNumber=t,this.symbolSizeRows=e,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=o,this.ecBlocks=i;let a=0;const s=i.getECCodewords(),c=i.getECBlocks();for(let t of c)a+=t.getCount()*(t.getDataCodewords()+s);this.totalCodewords=a}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(t,e){if(1&t||1&e)throw new v;for(let n of ue.VERSIONS)if(n.symbolSizeRows===t&&n.symbolSizeColumns===e)return n;throw new v}toString(){return""+this.versionNumber}static buildVersions(){return[new ue(1,10,10,8,8,new le(5,new de(1,3))),new ue(2,12,12,10,10,new le(7,new de(1,5))),new ue(3,14,14,12,12,new le(10,new de(1,8))),new ue(4,16,16,14,14,new le(12,new de(1,12))),new ue(5,18,18,16,16,new le(14,new de(1,18))),new ue(6,20,20,18,18,new le(18,new de(1,22))),new ue(7,22,22,20,20,new le(20,new de(1,30))),new ue(8,24,24,22,22,new le(24,new de(1,36))),new ue(9,26,26,24,24,new le(28,new de(1,44))),new ue(10,32,32,14,14,new le(36,new de(1,62))),new ue(11,36,36,16,16,new le(42,new de(1,86))),new ue(12,40,40,18,18,new le(48,new de(1,114))),new ue(13,44,44,20,20,new le(56,new de(1,144))),new ue(14,48,48,22,22,new le(68,new de(1,174))),new ue(15,52,52,24,24,new le(42,new de(2,102))),new ue(16,64,64,14,14,new le(56,new de(2,140))),new ue(17,72,72,16,16,new le(36,new de(4,92))),new ue(18,80,80,18,18,new le(48,new de(4,114))),new ue(19,88,88,20,20,new le(56,new de(4,144))),new ue(20,96,96,22,22,new le(68,new de(4,174))),new ue(21,104,104,24,24,new le(56,new de(6,136))),new ue(22,120,120,18,18,new le(68,new de(6,175))),new ue(23,132,132,20,20,new le(62,new de(8,163))),new ue(24,144,144,22,22,new le(62,new de(8,156),new de(2,155))),new ue(25,8,18,6,16,new le(7,new de(1,5))),new ue(26,8,32,6,14,new le(11,new de(1,10))),new ue(27,12,26,10,24,new le(14,new de(1,16))),new ue(28,12,36,10,16,new le(18,new de(1,22))),new ue(29,16,36,14,16,new le(24,new de(1,32))),new ue(30,16,48,14,22,new le(28,new de(1,49)))]}}ue.VERSIONS=ue.buildVersions();class he{constructor(t){const e=t.getHeight();if(e<8||e>144||1&e)throw new v;this.version=he.readVersion(t),this.mappingBitMatrix=this.extractDataRegion(t),this.readMappingMatrix=new k(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(t){const e=t.getHeight(),n=t.getWidth();return ue.getVersionForDimensions(e,n)}readCodewords(){const t=new Int8Array(this.version.getTotalCodewords());let e=0,n=4,r=0;const o=this.mappingBitMatrix.getHeight(),i=this.mappingBitMatrix.getWidth();let a=!1,s=!1,c=!1,l=!1;do{if(n!==o||0!==r||a)if(n===o-2&&0===r&&3&i&&!s)t[e++]=255&this.readCorner2(o,i),n-=2,r+=2,s=!0;else if(n!==o+4||2!==r||7&i||c)if(n!==o-2||0!==r||4!=(7&i)||l){do{n<o&&r>=0&&!this.readMappingMatrix.get(r,n)&&(t[e++]=255&this.readUtah(n,r,o,i)),n-=2,r+=2}while(n>=0&&r<i);n+=1,r+=3;do{n>=0&&r<i&&!this.readMappingMatrix.get(r,n)&&(t[e++]=255&this.readUtah(n,r,o,i)),n+=2,r-=2}while(n<o&&r>=0);n+=3,r+=1}else t[e++]=255&this.readCorner4(o,i),n-=2,r+=2,l=!0;else t[e++]=255&this.readCorner3(o,i),n-=2,r+=2,c=!0;else t[e++]=255&this.readCorner1(o,i),n-=2,r+=2,a=!0}while(n<o||r<i);if(e!==this.version.getTotalCodewords())throw new v;return t}readModule(t,e,n,r){return t<0&&(t+=n,e+=4-(n+4&7)),e<0&&(e+=r,t+=4-(r+4&7)),this.readMappingMatrix.set(e,t),this.mappingBitMatrix.get(e,t)}readUtah(t,e,n,r){let o=0;return this.readModule(t-2,e-2,n,r)&&(o|=1),o<<=1,this.readModule(t-2,e-1,n,r)&&(o|=1),o<<=1,this.readModule(t-1,e-2,n,r)&&(o|=1),o<<=1,this.readModule(t-1,e-1,n,r)&&(o|=1),o<<=1,this.readModule(t-1,e,n,r)&&(o|=1),o<<=1,this.readModule(t,e-2,n,r)&&(o|=1),o<<=1,this.readModule(t,e-1,n,r)&&(o|=1),o<<=1,this.readModule(t,e,n,r)&&(o|=1),o}readCorner1(t,e){let n=0;return this.readModule(t-1,0,t,e)&&(n|=1),n<<=1,this.readModule(t-1,1,t,e)&&(n|=1),n<<=1,this.readModule(t-1,2,t,e)&&(n|=1),n<<=1,this.readModule(0,e-2,t,e)&&(n|=1),n<<=1,this.readModule(0,e-1,t,e)&&(n|=1),n<<=1,this.readModule(1,e-1,t,e)&&(n|=1),n<<=1,this.readModule(2,e-1,t,e)&&(n|=1),n<<=1,this.readModule(3,e-1,t,e)&&(n|=1),n}readCorner2(t,e){let n=0;return this.readModule(t-3,0,t,e)&&(n|=1),n<<=1,this.readModule(t-2,0,t,e)&&(n|=1),n<<=1,this.readModule(t-1,0,t,e)&&(n|=1),n<<=1,this.readModule(0,e-4,t,e)&&(n|=1),n<<=1,this.readModule(0,e-3,t,e)&&(n|=1),n<<=1,this.readModule(0,e-2,t,e)&&(n|=1),n<<=1,this.readModule(0,e-1,t,e)&&(n|=1),n<<=1,this.readModule(1,e-1,t,e)&&(n|=1),n}readCorner3(t,e){let n=0;return this.readModule(t-1,0,t,e)&&(n|=1),n<<=1,this.readModule(t-1,e-1,t,e)&&(n|=1),n<<=1,this.readModule(0,e-3,t,e)&&(n|=1),n<<=1,this.readModule(0,e-2,t,e)&&(n|=1),n<<=1,this.readModule(0,e-1,t,e)&&(n|=1),n<<=1,this.readModule(1,e-3,t,e)&&(n|=1),n<<=1,this.readModule(1,e-2,t,e)&&(n|=1),n<<=1,this.readModule(1,e-1,t,e)&&(n|=1),n}readCorner4(t,e){let n=0;return this.readModule(t-3,0,t,e)&&(n|=1),n<<=1,this.readModule(t-2,0,t,e)&&(n|=1),n<<=1,this.readModule(t-1,0,t,e)&&(n|=1),n<<=1,this.readModule(0,e-2,t,e)&&(n|=1),n<<=1,this.readModule(0,e-1,t,e)&&(n|=1),n<<=1,this.readModule(1,e-1,t,e)&&(n|=1),n<<=1,this.readModule(2,e-1,t,e)&&(n|=1),n<<=1,this.readModule(3,e-1,t,e)&&(n|=1),n}extractDataRegion(t){const e=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(t.getHeight()!==e)throw new d("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),o=this.version.getDataRegionSizeColumns(),i=e/r|0,a=n/o|0,s=new k(a*o,i*r);for(let e=0;e<i;++e){const n=e*r;for(let i=0;i<a;++i){const a=i*o;for(let c=0;c<r;++c){const l=e*(r+2)+1+c,d=n+c;for(let e=0;e<o;++e){const n=i*(o+2)+1+e;if(t.get(n,l)){const t=a+e;s.set(t,d)}}}}}return s}}class me{constructor(t,e){this.numDataCodewords=t,this.codewords=e}static getDataBlocks(t,e){const n=e.getECBlocks();let r=0;const o=n.getECBlocks();for(let t of o)r+=t.getCount();const i=new Array(r);let a=0;for(let t of o)for(let e=0;e<t.getCount();e++){const e=t.getDataCodewords(),r=n.getECCodewords()+e;i[a++]=new me(e,new Uint8Array(r))}const s=i[0].codewords.length-n.getECCodewords(),c=s-1;let l=0;for(let e=0;e<c;e++)for(let n=0;n<a;n++)i[n].codewords[e]=t[l++];const u=24===e.getVersionNumber(),h=u?8:a;for(let e=0;e<h;e++)i[e].codewords[s-1]=t[l++];const m=i[0].codewords.length;for(let e=s;e<m;e++)for(let n=0;n<a;n++){const r=u?(n+8)%a:n,o=u&&r>7?e-1:e;i[r].codewords[o]=t[l++]}if(l!==t.length)throw new d;return i}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class fe{constructor(t){this.bytes=t,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(t){if(t<1||t>32||t>this.available())throw new d(""+t);let e=0,n=this.bitOffset,r=this.byteOffset;const o=this.bytes;if(n>0){const i=8-n,a=t<i?t:i,s=i-a,c=255>>8-a<<s;e=(o[r]&c)>>s,t-=a,n+=a,8===n&&(n=0,r++)}if(t>0){for(;t>=8;)e=e<<8|255&o[r],r++,t-=8;if(t>0){const i=8-t,a=255>>i<<i;e=e<<t|(o[r]&a)>>i,n+=t}}return this.bitOffset=n,this.byteOffset=r,e}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}!function(t){t[t.PAD_ENCODE=0]="PAD_ENCODE",t[t.ASCII_ENCODE=1]="ASCII_ENCODE",t[t.C40_ENCODE=2]="C40_ENCODE",t[t.TEXT_ENCODE=3]="TEXT_ENCODE",t[t.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",t[t.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",t[t.BASE256_ENCODE=6]="BASE256_ENCODE"}(U||(U={}));class pe{static decode(t){const e=new fe(t),n=new S,r=new S,o=new Array;let i=U.ASCII_ENCODE;do{if(i===U.ASCII_ENCODE)i=this.decodeAsciiSegment(e,n,r);else{switch(i){case U.C40_ENCODE:this.decodeC40Segment(e,n);break;case U.TEXT_ENCODE:this.decodeTextSegment(e,n);break;case U.ANSIX12_ENCODE:this.decodeAnsiX12Segment(e,n);break;case U.EDIFACT_ENCODE:this.decodeEdifactSegment(e,n);break;case U.BASE256_ENCODE:this.decodeBase256Segment(e,n,o);break;default:throw new v}i=U.ASCII_ENCODE}}while(i!==U.PAD_ENCODE&&e.available()>0);return r.length()>0&&n.append(r.toString()),new Q(t,n.toString(),0===o.length?null:o,null)}static decodeAsciiSegment(t,e,n){let r=!1;do{let o=t.readBits(8);if(0===o)throw new v;if(o<=128)return r&&(o+=128),e.append(String.fromCharCode(o-1)),U.ASCII_ENCODE;if(129===o)return U.PAD_ENCODE;if(o<=229){const t=o-130;t<10&&e.append("0"),e.append(""+t)}else switch(o){case 230:return U.C40_ENCODE;case 231:return U.BASE256_ENCODE;case 232:e.append(String.fromCharCode(29));break;case 233:case 234:case 241:break;case 235:r=!0;break;case 236:e.append("[)>05"),n.insert(0,"");break;case 237:e.append("[)>06"),n.insert(0,"");break;case 238:return U.ANSIX12_ENCODE;case 239:return U.TEXT_ENCODE;case 240:return U.EDIFACT_ENCODE;default:if(254!==o||0!==t.available())throw new v}}while(t.available()>0);return U.ASCII_ENCODE}static decodeC40Segment(t,e){let n=!1;const r=[];let o=0;do{if(8===t.available())return;const i=t.readBits(8);if(254===i)return;this.parseTwoBytes(i,t.readBits(8),r);for(let t=0;t<3;t++){const i=r[t];switch(o){case 0:if(i<3)o=i+1;else{if(!(i<this.C40_BASIC_SET_CHARS.length))throw new v;{const t=this.C40_BASIC_SET_CHARS[i];n?(e.append(String.fromCharCode(t.charCodeAt(0)+128)),n=!1):e.append(t)}}break;case 1:n?(e.append(String.fromCharCode(i+128)),n=!1):e.append(String.fromCharCode(i)),o=0;break;case 2:if(i<this.C40_SHIFT2_SET_CHARS.length){const t=this.C40_SHIFT2_SET_CHARS[i];n?(e.append(String.fromCharCode(t.charCodeAt(0)+128)),n=!1):e.append(t)}else switch(i){case 27:e.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new v}o=0;break;case 3:n?(e.append(String.fromCharCode(i+224)),n=!1):e.append(String.fromCharCode(i+96)),o=0;break;default:throw new v}}}while(t.available()>0)}static decodeTextSegment(t,e){let n=!1,r=[],o=0;do{if(8===t.available())return;const i=t.readBits(8);if(254===i)return;this.parseTwoBytes(i,t.readBits(8),r);for(let t=0;t<3;t++){const i=r[t];switch(o){case 0:if(i<3)o=i+1;else{if(!(i<this.TEXT_BASIC_SET_CHARS.length))throw new v;{const t=this.TEXT_BASIC_SET_CHARS[i];n?(e.append(String.fromCharCode(t.charCodeAt(0)+128)),n=!1):e.append(t)}}break;case 1:n?(e.append(String.fromCharCode(i+128)),n=!1):e.append(String.fromCharCode(i)),o=0;break;case 2:if(i<this.TEXT_SHIFT2_SET_CHARS.length){const t=this.TEXT_SHIFT2_SET_CHARS[i];n?(e.append(String.fromCharCode(t.charCodeAt(0)+128)),n=!1):e.append(t)}else switch(i){case 27:e.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new v}o=0;break;case 3:if(!(i<this.TEXT_SHIFT3_SET_CHARS.length))throw new v;{const t=this.TEXT_SHIFT3_SET_CHARS[i];n?(e.append(String.fromCharCode(t.charCodeAt(0)+128)),n=!1):e.append(t),o=0}break;default:throw new v}}}while(t.available()>0)}static decodeAnsiX12Segment(t,e){const n=[];do{if(8===t.available())return;const r=t.readBits(8);if(254===r)return;this.parseTwoBytes(r,t.readBits(8),n);for(let t=0;t<3;t++){const r=n[t];switch(r){case 0:e.append("\r");break;case 1:e.append("*");break;case 2:e.append(">");break;case 3:e.append(" ");break;default:if(r<14)e.append(String.fromCharCode(r+44));else{if(!(r<40))throw new v;e.append(String.fromCharCode(r+51))}}}}while(t.available()>0)}static parseTwoBytes(t,e,n){let r=(t<<8)+e-1,o=Math.floor(r/1600);n[0]=o,r-=1600*o,o=Math.floor(r/40),n[1]=o,n[2]=r-40*o}static decodeEdifactSegment(t,e){do{if(t.available()<=16)return;for(let n=0;n<4;n++){let n=t.readBits(6);if(31===n){const e=8-t.getBitOffset();return void(8!==e&&t.readBits(e))}32&n||(n|=64),e.append(String.fromCharCode(n))}}while(t.available()>0)}static decodeBase256Segment(t,e,n){let r=1+t.getByteOffset();const o=this.unrandomize255State(t.readBits(8),r++);let i;if(i=0===o?t.available()/8|0:o<250?o:250*(o-249)+this.unrandomize255State(t.readBits(8),r++),i<0)throw new v;const a=new Uint8Array(i);for(let e=0;e<i;e++){if(t.available()<8)throw new v;a[e]=this.unrandomize255State(t.readBits(8),r++)}n.push(a);try{e.append(E.decode(a,A.ISO88591))}catch(t){throw new et("Platform does not support required encoding: "+t.message)}}static unrandomize255State(t,e){const n=t-(149*e%255+1);return n>=0?n:n+256}}pe.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],pe.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],pe.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],pe.TEXT_SHIFT2_SET_CHARS=pe.C40_SHIFT2_SET_CHARS,pe.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];class _e{constructor(){this.rsDecoder=new nt(J.DATA_MATRIX_FIELD_256)}decode(t){const e=new he(t),n=e.getVersion(),r=e.readCodewords(),o=me.getDataBlocks(r,n);let i=0;for(let t of o)i+=t.getNumDataCodewords();const a=new Uint8Array(i),s=o.length;for(let t=0;t<s;t++){const e=o[t],n=e.getCodewords(),r=e.getNumDataCodewords();this.correctErrors(n,r);for(let e=0;e<r;e++)a[e*s+t]=n[e]}return pe.decode(a)}correctErrors(t,e){const n=new Int32Array(t);try{this.rsDecoder.decode(n,t.length-e)}catch(t){throw new h}for(let r=0;r<e;r++)t[r]=n[r]}}class ge{constructor(t){this.image=t,this.rectangleDetector=new lt(this.image)}detect(){const t=this.rectangleDetector.detect();let e=this.detectSolid1(t);if(e=this.detectSolid2(e),e[3]=this.correctTopRight(e),!e[3])throw new T;e=this.shiftToModuleCenter(e);const n=e[0],r=e[1],o=e[2],i=e[3];let a=this.transitionsBetween(n,i)+1,s=this.transitionsBetween(o,i)+1;1&~a||(a+=1),1&~s||(s+=1),4*a<7*s&&4*s<7*a&&(a=s=Math.max(a,s));let c=ge.sampleGrid(this.image,n,r,o,i,a,s);return new st(c,[n,r,o,i])}static shiftPoint(t,e,n){let r=(e.getX()-t.getX())/(n+1),o=(e.getY()-t.getY())/(n+1);return new at(t.getX()+r,t.getY()+o)}static moveAway(t,e,n){let r=t.getX(),o=t.getY();return r<e?r-=1:r+=1,o<n?o-=1:o+=1,new at(r,o)}detectSolid1(t){let e=t[0],n=t[1],r=t[3],o=t[2],i=this.transitionsBetween(e,n),a=this.transitionsBetween(n,r),s=this.transitionsBetween(r,o),c=this.transitionsBetween(o,e),l=i,d=[o,e,n,r];return l>a&&(l=a,d[0]=e,d[1]=n,d[2]=r,d[3]=o),l>s&&(l=s,d[0]=n,d[1]=r,d[2]=o,d[3]=e),l>c&&(d[0]=r,d[1]=o,d[2]=e,d[3]=n),d}detectSolid2(t){let e=t[0],n=t[1],r=t[2],o=t[3],i=this.transitionsBetween(e,o),a=ge.shiftPoint(n,r,4*(i+1)),s=ge.shiftPoint(r,n,4*(i+1));return this.transitionsBetween(a,e)<this.transitionsBetween(s,o)?(t[0]=e,t[1]=n,t[2]=r,t[3]=o):(t[0]=n,t[1]=r,t[2]=o,t[3]=e),t}correctTopRight(t){let e=t[0],n=t[1],r=t[2],o=t[3],i=this.transitionsBetween(e,o),a=this.transitionsBetween(n,o),s=ge.shiftPoint(e,n,4*(a+1)),c=ge.shiftPoint(r,n,4*(i+1));i=this.transitionsBetween(s,o),a=this.transitionsBetween(c,o);let l=new at(o.getX()+(r.getX()-n.getX())/(i+1),o.getY()+(r.getY()-n.getY())/(i+1)),d=new at(o.getX()+(e.getX()-n.getX())/(a+1),o.getY()+(e.getY()-n.getY())/(a+1));return this.isValid(l)?this.isValid(d)?this.transitionsBetween(s,l)+this.transitionsBetween(c,l)>this.transitionsBetween(s,d)+this.transitionsBetween(c,d)?l:d:l:this.isValid(d)?d:null}shiftToModuleCenter(t){let e=t[0],n=t[1],r=t[2],o=t[3],i=this.transitionsBetween(e,o)+1,a=this.transitionsBetween(r,o)+1,s=ge.shiftPoint(e,n,4*a),c=ge.shiftPoint(r,n,4*i);i=this.transitionsBetween(s,o)+1,a=this.transitionsBetween(c,o)+1,1&~i||(i+=1),1&~a||(a+=1);let l,d,u=(e.getX()+n.getX()+r.getX()+o.getX())/4,h=(e.getY()+n.getY()+r.getY()+o.getY())/4;return e=ge.moveAway(e,u,h),n=ge.moveAway(n,u,h),r=ge.moveAway(r,u,h),o=ge.moveAway(o,u,h),s=ge.shiftPoint(e,n,4*a),s=ge.shiftPoint(s,o,4*i),l=ge.shiftPoint(n,e,4*a),l=ge.shiftPoint(l,r,4*i),c=ge.shiftPoint(r,o,4*a),c=ge.shiftPoint(c,n,4*i),d=ge.shiftPoint(o,r,4*a),d=ge.shiftPoint(d,e,4*i),[s,l,c,d]}isValid(t){return t.getX()>=0&&t.getX()<this.image.getWidth()&&t.getY()>0&&t.getY()<this.image.getHeight()}static sampleGrid(t,e,n,r,o,i,a){return mt.getInstance().sampleGrid(t,i,a,.5,.5,i-.5,.5,i-.5,a-.5,.5,a-.5,e.getX(),e.getY(),o.getX(),o.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(t,e){let n=Math.trunc(t.getX()),r=Math.trunc(t.getY()),o=Math.trunc(e.getX()),i=Math.trunc(e.getY()),a=Math.abs(i-r)>Math.abs(o-n);if(a){let t=n;n=r,r=t,t=o,o=i,i=t}let s=Math.abs(o-n),c=Math.abs(i-r),l=-s/2,d=r<i?1:-1,u=n<o?1:-1,h=0,m=this.image.get(a?r:n,a?n:r);for(let t=n,e=r;t!==o;t+=u){let n=this.image.get(a?e:t,a?t:e);if(n!==m&&(h++,m=n),l+=c,l>0){if(e===i)break;e+=d,l-=s}}return h}}class we{constructor(){this.decoder=new _e}decode(t,e=null){let n,r;if(null!=e&&e.has(b.PURE_BARCODE)){const e=we.extractPureBits(t.getBlackMatrix());n=this.decoder.decode(e),r=we.NO_POINTS}else{const e=new ge(t.getBlackMatrix()).detect();n=this.decoder.decode(e.getBits()),r=e.getPoints()}const o=n.getRawBytes(),i=new L(n.getText(),o,8*o.length,r,V.DATA_MATRIX,f.currentTimeMillis()),a=n.getByteSegments();null!=a&&i.putMetadata(X.BYTE_SEGMENTS,a);const s=n.getECLevel();return null!=s&&i.putMetadata(X.ERROR_CORRECTION_LEVEL,s),i}reset(){}static extractPureBits(t){const e=t.getTopLeftOnBit(),n=t.getBottomRightOnBit();if(null==e||null==n)throw new T;const r=this.moduleSize(e,t);let o=e[1];const i=n[1];let a=e[0];const s=(n[0]-a+1)/r,c=(i-o+1)/r;if(s<=0||c<=0)throw new T;const l=r/2;o+=l,a+=l;const d=new k(s,c);for(let e=0;e<c;e++){const n=o+e*r;for(let o=0;o<s;o++)t.get(a+o*r,n)&&d.set(o,e)}return d}static moduleSize(t,e){const n=e.getWidth();let r=t[0];const o=t[1];for(;r<n&&e.get(r,o);)r++;if(r===n)throw new T;const i=r-t[0];if(0===i)throw new T;return i}}we.NO_POINTS=[];class $e extends F{constructor(t=500){super(new we,t)}}!function(t){t[t.L=0]="L",t[t.M=1]="M",t[t.Q=2]="Q",t[t.H=3]="H"}(z||(z={}));class ye{constructor(t,e,n){this.value=t,this.stringValue=e,this.bits=n,ye.FOR_BITS.set(n,this),ye.FOR_VALUE.set(t,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(t){switch(t){case"L":return ye.L;case"M":return ye.M;case"Q":return ye.Q;case"H":return ye.H;default:throw new l(t+"not available")}}toString(){return this.stringValue}equals(t){if(!(t instanceof ye))return!1;const e=t;return this.value===e.value}static forBits(t){if(t<0||t>=ye.FOR_BITS.size)throw new d;return ye.FOR_BITS.get(t)}}ye.FOR_BITS=new Map,ye.FOR_VALUE=new Map,ye.L=new ye(z.L,"L",1),ye.M=new ye(z.M,"M",0),ye.Q=new ye(z.Q,"Q",3),ye.H=new ye(z.H,"H",2);class be{constructor(t){this.errorCorrectionLevel=ye.forBits(t>>3&3),this.dataMask=7&t}static numBitsDiffering(t,e){return w.bitCount(t^e)}static decodeFormatInformation(t,e){const n=be.doDecodeFormatInformation(t,e);return null!==n?n:be.doDecodeFormatInformation(t^be.FORMAT_INFO_MASK_QR,e^be.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(t,e){let n=Number.MAX_SAFE_INTEGER,r=0;for(const o of be.FORMAT_INFO_DECODE_LOOKUP){const i=o[0];if(i===t||i===e)return new be(o[1]);let a=be.numBitsDiffering(t,i);a<n&&(r=o[1],n=a),t!==e&&(a=be.numBitsDiffering(e,i),a<n&&(r=o[1],n=a))}return n<=3?new be(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(t){if(!(t instanceof be))return!1;const e=t;return this.errorCorrectionLevel===e.errorCorrectionLevel&&this.dataMask===e.dataMask}}be.FORMAT_INFO_MASK_QR=21522,be.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class ve{constructor(t,...e){this.ecCodewordsPerBlock=t,this.ecBlocks=e}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let t=0;const e=this.ecBlocks;for(const n of e)t+=n.getCount();return t}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class Ie{constructor(t,e){this.count=t,this.dataCodewords=e}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ce{constructor(t,e,...n){this.versionNumber=t,this.alignmentPatternCenters=e,this.ecBlocks=n;let r=0;const o=n[0].getECCodewordsPerBlock(),i=n[0].getECBlocks();for(const t of i)r+=t.getCount()*(t.getDataCodewords()+o);this.totalCodewords=r}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(t){return this.ecBlocks[t.getValue()]}static getProvisionalVersionForDimension(t){if(t%4!=1)throw new v;try{return this.getVersionForNumber((t-17)/4)}catch(t){throw new v}}static getVersionForNumber(t){if(t<1||t>40)throw new d;return Ce.VERSIONS[t-1]}static decodeVersionInformation(t){let e=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<Ce.VERSION_DECODE_INFO.length;r++){const o=Ce.VERSION_DECODE_INFO[r];if(o===t)return Ce.getVersionForNumber(r+7);const i=be.numBitsDiffering(t,o);i<e&&(n=r+7,e=i)}return e<=3?Ce.getVersionForNumber(n):null}buildFunctionPattern(){const t=this.getDimensionForVersion(),e=new k(t);e.setRegion(0,0,9,9),e.setRegion(t-8,0,8,9),e.setRegion(0,t-8,9,8);const n=this.alignmentPatternCenters.length;for(let t=0;t<n;t++){const r=this.alignmentPatternCenters[t]-2;for(let o=0;o<n;o++)0===t&&(0===o||o===n-1)||t===n-1&&0===o||e.setRegion(this.alignmentPatternCenters[o]-2,r,5,5)}return e.setRegion(6,9,1,t-17),e.setRegion(9,6,t-17,1),this.versionNumber>6&&(e.setRegion(t-11,0,3,6),e.setRegion(0,t-11,6,3)),e}toString(){return""+this.versionNumber}}Ce.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Ce.VERSIONS=[new Ce(1,new Int32Array(0),new ve(7,new Ie(1,19)),new ve(10,new Ie(1,16)),new ve(13,new Ie(1,13)),new ve(17,new Ie(1,9))),new Ce(2,Int32Array.from([6,18]),new ve(10,new Ie(1,34)),new ve(16,new Ie(1,28)),new ve(22,new Ie(1,22)),new ve(28,new Ie(1,16))),new Ce(3,Int32Array.from([6,22]),new ve(15,new Ie(1,55)),new ve(26,new Ie(1,44)),new ve(18,new Ie(2,17)),new ve(22,new Ie(2,13))),new Ce(4,Int32Array.from([6,26]),new ve(20,new Ie(1,80)),new ve(18,new Ie(2,32)),new ve(26,new Ie(2,24)),new ve(16,new Ie(4,9))),new Ce(5,Int32Array.from([6,30]),new ve(26,new Ie(1,108)),new ve(24,new Ie(2,43)),new ve(18,new Ie(2,15),new Ie(2,16)),new ve(22,new Ie(2,11),new Ie(2,12))),new Ce(6,Int32Array.from([6,34]),new ve(18,new Ie(2,68)),new ve(16,new Ie(4,27)),new ve(24,new Ie(4,19)),new ve(28,new Ie(4,15))),new Ce(7,Int32Array.from([6,22,38]),new ve(20,new Ie(2,78)),new ve(18,new Ie(4,31)),new ve(18,new Ie(2,14),new Ie(4,15)),new ve(26,new Ie(4,13),new Ie(1,14))),new Ce(8,Int32Array.from([6,24,42]),new ve(24,new Ie(2,97)),new ve(22,new Ie(2,38),new Ie(2,39)),new ve(22,new Ie(4,18),new Ie(2,19)),new ve(26,new Ie(4,14),new Ie(2,15))),new Ce(9,Int32Array.from([6,26,46]),new ve(30,new Ie(2,116)),new ve(22,new Ie(3,36),new Ie(2,37)),new ve(20,new Ie(4,16),new Ie(4,17)),new ve(24,new Ie(4,12),new Ie(4,13))),new Ce(10,Int32Array.from([6,28,50]),new ve(18,new Ie(2,68),new Ie(2,69)),new ve(26,new Ie(4,43),new Ie(1,44)),new ve(24,new Ie(6,19),new Ie(2,20)),new ve(28,new Ie(6,15),new Ie(2,16))),new Ce(11,Int32Array.from([6,30,54]),new ve(20,new Ie(4,81)),new ve(30,new Ie(1,50),new Ie(4,51)),new ve(28,new Ie(4,22),new Ie(4,23)),new ve(24,new Ie(3,12),new Ie(8,13))),new Ce(12,Int32Array.from([6,32,58]),new ve(24,new Ie(2,92),new Ie(2,93)),new ve(22,new Ie(6,36),new Ie(2,37)),new ve(26,new Ie(4,20),new Ie(6,21)),new ve(28,new Ie(7,14),new Ie(4,15))),new Ce(13,Int32Array.from([6,34,62]),new ve(26,new Ie(4,107)),new ve(22,new Ie(8,37),new Ie(1,38)),new ve(24,new Ie(8,20),new Ie(4,21)),new ve(22,new Ie(12,11),new Ie(4,12))),new Ce(14,Int32Array.from([6,26,46,66]),new ve(30,new Ie(3,115),new Ie(1,116)),new ve(24,new Ie(4,40),new Ie(5,41)),new ve(20,new Ie(11,16),new Ie(5,17)),new ve(24,new Ie(11,12),new Ie(5,13))),new Ce(15,Int32Array.from([6,26,48,70]),new ve(22,new Ie(5,87),new Ie(1,88)),new ve(24,new Ie(5,41),new Ie(5,42)),new ve(30,new Ie(5,24),new Ie(7,25)),new ve(24,new Ie(11,12),new Ie(7,13))),new Ce(16,Int32Array.from([6,26,50,74]),new ve(24,new Ie(5,98),new Ie(1,99)),new ve(28,new Ie(7,45),new Ie(3,46)),new ve(24,new Ie(15,19),new Ie(2,20)),new ve(30,new Ie(3,15),new Ie(13,16))),new Ce(17,Int32Array.from([6,30,54,78]),new ve(28,new Ie(1,107),new Ie(5,108)),new ve(28,new Ie(10,46),new Ie(1,47)),new ve(28,new Ie(1,22),new Ie(15,23)),new ve(28,new Ie(2,14),new Ie(17,15))),new Ce(18,Int32Array.from([6,30,56,82]),new ve(30,new Ie(5,120),new Ie(1,121)),new ve(26,new Ie(9,43),new Ie(4,44)),new ve(28,new Ie(17,22),new Ie(1,23)),new ve(28,new Ie(2,14),new Ie(19,15))),new Ce(19,Int32Array.from([6,30,58,86]),new ve(28,new Ie(3,113),new Ie(4,114)),new ve(26,new Ie(3,44),new Ie(11,45)),new ve(26,new Ie(17,21),new Ie(4,22)),new ve(26,new Ie(9,13),new Ie(16,14))),new Ce(20,Int32Array.from([6,34,62,90]),new ve(28,new Ie(3,107),new Ie(5,108)),new ve(26,new Ie(3,41),new Ie(13,42)),new ve(30,new Ie(15,24),new Ie(5,25)),new ve(28,new Ie(15,15),new Ie(10,16))),new Ce(21,Int32Array.from([6,28,50,72,94]),new ve(28,new Ie(4,116),new Ie(4,117)),new ve(26,new Ie(17,42)),new ve(28,new Ie(17,22),new Ie(6,23)),new ve(30,new Ie(19,16),new Ie(6,17))),new Ce(22,Int32Array.from([6,26,50,74,98]),new ve(28,new Ie(2,111),new Ie(7,112)),new ve(28,new Ie(17,46)),new ve(30,new Ie(7,24),new Ie(16,25)),new ve(24,new Ie(34,13))),new Ce(23,Int32Array.from([6,30,54,78,102]),new ve(30,new Ie(4,121),new Ie(5,122)),new ve(28,new Ie(4,47),new Ie(14,48)),new ve(30,new Ie(11,24),new Ie(14,25)),new ve(30,new Ie(16,15),new Ie(14,16))),new Ce(24,Int32Array.from([6,28,54,80,106]),new ve(30,new Ie(6,117),new Ie(4,118)),new ve(28,new Ie(6,45),new Ie(14,46)),new ve(30,new Ie(11,24),new Ie(16,25)),new ve(30,new Ie(30,16),new Ie(2,17))),new Ce(25,Int32Array.from([6,32,58,84,110]),new ve(26,new Ie(8,106),new Ie(4,107)),new ve(28,new Ie(8,47),new Ie(13,48)),new ve(30,new Ie(7,24),new Ie(22,25)),new ve(30,new Ie(22,15),new Ie(13,16))),new Ce(26,Int32Array.from([6,30,58,86,114]),new ve(28,new Ie(10,114),new Ie(2,115)),new ve(28,new Ie(19,46),new Ie(4,47)),new ve(28,new Ie(28,22),new Ie(6,23)),new ve(30,new Ie(33,16),new Ie(4,17))),new Ce(27,Int32Array.from([6,34,62,90,118]),new ve(30,new Ie(8,122),new Ie(4,123)),new ve(28,new Ie(22,45),new Ie(3,46)),new ve(30,new Ie(8,23),new Ie(26,24)),new ve(30,new Ie(12,15),new Ie(28,16))),new Ce(28,Int32Array.from([6,26,50,74,98,122]),new ve(30,new Ie(3,117),new Ie(10,118)),new ve(28,new Ie(3,45),new Ie(23,46)),new ve(30,new Ie(4,24),new Ie(31,25)),new ve(30,new Ie(11,15),new Ie(31,16))),new Ce(29,Int32Array.from([6,30,54,78,102,126]),new ve(30,new Ie(7,116),new Ie(7,117)),new ve(28,new Ie(21,45),new Ie(7,46)),new ve(30,new Ie(1,23),new Ie(37,24)),new ve(30,new Ie(19,15),new Ie(26,16))),new Ce(30,Int32Array.from([6,26,52,78,104,130]),new ve(30,new Ie(5,115),new Ie(10,116)),new ve(28,new Ie(19,47),new Ie(10,48)),new ve(30,new Ie(15,24),new Ie(25,25)),new ve(30,new Ie(23,15),new Ie(25,16))),new Ce(31,Int32Array.from([6,30,56,82,108,134]),new ve(30,new Ie(13,115),new Ie(3,116)),new ve(28,new Ie(2,46),new Ie(29,47)),new ve(30,new Ie(42,24),new Ie(1,25)),new ve(30,new Ie(23,15),new Ie(28,16))),new Ce(32,Int32Array.from([6,34,60,86,112,138]),new ve(30,new Ie(17,115)),new ve(28,new Ie(10,46),new Ie(23,47)),new ve(30,new Ie(10,24),new Ie(35,25)),new ve(30,new Ie(19,15),new Ie(35,16))),new Ce(33,Int32Array.from([6,30,58,86,114,142]),new ve(30,new Ie(17,115),new Ie(1,116)),new ve(28,new Ie(14,46),new Ie(21,47)),new ve(30,new Ie(29,24),new Ie(19,25)),new ve(30,new Ie(11,15),new Ie(46,16))),new Ce(34,Int32Array.from([6,34,62,90,118,146]),new ve(30,new Ie(13,115),new Ie(6,116)),new ve(28,new Ie(14,46),new Ie(23,47)),new ve(30,new Ie(44,24),new Ie(7,25)),new ve(30,new Ie(59,16),new Ie(1,17))),new Ce(35,Int32Array.from([6,30,54,78,102,126,150]),new ve(30,new Ie(12,121),new Ie(7,122)),new ve(28,new Ie(12,47),new Ie(26,48)),new ve(30,new Ie(39,24),new Ie(14,25)),new ve(30,new Ie(22,15),new Ie(41,16))),new Ce(36,Int32Array.from([6,24,50,76,102,128,154]),new ve(30,new Ie(6,121),new Ie(14,122)),new ve(28,new Ie(6,47),new Ie(34,48)),new ve(30,new Ie(46,24),new Ie(10,25)),new ve(30,new Ie(2,15),new Ie(64,16))),new Ce(37,Int32Array.from([6,28,54,80,106,132,158]),new ve(30,new Ie(17,122),new Ie(4,123)),new ve(28,new Ie(29,46),new Ie(14,47)),new ve(30,new Ie(49,24),new Ie(10,25)),new ve(30,new Ie(24,15),new Ie(46,16))),new Ce(38,Int32Array.from([6,32,58,84,110,136,162]),new ve(30,new Ie(4,122),new Ie(18,123)),new ve(28,new Ie(13,46),new Ie(32,47)),new ve(30,new Ie(48,24),new Ie(14,25)),new ve(30,new Ie(42,15),new Ie(32,16))),new Ce(39,Int32Array.from([6,26,54,82,110,138,166]),new ve(30,new Ie(20,117),new Ie(4,118)),new ve(28,new Ie(40,47),new Ie(7,48)),new ve(30,new Ie(43,24),new Ie(22,25)),new ve(30,new Ie(10,15),new Ie(67,16))),new Ce(40,Int32Array.from([6,30,58,86,114,142,170]),new ve(30,new Ie(19,118),new Ie(6,119)),new ve(28,new Ie(18,47),new Ie(31,48)),new ve(30,new Ie(34,24),new Ie(34,25)),new ve(30,new Ie(20,15),new Ie(61,16)))],function(t){t[t.DATA_MASK_000=0]="DATA_MASK_000",t[t.DATA_MASK_001=1]="DATA_MASK_001",t[t.DATA_MASK_010=2]="DATA_MASK_010",t[t.DATA_MASK_011=3]="DATA_MASK_011",t[t.DATA_MASK_100=4]="DATA_MASK_100",t[t.DATA_MASK_101=5]="DATA_MASK_101",t[t.DATA_MASK_110=6]="DATA_MASK_110",t[t.DATA_MASK_111=7]="DATA_MASK_111"}(W||(W={}));class Ee{constructor(t,e){this.value=t,this.isMasked=e}unmaskBitMatrix(t,e){for(let n=0;n<e;n++)for(let r=0;r<e;r++)this.isMasked(n,r)&&t.flip(r,n)}}Ee.values=new Map([[W.DATA_MASK_000,new Ee(W.DATA_MASK_000,(t,e)=>!(t+e&1))],[W.DATA_MASK_001,new Ee(W.DATA_MASK_001,(t,e)=>!(1&t))],[W.DATA_MASK_010,new Ee(W.DATA_MASK_010,(t,e)=>e%3==0)],[W.DATA_MASK_011,new Ee(W.DATA_MASK_011,(t,e)=>(t+e)%3==0)],[W.DATA_MASK_100,new Ee(W.DATA_MASK_100,(t,e)=>!(Math.floor(t/2)+Math.floor(e/3)&1))],[W.DATA_MASK_101,new Ee(W.DATA_MASK_101,(t,e)=>t*e%6==0)],[W.DATA_MASK_110,new Ee(W.DATA_MASK_110,(t,e)=>t*e%6<3)],[W.DATA_MASK_111,new Ee(W.DATA_MASK_111,(t,e)=>!(t+e+t*e%3&1))]]);class Ae{constructor(t){const e=t.getHeight();if(e<21||1!=(3&e))throw new v;this.bitMatrix=t}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let t=0;for(let e=0;e<6;e++)t=this.copyBit(e,8,t);t=this.copyBit(7,8,t),t=this.copyBit(8,8,t),t=this.copyBit(8,7,t);for(let e=5;e>=0;e--)t=this.copyBit(8,e,t);const e=this.bitMatrix.getHeight();let n=0;const r=e-7;for(let t=e-1;t>=r;t--)n=this.copyBit(8,t,n);for(let t=e-8;t<e;t++)n=this.copyBit(t,8,n);if(this.parsedFormatInfo=be.decodeFormatInformation(t,n),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new v}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;const t=this.bitMatrix.getHeight(),e=Math.floor((t-17)/4);if(e<=6)return Ce.getVersionForNumber(e);let n=0;const r=t-11;for(let e=5;e>=0;e--)for(let o=t-9;o>=r;o--)n=this.copyBit(o,e,n);let o=Ce.decodeVersionInformation(n);if(null!==o&&o.getDimensionForVersion()===t)return this.parsedVersion=o,o;n=0;for(let e=5;e>=0;e--)for(let o=t-9;o>=r;o--)n=this.copyBit(e,o,n);if(o=Ce.decodeVersionInformation(n),null!==o&&o.getDimensionForVersion()===t)return this.parsedVersion=o,o;throw new v}copyBit(t,e,n){return(this.isMirror?this.bitMatrix.get(e,t):this.bitMatrix.get(t,e))?n<<1|1:n<<1}readCodewords(){const t=this.readFormatInformation(),e=this.readVersion(),n=Ee.values.get(t.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const o=e.buildFunctionPattern();let i=!0;const a=new Uint8Array(e.getTotalCodewords());let s=0,c=0,l=0;for(let t=r-1;t>0;t-=2){6===t&&t--;for(let e=0;e<r;e++){const n=i?r-1-e:e;for(let e=0;e<2;e++)o.get(t-e,n)||(l++,c<<=1,this.bitMatrix.get(t-e,n)&&(c|=1),8===l&&(a[s++]=c,l=0,c=0))}i=!i}if(s!==e.getTotalCodewords())throw new v;return a}remask(){if(null===this.parsedFormatInfo)return;const t=Ee.values[this.parsedFormatInfo.getDataMask()],e=this.bitMatrix.getHeight();t.unmaskBitMatrix(this.bitMatrix,e)}setMirror(t){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=t}mirror(){const t=this.bitMatrix;for(let e=0,n=t.getWidth();e<n;e++)for(let n=e+1,r=t.getHeight();n<r;n++)t.get(e,n)!==t.get(n,e)&&(t.flip(n,e),t.flip(e,n))}}class Se{constructor(t,e){this.numDataCodewords=t,this.codewords=e}static getDataBlocks(t,e,n){if(t.length!==e.getTotalCodewords())throw new d;const r=e.getECBlocksForLevel(n);let o=0;const i=r.getECBlocks();for(const t of i)o+=t.getCount();const a=new Array(o);let s=0;for(const t of i)for(let e=0;e<t.getCount();e++){const e=t.getDataCodewords(),n=r.getECCodewordsPerBlock()+e;a[s++]=new Se(e,new Uint8Array(n))}const c=a[0].codewords.length;let l=a.length-1;for(;l>=0&&a[l].codewords.length!==c;)l--;l++;const u=c-r.getECCodewordsPerBlock();let h=0;for(let e=0;e<u;e++)for(let n=0;n<s;n++)a[n].codewords[e]=t[h++];for(let e=l;e<s;e++)a[e].codewords[u]=t[h++];const m=a[0].codewords.length;for(let e=u;e<m;e++)for(let n=0;n<s;n++){const r=n<l?e:e+1;a[n].codewords[r]=t[h++]}return a}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}!function(t){t[t.TERMINATOR=0]="TERMINATOR",t[t.NUMERIC=1]="NUMERIC",t[t.ALPHANUMERIC=2]="ALPHANUMERIC",t[t.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",t[t.BYTE=4]="BYTE",t[t.ECI=5]="ECI",t[t.KANJI=6]="KANJI",t[t.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",t[t.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",t[t.HANZI=9]="HANZI"}(j||(j={}));class ke{constructor(t,e,n,r){this.value=t,this.stringValue=e,this.characterCountBitsForVersions=n,this.bits=r,ke.FOR_BITS.set(r,this),ke.FOR_VALUE.set(t,this)}static forBits(t){const e=ke.FOR_BITS.get(t);if(void 0===e)throw new d;return e}getCharacterCountBits(t){const e=t.getVersionNumber();let n;return n=e<=9?0:e<=26?1:2,this.characterCountBitsForVersions[n]}getValue(){return this.value}getBits(){return this.bits}equals(t){if(!(t instanceof ke))return!1;const e=t;return this.value===e.value}toString(){return this.stringValue}}ke.FOR_BITS=new Map,ke.FOR_VALUE=new Map,ke.TERMINATOR=new ke(j.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),ke.NUMERIC=new ke(j.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),ke.ALPHANUMERIC=new ke(j.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),ke.STRUCTURED_APPEND=new ke(j.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),ke.BYTE=new ke(j.BYTE,"BYTE",Int32Array.from([8,16,16]),4),ke.ECI=new ke(j.ECI,"ECI",Int32Array.from([0,0,0]),7),ke.KANJI=new ke(j.KANJI,"KANJI",Int32Array.from([8,10,12]),8),ke.FNC1_FIRST_POSITION=new ke(j.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),ke.FNC1_SECOND_POSITION=new ke(j.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),ke.HANZI=new ke(j.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Te{static decode(t,e,n,r){const o=new fe(t);let i=new S;const a=new Array;let s=-1,c=-1;try{let t,n=null,l=!1;do{if(o.available()<4)t=ke.TERMINATOR;else{const e=o.readBits(4);t=ke.forBits(e)}switch(t){case ke.TERMINATOR:break;case ke.FNC1_FIRST_POSITION:case ke.FNC1_SECOND_POSITION:l=!0;break;case ke.STRUCTURED_APPEND:if(o.available()<16)throw new v;s=o.readBits(8),c=o.readBits(8);break;case ke.ECI:const d=Te.parseECIValue(o);if(n=I.getCharacterSetECIByValue(d),null===n)throw new v;break;case ke.HANZI:const u=o.readBits(4),h=o.readBits(t.getCharacterCountBits(e));u===Te.GB2312_SUBSET&&Te.decodeHanziSegment(o,i,h);break;default:const m=o.readBits(t.getCharacterCountBits(e));switch(t){case ke.NUMERIC:Te.decodeNumericSegment(o,i,m);break;case ke.ALPHANUMERIC:Te.decodeAlphanumericSegment(o,i,m,l);break;case ke.BYTE:Te.decodeByteSegment(o,i,m,n,a,r);break;case ke.KANJI:Te.decodeKanjiSegment(o,i,m);break;default:throw new v}}}while(t!==ke.TERMINATOR)}catch(t){throw new v}return new Q(t,i.toString(),0===a.length?null:a,null===n?null:n.toString(),s,c)}static decodeHanziSegment(t,e,n){if(13*n>t.available())throw new v;const r=new Uint8Array(2*n);let o=0;for(;n>0;){const e=t.readBits(13);let i=e/96<<8&4294967295|e%96;i+=i<959?41377:42657,r[o]=i>>8&255,r[o+1]=255&i,o+=2,n--}try{e.append(E.decode(r,A.GB2312))}catch(t){throw new v(t)}}static decodeKanjiSegment(t,e,n){if(13*n>t.available())throw new v;const r=new Uint8Array(2*n);let o=0;for(;n>0;){const e=t.readBits(13);let i=e/192<<8&4294967295|e%192;i+=i<7936?33088:49472,r[o]=i>>8,r[o+1]=i,o+=2,n--}try{e.append(E.decode(r,A.SHIFT_JIS))}catch(t){throw new v(t)}}static decodeByteSegment(t,e,n,r,o,i){if(8*n>t.available())throw new v;const a=new Uint8Array(n);for(let e=0;e<n;e++)a[e]=t.readBits(8);let s;s=null===r?A.guessEncoding(a,i):r.getName();try{e.append(E.decode(a,s))}catch(t){throw new v(t)}o.push(a)}static toAlphaNumericChar(t){if(t>=Te.ALPHANUMERIC_CHARS.length)throw new v;return Te.ALPHANUMERIC_CHARS[t]}static decodeAlphanumericSegment(t,e,n,r){const o=e.length();for(;n>1;){if(t.available()<11)throw new v;const r=t.readBits(11);e.append(Te.toAlphaNumericChar(Math.floor(r/45))),e.append(Te.toAlphaNumericChar(r%45)),n-=2}if(1===n){if(t.available()<6)throw new v;e.append(Te.toAlphaNumericChar(t.readBits(6)))}if(r)for(let t=o;t<e.length();t++)"%"===e.charAt(t)&&(t<e.length()-1&&"%"===e.charAt(t+1)?e.deleteCharAt(t+1):e.setCharAt(t,String.fromCharCode(29)))}static decodeNumericSegment(t,e,n){for(;n>=3;){if(t.available()<10)throw new v;const r=t.readBits(10);if(r>=1e3)throw new v;e.append(Te.toAlphaNumericChar(Math.floor(r/100))),e.append(Te.toAlphaNumericChar(Math.floor(r/10)%10)),e.append(Te.toAlphaNumericChar(r%10)),n-=3}if(2===n){if(t.available()<7)throw new v;const n=t.readBits(7);if(n>=100)throw new v;e.append(Te.toAlphaNumericChar(Math.floor(n/10))),e.append(Te.toAlphaNumericChar(n%10))}else if(1===n){if(t.available()<4)throw new v;const n=t.readBits(4);if(n>=10)throw new v;e.append(Te.toAlphaNumericChar(n))}}static parseECIValue(t){const e=t.readBits(8);if(!(128&e))return 127&e;if(128==(192&e))return(63&e)<<8&4294967295|t.readBits(8);if(192==(224&e))return(31&e)<<16&4294967295|t.readBits(16);throw new v}}Te.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Te.GB2312_SUBSET=1;class Re{constructor(t){this.mirrored=t}isMirrored(){return this.mirrored}applyMirroredCorrection(t){if(!this.mirrored||null===t||t.length<3)return;const e=t[0];t[0]=t[2],t[2]=e}}class Ne{constructor(){this.rsDecoder=new nt(J.QR_CODE_FIELD_256)}decodeBooleanArray(t,e){return this.decodeBitMatrix(k.parseFromBooleanArray(t),e)}decodeBitMatrix(t,e){const n=new Ae(t);let r=null;try{return this.decodeBitMatrixParser(n,e)}catch(t){r=t}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const t=this.decodeBitMatrixParser(n,e);return t.setOther(new Re(!0)),t}catch(t){if(null!==r)throw r;throw t}}decodeBitMatrixParser(t,e){const n=t.readVersion(),r=t.readFormatInformation().getErrorCorrectionLevel(),o=t.readCodewords(),i=Se.getDataBlocks(o,n,r);let a=0;for(const t of i)a+=t.getNumDataCodewords();const s=new Uint8Array(a);let c=0;for(const t of i){const e=t.getCodewords(),n=t.getNumDataCodewords();this.correctErrors(e,n);for(let t=0;t<n;t++)s[c++]=e[t]}return Te.decode(s,n,r,e)}correctErrors(t,e){const n=new Int32Array(t);try{this.rsDecoder.decode(n,t.length-e)}catch(t){throw new h}for(let r=0;r<e;r++)t[r]=n[r]}}class De extends at{constructor(t,e,n){super(t,e),this.estimatedModuleSize=n}aboutEquals(t,e,n){if(Math.abs(e-this.getY())<=t&&Math.abs(n-this.getX())<=t){const e=Math.abs(t-this.estimatedModuleSize);return e<=1||e<=this.estimatedModuleSize}return!1}combineEstimate(t,e,n){const r=(this.getX()+e)/2,o=(this.getY()+t)/2,i=(this.estimatedModuleSize+n)/2;return new De(r,o,i)}}class xe{constructor(t,e,n,r,o,i,a){this.image=t,this.startX=e,this.startY=n,this.width=r,this.height=o,this.moduleSize=i,this.resultPointCallback=a,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const t=this.startX,e=this.height,n=t+this.width,r=this.startY+e/2,o=new Int32Array(3),i=this.image;for(let a=0;a<e;a++){const e=r+(1&a?-Math.floor((a+1)/2):Math.floor((a+1)/2));o[0]=0,o[1]=0,o[2]=0;let s=t;for(;s<n&&!i.get(s,e);)s++;let c=0;for(;s<n;){if(i.get(s,e))if(1===c)o[1]++;else if(2===c){if(this.foundPatternCross(o)){const t=this.handlePossibleCenter(o,e,s);if(null!==t)return t}o[0]=o[2],o[1]=1,o[2]=0,c=1}else o[++c]++;else 1===c&&c++,o[c]++;s++}if(this.foundPatternCross(o)){const t=this.handlePossibleCenter(o,e,n);if(null!==t)return t}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new T}static centerFromEnd(t,e){return e-t[2]-t[1]/2}foundPatternCross(t){const e=this.moduleSize,n=e/2;for(let r=0;r<3;r++)if(Math.abs(e-t[r])>=n)return!1;return!0}crossCheckVertical(t,e,n,r){const o=this.image,i=o.getHeight(),a=this.crossCheckStateCount;a[0]=0,a[1]=0,a[2]=0;let s=t;for(;s>=0&&o.get(e,s)&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&!o.get(e,s)&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s<i&&o.get(e,s)&&a[1]<=n;)a[1]++,s++;if(s===i||a[1]>n)return NaN;for(;s<i&&!o.get(e,s)&&a[2]<=n;)a[2]++,s++;if(a[2]>n)return NaN;const c=a[0]+a[1]+a[2];return 5*Math.abs(c-r)>=2*r?NaN:this.foundPatternCross(a)?xe.centerFromEnd(a,s):NaN}handlePossibleCenter(t,e,n){const r=t[0]+t[1]+t[2],o=xe.centerFromEnd(t,n),i=this.crossCheckVertical(e,o,2*t[1],r);if(!isNaN(i)){const e=(t[0]+t[1]+t[2])/3;for(const t of this.possibleCenters)if(t.aboutEquals(e,i,o))return t.combineEstimate(i,o,e);const n=new De(o,i,e);this.possibleCenters.push(n),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(n)}return null}}class Oe extends at{constructor(t,e,n,r){super(t,e),this.estimatedModuleSize=n,this.count=r,void 0===r&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(t,e,n){if(Math.abs(e-this.getY())<=t&&Math.abs(n-this.getX())<=t){const e=Math.abs(t-this.estimatedModuleSize);return e<=1||e<=this.estimatedModuleSize}return!1}combineEstimate(t,e,n){const r=this.count+1,o=(this.count*this.getX()+e)/r,i=(this.count*this.getY()+t)/r,a=(this.count*this.estimatedModuleSize+n)/r;return new Oe(o,i,a,r)}}class Me{constructor(t){this.bottomLeft=t[0],this.topLeft=t[1],this.topRight=t[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Pe{constructor(t,e){this.image=t,this.resultPointCallback=e,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=e}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(t){const e=null!=t&&void 0!==t.get(b.TRY_HARDER),n=null!=t&&void 0!==t.get(b.PURE_BARCODE),r=this.image,o=r.getHeight(),i=r.getWidth();let a=Math.floor(3*o/(4*Pe.MAX_MODULES));(a<Pe.MIN_SKIP||e)&&(a=Pe.MIN_SKIP);let s=!1;const c=new Int32Array(5);for(let t=a-1;t<o&&!s;t+=a){c[0]=0,c[1]=0,c[2]=0,c[3]=0,c[4]=0;let e=0;for(let o=0;o<i;o++)if(r.get(o,t))1&~e||e++,c[e]++;else if(1&e)c[e]++;else if(4===e)if(Pe.foundPatternCross(c)){if(!0!==this.handlePossibleCenter(c,t,o,n)){c[0]=c[2],c[1]=c[3],c[2]=c[4],c[3]=1,c[4]=0,e=3;continue}if(a=2,!0===this.hasSkipped)s=this.haveMultiplyConfirmedCenters();else{const e=this.findRowSkip();e>c[2]&&(t+=e-c[2]-a,o=i-1)}e=0,c[0]=0,c[1]=0,c[2]=0,c[3]=0,c[4]=0}else c[0]=c[2],c[1]=c[3],c[2]=c[4],c[3]=1,c[4]=0,e=3;else c[++e]++;Pe.foundPatternCross(c)&&!0===this.handlePossibleCenter(c,t,i,n)&&(a=c[0],this.hasSkipped&&(s=this.haveMultiplyConfirmedCenters()))}const l=this.selectBestPatterns();return at.orderBestPatterns(l),new Me(l)}static centerFromEnd(t,e){return e-t[4]-t[3]-t[2]/2}static foundPatternCross(t){let e=0;for(let n=0;n<5;n++){const r=t[n];if(0===r)return!1;e+=r}if(e<7)return!1;const n=e/7,r=n/2;return Math.abs(n-t[0])<r&&Math.abs(n-t[1])<r&&Math.abs(3*n-t[2])<3*r&&Math.abs(n-t[3])<r&&Math.abs(n-t[4])<r}getCrossCheckStateCount(){const t=this.crossCheckStateCount;return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t}crossCheckDiagonal(t,e,n,r){const o=this.getCrossCheckStateCount();let i=0;const a=this.image;for(;t>=i&&e>=i&&a.get(e-i,t-i);)o[2]++,i++;if(t<i||e<i)return!1;for(;t>=i&&e>=i&&!a.get(e-i,t-i)&&o[1]<=n;)o[1]++,i++;if(t<i||e<i||o[1]>n)return!1;for(;t>=i&&e>=i&&a.get(e-i,t-i)&&o[0]<=n;)o[0]++,i++;if(o[0]>n)return!1;const s=a.getHeight(),c=a.getWidth();for(i=1;t+i<s&&e+i<c&&a.get(e+i,t+i);)o[2]++,i++;if(t+i>=s||e+i>=c)return!1;for(;t+i<s&&e+i<c&&!a.get(e+i,t+i)&&o[3]<n;)o[3]++,i++;if(t+i>=s||e+i>=c||o[3]>=n)return!1;for(;t+i<s&&e+i<c&&a.get(e+i,t+i)&&o[4]<n;)o[4]++,i++;if(o[4]>=n)return!1;const l=o[0]+o[1]+o[2]+o[3]+o[4];return Math.abs(l-r)<2*r&&Pe.foundPatternCross(o)}crossCheckVertical(t,e,n,r){const o=this.image,i=o.getHeight(),a=this.getCrossCheckStateCount();let s=t;for(;s>=0&&o.get(e,s);)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!o.get(e,s)&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&o.get(e,s)&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s<i&&o.get(e,s);)a[2]++,s++;if(s===i)return NaN;for(;s<i&&!o.get(e,s)&&a[3]<n;)a[3]++,s++;if(s===i||a[3]>=n)return NaN;for(;s<i&&o.get(e,s)&&a[4]<n;)a[4]++,s++;if(a[4]>=n)return NaN;const c=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(c-r)>=2*r?NaN:Pe.foundPatternCross(a)?Pe.centerFromEnd(a,s):NaN}crossCheckHorizontal(t,e,n,r){const o=this.image,i=o.getWidth(),a=this.getCrossCheckStateCount();let s=t;for(;s>=0&&o.get(s,e);)a[2]++,s--;if(s<0)return NaN;for(;s>=0&&!o.get(s,e)&&a[1]<=n;)a[1]++,s--;if(s<0||a[1]>n)return NaN;for(;s>=0&&o.get(s,e)&&a[0]<=n;)a[0]++,s--;if(a[0]>n)return NaN;for(s=t+1;s<i&&o.get(s,e);)a[2]++,s++;if(s===i)return NaN;for(;s<i&&!o.get(s,e)&&a[3]<n;)a[3]++,s++;if(s===i||a[3]>=n)return NaN;for(;s<i&&o.get(s,e)&&a[4]<n;)a[4]++,s++;if(a[4]>=n)return NaN;const c=a[0]+a[1]+a[2]+a[3]+a[4];return 5*Math.abs(c-r)>=r?NaN:Pe.foundPatternCross(a)?Pe.centerFromEnd(a,s):NaN}handlePossibleCenter(t,e,n,r){const o=t[0]+t[1]+t[2]+t[3]+t[4];let i=Pe.centerFromEnd(t,n),a=this.crossCheckVertical(e,Math.floor(i),t[2],o);if(!isNaN(a)&&(i=this.crossCheckHorizontal(Math.floor(i),Math.floor(a),t[2],o),!isNaN(i)&&(!r||this.crossCheckDiagonal(Math.floor(a),Math.floor(i),t[2],o)))){const t=o/7;let e=!1;const n=this.possibleCenters;for(let r=0,o=n.length;r<o;r++){const o=n[r];if(o.aboutEquals(t,a,i)){n[r]=o.combineEstimate(a,i,t),e=!0;break}}if(!e){const e=new Oe(i,a,t);n.push(e),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(e)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let t=null;for(const e of this.possibleCenters)if(e.getCount()>=Pe.CENTER_QUORUM){if(null!=t)return this.hasSkipped=!0,Math.floor((Math.abs(t.getX()-e.getX())-Math.abs(t.getY()-e.getY()))/2);t=e}return 0}haveMultiplyConfirmedCenters(){let t=0,e=0;const n=this.possibleCenters.length;for(const n of this.possibleCenters)n.getCount()>=Pe.CENTER_QUORUM&&(t++,e+=n.getEstimatedModuleSize());if(t<3)return!1;const r=e/n;let o=0;for(const t of this.possibleCenters)o+=Math.abs(t.getEstimatedModuleSize()-r);return o<=.05*e}selectBestPatterns(){const t=this.possibleCenters.length;if(t<3)throw new T;const e=this.possibleCenters;let n;if(t>3){let r=0,o=0;for(const t of this.possibleCenters){const e=t.getEstimatedModuleSize();r+=e,o+=e*e}n=r/t;let i=Math.sqrt(o/t-n*n);e.sort((t,e)=>{const r=Math.abs(e.getEstimatedModuleSize()-n),o=Math.abs(t.getEstimatedModuleSize()-n);return r<o?-1:r>o?1:0});const a=Math.max(.2*n,i);for(let t=0;t<e.length&&e.length>3;t++){const r=e[t];Math.abs(r.getEstimatedModuleSize()-n)>a&&(e.splice(t,1),t--)}}if(e.length>3){let t=0;for(const n of e)t+=n.getEstimatedModuleSize();n=t/e.length,e.sort((t,e)=>{if(e.getCount()===t.getCount()){const r=Math.abs(e.getEstimatedModuleSize()-n),o=Math.abs(t.getEstimatedModuleSize()-n);return r<o?1:r>o?-1:0}return e.getCount()-t.getCount()}),e.splice(3)}return[e[0],e[1],e[2]]}}Pe.CENTER_QUORUM=2,Pe.MIN_SKIP=3,Pe.MAX_MODULES=57;class Be{constructor(t){this.image=t}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(t){this.resultPointCallback=null==t?null:t.get(b.NEED_RESULT_POINT_CALLBACK);const e=new Pe(this.image,this.resultPointCallback).find(t);return this.processFinderPatternInfo(e)}processFinderPatternInfo(t){const e=t.getTopLeft(),n=t.getTopRight(),r=t.getBottomLeft(),o=this.calculateModuleSize(e,n,r);if(o<1)throw new T("No pattern found in proccess finder.");const i=Be.computeDimension(e,n,r,o),a=Ce.getProvisionalVersionForDimension(i),s=a.getDimensionForVersion()-7;let c=null;if(a.getAlignmentPatternCenters().length>0){const t=n.getX()-e.getX()+r.getX(),i=n.getY()-e.getY()+r.getY(),a=1-3/s,l=Math.floor(e.getX()+a*(t-e.getX())),d=Math.floor(e.getY()+a*(i-e.getY()));for(let t=4;t<=16;t<<=1)try{c=this.findAlignmentInRegion(o,l,d,t);break}catch(t){if(!(t instanceof T))throw t}}const l=Be.createTransform(e,n,r,c,i),d=Be.sampleGrid(this.image,l,i);let u;return u=null===c?[r,e,n]:[r,e,n,c],new st(d,u)}static createTransform(t,e,n,r,o){const i=o-3.5;let a,s,c,l;return null!==r?(a=r.getX(),s=r.getY(),c=i-3,l=c):(a=e.getX()-t.getX()+n.getX(),s=e.getY()-t.getY()+n.getY(),c=i,l=i),ut.quadrilateralToQuadrilateral(3.5,3.5,i,3.5,c,l,3.5,i,t.getX(),t.getY(),e.getX(),e.getY(),a,s,n.getX(),n.getY())}static sampleGrid(t,e,n){return mt.getInstance().sampleGridWithTransform(t,n,n,e)}static computeDimension(t,e,n,r){const o=ot.round(at.distance(t,e)/r),i=ot.round(at.distance(t,n)/r);let a=Math.floor((o+i)/2)+7;switch(3&a){case 0:a++;break;case 2:a--;break;case 3:throw new T("Dimensions could be not found.")}return a}calculateModuleSize(t,e,n){return(this.calculateModuleSizeOneWay(t,e)+this.calculateModuleSizeOneWay(t,n))/2}calculateModuleSizeOneWay(t,e){const n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(t,e,n,r){let o=this.sizeOfBlackWhiteBlackRun(t,e,n,r),i=1,a=t-(n-t);a<0?(i=t/(t-a),a=0):a>=this.image.getWidth()&&(i=(this.image.getWidth()-1-t)/(a-t),a=this.image.getWidth()-1);let s=Math.floor(e-(r-e)*i);return i=1,s<0?(i=e/(e-s),s=0):s>=this.image.getHeight()&&(i=(this.image.getHeight()-1-e)/(s-e),s=this.image.getHeight()-1),a=Math.floor(t+(a-t)*i),o+=this.sizeOfBlackWhiteBlackRun(t,e,a,s),o-1}sizeOfBlackWhiteBlackRun(t,e,n,r){const o=Math.abs(r-e)>Math.abs(n-t);if(o){let o=t;t=e,e=o,o=n,n=r,r=o}const i=Math.abs(n-t),a=Math.abs(r-e);let s=-i/2;const c=t<n?1:-1,l=e<r?1:-1;let d=0;const u=n+c;for(let n=t,h=e;n!==u;n+=c){const c=o?h:n,u=o?n:h;if(1===d===this.image.get(c,u)){if(2===d)return ot.distance(n,h,t,e);d++}if(s+=a,s>0){if(h===r)break;h+=l,s-=i}}return 2===d?ot.distance(n+c,r,t,e):NaN}findAlignmentInRegion(t,e,n,r){const o=Math.floor(r*t),i=Math.max(0,e-o),a=Math.min(this.image.getWidth()-1,e+o);if(a-i<3*t)throw new T("Alignment top exceeds estimated module size.");const s=Math.max(0,n-o),c=Math.min(this.image.getHeight()-1,n+o);if(c-s<3*t)throw new T("Alignment bottom exceeds estimated module size.");return new xe(this.image,i,s,a-i,c-s,t,this.resultPointCallback).find()}}class Fe{constructor(){this.decoder=new Ne}getDecoder(){return this.decoder}decode(t,e){let n,r;if(null!=e&&void 0!==e.get(b.PURE_BARCODE)){const o=Fe.extractPureBits(t.getBlackMatrix());n=this.decoder.decodeBitMatrix(o,e),r=Fe.NO_POINTS}else{const o=new Be(t.getBlackMatrix()).detect(e);n=this.decoder.decodeBitMatrix(o.getBits(),e),r=o.getPoints()}n.getOther()instanceof Re&&n.getOther().applyMirroredCorrection(r);const o=new L(n.getText(),n.getRawBytes(),void 0,r,V.QR_CODE,void 0),i=n.getByteSegments();null!==i&&o.putMetadata(X.BYTE_SEGMENTS,i);const a=n.getECLevel();return null!==a&&o.putMetadata(X.ERROR_CORRECTION_LEVEL,a),n.hasStructuredAppend()&&(o.putMetadata(X.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),o.putMetadata(X.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),o}reset(){}static extractPureBits(t){const e=t.getTopLeftOnBit(),n=t.getBottomRightOnBit();if(null===e||null===n)throw new T;const r=this.moduleSize(e,t);let o=e[1],i=n[1],a=e[0],s=n[0];if(a>=s||o>=i)throw new T;if(i-o!==s-a&&(s=a+(i-o),s>=t.getWidth()))throw new T;const c=Math.round((s-a+1)/r),l=Math.round((i-o+1)/r);if(c<=0||l<=0)throw new T;if(l!==c)throw new T;const d=Math.floor(r/2);o+=d,a+=d;const u=a+Math.floor((c-1)*r)-s;if(u>0){if(u>d)throw new T;a-=u}const h=o+Math.floor((l-1)*r)-i;if(h>0){if(h>d)throw new T;o-=h}const m=new k(c,l);for(let e=0;e<l;e++){const n=o+Math.floor(e*r);for(let o=0;o<c;o++)t.get(a+Math.floor(o*r),n)&&m.set(o,e)}return m}static moduleSize(t,e){const n=e.getHeight(),r=e.getWidth();let o=t[0],i=t[1],a=!0,s=0;for(;o<r&&i<n;){if(a!==e.get(o,i)){if(5===++s)break;a=!a}o++,i++}if(o===r||i===n)throw new T;return(o-t[0])/7}}Fe.NO_POINTS=new Array;class Le{PDF417Common(){}static getBitCountSum(t){return ot.sum(t)}static toIntArray(t){if(null==t||!t.length)return Le.EMPTY_INT_ARRAY;const e=new Int32Array(t.length);let n=0;for(const r of t)e[n++]=r;return e}static getCodeword(t){const e=g.binarySearch(Le.SYMBOL_TABLE,262143&t);return e<0?-1:(Le.CODEWORD_TABLE[e]-1)%Le.NUMBER_OF_CODEWORDS}}Le.NUMBER_OF_CODEWORDS=929,Le.MAX_CODEWORDS_IN_BARCODE=Le.NUMBER_OF_CODEWORDS-1,Le.MIN_ROWS_IN_BARCODE=3,Le.MAX_ROWS_IN_BARCODE=90,Le.MODULES_IN_CODEWORD=17,Le.MODULES_IN_STOP_PATTERN=18,Le.BARS_IN_MODULE=8,Le.EMPTY_INT_ARRAY=new Int32Array([]),Le.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),Le.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class qe{constructor(t,e){this.bits=t,this.points=e}getBits(){return this.bits}getPoints(){return this.points}}class Ve{static detectMultiple(t,e,n){let r=t.getBlackMatrix(),o=Ve.detect(n,r);return o.length||(r=r.clone(),r.rotate180(),o=Ve.detect(n,r)),new qe(r,o)}static detect(t,e){const n=new Array;let r=0,o=0,i=!1;for(;r<e.getHeight();){const a=Ve.findVertices(e,r,o);if(null!=a[0]||null!=a[3]){if(i=!0,n.push(a),!t)break;null!=a[2]?(o=Math.trunc(a[2].getX()),r=Math.trunc(a[2].getY())):(o=Math.trunc(a[4].getX()),r=Math.trunc(a[4].getY()))}else{if(!i)break;i=!1,o=0;for(const t of n)null!=t[1]&&(r=Math.trunc(Math.max(r,t[1].getY()))),null!=t[3]&&(r=Math.max(r,Math.trunc(t[3].getY())));r+=Ve.ROW_STEP}}return n}static findVertices(t,e,n){const r=t.getHeight(),o=t.getWidth(),i=new Array(8);return Ve.copyToResult(i,Ve.findRowsWithPattern(t,r,o,e,n,Ve.START_PATTERN),Ve.INDEXES_START_PATTERN),null!=i[4]&&(n=Math.trunc(i[4].getX()),e=Math.trunc(i[4].getY())),Ve.copyToResult(i,Ve.findRowsWithPattern(t,r,o,e,n,Ve.STOP_PATTERN),Ve.INDEXES_STOP_PATTERN),i}static copyToResult(t,e,n){for(let r=0;r<n.length;r++)t[n[r]]=e[r]}static findRowsWithPattern(t,e,n,r,o,i){const a=new Array(4);let s=!1;const c=new Int32Array(i.length);for(;r<e;r+=Ve.ROW_STEP){let e=Ve.findGuardPattern(t,o,r,n,!1,i,c);if(null!=e){for(;r>0;){const a=Ve.findGuardPattern(t,o,--r,n,!1,i,c);if(null==a){r++;break}e=a}a[0]=new at(e[0],r),a[1]=new at(e[1],r),s=!0;break}}let l=r+1;if(s){let r=0,o=Int32Array.from([Math.trunc(a[0].getX()),Math.trunc(a[1].getX())]);for(;l<e;l++){const e=Ve.findGuardPattern(t,o[0],l,n,!1,i,c);if(null!=e&&Math.abs(o[0]-e[0])<Ve.MAX_PATTERN_DRIFT&&Math.abs(o[1]-e[1])<Ve.MAX_PATTERN_DRIFT)o=e,r=0;else{if(r>Ve.SKIPPED_ROW_COUNT_MAX)break;r++}}l-=r+1,a[2]=new at(o[0],l),a[3]=new at(o[1],l)}return l-r<Ve.BARCODE_MIN_HEIGHT&&g.fill(a,null),a}static findGuardPattern(t,e,n,r,o,i,a){g.fillWithin(a,0,a.length,0);let s=e,c=0;for(;t.get(s,n)&&s>0&&c++<Ve.MAX_PIXEL_DRIFT;)s--;let l=s,d=0,u=i.length;for(let e=o;l<r;l++)if(t.get(l,n)!==e)a[d]++;else{if(d===u-1){if(Ve.patternMatchVariance(a,i,Ve.MAX_INDIVIDUAL_VARIANCE)<Ve.MAX_AVG_VARIANCE)return new Int32Array([s,l]);s+=a[0]+a[1],f.arraycopy(a,2,a,0,d-1),a[d-1]=0,a[d]=0,d--}else d++;a[d]=1,e=!e}return d===u-1&&Ve.patternMatchVariance(a,i,Ve.MAX_INDIVIDUAL_VARIANCE)<Ve.MAX_AVG_VARIANCE?new Int32Array([s,l-1]):null}static patternMatchVariance(t,e,n){let r=t.length,o=0,i=0;for(let n=0;n<r;n++)o+=t[n],i+=e[n];if(o<i)return 1/0;let a=o/i;n*=a;let s=0;for(let o=0;o<r;o++){let r=t[o],i=e[o]*a,c=r>i?r-i:i-r;if(c>n)return 1/0;s+=c}return s/o}}Ve.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Ve.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Ve.MAX_AVG_VARIANCE=.42,Ve.MAX_INDIVIDUAL_VARIANCE=.8,Ve.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Ve.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Ve.MAX_PIXEL_DRIFT=3,Ve.MAX_PATTERN_DRIFT=5,Ve.SKIPPED_ROW_COUNT_MAX=25,Ve.ROW_STEP=5,Ve.BARCODE_MIN_HEIGHT=10;class He{constructor(t,e){if(0===e.length)throw new d;this.field=t;let n=e.length;if(n>1&&0===e[0]){let t=1;for(;t<n&&0===e[t];)t++;t===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-t),f.arraycopy(e,t,this.coefficients,0,this.coefficients.length))}else this.coefficients=e}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(t){return this.coefficients[this.coefficients.length-1-t]}evaluateAt(t){if(0===t)return this.getCoefficient(0);if(1===t){let t=0;for(let e of this.coefficients)t=this.field.add(t,e);return t}let e=this.coefficients[0],n=this.coefficients.length;for(let r=1;r<n;r++)e=this.field.add(this.field.multiply(t,e),this.coefficients[r]);return e}add(t){if(!this.field.equals(t.field))throw new d("ModulusPolys do not have same ModulusGF field");if(this.isZero())return t;if(t.isZero())return this;let e=this.coefficients,n=t.coefficients;if(e.length>n.length){let t=e;e=n,n=t}let r=new Int32Array(n.length),o=n.length-e.length;f.arraycopy(n,0,r,0,o);for(let t=o;t<n.length;t++)r[t]=this.field.add(e[t-o],n[t]);return new He(this.field,r)}subtract(t){if(!this.field.equals(t.field))throw new d("ModulusPolys do not have same ModulusGF field");return t.isZero()?this:this.add(t.negative())}multiply(t){return t instanceof He?this.multiplyOther(t):this.multiplyScalar(t)}multiplyOther(t){if(!this.field.equals(t.field))throw new d("ModulusPolys do not have same ModulusGF field");if(this.isZero()||t.isZero())return new He(this.field,new Int32Array([0]));let e=this.coefficients,n=e.length,r=t.coefficients,o=r.length,i=new Int32Array(n+o-1);for(let t=0;t<n;t++){let n=e[t];for(let e=0;e<o;e++)i[t+e]=this.field.add(i[t+e],this.field.multiply(n,r[e]))}return new He(this.field,i)}negative(){let t=this.coefficients.length,e=new Int32Array(t);for(let n=0;n<t;n++)e[n]=this.field.subtract(0,this.coefficients[n]);return new He(this.field,e)}multiplyScalar(t){if(0===t)return new He(this.field,new Int32Array([0]));if(1===t)return this;let e=this.coefficients.length,n=new Int32Array(e);for(let r=0;r<e;r++)n[r]=this.field.multiply(this.coefficients[r],t);return new He(this.field,n)}multiplyByMonomial(t,e){if(t<0)throw new d;if(0===e)return new He(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+t);for(let t=0;t<n;t++)r[t]=this.field.multiply(this.coefficients[t],e);return new He(this.field,r)}toString(){let t=new S;for(let e=this.getDegree();e>=0;e--){let n=this.getCoefficient(e);0!==n&&(n<0?(t.append(" - "),n=-n):t.length()>0&&t.append(" + "),0!==e&&1===n||t.append(n),0!==e&&(1===e?t.append("x"):(t.append("x^"),t.append(e))))}return t.toString()}}class Ue{add(t,e){return(t+e)%this.modulus}subtract(t,e){return(this.modulus+t-e)%this.modulus}exp(t){return this.expTable[t]}log(t){if(0===t)throw new d;return this.logTable[t]}inverse(t){if(0===t)throw new K;return this.expTable[this.modulus-this.logTable[t]-1]}multiply(t,e){return 0===t||0===e?0:this.expTable[(this.logTable[t]+this.logTable[e])%(this.modulus-1)]}getSize(){return this.modulus}equals(t){return t===this}}class ze extends Ue{constructor(t,e){super(),this.modulus=t,this.expTable=new Int32Array(t),this.logTable=new Int32Array(t);let n=1;for(let r=0;r<t;r++)this.expTable[r]=n,n=n*e%t;for(let e=0;e<t-1;e++)this.logTable[this.expTable[e]]=e;this.zero=new He(this,new Int32Array([0])),this.one=new He(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(t,e){if(t<0)throw new d;if(0===e)return this.zero;let n=new Int32Array(t+1);return n[0]=e,new He(this,n)}}ze.PDF417_GF=new ze(Le.NUMBER_OF_CODEWORDS,3);class We{constructor(){this.field=ze.PDF417_GF}decode(t,e,n){let r=new He(this.field,t),o=new Int32Array(e),i=!1;for(let t=e;t>0;t--){let n=r.evaluateAt(this.field.exp(t));o[e-t]=n,0!==n&&(i=!0)}if(!i)return 0;let a=this.field.getOne();if(null!=n)for(const e of n){let n=this.field.exp(t.length-1-e),r=new He(this.field,new Int32Array([this.field.subtract(0,n),1]));a=a.multiply(r)}let s=new He(this.field,o),c=this.runEuclideanAlgorithm(this.field.buildMonomial(e,1),s,e),l=c[0],d=c[1],u=this.findErrorLocations(l),m=this.findErrorMagnitudes(d,l,u);for(let e=0;e<u.length;e++){let n=t.length-1-this.field.log(u[e]);if(n<0)throw h.getChecksumInstance();t[n]=this.field.subtract(t[n],m[e])}return u.length}runEuclideanAlgorithm(t,e,n){if(t.getDegree()<e.getDegree()){let n=t;t=e,e=n}let r=t,o=e,i=this.field.getZero(),a=this.field.getOne();for(;o.getDegree()>=Math.round(n/2);){let t=r,e=i;if(r=o,i=a,r.isZero())throw h.getChecksumInstance();o=t;let n=this.field.getZero(),s=r.getCoefficient(r.getDegree()),c=this.field.inverse(s);for(;o.getDegree()>=r.getDegree()&&!o.isZero();){let t=o.getDegree()-r.getDegree(),e=this.field.multiply(o.getCoefficient(o.getDegree()),c);n=n.add(this.field.buildMonomial(t,e)),o=o.subtract(r.multiplyByMonomial(t,e))}a=n.multiply(i).subtract(e).negative()}let s=a.getCoefficient(0);if(0===s)throw h.getChecksumInstance();let c=this.field.inverse(s);return[a.multiply(c),o.multiply(c)]}findErrorLocations(t){let e=t.getDegree(),n=new Int32Array(e),r=0;for(let o=1;o<this.field.getSize()&&r<e;o++)0===t.evaluateAt(o)&&(n[r]=this.field.inverse(o),r++);if(r!==e)throw h.getChecksumInstance();return n}findErrorMagnitudes(t,e,n){let r=e.getDegree(),o=new Int32Array(r);for(let t=1;t<=r;t++)o[r-t]=this.field.multiply(t,e.getCoefficient(t));let i=new He(this.field,o),a=n.length,s=new Int32Array(a);for(let e=0;e<a;e++){let r=this.field.inverse(n[e]),o=this.field.subtract(0,t.evaluateAt(r)),a=this.field.inverse(i.evaluateAt(r));s[e]=this.field.multiply(o,a)}return s}}class je{constructor(t,e,n,r,o){t instanceof je?this.constructor_2(t):this.constructor_1(t,e,n,r,o)}constructor_1(t,e,n,r,o){const i=null==e||null==n,a=null==r||null==o;if(i&&a)throw new T;i?(e=new at(0,r.getY()),n=new at(0,o.getY())):a&&(r=new at(t.getWidth()-1,e.getY()),o=new at(t.getWidth()-1,n.getY())),this.image=t,this.topLeft=e,this.bottomLeft=n,this.topRight=r,this.bottomRight=o,this.minX=Math.trunc(Math.min(e.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),o.getX())),this.minY=Math.trunc(Math.min(e.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),o.getY()))}constructor_2(t){this.image=t.image,this.topLeft=t.getTopLeft(),this.bottomLeft=t.getBottomLeft(),this.topRight=t.getTopRight(),this.bottomRight=t.getBottomRight(),this.minX=t.getMinX(),this.maxX=t.getMaxX(),this.minY=t.getMinY(),this.maxY=t.getMaxY()}static merge(t,e){return null==t?e:null==e?t:new je(t.image,t.topLeft,t.bottomLeft,e.topRight,e.bottomRight)}addMissingRows(t,e,n){let r=this.topLeft,o=this.bottomLeft,i=this.topRight,a=this.bottomRight;if(t>0){let e=n?this.topLeft:this.topRight,o=Math.trunc(e.getY()-t);o<0&&(o=0);let a=new at(e.getX(),o);n?r=a:i=a}if(e>0){let t=n?this.bottomLeft:this.bottomRight,r=Math.trunc(t.getY()+e);r>=this.image.getHeight()&&(r=this.image.getHeight()-1);let i=new at(t.getX(),r);n?o=i:a=i}return new je(this.image,r,o,i,a)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Ge{constructor(t,e,n,r){this.columnCount=t,this.errorCorrectionLevel=r,this.rowCountUpperPart=e,this.rowCountLowerPart=n,this.rowCount=e+n}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class Xe{constructor(){this.buffer=""}static form(t,e){let n=-1;function r(t,r,o,i,a,s){if("%%"===t)return"%";if(void 0===e[++n])return;t=i?parseInt(i.substr(1)):void 0;let c,l=a?parseInt(a.substr(1)):void 0;switch(s){case"s":c=e[n];break;case"c":c=e[n][0];break;case"f":c=parseFloat(e[n]).toFixed(t);break;case"p":c=parseFloat(e[n]).toPrecision(t);break;case"e":c=parseFloat(e[n]).toExponential(t);break;case"x":c=parseInt(e[n]).toString(l||16);break;case"d":c=parseFloat(parseInt(e[n],l||10).toPrecision(t)).toFixed(0)}c="object"==typeof c?JSON.stringify(c):(+c).toString(l);let d=parseInt(o),u=o&&o[0]+""=="0"?"0":" ";for(;c.length<d;)c=void 0!==r?c+u:u+c;return c}let o=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return t.replace(o,r)}format(t,...e){this.buffer+=Xe.form(t,e)}toString(){return this.buffer}}class Qe{constructor(t){this.boundingBox=new je(t),this.codewords=new Array(t.getMaxY()-t.getMinY()+1)}getCodewordNearby(t){let e=this.getCodeword(t);if(null!=e)return e;for(let n=1;n<Qe.MAX_NEARBY_DISTANCE;n++){let r=this.imageRowToCodewordIndex(t)-n;if(r>=0&&(e=this.codewords[r],null!=e))return e;if(r=this.imageRowToCodewordIndex(t)+n,r<this.codewords.length&&(e=this.codewords[r],null!=e))return e}return null}imageRowToCodewordIndex(t){return t-this.boundingBox.getMinY()}setCodeword(t,e){this.codewords[this.imageRowToCodewordIndex(t)]=e}getCodeword(t){return this.codewords[this.imageRowToCodewordIndex(t)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const t=new Xe;let e=0;for(const n of this.codewords)null!=n?t.format("%3d: %3d|%3d%n",e++,n.getRowNumber(),n.getValue()):t.format("%3d: | %n",e++);return t.toString()}}Qe.MAX_NEARBY_DISTANCE=5;class Ye{constructor(){this.values=new Map}setValue(t){t=Math.trunc(t);let e=this.values.get(t);null==e&&(e=0),e++,this.values.set(t,e)}getValue(){let t=-1,e=new Array;for(const[n,r]of this.values.entries()){const o={getKey:()=>n,getValue:()=>r};o.getValue()>t?(t=o.getValue(),e=[],e.push(o.getKey())):o.getValue()===t&&e.push(o.getKey())}return Le.toIntArray(e)}getConfidence(t){return this.values.get(t)}}class Ze extends Qe{constructor(t,e){super(t),this._isLeft=e}setRowNumbers(){for(let t of this.getCodewords())null!=t&&t.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(t){let e=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(e,t);let n=this.getBoundingBox(),r=this._isLeft?n.getTopLeft():n.getTopRight(),o=this._isLeft?n.getBottomLeft():n.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),a=this.imageRowToCodewordIndex(Math.trunc(o.getY())),s=-1,c=1,l=0;for(let n=i;n<a;n++){if(null==e[n])continue;let r=e[n],o=r.getRowNumber()-s;if(0===o)l++;else if(1===o)c=Math.max(c,l),l=1,s=r.getRowNumber();else if(o<0||r.getRowNumber()>=t.getRowCount()||o>n)e[n]=null;else{let t;t=c>2?(c-2)*o:o;let i=t>=n;for(let r=1;r<=t&&!i;r++)i=null!=e[n-r];i?e[n]=null:(s=r.getRowNumber(),l=1)}}}getRowHeights(){let t=this.getBarcodeMetadata();if(null==t)return null;this.adjustIncompleteIndicatorColumnRowNumbers(t);let e=new Int32Array(t.getRowCount());for(let t of this.getCodewords())if(null!=t){let n=t.getRowNumber();if(n>=e.length)continue;e[n]++}return e}adjustIncompleteIndicatorColumnRowNumbers(t){let e=this.getBoundingBox(),n=this._isLeft?e.getTopLeft():e.getTopRight(),r=this._isLeft?e.getBottomLeft():e.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(n.getY())),i=this.imageRowToCodewordIndex(Math.trunc(r.getY())),a=this.getCodewords(),s=-1;for(let e=o;e<i;e++){if(null==a[e])continue;let n=a[e];n.setRowNumberAsRowIndicatorColumn();let r=n.getRowNumber()-s;0===r||(1===r?s=n.getRowNumber():n.getRowNumber()>=t.getRowCount()?a[e]=null:s=n.getRowNumber())}}getBarcodeMetadata(){let t=this.getCodewords(),e=new Ye,n=new Ye,r=new Ye,o=new Ye;for(let i of t){if(null==i)continue;i.setRowNumberAsRowIndicatorColumn();let t=i.getValue()%30,a=i.getRowNumber();switch(this._isLeft||(a+=2),a%3){case 0:n.setValue(3*t+1);break;case 1:o.setValue(t/3),r.setValue(t%3);break;case 2:e.setValue(t+1)}}if(0===e.getValue().length||0===n.getValue().length||0===r.getValue().length||0===o.getValue().length||e.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<Le.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>Le.MAX_ROWS_IN_BARCODE)return null;let i=new Ge(e.getValue()[0],n.getValue()[0],r.getValue()[0],o.getValue()[0]);return this.removeIncorrectCodewords(t,i),i}removeIncorrectCodewords(t,e){for(let n=0;n<t.length;n++){let r=t[n];if(null==t[n])continue;let o=r.getValue()%30,i=r.getRowNumber();if(i>e.getRowCount())t[n]=null;else switch(this._isLeft||(i+=2),i%3){case 0:3*o+1!==e.getRowCountUpperPart()&&(t[n]=null);break;case 1:Math.trunc(o/3)===e.getErrorCorrectionLevel()&&o%3===e.getRowCountLowerPart()||(t[n]=null);break;case 2:o+1!==e.getColumnCount()&&(t[n]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class Ke{constructor(t,e){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=t,this.barcodeColumnCount=t.getColumnCount(),this.boundingBox=e,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let t,e=Le.MAX_CODEWORDS_IN_BARCODE;do{t=e,e=this.adjustRowNumbersAndGetCount()}while(e>0&&e<t);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(t){null!=t&&t.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let t=this.adjustRowNumbersByRow();if(0===t)return 0;for(let t=1;t<this.barcodeColumnCount+1;t++){let e=this.detectionResultColumns[t].getCodewords();for(let n=0;n<e.length;n++)null!=e[n]&&(e[n].hasValidRowNumber()||this.adjustRowNumbers(t,n,e))}return t}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let t=this.detectionResultColumns[0].getCodewords(),e=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++)if(null!=t[n]&&null!=e[n]&&t[n].getRowNumber()===e[n].getRowNumber())for(let e=1;e<=this.barcodeColumnCount;e++){let r=this.detectionResultColumns[e].getCodewords()[n];null!=r&&(r.setRowNumber(t[n].getRowNumber()),r.hasValidRowNumber()||(this.detectionResultColumns[e].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let t=0,e=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++){if(null==e[n])continue;let r=e[n].getRowNumber(),o=0;for(let e=this.barcodeColumnCount+1;e>0&&o<this.ADJUST_ROW_NUMBER_SKIP;e--){let i=this.detectionResultColumns[e].getCodewords()[n];null!=i&&(o=Ke.adjustRowNumberIfValid(r,o,i),i.hasValidRowNumber()||t++)}}return t}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let t=0,e=this.detectionResultColumns[0].getCodewords();for(let n=0;n<e.length;n++){if(null==e[n])continue;let r=e[n].getRowNumber(),o=0;for(let e=1;e<this.barcodeColumnCount+1&&o<this.ADJUST_ROW_NUMBER_SKIP;e++){let i=this.detectionResultColumns[e].getCodewords()[n];null!=i&&(o=Ke.adjustRowNumberIfValid(r,o,i),i.hasValidRowNumber()||t++)}}return t}static adjustRowNumberIfValid(t,e,n){return null==n||n.hasValidRowNumber()||(n.isValidRowNumber(t)?(n.setRowNumber(t),e=0):++e),e}adjustRowNumbers(t,e,n){if(!this.detectionResultColumns[t-1])return;let r=n[e],o=this.detectionResultColumns[t-1].getCodewords(),i=o;null!=this.detectionResultColumns[t+1]&&(i=this.detectionResultColumns[t+1].getCodewords());let a=new Array(14);a[2]=o[e],a[3]=i[e],e>0&&(a[0]=n[e-1],a[4]=o[e-1],a[5]=i[e-1]),e>1&&(a[8]=n[e-2],a[10]=o[e-2],a[11]=i[e-2]),e<n.length-1&&(a[1]=n[e+1],a[6]=o[e+1],a[7]=i[e+1]),e<n.length-2&&(a[9]=n[e+2],a[12]=o[e+2],a[13]=i[e+2]);for(let t of a)if(Ke.adjustRowNumber(r,t))return}static adjustRowNumber(t,e){return!(null==e||!e.hasValidRowNumber()||e.getBucket()!==t.getBucket()||(t.setRowNumber(e.getRowNumber()),0))}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(t){this.boundingBox=t}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(t,e){this.detectionResultColumns[t]=e}getDetectionResultColumn(t){return this.detectionResultColumns[t]}toString(){let t=this.detectionResultColumns[0];null==t&&(t=this.detectionResultColumns[this.barcodeColumnCount+1]);let e=new Xe;for(let n=0;n<t.getCodewords().length;n++){e.format("CW %3d:",n);for(let t=0;t<this.barcodeColumnCount+2;t++){if(null==this.detectionResultColumns[t]){e.format(" | ");continue}let r=this.detectionResultColumns[t].getCodewords()[n];null!=r?e.format(" %3d|%3d",r.getRowNumber(),r.getValue()):e.format(" | ")}e.format("%n")}return e.toString()}}class Je{constructor(t,e,n,r){this.rowNumber=Je.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(t),this.endX=Math.trunc(e),this.bucket=Math.trunc(n),this.value=Math.trunc(r)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(t){return t!==Je.BARCODE_ROW_UNKNOWN&&this.bucket===t%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(t){this.rowNumber=t}toString(){return this.rowNumber+"|"+this.value}}Je.BARCODE_ROW_UNKNOWN=-1;class tn{static initialize(){for(let t=0;t<Le.SYMBOL_TABLE.length;t++){let e=Le.SYMBOL_TABLE[t],n=1&e;for(let r=0;r<Le.BARS_IN_MODULE;r++){let o=0;for(;(1&e)===n;)o+=1,e>>=1;n=1&e,tn.RATIOS_TABLE[t]||(tn.RATIOS_TABLE[t]=new Array(Le.BARS_IN_MODULE)),tn.RATIOS_TABLE[t][Le.BARS_IN_MODULE-r-1]=Math.fround(o/Le.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(t){let e=tn.getDecodedCodewordValue(tn.sampleBitCounts(t));return-1!==e?e:tn.getClosestDecodedValue(t)}static sampleBitCounts(t){let e=ot.sum(t),n=new Int32Array(Le.BARS_IN_MODULE),r=0,o=0;for(let i=0;i<Le.MODULES_IN_CODEWORD;i++){let a=e/(2*Le.MODULES_IN_CODEWORD)+i*e/Le.MODULES_IN_CODEWORD;o+t[r]<=a&&(o+=t[r],r++),n[r]++}return n}static getDecodedCodewordValue(t){let e=tn.getBitValue(t);return-1===Le.getCodeword(e)?-1:e}static getBitValue(t){let e=0;for(let n=0;n<t.length;n++)for(let r=0;r<t[n];r++)e=e<<1|(n%2==0?1:0);return Math.trunc(e)}static getClosestDecodedValue(t){let e=ot.sum(t),n=new Array(Le.BARS_IN_MODULE);if(e>1)for(let r=0;r<n.length;r++)n[r]=Math.fround(t[r]/e);let r=it.MAX_VALUE,o=-1;this.bSymbolTableReady||tn.initialize();for(let t=0;t<tn.RATIOS_TABLE.length;t++){let e=0,i=tn.RATIOS_TABLE[t];for(let t=0;t<Le.BARS_IN_MODULE;t++){let o=Math.fround(i[t]-n[t]);if(e+=Math.fround(o*o),e>=r)break}e<r&&(r=e,o=Le.SYMBOL_TABLE[t])}return o}}tn.bSymbolTableReady=!1,tn.RATIOS_TABLE=new Array(Le.SYMBOL_TABLE.length).map(t=>new Array(Le.BARS_IN_MODULE));class en{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(t){this.segmentIndex=t}getFileId(){return this.fileId}setFileId(t){this.fileId=t}getOptionalData(){return this.optionalData}setOptionalData(t){this.optionalData=t}isLastSegment(){return this.lastSegment}setLastSegment(t){this.lastSegment=t}getSegmentCount(){return this.segmentCount}setSegmentCount(t){this.segmentCount=t}getSender(){return this.sender||null}setSender(t){this.sender=t}getAddressee(){return this.addressee||null}setAddressee(t){this.addressee=t}getFileName(){return this.fileName}setFileName(t){this.fileName=t}getFileSize(){return this.fileSize}setFileSize(t){this.fileSize=t}getChecksum(){return this.checksum}setChecksum(t){this.checksum=t}getTimestamp(){return this.timestamp}setTimestamp(t){this.timestamp=t}}class nn{static parseLong(t,e=void 0){return parseInt(t,e)}}class rn extends c{}rn.kind="NullPointerException";class on{writeBytes(t){this.writeBytesOffset(t,0,t.length)}writeBytesOffset(t,e,n){if(null==t)throw new rn;if(e<0||e>t.length||n<0||e+n>t.length||e+n<0)throw new p;if(0!==n)for(let r=0;r<n;r++)this.write(t[e+r])}flush(){}close(){}}class an extends c{}class sn extends on{constructor(t=32){if(super(),this.count=0,t<0)throw new d("Negative initial size: "+t);this.buf=new Uint8Array(t)}ensureCapacity(t){t-this.buf.length>0&&this.grow(t)}grow(t){let e=this.buf.length<<1;if(e-t<0&&(e=t),e<0){if(t<0)throw new an;e=w.MAX_VALUE}this.buf=g.copyOfUint8Array(this.buf,e)}write(t){this.ensureCapacity(this.count+1),this.buf[this.count]=t,this.count+=1}writeBytesOffset(t,e,n){if(e<0||e>t.length||n<0||e+n-t.length>0)throw new p;this.ensureCapacity(this.count+n),f.arraycopy(t,e,this.buf,this.count,n),this.count+=n}writeTo(t){t.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return g.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(t){return t?"string"==typeof t?this.toString_string(t):this.toString_number(t):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(t){return new String(this.buf).toString()}toString_number(t){return new String(this.buf).toString()}close(){}}function cn(){if("undefined"!=typeof window)return window.BigInt||null;if(void 0!==commonjsGlobal)return commonjsGlobal.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let ln;function dn(t){if(void 0===ln&&(ln=cn()),null===ln)throw new Error("BigInt is not supported!");return ln(t)}function un(){let t=[];t[0]=dn(1);let e=dn(900);t[1]=e;for(let n=2;n<16;n++)t[n]=t[n-1]*e;return t}!function(t){t[t.ALPHA=0]="ALPHA",t[t.LOWER=1]="LOWER",t[t.MIXED=2]="MIXED",t[t.PUNCT=3]="PUNCT",t[t.ALPHA_SHIFT=4]="ALPHA_SHIFT",t[t.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(G||(G={}));class hn{static decode(t,e){let n=new S(""),r=I.ISO8859_1;n.enableDecoding(r);let o=1,i=t[o++],a=new en;for(;o<t[0];){switch(i){case hn.TEXT_COMPACTION_MODE_LATCH:o=hn.textCompaction(t,o,n);break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:o=hn.byteCompaction(i,t,r,o,n);break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(t[o++]);break;case hn.NUMERIC_COMPACTION_MODE_LATCH:o=hn.numericCompaction(t,o,n);break;case hn.ECI_CHARSET:I.getCharacterSetECIByValue(t[o++]);break;case hn.ECI_GENERAL_PURPOSE:o+=2;break;case hn.ECI_USER_DEFINED:o++;break;case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:o=hn.decodeMacroBlock(t,o,a);break;case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:throw new v;default:o--,o=hn.textCompaction(t,o,n)}if(!(o<t.length))throw v.getFormatInstance();i=t[o++]}if(0===n.length())throw v.getFormatInstance();let s=new Q(null,n.toString(),null,e);return s.setOther(a),s}static decodeMacroBlock(t,e,n){if(e+hn.NUMBER_OF_SEQUENCE_CODEWORDS>t[0])throw v.getFormatInstance();let r=new Int32Array(hn.NUMBER_OF_SEQUENCE_CODEWORDS);for(let n=0;n<hn.NUMBER_OF_SEQUENCE_CODEWORDS;n++,e++)r[n]=t[e];n.setSegmentIndex(w.parseInt(hn.decodeBase900toBase10(r,hn.NUMBER_OF_SEQUENCE_CODEWORDS)));let o=new S;e=hn.textCompaction(t,e,o),n.setFileId(o.toString());let i=-1;for(t[e]===hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(i=e+1);e<t[0];)switch(t[e]){case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(t[++e]){case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let r=new S;e=hn.textCompaction(t,e+1,r),n.setFileName(r.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let o=new S;e=hn.textCompaction(t,e+1,o),n.setSender(o.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let i=new S;e=hn.textCompaction(t,e+1,i),n.setAddressee(i.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let a=new S;e=hn.numericCompaction(t,e+1,a),n.setSegmentCount(w.parseInt(a.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let s=new S;e=hn.numericCompaction(t,e+1,s),n.setTimestamp(nn.parseLong(s.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let c=new S;e=hn.numericCompaction(t,e+1,c),n.setChecksum(w.parseInt(c.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let l=new S;e=hn.numericCompaction(t,e+1,l),n.setFileSize(nn.parseLong(l.toString()));break;default:throw v.getFormatInstance()}break;case hn.MACRO_PDF417_TERMINATOR:e++,n.setLastSegment(!0);break;default:throw v.getFormatInstance()}if(-1!==i){let r=e-i;n.isLastSegment()&&r--,n.setOptionalData(g.copyOfRange(t,i,i+r))}return e}static textCompaction(t,e,n){let r=new Int32Array(2*(t[0]-e)),o=new Int32Array(2*(t[0]-e)),i=0,a=!1;for(;e<t[0]&&!a;){let n=t[e++];if(n<hn.TEXT_COMPACTION_MODE_LATCH)r[i]=n/30,r[i+1]=n%30,i+=2;else switch(n){case hn.TEXT_COMPACTION_MODE_LATCH:r[i++]=hn.TEXT_COMPACTION_MODE_LATCH;break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:e--,a=!0;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[i]=hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,n=t[e++],o[i]=n,i++}}return hn.decodeTextCompaction(r,o,i,n),e}static decodeTextCompaction(t,e,n,r){let o=G.ALPHA,i=G.ALPHA,a=0;for(;a<n;){let n=t[a],s="";switch(o){case G.ALPHA:if(n<26)s=String.fromCharCode(65+n);else switch(n){case 26:s=" ";break;case hn.LL:o=G.LOWER;break;case hn.ML:o=G.MIXED;break;case hn.PS:i=o,o=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[a]);break;case hn.TEXT_COMPACTION_MODE_LATCH:o=G.ALPHA}break;case G.LOWER:if(n<26)s=String.fromCharCode(97+n);else switch(n){case 26:s=" ";break;case hn.AS:i=o,o=G.ALPHA_SHIFT;break;case hn.ML:o=G.MIXED;break;case hn.PS:i=o,o=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[a]);break;case hn.TEXT_COMPACTION_MODE_LATCH:o=G.ALPHA}break;case G.MIXED:if(n<hn.PL)s=hn.MIXED_CHARS[n];else switch(n){case hn.PL:o=G.PUNCT;break;case 26:s=" ";break;case hn.LL:o=G.LOWER;break;case hn.AL:o=G.ALPHA;break;case hn.PS:i=o,o=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[a]);break;case hn.TEXT_COMPACTION_MODE_LATCH:o=G.ALPHA}break;case G.PUNCT:if(n<hn.PAL)s=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:o=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[a]);break;case hn.TEXT_COMPACTION_MODE_LATCH:o=G.ALPHA}break;case G.ALPHA_SHIFT:if(o=i,n<26)s=String.fromCharCode(65+n);else switch(n){case 26:s=" ";break;case hn.TEXT_COMPACTION_MODE_LATCH:o=G.ALPHA}break;case G.PUNCT_SHIFT:if(o=i,n<hn.PAL)s=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:o=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(e[a]);break;case hn.TEXT_COMPACTION_MODE_LATCH:o=G.ALPHA}}""!==s&&r.append(s),a++}}static byteCompaction(t,e,n,r,o){let i=new sn,a=0,s=0,c=!1;switch(t){case hn.BYTE_COMPACTION_MODE_LATCH:let t=new Int32Array(6),n=e[r++];for(;r<e[0]&&!c;)switch(t[a++]=n,s=900*s+n,n=e[r++],n){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:r--,c=!0;break;default:if(a%5==0&&a>0){for(let t=0;t<6;++t)i.write(Number(dn(s)>>dn(8*(5-t))));s=0,a=0}}r===e[0]&&n<hn.TEXT_COMPACTION_MODE_LATCH&&(t[a++]=n);for(let e=0;e<a;e++)i.write(t[e]);break;case hn.BYTE_COMPACTION_MODE_LATCH_6:for(;r<e[0]&&!c;){let t=e[r++];if(t<hn.TEXT_COMPACTION_MODE_LATCH)a++,s=900*s+t;else switch(t){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:r--,c=!0}if(a%5==0&&a>0){for(let t=0;t<6;++t)i.write(Number(dn(s)>>dn(8*(5-t))));s=0,a=0}}}return o.append(E.decode(i.toByteArray(),n)),r}static numericCompaction(t,e,n){let r=0,o=!1,i=new Int32Array(hn.MAX_NUMERIC_CODEWORDS);for(;e<t[0]&&!o;){let a=t[e++];if(e===t[0]&&(o=!0),a<hn.TEXT_COMPACTION_MODE_LATCH)i[r]=a,r++;else switch(a){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:e--,o=!0}(r%hn.MAX_NUMERIC_CODEWORDS===0||a===hn.NUMERIC_COMPACTION_MODE_LATCH||o)&&r>0&&(n.append(hn.decodeBase900toBase10(i,r)),r=0)}return e}static decodeBase900toBase10(t,e){let n=dn(0);for(let r=0;r<e;r++)n+=hn.EXP900[e-r-1]*dn(t[r]);let r=n.toString();if("1"!==r.charAt(0))throw new v;return r.substring(1)}}hn.TEXT_COMPACTION_MODE_LATCH=900,hn.BYTE_COMPACTION_MODE_LATCH=901,hn.NUMERIC_COMPACTION_MODE_LATCH=902,hn.BYTE_COMPACTION_MODE_LATCH_6=924,hn.ECI_USER_DEFINED=925,hn.ECI_GENERAL_PURPOSE=926,hn.ECI_CHARSET=927,hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,hn.MACRO_PDF417_TERMINATOR=922,hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,hn.MAX_NUMERIC_CODEWORDS=15,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,hn.PL=25,hn.LL=27,hn.AS=27,hn.ML=28,hn.AL=28,hn.PS=29,hn.PAL=29,hn.PUNCT_CHARS=";<>@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",hn.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",hn.EXP900=cn()?un():[],hn.NUMBER_OF_SEQUENCE_CODEWORDS=2;class mn{constructor(){}static decode(t,e,n,r,o,i,a){let s,c=new je(t,e,n,r,o),l=null,d=null;for(let n=!0;;n=!1){if(null!=e&&(l=mn.getRowIndicatorColumn(t,c,e,!0,i,a)),null!=r&&(d=mn.getRowIndicatorColumn(t,c,r,!1,i,a)),s=mn.merge(l,d),null==s)throw T.getNotFoundInstance();let o=s.getBoundingBox();if(!n||null==o||!(o.getMinY()<c.getMinY()||o.getMaxY()>c.getMaxY()))break;c=o}s.setBoundingBox(c);let u=s.getBarcodeColumnCount()+1;s.setDetectionResultColumn(0,l),s.setDetectionResultColumn(u,d);let h=null!=l;for(let e=1;e<=u;e++){let n,r=h?e:u-e;if(void 0!==s.getDetectionResultColumn(r))continue;n=0===r||r===u?new Ze(c,0===r):new Qe(c),s.setDetectionResultColumn(r,n);let o=-1,l=o;for(let e=c.getMinY();e<=c.getMaxY();e++){if(o=mn.getStartColumn(s,r,e,h),o<0||o>c.getMaxX()){if(-1===l)continue;o=l}let d=mn.detectCodeword(t,c.getMinX(),c.getMaxX(),h,o,e,i,a);null!=d&&(n.setCodeword(e,d),l=o,i=Math.min(i,d.getWidth()),a=Math.max(a,d.getWidth()))}}return mn.createDecoderResult(s)}static merge(t,e){if(null==t&&null==e)return null;let n=mn.getBarcodeMetadata(t,e);if(null==n)return null;let r=je.merge(mn.adjustBoundingBox(t),mn.adjustBoundingBox(e));return new Ke(n,r)}static adjustBoundingBox(t){if(null==t)return null;let e=t.getRowHeights();if(null==e)return null;let n=mn.getMax(e),r=0;for(let t of e)if(r+=n-t,t>0)break;let o=t.getCodewords();for(let t=0;r>0&&null==o[t];t++)r--;let i=0;for(let t=e.length-1;t>=0&&(i+=n-e[t],!(e[t]>0));t--);for(let t=o.length-1;i>0&&null==o[t];t--)i--;return t.getBoundingBox().addMissingRows(r,i,t.isLeft())}static getMax(t){let e=-1;for(let n of t)e=Math.max(e,n);return e}static getBarcodeMetadata(t,e){let n,r;return null==t||null==(n=t.getBarcodeMetadata())?null==e?null:e.getBarcodeMetadata():null==e||null==(r=e.getBarcodeMetadata())?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(t,e,n,r,o,i){let a=new Ze(e,r);for(let s=0;s<2;s++){let c=0===s?1:-1,l=Math.trunc(Math.trunc(n.getX()));for(let s=Math.trunc(Math.trunc(n.getY()));s<=e.getMaxY()&&s>=e.getMinY();s+=c){let e=mn.detectCodeword(t,0,t.getWidth(),r,l,s,o,i);null!=e&&(a.setCodeword(s,e),l=r?e.getStartX():e.getEndX())}}return a}static adjustCodewordCount(t,e){let n=e[0][1],r=n.getValue(),o=t.getBarcodeColumnCount()*t.getBarcodeRowCount()-mn.getNumberOfECCodeWords(t.getBarcodeECLevel());if(0===r.length){if(o<1||o>Le.MAX_CODEWORDS_IN_BARCODE)throw T.getNotFoundInstance();n.setValue(o)}else r[0]!==o&&n.setValue(o)}static createDecoderResult(t){let e=mn.createBarcodeMatrix(t);mn.adjustCodewordCount(t,e);let n=new Array,r=new Int32Array(t.getBarcodeRowCount()*t.getBarcodeColumnCount()),o=[],i=new Array;for(let a=0;a<t.getBarcodeRowCount();a++)for(let s=0;s<t.getBarcodeColumnCount();s++){let c=e[a][s+1].getValue(),l=a*t.getBarcodeColumnCount()+s;0===c.length?n.push(l):1===c.length?r[l]=c[0]:(i.push(l),o.push(c))}let a=new Array(o.length);for(let t=0;t<a.length;t++)a[t]=o[t];return mn.createDecoderResultFromAmbiguousValues(t.getBarcodeECLevel(),r,Le.toIntArray(n),Le.toIntArray(i),a)}static createDecoderResultFromAmbiguousValues(t,e,n,r,o){let i=new Int32Array(r.length),a=100;for(;a-- >0;){for(let t=0;t<i.length;t++)e[r[t]]=o[t][i[t]];try{return mn.decodeCodewords(e,t,n)}catch(t){if(!(t instanceof h))throw t}if(0===i.length)throw h.getChecksumInstance();for(let t=0;t<i.length;t++){if(i[t]<o[t].length-1){i[t]++;break}if(i[t]=0,t===i.length-1)throw h.getChecksumInstance()}}throw h.getChecksumInstance()}static createBarcodeMatrix(t){let e=Array.from({length:t.getBarcodeRowCount()},()=>new Array(t.getBarcodeColumnCount()+2));for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)e[t][n]=new Ye;let n=0;for(let r of t.getDetectionResultColumns()){if(null!=r)for(let t of r.getCodewords())if(null!=t){let r=t.getRowNumber();if(r>=0){if(r>=e.length)continue;e[r][n].setValue(t.getValue())}}n++}return e}static isValidBarcodeColumn(t,e){return e>=0&&e<=t.getBarcodeColumnCount()+1}static getStartColumn(t,e,n,r){let o=r?1:-1,i=null;if(mn.isValidBarcodeColumn(t,e-o)&&(i=t.getDetectionResultColumn(e-o).getCodeword(n)),null!=i)return r?i.getEndX():i.getStartX();if(i=t.getDetectionResultColumn(e).getCodewordNearby(n),null!=i)return r?i.getStartX():i.getEndX();if(mn.isValidBarcodeColumn(t,e-o)&&(i=t.getDetectionResultColumn(e-o).getCodewordNearby(n)),null!=i)return r?i.getEndX():i.getStartX();let a=0;for(;mn.isValidBarcodeColumn(t,e-o);){e-=o;for(let n of t.getDetectionResultColumn(e).getCodewords())if(null!=n)return(r?n.getEndX():n.getStartX())+o*a*(n.getEndX()-n.getStartX());a++}return r?t.getBoundingBox().getMinX():t.getBoundingBox().getMaxX()}static detectCodeword(t,e,n,r,o,i,a,s){o=mn.adjustCodewordStartColumn(t,e,n,r,o,i);let c,l=mn.getModuleBitCount(t,e,n,r,o,i);if(null==l)return null;let d=ot.sum(l);if(r)c=o+d;else{for(let t=0;t<l.length/2;t++){let e=l[t];l[t]=l[l.length-1-t],l[l.length-1-t]=e}c=o,o=c-d}if(!mn.checkCodewordSkew(d,a,s))return null;let u=tn.getDecodedValue(l),h=Le.getCodeword(u);return-1===h?null:new Je(o,c,mn.getCodewordBucketNumber(u),h)}static getModuleBitCount(t,e,n,r,o,i){let a=o,s=new Int32Array(8),c=0,l=r?1:-1,d=r;for(;(r?a<n:a>=e)&&c<s.length;)t.get(a,i)===d?(s[c]++,a+=l):(c++,d=!d);return c===s.length||a===(r?n:e)&&c===s.length-1?s:null}static getNumberOfECCodeWords(t){return 2<<t}static adjustCodewordStartColumn(t,e,n,r,o,i){let a=o,s=r?-1:1;for(let c=0;c<2;c++){for(;(r?a>=e:a<n)&&r===t.get(a,i);){if(Math.abs(o-a)>mn.CODEWORD_SKEW_SIZE)return o;a+=s}s=-s,r=!r}return a}static checkCodewordSkew(t,e,n){return e-mn.CODEWORD_SKEW_SIZE<=t&&t<=n+mn.CODEWORD_SKEW_SIZE}static decodeCodewords(t,e,n){if(0===t.length)throw v.getFormatInstance();let r=1<<e+1,o=mn.correctErrors(t,n,r);mn.verifyCodewordCount(t,r);let i=hn.decode(t,""+e);return i.setErrorsCorrected(o),i.setErasures(n.length),i}static correctErrors(t,e,n){if(null!=e&&e.length>n/2+mn.MAX_ERRORS||n<0||n>mn.MAX_EC_CODEWORDS)throw h.getChecksumInstance();return mn.errorCorrection.decode(t,n,e)}static verifyCodewordCount(t,e){if(t.length<4)throw v.getFormatInstance();let n=t[0];if(n>t.length)throw v.getFormatInstance();if(0===n){if(!(e<t.length))throw v.getFormatInstance();t[0]=t.length-e}}static getBitCountForCodeword(t){let e=new Int32Array(8),n=0,r=e.length-1;for(;!((1&t)!==n&&(n=1&t,r--,r<0));)e[r]++,t>>=1;return e}static getCodewordBucketNumber(t){return t instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(t):this.getCodewordBucketNumber_number(t)}static getCodewordBucketNumber_number(t){return mn.getCodewordBucketNumber(mn.getBitCountForCodeword(t))}static getCodewordBucketNumber_Int32Array(t){return(t[0]-t[2]+t[4]-t[6]+9)%9}static toString(t){let e=new Xe;for(let n=0;n<t.length;n++){e.format("Row %2d: ",n);for(let r=0;r<t[n].length;r++){let o=t[n][r];0===o.getValue().length?e.format(" ",null):e.format("%4d(%2d)",o.getValue()[0],o.getConfidence(o.getValue()[0]))}e.format("%n")}return e.toString()}}mn.CODEWORD_SKEW_SIZE=2,mn.MAX_ERRORS=3,mn.MAX_EC_CODEWORDS=512,mn.errorCorrection=new We;class fn{decode(t,e=null){let n=fn.decode(t,e,!1);if(null==n||0===n.length||null==n[0])throw T.getNotFoundInstance();return n[0]}decodeMultiple(t,e=null){try{return fn.decode(t,e,!0)}catch(t){if(t instanceof v||t instanceof h)throw T.getNotFoundInstance();throw t}}static decode(t,e,n){const r=new Array,o=Ve.detectMultiple(t,e,n);for(const t of o.getPoints()){const e=mn.decode(o.getBits(),t[4],t[5],t[6],t[7],fn.getMinCodewordWidth(t),fn.getMaxCodewordWidth(t)),n=new L(e.getText(),e.getRawBytes(),void 0,t,V.PDF_417);n.putMetadata(X.ERROR_CORRECTION_LEVEL,e.getECLevel());const i=e.getOther();null!=i&&n.putMetadata(X.PDF417_EXTRA_METADATA,i),r.push(n)}return r.map(t=>t)}static getMaxWidth(t,e){return null==t||null==e?0:Math.trunc(Math.abs(t.getX()-e.getX()))}static getMinWidth(t,e){return null==t||null==e?w.MAX_VALUE:Math.trunc(Math.abs(t.getX()-e.getX()))}static getMaxCodewordWidth(t){return Math.floor(Math.max(Math.max(fn.getMaxWidth(t[0],t[4]),fn.getMaxWidth(t[6],t[2])*Le.MODULES_IN_CODEWORD/Le.MODULES_IN_STOP_PATTERN),Math.max(fn.getMaxWidth(t[1],t[5]),fn.getMaxWidth(t[7],t[3])*Le.MODULES_IN_CODEWORD/Le.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(t){return Math.floor(Math.min(Math.min(fn.getMinWidth(t[0],t[4]),fn.getMinWidth(t[6],t[2])*Le.MODULES_IN_CODEWORD/Le.MODULES_IN_STOP_PATTERN),Math.min(fn.getMinWidth(t[1],t[5]),fn.getMinWidth(t[7],t[3])*Le.MODULES_IN_CODEWORD/Le.MODULES_IN_STOP_PATTERN)))}reset(){}}class pn extends c{}pn.kind="ReaderException";class _n{constructor(t,e){this.verbose=!0===t,e&&this.setHints(e)}decode(t,e){return e&&this.setHints(e),this.decodeInternal(t)}decodeWithState(t){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(t)}setHints(t){this.hints=t;const n=!e(t)&&!0===t.get(b.TRY_HARDER),r=e(t)?null:t.get(b.POSSIBLE_FORMATS),o=new Array;if(!e(r)){const e=r.some(t=>t===V.UPC_A||t===V.UPC_E||t===V.EAN_13||t===V.EAN_8||t===V.CODABAR||t===V.CODE_39||t===V.CODE_93||t===V.CODE_128||t===V.ITF||t===V.RSS_14||t===V.RSS_EXPANDED);e&&!n&&o.push(new se(t,this.verbose)),r.includes(V.QR_CODE)&&o.push(new Fe),r.includes(V.DATA_MATRIX)&&o.push(new we),r.includes(V.AZTEC)&&o.push(new _t),r.includes(V.PDF_417)&&o.push(new fn),e&&n&&o.push(new se(t,this.verbose))}0===o.length&&(n||o.push(new se(t,this.verbose)),o.push(new Fe),o.push(new we),o.push(new _t),o.push(new fn),n&&o.push(new se(t,this.verbose))),this.readers=o}reset(){if(null!==this.readers)for(const t of this.readers)t.reset()}decodeInternal(t){if(null===this.readers)throw new pn("No readers where selected, nothing can be read.");for(const e of this.readers)try{return e.decode(t,this.hints)}catch(t){if(t instanceof pn)continue}throw new T("No MultiFormat Readers were able to detect the code.")}}class gn extends F{constructor(t=null,e=500){const n=new _n;n.setHints(t),super(n,e)}decodeBitmap(t){return this.reader.decodeWithState(t)}}class wn extends F{constructor(t=500){super(new fn,t)}}class $n extends F{constructor(t=500){super(new Fe,t)}}var yn;!function(t){t[t.ERROR_CORRECTION=0]="ERROR_CORRECTION",t[t.CHARACTER_SET=1]="CHARACTER_SET",t[t.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",t[t.MIN_SIZE=3]="MIN_SIZE",t[t.MAX_SIZE=4]="MAX_SIZE",t[t.MARGIN=5]="MARGIN",t[t.PDF417_COMPACT=6]="PDF417_COMPACT",t[t.PDF417_COMPACTION=7]="PDF417_COMPACTION",t[t.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",t[t.AZTEC_LAYERS=9]="AZTEC_LAYERS",t[t.QR_VERSION=10]="QR_VERSION"}(yn||(yn={}));var bn=yn;class vn{constructor(t){this.field=t,this.cachedGenerators=[],this.cachedGenerators.push(new Z(t,Int32Array.from([1])))}buildGenerator(t){const e=this.cachedGenerators;if(t>=e.length){let n=e[e.length-1];const r=this.field;for(let o=e.length;o<=t;o++){const t=n.multiply(new Z(r,Int32Array.from([1,r.exp(o-1+r.getGeneratorBase())])));e.push(t),n=t}}return e[t]}encode(t,e){if(0===e)throw new d("No error correction bytes");const n=t.length-e;if(n<=0)throw new d("No data bytes provided");const r=this.buildGenerator(e),o=new Int32Array(n);f.arraycopy(t,0,o,0,n);let i=new Z(this.field,o);i=i.multiplyByMonomial(e,1);const a=i.divide(r)[1].getCoefficients(),s=e-a.length;for(let e=0;e<s;e++)t[n+e]=0;f.arraycopy(a,0,t,n+s,a.length)}}class In{constructor(){}static applyMaskPenaltyRule1(t){return In.applyMaskPenaltyRule1Internal(t,!0)+In.applyMaskPenaltyRule1Internal(t,!1)}static applyMaskPenaltyRule2(t){let e=0;const n=t.getArray(),r=t.getWidth(),o=t.getHeight();for(let t=0;t<o-1;t++){const o=n[t];for(let i=0;i<r-1;i++){const r=o[i];r===o[i+1]&&r===n[t+1][i]&&r===n[t+1][i+1]&&e++}}return In.N2*e}static applyMaskPenaltyRule3(t){let e=0;const n=t.getArray(),r=t.getWidth(),o=t.getHeight();for(let t=0;t<o;t++)for(let i=0;i<r;i++){const a=n[t];i+6<r&&1===a[i]&&0===a[i+1]&&1===a[i+2]&&1===a[i+3]&&1===a[i+4]&&0===a[i+5]&&1===a[i+6]&&(In.isWhiteHorizontal(a,i-4,i)||In.isWhiteHorizontal(a,i+7,i+11))&&e++,t+6<o&&1===n[t][i]&&0===n[t+1][i]&&1===n[t+2][i]&&1===n[t+3][i]&&1===n[t+4][i]&&0===n[t+5][i]&&1===n[t+6][i]&&(In.isWhiteVertical(n,i,t-4,t)||In.isWhiteVertical(n,i,t+7,t+11))&&e++}return e*In.N3}static isWhiteHorizontal(t,e,n){e=Math.max(e,0),n=Math.min(n,t.length);for(let r=e;r<n;r++)if(1===t[r])return!1;return!0}static isWhiteVertical(t,e,n,r){n=Math.max(n,0),r=Math.min(r,t.length);for(let o=n;o<r;o++)if(1===t[o][e])return!1;return!0}static applyMaskPenaltyRule4(t){let e=0;const n=t.getArray(),r=t.getWidth(),o=t.getHeight();for(let t=0;t<o;t++){const o=n[t];for(let t=0;t<r;t++)1===o[t]&&e++}const i=t.getHeight()*t.getWidth();return Math.floor(10*Math.abs(2*e-i)/i)*In.N4}static getDataMaskBit(t,e,n){let r,o;switch(t){case 0:r=n+e&1;break;case 1:r=1&n;break;case 2:r=e%3;break;case 3:r=(n+e)%3;break;case 4:r=Math.floor(n/2)+Math.floor(e/3)&1;break;case 5:o=n*e,r=(1&o)+o%3;break;case 6:o=n*e,r=(1&o)+o%3&1;break;case 7:o=n*e,r=o%3+(n+e&1)&1;break;default:throw new d("Invalid mask pattern: "+t)}return 0===r}static applyMaskPenaltyRule1Internal(t,e){let n=0;const r=e?t.getHeight():t.getWidth(),o=e?t.getWidth():t.getHeight(),i=t.getArray();for(let t=0;t<r;t++){let r=0,a=-1;for(let s=0;s<o;s++){const o=e?i[t][s]:i[s][t];o===a?r++:(r>=5&&(n+=In.N1+(r-5)),r=1,a=o)}r>=5&&(n+=In.N1+(r-5))}return n}}In.N1=3,In.N2=3,In.N3=40,In.N4=10;class Cn{constructor(t,e){this.width=t,this.height=e;const n=new Array(e);for(let r=0;r!==e;r++)n[r]=new Uint8Array(t);this.bytes=n}getHeight(){return this.height}getWidth(){return this.width}get(t,e){return this.bytes[e][t]}getArray(){return this.bytes}setNumber(t,e,n){this.bytes[e][t]=n}setBoolean(t,e,n){this.bytes[e][t]=n?1:0}clear(t){for(const e of this.bytes)g.fill(e,t)}equals(t){if(!(t instanceof Cn))return!1;const e=t;if(this.width!==e.width)return!1;if(this.height!==e.height)return!1;for(let t=0,n=this.height;t<n;++t){const n=this.bytes[t],r=e.bytes[t];for(let t=0,e=this.width;t<e;++t)if(n[t]!==r[t])return!1}return!0}toString(){const t=new S;for(let e=0,n=this.height;e<n;++e){const n=this.bytes[e];for(let e=0,r=this.width;e<r;++e)switch(n[e]){case 0:t.append(" 0");break;case 1:t.append(" 1");break;default:t.append(" ")}t.append("\n")}return t.toString()}}class En{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const t=new S;return t.append("<<\n"),t.append(" mode: "),t.append(this.mode?this.mode.toString():"null"),t.append("\n ecLevel: "),t.append(this.ecLevel?this.ecLevel.toString():"null"),t.append("\n version: "),t.append(this.version?this.version.toString():"null"),t.append("\n maskPattern: "),t.append(this.maskPattern.toString()),this.matrix?(t.append("\n matrix:\n"),t.append(this.matrix.toString())):t.append("\n matrix: null\n"),t.append(">>\n"),t.toString()}setMode(t){this.mode=t}setECLevel(t){this.ecLevel=t}setVersion(t){this.version=t}setMaskPattern(t){this.maskPattern=t}setMatrix(t){this.matrix=t}static isValidMaskPattern(t){return t>=0&&t<En.NUM_MASK_PATTERNS}}En.NUM_MASK_PATTERNS=8;class An extends c{}An.kind="WriterException";class Sn{constructor(){}static clearMatrix(t){t.clear(255)}static buildMatrix(t,e,n,r,o){Sn.clearMatrix(o),Sn.embedBasicPatterns(n,o),Sn.embedTypeInfo(e,r,o),Sn.maybeEmbedVersionInfo(n,o),Sn.embedDataBits(t,r,o)}static embedBasicPatterns(t,e){Sn.embedPositionDetectionPatternsAndSeparators(e),Sn.embedDarkDotAtLeftBottomCorner(e),Sn.maybeEmbedPositionAdjustmentPatterns(t,e),Sn.embedTimingPatterns(e)}static embedTypeInfo(t,e,n){const r=new $;Sn.makeTypeInfoBits(t,e,r);for(let t=0,e=r.getSize();t<e;++t){const e=r.get(r.getSize()-1-t),o=Sn.TYPE_INFO_COORDINATES[t],i=o[0],a=o[1];if(n.setBoolean(i,a,e),t<8){const r=n.getWidth()-t-1,o=8;n.setBoolean(r,o,e)}else{const r=8,o=n.getHeight()-7+(t-8);n.setBoolean(r,o,e)}}}static maybeEmbedVersionInfo(t,e){if(t.getVersionNumber()<7)return;const n=new $;Sn.makeVersionInfoBits(t,n);let r=17;for(let t=0;t<6;++t)for(let o=0;o<3;++o){const i=n.get(r);r--,e.setBoolean(t,e.getHeight()-11+o,i),e.setBoolean(e.getHeight()-11+o,t,i)}}static embedDataBits(t,e,n){let r=0,o=-1,i=n.getWidth()-1,a=n.getHeight()-1;for(;i>0;){for(6===i&&(i-=1);a>=0&&a<n.getHeight();){for(let o=0;o<2;++o){const s=i-o;if(!Sn.isEmpty(n.get(s,a)))continue;let c;r<t.getSize()?(c=t.get(r),++r):c=!1,255!==e&&In.getDataMaskBit(e,s,a)&&(c=!c),n.setBoolean(s,a,c)}a+=o}o=-o,a+=o,i-=2}if(r!==t.getSize())throw new An("Not all bits consumed: "+r+"/"+t.getSize())}static findMSBSet(t){return 32-w.numberOfLeadingZeros(t)}static calculateBCHCode(t,e){if(0===e)throw new d("0 polynomial");const n=Sn.findMSBSet(e);for(t<<=n-1;Sn.findMSBSet(t)>=n;)t^=e<<Sn.findMSBSet(t)-n;return t}static makeTypeInfoBits(t,e,n){if(!En.isValidMaskPattern(e))throw new An("Invalid mask pattern");const r=t.getBits()<<3|e;n.appendBits(r,5);const o=Sn.calculateBCHCode(r,Sn.TYPE_INFO_POLY);n.appendBits(o,10);const i=new $;if(i.appendBits(Sn.TYPE_INFO_MASK_PATTERN,15),n.xor(i),15!==n.getSize())throw new An("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(t,e){e.appendBits(t.getVersionNumber(),6);const n=Sn.calculateBCHCode(t.getVersionNumber(),Sn.VERSION_INFO_POLY);if(e.appendBits(n,12),18!==e.getSize())throw new An("should not happen but we got: "+e.getSize())}static isEmpty(t){return 255===t}static embedTimingPatterns(t){for(let e=8;e<t.getWidth()-8;++e){const n=(e+1)%2;Sn.isEmpty(t.get(e,6))&&t.setNumber(e,6,n),Sn.isEmpty(t.get(6,e))&&t.setNumber(6,e,n)}}static embedDarkDotAtLeftBottomCorner(t){if(0===t.get(8,t.getHeight()-8))throw new An;t.setNumber(8,t.getHeight()-8,1)}static embedHorizontalSeparationPattern(t,e,n){for(let r=0;r<8;++r){if(!Sn.isEmpty(n.get(t+r,e)))throw new An;n.setNumber(t+r,e,0)}}static embedVerticalSeparationPattern(t,e,n){for(let r=0;r<7;++r){if(!Sn.isEmpty(n.get(t,e+r)))throw new An;n.setNumber(t,e+r,0)}}static embedPositionAdjustmentPattern(t,e,n){for(let r=0;r<5;++r){const o=Sn.POSITION_ADJUSTMENT_PATTERN[r];for(let i=0;i<5;++i)n.setNumber(t+i,e+r,o[i])}}static embedPositionDetectionPattern(t,e,n){for(let r=0;r<7;++r){const o=Sn.POSITION_DETECTION_PATTERN[r];for(let i=0;i<7;++i)n.setNumber(t+i,e+r,o[i])}}static embedPositionDetectionPatternsAndSeparators(t){const e=Sn.POSITION_DETECTION_PATTERN[0].length;Sn.embedPositionDetectionPattern(0,0,t),Sn.embedPositionDetectionPattern(t.getWidth()-e,0,t),Sn.embedPositionDetectionPattern(0,t.getWidth()-e,t);const n=8;Sn.embedHorizontalSeparationPattern(0,n-1,t),Sn.embedHorizontalSeparationPattern(t.getWidth()-n,n-1,t),Sn.embedHorizontalSeparationPattern(0,t.getWidth()-n,t);const r=7;Sn.embedVerticalSeparationPattern(r,0,t),Sn.embedVerticalSeparationPattern(t.getHeight()-r-1,0,t),Sn.embedVerticalSeparationPattern(r,t.getHeight()-r,t)}static maybeEmbedPositionAdjustmentPatterns(t,e){if(t.getVersionNumber()<2)return;const n=t.getVersionNumber()-1,r=Sn.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let t=0,n=r.length;t!==n;t++){const o=r[t];if(o>=0)for(let t=0;t!==n;t++){const n=r[t];n>=0&&Sn.isEmpty(e.get(n,o))&&Sn.embedPositionAdjustmentPattern(n-2,o-2,e)}}}}Sn.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Sn.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Sn.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Sn.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Sn.VERSION_INFO_POLY=7973,Sn.TYPE_INFO_POLY=1335,Sn.TYPE_INFO_MASK_PATTERN=21522;class kn{constructor(t,e){this.dataBytes=t,this.errorCorrectionBytes=e}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Tn{constructor(){}static calculateMaskPenalty(t){return In.applyMaskPenaltyRule1(t)+In.applyMaskPenaltyRule2(t)+In.applyMaskPenaltyRule3(t)+In.applyMaskPenaltyRule4(t)}static encode(t,e,n=null){let r=Tn.DEFAULT_BYTE_MODE_ENCODING;const o=null!==n&&void 0!==n.get(bn.CHARACTER_SET);o&&(r=n.get(bn.CHARACTER_SET).toString());const i=this.chooseMode(t,r),a=new $;if(i===ke.BYTE&&(o||Tn.DEFAULT_BYTE_MODE_ENCODING!==r)){const t=I.getCharacterSetECIByName(r);void 0!==t&&this.appendECI(t,a)}this.appendModeInfo(i,a);const s=new $;let c;if(this.appendBytes(t,i,s,r),null!==n&&void 0!==n.get(bn.QR_VERSION)){const t=Number.parseInt(n.get(bn.QR_VERSION).toString(),10);c=Ce.getVersionForNumber(t);const r=this.calculateBitsNeeded(i,a,s,c);if(!this.willFit(r,c,e))throw new An("Data too big for requested version")}else c=this.recommendVersion(e,i,a,s);const l=new $;l.appendBitArray(a);const d=i===ke.BYTE?s.getSizeInBytes():t.length;this.appendLengthInfo(d,c,i,l),l.appendBitArray(s);const u=c.getECBlocksForLevel(e),h=c.getTotalCodewords()-u.getTotalECCodewords();this.terminateBits(h,l);const m=this.interleaveWithECBytes(l,c.getTotalCodewords(),h,u.getNumBlocks()),f=new En;f.setECLevel(e),f.setMode(i),f.setVersion(c);const p=c.getDimensionForVersion(),_=new Cn(p,p),g=this.chooseMaskPattern(m,e,c,_);return f.setMaskPattern(g),Sn.buildMatrix(m,e,c,g,_),f.setMatrix(_),f}static recommendVersion(t,e,n,r){const o=this.calculateBitsNeeded(e,n,r,Ce.getVersionForNumber(1)),i=this.chooseVersion(o,t),a=this.calculateBitsNeeded(e,n,r,i);return this.chooseVersion(a,t)}static calculateBitsNeeded(t,e,n,r){return e.getSize()+t.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(t){return t<Tn.ALPHANUMERIC_TABLE.length?Tn.ALPHANUMERIC_TABLE[t]:-1}static chooseMode(t,e=null){if(I.SJIS.getName()===e&&this.isOnlyDoubleByteKanji(t))return ke.KANJI;let n=!1,r=!1;for(let e=0,o=t.length;e<o;++e){const o=t.charAt(e);if(Tn.isDigit(o))n=!0;else{if(-1===this.getAlphanumericCode(o.charCodeAt(0)))return ke.BYTE;r=!0}}return r?ke.ALPHANUMERIC:n?ke.NUMERIC:ke.BYTE}static isOnlyDoubleByteKanji(t){let e;try{e=E.encode(t,I.SJIS)}catch(t){return!1}const n=e.length;if(n%2!=0)return!1;for(let t=0;t<n;t+=2){const n=255&e[t];if((n<129||n>159)&&(n<224||n>235))return!1}return!0}static chooseMaskPattern(t,e,n,r){let o=Number.MAX_SAFE_INTEGER,i=-1;for(let a=0;a<En.NUM_MASK_PATTERNS;a++){Sn.buildMatrix(t,e,n,a,r);let s=this.calculateMaskPenalty(r);s<o&&(o=s,i=a)}return i}static chooseVersion(t,e){for(let n=1;n<=40;n++){const r=Ce.getVersionForNumber(n);if(Tn.willFit(t,r,e))return r}throw new An("Data too big")}static willFit(t,e,n){return e.getTotalCodewords()-e.getECBlocksForLevel(n).getTotalECCodewords()>=(t+7)/8}static terminateBits(t,e){const n=8*t;if(e.getSize()>n)throw new An("data bits cannot fit in the QR Code"+e.getSize()+" > "+n);for(let t=0;t<4&&e.getSize()<n;++t)e.appendBit(!1);const r=7&e.getSize();if(r>0)for(let t=r;t<8;t++)e.appendBit(!1);const o=t-e.getSizeInBytes();for(let t=0;t<o;++t)e.appendBits(1&t?17:236,8);if(e.getSize()!==n)throw new An("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(t,e,n,r,o,i){if(r>=n)throw new An("Block ID too large");const a=t%n,s=n-a,c=Math.floor(t/n),l=c+1,d=Math.floor(e/n),u=d+1,h=c-d,m=l-u;if(h!==m)throw new An("EC bytes mismatch");if(n!==s+a)throw new An("RS blocks mismatch");if(t!==(d+h)*s+(u+m)*a)throw new An("Total bytes mismatch");r<s?(o[0]=d,i[0]=h):(o[0]=u,i[0]=m)}static interleaveWithECBytes(t,e,n,r){if(t.getSizeInBytes()!==n)throw new An("Number of bits and data bytes does not match");let o=0,i=0,a=0;const s=new Array;for(let c=0;c<r;++c){const l=new Int32Array(1),d=new Int32Array(1);Tn.getNumDataBytesAndNumECBytesForBlockID(e,n,r,c,l,d);const u=l[0],h=new Uint8Array(u);t.toBytes(8*o,h,0,u);const m=Tn.generateECBytes(h,d[0]);s.push(new kn(h,m)),i=Math.max(i,u),a=Math.max(a,m.length),o+=l[0]}if(n!==o)throw new An("Data bytes does not match offset");const c=new $;for(let t=0;t<i;++t)for(const e of s){const n=e.getDataBytes();t<n.length&&c.appendBits(n[t],8)}for(let t=0;t<a;++t)for(const e of s){const n=e.getErrorCorrectionBytes();t<n.length&&c.appendBits(n[t],8)}if(e!==c.getSizeInBytes())throw new An("Interleaving error: "+e+" and "+c.getSizeInBytes()+" differ.");return c}static generateECBytes(t,e){const n=t.length,r=new Int32Array(n+e);for(let e=0;e<n;e++)r[e]=255&t[e];new vn(J.QR_CODE_FIELD_256).encode(r,e);const o=new Uint8Array(e);for(let t=0;t<e;t++)o[t]=r[n+t];return o}static appendModeInfo(t,e){e.appendBits(t.getBits(),4)}static appendLengthInfo(t,e,n,r){const o=n.getCharacterCountBits(e);if(t>=1<<o)throw new An(t+" is bigger than "+((1<<o)-1));r.appendBits(t,o)}static appendBytes(t,e,n,r){switch(e){case ke.NUMERIC:Tn.appendNumericBytes(t,n);break;case ke.ALPHANUMERIC:Tn.appendAlphanumericBytes(t,n);break;case ke.BYTE:Tn.append8BitBytes(t,n,r);break;case ke.KANJI:Tn.appendKanjiBytes(t,n);break;default:throw new An("Invalid mode: "+e)}}static getDigit(t){return t.charCodeAt(0)-48}static isDigit(t){const e=Tn.getDigit(t);return e>=0&&e<=9}static appendNumericBytes(t,e){const n=t.length;let r=0;for(;r<n;){const o=Tn.getDigit(t.charAt(r));if(r+2<n){const n=Tn.getDigit(t.charAt(r+1)),i=Tn.getDigit(t.charAt(r+2));e.appendBits(100*o+10*n+i,10),r+=3}else if(r+1<n){const n=Tn.getDigit(t.charAt(r+1));e.appendBits(10*o+n,7),r+=2}else e.appendBits(o,4),r++}}static appendAlphanumericBytes(t,e){const n=t.length;let r=0;for(;r<n;){const o=Tn.getAlphanumericCode(t.charCodeAt(r));if(-1===o)throw new An;if(r+1<n){const n=Tn.getAlphanumericCode(t.charCodeAt(r+1));if(-1===n)throw new An;e.appendBits(45*o+n,11),r+=2}else e.appendBits(o,6),r++}}static append8BitBytes(t,e,n){let r;try{r=E.encode(t,n)}catch(t){throw new An(t)}for(let t=0,n=r.length;t!==n;t++){const n=r[t];e.appendBits(n,8)}}static appendKanjiBytes(t,e){let n;try{n=E.encode(t,I.SJIS)}catch(t){throw new An(t)}const r=n.length;for(let t=0;t<r;t+=2){const r=(255&n[t])<<8&4294967295|255&n[t+1];let o=-1;if(r>=33088&&r<=40956?o=r-33088:r>=57408&&r<=60351&&(o=r-49472),-1===o)throw new An("Invalid byte sequence");const i=192*(o>>8)+(255&o);e.appendBits(i,13)}}static appendECI(t,e){e.appendBits(ke.ECI.getBits(),4),e.appendBits(t.getValue(),8)}}Tn.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Tn.DEFAULT_BYTE_MODE_ENCODING=I.UTF8.getName();class Rn{write(t,e,n,r=null){if(0===t.length)throw new d("Found empty contents");if(e<0||n<0)throw new d("Requested dimensions are too small: "+e+"x"+n);let o=ye.L,i=Rn.QUIET_ZONE_SIZE;null!==r&&(void 0!==r.get(bn.ERROR_CORRECTION)&&(o=ye.fromString(r.get(bn.ERROR_CORRECTION).toString())),void 0!==r.get(bn.MARGIN)&&(i=Number.parseInt(r.get(bn.MARGIN).toString(),10)));const a=Tn.encode(t,o,r);return this.renderResult(a,e,n,i)}writeToDom(t,e,n,r,o=null){"string"==typeof t&&(t=document.querySelector(t));const i=this.write(e,n,r,o);t&&t.appendChild(i)}renderResult(t,e,n,r){const o=t.getMatrix();if(null===o)throw new et;const i=o.getWidth(),a=o.getHeight(),s=i+2*r,c=a+2*r,l=Math.max(e,s),d=Math.max(n,c),u=Math.min(Math.floor(l/s),Math.floor(d/c)),h=Math.floor((l-i*u)/2),m=Math.floor((d-a*u)/2),f=this.createSVGElement(l,d);for(let t=0,e=m;t<a;t++,e+=u)for(let n=0,r=h;n<i;n++,r+=u)if(1===o.get(n,t)){const t=this.createSvgRectElement(r,e,u,u);f.appendChild(t)}return f}createSVGElement(t,e){const n=document.createElementNS(Rn.SVG_NS,"svg");return n.setAttributeNS(null,"height",t.toString()),n.setAttributeNS(null,"width",e.toString()),n}createSvgRectElement(t,e,n,r){const o=document.createElementNS(Rn.SVG_NS,"rect");return o.setAttributeNS(null,"x",t.toString()),o.setAttributeNS(null,"y",e.toString()),o.setAttributeNS(null,"height",n.toString()),o.setAttributeNS(null,"width",r.toString()),o.setAttributeNS(null,"fill","#000000"),o}}Rn.QUIET_ZONE_SIZE=4,Rn.SVG_NS="http://www.w3.org/2000/svg";class Nn{encode(t,e,n,r,o){if(0===t.length)throw new d("Found empty contents");if(e!==V.QR_CODE)throw new d("Can only encode QR_CODE, but got "+e);if(n<0||r<0)throw new d(`Requested dimensions are too small: ${n}x${r}`);let i=ye.L,a=Nn.QUIET_ZONE_SIZE;null!==o&&(void 0!==o.get(bn.ERROR_CORRECTION)&&(i=ye.fromString(o.get(bn.ERROR_CORRECTION).toString())),void 0!==o.get(bn.MARGIN)&&(a=Number.parseInt(o.get(bn.MARGIN).toString(),10)));const s=Tn.encode(t,i,o);return Nn.renderResult(s,n,r,a)}static renderResult(t,e,n,r){const o=t.getMatrix();if(null===o)throw new et;const i=o.getWidth(),a=o.getHeight(),s=i+2*r,c=a+2*r,l=Math.max(e,s),d=Math.max(n,c),u=Math.min(Math.floor(l/s),Math.floor(d/c)),h=Math.floor((l-i*u)/2),m=Math.floor((d-a*u)/2),f=new k(l,d);for(let t=0,e=m;t<a;t++,e+=u)for(let n=0,r=h;n<i;n++,r+=u)1===o.get(n,t)&&f.setRegion(r,e,u,u);return f}}Nn.QUIET_ZONE_SIZE=4;class Dn{encode(t,e,n,r,o){let i;if(e!==V.QR_CODE)throw new d("No encoder available for format "+e);return i=new Nn,i.encode(t,e,n,r,o)}}class xn extends D{constructor(t,e,n,r,o,i,a,s){if(super(i,a),this.yuvData=t,this.dataWidth=e,this.dataHeight=n,this.left=r,this.top=o,r+i>e||o+a>n)throw new d("Crop rectangle does not fit within image data.");s&&this.reverseHorizontal(i,a)}getRow(t,e){if(t<0||t>=this.getHeight())throw new d("Requested row is outside the image: "+t);const n=this.getWidth();(null==e||e.length<n)&&(e=new Uint8ClampedArray(n));const r=(t+this.top)*this.dataWidth+this.left;return f.arraycopy(this.yuvData,r,e,0,n),e}getMatrix(){const t=this.getWidth(),e=this.getHeight();if(t===this.dataWidth&&e===this.dataHeight)return this.yuvData;const n=t*e,r=new Uint8ClampedArray(n);let o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return f.arraycopy(this.yuvData,o,r,0,n),r;for(let n=0;n<e;n++){const e=n*t;f.arraycopy(this.yuvData,o,r,e,t),o+=this.dataWidth}return r}isCropSupported(){return!0}crop(t,e,n,r){return new xn(this.yuvData,this.dataWidth,this.dataHeight,this.left+t,this.top+e,n,r,!1)}renderThumbnail(){const t=this.getWidth()/xn.THUMBNAIL_SCALE_FACTOR,e=this.getHeight()/xn.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(t*e),r=this.yuvData;let o=this.top*this.dataWidth+this.left;for(let i=0;i<e;i++){const e=i*t;for(let i=0;i<t;i++){const t=255&r[o+i*xn.THUMBNAIL_SCALE_FACTOR];n[e+i]=4278190080|65793*t}o+=this.dataWidth*xn.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/xn.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/xn.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(t,e){const n=this.yuvData;for(let r=0,o=this.top*this.dataWidth+this.left;r<e;r++,o+=this.dataWidth){const e=o+t/2;for(let r=o,i=o+t-1;r<e;r++,i--){const t=n[r];n[r]=n[i],n[i]=t}}}invert(){return new x(this)}}xn.THUMBNAIL_SCALE_FACTOR=2;class On extends D{constructor(t,e,n,r,o,i,a){if(super(e,n),this.dataWidth=r,this.dataHeight=o,this.left=i,this.top=a,4===t.BYTES_PER_ELEMENT){const r=e*n,o=new Uint8ClampedArray(r);for(let e=0;e<r;e++){const n=t[e],r=n>>16&255,i=n>>7&510,a=255&n;o[e]=(r+i+a)/4&255}this.luminances=o}else this.luminances=t;if(void 0===r&&(this.dataWidth=e),void 0===o&&(this.dataHeight=n),void 0===i&&(this.left=0),void 0===a&&(this.top=0),this.left+e>this.dataWidth||this.top+n>this.dataHeight)throw new d("Crop rectangle does not fit within image data.")}getRow(t,e){if(t<0||t>=this.getHeight())throw new d("Requested row is outside the image: "+t);const n=this.getWidth();(null==e||e.length<n)&&(e=new Uint8ClampedArray(n));const r=(t+this.top)*this.dataWidth+this.left;return f.arraycopy(this.luminances,r,e,0,n),e}getMatrix(){const t=this.getWidth(),e=this.getHeight();if(t===this.dataWidth&&e===this.dataHeight)return this.luminances;const n=t*e,r=new Uint8ClampedArray(n);let o=this.top*this.dataWidth+this.left;if(t===this.dataWidth)return f.arraycopy(this.luminances,o,r,0,n),r;for(let n=0;n<e;n++){const e=n*t;f.arraycopy(this.luminances,o,r,e,t),o+=this.dataWidth}return r}isCropSupported(){return!0}crop(t,e,n,r){return new On(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+t,this.top+e)}invert(){return new x(this)}}class Mn extends I{static forName(t){return this.getCharacterSetECIByName(t)}}class Pn{}Pn.ISO_8859_1=I.ISO8859_1;class Bn{isCompact(){return this.compact}setCompact(t){this.compact=t}getSize(){return this.size}setSize(t){this.size=t}getLayers(){return this.layers}setLayers(t){this.layers=t}getCodeWords(){return this.codeWords}setCodeWords(t){this.codeWords=t}getMatrix(){return this.matrix}setMatrix(t){this.matrix=t}}class Fn{static singletonList(t){return[t]}static min(t,e){return t.sort(e)[0]}}class Ln{constructor(t){this.previous=t}getPrevious(){return this.previous}}class qn extends Ln{constructor(t,e,n){super(t),this.value=e,this.bitCount=n}appendTo(t,e){t.appendBits(this.value,this.bitCount)}add(t,e){return new qn(this,t,e)}addBinaryShift(t,e){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new qn(this,t,e)}toString(){let t=this.value&(1<<this.bitCount)-1;return t|=1<<this.bitCount,"<"+w.toBinaryString(t|1<<this.bitCount).substring(1)+">"}}class Vn extends qn{constructor(t,e,n){super(t,0,0),this.binaryShiftStart=e,this.binaryShiftByteCount=n}appendTo(t,e){for(let n=0;n<this.binaryShiftByteCount;n++)(0===n||31===n&&this.binaryShiftByteCount<=62)&&(t.appendBits(31,5),this.binaryShiftByteCount>62?t.appendBits(this.binaryShiftByteCount-31,16):0===n?t.appendBits(Math.min(this.binaryShiftByteCount,31),5):t.appendBits(this.binaryShiftByteCount-31,5)),t.appendBits(e[this.binaryShiftStart+n],8)}addBinaryShift(t,e){return new Vn(this,t,e)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Hn(t,e,n){return new Vn(t,e,n)}function Un(t,e,n){return new qn(t,e,n)}const zn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Wn=0,jn=1,Gn=2,Xn=3,Qn=4,Yn=new qn(null,0,0),Zn=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];function Kn(t){for(let e of t)g.fill(e,-1);return t[Wn][Qn]=0,t[jn][Qn]=0,t[jn][Wn]=28,t[Xn][Qn]=0,t[Gn][Qn]=0,t[Gn][Wn]=15,t}const Jn=Kn(g.createInt32Array(6,6));class tr{constructor(t,e,n,r){this.token=t,this.mode=e,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(t,e){let n=this.bitCount,r=this.token;if(t!==this.mode){let e=Zn[this.mode][t];r=Un(r,65535&e,e>>16),n+=e>>16}let o=t===Gn?4:5;return r=Un(r,e,o),new tr(r,t,0,n+o)}shiftAndAppend(t,e){let n=this.token,r=this.mode===Gn?4:5;return n=Un(n,Jn[this.mode][t],r),n=Un(n,e,5),new tr(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(t){let e=this.token,n=this.mode,r=this.bitCount;if(this.mode===Qn||this.mode===Gn){let t=Zn[n][Wn];e=Un(e,65535&t,t>>16),r+=t>>16,n=Wn}let o=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,i=new tr(e,n,this.binaryShiftByteCount+1,r+o);return 2078===i.binaryShiftByteCount&&(i=i.endBinaryShift(t+1)),i}endBinaryShift(t){if(0===this.binaryShiftByteCount)return this;let e=this.token;return e=Hn(e,t-this.binaryShiftByteCount,this.binaryShiftByteCount),new tr(e,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(t){let e=this.bitCount+(Zn[this.mode][t.mode]>>16);return this.binaryShiftByteCount<t.binaryShiftByteCount?e+=tr.calculateBinaryShiftCost(t)-tr.calculateBinaryShiftCost(this):this.binaryShiftByteCount>t.binaryShiftByteCount&&t.binaryShiftByteCount>0&&(e+=10),e<=t.bitCount}toBitArray(t){let e=[];for(let n=this.endBinaryShift(t.length).token;null!==n;n=n.getPrevious())e.unshift(n);let n=new $;for(const r of e)r.appendTo(n,t);return n}toString(){return A.format("%s bits=%d bytes=%d",zn[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(t){return t.binaryShiftByteCount>62?21:t.binaryShiftByteCount>31?20:t.binaryShiftByteCount>0?10:0}}function er(t){const e=A.getCharCode(" "),n=A.getCharCode("."),r=A.getCharCode(",");t[Wn][e]=1;const o=A.getCharCode("Z"),i=A.getCharCode("A");for(let e=i;e<=o;e++)t[Wn][e]=e-i+2;t[jn][e]=1;const a=A.getCharCode("z"),s=A.getCharCode("a");for(let e=s;e<=a;e++)t[jn][e]=e-s+2;t[Gn][e]=1;const c=A.getCharCode("9"),l=A.getCharCode("0");for(let e=l;e<=c;e++)t[Gn][e]=e-l+2;t[Gn][r]=12,t[Gn][n]=13;const d=["\0"," ","","","","","","","","\b","\t","\n","\v","\f","\r","","","","","","@","\\","^","_","`","|","~",""];for(let e=0;e<d.length;e++)t[Xn][A.getCharCode(d[e])]=e;const u=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let e=0;e<u.length;e++)A.getCharCode(u[e])>0&&(t[Qn][A.getCharCode(u[e])]=e);return t}tr.INITIAL_STATE=new tr(Yn,Wn,0,0);const nr=er(g.createInt32Array(5,256));class rr{constructor(t){this.text=t}encode(){const t=A.getCharCode(" "),e=A.getCharCode("\n");let n=Fn.singletonList(tr.INITIAL_STATE);for(let r=0;r<this.text.length;r++){let o,i=r+1<this.text.length?this.text[r+1]:0;switch(this.text[r]){case A.getCharCode("\r"):o=i===e?2:0;break;case A.getCharCode("."):o=i===t?3:0;break;case A.getCharCode(","):o=i===t?4:0;break;case A.getCharCode(":"):o=i===t?5:0;break;default:o=0}o>0?(n=rr.updateStateListForPair(n,r,o),r++):n=this.updateStateListForChar(n,r)}return Fn.min(n,(t,e)=>t.getBitCount()-e.getBitCount()).toBitArray(this.text)}updateStateListForChar(t,e){const n=[];for(let r of t)this.updateStateForChar(r,e,n);return rr.simplifyStates(n)}updateStateForChar(t,e,n){let r=255&this.text[e],o=nr[t.getMode()][r]>0,i=null;for(let a=0;a<=Qn;a++){let s=nr[a][r];if(s>0){if(null==i&&(i=t.endBinaryShift(e)),!o||a===t.getMode()||a===Gn){const t=i.latchAndAppend(a,s);n.push(t)}if(!o&&Jn[t.getMode()][a]>=0){const t=i.shiftAndAppend(a,s);n.push(t)}}}if(t.getBinaryShiftByteCount()>0||0===nr[t.getMode()][r]){let r=t.addBinaryShiftChar(e);n.push(r)}}static updateStateListForPair(t,e,n){const r=[];for(let o of t)this.updateStateForPair(o,e,n,r);return this.simplifyStates(r)}static updateStateForPair(t,e,n,r){let o=t.endBinaryShift(e);if(r.push(o.latchAndAppend(Qn,n)),t.getMode()!==Qn&&r.push(o.shiftAndAppend(Qn,n)),3===n||4===n){let t=o.latchAndAppend(Gn,16-n).latchAndAppend(Gn,1);r.push(t)}if(t.getBinaryShiftByteCount()>0){let n=t.addBinaryShiftChar(e).addBinaryShiftChar(e+1);r.push(n)}}static simplifyStates(t){let e=[];for(const n of t){let t=!0;for(const r of e){if(r.isBetterThanOrEqualTo(n)){t=!1;break}n.isBetterThanOrEqualTo(r)&&(e=e.filter(t=>t!==r))}t&&e.push(n)}return e}}class or{constructor(){}static encodeBytes(t){return or.encode(t,or.DEFAULT_EC_PERCENT,or.DEFAULT_AZTEC_LAYERS)}static encode(t,e,n){let r,o,i,a,s,c=new rr(t).encode(),l=w.truncDivision(c.getSize()*e,100)+11,u=c.getSize()+l;if(n!==or.DEFAULT_AZTEC_LAYERS){if(r=n<0,o=Math.abs(n),o>(r?or.MAX_NB_BITS_COMPACT:or.MAX_NB_BITS))throw new d(A.format("Illegal value %s for layers",n));i=or.totalBitsInLayer(o,r),a=or.WORD_SIZE[o];let t=i-i%a;if(s=or.stuffBits(c,a),s.getSize()+l>t)throw new d("Data to large for user specified layer");if(r&&s.getSize()>64*a)throw new d("Data to large for user specified layer")}else{a=0,s=null;for(let t=0;;t++){if(t>or.MAX_NB_BITS)throw new d("Data too large for an Aztec code");if(r=t<=3,o=r?t+1:t,i=or.totalBitsInLayer(o,r),u>i)continue;null!=s&&a===or.WORD_SIZE[o]||(a=or.WORD_SIZE[o],s=or.stuffBits(c,a));let e=i-i%a;if(!(r&&s.getSize()>64*a)&&s.getSize()+l<=e)break}}let h,m=or.generateCheckWords(s,i,a),f=s.getSize()/a,p=or.generateModeMessage(r,o,f),_=(r?11:14)+4*o,g=new Int32Array(_);if(r){h=_;for(let t=0;t<g.length;t++)g[t]=t}else{h=_+1+2*w.truncDivision(w.truncDivision(_,2)-1,15);let t=w.truncDivision(_,2),e=w.truncDivision(h,2);for(let n=0;n<t;n++){let r=n+w.truncDivision(n,15);g[t-n-1]=e-r-1,g[t+n]=e+r+1}}let $=new k(h);for(let t=0,e=0;t<o;t++){let n=4*(o-t)+(r?9:12);for(let r=0;r<n;r++){let o=2*r;for(let i=0;i<2;i++)m.get(e+o+i)&&$.set(g[2*t+i],g[2*t+r]),m.get(e+2*n+o+i)&&$.set(g[2*t+r],g[_-1-2*t-i]),m.get(e+4*n+o+i)&&$.set(g[_-1-2*t-i],g[_-1-2*t-r]),m.get(e+6*n+o+i)&&$.set(g[_-1-2*t-r],g[2*t+i])}e+=8*n}if(or.drawModeMessage($,r,h,p),r)or.drawBullsEye($,w.truncDivision(h,2),5);else{or.drawBullsEye($,w.truncDivision(h,2),7);for(let t=0,e=0;t<w.truncDivision(_,2)-1;t+=15,e+=16)for(let t=1&w.truncDivision(h,2);t<h;t+=2)$.set(w.truncDivision(h,2)-e,t),$.set(w.truncDivision(h,2)+e,t),$.set(t,w.truncDivision(h,2)-e),$.set(t,w.truncDivision(h,2)+e)}let y=new Bn;return y.setCompact(r),y.setSize(h),y.setLayers(o),y.setCodeWords(f),y.setMatrix($),y}static drawBullsEye(t,e,n){for(let r=0;r<n;r+=2)for(let n=e-r;n<=e+r;n++)t.set(n,e-r),t.set(n,e+r),t.set(e-r,n),t.set(e+r,n);t.set(e-n,e-n),t.set(e-n+1,e-n),t.set(e-n,e-n+1),t.set(e+n,e-n),t.set(e+n,e-n+1),t.set(e+n,e+n-1)}static generateModeMessage(t,e,n){let r=new $;return t?(r.appendBits(e-1,2),r.appendBits(n-1,6),r=or.generateCheckWords(r,28,4)):(r.appendBits(e-1,5),r.appendBits(n-1,11),r=or.generateCheckWords(r,40,4)),r}static drawModeMessage(t,e,n,r){let o=w.truncDivision(n,2);if(e)for(let e=0;e<7;e++){let n=o-3+e;r.get(e)&&t.set(n,o-5),r.get(e+7)&&t.set(o+5,n),r.get(20-e)&&t.set(n,o+5),r.get(27-e)&&t.set(o-5,n)}else for(let e=0;e<10;e++){let n=o-5+e+w.truncDivision(e,5);r.get(e)&&t.set(n,o-7),r.get(e+10)&&t.set(o+7,n),r.get(29-e)&&t.set(n,o+7),r.get(39-e)&&t.set(o-7,n)}}static generateCheckWords(t,e,n){let r=t.getSize()/n,o=new vn(or.getGF(n)),i=w.truncDivision(e,n),a=or.bitsToWords(t,n,i);o.encode(a,i-r);let s=e%n,c=new $;c.appendBits(0,s);for(const t of Array.from(a))c.appendBits(t,n);return c}static bitsToWords(t,e,n){let r,o,i=new Int32Array(n);for(r=0,o=t.getSize()/e;r<o;r++){let n=0;for(let o=0;o<e;o++)n|=t.get(r*e+o)?1<<e-o-1:0;i[r]=n}return i}static getGF(t){switch(t){case 4:return J.AZTEC_PARAM;case 6:return J.AZTEC_DATA_6;case 8:return J.AZTEC_DATA_8;case 10:return J.AZTEC_DATA_10;case 12:return J.AZTEC_DATA_12;default:throw new d("Unsupported word size "+t)}}static stuffBits(t,e){let n=new $,r=t.getSize(),o=(1<<e)-2;for(let i=0;i<r;i+=e){let a=0;for(let n=0;n<e;n++)(i+n>=r||t.get(i+n))&&(a|=1<<e-1-n);(a&o)===o?(n.appendBits(a&o,e),i--):0===(a&o)?(n.appendBits(1|a,e),i--):n.appendBits(a,e)}return n}static totalBitsInLayer(t,e){return((e?88:112)+16*t)*t}}or.DEFAULT_EC_PERCENT=33,or.DEFAULT_AZTEC_LAYERS=0,or.MAX_NB_BITS=32,or.MAX_NB_BITS_COMPACT=4,or.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class ir{encode(t,e,n,r){return this.encodeWithHints(t,e,n,r,null)}encodeWithHints(t,e,n,r,o){let i=Pn.ISO_8859_1,a=or.DEFAULT_EC_PERCENT,s=or.DEFAULT_AZTEC_LAYERS;return null!=o&&(o.has(bn.CHARACTER_SET)&&(i=Mn.forName(o.get(bn.CHARACTER_SET).toString())),o.has(bn.ERROR_CORRECTION)&&(a=w.parseInt(o.get(bn.ERROR_CORRECTION).toString())),o.has(bn.AZTEC_LAYERS)&&(s=w.parseInt(o.get(bn.AZTEC_LAYERS).toString()))),ir.encodeLayers(t,e,n,r,i,a,s)}static encodeLayers(t,e,n,r,o,i,a){if(e!==V.AZTEC)throw new d("Can only encode AZTEC, but got "+e);let s=or.encode(A.getBytes(t,o),i,a);return ir.renderResult(s,n,r)}static renderResult(t,e,n){let r=t.getMatrix();if(null==r)throw new et;let o=r.getWidth(),i=r.getHeight(),a=Math.max(e,o),s=Math.max(n,i),c=Math.min(a/o,s/i),l=(a-o*c)/2,d=(s-i*c)/2,u=new k(a,s);for(let t=0,e=d;t<i;t++,e+=c)for(let n=0,i=l;n<o;n++,i+=c)r.get(n,t)&&u.setRegion(i,e,c,c);return u}}t.AbstractExpandedDecoder=zt,t.ArgumentException=l,t.ArithmeticException=K,t.AztecCode=Bn,t.AztecCodeReader=_t,t.AztecCodeWriter=ir,t.AztecDecoder=rt,t.AztecDetector=pt,t.AztecDetectorResult=ct,t.AztecEncoder=or,t.AztecHighLevelEncoder=rr,t.AztecPoint=ft,t.BarcodeFormat=V,t.Binarizer=m,t.BinaryBitmap=u,t.BitArray=$,t.BitMatrix=k,t.BitSource=fe,t.BrowserAztecCodeReader=gt,t.BrowserBarcodeReader=ce,t.BrowserCodeReader=F,t.BrowserDatamatrixCodeReader=$e,t.BrowserMultiFormatReader=gn,t.BrowserPDF417Reader=wn,t.BrowserQRCodeReader=$n,t.BrowserQRCodeSvgWriter=Rn,t.CharacterSetECI=I,t.ChecksumException=h,t.Code128Reader=$t,t.Code39Reader=yt,t.DataMatrixDecodedBitStreamParser=pe,t.DataMatrixReader=we,t.DecodeHintType=b,t.DecoderResult=Q,t.DefaultGridSampler=ht,t.DetectorResult=st,t.EAN13Reader=St,t.EncodeHintType=bn,t.Exception=c,t.FormatException=v,t.GenericGF=J,t.GenericGFPoly=Z,t.GlobalHistogramBinarizer=R,t.GridSampler=dt,t.GridSamplerInstance=mt,t.HTMLCanvasElementLuminanceSource=O,t.HybridBinarizer=N,t.ITFReader=bt,t.IllegalArgumentException=d,t.IllegalStateException=et,t.InvertedLuminanceSource=x,t.LuminanceSource=D,t.MathUtils=ot,t.MultiFormatOneDReader=se,t.MultiFormatReader=_n,t.MultiFormatWriter=Dn,t.NotFoundException=T,t.OneDReader=wt,t.PDF417DecodedBitStreamParser=hn,t.PDF417DecoderErrorCorrection=We,t.PDF417Reader=fn,t.PDF417ResultMetadata=en,t.PerspectiveTransform=ut,t.PlanarYUVLuminanceSource=xn,t.QRCodeByteMatrix=Cn,t.QRCodeDataMask=Ee,t.QRCodeDecodedBitStreamParser=Te,t.QRCodeDecoderErrorCorrectionLevel=ye,t.QRCodeDecoderFormatInformation=be,t.QRCodeEncoder=Tn,t.QRCodeEncoderQRCode=En,t.QRCodeMaskUtil=In,t.QRCodeMatrixUtil=Sn,t.QRCodeMode=ke,t.QRCodeReader=Fe,t.QRCodeVersion=Ce,t.QRCodeWriter=Nn,t.RGBLuminanceSource=On,t.RSS14Reader=ae,t.RSSExpandedReader=oe,t.ReaderException=pn,t.ReedSolomonDecoder=nt,t.ReedSolomonEncoder=vn,t.ReedSolomonException=tt,t.Result=L,t.ResultMetadataType=X,t.ResultPoint=at,t.StringUtils=A,t.UnsupportedOperationException=C,t.VideoInputDevice=M,t.WhiteRectangleDetector=lt,t.WriterException=An,t.ZXingArrays=g,t.ZXingCharset=Mn,t.ZXingInteger=w,t.ZXingStandardCharsets=Pn,t.ZXingStringBuilder=S,t.ZXingStringEncoding=E,t.ZXingSystem=f,t.createAbstractExpandedDecoder=ee,Object.defineProperty(t,"__esModule",{value:!0})}(e)}),zxingJs_umd$1=getDefaultExportFromCjs(zxingJs_umd),ZXing=_mergeNamespaces({__proto__:null,default:zxingJs_umd$1},[zxingJs_umd]),ZXingHtml5QrcodeDecoder=function(){function t(t,e,n){if(this.formatMap=new Map([[Html5QrcodeSupportedFormats.QR_CODE,zxingJs_umd.BarcodeFormat.QR_CODE],[Html5QrcodeSupportedFormats.AZTEC,zxingJs_umd.BarcodeFormat.AZTEC],[Html5QrcodeSupportedFormats.CODABAR,zxingJs_umd.BarcodeFormat.CODABAR],[Html5QrcodeSupportedFormats.CODE_39,zxingJs_umd.BarcodeFormat.CODE_39],[Html5QrcodeSupportedFormats.CODE_93,zxingJs_umd.BarcodeFormat.CODE_93],[Html5QrcodeSupportedFormats.CODE_128,zxingJs_umd.BarcodeFormat.CODE_128],[Html5QrcodeSupportedFormats.DATA_MATRIX,zxingJs_umd.BarcodeFormat.DATA_MATRIX],[Html5QrcodeSupportedFormats.MAXICODE,zxingJs_umd.BarcodeFormat.MAXICODE],[Html5QrcodeSupportedFormats.ITF,zxingJs_umd.BarcodeFormat.ITF],[Html5QrcodeSupportedFormats.EAN_13,zxingJs_umd.BarcodeFormat.EAN_13],[Html5QrcodeSupportedFormats.EAN_8,zxingJs_umd.BarcodeFormat.EAN_8],[Html5QrcodeSupportedFormats.PDF_417,zxingJs_umd.BarcodeFormat.PDF_417],[Html5QrcodeSupportedFormats.RSS_14,zxingJs_umd.BarcodeFormat.RSS_14],[Html5QrcodeSupportedFormats.RSS_EXPANDED,zxingJs_umd.BarcodeFormat.RSS_EXPANDED],[Html5QrcodeSupportedFormats.UPC_A,zxingJs_umd.BarcodeFormat.UPC_A],[Html5QrcodeSupportedFormats.UPC_E,zxingJs_umd.BarcodeFormat.UPC_E],[Html5QrcodeSupportedFormats.UPC_EAN_EXTENSION,zxingJs_umd.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!ZXing)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=e,this.logger=n;var r=this.createZXingFormats(t),o=new Map;o.set(zxingJs_umd.DecodeHintType.POSSIBLE_FORMATS,r),o.set(zxingJs_umd.DecodeHintType.TRY_HARDER,!1),this.hints=o}return t.prototype.decodeAsync=function(t){var e=this;return new Promise(function(n,r){try{n(e.decode(t))}catch(t){r(t)}})},t.prototype.decode=function(t){var e=new zxingJs_umd.MultiFormatReader(this.verbose,this.hints),n=new zxingJs_umd.HTMLCanvasElementLuminanceSource(t),r=new zxingJs_umd.BinaryBitmap(new zxingJs_umd.HybridBinarizer(n)),o=e.decode(r);return{text:o.text,format:QrcodeResultFormat.create(this.toHtml5QrcodeSupportedFormats(o.format)),debugData:this.createDebugData()}},t.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(e,n,r){t.set(e,n)}),t},t.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},t.prototype.createZXingFormats=function(t){for(var e=[],n=0,r=t;n<r.length;n++){var o=r[n];this.formatMap.has(o)?e.push(this.formatMap.get(o)):this.logger.logError("".concat(o," is not supported by")+"ZXingHtml5QrcodeShim")}return e},t.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},t}(),__awaiter$4=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})},__generator$4=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},BarcodeDetectorDelegate=function(){function t(e,n,r){if(this.formatMap=new Map([[Html5QrcodeSupportedFormats.QR_CODE,"qr_code"],[Html5QrcodeSupportedFormats.AZTEC,"aztec"],[Html5QrcodeSupportedFormats.CODABAR,"codabar"],[Html5QrcodeSupportedFormats.CODE_39,"code_39"],[Html5QrcodeSupportedFormats.CODE_93,"code_93"],[Html5QrcodeSupportedFormats.CODE_128,"code_128"],[Html5QrcodeSupportedFormats.DATA_MATRIX,"data_matrix"],[Html5QrcodeSupportedFormats.ITF,"itf"],[Html5QrcodeSupportedFormats.EAN_13,"ean_13"],[Html5QrcodeSupportedFormats.EAN_8,"ean_8"],[Html5QrcodeSupportedFormats.PDF_417,"pdf417"],[Html5QrcodeSupportedFormats.UPC_A,"upc_a"],[Html5QrcodeSupportedFormats.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!t.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=r;var o=this.createBarcodeDetectorFormats(e);if(this.detector=new BarcodeDetector(o),!this.detector)throw"BarcodeDetector detector not supported"}return t.isSupported=function(){return"BarcodeDetector"in window&&void 0!==new BarcodeDetector({formats:["qr_code"]})},t.prototype.decodeAsync=function(t){return __awaiter$4(this,void 0,void 0,function(){var e,n;return __generator$4(this,function(r){switch(r.label){case 0:return[4,this.detector.detect(t)];case 1:if(!(e=r.sent())||0===e.length)throw"No barcode or QR code detected.";return[2,{text:(n=this.selectLargestBarcode(e)).rawValue,format:QrcodeResultFormat.create(this.toHtml5QrcodeSupportedFormats(n.format)),debugData:this.createDebugData()}]}})})},t.prototype.selectLargestBarcode=function(t){for(var e=null,n=0,r=0,o=t;r<o.length;r++){var i=o[r],a=i.boundingBox.width*i.boundingBox.height;a>n&&(n=a,e=i)}if(!e)throw"No largest barcode found";return e},t.prototype.createBarcodeDetectorFormats=function(t){for(var e=[],n=0,r=t;n<r.length;n++){var o=r[n];this.formatMap.has(o)?e.push(this.formatMap.get(o)):this.logger.warn("".concat(o," is not supported by")+"BarcodeDetectorDelegate")}return{formats:e}},t.prototype.toHtml5QrcodeSupportedFormats=function(t){if(!this.reverseFormatMap.has(t))throw"reverseFormatMap doesn't have ".concat(t);return this.reverseFormatMap.get(t)},t.prototype.createReverseFormatMap=function(){var t=new Map;return this.formatMap.forEach(function(e,n,r){t.set(e,n)}),t},t.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},t}(),__awaiter$3=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})},__generator$3=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},Html5QrcodeShim=function(){function t(t,e,n,r){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=n,e&&BarcodeDetectorDelegate.isSupported()?(this.primaryDecoder=new BarcodeDetectorDelegate(t,n,r),this.secondaryDecoder=new ZXingHtml5QrcodeDecoder(t,n,r)):this.primaryDecoder=new ZXingHtml5QrcodeDecoder(t,n,r)}return t.prototype.decodeAsync=function(t){return __awaiter$3(this,void 0,void 0,function(){var e;return __generator$3(this,function(n){switch(n.label){case 0:e=performance.now(),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(t)];case 2:return[2,n.sent()];case 3:return this.possiblyLogPerformance(e),[7];case 4:return[2]}})})},t.prototype.decodeRobustlyAsync=function(t){return __awaiter$3(this,void 0,void 0,function(){var e,n;return __generator$3(this,function(r){switch(r.label){case 0:e=performance.now(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(t)];case 2:return[2,r.sent()];case 3:if(n=r.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(t)];throw n;case 4:return this.possiblyLogPerformance(e),[7];case 5:return[2]}})})},t.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},t.prototype.possiblyLogPerformance=function(t){if(this.verbose){var e=performance.now()-t;this.executionResults.push(e),this.executions++,this.possiblyFlushPerformanceReport()}},t.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var t=0,e=0,n=this.executionResults;e<n.length;e++){t+=n[e]}var r=t/this.executionResults.length;console.log("".concat(r," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},t}(),__extends$1=(extendStatics=function(t,e){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},extendStatics(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}),extendStatics,__awaiter$2=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})},__generator$2=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},AbstractCameraCapability=function(){function t(t,e){this.name=t,this.track=e}return t.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},t.prototype.apply=function(t){var e={};e[this.name]=t;var n={advanced:[e]};return this.track.applyConstraints(n)},t.prototype.value=function(){var t=this.track.getSettings();return this.name in t?t[this.name]:null},t}(),AbstractRangeCameraCapability=function(t){function e(e,n){return t.call(this,e,n)||this}return __extends$1(e,t),e.prototype.min=function(){return this.getCapabilities().min},e.prototype.max=function(){return this.getCapabilities().max},e.prototype.step=function(){return this.getCapabilities().step},e.prototype.apply=function(t){var e={};e[this.name]=t;var n={advanced:[e]};return this.track.applyConstraints(n)},e.prototype.getCapabilities=function(){this.failIfNotSupported();var t=this.track.getCapabilities()[this.name];return{min:t.min,max:t.max,step:t.step}},e.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},e}(AbstractCameraCapability),ZoomFeatureImpl=function(t){function e(e){return t.call(this,"zoom",e)||this}return __extends$1(e,t),e}(AbstractRangeCameraCapability),TorchFeatureImpl=function(t){function e(e){return t.call(this,"torch",e)||this}return __extends$1(e,t),e}(AbstractCameraCapability),CameraCapabilitiesImpl=function(){function t(t){this.track=t}return t.prototype.zoomFeature=function(){return new ZoomFeatureImpl(this.track)},t.prototype.torchFeature=function(){return new TorchFeatureImpl(this.track)},t}(),RenderedCameraImpl=function(){function t(t,e,n){this.isClosed=!1,this.parentElement=t,this.mediaStream=e,this.callbacks=n,this.surface=this.createVideoElement(this.parentElement.clientWidth),t.append(this.surface)}return t.prototype.createVideoElement=function(t){var e=document.createElement("video");return e.style.width="".concat(t,"px"),e.style.display="block",e.muted=!0,e.setAttribute("muted","true"),e.playsInline=!0,e},t.prototype.setupSurface=function(){var t=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var e=function(){var n=t.surface.clientWidth,r=t.surface.clientHeight;t.callbacks.onRenderSurfaceReady(n,r),t.surface.removeEventListener("playing",e)};this.surface.addEventListener("playing",e),this.surface.srcObject=this.mediaStream,this.surface.play()},t.create=function(e,n,r,o){return __awaiter$2(this,void 0,void 0,function(){var i,a;return __generator$2(this,function(s){switch(s.label){case 0:return i=new t(e,n,o),r.aspectRatio?(a={aspectRatio:r.aspectRatio},[4,i.getFirstTrackOrFail().applyConstraints(a)]):[3,2];case 1:s.sent(),s.label=2;case 2:return i.setupSurface(),[2,i]}})})},t.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},t.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},t.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},t.prototype.resume=function(t){this.failIfClosed();var e=this,n=function(){setTimeout(t,200),e.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.play()},t.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},t.prototype.getSurface=function(){return this.failIfClosed(),this.surface},t.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},t.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},t.prototype.applyVideoConstraints=function(t){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(e){if("aspectRatio"in t)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(t)]})})},t.prototype.close=function(){if(this.isClosed)return Promise.resolve();var t=this;return new Promise(function(e,n){var r=t.mediaStream.getVideoTracks().length,o=0;t.mediaStream.getVideoTracks().forEach(function(n){t.mediaStream.removeTrack(n),n.stop(),++o>=r&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),e())})})},t.prototype.getCapabilities=function(){return new CameraCapabilitiesImpl(this.getFirstTrackOrFail())},t}(),CameraImpl=function(){function t(t){this.mediaStream=t}return t.prototype.render=function(t,e,n){return __awaiter$2(this,void 0,void 0,function(){return __generator$2(this,function(r){return[2,RenderedCameraImpl.create(t,this.mediaStream,e,n)]})})},t.create=function(e){return __awaiter$2(this,void 0,void 0,function(){var n;return __generator$2(this,function(r){switch(r.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:e},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return[2,new t(r.sent())]}})})},t}(),__awaiter$1=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})},__generator$1=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},CameraFactory=function(){function t(){}return t.failIfNotSupported=function(){return __awaiter$1(this,void 0,void 0,function(){return __generator$1(this,function(e){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new t]})})},t.prototype.create=function(t){return __awaiter$1(this,void 0,void 0,function(){return __generator$1(this,function(e){return[2,CameraImpl.create(t)]})})},t}(),__awaiter=function(t,e,n,r){return new(n||(n=Promise))(function(o,i){function a(t){try{c(r.next(t))}catch(t){i(t)}}function s(t){try{c(r.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n(function(t){t(e)})).then(a,s)}c((r=r.apply(t,e||[])).next())})},__generator=function(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&s[0]?r.return:s[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,s[1])).done)return o;switch(r=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,r=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){a.label=s[1];break}if(6===s[0]&&a.label<o[1]){a.label=o[1],o=s;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(s);break}o[2]&&a.ops.pop(),a.trys.pop();continue}s=e.call(t,a)}catch(t){s=[6,t],r=0}finally{n=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},CameraRetriever=function(){function t(){}return t.retrieve=function(){if(navigator.mediaDevices)return t.getCamerasFromMediaDevices();var e=MediaStreamTrack;return MediaStreamTrack&&e.getSources?t.getCamerasFromMediaStreamTrack():t.rejectWithError()},t.rejectWithError=function(){var e=Html5QrcodeStrings.unableToQuerySupportedDevices();return t.isHttpsOrLocalhost()||(e=Html5QrcodeStrings.insecureContextCameraQueryError()),Promise.reject(e)},t.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var t=location.host.split(":")[0];return"127.0.0.1"===t||"localhost"===t},t.getCamerasFromMediaDevices=function(){return __awaiter(this,void 0,void 0,function(){var t,e,n,r,o,i,a;return __generator(this,function(s){switch(s.label){case 0:return t=function(t){for(var e=0,n=t.getVideoTracks();e<n.length;e++){var r=n[e];r.enabled=!1,r.stop(),t.removeTrack(r)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return e=s.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(n=s.sent(),r=[],o=0,i=n;o<i.length;o++)"videoinput"===(a=i[o]).kind&&r.push({id:a.deviceId,label:a.label});return t(e),[2,r]}})})},t.getCamerasFromMediaStreamTrack=function(){return new Promise(function(t,e){MediaStreamTrack.getSources(function(e){for(var n=[],r=0,o=e;r<o.length;r++){var i=o[r];"video"===i.kind&&n.push({id:i.id,label:i.label})}t(n)})})},t}(),Html5QrcodeScannerState;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.NOT_STARTED=1]="NOT_STARTED",t[t.SCANNING=2]="SCANNING",t[t.PAUSED=3]="PAUSED"}(Html5QrcodeScannerState||(Html5QrcodeScannerState={}));var StateManagerImpl=function(){function t(){this.state=Html5QrcodeScannerState.NOT_STARTED,this.onGoingTransactionNewState=Html5QrcodeScannerState.UNKNOWN}return t.prototype.directTransition=function(t){this.failIfTransitionOngoing(),this.validateTransition(t),this.state=t},t.prototype.startTransition=function(t){return this.failIfTransitionOngoing(),this.validateTransition(t),this.onGoingTransactionNewState=t,this},t.prototype.execute=function(){if(this.onGoingTransactionNewState===Html5QrcodeScannerState.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var t=this.onGoingTransactionNewState;this.onGoingTransactionNewState=Html5QrcodeScannerState.UNKNOWN,this.directTransition(t)},t.prototype.cancel=function(){if(this.onGoingTransactionNewState===Html5QrcodeScannerState.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=Html5QrcodeScannerState.UNKNOWN},t.prototype.getState=function(){return this.state},t.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==Html5QrcodeScannerState.UNKNOWN)throw"Cannot transition to a new state, already under transition"},t.prototype.validateTransition=function(t){switch(this.state){case Html5QrcodeScannerState.UNKNOWN:throw"Transition from unknown is not allowed";case Html5QrcodeScannerState.NOT_STARTED:this.failIfNewStateIs(t,[Html5QrcodeScannerState.PAUSED]);case Html5QrcodeScannerState.SCANNING:case Html5QrcodeScannerState.PAUSED:}},t.prototype.failIfNewStateIs=function(t,e){for(var n=0,r=e;n<r.length;n++){if(t===r[n])throw"Cannot transition from ".concat(this.state," to ").concat(t)}},t}(),StateManagerProxy=function(){function t(t){this.stateManager=t}return t.prototype.startTransition=function(t){return this.stateManager.startTransition(t)},t.prototype.directTransition=function(t){this.stateManager.directTransition(t)},t.prototype.getState=function(){return this.stateManager.getState()},t.prototype.canScanFile=function(){return this.stateManager.getState()===Html5QrcodeScannerState.NOT_STARTED},t.prototype.isScanning=function(){return this.stateManager.getState()!==Html5QrcodeScannerState.NOT_STARTED},t.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===Html5QrcodeScannerState.SCANNING},t.prototype.isPaused=function(){return this.stateManager.getState()===Html5QrcodeScannerState.PAUSED},t}(),StateManagerFactory=function(){function t(){}return t.create=function(){return new StateManagerProxy(new StateManagerImpl)},t}(),__extends=function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},t(e,n)};return function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Constants=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return __extends(e,t),e.DEFAULT_WIDTH=300,e.DEFAULT_WIDTH_OFFSET=2,e.FILE_SCAN_MIN_HEIGHT=300,e.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,e.MIN_QR_BOX_SIZE=50,e.SHADED_LEFT=1,e.SHADED_RIGHT=2,e.SHADED_TOP=3,e.SHADED_BOTTOM=4,e.SHADED_REGION_ELEMENT_ID="qr-shaded-region",e.VERBOSE=!1,e.BORDER_SHADER_DEFAULT_COLOR="#ffffff",e.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",e}(Html5QrcodeConstants),InternalHtml5QrcodeConfig=function(){function t(t,e){this.logger=e,this.fps=Constants.SCAN_DEFAULT_FPS,t?(t.fps&&(this.fps=t.fps),this.disableFlip=!0===t.disableFlip,this.qrbox=t.qrbox,this.aspectRatio=t.aspectRatio,this.videoConstraints=t.videoConstraints):this.disableFlip=Constants.DEFAULT_DISABLE_FLIP}return t.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?VideoConstraintsUtil.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},t.prototype.isShadedBoxEnabled=function(){return!isNullOrUndefined(this.qrbox)},t.create=function(e,n){return new t(e,n)},t}(),Html5Qrcode=function(){function t(t,e){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(t))throw"HTML Element with id=".concat(t," not found");var n;this.elementId=t,this.verbose=!1,"boolean"==typeof e?this.verbose=!0===e:e&&(n=e,this.verbose=!0===n.verbose,n.experimentalFeatures),this.logger=new BaseLoggger(this.verbose),this.qrcode=new Html5QrcodeShim(this.getSupportedFormats(e),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=StateManagerFactory.create()}return t.prototype.start=function(t,e,n,r){var o,i=this;if(!t)throw"cameraIdOrConfig is required";if(!n||"function"!=typeof n)throw"qrCodeSuccessCallback is required and should be a function.";o=r||(this.verbose?this.logger.log:function(){});var a=InternalHtml5QrcodeConfig.create(e,this.logger);this.clearElement();var s=!1;a.videoConstraints&&(a.isMediaStreamConstraintsValid()?s=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var c=s,l=document.getElementById(this.elementId);l.clientWidth?l.clientWidth:Constants.DEFAULT_WIDTH,l.style.position="relative",this.shouldScan=!0,this.element=l;var d=this,u=this.stateManagerProxy.startTransition(Html5QrcodeScannerState.SCANNING);return new Promise(function(e,r){var s=c?a.videoConstraints:d.createVideoConstraints(t);if(!s)return u.cancel(),void r("videoConstraints should be defined");var l={};c&&!a.aspectRatio||(l.aspectRatio=a.aspectRatio);var h={onRenderSurfaceReady:function(t,e){d.setupUi(t,e,a),d.isScanning=!0,d.foreverScan(a,n,o)}};CameraFactory.failIfNotSupported().then(function(t){t.create(s).then(function(t){return t.render(i.element,l,h).then(function(t){d.renderedCamera=t,u.execute(),e(null)}).catch(function(t){u.cancel(),r(t)})}).catch(function(t){u.cancel(),r(Html5QrcodeStrings.errorGettingUserMedia(t))})}).catch(function(t){u.cancel(),r(Html5QrcodeStrings.cameraStreamingNotSupported())})})},t.prototype.pause=function(t){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(Html5QrcodeScannerState.PAUSED),this.showPausedState(),(isNullOrUndefined(t)||!0!==t)&&(t=!1),t&&this.renderedCamera&&this.renderedCamera.pause()},t.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var t=this,e=function(){t.stateManagerProxy.directTransition(Html5QrcodeScannerState.SCANNING),t.hidePausedState()};this.renderedCamera.isPaused()?this.renderedCamera.resume(function(){e()}):e()},t.prototype.getState=function(){return this.stateManagerProxy.getState()},t.prototype.stop=function(){var t=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var e=this.stateManagerProxy.startTransition(Html5QrcodeScannerState.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),function(){if(t.element){var e=document.getElementById(Constants.SHADED_REGION_ELEMENT_ID);e&&t.element.removeChild(e)}}(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),e.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},t.prototype.scanFile=function(t,e){return this.scanFileV2(t,e).then(function(t){return t.decodedText})},t.prototype.scanFileV2=function(t,e){var n=this;if(!(t&&t instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(isNullOrUndefined(e)&&(e=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(r,o){n.possiblyCloseLastScanImageFile(),n.clearElement(),n.lastScanImageFile=URL.createObjectURL(t);var i=new Image;i.onload=function(){var t=i.width,a=i.height,s=document.getElementById(n.elementId),c=s.clientWidth?s.clientWidth:Constants.DEFAULT_WIDTH,l=Math.max(s.clientHeight?s.clientHeight:a,Constants.FILE_SCAN_MIN_HEIGHT),d=n.computeCanvasDrawConfig(t,a,c,l);if(e){var u=n.createCanvasElement(c,l,"qr-canvas-visible");u.style.display="inline-block",s.appendChild(u);var h=u.getContext("2d");if(!h)throw"Unable to get 2d context from canvas";h.canvas.width=c,h.canvas.height=l,h.drawImage(i,0,0,t,a,d.x,d.y,d.width,d.height)}var m=Constants.FILE_SCAN_HIDDEN_CANVAS_PADDING,f=Math.max(i.width,d.width),p=Math.max(i.height,d.height),_=f+2*m,g=p+2*m,w=n.createCanvasElement(_,g);s.appendChild(w);var $=w.getContext("2d");if(!$)throw"Unable to get 2d context from canvas";$.canvas.width=_,$.canvas.height=g,$.drawImage(i,0,0,t,a,m,m,f,p);try{n.qrcode.decodeRobustlyAsync(w).then(function(t){r(Html5QrcodeResultFactory.createFromQrcodeResult(t))}).catch(o)}catch(t){o("QR code parse error, error = ".concat(t))}},i.onerror=o,i.onabort=o,i.onstalled=o,i.onsuspend=o,i.src=URL.createObjectURL(t)})},t.prototype.clear=function(){this.clearElement()},t.getCameras=function(){return CameraRetriever.retrieve()},t.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},t.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},t.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},t.prototype.applyVideoConstraints=function(t){if(!t)throw"videoConstaints is required argument.";if(!VideoConstraintsUtil.isMediaStreamConstraintsValid(t,this.logger))throw"invalid videoConstaints passed, check logs for more details";return this.getRenderedCameraOrFail().applyVideoConstraints(t)},t.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},t.prototype.getSupportedFormats=function(t){var e=[Html5QrcodeSupportedFormats.QR_CODE,Html5QrcodeSupportedFormats.AZTEC,Html5QrcodeSupportedFormats.CODABAR,Html5QrcodeSupportedFormats.CODE_39,Html5QrcodeSupportedFormats.CODE_93,Html5QrcodeSupportedFormats.CODE_128,Html5QrcodeSupportedFormats.DATA_MATRIX,Html5QrcodeSupportedFormats.MAXICODE,Html5QrcodeSupportedFormats.ITF,Html5QrcodeSupportedFormats.EAN_13,Html5QrcodeSupportedFormats.EAN_8,Html5QrcodeSupportedFormats.PDF_417,Html5QrcodeSupportedFormats.RSS_14,Html5QrcodeSupportedFormats.RSS_EXPANDED,Html5QrcodeSupportedFormats.UPC_A,Html5QrcodeSupportedFormats.UPC_E,Html5QrcodeSupportedFormats.UPC_EAN_EXTENSION];if(!t||"boolean"==typeof t)return e;if(!t.formatsToSupport)return e;if(!Array.isArray(t.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===t.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var n=[],r=0,o=t.formatsToSupport;r<o.length;r++){var i=o[r];isValidHtml5QrcodeSupportedFormats(i)?n.push(i):this.logger.warn("Invalid format: ".concat(i," passed in config, ignoring."))}if(0===n.length)throw"None of formatsToSupport match supported values.";return n},t.prototype.getUseBarCodeDetectorIfSupported=function(t){if(isNullOrUndefined(t))return!0;if(!isNullOrUndefined(t.useBarCodeDetectorIfSupported))return!1!==t.useBarCodeDetectorIfSupported;if(isNullOrUndefined(t.experimentalFeatures))return!0;var e=t.experimentalFeatures;return!!isNullOrUndefined(e.useBarCodeDetectorIfSupported)||!1!==e.useBarCodeDetectorIfSupported},t.prototype.validateQrboxSize=function(t,e,n){var r=this,o=n.qrbox;this.validateQrboxConfig(o);var i,a=this.toQrdimensions(t,e,o),s=function(t){if(t<Constants.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Constants.MIN_QR_BOX_SIZE,"px.")};s(a.width),s(a.height),a.width=((i=a.width)>t&&(r.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),i=t),i)},t.prototype.validateQrboxConfig=function(t){if("number"!=typeof t&&"function"!=typeof t&&(void 0===t.width||void 0===t.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},t.prototype.toQrdimensions=function(t,e,n){if("number"==typeof n)return{width:n,height:n};if("function"==typeof n)try{return n(t,e)}catch(t){throw new Error("qrbox config was passed as a function but it failed with unknown error"+t)}return n},t.prototype.setupUi=function(t,e,n){n.isShadedBoxEnabled()&&this.validateQrboxSize(t,e,n);var r=isNullOrUndefined(n.qrbox)?{width:t,height:e}:n.qrbox;this.validateQrboxConfig(r);var o=this.toQrdimensions(t,e,r);o.height>e&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var i=n.isShadedBoxEnabled()&&o.height<=e,a={x:0,y:0,width:t,height:e},s=i?this.getShadedRegionBounds(t,e,o):a,c=this.createCanvasElement(s.width,s.height),l=c.getContext("2d",{willReadFrequently:!0});l.canvas.width=s.width,l.canvas.height=s.height,this.element.append(c),i&&this.possiblyInsertShadingElement(this.element,t,e,o),this.createScannerPausedUiElement(this.element),this.qrRegion=s,this.context=l,this.canvasElement=c},t.prototype.createScannerPausedUiElement=function(t){var e=document.createElement("div");e.innerText=Html5QrcodeStrings.scannerPaused(),e.style.display="none",e.style.position="absolute",e.style.top="0px",e.style.zIndex="1",e.style.background="rgba(9, 9, 9, 0.46)",e.style.color="#FFECEC",e.style.textAlign="center",e.style.width="100%",t.appendChild(e),this.scannerPausedUiElement=e},t.prototype.scanContext=function(t,e){var n=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(e){return t(e.text,Html5QrcodeResultFactory.createFromQrcodeResult(e)),n.possiblyUpdateShaders(!0),!0}).catch(function(t){n.possiblyUpdateShaders(!1);var r=Html5QrcodeStrings.codeParseError(t);return e(r,Html5QrcodeErrorFactory.createFrom(r)),!1})},t.prototype.foreverScan=function(t,e,n){var r=this;if(this.shouldScan&&this.renderedCamera){var o=this.renderedCamera.getSurface(),i=o.videoWidth/o.clientWidth,a=o.videoHeight/o.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var s=this.qrRegion.width*i,c=this.qrRegion.height*a,l=this.qrRegion.x*i,d=this.qrRegion.y*a;this.context.drawImage(o,l,d,s,c,0,0,this.qrRegion.width,this.qrRegion.height);var u=function(){r.foreverScanTimeout=setTimeout(function(){r.foreverScan(t,e,n)},r.getTimeoutFps(t.fps))};this.scanContext(e,n).then(function(o){o||!0===t.disableFlip?u():(r.context.translate(r.context.canvas.width,0),r.context.scale(-1,1),r.scanContext(e,n).finally(function(){u()}))}).catch(function(t){r.logger.logError("Error happend while scanning context",t),u()})}},t.prototype.createVideoConstraints=function(t){if("string"==typeof t)return{deviceId:{exact:t}};if("object"==typeof t){var e="facingMode",n="deviceId",r={user:!0,environment:!0},o="exact",i=function(t){if(t in r)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(t,"'")},a=Object.keys(t);if(1!==a.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(a.length," keys");var s=Object.keys(t)[0];if(s!==e&&s!==n)throw"Only '".concat(e,"' and '").concat(n,"' ")+" are supported for 'cameraIdOrConfig'";if(s!==e){var c=t.deviceId;if("string"==typeof c)return{deviceId:c};if("object"==typeof c){if(o in c)return{deviceId:{exact:c["".concat(o)]}};throw"'deviceId' should be string or object with"+" ".concat(o," as key.")}throw"Invalid type of 'deviceId' = ".concat(typeof c)}var l=t.facingMode;if("string"==typeof l){if(i(l))return{facingMode:l}}else{if("object"!=typeof l)throw"Invalid type of 'facingMode' = ".concat(typeof l);if(!(o in l))throw"'facingMode' should be string or object with"+" ".concat(o," as key.");if(i(l["".concat(o)]))return{facingMode:{exact:l["".concat(o)]}}}}throw"Invalid type of 'cameraIdOrConfig' = ".concat(typeof t)},t.prototype.computeCanvasDrawConfig=function(t,e,n,r){if(t<=n&&e<=r)return{x:(n-t)/2,y:(r-e)/2,width:t,height:e};var o=t,i=e;return t>n&&(e*=n/t,t=n),e>r&&(t*=r/e,e=r),this.logger.log("Image downsampled from "+"".concat(o,"X").concat(i)+" to ".concat(t,"X").concat(e,".")),this.computeCanvasDrawConfig(t,e,n,r)},t.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},t.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(e){e.style.backgroundColor=t?Constants.BORDER_SHADER_MATCH_COLOR:Constants.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},t.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},t.prototype.createCanvasElement=function(t,e,n){var r=t,o=e,i=document.createElement("canvas");return i.style.width="".concat(r,"px"),i.style.height="".concat(o,"px"),i.style.display="none",i.id=isNullOrUndefined(n)?"qr-canvas":n,i},t.prototype.getShadedRegionBounds=function(t,e,n){if(n.width>t||n.height>e)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-n.width)/2,y:(e-n.height)/2,width:n.width,height:n.height}},t.prototype.possiblyInsertShadingElement=function(t,e,n,r){if(!(e-r.width<1||n-r.height<1)){var o=document.createElement("div");o.style.position="absolute";var i=(e-r.width)/2,a=(n-r.height)/2;if(o.style.borderLeft="".concat(i,"px solid rgba(0, 0, 0, 0.48)"),o.style.borderRight="".concat(i,"px solid rgba(0, 0, 0, 0.48)"),o.style.borderTop="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),o.style.borderBottom="".concat(a,"px solid rgba(0, 0, 0, 0.48)"),o.style.boxSizing="border-box",o.style.top="0px",o.style.bottom="0px",o.style.left="0px",o.style.right="0px",o.id="".concat(Constants.SHADED_REGION_ELEMENT_ID),e-r.width<11||n-r.height<11)this.hasBorderShaders=!1;else{var s=40;this.insertShaderBorders(o,s,5,-5,null,0,!0),this.insertShaderBorders(o,s,5,-5,null,0,!1),this.insertShaderBorders(o,s,5,null,-5,0,!0),this.insertShaderBorders(o,s,5,null,-5,0,!1),this.insertShaderBorders(o,5,45,-5,null,-5,!0),this.insertShaderBorders(o,5,45,null,-5,-5,!0),this.insertShaderBorders(o,5,45,-5,null,-5,!1),this.insertShaderBorders(o,5,45,null,-5,-5,!1),this.hasBorderShaders=!0}t.append(o)}},t.prototype.insertShaderBorders=function(t,e,n,r,o,i,a){var s=document.createElement("div");s.style.position="absolute",s.style.backgroundColor=Constants.BORDER_SHADER_DEFAULT_COLOR,s.style.width="".concat(e,"px"),s.style.height="".concat(n,"px"),null!==r&&(s.style.top="".concat(r,"px")),null!==o&&(s.style.bottom="".concat(o,"px")),a?s.style.left="".concat(i,"px"):s.style.right="".concat(i,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(s),t.appendChild(s)},t.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},t.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},t.prototype.getTimeoutFps=function(t){return 1e3/t},t}(),Html5QrcodeScannerStatus;function add_css$2(){var t=element("style");t.id="svelte-9062r9-style",t.textContent="main.svelte-9062r9{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;max-height:400px}reader.svelte-9062r9{width:400px;height:300px;background-color:gray}",append(document.head,t)}function get_each_context$2(t,e,n){const r=t.slice();return r[19]=e[n].id,r[20]=e[n].label,r}function create_if_block$2(t){let e,n,r=t[1]&&create_if_block_1$2(t);return{c(){r&&r.c(),e=space(),n=element("reader"),attr(n,"id","reader"),attr(n,"class","svelte-9062r9")},m(t,o){r&&r.m(t,o),insert(t,e,o),insert(t,n,o)},p(t,n){t[1]?r?r.p(t,n):(r=create_if_block_1$2(t),r.c(),r.m(e.parentNode,e)):r&&(r.d(1),r=null)},d(t){r&&r.d(t),t&&detach(e),t&&detach(n)}}}function create_if_block_1$2(t){let e,n,r,o,i,a,s=t[1],c=[];for(let e=0;e<s.length;e+=1)c[e]=create_each_block$2(get_each_context$2(t,s,e));return{c(){e=element("div"),n=text("Quelle:\n "),r=element("select");for(let t=0;t<c.length;t+=1)c[t].c();r.disabled=o=1===t[1].length},m(o,s){insert(o,e,s),append(e,n),append(e,r);for(let t=0;t<c.length;t+=1)c[t].m(r,null);i||(a=listen(r,"change",t[4]),i=!0)},p(t,e){if(6&e){let n;for(s=t[1],n=0;n<s.length;n+=1){const o=get_each_context$2(t,s,n);c[n]?c[n].p(o,e):(c[n]=create_each_block$2(o),c[n].c(),c[n].m(r,null))}for(;n<c.length;n+=1)c[n].d(1);c.length=s.length}2&e&&o!==(o=1===t[1].length)&&(r.disabled=o)},d(t){t&&detach(e),destroy_each(c,t),i=!1,a()}}}function create_each_block$2(t){let e,n,r,o,i=t[20]+"";return{c(){e=element("option"),n=text(i),e.__value=r=t[19],e.value=e.__value,e.selected=o=t[2]===t[19]},m(t,r){insert(t,e,r),append(e,n)},p(t,a){2&a&&i!==(i=t[20]+"")&&set_data(n,i),2&a&&r!==(r=t[19])&&(e.__value=r,e.value=e.__value),6&a&&o!==(o=t[2]===t[19])&&(e.selected=o)},d(t){t&&detach(e)}}}function create_fragment$3(t){let e,n=!t[0]&&create_if_block$2(t);return{c(){e=element("main"),n&&n.c(),attr(e,"class","svelte-9062r9")},m(t,r){insert(t,e,r),n&&n.m(e,null)},p(t,[r]){t[0]?n&&(n.d(1),n=null):n?n.p(t,r):(n=create_if_block$2(t),n.c(),n.m(e,null))},i:noop,o:noop,d(t){t&&detach(e),n&&n.d()}}}!function(t){t[t.STATUS_DEFAULT=0]="STATUS_DEFAULT",t[t.STATUS_SUCCESS=1]="STATUS_SUCCESS",t[t.STATUS_WARNING=2]="STATUS_WARNING",t[t.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"}(Html5QrcodeScannerStatus||(Html5QrcodeScannerStatus={}));const getCameras$1=()=>Html5Qrcode.getCameras();function instance$3(t,e,n){let r;const o=createEventDispatcher(),{loggedIn:i}=user;component_subscribe(t,i,t=>n(9,r=t));let a,s,c,{keyboard:l}=e,{codeTypes:d=""}=e,{readerInit:u=!1}=e,h=!1;const m=r.tenant+"-ENABLERR-CAMERA";onMount(function(){if(l)return void(h=!0);try{a||(a=new Html5Qrcode("reader"));const t=window.localStorage.getItem(m);getCameras$1().then(e=>{if(!e?.length)return;n(1,s=e);const r=e.find(e=>e.id===t);r&&window.localStorage.setItem(m,r.id),p(r?.id||s[0].id)})}catch{}}),onDestroy(function(){_(),o("exit")});var f=function(t,e){var n=250,r=t>e?e:t,o=Math.floor(.75*r);return o<n?r<n?{width:r,height:r}:{width:n,height:n}:{width:o,height:o}};function p(t){if(t&&n(2,c=t),c)try{a.start(c,{fps:5,qrbox:f,formatsToSupport:d||void 0,facingMode:"environment"},g),h=!0}catch{}}async function _(t=!1){try{l||(await a.stop(),t&&await a.clear())}catch{}finally{h=!1}}function g(t,e){h&&(o("scan",{text:t}),h=!1)}return t.$$set=t=>{"keyboard"in t&&n(0,l=t.keyboard),"codeTypes"in t&&n(6,d=t.codeTypes),"readerInit"in t&&n(5,u=t.readerInit)},t.$$.update=()=>{32&t.$$.dirty&&u&&(h=!0,n(5,u=!1))},[l,s,c,i,async t=>{const e=t.target.value;await _(),window.localStorage.setItem(m,e),p(e)},u,d]}class InputReader extends SvelteComponent{constructor(t){super(),document.getElementById("svelte-9062r9-style")||add_css$2(),init(this,t,instance$3,create_fragment$3,safe_not_equal,{keyboard:0,codeTypes:6,readerInit:5})}}const{document:document_1$1}=globals;function add_css$1(){var t=element("style");t.id="svelte-9vv5ub-style",t.textContent=".accordion.svelte-9vv5ub{display:flex;overflow:hidden}.accordion-content.svelte-9vv5ub{position:relative}.formList .accordion > .btn{display:inline-block;margin-bottom:1em;background-color:#F5F5F5}.sTask .formList .accordion > .btn{width:95% !important}.sEmbedded .formList .accordion > .btn{width:97%}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}span.pointer.svelte-9vv5ub{padding-top:1em}div.delete.svelte-9vv5ub{text-decoration:line-through}.icon.svelte-9vv5ub{margin-right:-0.75em}.form-field .formField_italic{font-style:italic}.panel.invalid .btn{border:1px #b80000 solid}.draggableListItem.svelte-9vv5ub{cursor:drag}.draggableListItem.is-active-top.svelte-9vv5ub{border-top:3px purple solid;padding-top:2em}.draggableListItem.is-active-bottom.svelte-9vv5ub{border-bottom:3px purple solid;padding-bottom:2em}.modal-overlay > .dialog.reader{margin-top:0}",append(document_1$1.head,t)}function get_each_context$1(t,e,n){const r=t.slice();return r[143]=e[n],r[145]=n,r}function get_each_context_1$1(t,e,n){const r=t.slice();return r[147]=e[n],r[149]=n,r}function get_each_context_3(t,e,n){const r=t.slice();return r[156]=e[n],r}function get_each_context_2$1(t,e,n){const r=t.slice();return r[151]=e[n].title,r[152]=e[n].toDelete,r[153]=e[n].icon,r}function create_catch_block$1(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block$1(t){let e,n,r,o,i,a,s,c,l,d,u,h=(!t[2]||t[15]?.length&&t[15].length>1)&&create_if_block_14$1(t),m=t[19]&&create_if_block_13$1(t),f=!1!==t[4].transfer&&t[49]?.length&&create_if_block_12$1(t),p=!t[10]&&t[45]&&t[14]&&0!=t[14]&&create_if_block_11$1(t),_=!t[10]&&t[43]&&t[17]&&0!=t[17]&&create_if_block_10$1(t),g=t[41]&&t[13]&&0!=t[13]&&create_if_block_9$1(t);c=new t[36]({props:{class:t[6]+t[4].name,$$slots:{default:[create_default_slot_4$1,({closeOtherPanels:t})=>({146:t}),({closeOtherPanels:t})=>[0,0,0,0,t?4194304:0]]},$$scope:{ctx:t}}});let w=t[19]&&t[22]&&create_if_block$1(t);return{c(){h&&h.c(),e=space(),n=element("div"),m&&m.c(),r=space(),f&&f.c(),o=space(),p&&p.c(),i=space(),_&&_.c(),a=space(),g&&g.c(),s=space(),create_component(c.$$.fragment),l=space(),w&&w.c(),d=empty(),attr(n,"class","formList")},m(t,$){h&&h.m(t,$),insert(t,e,$),insert(t,n,$),m&&m.m(n,null),append(n,r),f&&f.m(n,null),append(n,o),p&&p.m(n,null),append(n,i),_&&_.m(n,null),append(n,a),g&&g.m(n,null),append(n,s),mount_component(c,n,null),insert(t,l,$),w&&w.m(t,$),insert(t,d,$),u=!0},p(t,l){!t[2]||t[15]?.length&&t[15].length>1?h?(h.p(t,l),32772&l[0]&&transition_in(h,1)):(h=create_if_block_14$1(t),h.c(),transition_in(h,1),h.m(e.parentNode,e)):h&&(group_outros(),transition_out(h,1,1,()=>{h=null}),check_outros()),t[19]?m?(m.p(t,l),524288&l[0]&&transition_in(m,1)):(m=create_if_block_13$1(t),m.c(),transition_in(m,1),m.m(n,r)):m&&(group_outros(),transition_out(m,1,1,()=>{m=null}),check_outros()),!1!==t[4].transfer&&t[49]?.length?f?(f.p(t,l),16&l[0]&&transition_in(f,1)):(f=create_if_block_12$1(t),f.c(),transition_in(f,1),f.m(n,o)):f&&(group_outros(),transition_out(f,1,1,()=>{f=null}),check_outros()),!t[10]&&t[45]&&t[14]&&0!=t[14]?p?(p.p(t,l),17408&l[0]&&transition_in(p,1)):(p=create_if_block_11$1(t),p.c(),transition_in(p,1),p.m(n,i)):p&&(group_outros(),transition_out(p,1,1,()=>{p=null}),check_outros()),!t[10]&&t[43]&&t[17]&&0!=t[17]?_?(_.p(t,l),132096&l[0]&&transition_in(_,1)):(_=create_if_block_10$1(t),_.c(),transition_in(_,1),_.m(n,a)):_&&(group_outros(),transition_out(_,1,1,()=>{_=null}),check_outros()),t[41]&&t[13]&&0!=t[13]?g?(g.p(t,l),8192&l[0]&&transition_in(g,1)):(g=create_if_block_9$1(t),g.c(),transition_in(g,1),g.m(n,s)):g&&(group_outros(),transition_out(g,1,1,()=>{g=null}),check_outros());const u={};80&l[0]&&(u.class=t[6]+t[4].name),1612554239&l[0]|1&l[1]|4194304&l[4]|16&l[5]&&(u.$$scope={dirty:l,ctx:t}),c.$set(u),t[19]&&t[22]?w?(w.p(t,l),4718592&l[0]&&transition_in(w,1)):(w=create_if_block$1(t),w.c(),transition_in(w,1),w.m(d.parentNode,d)):w&&(group_outros(),transition_out(w,1,1,()=>{w=null}),check_outros())},i(t){u||(transition_in(h),transition_in(m),transition_in(f),transition_in(p),transition_in(_),transition_in(g),transition_in(c.$$.fragment,t),transition_in(w),u=!0)},o(t){transition_out(h),transition_out(m),transition_out(f),transition_out(p),transition_out(_),transition_out(g),transition_out(c.$$.fragment,t),transition_out(w),u=!1},d(t){h&&h.d(t),t&&detach(e),t&&detach(n),m&&m.d(),f&&f.d(),p&&p.d(),_&&_.d(),g&&g.d(),destroy_component(c),t&&detach(l),w&&w.d(t),t&&detach(d)}}}function create_if_block_14$1(t){let e,n;return e=new t[38]({props:{text:t[4].designation}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};16&n[0]&&(r.text=t[4].designation),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_13$1(t){let e,n;return e=new t[35]({props:{disabled:t[1]||!t[0]._id&&t[21].input,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[create_default_slot_11$1]},$$scope:{ctx:t}}}),e.$on("click",t[70]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};2097155&n[0]&&(r.disabled=t[1]||!t[0]._id&&t[21].input),16&n[5]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_11$1(t){let e,n,r;return n=new CameraIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent="Barcode scannen",create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_if_block_12$1(t){let e,n;return e=new t[35]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[create_default_slot_10$1]},$$scope:{ctx:t}}}),e.$on("click",t[77]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};16&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_10$1(t){let e,n,r,o,i=t[69](t[4].transfer)+"";return r=new ArrowDownCircleIcon({props:{size:"18"}}),{c(){e=element("span"),n=text(i),create_component(r.$$.fragment),set_style(e,"margin-right",".75em")},m(t,i){insert(t,e,i),append(e,n),mount_component(r,t,i),o=!0},p(t,e){(!o||16&e[0])&&i!==(i=t[69](t[4].transfer)+"")&&set_data(n,i)},i(t){o||(transition_in(r.$$.fragment,t),o=!0)},o(t){transition_out(r.$$.fragment,t),o=!1},d(t){t&&detach(e),destroy_component(r,t)}}}function create_if_block_11$1(t){let e,n;return e=new t[34]({props:{name:"Total Wochen",nameClass:"formField_italic",$$slots:{default:[create_default_slot_9$1]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};16384&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_9$1(t){let e,n,r;function o(e){t[83](e)}let i={item:t[46],disabled:!0};return void 0!==t[14]&&(i.value=t[14]),e=new InputNumber({props:i}),binding_callbacks.push(()=>bind(e,"value",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};!n&&16384&r[0]&&(n=!0,o.value=t[14],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_if_block_10$1(t){let e,n;return e=new t[34]({props:{name:"Total Stunden",nameClass:"formField_italic",$$slots:{default:[create_default_slot_8$1]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};131072&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_8$1(t){let e,n,r;function o(e){t[84](e)}let i={item:t[44],disabled:!0};return void 0!==t[17]&&(i.value=t[17]),e=new InputNumber({props:i}),binding_callbacks.push(()=>bind(e,"value",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};!n&&131072&r[0]&&(n=!0,o.value=t[17],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_if_block_9$1(t){let e,n;return e=new t[34]({props:{name:"Total Betrag",nameClass:"formField_italic",$$slots:{default:[create_default_slot_7$1]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};8448&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_7$1(t){let e,n,r;function o(e){t[85](e)}let i={item:t[42],disabled:!0,currency:t[8]};return void 0!==t[13]&&(i.value=t[13]),e=new InputNumber({props:i}),binding_callbacks.push(()=>bind(e,"value",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};256&r[0]&&(o.currency=t[8]),!n&&8192&r[0]&&(n=!0,o.value=t[13],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_if_block_6$1(t){let e,n;return e=new t[37]({props:{class:t[29][t[149]],open:t[12]&&!t[2]&&0===t[149]&&!t[19],$$slots:{handle:[create_handle_slot,({toggle:t,open:e})=>({150:t,12:e}),({toggle:t,open:e})=>[e?4096:0,0,0,0,t?67108864:0]],default:[create_default_slot_6$1,({toggle:t,open:e})=>({150:t,12:e}),({toggle:t,open:e})=>[e?4096:0,0,0,0,t?67108864:0]]},$$scope:{ctx:t}}}),e.$on("panel-open",function(){is_function(t[66](t[149],t[146]))&&t[66](t[149],t[146]).apply(this,arguments)}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(n,r){t=n;const o={};536870912&r[0]&&(o.class=t[29][t[149]]),528388&r[0]&&(o.open=t[12]&&!t[2]&&0===t[149]&&!t[19]),1075159035&r[0]|1&r[1]|67108864&r[4]|16&r[5]&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_each_block_3(t){let e,n;return e=new InputFormField({props:{praefix:t[149],item:t[156],eventId:t[7],fullRecord:t[0],record:t[147],recordId:t[0]._id,multiValues:t[5],reqQuantity:t[3],notifyList:t[9],noForm:noForm,classId:t[6],disabled:t[1],required:t[40],selectionFields:t[50],propSelection:t[20],numberInput:t[31],dateInput:{...t[11],l:t[4].name,t:t[149]===t[15].length-1,n:t[48].get(t[156].name)},shortEdit:t[10],currency:t[8],initFinished:t[18],formnovalidate:t[149]===t[15].length-1||t[15][t[149]]._delete}}),e.$on("notify",function(){is_function(t[54](t[4],t[156],t[149]))&&t[54](t[4],t[156],t[149]).apply(this,arguments)}),e.$on("task",function(){is_function(t[53](t[4]))&&t[53](t[4]).apply(this,arguments)}),e.$on("invalid",t[55]),e.$on("defPrep",t[56]),e.$on("checkRange",t[57]),e.$on("formula",t[67](t[149])),e.$on("record",t[86]),e.$on("listRecord",t[58](t[149])),e.$on("propSelection",t[68](t[149])),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(n,r){t=n;const o={};16&r[0]&&(o.item=t[156]),128&r[0]&&(o.eventId=t[7]),1&r[0]&&(o.fullRecord=t[0]),32768&r[0]&&(o.record=t[147]),1&r[0]&&(o.recordId=t[0]._id),32&r[0]&&(o.multiValues=t[5]),8&r[0]&&(o.reqQuantity=t[3]),512&r[0]&&(o.notifyList=t[9]),64&r[0]&&(o.classId=t[6]),2&r[0]&&(o.disabled=t[1]),1048576&r[0]&&(o.propSelection=t[20]),1&r[1]&&(o.numberInput=t[31]),34832&r[0]&&(o.dateInput={...t[11],l:t[4].name,t:t[149]===t[15].length-1,n:t[48].get(t[156].name)}),1024&r[0]&&(o.shortEdit=t[10]),256&r[0]&&(o.currency=t[8]),262144&r[0]&&(o.initFinished=t[18]),32768&r[0]&&(o.formnovalidate=t[149]===t[15].length-1||t[15][t[149]]._delete),e.$set(o)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_key_block_1(t){let e,n,r=t[4].item,o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block_3(get_each_context_3(t,r,e));const i=t=>transition_out(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=empty()},m(t,r){for(let e=0;e<o.length;e+=1)o[e].m(t,r);insert(t,e,r),n=!0},p(t,n){if(1347579&n[0]|264897025&n[1]|96&n[2]){let a;for(r=t[4].item,a=0;a<r.length;a+=1){const i=get_each_context_3(t,r,a);o[a]?(o[a].p(i,n),transition_in(o[a],1)):(o[a]=create_each_block_3(i),o[a].c(),transition_in(o[a],1),o[a].m(e.parentNode,e))}for(group_outros(),a=r.length;a<o.length;a+=1)i(a);check_outros()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)transition_out(o[t]);n=!1},d(t){destroy_each(o,t),t&&detach(e)}}}function create_key_block(t){let e,n,r=t[15][t[149]]._delete,o=create_key_block_1(t);return{c(){o.c(),e=empty()},m(t,r){o.m(t,r),insert(t,e,r),n=!0},p(t,n){32768&n[0]&&safe_not_equal(r,r=t[15][t[149]]._delete)?(group_outros(),transition_out(o,1,1,noop),check_outros(),o=create_key_block_1(t),o.c(),transition_in(o),o.m(e.parentNode,e)):o.p(t,n)},i(t){n||(transition_in(o),n=!0)},o(t){transition_out(o),n=!1},d(t){t&&detach(e),o.d(t)}}}function create_default_slot_6$1(t){let e,n,r,o,i=t[15].length,a=create_key_block(t);return{c(){e=element("div"),a.c(),r=space(),attr(e,"id",n=`accordion-content-${t[6]}-${t[4].name}-${t[149]}`)},m(t,n){insert(t,e,n),a.m(e,null),insert(t,r,n),o=!0},p(t,r){32768&r[0]&&safe_not_equal(i,i=t[15].length)?(group_outros(),transition_out(a,1,1,noop),check_outros(),a=create_key_block(t),a.c(),transition_in(a),a.m(e,null)):a.p(t,r),(!o||80&r[0]&&n!==(n=`accordion-content-${t[6]}-${t[4].name}-${t[149]}`))&&attr(e,"id",n)},i(t){o||(transition_in(a),o=!0)},o(t){transition_out(a),o=!1},d(t){t&&detach(e),a.d(t),t&&detach(r)}}}function create_if_block_8$1(t){let e,n;return e=new t[35]({props:{$$slots:{default:[create_default_slot_5$1]},$$scope:{ctx:t}}}),e.$on("click",function(){is_function(t[59](t[150],t[149],t[12]))&&t[59](t[150],t[149],t[12]).apply(this,arguments)}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(n,r){t=n;const o={};1073840144&r[0]|16&r[5]&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_5$1(t){let e,n,r,o,i,a=t[52](t[16],t[149])+"";return{c(){e=element("div"),n=text(a),attr(e,"class",r=null_to_empty("draggableListItem "+t[4].name)+" svelte-9vv5ub"),attr(e,"draggable",!0),toggle_class(e,"delete",t[147]._delete),toggle_class(e,"is-active-top",t[30]?.top===t[149]),toggle_class(e,"is-active-bottom",t[30]?.bottom===t[149])},m(r,a){insert(r,e,a),append(e,n),o||(i=[listen(e,"dragover",t[64]),listen(e,"dragleave",t[65](t[149])),listen(e,"dragstart",t[62](t[149])),listen(e,"drop",prevent_default(t[61](t[149]))),listen(e,"dragenter",t[63](t[149]))],o=!0)},p(o,i){t=o,65536&i[0]&&a!==(a=t[52](t[16],t[149])+"")&&set_data(n,a),16&i[0]&&r!==(r=null_to_empty("draggableListItem "+t[4].name)+" svelte-9vv5ub")&&attr(e,"class",r),32784&i[0]&&toggle_class(e,"delete",t[147]._delete),1073741840&i[0]&&toggle_class(e,"is-active-top",t[30]?.top===t[149]),1073741840&i[0]&&toggle_class(e,"is-active-bottom",t[30]?.bottom===t[149])},d(t){t&&detach(e),o=!1,run_all(i)}}}function create_if_block_7$1(t){let e,n,r;var o=t[153];return o&&(e=new o({props:{size:"20"}})),{c(){e&&create_component(e.$$.fragment),n=empty()},m(t,o){e&&mount_component(e,t,o),insert(t,n,o),r=!0},p(t,r){if(o!==(o=t[153])){if(e){group_outros();const t=e;transition_out(t.$$.fragment,1,0,()=>{destroy_component(t,1)}),check_outros()}o?(e=new o({props:{size:"20"}}),create_component(e.$$.fragment),transition_in(e.$$.fragment,1),mount_component(e,n.parentNode,n)):e=null}},i(t){r||(e&&transition_in(e.$$.fragment,t),r=!0)},o(t){e&&transition_out(e.$$.fragment,t),r=!1},d(t){t&&detach(n),e&&destroy_component(e,t)}}}function create_each_block_2$1(t){let e,n,r,o,i,a=!t[1]&&!t[4].readonly&&create_if_block_7$1(t);return{c(){e=element("span"),a&&a.c(),attr(e,"class","pointer icon svelte-9vv5ub"),attr(e,"title",t[151]),e.hidden=n=t[149]===t[15].length-1||!(t[147]._delete^t[152])},m(n,s){insert(n,e,s),a&&a.m(e,null),r=!0,o||(i=listen(e,"click",function(){is_function(t[60](t[149],t[12],t[150]))&&t[60](t[149],t[12],t[150]).apply(this,arguments)}),o=!0)},p(o,i){(t=o)[1]||t[4].readonly?a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros()):a?(a.p(t,i),18&i[0]&&transition_in(a,1)):(a=create_if_block_7$1(t),a.c(),transition_in(a,1),a.m(e,null)),(!r||32768&i[0]&&n!==(n=t[149]===t[15].length-1||!(t[147]._delete^t[152])))&&(e.hidden=n)},i(t){r||(transition_in(a),r=!0)},o(t){transition_out(a),r=!1},d(t){t&&detach(e),a&&a.d(),o=!1,i()}}}function create_handle_slot(t){let e,n,r,o,i,a=!t[10]&&create_if_block_8$1(t),s=[{title:"löschen",toDelete:!0,icon:DeleteIcon},{title:"undo",toDelete:!1,icon:CornerDownLeftIcon}],c=[];for(let e=0;e<2;e+=1)c[e]=create_each_block_2$1(get_each_context_2$1(t,s,e));const l=t=>transition_out(c[t],1,1,()=>{c[t]=null});return{c(){e=element("div"),a&&a.c(),n=space();for(let t=0;t<2;t+=1)c[t].c();r=space(),attr(e,"class",o=null_to_empty("accordion "+t[4].name)+" svelte-9vv5ub"),attr(e,"slot","handle")},m(t,o){insert(t,e,o),a&&a.m(e,null),append(e,n);for(let t=0;t<2;t+=1)c[t].m(e,null);append(e,r),i=!0},p(t,d){if(t[10]?a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros()):a?(a.p(t,d),1024&d[0]&&transition_in(a,1)):(a=create_if_block_8$1(t),a.c(),transition_in(a,1),a.m(e,n)),36882&d[0]|536870912&d[1]|67108864&d[4]){let n;for(s=[{title:"löschen",toDelete:!0,icon:DeleteIcon},{title:"undo",toDelete:!1,icon:CornerDownLeftIcon}],n=0;n<2;n+=1){const o=get_each_context_2$1(t,s,n);c[n]?(c[n].p(o,d),transition_in(c[n],1)):(c[n]=create_each_block_2$1(o),c[n].c(),transition_in(c[n],1),c[n].m(e,r))}for(group_outros(),n=2;n<2;n+=1)l(n);check_outros()}(!i||16&d[0]&&o!==(o=null_to_empty("accordion "+t[4].name)+" svelte-9vv5ub"))&&attr(e,"class",o)},i(t){if(!i){transition_in(a);for(let t=0;t<2;t+=1)transition_in(c[t]);i=!0}},o(t){transition_out(a),c=c.filter(Boolean);for(let t=0;t<2;t+=1)transition_out(c[t]);i=!1},d(t){t&&detach(e),a&&a.d(),destroy_each(c,t)}}}function create_each_block_1$1(t){let e,n,r=(!t[2]&&!t[1]||t[149]<t[15].length-1)&&create_if_block_6$1(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){!t[2]&&!t[1]||t[149]<t[15].length-1?r?(r.p(t,n),32774&n[0]&&transition_in(r,1)):(r=create_if_block_6$1(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_default_slot_4$1(t){let e,n,r=t[15],o=[];for(let e=0;e<r.length;e+=1)o[e]=create_each_block_1$1(get_each_context_1$1(t,r,e));const i=t=>transition_out(o[t],1,1,()=>{o[t]=null});return{c(){for(let t=0;t<o.length;t+=1)o[t].c();e=empty()},m(t,r){for(let e=0;e<o.length;e+=1)o[e].m(t,r);insert(t,e,r),n=!0},p(t,n){if(1612554239&n[0]|2146042369&n[1]|127&n[2]|71303168&n[4]){let a;for(r=t[15],a=0;a<r.length;a+=1){const i=get_each_context_1$1(t,r,a);o[a]?(o[a].p(i,n),transition_in(o[a],1)):(o[a]=create_each_block_1$1(i),o[a].c(),transition_in(o[a],1),o[a].m(e.parentNode,e))}for(group_outros(),a=r.length;a<o.length;a+=1)i(a);check_outros()}},i(t){if(!n){for(let t=0;t<r.length;t+=1)transition_in(o[t]);n=!0}},o(t){o=o.filter(Boolean);for(let t=0;t<o.length;t+=1)transition_out(o[t]);n=!1},d(t){destroy_each(o,t),t&&detach(e)}}}function create_if_block$1(t){let e,n,r;function o(e){t[88](e)}let i={$$slots:{default:[create_default_slot$2,({closeCallback:t})=>({142:t}),({closeCallback:t})=>[0,0,0,0,t?262144:0]]},$$scope:{ctx:t}};return void 0!==t[22]&&(i.open=t[22]),e=new t[32]({props:i}),binding_callbacks.push(()=>bind(e,"open",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};529006592&r[0]|262144&r[4]|16&r[5]&&(o.$$scope={dirty:r,ctx:t}),!n&&4194304&r[0]&&(n=!0,o.open=t[22],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_else_block_1$1(t){let e,n;return{c(){e=element("td"),n=text(t[24])},m(t,r){insert(t,e,r),append(e,n)},p(t,e){16777216&e[0]&&set_data(n,t[24])},d(t){t&&detach(e)}}}function create_if_block_5$1(t){let e,n,r,o;return{c(){e=element("td"),n=element("input"),attr(n,"id","reader_focusId"),n.autofocus=!0,n.value=t[23]},m(i,a){insert(i,e,a),append(e,n),n.focus(),r||(o=[listen(n,"focus",t[72]),listen(n,"input",function(){is_function(t[78](t[19].keyboard.length))&&t[78](t[19].keyboard.length).apply(this,arguments)})],r=!0)},p(e,r){t=e,8388608&r[0]&&n.value!==t[23]&&(n.value=t[23])},d(t){t&&detach(e),r=!1,run_all(o)}}}function create_if_block_4$1(t){let e,n,r,o,i,a=t[73](t[19].refItem,!0)+"";return{c(){e=element("tr"),n=element("th"),r=element("div"),o=text(a),i=text(" nicht gefunden!"),set_style(r,"color","red"),attr(n,"colspan","2")},m(t,a){insert(t,e,a),append(e,n),append(n,r),append(r,o),append(r,i)},p(t,e){524288&e[0]&&a!==(a=t[73](t[19].refItem,!0)+"")&&set_data(o,a)},d(t){t&&detach(e)}}}function create_if_block_3$1(t){let e,n,r,o,i,a=t[73](t[19].refItem)+"";return{c(){e=element("tr"),n=element("th"),r=element("div"),o=text(a),i=text(" bereits eingefügt!"),set_style(r,"color","red"),attr(n,"colspan","2")},m(t,a){insert(t,e,a),append(e,n),append(n,r),append(r,o),append(r,i)},p(t,e){524288&e[0]&&a!==(a=t[73](t[19].refItem)+"")&&set_data(o,a)},d(t){t&&detach(e)}}}function create_if_block_1$1(t){let e;let n=function(t){return"number"===t[143].type?create_if_block_2$1:create_else_block$1}(t),r=n(t);return{c(){r.c(),e=empty()},m(t,n){r.m(t,n),insert(t,e,n)},p(t,e){r.p(t,e)},d(t){r.d(t),t&&detach(e)}}}function create_else_block$1(t){let e;return{c(){e=element("input"),attr(e,"id","reader_"+t[143].name),attr(e,"type","text")},m(t,n){insert(t,e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block_2$1(t){let e,n,r;return{c(){e=element("input"),set_style(e,"width","4em"),attr(e,"id","reader_"+t[143].name),attr(e,"type","number"),attr(e,"min","0")},m(o,i){insert(o,e,i),n||(r=listen(e,"input",function(){is_function(t[78](t[19].keyboard.length,t[143]))&&t[78](t[19].keyboard.length,t[143]).apply(this,arguments)}),n=!0)},p(e,n){t=e},d(t){t&&detach(e),n=!1,r()}}}function create_each_block$1(t){let e,n,r,o,i,a,s=t[73](t[143].name)+"",c=t[25]&&create_if_block_1$1(t);return{c(){e=element("tr"),n=element("th"),r=text(s),o=space(),i=element("td"),c&&c.c(),a=space()},m(t,s){insert(t,e,s),append(e,n),append(n,r),append(e,o),append(e,i),c&&c.m(i,null),append(e,a)},p(t,e){t[25]?c?c.p(t,e):(c=create_if_block_1$1(t),c.c(),c.m(i,null)):c&&(c.d(1),c=null)},d(t){t&&detach(e),c&&c.d()}}}function create_default_slot_3$1(t){let e;return{c(){e=text("Verwerfen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_2$1(t){let e;return{c(){e=text("Speichern")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_1$1(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w,$,y,b,v,I,C=t[73](t[19].refItem)+"";function E(e){t[87](e)}let A={keyboard:t[19].keyboard,codeTypes:t[19].codeTypes};function S(t,e){return t[19].keyboard?create_if_block_5$1:create_else_block_1$1}void 0!==t[27]&&(A.readerInit=t[27]),e=new InputReader({props:A}),binding_callbacks.push(()=>bind(e,"readerInit",E)),e.$on("scan",t[71]),e.$on("exit",t[76]);let k=S(t),T=k(t);function R(t,e){return t[28]?create_if_block_3$1:t[24]&&!t[26]?create_if_block_4$1:void 0}let N=R(t),D=N&&N(t),x=t[47],O=[];for(let e=0;e<x.length;e+=1)O[e]=create_each_block$1(get_each_context$1(t,x,e));return y=new t[35]({props:{disabled:!t[24],outline:!0,style:"float: left;",$$slots:{default:[create_default_slot_3$1]},$$scope:{ctx:t}}}),y.$on("click",t[74]),v=new t[35]({props:{disabled:!t[26],filled:!0,style:"float: right;",$$slots:{default:[create_default_slot_2$1]},$$scope:{ctx:t}}}),v.$on("click",t[75]),{c(){create_component(e.$$.fragment),r=space(),o=element("div"),i=element("table"),a=element("tr"),s=element("th"),s.textContent="Code",c=space(),T.c(),l=space(),d=element("tr"),u=element("th"),h=text(C),m=space(),f=element("td"),p=element("div"),_=text(t[25]),g=space(),D&&D.c(),w=space();for(let t=0;t<O.length;t+=1)O[t].c();$=space(),create_component(y.$$.fragment),b=space(),create_component(v.$$.fragment),set_style(p,"max-width","14em"),set_style(i,"margin-top","1em"),set_style(i,"margin-bottom","1em"),set_style(i,"text-align","left"),set_style(o,"position","relative"),set_style(o,"z-index","1000"),set_style(o,"background-color","white"),set_style(o,"height","225px")},m(t,n){mount_component(e,t,n),insert(t,r,n),insert(t,o,n),append(o,i),append(i,a),append(a,s),append(a,c),T.m(a,null),append(i,l),append(i,d),append(d,u),append(u,h),append(d,m),append(d,f),append(f,p),append(p,_),append(i,g),D&&D.m(i,null),append(i,w);for(let t=0;t<O.length;t+=1)O[t].m(i,null);append(o,$),mount_component(y,o,null),append(o,b),mount_component(v,o,null),I=!0},p(t,r){const o={};if(524288&r[0]&&(o.keyboard=t[19].keyboard),524288&r[0]&&(o.codeTypes=t[19].codeTypes),!n&&134217728&r[0]&&(n=!0,o.readerInit=t[27],add_flush_callback(()=>n=!1)),e.$set(o),k===(k=S(t))&&T?T.p(t,r):(T.d(1),T=k(t),T&&(T.c(),T.m(a,null))),(!I||524288&r[0])&&C!==(C=t[73](t[19].refItem)+"")&&set_data(h,C),(!I||33554432&r[0])&&set_data(_,t[25]),N===(N=R(t))&&D?D.p(t,r):(D&&D.d(1),D=N&&N(t),D&&(D.c(),D.m(i,w))),34078720&r[0]|65536&r[1]|67584&r[2]){let e;for(x=t[47],e=0;e<x.length;e+=1){const n=get_each_context$1(t,x,e);O[e]?O[e].p(n,r):(O[e]=create_each_block$1(n),O[e].c(),O[e].m(i,null))}for(;e<O.length;e+=1)O[e].d(1);O.length=x.length}const s={};16777216&r[0]&&(s.disabled=!t[24]),16&r[5]&&(s.$$scope={dirty:r,ctx:t}),y.$set(s);const c={};67108864&r[0]&&(c.disabled=!t[26]),16&r[5]&&(c.$$scope={dirty:r,ctx:t}),v.$set(c)},i(t){I||(transition_in(e.$$.fragment,t),transition_in(y.$$.fragment,t),transition_in(v.$$.fragment,t),I=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(y.$$.fragment,t),transition_out(v.$$.fragment,t),I=!1},d(t){destroy_component(e,t),t&&detach(r),t&&detach(o),T.d(),D&&D.d(),destroy_each(O,t),destroy_component(y),destroy_component(v)}}}function create_default_slot$2(t){let e,n;return e=new t[33]({props:{title:"Scannen",class:"reader",closeCallback:t[142],$$slots:{default:[create_default_slot_1$1]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};262144&n[4]&&(r.closeCallback=t[142]),529006592&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_pending_block$1(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_fragment$2(t){let e,n,r={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block$1,then:create_then_block$1,catch:create_catch_block$1,value:141,blocks:[,,,]};return handle_promise(t[51](),r),{c(){e=empty(),r.block.c()},m(t,o){insert(t,e,o),r.block.m(t,r.anchor=o),r.mount=()=>e.parentNode,r.anchor=e,n=!0},p(e,n){update_await_block_branch(r,t=e,n)},i(t){n||(transition_in(r.block),n=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(r.blocks[t])}n=!1},d(t){t&&detach(e),r.block.d(t),r.token=null,r=null}}}let _praefix=new Map;const setPraefix=(t,e)=>{_praefix.set(e,t)},getPraefix=t=>{const e=_praefix.get(t);return void 0===e?t:e},noForm=!0,dragId="pos/target";function _delay(t){return new Promise(e=>{setTimeout(e,t)})}function instance$2(t,e,n){let r,o,i;const{Modal:a,Dialog:s,FormField:c,TextField:l,Button:d,Accordion:u,AccordionSection:h,Divider:m}=getAttractions,f=createEventDispatcher(),{loggedIn:p}=user;component_subscribe(t,p,t=>n(96,i=t));let{list:_}=e,{mainSchema:g}=e,{schema:w}=e,{record:$}=e,{multiValues:y}=e,{classId:b}=e,{eventId:v}=e,{disabled:I}=e,{fixed:C}=e,{template:E={}}=e,{reqQuantity:A}=e,{open:S=!1}=e,{currency:k}=e,{notifyList:T}=e,{shortEdit:R}=e,{dateInput:N}=e;const D=w.find(t=>"price"===t.name&&!t.properties?.hidden),x=w.find(t=>"amount"===t.name&&!t.properties?.hidden)||w.find(t=>t.isAmount&&!t.properties?.hidden),O=w.find(t=>"quantity"===t.name&&!t.properties?.hidden),M=x||D&&O,P=M&&O;let B=0;const F=w.find(t=>"quantity"===t.name&&"h"===t.properties?.unit?.constant&&!t.properties?.hidden);let L=0;const q=w.find(t=>"number"===t.type&&"w"===t.properties?.unit?.constant?.toLowerCase()&&!t.properties?.hidden)?.name||"",V=!!q;let H=0,U=!1;const z={},W=_.reader;let j,G,X,Q=w.properties?.readonly,Y=b.split("form-")[1].slice(0,-4),Z=new Map,K="",J=!0,tt="",et="",nt="",rt=!1,ot=!1,it=!1;const at=w.filter(t=>t.properties?.reader);let st=new Map;_.group&&(C=!0);const ct={},lt=new Map,dt=_.item.filter(t=>"number"===t.type&&!!t.properties?.transfer);I||=Q;let ut,ht,mt=[],ft=[],pt=!1,_t={},gt=[];const wt=async t=>{if("saleDelivery"!==_.name||!ut?.length||t[_.name]?.length){if(n(3,A=t.quantity),R)n(15,ut=t[_.name]||[]);else if(!t._id&&_.filter){const t=ut;n(15,ut=[]);const e=await Lt();n(15,ut=!1!==e?e.concat({}):t)}else n(15,ut=((t,e)=>{let n=t[e];if(n?.length||(n=[]),n=n.concat({}),t._id)return n;for(const e of w)e.preset&&!n[0][e.name]&&(n[0][e.name]=t[e.preset]);return n})(t,_.name)||[{}]);qt(t)}};w.filter(t=>t.selection).map(t=>mt.push({className:Y,parentClass:w,refClass:t.selection,value:""}));["readonly","hidden","required"].map(t=>{w.filter(e=>"object"==typeof(e.properties&&e.properties[t])).map(e=>{const n=e.properties[t].refItem||"",r=e.properties[t].refValue;let[o,i]=n.split(".");i||(i=o,o=void 0),gt.push({action:t,itemName:e.name,refObj:o,refName:i,refValue:r,op:e.properties[t].invert?"!":""})})});const $t=(t,e=!1)=>{if(!t)return"";try{if(t.split&&3===t.split("-").length)return new Date(t)?.toISOString();if(t.split&&3===t.split(".").length){const[e,n,r]=t.split("."),o=new Date(r,n-1,e);if(!isNaN(o))return o.toISOString()}}catch{}return e?t:""},yt=t=>t.slice(0,3).join(", "),bt=(t,e,o)=>async({detail:i})=>{const{oldValue:a,value:s,add:c}=i;if(a&&!s){const t=w.find(t=>t.refItem===e.refClass&&t._formulaActor);t&&Tt(o,t._formulaActor,!0)}if(s&&e.refClass){const t="p$"+e.refClass+"$"+v;let n=await getList2(t);0===n?.length&&(await _delay(500),n=await getList2(t)),n&&n.find(({_id:t})=>t==s)||await getTaskFull(e.refClass,s)}let{desc:l}=i;if(""===a&&""===s&&(l=""),t.refItem){const r=await Ct(t,o,e,t.refItem);r&&n(15,ut=r)}Tt(o,e._formulaActor);const d=mt?.find(t=>t.refClass.split(":")[1]?.split(".")[0]===e.refClass);d&&(d.value=(d.value||new Map).set(o,s)),s&&ut.length===o+1&&!R&&n(15,ut=ut.concat({})),l&&n(82,z[s]=l,z),R||await Nt(t,o,e,s,a),await At(o,e.name),n(16,r=ut),"number"===e.type&&n(31,_t={item:e,value:s,idx:o}),await vt(o),St(o)},vt=async t=>{if(ut[t]&&!_.filter&&ut.length!==t+1)for(const e of w.filter(t=>!!t.refProp)){let r,o=$[e.refItem]||ut[t][e.refItem];if(!o)continue;if(Array.isArray(o)){if(ut[t][e.name])continue;o=o[t][e.refItem]}const i="p$"+e.refItem+"$"+v;let a=await getList2(i);if(a&&(r=a.find(({_id:t})=>t==o)),r||(r=await getTaskFull(e.refItem,o)),!r)continue;const s=It(r,e.refProp)?.replace(",",".")||r[e.refProp]&&r[e.refProp][e.name]?.replace(",",".")||r[e.refProp];ut[t][e.name]||n(15,ut[t][e.name]=s,ut)}},It=(t,e)=>{try{return t.split(".").reduce((t,e)=>t[e],e)}catch(t){return""}},Ct=async(t,e,n,r)=>{if(t.filter)return;const o=$[r];if(!o?.length)return;const i=o[0][r];if(!i)return;const a=await getTaskFull(r,i);return a?a[t.name]:void 0},Et=(t,e,r,o)=>{if(!t.filter){if(o&&!1===r.refItem){const t="boolean"!==r.type&&"";ut[e][r.name]&&n(15,ut[e][r.name]=t,ut)}ut.length!==e+1&&"number"==typeof r.properties?.value&&n(15,ut[e][r.name]=r.properties.value,ut)}},At=async(t,e)=>{const r=gt.filter(t=>(t.refObj||Y)===e||t.refName===e);if(r?.length)for(const e of r){const{itemName:r,refObj:o,refName:i,refValue:a,op:s}=e;let c,l,{action:d}=e,u=!1,h=!1;if(o){const e=ut[t][o];o===Y&&i?u=$:e&&(u=await getTaskFull(o,e))}!o&&i&&(u=ut[t]),u&&(h=u[i],Array.isArray(h)&&0===h.length?h=!1:a&&(h=h==(u[a]||$[a]))),"!"===s&&(h=!h),"required"!==d&&"readonly"!==d||(d="required"===d?d:"disabled",setTimeout(()=>{c=`#accordion-content-${b}-${_.name}-${t} .form-field.${r} .field textarea`,l=document.querySelector(c),l||(c=`#accordion-content-${b}-${_.name}-${t} .form-field.${r} .field input#${"dp-"+r+"-"+t}`,l=document.querySelector(c)),l||(c=`#accordion-content-${b}-${_.name}-${t} .form-field.${r} .field input`,l=document.querySelector(c)),l&&h&&l.setAttribute(d,""),l&&!h&&l.removeAttribute(d)},0)),"hidden"===d&&(c=`#accordion-content-${b}-${_.name}-${t} .form-field.${r}`,l=document.querySelector(c),l?.classList?.toggle("hidden",h),h&&n(15,ut[t][r]="",ut))}},St=(t,e)=>{let r=`#accordion-content-${b}-${_.name}-${t} .form-field:not(.hidden) .field :required:not(:disabled)`;const o=document.querySelectorAll(r);let i=!1;o.forEach(t=>{!t.id.startsWith("dp-")&&t.required&&""===t.value&&(i=!0)}),void 0===e&&(r=`#accordion-content-${b}-${_.name}-${t} :not(.form-field.hidden) .field input.invalid`,document.querySelector(r)&&(e=!0)),n(29,ft[t]=i||e?"invalid":"",ft)},kt=t=>{if(!t)return 0;const[e,n=0]=t.split(":");return 60*e+parseInt(n)},Tt=(t,e,r=!1)=>{if(!e)return;const o=w.find(t=>t.name===e);if(!o)return;const i=o.properties.value.formula,{operator:a,argument:s}=i,c=s.map(e=>ut[t][e.refItem]||$[e.refItem]);let l=0;if("$preferred"===a&&(l=r?"":c.reduce((t,e)=>{let n=t;return"number"===o.type?n=+n||+e:n||=e,n})),"$add"===a&&(l=c.reduce((t,e)=>+(t||0)+ +(e||0))),"$subtract"===a&&(l=c.reduce((t,e)=>{t||(t=""),e||(e=""),"number"==typeof t&&(t=t.toString());const[n,r]=t.split(":");t=r?(+n+ +r/60).toFixed(2):+(n||0);let[o,i]=e.split(":");return o||(o=0),t-=i?(+o+ +i/60).toFixed(2):+(o||0)})),"$multiply"===a&&(l=c.reduce((t,e)=>+(t||0)*+(e||0))),"$percentMultiply"===a){const[t,e]=c;l=+t,+e>0&&(l*=1-e/100)}if("$percentDivide"===a){const[t,e]=c;0!=+e&&(l=+t/+e*100)}if("$percentSubtract"===a){let[t,e]=c;e.replace&&(e=e.replace(",",".")),0!=+e&&(l=+t-t*+e/100)}const d=`#accordion-content-${b}-${_.name}-${t} .form-field.${e} .field input`,u=document.querySelector(d),h=u?.disabled;n(15,ut[t][e]="$multiply"===a?l?Rt(l,o.properties?.decimals):"":Rt(l,o.properties?.decimals),ut),n(31,_t={item:o,value:l,idx:t}),setTimeout(()=>{const e=document.querySelector(d);h&&e&&e.setAttribute("disabled",""),o._formulaActor&&Tt(t,o._formulaActor)},0)},Rt=(t,e)=>("number"==typeof t&&t||(t=Number(t||0)),t.toFixed(e||0));ht=w.filter(t=>t.refClass).reduce((t,e)=>{const n=w.filter(t=>t.refItem===e.refClass);if(!n?.length)return t;if(e.selection){const[n,r]=e.selection.split(":"),[o]=r?.split(".")||[];o&&t.push({refClass:o,items:[n],selection:e.selection})}const r={refClass:e.refClass,items:[]};return n.forEach(t=>{r.items.push(t.name)}),t.push(r),t},[]);const Nt=async(t,e,r,o,i)=>{if(t.filter)return;const a=(await ht).find(t=>t.refClass===r.refClass);if(!a)return;const{refClass:s,items:c,selection:l}=a,d=r.name;if(gt.find(t=>t.itemName===d)){const n=`#accordion-content-${b}-${t.name}-${e} .form-field.${s}.hidden`;if(document.querySelector(n))return}return o?Promise.all(c.map(async t=>{let a=w.find(e=>e.name===t);if(!a)return;let d=a.refName||a.name,u="",h="";if(a.lookup){if(h=ut[e][a.name],n(15,ut[e][a.name]="",ut),!ut[e][a.refItem])return void n(15,ut[e][a.name]="",ut);let[t,r,o]=a.lookup.split(".");o||(o=r,r="");const i=a.lookupRefItem||a.refItem,s=a.lookupRefName||d,c="p$"+a.refItem+"$"+v;let l,m=await getList2(c);if(l=m?.find(({_id:t})=>t==ut[e][a.refItem]),l||(l=await getTaskFull(a.refItem,ut[e][a.refItem])),l){if(a.refItem2){const t=await getTaskFull(a.refItem2,l[a.refItem2]);if("dealerPrice"===d&&$.branch){const t=await getTaskFull("branch",$.branch);t?.sector?.includes("Privat")&&(d="price")}t&&(u=t[d])}0===+u&&(u=l[d])}if($[t]){const n=await getTaskFull(t,$[t]);if(n&&n[r]){const t=await getTaskFull(r,n[r]);if(t){const n=t[o].find(t=>t[i]===ut[e][i]);n&&(u=n[s])}}else if(n&&n[o]){const t=n[o].find(t=>t[i]===ut[e][i]);t&&(u=t[s])}}return ut[e][a.name]||n(15,ut[e][a.name]=u||h,ut),void await Tt(e,a._formulaActor)}if(a.properties?.readonly&&!r.refInput){const o=ut[e][r.refClass];return Promise.resolve(getTaskFull(r.refClass,o,!0)).then(r=>{let o=a.refPos?r[a.refPos]||It(a.refPos,r):r[t];void 0!==a.factor&&(o*=a.factor),Array.isArray(o)&&(o=o.length?o[0][t]:""),n(15,ut[e][t]=o,ut),a._formulaActor&&Tt(e,a._formulaActor)})}const{refInput:m}=r;if(m&&ut[e]){const[t,n]=m.split(".");u=n?ut[e][n]:$[t]}if(l&&o!==i)c.map(t=>{n(15,ut[e][t]="",ut)});else{if(a.refItem2){const[r,o]=a.refItem2.split(".");$[r]&&getTaskFull(r,$[r]).then(r=>{r&&+r[o]&&n(15,ut[e][t]=r[o],ut)})}if(m&&!u||Dt(e,t)||i!==o){const o=w.find(t=>t.refClass===s),i=ut[e][o.name];if(r.selection){const o=getTaskSelection(r.selection+i.toString());if(o)return Promise.resolve(o).then(r=>n(15,ut[e][t]=r[t],ut))}const a="p$"+o.refClass+"$"+v;let c=await getList2(a);if(c){const r=c.find(({_id:t})=>t==i);if(r)return Promise.resolve(()=>{n(15,ut[e][t]=r[t],ut)})}return Promise.resolve(getTaskFull(o.refClass,i)).then(r=>n(15,ut[e][t]=r[t],ut))}}})):Promise.resolve(c.map(t=>{n(15,ut[e][t]="",ut)}))},Dt=(t,e)=>{let n=ut[t][e];return"number"===w.find(t=>t.name===e).type&&(n=Number(n||0)),!n},xt=t=>{if(!t)return;const{style:e,scrollHeight:n}=t;n&&(e.height=`${n}px`)};let Ot=!1;const Mt=t=>!(!C&&t>=ut.length-1),Pt=(t,e=!1)=>{const[n,r]=t.split(";");return _.name===r&&(!!Mt(e)&&((!1===e||e!=n)&&parseInt(n)))};w.filter(t=>t.properties?.value?.formula?.argument).forEach(t=>{t.properties.value.formula.argument.forEach(e=>{const n=w.find(t=>t.name===e.refItem)||w.find(t=>t.name===e.refItem);n&&(n._formulaActor=t.name)})});const Bt=(t,e=!1)=>{const r=`#accordion-content-${b}-${_.name}-${t} > div.form-field:not(.hidden)`,o=document.querySelectorAll(r);if(!o?.length)return;const i=o[o.length-1];tick().then(()=>{const e=`#accordion-content-${b}-${_.name}-${t} textarea`;Array.from(document.querySelectorAll(e)).forEach(xt)}).then(()=>{e&&i.scrollIntoView({behavior:"smooth",block:"end"})});for(const e of w){"number"==typeof e.properties?.value&&n(15,ut[t][e.name]=e.properties.value,ut);const r=_.preserve&&_.preserve.includes(e.preset);if(e.preset&&!r&&!ut[t][e.name]){const r=lt.get(e.preset);r&&n(15,ut[t][e.name]=r,ut)}!$._id&&e.refItem&&$[e.refItem]&&getTaskFull(e.refItem,$[e.refItem]).then(r=>n(15,ut[t][e.name]=r[e.name],ut))}if(!(t<1)&&ut?.length&&t===ut.length-1&&_.preserve&&!$._id)for(const e of _.preserve){if(!ut[t-1][e])continue;const r=$t(ut[t-1][e],!0);n(15,ut[t][e]=r,ut),lt.set(e,r)}},Ft=new Map,Lt=async()=>{if(!_.filter)return[];let t,e,n,{date:r,level:o,isDealer:i}=$;if(r)[t,e,n]=r.split(".");else{r=(new Date).toISOString();const o=r.split("T")[0];[n,e,t]=o.split("-")}const a=`${n}-${e}-${t}`,s=Ft.get("dv"),c=Ft.get("lv"),l=Ft.get("iv");if(s===a&&c===o&&l===!!i)return!1;let d;Ft.set("dv",a),Ft.set("lv",o),Ft.set("iv",!!i),d=i?{$ne:""}:{$eq:""};const u={dealer:d,"_task.status":"Ready",payable:{$lt:a},_total:{$gt:0}};o&&(u.levelReminder=o),o||(u.levelReminder={$in:[void 0,!1,""]});const h=[{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:u},{$sort:{payable:1,invoiceId:1}}];return await Request.getSectionView("invoice",h)},qt=async t=>{if(!_.filter){if(t[_.name]?.length)for(const e of w)if((e.properties?.prefetch||1e3)<t[_.name].length){const n="p$"+e.refClass+"$"+v;if(getList2(n))continue;setList(n,[]);const r=Vt(t[_.name],e.name);r?.length&&setList(n,Request.getSectionView(e.refClass,{_id:{$in:r}}))}n(20,j={record:t})}},Vt=(t,e)=>Array.from(new Set(t.map(t=>t[e]).filter(t=>!!t))),Ht=()=>{n(28,ot=!1),n(25,et=""),n(23,K=""),J=!0,n(24,tt=""),n(26,nt=""),n(22,X=!0)},Ut=async({detail:t})=>{const{refItem:e,refValue:r,refDescription:o,keyboard:i,input:a}=W;let s,c="reader_";for(;t.text.length>i.length;)t.text=t.text.slice(1);if(tt===t.text&&t.item){const e=c+t.item.name;return s=document.getElementById(e),s.value=+(st.get(t.item.name)||0)+1,st.set(t.item.name,s.value),s.focus(),J=!0,void n(23,K="")}if(n(28,ot=!1),n(25,et=""),n(24,tt=t.text||""),!tt)return;const l=w.find(t=>t.name===e)?.refClass;if(!l)return;let d=await Request.getSectionView(l,{[r]:tt});d?.length?(d=d[0],n(26,nt=d._id),n(25,et=o.map(t=>d[t]).join(", ")),n(28,ot=ut.find(t=>t[e]===nt)),setTimeout(()=>{w.filter(t=>t.properties?.reader).forEach(t=>{const e=document.getElementById("reader_"+t.name);e&&(e.value=st.get(t.name)||(ot?ot[t.name]:"")),st.set(t.name,e.value)});let e=1;if(a){const{refItem:t,refValue:n}=a;for(const r of n){const{value:n,factor:o}=r,i=d[t];n.includes(","+i.split("-")[0]+"-,")&&(e=o)}}if(t.item){const n=c+t.item.name;s=document.getElementById(n),s.value=+(st.get(t.item.name)||0)+e,st.set(t.item.name,s.value),s.focus()}else{const t=w.find(t=>t.properties?.reader).name,n=c+t;s=document.getElementById(n),s.value=+(st.get(t)||0)+e,st.set(t,s.value),s.focus()}J=!0,n(23,K="")},0)):setTimeout(()=>{J=!0,n(23,K=""),n(24,tt=""),st=new Map;const t=document.getElementById("reader_focusId");t&&t.focus()},0)},zt=()=>{n(25,et=""),n(26,nt=""),n(28,ot=!1),n(27,rt=!0),Wt(),st=new Map},Wt=()=>{if(!W.keyboard)return;const t=document.getElementById("reader_focusId");t&&t.focus()};onMount(async()=>{if(!_.filter&&(G||n(21,G=await Request.getEvent(v)),($._id||!G.input)&&!(ut.length>1)&&!I&&W?.autostart)){if("object"==typeof W.autostart){if(!W.autostart.user)return;{const t=i.user,[e,n]=W.autostart.user.split(":"),r=g.find(t=>t.name===e),o=r?.refClass;if(!o||!n)return;const a=await getTaskFull(o,$[e]);if(!a)return;if(a[n]!==t)return}}else if(!0!==W.autostart)return;it=!1,Ht()}});return t.$$set=t=>{"list"in t&&n(4,_=t.list),"mainSchema"in t&&n(79,g=t.mainSchema),"schema"in t&&n(80,w=t.schema),"record"in t&&n(0,$=t.record),"multiValues"in t&&n(5,y=t.multiValues),"classId"in t&&n(6,b=t.classId),"eventId"in t&&n(7,v=t.eventId),"disabled"in t&&n(1,I=t.disabled),"fixed"in t&&n(2,C=t.fixed),"template"in t&&n(81,E=t.template),"reqQuantity"in t&&n(3,A=t.reqQuantity),"open"in t&&n(12,S=t.open),"currency"in t&&n(8,k=t.currency),"notifyList"in t&&n(9,T=t.notifyList),"shortEdit"in t&&n(10,R=t.shortEdit),"dateInput"in t&&n(11,N=t.dateInput)},t.$$.update=()=>{if(528&t.$$.dirty[0]&&T&&!_.filter){const{itemName:t,value:e}=T;lt.set(t,e),t&&t===_.name&&n(0,$[t]=e,$)}1&t.$$.dirty[0]&&wt($),32768&t.$$.dirty[0]&&n(16,r=ut),122896&t.$$.dirty[0]&&r&&((()=>{if(F)n(17,L=ut?.reduce((t,e)=>t+(e._delete?0:+(e.quantity||0)),0)||0)})(),(()=>{if(V)n(14,H=ut?.reduce((t,e)=>t+(e._delete?0:+(e[q]||0)),0)||0)})(),(()=>{if(M)n(13,B=ut?.reduce((t,e)=>{if(e.amount){const n=e.amount??0;t+=e._delete?0:+n}else if(e.price){const n=(P?e.quantity??0:1)*(e.price??0);t+=e._delete?0:n}else if(e.value){const n=e.value??0;t+=e._delete?0:+n}return t},0)||0)})(),tick().then(()=>f("save",{listName:_.name,value:ut,amountValue:B,weeksValue:H}))),1048576&t.$$.dirty[2]&&(o=t=>z[t]?.split(" • ").filter(t=>!!t&&!/^[0-9a-f]{24}/.test(t)).slice(0,2).join(" · "))},[$,I,C,A,_,y,b,v,k,T,R,N,S,B,H,ut,r,L,U,W,j,G,X,K,tt,et,nt,rt,ot,ft,pt,_t,a,s,c,d,u,h,m,p,undefined,M,{name:"amountValue",properties:{decimals:2}},F,{name:"hoursValue",properties:{decimals:2}},V,{name:"weeksValue",properties:{decimals:1}},at,lt,dt,mt,async()=>{if(!I&&(G||n(21,G=await Request.getEvent(v)),($._id||!G.input)&&W&&!W.keyboard))try{const t=await getCameras$1();t?.length||n(19,W=!1)}catch{}},(t,e)=>{let n=t[e];return ct["pos"+e]&&(n=ct["pos"+e]),n&&w.filter(t=>!0!==t.properties?.hidden&&("dateRange"===t.type||void 0!==n[t.name])&&"textarea"!==t.properties?.format).map(t=>""===n[t.name]?"":"object"===t.type?o(n[t.name]):Array.isArray(n[t.name])?yt(n[t.name]):"boolean"===t.type?checkBoolean(n[t.name]):"number"===t.type?Rt(n[t.name],t.properties?.decimals||0):"dateRange"===t.type?checkDateRange(t.name,n):"date"===t.type?checkDate($t(n[t.name])):"datetime"===t.type?checkDateTime(n[t.name]):t.properties?.multi?"":n[t.name]).filter(t=>!!t).join(" • ")||"+"},t=>({detail:{row:e}})=>{if(f("task",{row:e}),!$._id&&e._id){for(let e=0;e<ut.length;e++)for(const n of t.item)Et(t,e,n,!U);n(18,U=!0)}},bt,({detail:t})=>{const{idx:e,value:n}=t;St(e,n)},async({detail:{className:t,itemName:e,value:n}})=>{if(Z.has(t))return;if(!0!==n&&(n=(n=[].concat(n)).some(t=>t===Y+"."+_.name)),!n)return;const r={[e]:!0},o=await Request.getSectionView(t,r);o?.length&&Z.set(t,o[0])},({detail:t})=>{const{idx:e,fieldId:n,value:r}=t;if(!r)return;const o=kt(r);let i=!1;ut.forEach((t,n)=>{if(e===n)return;const{start:r,end:a}=ut[n];r&&a&&o>kt(r)&&o<kt(a)&&(i=!0)});const a=document.getElementById(n);a?.classList?.toggle("invalid",i)},t=>({detail:e})=>{e.string?n(15,ut[t][e.itemName]=e.value,ut):n(15,ut[t][e.itemName]=Rt(e.value,e.decimals),ut)},(t,e,n)=>n=>{ut[e]._delete||(t(n),Bt(e,!0))},(t,e,r)=>o=>{if(n(15,ut[t]._delete=!ut[t]._delete,ut),ut[t]._delete){ct["pos"+t]={...ut[t]};for(const e of w)n(15,ut[t][e.name]="",ut);e&&r(o)}else{if(ct["pos"+t]){const e={};for(const n of w)e[n.name]=ct["pos"+t][n.name];n(15,ut[t]=e,ut)}ct["pos"+t]=void 0,e||r(o)}},t=>e=>{e.preventDefault(),n(30,pt=!1);const r=Pt(e.dataTransfer.getData(dragId),t);if(!1===r)return;e.dataTransfer.dropEffect="move";const o=[...ut].map((t,e)=>(t._index=e,t));r<t?(o.splice(t+1,0,o[r]),o.splice(r,1)):(o.splice(t,0,o[r]),o.splice(r+1,1)),o.map((t,e)=>setPraefix(t._index,e));let i=[];ft.map((t,e)=>{i[e]=ft[getPraefix(e)]}),n(29,ft=i),n(15,ut=o.map((t,e)=>(delete t._index,t))),Ot=!1},t=>e=>{if(!Mt(t))return!1;e.dataTransfer.effectAllowed="move",e.dataTransfer.dropEffect="move",e.dataTransfer.setData(dragId,t+";"+_.name),Ot=t},t=>e=>{const r=Pt(e.dataTransfer.getData(dragId),t)||Ot;return!1===r||r===t?n(30,pt=!1):void n(30,pt={top:r>t&&t,bottom:r<t&&t})},t=>t.preventDefault(),t=>t=>{n(30,pt=!1)},(t,e)=>r=>{setTimeout(()=>{Array.from(Z).forEach(([e,r])=>{ut[t][e]||n(15,ut[t][e]=r._id,ut)})},500);const o=new Set;for(const t of gt)o.add(t.refObj||Y);for(const e of Array.from(o))At(t,e);e(r),Bt(t)},t=>({detail:e})=>{Tt(t,e.item.name)},t=>async({detail:e})=>{const{itemName:r,itemType:o,source:i,target:a,sourceId:s,prop:c}=e;if(!s)return void n(15,ut[t][r]="",ut);let l=await getTaskFull(i,s);const d=l[c];l=await getTaskFull(_.name,$[_.name][t][_.name]);const u=l[a];let h="number"===o?0:"",m=0;u.forEach(t=>{const e=t[c];e.length<=m||e.every(t=>d.find(e=>e===t))&&(h=t[r],m=e.length)}),n(15,ut[t][r]=h,ut)},t=>t?.description||"Daten übernehmen",Ht,Ut,()=>{J=!0,n(23,K="")},(t,e=!1)=>e?(zt(),""):w.find(e=>e.name===t)?.designation||"",zt,()=>{const{refItem:t}=W,e={[t]:nt};let r;w.filter(t=>t.properties?.reader).forEach(t=>{const n=document.getElementById("reader_"+t.name);n&&(e[t.name]=n.value||("number"===t.type?0:""))});let o=ut;const i=o.findIndex(e=>e[t]===nt);i>=0?(r=o[i],o[i]={...r,...e}):o=o.slice(0,-1).concat(e),n(15,ut=o),w.filter(t=>t.properties?.reader).forEach(t=>{bt(t,i>=0?i:0)({detail:{oldValue:r?r[t.name]:"",value:e[t.name]}})}),it=!0,zt()},()=>{it&&(f("readerSave"),it=!1)},()=>{const t=new Map;dt.forEach(e=>{[].concat(e.properties.transfer.target).forEach(n=>{t.set(n,e.name)})});let e=0;for(const r of ut){for(const[o,i]of t)!r[o]&&r[i]&&n(15,ut[e][o]=r[i],ut);e++}n(16,r=ut)},(t,e)=>r=>{const{data:o}=r;"0123456789".includes(o)&&(J?(n(23,K=o.toString()),J=!1):(n(23,K+=o.toString()),"77"===K&&n(23,K="7"),K.length===t&&Ut({detail:{text:K,item:e}})))},g,w,E,z,function(t){H=t,n(14,H)},function(t){L=t,n(17,L)},function(t){B=t,n(13,B)},function(e){bubble(t,e)},function(t){rt=t,n(27,rt)},function(t){X=t,n(22,X)}]}class InputList extends SvelteComponent{constructor(t){super(),document_1$1.getElementById("svelte-9vv5ub-style")||add_css$1(),init(this,t,instance$2,create_fragment$2,safe_not_equal,{list:4,mainSchema:79,schema:80,record:0,multiValues:5,classId:6,eventId:7,disabled:1,fixed:2,template:81,reqQuantity:3,open:12,currency:8,notifyList:9,shortEdit:10,dateInput:11},[-1,-1,-1,-1,-1,-1])}}const{Boolean:Boolean_1,document:document_1}=globals;function add_css(){var t=element("style");t.id="svelte-lfqa43-style",t.textContent="form.disabled.svelte-lfqa43 input.svelte-lfqa43{background-color:red !important}input:placeholder-shown{font-style:italic}form.svelte-lfqa43.svelte-lfqa43{min-width:25em}hr[data-text]{margin-bottom:1em !important}@media only screen and (min-width: 600px){form.svelte-lfqa43.svelte-lfqa43{min-width:30em}}.fEmbedded.svelte-lfqa43.svelte-lfqa43,.fTask.svelte-lfqa43.svelte-lfqa43{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-lfqa43.svelte-lfqa43{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-lfqa43.svelte-lfqa43{height:fit-content;max-height:70vh}.sTask.svelte-lfqa43.svelte-lfqa43{height:95%;display:inline-grid}.sTask.svelte-lfqa43 .btn.svelte-lfqa43{display:initial !important}.form--buttons.svelte-lfqa43.svelte-lfqa43{display:flex;gap:1em;padding-top:0.75em}.flex_div.svelte-lfqa43.svelte-lfqa43{display:flex;margin-top:1em;gap:0.5em;justify-content:space-between}section.sTask div.date-picker div.dropdown-shell div.dropdown.calendar{position:fixed !important;left:auto !important}form.fTask div.form-field{min-width:49vw}section.data + .modal-overlay > .dialog{margin-top:-5em}",append(document_1.head,t)}function get_each_context(t,e,n){const r=t.slice();return r[203]=e[n],r[205]=n,r}function get_each_context_1(t,e,n){const r=t.slice();return r[207]=e[n],r}function get_each_context_2(t,e,n){const r=t.slice();return r[210]=e[n],r}function create_catch_block(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_then_block(t){let e,n,r=t[206]&&create_if_block_5(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,e){t[206]&&r.p(t,e)},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_if_block_5(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w,$=t[23]&&create_if_block_23(t),y=t[40]&&create_if_block_22(t),b=t[0].items,v=[];for(let e=0;e<b.length;e+=1)v[e]=create_each_block_2(get_each_context_2(t,b,e));const I=t=>transition_out(v[t],1,1,()=>{v[t]=null});let C=t[0].list&&create_if_block_16(t),E=!t[4]&&!t[2]&&t[38]&&t[5]&&!t[43]&&create_if_block_15(t);h=new t[48]({props:{outline:!0,$$slots:{default:[create_default_slot_24]},$$scope:{ctx:t}}}),h.$on("click",t[68]);const A=[create_if_block_6,create_if_block_8],S=[];function k(t,e){return t[11]?0:t[38]?1:-1}return~(f=k(t))&&(p=S[f]=A[f](t)),{c(){e=element("section"),$&&$.c(),n=space(),y&&y.c(),r=space(),o=element("form"),i=element("input"),s=space();for(let t=0;t<v.length;t+=1)v[t].c();c=space(),C&&C.c(),l=space(),E&&E.c(),d=space(),u=element("div"),create_component(h.$$.fragment),m=space(),p&&p.c(),attr(i,"class",null_to_empty(t[55])+" svelte-lfqa43"),attr(i,"name","_id"),attr(i,"type","hidden"),i.value=a=t[10]._id||"",attr(o,"class",null_to_empty(t[56])+" svelte-lfqa43"),attr(o,"id",t[55]),attr(u,"class","form--buttons svelte-lfqa43"),attr(e,"class",null_to_empty(t[57])+" svelte-lfqa43")},m(a,p){insert(a,e,p),$&&$.m(e,null),append(e,n),y&&y.m(e,null),append(e,r),append(e,o),append(o,i),append(o,s);for(let t=0;t<v.length;t+=1)v[t].m(o,null);append(o,c),C&&C.m(o,null),append(e,l),E&&E.m(e,null),append(e,d),append(e,u),mount_component(h,u,null),append(u,m),~f&&S[f].m(u,null),_=!0,g||(w=[listen(o,"keydown",t[73]),listen(o,"submit",prevent_default(t[67]))],g=!0)},p(t,s){if(t[23]?$?($.p(t,s),8388608&s[0]&&transition_in($,1)):($=create_if_block_23(t),$.c(),transition_in($,1),$.m(e,n)):$&&(group_outros(),transition_out($,1,1,()=>{$=null}),check_outros()),t[40]?y?(y.p(t,s),512&s[1]&&transition_in(y,1)):(y=create_if_block_22(t),y.c(),transition_in(y,1),y.m(e,r)):y&&(group_outros(),transition_out(y,1,1,()=>{y=null}),check_outros()),(!_||1024&s[0]&&a!==(a=t[10]._id||""))&&(i.value=a),1074861057&s[0]|553652226&s[1]|2033544&s[2]){let e;for(b=t[0].items,e=0;e<b.length;e+=1){const n=get_each_context_2(t,b,e);v[e]?(v[e].p(n,s),transition_in(v[e],1)):(v[e]=create_each_block_2(n),v[e].c(),transition_in(v[e],1),v[e].m(o,c))}for(group_outros(),e=b.length;e<v.length;e+=1)I(e);check_outros()}t[0].list?C?(C.p(t,s),1&s[0]&&transition_in(C,1)):(C=create_if_block_16(t),C.c(),transition_in(C,1),C.m(o,null)):C&&(group_outros(),transition_out(C,1,1,()=>{C=null}),check_outros()),t[4]||t[2]||!t[38]||!t[5]||t[43]?E&&(group_outros(),transition_out(E,1,1,()=>{E=null}),check_outros()):E?(E.p(t,s),52&s[0]|4224&s[1]&&transition_in(E,1)):(E=create_if_block_15(t),E.c(),transition_in(E,1),E.m(e,d));const l={};134217728&s[6]&&(l.$$scope={dirty:s,ctx:t}),h.$set(l);let m=f;f=k(t),f===m?~f&&S[f].p(t,s):(p&&(group_outros(),transition_out(S[m],1,1,()=>{S[m]=null}),check_outros()),~f?(p=S[f],p?p.p(t,s):(p=S[f]=A[f](t),p.c()),transition_in(p,1),p.m(u,null)):p=null)},i(t){if(!_){transition_in($),transition_in(y);for(let t=0;t<b.length;t+=1)transition_in(v[t]);transition_in(C),transition_in(E),transition_in(h.$$.fragment,t),transition_in(p),_=!0}},o(t){transition_out($),transition_out(y),v=v.filter(Boolean_1);for(let t=0;t<v.length;t+=1)transition_out(v[t]);transition_out(C),transition_out(E),transition_out(h.$$.fragment,t),transition_out(p),_=!1},d(t){t&&detach(e),$&&$.d(),y&&y.d(),destroy_each(v,t),C&&C.d(),E&&E.d(),destroy_component(h),~f&&S[f].d(),g=!1,run_all(w)}}}function create_if_block_23(t){let e,n;return e=new t[48]({props:{disabled:t[43]||t[10]._id,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[create_default_slot_30]},$$scope:{ctx:t}}}),e.$on("click",t[90]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1024&n[0]|4096&n[1]&&(r.disabled=t[43]||t[10]._id),134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_30(t){let e,n,r;return n=new CameraIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent="QR Code scannen",create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_if_block_22(t){let e,n;return e=new t[48]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[create_default_slot_29]},$$scope:{ctx:t}}}),e.$on("click",t[88]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_29(t){let e,n,r;return n=new FilePlusIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent="Dokument ergänzen",create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_if_block_21(t){let e,n;return e=new InputFormField({props:{classId:t[55],item:t[210],selection:t[210].selection,record:t[10],disabled:t[43],eventId:t[65],multiValues:t[60],notifyList:t[12],toDelete:t[20],currency:t[16],changeValue:t[32],initFinished:t[30]}}),e.$on("save",t[72]),e.$on("task",t[69]),e.$on("notify",t[70]),e.$on("safeReference",t[79]),e.$on("multi",t[71]),e.$on("defPrep",t[78]),e.$on("record",t[80]),e.$on("objRecord",t[81]),e.$on("formula",t[82]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1&n[0]&&(r.item=t[210]),1&n[0]&&(r.selection=t[210].selection),1024&n[0]&&(r.record=t[10]),4096&n[1]&&(r.disabled=t[43]),4096&n[0]&&(r.notifyList=t[12]),1048576&n[0]&&(r.toDelete=t[20]),65536&n[0]&&(r.currency=t[16]),2&n[1]&&(r.changeValue=t[32]),1073741824&n[0]&&(r.initFinished=t[30]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_each_block_2(t){let e,n,r="list"!==t[210].type&&create_if_block_21(t);return{c(){r&&r.c(),e=empty()},m(t,o){r&&r.m(t,o),insert(t,e,o),n=!0},p(t,n){"list"!==t[210].type?r?(r.p(t,n),1&n[0]&&transition_in(r,1)):(r=create_if_block_21(t),r.c(),transition_in(r,1),r.m(e.parentNode,e)):r&&(group_outros(),transition_out(r,1,1,()=>{r=null}),check_outros())},i(t){n||(transition_in(r),n=!0)},o(t){transition_out(r),n=!1},d(t){r&&r.d(t),t&&detach(e)}}}function create_if_block_16(t){let e,n,r,o,i,a=t[7]&&t[61]&&t[17]&&0!=t[17]&&create_if_block_20(t),s=t[18]&&create_if_block_19(t),c=t[62]&&t[31]&&0!=t[31]&&create_if_block_18(t),l=t[0].list,d=[];for(let e=0;e<l.length;e+=1)d[e]=create_each_block_1(get_each_context_1(t,l,e));const u=t=>transition_out(d[t],1,1,()=>{d[t]=null});return{c(){a&&a.c(),e=space(),s&&s.c(),n=space(),c&&c.c(),r=space();for(let t=0;t<d.length;t+=1)d[t].c();o=empty()},m(t,l){a&&a.m(t,l),insert(t,e,l),s&&s.m(t,l),insert(t,n,l),c&&c.m(t,l),insert(t,r,l);for(let e=0;e<d.length;e+=1)d[e].m(t,l);insert(t,o,l),i=!0},p(t,i){if(t[7]&&t[61]&&t[17]&&0!=t[17]?a?(a.p(t,i),131200&i[0]&&transition_in(a,1)):(a=create_if_block_20(t),a.c(),transition_in(a,1),a.m(e.parentNode,e)):a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros()),t[18]?s?(s.p(t,i),262144&i[0]&&transition_in(s,1)):(s=create_if_block_19(t),s.c(),transition_in(s,1),s.m(n.parentNode,n)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros()),t[62]&&t[31]&&0!=t[31]?c?(c.p(t,i),1&i[1]&&transition_in(c,1)):(c=create_if_block_18(t),c.c(),transition_in(c,1),c.m(r.parentNode,r)):c&&(group_outros(),transition_out(c,1,1,()=>{c=null}),check_outros()),6411333&i[0]|553652236&i[1]|134480904&i[2]){let e;for(l=t[0].list,e=0;e<l.length;e+=1){const n=get_each_context_1(t,l,e);d[e]?(d[e].p(n,i),transition_in(d[e],1)):(d[e]=create_each_block_1(n),d[e].c(),transition_in(d[e],1),d[e].m(o.parentNode,o))}for(group_outros(),e=l.length;e<d.length;e+=1)u(e);check_outros()}},i(t){if(!i){transition_in(a),transition_in(s),transition_in(c);for(let t=0;t<l.length;t+=1)transition_in(d[t]);i=!0}},o(t){transition_out(a),transition_out(s),transition_out(c),d=d.filter(Boolean_1);for(let t=0;t<d.length;t+=1)transition_out(d[t]);i=!1},d(t){a&&a.d(t),t&&detach(e),s&&s.d(t),t&&detach(n),c&&c.d(t),t&&detach(r),destroy_each(d,t),t&&detach(o)}}}function create_if_block_20(t){let e,n;return e=new t[49]({props:{name:"Total Dokument",nameClass:"formField_italic",$$slots:{default:[create_default_slot_28]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};196608&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_28(t){let e,n,r;function o(e){t[105](e)}let i={item:t[58],disabled:!0,currency:t[16]};return void 0!==t[17]&&(i.value=t[17]),e=new InputNumber({props:i}),binding_callbacks.push(()=>bind(e,"value",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};65536&r[0]&&(o.currency=t[16]),!n&&131072&r[0]&&(n=!0,o.value=t[17],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_if_block_19(t){let e,n;return e=new t[49]({props:{name:"Total MWSt "+(t[19]?"("+t[19]+"%)":""),nameClass:"formField_italic",$$slots:{default:[create_default_slot_27]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};524288&n[0]&&(r.name="Total MWSt "+(t[19]?"("+t[19]+"%)":"")),327680&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_27(t){let e,n,r;function o(e){t[106](e)}let i={item:t[59],disabled:!0,currency:t[16]};return void 0!==t[18]&&(i.value=t[18]),e=new InputNumber({props:i}),binding_callbacks.push(()=>bind(e,"value",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};65536&r[0]&&(o.currency=t[16]),!n&&262144&r[0]&&(n=!0,o.value=t[18],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_if_block_18(t){let e,n;return e=new t[49]({props:{name:"Gesamtzeit in Wochen",nameClass:"formField_italic",$$slots:{default:[create_default_slot_26]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};1&n[1]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_26(t){let e,n,r;function o(e){t[107](e)}let i={item:t[63],disabled:!0};return void 0!==t[31]&&(i.value=t[31]),e=new InputNumber({props:i}),binding_callbacks.push(()=>bind(e,"value",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};!n&&1&r[1]&&(n=!0,o.value=t[31],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_else_block_2(t){let e,n,r,o;return e=new t[47]({props:{text:t[207].designation}}),r=new InputObject({props:{classId:t[55],open:!t[2]&&1===t[0].list.length,list:t[207],template:t[33],eventId:t[65],schema:t[207].item,record:t[10],disabled:t[43],currency:t[16],update:t[14]}}),{c(){create_component(e.$$.fragment),n=space(),create_component(r.$$.fragment)},m(t,i){mount_component(e,t,i),insert(t,n,i),mount_component(r,t,i),o=!0},p(t,n){const o={};1&n[0]&&(o.text=t[207].designation),e.$set(o);const i={};5&n[0]&&(i.open=!t[2]&&1===t[0].list.length),1&n[0]&&(i.list=t[207]),4&n[1]&&(i.template=t[33]),1&n[0]&&(i.schema=t[207].item),1024&n[0]&&(i.record=t[10]),4096&n[1]&&(i.disabled=t[43]),65536&n[0]&&(i.currency=t[16]),16384&n[0]&&(i.update=t[14]),r.$set(i)},i(t){o||(transition_in(e.$$.fragment,t),transition_in(r.$$.fragment,t),o=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(r.$$.fragment,t),o=!1},d(t){destroy_component(e,t),t&&detach(n),destroy_component(r,t)}}}function create_if_block_17(t){let e,n;return e=new InputList({props:{classId:t[55],open:t[22],list:t[207],template:t[34],eventId:t[65],schema:t[207].item,mainSchema:t[0].items,record:t[10],disabled:t[43],fixed:t[207].fixed,reqQuantity:t[21],currency:t[16],notifyList:t[12],multiValues:t[60],shortEdit:t[6],dateInput:t[15]}}),e.$on("save",t[72]),e.$on("record",t[80]),e.$on("readerSave",t[89]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4194304&n[0]&&(r.open=t[22]),1&n[0]&&(r.list=t[207]),8&n[1]&&(r.template=t[34]),1&n[0]&&(r.schema=t[207].item),1&n[0]&&(r.mainSchema=t[0].items),1024&n[0]&&(r.record=t[10]),4096&n[1]&&(r.disabled=t[43]),1&n[0]&&(r.fixed=t[207].fixed),2097152&n[0]&&(r.reqQuantity=t[21]),65536&n[0]&&(r.currency=t[16]),4096&n[0]&&(r.notifyList=t[12]),64&n[0]&&(r.shortEdit=t[6]),32768&n[0]&&(r.dateInput=t[15]),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_each_block_1(t){let e,n,r,o;const i=[create_if_block_17,create_else_block_2],a=[];function s(t,e){return"array"===t[207].type?0:1}return e=s(t),n=a[e]=i[e](t),{c(){n.c(),r=empty()},m(t,n){a[e].m(t,n),insert(t,r,n),o=!0},p(t,o){let c=e;e=s(t),e===c?a[e].p(t,o):(group_outros(),transition_out(a[c],1,1,()=>{a[c]=null}),check_outros(),n=a[e],n?n.p(t,o):(n=a[e]=i[e](t),n.c()),transition_in(n,1),n.m(r.parentNode,r))},i(t){o||(transition_in(n),o=!0)},o(t){transition_out(n),o=!1},d(t){a[e].d(t),t&&detach(r)}}}function create_if_block_15(t){let e,n,r,o;function i(e){t[108](e)}let a={title:"",$$slots:{default:[create_default_slot_25]},$$scope:{ctx:t}};return void 0!==t[37]&&(a.checked=t[37]),n=new t[50]({props:a}),binding_callbacks.push(()=>bind(n,"checked",i)),{c(){e=element("div"),create_component(n.$$.fragment),attr(e,"class","askNext"),set_style(e,"margin-top","1em"),set_style(e,"margin-left","23em")},m(t,r){insert(t,e,r),mount_component(n,e,null),o=!0},p(t,e){const o={};134217728&e[6]&&(o.$$scope={dirty:e,ctx:t}),!r&&64&e[1]&&(r=!0,o.checked=t[37],add_flush_callback(()=>r=!1)),n.$set(o)},i(t){o||(transition_in(n.$$.fragment,t),o=!0)},o(t){transition_out(n.$$.fragment,t),o=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_default_slot_25(t){let e;return{c(){e=element("span"),e.textContent="Weiter erfassen",set_style(e,"margin-left",".75em")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_24(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_8(t){let e,n,r,o,i,a=!(t[39]||t[37])&&create_if_block_14(t),s=t[5]&&!t[43]&&create_if_block_13(t),c=t[2]&&t[3]&&create_if_block_12(t),l=t[35]&&create_if_block_9(t);return{c(){a&&a.c(),e=space(),s&&s.c(),n=space(),c&&c.c(),r=space(),l&&l.c(),o=empty()},m(t,d){a&&a.m(t,d),insert(t,e,d),s&&s.m(t,d),insert(t,n,d),c&&c.m(t,d),insert(t,r,d),l&&l.m(t,d),insert(t,o,d),i=!0},p(t,i){t[39]||t[37]?a&&(group_outros(),transition_out(a,1,1,()=>{a=null}),check_outros()):a?(a.p(t,i),320&i[1]&&transition_in(a,1)):(a=create_if_block_14(t),a.c(),transition_in(a,1),a.m(e.parentNode,e)),t[5]&&!t[43]?s?(s.p(t,i),32&i[0]|4096&i[1]&&transition_in(s,1)):(s=create_if_block_13(t),s.c(),transition_in(s,1),s.m(n.parentNode,n)):s&&(group_outros(),transition_out(s,1,1,()=>{s=null}),check_outros()),t[2]&&t[3]?c?(c.p(t,i),12&i[0]&&transition_in(c,1)):(c=create_if_block_12(t),c.c(),transition_in(c,1),c.m(r.parentNode,r)):c&&(group_outros(),transition_out(c,1,1,()=>{c=null}),check_outros()),t[35]?l?(l.p(t,i),16&i[1]&&transition_in(l,1)):(l=create_if_block_9(t),l.c(),transition_in(l,1),l.m(o.parentNode,o)):l&&(group_outros(),transition_out(l,1,1,()=>{l=null}),check_outros())},i(t){i||(transition_in(a),transition_in(s),transition_in(c),transition_in(l),i=!0)},o(t){transition_out(a),transition_out(s),transition_out(c),transition_out(l),i=!1},d(t){a&&a.d(t),t&&detach(e),s&&s.d(t),t&&detach(n),c&&c.d(t),t&&detach(r),l&&l.d(t),t&&detach(o)}}}function create_if_block_6(t){let e,n,r,o;e=new t[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[create_default_slot_16]},$$scope:{ctx:t}}}),e.$on("click",t[76]);let i=t[36]&&create_if_block_7(t);return{c(){create_component(e.$$.fragment),n=space(),i&&i.c(),r=empty()},m(t,a){mount_component(e,t,a),insert(t,n,a),i&&i.m(t,a),insert(t,r,a),o=!0},p(t,n){const o={};134217728&n[6]&&(o.$$scope={dirty:n,ctx:t}),e.$set(o),t[36]?i?(i.p(t,n),32&n[1]&&transition_in(i,1)):(i=create_if_block_7(t),i.c(),transition_in(i,1),i.m(r.parentNode,r)):i&&(group_outros(),transition_out(i,1,1,()=>{i=null}),check_outros())},i(t){o||(transition_in(e.$$.fragment,t),transition_in(i),o=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(i),o=!1},d(t){destroy_component(e,t),t&&detach(n),i&&i.d(t),t&&detach(r)}}}function create_if_block_14(t){let e,n;return e=new t[48]({props:{class:"close",disabled:t[43],form:t[55],filled:!0,type:"submit",$$slots:{default:[create_default_slot_23]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4096&n[1]&&(r.disabled=t[43]),134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_23(t){let e;return{c(){e=text("Speichern und schliessen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_13(t){let e,n;return e=new t[48]({props:{form:t[55],filled:!0,type:"submit",style:"opacity: 0.75;",$$slots:{default:[create_default_slot_22]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};256&n[1]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_22(t){let e,n=(t[39]||"Speichern")+"";return{c(){e=text(n)},m(t,n){insert(t,e,n)},p(t,r){256&r[1]&&n!==(n=(t[39]||"Speichern")+"")&&set_data(e,n)},d(t){t&&detach(e)}}}function create_if_block_12(t){let e,n;return e=new t[48]({props:{disabled:t[43],danger:!0,outline:!0,$$slots:{default:[create_default_slot_21]},$$scope:{ctx:t}}}),e.$on("click",t[84]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};4096&n[1]&&(r.disabled=t[43]),134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_21(t){let e;return{c(){e=text("Löschen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_if_block_9(t){let e,n,r,o,i;const a=[create_if_block_11,create_else_block_1],s=[];e=function(t){return t[64]?0:1}(t),n=s[e]=a[e](t);let c=t[36]&&create_if_block_10(t);return{c(){n.c(),r=space(),c&&c.c(),o=empty()},m(t,n){s[e].m(t,n),insert(t,r,n),c&&c.m(t,n),insert(t,o,n),i=!0},p(t,e){n.p(t,e),t[36]?c?(c.p(t,e),32&e[1]&&transition_in(c,1)):(c=create_if_block_10(t),c.c(),transition_in(c,1),c.m(o.parentNode,o)):c&&(group_outros(),transition_out(c,1,1,()=>{c=null}),check_outros())},i(t){i||(transition_in(n),transition_in(c),i=!0)},o(t){transition_out(n),transition_out(c),i=!1},d(t){s[e].d(t),t&&detach(r),c&&c.d(t),t&&detach(o)}}}function create_else_block_1(t){let e,n;return e=new t[48]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[create_default_slot_20]},$$scope:{ctx:t}}}),e.$on("click",function(){is_function(t[74](t[1]))&&t[74](t[1]).apply(this,arguments)}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(n,r){t=n;const o={};134217728&r[6]&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_11(t){let e,n;return e=new PopOver({props:{text:t[64],extended:!0,$$slots:{default:[create_default_slot_18]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};2&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_20(t){let e,n,r;return n=new PrinterIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent=`${t[83]()}`,create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_default_slot_19(t){let e,n,r;return n=new PrinterIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent=`${t[83]()}`,create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_default_slot_18(t){let e,n;return e=new t[48]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[create_default_slot_19]},$$scope:{ctx:t}}}),e.$on("click",function(){is_function(t[74](t[1]))&&t[74](t[1]).apply(this,arguments)}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(n,r){t=n;const o={};134217728&r[6]&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block_10(t){let e,n;return e=new t[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[create_default_slot_17]},$$scope:{ctx:t}}}),e.$on("click",function(){is_function(t[75](t[1]))&&t[75](t[1]).apply(this,arguments)}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(n,r){t=n;const o={};134217728&r[6]&&(o.$$scope={dirty:r,ctx:t}),e.$set(o)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_17(t){let e,n,r;return n=new SearchIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent="Daten",create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_default_slot_16(t){let e,n,r;return n=new PrinterIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent="Erstellen",create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_if_block_7(t){let e,n;return e=new t[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[create_default_slot_15]},$$scope:{ctx:t}}}),e.$on("click",t[77]),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_15(t){let e,n,r;return n=new SearchIcon({props:{size:"18"}}),{c(){e=element("span"),e.textContent="Daten",create_component(n.$$.fragment),set_style(e,"margin-right",".75em")},m(t,o){insert(t,e,o),mount_component(n,t,o),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n,t)}}}function create_pending_block(t){return{c:noop,m:noop,p:noop,i:noop,o:noop,d:noop}}function create_default_slot_14(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_13(t){let e;return{c(){e=text("Ja, bitte löschen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_12(t){let e,n,r,o,i,a,s,c,l;return a=new t[48]({props:{filled:!0,$$slots:{default:[create_default_slot_14]},$$scope:{ctx:t}}}),a.$on("click",t[109]),c=new t[48]({props:{danger:!0,outline:!0,$$slots:{default:[create_default_slot_13]},$$scope:{ctx:t}}}),c.$on("click",t[87]),{c(){e=element("p"),e.textContent="Willst du diese Daten löschen?",n=space(),r=element("p"),r.textContent="Das kann nicht rückgängig gemacht werden.",o=space(),i=element("div"),create_component(a.$$.fragment),s=space(),create_component(c.$$.fragment),attr(i,"class","flex_div svelte-lfqa43")},m(t,d){insert(t,e,d),insert(t,n,d),insert(t,r,d),insert(t,o,d),insert(t,i,d),mount_component(a,i,null),append(i,s),mount_component(c,i,null),l=!0},p(t,e){const n={};134217728&e[6]&&(n.$$scope={dirty:e,ctx:t}),a.$set(n);const r={};134217728&e[6]&&(r.$$scope={dirty:e,ctx:t}),c.$set(r)},i(t){l||(transition_in(a.$$.fragment,t),transition_in(c.$$.fragment,t),l=!0)},o(t){transition_out(a.$$.fragment,t),transition_out(c.$$.fragment,t),l=!1},d(t){t&&detach(e),t&&detach(n),t&&detach(r),t&&detach(o),t&&detach(i),destroy_component(a),destroy_component(c)}}}function create_title_icon_slot_2(t){let e,n,r;return n=new AlertTriangleIcon({props:{size:"25"}}),{c(){e=element("div"),create_component(n.$$.fragment),attr(e,"slot","title-icon")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_default_slot_11(t){let e,n;return e=new t[46]({props:{title:"Bestätigung",closeCallback:t[202],danger:!0,$$slots:{"title-icon":[create_title_icon_slot_2],default:[create_default_slot_12]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};65536&n[6]&&(r.closeCallback=t[202]),134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_if_block(t){let e,n,r;function o(e){t[112](e)}let i={$$slots:{default:[create_default_slot_7,({closeCallback:t})=>({202:t}),({closeCallback:t})=>[0,0,0,0,0,0,t?65536:0]]},$$scope:{ctx:t}};return void 0!==t[24]&&(i.open=t[24]),e=new t[45]({props:i}),binding_callbacks.push(()=>bind(e,"open",o)),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};1048576e3&r[0]|134283264&r[6]&&(o.$$scope={dirty:r,ctx:t}),!n&&16777216&r[0]&&(n=!0,o.open=t[24],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_if_block_4(t){let e,n,r,o,i,a=t[93](t[23].refItem,!0)+"";return{c(){e=element("tr"),n=element("th"),r=element("div"),o=text(a),i=text(" nicht gefunden!"),set_style(r,"color","red"),attr(n,"colspan","2")},m(t,a){insert(t,e,a),append(e,n),append(n,r),append(r,o),append(r,i)},p(t,e){8388608&e[0]&&a!==(a=t[93](t[23].refItem,!0)+"")&&set_data(o,a)},d(t){t&&detach(e)}}}function create_if_block_3(t){let e,n,r,o,i,a=t[93](t[23].refItem)+"";return{c(){e=element("tr"),n=element("th"),r=element("div"),o=text(a),i=text(" bereits eingefügt!"),set_style(r,"color","red"),attr(n,"colspan","2")},m(t,a){insert(t,e,a),append(e,n),append(n,r),append(r,o),append(r,i)},p(t,e){8388608&e[0]&&a!==(a=t[93](t[23].refItem)+"")&&set_data(o,a)},d(t){t&&detach(e)}}}function create_if_block_1(t){let e;let n=function(t){return"number"===t[203].type?create_if_block_2:create_else_block}(t),r=n(t);return{c(){r.c(),e=empty()},m(t,n){r.m(t,n),insert(t,e,n)},p(t,e){r.p(t,e)},d(t){r.d(t),t&&detach(e)}}}function create_else_block(t){let e;return{c(){e=element("input"),attr(e,"id","reader_"+t[203].name),attr(e,"type","text")},m(t,n){insert(t,e,n)},p:noop,d(t){t&&detach(e)}}}function create_if_block_2(t){let e;return{c(){e=element("input"),set_style(e,"width","4em"),attr(e,"id","reader_"+t[203].name),attr(e,"type","number"),attr(e,"min","0")},m(t,n){insert(t,e,n)},p:noop,d(t){t&&detach(e)}}}function create_each_block(t){let e,n,r,o,i,a,s=t[93](t[203].name)+"",c=t[25]&&t[26]&&create_if_block_1(t);return{c(){e=element("tr"),n=element("th"),r=text(s),o=space(),i=element("td"),c&&c.c(),a=space()},m(t,s){insert(t,e,s),append(e,n),append(n,r),append(e,o),append(e,i),c&&c.m(i,null),append(e,a)},p(t,e){t[25]&&t[26]?c?c.p(t,e):(c=create_if_block_1(t),c.c(),c.m(i,null)):c&&(c.d(1),c=null)},d(t){t&&detach(e),c&&c.d()}}}function create_default_slot_10(t){let e;return{c(){e=text("Verwerfen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_9(t){let e;return{c(){e=text("Speichern")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_8(t){let e,n,r,o,i,a,s,c,l,d,u,h,m,f,p,_,g,w,$,y,b,v,I,C,E,A=t[93](t[23].refItem)+"";function S(e){t[111](e)}let k={keyboard:t[23].keyboard,codeTypes:t[23].codeTypes};function T(t,e){return t[29]?create_if_block_3:t[25]&&!t[27]?create_if_block_4:void 0}void 0!==t[28]&&(k.readerInit=t[28]),e=new InputReader({props:k}),binding_callbacks.push(()=>bind(e,"readerInit",S)),e.$on("scan",t[91]),e.$on("exit",t[96]);let R=T(t),N=R&&R(t),D=t[92](),x=[];for(let e=0;e<D.length;e+=1)x[e]=create_each_block(get_each_context(t,D,e));return v=new t[48]({props:{disabled:!t[25],outline:!0,style:"float: left;",$$slots:{default:[create_default_slot_10]},$$scope:{ctx:t}}}),v.$on("click",t[94]),C=new t[48]({props:{disabled:!t[27],filled:!0,style:"float: right;",$$slots:{default:[create_default_slot_9]},$$scope:{ctx:t}}}),C.$on("click",t[95]),{c(){create_component(e.$$.fragment),r=space(),o=element("div"),i=element("table"),a=element("tr"),s=element("th"),s.textContent="Code",c=space(),l=element("td"),d=text(t[25]),u=space(),h=element("tr"),m=element("th"),f=text(A),p=space(),_=element("td"),g=element("div"),w=text(t[26]),$=space(),N&&N.c(),y=space();for(let t=0;t<x.length;t+=1)x[t].c();b=space(),create_component(v.$$.fragment),I=space(),create_component(C.$$.fragment),set_style(g,"max-width","14em"),set_style(i,"margin-top","1em"),set_style(i,"margin-bottom","1em"),set_style(i,"text-align","left"),set_style(o,"position","relative"),set_style(o,"z-index","1000"),set_style(o,"background-color","white"),set_style(o,"height","225px")},m(t,n){mount_component(e,t,n),insert(t,r,n),insert(t,o,n),append(o,i),append(i,a),append(a,s),append(a,c),append(a,l),append(l,d),append(i,u),append(i,h),append(h,m),append(m,f),append(h,p),append(h,_),append(_,g),append(g,w),append(i,$),N&&N.m(i,null),append(i,y);for(let t=0;t<x.length;t+=1)x[t].m(i,null);append(o,b),mount_component(v,o,null),append(o,I),mount_component(C,o,null),E=!0},p(t,r){const o={};if(8388608&r[0]&&(o.keyboard=t[23].keyboard),8388608&r[0]&&(o.codeTypes=t[23].codeTypes),!n&&268435456&r[0]&&(n=!0,o.readerInit=t[28],add_flush_callback(()=>n=!1)),e.$set(o),(!E||33554432&r[0])&&set_data(d,t[25]),(!E||8388608&r[0])&&A!==(A=t[93](t[23].refItem)+"")&&set_data(f,A),(!E||67108864&r[0])&&set_data(w,t[26]),R===(R=T(t))&&N?N.p(t,r):(N&&N.d(1),N=R&&R(t),N&&(N.c(),N.m(i,y))),100663296&r[0]|1073741824&r[2]|1&r[3]){let e;for(D=t[92](),e=0;e<D.length;e+=1){const n=get_each_context(t,D,e);x[e]?x[e].p(n,r):(x[e]=create_each_block(n),x[e].c(),x[e].m(i,null))}for(;e<x.length;e+=1)x[e].d(1);x.length=D.length}const a={};33554432&r[0]&&(a.disabled=!t[25]),134217728&r[6]&&(a.$$scope={dirty:r,ctx:t}),v.$set(a);const s={};134217728&r[0]&&(s.disabled=!t[27]),134217728&r[6]&&(s.$$scope={dirty:r,ctx:t}),C.$set(s)},i(t){E||(transition_in(e.$$.fragment,t),transition_in(v.$$.fragment,t),transition_in(C.$$.fragment,t),E=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(v.$$.fragment,t),transition_out(C.$$.fragment,t),E=!1},d(t){destroy_component(e,t),t&&detach(r),t&&detach(o),N&&N.d(),destroy_each(x,t),destroy_component(v),destroy_component(C)}}}function create_default_slot_7(t){let e,n;return e=new t[46]({props:{title:"Scannen",class:"reader",closeCallback:t[202],$$slots:{default:[create_default_slot_8]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};65536&n[6]&&(r.closeCallback=t[202]),1048576e3&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_6(t){let e;return{c(){e=text("Abbrechen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_5(t){let e,n,r,o,i;return o=new t[48]({props:{filled:!0,$$slots:{default:[create_default_slot_6]},$$scope:{ctx:t}}}),o.$on("click",t[113]),{c(){e=element("progress"),n=space(),r=element("div"),create_component(o.$$.fragment),set_style(e,"width","100%"),attr(e,"id","file"),attr(e,"max","100"),e.value=t[42],attr(r,"class","flex_div svelte-lfqa43")},m(t,a){insert(t,e,a),insert(t,n,a),insert(t,r,a),mount_component(o,r,null),i=!0},p(t,n){(!i||2048&n[1])&&(e.value=t[42]);const r={};134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),o.$set(r)},i(t){i||(transition_in(o.$$.fragment,t),i=!0)},o(t){transition_out(o.$$.fragment,t),i=!1},d(t){t&&detach(e),t&&detach(n),t&&detach(r),destroy_component(o)}}}function create_title_icon_slot_1(t){let e,n,r;return n=new AlertTriangleIcon({props:{size:"25"}}),{c(){e=element("div"),create_component(n.$$.fragment),attr(e,"slot","title-icon")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_default_slot_4(t){let e,n;return e=new t[46]({props:{title:"Auswertung wird erstellt",closeCallback:t[202],$$slots:{"title-icon":[create_title_icon_slot_1],default:[create_default_slot_5]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};65536&n[6]&&(r.closeCallback=t[202]),2048&n[1]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_default_slot_3(t){let e,n;return{c(){e=element("p"),n=text(t[9])},m(t,r){insert(t,e,r),append(e,n)},p(t,e){512&e[0]&&set_data(n,t[9])},d(t){t&&detach(e)}}}function create_default_slot_2(t){let e;return{c(){e=text("Schliessen")},m(t,n){insert(t,e,n)},d(t){t&&detach(e)}}}function create_default_slot_1(t){let e,n,r,o,i;return e=new t[51]({props:{outline:!0,$$slots:{default:[create_default_slot_3]},$$scope:{ctx:t}}}),o=new t[48]({props:{danger:!0,outline:!0,$$slots:{default:[create_default_slot_2]},$$scope:{ctx:t}}}),o.$on("click",t[115]),{c(){create_component(e.$$.fragment),n=space(),r=element("div"),create_component(o.$$.fragment),attr(r,"class","flex_div svelte-lfqa43")},m(t,a){mount_component(e,t,a),insert(t,n,a),insert(t,r,a),mount_component(o,r,null),i=!0},p(t,n){const r={};512&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r);const i={};134217728&n[6]&&(i.$$scope={dirty:n,ctx:t}),o.$set(i)},i(t){i||(transition_in(e.$$.fragment,t),transition_in(o.$$.fragment,t),i=!0)},o(t){transition_out(e.$$.fragment,t),transition_out(o.$$.fragment,t),i=!1},d(t){destroy_component(e,t),t&&detach(n),t&&detach(r),destroy_component(o)}}}function create_title_icon_slot(t){let e,n,r;return n=new AlertTriangleIcon({props:{size:"25"}}),{c(){e=element("div"),create_component(n.$$.fragment),attr(e,"slot","title-icon")},m(t,o){insert(t,e,o),mount_component(n,e,null),r=!0},p:noop,i(t){r||(transition_in(n.$$.fragment,t),r=!0)},o(t){transition_out(n.$$.fragment,t),r=!1},d(t){t&&detach(e),destroy_component(n)}}}function create_default_slot$1(t){let e,n;return e=new t[46]({props:{title:"Speichern nicht erfolgreich",danger:!0,$$slots:{"title-icon":[create_title_icon_slot],default:[create_default_slot_1]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,n){const r={};768&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function create_fragment$1(t){let e,n,r,o,i,a,s,c,l,d,u,h,m;document_1.title=e=t[44];let f={ctx:t,current:null,token:null,hasCatch:!1,pending:create_pending_block,then:create_then_block,catch:create_catch_block,value:206,blocks:[,,,]};function p(e){t[110](e)}handle_promise(t[66](),f);let _={$$slots:{default:[create_default_slot_11,({closeCallback:t})=>({202:t}),({closeCallback:t})=>[0,0,0,0,0,0,t?65536:0]]},$$scope:{ctx:t}};void 0!==t[13]&&(_.open=t[13]),o=new t[45]({props:_}),binding_callbacks.push(()=>bind(o,"open",p));let g=t[23]&&t[24]&&create_if_block(t);function w(e){t[114](e)}let $={$$slots:{default:[create_default_slot_4,({closeCallback:t})=>({202:t}),({closeCallback:t})=>[0,0,0,0,0,0,t?65536:0]]},$$scope:{ctx:t}};function y(e){t[116](e)}void 0!==t[41]&&($.open=t[41]),c=new t[45]({props:$}),binding_callbacks.push(()=>bind(c,"open",w));let b={$$slots:{default:[create_default_slot$1,({closeCallback:t})=>({202:t}),({closeCallback:t})=>[0,0,0,0,0,0,t?65536:0]]},$$scope:{ctx:t}};return void 0!==t[8]&&(b.open=t[8]),u=new t[45]({props:b}),binding_callbacks.push(()=>bind(u,"open",y)),{c(){n=space(),f.block.c(),r=space(),create_component(o.$$.fragment),a=space(),g&&g.c(),s=space(),create_component(c.$$.fragment),d=space(),create_component(u.$$.fragment)},m(t,e){insert(t,n,e),f.block.m(t,f.anchor=e),f.mount=()=>r.parentNode,f.anchor=r,insert(t,r,e),mount_component(o,t,e),insert(t,a,e),g&&g.m(t,e),insert(t,s,e),mount_component(c,t,e),insert(t,d,e),mount_component(u,t,e),m=!0},p(n,r){t=n,(!m||8192&r[1])&&e!==(e=t[44])&&(document_1.title=e),update_await_block_branch(f,t,r);const a={};134283264&r[6]&&(a.$$scope={dirty:r,ctx:t}),!i&&8192&r[0]&&(i=!0,a.open=t[13],add_flush_callback(()=>i=!1)),o.$set(a),t[23]&&t[24]?g?(g.p(t,r),25165824&r[0]&&transition_in(g,1)):(g=create_if_block(t),g.c(),transition_in(g,1),g.m(s.parentNode,s)):g&&(group_outros(),transition_out(g,1,1,()=>{g=null}),check_outros());const d={};2048&r[1]|134283264&r[6]&&(d.$$scope={dirty:r,ctx:t}),!l&&1024&r[1]&&(l=!0,d.open=t[41],add_flush_callback(()=>l=!1)),c.$set(d);const p={};768&r[0]|134217728&r[6]&&(p.$$scope={dirty:r,ctx:t}),!h&&256&r[0]&&(h=!0,p.open=t[8],add_flush_callback(()=>h=!1)),u.$set(p)},i(t){m||(transition_in(f.block),transition_in(o.$$.fragment,t),transition_in(g),transition_in(c.$$.fragment,t),transition_in(u.$$.fragment,t),m=!0)},o(t){for(let t=0;t<3;t+=1){transition_out(f.blocks[t])}transition_out(o.$$.fragment,t),transition_out(g),transition_out(c.$$.fragment,t),transition_out(u.$$.fragment,t),m=!1},d(t){t&&detach(n),f.block.d(t),f.token=null,f=null,t&&detach(r),destroy_component(o,t),t&&detach(a),g&&g.d(t),t&&detach(s),destroy_component(c,t),t&&detach(d),destroy_component(u,t)}}}let gList=new Map,gTask=new Map,gTaskFull=new Map;const setList=(t,e)=>gList.set(t,e),getList2=t=>gList.get(t),getList=async(t,e)=>{const n="p$"+t+"$"+e,r=gList.get(n);if(r?.length)return r;const o=e;return gList.has(o)||(gList.set(o,[]),gList.set(o,Request.getTasksList(e).then(({data:t})=>t))),gList.get(o)},getTask=async(t,e,n,r=!1)=>{let o=gTask.get(n);if(!o)if(r)o=Request.getTaskList(t,n),gTask.set(n,o);else{const r="p$"+t+"$"+e,i=await gList.get(r);if(!i?.length)return getList(t,e).then(e=>(o=e.find(({_id:t})=>t===n),o||(o=Request.getTaskList(t,n)),gTask.set(n,o),o));o=i.find(({_id:t})=>t===n),o||(o=Request.getTaskList(t,n)),gTask.set(n,o)}return o},addTask=(t,e,n)=>{if(!gList.get(t))return;const r=e;gTask.set(r,n)},setTaskSelection=(t,e)=>{gTaskFull.set(t,e)},getTaskSelection=t=>gTaskFull.get(t),getTaskFull=(t,e,n=!1)=>{let r=!n&&gTaskFull.get(e);return r||(r=Request.getTask(t,e),gTaskFull.set(e,r)),r},refreshList=(t,e)=>{if(!gList.get(e))return;const n=e;gList.set(n,Request.getTasksList(e).then(({data:t})=>t))},resetCache=()=>{gList=new Map,gTask=new Map,gTaskFull=new Map};function sleep(t){return new Promise(e=>setTimeout(e,t))}function instance$1(t,e,n){let r,o,i,a,s,c,l,d;component_subscribe(t,taskClipboard,t=>n(134,s=t)),component_subscribe(t,settings,t=>n(135,c=t)),component_subscribe(t,currentRoles,t=>n(136,l=t));const{Modal:u,Dialog:h,Divider:m,Button:f,FormField:p,Checkbox:_,Chip:g}=getAttractions,{loggedIn:w,currentTasks:$,environment:y}=user;component_subscribe(t,w,t=>n(137,d=t)),component_subscribe(t,$,t=>n(132,i=t)),component_subscribe(t,y,t=>n(133,a=t)),JSON.parse(Storage.getItem("Locale"));const b=createEventDispatcher();let{schema:v}=e,{recID:I}=e,{deletable:C}=e,{prevEventID:E=!1}=e,{prev:A=!1}=e,{taskId:S=!1}=e,{taskOrg:k}=e,{description:T=""}=e,{root:R=!1}=e,{readonly:N}=e,{isStandalone:D}=e,{shortEdit:x=!1}=e,{shortSchema:O=!1}=e,M=!0,P=!1,B="",F=window.location.href.split("/task/")[2];F&&(F=F.split(":")[1],F&&(F=F.split("?")[0])),x&&(v=O);let L,q,V,H,U,z,W={},j={},G="form-"+v.class+Math.floor(9e3*Math.random()+1e3).toString(),X=!1,Q=!1;const Y=R?"fEmbedded":"fTask",Z=R?"sEmbedded":"sTask";let K="CHF";const J=new Map;let tt,et,nt=0,rt=0,ot=0,it=0,at=1,st=!I&&v.list&&1===v.list.length;const ct={},lt=v.items.find(t=>"price"===t.name&&!t.properties?.hidden),dt=v.items.find(t=>"quantity"===t.name&&!t.properties?.hidden),ut=v.items.find(t=>"amount"===t.name&&!t.properties?.hidden),ht=!!lt||!!ut,mt=v.list?.filter(t=>"array"===t.type)?.length>1||v.items?.filter(t=>t.name.startsWith("amount"))||ht,ft=v.items.find(t=>"number"===t.type&&"w"===t.properties?.unit?.constant?.toLowerCase()&&!t.properties?.hidden)?.name,pt=!!ft,_t=v.list?.filter(t=>"array"===t.type)?.length>1||pt,gt={},wt=v.result?.resultDef[0].button?.description;let $t,yt,bt,vt,It,Ct,Et,At,St,kt,Tt,Rt,Nt,Dt="",xt="",Ot="",Mt=!1,Pt=!1,Bt=!1,Ft=!1,Lt=!1,qt=0,Vt=0,Ht=[],Ut=[],zt=[],Wt={},jt=new Map,Gt=v.class,Xt=v.id,Qt=!1,Yt=-1!==window.location.search.indexOf("next="),Zt=0;const Kt=-1!==window.location.search.indexOf("back=true");St=At=!i?.length||i.find(t=>t===Xt);["readonly","hidden","required"].map(t=>{v.items.filter(e=>"object"==typeof(e.properties&&e.properties[t])).map(e=>{const n=e.properties[t].refItem||"",[r,o]=n.split(".");Ht.push({action:t,itemName:e.name,refObj:r,refName:o,op:e.properties[t].invert?"!":""})})});v.items.filter(t=>t.selection&&t.constraint).map(t=>{Ut.push({name:t.name,selection:t.selection,constraint:t.constraint})});v.items.filter(t=>t.lookup).forEach(t=>{zt.push({name:t.name,lookup:t.lookup})}),v.items.filter(t=>t.properties?.lookup).forEach(t=>{zt.push({name:t.name,lookup:t.properties.lookup.split(":").at(-1)})});const Jt=async t=>{if(t?.length)for(const e of t){if(!e.lookup)break;const{name:t}=e;if(W[t])break;const{domain:r,value:o}=e.lookup;if("user"===r&&o){const e=d.user,r={[o]:e},i=await Request.getSectionView(t,r);if(i?.length){const[{_id:e}]=i;e&&n(10,W[t]=e,W)}}}},te=async t=>{if(!v.input)return;if(!v.input.length)return;if(v.input.length<2)return;const e=!t.input.class[0].name&&t.input.class[0].selection;if(!e)return;const r=t.input.class[1].name,[o,i]=t.input.class[1].destination?.split(".");if(!r||!i)return;const a=v.list?.find(t=>t.name===o);if(!a)return;if(a.filter)return;const s=await Request.getSchemaByClass(e),c=(await Request.getTasks(s.id)).data;if(!c?.length)return;const l=[];for(const t of c)if(t.active??1){const e={};for(const n of a.item)n.name===i?e[n.name]=t._id:t[n.name]&&(e[n.name]=t[n.name]);l.push(e)}l.length&&n(10,W[o]=l,W)},ee=async t=>{if(!v.input)return;if(!v.input.length)return;if(v.input.length>1)return;const e=Ct.input.class[0],{name:n,selection:r,state:o,list:i}=e;n||r&&o&&i&&await ne(r,o,i)},ne=async(t,e,r)=>{const o=(await Request.getEvents()).filter(e=>e.output?.class?.at(0)?.name===t),i={[r]:[]};for(const n of o){let o={event:n._id,status:e};const a=await Request.getSectionView("_task",o);if(a?.length){o={_id:{$in:a.map(t=>t.docId)}};const e=await Request.getSectionView(t,o);for(const n of e){const e=v.list.find(t=>t.name===r);if(e){const o={[t]:n._id.toString()};for(const t of e.item)n[t.name]&&(o[t.name]=n[t.name]);i[r].push(o)}}}}setTimeout(()=>n(10,W={...W,...i}),100)},re=()=>{for(const t of v.items)"boolean"==typeof t.properties?.value&&n(10,W[t.name]=t.properties.value,W),"string"==typeof t.properties?.value&&n(10,W[t.name]=t.properties.value,W),t.properties?.value?.concatenation&&ie(t);oe()},oe=async()=>{for(const t of v.list||[])for(const e of t.item)if(e.refItem&&"array"!==t.type)if("owner"===e.refItem){const r=a.owner;r||set_store_value(y,a.owner=r=(await Request.getSolitaire(e.refItem))[0],a),a.owner||(await Request.getSolitaire(e.refItem))[0],r&&(W[t.name]||n(10,W[t.name]={},W),n(10,W[t.name][e.name]=getData(r,e.refPos||e.name),W))}else if(W[e.refItem]){const r=await Request.getTask(e.refItem,W[e.refItem]);r&&(W[t.name]||n(10,W[t.name]={},W),n(10,W[t.name][e.name]=getData(r,e.refPos||e.name),W))}},ie=async t=>{const e=t.properties.value.concatenation;let r="";for(const t of e)void 0!==t.constant&&(r+=t.constant),"year"===t.variable&&(r+=(new Date).getFullYear()),t.refItemNext&&(r+=await se(t.refItemNext));n(10,W[t.name]=r,W)},ae=async t=>{const e=Ht.filter(e=>e.refObj===t||e.itemName===t);if(e?.length){n(32,Wt={});for(const t of e){const{itemName:e,refObj:r,refName:o,op:i}=t;let{action:a}=t;if(!r)break;let s,c,l=!o&&W[r];const d=W[r];d&&o&&(l=(await getTaskFull(r,d))[o]),Array.isArray(l)&&0===l.length&&(l=!1),"!"===i&&(l=!l),"required"!==a&&"readonly"!==a||(a="required"===a?a:"disabled",setTimeout(()=>{s=`#${G} .form-field.${e} .field #${e}`,c=document.querySelector(s),c&&l&&c.setAttribute(a,""),c&&!l&&c.removeAttribute(a)},0)),"hidden"===a&&(s=`#${G} .form-field.${e}`,c=document.querySelector(s),c?.classList?.toggle("hidden",!!l),l&&n(32,Wt[e]="",Wt))}}},se=async t=>{const[e,n]=t.offset?.split(",")||[0,0],r=+t.base||0,o=+t.step||1;t.type;const i=t.refItem,a=await Request.getLastId(v.class,i);if(!a?.length)return(r+o).toString().padStart(n,"0");let s=a[0][i];+s<r&&(s=r.toString());return((+s?.substring(e,e+n)||r)+o).toString().padStart(n,"0")},ce=(t,e,n,r=!1)=>{const o=n||e.name,i=o.startsWith("_")?o:o.split("_")[0],a=t.find(t=>t.name===i);let s=e.value;if(!a)return s;if(r||"signature"!==a.type&&!a.properties?.multi||W[o]&&!s&&(s=W[o]),"dateRange"===a.type){if(null===s)return;let t=new Date(s);if("Invalid Date"==t)return;return t=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,"0")}-${t.getDate().toString().padStart(2,"0")}T00:00:00.000Z`,new Date(t).toISOString()}if(s&&a.type.startsWith("date"))try{return parseDateTime(s,"%d.%m.%Y").toISOString()}catch{return new Date(s).toISOString()}if("boolean"===a.type&&(s=!!e.checked),"number"===a.type){const t=a.properties?.decimals||0;try{s=Number(s.replace(",",".")).toFixed(t).toString()}catch{}}if(r&&"date"===a.type&&a.properties?.required&&!s&&W[o]){s=W[o];try{return parseDateTime(s,"%d.%m.%Y").toISOString()}catch{return s}}return s},le=async t=>{n(43,r=!0);const e=t.submitter?.className?.includes("close"),o={_docAsync:t?._docAsync};Array.from(document.querySelectorAll("form#"+G+" ."+G)).map(t=>{if(t.name)if(t.name.includes(".")){const e=t.name.split(".")[0],n=v.items.find(t=>t.name===e);if(n&&"object"===n.type&&n.properties?.multi)o[e]=(o[e]||[]).concat(t.value);else{const[e,n]=t.name.split("."),r=v.list.find(t=>t.name===e);o[t.name]=ce(r.item,t)}}else o[t.name]=ce(v.items,t);else if(t.id){"signature"===v.items.find(e=>e.name===t.id).type&&(t.name=t.id,o[t.name]=ce(v.items,t))}});let i=!1;if(v.list&&v.list.map(t=>{if(t.mandatory){const e=j[t.name]?.filter(t=>!t._delete).length;if(!e||e<2)return void(i=!0)}"array"===t.type&&j[t.name]&&(t.item.forEach(e=>{for(const n of j[t.name])void 0===n[e.name]&&(n[e.name]="boolean"!==e.type&&"")}),o[t.name]=j[t.name].reduce((e,n)=>n._delete||!Object.values(n).some(Boolean)?e:e.concat(Object.entries(n).reduce((e,[n,r])=>("_delete"!==n&&(e[n]=ce(t.item,{name:n,value:r,checked:r},"",!0)),e),{})),[]))}),i)return toasts.failed("Bitte Positionen erfassen",3e3),void n(43,r=!1);if(o._event=Xt,o._prevEventId=E,o._taskId=S,H){const t=H.record;for(const e in t)e.includes(".")&&delete t[e];t._event=H.event,t._taskId=H.taskId;const{id:e}=await Request.saveData(H.class,t);o[H.class]||(o[H.class]=e)}if(x)return de(v.class,o),n(43,r=!1),he();const{id:a,task:s,tax:c,error:l,state:d,info:u}=await Request.saveData(v.class,o);if(l?.text){const t=l.field?" in "+l.field+": "+l.value:"";if(n(9,B=`${l.text} ${t}`),n(8,P=!0),!d)return void n(43,r=!1)}if(Rt){const t=new FormData;t.append("title",Rt.fileName),t.append("file",Rt.file),await Request.uploadUserReport(s,t)}u&&!Array.isArray(u)&&u.accepted?u.accepted?.length?toasts.success(`Email versandt an ${u.accepted.join(", ")}, Dateigrösse: ${u.messageSize} Bytes.`,5e3):(n(9,B="Email konnte nicht versandt werden!"),n(8,P=!0)):toasts.success("Die Daten wurden gespeichert.",2e3),n(43,r=!1),n(18,rt=c?._amount||0),n(19,ot=100*(c?._rate||0)||""),ge(),o._id=a;const h=await Request.getTaskList(v.class,a);if(b("choose",{row:h}),e)return n(43,r=!1),he();if(!I){if(Yt){const t=Math.floor(9e3*Math.random()+1e3).toString();return window.singleSpaNavigate(`/task/${Xt}/${Xt}/task?next=${t}`)}return window.singleSpaNavigate(`/task/${Xt}/${s}/task`)}},de=async(t,e)=>{if(!x.lookup)return;const n={};for(const t in e){const r=e[t];Array.isArray(r)||x.lookup.includes(t)&&(n[t]=e[t])}const r=await Request.getSectionView(v.class,n);if(!r?.length)return void await Request.saveData(t,e);let o,i;for(const n of r.toReversed()){if(!(await Request.getTaskByDocId(n._id,!0)).status.startsWith("WaitingForApproval"))continue;i=n;const r=n[x.ref];for(let i=0;i<r.length;i++){o=!0;const a=r[i];for(const t in a)if(x.lookup.includes(t)&&a[t]!=e[x.ref][0][t]){o=!1;break}if(o)return r[i]=e[x.ref][0],n._event=e._event,n._prevEventId=e._prevEventId,n._taskId=e._taskId,void await Request.saveData(t,n)}}if(i){const n=i;n[x.ref].push(e[x.ref][0]),n._event=e._event,n._prevEventId=e._prevEventId,n._taskId=e._taskId,await Request.saveData(t,n)}else await Request.saveData(t,e)},ue=()=>x||V||D||!E?he():window.history.back(),he=()=>Kt?b("back"):D?window.close():R?window.singleSpaNavigate("/"):b("back"),me=async({detail:t})=>{if(Array.isArray(t.value)&&J.set(t.name,t.value),!(v.input?.length&&v.input.length>1))return;if(L?.class!==v.input[0]&&!F)return;let e,{value:r,lookup:o,name:i,view:a}=t;if(!o&&!F)return;if(o&&(e=o.split(":")[0]),a||(e=i,a="_id"),F){if(e=v.input[1],!J?.size||!J.get(t.name)?.length)return void n(10,W[e]=[],W);a=i,r=[F]}const s=await Request.getSectionView(e,{[a]:{$in:r}}),c=s.map(t=>t._id);for(const t of v.input.slice(1)){n(10,W[t]=[],W);const r=await Request.getSchemaByClass(t);r.id;let o=await Request.getTasks(r.id);if(o=o.data.filter(t=>"Ready"===t._task?.status&&(c.includes(t[e])||c.includes(t._id))),o?.length){const{filter:r}=Ct.input.class.find(e=>e.name===t),{refItem:i,value:a}=r||{},c=[];if(o.forEach(t=>{if(r){const n=s.find(n=>n._id===t[e]);n&&n[i]===a&&c.push(t._id)}else c.push(t._id)}),c.length){const e=await Request.getSectionView(t,{_id:{$in:c}});for(const n of e)n[t]=n._id;n(10,W[t]=e,W)}}}},fe=async(t,e,r)=>{if(1===Ct.input?.class?.length){const n=Ct.input.class[0],{name:r,selection:o,state:i,list:a,exclude:s}=n;t===r&&o&&i&&a&&await pe(t,e,o,i,a,s)}if(v.input&&v.input.length>1&&!F){if(v.input[0]!==t)return;const{name:o,source:i,destination:a,selection:s}=Ct.input.class[1];if(i&&a){const r=await getTaskFull(t,e);if(!r)return void n(10,W[a]=[],W);const o=await getTaskFull(s,r[s]);if(!o)return;const c=o[i]||[];return void n(10,W[a]=c,W)}const{recursive:c}=Ct.input.class[1];if(e){let o=await Request.getTaskOptions(`${t}:${e}`,Xt,c);if(r){const t=a.split(".")[1],e=[];o[t].forEach(n=>{W[t]?.find(e=>e[t]===n[t])||e.push(n)}),o={[t]:W[t]?[...W[t],...e]:[...e]}}n(10,W={...W,...o})}else{const t=v.input.slice(1);for(const e of t)n(10,W[e]=[],W)}}for(const t of Ct.output.class[0].item)"date"===t.type&&t.properties?.value?.formula?Ae(t.name):void 0!==t.factor&&n(10,W[t.name]=W[t.name]*t.factor,W);if((async()=>{const t=v.items.find(t=>"textarea"===t.properties?.format&&t.properties?.source);if(t&&!W[t.name]){const e=new Set;let r="";for(const n of t.properties.source){const[t,o,i]=n.split("."),a=W[t];for(const n of a||[]){const a=n[o];if(a&&!e.has(a)){e.add(a);const n=v.list?.find(e=>e.name===t),s=n?.item.find(t=>t.name===o);if(s?.refClass){const t=await getTaskFull(s.refClass,a);t&&t[i]&&(r+=t[i])}}if(r)break}if(r)break}r&&n(10,W[t.name]=r,W)}})(),v.list?.length){let t=At;for(const e of v.list)"array"===e.type&&e.mandatory&&W[e.name]&&!W[e.name].length&&(t=!1);n(38,St=t)}},pe=async(t,e,n,r,o,i)=>{n=[].concat(n);for(const a of n)await _e(t,e,a,r,o,i)},_e=async(t,e,r,o,i,a)=>{let[s,c]=r.split(".");c||(c=r,s=""),i=[].concat(i);const l=s?(await Request.getEvents()).filter(t=>t.output?.class?.at(0)?.name===c):(await Request.getEvents()).filter(t=>t.output?.class?.at(0)?.name===c&&Ct.output?.class?.at(0)?.list?.find(e=>e.name===t.identity.name)),d={};for(const n of l)if(d[n.identity.name]=[],e){let r={event:n._id,status:o};const l=await Request.getSectionView("_task",r);if(l?.length){const o=[];r={_id:{$in:l.map(t=>t.docId)},[t]:e};const u=await Request.getSectionView(c,r);for(const t of u)for(const e of i)if(e.startsWith("$")){const n=e.slice(1),r=[];for(const e of t[n]||[]){const n={...e,[c]:t._id};for(const t in n)!n.quantity&&t.startsWith("quantity")&&(n.quantity=n[t]);n.quantity&&r.push(n)}let o=d[n]||[];o=o.concat(r),d[n]=o}else if(s){let n=!0;if(a){const r=await Request.getSectionView(v.class,{[e+"."+c]:t._id});n=!r?.length}const r={[c]:t._id.toString()};n&&o.push(r)}else for(const n of t[e]||[]){const e={...n,[c]:t._id};for(const t in e)!e.quantity&&t.startsWith("quantity")&&(e.quantity=e[t]);e.quantity&&o.push(e)}s?d[i[0]]=o.length?o:[]:d[n.identity.name]=o.length?o:[]}}else s&&(d[i[0]]=[]);setTimeout(()=>n(10,W={...W,...d}),100)},ge=()=>{let t=0;if(lt){let e=1;dt&&(e=at),t=it*e}ut&&(t=it);let e=0;for(const t in ct)e+=ct[t];let r=0;for(const t of v.items)t.name.startsWith("amount")&&(r+=+W[t.name]);n(17,nt=e+t),W.discount>0&&n(17,nt-=nt*W.discount*.01),n(17,nt+=r)},we=()=>{let t=0;for(const e in gt)t+=gt[e];n(31,qt=t+ +Vt)},$e=({detail:t})=>{j[t.listName]=t.value,mt&&(ct[t.listName]=t.amountValue,ge()),_t&&(gt[t.listName]=t.weeksValue||0,we()),t.addToRecord&&n(12,U=t)};task_notification.subscribe(async t=>{if(!t)return;if(!I)return;const e=await Request.getSchema(t.eventId);if(!e)return;const r=v.list?.find(t=>t.name===e.class);if(!r)return;const o=await Request.getTaskById(t.taskId);addTask(o.event,o.docId,o.data);const i=await Request.getTask(e.class,o.docId),a=W[e.class].filter(t=>t[e.class]==i._id);a?.length&&a.map(t=>{t[e.class]=o.docId}),n(10,W),n(104,q),n(103,L),n(0,v)}),onMount(async()=>{if(resetCache(),await be(),!x)return;const t={...W};let e=t[x.ref][0];for(const t in e)e[t]||(e[t]=x.value[t]);const r={};for(const n in t){const o=t[n];if(Array.isArray(o))for(const t in e){const n=e[t];x.lookup.includes(t)&&(r[x.ref+"."+t]=n)}else x.lookup.includes(n)&&(r[n]=o)}if(x.lookup.includes("date")){const t=new Date,e=new Date(t.getFullYear(),t.getMonth(),t.getDate()).toISOString(),n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1).toISOString();r.date=e,r.date={$gte:e,$lt:n}}const o=await Request.getSectionView(v.class,r);let i=!1;for(const t of o){if((await Request.getTaskByDocId(t._id,!0)).status.startsWith("WaitingForApproval")){if(i)break;for(const n of t[x.ref]){let t=!0;for(const r in n)if(x.lookup.includes(r)&&n[r]!=e[r]){t=!1;break}if(t){for(const t in n)x.lookup.includes(t)||(e[t]=n[t]);i=!0;break}}}}n(10,W[x.ref][0]=e,W);const a=(x.focus||x.fill.at(-1))+"-0",s=document.getElementById(a);s&&s.focus()});const ye=async()=>{$t&&(yt||(yt=await Request.getEvent(Xt)),n(37,Yt=!0),$t.autostart&&De())},be=async()=>{const t=t=>new Promise(e=>setTimeout(e,t));let e,n=0;for(;!(e=document.getElementById(G)&&!Ft&&!Lt)&&++n<20;)await t(50);e||(e=document.getElementById(G)),e&&(()=>{if(I)return;const t=new Set;for(const e of Ht)t.add(e.refObj||Gt);Array.from(t).forEach(t=>ae(t))})(),ve()},ve=()=>{setTimeout(()=>{Array.from(jt).forEach(([t,e])=>{W[t]||n(10,W[t]=e._id,W)})},350)};onDestroy(()=>{I&&set_store_value(taskClipboard,s={[I]:{record:W,lists:j}},s)});const Ie=()=>{const t={};Array.from(document.querySelectorAll("form#"+G+" ."+G)).map(e=>{if(e.name){const n=v.items.find(t=>t.name===e.name.split(".")[0]);if(n?.properties?.multi){const n=e.name.split(".")[0];t[n]=(t[n]||[]).concat(e.value)}else if(e.name.includes(".")){const[n,r]=e.name.split("."),o=v.list.find(t=>t.name===n);t[e.name]=ce(o.item,e)}else t[e.name]=ce(v.items,e,e.name.split("_")[0])}}),v.list&&v.list.map(e=>{"array"===e.type&&j[e.name]&&(t[e.name]=j[e.name].reduce((t,n)=>n._delete||!Object.values(n).some(Boolean)?t:t.concat(Object.entries(n).reduce((t,[n,r])=>("_delete"!==n&&(t[n]=ce(e.item,{name:n,value:r,checked:r},"",!0)),t),{})),[]))});let e=!0;return Object.entries(t).map(([t,n])=>{t=t.split("_")[0];const r=v.items.find(e=>e.name===t);r?.properties?.required&&!n&&(e=!1)}),e&&t},Ce=async t=>{let e;for(n(42,Zt=0),Re();!e&&Nt;){n(42,Zt++,Zt);const r=await Request.progressReport(t);if(e=r?.progressValue,Zt>300)break;await sleep(1e3)}if(Ne(),e){const e="/api/report/list/"+t;window.open(e,"_self","width=1 height=1")}},Ee=(t,e)=>("number"==typeof t&&t||(t=Number(t||0)),t.toFixed(e||0)),Ae=async t=>{if(!t)return;const e=v.items.find(e=>e.name===t),r=e.properties.value.formula,{operator:o,argument:i}=r,a=i.map(t=>W[t.refItem]);let s=0;if("$add"===o){if("date"===e.type)return void n(10,W[t]=await Se(o,i),W);s=a.reduce((t,e)=>+(t||0)+ +(e||0))}if("$subtract"===o&&(s=a.reduce((t,e)=>{t||(t=""),e||(e="");const[n,r]=t.toString().split(":");t=r?(+n+ +r/60).toFixed(2):+(n||0);let[o,i]=e.toString().split(":");return o||(o=0),t-=i?(+o+ +i/60).toFixed(2):+(o||0)})),"$multiply"===o&&(s=a.reduce((t,e)=>+(t||0)*+(e||0))),"$percentMultiply"===o){const[t,e]=a;if(!+t)return;s=+t,+e>0&&(s*=1-e/100)}if("$percentDivide"===o){const[t,e]=a;if(!+t||!+e)return;s=+t/+e*100}n(10,W[t]="$multiply"===o?s?Ee(s,e.properties?.decimals):"":Ee(s,e.properties?.decimals),W)},Se=async(t,e)=>{const[n,r]=e.map(t=>t.refItem||t.value);let o,i;"string"==typeof r&&([o,...i]=r.split("."),0===i.length?(i=o,o=""):i=i.join("."));const s=ke(W[n])||Date.now();let c=i?0:r;if(o){if("owner"===o)a.owner||set_store_value(y,a.owner=await Request.getSectionView("owner",{}),a),c=getData(a.owner,i);else if(W[o]){const t=await getTaskFull(o,W[o]);t&&(c=getData(t,i))}}else c=c||W[i];return addDays(s,c||0)},ke=t=>{if(!t)return;let e,n,r;t.includes("T")?([e,n,r]=t.split("-"),r=r.split("T")[0]):[r,n,e]=t.split(".");return new Date(+e,+n-1,+r).toISOString()},Te=()=>{n(13,X=!1)},Re=()=>{n(41,Nt=!0)},Ne=()=>{n(41,Nt=!1)},De=()=>{n(29,Pt=!1),n(26,xt=""),n(25,Dt=""),n(27,Ot=""),n(24,bt=!0)},xe=()=>{n(25,Dt=""),n(26,xt=""),n(27,Ot=""),n(29,Pt=!1),n(28,Mt=!0),Oe()},Oe=()=>{if(!$t.keyboard)return;const t=document.getElementById("reader_focusId");t&&t.focus()};return t.$$set=t=>{"schema"in t&&n(0,v=t.schema),"recID"in t&&n(2,I=t.recID),"deletable"in t&&n(3,C=t.deletable),"prevEventID"in t&&n(99,E=t.prevEventID),"prev"in t&&n(4,A=t.prev),"taskId"in t&&n(1,S=t.taskId),"taskOrg"in t&&n(100,k=t.taskOrg),"description"in t&&n(97,T=t.description),"root"in t&&n(5,R=t.root),"readonly"in t&&n(98,N=t.readonly),"isStandalone"in t&&n(101,D=t.isStandalone),"shortEdit"in t&&n(6,x=t.shortEdit),"shortSchema"in t&&n(102,O=t.shortSchema)},t.$$.update=()=>{32&t.$$.dirty[3]&&n(43,r=N),1&t.$$.dirty[0]|3072&t.$$.dirty[3]&&q&&L&&(v.items.map(({name:t,type:e,refItem:r,properties:o})=>{if(!1===r)return;const i=L.items.find(e=>e.name===t);if(!i)return;if(e!==i.type)return;const a="_"+t;q[t]?n(10,W[t]=q[t],W):r&&r.startsWith("owner")||o&&o.readonly||n(10,W[t]="",W),q[a]&&n(10,W[a]=q[a],W),n(22,st=!1)}),(()=>{for(const t of v.list||[]){const e=[],r=W[t.name];if(r?.length){for(const n of r){const r=n;for(const e of t.item)if(!1===e.refItem)r[e.name]="boolean"!==e.type&&"";else if(e.refItem)if("date"!==e.type||W[e.refItem])r[e.name]=W[e.refItem];else{const t=new Date,n=new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,0,0);r[e.name]=n}e.push(r)}n(10,W[t.name]=e,W)}}})()),32&t.$$.dirty[0]|16&t.$$.dirty[3]&&n(44,o=R?T||"enablerr - Form":document.title)},[v,S,I,C,A,R,x,M,P,B,W,V,U,X,Q,z,K,nt,rt,ot,tt,et,st,$t,bt,Dt,xt,Ot,Mt,Pt,Ft,qt,Wt,vt,It,Qt,Et,Yt,St,kt,Tt,Nt,Zt,r,o,u,h,m,f,p,_,g,w,$,y,G,Y,Z,{name:"amountValue",properties:{decimals:2}},{name:"taxValue",properties:{decimals:2}},J,mt,_t,{name:"weekValue",properties:{decimals:1}},wt,Xt,async()=>{if(n(34,It=[]),a.owner||set_store_value(y,a.owner=await Request.getSectionView("owner",{}),a),a.currency?n(16,K=a.currency.designation):Request.getSectionView("owner",{}).then(t=>{t?.length&&t[0].currency&&getTaskFull("currency",t[0].currency).then(t=>{t&&n(16,K=t.designation)}).catch(t=>console.log("currency not found"))}),W.currency&&getTaskFull("currency",W.currency).then(t=>{t&&n(16,K=t.designation)}).catch(t=>console.log("currency not found")),Ct=await Request.getEvent(Xt),x&&n(10,W[x.ref]=[{...x.value}],W),!I){if(n(33,vt=It),Jt(Ct.input?.class).then(()=>{Lt=!0}),re(),te(Ct),ee(),F){const t=Ct.input.class[0].selection;W[t]||(n(10,W[t]=[F],W),me({detail:{value:[F],name:t}}))}await(async()=>{if(!r&&(yt||(yt=await Request.getEvent(Xt)),n(23,$t=yt.output.class[0].reader),$t&&!$t.keyboard))try{const t=await getCameras();t?.length||n(23,$t=!1)}catch{}})(),ye()}if(I){if(s&&s[I]){const t=s[I],e=t.record;v.items.map(t=>{e[t.name]=ce(v.items,{name:t.name,value:e[t.name],checked:e[t.name]})}),n(10,W=e),v.list&&v.list.map(e=>{"array"===e.type&&t.lists[e.name]&&n(10,W[e.name]=t.lists[e.name].reduce((t,n)=>n._delete||!Object.values(n).some(Boolean)?t:t.concat(Object.entries(n).reduce((t,[n,r])=>("_delete"!==n&&(t[n]=ce(e.item,{name:n,value:r,checked:r},"",!0)),t),{})),[]),W)})}else n(10,W=await Request.getTask(v.class,I));if(n(97,T=getRecordDescription(v,W)),v.result,n(35,Qt=!!v.result?.resultDef&&!v.result.resultDef[0].createAfterSave),n(18,rt=W._tax?._amount),n(19,ot=100*W._tax?._rate||""),n(40,Tt=v.list?.find(t=>t.mandatory)&&Ct.input?.class?.length>1),Tt){(k||await Request.getTaskByDocId(I,!0)).visum&&n(40,Tt=!1)}n(12,U={itemName:v.class,value:I})}if(E){n(98,N=!1),n(103,L=await Request.getSchema(E)),"string"==typeof A&&n(104,q=await Request.getTask(L.class,A));const t=v.items.find(t=>t.refClass===L.class);t&&n(10,W[t.name]=q._id,W)}if(_t&&(Vt=W[ft]||0),Ct.trigger?.startOn&&!Ct.trigger.startOn.some(t=>t.type.indexOf("Manual")>=0)&&n(98,N=!0),c.role?.length&&v.authorization?.length){const t=v.authorization.some(t=>l?.find(e=>e===t.role&&"edit"===t.activity));n(98,N||=!t)}if(n(11,V="report"===Ct.output.type),n(7,M=!1!==Ct.output.class?.at(0)?.documentTotal),n(39,kt=Ct.output.saveButton),a.userSetting){const t=a.userSetting;if(n(36,Et=t.isAdmin),!Et){const t=d.tenants.find(t=>t._id===d.tenant);t&&n(36,Et=t.admin?.find(t=>t===d.user))}}else Request.getUserSettings().then(t=>{if(n(36,Et=t.isAdmin),!Et){const t=d.tenants.find(t=>t._id===d.tenant);t&&n(36,Et=t.admin?.find(t=>t===d.user))}});return n(30,Ft=!0),!0},le,ue,async({detail:t})=>{const{row:e}=t;let{eventId:r}=t;if((()=>{if(I)for(const t of Ht)t.refName||ae(t.itemName)})(),await(async(t,e)=>{if(!t&&!e?._id)return;let r,o=!1;const i={...W};for(const n of v.items){if("string"==typeof n.refItem&&(!t||n.properties?.linkOnly)){const[t,s]=n.refItem.split(".");if("owner"===t)n.refItem.split(".").length<3&&(i[n.name]=a.owner[s||n.refClass],o=!0);else if(n.refInput?.includes("|")&&W[t]){const[e,a]=n.refInput.split("|");r=await getTaskFull(t,W[t]),i[n.name]=r[e]||r[a]||"",o=!0}else if(W[t]){if((e._id===W[t]||n.refItemAlt)&&(r=await getTaskFull(t,W[t]),r)){let t;24===r[s]?.toString().length?(r=await getTaskFull(s,r[s]),r&&(t=r[n.name||n.refInput])):s?(t=r[s][n.name]||r[s],"object"==typeof t&&(t=void 0)):t=r[n.name],void 0!==t&&(i[n.name]=t,o=!0)}}else s&&(i[n.name]="",o=!0)}if(!i[n.name]&&"string"==typeof n.refItemAlt&&(!t||n.properties?.linkOnly)){const[t,a]=n.refItemAlt.split(".");if((W[t]||e[t])&&(r=await getTaskFull(t,W[t]||e[t]),r)){let t;24===r[a]?.toString().length?(r=await getTaskFull(a,r[a]),r&&(t=r[n.name||n.refInput])):t=a?r[a][n.name]||r[a]:r[n.name],void 0!==t&&(i[n.name]=t,o=!0)}}}for(const e of v.list||[])if((!t||e.properties?.linkOnly)&&e.refItem&&W[e.refItem]){r=await getTaskFull(refItem,W[e.refItem]);const t=[];for(const n of r[e.name]){const r={};for(const t of e.item)n[t.name]&&(r[t.name]=n[t.name]);t.push(r),o=!0}i[e.name]=t}o&&n(10,W=i)})(!!I,e),I)return;if(r||=e._task?.event,r&&(await(async(t,e)=>{if(!t)return;const r=(await Request.getEvent(t)).output.class[0].name,o=zt.filter(t=>t.lookup===r);if(o?.length)for(const t of o){const{lookup:r,name:o}=t;let i="";if(e){let t=await getTaskFull(r,e);t&&t[o]?.length&&(i=t[o][0][o])}i&&n(10,W[o]=i,W)}})(r,e._id),v.items.filter(t=>t.properties?.lookup).forEach(async t=>{const e=await Request.getEvent(r);e.output.class[0]?.name===t.properties.lookup&&n(10,W[t.name]="",W)})),!e._task)return;const o=e._task.event,i=await Request.getEvent(o);for(const t of Ct.output.class[0].item)"date"===t.type&&t.properties?.value?.formula&&Ae(t.name);if(!Ct.output?.class?.length)return;const s=Ct.output.class[0]?.item.find(t=>(t.refClass||t.name)===i.output.class[0]?.name);(Ct.input?.class?.length&&Ct.input.class[0].name===i.output.class[0]?.name||s?.asInput)&&(n(103,L=await Request.getSchema(o)),n(99,E=o),n(1,S=e._task._id),S&&e._task.docId?n(104,q=await Request.getTask(L.class,e._task.docId)):n(104,q={}),await fe(L.class,e?._task?.docId||e?._task?._id))},async({detail:t})=>{if(!x&&(n(12,U=t),"quantity"===t.itemName&&n(21,et=W.quantity),"currency"===t.itemName&&t.value&&getTaskFull("currency",t.value).then(t=>{t&&n(16,K=t.designation)}).catch(t=>console.log("currency not found")),(async(t,e)=>{const r=Ut.filter(e=>e.selection===t||e.constraint===t);if(r?.length){n(20,tt=!1);for(const o of r){const{selection:r,constraint:i,name:a}=o;if(e)break;n(10,W[a]="",W),t===r&&n(20,tt=i);const s=W[r];if(s&&t===i){let t=await getTaskFull(r,s);const e=W[i];if(e?.length){const r=e[0].split(", ");t=t[i];let o="";for(const e of t)Object.values(e).map(t=>{r.includes(t)&&(o=e[a])});n(10,W[a]=o,W)}}}}})(t.itemName,t.oldValue===t.value),oe(),ae(t.itemName),_t&&ft&&(t.itemName===ft&&(Vt=+t.value),we()),ht&&mt)){if(t.itemName===lt?.name)it=t.value;else if(t.itemName===dt?.name)at=t.value;else{if(t.itemName!==ut?.name)return;it=t.value}ge()}},me,$e,t=>{"button"!==t.srcElement?.type&&"textarea"!==t.srcElement?.type&&13==t.which&&t.preventDefault()},t=>async()=>{const e=await Request.getReportDoc(t)||{},{userReportId:n,type:r}=e;if(!n)return;if("eps"===r)return void toasts.success("Die Datei wurde erstellt und im Anhang abgelegt.");const o="/api/userreport/"+n;if("ics"===r)return window.open(o,"_self","width=1 height=1");const i="/viewer/doc/index.html?file="+o+"&type="+r;window.open(i,"","popup=yes toolbar=no width=624 height=900")},t=>async()=>{const t=await Request.getDocData(S);(async t=>{const e=window.screen.height,n=window.open("","_blank","width=800,height="+e+",location=no");await tick(),n?.document.write("<title>Report Daten für '"+v.identity.designation+"'</title>"),n?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+t+"</textarea>")})(JSON.stringify(t,null,4),v.identity.designation)},async()=>{const t=Ie();if(!t)return;const e=Ct.result?.resultDef[0]?.addToReports;if(e){const n=t[e];if(n){const e={docId:n},r=(await Request.getSectionView("_task",e))[0];t._taskId=r._id}}const{reportId:n,type:r}=await Request.createReport(Xt,t);await Ce(n),he()},async()=>{const t=Ie();if(!t)return;const e=await Request.getReportData(Xt,t),n=window.screen.height,r=window.open("","_blank","width=800,height="+n+",location=no");await tick(),r?.document.write("<title>Report Daten für '"+v.identity.designation+"'</title>"),r?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+JSON.stringify(e,null,4)+"</textarea>")},async({detail:{className:t,itemName:e,value:n}})=>{if(Gt!==n)return;if(!t)return;if(jt.has(t))return;if(!0!==n&&(n=(n=[].concat(n)).some(t=>t===Gt)),!n)return;const r={[e]:!0},o=await Request.getSectionView(t,r);o?.length&&jt.set(t,o[0])},({detail:t})=>{H=t},({detail:t})=>{t.target&&v.list?.length?n(15,z={ref:t.target,val:t.value}):t.itemName.startsWith("$")?Rt=t.value:setTimeout(()=>{n(10,W[t.itemName]=t.value,W)},200)},({detail:t})=>{n(14,Q=!1);for(const e of t.items)n(10,W[t.listName][e.name]=e.value,W);n(14,Q=!0)},({detail:t})=>{Ae(t.item.name)},()=>v.result.resultDef[0].button?.designation||"Dokument erstellen",()=>{n(13,X=!0)},Te,Ne,async()=>{if(Gt&&I){(await Request.deleteData(Gt,I)).taskId?(toasts.success("Die Daten wurden gelöscht.",3e3),ue()):toasts.failed("Die Daten können nicht gelöscht werden!",3e3)}Te()},async()=>{if(!Tt)return;const t=Ct.input.class[0].name,e=Ct.input.class[1].destination.split(".")[1];if(!t)return;if(!e)return;if(!W[t])return;const n=W[e]?.length||0;await fe(t,W[t],!0),n<W[e].length?($e({detail:{listName:e,value:W[e]}}),le({})):toasts.failed("Keine Positionen gefunden!",3e3)},()=>{I&&le({_docAsync:!0})},De,async({detail:t})=>{if(n(29,Pt=!1),n(26,xt=""),n(25,Dt=t.text||""),!Dt)return;const e=readSwissQR(Dt);for(const t in e){if(v.items.find(e=>e.name===t))if("object"==typeof e[t]){let r={};for(const o in e[t])if("object"==typeof e[t][o])for(const i in e[t][o]){e[t][o][i]&&(r[i]=e[t][o][i]);const a=await Request.getSectionView(o,r);if(a?.length){const e=await Request.getSectionView(t,{[o]:a[0]._id});e?.length&&n(10,W[t]=e[0]._id,W)}}else{e[t][o]&&(r[o]=e[t][o]);const i=await Request.getSectionView(t,r);i?.length&&n(10,W[t]=i[0]._id,W)}}else e[t]&&n(10,W[t]=e[t],W)}n(24,bt=!1)},()=>v.items.filter(t=>t.properties?.reader),(t,e=!1)=>e?(xe(),""):v.items.find(e=>e.name===t)?.designation||"",xe,()=>{const{refItem:t}=$t,e={[t]:Ot};let n;v.filter(t=>t.properties?.reader).forEach(t=>{const n=document.getElementById("reader_"+t.name);n&&(e[t.name]=n.value||("number"===t.type?0:""))});let r=rec;const o=r.findIndex(e=>e[t]===Ot);o>=0?(n=r[o],r[o]={...n,...e}):r=r.slice(0,-1).concat(e),rec=r,v.filter(t=>t.properties?.reader).forEach(t=>{notify(t,o>=0?o:0)({detail:{oldValue:n?n[t.name]:"",value:e[t.name]}})}),Bt=!0,xe()},()=>{Bt&&(Bt=!1,le({}))},T,N,E,k,D,O,L,q,function(t){nt=t,n(17,nt)},function(t){rt=t,n(18,rt)},function(t){qt=t,n(31,qt)},function(t){Yt=t,n(37,Yt)},()=>Te(),function(t){X=t,n(13,X)},function(t){Mt=t,n(28,Mt)},function(t){bt=t,n(24,bt)},()=>Ne(),function(t){Nt=t,n(41,Nt)},()=>{n(8,P=!1)},function(t){P=t,n(8,P)}]}class Index extends SvelteComponent{constructor(t){super(),document_1.getElementById("svelte-lfqa43-style")||add_css(),init(this,t,instance$1,create_fragment$1,safe_not_equal,{schema:0,recID:2,deletable:3,prevEventID:99,prev:4,taskId:1,taskOrg:100,description:97,root:5,readonly:98,isStandalone:101,shortEdit:6,shortSchema:102},[-1,-1,-1,-1,-1,-1,-1])}}function create_default_slot(t){let e,n,r;function o(e){t[4](e)}let i={schema:t[5],recID:t[6]};return void 0!==t[0]&&(i.description=t[0]),e=new Index({props:i}),binding_callbacks.push(()=>bind(e,"description",o)),e.$on("back",t[2]),{c(){create_component(e.$$.fragment)},m(t,n){mount_component(e,t,n),r=!0},p(t,r){const o={};32&r&&(o.schema=t[5]),64&r&&(o.recID=t[6]),!n&&1&r&&(n=!0,o.description=t[0],add_flush_callback(()=>n=!1)),e.$set(o)},i(t){r||(transition_in(e.$$.fragment,t),r=!0)},o(t){transition_out(e.$$.fragment,t),r=!1},d(t){destroy_component(e,t)}}}function create_fragment(t){let e,n;return e=new Page({props:{update:t[1],description:t[0],$$slots:{default:[create_default_slot,({prop:{schema:t,recID:e,eventID:n}})=>({5:t,6:e,7:n}),({prop:t})=>(t?32:0)|(t?64:0)|(t?128:0)]},$$scope:{ctx:t}}}),{c(){create_component(e.$$.fragment)},m(t,r){mount_component(e,t,r),n=!0},p(t,[n]){const r={};1&n&&(r.description=t[0]),353&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i(t){n||(transition_in(e.$$.fragment,t),n=!0)},o(t){transition_out(e.$$.fragment,t),n=!1},d(t){destroy_component(e,t)}}}function instance(t,e,n){let r,{refresh:o}=e;return t.$$set=t=>{"refresh"in t&&n(3,o=t.refresh)},[r,(t,e)=>Request.getSchema(t).then(n=>({schema:n,recID:e,eventID:t,title:n.identity.designation})),t=>{},o,function(t){r=t,n(0,r)}]}class Detail extends SvelteComponent{constructor(t){super(),init(this,t,instance,create_fragment,safe_not_equal,{refresh:3})}}var singleSpaSvelte_1=createCommonjsModule(function(t,e){function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach(function(e){o(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if("object"!==i(t))throw new Error("single-spa-svelte requires a configuration object");var e=r(r({},a),t);if(!e.component)throw new Error("single-spa-svelte must be passed opts.component");var n={};return{bootstrap:s.bind(null,e,n),mount:c.bind(null,e,n),unmount:l.bind(null,e,n),update:d.bind(null,e,n)}};var a={component:null,domElementGetter:null,props:{}};function s(t){return Promise.resolve()}function c(t,e,n){var o=Object.keys(a),i=Object.keys(t).reduce(function(e,n){return o.includes(n)||(e[n]=t[n]),e},{});return Promise.resolve().then(function(){var o=function(t,e){return(e=e&&e.customProps?e.customProps:e).domElement?function(){return e.domElement}:e.domElementGetter?function(){return e.domElementGetter(e)}:t.domElementGetter?function(){return t.domElementGetter(e)}:function(t){var e=t.appName||t.name;if(!e)throw Error("single-spa-svelte was not given an application name as a prop, so it can't make a unique dom element container for the svelte application");var n="single-spa-application:".concat(e);return function(){var t=document.getElementById(n);return t||((t=document.createElement("div")).id=n,document.body.appendChild(t)),t}}(e)}(t,n),a=o();e.instance=new t.component(r(r({},i),{},{target:a,props:Object.assign({},n,t.props)}))})}function l(t,e){return Promise.resolve().then(function(){e.instance.$destroy?e.instance.$destroy():e.instance.destroy()})}function d(t,e,n){return Promise.resolve().then(function(){e.instance.$set?e.instance.$set(n):e.instance.set(n)})}}),singleSpaSvelte=getDefaultExportFromCjs(singleSpaSvelte_1);const lcDetail=singleSpaSvelte({component:Detail,domElementGetter:()=>document.getElementById("detail-app")}),{bootstrap:bootstrap,mount:mount,unmount:unmount}=lcDetail;exports({bootstrap:bootstrap,mount:mount,unmount:unmount});const Form=exports("Form",Index),List=exports("List",List$1),Template=exports("Template",Template$1)}}});
|
|
5
|
+
*/class kc{constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}}class Mc{static fromPoints(e,t){const n=this.calculateControlPoints(e[0],e[1],e[2]).c2,r=this.calculateControlPoints(e[1],e[2],e[3]).c1;return new Mc(e[1],n,r,e[2],t.start,t.end)}static calculateControlPoints(e,t,n){const r=e.x-t.x,i=e.y-t.y,o=t.x-n.x,s=t.y-n.y,a=(e.x+t.x)/2,l=(e.y+t.y)/2,c=(t.x+n.x)/2,d=(t.y+n.y)/2,u=Math.sqrt(r*r+i*i),h=Math.sqrt(o*o+s*s),f=u+h==0?0:h/(u+h),m=c+(a-c)*f,p=d+(l-d)*f,g=t.x-m,w=t.y-p;return{c1:new kc(a+g,l+w),c2:new kc(c+g,d+w)}}constructor(e,t,n,r,i,o){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=o}length(){let e,t,n=0;for(let r=0;r<=10;r+=1){const i=r/10,o=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),s=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){const r=o-e,i=s-t;n+=Math.sqrt(r*r+i*i)}e=o,t=s}return n}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}}class Pc{constructor(){try{this._et=new EventTarget}catch(e){this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}}class Bc extends Pc{constructor(e,t={}){var n,r,i;super(),this.canvas=e,this._drawingStroke=!1,this._isEmpty=!0,this._lastPoints=[],this._data=[],this._lastVelocity=0,this._lastWidth=0,this.velocityFilterWeight=t.velocityFilterWeight||.7,this.minWidth=t.minWidth||.5,this.maxWidth=t.maxWidth||2.5,this.throttle=null!==(n=t.throttle)&&void 0!==n?n:16,this.minDistance=null!==(r=t.minDistance)&&void 0!==r?r:5,this.dotSize=t.dotSize||0,this.penColor=t.penColor||"black",this.backgroundColor=t.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=t.compositeOperation||"source-over",this.canvasContextOptions=null!==(i=t.canvasContextOptions)&&void 0!==i?i:{},this._strokeMoveUpdate=this.throttle?function(e,t=250){let n,r,i,o=0,s=null;const a=()=>{o=Date.now(),s=null,n=e.apply(r,i),s||(r=null,i=[])};return function(...l){const c=Date.now(),d=t-(c-o);return r=this,i=l,d<=0||d>t?(s&&(clearTimeout(s),s=null),o=c,n=e.apply(r,i),s||(r=null,i=[])):s||(s=window.setTimeout(a,d)),n}}(Bc.prototype._strokeUpdate,this.throttle):Bc.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._ctx=e.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}clear(){const{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._strokePointerId=void 0}fromDataURL(e,t={}){return new Promise((n,r)=>{const i=new Image,o=t.ratio||window.devicePixelRatio||1,s=t.width||this.canvas.width/o,a=t.height||this.canvas.height/o,l=t.xOffset||0,c=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,l,c,s,a),n()},i.onerror=e=>{r(e)},i.crossOrigin="anonymous",i.src=e,this._isEmpty=!1})}toDataURL(e="image/png",t){return"image/svg+xml"===e?("object"!=typeof t&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`):("number"!=typeof t&&(t=void 0),this.canvas.toDataURL(e,t))}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const e=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){var e;const t=window.document===this.canvas.ownerDocument?window:null!==(e=this.canvas.ownerDocument.defaultView)&&void 0!==e?e:this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:e}=this._getListenerFunctions();e("pointermove",this._handlePointerMove),e("pointerup",this._handlePointerUp),e("mousemove",this._handleMouseMove),e("mouseup",this._handleMouseUp),e("touchmove",this._handleTouchMove),e("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?1===e.buttons:!(1&~e.buttons)}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:"pressure"in e?e.pressure:0}}_touchEventToSignatureEvent(e){const t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){this._isLeftButtonPressed(e,!0)&&this._drawingStroke?this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e)):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1)}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){1!==e.targetTouches.length||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){1===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._drawingStroke?this._strokeMoveUpdate(this._touchEventToSignatureEvent(e)):this._strokeEnd(this._touchEventToSignatureEvent(e),!1))}_handleTouchEnd(e){0===e.targetTouches.length&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return void 0===this._strokePointerId?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){!this._drawingStroke&&this._isLeftButtonPressed(e)&&this._allowPointerId(e,!0)&&(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){this._allowPointerId(e)&&(this._isLeftButtonPressed(e,!0)&&this._drawingStroke?(e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))):this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handlePointerUp(e){!this._isLeftButtonPressed(e)&&this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&"penColor"in e?e.penColor:this.penColor,dotSize:e&&"dotSize"in e?e.dotSize:this.dotSize,minWidth:e&&"minWidth"in e?e.minWidth:this.minWidth,maxWidth:e&&"maxWidth"in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&"velocityFilterWeight"in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&"compositeOperation"in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:e,cancelable:!0})))return;const{addEventListener:t}=this._getListenerFunctions();switch(e.event.type){case"mousedown":t("mousemove",this._handleMouseMove,{passive:!1}),t("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":t("touchmove",this._handleTouchMove,{passive:!1}),t("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":t("pointermove",this._handlePointerMove,{passive:!1}),t("pointerup",this._handlePointerUp,{passive:!1})}this._drawingStroke=!0;const n=this._getPointGroupOptions(),r=Object.assign(Object.assign({},n),{points:[]});this._data.push(r),this._reset(n),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(0===this._data.length)return void this._strokeBegin(e);this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:e}));const t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],o=!!i&&t.distanceTo(i)<=this.minDistance,s=this._getPointGroupOptions(n);if(!i||!i||!o){const e=this._addPoint(t,s);i?e&&this._drawCurve(e,s):this._drawDot(t,s),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:e})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){const r=this.canvas.getBoundingClientRect();return new kc(e-r.left,t-r.top,n,(new Date).getTime())}_addPoint(e,t){const{_lastPoints:n}=this;if(n.push(e),n.length>2){3===n.length&&n.unshift(n[0]);const e=this._calculateCurveWidths(n[1],n[2],t),r=Mc.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){const r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),o={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,o}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){const r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){const n=this._ctx,r=e.endWidth-e.startWidth,i=2*Math.ceil(e.length());n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){const o=n/i,s=o*o,a=s*o,l=1-o,c=l*l,d=c*l;let u=d*e.startPoint.x;u+=3*c*o*e.control1.x,u+=3*l*s*e.control2.x,u+=a*e.endPoint.x;let h=d*e.startPoint.y;h+=3*c*o*e.control1.y,h+=3*l*s*e.control2.y,h+=a*e.endPoint.y;const f=Math.min(e.startWidth+a*r,t.maxWidth);this._drawCurveSegment(u,h,f)}n.closePath(),n.fill()}_drawDot(e,t){const n=this._ctx,r=t.dotSize>0?t.dotSize:(t.minWidth+t.maxWidth)/2;n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_fromData(e,t,n){for(const r of e){const{points:e}=r,i=this._getPointGroupOptions(r);if(e.length>1)for(let n=0;n<e.length;n+=1){const r=e[n],o=new kc(r.x,r.y,r.pressure,r.time);0===n&&this._reset(i);const s=this._addPoint(o,i);s&&t(s,i)}else this._reset(i),n(e[0],i)}}toSVG({includeBackgroundColor:e=!1}={}){const t=this._data,n=Math.max(window.devicePixelRatio||1,1),r=this.canvas.width/n,i=this.canvas.height/n,o=document.createElementNS("http://www.w3.org/2000/svg","svg");if(o.setAttribute("xmlns","http://www.w3.org/2000/svg"),o.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),o.setAttribute("viewBox",`0 0 ${r} ${i}`),o.setAttribute("width",r.toString()),o.setAttribute("height",i.toString()),e&&this.backgroundColor){const e=document.createElement("rect");e.setAttribute("width","100%"),e.setAttribute("height","100%"),e.setAttribute("fill",this.backgroundColor),o.appendChild(e)}return this._fromData(t,(e,{penColor:t})=>{const n=document.createElement("path");if(!(isNaN(e.control1.x)||isNaN(e.control1.y)||isNaN(e.control2.x)||isNaN(e.control2.y))){const r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute("d",r),n.setAttribute("stroke-width",(2.25*e.endWidth).toFixed(3)),n.setAttribute("stroke",t),n.setAttribute("fill","none"),n.setAttribute("stroke-linecap","round"),o.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{const s=document.createElement("circle"),a=n>0?n:(r+i)/2;s.setAttribute("r",a.toString()),s.setAttribute("cx",e.x.toString()),s.setAttribute("cy",e.y.toString()),s.setAttribute("fill",t),o.appendChild(s)}),o.outerHTML}}const{document:Lc}=_e;function Fc(e){let t,n,r,i,o;return n=new tt({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 pointer svelte-efkzkz")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[5]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Vc(e){let t,n,r,i,o,s,a=!e[0]&&Fc(e);return{c(){t=O("div"),n=O("canvas"),i=P(),a&&a.c(),U(n,"id",e[1]),U(n,"name",e[1]),U(n,"class",r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"),U(t,"class",o=e[2]+"_wrapper wrapper svelte-efkzkz"),U(t,"id","signature_wrapper")},m(e,r){R(e,t,r),N(t,n),N(t,i),a&&a.m(t,null),s=!0},p(e,[i]){(!s||2&i)&&U(n,"id",e[1]),(!s||2&i)&&U(n,"name",e[1]),(!s||29&i&&r!==(r=e[2]+" signature_pad "+e[3]+(e[0]||e[4]?" signature-readonly":"")+" svelte-efkzkz"))&&U(n,"class",r),e[0]?a&&(pe(),ye(a,1,1,()=>{a=null}),ge()):a?(a.p(e,i),1&i&&we(a,1)):(a=Fc(e),a.c(),we(a,1),a.m(t,null)),(!s||4&i&&o!==(o=e[2]+"_wrapper wrapper svelte-efkzkz"))&&U(t,"class",o)},i(e){s||(we(a),s=!0)},o(e){ye(a),s=!1},d(e){e&&D(t),a&&a.d()}}}const Uc=new Map;let Hc="";function Wc(e,t,n){const r=K();let i,{id:o}=t,{name:s}=t,{value:a}=t,{record:l}=t,{classId:c}=t,{disabled:d}=t,{readonly:u}=t;const h=l._id||Math.floor(9e3*Math.random()+1e3).toString();u||=d;const f=e=>{Hc=e,Uc.set(h,Hc),r("blur",{value:Hc})};return Y(()=>{Hc=a||Uc.get(h)||"",Uc.set(h,Hc);const e=document.querySelector("canvas");n(8,i=new Bc(e)),u||(i.addEventListener("endStroke",()=>{f(i.toDataURL("image/png"))}),i.addEventListener("afterUpdateStroke",()=>{f(i.toDataURL("image/png"))}))}),Z(()=>Uc.forEach((e,t,n)=>{t!==h&&n.delete(t)})),e.$$set=e=>{"id"in e&&n(1,o=e.id),"name"in e&&n(2,s=e.name),"value"in e&&n(6,a=e.value),"record"in e&&n(7,l=e.record),"classId"in e&&n(3,c=e.classId),"disabled"in e&&n(4,d=e.disabled),"readonly"in e&&n(0,u=e.readonly)},e.$$.update=()=>{256&e.$$.dirty&&Hc&&i&&i.fromDataURL(Hc,{ratio:1})},[u,o,s,c,d,()=>{i.clear(),f("")},a,l,i]}class zc extends Te{constructor(e){var t;super(),Lc.getElementById("svelte-efkzkz-style")||((t=O("style")).id="svelte-efkzkz-style",t.textContent=".feather2.svelte-efkzkz{position:absolute;top:0.25em;right:0.25em;color:#4300b0}.wrapper.svelte-efkzkz{position:relative;width:100%;height:200px;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;border:1px solid #36697d}canvas.svelte-efkzkz{width:100%;height:100%;display:block;background-color:lightyellow}.signature-readonly.svelte-efkzkz{cursor:not-allowed;pointer-events:none}",N(Lc.head,t)),Se(this,e,Wc,Vc,$,{id:1,name:2,value:6,record:7,classId:3,disabled:4,readonly:0})}}function jc(e,t,n){const r=e.slice();return r[36]=t[n],r[38]=n,r}function qc(e){let t,n,r;return n=new Ve({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 svelte-bcd9jd"),U(t,"title",e[21])},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Gc(e){let t,n,r,i,o;return n=new Ve({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-bcd9jd"),U(t,"title",e[21])},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[22]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function Xc(e){let t,n,r;function i(t){e[28](t)}let o={class:"tModal",noClickaway:!0,$$slots:{default:[ed]},$$scope:{ctx:e}};return void 0!==e[8]&&(o.open=e[8]),t=new e[12]({props:o}),ee.push(()=>Ee(t,"open",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};1536&r[0]|256&r[1]&&(i.$$scope={dirty:r,ctx:e}),!n&&256&r[0]&&(n=!0,i.open=e[8],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Yc(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Zc(e){let t,n,r,i=(e[10]||"Keine Einträge gefunden!")+"";return{c(){t=O("tr"),n=O("td"),r=M(i),U(n,"class","svelte-bcd9jd"),U(t,"class","svelte-bcd9jd")},m(e,i){R(e,t,i),N(t,n),N(n,r)},p(e,t){1024&t[0]&&i!==(i=(e[10]||"Keine Einträge gefunden!")+"")&&H(r,i)},d(e){e&&D(t)}}}function Kc(e){let t,n=e[9],r=[];for(let t=0;t<n.length;t+=1)r[t]=Qc(jc(e,n,t));return{c(){for(let e=0;e<r.length;e+=1)r[e].c();t=B()},m(e,n){for(let t=0;t<r.length;t+=1)r[t].m(e,n);R(e,t,n)},p(e,i){if(25166336&i[0]){let o;for(n=e[9],o=0;o<n.length;o+=1){const s=jc(e,n,o);r[o]?r[o].p(s,i):(r[o]=Qc(s),r[o].c(),r[o].m(t.parentNode,t))}for(;o<r.length;o+=1)r[o].d(1);r.length=n.length}},d(e){x(r,e),e&&D(t)}}}function Qc(e){let t,n,r,i,o,s,a=e[23](e[36])+"";return{c(){t=O("tr"),n=O("td"),r=M(a),i=P(),U(n,"class","svelte-bcd9jd"),U(t,"class","pointer svelte-bcd9jd")},m(a,l){R(a,t,l),N(t,n),N(n,r),N(t,i),o||(s=L(t,"click",V(e[24](e[38]))),o=!0)},p(t,n){e=t,512&n[0]&&a!==(a=e[23](e[36])+"")&&H(r,a)},d(e){e&&D(t),o=!1,s()}}}function Jc(e){let t,n,r,i,o,s,a,l,c,d,u,h,f;function m(e,t){return e[9]?.length?Kc:Zc}n=new e[14]({props:{outline:!0,$$slots:{default:[Yc]},$$scope:{ctx:e}}}),n.$on("click",e[25]),i=new e[15]({});let p=m(e),g=p(e);return{c(){t=O("div"),Ae(n.$$.fragment),r=P(),Ae(i.$$.fragment),o=P(),s=O("div"),a=O("table"),l=O("thead"),c=O("tr"),d=O("th"),d.textContent=`${e[20]}`,u=P(),h=O("tbody"),g.c(),U(d,"class","svelte-bcd9jd"),U(c,"class","svelte-bcd9jd"),U(l,"class","svelte-bcd9jd"),U(a,"striped",""),U(a,"class","svelte-bcd9jd"),U(s,"class","eList svelte-bcd9jd")},m(e,m){R(e,t,m),$e(n,t,null),R(e,r,m),$e(i,e,m),R(e,o,m),R(e,s,m),N(s,a),N(a,l),N(l,c),N(c,d),N(a,u),N(a,h),g.m(h,null),f=!0},p(e,t){const r={};256&t[1]&&(r.$$scope={dirty:t,ctx:e}),n.$set(r),p===(p=m(e))&&g?g.p(e,t):(g.d(1),g=p(e),g&&(g.c(),g.m(h,null)))},i(e){f||(we(n.$$.fragment,e),we(i.$$.fragment,e),f=!0)},o(e){ye(n.$$.fragment,e),ye(i.$$.fragment,e),f=!1},d(e){e&&D(t),be(n),e&&D(r),be(i,e),e&&D(o),e&&D(s),g.d()}}}function ed(e){let t,n;return t=new e[13]({props:{title:e[21],class:"eList",$$slots:{default:[Jc]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1536&n[0]|256&n[1]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function td(e){let t,n,r,i,o,s,a,l,c;function d(t){e[26](t)}let u={id:e[2],name:e[3].name,inputClass:e[5]||e[1],disabled:e[6],formnovalidate:e[7],readonly:e[18],pattern:e[17],required:e[19],style:"padding-left:2em;"};void 0!==e[0]&&(u.value=e[0]),n=new e[11]({props:u}),ee.push(()=>Ee(n,"value",d)),n.$on("change",e[27]);const h=[Gc,qc],f=[];function m(e,t){return e[6]||e[4]._id?1:0}o=m(e),s=f[o]=h[o](e);let p=e[8]&&Xc(e);return{c(){t=O("div"),Ae(n.$$.fragment),i=P(),s.c(),a=P(),p&&p.c(),l=B(),z(t,"position","relative")},m(e,r){R(e,t,r),$e(n,t,null),N(t,i),f[o].m(t,null),R(e,a,r),p&&p.m(e,r),R(e,l,r),c=!0},p(e,i){const a={};4&i[0]&&(a.id=e[2]),8&i[0]&&(a.name=e[3].name),34&i[0]&&(a.inputClass=e[5]||e[1]),64&i[0]&&(a.disabled=e[6]),128&i[0]&&(a.formnovalidate=e[7]),!r&&1&i[0]&&(r=!0,a.value=e[0],le(()=>r=!1)),n.$set(a);let c=o;o=m(e),o===c?f[o].p(e,i):(pe(),ye(f[c],1,1,()=>{f[c]=null}),ge(),s=f[o],s?s.p(e,i):(s=f[o]=h[o](e),s.c()),we(s,1),s.m(t,null)),e[8]?p?(p.p(e,i),256&i[0]&&we(p,1)):(p=Xc(e),p.c(),we(p,1),p.m(l.parentNode,l)):p&&(pe(),ye(p,1,1,()=>{p=null}),ge())},i(e){c||(we(n.$$.fragment,e),we(s),we(p),c=!0)},o(e){ye(n.$$.fragment,e),ye(s),ye(p),c=!1},d(e){e&&D(t),be(n),f[o].d(),e&&D(a),p&&p.d(e),e&&D(l)}}}function nd(e,n,r){let i;const{TextField:o,Modal:s,Dialog:a,Button:l,Divider:d}=c,h=K(),{environment:f}=u;b(e,f,e=>r(29,i=e));let{classId:m}=n,{id:p}=n,{item:g}=n,{record:w={}}=n,{value:y}=n,{noForm:v=!1}=n,{disabled:I}=n,{formnovalidate:_}=n;const{properties:C={}}=g;let{pattern:E,placeholder:A,readonly:$,required:S=!1,format:T}=C,N=!1;const{service:{type:R,map:D,title:x,designation:O}}=T;let k,M;const P=()=>{r(8,N=!1)};return e.$$set=e=>{"classId"in e&&r(1,m=e.classId),"id"in e&&r(2,p=e.id),"item"in e&&r(3,g=e.item),"record"in e&&r(4,w=e.record),"value"in e&&r(0,y=e.value),"noForm"in e&&r(5,v=e.noForm),"disabled"in e&&r(6,I=e.disabled),"formnovalidate"in e&&r(7,_=e.formnovalidate)},[y,m,p,g,w,v,I,_,N,k,M,o,s,a,l,d,f,E,$,S,x,O,async()=>{I||w._id||(r(9,k=[]),r(10,M=""),y.length>3&&(r(9,k=await t.getService("address",R,y)),Array.isArray(k)||r(10,M=k.error)),r(8,N=!0))},e=>D.map(({name:t})=>e[t]).filter(e=>!!e).join(", "),e=>()=>{const t=k[e],n=[];let r="";for(const{name:e,refItem:o}of D){const[s,a]=o.split(".");a?(r=s,"owner.country"===e&&(t[e]=i.country?._id||""),n.push({name:a,value:t[e]})):h("record",{itemName:o,value:t[e]})}n.length&&h("objRecord",{listName:r,items:n}),P()},P,function(e){y=e,r(0,y)},function(t){Q(e,t)},function(e){N=e,r(8,N)}]}class rd extends Te{constructor(e){var t;super(),document.getElementById("svelte-bcd9jd-style")||((t=O("style")).id="svelte-bcd9jd-style",t.textContent=".feather.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:#326173}.feather2.svelte-bcd9jd.svelte-bcd9jd{position:absolute;top:0.75em;left:0.5em;color:light-gray}.eList.svelte-bcd9jd.svelte-bcd9jd{height:fit-content;max-height:65vh;overflow-y:scroll;overflow-x:auto}.eList.svelte-bcd9jd table.svelte-bcd9jd{min-width:30vw;position:relative;width:max-content !important;max-width:50vh !important}.eList.svelte-bcd9jd table thead.svelte-bcd9jd{position:sticky;top:0;background:#326173;color:white}.eList.svelte-bcd9jd table thead tr.svelte-bcd9jd{height:2.3em}.eList.svelte-bcd9jd table tbody tr.svelte-bcd9jd{height:2.75em !important}th.svelte-bcd9jd.svelte-bcd9jd,td.svelte-bcd9jd.svelte-bcd9jd{padding-left:0.4em;padding-right:0.4em}",N(document.head,t)),Se(this,e,nd,td,$,{classId:1,id:2,item:3,record:4,value:0,noForm:5,disabled:6,formnovalidate:7},[-1,-1])}}function id(e){let t,n,r;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather2 svelte-1xgbysl")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function od(e){let t,n,r,i,o;return n=new it({props:{size:"18"}}),{c(){t=O("span"),Ae(n.$$.fragment),U(t,"class","feather pointer svelte-1xgbysl")},m(s,a){R(s,t,a),$e(n,t,null),r=!0,i||(o=L(t,"click",e[6]),i=!0)},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n),i=!1,o()}}}function sd(e){let t,n,r,i,o,s;n=new e[5]({props:{inputClass:e[0],disabled:!0,formnovalidate:e[1],readonly:!0,id:e[2],name:e[3],value:e[4],style:"padding-left: 2em;"}});const a=[od,id],l=[];function c(e,t){return e[4]?0:1}return i=c(e),o=l[i]=a[i](e),{c(){t=O("div"),Ae(n.$$.fragment),r=P(),o.c(),z(t,"position","relative")},m(e,o){R(e,t,o),$e(n,t,null),N(t,r),l[i].m(t,null),s=!0},p(e,[r]){const s={};1&r&&(s.inputClass=e[0]),2&r&&(s.formnovalidate=e[1]),4&r&&(s.id=e[2]),8&r&&(s.name=e[3]),16&r&&(s.value=e[4]),n.$set(s);let d=i;i=c(e),i===d?l[i].p(e,r):(pe(),ye(l[d],1,1,()=>{l[d]=null}),ge(),o=l[i],o?o.p(e,r):(o=l[i]=a[i](e),o.c()),we(o,1),o.m(t,null))},i(e){s||(we(n.$$.fragment,e),we(o),s=!0)},o(e){ye(n.$$.fragment,e),ye(o),s=!1},d(e){e&&D(t),be(n),l[i].d()}}}function ad(e,t,n){const{TextField:r}=c;let{inputClass:i}=t,{disabled:o}=t,{formnovalidate:s}=t,{readonly:a}=t,{required:l}=t,{id:d}=t,{name:u}=t,{value:h}=t,{record:f}=t;const m=f?.task;return e.$$set=e=>{"inputClass"in e&&n(0,i=e.inputClass),"disabled"in e&&n(7,o=e.disabled),"formnovalidate"in e&&n(1,s=e.formnovalidate),"readonly"in e&&n(8,a=e.readonly),"required"in e&&n(9,l=e.required),"id"in e&&n(2,d=e.id),"name"in e&&n(3,u=e.name),"value"in e&&n(4,h=e.value),"record"in e&&n(10,f=e.record)},[i,s,d,u,h,r,async()=>{m&&window.open(m)},o,a,l,f]}class ld extends Te{constructor(e){var t;super(),document.getElementById("svelte-1xgbysl-style")||((t=O("style")).id="svelte-1xgbysl-style",t.textContent=".feather.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:#4300b0}.feather2.svelte-1xgbysl{position:absolute;top:0.75em;left:0.5em;color:light-gray}",N(document.head,t)),Se(this,e,ad,sd,$,{inputClass:0,disabled:7,formnovalidate:1,readonly:8,required:9,id:2,name:3,value:4,record:10})}}function cd(e){let t,n;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+(e[26]?" hidden ":""),nameClass:e[0].properties?.color?"color_"+e[0].properties.color:"",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Ld,({notifyList:e})=>({24:e}),({notifyList:e})=>[e?16777216:0]]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};67108865&n[0]&&(r.class=e[0].name+(e[26]?" hidden ":"")),1&n[0]&&(r.nameClass=e[0].properties?.color?"color_"+e[0].properties.color:""),1&n[0]&&(r.name=e[0].designation),1&n[0]&&(r.help=e[0].properties?.hint),872415231&n[0]|262144&n[2]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function dd(e){let t,n;return t=new e[33]({props:{text:e[0].designation}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.text=e[0].designation),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ud(e){let t,n,r,i;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+(e[26]?" hidden ":""),name:e[0].designation,help:e[0].properties?.hint}}),r=new Oc({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),record:e[1],noForm:e[8]}}),r.$on("blur",e[42]()),{c(){Ae(t.$$.fragment),n=P(),Ae(r.$$.fragment)},m(e,o){$e(t,e,o),R(e,n,o),$e(r,e,o),i=!0},p(e,n){const i={};67108865&n[0]&&(i.class=e[0].name+(e[26]?" hidden ":"")),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),t.$set(i);const o={};512&n[0]&&(o.classId=e[9]),8&n[0]&&(o.disabled=e[3]),33554432&n[0]&&(o.readonly=e[25]),1&n[0]&&(o.name=e[0].name),268435456&n[0]&&(o.value=e[28]()),2&n[0]&&(o.record=e[1]),256&n[0]&&(o.noForm=e[8]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function hd(e){let t,n,r,i,o,s;return t=new e[30]({props:{id:e[46](e[39]),class:e[0].name+" hidden",name:e[0].designation,help:e[0].properties?.hint,$$slots:{default:[Fd]},$$scope:{ctx:e}}}),r=new e[33]({props:{text:e[29]}}),o=new Ii({props:{required:e[4],disabled:e[3],readonly:e[25],id:e[39],item:e[0],currency:e[19],value:e[28]()}}),o.$on("setRefValue",e[47]),o.$on("safeReference",e[52]),o.$on("objRecord",e[53]),{c(){Ae(t.$$.fragment),n=P(),Ae(r.$$.fragment),i=P(),Ae(o.$$.fragment)},m(e,a){$e(t,e,a),R(e,n,a),$e(r,e,a),R(e,i,a),$e(o,e,a),s=!0},p(e,n){const i={};1&n[0]&&(i.class=e[0].name+" hidden"),1&n[0]&&(i.name=e[0].designation),1&n[0]&&(i.help=e[0].properties?.hint),402654721&n[0]|262144&n[2]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i);const s={};536870912&n[0]&&(s.text=e[29]),r.$set(s);const a={};16&n[0]&&(a.required=e[4]),8&n[0]&&(a.disabled=e[3]),33554432&n[0]&&(a.readonly=e[25]),1&n[0]&&(a.item=e[0]),524288&n[0]&&(a.currency=e[19]),268435456&n[0]&&(a.value=e[28]()),o.$set(a)},i(e){s||(we(t.$$.fragment,e),we(r.$$.fragment,e),we(o.$$.fragment,e),s=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),ye(o.$$.fragment,e),s=!1},d(e){be(t,e),e&&D(n),be(r,e),e&&D(i),be(o,e)}}}function fd(e){let t,n;return t=new e[31]({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],pattern:e[35],required:!0===e[4],placeholder:e[37],id:e[39],name:e[38],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=!0===e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function md(e){let t,n;return t=new gc({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],pattern:e[35],placeholder:e[37],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function pd(e){let t,n;return t=new ld({props:{inputClass:e[8]||e[9],formnovalidate:e[12],id:e[39],name:e[38],value:e[28](),record:e[1],"}":!0}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),4096&n[0]&&(r.formnovalidate=e[12]),268435456&n[0]&&(r.value=e[28]()),2&n[0]&&(r.record=e[1]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function gd(e){let t,n;return t=new uc({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function wd(e){let t,n;return t=new _c({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],pattern:e[35],multiple:e[36],placeholder:e[37],value:e[28]()}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function yd(e){let t,n;return t=new Ql({props:{inputClass:e[8]||e[9],disabled:e[3],readonly:e[25],required:e[4],id:e[39],item:e[0],value:e[28](),praefix:e[5]}}),t.$on("blur",e[42]()),t.$on("checkRange",e[71]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),268435456&n[0]&&(r.value=e[28]()),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function vd(e){let t,n;return t=new fo({props:{inputClass:e[8]||e[9],disabled:e[3],formnovalidate:e[12],readonly:e[25],required:e[4],id:e[39],name:e[38],value:e[28](),record:e[1],item:e[0]}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.value=e[28]()),2&n[0]&&(r.record=e[1]),1&n[0]&&(r.item=e[0]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Id(e){let t,n;return t=new hs({props:{classId:e[9],id:e[39],disabled:e[3],required:e[4],value:e[40](),noForm:e[8]}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function _d(e){let t,n;return t=new ps({props:{classId:e[9],id:e[39],item:e[0],disabled:e[3],required:e[4],value:e[41](),noForm:e[8]}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1&n[0]&&(r.item=e[0]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Cd(e){let t,n;return t=new rs({props:{classId:e[9],eventId:e[10],id:e[39],item:e[0],record:e[1],readonly:e[25],disabled:e[3],required:e[4],praefix:e[5],value:e[40](),noForm:e[8],notifyList:e[24],dateInput:e[23]}}),t.$on("change",e[42](!0)),t.$on("formula",e[69]),t.$on("record",e[70]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),33554432&n[0]&&(r.readonly=e[25]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),32&n[0]&&(r.praefix=e[5]),256&n[0]&&(r.noForm=e[8]),16777216&n[0]&&(r.notifyList=e[24]),8388608&n[0]&&(r.dateInput=e[23]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ed(e){let t,n;return t=new e[32]({props:{round:!0,inputClass:e[8]||e[9],disabled:e[3]||e[25],required:e[4],id:e[39],name:e[38],checked:e[28](),value:e[28](!0)}}),t.$on("change",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]&&(r.inputClass=e[8]||e[9]),33554440&n[0]&&(r.disabled=e[3]||e[25]),16&n[0]&&(r.required=e[4]),268435456&n[0]&&(r.checked=e[28]()),268435456&n[0]&&(r.value=e[28](!0)),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ad(e){let t,n;return t=new sc({props:{id:e[39],item:e[0],praefix:e[5],record:e[1],notifyList:e[24]}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[0]),32&n[0]&&(r.praefix=e[5]),2&n[0]&&(r.record=e[1]),16777216&n[0]&&(r.notifyList=e[24]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function $d(e){let t,n;return t=new Io({props:{classId:e[9],item:e[0],record:e[1],listName:e[6],disabled:e[3],formnovalidate:e[12],readonly:e[25],pattern:e[35],required:!0===e[4],placeholder:e[37],id:e[39],name:e[38],value:e[28]()}}),t.$on("blur",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),64&n[0]&&(r.listName=e[6]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=!0===e[4]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function bd(e){let t,n;return t=new qo({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8],view:e[0].properties.view,praefix:e[5]}}),t.$on("blur",e[42]()),t.$on("invalid",e[68]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.view=e[0].properties.view),32&n[0]&&(r.praefix=e[5]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Sd(e){let t,n;return t=new so({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8],multi:e[0].properties.multi,numberInput:e[14],praefix:e[5],toDelete:e[17],reqQuantity:e[18],notifyList:e[24]}}),t.$on("blur",e[42]()),t.$on("invalid",e[67]),t.$on("record",e[43]),t.$on("multi",e[44]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.multi=e[0].properties.multi),16384&n[0]&&(r.numberInput=e[14]),32&n[0]&&(r.praefix=e[5]),131072&n[0]&&(r.toDelete=e[17]),262144&n[0]&&(r.reqQuantity=e[18]),16777216&n[0]&&(r.notifyList=e[24]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Td(e){let t,n;return t=new $i({props:{classId:e[9],disabled:e[3],formnovalidate:e[12],required:e[4],readonly:e[25],id:e[39],item:e[0],currency:e[19],value:e[28](),praefix:e[5],notifyList:e[24],noForm:e[8]}}),t.$on("blur",e[42]()),t.$on("formula",e[64]),t.$on("listRecord",e[65]),t.$on("record",e[66]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),16&n[0]&&(r.required=e[4]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),524288&n[0]&&(r.currency=e[19]),268435456&n[0]&&(r.value=e[28]()),32&n[0]&&(r.praefix=e[5]),16777216&n[0]&&(r.notifyList=e[24]),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Nd(e){let t,n;return t=new rd({props:{classId:e[9],disabled:e[3],readonly:e[25],required:e[4],id:e[39],item:e[0],record:e[1],value:e[28](),noForm:e[8]}}),t.$on("change",e[42]()),t.$on("record",e[62]),t.$on("objRecord",e[63]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Rd(e){let t,n;return t=new Jo({props:{classId:e[9],disabled:e[3],required:e[4],id:e[39],item:e[0],value:e[28](),noForm:e[8]}}),t.$on("blur",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),16&n[0]&&(r.required=e[4]),1&n[0]&&(r.item=e[0]),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Dd(e){let t,n;return t=new zc({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),record:e[1],noForm:e[8],placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.name=e[0].name),268435456&n[0]&&(r.value=e[28]()),2&n[0]&&(r.record=e[1]),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function xd(e){let t,n;return t=new Gl({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],recordId:e[2],value:e[28](),fileType:e[0].properties?.accept}}),t.$on("record",e[60]),t.$on("listRecord",e[61]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.praefix=e[5]),512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),4&n[0]&&(r.recordId=e[2]),268435456&n[0]&&(r.value=e[28]()),1&n[0]&&(r.fileType=e[0].properties?.accept),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Od(e){let t,n;return t=new Ml({props:{praefix:e[5],classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],value:e[28]()}}),t.$on("record",e[59]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};32&n[0]&&(r.praefix=e[5]),512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function kd(e){let t,n;return t=new Al({props:{classId:e[9],disabled:e[3],readonly:e[25],item:e[0],id:e[39],name:e[0].name,eventId:e[10],record:e[1],value:e[28]()}}),t.$on("record",e[58]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),1&n[0]&&(r.name=e[0].name),1024&n[0]&&(r.eventId=e[10]),2&n[0]&&(r.record=e[1]),268435456&n[0]&&(r.value=e[28]()),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Md(e){let t,n;return t=new o({props:{classId:e[9],disabled:e[3],readonly:e[25],id:e[39],name:e[0].name,value:e[28](),noForm:e[8],standard:!0,style:"",placeholder:e[0].properties?.placeholder}}),t.$on("blur",e[42]()),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),8&n[0]&&(r.disabled=e[3]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.name=e[0].name),268435456&n[0]&&(r.value=e[28]()),256&n[0]&&(r.noForm=e[8]),1&n[0]&&(r.placeholder=e[0].properties?.placeholder),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Pd(e){let t,n;return t=new Xn({props:{classId:e[9],eventId:e[10],fullRecord:e[7],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[25],id:e[39],item:e[0],desc:e[29],value:e[28](),multiValues:e[20],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16],shortEdit:e[21],initFinished:e[22]}}),t.$on("task",e[56]),t.$on("change",e[42]()),t.$on("initFail",e[45]),t.$on("defPrep",e[57]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),128&n[0]&&(r.fullRecord=e[7]),16&n[0]&&(r.required=e[4]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),536870912&n[0]&&(r.desc=e[29]),268435456&n[0]&&(r.value=e[28]()),1048576&n[0]&&(r.multiValues=e[20]),256&n[0]&&(r.noForm=e[8]),32&n[0]&&(r.praefix=e[5]),2048&n[0]&&(r.selectionFields=e[11]),8192&n[0]&&(r.selection=e[13]),32768&n[0]&&(r.deList=e[15]),4&n[0]&&(r.recordId=e[2]),65536&n[0]&&(r.isTemplate=e[16]),2097152&n[0]&&(r.shortEdit=e[21]),4194304&n[0]&&(r.initFinished=e[22]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Bd(e){let t,n;return t=new lr({props:{classId:e[9],eventId:e[10],required:e[4],disabled:e[3],formnovalidate:e[12],readonly:e[25],id:e[39],item:e[0],record:e[1],desc:e[29],values:e[28]()||[],noForm:e[8],praefix:e[5],selectionFields:e[11],selection:e[13],deList:e[15],recordId:e[2],isTemplate:e[16]}}),t.$on("task",e[54]),t.$on("change",e[42]()),t.$on("multi",e[44]),t.$on("initFail",e[45]),t.$on("defPrep",e[55]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),16&n[0]&&(r.required=e[4]),8&n[0]&&(r.disabled=e[3]),4096&n[0]&&(r.formnovalidate=e[12]),33554432&n[0]&&(r.readonly=e[25]),1&n[0]&&(r.item=e[0]),2&n[0]&&(r.record=e[1]),536870912&n[0]&&(r.desc=e[29]),268435456&n[0]&&(r.values=e[28]()||[]),256&n[0]&&(r.noForm=e[8]),32&n[0]&&(r.praefix=e[5]),2048&n[0]&&(r.selectionFields=e[11]),8192&n[0]&&(r.selection=e[13]),32768&n[0]&&(r.deList=e[15]),4&n[0]&&(r.recordId=e[2]),65536&n[0]&&(r.isTemplate=e[16]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Ld(e){let t,n,r,i;const o=[Bd,Pd,Md,kd,Od,xd,Dd,Rd,Nd,Td,Sd,bd,$d,Ad,Ed,Cd,_d,Id,vd,yd,wd,gd,pd,md,fd],s=[];function a(e,t){return"object"===e[0].type&&e[0].properties?.multi?0:"object"===e[0].type?1:"textarea"===e[0].type||e[0].properties&&"textarea"===e[0].properties.format?2:"file"===e[0].type?3:"fileQR"===e[0].type?4:"filePDF"===e[0].type?5:"signature"===e[0].type?6:e[0].properties&&(e[0].properties.enum||e[0].properties.regulation)?7:e[0].properties?.format?.service?8:"number"===e[0].type?9:e[0].properties&&e[0].properties.multi?10:e[0].properties&&e[0].properties.view&&"lookup"!==e[0].properties.format?11:e[0].properties?.autocomplete?12:"lookup"===e[0].properties?.format?13:"boolean"===e[0].type?14:"date"===e[0].type?15:"dateRange"===e[0].type?16:"datetime"===e[0].type?17:"map"===e[0].properties?.format?18:"time"===e[0].properties?.format?19:"email"===e[0].type||"email"===e[0].properties?.format?20:"url"===e[0].properties?.format?21:"task"===e[0].properties?.format?22:"tel"===e[0].properties?.format?23:24}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Fd(e){let t,n;return t=new Xn({props:{classId:e[9],eventId:e[10],disabled:!0,readonly:!0,id:e[39],item:e[0],value:e[28](),noList:!0,withRefValue:!0,refValue:e[27]}}),t.$on("setRefDesc",e[48]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};512&n[0]&&(r.classId=e[9]),1024&n[0]&&(r.eventId=e[10]),1&n[0]&&(r.item=e[0]),268435456&n[0]&&(r.value=e[28]()),134217728&n[0]&&(r.refValue=e[27]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Vd(e){let t,n,r,i;const o=[hd,ud,dd,cd],s=[];function a(e,t){return e[5]||"reference"!==e[0].saveAs||"object"!==e[0].type?"html"===e[0].properties?.format?1:"divider"===e[0].type?2:3:0}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function Ud(e,n,r){let i,o,s,a;const l=K(),{FormField:d,TextField:h,DatePicker:f,TimePicker:p,Checkbox:g,Divider:w}=c,{environment:y}=u;b(e,y,e=>r(51,a=e));let{praefix:v=""}=n,{item:I}=n,{listName:_=""}=n,{fullRecord:C}=n,{record:E}=n,{recordId:A}=n,{noForm:$=!1}=n,{classId:S}=n,{eventId:T}=n,{disabled:N}=n,{selectionFields:R}=n,{formnovalidate:D}=n,{selection:x=!1}=n,{notifyList:O}=n,{numberInput:k}=n,{deList:M}=n,{required:P}=n,{isTemplate:B}=n,{toDelete:L}=n,{reqQuantity:F}=n,{currency:V}=n,{changeValue:U}=n,{propSelection:H}=n,{multiValues:W}=n,{shortEdit:z}=n,{initFinished:j}=n,{dateInput:q}=n;A||=E._id;let{required:G,readonly:X,hidden:Y,pattern:Z,multiple:J,placeholder:ee}=I.properties||{};if(Y=!0===Y,void 0!==X&&(X=!0===X),X||=A&&I.asInput,void 0===P&&(P=G),N=N||!!X,"string"==typeof I.name){const[e,t]=I.name.split("_");t&&(I.name=t)}const te=(_?_+".":"")+I.name,ne=te+(""!==v?"-"+v:""),re=(e,t=te)=>{try{return t.split(".").reduce((e,t)=>e[t],e)}catch(e){return""}},ie=async e=>{const{list:n,values:r}=I.process;if(!e)return void l("save",{itemName:n,value:[],addToRecord:!0});const i={},o=await t.getSchema(T);for(const e in r){const s=r[e];if(e.includes(".")){const[r,a]=e.split("."),l={[a]:s};let c=await t.getSectionView(r,l);if(!c?.length)continue;c=c[0],i[r]=c._id;const d=o.list.find(e=>e.name===n);for(const e of d.item){const{name:t}=e;i[t]||(i[t]=c[t])}}else i[e]=s}l("save",{itemName:n,value:[i],addToRecord:!0})};let oe=re(E);return e.$$set=e=>{"praefix"in e&&r(5,v=e.praefix),"item"in e&&r(0,I=e.item),"listName"in e&&r(6,_=e.listName),"fullRecord"in e&&r(7,C=e.fullRecord),"record"in e&&r(1,E=e.record),"recordId"in e&&r(2,A=e.recordId),"noForm"in e&&r(8,$=e.noForm),"classId"in e&&r(9,S=e.classId),"eventId"in e&&r(10,T=e.eventId),"disabled"in e&&r(3,N=e.disabled),"selectionFields"in e&&r(11,R=e.selectionFields),"formnovalidate"in e&&r(12,D=e.formnovalidate),"selection"in e&&r(13,x=e.selection),"notifyList"in e&&r(24,O=e.notifyList),"numberInput"in e&&r(14,k=e.numberInput),"deList"in e&&r(15,M=e.deList),"required"in e&&r(4,P=e.required),"isTemplate"in e&&r(16,B=e.isTemplate),"toDelete"in e&&r(17,L=e.toDelete),"reqQuantity"in e&&r(18,F=e.reqQuantity),"currency"in e&&r(19,V=e.currency),"changeValue"in e&&r(49,U=e.changeValue),"propSelection"in e&&r(50,H=e.propSelection),"multiValues"in e&&r(20,W=e.multiValues),"shortEdit"in e&&r(21,z=e.shortEdit),"initFinished"in e&&r(22,j=e.initFinished),"dateInput"in e&&r(23,q=e.dateInput)},e.$$.update=()=>{if(1&e.$$.dirty[0]|524288&e.$$.dirty[1]&&H&&I.properties?.selection){const{refClass:e,refItem:t,target:n}=I.properties.selection,r=H.record[e];l("propSelection",{itemName:I.name,itemType:I.type,prop:t,target:n,source:e,sourceId:r})}if(262144&e.$$.dirty[1])for(const e in U)e===te&&r(1,E[te]=U[e],E);7&e.$$.dirty[0]|1048576&e.$$.dirty[1]&&r(28,i=(e=!1)=>{let t;return A||"number"!==I.type&&"string"!==I.type||!I.refItemAlt?.startsWith||!I.refItemAlt.startsWith("owner.")||+re(E)?A||"number"!==I.type&&"string"!==I.type||!I.refItem?.startsWith||!I.refItem.startsWith("owner.")?(t=re(E),!t&&I.properties?.useId&&(t=E._id),e&&(t=!!t),void 0===t?"":t):(t=re(a,I.refItem),void 0===t?"":t):(t=re(a,I.refItemAlt),void 0===t?"":t)}),2&e.$$.dirty[0]&&(s=re(E))},r(29,o=((e=te)=>{let t=E["_"+e];return t=m(t),void 0===t?"":t})()),[I,E,A,N,P,v,_,C,$,S,T,R,D,x,k,M,B,L,F,V,W,z,j,q,O,X,Y,oe,i,o,d,h,g,w,y,Z,J,ee,te,ne,(e=te)=>{let t=re(E);return t?new Date(t):""===v?(()=>{const e=new Date;return new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate()-1,23))})():void 0},(e=te)=>{const t=re(E,e+"_from"),n=re(E,e+"_to");return{from:void 0===t?t:new Date(t),to:void 0===n?n:new Date(n)}},e=>({detail:t})=>{let{value:n,checked:i,range:o}=t;void 0!==i&&(n=i);const a=te+(o||"");r(1,E[a]=e?function(e,t){if(null==e)return null;let n=e.getHours();return/%p/i.test(t)&&(n%=12,0===n&&(n=12)),t.replace("%Y",e.getFullYear()).replace("%y",(e.getFullYear()%100).toString().padStart(2,"0")).replace("%m",(e.getMonth()+1).toString().padStart(2,"0")).replace("%d",e.getDate().toString().padStart(2,"0")).replace("%H",n.toString().padStart(2,"0")).replace("%M",e.getMinutes().toString().padStart(2,"0")).replace("%S",e.getSeconds().toString().padStart(2,"0")).replace("%p",e.getHours()<12?"am":"pm").replace("%P",e.getHours()<12?"AM":"PM").replace("%%","%")}(n,"%d.%m.%Y"):n,E);const c=Object.values(E).every(e=>!e)&&n;l("notify",{oldValue:s,value:n,add:c,itemName:a,desc:t.description}),"boolean"===I.type&&I.process&&ie(i)},({detail:e})=>{l("record",e)},({detail:e})=>{l("multi",e)},()=>r(26,Y=!0),()=>"object"===I.type?"comment_"+ne:ne,({detail:e})=>{r(27,oe=e)},({detail:e})=>{const{designation:t}=I;r(29,o=t+": "+(e||"(Neu)"))},U,H,a,function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)},function(t){Q(e,t)}]}class Hd extends Te{constructor(e){var t;super(),document.getElementById("svelte-rxh0vh-style")||((t=O("style")).id="svelte-rxh0vh-style",t.textContent=".form-field{margin-bottom:0.5em !important}.form-field.hidden{display:none !important}.form-field > .description{padding-top:0.75em;color:black}.form-field div.field > label.checkbox{padding-top:0.5em}.form-field label.color_red{color:red}",N(document.head,t)),Se(this,e,Ud,Vd,$,{praefix:5,item:0,listName:6,fullRecord:7,record:1,recordId:2,noForm:8,classId:9,eventId:10,disabled:3,selectionFields:11,formnovalidate:12,selection:13,notifyList:24,numberInput:14,deList:15,required:4,isTemplate:16,toDelete:17,reqQuantity:18,currency:19,changeValue:49,propSelection:50,multiValues:20,shortEdit:21,initFinished:22,dateInput:23},[-1,-1,-1])}}var Wd;!function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(Wd||(Wd={}));var zd,jd,qd=new Map([[Wd.QR_CODE,"QR_CODE"],[Wd.AZTEC,"AZTEC"],[Wd.CODABAR,"CODABAR"],[Wd.CODE_39,"CODE_39"],[Wd.CODE_93,"CODE_93"],[Wd.CODE_128,"CODE_128"],[Wd.DATA_MATRIX,"DATA_MATRIX"],[Wd.MAXICODE,"MAXICODE"],[Wd.ITF,"ITF"],[Wd.EAN_13,"EAN_13"],[Wd.EAN_8,"EAN_8"],[Wd.PDF_417,"PDF_417"],[Wd.RSS_14,"RSS_14"],[Wd.RSS_EXPANDED,"RSS_EXPANDED"],[Wd.UPC_A,"UPC_A"],[Wd.UPC_E,"UPC_E"],[Wd.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]);function Gd(e){return Object.values(Wd).includes(e)}!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"}(zd||(zd={})),function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"}(jd||(jd={}));var Xd,Yd=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[jd.SCAN_TYPE_CAMERA,jd.SCAN_TYPE_FILE],e}(),Zd=function(){function e(e,t){this.format=e,this.formatName=t}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!qd.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,qd.get(t))},e}(),Kd=function(){function e(){}return e.createFromText=function(e){return{decodedText:e,result:{text:e}}},e.createFromQrcodeResult=function(e){return{decodedText:e.text,result:e}},e}();!function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"}(Xd||(Xd={}));var Qd=function(){function e(){}return e.createFrom=function(e){return{errorMessage:e,type:Xd.UNKWOWN_ERROR}},e}(),Jd=function(){function e(e){this.verbose=e}return e.prototype.log=function(e){this.verbose&&console.log(e)},e.prototype.warn=function(e){this.verbose&&console.warn(e)},e.prototype.logError=function(e,t){(this.verbose||!0===t)&&console.error(e)},e.prototype.logErrors=function(e){if(0===e.length)throw"Logger#logError called without arguments";this.verbose&&console.error(e)},e}();function eu(e){return null==e}var tu=function(){function e(){}return e.codeParseError=function(e){return"QR code parse error, error = ".concat(e)},e.errorGettingUserMedia=function(e){return"Error getting userMedia, error = ".concat(e)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),nu=function(){function e(){}return e.isMediaStreamConstraintsValid=function(e,t){if("object"!=typeof e){var n=typeof e;return t.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(n,"."),!0),!1}for(var r=new Set(["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"]),i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];if(r.has(s))return t.logError("".concat(s," is not supported videoConstaints."),!0),!1}return!0},e}(),ru="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function iu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ou(e){var t={exports:{}};return e(t,t.exports),t.exports}var su,au,lu=ou(function(e,t){!function(e){function t(e){return null==e}var n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function r(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function i(e,t){var n=Object.setPrototypeOf;n?n(e,t):e.__proto__=t}function o(e,t){void 0===t&&(t=e.constructor);var n=Error.captureStackTrace;n&&n(e,t)}var s,a=function(e){function t(t){var n=this.constructor,r=e.call(this,t)||this;return Object.defineProperty(r,"name",{value:n.name,enumerable:!1}),i(r,n.prototype),o(r),r}return r(t,e),t}(Error);class l extends a{constructor(e=void 0){super(e),this.message=e}getKind(){return this.constructor.kind}}l.kind="Exception";class c extends l{}c.kind="ArgumentException";class d extends l{}d.kind="IllegalArgumentException";class u{constructor(e){if(this.binarizer=e,null===e)throw new d("Binarizer must be non-null.")}getWidth(){return this.binarizer.getWidth()}getHeight(){return this.binarizer.getHeight()}getBlackRow(e,t){return this.binarizer.getBlackRow(e,t)}getBlackMatrix(){return null!==this.matrix&&void 0!==this.matrix||(this.matrix=this.binarizer.getBlackMatrix()),this.matrix}isCropSupported(){return this.binarizer.getLuminanceSource().isCropSupported()}crop(e,t,n,r){const i=this.binarizer.getLuminanceSource().crop(e,t,n,r);return new u(this.binarizer.createBinarizer(i))}isRotateSupported(){return this.binarizer.getLuminanceSource().isRotateSupported()}rotateCounterClockwise(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise();return new u(this.binarizer.createBinarizer(e))}rotateCounterClockwise45(){const e=this.binarizer.getLuminanceSource().rotateCounterClockwise45();return new u(this.binarizer.createBinarizer(e))}toString(){try{return this.getBlackMatrix().toString()}catch(e){return""}}}class h extends l{static getChecksumInstance(){return new h}}h.kind="ChecksumException";class f{constructor(e){this.source=e}getLuminanceSource(){return this.source}getWidth(){return this.source.getWidth()}getHeight(){return this.source.getHeight()}}class m{static arraycopy(e,t,n,r,i){for(;i--;)n[r++]=e[t++]}static currentTimeMillis(){return Date.now()}}class p extends l{}p.kind="IndexOutOfBoundsException";class g extends p{constructor(e=void 0,t=void 0){super(t),this.index=e,this.message=t}}g.kind="ArrayIndexOutOfBoundsException";class w{static fill(e,t){for(let n=0,r=e.length;n<r;n++)e[n]=t}static fillWithin(e,t,n,r){w.rangeCheck(e.length,t,n);for(let i=t;i<n;i++)e[i]=r}static rangeCheck(e,t,n){if(t>n)throw new d("fromIndex("+t+") > toIndex("+n+")");if(t<0)throw new g(t);if(n>e)throw new g(n)}static asList(...e){return e}static create(e,t,n){return Array.from({length:e}).map(e=>Array.from({length:t}).fill(n))}static createInt32Array(e,t,n){return Array.from({length:e}).map(e=>Int32Array.from({length:t}).fill(n))}static equals(e,t){if(!e)return!1;if(!t)return!1;if(!e.length)return!1;if(!t.length)return!1;if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}static hashCode(e){if(null===e)return 0;let t=1;for(const n of e)t=31*t+n;return t}static fillUint8Array(e,t){for(let n=0;n!==e.length;n++)e[n]=t}static copyOf(e,t){return e.slice(0,t)}static copyOfUint8Array(e,t){if(e.length<=t){const n=new Uint8Array(t);return n.set(e),n}return e.slice(0,t)}static copyOfRange(e,t,n){const r=n-t,i=new Int32Array(r);return m.arraycopy(e,t,i,0,r),i}static binarySearch(e,t,n){void 0===n&&(n=w.numberComparator);let r=0,i=e.length-1;for(;r<=i;){const o=i+r>>1,s=n(t,e[o]);if(s>0)r=o+1;else{if(!(s<0))return o;i=o-1}}return-r-1}static numberComparator(e,t){return e-t}}class y{static numberOfTrailingZeros(e){let t;if(0===e)return 32;let n=31;return t=e<<16,0!==t&&(n-=16,e=t),t=e<<8,0!==t&&(n-=8,e=t),t=e<<4,0!==t&&(n-=4,e=t),t=e<<2,0!==t&&(n-=2,e=t),n-(e<<1>>>31)}static numberOfLeadingZeros(e){if(0===e)return 32;let t=1;return e>>>16==0&&(t+=16,e<<=16),e>>>24==0&&(t+=8,e<<=8),e>>>28==0&&(t+=4,e<<=4),e>>>30==0&&(t+=2,e<<=2),t-=e>>>31,t}static toHexString(e){return e.toString(16)}static toBinaryString(e){return String(parseInt(String(e),2))}static bitCount(e){return e=(e=(858993459&(e-=e>>>1&1431655765))+(e>>>2&858993459))+(e>>>4)&252645135,e+=e>>>8,63&(e+=e>>>16)}static truncDivision(e,t){return Math.trunc(e/t)}static parseInt(e,t=void 0){return parseInt(e,t)}}y.MIN_VALUE_32_BITS=-2147483648,y.MAX_VALUE=Number.MAX_SAFE_INTEGER;class v{constructor(e,t){void 0===e?(this.size=0,this.bits=new Int32Array(1)):(this.size=e,this.bits=null==t?v.makeArray(e):t)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(e){if(e>32*this.bits.length){const t=v.makeArray(e);m.arraycopy(this.bits,0,t,0,this.bits.length),this.bits=t}}get(e){return!!(this.bits[Math.floor(e/32)]&1<<(31&e))}set(e){this.bits[Math.floor(e/32)]|=1<<(31&e)}flip(e){this.bits[Math.floor(e/32)]^=1<<(31&e)}getNextSet(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=n[r];i&=~((1<<(31&e))-1);const o=n.length;for(;0===i;){if(++r===o)return t;i=n[r]}const s=32*r+y.numberOfTrailingZeros(i);return s>t?t:s}getNextUnset(e){const t=this.size;if(e>=t)return t;const n=this.bits;let r=Math.floor(e/32),i=~n[r];i&=~((1<<(31&e))-1);const o=n.length;for(;0===i;){if(++r===o)return t;i=~n[r]}const s=32*r+y.numberOfTrailingZeros(i);return s>t?t:s}setBulk(e,t){this.bits[Math.floor(e/32)]=t}setRange(e,t){if(t<e||e<0||t>this.size)throw new d;if(t===e)return;t--;const n=Math.floor(e/32),r=Math.floor(t/32),i=this.bits;for(let o=n;o<=r;o++){const s=(2<<(o<r?31:31&t))-(1<<(o>n?0:31&e));i[o]|=s}}clear(){const e=this.bits.length,t=this.bits;for(let n=0;n<e;n++)t[n]=0}isRange(e,t,n){if(t<e||e<0||t>this.size)throw new d;if(t===e)return!0;t--;const r=Math.floor(e/32),i=Math.floor(t/32),o=this.bits;for(let s=r;s<=i;s++){const a=(2<<(s<i?31:31&t))-(1<<(s>r?0:31&e))&4294967295;if((o[s]&a)!==(n?a:0))return!1}return!0}appendBit(e){this.ensureCapacity(this.size+1),e&&(this.bits[Math.floor(this.size/32)]|=1<<(31&this.size)),this.size++}appendBits(e,t){if(t<0||t>32)throw new d("Num bits must be between 0 and 32");this.ensureCapacity(this.size+t);for(let n=t;n>0;n--)this.appendBit(1==(e>>n-1&1))}appendBitArray(e){const t=e.size;this.ensureCapacity(this.size+t);for(let n=0;n<t;n++)this.appendBit(e.get(n))}xor(e){if(this.size!==e.size)throw new d("Sizes don't match");const t=this.bits;for(let n=0,r=t.length;n<r;n++)t[n]^=e.bits[n]}toBytes(e,t,n,r){for(let i=0;i<r;i++){let r=0;for(let t=0;t<8;t++)this.get(e)&&(r|=1<<7-t),e++;t[n+i]=r}}getBitArray(){return this.bits}reverse(){const e=new Int32Array(this.bits.length),t=Math.floor((this.size-1)/32),n=t+1,r=this.bits;for(let i=0;i<n;i++){let n=r[i];n=n>>1&1431655765|(1431655765&n)<<1,n=n>>2&858993459|(858993459&n)<<2,n=n>>4&252645135|(252645135&n)<<4,n=n>>8&16711935|(16711935&n)<<8,n=n>>16&65535|(65535&n)<<16,e[t-i]=n}if(this.size!==32*n){const t=32*n-this.size;let r=e[0]>>>t;for(let i=1;i<n;i++){const n=e[i];r|=n<<32-t,e[i-1]=r,r=n>>>t}e[n-1]=r}this.bits=e}static makeArray(e){return new Int32Array(Math.floor((e+31)/32))}equals(e){if(!(e instanceof v))return!1;const t=e;return this.size===t.size&&w.equals(this.bits,t.bits)}hashCode(){return 31*this.size+w.hashCode(this.bits)}toString(){let e="";for(let t=0,n=this.size;t<n;t++)7&t||(e+=" "),e+=this.get(t)?"X":".";return e}clone(){return new v(this.size,this.bits.slice())}}!function(e){e[e.OTHER=0]="OTHER",e[e.PURE_BARCODE=1]="PURE_BARCODE",e[e.POSSIBLE_FORMATS=2]="POSSIBLE_FORMATS",e[e.TRY_HARDER=3]="TRY_HARDER",e[e.CHARACTER_SET=4]="CHARACTER_SET",e[e.ALLOWED_LENGTHS=5]="ALLOWED_LENGTHS",e[e.ASSUME_CODE_39_CHECK_DIGIT=6]="ASSUME_CODE_39_CHECK_DIGIT",e[e.ASSUME_GS1=7]="ASSUME_GS1",e[e.RETURN_CODABAR_START_END=8]="RETURN_CODABAR_START_END",e[e.NEED_RESULT_POINT_CALLBACK=9]="NEED_RESULT_POINT_CALLBACK",e[e.ALLOWED_EAN_EXTENSIONS=10]="ALLOWED_EAN_EXTENSIONS"}(s||(s={}));var I,_=s;class C extends l{static getFormatInstance(){return new C}}C.kind="FormatException",function(e){e[e.Cp437=0]="Cp437",e[e.ISO8859_1=1]="ISO8859_1",e[e.ISO8859_2=2]="ISO8859_2",e[e.ISO8859_3=3]="ISO8859_3",e[e.ISO8859_4=4]="ISO8859_4",e[e.ISO8859_5=5]="ISO8859_5",e[e.ISO8859_6=6]="ISO8859_6",e[e.ISO8859_7=7]="ISO8859_7",e[e.ISO8859_8=8]="ISO8859_8",e[e.ISO8859_9=9]="ISO8859_9",e[e.ISO8859_10=10]="ISO8859_10",e[e.ISO8859_11=11]="ISO8859_11",e[e.ISO8859_13=12]="ISO8859_13",e[e.ISO8859_14=13]="ISO8859_14",e[e.ISO8859_15=14]="ISO8859_15",e[e.ISO8859_16=15]="ISO8859_16",e[e.SJIS=16]="SJIS",e[e.Cp1250=17]="Cp1250",e[e.Cp1251=18]="Cp1251",e[e.Cp1252=19]="Cp1252",e[e.Cp1256=20]="Cp1256",e[e.UnicodeBigUnmarked=21]="UnicodeBigUnmarked",e[e.UTF8=22]="UTF8",e[e.ASCII=23]="ASCII",e[e.Big5=24]="Big5",e[e.GB18030=25]="GB18030",e[e.EUC_KR=26]="EUC_KR"}(I||(I={}));class E{constructor(e,t,n,...r){this.valueIdentifier=e,this.name=n,this.values="number"==typeof t?Int32Array.from([t]):t,this.otherEncodingNames=r,E.VALUE_IDENTIFIER_TO_ECI.set(e,this),E.NAME_TO_ECI.set(n,this);const i=this.values;for(let e=0,t=i.length;e!==t;e++){const t=i[e];E.VALUES_TO_ECI.set(t,this)}for(const e of r)E.NAME_TO_ECI.set(e,this)}getValueIdentifier(){return this.valueIdentifier}getName(){return this.name}getValue(){return this.values[0]}static getCharacterSetECIByValue(e){if(e<0||e>=900)throw new C("incorect value");const t=E.VALUES_TO_ECI.get(e);if(void 0===t)throw new C("incorect value");return t}static getCharacterSetECIByName(e){const t=E.NAME_TO_ECI.get(e);if(void 0===t)throw new C("incorect value");return t}equals(e){if(!(e instanceof E))return!1;const t=e;return this.getName()===t.getName()}}E.VALUE_IDENTIFIER_TO_ECI=new Map,E.VALUES_TO_ECI=new Map,E.NAME_TO_ECI=new Map,E.Cp437=new E(I.Cp437,Int32Array.from([0,2]),"Cp437"),E.ISO8859_1=new E(I.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),E.ISO8859_2=new E(I.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),E.ISO8859_3=new E(I.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),E.ISO8859_4=new E(I.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),E.ISO8859_5=new E(I.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),E.ISO8859_6=new E(I.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),E.ISO8859_7=new E(I.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),E.ISO8859_8=new E(I.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),E.ISO8859_9=new E(I.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),E.ISO8859_10=new E(I.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),E.ISO8859_11=new E(I.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),E.ISO8859_13=new E(I.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),E.ISO8859_14=new E(I.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),E.ISO8859_15=new E(I.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),E.ISO8859_16=new E(I.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),E.SJIS=new E(I.SJIS,20,"SJIS","Shift_JIS"),E.Cp1250=new E(I.Cp1250,21,"Cp1250","windows-1250"),E.Cp1251=new E(I.Cp1251,22,"Cp1251","windows-1251"),E.Cp1252=new E(I.Cp1252,23,"Cp1252","windows-1252"),E.Cp1256=new E(I.Cp1256,24,"Cp1256","windows-1256"),E.UnicodeBigUnmarked=new E(I.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),E.UTF8=new E(I.UTF8,26,"UTF8","UTF-8"),E.ASCII=new E(I.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),E.Big5=new E(I.Big5,28,"Big5"),E.GB18030=new E(I.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),E.EUC_KR=new E(I.EUC_KR,30,"EUC_KR","EUC-KR");class A extends l{}A.kind="UnsupportedOperationException";class ${static decode(e,t){const n=this.encodingName(t);return this.customDecoder?this.customDecoder(e,n):"undefined"==typeof TextDecoder||this.shouldDecodeOnFallback(n)?this.decodeFallback(e,n):new TextDecoder(n).decode(e)}static shouldDecodeOnFallback(e){return!$.isBrowser()&&"ISO-8859-1"===e}static encode(e,t){const n=this.encodingName(t);return this.customEncoder?this.customEncoder(e,n):"undefined"==typeof TextEncoder?this.encodeFallback(e):(new TextEncoder).encode(e)}static isBrowser(){return"undefined"!=typeof window&&"[object Window]"==={}.toString.call(window)}static encodingName(e){return"string"==typeof e?e:e.getName()}static encodingCharacterSet(e){return e instanceof E?e:E.getCharacterSetECIByName(e)}static decodeFallback(e,t){const n=this.encodingCharacterSet(t);if($.isDecodeFallbackSupported(n)){let t="";for(let n=0,r=e.length;n<r;n++){let r=e[n].toString(16);r.length<2&&(r="0"+r),t+="%"+r}return decodeURIComponent(t)}if(n.equals(E.UnicodeBigUnmarked))return String.fromCharCode.apply(null,new Uint16Array(e.buffer));throw new A(`Encoding ${this.encodingName(t)} not supported by fallback.`)}static isDecodeFallbackSupported(e){return e.equals(E.UTF8)||e.equals(E.ISO8859_1)||e.equals(E.ASCII)}static encodeFallback(e){const t=btoa(unescape(encodeURIComponent(e))).split(""),n=[];for(let e=0;e<t.length;e++)n.push(t[e].charCodeAt(0));return new Uint8Array(n)}}class b{static castAsNonUtf8Char(e,t=null){const n=t?t.getName():this.ISO88591;return $.decode(new Uint8Array([e]),n)}static guessEncoding(e,t){if(null!=t&&void 0!==t.get(_.CHARACTER_SET))return t.get(_.CHARACTER_SET).toString();const n=e.length;let r=!0,i=!0,o=!0,s=0,a=0,l=0,c=0,d=0,u=0,h=0,f=0,m=0,p=0,g=0;const w=e.length>3&&239===e[0]&&187===e[1]&&191===e[2];for(let t=0;t<n&&(r||i||o);t++){const n=255&e[t];o&&(s>0?128&n?s--:o=!1:128&n&&(64&n?(s++,32&n?(s++,16&n?(s++,8&n?o=!1:c++):l++):a++):o=!1)),r&&(n>127&&n<160?r=!1:n>159&&(n<192||215===n||247===n)&&g++),i&&(d>0?n<64||127===n||n>252?i=!1:d--:128===n||160===n||n>239?i=!1:n>160&&n<224?(u++,f=0,h++,h>m&&(m=h)):n>127?(d++,h=0,f++,f>p&&(p=f)):(h=0,f=0))}return o&&s>0&&(o=!1),i&&d>0&&(i=!1),o&&(w||a+l+c>0)?b.UTF8:i&&(b.ASSUME_SHIFT_JIS||m>=3||p>=3)?b.SHIFT_JIS:r&&i?2===m&&2===u||10*g>=n?b.SHIFT_JIS:b.ISO88591:r?b.ISO88591:i?b.SHIFT_JIS:o?b.UTF8:b.PLATFORM_DEFAULT_ENCODING}static format(e,...t){let n=-1;function r(e,r,i,o,s,a){if("%%"===e)return"%";if(void 0===t[++n])return;e=o?parseInt(o.substr(1)):void 0;let l,c=s?parseInt(s.substr(1)):void 0;switch(a){case"s":l=t[n];break;case"c":l=t[n][0];break;case"f":l=parseFloat(t[n]).toFixed(e);break;case"p":l=parseFloat(t[n]).toPrecision(e);break;case"e":l=parseFloat(t[n]).toExponential(e);break;case"x":l=parseInt(t[n]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[n],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let d=parseInt(i),u=i&&i[0]+""=="0"?"0":" ";for(;l.length<d;)l=void 0!==r?l+u:u+l;return l}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}static getBytes(e,t){return $.encode(e,t)}static getCharCode(e,t=0){return e.charCodeAt(t)}static getCharAt(e){return String.fromCharCode(e)}}b.SHIFT_JIS=E.SJIS.getName(),b.GB2312="GB2312",b.ISO88591=E.ISO8859_1.getName(),b.EUC_JP="EUC_JP",b.UTF8=E.UTF8.getName(),b.PLATFORM_DEFAULT_ENCODING=b.UTF8,b.ASSUME_SHIFT_JIS=!1;class S{constructor(e=""){this.value=e}enableDecoding(e){return this.encoding=e,this}append(e){return"string"==typeof e?this.value+=e.toString():this.encoding?this.value+=b.castAsNonUtf8Char(e,this.encoding):this.value+=String.fromCharCode(e),this}appendChars(e,t,n){for(let r=t;t<t+n;r++)this.append(e[r]);return this}length(){return this.value.length}charAt(e){return this.value.charAt(e)}deleteCharAt(e){this.value=this.value.substr(0,e)+this.value.substring(e+1)}setCharAt(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+1)}substring(e,t){return this.value.substring(e,t)}setLengthToZero(){this.value=""}toString(){return this.value}insert(e,t){this.value=this.value.substr(0,e)+t+this.value.substr(e+t.length)}}class T{constructor(e,t,n,r){if(this.width=e,this.height=t,this.rowSize=n,this.bits=r,null==t&&(t=e),this.height=t,e<1||t<1)throw new d("Both dimensions must be greater than 0");null==n&&(n=Math.floor((e+31)/32)),this.rowSize=n,null==r&&(this.bits=new Int32Array(this.rowSize*this.height))}static parseFromBooleanArray(e){const t=e.length,n=e[0].length,r=new T(n,t);for(let i=0;i<t;i++){const t=e[i];for(let e=0;e<n;e++)t[e]&&r.set(e,i)}return r}static parseFromString(e,t,n){if(null===e)throw new d("stringRepresentation cannot be null");const r=new Array(e.length);let i=0,o=0,s=-1,a=0,l=0;for(;l<e.length;)if("\n"===e.charAt(l)||"\r"===e.charAt(l)){if(i>o){if(-1===s)s=i-o;else if(i-o!==s)throw new d("row lengths do not match");o=i,a++}l++}else if(e.substring(l,l+t.length)===t)l+=t.length,r[i]=!0,i++;else{if(e.substring(l,l+n.length)!==n)throw new d("illegal character encountered: "+e.substring(l));l+=n.length,r[i]=!1,i++}if(i>o){if(-1===s)s=i-o;else if(i-o!==s)throw new d("row lengths do not match");a++}const c=new T(s,a);for(let e=0;e<i;e++)r[e]&&c.set(Math.floor(e%s),Math.floor(e/s));return c}get(e,t){const n=t*this.rowSize+Math.floor(e/32);return!!(this.bits[n]>>>(31&e)&1)}set(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]|=1<<(31&e)&4294967295}unset(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]&=~(1<<(31&e)&4294967295)}flip(e,t){const n=t*this.rowSize+Math.floor(e/32);this.bits[n]^=1<<(31&e)&4294967295}xor(e){if(this.width!==e.getWidth()||this.height!==e.getHeight()||this.rowSize!==e.getRowSize())throw new d("input matrix dimensions do not match");const t=new v(Math.floor(this.width/32)+1),n=this.rowSize,r=this.bits;for(let i=0,o=this.height;i<o;i++){const o=i*n,s=e.getRow(i,t).getBitArray();for(let e=0;e<n;e++)r[o+e]^=s[e]}}clear(){const e=this.bits,t=e.length;for(let n=0;n<t;n++)e[n]=0}setRegion(e,t,n,r){if(t<0||e<0)throw new d("Left and top must be nonnegative");if(r<1||n<1)throw new d("Height and width must be at least 1");const i=e+n,o=t+r;if(o>this.height||i>this.width)throw new d("The region must fit inside the matrix");const s=this.rowSize,a=this.bits;for(let n=t;n<o;n++){const t=n*s;for(let n=e;n<i;n++)a[t+Math.floor(n/32)]|=1<<(31&n)&4294967295}}getRow(e,t){null==t||t.getSize()<this.width?t=new v(this.width):t.clear();const n=this.rowSize,r=this.bits,i=e*n;for(let e=0;e<n;e++)t.setBulk(32*e,r[i+e]);return t}setRow(e,t){m.arraycopy(t.getBitArray(),0,this.bits,e*this.rowSize,this.rowSize)}rotate180(){const e=this.getWidth(),t=this.getHeight();let n=new v(e),r=new v(e);for(let e=0,i=Math.floor((t+1)/2);e<i;e++)n=this.getRow(e,n),r=this.getRow(t-1-e,r),n.reverse(),r.reverse(),this.setRow(e,r),this.setRow(t-1-e,n)}getEnclosingRectangle(){const e=this.width,t=this.height,n=this.rowSize,r=this.bits;let i=e,o=t,s=-1,a=-1;for(let e=0;e<t;e++)for(let t=0;t<n;t++){const l=r[e*n+t];if(0!==l){if(e<o&&(o=e),e>a&&(a=e),32*t<i){let e=0;for(;!(l<<31-e&4294967295);)e++;32*t+e<i&&(i=32*t+e)}if(32*t+31>s){let e=31;for(;l>>>e===0;)e--;32*t+e>s&&(s=32*t+e)}}}return s<i||a<o?null:Int32Array.from([i,o,s-i+1,a-o+1])}getTopLeftOnBit(){const e=this.rowSize,t=this.bits;let n=0;for(;n<t.length&&0===t[n];)n++;if(n===t.length)return null;const r=n/e;let i=n%e*32;const o=t[n];let s=0;for(;!(o<<31-s&4294967295);)s++;return i+=s,Int32Array.from([i,r])}getBottomRightOnBit(){const e=this.rowSize,t=this.bits;let n=t.length-1;for(;n>=0&&0===t[n];)n--;if(n<0)return null;const r=Math.floor(n/e);let i=32*Math.floor(n%e);const o=t[n];let s=31;for(;o>>>s===0;)s--;return i+=s,Int32Array.from([i,r])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(e){if(!(e instanceof T))return!1;const t=e;return this.width===t.width&&this.height===t.height&&this.rowSize===t.rowSize&&w.equals(this.bits,t.bits)}hashCode(){let e=this.width;return e=31*e+this.width,e=31*e+this.height,e=31*e+this.rowSize,e=31*e+w.hashCode(this.bits),e}toString(e="X ",t=" ",n="\n"){return this.buildToString(e,t,n)}buildToString(e,t,n){let r=new S;for(let i=0,o=this.height;i<o;i++){for(let n=0,o=this.width;n<o;n++)r.append(this.get(n,i)?e:t);r.append(n)}return r.toString()}clone(){return new T(this.width,this.height,this.rowSize,this.bits.slice())}}class N extends l{static getNotFoundInstance(){return new N}}N.kind="NotFoundException";class R extends f{constructor(e){super(e),this.luminances=R.EMPTY,this.buckets=new Int32Array(R.LUMINANCE_BUCKETS)}getBlackRow(e,t){const n=this.getLuminanceSource(),r=n.getWidth();null==t||t.getSize()<r?t=new v(r):t.clear(),this.initArrays(r);const i=n.getRow(e,this.luminances),o=this.buckets;for(let e=0;e<r;e++)o[(255&i[e])>>R.LUMINANCE_SHIFT]++;const s=R.estimateBlackPoint(o);if(r<3)for(let e=0;e<r;e++)(255&i[e])<s&&t.set(e);else{let e=255&i[0],n=255&i[1];for(let o=1;o<r-1;o++){const r=255&i[o+1];(4*n-e-r)/2<s&&t.set(o),e=n,n=r}}return t}getBlackMatrix(){const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight(),r=new T(t,n);this.initArrays(t);const i=this.buckets;for(let r=1;r<5;r++){const o=Math.floor(n*r/5),s=e.getRow(o,this.luminances),a=Math.floor(4*t/5);for(let e=Math.floor(t/5);e<a;e++)i[(255&s[e])>>R.LUMINANCE_SHIFT]++}const o=R.estimateBlackPoint(i),s=e.getMatrix();for(let e=0;e<n;e++){const n=e*t;for(let i=0;i<t;i++)(255&s[n+i])<o&&r.set(i,e)}return r}createBinarizer(e){return new R(e)}initArrays(e){this.luminances.length<e&&(this.luminances=new Uint8ClampedArray(e));const t=this.buckets;for(let e=0;e<R.LUMINANCE_BUCKETS;e++)t[e]=0}static estimateBlackPoint(e){const t=e.length;let n=0,r=0,i=0;for(let o=0;o<t;o++)e[o]>i&&(r=o,i=e[o]),e[o]>n&&(n=e[o]);let o=0,s=0;for(let n=0;n<t;n++){const t=n-r,i=e[n]*t*t;i>s&&(o=n,s=i)}if(r>o){const e=r;r=o,o=e}if(o-r<=t/16)throw new N;let a=o-1,l=-1;for(let t=o-1;t>r;t--){const i=t-r,s=i*i*(o-t)*(n-e[t]);s>l&&(a=t,l=s)}return a<<R.LUMINANCE_SHIFT}}R.LUMINANCE_BITS=5,R.LUMINANCE_SHIFT=8-R.LUMINANCE_BITS,R.LUMINANCE_BUCKETS=1<<R.LUMINANCE_BITS,R.EMPTY=Uint8ClampedArray.from([0]);class D extends R{constructor(e){super(e),this.matrix=null}getBlackMatrix(){if(null!==this.matrix)return this.matrix;const e=this.getLuminanceSource(),t=e.getWidth(),n=e.getHeight();if(t>=D.MINIMUM_DIMENSION&&n>=D.MINIMUM_DIMENSION){const r=e.getMatrix();let i=t>>D.BLOCK_SIZE_POWER;0!==(t&D.BLOCK_SIZE_MASK)&&i++;let o=n>>D.BLOCK_SIZE_POWER;0!==(n&D.BLOCK_SIZE_MASK)&&o++;const s=D.calculateBlackPoints(r,i,o,t,n),a=new T(t,n);D.calculateThresholdForBlock(r,i,o,t,n,s,a),this.matrix=a}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(e){return new D(e)}static calculateThresholdForBlock(e,t,n,r,i,o,s){const a=i-D.BLOCK_SIZE,l=r-D.BLOCK_SIZE;for(let i=0;i<n;i++){let c=i<<D.BLOCK_SIZE_POWER;c>a&&(c=a);const d=D.cap(i,2,n-3);for(let n=0;n<t;n++){let i=n<<D.BLOCK_SIZE_POWER;i>l&&(i=l);const a=D.cap(n,2,t-3);let u=0;for(let e=-2;e<=2;e++){const t=o[d+e];u+=t[a-2]+t[a-1]+t[a]+t[a+1]+t[a+2]}const h=u/25;D.thresholdBlock(e,i,c,h,r,s)}}}static cap(e,t,n){return e<t?t:e>n?n:e}static thresholdBlock(e,t,n,r,i,o){for(let s=0,a=n*i+t;s<D.BLOCK_SIZE;s++,a+=i)for(let i=0;i<D.BLOCK_SIZE;i++)(255&e[a+i])<=r&&o.set(t+i,n+s)}static calculateBlackPoints(e,t,n,r,i){const o=i-D.BLOCK_SIZE,s=r-D.BLOCK_SIZE,a=new Array(n);for(let i=0;i<n;i++){a[i]=new Int32Array(t);let n=i<<D.BLOCK_SIZE_POWER;n>o&&(n=o);for(let o=0;o<t;o++){let t=o<<D.BLOCK_SIZE_POWER;t>s&&(t=s);let l=0,c=255,d=0;for(let i=0,o=n*r+t;i<D.BLOCK_SIZE;i++,o+=r){for(let t=0;t<D.BLOCK_SIZE;t++){const n=255&e[o+t];l+=n,n<c&&(c=n),n>d&&(d=n)}if(d-c>D.MIN_DYNAMIC_RANGE)for(i++,o+=r;i<D.BLOCK_SIZE;i++,o+=r)for(let t=0;t<D.BLOCK_SIZE;t++)l+=255&e[o+t]}let u=l>>2*D.BLOCK_SIZE_POWER;if(d-c<=D.MIN_DYNAMIC_RANGE&&(u=c/2,i>0&&o>0)){const e=(a[i-1][o]+2*a[i][o-1]+a[i-1][o-1])/4;c<e&&(u=e)}a[i][o]=u}}return a}}D.BLOCK_SIZE_POWER=3,D.BLOCK_SIZE=1<<D.BLOCK_SIZE_POWER,D.BLOCK_SIZE_MASK=D.BLOCK_SIZE-1,D.MINIMUM_DIMENSION=5*D.BLOCK_SIZE,D.MIN_DYNAMIC_RANGE=24;class x{constructor(e,t){this.width=e,this.height=t}getWidth(){return this.width}getHeight(){return this.height}isCropSupported(){return!1}crop(e,t,n,r){throw new A("This luminance source does not support cropping.")}isRotateSupported(){return!1}rotateCounterClockwise(){throw new A("This luminance source does not support rotation by 90 degrees.")}rotateCounterClockwise45(){throw new A("This luminance source does not support rotation by 45 degrees.")}toString(){const e=new Uint8ClampedArray(this.width);let t=new S;for(let n=0;n<this.height;n++){const r=this.getRow(n,e);for(let e=0;e<this.width;e++){const n=255&r[e];let i;i=n<64?"#":n<128?"+":n<192?".":" ",t.append(i)}t.append("\n")}return t.toString()}}class O extends x{constructor(e){super(e.getWidth(),e.getHeight()),this.delegate=e}getRow(e,t){const n=this.delegate.getRow(e,t),r=this.getWidth();for(let e=0;e<r;e++)n[e]=255-(255&n[e]);return n}getMatrix(){const e=this.delegate.getMatrix(),t=this.getWidth()*this.getHeight(),n=new Uint8ClampedArray(t);for(let r=0;r<t;r++)n[r]=255-(255&e[r]);return n}isCropSupported(){return this.delegate.isCropSupported()}crop(e,t,n,r){return new O(this.delegate.crop(e,t,n,r))}isRotateSupported(){return this.delegate.isRotateSupported()}invert(){return this.delegate}rotateCounterClockwise(){return new O(this.delegate.rotateCounterClockwise())}rotateCounterClockwise45(){return new O(this.delegate.rotateCounterClockwise45())}}class k extends x{constructor(e){super(e.width,e.height),this.canvas=e,this.tempCanvasElement=null,this.buffer=k.makeBufferFromCanvasImageData(e)}static makeBufferFromCanvasImageData(e){const t=e.getContext("2d").getImageData(0,0,e.width,e.height);return k.toGrayscaleBuffer(t.data,e.width,e.height)}static toGrayscaleBuffer(e,t,n){const r=new Uint8ClampedArray(t*n);for(let t=0,n=0,i=e.length;t<i;t+=4,n++){let i;i=0===e[t+3]?255:306*e[t]+601*e[t+1]+117*e[t+2]+512>>10,r[n]=i}return r}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth(),r=e*n;return null===t?t=this.buffer.slice(r,r+n):(t.length<n&&(t=new Uint8ClampedArray(n)),t.set(this.buffer.slice(r,r+n))),t}getMatrix(){return this.buffer}isCropSupported(){return!0}crop(e,t,n,r){return super.crop(e,t,n,r),this}isRotateSupported(){return!0}rotateCounterClockwise(){return this.rotate(-90),this}rotateCounterClockwise45(){return this.rotate(-45),this}getTempCanvasElement(){if(null===this.tempCanvasElement){const e=this.canvas.ownerDocument.createElement("canvas");e.width=this.canvas.width,e.height=this.canvas.height,this.tempCanvasElement=e}return this.tempCanvasElement}rotate(e){const t=this.getTempCanvasElement(),n=t.getContext("2d"),r=e*k.DEGREE_TO_RADIANS,i=this.canvas.width,o=this.canvas.height,s=Math.ceil(Math.abs(Math.cos(r))*i+Math.abs(Math.sin(r))*o),a=Math.ceil(Math.abs(Math.sin(r))*i+Math.abs(Math.cos(r))*o);return t.width=s,t.height=a,n.translate(s/2,a/2),n.rotate(r),n.drawImage(this.canvas,i/-2,o/-2),this.buffer=k.makeBufferFromCanvasImageData(t),this}invert(){return new O(this)}}k.DEGREE_TO_RADIANS=Math.PI/180;class M{constructor(e,t,n){this.deviceId=e,this.label=t,this.kind="videoinput",this.groupId=n||void 0}toJSON(){return{kind:this.kind,groupId:this.groupId,deviceId:this.deviceId,label:this.label}}}var P,B=(globalThis||ru||self||window?(globalThis||ru||self||window||void 0).__awaiter:void 0)||function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){e.done?n(e.value):i(e.value).then(s,a)}l((r=r.apply(e,t||[])).next())})};class L{constructor(e,t=500,n){this.reader=e,this.timeBetweenScansMillis=t,this._hints=n,this._stopContinuousDecode=!1,this._stopAsyncDecode=!1,this._timeBetweenDecodingAttempts=0}get hasNavigator(){return"undefined"!=typeof navigator}get isMediaDevicesSuported(){return this.hasNavigator&&!!navigator.mediaDevices}get canEnumerateDevices(){return!(!this.isMediaDevicesSuported||!navigator.mediaDevices.enumerateDevices)}get timeBetweenDecodingAttempts(){return this._timeBetweenDecodingAttempts}set timeBetweenDecodingAttempts(e){this._timeBetweenDecodingAttempts=e<0?0:e}set hints(e){this._hints=e||null}get hints(){return this._hints}listVideoInputDevices(){return B(this,void 0,void 0,function*(){if(!this.hasNavigator)throw new Error("Can't enumerate devices, navigator is not present.");if(!this.canEnumerateDevices)throw new Error("Can't enumerate devices, method not supported.");const e=yield navigator.mediaDevices.enumerateDevices(),t=[];for(const n of e){const e="video"===n.kind?"videoinput":n.kind;if("videoinput"!==e)continue;const r={deviceId:n.deviceId||n.id,label:n.label||`Video device ${t.length+1}`,kind:e,groupId:n.groupId};t.push(r)}return t})}getVideoInputDevices(){return B(this,void 0,void 0,function*(){return(yield this.listVideoInputDevices()).map(e=>new M(e.deviceId,e.label))})}findDeviceById(e){return B(this,void 0,void 0,function*(){const t=yield this.listVideoInputDevices();return t?t.find(t=>t.deviceId===e):null})}decodeFromInputVideoDevice(e,t){return B(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(e,t)})}decodeOnceFromVideoDevice(e,t){return B(this,void 0,void 0,function*(){let n;this.reset(),n=e?{deviceId:{exact:e}}:{facingMode:"environment"};const r={video:n};return yield this.decodeOnceFromConstraints(r,t)})}decodeOnceFromConstraints(e,t){return B(this,void 0,void 0,function*(){const n=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeOnceFromStream(n,t)})}decodeOnceFromStream(e,t){return B(this,void 0,void 0,function*(){this.reset();const n=yield this.attachStreamToVideo(e,t);return yield this.decodeOnce(n)})}decodeFromInputVideoDeviceContinuously(e,t,n){return B(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(e,t,n)})}decodeFromVideoDevice(e,t,n){return B(this,void 0,void 0,function*(){let r;r=e?{deviceId:{exact:e}}:{facingMode:"environment"};const i={video:r};return yield this.decodeFromConstraints(i,t,n)})}decodeFromConstraints(e,t,n){return B(this,void 0,void 0,function*(){const r=yield navigator.mediaDevices.getUserMedia(e);return yield this.decodeFromStream(r,t,n)})}decodeFromStream(e,t,n){return B(this,void 0,void 0,function*(){this.reset();const r=yield this.attachStreamToVideo(e,t);return yield this.decodeContinuously(r,n)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(e,t){return B(this,void 0,void 0,function*(){const n=this.prepareVideoElement(t);return this.addVideoSource(n,e),this.videoElement=n,this.stream=e,yield this.playVideoOnLoadAsync(n),n})}playVideoOnLoadAsync(e){return new Promise((t,n)=>this.playVideoOnLoad(e,()=>t()))}playVideoOnLoad(e,t){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(e),e.addEventListener("ended",this.videoEndedListener),e.addEventListener("canplay",this.videoCanPlayListener),e.addEventListener("playing",t),this.tryPlayVideo(e)}isVideoPlaying(e){return e.currentTime>0&&!e.paused&&!e.ended&&e.readyState>2}tryPlayVideo(e){return B(this,void 0,void 0,function*(){if(this.isVideoPlaying(e))console.warn("Trying to play video that is already playing.");else try{yield e.play()}catch(e){console.warn("It was not possible to play the video.")}})}getMediaElement(e,t){const n=document.getElementById(e);if(!n)throw new c(`element with id '${e}' not found`);if(n.nodeName.toLowerCase()!==t.toLowerCase())throw new c(`element with id '${e}' must be an ${t} element`);return n}decodeFromImage(e,t){if(!e&&!t)throw new c("either imageElement with a src set or an url must be provided");return t&&!e?this.decodeFromImageUrl(t):this.decodeFromImageElement(e)}decodeFromVideo(e,t){if(!e&&!t)throw new c("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrl(t):this.decodeFromVideoElement(e)}decodeFromVideoContinuously(e,t,n){if(void 0===e&&void 0===t)throw new c("Either an element with a src set or an URL must be provided");return t&&!e?this.decodeFromVideoUrlContinuously(t,n):this.decodeFromVideoElementContinuously(e,n)}decodeFromImageElement(e){if(!e)throw new c("An image element must be provided.");this.reset();const t=this.prepareImageElement(e);let n;return this.imageElement=t,n=this.isImageLoaded(t)?this.decodeOnce(t,!1,!0):this._decodeOnLoadImage(t),n}decodeFromVideoElement(e){const t=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideo(t)}decodeFromVideoElementContinuously(e,t){const n=this._decodeFromVideoElementSetup(e);return this._decodeOnLoadVideoContinuously(n,t)}_decodeFromVideoElementSetup(e){if(!e)throw new c("A video element must be provided.");this.reset();const t=this.prepareVideoElement(e);return this.videoElement=t,t}decodeFromImageUrl(e){if(!e)throw new c("An URL must be provided.");this.reset();const t=this.prepareImageElement();this.imageElement=t;const n=this._decodeOnLoadImage(t);return t.src=e,n}decodeFromVideoUrl(e){if(!e)throw new c("An URL must be provided.");this.reset();const t=this.prepareVideoElement(),n=this.decodeFromVideoElement(t);return t.src=e,n}decodeFromVideoUrlContinuously(e,t){if(!e)throw new c("An URL must be provided.");this.reset();const n=this.prepareVideoElement(),r=this.decodeFromVideoElementContinuously(n,t);return n.src=e,r}_decodeOnLoadImage(e){return new Promise((t,n)=>{this.imageLoadedListener=()=>this.decodeOnce(e,!1,!0).then(t,n),e.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(e){return B(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(e),yield this.decodeOnce(e)})}_decodeOnLoadVideoContinuously(e,t){return B(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(e),this.decodeContinuously(e,t)})}isImageLoaded(e){return!!e.complete&&0!==e.naturalWidth}prepareImageElement(e){let t;return void 0===e&&(t=document.createElement("img"),t.width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"img")),e instanceof HTMLImageElement&&(t=e),t}prepareVideoElement(e){let t;return e||"undefined"==typeof document||(t=document.createElement("video"),t.width=200,t.height=200),"string"==typeof e&&(t=this.getMediaElement(e,"video")),e instanceof HTMLVideoElement&&(t=e),t.setAttribute("autoplay","true"),t.setAttribute("muted","true"),t.setAttribute("playsinline","true"),t}decodeOnce(e,t=!0,n=!0){this._stopAsyncDecode=!1;const r=(i,o)=>{if(this._stopAsyncDecode)return o(new N("Video stream has ended before any code could be detected.")),void(this._stopAsyncDecode=void 0);try{i(this.decode(e))}catch(e){if(t&&e instanceof N||(e instanceof h||e instanceof C)&&n)return setTimeout(r,this._timeBetweenDecodingAttempts,i,o);o(e)}};return new Promise((e,t)=>r(e,t))}decodeContinuously(e,t){this._stopContinuousDecode=!1;const n=()=>{if(this._stopContinuousDecode)this._stopContinuousDecode=void 0;else try{const r=this.decode(e);t(r,null),setTimeout(n,this.timeBetweenScansMillis)}catch(e){t(null,e),(e instanceof h||e instanceof C||e instanceof N)&&setTimeout(n,this._timeBetweenDecodingAttempts)}};n()}decode(e){const t=this.createBinaryBitmap(e);return this.decodeBitmap(t)}_isHTMLVideoElement(e){return 0!==e.videoWidth}drawFrameOnCanvas(e,t,n){t||(t={sx:0,sy:0,sWidth:e.videoWidth,sHeight:e.videoHeight,dx:0,dy:0,dWidth:e.videoWidth,dHeight:e.videoHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}drawImageOnCanvas(e,t,n=this.captureCanvasContext){t||(t={sx:0,sy:0,sWidth:e.naturalWidth,sHeight:e.naturalHeight,dx:0,dy:0,dWidth:e.naturalWidth,dHeight:e.naturalHeight}),n||(n=this.captureCanvasContext),n.drawImage(e,t.sx,t.sy,t.sWidth,t.sHeight,t.dx,t.dy,t.dWidth,t.dHeight)}createBinaryBitmap(e){this.getCaptureCanvasContext(e),this._isHTMLVideoElement(e)?this.drawFrameOnCanvas(e):this.drawImageOnCanvas(e);const t=this.getCaptureCanvas(e),n=new k(t),r=new D(n);return new u(r)}getCaptureCanvasContext(e){if(!this.captureCanvasContext){const t=this.getCaptureCanvas(e).getContext("2d");this.captureCanvasContext=t}return this.captureCanvasContext}getCaptureCanvas(e){if(!this.captureCanvas){const t=this.createCaptureCanvas(e);this.captureCanvas=t}return this.captureCanvas}decodeBitmap(e){return this.reader.decode(e,this._hints)}createCaptureCanvas(e){if("undefined"==typeof document)return this._destroyCaptureCanvas(),null;const t=document.createElement("canvas");let n,r;return void 0!==e&&(e instanceof HTMLVideoElement?(n=e.videoWidth,r=e.videoHeight):e instanceof HTMLImageElement&&(n=e.naturalWidth||e.width,r=e.naturalHeight||e.height)),t.style.width=n+"px",t.style.height=r+"px",t.width=n,t.height=r,t}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(e=>e.stop()),this.stream=void 0),!1===this._stopAsyncDecode&&this.stopAsyncDecode(),!1===this._stopContinuousDecode&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(void 0!==this.videoEndedListener&&this.videoElement.removeEventListener("ended",this.videoEndedListener),void 0!==this.videoPlayingEventListener&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),void 0!==this.videoCanPlayListener&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(void 0!==this.imageLoadedListener&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(e,t){try{e.srcObject=t}catch(n){e.src=URL.createObjectURL(t)}}cleanVideoSource(e){try{e.srcObject=null}catch(t){e.src=""}this.videoElement.removeAttribute("src")}}class F{constructor(e,t,n=(null==t?0:8*t.length),r,i,o=m.currentTimeMillis()){this.text=e,this.rawBytes=t,this.numBits=n,this.resultPoints=r,this.format=i,this.timestamp=o,this.text=e,this.rawBytes=t,this.numBits=null==n?null==t?0:8*t.length:n,this.resultPoints=r,this.format=i,this.resultMetadata=null,this.timestamp=null==o?m.currentTimeMillis():o}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(e,t){null===this.resultMetadata&&(this.resultMetadata=new Map),this.resultMetadata.set(e,t)}putAllMetadata(e){null!==e&&(null===this.resultMetadata?this.resultMetadata=e:this.resultMetadata=new Map(e))}addResultPoints(e){const t=this.resultPoints;if(null===t)this.resultPoints=e;else if(null!==e&&e.length>0){const n=new Array(t.length+e.length);m.arraycopy(t,0,n,0,t.length),m.arraycopy(e,0,n,t.length,e.length),this.resultPoints=n}}getTimestamp(){return this.timestamp}toString(){return this.text}}!function(e){e[e.AZTEC=0]="AZTEC",e[e.CODABAR=1]="CODABAR",e[e.CODE_39=2]="CODE_39",e[e.CODE_93=3]="CODE_93",e[e.CODE_128=4]="CODE_128",e[e.DATA_MATRIX=5]="DATA_MATRIX",e[e.EAN_8=6]="EAN_8",e[e.EAN_13=7]="EAN_13",e[e.ITF=8]="ITF",e[e.MAXICODE=9]="MAXICODE",e[e.PDF_417=10]="PDF_417",e[e.QR_CODE=11]="QR_CODE",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"}(P||(P={}));var V,U=P;!function(e){e[e.OTHER=0]="OTHER",e[e.ORIENTATION=1]="ORIENTATION",e[e.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",e[e.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",e[e.ISSUE_NUMBER=4]="ISSUE_NUMBER",e[e.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",e[e.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",e[e.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",e[e.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",e[e.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",e[e.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"}(V||(V={}));var H,W,z,j,q,G,X=V;class Y{constructor(e,t,n,r,i=-1,o=-1){this.rawBytes=e,this.text=t,this.byteSegments=n,this.ecLevel=r,this.structuredAppendSequenceNumber=i,this.structuredAppendParity=o,this.numBits=null==e?0:8*e.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(e){this.numBits=e}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(e){this.errorsCorrected=e}getErasures(){return this.erasures}setErasures(e){this.erasures=e}getOther(){return this.other}setOther(e){this.other=e}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class Z{exp(e){return this.expTable[e]}log(e){if(0===e)throw new d;return this.logTable[e]}static addOrSubtract(e,t){return e^t}}class K{constructor(e,t){if(0===t.length)throw new d;this.field=e;const n=t.length;if(n>1&&0===t[0]){let e=1;for(;e<n&&0===t[e];)e++;e===n?this.coefficients=Int32Array.from([0]):(this.coefficients=new Int32Array(n-e),m.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);const t=this.coefficients;let n;if(1===e){n=0;for(let e=0,r=t.length;e!==r;e++){const r=t[e];n=Z.addOrSubtract(n,r)}return n}n=t[0];const r=t.length,i=this.field;for(let o=1;o<r;o++)n=Z.addOrSubtract(i.multiply(e,n),t[o]);return n}addOrSubtract(e){if(!this.field.equals(e.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){const e=t;t=n,n=e}let r=new Int32Array(n.length);const i=n.length-t.length;m.arraycopy(n,0,r,0,i);for(let e=i;e<n.length;e++)r[e]=Z.addOrSubtract(t[e-i],n[e]);return new K(this.field,r)}multiply(e){if(!this.field.equals(e.field))throw new d("GenericGFPolys do not have same GenericGF field");if(this.isZero()||e.isZero())return this.field.getZero();const t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,o=new Int32Array(n+i-1),s=this.field;for(let e=0;e<n;e++){const n=t[e];for(let t=0;t<i;t++)o[e+t]=Z.addOrSubtract(o[e+t],s.multiply(n,r[t]))}return new K(s,o)}multiplyScalar(e){if(0===e)return this.field.getZero();if(1===e)return this;const t=this.coefficients.length,n=this.field,r=new Int32Array(t),i=this.coefficients;for(let o=0;o<t;o++)r[o]=n.multiply(i[o],e);return new K(n,r)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return this.field.getZero();const n=this.coefficients,r=n.length,i=new Int32Array(r+e),o=this.field;for(let e=0;e<r;e++)i[e]=o.multiply(n[e],t);return new K(o,i)}divide(e){if(!this.field.equals(e.field))throw new d("GenericGFPolys do not have same GenericGF field");if(e.isZero())throw new d("Divide by 0");const t=this.field;let n=t.getZero(),r=this;const i=e.getCoefficient(e.getDegree()),o=t.inverse(i);for(;r.getDegree()>=e.getDegree()&&!r.isZero();){const i=r.getDegree()-e.getDegree(),s=t.multiply(r.getCoefficient(r.getDegree()),o),a=e.multiplyByMonomial(i,s),l=t.buildMonomial(i,s);n=n.addOrSubtract(l),r=r.addOrSubtract(a)}return[n,r]}toString(){let e="";for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);if(0!==n){if(n<0?(e+=" - ",n=-n):e.length>0&&(e+=" + "),0===t||1!==n){const t=this.field.log(n);0===t?e+="1":1===t?e+="a":(e+="a^",e+=t)}0!==t&&(1===t?e+="x":(e+="x^",e+=t))}}return e}}class Q extends l{}Q.kind="ArithmeticException";class J extends Z{constructor(e,t,n){super(),this.primitive=e,this.size=t,this.generatorBase=n;const r=new Int32Array(t);let i=1;for(let n=0;n<t;n++)r[n]=i,i*=2,i>=t&&(i^=e,i&=t-1);this.expTable=r;const o=new Int32Array(t);for(let e=0;e<t-1;e++)o[r[e]]=e;this.logTable=o,this.zero=new K(this,Int32Array.from([0])),this.one=new K(this,Int32Array.from([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;const n=new Int32Array(e+1);return n[0]=t,new K(this,n)}inverse(e){if(0===e)throw new Q;return this.expTable[this.size-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.size-1)]}getSize(){return this.size}getGeneratorBase(){return this.generatorBase}toString(){return"GF(0x"+y.toHexString(this.primitive)+","+this.size+")"}equals(e){return e===this}}J.AZTEC_DATA_12=new J(4201,4096,1),J.AZTEC_DATA_10=new J(1033,1024,1),J.AZTEC_DATA_6=new J(67,64,1),J.AZTEC_PARAM=new J(19,16,1),J.QR_CODE_FIELD_256=new J(285,256,0),J.DATA_MATRIX_FIELD_256=new J(301,256,1),J.AZTEC_DATA_8=J.DATA_MATRIX_FIELD_256,J.MAXICODE_FIELD_64=J.AZTEC_DATA_6;class ee extends l{}ee.kind="ReedSolomonException";class te extends l{}te.kind="IllegalStateException";class ne{constructor(e){this.field=e}decode(e,t){const n=this.field,r=new K(n,e),i=new Int32Array(t);let o=!0;for(let e=0;e<t;e++){const t=r.evaluateAt(n.exp(e+n.getGeneratorBase()));i[i.length-1-e]=t,0!==t&&(o=!1)}if(o)return;const s=new K(n,i),a=this.runEuclideanAlgorithm(n.buildMonomial(t,1),s,t),l=a[0],c=a[1],d=this.findErrorLocations(l),u=this.findErrorMagnitudes(c,d);for(let t=0;t<d.length;t++){const r=e.length-1-n.log(d[t]);if(r<0)throw new ee("Bad error location");e[r]=J.addOrSubtract(e[r],u[t])}}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){const n=e;e=t,t=n}const r=this.field;let i=e,o=t,s=r.getZero(),a=r.getOne();for(;o.getDegree()>=(n/2|0);){let e=i,t=s;if(i=o,s=a,i.isZero())throw new ee("r_{i-1} was zero");o=e;let n=r.getZero();const l=i.getCoefficient(i.getDegree()),c=r.inverse(l);for(;o.getDegree()>=i.getDegree()&&!o.isZero();){const e=o.getDegree()-i.getDegree(),t=r.multiply(o.getCoefficient(o.getDegree()),c);n=n.addOrSubtract(r.buildMonomial(e,t)),o=o.addOrSubtract(i.multiplyByMonomial(e,t))}if(a=n.multiply(s).addOrSubtract(t),o.getDegree()>=i.getDegree())throw new te("Division algorithm failed to reduce polynomial?")}const l=a.getCoefficient(0);if(0===l)throw new ee("sigmaTilde(0) was zero");const c=r.inverse(l);return[a.multiplyScalar(c),o.multiplyScalar(c)]}findErrorLocations(e){const t=e.getDegree();if(1===t)return Int32Array.from([e.getCoefficient(1)]);const n=new Int32Array(t);let r=0;const i=this.field;for(let o=1;o<i.getSize()&&r<t;o++)0===e.evaluateAt(o)&&(n[r]=i.inverse(o),r++);if(r!==t)throw new ee("Error locator degree does not match number of roots");return n}findErrorMagnitudes(e,t){const n=t.length,r=new Int32Array(n),i=this.field;for(let o=0;o<n;o++){const s=i.inverse(t[o]);let a=1;for(let e=0;e<n;e++)if(o!==e){const n=i.multiply(t[e],s),r=1&n?-2&n:1|n;a=i.multiply(a,r)}r[o]=i.multiply(e.evaluateAt(s),i.inverse(a)),0!==i.getGeneratorBase()&&(r[o]=i.multiply(r[o],s))}return r}}!function(e){e[e.UPPER=0]="UPPER",e[e.LOWER=1]="LOWER",e[e.MIXED=2]="MIXED",e[e.DIGIT=3]="DIGIT",e[e.PUNCT=4]="PUNCT",e[e.BINARY=5]="BINARY"}(H||(H={}));class re{decode(e){this.ddata=e;let t=e.getBits(),n=this.extractBits(t),r=this.correctBits(n),i=re.convertBoolArrayToByteArray(r),o=re.getEncodedData(r),s=new Y(i,o,null,null);return s.setNumBits(r.length),s}static highLevelDecode(e){return this.getEncodedData(e)}static getEncodedData(e){let t=e.length,n=H.UPPER,r=H.UPPER,i="",o=0;for(;o<t;)if(r===H.BINARY){if(t-o<5)break;let s=re.readCode(e,o,5);if(o+=5,0===s){if(t-o<11)break;s=re.readCode(e,o,11)+31,o+=11}for(let n=0;n<s;n++){if(t-o<8){o=t;break}const n=re.readCode(e,o,8);i+=b.castAsNonUtf8Char(n),o+=8}r=n}else{let s=r===H.DIGIT?4:5;if(t-o<s)break;let a=re.readCode(e,o,s);o+=s;let l=re.getCharacter(r,a);l.startsWith("CTRL_")?(n=r,r=re.getTable(l.charAt(5)),"L"===l.charAt(6)&&(n=r)):(i+=l,r=n)}return i}static getTable(e){switch(e){case"L":return H.LOWER;case"P":return H.PUNCT;case"M":return H.MIXED;case"D":return H.DIGIT;case"B":return H.BINARY;default:return H.UPPER}}static getCharacter(e,t){switch(e){case H.UPPER:return re.UPPER_TABLE[t];case H.LOWER:return re.LOWER_TABLE[t];case H.MIXED:return re.MIXED_TABLE[t];case H.PUNCT:return re.PUNCT_TABLE[t];case H.DIGIT:return re.DIGIT_TABLE[t];default:throw new te("Bad table")}}correctBits(e){let t,n;this.ddata.getNbLayers()<=2?(n=6,t=J.AZTEC_DATA_6):this.ddata.getNbLayers()<=8?(n=8,t=J.AZTEC_DATA_8):this.ddata.getNbLayers()<=22?(n=10,t=J.AZTEC_DATA_10):(n=12,t=J.AZTEC_DATA_12);let r=this.ddata.getNbDatablocks(),i=e.length/n;if(i<r)throw new C;let o=e.length%n,s=new Int32Array(i);for(let t=0;t<i;t++,o+=n)s[t]=re.readCode(e,o,n);try{new ne(t).decode(s,i-r)}catch(e){throw new C(e)}let a=(1<<n)-1,l=0;for(let e=0;e<r;e++){let t=s[e];if(0===t||t===a)throw new C;1!==t&&t!==a-1||l++}let c=new Array(r*n-l),d=0;for(let e=0;e<r;e++){let t=s[e];if(1===t||t===a-1)c.fill(t>1,d,d+n-1),d+=n-1;else for(let e=n-1;e>=0;--e)c[d++]=!!(t&1<<e)}return c}extractBits(e){let t=this.ddata.isCompact(),n=this.ddata.getNbLayers(),r=(t?11:14)+4*n,i=new Int32Array(r),o=new Array(this.totalBitsInLayer(n,t));if(t)for(let e=0;e<i.length;e++)i[e]=e;else{let e=r+1+2*y.truncDivision(y.truncDivision(r,2)-1,15),t=r/2,n=y.truncDivision(e,2);for(let e=0;e<t;e++){let r=e+y.truncDivision(e,15);i[t-e-1]=n-r-1,i[t+e]=n+r+1}}for(let s=0,a=0;s<n;s++){let l=4*(n-s)+(t?9:12),c=2*s,d=r-1-c;for(let t=0;t<l;t++){let n=2*t;for(let r=0;r<2;r++)o[a+n+r]=e.get(i[c+r],i[c+t]),o[a+2*l+n+r]=e.get(i[c+t],i[d-r]),o[a+4*l+n+r]=e.get(i[d-r],i[d-t]),o[a+6*l+n+r]=e.get(i[d-t],i[c+r])}a+=8*l}return o}static readCode(e,t,n){let r=0;for(let i=t;i<t+n;i++)r<<=1,e[i]&&(r|=1);return r}static readByte(e,t){let n=e.length-t;return n>=8?re.readCode(e,t,8):re.readCode(e,t,n)<<8-n}static convertBoolArrayToByteArray(e){let t=new Uint8Array((e.length+7)/8);for(let n=0;n<t.length;n++)t[n]=re.readByte(e,8*n);return t}totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}re.UPPER_TABLE=["CTRL_PS"," ","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CTRL_LL","CTRL_ML","CTRL_DL","CTRL_BS"],re.LOWER_TABLE=["CTRL_PS"," ","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","CTRL_US","CTRL_ML","CTRL_DL","CTRL_BS"],re.MIXED_TABLE=["CTRL_PS"," ","\\1","\\2","\\3","\\4","\\5","\\6","\\7","\b","\t","\n","\\13","\f","\r","\\33","\\34","\\35","\\36","\\37","@","\\","^","_","`","|","~","\\177","CTRL_LL","CTRL_UL","CTRL_PL","CTRL_BS"],re.PUNCT_TABLE=["","\r","\r\n",". ",", ",": ","!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}","CTRL_UL"],re.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class ie{constructor(){}static round(e){return NaN===e?0:e<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:e>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:e+(e<0?-.5:.5)|0}static distance(e,t,n,r){const i=e-n,o=t-r;return Math.sqrt(i*i+o*o)}static sum(e){let t=0;for(let n=0,r=e.length;n!==r;n++)t+=e[n];return t}}class oe{static floatToIntBits(e){return e}}oe.MAX_VALUE=Number.MAX_SAFE_INTEGER;class se{constructor(e,t){this.x=e,this.y=t}getX(){return this.x}getY(){return this.y}equals(e){if(e instanceof se){const t=e;return this.x===t.x&&this.y===t.y}return!1}hashCode(){return 31*oe.floatToIntBits(this.x)+oe.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(e){const t=this.distance(e[0],e[1]),n=this.distance(e[1],e[2]),r=this.distance(e[0],e[2]);let i,o,s;if(n>=t&&n>=r?(o=e[0],i=e[1],s=e[2]):r>=n&&r>=t?(o=e[1],i=e[0],s=e[2]):(o=e[2],i=e[0],s=e[1]),this.crossProductZ(i,o,s)<0){const e=i;i=s,s=e}e[0]=i,e[1]=o,e[2]=s}static distance(e,t){return ie.distance(e.x,e.y,t.x,t.y)}static crossProductZ(e,t,n){const r=t.x,i=t.y;return(n.x-r)*(e.y-i)-(n.y-i)*(e.x-r)}}class ae{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class le extends ae{constructor(e,t,n,r,i){super(e,t),this.compact=n,this.nbDatablocks=r,this.nbLayers=i}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class ce{constructor(e,t,n,r){this.image=e,this.height=e.getHeight(),this.width=e.getWidth(),null==t&&(t=ce.INIT_SIZE),null==n&&(n=e.getWidth()/2|0),null==r&&(r=e.getHeight()/2|0);const i=t/2|0;if(this.leftInit=n-i,this.rightInit=n+i,this.upInit=r-i,this.downInit=r+i,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new N}detect(){let e=this.leftInit,t=this.rightInit,n=this.upInit,r=this.downInit,i=!1,o=!0,s=!1,a=!1,l=!1,c=!1,d=!1;const u=this.width,h=this.height;for(;o;){o=!1;let f=!0;for(;(f||!a)&&t<u;)f=this.containsBlackPoint(n,r,t,!1),f?(t++,o=!0,a=!0):a||t++;if(t>=u){i=!0;break}let m=!0;for(;(m||!l)&&r<h;)m=this.containsBlackPoint(e,t,r,!0),m?(r++,o=!0,l=!0):l||r++;if(r>=h){i=!0;break}let p=!0;for(;(p||!c)&&e>=0;)p=this.containsBlackPoint(n,r,e,!1),p?(e--,o=!0,c=!0):c||e--;if(e<0){i=!0;break}let g=!0;for(;(g||!d)&&n>=0;)g=this.containsBlackPoint(e,t,n,!0),g?(n--,o=!0,d=!0):d||n--;if(n<0){i=!0;break}o&&(s=!0)}if(!i&&s){const i=t-e;let o=null;for(let t=1;null===o&&t<i;t++)o=this.getBlackPointOnSegment(e,r-t,e+t,r);if(null==o)throw new N;let s=null;for(let t=1;null===s&&t<i;t++)s=this.getBlackPointOnSegment(e,n+t,e+t,n);if(null==s)throw new N;let a=null;for(let e=1;null===a&&e<i;e++)a=this.getBlackPointOnSegment(t,n+e,t-e,n);if(null==a)throw new N;let l=null;for(let e=1;null===l&&e<i;e++)l=this.getBlackPointOnSegment(t,r-e,t-e,r);if(null==l)throw new N;return this.centerEdges(l,o,a,s)}throw new N}getBlackPointOnSegment(e,t,n,r){const i=ie.round(ie.distance(e,t,n,r)),o=(n-e)/i,s=(r-t)/i,a=this.image;for(let n=0;n<i;n++){const r=ie.round(e+n*o),i=ie.round(t+n*s);if(a.get(r,i))return new se(r,i)}return null}centerEdges(e,t,n,r){const i=e.getX(),o=e.getY(),s=t.getX(),a=t.getY(),l=n.getX(),c=n.getY(),d=r.getX(),u=r.getY(),h=ce.CORR;return i<this.width/2?[new se(d-h,u+h),new se(s+h,a+h),new se(l-h,c-h),new se(i+h,o-h)]:[new se(d+h,u+h),new se(s+h,a-h),new se(l-h,c+h),new se(i-h,o-h)]}containsBlackPoint(e,t,n,r){const i=this.image;if(r){for(let r=e;r<=t;r++)if(i.get(r,n))return!0}else for(let r=e;r<=t;r++)if(i.get(n,r))return!0;return!1}}ce.INIT_SIZE=10,ce.CORR=1;class de{static checkAndNudgePoints(e,t){const n=e.getWidth(),r=e.getHeight();let i=!0;for(let e=0;e<t.length&&i;e+=2){const o=Math.floor(t[e]),s=Math.floor(t[e+1]);if(o<-1||o>n||s<-1||s>r)throw new N;i=!1,-1===o?(t[e]=0,i=!0):o===n&&(t[e]=n-1,i=!0),-1===s?(t[e+1]=0,i=!0):s===r&&(t[e+1]=r-1,i=!0)}i=!0;for(let e=t.length-2;e>=0&&i;e-=2){const o=Math.floor(t[e]),s=Math.floor(t[e+1]);if(o<-1||o>n||s<-1||s>r)throw new N;i=!1,-1===o?(t[e]=0,i=!0):o===n&&(t[e]=n-1,i=!0),-1===s?(t[e+1]=0,i=!0):s===r&&(t[e+1]=r-1,i=!0)}}}class ue{constructor(e,t,n,r,i,o,s,a,l){this.a11=e,this.a21=t,this.a31=n,this.a12=r,this.a22=i,this.a32=o,this.a13=s,this.a23=a,this.a33=l}static quadrilateralToQuadrilateral(e,t,n,r,i,o,s,a,l,c,d,u,h,f,m,p){const g=ue.quadrilateralToSquare(e,t,n,r,i,o,s,a);return ue.squareToQuadrilateral(l,c,d,u,h,f,m,p).times(g)}transformPoints(e){const t=e.length,n=this.a11,r=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,l=this.a31,c=this.a32,d=this.a33;for(let u=0;u<t;u+=2){const t=e[u],h=e[u+1],f=i*t+a*h+d;e[u]=(n*t+o*h+l)/f,e[u+1]=(r*t+s*h+c)/f}}transformPointsWithValues(e,t){const n=this.a11,r=this.a12,i=this.a13,o=this.a21,s=this.a22,a=this.a23,l=this.a31,c=this.a32,d=this.a33,u=e.length;for(let h=0;h<u;h++){const u=e[h],f=t[h],m=i*u+a*f+d;e[h]=(n*u+o*f+l)/m,t[h]=(r*u+s*f+c)/m}}static squareToQuadrilateral(e,t,n,r,i,o,s,a){const l=e-n+i-s,c=t-r+o-a;if(0===l&&0===c)return new ue(n-e,i-n,e,r-t,o-r,t,0,0,1);{const d=n-i,u=s-i,h=r-o,f=a-o,m=d*f-u*h,p=(l*f-u*c)/m,g=(d*c-l*h)/m;return new ue(n-e+p*n,s-e+g*s,e,r-t+p*r,a-t+g*a,t,p,g,1)}}static quadrilateralToSquare(e,t,n,r,i,o,s,a){return ue.squareToQuadrilateral(e,t,n,r,i,o,s,a).buildAdjoint()}buildAdjoint(){return new ue(this.a22*this.a33-this.a23*this.a32,this.a23*this.a31-this.a21*this.a33,this.a21*this.a32-this.a22*this.a31,this.a13*this.a32-this.a12*this.a33,this.a11*this.a33-this.a13*this.a31,this.a12*this.a31-this.a11*this.a32,this.a12*this.a23-this.a13*this.a22,this.a13*this.a21-this.a11*this.a23,this.a11*this.a22-this.a12*this.a21)}times(e){return new ue(this.a11*e.a11+this.a21*e.a12+this.a31*e.a13,this.a11*e.a21+this.a21*e.a22+this.a31*e.a23,this.a11*e.a31+this.a21*e.a32+this.a31*e.a33,this.a12*e.a11+this.a22*e.a12+this.a32*e.a13,this.a12*e.a21+this.a22*e.a22+this.a32*e.a23,this.a12*e.a31+this.a22*e.a32+this.a32*e.a33,this.a13*e.a11+this.a23*e.a12+this.a33*e.a13,this.a13*e.a21+this.a23*e.a22+this.a33*e.a23,this.a13*e.a31+this.a23*e.a32+this.a33*e.a33)}}class he extends de{sampleGrid(e,t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y){const v=ue.quadrilateralToQuadrilateral(r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y);return this.sampleGridWithTransform(e,t,n,v)}sampleGridWithTransform(e,t,n,r){if(t<=0||n<=0)throw new N;const i=new T(t,n),o=new Float32Array(2*t);for(let t=0;t<n;t++){const n=o.length,s=t+.5;for(let e=0;e<n;e+=2)o[e]=e/2+.5,o[e+1]=s;r.transformPoints(o),de.checkAndNudgePoints(e,o);try{for(let r=0;r<n;r+=2)e.get(Math.floor(o[r]),Math.floor(o[r+1]))&&i.set(r/2,t)}catch(e){throw new N}}return i}}class fe{static setGridSampler(e){fe.gridSampler=e}static getInstance(){return fe.gridSampler}}fe.gridSampler=new he;class me{constructor(e,t){this.x=e,this.y=t}toResultPoint(){return new se(this.getX(),this.getY())}getX(){return this.x}getY(){return this.y}}class pe{constructor(e){this.EXPECTED_CORNER_BITS=new Int32Array([3808,476,2107,1799]),this.image=e}detect(){return this.detectMirror(!1)}detectMirror(e){let t=this.getMatrixCenter(),n=this.getBullsEyeCorners(t);if(e){let e=n[0];n[0]=n[2],n[2]=e}this.extractParameters(n);let r=this.sampleGrid(this.image,n[this.shift%4],n[(this.shift+1)%4],n[(this.shift+2)%4],n[(this.shift+3)%4]),i=this.getMatrixCornerPoints(n);return new le(r,i,this.compact,this.nbDataBlocks,this.nbLayers)}extractParameters(e){if(!(this.isValidPoint(e[0])&&this.isValidPoint(e[1])&&this.isValidPoint(e[2])&&this.isValidPoint(e[3])))throw new N;let t=2*this.nbCenterLayers,n=new Int32Array([this.sampleLine(e[0],e[1],t),this.sampleLine(e[1],e[2],t),this.sampleLine(e[2],e[3],t),this.sampleLine(e[3],e[0],t)]);this.shift=this.getRotation(n,t);let r=0;for(let e=0;e<4;e++){let t=n[(this.shift+e)%4];this.compact?(r<<=7,r+=t>>1&127):(r<<=10,r+=(t>>2&992)+(t>>1&31))}let i=this.getCorrectedParameterData(r,this.compact);this.compact?(this.nbLayers=1+(i>>6),this.nbDataBlocks=1+(63&i)):(this.nbLayers=1+(i>>11),this.nbDataBlocks=1+(2047&i))}getRotation(e,t){let n=0;e.forEach((e,r,i)=>{n=(e>>t-2<<1)+(1&e)+(n<<3)}),n=((1&n)<<11)+(n>>1);for(let e=0;e<4;e++)if(y.bitCount(n^this.EXPECTED_CORNER_BITS[e])<=2)return e;throw new N}getCorrectedParameterData(e,t){let n,r;t?(n=7,r=2):(n=10,r=4);let i=n-r,o=new Int32Array(n);for(let t=n-1;t>=0;--t)o[t]=15&e,e>>=4;try{new ne(J.AZTEC_PARAM).decode(o,i)}catch(e){throw new N}let s=0;for(let e=0;e<r;e++)s=(s<<4)+o[e];return s}getBullsEyeCorners(e){let t=e,n=e,r=e,i=e,o=!0;for(this.nbCenterLayers=1;this.nbCenterLayers<9;this.nbCenterLayers++){let e=this.getFirstDifferent(t,o,1,-1),s=this.getFirstDifferent(n,o,1,1),a=this.getFirstDifferent(r,o,-1,1),l=this.getFirstDifferent(i,o,-1,-1);if(this.nbCenterLayers>2){let n=this.distancePoint(l,e)*this.nbCenterLayers/(this.distancePoint(i,t)*(this.nbCenterLayers+2));if(n<.75||n>1.25||!this.isWhiteOrBlackRectangle(e,s,a,l))break}t=e,n=s,r=a,i=l,o=!o}if(5!==this.nbCenterLayers&&7!==this.nbCenterLayers)throw new N;this.compact=5===this.nbCenterLayers;let s=new se(t.getX()+.5,t.getY()-.5),a=new se(n.getX()+.5,n.getY()+.5),l=new se(r.getX()-.5,r.getY()+.5),c=new se(i.getX()-.5,i.getY()-.5);return this.expandSquare([s,a,l,c],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let e,t,n,r;try{let i=new ce(this.image).detect();e=i[0],t=i[1],n=i[2],r=i[3]}catch(i){let o=this.image.getWidth()/2,s=this.image.getHeight()/2;e=this.getFirstDifferent(new me(o+7,s-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new me(o+7,s+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new me(o-7,s+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new me(o-7,s-7),!1,-1,-1).toResultPoint()}let i=ie.round((e.getX()+r.getX()+t.getX()+n.getX())/4),o=ie.round((e.getY()+r.getY()+t.getY()+n.getY())/4);try{let s=new ce(this.image,15,i,o).detect();e=s[0],t=s[1],n=s[2],r=s[3]}catch(s){e=this.getFirstDifferent(new me(i+7,o-7),!1,1,-1).toResultPoint(),t=this.getFirstDifferent(new me(i+7,o+7),!1,1,1).toResultPoint(),n=this.getFirstDifferent(new me(i-7,o+7),!1,-1,1).toResultPoint(),r=this.getFirstDifferent(new me(i-7,o-7),!1,-1,-1).toResultPoint()}return i=ie.round((e.getX()+r.getX()+t.getX()+n.getX())/4),o=ie.round((e.getY()+r.getY()+t.getY()+n.getY())/4),new me(i,o)}getMatrixCornerPoints(e){return this.expandSquare(e,2*this.nbCenterLayers,this.getDimension())}sampleGrid(e,t,n,r,i){let o=fe.getInstance(),s=this.getDimension(),a=s/2-this.nbCenterLayers,l=s/2+this.nbCenterLayers;return o.sampleGrid(e,s,s,a,a,l,a,l,l,a,l,t.getX(),t.getY(),n.getX(),n.getY(),r.getX(),r.getY(),i.getX(),i.getY())}sampleLine(e,t,n){let r=0,i=this.distanceResultPoint(e,t),o=i/n,s=e.getX(),a=e.getY(),l=o*(t.getX()-e.getX())/i,c=o*(t.getY()-e.getY())/i;for(let e=0;e<n;e++)this.image.get(ie.round(s+e*l),ie.round(a+e*c))&&(r|=1<<n-e-1);return r}isWhiteOrBlackRectangle(e,t,n,r){let i=3;e=new me(e.getX()-i,e.getY()+i),t=new me(t.getX()-i,t.getY()-i),n=new me(n.getX()+i,n.getY()-i),r=new me(r.getX()+i,r.getY()+i);let o=this.getColor(r,e);if(0===o)return!1;let s=this.getColor(e,t);return s===o&&(s=this.getColor(t,n),s===o&&(s=this.getColor(n,r),s===o))}getColor(e,t){let n=this.distancePoint(e,t),r=(t.getX()-e.getX())/n,i=(t.getY()-e.getY())/n,o=0,s=e.getX(),a=e.getY(),l=this.image.get(e.getX(),e.getY()),c=Math.ceil(n);for(let e=0;e<c;e++)s+=r,a+=i,this.image.get(ie.round(s),ie.round(a))!==l&&o++;let d=o/n;return d>.1&&d<.9?0:d<=.1===l?1:-1}getFirstDifferent(e,t,n,r){let i=e.getX()+n,o=e.getY()+r;for(;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=n,o+=r;for(i-=n,o-=r;this.isValid(i,o)&&this.image.get(i,o)===t;)i+=n;for(i-=n;this.isValid(i,o)&&this.image.get(i,o)===t;)o+=r;return o-=r,new me(i,o)}expandSquare(e,t,n){let r=n/(2*t),i=e[0].getX()-e[2].getX(),o=e[0].getY()-e[2].getY(),s=(e[0].getX()+e[2].getX())/2,a=(e[0].getY()+e[2].getY())/2,l=new se(s+r*i,a+r*o),c=new se(s-r*i,a-r*o);return i=e[1].getX()-e[3].getX(),o=e[1].getY()-e[3].getY(),s=(e[1].getX()+e[3].getX())/2,a=(e[1].getY()+e[3].getY())/2,[l,new se(s+r*i,a+r*o),c,new se(s-r*i,a-r*o)]}isValid(e,t){return e>=0&&e<this.image.getWidth()&&t>0&&t<this.image.getHeight()}isValidPoint(e){let t=ie.round(e.getX()),n=ie.round(e.getY());return this.isValid(t,n)}distancePoint(e,t){return ie.distance(e.getX(),e.getY(),t.getX(),t.getY())}distanceResultPoint(e,t){return ie.distance(e.getX(),e.getY(),t.getX(),t.getY())}getDimension(){return this.compact?4*this.nbLayers+11:this.nbLayers<=4?4*this.nbLayers+15:4*this.nbLayers+2*(y.truncDivision(this.nbLayers-4,8)+1)+15}}class ge{decode(e,t=null){let n=null,r=new pe(e.getBlackMatrix()),i=null,o=null;try{let e=r.detectMirror(!1);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=(new re).decode(e)}catch(e){n=e}if(null==o)try{let e=r.detectMirror(!0);i=e.getPoints(),this.reportFoundResultPoints(t,i),o=(new re).decode(e)}catch(e){if(null!=n)throw n;throw e}let s=new F(o.getText(),o.getRawBytes(),o.getNumBits(),i,U.AZTEC,m.currentTimeMillis()),a=o.getByteSegments();null!=a&&s.putMetadata(X.BYTE_SEGMENTS,a);let l=o.getECLevel();return null!=l&&s.putMetadata(X.ERROR_CORRECTION_LEVEL,l),s}reportFoundResultPoints(e,t){if(null!=e){let n=e.get(_.NEED_RESULT_POINT_CALLBACK);null!=n&&t.forEach((e,t,r)=>{n.foundPossibleResultPoint(e)})}}reset(){}}class we extends L{constructor(e=500){super(new ge,e)}}class ye{decode(e,t){try{return this.doDecode(e,t)}catch(n){if(t&&!0===t.get(_.TRY_HARDER)&&e.isRotateSupported()){const n=e.rotateCounterClockwise(),r=this.doDecode(n,t),i=r.getResultMetadata();let o=270;null!==i&&!0===i.get(X.ORIENTATION)&&(o+=i.get(X.ORIENTATION)%360),r.putMetadata(X.ORIENTATION,o);const s=r.getResultPoints();if(null!==s){const e=n.getHeight();for(let t=0;t<s.length;t++)s[t]=new se(e-s[t].getY()-1,s[t].getX())}return r}throw new N}}reset(){}doDecode(e,t){const n=e.getWidth(),r=e.getHeight();let i=new v(n);const o=t&&!0===t.get(_.TRY_HARDER),s=Math.max(1,r>>(o?8:5));let a;a=o?r:15;const l=Math.trunc(r/2);for(let o=0;o<a;o++){const a=Math.trunc((o+1)/2),c=l+s*(1&o?-a:a);if(c<0||c>=r)break;try{i=e.getBlackRow(c,i)}catch(e){continue}for(let e=0;e<2;e++){if(1===e&&(i.reverse(),t&&!0===t.get(_.NEED_RESULT_POINT_CALLBACK))){const e=new Map;t.forEach((t,n)=>e.set(n,t)),e.delete(_.NEED_RESULT_POINT_CALLBACK),t=e}try{const r=this.decodeRow(c,i,t);if(1===e){r.putMetadata(X.ORIENTATION,180);const e=r.getResultPoints();null!==e&&(e[0]=new se(n-e[0].getX()-1,e[0].getY()),e[1]=new se(n-e[1].getX()-1,e[1].getY()))}return r}catch(e){}}}throw new N}static recordPattern(e,t,n){const r=n.length;for(let e=0;e<r;e++)n[e]=0;const i=e.getSize();if(t>=i)throw new N;let o=!e.get(t),s=0,a=t;for(;a<i;){if(e.get(a)!==o)n[s]++;else{if(++s===r)break;n[s]=1,o=!o}a++}if(s!==r&&(s!==r-1||a!==i))throw new N}static recordPatternInReverse(e,t,n){let r=n.length,i=e.get(t);for(;t>0&&r>=0;)e.get(--t)!==i&&(r--,i=!i);if(r>=0)throw new N;ye.recordPattern(e,t+1,n)}static patternMatchVariance(e,t,n){const r=e.length;let i=0,o=0;for(let n=0;n<r;n++)i+=e[n],o+=t[n];if(i<o)return Number.POSITIVE_INFINITY;const s=i/o;n*=s;let a=0;for(let i=0;i<r;i++){const r=e[i],o=t[i]*s,l=r>o?r-o:o-r;if(l>n)return Number.POSITIVE_INFINITY;a+=l}return a/i}}class ve extends ye{static findStartPattern(e){const t=e.getSize(),n=e.getNextSet(0);let r=0,i=Int32Array.from([0,0,0,0,0,0]),o=n,s=!1;const a=6;for(let l=n;l<t;l++)if(e.get(l)!==s)i[r]++;else{if(r===a-1){let t=ve.MAX_AVG_VARIANCE,n=-1;for(let e=ve.CODE_START_A;e<=ve.CODE_START_C;e++){const r=ye.patternMatchVariance(i,ve.CODE_PATTERNS[e],ve.MAX_INDIVIDUAL_VARIANCE);r<t&&(t=r,n=e)}if(n>=0&&e.isRange(Math.max(0,o-(l-o)/2),o,!1))return Int32Array.from([o,l,n]);o+=i[0]+i[1],i=i.slice(2,i.length-1),i[r-1]=0,i[r]=0,r--}else r++;i[r]=1,s=!s}throw new N}static decodeCode(e,t,n){ye.recordPattern(e,n,t);let r=ve.MAX_AVG_VARIANCE,i=-1;for(let e=0;e<ve.CODE_PATTERNS.length;e++){const n=ve.CODE_PATTERNS[e],o=this.patternMatchVariance(t,n,ve.MAX_INDIVIDUAL_VARIANCE);o<r&&(r=o,i=e)}if(i>=0)return i;throw new N}decodeRow(e,t,n){const r=n&&!0===n.get(_.ASSUME_GS1),i=ve.findStartPattern(t),o=i[2];let s=0;const a=new Uint8Array(20);let l;switch(a[s++]=o,o){case ve.CODE_START_A:l=ve.CODE_CODE_A;break;case ve.CODE_START_B:l=ve.CODE_CODE_B;break;case ve.CODE_START_C:l=ve.CODE_CODE_C;break;default:throw new C}let c=!1,d=!1,u="",f=i[0],m=i[1];const p=Int32Array.from([0,0,0,0,0,0]);let g=0,w=0,y=o,v=0,I=!0,E=!1,A=!1;for(;!c;){const e=d;switch(d=!1,g=w,w=ve.decodeCode(t,p,m),a[s++]=w,w!==ve.CODE_STOP&&(I=!0),w!==ve.CODE_STOP&&(v++,y+=v*w),f=m,m+=p.reduce((e,t)=>e+t,0),w){case ve.CODE_START_A:case ve.CODE_START_B:case ve.CODE_START_C:throw new C}switch(l){case ve.CODE_CODE_A:if(w<64)u+=A===E?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),A=!1;else if(w<96)u+=A===E?String.fromCharCode(w-64):String.fromCharCode(w+64),A=!1;else switch(w!==ve.CODE_STOP&&(I=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_A:!E&&A?(E=!0,A=!1):E&&A?(E=!1,A=!1):A=!0;break;case ve.CODE_SHIFT:d=!0,l=ve.CODE_CODE_B;break;case ve.CODE_CODE_B:l=ve.CODE_CODE_B;break;case ve.CODE_CODE_C:l=ve.CODE_CODE_C;break;case ve.CODE_STOP:c=!0}break;case ve.CODE_CODE_B:if(w<96)u+=A===E?String.fromCharCode(" ".charCodeAt(0)+w):String.fromCharCode(" ".charCodeAt(0)+w+128),A=!1;else switch(w!==ve.CODE_STOP&&(I=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_B:!E&&A?(E=!0,A=!1):E&&A?(E=!1,A=!1):A=!0;break;case ve.CODE_SHIFT:d=!0,l=ve.CODE_CODE_A;break;case ve.CODE_CODE_A:l=ve.CODE_CODE_A;break;case ve.CODE_CODE_C:l=ve.CODE_CODE_C;break;case ve.CODE_STOP:c=!0}break;case ve.CODE_CODE_C:if(w<100)w<10&&(u+="0"),u+=w;else switch(w!==ve.CODE_STOP&&(I=!1),w){case ve.CODE_FNC_1:r&&(0===u.length?u+="]C1":u+=String.fromCharCode(29));break;case ve.CODE_CODE_A:l=ve.CODE_CODE_A;break;case ve.CODE_CODE_B:l=ve.CODE_CODE_B;break;case ve.CODE_STOP:c=!0}}e&&(l=l===ve.CODE_CODE_A?ve.CODE_CODE_B:ve.CODE_CODE_A)}const $=m-f;if(m=t.getNextUnset(m),!t.isRange(m,Math.min(t.getSize(),m+(m-f)/2),!1))throw new N;if(y-=v*g,y%103!==g)throw new h;const b=u.length;if(0===b)throw new N;b>0&&I&&(u=l===ve.CODE_CODE_C?u.substring(0,b-2):u.substring(0,b-1));const S=(i[1]+i[0])/2,T=f+$/2,R=a.length,D=new Uint8Array(R);for(let e=0;e<R;e++)D[e]=a[e];const x=[new se(S,e),new se(T,e)];return new F(u,D,0,x,U.CODE_128,(new Date).getTime())}}ve.CODE_PATTERNS=[Int32Array.from([2,1,2,2,2,2]),Int32Array.from([2,2,2,1,2,2]),Int32Array.from([2,2,2,2,2,1]),Int32Array.from([1,2,1,2,2,3]),Int32Array.from([1,2,1,3,2,2]),Int32Array.from([1,3,1,2,2,2]),Int32Array.from([1,2,2,2,1,3]),Int32Array.from([1,2,2,3,1,2]),Int32Array.from([1,3,2,2,1,2]),Int32Array.from([2,2,1,2,1,3]),Int32Array.from([2,2,1,3,1,2]),Int32Array.from([2,3,1,2,1,2]),Int32Array.from([1,1,2,2,3,2]),Int32Array.from([1,2,2,1,3,2]),Int32Array.from([1,2,2,2,3,1]),Int32Array.from([1,1,3,2,2,2]),Int32Array.from([1,2,3,1,2,2]),Int32Array.from([1,2,3,2,2,1]),Int32Array.from([2,2,3,2,1,1]),Int32Array.from([2,2,1,1,3,2]),Int32Array.from([2,2,1,2,3,1]),Int32Array.from([2,1,3,2,1,2]),Int32Array.from([2,2,3,1,1,2]),Int32Array.from([3,1,2,1,3,1]),Int32Array.from([3,1,1,2,2,2]),Int32Array.from([3,2,1,1,2,2]),Int32Array.from([3,2,1,2,2,1]),Int32Array.from([3,1,2,2,1,2]),Int32Array.from([3,2,2,1,1,2]),Int32Array.from([3,2,2,2,1,1]),Int32Array.from([2,1,2,1,2,3]),Int32Array.from([2,1,2,3,2,1]),Int32Array.from([2,3,2,1,2,1]),Int32Array.from([1,1,1,3,2,3]),Int32Array.from([1,3,1,1,2,3]),Int32Array.from([1,3,1,3,2,1]),Int32Array.from([1,1,2,3,1,3]),Int32Array.from([1,3,2,1,1,3]),Int32Array.from([1,3,2,3,1,1]),Int32Array.from([2,1,1,3,1,3]),Int32Array.from([2,3,1,1,1,3]),Int32Array.from([2,3,1,3,1,1]),Int32Array.from([1,1,2,1,3,3]),Int32Array.from([1,1,2,3,3,1]),Int32Array.from([1,3,2,1,3,1]),Int32Array.from([1,1,3,1,2,3]),Int32Array.from([1,1,3,3,2,1]),Int32Array.from([1,3,3,1,2,1]),Int32Array.from([3,1,3,1,2,1]),Int32Array.from([2,1,1,3,3,1]),Int32Array.from([2,3,1,1,3,1]),Int32Array.from([2,1,3,1,1,3]),Int32Array.from([2,1,3,3,1,1]),Int32Array.from([2,1,3,1,3,1]),Int32Array.from([3,1,1,1,2,3]),Int32Array.from([3,1,1,3,2,1]),Int32Array.from([3,3,1,1,2,1]),Int32Array.from([3,1,2,1,1,3]),Int32Array.from([3,1,2,3,1,1]),Int32Array.from([3,3,2,1,1,1]),Int32Array.from([3,1,4,1,1,1]),Int32Array.from([2,2,1,4,1,1]),Int32Array.from([4,3,1,1,1,1]),Int32Array.from([1,1,1,2,2,4]),Int32Array.from([1,1,1,4,2,2]),Int32Array.from([1,2,1,1,2,4]),Int32Array.from([1,2,1,4,2,1]),Int32Array.from([1,4,1,1,2,2]),Int32Array.from([1,4,1,2,2,1]),Int32Array.from([1,1,2,2,1,4]),Int32Array.from([1,1,2,4,1,2]),Int32Array.from([1,2,2,1,1,4]),Int32Array.from([1,2,2,4,1,1]),Int32Array.from([1,4,2,1,1,2]),Int32Array.from([1,4,2,2,1,1]),Int32Array.from([2,4,1,2,1,1]),Int32Array.from([2,2,1,1,1,4]),Int32Array.from([4,1,3,1,1,1]),Int32Array.from([2,4,1,1,1,2]),Int32Array.from([1,3,4,1,1,1]),Int32Array.from([1,1,1,2,4,2]),Int32Array.from([1,2,1,1,4,2]),Int32Array.from([1,2,1,2,4,1]),Int32Array.from([1,1,4,2,1,2]),Int32Array.from([1,2,4,1,1,2]),Int32Array.from([1,2,4,2,1,1]),Int32Array.from([4,1,1,2,1,2]),Int32Array.from([4,2,1,1,1,2]),Int32Array.from([4,2,1,2,1,1]),Int32Array.from([2,1,2,1,4,1]),Int32Array.from([2,1,4,1,2,1]),Int32Array.from([4,1,2,1,2,1]),Int32Array.from([1,1,1,1,4,3]),Int32Array.from([1,1,1,3,4,1]),Int32Array.from([1,3,1,1,4,1]),Int32Array.from([1,1,4,1,1,3]),Int32Array.from([1,1,4,3,1,1]),Int32Array.from([4,1,1,1,1,3]),Int32Array.from([4,1,1,3,1,1]),Int32Array.from([1,1,3,1,4,1]),Int32Array.from([1,1,4,1,3,1]),Int32Array.from([3,1,1,1,4,1]),Int32Array.from([4,1,1,1,3,1]),Int32Array.from([2,1,1,4,1,2]),Int32Array.from([2,1,1,2,1,4]),Int32Array.from([2,1,1,2,3,2]),Int32Array.from([2,3,3,1,1,1,2])],ve.MAX_AVG_VARIANCE=.25,ve.MAX_INDIVIDUAL_VARIANCE=.7,ve.CODE_SHIFT=98,ve.CODE_CODE_C=99,ve.CODE_CODE_B=100,ve.CODE_CODE_A=101,ve.CODE_FNC_1=102,ve.CODE_FNC_2=97,ve.CODE_FNC_3=96,ve.CODE_FNC_4_A=101,ve.CODE_FNC_4_B=100,ve.CODE_START_A=103,ve.CODE_START_B=104,ve.CODE_START_C=105,ve.CODE_STOP=106;class Ie extends ye{constructor(e=!1,t=!1){super(),this.usingCheckDigit=e,this.extendedMode=t,this.decodeRowResult="",this.counters=new Int32Array(9)}decodeRow(e,t,n){let r=this.counters;r.fill(0),this.decodeRowResult="";let i,o,s=Ie.findAsteriskPattern(t,r),a=t.getNextSet(s[1]),l=t.getSize();do{Ie.recordPattern(t,a,r);let e=Ie.toNarrowWidePattern(r);if(e<0)throw new N;i=Ie.patternToChar(e),this.decodeRowResult+=i,o=a;for(let e of r)a+=e;a=t.getNextSet(a)}while("*"!==i);this.decodeRowResult=this.decodeRowResult.substring(0,this.decodeRowResult.length-1);let c,d=0;for(let e of r)d+=e;if(a!==l&&2*(a-o-d)<d)throw new N;if(this.usingCheckDigit){let e=this.decodeRowResult.length-1,t=0;for(let n=0;n<e;n++)t+=Ie.ALPHABET_STRING.indexOf(this.decodeRowResult.charAt(n));if(this.decodeRowResult.charAt(e)!==Ie.ALPHABET_STRING.charAt(t%43))throw new h;this.decodeRowResult=this.decodeRowResult.substring(0,e)}if(0===this.decodeRowResult.length)throw new N;c=this.extendedMode?Ie.decodeExtended(this.decodeRowResult):this.decodeRowResult;let u=(s[1]+s[0])/2,f=o+d/2;return new F(c,null,0,[new se(u,e),new se(f,e)],U.CODE_39,(new Date).getTime())}static findAsteriskPattern(e,t){let n=e.getSize(),r=e.getNextSet(0),i=0,o=r,s=!1,a=t.length;for(let l=r;l<n;l++)if(e.get(l)!==s)t[i]++;else{if(i===a-1){if(this.toNarrowWidePattern(t)===Ie.ASTERISK_ENCODING&&e.isRange(Math.max(0,o-Math.floor((l-o)/2)),o,!1))return[o,l];o+=t[0]+t[1],t.copyWithin(0,2,2+i-1),t[i-1]=0,t[i]=0,i--}else i++;t[i]=1,s=!s}throw new N}static toNarrowWidePattern(e){let t,n=e.length,r=0;do{let i=2147483647;for(let t of e)t<i&&t>r&&(i=t);r=i,t=0;let o=0,s=0;for(let i=0;i<n;i++){let a=e[i];a>r&&(s|=1<<n-1-i,t++,o+=a)}if(3===t){for(let i=0;i<n&&t>0;i++){let n=e[i];if(n>r&&(t--,2*n>=o))return-1}return s}}while(t>3);return-1}static patternToChar(e){for(let t=0;t<Ie.CHARACTER_ENCODINGS.length;t++)if(Ie.CHARACTER_ENCODINGS[t]===e)return Ie.ALPHABET_STRING.charAt(t);if(e===Ie.ASTERISK_ENCODING)return"*";throw new N}static decodeExtended(e){let t=e.length,n="";for(let r=0;r<t;r++){let t=e.charAt(r);if("+"===t||"$"===t||"%"===t||"/"===t){let i=e.charAt(r+1),o="\0";switch(t){case"+":if(!(i>="A"&&i<="Z"))throw new C;o=String.fromCharCode(i.charCodeAt(0)+32);break;case"$":if(!(i>="A"&&i<="Z"))throw new C;o=String.fromCharCode(i.charCodeAt(0)-64);break;case"%":if(i>="A"&&i<="E")o=String.fromCharCode(i.charCodeAt(0)-38);else if(i>="F"&&i<="J")o=String.fromCharCode(i.charCodeAt(0)-11);else if(i>="K"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)+16);else if(i>="P"&&i<="T")o=String.fromCharCode(i.charCodeAt(0)+43);else if("U"===i)o="\0";else if("V"===i)o="@";else if("W"===i)o="`";else{if("X"!==i&&"Y"!==i&&"Z"!==i)throw new C;o=""}break;case"/":if(i>="A"&&i<="O")o=String.fromCharCode(i.charCodeAt(0)-32);else{if("Z"!==i)throw new C;o=":"}}n+=o,r++}else n+=t}return n}}Ie.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Ie.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],Ie.ASTERISK_ENCODING=148;class _e extends ye{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(e,t,n){let r=this.decodeStart(t),i=this.decodeEnd(t),o=new S;_e.decodeMiddle(t,r[1],i[0],o);let s=o.toString(),a=null;null!=n&&(a=n.get(_.ALLOWED_LENGTHS)),null==a&&(a=_e.DEFAULT_ALLOWED_LENGTHS);let l=s.length,c=!1,d=0;for(let e of a){if(l===e){c=!0;break}e>d&&(d=e)}if(!c&&l>d&&(c=!0),!c)throw new C;const u=[new se(r[1],e),new se(i[0],e)];return new F(s,null,0,u,U.ITF,(new Date).getTime())}static decodeMiddle(e,t,n,r){let i=new Int32Array(10),o=new Int32Array(5),s=new Int32Array(5);for(i.fill(0),o.fill(0),s.fill(0);t<n;){ye.recordPattern(e,t,i);for(let e=0;e<5;e++){let t=2*e;o[e]=i[t],s[e]=i[t+1]}let n=_e.decodeDigit(o);r.append(n.toString()),n=this.decodeDigit(s),r.append(n.toString()),i.forEach(function(e){t+=e})}}decodeStart(e){let t=_e.skipWhiteSpace(e),n=_e.findGuardPattern(e,t,_e.START_PATTERN);return this.narrowLineWidth=(n[1]-n[0])/4,this.validateQuietZone(e,n[0]),n}validateQuietZone(e,t){let n=10*this.narrowLineWidth;n=n<t?n:t;for(let r=t-1;n>0&&r>=0&&!e.get(r);r--)n--;if(0!==n)throw new N}static skipWhiteSpace(e){const t=e.getSize(),n=e.getNextSet(0);if(n===t)throw new N;return n}decodeEnd(e){e.reverse();try{let t,n=_e.skipWhiteSpace(e);try{t=_e.findGuardPattern(e,n,_e.END_PATTERN_REVERSED[0])}catch(r){r instanceof N&&(t=_e.findGuardPattern(e,n,_e.END_PATTERN_REVERSED[1]))}this.validateQuietZone(e,t[0]);let r=t[0];return t[0]=e.getSize()-t[1],t[1]=e.getSize()-r,t}finally{e.reverse()}}static findGuardPattern(e,t,n){let r=n.length,i=new Int32Array(r),o=e.getSize(),s=!1,a=0,l=t;i.fill(0);for(let c=t;c<o;c++)if(e.get(c)!==s)i[a]++;else{if(a===r-1){if(ye.patternMatchVariance(i,n,_e.MAX_INDIVIDUAL_VARIANCE)<_e.MAX_AVG_VARIANCE)return[l,c];l+=i[0]+i[1],m.arraycopy(i,2,i,0,a-1),i[a-1]=0,i[a]=0,a--}else a++;i[a]=1,s=!s}throw new N}static decodeDigit(e){let t=_e.MAX_AVG_VARIANCE,n=-1,r=_e.PATTERNS.length;for(let i=0;i<r;i++){let r=_e.PATTERNS[i],o=ye.patternMatchVariance(e,r,_e.MAX_INDIVIDUAL_VARIANCE);o<t?(t=o,n=i):o===t&&(n=-1)}if(n>=0)return n%10;throw new N}}_e.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],_e.MAX_AVG_VARIANCE=.38,_e.MAX_INDIVIDUAL_VARIANCE=.5,_e.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],_e.START_PATTERN=Int32Array.from([1,1,1,1]),_e.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class Ce extends ye{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(e){let t,n=!1,r=0,i=Int32Array.from([0,0,0]);for(;!n;){i=Int32Array.from([0,0,0]),t=Ce.findGuardPattern(e,r,!1,this.START_END_PATTERN,i);let o=t[0];r=t[1];let s=o-(r-o);s>=0&&(n=e.isRange(s,o,!1))}return t}static checkChecksum(e){return Ce.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return Ce.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new C;n+=t}n*=3;for(let r=t-2;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new C;n+=t}return(1e3-n)%10}static decodeEnd(e,t){return Ce.findGuardPattern(e,t,!1,Ce.START_END_PATTERN,new Int32Array(Ce.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(e,t,n,r){return this.findGuardPattern(e,t,n,r,new Int32Array(r.length))}static findGuardPattern(e,t,n,r,i){let o=e.getSize(),s=0,a=t=n?e.getNextUnset(t):e.getNextSet(t),l=r.length,c=n;for(let n=t;n<o;n++)if(e.get(n)!==c)i[s]++;else{if(s===l-1){if(ye.patternMatchVariance(i,r,Ce.MAX_INDIVIDUAL_VARIANCE)<Ce.MAX_AVG_VARIANCE)return Int32Array.from([a,n]);a+=i[0]+i[1];let e=i.slice(2,i.length-1);for(let t=0;t<s-1;t++)i[t]=e[t];i[s-1]=0,i[s]=0,s--}else s++;i[s]=1,c=!c}throw new N}static decodeDigit(e,t,n,r){this.recordPattern(e,n,t);let i=this.MAX_AVG_VARIANCE,o=-1,s=r.length;for(let e=0;e<s;e++){let n=r[e],s=ye.patternMatchVariance(t,n,Ce.MAX_INDIVIDUAL_VARIANCE);s<i&&(i=s,o=e)}if(o>=0)return o;throw new N}}Ce.MAX_AVG_VARIANCE=.48,Ce.MAX_INDIVIDUAL_VARIANCE=.7,Ce.START_END_PATTERN=Int32Array.from([1,1,1]),Ce.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Ce.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Ce.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class Ee{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),o=r.toString(),s=Ee.parseExtensionString(o),a=[new se((n[0]+n[1])/2,e),new se(i,e)],l=new F(o,null,0,a,U.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&l.putAllMetadata(s),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<5&&o<i;t++){let i=Ce.decodeDigit(e,r,o,Ce.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<4-t),4!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(5!==n.length)throw new N;let a=this.determineCheckDigit(s);if(Ee.extensionChecksum(n.toString())!==a)throw new N;return o}static extensionChecksum(e){let t=e.length,n=0;for(let r=t-2;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);n*=3;for(let r=t-1;r>=0;r-=2)n+=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);return n*=3,n%10}determineCheckDigit(e){for(let t=0;t<10;t++)if(e===this.CHECK_DIGIT_ENCODINGS[t])return t;throw new N}static parseExtensionString(e){if(5!==e.length)return null;let t=Ee.parseExtension5String(e);return null==t?null:new Map([[X.SUGGESTED_PRICE,t]])}static parseExtension5String(e){let t;switch(e.charAt(0)){case"0":t="£";break;case"5":t="$";break;case"9":switch(e){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}t="";break;default:t=""}let n=parseInt(e.substring(1)),r=n%100;return t+(n/100).toString()+"."+(r<10?"0"+r:r.toString())}}class Ae{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(e,t,n){let r=this.decodeRowStringBuffer,i=this.decodeMiddle(t,n,r),o=r.toString(),s=Ae.parseExtensionString(o),a=[new se((n[0]+n[1])/2,e),new se(i,e)],l=new F(o,null,0,a,U.UPC_EAN_EXTENSION,(new Date).getTime());return null!=s&&l.putAllMetadata(s),l}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<2&&o<i;t++){let i=Ce.decodeDigit(e,r,o,Ce.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<1-t),1!==t&&(o=e.getNextSet(o),o=e.getNextUnset(o))}if(2!==n.length)throw new N;if(parseInt(n.toString())%4!==s)throw new N;return o}static parseExtensionString(e){return 2!==e.length?null:new Map([[X.ISSUE_NUMBER,parseInt(e)]])}}class $e{static decodeRow(e,t,n){let r=Ce.findGuardPattern(t,n,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return(new Ee).decodeRow(e,t,r)}catch(n){return(new Ae).decodeRow(e,t,r)}}}$e.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class be extends Ce{constructor(){super(),this.decodeRowStringBuffer="",be.L_AND_G_PATTERNS=be.L_PATTERNS.map(e=>Int32Array.from(e));for(let e=10;e<20;e++){let t=be.L_PATTERNS[e-10],n=new Int32Array(t.length);for(let e=0;e<t.length;e++)n[e]=t[t.length-e-1];be.L_AND_G_PATTERNS[e]=n}}decodeRow(e,t,n){let r=be.findStartGuardPattern(t),i=null==n?null:n.get(_.NEED_RESULT_POINT_CALLBACK);if(null!=i){const t=new se((r[0]+r[1])/2,e);i.foundPossibleResultPoint(t)}let o=this.decodeMiddle(t,r,this.decodeRowStringBuffer),s=o.rowOffset,a=o.resultString;if(null!=i){const t=new se(s,e);i.foundPossibleResultPoint(t)}let l=this.decodeEnd(t,s);if(null!=i){const t=new se((l[0]+l[1])/2,e);i.foundPossibleResultPoint(t)}let c=l[1],d=c+(c-l[0]);if(d>=t.getSize()||!t.isRange(c,d,!1))throw new N;let u=a.toString();if(u.length<8)throw new C;if(!be.checkChecksum(u))throw new h;let f=(r[1]+r[0])/2,m=(l[1]+l[0])/2,p=this.getBarcodeFormat(),g=[new se(f,e),new se(m,e)],w=new F(u,null,0,g,p,(new Date).getTime()),y=0;try{let n=$e.decodeRow(e,t,l[1]);w.putMetadata(X.UPC_EAN_EXTENSION,n.getText()),w.putAllMetadata(n.getResultMetadata()),w.addResultPoints(n.getResultPoints()),y=n.getText().length}catch(e){}let v=null==n?null:n.get(_.ALLOWED_EAN_EXTENSIONS);if(null!=v){let e=!1;for(let t in v)if(y.toString()===t){e=!0;break}if(!e)throw new N}return w}decodeEnd(e,t){return be.findGuardPattern(e,t,!1,be.START_END_PATTERN,new Int32Array(be.START_END_PATTERN.length).fill(0))}static checkChecksum(e){return be.checkStandardUPCEANChecksum(e)}static checkStandardUPCEANChecksum(e){let t=e.length;if(0===t)return!1;let n=parseInt(e.charAt(t-1),10);return be.getStandardUPCEANChecksum(e.substring(0,t-1))===n}static getStandardUPCEANChecksum(e){let t=e.length,n=0;for(let r=t-1;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new C;n+=t}n*=3;for(let r=t-2;r>=0;r-=2){let t=e.charAt(r).charCodeAt(0)-"0".charCodeAt(0);if(t<0||t>9)throw new C;n+=t}return(1e3-n)%10}}class Se extends be{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){let r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1],s=0;for(let t=0;t<6&&o<i;t++){let i=be.decodeDigit(e,r,o,be.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<5-t)}n=Se.determineFirstDigit(n,s),o=be.findGuardPattern(e,o,!0,be.MIDDLE_PATTERN,new Int32Array(be.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<6&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return U.EAN_13}static determineFirstDigit(e,t){for(let n=0;n<10;n++)if(t===this.FIRST_DIGIT_ENCODINGS[n])return e=String.fromCharCode("0".charCodeAt(0)+n)+e;throw new N}}Se.FIRST_DIGIT_ENCODINGS=[0,11,13,14,19,25,28,21,22,26];class Te extends be{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters;r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i=e.getSize(),o=t[1];for(let t=0;t<4&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}o=be.findGuardPattern(e,o,!0,be.MIDDLE_PATTERN,new Int32Array(be.MIDDLE_PATTERN.length).fill(0))[1];for(let t=0;t<4&&o<i;t++){let t=be.decodeDigit(e,r,o,be.L_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+t);for(let e of r)o+=e}return{rowOffset:o,resultString:n}}getBarcodeFormat(){return U.EAN_8}}class Ne extends be{constructor(){super(...arguments),this.ean13Reader=new Se}getBarcodeFormat(){return U.UPC_A}decode(e,t){return this.maybeReturnResult(this.ean13Reader.decode(e))}decodeRow(e,t,n){return this.maybeReturnResult(this.ean13Reader.decodeRow(e,t,n))}decodeMiddle(e,t,n){return this.ean13Reader.decodeMiddle(e,t,n)}maybeReturnResult(e){let t=e.getText();if("0"===t.charAt(0)){let n=new F(t.substring(1),null,null,e.getResultPoints(),U.UPC_A);return null!=e.getResultMetadata()&&n.putAllMetadata(e.getResultMetadata()),n}throw new N}reset(){this.ean13Reader.reset()}}class Re extends be{constructor(){super(),this.decodeMiddleCounters=new Int32Array(4)}decodeMiddle(e,t,n){const r=this.decodeMiddleCounters.map(e=>e);r[0]=0,r[1]=0,r[2]=0,r[3]=0;const i=e.getSize();let o=t[1],s=0;for(let t=0;t<6&&o<i;t++){const i=Re.decodeDigit(e,r,o,Re.L_AND_G_PATTERNS);n+=String.fromCharCode("0".charCodeAt(0)+i%10);for(let e of r)o+=e;i>=10&&(s|=1<<5-t)}return{rowOffset:o,resultString:Re.determineNumSysAndCheckDigit(n,s)}}decodeEnd(e,t){return Re.findGuardPatternWithoutCounters(e,t,!0,Re.MIDDLE_END_PATTERN)}checkChecksum(e){return be.checkChecksum(Re.convertUPCEtoUPCA(e))}static determineNumSysAndCheckDigit(e,t){for(let n=0;n<=1;n++)for(let r=0;r<10;r++)if(t===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[n][r])return String.fromCharCode("0".charCodeAt(0)+n)+e+String.fromCharCode("0".charCodeAt(0)+r);throw N.getNotFoundInstance()}getBarcodeFormat(){return U.UPC_E}static convertUPCEtoUPCA(e){const t=e.slice(1,7).split("").map(e=>e.charCodeAt(0)),n=new S;n.append(e.charAt(0));let r=t[5];switch(r){case 0:case 1:case 2:n.appendChars(t,0,2),n.append(r),n.append("0000"),n.appendChars(t,2,3);break;case 3:n.appendChars(t,0,3),n.append("00000"),n.appendChars(t,3,2);break;case 4:n.appendChars(t,0,4),n.append("00000"),n.append(t[4]);break;default:n.appendChars(t,0,5),n.append("0000"),n.append(r)}return e.length>=8&&n.append(e.charAt(7)),n.toString()}}Re.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Re.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class De extends ye{constructor(e){super();let n=null==e?null:e.get(_.POSSIBLE_FORMATS),r=[];t(n)?(r.push(new Se),r.push(new Ne),r.push(new Te),r.push(new Re)):(n.indexOf(U.EAN_13)>-1&&r.push(new Se),n.indexOf(U.UPC_A)>-1&&r.push(new Ne),n.indexOf(U.EAN_8)>-1&&r.push(new Te),n.indexOf(U.UPC_E)>-1&&r.push(new Re)),this.readers=r}decodeRow(e,t,n){for(let r of this.readers)try{const i=r.decodeRow(e,t,n),o=i.getBarcodeFormat()===U.EAN_13&&"0"===i.getText().charAt(0),s=null==n?null:n.get(_.POSSIBLE_FORMATS),a=null==s||s.includes(U.UPC_A);if(o&&a){const e=i.getRawBytes(),t=new F(i.getText().substring(1),e,e?e.length:null,i.getResultPoints(),U.UPC_A);return t.putAllMetadata(i.getResultMetadata()),t}return i}catch(e){}throw new N}reset(){for(let e of this.readers)e.reset()}}class xe extends ye{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(e,t){for(let n=0;n<t.length;n++)if(ye.patternMatchVariance(e,t[n],xe.MAX_INDIVIDUAL_VARIANCE)<xe.MAX_AVG_VARIANCE)return n;throw new N}static count(e){return ie.sum(new Int32Array(e))}static increment(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]>r&&(r=t[i],n=i);e[n]++}static decrement(e,t){let n=0,r=t[0];for(let i=1;i<e.length;i++)t[i]<r&&(r=t[i],n=i);e[n]--}static isFinderPattern(e){let t=e[0]+e[1],n=t/(t+e[2]+e[3]);if(n>=xe.MIN_FINDER_PATTERN_RATIO&&n<=xe.MAX_FINDER_PATTERN_RATIO){let t=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER;for(let r of e)r>n&&(n=r),r<t&&(t=r);return n<10*t}return!1}}xe.MAX_AVG_VARIANCE=.2,xe.MAX_INDIVIDUAL_VARIANCE=.45,xe.MIN_FINDER_PATTERN_RATIO=9.5/12,xe.MAX_FINDER_PATTERN_RATIO=12.5/14;class Oe{constructor(e,t){this.value=e,this.checksumPortion=t}getValue(){return this.value}getChecksumPortion(){return this.checksumPortion}toString(){return this.value+"("+this.checksumPortion+")"}equals(e){if(!(e instanceof Oe))return!1;const t=e;return this.value===t.value&&this.checksumPortion===t.checksumPortion}hashCode(){return this.value^this.checksumPortion}}class ke{constructor(e,t,n,r,i){this.value=e,this.startEnd=t,this.value=e,this.startEnd=t,this.resultPoints=new Array,this.resultPoints.push(new se(n,i)),this.resultPoints.push(new se(r,i))}getValue(){return this.value}getStartEnd(){return this.startEnd}getResultPoints(){return this.resultPoints}equals(e){if(!(e instanceof ke))return!1;const t=e;return this.value===t.value}hashCode(){return this.value}}class Me{constructor(){}static getRSSvalue(e,t,n){let r=0;for(let t of e)r+=t;let i=0,o=0,s=e.length;for(let a=0;a<s-1;a++){let l;for(l=1,o|=1<<a;l<e[a];l++,o&=~(1<<a)){let e=Me.combins(r-l-1,s-a-2);if(n&&0===o&&r-l-(s-a-1)>=s-a-1&&(e-=Me.combins(r-l-(s-a),s-a-2)),s-a-1>1){let n=0;for(let e=r-l-(s-a-2);e>t;e--)n+=Me.combins(r-l-e-1,s-a-3);e-=n*(s-1-a)}else r-l>t&&e--;i+=e}r-=l}return i}static combins(e,t){let n,r;e-t>t?(r=t,n=e-t):(r=e-t,n=t);let i=1,o=1;for(let t=e;t>n;t--)i*=t,o<=r&&(i/=o,o++);for(;o<=r;)i/=o,o++;return i}}class Pe{static buildBitArray(e){let t=2*e.length-1;null==e[e.length-1].getRightChar()&&(t-=1);let n=new v(12*t),r=0,i=e[0].getRightChar().getValue();for(let e=11;e>=0;--e)i&1<<e&&n.set(r),r++;for(let t=1;t<e.length;++t){let i=e[t],o=i.getLeftChar().getValue();for(let e=11;e>=0;--e)o&1<<e&&n.set(r),r++;if(null!=i.getRightChar()){let e=i.getRightChar().getValue();for(let t=11;t>=0;--t)e&1<<t&&n.set(r),r++}}return n}}class Be{constructor(e,t){t?this.decodedInformation=null:(this.finished=e,this.decodedInformation=t)}getDecodedInformation(){return this.decodedInformation}isFinished(){return this.finished}}class Le{constructor(e){this.newPosition=e}getNewPosition(){return this.newPosition}}class Fe extends Le{constructor(e,t){super(e),this.value=t}getValue(){return this.value}isFNC1(){return this.value===Fe.FNC1}}Fe.FNC1="$";class Ve extends Le{constructor(e,t,n){super(e),n?(this.remaining=!0,this.remainingValue=this.remainingValue):(this.remaining=!1,this.remainingValue=0),this.newString=t}getNewString(){return this.newString}isRemaining(){return this.remaining}getRemainingValue(){return this.remainingValue}}class Ue extends Le{constructor(e,t,n){if(super(e),t<0||t>10||n<0||n>10)throw new C;this.firstDigit=t,this.secondDigit=n}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return 10*this.firstDigit+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===Ue.FNC1}isSecondDigitFNC1(){return this.secondDigit===Ue.FNC1}isAnyFNC1(){return this.firstDigit===Ue.FNC1||this.secondDigit===Ue.FNC1}}Ue.FNC1=10;class He{constructor(){}static parseFieldsInGeneralPurpose(e){if(!e)return null;if(e.length<2)throw new N;let t=e.substring(0,2);for(let n of He.TWO_DIGIT_DATA_LENGTH)if(n[0]===t)return n[1]===He.VARIABLE_LENGTH?He.processVariableAI(2,n[2],e):He.processFixedAI(2,n[1],e);if(e.length<3)throw new N;let n=e.substring(0,3);for(let t of He.THREE_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(3,t[2],e):He.processFixedAI(3,t[1],e);for(let t of He.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(t[0]===n)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(4,t[2],e):He.processFixedAI(4,t[1],e);if(e.length<4)throw new N;let r=e.substring(0,4);for(let t of He.FOUR_DIGIT_DATA_LENGTH)if(t[0]===r)return t[1]===He.VARIABLE_LENGTH?He.processVariableAI(4,t[2],e):He.processFixedAI(4,t[1],e);throw new N}static processFixedAI(e,t,n){if(n.length<e)throw new N;let r=n.substring(0,e);if(n.length<e+t)throw new N;let i=n.substring(e,e+t),o=n.substring(e+t),s="("+r+")"+i,a=He.parseFieldsInGeneralPurpose(o);return null==a?s:s+a}static processVariableAI(e,t,n){let r,i=n.substring(0,e);r=n.length<e+t?n.length:e+t;let o=n.substring(e,r),s=n.substring(r),a="("+i+")"+o,l=He.parseFieldsInGeneralPurpose(s);return null==l?a:a+l}}He.VARIABLE_LENGTH=[],He.TWO_DIGIT_DATA_LENGTH=[["00",18],["01",14],["02",14],["10",He.VARIABLE_LENGTH,20],["11",6],["12",6],["13",6],["15",6],["17",6],["20",2],["21",He.VARIABLE_LENGTH,20],["22",He.VARIABLE_LENGTH,29],["30",He.VARIABLE_LENGTH,8],["37",He.VARIABLE_LENGTH,8],["90",He.VARIABLE_LENGTH,30],["91",He.VARIABLE_LENGTH,30],["92",He.VARIABLE_LENGTH,30],["93",He.VARIABLE_LENGTH,30],["94",He.VARIABLE_LENGTH,30],["95",He.VARIABLE_LENGTH,30],["96",He.VARIABLE_LENGTH,30],["97",He.VARIABLE_LENGTH,3],["98",He.VARIABLE_LENGTH,30],["99",He.VARIABLE_LENGTH,30]],He.THREE_DIGIT_DATA_LENGTH=[["240",He.VARIABLE_LENGTH,30],["241",He.VARIABLE_LENGTH,30],["242",He.VARIABLE_LENGTH,6],["250",He.VARIABLE_LENGTH,30],["251",He.VARIABLE_LENGTH,30],["253",He.VARIABLE_LENGTH,17],["254",He.VARIABLE_LENGTH,20],["400",He.VARIABLE_LENGTH,30],["401",He.VARIABLE_LENGTH,30],["402",17],["403",He.VARIABLE_LENGTH,30],["410",13],["411",13],["412",13],["413",13],["414",13],["420",He.VARIABLE_LENGTH,20],["421",He.VARIABLE_LENGTH,15],["422",3],["423",He.VARIABLE_LENGTH,15],["424",3],["425",3],["426",3]],He.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH=[["310",6],["311",6],["312",6],["313",6],["314",6],["315",6],["316",6],["320",6],["321",6],["322",6],["323",6],["324",6],["325",6],["326",6],["327",6],["328",6],["329",6],["330",6],["331",6],["332",6],["333",6],["334",6],["335",6],["336",6],["340",6],["341",6],["342",6],["343",6],["344",6],["345",6],["346",6],["347",6],["348",6],["349",6],["350",6],["351",6],["352",6],["353",6],["354",6],["355",6],["356",6],["357",6],["360",6],["361",6],["362",6],["363",6],["364",6],["365",6],["366",6],["367",6],["368",6],["369",6],["390",He.VARIABLE_LENGTH,15],["391",He.VARIABLE_LENGTH,18],["392",He.VARIABLE_LENGTH,15],["393",He.VARIABLE_LENGTH,18],["703",He.VARIABLE_LENGTH,30]],He.FOUR_DIGIT_DATA_LENGTH=[["7001",13],["7002",He.VARIABLE_LENGTH,30],["7003",10],["8001",14],["8002",He.VARIABLE_LENGTH,20],["8003",He.VARIABLE_LENGTH,30],["8004",He.VARIABLE_LENGTH,30],["8005",6],["8006",18],["8007",He.VARIABLE_LENGTH,30],["8008",He.VARIABLE_LENGTH,12],["8018",18],["8020",He.VARIABLE_LENGTH,25],["8100",6],["8101",10],["8102",2],["8110",He.VARIABLE_LENGTH,70],["8200",He.VARIABLE_LENGTH,70]];class We{constructor(e){this.buffer=new S,this.information=e}decodeAllCodes(e,t){let n=t,r=null;for(;;){let t=this.decodeGeneralPurposeField(n,r),i=He.parseFieldsInGeneralPurpose(t.getNewString());if(null!=i&&e.append(i),r=t.isRemaining()?""+t.getRemainingValue():null,n===t.getNewPosition())break;n=t.getNewPosition()}return e.toString()}isStillNumeric(e){if(e+7>this.information.getSize())return e+4<=this.information.getSize();for(let t=e;t<e+3;++t)if(this.information.get(t))return!0;return this.information.get(e+3)}decodeNumeric(e){if(e+7>this.information.getSize()){let t=this.extractNumericValueFromBitArray(e,4);return new Ue(this.information.getSize(),0===t?Ue.FNC1:t-1,Ue.FNC1)}let t=this.extractNumericValueFromBitArray(e,7);return new Ue(e+7,(t-8)/11,(t-8)%11)}extractNumericValueFromBitArray(e,t){return We.extractNumericValueFromBitArray(this.information,e,t)}static extractNumericValueFromBitArray(e,t,n){let r=0;for(let i=0;i<n;++i)e.get(t+i)&&(r|=1<<n-i-1);return r}decodeGeneralPurposeField(e,t){this.buffer.setLengthToZero(),null!=t&&this.buffer.append(t),this.current.setPosition(e);let n=this.parseBlocks();return null!=n&&n.isRemaining()?new Ve(this.current.getPosition(),this.buffer.toString(),n.getRemainingValue()):new Ve(this.current.getPosition(),this.buffer.toString())}parseBlocks(){let e,t;do{let n=this.current.getPosition();if(this.current.isAlpha()?(t=this.parseAlphaBlock(),e=t.isFinished()):this.current.isIsoIec646()?(t=this.parseIsoIec646Block(),e=t.isFinished()):(t=this.parseNumericBlock(),e=t.isFinished()),n===this.current.getPosition()&&!e)break}while(!e);return t.getDecodedInformation()}parseNumericBlock(){for(;this.isStillNumeric(this.current.getPosition());){let e=this.decodeNumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFirstDigitFNC1()){let t;return t=e.isSecondDigitFNC1()?new Ve(this.current.getPosition(),this.buffer.toString()):new Ve(this.current.getPosition(),this.buffer.toString(),e.getSecondDigit()),new Be(!0,t)}if(this.buffer.append(e.getFirstDigit()),e.isSecondDigitFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}this.buffer.append(e.getSecondDigit())}return this.isNumericToAlphaNumericLatch(this.current.getPosition())&&(this.current.setAlpha(),this.current.incrementPosition(4)),new Be(!1)}parseIsoIec646Block(){for(;this.isStillIsoIec646(this.current.getPosition());){let e=this.decodeIsoIec646(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setAlpha()),new Be(!1)}parseAlphaBlock(){for(;this.isStillAlpha(this.current.getPosition());){let e=this.decodeAlphanumeric(this.current.getPosition());if(this.current.setPosition(e.getNewPosition()),e.isFNC1()){let e=new Ve(this.current.getPosition(),this.buffer.toString());return new Be(!0,e)}this.buffer.append(e.getValue())}return this.isAlphaOr646ToNumericLatch(this.current.getPosition())?(this.current.incrementPosition(3),this.current.setNumeric()):this.isAlphaTo646ToAlphaLatch(this.current.getPosition())&&(this.current.getPosition()+5<this.information.getSize()?this.current.incrementPosition(5):this.current.setPosition(this.information.getSize()),this.current.setIsoIec646()),new Be(!1)}isStillIsoIec646(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+7>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,7);if(n>=64&&n<116)return!0;if(e+8>this.information.getSize())return!1;let r=this.extractNumericValueFromBitArray(e,8);return r>=232&&r<253}decodeIsoIec646(e){let t=this.extractNumericValueFromBitArray(e,5);if(15===t)return new Fe(e+5,Fe.FNC1);if(t>=5&&t<15)return new Fe(e+5,"0"+(t-5));let n,r=this.extractNumericValueFromBitArray(e,7);if(r>=64&&r<90)return new Fe(e+7,""+(r+1));if(r>=90&&r<116)return new Fe(e+7,""+(r+7));switch(this.extractNumericValueFromBitArray(e,8)){case 232:n="!";break;case 233:n='"';break;case 234:n="%";break;case 235:n="&";break;case 236:n="'";break;case 237:n="(";break;case 238:n=")";break;case 239:n="*";break;case 240:n="+";break;case 241:n=",";break;case 242:n="-";break;case 243:n=".";break;case 244:n="/";break;case 245:n=":";break;case 246:n=";";break;case 247:n="<";break;case 248:n="=";break;case 249:n=">";break;case 250:n="?";break;case 251:n="_";break;case 252:n=" ";break;default:throw new C}return new Fe(e+8,n)}isStillAlpha(e){if(e+5>this.information.getSize())return!1;let t=this.extractNumericValueFromBitArray(e,5);if(t>=5&&t<16)return!0;if(e+6>this.information.getSize())return!1;let n=this.extractNumericValueFromBitArray(e,6);return n>=16&&n<63}decodeAlphanumeric(e){let t=this.extractNumericValueFromBitArray(e,5);if(15===t)return new Fe(e+5,Fe.FNC1);if(t>=5&&t<15)return new Fe(e+5,"0"+(t-5));let n,r=this.extractNumericValueFromBitArray(e,6);if(r>=32&&r<58)return new Fe(e+6,""+(r+33));switch(r){case 58:n="*";break;case 59:n=",";break;case 60:n="-";break;case 61:n=".";break;case 62:n="/";break;default:throw new te("Decoding invalid alphanumeric value: "+r)}return new Fe(e+6,n)}isAlphaTo646ToAlphaLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<5&&t+e<this.information.getSize();++t)if(2===t){if(!this.information.get(e+2))return!1}else if(this.information.get(e+t))return!1;return!0}isAlphaOr646ToNumericLatch(e){if(e+3>this.information.getSize())return!1;for(let t=e;t<e+3;++t)if(this.information.get(t))return!1;return!0}isNumericToAlphaNumericLatch(e){if(e+1>this.information.getSize())return!1;for(let t=0;t<4&&t+e<this.information.getSize();++t)if(this.information.get(e+t))return!1;return!0}}class ze{constructor(e){this.information=e,this.generalDecoder=new We(e)}getInformation(){return this.information}getGeneralDecoder(){return this.generalDecoder}}class je extends ze{constructor(e){super(e)}encodeCompressedGtin(e,t){e.append("(01)");let n=e.length();e.append("9"),this.encodeCompressedGtinWithoutAI(e,t,n)}encodeCompressedGtinWithoutAI(e,t,n){for(let n=0;n<4;++n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t+10*n,10);r/100==0&&e.append("0"),r/10==0&&e.append("0"),e.append(r)}je.appendCheckDigit(e,n)}static appendCheckDigit(e,t){let n=0;for(let r=0;r<13;r++){let i=e.charAt(r+t).charCodeAt(0)-"0".charCodeAt(0);n+=1&r?i:3*i}n=10-n%10,10===n&&(n=0),e.append(n)}}je.GTIN_SIZE=40;class qe extends je{constructor(e){super(e)}parseInformation(){let e=new S;e.append("(01)");let t=e.length(),n=this.getGeneralDecoder().extractNumericValueFromBitArray(qe.HEADER_SIZE,4);return e.append(n),this.encodeCompressedGtinWithoutAI(e,qe.HEADER_SIZE+4,t),this.getGeneralDecoder().decodeAllCodes(e,qe.HEADER_SIZE+44)}}qe.HEADER_SIZE=4;class Ge extends ze{constructor(e){super(e)}parseInformation(){let e=new S;return this.getGeneralDecoder().decodeAllCodes(e,Ge.HEADER_SIZE)}}Ge.HEADER_SIZE=5;class Xe extends je{constructor(e){super(e)}encodeCompressedWeight(e,t,n){let r=this.getGeneralDecoder().extractNumericValueFromBitArray(t,n);this.addWeightCode(e,r);let i=this.checkWeight(r),o=1e5;for(let t=0;t<5;++t)i/o===0&&e.append("0"),o/=10;e.append(i)}}class Ye extends Xe{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()!=Ye.HEADER_SIZE+Xe.GTIN_SIZE+Ye.WEIGHT_SIZE)throw new N;let e=new S;return this.encodeCompressedGtin(e,Ye.HEADER_SIZE),this.encodeCompressedWeight(e,Ye.HEADER_SIZE+Xe.GTIN_SIZE,Ye.WEIGHT_SIZE),e.toString()}}Ye.HEADER_SIZE=5,Ye.WEIGHT_SIZE=15;class Ze extends Ye{constructor(e){super(e)}addWeightCode(e,t){e.append("(3103)")}checkWeight(e){return e}}class Ke extends Ye{constructor(e){super(e)}addWeightCode(e,t){t<1e4?e.append("(3202)"):e.append("(3203)")}checkWeight(e){return e<1e4?e:e-1e4}}class Qe extends je{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Qe.HEADER_SIZE+je.GTIN_SIZE)throw new N;let e=new S;this.encodeCompressedGtin(e,Qe.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Qe.HEADER_SIZE+je.GTIN_SIZE,Qe.LAST_DIGIT_SIZE);e.append("(392"),e.append(t),e.append(")");let n=this.getGeneralDecoder().decodeGeneralPurposeField(Qe.HEADER_SIZE+je.GTIN_SIZE+Qe.LAST_DIGIT_SIZE,null);return e.append(n.getNewString()),e.toString()}}Qe.HEADER_SIZE=8,Qe.LAST_DIGIT_SIZE=2;class Je extends je{constructor(e){super(e)}parseInformation(){if(this.getInformation().getSize()<Je.HEADER_SIZE+je.GTIN_SIZE)throw new N;let e=new S;this.encodeCompressedGtin(e,Je.HEADER_SIZE);let t=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+je.GTIN_SIZE,Je.LAST_DIGIT_SIZE);e.append("(393"),e.append(t),e.append(")");let n=this.getGeneralDecoder().extractNumericValueFromBitArray(Je.HEADER_SIZE+je.GTIN_SIZE+Je.LAST_DIGIT_SIZE,Je.FIRST_THREE_DIGITS_SIZE);n/100==0&&e.append("0"),n/10==0&&e.append("0"),e.append(n);let r=this.getGeneralDecoder().decodeGeneralPurposeField(Je.HEADER_SIZE+je.GTIN_SIZE+Je.LAST_DIGIT_SIZE+Je.FIRST_THREE_DIGITS_SIZE,null);return e.append(r.getNewString()),e.toString()}}Je.HEADER_SIZE=8,Je.LAST_DIGIT_SIZE=2,Je.FIRST_THREE_DIGITS_SIZE=10;class et extends Xe{constructor(e,t,n){super(e),this.dateCode=n,this.firstAIdigits=t}parseInformation(){if(this.getInformation().getSize()!=et.HEADER_SIZE+et.GTIN_SIZE+et.WEIGHT_SIZE+et.DATE_SIZE)throw new N;let e=new S;return this.encodeCompressedGtin(e,et.HEADER_SIZE),this.encodeCompressedWeight(e,et.HEADER_SIZE+et.GTIN_SIZE,et.WEIGHT_SIZE),this.encodeCompressedDate(e,et.HEADER_SIZE+et.GTIN_SIZE+et.WEIGHT_SIZE),e.toString()}encodeCompressedDate(e,t){let n=this.getGeneralDecoder().extractNumericValueFromBitArray(t,et.DATE_SIZE);if(38400==n)return;e.append("("),e.append(this.dateCode),e.append(")");let r=n%32;n/=32;let i=n%12+1;n/=12;let o=n;o/10==0&&e.append("0"),e.append(o),i/10==0&&e.append("0"),e.append(i),r/10==0&&e.append("0"),e.append(r)}addWeightCode(e,t){e.append("("),e.append(this.firstAIdigits),e.append(t/1e5),e.append(")")}checkWeight(e){return e%1e5}}function tt(e){try{if(e.get(1))return new qe(e);if(!e.get(2))return new Ge(e);switch(We.extractNumericValueFromBitArray(e,1,4)){case 4:return new Ze(e);case 5:return new Ke(e)}switch(We.extractNumericValueFromBitArray(e,1,5)){case 12:return new Qe(e);case 13:return new Je(e)}switch(We.extractNumericValueFromBitArray(e,1,7)){case 56:return new et(e,"310","11");case 57:return new et(e,"320","11");case 58:return new et(e,"310","13");case 59:return new et(e,"320","13");case 60:return new et(e,"310","15");case 61:return new et(e,"320","15");case 62:return new et(e,"310","17");case 63:return new et(e,"320","17")}}catch(t){throw console.log(t),new te("unknown decoder: "+e)}}et.HEADER_SIZE=8,et.WEIGHT_SIZE=20,et.DATE_SIZE=16;class nt{constructor(e,t,n,r){this.leftchar=e,this.rightchar=t,this.finderpattern=n,this.maybeLast=r}mayBeLast(){return this.maybeLast}getLeftChar(){return this.leftchar}getRightChar(){return this.rightchar}getFinderPattern(){return this.finderpattern}mustBeLast(){return null==this.rightchar}toString(){return"[ "+this.leftchar+", "+this.rightchar+" : "+(null==this.finderpattern?"null":this.finderpattern.getValue())+" ]"}static equals(e,t){return e instanceof nt&&nt.equalsOrNull(e.leftchar,t.leftchar)&&nt.equalsOrNull(e.rightchar,t.rightchar)&&nt.equalsOrNull(e.finderpattern,t.finderpattern)}static equalsOrNull(e,t){return null===e?null===t:nt.equals(e,t)}hashCode(){return this.leftchar.getValue()^this.rightchar.getValue()^this.finderpattern.getValue()}}class rt{constructor(e,t,n){this.pairs=e,this.rowNumber=t,this.wasReversed=n}getPairs(){return this.pairs}getRowNumber(){return this.rowNumber}isReversed(){return this.wasReversed}isEquivalent(e){return this.checkEqualitity(this,e)}toString(){return"{ "+this.pairs+" }"}equals(e,t){return e instanceof rt&&this.checkEqualitity(e,t)&&e.wasReversed===t.wasReversed}checkEqualitity(e,t){if(!e||!t)return;let n;return e.forEach((e,r)=>{t.forEach(t=>{e.getLeftChar().getValue()===t.getLeftChar().getValue()&&e.getRightChar().getValue()===t.getRightChar().getValue()&&e.getFinderPatter().getValue()===t.getFinderPatter().getValue()&&(n=!0)})}),n}}class it extends xe{constructor(e){super(...arguments),this.pairs=new Array(it.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=!0===e}decodeRow(e,t,n){this.pairs.length=0,this.startFromEven=!1;try{return it.constructResult(this.decodeRow2pairs(e,t))}catch(e){this.verbose&&console.log(e)}return this.pairs.length=0,this.startFromEven=!0,it.constructResult(this.decodeRow2pairs(e,t))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(e,t){let n,r=!1;for(;!r;)try{this.pairs.push(this.retrieveNextPair(t,this.pairs,e))}catch(e){if(e instanceof N){if(!this.pairs.length)throw new N;r=!0}}if(this.checkChecksum())return this.pairs;if(n=!!this.rows.length,this.storeRow(e,!1),n){let e=this.checkRowsBoolean(!1);if(null!=e)return e;if(e=this.checkRowsBoolean(!0),null!=e)return e}throw new N}checkRowsBoolean(e){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,e&&(this.rows=this.rows.reverse());let t=null;try{t=this.checkRows(new Array,0)}catch(e){this.verbose&&console.log(e)}return e&&(this.rows=this.rows.reverse()),t}checkRows(e,t){for(let n=t;n<this.rows.length;n++){let t=this.rows[n];this.pairs.length=0;for(let t of e)this.pairs.push(t.getPairs());if(this.pairs.push(t.getPairs()),!it.isValidSequence(this.pairs))continue;if(this.checkChecksum())return this.pairs;let r=new Array(e);r.push(t);try{return this.checkRows(r,n+1)}catch(e){this.verbose&&console.log(e)}}throw new N}static isValidSequence(e){for(let t of it.FINDER_PATTERN_SEQUENCES){if(e.length>t.length)continue;let n=!0;for(let r=0;r<e.length;r++)if(e[r].getFinderPattern().getValue()!=t[r]){n=!1;break}if(n)return!0}return!1}storeRow(e,t){let n=0,r=!1,i=!1;for(;n<this.rows.length;){let t=this.rows[n];if(t.getRowNumber()>e){i=t.isEquivalent(this.pairs);break}r=t.isEquivalent(this.pairs),n++}i||r||it.isPartialRow(this.pairs,this.rows)||(this.rows.push(n,new rt(this.pairs,e,t)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(e,t){for(let n of t)if(n.getPairs().length!==e.length)for(let t of n.getPairs())for(let n of e)if(nt.equals(t,n))break}static isPartialRow(e,t){for(let n of t){let t=!0;for(let r of e){let e=!1;for(let t of n.getPairs())if(r.equals(t)){e=!0;break}if(!e){t=!1;break}}if(t)return!0}return!1}getRows(){return this.rows}static constructResult(e){let t=tt(Pe.buildBitArray(e)).parseInformation(),n=e[0].getFinderPattern().getResultPoints(),r=e[e.length-1].getFinderPattern().getResultPoints(),i=[n[0],n[1],r[0],r[1]];return new F(t,null,null,i,U.RSS_EXPANDED,null)}checkChecksum(){let e=this.pairs.get(0),t=e.getLeftChar(),n=e.getRightChar();if(null==n)return!1;let r=n.getChecksumPortion(),i=2;for(let e=1;e<this.pairs.size();++e){let t=this.pairs.get(e);r+=t.getLeftChar().getChecksumPortion(),i++;let n=t.getRightChar();null!=n&&(r+=n.getChecksumPortion(),i++)}return r%=211,211*(i-4)+r==t.getValue()}static getNextSecondBar(e,t){let n;return e.get(t)?(n=e.getNextUnset(t),n=e.getNextSet(n)):(n=e.getNextSet(t),n=e.getNextUnset(n)),n}retrieveNextPair(e,t,n){let r,i=t.length%2==0;this.startFromEven&&(i=!i);let o=!0,s=-1;do{this.findNextPair(e,t,s),r=this.parseFoundFinderPattern(e,n,i),null==r?s=it.getNextSecondBar(e,this.startEnd[0]):o=!1}while(o);let a,l=this.decodeDataCharacter(e,r,i,!0);if(!this.isEmptyPair(t)&&t[t.length-1].mustBeLast())throw new N;try{a=this.decodeDataCharacter(e,r,i,!1)}catch(e){a=null,this.verbose&&console.log(e)}return new nt(l,a,r,!0)}isEmptyPair(e){return 0===e.length}findNextPair(e,t,n){let r=this.getDecodeFinderCounters();r[0]=0,r[1]=0,r[2]=0,r[3]=0;let i,o=e.getSize();i=n>=0?n:this.isEmptyPair(t)?0:t[t.length-1].getFinderPattern().getStartEnd()[1];let s=t.length%2!=0;this.startFromEven&&(s=!s);let a=!1;for(;i<o&&(a=!e.get(i),a);)i++;let l=0,c=i;for(let t=i;t<o;t++)if(e.get(t)!=a)r[l]++;else{if(3==l){if(s&&it.reverseCounters(r),it.isFinderPattern(r))return this.startEnd[0]=c,void(this.startEnd[1]=t);s&&it.reverseCounters(r),c+=r[0]+r[1],r[0]=r[2],r[1]=r[3],r[2]=0,r[3]=0,l--}else l++;r[l]=1,a=!a}throw new N}static reverseCounters(e){let t=e.length;for(let n=0;n<t/2;++n){let r=e[n];e[n]=e[t-n-1],e[t-n-1]=r}}parseFoundFinderPattern(e,t,n){let r,i,o;if(n){let t=this.startEnd[0]-1;for(;t>=0&&!e.get(t);)t--;t++,r=this.startEnd[0]-t,i=t,o=this.startEnd[1]}else i=this.startEnd[0],o=e.getNextUnset(this.startEnd[1]+1),r=o-this.startEnd[1];let s,a=this.getDecodeFinderCounters();m.arraycopy(a,0,a,1,a.length-1),a[0]=r;try{s=this.parseFinderValue(a,it.FINDER_PATTERNS)}catch(e){return null}return new ke(s,[i,o],i,o,t)}decodeDataCharacter(e,t,n,r){let i=this.getDataCharacterCounters();for(let e=0;e<i.length;e++)i[e]=0;if(r)it.recordPatternInReverse(e,t.getStartEnd()[0],i);else{it.recordPattern(e,t.getStartEnd()[1],i);for(let e=0,t=i.length-1;e<t;e++,t--){let n=i[e];i[e]=i[t],i[t]=n}}let o=17,s=ie.sum(new Int32Array(i))/o,a=(t.getStartEnd()[1]-t.getStartEnd()[0])/15;if(Math.abs(s-a)/a>.3)throw new N;let l=this.getOddCounts(),c=this.getEvenCounts(),d=this.getOddRoundingErrors(),u=this.getEvenRoundingErrors();for(let e=0;e<i.length;e++){let t=1*i[e]/s,n=t+.5;if(n<1){if(t<.3)throw new N;n=1}else if(n>8){if(t>8.7)throw new N;n=8}let r=e/2;1&e?(c[r]=n,u[r]=t-n):(l[r]=n,d[r]=t-n)}this.adjustOddEvenCounts(o);let h=4*t.getValue()+(n?0:2)+(r?0:1)-1,f=0,m=0;for(let e=l.length-1;e>=0;e--){if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[h][2*e];m+=l[e]*t}f+=l[e]}let p=0;for(let e=c.length-1;e>=0;e--)if(it.isNotA1left(t,n,r)){let t=it.WEIGHTS[h][2*e+1];p+=c[e]*t}let g=m+p;if(1&f||f>13||f<4)throw new N;let w=(13-f)/2,y=it.SYMBOL_WIDEST[w],v=9-y,I=Me.getRSSvalue(l,y,!0),_=Me.getRSSvalue(c,v,!1),C=it.EVEN_TOTAL_SUBSET[w],E=it.GSUM[w];return new Oe(I*C+_+E,g)}static isNotA1left(e,t,n){return!(0==e.getValue()&&t&&n)}adjustOddEvenCounts(e){let t=ie.sum(new Int32Array(this.getOddCounts())),n=ie.sum(new Int32Array(this.getEvenCounts())),r=!1,i=!1;t>13?i=!0:t<4&&(r=!0);let o=!1,s=!1;n>13?s=!0:n<4&&(o=!0);let a=t+n-e,l=!(1&~t),c=!(1&n);if(1==a)if(l){if(c)throw new N;i=!0}else{if(!c)throw new N;s=!0}else if(-1==a)if(l){if(c)throw new N;r=!0}else{if(!c)throw new N;o=!0}else{if(0!=a)throw new N;if(l){if(!c)throw new N;t<n?(r=!0,s=!0):(i=!0,o=!0)}else if(c)throw new N}if(r){if(i)throw new N;it.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(i&&it.decrement(this.getOddCounts(),this.getOddRoundingErrors()),o){if(s)throw new N;it.increment(this.getEvenCounts(),this.getOddRoundingErrors())}s&&it.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}it.SYMBOL_WIDEST=[7,5,4,3,1],it.EVEN_TOTAL_SUBSET=[4,20,52,104,204],it.GSUM=[0,348,1388,2948,3988],it.FINDER_PATTERNS=[Int32Array.from([1,8,4,1]),Int32Array.from([3,6,4,1]),Int32Array.from([3,4,6,1]),Int32Array.from([3,2,8,1]),Int32Array.from([2,6,5,1]),Int32Array.from([2,2,9,1])],it.WEIGHTS=[[1,3,9,27,81,32,96,77],[20,60,180,118,143,7,21,63],[189,145,13,39,117,140,209,205],[193,157,49,147,19,57,171,91],[62,186,136,197,169,85,44,132],[185,133,188,142,4,12,36,108],[113,128,173,97,80,29,87,50],[150,28,84,41,123,158,52,156],[46,138,203,187,139,206,196,166],[76,17,51,153,37,111,122,155],[43,129,176,106,107,110,119,146],[16,48,144,10,30,90,59,177],[109,116,137,200,178,112,125,164],[70,210,208,202,184,130,179,115],[134,191,151,31,93,68,204,190],[148,22,66,198,172,94,71,2],[6,18,54,162,64,192,154,40],[120,149,25,75,14,42,126,167],[79,26,78,23,69,207,199,175],[103,98,83,38,114,131,182,124],[161,61,183,127,170,88,53,159],[55,165,73,8,24,72,5,15],[45,135,194,160,58,174,100,89]],it.FINDER_PAT_A=0,it.FINDER_PAT_B=1,it.FINDER_PAT_C=2,it.FINDER_PAT_D=3,it.FINDER_PAT_E=4,it.FINDER_PAT_F=5,it.FINDER_PATTERN_SEQUENCES=[[it.FINDER_PAT_A,it.FINDER_PAT_A],[it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B],[it.FINDER_PAT_A,it.FINDER_PAT_C,it.FINDER_PAT_B,it.FINDER_PAT_D],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_C],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_D,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_E,it.FINDER_PAT_B,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_D],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_E],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F],[it.FINDER_PAT_A,it.FINDER_PAT_A,it.FINDER_PAT_B,it.FINDER_PAT_B,it.FINDER_PAT_C,it.FINDER_PAT_D,it.FINDER_PAT_D,it.FINDER_PAT_E,it.FINDER_PAT_E,it.FINDER_PAT_F,it.FINDER_PAT_F]],it.MAX_PAIRS=11;class ot extends Oe{constructor(e,t,n){super(e,t),this.count=0,this.finderPattern=n}getFinderPattern(){return this.finderPattern}getCount(){return this.count}incrementCount(){this.count++}}class st extends xe{constructor(){super(...arguments),this.possibleLeftPairs=[],this.possibleRightPairs=[]}decodeRow(e,t,n){const r=this.decodePair(t,!1,e,n);st.addOrTally(this.possibleLeftPairs,r),t.reverse();let i=this.decodePair(t,!0,e,n);st.addOrTally(this.possibleRightPairs,i),t.reverse();for(let e of this.possibleLeftPairs)if(e.getCount()>1)for(let t of this.possibleRightPairs)if(t.getCount()>1&&st.checkChecksum(e,t))return st.constructResult(e,t);throw new N}static addOrTally(e,t){if(null==t)return;let n=!1;for(let r of e)if(r.getValue()===t.getValue()){r.incrementCount(),n=!0;break}n||e.push(t)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(e,t){let n=4537077*e.getValue()+t.getValue(),r=new String(n).toString(),i=new S;for(let e=13-r.length;e>0;e--)i.append("0");i.append(r);let o=0;for(let e=0;e<13;e++){let t=i.charAt(e).charCodeAt(0)-"0".charCodeAt(0);o+=1&e?t:3*t}o=10-o%10,10===o&&(o=0),i.append(o.toString());let s=e.getFinderPattern().getResultPoints(),a=t.getFinderPattern().getResultPoints();return new F(i.toString(),null,0,[s[0],s[1],a[0],a[1]],U.RSS_14,(new Date).getTime())}static checkChecksum(e,t){let n=(e.getChecksumPortion()+16*t.getChecksumPortion())%79,r=9*e.getFinderPattern().getValue()+t.getFinderPattern().getValue();return r>72&&r--,r>8&&r--,n===r}decodePair(e,t,n,r){try{let i=this.findFinderPattern(e,t),o=this.parseFoundFinderPattern(e,n,t,i),s=null==r?null:r.get(_.NEED_RESULT_POINT_CALLBACK);if(null!=s){let r=(i[0]+i[1])/2;t&&(r=e.getSize()-1-r),s.foundPossibleResultPoint(new se(r,n))}let a=this.decodeDataCharacter(e,o,!0),l=this.decodeDataCharacter(e,o,!1);return new ot(1597*a.getValue()+l.getValue(),a.getChecksumPortion()+4*l.getChecksumPortion(),o)}catch(e){return null}}decodeDataCharacter(e,t,n){let r=this.getDataCharacterCounters();for(let e=0;e<r.length;e++)r[e]=0;if(n)ye.recordPatternInReverse(e,t.getStartEnd()[0],r);else{ye.recordPattern(e,t.getStartEnd()[1]+1,r);for(let e=0,t=r.length-1;e<t;e++,t--){let n=r[e];r[e]=r[t],r[t]=n}}let i=n?16:15,o=ie.sum(new Int32Array(r))/i,s=this.getOddCounts(),a=this.getEvenCounts(),l=this.getOddRoundingErrors(),c=this.getEvenRoundingErrors();for(let e=0;e<r.length;e++){let t=r[e]/o,n=Math.floor(t+.5);n<1?n=1:n>8&&(n=8);let i=Math.floor(e/2);1&e?(a[i]=n,c[i]=t-n):(s[i]=n,l[i]=t-n)}this.adjustOddEvenCounts(n,i);let d=0,u=0;for(let e=s.length-1;e>=0;e--)u*=9,u+=s[e],d+=s[e];let h=0,f=0;for(let e=a.length-1;e>=0;e--)h*=9,h+=a[e],f+=a[e];let m=u+3*h;if(n){if(1&d||d>12||d<4)throw new N;let e=(12-d)/2,t=st.OUTSIDE_ODD_WIDEST[e],n=9-t,r=Me.getRSSvalue(s,t,!1),i=Me.getRSSvalue(a,n,!0),o=st.OUTSIDE_EVEN_TOTAL_SUBSET[e],l=st.OUTSIDE_GSUM[e];return new Oe(r*o+i+l,m)}{if(1&f||f>10||f<4)throw new N;let e=(10-f)/2,t=st.INSIDE_ODD_WIDEST[e],n=9-t,r=Me.getRSSvalue(s,t,!0),i=Me.getRSSvalue(a,n,!1),o=st.INSIDE_ODD_TOTAL_SUBSET[e],l=st.INSIDE_GSUM[e];return new Oe(i*o+r+l,m)}}findFinderPattern(e,t){let n=this.getDecodeFinderCounters();n[0]=0,n[1]=0,n[2]=0,n[3]=0;let r=e.getSize(),i=!1,o=0;for(;o<r&&(i=!e.get(o),t!==i);)o++;let s=0,a=o;for(let t=o;t<r;t++)if(e.get(t)!==i)n[s]++;else{if(3===s){if(xe.isFinderPattern(n))return[a,t];a+=n[0]+n[1],n[0]=n[2],n[1]=n[3],n[2]=0,n[3]=0,s--}else s++;n[s]=1,i=!i}throw new N}parseFoundFinderPattern(e,t,n,r){let i=e.get(r[0]),o=r[0]-1;for(;o>=0&&i!==e.get(o);)o--;o++;const s=r[0]-o,a=this.getDecodeFinderCounters(),l=new Int32Array(a.length);m.arraycopy(a,0,l,1,a.length-1),l[0]=s;const c=this.parseFinderValue(l,st.FINDER_PATTERNS);let d=o,u=r[1];return n&&(d=e.getSize()-1-d,u=e.getSize()-1-u),new ke(c,[o,r[1]],d,u,t)}adjustOddEvenCounts(e,t){let n=ie.sum(new Int32Array(this.getOddCounts())),r=ie.sum(new Int32Array(this.getEvenCounts())),i=!1,o=!1,s=!1,a=!1;e?(n>12?o=!0:n<4&&(i=!0),r>12?a=!0:r<4&&(s=!0)):(n>11?o=!0:n<5&&(i=!0),r>10?a=!0:r<4&&(s=!0));let l=n+r-t,c=(1&n)==(e?1:0),d=!(1&~r);if(1===l)if(c){if(d)throw new N;o=!0}else{if(!d)throw new N;a=!0}else if(-1===l)if(c){if(d)throw new N;i=!0}else{if(!d)throw new N;s=!0}else{if(0!==l)throw new N;if(c){if(!d)throw new N;n<r?(i=!0,a=!0):(o=!0,s=!0)}else if(d)throw new N}if(i){if(o)throw new N;xe.increment(this.getOddCounts(),this.getOddRoundingErrors())}if(o&&xe.decrement(this.getOddCounts(),this.getOddRoundingErrors()),s){if(a)throw new N;xe.increment(this.getEvenCounts(),this.getOddRoundingErrors())}a&&xe.decrement(this.getEvenCounts(),this.getEvenRoundingErrors())}}st.OUTSIDE_EVEN_TOTAL_SUBSET=[1,10,34,70,126],st.INSIDE_ODD_TOTAL_SUBSET=[4,20,48,81],st.OUTSIDE_GSUM=[0,161,961,2015,2715],st.INSIDE_GSUM=[0,336,1036,1516],st.OUTSIDE_ODD_WIDEST=[8,6,4,3,1],st.INSIDE_ODD_WIDEST=[2,4,6,8],st.FINDER_PATTERNS=[Int32Array.from([3,8,2,1]),Int32Array.from([3,5,5,1]),Int32Array.from([3,3,7,1]),Int32Array.from([3,1,9,1]),Int32Array.from([2,7,4,1]),Int32Array.from([2,5,6,1]),Int32Array.from([2,3,8,1]),Int32Array.from([1,5,7,1]),Int32Array.from([1,3,9,1])];class at extends ye{constructor(e,t){super(),this.readers=[],this.verbose=!0===t;const n=e?e.get(_.POSSIBLE_FORMATS):null,r=e&&void 0!==e.get(_.ASSUME_CODE_39_CHECK_DIGIT);n?((n.includes(U.EAN_13)||n.includes(U.UPC_A)||n.includes(U.EAN_8)||n.includes(U.UPC_E))&&this.readers.push(new De(e)),n.includes(U.CODE_39)&&this.readers.push(new Ie(r)),n.includes(U.CODE_128)&&this.readers.push(new ve),n.includes(U.ITF)&&this.readers.push(new _e),n.includes(U.RSS_14)&&this.readers.push(new st),n.includes(U.RSS_EXPANDED)&&this.readers.push(new it(this.verbose))):(this.readers.push(new De(e)),this.readers.push(new Ie),this.readers.push(new De(e)),this.readers.push(new ve),this.readers.push(new _e),this.readers.push(new st),this.readers.push(new it(this.verbose)))}decodeRow(e,t,n){for(let r=0;r<this.readers.length;r++)try{return this.readers[r].decodeRow(e,t,n)}catch(e){}throw new N}reset(){this.readers.forEach(e=>e.reset())}}class lt extends L{constructor(e=500,t){super(new at(t),e,t)}}class ct{constructor(e,t,n){this.ecCodewords=e,this.ecBlocks=[t],n&&this.ecBlocks.push(n)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class dt{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class ut{constructor(e,t,n,r,i,o){this.versionNumber=e,this.symbolSizeRows=t,this.symbolSizeColumns=n,this.dataRegionSizeRows=r,this.dataRegionSizeColumns=i,this.ecBlocks=o;let s=0;const a=o.getECCodewords(),l=o.getECBlocks();for(let e of l)s+=e.getCount()*(e.getDataCodewords()+a);this.totalCodewords=s}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(e,t){if(1&e||1&t)throw new C;for(let n of ut.VERSIONS)if(n.symbolSizeRows===e&&n.symbolSizeColumns===t)return n;throw new C}toString(){return""+this.versionNumber}static buildVersions(){return[new ut(1,10,10,8,8,new ct(5,new dt(1,3))),new ut(2,12,12,10,10,new ct(7,new dt(1,5))),new ut(3,14,14,12,12,new ct(10,new dt(1,8))),new ut(4,16,16,14,14,new ct(12,new dt(1,12))),new ut(5,18,18,16,16,new ct(14,new dt(1,18))),new ut(6,20,20,18,18,new ct(18,new dt(1,22))),new ut(7,22,22,20,20,new ct(20,new dt(1,30))),new ut(8,24,24,22,22,new ct(24,new dt(1,36))),new ut(9,26,26,24,24,new ct(28,new dt(1,44))),new ut(10,32,32,14,14,new ct(36,new dt(1,62))),new ut(11,36,36,16,16,new ct(42,new dt(1,86))),new ut(12,40,40,18,18,new ct(48,new dt(1,114))),new ut(13,44,44,20,20,new ct(56,new dt(1,144))),new ut(14,48,48,22,22,new ct(68,new dt(1,174))),new ut(15,52,52,24,24,new ct(42,new dt(2,102))),new ut(16,64,64,14,14,new ct(56,new dt(2,140))),new ut(17,72,72,16,16,new ct(36,new dt(4,92))),new ut(18,80,80,18,18,new ct(48,new dt(4,114))),new ut(19,88,88,20,20,new ct(56,new dt(4,144))),new ut(20,96,96,22,22,new ct(68,new dt(4,174))),new ut(21,104,104,24,24,new ct(56,new dt(6,136))),new ut(22,120,120,18,18,new ct(68,new dt(6,175))),new ut(23,132,132,20,20,new ct(62,new dt(8,163))),new ut(24,144,144,22,22,new ct(62,new dt(8,156),new dt(2,155))),new ut(25,8,18,6,16,new ct(7,new dt(1,5))),new ut(26,8,32,6,14,new ct(11,new dt(1,10))),new ut(27,12,26,10,24,new ct(14,new dt(1,16))),new ut(28,12,36,10,16,new ct(18,new dt(1,22))),new ut(29,16,36,14,16,new ct(24,new dt(1,32))),new ut(30,16,48,14,22,new ct(28,new dt(1,49)))]}}ut.VERSIONS=ut.buildVersions();class ht{constructor(e){const t=e.getHeight();if(t<8||t>144||1&t)throw new C;this.version=ht.readVersion(e),this.mappingBitMatrix=this.extractDataRegion(e),this.readMappingMatrix=new T(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(e){const t=e.getHeight(),n=e.getWidth();return ut.getVersionForDimensions(t,n)}readCodewords(){const e=new Int8Array(this.version.getTotalCodewords());let t=0,n=4,r=0;const i=this.mappingBitMatrix.getHeight(),o=this.mappingBitMatrix.getWidth();let s=!1,a=!1,l=!1,c=!1;do{if(n!==i||0!==r||s)if(n===i-2&&0===r&&3&o&&!a)e[t++]=255&this.readCorner2(i,o),n-=2,r+=2,a=!0;else if(n!==i+4||2!==r||7&o||l)if(n!==i-2||0!==r||4!=(7&o)||c){do{n<i&&r>=0&&!this.readMappingMatrix.get(r,n)&&(e[t++]=255&this.readUtah(n,r,i,o)),n-=2,r+=2}while(n>=0&&r<o);n+=1,r+=3;do{n>=0&&r<o&&!this.readMappingMatrix.get(r,n)&&(e[t++]=255&this.readUtah(n,r,i,o)),n+=2,r-=2}while(n<i&&r>=0);n+=3,r+=1}else e[t++]=255&this.readCorner4(i,o),n-=2,r+=2,c=!0;else e[t++]=255&this.readCorner3(i,o),n-=2,r+=2,l=!0;else e[t++]=255&this.readCorner1(i,o),n-=2,r+=2,s=!0}while(n<i||r<o);if(t!==this.version.getTotalCodewords())throw new C;return e}readModule(e,t,n,r){return e<0&&(e+=n,t+=4-(n+4&7)),t<0&&(t+=r,e+=4-(r+4&7)),this.readMappingMatrix.set(t,e),this.mappingBitMatrix.get(t,e)}readUtah(e,t,n,r){let i=0;return this.readModule(e-2,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-2,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e-1,t,n,r)&&(i|=1),i<<=1,this.readModule(e,t-2,n,r)&&(i|=1),i<<=1,this.readModule(e,t-1,n,r)&&(i|=1),i<<=1,this.readModule(e,t,n,r)&&(i|=1),i}readCorner1(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,1,e,t)&&(n|=1),n<<=1,this.readModule(e-1,2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}readCorner2(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-4,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner3(e,t){let n=0;return this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(0,t-3,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-3,e,t)&&(n|=1),n<<=1,this.readModule(1,t-2,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n}readCorner4(e,t){let n=0;return this.readModule(e-3,0,e,t)&&(n|=1),n<<=1,this.readModule(e-2,0,e,t)&&(n|=1),n<<=1,this.readModule(e-1,0,e,t)&&(n|=1),n<<=1,this.readModule(0,t-2,e,t)&&(n|=1),n<<=1,this.readModule(0,t-1,e,t)&&(n|=1),n<<=1,this.readModule(1,t-1,e,t)&&(n|=1),n<<=1,this.readModule(2,t-1,e,t)&&(n|=1),n<<=1,this.readModule(3,t-1,e,t)&&(n|=1),n}extractDataRegion(e){const t=this.version.getSymbolSizeRows(),n=this.version.getSymbolSizeColumns();if(e.getHeight()!==t)throw new d("Dimension of bitMatrix must match the version size");const r=this.version.getDataRegionSizeRows(),i=this.version.getDataRegionSizeColumns(),o=t/r|0,s=n/i|0,a=new T(s*i,o*r);for(let t=0;t<o;++t){const n=t*r;for(let o=0;o<s;++o){const s=o*i;for(let l=0;l<r;++l){const c=t*(r+2)+1+l,d=n+l;for(let t=0;t<i;++t){const n=o*(i+2)+1+t;if(e.get(n,c)){const e=s+t;a.set(e,d)}}}}}return a}}class ft{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t){const n=t.getECBlocks();let r=0;const i=n.getECBlocks();for(let e of i)r+=e.getCount();const o=new Array(r);let s=0;for(let e of i)for(let t=0;t<e.getCount();t++){const t=e.getDataCodewords(),r=n.getECCodewords()+t;o[s++]=new ft(t,new Uint8Array(r))}const a=o[0].codewords.length-n.getECCodewords(),l=a-1;let c=0;for(let t=0;t<l;t++)for(let n=0;n<s;n++)o[n].codewords[t]=e[c++];const u=24===t.getVersionNumber(),h=u?8:s;for(let t=0;t<h;t++)o[t].codewords[a-1]=e[c++];const f=o[0].codewords.length;for(let t=a;t<f;t++)for(let n=0;n<s;n++){const r=u?(n+8)%s:n,i=u&&r>7?t-1:t;o[r].codewords[i]=e[c++]}if(c!==e.length)throw new d;return o}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class mt{constructor(e){this.bytes=e,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(e){if(e<1||e>32||e>this.available())throw new d(""+e);let t=0,n=this.bitOffset,r=this.byteOffset;const i=this.bytes;if(n>0){const o=8-n,s=e<o?e:o,a=o-s,l=255>>8-s<<a;t=(i[r]&l)>>a,e-=s,n+=s,8===n&&(n=0,r++)}if(e>0){for(;e>=8;)t=t<<8|255&i[r],r++,e-=8;if(e>0){const o=8-e,s=255>>o<<o;t=t<<e|(i[r]&s)>>o,n+=e}}return this.bitOffset=n,this.byteOffset=r,t}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}!function(e){e[e.PAD_ENCODE=0]="PAD_ENCODE",e[e.ASCII_ENCODE=1]="ASCII_ENCODE",e[e.C40_ENCODE=2]="C40_ENCODE",e[e.TEXT_ENCODE=3]="TEXT_ENCODE",e[e.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",e[e.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",e[e.BASE256_ENCODE=6]="BASE256_ENCODE"}(W||(W={}));class pt{static decode(e){const t=new mt(e),n=new S,r=new S,i=new Array;let o=W.ASCII_ENCODE;do{if(o===W.ASCII_ENCODE)o=this.decodeAsciiSegment(t,n,r);else{switch(o){case W.C40_ENCODE:this.decodeC40Segment(t,n);break;case W.TEXT_ENCODE:this.decodeTextSegment(t,n);break;case W.ANSIX12_ENCODE:this.decodeAnsiX12Segment(t,n);break;case W.EDIFACT_ENCODE:this.decodeEdifactSegment(t,n);break;case W.BASE256_ENCODE:this.decodeBase256Segment(t,n,i);break;default:throw new C}o=W.ASCII_ENCODE}}while(o!==W.PAD_ENCODE&&t.available()>0);return r.length()>0&&n.append(r.toString()),new Y(e,n.toString(),0===i.length?null:i,null)}static decodeAsciiSegment(e,t,n){let r=!1;do{let i=e.readBits(8);if(0===i)throw new C;if(i<=128)return r&&(i+=128),t.append(String.fromCharCode(i-1)),W.ASCII_ENCODE;if(129===i)return W.PAD_ENCODE;if(i<=229){const e=i-130;e<10&&t.append("0"),t.append(""+e)}else switch(i){case 230:return W.C40_ENCODE;case 231:return W.BASE256_ENCODE;case 232:t.append(String.fromCharCode(29));break;case 233:case 234:case 241:break;case 235:r=!0;break;case 236:t.append("[)>05"),n.insert(0,"");break;case 237:t.append("[)>06"),n.insert(0,"");break;case 238:return W.ANSIX12_ENCODE;case 239:return W.TEXT_ENCODE;case 240:return W.EDIFACT_ENCODE;default:if(254!==i||0!==e.available())throw new C}}while(e.available()>0);return W.ASCII_ENCODE}static decodeC40Segment(e,t){let n=!1;const r=[];let i=0;do{if(8===e.available())return;const o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),r);for(let e=0;e<3;e++){const o=r[e];switch(i){case 0:if(o<3)i=o+1;else{if(!(o<this.C40_BASIC_SET_CHARS.length))throw new C;{const e=this.C40_BASIC_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}}break;case 1:n?(t.append(String.fromCharCode(o+128)),n=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.C40_SHIFT2_SET_CHARS.length){const e=this.C40_SHIFT2_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}else switch(o){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new C}i=0;break;case 3:n?(t.append(String.fromCharCode(o+224)),n=!1):t.append(String.fromCharCode(o+96)),i=0;break;default:throw new C}}}while(e.available()>0)}static decodeTextSegment(e,t){let n=!1,r=[],i=0;do{if(8===e.available())return;const o=e.readBits(8);if(254===o)return;this.parseTwoBytes(o,e.readBits(8),r);for(let e=0;e<3;e++){const o=r[e];switch(i){case 0:if(o<3)i=o+1;else{if(!(o<this.TEXT_BASIC_SET_CHARS.length))throw new C;{const e=this.TEXT_BASIC_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}}break;case 1:n?(t.append(String.fromCharCode(o+128)),n=!1):t.append(String.fromCharCode(o)),i=0;break;case 2:if(o<this.TEXT_SHIFT2_SET_CHARS.length){const e=this.TEXT_SHIFT2_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e)}else switch(o){case 27:t.append(String.fromCharCode(29));break;case 30:n=!0;break;default:throw new C}i=0;break;case 3:if(!(o<this.TEXT_SHIFT3_SET_CHARS.length))throw new C;{const e=this.TEXT_SHIFT3_SET_CHARS[o];n?(t.append(String.fromCharCode(e.charCodeAt(0)+128)),n=!1):t.append(e),i=0}break;default:throw new C}}}while(e.available()>0)}static decodeAnsiX12Segment(e,t){const n=[];do{if(8===e.available())return;const r=e.readBits(8);if(254===r)return;this.parseTwoBytes(r,e.readBits(8),n);for(let e=0;e<3;e++){const r=n[e];switch(r){case 0:t.append("\r");break;case 1:t.append("*");break;case 2:t.append(">");break;case 3:t.append(" ");break;default:if(r<14)t.append(String.fromCharCode(r+44));else{if(!(r<40))throw new C;t.append(String.fromCharCode(r+51))}}}}while(e.available()>0)}static parseTwoBytes(e,t,n){let r=(e<<8)+t-1,i=Math.floor(r/1600);n[0]=i,r-=1600*i,i=Math.floor(r/40),n[1]=i,n[2]=r-40*i}static decodeEdifactSegment(e,t){do{if(e.available()<=16)return;for(let n=0;n<4;n++){let n=e.readBits(6);if(31===n){const t=8-e.getBitOffset();return void(8!==t&&e.readBits(t))}32&n||(n|=64),t.append(String.fromCharCode(n))}}while(e.available()>0)}static decodeBase256Segment(e,t,n){let r=1+e.getByteOffset();const i=this.unrandomize255State(e.readBits(8),r++);let o;if(o=0===i?e.available()/8|0:i<250?i:250*(i-249)+this.unrandomize255State(e.readBits(8),r++),o<0)throw new C;const s=new Uint8Array(o);for(let t=0;t<o;t++){if(e.available()<8)throw new C;s[t]=this.unrandomize255State(e.readBits(8),r++)}n.push(s);try{t.append($.decode(s,b.ISO88591))}catch(e){throw new te("Platform does not support required encoding: "+e.message)}}static unrandomize255State(e,t){const n=e-(149*t%255+1);return n>=0?n:n+256}}pt.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],pt.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],pt.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],pt.TEXT_SHIFT2_SET_CHARS=pt.C40_SHIFT2_SET_CHARS,pt.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",String.fromCharCode(127)];class gt{constructor(){this.rsDecoder=new ne(J.DATA_MATRIX_FIELD_256)}decode(e){const t=new ht(e),n=t.getVersion(),r=t.readCodewords(),i=ft.getDataBlocks(r,n);let o=0;for(let e of i)o+=e.getNumDataCodewords();const s=new Uint8Array(o),a=i.length;for(let e=0;e<a;e++){const t=i[e],n=t.getCodewords(),r=t.getNumDataCodewords();this.correctErrors(n,r);for(let t=0;t<r;t++)s[t*a+e]=n[t]}return pt.decode(s)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch(e){throw new h}for(let r=0;r<t;r++)e[r]=n[r]}}class wt{constructor(e){this.image=e,this.rectangleDetector=new ce(this.image)}detect(){const e=this.rectangleDetector.detect();let t=this.detectSolid1(e);if(t=this.detectSolid2(t),t[3]=this.correctTopRight(t),!t[3])throw new N;t=this.shiftToModuleCenter(t);const n=t[0],r=t[1],i=t[2],o=t[3];let s=this.transitionsBetween(n,o)+1,a=this.transitionsBetween(i,o)+1;1&~s||(s+=1),1&~a||(a+=1),4*s<7*a&&4*a<7*s&&(s=a=Math.max(s,a));let l=wt.sampleGrid(this.image,n,r,i,o,s,a);return new ae(l,[n,r,i,o])}static shiftPoint(e,t,n){let r=(t.getX()-e.getX())/(n+1),i=(t.getY()-e.getY())/(n+1);return new se(e.getX()+r,e.getY()+i)}static moveAway(e,t,n){let r=e.getX(),i=e.getY();return r<t?r-=1:r+=1,i<n?i-=1:i+=1,new se(r,i)}detectSolid1(e){let t=e[0],n=e[1],r=e[3],i=e[2],o=this.transitionsBetween(t,n),s=this.transitionsBetween(n,r),a=this.transitionsBetween(r,i),l=this.transitionsBetween(i,t),c=o,d=[i,t,n,r];return c>s&&(c=s,d[0]=t,d[1]=n,d[2]=r,d[3]=i),c>a&&(c=a,d[0]=n,d[1]=r,d[2]=i,d[3]=t),c>l&&(d[0]=r,d[1]=i,d[2]=t,d[3]=n),d}detectSolid2(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i),s=wt.shiftPoint(n,r,4*(o+1)),a=wt.shiftPoint(r,n,4*(o+1));return this.transitionsBetween(s,t)<this.transitionsBetween(a,i)?(e[0]=t,e[1]=n,e[2]=r,e[3]=i):(e[0]=n,e[1]=r,e[2]=i,e[3]=t),e}correctTopRight(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i),s=this.transitionsBetween(n,i),a=wt.shiftPoint(t,n,4*(s+1)),l=wt.shiftPoint(r,n,4*(o+1));o=this.transitionsBetween(a,i),s=this.transitionsBetween(l,i);let c=new se(i.getX()+(r.getX()-n.getX())/(o+1),i.getY()+(r.getY()-n.getY())/(o+1)),d=new se(i.getX()+(t.getX()-n.getX())/(s+1),i.getY()+(t.getY()-n.getY())/(s+1));return this.isValid(c)?this.isValid(d)?this.transitionsBetween(a,c)+this.transitionsBetween(l,c)>this.transitionsBetween(a,d)+this.transitionsBetween(l,d)?c:d:c:this.isValid(d)?d:null}shiftToModuleCenter(e){let t=e[0],n=e[1],r=e[2],i=e[3],o=this.transitionsBetween(t,i)+1,s=this.transitionsBetween(r,i)+1,a=wt.shiftPoint(t,n,4*s),l=wt.shiftPoint(r,n,4*o);o=this.transitionsBetween(a,i)+1,s=this.transitionsBetween(l,i)+1,1&~o||(o+=1),1&~s||(s+=1);let c,d,u=(t.getX()+n.getX()+r.getX()+i.getX())/4,h=(t.getY()+n.getY()+r.getY()+i.getY())/4;return t=wt.moveAway(t,u,h),n=wt.moveAway(n,u,h),r=wt.moveAway(r,u,h),i=wt.moveAway(i,u,h),a=wt.shiftPoint(t,n,4*s),a=wt.shiftPoint(a,i,4*o),c=wt.shiftPoint(n,t,4*s),c=wt.shiftPoint(c,r,4*o),l=wt.shiftPoint(r,i,4*s),l=wt.shiftPoint(l,n,4*o),d=wt.shiftPoint(i,r,4*s),d=wt.shiftPoint(d,t,4*o),[a,c,l,d]}isValid(e){return e.getX()>=0&&e.getX()<this.image.getWidth()&&e.getY()>0&&e.getY()<this.image.getHeight()}static sampleGrid(e,t,n,r,i,o,s){return fe.getInstance().sampleGrid(e,o,s,.5,.5,o-.5,.5,o-.5,s-.5,.5,s-.5,t.getX(),t.getY(),i.getX(),i.getY(),r.getX(),r.getY(),n.getX(),n.getY())}transitionsBetween(e,t){let n=Math.trunc(e.getX()),r=Math.trunc(e.getY()),i=Math.trunc(t.getX()),o=Math.trunc(t.getY()),s=Math.abs(o-r)>Math.abs(i-n);if(s){let e=n;n=r,r=e,e=i,i=o,o=e}let a=Math.abs(i-n),l=Math.abs(o-r),c=-a/2,d=r<o?1:-1,u=n<i?1:-1,h=0,f=this.image.get(s?r:n,s?n:r);for(let e=n,t=r;e!==i;e+=u){let n=this.image.get(s?t:e,s?e:t);if(n!==f&&(h++,f=n),c+=l,c>0){if(t===o)break;t+=d,c-=a}}return h}}class yt{constructor(){this.decoder=new gt}decode(e,t=null){let n,r;if(null!=t&&t.has(_.PURE_BARCODE)){const t=yt.extractPureBits(e.getBlackMatrix());n=this.decoder.decode(t),r=yt.NO_POINTS}else{const t=new wt(e.getBlackMatrix()).detect();n=this.decoder.decode(t.getBits()),r=t.getPoints()}const i=n.getRawBytes(),o=new F(n.getText(),i,8*i.length,r,U.DATA_MATRIX,m.currentTimeMillis()),s=n.getByteSegments();null!=s&&o.putMetadata(X.BYTE_SEGMENTS,s);const a=n.getECLevel();return null!=a&&o.putMetadata(X.ERROR_CORRECTION_LEVEL,a),o}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null==t||null==n)throw new N;const r=this.moduleSize(t,e);let i=t[1];const o=n[1];let s=t[0];const a=(n[0]-s+1)/r,l=(o-i+1)/r;if(a<=0||l<=0)throw new N;const c=r/2;i+=c,s+=c;const d=new T(a,l);for(let t=0;t<l;t++){const n=i+t*r;for(let i=0;i<a;i++)e.get(s+i*r,n)&&d.set(i,t)}return d}static moduleSize(e,t){const n=t.getWidth();let r=e[0];const i=e[1];for(;r<n&&t.get(r,i);)r++;if(r===n)throw new N;const o=r-e[0];if(0===o)throw new N;return o}}yt.NO_POINTS=[];class vt extends L{constructor(e=500){super(new yt,e)}}!function(e){e[e.L=0]="L",e[e.M=1]="M",e[e.Q=2]="Q",e[e.H=3]="H"}(z||(z={}));class It{constructor(e,t,n){this.value=e,this.stringValue=t,this.bits=n,It.FOR_BITS.set(n,this),It.FOR_VALUE.set(e,this)}getValue(){return this.value}getBits(){return this.bits}static fromString(e){switch(e){case"L":return It.L;case"M":return It.M;case"Q":return It.Q;case"H":return It.H;default:throw new c(e+"not available")}}toString(){return this.stringValue}equals(e){if(!(e instanceof It))return!1;const t=e;return this.value===t.value}static forBits(e){if(e<0||e>=It.FOR_BITS.size)throw new d;return It.FOR_BITS.get(e)}}It.FOR_BITS=new Map,It.FOR_VALUE=new Map,It.L=new It(z.L,"L",1),It.M=new It(z.M,"M",0),It.Q=new It(z.Q,"Q",3),It.H=new It(z.H,"H",2);class _t{constructor(e){this.errorCorrectionLevel=It.forBits(e>>3&3),this.dataMask=7&e}static numBitsDiffering(e,t){return y.bitCount(e^t)}static decodeFormatInformation(e,t){const n=_t.doDecodeFormatInformation(e,t);return null!==n?n:_t.doDecodeFormatInformation(e^_t.FORMAT_INFO_MASK_QR,t^_t.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(e,t){let n=Number.MAX_SAFE_INTEGER,r=0;for(const i of _t.FORMAT_INFO_DECODE_LOOKUP){const o=i[0];if(o===e||o===t)return new _t(i[1]);let s=_t.numBitsDiffering(e,o);s<n&&(r=i[1],n=s),e!==t&&(s=_t.numBitsDiffering(t,o),s<n&&(r=i[1],n=s))}return n<=3?new _t(r):null}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getDataMask(){return this.dataMask}hashCode(){return this.errorCorrectionLevel.getBits()<<3|this.dataMask}equals(e){if(!(e instanceof _t))return!1;const t=e;return this.errorCorrectionLevel===t.errorCorrectionLevel&&this.dataMask===t.dataMask}}_t.FORMAT_INFO_MASK_QR=21522,_t.FORMAT_INFO_DECODE_LOOKUP=[Int32Array.from([21522,0]),Int32Array.from([20773,1]),Int32Array.from([24188,2]),Int32Array.from([23371,3]),Int32Array.from([17913,4]),Int32Array.from([16590,5]),Int32Array.from([20375,6]),Int32Array.from([19104,7]),Int32Array.from([30660,8]),Int32Array.from([29427,9]),Int32Array.from([32170,10]),Int32Array.from([30877,11]),Int32Array.from([26159,12]),Int32Array.from([25368,13]),Int32Array.from([27713,14]),Int32Array.from([26998,15]),Int32Array.from([5769,16]),Int32Array.from([5054,17]),Int32Array.from([7399,18]),Int32Array.from([6608,19]),Int32Array.from([1890,20]),Int32Array.from([597,21]),Int32Array.from([3340,22]),Int32Array.from([2107,23]),Int32Array.from([13663,24]),Int32Array.from([12392,25]),Int32Array.from([16177,26]),Int32Array.from([14854,27]),Int32Array.from([9396,28]),Int32Array.from([8579,29]),Int32Array.from([11994,30]),Int32Array.from([11245,31])];class Ct{constructor(e,...t){this.ecCodewordsPerBlock=e,this.ecBlocks=t}getECCodewordsPerBlock(){return this.ecCodewordsPerBlock}getNumBlocks(){let e=0;const t=this.ecBlocks;for(const n of t)e+=n.getCount();return e}getTotalECCodewords(){return this.ecCodewordsPerBlock*this.getNumBlocks()}getECBlocks(){return this.ecBlocks}}class Et{constructor(e,t){this.count=e,this.dataCodewords=t}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class At{constructor(e,t,...n){this.versionNumber=e,this.alignmentPatternCenters=t,this.ecBlocks=n;let r=0;const i=n[0].getECCodewordsPerBlock(),o=n[0].getECBlocks();for(const e of o)r+=e.getCount()*(e.getDataCodewords()+i);this.totalCodewords=r}getVersionNumber(){return this.versionNumber}getAlignmentPatternCenters(){return this.alignmentPatternCenters}getTotalCodewords(){return this.totalCodewords}getDimensionForVersion(){return 17+4*this.versionNumber}getECBlocksForLevel(e){return this.ecBlocks[e.getValue()]}static getProvisionalVersionForDimension(e){if(e%4!=1)throw new C;try{return this.getVersionForNumber((e-17)/4)}catch(e){throw new C}}static getVersionForNumber(e){if(e<1||e>40)throw new d;return At.VERSIONS[e-1]}static decodeVersionInformation(e){let t=Number.MAX_SAFE_INTEGER,n=0;for(let r=0;r<At.VERSION_DECODE_INFO.length;r++){const i=At.VERSION_DECODE_INFO[r];if(i===e)return At.getVersionForNumber(r+7);const o=_t.numBitsDiffering(e,i);o<t&&(n=r+7,t=o)}return t<=3?At.getVersionForNumber(n):null}buildFunctionPattern(){const e=this.getDimensionForVersion(),t=new T(e);t.setRegion(0,0,9,9),t.setRegion(e-8,0,8,9),t.setRegion(0,e-8,9,8);const n=this.alignmentPatternCenters.length;for(let e=0;e<n;e++){const r=this.alignmentPatternCenters[e]-2;for(let i=0;i<n;i++)0===e&&(0===i||i===n-1)||e===n-1&&0===i||t.setRegion(this.alignmentPatternCenters[i]-2,r,5,5)}return t.setRegion(6,9,1,e-17),t.setRegion(9,6,e-17,1),this.versionNumber>6&&(t.setRegion(e-11,0,3,6),t.setRegion(0,e-11,6,3)),t}toString(){return""+this.versionNumber}}At.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),At.VERSIONS=[new At(1,new Int32Array(0),new Ct(7,new Et(1,19)),new Ct(10,new Et(1,16)),new Ct(13,new Et(1,13)),new Ct(17,new Et(1,9))),new At(2,Int32Array.from([6,18]),new Ct(10,new Et(1,34)),new Ct(16,new Et(1,28)),new Ct(22,new Et(1,22)),new Ct(28,new Et(1,16))),new At(3,Int32Array.from([6,22]),new Ct(15,new Et(1,55)),new Ct(26,new Et(1,44)),new Ct(18,new Et(2,17)),new Ct(22,new Et(2,13))),new At(4,Int32Array.from([6,26]),new Ct(20,new Et(1,80)),new Ct(18,new Et(2,32)),new Ct(26,new Et(2,24)),new Ct(16,new Et(4,9))),new At(5,Int32Array.from([6,30]),new Ct(26,new Et(1,108)),new Ct(24,new Et(2,43)),new Ct(18,new Et(2,15),new Et(2,16)),new Ct(22,new Et(2,11),new Et(2,12))),new At(6,Int32Array.from([6,34]),new Ct(18,new Et(2,68)),new Ct(16,new Et(4,27)),new Ct(24,new Et(4,19)),new Ct(28,new Et(4,15))),new At(7,Int32Array.from([6,22,38]),new Ct(20,new Et(2,78)),new Ct(18,new Et(4,31)),new Ct(18,new Et(2,14),new Et(4,15)),new Ct(26,new Et(4,13),new Et(1,14))),new At(8,Int32Array.from([6,24,42]),new Ct(24,new Et(2,97)),new Ct(22,new Et(2,38),new Et(2,39)),new Ct(22,new Et(4,18),new Et(2,19)),new Ct(26,new Et(4,14),new Et(2,15))),new At(9,Int32Array.from([6,26,46]),new Ct(30,new Et(2,116)),new Ct(22,new Et(3,36),new Et(2,37)),new Ct(20,new Et(4,16),new Et(4,17)),new Ct(24,new Et(4,12),new Et(4,13))),new At(10,Int32Array.from([6,28,50]),new Ct(18,new Et(2,68),new Et(2,69)),new Ct(26,new Et(4,43),new Et(1,44)),new Ct(24,new Et(6,19),new Et(2,20)),new Ct(28,new Et(6,15),new Et(2,16))),new At(11,Int32Array.from([6,30,54]),new Ct(20,new Et(4,81)),new Ct(30,new Et(1,50),new Et(4,51)),new Ct(28,new Et(4,22),new Et(4,23)),new Ct(24,new Et(3,12),new Et(8,13))),new At(12,Int32Array.from([6,32,58]),new Ct(24,new Et(2,92),new Et(2,93)),new Ct(22,new Et(6,36),new Et(2,37)),new Ct(26,new Et(4,20),new Et(6,21)),new Ct(28,new Et(7,14),new Et(4,15))),new At(13,Int32Array.from([6,34,62]),new Ct(26,new Et(4,107)),new Ct(22,new Et(8,37),new Et(1,38)),new Ct(24,new Et(8,20),new Et(4,21)),new Ct(22,new Et(12,11),new Et(4,12))),new At(14,Int32Array.from([6,26,46,66]),new Ct(30,new Et(3,115),new Et(1,116)),new Ct(24,new Et(4,40),new Et(5,41)),new Ct(20,new Et(11,16),new Et(5,17)),new Ct(24,new Et(11,12),new Et(5,13))),new At(15,Int32Array.from([6,26,48,70]),new Ct(22,new Et(5,87),new Et(1,88)),new Ct(24,new Et(5,41),new Et(5,42)),new Ct(30,new Et(5,24),new Et(7,25)),new Ct(24,new Et(11,12),new Et(7,13))),new At(16,Int32Array.from([6,26,50,74]),new Ct(24,new Et(5,98),new Et(1,99)),new Ct(28,new Et(7,45),new Et(3,46)),new Ct(24,new Et(15,19),new Et(2,20)),new Ct(30,new Et(3,15),new Et(13,16))),new At(17,Int32Array.from([6,30,54,78]),new Ct(28,new Et(1,107),new Et(5,108)),new Ct(28,new Et(10,46),new Et(1,47)),new Ct(28,new Et(1,22),new Et(15,23)),new Ct(28,new Et(2,14),new Et(17,15))),new At(18,Int32Array.from([6,30,56,82]),new Ct(30,new Et(5,120),new Et(1,121)),new Ct(26,new Et(9,43),new Et(4,44)),new Ct(28,new Et(17,22),new Et(1,23)),new Ct(28,new Et(2,14),new Et(19,15))),new At(19,Int32Array.from([6,30,58,86]),new Ct(28,new Et(3,113),new Et(4,114)),new Ct(26,new Et(3,44),new Et(11,45)),new Ct(26,new Et(17,21),new Et(4,22)),new Ct(26,new Et(9,13),new Et(16,14))),new At(20,Int32Array.from([6,34,62,90]),new Ct(28,new Et(3,107),new Et(5,108)),new Ct(26,new Et(3,41),new Et(13,42)),new Ct(30,new Et(15,24),new Et(5,25)),new Ct(28,new Et(15,15),new Et(10,16))),new At(21,Int32Array.from([6,28,50,72,94]),new Ct(28,new Et(4,116),new Et(4,117)),new Ct(26,new Et(17,42)),new Ct(28,new Et(17,22),new Et(6,23)),new Ct(30,new Et(19,16),new Et(6,17))),new At(22,Int32Array.from([6,26,50,74,98]),new Ct(28,new Et(2,111),new Et(7,112)),new Ct(28,new Et(17,46)),new Ct(30,new Et(7,24),new Et(16,25)),new Ct(24,new Et(34,13))),new At(23,Int32Array.from([6,30,54,78,102]),new Ct(30,new Et(4,121),new Et(5,122)),new Ct(28,new Et(4,47),new Et(14,48)),new Ct(30,new Et(11,24),new Et(14,25)),new Ct(30,new Et(16,15),new Et(14,16))),new At(24,Int32Array.from([6,28,54,80,106]),new Ct(30,new Et(6,117),new Et(4,118)),new Ct(28,new Et(6,45),new Et(14,46)),new Ct(30,new Et(11,24),new Et(16,25)),new Ct(30,new Et(30,16),new Et(2,17))),new At(25,Int32Array.from([6,32,58,84,110]),new Ct(26,new Et(8,106),new Et(4,107)),new Ct(28,new Et(8,47),new Et(13,48)),new Ct(30,new Et(7,24),new Et(22,25)),new Ct(30,new Et(22,15),new Et(13,16))),new At(26,Int32Array.from([6,30,58,86,114]),new Ct(28,new Et(10,114),new Et(2,115)),new Ct(28,new Et(19,46),new Et(4,47)),new Ct(28,new Et(28,22),new Et(6,23)),new Ct(30,new Et(33,16),new Et(4,17))),new At(27,Int32Array.from([6,34,62,90,118]),new Ct(30,new Et(8,122),new Et(4,123)),new Ct(28,new Et(22,45),new Et(3,46)),new Ct(30,new Et(8,23),new Et(26,24)),new Ct(30,new Et(12,15),new Et(28,16))),new At(28,Int32Array.from([6,26,50,74,98,122]),new Ct(30,new Et(3,117),new Et(10,118)),new Ct(28,new Et(3,45),new Et(23,46)),new Ct(30,new Et(4,24),new Et(31,25)),new Ct(30,new Et(11,15),new Et(31,16))),new At(29,Int32Array.from([6,30,54,78,102,126]),new Ct(30,new Et(7,116),new Et(7,117)),new Ct(28,new Et(21,45),new Et(7,46)),new Ct(30,new Et(1,23),new Et(37,24)),new Ct(30,new Et(19,15),new Et(26,16))),new At(30,Int32Array.from([6,26,52,78,104,130]),new Ct(30,new Et(5,115),new Et(10,116)),new Ct(28,new Et(19,47),new Et(10,48)),new Ct(30,new Et(15,24),new Et(25,25)),new Ct(30,new Et(23,15),new Et(25,16))),new At(31,Int32Array.from([6,30,56,82,108,134]),new Ct(30,new Et(13,115),new Et(3,116)),new Ct(28,new Et(2,46),new Et(29,47)),new Ct(30,new Et(42,24),new Et(1,25)),new Ct(30,new Et(23,15),new Et(28,16))),new At(32,Int32Array.from([6,34,60,86,112,138]),new Ct(30,new Et(17,115)),new Ct(28,new Et(10,46),new Et(23,47)),new Ct(30,new Et(10,24),new Et(35,25)),new Ct(30,new Et(19,15),new Et(35,16))),new At(33,Int32Array.from([6,30,58,86,114,142]),new Ct(30,new Et(17,115),new Et(1,116)),new Ct(28,new Et(14,46),new Et(21,47)),new Ct(30,new Et(29,24),new Et(19,25)),new Ct(30,new Et(11,15),new Et(46,16))),new At(34,Int32Array.from([6,34,62,90,118,146]),new Ct(30,new Et(13,115),new Et(6,116)),new Ct(28,new Et(14,46),new Et(23,47)),new Ct(30,new Et(44,24),new Et(7,25)),new Ct(30,new Et(59,16),new Et(1,17))),new At(35,Int32Array.from([6,30,54,78,102,126,150]),new Ct(30,new Et(12,121),new Et(7,122)),new Ct(28,new Et(12,47),new Et(26,48)),new Ct(30,new Et(39,24),new Et(14,25)),new Ct(30,new Et(22,15),new Et(41,16))),new At(36,Int32Array.from([6,24,50,76,102,128,154]),new Ct(30,new Et(6,121),new Et(14,122)),new Ct(28,new Et(6,47),new Et(34,48)),new Ct(30,new Et(46,24),new Et(10,25)),new Ct(30,new Et(2,15),new Et(64,16))),new At(37,Int32Array.from([6,28,54,80,106,132,158]),new Ct(30,new Et(17,122),new Et(4,123)),new Ct(28,new Et(29,46),new Et(14,47)),new Ct(30,new Et(49,24),new Et(10,25)),new Ct(30,new Et(24,15),new Et(46,16))),new At(38,Int32Array.from([6,32,58,84,110,136,162]),new Ct(30,new Et(4,122),new Et(18,123)),new Ct(28,new Et(13,46),new Et(32,47)),new Ct(30,new Et(48,24),new Et(14,25)),new Ct(30,new Et(42,15),new Et(32,16))),new At(39,Int32Array.from([6,26,54,82,110,138,166]),new Ct(30,new Et(20,117),new Et(4,118)),new Ct(28,new Et(40,47),new Et(7,48)),new Ct(30,new Et(43,24),new Et(22,25)),new Ct(30,new Et(10,15),new Et(67,16))),new At(40,Int32Array.from([6,30,58,86,114,142,170]),new Ct(30,new Et(19,118),new Et(6,119)),new Ct(28,new Et(18,47),new Et(31,48)),new Ct(30,new Et(34,24),new Et(34,25)),new Ct(30,new Et(20,15),new Et(61,16)))],function(e){e[e.DATA_MASK_000=0]="DATA_MASK_000",e[e.DATA_MASK_001=1]="DATA_MASK_001",e[e.DATA_MASK_010=2]="DATA_MASK_010",e[e.DATA_MASK_011=3]="DATA_MASK_011",e[e.DATA_MASK_100=4]="DATA_MASK_100",e[e.DATA_MASK_101=5]="DATA_MASK_101",e[e.DATA_MASK_110=6]="DATA_MASK_110",e[e.DATA_MASK_111=7]="DATA_MASK_111"}(j||(j={}));class $t{constructor(e,t){this.value=e,this.isMasked=t}unmaskBitMatrix(e,t){for(let n=0;n<t;n++)for(let r=0;r<t;r++)this.isMasked(n,r)&&e.flip(r,n)}}$t.values=new Map([[j.DATA_MASK_000,new $t(j.DATA_MASK_000,(e,t)=>!(e+t&1))],[j.DATA_MASK_001,new $t(j.DATA_MASK_001,(e,t)=>!(1&e))],[j.DATA_MASK_010,new $t(j.DATA_MASK_010,(e,t)=>t%3==0)],[j.DATA_MASK_011,new $t(j.DATA_MASK_011,(e,t)=>(e+t)%3==0)],[j.DATA_MASK_100,new $t(j.DATA_MASK_100,(e,t)=>!(Math.floor(e/2)+Math.floor(t/3)&1))],[j.DATA_MASK_101,new $t(j.DATA_MASK_101,(e,t)=>e*t%6==0)],[j.DATA_MASK_110,new $t(j.DATA_MASK_110,(e,t)=>e*t%6<3)],[j.DATA_MASK_111,new $t(j.DATA_MASK_111,(e,t)=>!(e+t+e*t%3&1))]]);class bt{constructor(e){const t=e.getHeight();if(t<21||1!=(3&t))throw new C;this.bitMatrix=e}readFormatInformation(){if(null!==this.parsedFormatInfo&&void 0!==this.parsedFormatInfo)return this.parsedFormatInfo;let e=0;for(let t=0;t<6;t++)e=this.copyBit(t,8,e);e=this.copyBit(7,8,e),e=this.copyBit(8,8,e),e=this.copyBit(8,7,e);for(let t=5;t>=0;t--)e=this.copyBit(8,t,e);const t=this.bitMatrix.getHeight();let n=0;const r=t-7;for(let e=t-1;e>=r;e--)n=this.copyBit(8,e,n);for(let e=t-8;e<t;e++)n=this.copyBit(e,8,n);if(this.parsedFormatInfo=_t.decodeFormatInformation(e,n),null!==this.parsedFormatInfo)return this.parsedFormatInfo;throw new C}readVersion(){if(null!==this.parsedVersion&&void 0!==this.parsedVersion)return this.parsedVersion;const e=this.bitMatrix.getHeight(),t=Math.floor((e-17)/4);if(t<=6)return At.getVersionForNumber(t);let n=0;const r=e-11;for(let t=5;t>=0;t--)for(let i=e-9;i>=r;i--)n=this.copyBit(i,t,n);let i=At.decodeVersionInformation(n);if(null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;n=0;for(let t=5;t>=0;t--)for(let i=e-9;i>=r;i--)n=this.copyBit(t,i,n);if(i=At.decodeVersionInformation(n),null!==i&&i.getDimensionForVersion()===e)return this.parsedVersion=i,i;throw new C}copyBit(e,t,n){return(this.isMirror?this.bitMatrix.get(t,e):this.bitMatrix.get(e,t))?n<<1|1:n<<1}readCodewords(){const e=this.readFormatInformation(),t=this.readVersion(),n=$t.values.get(e.getDataMask()),r=this.bitMatrix.getHeight();n.unmaskBitMatrix(this.bitMatrix,r);const i=t.buildFunctionPattern();let o=!0;const s=new Uint8Array(t.getTotalCodewords());let a=0,l=0,c=0;for(let e=r-1;e>0;e-=2){6===e&&e--;for(let t=0;t<r;t++){const n=o?r-1-t:t;for(let t=0;t<2;t++)i.get(e-t,n)||(c++,l<<=1,this.bitMatrix.get(e-t,n)&&(l|=1),8===c&&(s[a++]=l,c=0,l=0))}o=!o}if(a!==t.getTotalCodewords())throw new C;return s}remask(){if(null===this.parsedFormatInfo)return;const e=$t.values[this.parsedFormatInfo.getDataMask()],t=this.bitMatrix.getHeight();e.unmaskBitMatrix(this.bitMatrix,t)}setMirror(e){this.parsedVersion=null,this.parsedFormatInfo=null,this.isMirror=e}mirror(){const e=this.bitMatrix;for(let t=0,n=e.getWidth();t<n;t++)for(let n=t+1,r=e.getHeight();n<r;n++)e.get(t,n)!==e.get(n,t)&&(e.flip(n,t),e.flip(t,n))}}class St{constructor(e,t){this.numDataCodewords=e,this.codewords=t}static getDataBlocks(e,t,n){if(e.length!==t.getTotalCodewords())throw new d;const r=t.getECBlocksForLevel(n);let i=0;const o=r.getECBlocks();for(const e of o)i+=e.getCount();const s=new Array(i);let a=0;for(const e of o)for(let t=0;t<e.getCount();t++){const t=e.getDataCodewords(),n=r.getECCodewordsPerBlock()+t;s[a++]=new St(t,new Uint8Array(n))}const l=s[0].codewords.length;let c=s.length-1;for(;c>=0&&s[c].codewords.length!==l;)c--;c++;const u=l-r.getECCodewordsPerBlock();let h=0;for(let t=0;t<u;t++)for(let n=0;n<a;n++)s[n].codewords[t]=e[h++];for(let t=c;t<a;t++)s[t].codewords[u]=e[h++];const f=s[0].codewords.length;for(let t=u;t<f;t++)for(let n=0;n<a;n++){const r=n<c?t:t+1;s[n].codewords[r]=e[h++]}return s}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}!function(e){e[e.TERMINATOR=0]="TERMINATOR",e[e.NUMERIC=1]="NUMERIC",e[e.ALPHANUMERIC=2]="ALPHANUMERIC",e[e.STRUCTURED_APPEND=3]="STRUCTURED_APPEND",e[e.BYTE=4]="BYTE",e[e.ECI=5]="ECI",e[e.KANJI=6]="KANJI",e[e.FNC1_FIRST_POSITION=7]="FNC1_FIRST_POSITION",e[e.FNC1_SECOND_POSITION=8]="FNC1_SECOND_POSITION",e[e.HANZI=9]="HANZI"}(q||(q={}));class Tt{constructor(e,t,n,r){this.value=e,this.stringValue=t,this.characterCountBitsForVersions=n,this.bits=r,Tt.FOR_BITS.set(r,this),Tt.FOR_VALUE.set(e,this)}static forBits(e){const t=Tt.FOR_BITS.get(e);if(void 0===t)throw new d;return t}getCharacterCountBits(e){const t=e.getVersionNumber();let n;return n=t<=9?0:t<=26?1:2,this.characterCountBitsForVersions[n]}getValue(){return this.value}getBits(){return this.bits}equals(e){if(!(e instanceof Tt))return!1;const t=e;return this.value===t.value}toString(){return this.stringValue}}Tt.FOR_BITS=new Map,Tt.FOR_VALUE=new Map,Tt.TERMINATOR=new Tt(q.TERMINATOR,"TERMINATOR",Int32Array.from([0,0,0]),0),Tt.NUMERIC=new Tt(q.NUMERIC,"NUMERIC",Int32Array.from([10,12,14]),1),Tt.ALPHANUMERIC=new Tt(q.ALPHANUMERIC,"ALPHANUMERIC",Int32Array.from([9,11,13]),2),Tt.STRUCTURED_APPEND=new Tt(q.STRUCTURED_APPEND,"STRUCTURED_APPEND",Int32Array.from([0,0,0]),3),Tt.BYTE=new Tt(q.BYTE,"BYTE",Int32Array.from([8,16,16]),4),Tt.ECI=new Tt(q.ECI,"ECI",Int32Array.from([0,0,0]),7),Tt.KANJI=new Tt(q.KANJI,"KANJI",Int32Array.from([8,10,12]),8),Tt.FNC1_FIRST_POSITION=new Tt(q.FNC1_FIRST_POSITION,"FNC1_FIRST_POSITION",Int32Array.from([0,0,0]),5),Tt.FNC1_SECOND_POSITION=new Tt(q.FNC1_SECOND_POSITION,"FNC1_SECOND_POSITION",Int32Array.from([0,0,0]),9),Tt.HANZI=new Tt(q.HANZI,"HANZI",Int32Array.from([8,10,12]),13);class Nt{static decode(e,t,n,r){const i=new mt(e);let o=new S;const s=new Array;let a=-1,l=-1;try{let e,n=null,c=!1;do{if(i.available()<4)e=Tt.TERMINATOR;else{const t=i.readBits(4);e=Tt.forBits(t)}switch(e){case Tt.TERMINATOR:break;case Tt.FNC1_FIRST_POSITION:case Tt.FNC1_SECOND_POSITION:c=!0;break;case Tt.STRUCTURED_APPEND:if(i.available()<16)throw new C;a=i.readBits(8),l=i.readBits(8);break;case Tt.ECI:const d=Nt.parseECIValue(i);if(n=E.getCharacterSetECIByValue(d),null===n)throw new C;break;case Tt.HANZI:const u=i.readBits(4),h=i.readBits(e.getCharacterCountBits(t));u===Nt.GB2312_SUBSET&&Nt.decodeHanziSegment(i,o,h);break;default:const f=i.readBits(e.getCharacterCountBits(t));switch(e){case Tt.NUMERIC:Nt.decodeNumericSegment(i,o,f);break;case Tt.ALPHANUMERIC:Nt.decodeAlphanumericSegment(i,o,f,c);break;case Tt.BYTE:Nt.decodeByteSegment(i,o,f,n,s,r);break;case Tt.KANJI:Nt.decodeKanjiSegment(i,o,f);break;default:throw new C}}}while(e!==Tt.TERMINATOR)}catch(e){throw new C}return new Y(e,o.toString(),0===s.length?null:s,null===n?null:n.toString(),a,l)}static decodeHanziSegment(e,t,n){if(13*n>e.available())throw new C;const r=new Uint8Array(2*n);let i=0;for(;n>0;){const t=e.readBits(13);let o=t/96<<8&4294967295|t%96;o+=o<959?41377:42657,r[i]=o>>8&255,r[i+1]=255&o,i+=2,n--}try{t.append($.decode(r,b.GB2312))}catch(e){throw new C(e)}}static decodeKanjiSegment(e,t,n){if(13*n>e.available())throw new C;const r=new Uint8Array(2*n);let i=0;for(;n>0;){const t=e.readBits(13);let o=t/192<<8&4294967295|t%192;o+=o<7936?33088:49472,r[i]=o>>8,r[i+1]=o,i+=2,n--}try{t.append($.decode(r,b.SHIFT_JIS))}catch(e){throw new C(e)}}static decodeByteSegment(e,t,n,r,i,o){if(8*n>e.available())throw new C;const s=new Uint8Array(n);for(let t=0;t<n;t++)s[t]=e.readBits(8);let a;a=null===r?b.guessEncoding(s,o):r.getName();try{t.append($.decode(s,a))}catch(e){throw new C(e)}i.push(s)}static toAlphaNumericChar(e){if(e>=Nt.ALPHANUMERIC_CHARS.length)throw new C;return Nt.ALPHANUMERIC_CHARS[e]}static decodeAlphanumericSegment(e,t,n,r){const i=t.length();for(;n>1;){if(e.available()<11)throw new C;const r=e.readBits(11);t.append(Nt.toAlphaNumericChar(Math.floor(r/45))),t.append(Nt.toAlphaNumericChar(r%45)),n-=2}if(1===n){if(e.available()<6)throw new C;t.append(Nt.toAlphaNumericChar(e.readBits(6)))}if(r)for(let e=i;e<t.length();e++)"%"===t.charAt(e)&&(e<t.length()-1&&"%"===t.charAt(e+1)?t.deleteCharAt(e+1):t.setCharAt(e,String.fromCharCode(29)))}static decodeNumericSegment(e,t,n){for(;n>=3;){if(e.available()<10)throw new C;const r=e.readBits(10);if(r>=1e3)throw new C;t.append(Nt.toAlphaNumericChar(Math.floor(r/100))),t.append(Nt.toAlphaNumericChar(Math.floor(r/10)%10)),t.append(Nt.toAlphaNumericChar(r%10)),n-=3}if(2===n){if(e.available()<7)throw new C;const n=e.readBits(7);if(n>=100)throw new C;t.append(Nt.toAlphaNumericChar(Math.floor(n/10))),t.append(Nt.toAlphaNumericChar(n%10))}else if(1===n){if(e.available()<4)throw new C;const n=e.readBits(4);if(n>=10)throw new C;t.append(Nt.toAlphaNumericChar(n))}}static parseECIValue(e){const t=e.readBits(8);if(!(128&t))return 127&t;if(128==(192&t))return(63&t)<<8&4294967295|e.readBits(8);if(192==(224&t))return(31&t)<<16&4294967295|e.readBits(16);throw new C}}Nt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Nt.GB2312_SUBSET=1;class Rt{constructor(e){this.mirrored=e}isMirrored(){return this.mirrored}applyMirroredCorrection(e){if(!this.mirrored||null===e||e.length<3)return;const t=e[0];e[0]=e[2],e[2]=t}}class Dt{constructor(){this.rsDecoder=new ne(J.QR_CODE_FIELD_256)}decodeBooleanArray(e,t){return this.decodeBitMatrix(T.parseFromBooleanArray(e),t)}decodeBitMatrix(e,t){const n=new bt(e);let r=null;try{return this.decodeBitMatrixParser(n,t)}catch(e){r=e}try{n.remask(),n.setMirror(!0),n.readVersion(),n.readFormatInformation(),n.mirror();const e=this.decodeBitMatrixParser(n,t);return e.setOther(new Rt(!0)),e}catch(e){if(null!==r)throw r;throw e}}decodeBitMatrixParser(e,t){const n=e.readVersion(),r=e.readFormatInformation().getErrorCorrectionLevel(),i=e.readCodewords(),o=St.getDataBlocks(i,n,r);let s=0;for(const e of o)s+=e.getNumDataCodewords();const a=new Uint8Array(s);let l=0;for(const e of o){const t=e.getCodewords(),n=e.getNumDataCodewords();this.correctErrors(t,n);for(let e=0;e<n;e++)a[l++]=t[e]}return Nt.decode(a,n,r,t)}correctErrors(e,t){const n=new Int32Array(e);try{this.rsDecoder.decode(n,e.length-t)}catch(e){throw new h}for(let r=0;r<t;r++)e[r]=n[r]}}class xt extends se{constructor(e,t,n){super(e,t),this.estimatedModuleSize=n}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=(this.getX()+t)/2,i=(this.getY()+e)/2,o=(this.estimatedModuleSize+n)/2;return new xt(r,i,o)}}class Ot{constructor(e,t,n,r,i,o,s){this.image=e,this.startX=t,this.startY=n,this.width=r,this.height=i,this.moduleSize=o,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(3)}find(){const e=this.startX,t=this.height,n=e+this.width,r=this.startY+t/2,i=new Int32Array(3),o=this.image;for(let s=0;s<t;s++){const t=r+(1&s?-Math.floor((s+1)/2):Math.floor((s+1)/2));i[0]=0,i[1]=0,i[2]=0;let a=e;for(;a<n&&!o.get(a,t);)a++;let l=0;for(;a<n;){if(o.get(a,t))if(1===l)i[1]++;else if(2===l){if(this.foundPatternCross(i)){const e=this.handlePossibleCenter(i,t,a);if(null!==e)return e}i[0]=i[2],i[1]=1,i[2]=0,l=1}else i[++l]++;else 1===l&&l++,i[l]++;a++}if(this.foundPatternCross(i)){const e=this.handlePossibleCenter(i,t,n);if(null!==e)return e}}if(0!==this.possibleCenters.length)return this.possibleCenters[0];throw new N}static centerFromEnd(e,t){return t-e[2]-e[1]/2}foundPatternCross(e){const t=this.moduleSize,n=t/2;for(let r=0;r<3;r++)if(Math.abs(t-e[r])>=n)return!1;return!0}crossCheckVertical(e,t,n,r){const i=this.image,o=i.getHeight(),s=this.crossCheckStateCount;s[0]=0,s[1]=0,s[2]=0;let a=e;for(;a>=0&&i.get(t,a)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&!i.get(t,a)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(t,a)&&s[1]<=n;)s[1]++,a++;if(a===o||s[1]>n)return NaN;for(;a<o&&!i.get(t,a)&&s[2]<=n;)s[2]++,a++;if(s[2]>n)return NaN;const l=s[0]+s[1]+s[2];return 5*Math.abs(l-r)>=2*r?NaN:this.foundPatternCross(s)?Ot.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n){const r=e[0]+e[1]+e[2],i=Ot.centerFromEnd(e,n),o=this.crossCheckVertical(t,i,2*e[1],r);if(!isNaN(o)){const t=(e[0]+e[1]+e[2])/3;for(const e of this.possibleCenters)if(e.aboutEquals(t,o,i))return e.combineEstimate(o,i,t);const n=new xt(i,o,t);this.possibleCenters.push(n),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(n)}return null}}class kt extends se{constructor(e,t,n,r){super(e,t),this.estimatedModuleSize=n,this.count=r,void 0===r&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(e,t,n){if(Math.abs(t-this.getY())<=e&&Math.abs(n-this.getX())<=e){const t=Math.abs(e-this.estimatedModuleSize);return t<=1||t<=this.estimatedModuleSize}return!1}combineEstimate(e,t,n){const r=this.count+1,i=(this.count*this.getX()+t)/r,o=(this.count*this.getY()+e)/r,s=(this.count*this.estimatedModuleSize+n)/r;return new kt(i,o,s,r)}}class Mt{constructor(e){this.bottomLeft=e[0],this.topLeft=e[1],this.topRight=e[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class Pt{constructor(e,t){this.image=e,this.resultPointCallback=t,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=t}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(e){const t=null!=e&&void 0!==e.get(_.TRY_HARDER),n=null!=e&&void 0!==e.get(_.PURE_BARCODE),r=this.image,i=r.getHeight(),o=r.getWidth();let s=Math.floor(3*i/(4*Pt.MAX_MODULES));(s<Pt.MIN_SKIP||t)&&(s=Pt.MIN_SKIP);let a=!1;const l=new Int32Array(5);for(let e=s-1;e<i&&!a;e+=s){l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0;let t=0;for(let i=0;i<o;i++)if(r.get(i,e))1&~t||t++,l[t]++;else if(1&t)l[t]++;else if(4===t)if(Pt.foundPatternCross(l)){if(!0!==this.handlePossibleCenter(l,e,i,n)){l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;continue}if(s=2,!0===this.hasSkipped)a=this.haveMultiplyConfirmedCenters();else{const t=this.findRowSkip();t>l[2]&&(e+=t-l[2]-s,i=o-1)}t=0,l[0]=0,l[1]=0,l[2]=0,l[3]=0,l[4]=0}else l[0]=l[2],l[1]=l[3],l[2]=l[4],l[3]=1,l[4]=0,t=3;else l[++t]++;Pt.foundPatternCross(l)&&!0===this.handlePossibleCenter(l,e,o,n)&&(s=l[0],this.hasSkipped&&(a=this.haveMultiplyConfirmedCenters()))}const c=this.selectBestPatterns();return se.orderBestPatterns(c),new Mt(c)}static centerFromEnd(e,t){return t-e[4]-e[3]-e[2]/2}static foundPatternCross(e){let t=0;for(let n=0;n<5;n++){const r=e[n];if(0===r)return!1;t+=r}if(t<7)return!1;const n=t/7,r=n/2;return Math.abs(n-e[0])<r&&Math.abs(n-e[1])<r&&Math.abs(3*n-e[2])<3*r&&Math.abs(n-e[3])<r&&Math.abs(n-e[4])<r}getCrossCheckStateCount(){const e=this.crossCheckStateCount;return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e}crossCheckDiagonal(e,t,n,r){const i=this.getCrossCheckStateCount();let o=0;const s=this.image;for(;e>=o&&t>=o&&s.get(t-o,e-o);)i[2]++,o++;if(e<o||t<o)return!1;for(;e>=o&&t>=o&&!s.get(t-o,e-o)&&i[1]<=n;)i[1]++,o++;if(e<o||t<o||i[1]>n)return!1;for(;e>=o&&t>=o&&s.get(t-o,e-o)&&i[0]<=n;)i[0]++,o++;if(i[0]>n)return!1;const a=s.getHeight(),l=s.getWidth();for(o=1;e+o<a&&t+o<l&&s.get(t+o,e+o);)i[2]++,o++;if(e+o>=a||t+o>=l)return!1;for(;e+o<a&&t+o<l&&!s.get(t+o,e+o)&&i[3]<n;)i[3]++,o++;if(e+o>=a||t+o>=l||i[3]>=n)return!1;for(;e+o<a&&t+o<l&&s.get(t+o,e+o)&&i[4]<n;)i[4]++,o++;if(i[4]>=n)return!1;const c=i[0]+i[1]+i[2]+i[3]+i[4];return Math.abs(c-r)<2*r&&Pt.foundPatternCross(i)}crossCheckVertical(e,t,n,r){const i=this.image,o=i.getHeight(),s=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(t,a);)s[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(t,a)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&i.get(t,a)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(t,a);)s[2]++,a++;if(a===o)return NaN;for(;a<o&&!i.get(t,a)&&s[3]<n;)s[3]++,a++;if(a===o||s[3]>=n)return NaN;for(;a<o&&i.get(t,a)&&s[4]<n;)s[4]++,a++;if(s[4]>=n)return NaN;const l=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(l-r)>=2*r?NaN:Pt.foundPatternCross(s)?Pt.centerFromEnd(s,a):NaN}crossCheckHorizontal(e,t,n,r){const i=this.image,o=i.getWidth(),s=this.getCrossCheckStateCount();let a=e;for(;a>=0&&i.get(a,t);)s[2]++,a--;if(a<0)return NaN;for(;a>=0&&!i.get(a,t)&&s[1]<=n;)s[1]++,a--;if(a<0||s[1]>n)return NaN;for(;a>=0&&i.get(a,t)&&s[0]<=n;)s[0]++,a--;if(s[0]>n)return NaN;for(a=e+1;a<o&&i.get(a,t);)s[2]++,a++;if(a===o)return NaN;for(;a<o&&!i.get(a,t)&&s[3]<n;)s[3]++,a++;if(a===o||s[3]>=n)return NaN;for(;a<o&&i.get(a,t)&&s[4]<n;)s[4]++,a++;if(s[4]>=n)return NaN;const l=s[0]+s[1]+s[2]+s[3]+s[4];return 5*Math.abs(l-r)>=r?NaN:Pt.foundPatternCross(s)?Pt.centerFromEnd(s,a):NaN}handlePossibleCenter(e,t,n,r){const i=e[0]+e[1]+e[2]+e[3]+e[4];let o=Pt.centerFromEnd(e,n),s=this.crossCheckVertical(t,Math.floor(o),e[2],i);if(!isNaN(s)&&(o=this.crossCheckHorizontal(Math.floor(o),Math.floor(s),e[2],i),!isNaN(o)&&(!r||this.crossCheckDiagonal(Math.floor(s),Math.floor(o),e[2],i)))){const e=i/7;let t=!1;const n=this.possibleCenters;for(let r=0,i=n.length;r<i;r++){const i=n[r];if(i.aboutEquals(e,s,o)){n[r]=i.combineEstimate(s,o,e),t=!0;break}}if(!t){const t=new kt(o,s,e);n.push(t),null!==this.resultPointCallback&&void 0!==this.resultPointCallback&&this.resultPointCallback.foundPossibleResultPoint(t)}return!0}return!1}findRowSkip(){if(this.possibleCenters.length<=1)return 0;let e=null;for(const t of this.possibleCenters)if(t.getCount()>=Pt.CENTER_QUORUM){if(null!=e)return this.hasSkipped=!0,Math.floor((Math.abs(e.getX()-t.getX())-Math.abs(e.getY()-t.getY()))/2);e=t}return 0}haveMultiplyConfirmedCenters(){let e=0,t=0;const n=this.possibleCenters.length;for(const n of this.possibleCenters)n.getCount()>=Pt.CENTER_QUORUM&&(e++,t+=n.getEstimatedModuleSize());if(e<3)return!1;const r=t/n;let i=0;for(const e of this.possibleCenters)i+=Math.abs(e.getEstimatedModuleSize()-r);return i<=.05*t}selectBestPatterns(){const e=this.possibleCenters.length;if(e<3)throw new N;const t=this.possibleCenters;let n;if(e>3){let r=0,i=0;for(const e of this.possibleCenters){const t=e.getEstimatedModuleSize();r+=t,i+=t*t}n=r/e;let o=Math.sqrt(i/e-n*n);t.sort((e,t)=>{const r=Math.abs(t.getEstimatedModuleSize()-n),i=Math.abs(e.getEstimatedModuleSize()-n);return r<i?-1:r>i?1:0});const s=Math.max(.2*n,o);for(let e=0;e<t.length&&t.length>3;e++){const r=t[e];Math.abs(r.getEstimatedModuleSize()-n)>s&&(t.splice(e,1),e--)}}if(t.length>3){let e=0;for(const n of t)e+=n.getEstimatedModuleSize();n=e/t.length,t.sort((e,t)=>{if(t.getCount()===e.getCount()){const r=Math.abs(t.getEstimatedModuleSize()-n),i=Math.abs(e.getEstimatedModuleSize()-n);return r<i?1:r>i?-1:0}return t.getCount()-e.getCount()}),t.splice(3)}return[t[0],t[1],t[2]]}}Pt.CENTER_QUORUM=2,Pt.MIN_SKIP=3,Pt.MAX_MODULES=57;class Bt{constructor(e){this.image=e}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(e){this.resultPointCallback=null==e?null:e.get(_.NEED_RESULT_POINT_CALLBACK);const t=new Pt(this.image,this.resultPointCallback).find(e);return this.processFinderPatternInfo(t)}processFinderPatternInfo(e){const t=e.getTopLeft(),n=e.getTopRight(),r=e.getBottomLeft(),i=this.calculateModuleSize(t,n,r);if(i<1)throw new N("No pattern found in proccess finder.");const o=Bt.computeDimension(t,n,r,i),s=At.getProvisionalVersionForDimension(o),a=s.getDimensionForVersion()-7;let l=null;if(s.getAlignmentPatternCenters().length>0){const e=n.getX()-t.getX()+r.getX(),o=n.getY()-t.getY()+r.getY(),s=1-3/a,c=Math.floor(t.getX()+s*(e-t.getX())),d=Math.floor(t.getY()+s*(o-t.getY()));for(let e=4;e<=16;e<<=1)try{l=this.findAlignmentInRegion(i,c,d,e);break}catch(e){if(!(e instanceof N))throw e}}const c=Bt.createTransform(t,n,r,l,o),d=Bt.sampleGrid(this.image,c,o);let u;return u=null===l?[r,t,n]:[r,t,n,l],new ae(d,u)}static createTransform(e,t,n,r,i){const o=i-3.5;let s,a,l,c;return null!==r?(s=r.getX(),a=r.getY(),l=o-3,c=l):(s=t.getX()-e.getX()+n.getX(),a=t.getY()-e.getY()+n.getY(),l=o,c=o),ue.quadrilateralToQuadrilateral(3.5,3.5,o,3.5,l,c,3.5,o,e.getX(),e.getY(),t.getX(),t.getY(),s,a,n.getX(),n.getY())}static sampleGrid(e,t,n){return fe.getInstance().sampleGridWithTransform(e,n,n,t)}static computeDimension(e,t,n,r){const i=ie.round(se.distance(e,t)/r),o=ie.round(se.distance(e,n)/r);let s=Math.floor((i+o)/2)+7;switch(3&s){case 0:s++;break;case 2:s--;break;case 3:throw new N("Dimensions could be not found.")}return s}calculateModuleSize(e,t,n){return(this.calculateModuleSizeOneWay(e,t)+this.calculateModuleSizeOneWay(e,n))/2}calculateModuleSizeOneWay(e,t){const n=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(e.getX()),Math.floor(e.getY()),Math.floor(t.getX()),Math.floor(t.getY())),r=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(t.getX()),Math.floor(t.getY()),Math.floor(e.getX()),Math.floor(e.getY()));return isNaN(n)?r/7:isNaN(r)?n/7:(n+r)/14}sizeOfBlackWhiteBlackRunBothWays(e,t,n,r){let i=this.sizeOfBlackWhiteBlackRun(e,t,n,r),o=1,s=e-(n-e);s<0?(o=e/(e-s),s=0):s>=this.image.getWidth()&&(o=(this.image.getWidth()-1-e)/(s-e),s=this.image.getWidth()-1);let a=Math.floor(t-(r-t)*o);return o=1,a<0?(o=t/(t-a),a=0):a>=this.image.getHeight()&&(o=(this.image.getHeight()-1-t)/(a-t),a=this.image.getHeight()-1),s=Math.floor(e+(s-e)*o),i+=this.sizeOfBlackWhiteBlackRun(e,t,s,a),i-1}sizeOfBlackWhiteBlackRun(e,t,n,r){const i=Math.abs(r-t)>Math.abs(n-e);if(i){let i=e;e=t,t=i,i=n,n=r,r=i}const o=Math.abs(n-e),s=Math.abs(r-t);let a=-o/2;const l=e<n?1:-1,c=t<r?1:-1;let d=0;const u=n+l;for(let n=e,h=t;n!==u;n+=l){const l=i?h:n,u=i?n:h;if(1===d===this.image.get(l,u)){if(2===d)return ie.distance(n,h,e,t);d++}if(a+=s,a>0){if(h===r)break;h+=c,a-=o}}return 2===d?ie.distance(n+l,r,e,t):NaN}findAlignmentInRegion(e,t,n,r){const i=Math.floor(r*e),o=Math.max(0,t-i),s=Math.min(this.image.getWidth()-1,t+i);if(s-o<3*e)throw new N("Alignment top exceeds estimated module size.");const a=Math.max(0,n-i),l=Math.min(this.image.getHeight()-1,n+i);if(l-a<3*e)throw new N("Alignment bottom exceeds estimated module size.");return new Ot(this.image,o,a,s-o,l-a,e,this.resultPointCallback).find()}}class Lt{constructor(){this.decoder=new Dt}getDecoder(){return this.decoder}decode(e,t){let n,r;if(null!=t&&void 0!==t.get(_.PURE_BARCODE)){const i=Lt.extractPureBits(e.getBlackMatrix());n=this.decoder.decodeBitMatrix(i,t),r=Lt.NO_POINTS}else{const i=new Bt(e.getBlackMatrix()).detect(t);n=this.decoder.decodeBitMatrix(i.getBits(),t),r=i.getPoints()}n.getOther()instanceof Rt&&n.getOther().applyMirroredCorrection(r);const i=new F(n.getText(),n.getRawBytes(),void 0,r,U.QR_CODE,void 0),o=n.getByteSegments();null!==o&&i.putMetadata(X.BYTE_SEGMENTS,o);const s=n.getECLevel();return null!==s&&i.putMetadata(X.ERROR_CORRECTION_LEVEL,s),n.hasStructuredAppend()&&(i.putMetadata(X.STRUCTURED_APPEND_SEQUENCE,n.getStructuredAppendSequenceNumber()),i.putMetadata(X.STRUCTURED_APPEND_PARITY,n.getStructuredAppendParity())),i}reset(){}static extractPureBits(e){const t=e.getTopLeftOnBit(),n=e.getBottomRightOnBit();if(null===t||null===n)throw new N;const r=this.moduleSize(t,e);let i=t[1],o=n[1],s=t[0],a=n[0];if(s>=a||i>=o)throw new N;if(o-i!==a-s&&(a=s+(o-i),a>=e.getWidth()))throw new N;const l=Math.round((a-s+1)/r),c=Math.round((o-i+1)/r);if(l<=0||c<=0)throw new N;if(c!==l)throw new N;const d=Math.floor(r/2);i+=d,s+=d;const u=s+Math.floor((l-1)*r)-a;if(u>0){if(u>d)throw new N;s-=u}const h=i+Math.floor((c-1)*r)-o;if(h>0){if(h>d)throw new N;i-=h}const f=new T(l,c);for(let t=0;t<c;t++){const n=i+Math.floor(t*r);for(let i=0;i<l;i++)e.get(s+Math.floor(i*r),n)&&f.set(i,t)}return f}static moduleSize(e,t){const n=t.getHeight(),r=t.getWidth();let i=e[0],o=e[1],s=!0,a=0;for(;i<r&&o<n;){if(s!==t.get(i,o)){if(5===++a)break;s=!s}i++,o++}if(i===r||o===n)throw new N;return(i-e[0])/7}}Lt.NO_POINTS=new Array;class Ft{PDF417Common(){}static getBitCountSum(e){return ie.sum(e)}static toIntArray(e){if(null==e||!e.length)return Ft.EMPTY_INT_ARRAY;const t=new Int32Array(e.length);let n=0;for(const r of e)t[n++]=r;return t}static getCodeword(e){const t=w.binarySearch(Ft.SYMBOL_TABLE,262143&e);return t<0?-1:(Ft.CODEWORD_TABLE[t]-1)%Ft.NUMBER_OF_CODEWORDS}}Ft.NUMBER_OF_CODEWORDS=929,Ft.MAX_CODEWORDS_IN_BARCODE=Ft.NUMBER_OF_CODEWORDS-1,Ft.MIN_ROWS_IN_BARCODE=3,Ft.MAX_ROWS_IN_BARCODE=90,Ft.MODULES_IN_CODEWORD=17,Ft.MODULES_IN_STOP_PATTERN=18,Ft.BARS_IN_MODULE=8,Ft.EMPTY_INT_ARRAY=new Int32Array([]),Ft.SYMBOL_TABLE=Int32Array.from([66142,66170,66206,66236,66290,66292,66350,66382,66396,66454,66470,66476,66594,66600,66614,66626,66628,66632,66640,66654,66662,66668,66682,66690,66718,66720,66748,66758,66776,66798,66802,66804,66820,66824,66832,66846,66848,66876,66880,66936,66950,66956,66968,66992,67006,67022,67036,67042,67044,67048,67062,67118,67150,67164,67214,67228,67256,67294,67322,67350,67366,67372,67398,67404,67416,67438,67474,67476,67490,67492,67496,67510,67618,67624,67650,67656,67664,67678,67686,67692,67706,67714,67716,67728,67742,67744,67772,67782,67788,67800,67822,67826,67828,67842,67848,67870,67872,67900,67904,67960,67974,67992,68016,68030,68046,68060,68066,68068,68072,68086,68104,68112,68126,68128,68156,68160,68216,68336,68358,68364,68376,68400,68414,68448,68476,68494,68508,68536,68546,68548,68552,68560,68574,68582,68588,68654,68686,68700,68706,68708,68712,68726,68750,68764,68792,68802,68804,68808,68816,68830,68838,68844,68858,68878,68892,68920,68976,68990,68994,68996,69e3,69008,69022,69024,69052,69062,69068,69080,69102,69106,69108,69142,69158,69164,69190,69208,69230,69254,69260,69272,69296,69310,69326,69340,69386,69394,69396,69410,69416,69430,69442,69444,69448,69456,69470,69478,69484,69554,69556,69666,69672,69698,69704,69712,69726,69754,69762,69764,69776,69790,69792,69820,69830,69836,69848,69870,69874,69876,69890,69918,69920,69948,69952,70008,70022,70040,70064,70078,70094,70108,70114,70116,70120,70134,70152,70174,70176,70264,70384,70412,70448,70462,70496,70524,70542,70556,70584,70594,70600,70608,70622,70630,70636,70664,70672,70686,70688,70716,70720,70776,70896,71136,71180,71192,71216,71230,71264,71292,71360,71416,71452,71480,71536,71550,71554,71556,71560,71568,71582,71584,71612,71622,71628,71640,71662,71726,71732,71758,71772,71778,71780,71784,71798,71822,71836,71864,71874,71880,71888,71902,71910,71916,71930,71950,71964,71992,72048,72062,72066,72068,72080,72094,72096,72124,72134,72140,72152,72174,72178,72180,72206,72220,72248,72304,72318,72416,72444,72456,72464,72478,72480,72508,72512,72568,72588,72600,72624,72638,72654,72668,72674,72676,72680,72694,72726,72742,72748,72774,72780,72792,72814,72838,72856,72880,72894,72910,72924,72930,72932,72936,72950,72966,72972,72984,73008,73022,73056,73084,73102,73116,73144,73156,73160,73168,73182,73190,73196,73210,73226,73234,73236,73250,73252,73256,73270,73282,73284,73296,73310,73318,73324,73346,73348,73352,73360,73374,73376,73404,73414,73420,73432,73454,73498,73518,73522,73524,73550,73564,73570,73572,73576,73590,73800,73822,73858,73860,73872,73886,73888,73916,73944,73970,73972,73992,74014,74016,74044,74048,74104,74118,74136,74160,74174,74210,74212,74216,74230,74244,74256,74270,74272,74360,74480,74502,74508,74544,74558,74592,74620,74638,74652,74680,74690,74696,74704,74726,74732,74782,74784,74812,74992,75232,75288,75326,75360,75388,75456,75512,75576,75632,75646,75650,75652,75664,75678,75680,75708,75718,75724,75736,75758,75808,75836,75840,75896,76016,76256,76736,76824,76848,76862,76896,76924,76992,77048,77296,77340,77368,77424,77438,77536,77564,77572,77576,77584,77600,77628,77632,77688,77702,77708,77720,77744,77758,77774,77788,77870,77902,77916,77922,77928,77966,77980,78008,78018,78024,78032,78046,78060,78074,78094,78136,78192,78206,78210,78212,78224,78238,78240,78268,78278,78284,78296,78322,78324,78350,78364,78448,78462,78560,78588,78600,78622,78624,78652,78656,78712,78726,78744,78768,78782,78798,78812,78818,78820,78824,78838,78862,78876,78904,78960,78974,79072,79100,79296,79352,79368,79376,79390,79392,79420,79424,79480,79600,79628,79640,79664,79678,79712,79740,79772,79800,79810,79812,79816,79824,79838,79846,79852,79894,79910,79916,79942,79948,79960,79982,79988,80006,80024,80048,80062,80078,80092,80098,80100,80104,80134,80140,80176,80190,80224,80252,80270,80284,80312,80328,80336,80350,80358,80364,80378,80390,80396,80408,80432,80446,80480,80508,80576,80632,80654,80668,80696,80752,80766,80776,80784,80798,80800,80828,80844,80856,80878,80882,80884,80914,80916,80930,80932,80936,80950,80962,80968,80976,80990,80998,81004,81026,81028,81040,81054,81056,81084,81094,81100,81112,81134,81154,81156,81160,81168,81182,81184,81212,81216,81272,81286,81292,81304,81328,81342,81358,81372,81380,81384,81398,81434,81454,81458,81460,81486,81500,81506,81508,81512,81526,81550,81564,81592,81602,81604,81608,81616,81630,81638,81644,81702,81708,81722,81734,81740,81752,81774,81778,81780,82050,82078,82080,82108,82180,82184,82192,82206,82208,82236,82240,82296,82316,82328,82352,82366,82402,82404,82408,82440,82448,82462,82464,82492,82496,82552,82672,82694,82700,82712,82736,82750,82784,82812,82830,82882,82884,82888,82896,82918,82924,82952,82960,82974,82976,83004,83008,83064,83184,83424,83468,83480,83504,83518,83552,83580,83648,83704,83740,83768,83824,83838,83842,83844,83848,83856,83872,83900,83910,83916,83928,83950,83984,84e3,84028,84032,84088,84208,84448,84928,85040,85054,85088,85116,85184,85240,85488,85560,85616,85630,85728,85756,85764,85768,85776,85790,85792,85820,85824,85880,85894,85900,85912,85936,85966,85980,86048,86080,86136,86256,86496,86976,88160,88188,88256,88312,88560,89056,89200,89214,89312,89340,89536,89592,89608,89616,89632,89664,89720,89840,89868,89880,89904,89952,89980,89998,90012,90040,90190,90204,90254,90268,90296,90306,90308,90312,90334,90382,90396,90424,90480,90494,90500,90504,90512,90526,90528,90556,90566,90572,90584,90610,90612,90638,90652,90680,90736,90750,90848,90876,90884,90888,90896,90910,90912,90940,90944,91e3,91014,91020,91032,91056,91070,91086,91100,91106,91108,91112,91126,91150,91164,91192,91248,91262,91360,91388,91584,91640,91664,91678,91680,91708,91712,91768,91888,91928,91952,91966,92e3,92028,92046,92060,92088,92098,92100,92104,92112,92126,92134,92140,92188,92216,92272,92384,92412,92608,92664,93168,93200,93214,93216,93244,93248,93304,93424,93664,93720,93744,93758,93792,93820,93888,93944,93980,94008,94064,94078,94084,94088,94096,94110,94112,94140,94150,94156,94168,94246,94252,94278,94284,94296,94318,94342,94348,94360,94384,94398,94414,94428,94440,94470,94476,94488,94512,94526,94560,94588,94606,94620,94648,94658,94660,94664,94672,94686,94694,94700,94714,94726,94732,94744,94768,94782,94816,94844,94912,94968,94990,95004,95032,95088,95102,95112,95120,95134,95136,95164,95180,95192,95214,95218,95220,95244,95256,95280,95294,95328,95356,95424,95480,95728,95758,95772,95800,95856,95870,95968,95996,96008,96016,96030,96032,96060,96064,96120,96152,96176,96190,96220,96226,96228,96232,96290,96292,96296,96310,96322,96324,96328,96336,96350,96358,96364,96386,96388,96392,96400,96414,96416,96444,96454,96460,96472,96494,96498,96500,96514,96516,96520,96528,96542,96544,96572,96576,96632,96646,96652,96664,96688,96702,96718,96732,96738,96740,96744,96758,96772,96776,96784,96798,96800,96828,96832,96888,97008,97030,97036,97048,97072,97086,97120,97148,97166,97180,97208,97220,97224,97232,97246,97254,97260,97326,97330,97332,97358,97372,97378,97380,97384,97398,97422,97436,97464,97474,97476,97480,97488,97502,97510,97516,97550,97564,97592,97648,97666,97668,97672,97680,97694,97696,97724,97734,97740,97752,97774,97830,97836,97850,97862,97868,97880,97902,97906,97908,97926,97932,97944,97968,97998,98012,98018,98020,98024,98038,98618,98674,98676,98838,98854,98874,98892,98904,98926,98930,98932,98968,99006,99042,99044,99048,99062,99166,99194,99246,99286,99350,99366,99372,99386,99398,99416,99438,99442,99444,99462,99504,99518,99534,99548,99554,99556,99560,99574,99590,99596,99608,99632,99646,99680,99708,99726,99740,99768,99778,99780,99784,99792,99806,99814,99820,99834,99858,99860,99874,99880,99894,99906,99920,99934,99962,99970,99972,99976,99984,99998,1e5,100028,100038,100044,100056,100078,100082,100084,100142,100174,100188,100246,100262,100268,100306,100308,100390,100396,100410,100422,100428,100440,100462,100466,100468,100486,100504,100528,100542,100558,100572,100578,100580,100584,100598,100620,100656,100670,100704,100732,100750,100792,100802,100808,100816,100830,100838,100844,100858,100888,100912,100926,100960,100988,101056,101112,101148,101176,101232,101246,101250,101252,101256,101264,101278,101280,101308,101318,101324,101336,101358,101362,101364,101410,101412,101416,101430,101442,101448,101456,101470,101478,101498,101506,101508,101520,101534,101536,101564,101580,101618,101620,101636,101640,101648,101662,101664,101692,101696,101752,101766,101784,101838,101858,101860,101864,101934,101938,101940,101966,101980,101986,101988,101992,102030,102044,102072,102082,102084,102088,102096,102138,102166,102182,102188,102214,102220,102232,102254,102282,102290,102292,102306,102308,102312,102326,102444,102458,102470,102476,102488,102514,102516,102534,102552,102576,102590,102606,102620,102626,102632,102646,102662,102668,102704,102718,102752,102780,102798,102812,102840,102850,102856,102864,102878,102886,102892,102906,102936,102974,103008,103036,103104,103160,103224,103280,103294,103298,103300,103312,103326,103328,103356,103366,103372,103384,103406,103410,103412,103472,103486,103520,103548,103616,103672,103920,103992,104048,104062,104160,104188,104194,104196,104200,104208,104224,104252,104256,104312,104326,104332,104344,104368,104382,104398,104412,104418,104420,104424,104482,104484,104514,104520,104528,104542,104550,104570,104578,104580,104592,104606,104608,104636,104652,104690,104692,104706,104712,104734,104736,104764,104768,104824,104838,104856,104910,104930,104932,104936,104968,104976,104990,104992,105020,105024,105080,105200,105240,105278,105312,105372,105410,105412,105416,105424,105446,105518,105524,105550,105564,105570,105572,105576,105614,105628,105656,105666,105672,105680,105702,105722,105742,105756,105784,105840,105854,105858,105860,105864,105872,105888,105932,105970,105972,106006,106022,106028,106054,106060,106072,106100,106118,106124,106136,106160,106174,106190,106210,106212,106216,106250,106258,106260,106274,106276,106280,106306,106308,106312,106320,106334,106348,106394,106414,106418,106420,106566,106572,106610,106612,106630,106636,106648,106672,106686,106722,106724,106728,106742,106758,106764,106776,106800,106814,106848,106876,106894,106908,106936,106946,106948,106952,106960,106974,106982,106988,107032,107056,107070,107104,107132,107200,107256,107292,107320,107376,107390,107394,107396,107400,107408,107422,107424,107452,107462,107468,107480,107502,107506,107508,107544,107568,107582,107616,107644,107712,107768,108016,108060,108088,108144,108158,108256,108284,108290,108292,108296,108304,108318,108320,108348,108352,108408,108422,108428,108440,108464,108478,108494,108508,108514,108516,108520,108592,108640,108668,108736,108792,109040,109536,109680,109694,109792,109820,110016,110072,110084,110088,110096,110112,110140,110144,110200,110320,110342,110348,110360,110384,110398,110432,110460,110478,110492,110520,110532,110536,110544,110558,110658,110686,110714,110722,110724,110728,110736,110750,110752,110780,110796,110834,110836,110850,110852,110856,110864,110878,110880,110908,110912,110968,110982,111e3,111054,111074,111076,111080,111108,111112,111120,111134,111136,111164,111168,111224,111344,111372,111422,111456,111516,111554,111556,111560,111568,111590,111632,111646,111648,111676,111680,111736,111856,112096,112152,112224,112252,112320,112440,112514,112516,112520,112528,112542,112544,112588,112686,112718,112732,112782,112796,112824,112834,112836,112840,112848,112870,112890,112910,112924,112952,113008,113022,113026,113028,113032,113040,113054,113056,113100,113138,113140,113166,113180,113208,113264,113278,113376,113404,113416,113424,113440,113468,113472,113560,113614,113634,113636,113640,113686,113702,113708,113734,113740,113752,113778,113780,113798,113804,113816,113840,113854,113870,113890,113892,113896,113926,113932,113944,113968,113982,114016,114044,114076,114114,114116,114120,114128,114150,114170,114194,114196,114210,114212,114216,114242,114244,114248,114256,114270,114278,114306,114308,114312,114320,114334,114336,114364,114380,114420,114458,114478,114482,114484,114510,114524,114530,114532,114536,114842,114866,114868,114970,114994,114996,115042,115044,115048,115062,115130,115226,115250,115252,115278,115292,115298,115300,115304,115318,115342,115394,115396,115400,115408,115422,115430,115436,115450,115478,115494,115514,115526,115532,115570,115572,115738,115758,115762,115764,115790,115804,115810,115812,115816,115830,115854,115868,115896,115906,115912,115920,115934,115942,115948,115962,115996,116024,116080,116094,116098,116100,116104,116112,116126,116128,116156,116166,116172,116184,116206,116210,116212,116246,116262,116268,116282,116294,116300,116312,116334,116338,116340,116358,116364,116376,116400,116414,116430,116444,116450,116452,116456,116498,116500,116514,116520,116534,116546,116548,116552,116560,116574,116582,116588,116602,116654,116694,116714,116762,116782,116786,116788,116814,116828,116834,116836,116840,116854,116878,116892,116920,116930,116936,116944,116958,116966,116972,116986,117006,117048,117104,117118,117122,117124,117136,117150,117152,117180,117190,117196,117208,117230,117234,117236,117304,117360,117374,117472,117500,117506,117508,117512,117520,117536,117564,117568,117624,117638,117644,117656,117680,117694,117710,117724,117730,117732,117736,117750,117782,117798,117804,117818,117830,117848,117874,117876,117894,117936,117950,117966,117986,117988,117992,118022,118028,118040,118064,118078,118112,118140,118172,118210,118212,118216,118224,118238,118246,118266,118306,118312,118338,118352,118366,118374,118394,118402,118404,118408,118416,118430,118432,118460,118476,118514,118516,118574,118578,118580,118606,118620,118626,118628,118632,118678,118694,118700,118730,118738,118740,118830,118834,118836,118862,118876,118882,118884,118888,118902,118926,118940,118968,118978,118980,118984,118992,119006,119014,119020,119034,119068,119096,119152,119166,119170,119172,119176,119184,119198,119200,119228,119238,119244,119256,119278,119282,119284,119324,119352,119408,119422,119520,119548,119554,119556,119560,119568,119582,119584,119612,119616,119672,119686,119692,119704,119728,119742,119758,119772,119778,119780,119784,119798,119920,119934,120032,120060,120256,120312,120324,120328,120336,120352,120384,120440,120560,120582,120588,120600,120624,120638,120672,120700,120718,120732,120760,120770,120772,120776,120784,120798,120806,120812,120870,120876,120890,120902,120908,120920,120946,120948,120966,120972,120984,121008,121022,121038,121058,121060,121064,121078,121100,121112,121136,121150,121184,121212,121244,121282,121284,121288,121296,121318,121338,121356,121368,121392,121406,121440,121468,121536,121592,121656,121730,121732,121736,121744,121758,121760,121804,121842,121844,121890,121922,121924,121928,121936,121950,121958,121978,121986,121988,121992,122e3,122014,122016,122044,122060,122098,122100,122116,122120,122128,122142,122144,122172,122176,122232,122246,122264,122318,122338,122340,122344,122414,122418,122420,122446,122460,122466,122468,122472,122510,122524,122552,122562,122564,122568,122576,122598,122618,122646,122662,122668,122694,122700,122712,122738,122740,122762,122770,122772,122786,122788,122792,123018,123026,123028,123042,123044,123048,123062,123098,123146,123154,123156,123170,123172,123176,123190,123202,123204,123208,123216,123238,123244,123258,123290,123314,123316,123402,123410,123412,123426,123428,123432,123446,123458,123464,123472,123486,123494,123500,123514,123522,123524,123528,123536,123552,123580,123590,123596,123608,123630,123634,123636,123674,123698,123700,123740,123746,123748,123752,123834,123914,123922,123924,123938,123944,123958,123970,123976,123984,123998,124006,124012,124026,124034,124036,124048,124062,124064,124092,124102,124108,124120,124142,124146,124148,124162,124164,124168,124176,124190,124192,124220,124224,124280,124294,124300,124312,124336,124350,124366,124380,124386,124388,124392,124406,124442,124462,124466,124468,124494,124508,124514,124520,124558,124572,124600,124610,124612,124616,124624,124646,124666,124694,124710,124716,124730,124742,124748,124760,124786,124788,124818,124820,124834,124836,124840,124854,124946,124948,124962,124964,124968,124982,124994,124996,125e3,125008,125022,125030,125036,125050,125058,125060,125064,125072,125086,125088,125116,125126,125132,125144,125166,125170,125172,125186,125188,125192,125200,125216,125244,125248,125304,125318,125324,125336,125360,125374,125390,125404,125410,125412,125416,125430,125444,125448,125456,125472,125504,125560,125680,125702,125708,125720,125744,125758,125792,125820,125838,125852,125880,125890,125892,125896,125904,125918,125926,125932,125978,125998,126002,126004,126030,126044,126050,126052,126056,126094,126108,126136,126146,126148,126152,126160,126182,126202,126222,126236,126264,126320,126334,126338,126340,126344,126352,126366,126368,126412,126450,126452,126486,126502,126508,126522,126534,126540,126552,126574,126578,126580,126598,126604,126616,126640,126654,126670,126684,126690,126692,126696,126738,126754,126756,126760,126774,126786,126788,126792,126800,126814,126822,126828,126842,126894,126898,126900,126934,127126,127142,127148,127162,127178,127186,127188,127254,127270,127276,127290,127302,127308,127320,127342,127346,127348,127370,127378,127380,127394,127396,127400,127450,127510,127526,127532,127546,127558,127576,127598,127602,127604,127622,127628,127640,127664,127678,127694,127708,127714,127716,127720,127734,127754,127762,127764,127778,127784,127810,127812,127816,127824,127838,127846,127866,127898,127918,127922,127924,128022,128038,128044,128058,128070,128076,128088,128110,128114,128116,128134,128140,128152,128176,128190,128206,128220,128226,128228,128232,128246,128262,128268,128280,128304,128318,128352,128380,128398,128412,128440,128450,128452,128456,128464,128478,128486,128492,128506,128522,128530,128532,128546,128548,128552,128566,128578,128580,128584,128592,128606,128614,128634,128642,128644,128648,128656,128670,128672,128700,128716,128754,128756,128794,128814,128818,128820,128846,128860,128866,128868,128872,128886,128918,128934,128940,128954,128978,128980,129178,129198,129202,129204,129238,129258,129306,129326,129330,129332,129358,129372,129378,129380,129384,129398,129430,129446,129452,129466,129482,129490,129492,129562,129582,129586,129588,129614,129628,129634,129636,129640,129654,129678,129692,129720,129730,129732,129736,129744,129758,129766,129772,129814,129830,129836,129850,129862,129868,129880,129902,129906,129908,129930,129938,129940,129954,129956,129960,129974,130010]),Ft.CODEWORD_TABLE=Int32Array.from([2627,1819,2622,2621,1813,1812,2729,2724,2723,2779,2774,2773,902,896,908,868,865,861,859,2511,873,871,1780,835,2493,825,2491,842,837,844,1764,1762,811,810,809,2483,807,2482,806,2480,815,814,813,812,2484,817,816,1745,1744,1742,1746,2655,2637,2635,2626,2625,2623,2628,1820,2752,2739,2737,2728,2727,2725,2730,2785,2783,2778,2777,2775,2780,787,781,747,739,736,2413,754,752,1719,692,689,681,2371,678,2369,700,697,694,703,1688,1686,642,638,2343,631,2341,627,2338,651,646,643,2345,654,652,1652,1650,1647,1654,601,599,2322,596,2321,594,2319,2317,611,610,608,606,2324,603,2323,615,614,612,1617,1616,1614,1612,616,1619,1618,2575,2538,2536,905,901,898,909,2509,2507,2504,870,867,864,860,2512,875,872,1781,2490,2489,2487,2485,1748,836,834,832,830,2494,827,2492,843,841,839,845,1765,1763,2701,2676,2674,2653,2648,2656,2634,2633,2631,2629,1821,2638,2636,2770,2763,2761,2750,2745,2753,2736,2735,2733,2731,1848,2740,2738,2786,2784,591,588,576,569,566,2296,1590,537,534,526,2276,522,2274,545,542,539,548,1572,1570,481,2245,466,2242,462,2239,492,485,482,2249,496,494,1534,1531,1528,1538,413,2196,406,2191,2188,425,419,2202,415,2199,432,430,427,1472,1467,1464,433,1476,1474,368,367,2160,365,2159,362,2157,2155,2152,378,377,375,2166,372,2165,369,2162,383,381,379,2168,1419,1418,1416,1414,385,1411,384,1423,1422,1420,1424,2461,802,2441,2439,790,786,783,794,2409,2406,2403,750,742,738,2414,756,753,1720,2367,2365,2362,2359,1663,693,691,684,2373,680,2370,702,699,696,704,1690,1687,2337,2336,2334,2332,1624,2329,1622,640,637,2344,634,2342,630,2340,650,648,645,2346,655,653,1653,1651,1649,1655,2612,2597,2595,2571,2568,2565,2576,2534,2529,2526,1787,2540,2537,907,904,900,910,2503,2502,2500,2498,1768,2495,1767,2510,2508,2506,869,866,863,2513,876,874,1782,2720,2713,2711,2697,2694,2691,2702,2672,2670,2664,1828,2678,2675,2647,2646,2644,2642,1823,2639,1822,2654,2652,2650,2657,2771,1855,2765,2762,1850,1849,2751,2749,2747,2754,353,2148,344,342,336,2142,332,2140,345,1375,1373,306,2130,299,2128,295,2125,319,314,311,2132,1354,1352,1349,1356,262,257,2101,253,2096,2093,274,273,267,2107,263,2104,280,278,275,1316,1311,1308,1320,1318,2052,202,2050,2044,2040,219,2063,212,2060,208,2055,224,221,2066,1260,1258,1252,231,1248,229,1266,1264,1261,1268,155,1998,153,1996,1994,1991,1988,165,164,2007,162,2006,159,2003,2e3,172,171,169,2012,166,2010,1186,1184,1182,1179,175,1176,173,1192,1191,1189,1187,176,1194,1193,2313,2307,2305,592,589,2294,2292,2289,578,572,568,2297,580,1591,2272,2267,2264,1547,538,536,529,2278,525,2275,547,544,541,1574,1571,2237,2235,2229,1493,2225,1489,478,2247,470,2244,465,2241,493,488,484,2250,498,495,1536,1533,1530,1539,2187,2186,2184,2182,1432,2179,1430,2176,1427,414,412,2197,409,2195,405,2193,2190,426,424,421,2203,418,2201,431,429,1473,1471,1469,1466,434,1477,1475,2478,2472,2470,2459,2457,2454,2462,803,2437,2432,2429,1726,2443,2440,792,789,785,2401,2399,2393,1702,2389,1699,2411,2408,2405,745,741,2415,758,755,1721,2358,2357,2355,2353,1661,2350,1660,2347,1657,2368,2366,2364,2361,1666,690,687,2374,683,2372,701,698,705,1691,1689,2619,2617,2610,2608,2605,2613,2593,2588,2585,1803,2599,2596,2563,2561,2555,1797,2551,1795,2573,2570,2567,2577,2525,2524,2522,2520,1786,2517,1785,2514,1783,2535,2533,2531,2528,1788,2541,2539,906,903,911,2721,1844,2715,2712,1838,1836,2699,2696,2693,2703,1827,1826,1824,2673,2671,2669,2666,1829,2679,2677,1858,1857,2772,1854,1853,1851,1856,2766,2764,143,1987,139,1986,135,133,131,1984,128,1983,125,1981,138,137,136,1985,1133,1132,1130,112,110,1974,107,1973,104,1971,1969,122,121,119,117,1977,114,1976,124,1115,1114,1112,1110,1117,1116,84,83,1953,81,1952,78,1950,1948,1945,94,93,91,1959,88,1958,85,1955,99,97,95,1961,1086,1085,1083,1081,1078,100,1090,1089,1087,1091,49,47,1917,44,1915,1913,1910,1907,59,1926,56,1925,53,1922,1919,66,64,1931,61,1929,1042,1040,1038,71,1035,70,1032,68,1048,1047,1045,1043,1050,1049,12,10,1869,1867,1864,1861,21,1880,19,1877,1874,1871,28,1888,25,1886,22,1883,982,980,977,974,32,30,991,989,987,984,34,995,994,992,2151,2150,2147,2146,2144,356,355,354,2149,2139,2138,2136,2134,1359,343,341,338,2143,335,2141,348,347,346,1376,1374,2124,2123,2121,2119,1326,2116,1324,310,308,305,2131,302,2129,298,2127,320,318,316,313,2133,322,321,1355,1353,1351,1357,2092,2091,2089,2087,1276,2084,1274,2081,1271,259,2102,256,2100,252,2098,2095,272,269,2108,266,2106,281,279,277,1317,1315,1313,1310,282,1321,1319,2039,2037,2035,2032,1203,2029,1200,1197,207,2053,205,2051,201,2049,2046,2043,220,218,2064,215,2062,211,2059,228,226,223,2069,1259,1257,1254,232,1251,230,1267,1265,1263,2316,2315,2312,2311,2309,2314,2304,2303,2301,2299,1593,2308,2306,590,2288,2287,2285,2283,1578,2280,1577,2295,2293,2291,579,577,574,571,2298,582,581,1592,2263,2262,2260,2258,1545,2255,1544,2252,1541,2273,2271,2269,2266,1550,535,532,2279,528,2277,546,543,549,1575,1573,2224,2222,2220,1486,2217,1485,2214,1482,1479,2238,2236,2234,2231,1496,2228,1492,480,477,2248,473,2246,469,2243,490,487,2251,497,1537,1535,1532,2477,2476,2474,2479,2469,2468,2466,2464,1730,2473,2471,2453,2452,2450,2448,1729,2445,1728,2460,2458,2456,2463,805,804,2428,2427,2425,2423,1725,2420,1724,2417,1722,2438,2436,2434,2431,1727,2444,2442,793,791,788,795,2388,2386,2384,1697,2381,1696,2378,1694,1692,2402,2400,2398,2395,1703,2392,1701,2412,2410,2407,751,748,744,2416,759,757,1807,2620,2618,1806,1805,2611,2609,2607,2614,1802,1801,1799,2594,2592,2590,2587,1804,2600,2598,1794,1793,1791,1789,2564,2562,2560,2557,1798,2554,1796,2574,2572,2569,2578,1847,1846,2722,1843,1842,1840,1845,2716,2714,1835,1834,1832,1830,1839,1837,2700,2698,2695,2704,1817,1811,1810,897,862,1777,829,826,838,1760,1758,808,2481,1741,1740,1738,1743,2624,1818,2726,2776,782,740,737,1715,686,679,695,1682,1680,639,628,2339,647,644,1645,1643,1640,1648,602,600,597,595,2320,593,2318,609,607,604,1611,1610,1608,1606,613,1615,1613,2328,926,924,892,886,899,857,850,2505,1778,824,823,821,819,2488,818,2486,833,831,828,840,1761,1759,2649,2632,2630,2746,2734,2732,2782,2781,570,567,1587,531,527,523,540,1566,1564,476,467,463,2240,486,483,1524,1521,1518,1529,411,403,2192,399,2189,423,416,1462,1457,1454,428,1468,1465,2210,366,363,2158,360,2156,357,2153,376,373,370,2163,1410,1409,1407,1405,382,1402,380,1417,1415,1412,1421,2175,2174,777,774,771,784,732,725,722,2404,743,1716,676,674,668,2363,665,2360,685,1684,1681,626,624,622,2335,620,2333,617,2330,641,635,649,1646,1644,1642,2566,928,925,2530,2527,894,891,888,2501,2499,2496,858,856,854,851,1779,2692,2668,2665,2645,2643,2640,2651,2768,2759,2757,2744,2743,2741,2748,352,1382,340,337,333,1371,1369,307,300,296,2126,315,312,1347,1342,1350,261,258,250,2097,246,2094,271,268,264,1306,1301,1298,276,1312,1309,2115,203,2048,195,2045,191,2041,213,209,2056,1246,1244,1238,225,1234,222,1256,1253,1249,1262,2080,2079,154,1997,150,1995,147,1992,1989,163,160,2004,156,2001,1175,1174,1172,1170,1167,170,1164,167,1185,1183,1180,1177,174,1190,1188,2025,2024,2022,587,586,564,559,556,2290,573,1588,520,518,512,2268,508,2265,530,1568,1565,461,457,2233,450,2230,446,2226,479,471,489,1526,1523,1520,397,395,2185,392,2183,389,2180,2177,410,2194,402,422,1463,1461,1459,1456,1470,2455,799,2433,2430,779,776,773,2397,2394,2390,734,728,724,746,1717,2356,2354,2351,2348,1658,677,675,673,670,667,688,1685,1683,2606,2589,2586,2559,2556,2552,927,2523,2521,2518,2515,1784,2532,895,893,890,2718,2709,2707,2689,2687,2684,2663,2662,2660,2658,1825,2667,2769,1852,2760,2758,142,141,1139,1138,134,132,129,126,1982,1129,1128,1126,1131,113,111,108,105,1972,101,1970,120,118,115,1109,1108,1106,1104,123,1113,1111,82,79,1951,75,1949,72,1946,92,89,86,1956,1077,1076,1074,1072,98,1069,96,1084,1082,1079,1088,1968,1967,48,45,1916,42,1914,39,1911,1908,60,57,54,1923,50,1920,1031,1030,1028,1026,67,1023,65,1020,62,1041,1039,1036,1033,69,1046,1044,1944,1943,1941,11,9,1868,7,1865,1862,1859,20,1878,16,1875,13,1872,970,968,966,963,29,960,26,23,983,981,978,975,33,971,31,990,988,985,1906,1904,1902,993,351,2145,1383,331,330,328,326,2137,323,2135,339,1372,1370,294,293,291,289,2122,286,2120,283,2117,309,303,317,1348,1346,1344,245,244,242,2090,239,2088,236,2085,2082,260,2099,249,270,1307,1305,1303,1300,1314,189,2038,186,2036,183,2033,2030,2026,206,198,2047,194,216,1247,1245,1243,1240,227,1237,1255,2310,2302,2300,2286,2284,2281,565,563,561,558,575,1589,2261,2259,2256,2253,1542,521,519,517,514,2270,511,533,1569,1567,2223,2221,2218,2215,1483,2211,1480,459,456,453,2232,449,474,491,1527,1525,1522,2475,2467,2465,2451,2449,2446,801,800,2426,2424,2421,2418,1723,2435,780,778,775,2387,2385,2382,2379,1695,2375,1693,2396,735,733,730,727,749,1718,2616,2615,2604,2603,2601,2584,2583,2581,2579,1800,2591,2550,2549,2547,2545,1792,2542,1790,2558,929,2719,1841,2710,2708,1833,1831,2690,2688,2686,1815,1809,1808,1774,1756,1754,1737,1736,1734,1739,1816,1711,1676,1674,633,629,1638,1636,1633,1641,598,1605,1604,1602,1600,605,1609,1607,2327,887,853,1775,822,820,1757,1755,1584,524,1560,1558,468,464,1514,1511,1508,1519,408,404,400,1452,1447,1444,417,1458,1455,2208,364,361,358,2154,1401,1400,1398,1396,374,1393,371,1408,1406,1403,1413,2173,2172,772,726,723,1712,672,669,666,682,1678,1675,625,623,621,618,2331,636,632,1639,1637,1635,920,918,884,880,889,849,848,847,846,2497,855,852,1776,2641,2742,2787,1380,334,1367,1365,301,297,1340,1338,1335,1343,255,251,247,1296,1291,1288,265,1302,1299,2113,204,196,192,2042,1232,1230,1224,214,1220,210,1242,1239,1235,1250,2077,2075,151,148,1993,144,1990,1163,1162,1160,1158,1155,161,1152,157,1173,1171,1168,1165,168,1181,1178,2021,2020,2018,2023,585,560,557,1585,516,509,1562,1559,458,447,2227,472,1516,1513,1510,398,396,393,390,2181,386,2178,407,1453,1451,1449,1446,420,1460,2209,769,764,720,712,2391,729,1713,664,663,661,659,2352,656,2349,671,1679,1677,2553,922,919,2519,2516,885,883,881,2685,2661,2659,2767,2756,2755,140,1137,1136,130,127,1125,1124,1122,1127,109,106,102,1103,1102,1100,1098,116,1107,1105,1980,80,76,73,1947,1068,1067,1065,1063,90,1060,87,1075,1073,1070,1080,1966,1965,46,43,40,1912,36,1909,1019,1018,1016,1014,58,1011,55,1008,51,1029,1027,1024,1021,63,1037,1034,1940,1939,1937,1942,8,1866,4,1863,1,1860,956,954,952,949,946,17,14,969,967,964,961,27,957,24,979,976,972,1901,1900,1898,1896,986,1905,1903,350,349,1381,329,327,324,1368,1366,292,290,287,284,2118,304,1341,1339,1337,1345,243,240,237,2086,233,2083,254,1297,1295,1293,1290,1304,2114,190,187,184,2034,180,2031,177,2027,199,1233,1231,1229,1226,217,1223,1241,2078,2076,584,555,554,552,550,2282,562,1586,507,506,504,502,2257,499,2254,515,1563,1561,445,443,441,2219,438,2216,435,2212,460,454,475,1517,1515,1512,2447,798,797,2422,2419,770,768,766,2383,2380,2376,721,719,717,714,731,1714,2602,2582,2580,2548,2546,2543,923,921,2717,2706,2705,2683,2682,2680,1771,1752,1750,1733,1732,1731,1735,1814,1707,1670,1668,1631,1629,1626,1634,1599,1598,1596,1594,1603,1601,2326,1772,1753,1751,1581,1554,1552,1504,1501,1498,1509,1442,1437,1434,401,1448,1445,2206,1392,1391,1389,1387,1384,359,1399,1397,1394,1404,2171,2170,1708,1672,1669,619,1632,1630,1628,1773,1378,1363,1361,1333,1328,1336,1286,1281,1278,248,1292,1289,2111,1218,1216,1210,197,1206,193,1228,1225,1221,1236,2073,2071,1151,1150,1148,1146,152,1143,149,1140,145,1161,1159,1156,1153,158,1169,1166,2017,2016,2014,2019,1582,510,1556,1553,452,448,1506,1500,394,391,387,1443,1441,1439,1436,1450,2207,765,716,713,1709,662,660,657,1673,1671,916,914,879,878,877,882,1135,1134,1121,1120,1118,1123,1097,1096,1094,1092,103,1101,1099,1979,1059,1058,1056,1054,77,1051,74,1066,1064,1061,1071,1964,1963,1007,1006,1004,1002,999,41,996,37,1017,1015,1012,1009,52,1025,1022,1936,1935,1933,1938,942,940,938,935,932,5,2,955,953,950,947,18,943,15,965,962,958,1895,1894,1892,1890,973,1899,1897,1379,325,1364,1362,288,285,1334,1332,1330,241,238,234,1287,1285,1283,1280,1294,2112,188,185,181,178,2028,1219,1217,1215,1212,200,1209,1227,2074,2072,583,553,551,1583,505,503,500,513,1557,1555,444,442,439,436,2213,455,451,1507,1505,1502,796,763,762,760,767,711,710,708,706,2377,718,715,1710,2544,917,915,2681,1627,1597,1595,2325,1769,1749,1747,1499,1438,1435,2204,1390,1388,1385,1395,2169,2167,1704,1665,1662,1625,1623,1620,1770,1329,1282,1279,2109,1214,1207,1222,2068,2065,1149,1147,1144,1141,146,1157,1154,2013,2011,2008,2015,1579,1549,1546,1495,1487,1433,1431,1428,1425,388,1440,2205,1705,658,1667,1664,1119,1095,1093,1978,1057,1055,1052,1062,1962,1960,1005,1003,1e3,997,38,1013,1010,1932,1930,1927,1934,941,939,936,933,6,930,3,951,948,944,1889,1887,1884,1881,959,1893,1891,35,1377,1360,1358,1327,1325,1322,1331,1277,1275,1272,1269,235,1284,2110,1205,1204,1201,1198,182,1195,179,1213,2070,2067,1580,501,1551,1548,440,437,1497,1494,1490,1503,761,709,707,1706,913,912,2198,1386,2164,2161,1621,1766,2103,1208,2058,2054,1145,1142,2005,2002,1999,2009,1488,1429,1426,2200,1698,1659,1656,1975,1053,1957,1954,1001,998,1924,1921,1918,1928,937,934,931,1879,1876,1873,1870,945,1885,1882,1323,1273,1270,2105,1202,1199,1196,1211,2061,2057,1576,1543,1540,1484,1481,1478,1491,1700]);class Vt{constructor(e,t){this.bits=e,this.points=t}getBits(){return this.bits}getPoints(){return this.points}}class Ut{static detectMultiple(e,t,n){let r=e.getBlackMatrix(),i=Ut.detect(n,r);return i.length||(r=r.clone(),r.rotate180(),i=Ut.detect(n,r)),new Vt(r,i)}static detect(e,t){const n=new Array;let r=0,i=0,o=!1;for(;r<t.getHeight();){const s=Ut.findVertices(t,r,i);if(null!=s[0]||null!=s[3]){if(o=!0,n.push(s),!e)break;null!=s[2]?(i=Math.trunc(s[2].getX()),r=Math.trunc(s[2].getY())):(i=Math.trunc(s[4].getX()),r=Math.trunc(s[4].getY()))}else{if(!o)break;o=!1,i=0;for(const e of n)null!=e[1]&&(r=Math.trunc(Math.max(r,e[1].getY()))),null!=e[3]&&(r=Math.max(r,Math.trunc(e[3].getY())));r+=Ut.ROW_STEP}}return n}static findVertices(e,t,n){const r=e.getHeight(),i=e.getWidth(),o=new Array(8);return Ut.copyToResult(o,Ut.findRowsWithPattern(e,r,i,t,n,Ut.START_PATTERN),Ut.INDEXES_START_PATTERN),null!=o[4]&&(n=Math.trunc(o[4].getX()),t=Math.trunc(o[4].getY())),Ut.copyToResult(o,Ut.findRowsWithPattern(e,r,i,t,n,Ut.STOP_PATTERN),Ut.INDEXES_STOP_PATTERN),o}static copyToResult(e,t,n){for(let r=0;r<n.length;r++)e[n[r]]=t[r]}static findRowsWithPattern(e,t,n,r,i,o){const s=new Array(4);let a=!1;const l=new Int32Array(o.length);for(;r<t;r+=Ut.ROW_STEP){let t=Ut.findGuardPattern(e,i,r,n,!1,o,l);if(null!=t){for(;r>0;){const s=Ut.findGuardPattern(e,i,--r,n,!1,o,l);if(null==s){r++;break}t=s}s[0]=new se(t[0],r),s[1]=new se(t[1],r),a=!0;break}}let c=r+1;if(a){let r=0,i=Int32Array.from([Math.trunc(s[0].getX()),Math.trunc(s[1].getX())]);for(;c<t;c++){const t=Ut.findGuardPattern(e,i[0],c,n,!1,o,l);if(null!=t&&Math.abs(i[0]-t[0])<Ut.MAX_PATTERN_DRIFT&&Math.abs(i[1]-t[1])<Ut.MAX_PATTERN_DRIFT)i=t,r=0;else{if(r>Ut.SKIPPED_ROW_COUNT_MAX)break;r++}}c-=r+1,s[2]=new se(i[0],c),s[3]=new se(i[1],c)}return c-r<Ut.BARCODE_MIN_HEIGHT&&w.fill(s,null),s}static findGuardPattern(e,t,n,r,i,o,s){w.fillWithin(s,0,s.length,0);let a=t,l=0;for(;e.get(a,n)&&a>0&&l++<Ut.MAX_PIXEL_DRIFT;)a--;let c=a,d=0,u=o.length;for(let t=i;c<r;c++)if(e.get(c,n)!==t)s[d]++;else{if(d===u-1){if(Ut.patternMatchVariance(s,o,Ut.MAX_INDIVIDUAL_VARIANCE)<Ut.MAX_AVG_VARIANCE)return new Int32Array([a,c]);a+=s[0]+s[1],m.arraycopy(s,2,s,0,d-1),s[d-1]=0,s[d]=0,d--}else d++;s[d]=1,t=!t}return d===u-1&&Ut.patternMatchVariance(s,o,Ut.MAX_INDIVIDUAL_VARIANCE)<Ut.MAX_AVG_VARIANCE?new Int32Array([a,c-1]):null}static patternMatchVariance(e,t,n){let r=e.length,i=0,o=0;for(let n=0;n<r;n++)i+=e[n],o+=t[n];if(i<o)return 1/0;let s=i/o;n*=s;let a=0;for(let i=0;i<r;i++){let r=e[i],o=t[i]*s,l=r>o?r-o:o-r;if(l>n)return 1/0;a+=l}return a/i}}Ut.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),Ut.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),Ut.MAX_AVG_VARIANCE=.42,Ut.MAX_INDIVIDUAL_VARIANCE=.8,Ut.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),Ut.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),Ut.MAX_PIXEL_DRIFT=3,Ut.MAX_PATTERN_DRIFT=5,Ut.SKIPPED_ROW_COUNT_MAX=25,Ut.ROW_STEP=5,Ut.BARCODE_MIN_HEIGHT=10;class Ht{constructor(e,t){if(0===t.length)throw new d;this.field=e;let n=t.length;if(n>1&&0===t[0]){let e=1;for(;e<n&&0===t[e];)e++;e===n?this.coefficients=new Int32Array([0]):(this.coefficients=new Int32Array(n-e),m.arraycopy(t,e,this.coefficients,0,this.coefficients.length))}else this.coefficients=t}getCoefficients(){return this.coefficients}getDegree(){return this.coefficients.length-1}isZero(){return 0===this.coefficients[0]}getCoefficient(e){return this.coefficients[this.coefficients.length-1-e]}evaluateAt(e){if(0===e)return this.getCoefficient(0);if(1===e){let e=0;for(let t of this.coefficients)e=this.field.add(e,t);return e}let t=this.coefficients[0],n=this.coefficients.length;for(let r=1;r<n;r++)t=this.field.add(this.field.multiply(e,t),this.coefficients[r]);return t}add(e){if(!this.field.equals(e.field))throw new d("ModulusPolys do not have same ModulusGF field");if(this.isZero())return e;if(e.isZero())return this;let t=this.coefficients,n=e.coefficients;if(t.length>n.length){let e=t;t=n,n=e}let r=new Int32Array(n.length),i=n.length-t.length;m.arraycopy(n,0,r,0,i);for(let e=i;e<n.length;e++)r[e]=this.field.add(t[e-i],n[e]);return new Ht(this.field,r)}subtract(e){if(!this.field.equals(e.field))throw new d("ModulusPolys do not have same ModulusGF field");return e.isZero()?this:this.add(e.negative())}multiply(e){return e instanceof Ht?this.multiplyOther(e):this.multiplyScalar(e)}multiplyOther(e){if(!this.field.equals(e.field))throw new d("ModulusPolys do not have same ModulusGF field");if(this.isZero()||e.isZero())return new Ht(this.field,new Int32Array([0]));let t=this.coefficients,n=t.length,r=e.coefficients,i=r.length,o=new Int32Array(n+i-1);for(let e=0;e<n;e++){let n=t[e];for(let t=0;t<i;t++)o[e+t]=this.field.add(o[e+t],this.field.multiply(n,r[t]))}return new Ht(this.field,o)}negative(){let e=this.coefficients.length,t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=this.field.subtract(0,this.coefficients[n]);return new Ht(this.field,t)}multiplyScalar(e){if(0===e)return new Ht(this.field,new Int32Array([0]));if(1===e)return this;let t=this.coefficients.length,n=new Int32Array(t);for(let r=0;r<t;r++)n[r]=this.field.multiply(this.coefficients[r],e);return new Ht(this.field,n)}multiplyByMonomial(e,t){if(e<0)throw new d;if(0===t)return new Ht(this.field,new Int32Array([0]));let n=this.coefficients.length,r=new Int32Array(n+e);for(let e=0;e<n;e++)r[e]=this.field.multiply(this.coefficients[e],t);return new Ht(this.field,r)}toString(){let e=new S;for(let t=this.getDegree();t>=0;t--){let n=this.getCoefficient(t);0!==n&&(n<0?(e.append(" - "),n=-n):e.length()>0&&e.append(" + "),0!==t&&1===n||e.append(n),0!==t&&(1===t?e.append("x"):(e.append("x^"),e.append(t))))}return e.toString()}}class Wt{add(e,t){return(e+t)%this.modulus}subtract(e,t){return(this.modulus+e-t)%this.modulus}exp(e){return this.expTable[e]}log(e){if(0===e)throw new d;return this.logTable[e]}inverse(e){if(0===e)throw new Q;return this.expTable[this.modulus-this.logTable[e]-1]}multiply(e,t){return 0===e||0===t?0:this.expTable[(this.logTable[e]+this.logTable[t])%(this.modulus-1)]}getSize(){return this.modulus}equals(e){return e===this}}class zt extends Wt{constructor(e,t){super(),this.modulus=e,this.expTable=new Int32Array(e),this.logTable=new Int32Array(e);let n=1;for(let r=0;r<e;r++)this.expTable[r]=n,n=n*t%e;for(let t=0;t<e-1;t++)this.logTable[this.expTable[t]]=t;this.zero=new Ht(this,new Int32Array([0])),this.one=new Ht(this,new Int32Array([1]))}getZero(){return this.zero}getOne(){return this.one}buildMonomial(e,t){if(e<0)throw new d;if(0===t)return this.zero;let n=new Int32Array(e+1);return n[0]=t,new Ht(this,n)}}zt.PDF417_GF=new zt(Ft.NUMBER_OF_CODEWORDS,3);class jt{constructor(){this.field=zt.PDF417_GF}decode(e,t,n){let r=new Ht(this.field,e),i=new Int32Array(t),o=!1;for(let e=t;e>0;e--){let n=r.evaluateAt(this.field.exp(e));i[t-e]=n,0!==n&&(o=!0)}if(!o)return 0;let s=this.field.getOne();if(null!=n)for(const t of n){let n=this.field.exp(e.length-1-t),r=new Ht(this.field,new Int32Array([this.field.subtract(0,n),1]));s=s.multiply(r)}let a=new Ht(this.field,i),l=this.runEuclideanAlgorithm(this.field.buildMonomial(t,1),a,t),c=l[0],d=l[1],u=this.findErrorLocations(c),f=this.findErrorMagnitudes(d,c,u);for(let t=0;t<u.length;t++){let n=e.length-1-this.field.log(u[t]);if(n<0)throw h.getChecksumInstance();e[n]=this.field.subtract(e[n],f[t])}return u.length}runEuclideanAlgorithm(e,t,n){if(e.getDegree()<t.getDegree()){let n=e;e=t,t=n}let r=e,i=t,o=this.field.getZero(),s=this.field.getOne();for(;i.getDegree()>=Math.round(n/2);){let e=r,t=o;if(r=i,o=s,r.isZero())throw h.getChecksumInstance();i=e;let n=this.field.getZero(),a=r.getCoefficient(r.getDegree()),l=this.field.inverse(a);for(;i.getDegree()>=r.getDegree()&&!i.isZero();){let e=i.getDegree()-r.getDegree(),t=this.field.multiply(i.getCoefficient(i.getDegree()),l);n=n.add(this.field.buildMonomial(e,t)),i=i.subtract(r.multiplyByMonomial(e,t))}s=n.multiply(o).subtract(t).negative()}let a=s.getCoefficient(0);if(0===a)throw h.getChecksumInstance();let l=this.field.inverse(a);return[s.multiply(l),i.multiply(l)]}findErrorLocations(e){let t=e.getDegree(),n=new Int32Array(t),r=0;for(let i=1;i<this.field.getSize()&&r<t;i++)0===e.evaluateAt(i)&&(n[r]=this.field.inverse(i),r++);if(r!==t)throw h.getChecksumInstance();return n}findErrorMagnitudes(e,t,n){let r=t.getDegree(),i=new Int32Array(r);for(let e=1;e<=r;e++)i[r-e]=this.field.multiply(e,t.getCoefficient(e));let o=new Ht(this.field,i),s=n.length,a=new Int32Array(s);for(let t=0;t<s;t++){let r=this.field.inverse(n[t]),i=this.field.subtract(0,e.evaluateAt(r)),s=this.field.inverse(o.evaluateAt(r));a[t]=this.field.multiply(i,s)}return a}}class qt{constructor(e,t,n,r,i){e instanceof qt?this.constructor_2(e):this.constructor_1(e,t,n,r,i)}constructor_1(e,t,n,r,i){const o=null==t||null==n,s=null==r||null==i;if(o&&s)throw new N;o?(t=new se(0,r.getY()),n=new se(0,i.getY())):s&&(r=new se(e.getWidth()-1,t.getY()),i=new se(e.getWidth()-1,n.getY())),this.image=e,this.topLeft=t,this.bottomLeft=n,this.topRight=r,this.bottomRight=i,this.minX=Math.trunc(Math.min(t.getX(),n.getX())),this.maxX=Math.trunc(Math.max(r.getX(),i.getX())),this.minY=Math.trunc(Math.min(t.getY(),r.getY())),this.maxY=Math.trunc(Math.max(n.getY(),i.getY()))}constructor_2(e){this.image=e.image,this.topLeft=e.getTopLeft(),this.bottomLeft=e.getBottomLeft(),this.topRight=e.getTopRight(),this.bottomRight=e.getBottomRight(),this.minX=e.getMinX(),this.maxX=e.getMaxX(),this.minY=e.getMinY(),this.maxY=e.getMaxY()}static merge(e,t){return null==e?t:null==t?e:new qt(e.image,e.topLeft,e.bottomLeft,t.topRight,t.bottomRight)}addMissingRows(e,t,n){let r=this.topLeft,i=this.bottomLeft,o=this.topRight,s=this.bottomRight;if(e>0){let t=n?this.topLeft:this.topRight,i=Math.trunc(t.getY()-e);i<0&&(i=0);let s=new se(t.getX(),i);n?r=s:o=s}if(t>0){let e=n?this.bottomLeft:this.bottomRight,r=Math.trunc(e.getY()+t);r>=this.image.getHeight()&&(r=this.image.getHeight()-1);let o=new se(e.getX(),r);n?i=o:s=o}return new qt(this.image,r,i,o,s)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class Gt{constructor(e,t,n,r){this.columnCount=e,this.errorCorrectionLevel=r,this.rowCountUpperPart=t,this.rowCountLowerPart=n,this.rowCount=t+n}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class Xt{constructor(){this.buffer=""}static form(e,t){let n=-1;function r(e,r,i,o,s,a){if("%%"===e)return"%";if(void 0===t[++n])return;e=o?parseInt(o.substr(1)):void 0;let l,c=s?parseInt(s.substr(1)):void 0;switch(a){case"s":l=t[n];break;case"c":l=t[n][0];break;case"f":l=parseFloat(t[n]).toFixed(e);break;case"p":l=parseFloat(t[n]).toPrecision(e);break;case"e":l=parseFloat(t[n]).toExponential(e);break;case"x":l=parseInt(t[n]).toString(c||16);break;case"d":l=parseFloat(parseInt(t[n],c||10).toPrecision(e)).toFixed(0)}l="object"==typeof l?JSON.stringify(l):(+l).toString(c);let d=parseInt(i),u=i&&i[0]+""=="0"?"0":" ";for(;l.length<d;)l=void 0!==r?l+u:u+l;return l}let i=/%(-)?(0?[0-9]+)?([.][0-9]+)?([#][0-9]+)?([scfpexd%])/g;return e.replace(i,r)}format(e,...t){this.buffer+=Xt.form(e,t)}toString(){return this.buffer}}class Yt{constructor(e){this.boundingBox=new qt(e),this.codewords=new Array(e.getMaxY()-e.getMinY()+1)}getCodewordNearby(e){let t=this.getCodeword(e);if(null!=t)return t;for(let n=1;n<Yt.MAX_NEARBY_DISTANCE;n++){let r=this.imageRowToCodewordIndex(e)-n;if(r>=0&&(t=this.codewords[r],null!=t))return t;if(r=this.imageRowToCodewordIndex(e)+n,r<this.codewords.length&&(t=this.codewords[r],null!=t))return t}return null}imageRowToCodewordIndex(e){return e-this.boundingBox.getMinY()}setCodeword(e,t){this.codewords[this.imageRowToCodewordIndex(e)]=t}getCodeword(e){return this.codewords[this.imageRowToCodewordIndex(e)]}getBoundingBox(){return this.boundingBox}getCodewords(){return this.codewords}toString(){const e=new Xt;let t=0;for(const n of this.codewords)null!=n?e.format("%3d: %3d|%3d%n",t++,n.getRowNumber(),n.getValue()):e.format("%3d: | %n",t++);return e.toString()}}Yt.MAX_NEARBY_DISTANCE=5;class Zt{constructor(){this.values=new Map}setValue(e){e=Math.trunc(e);let t=this.values.get(e);null==t&&(t=0),t++,this.values.set(e,t)}getValue(){let e=-1,t=new Array;for(const[n,r]of this.values.entries()){const i={getKey:()=>n,getValue:()=>r};i.getValue()>e?(e=i.getValue(),t=[],t.push(i.getKey())):i.getValue()===e&&t.push(i.getKey())}return Ft.toIntArray(t)}getConfidence(e){return this.values.get(e)}}class Kt extends Yt{constructor(e,t){super(e),this._isLeft=t}setRowNumbers(){for(let e of this.getCodewords())null!=e&&e.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(e){let t=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(t,e);let n=this.getBoundingBox(),r=this._isLeft?n.getTopLeft():n.getTopRight(),i=this._isLeft?n.getBottomLeft():n.getBottomRight(),o=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.imageRowToCodewordIndex(Math.trunc(i.getY())),a=-1,l=1,c=0;for(let n=o;n<s;n++){if(null==t[n])continue;let r=t[n],i=r.getRowNumber()-a;if(0===i)c++;else if(1===i)l=Math.max(l,c),c=1,a=r.getRowNumber();else if(i<0||r.getRowNumber()>=e.getRowCount()||i>n)t[n]=null;else{let e;e=l>2?(l-2)*i:i;let o=e>=n;for(let r=1;r<=e&&!o;r++)o=null!=t[n-r];o?t[n]=null:(a=r.getRowNumber(),c=1)}}}getRowHeights(){let e=this.getBarcodeMetadata();if(null==e)return null;this.adjustIncompleteIndicatorColumnRowNumbers(e);let t=new Int32Array(e.getRowCount());for(let e of this.getCodewords())if(null!=e){let n=e.getRowNumber();if(n>=t.length)continue;t[n]++}return t}adjustIncompleteIndicatorColumnRowNumbers(e){let t=this.getBoundingBox(),n=this._isLeft?t.getTopLeft():t.getTopRight(),r=this._isLeft?t.getBottomLeft():t.getBottomRight(),i=this.imageRowToCodewordIndex(Math.trunc(n.getY())),o=this.imageRowToCodewordIndex(Math.trunc(r.getY())),s=this.getCodewords(),a=-1;for(let t=i;t<o;t++){if(null==s[t])continue;let n=s[t];n.setRowNumberAsRowIndicatorColumn();let r=n.getRowNumber()-a;0===r||(1===r?a=n.getRowNumber():n.getRowNumber()>=e.getRowCount()?s[t]=null:a=n.getRowNumber())}}getBarcodeMetadata(){let e=this.getCodewords(),t=new Zt,n=new Zt,r=new Zt,i=new Zt;for(let o of e){if(null==o)continue;o.setRowNumberAsRowIndicatorColumn();let e=o.getValue()%30,s=o.getRowNumber();switch(this._isLeft||(s+=2),s%3){case 0:n.setValue(3*e+1);break;case 1:i.setValue(e/3),r.setValue(e%3);break;case 2:t.setValue(e+1)}}if(0===t.getValue().length||0===n.getValue().length||0===r.getValue().length||0===i.getValue().length||t.getValue()[0]<1||n.getValue()[0]+r.getValue()[0]<Ft.MIN_ROWS_IN_BARCODE||n.getValue()[0]+r.getValue()[0]>Ft.MAX_ROWS_IN_BARCODE)return null;let o=new Gt(t.getValue()[0],n.getValue()[0],r.getValue()[0],i.getValue()[0]);return this.removeIncorrectCodewords(e,o),o}removeIncorrectCodewords(e,t){for(let n=0;n<e.length;n++){let r=e[n];if(null==e[n])continue;let i=r.getValue()%30,o=r.getRowNumber();if(o>t.getRowCount())e[n]=null;else switch(this._isLeft||(o+=2),o%3){case 0:3*i+1!==t.getRowCountUpperPart()&&(e[n]=null);break;case 1:Math.trunc(i/3)===t.getErrorCorrectionLevel()&&i%3===t.getRowCountLowerPart()||(e[n]=null);break;case 2:i+1!==t.getColumnCount()&&(e[n]=null)}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+"\n"+super.toString()}}class Qt{constructor(e,t){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=e,this.barcodeColumnCount=e.getColumnCount(),this.boundingBox=t,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let e,t=Ft.MAX_CODEWORDS_IN_BARCODE;do{e=t,t=this.adjustRowNumbersAndGetCount()}while(t>0&&t<e);return this.detectionResultColumns}adjustIndicatorColumnRowNumbers(e){null!=e&&e.adjustCompleteIndicatorColumnRowNumbers(this.barcodeMetadata)}adjustRowNumbersAndGetCount(){let e=this.adjustRowNumbersByRow();if(0===e)return 0;for(let e=1;e<this.barcodeColumnCount+1;e++){let t=this.detectionResultColumns[e].getCodewords();for(let n=0;n<t.length;n++)null!=t[n]&&(t[n].hasValidRowNumber()||this.adjustRowNumbers(e,n,t))}return e}adjustRowNumbersByRow(){return this.adjustRowNumbersFromBothRI(),this.adjustRowNumbersFromLRI()+this.adjustRowNumbersFromRRI()}adjustRowNumbersFromBothRI(){if(null==this.detectionResultColumns[0]||null==this.detectionResultColumns[this.barcodeColumnCount+1])return;let e=this.detectionResultColumns[0].getCodewords(),t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<e.length;n++)if(null!=e[n]&&null!=t[n]&&e[n].getRowNumber()===t[n].getRowNumber())for(let t=1;t<=this.barcodeColumnCount;t++){let r=this.detectionResultColumns[t].getCodewords()[n];null!=r&&(r.setRowNumber(e[n].getRowNumber()),r.hasValidRowNumber()||(this.detectionResultColumns[t].getCodewords()[n]=null))}}adjustRowNumbersFromRRI(){if(null==this.detectionResultColumns[this.barcodeColumnCount+1])return 0;let e=0,t=this.detectionResultColumns[this.barcodeColumnCount+1].getCodewords();for(let n=0;n<t.length;n++){if(null==t[n])continue;let r=t[n].getRowNumber(),i=0;for(let t=this.barcodeColumnCount+1;t>0&&i<this.ADJUST_ROW_NUMBER_SKIP;t--){let o=this.detectionResultColumns[t].getCodewords()[n];null!=o&&(i=Qt.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}adjustRowNumbersFromLRI(){if(null==this.detectionResultColumns[0])return 0;let e=0,t=this.detectionResultColumns[0].getCodewords();for(let n=0;n<t.length;n++){if(null==t[n])continue;let r=t[n].getRowNumber(),i=0;for(let t=1;t<this.barcodeColumnCount+1&&i<this.ADJUST_ROW_NUMBER_SKIP;t++){let o=this.detectionResultColumns[t].getCodewords()[n];null!=o&&(i=Qt.adjustRowNumberIfValid(r,i,o),o.hasValidRowNumber()||e++)}}return e}static adjustRowNumberIfValid(e,t,n){return null==n||n.hasValidRowNumber()||(n.isValidRowNumber(e)?(n.setRowNumber(e),t=0):++t),t}adjustRowNumbers(e,t,n){if(!this.detectionResultColumns[e-1])return;let r=n[t],i=this.detectionResultColumns[e-1].getCodewords(),o=i;null!=this.detectionResultColumns[e+1]&&(o=this.detectionResultColumns[e+1].getCodewords());let s=new Array(14);s[2]=i[t],s[3]=o[t],t>0&&(s[0]=n[t-1],s[4]=i[t-1],s[5]=o[t-1]),t>1&&(s[8]=n[t-2],s[10]=i[t-2],s[11]=o[t-2]),t<n.length-1&&(s[1]=n[t+1],s[6]=i[t+1],s[7]=o[t+1]),t<n.length-2&&(s[9]=n[t+2],s[12]=i[t+2],s[13]=o[t+2]);for(let e of s)if(Qt.adjustRowNumber(r,e))return}static adjustRowNumber(e,t){return!(null==t||!t.hasValidRowNumber()||t.getBucket()!==e.getBucket()||(e.setRowNumber(t.getRowNumber()),0))}getBarcodeColumnCount(){return this.barcodeColumnCount}getBarcodeRowCount(){return this.barcodeMetadata.getRowCount()}getBarcodeECLevel(){return this.barcodeMetadata.getErrorCorrectionLevel()}setBoundingBox(e){this.boundingBox=e}getBoundingBox(){return this.boundingBox}setDetectionResultColumn(e,t){this.detectionResultColumns[e]=t}getDetectionResultColumn(e){return this.detectionResultColumns[e]}toString(){let e=this.detectionResultColumns[0];null==e&&(e=this.detectionResultColumns[this.barcodeColumnCount+1]);let t=new Xt;for(let n=0;n<e.getCodewords().length;n++){t.format("CW %3d:",n);for(let e=0;e<this.barcodeColumnCount+2;e++){if(null==this.detectionResultColumns[e]){t.format(" | ");continue}let r=this.detectionResultColumns[e].getCodewords()[n];null!=r?t.format(" %3d|%3d",r.getRowNumber(),r.getValue()):t.format(" | ")}t.format("%n")}return t.toString()}}class Jt{constructor(e,t,n,r){this.rowNumber=Jt.BARCODE_ROW_UNKNOWN,this.startX=Math.trunc(e),this.endX=Math.trunc(t),this.bucket=Math.trunc(n),this.value=Math.trunc(r)}hasValidRowNumber(){return this.isValidRowNumber(this.rowNumber)}isValidRowNumber(e){return e!==Jt.BARCODE_ROW_UNKNOWN&&this.bucket===e%3*3}setRowNumberAsRowIndicatorColumn(){this.rowNumber=Math.trunc(3*Math.trunc(this.value/30)+Math.trunc(this.bucket/3))}getWidth(){return this.endX-this.startX}getStartX(){return this.startX}getEndX(){return this.endX}getBucket(){return this.bucket}getValue(){return this.value}getRowNumber(){return this.rowNumber}setRowNumber(e){this.rowNumber=e}toString(){return this.rowNumber+"|"+this.value}}Jt.BARCODE_ROW_UNKNOWN=-1;class en{static initialize(){for(let e=0;e<Ft.SYMBOL_TABLE.length;e++){let t=Ft.SYMBOL_TABLE[e],n=1&t;for(let r=0;r<Ft.BARS_IN_MODULE;r++){let i=0;for(;(1&t)===n;)i+=1,t>>=1;n=1&t,en.RATIOS_TABLE[e]||(en.RATIOS_TABLE[e]=new Array(Ft.BARS_IN_MODULE)),en.RATIOS_TABLE[e][Ft.BARS_IN_MODULE-r-1]=Math.fround(i/Ft.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(e){let t=en.getDecodedCodewordValue(en.sampleBitCounts(e));return-1!==t?t:en.getClosestDecodedValue(e)}static sampleBitCounts(e){let t=ie.sum(e),n=new Int32Array(Ft.BARS_IN_MODULE),r=0,i=0;for(let o=0;o<Ft.MODULES_IN_CODEWORD;o++){let s=t/(2*Ft.MODULES_IN_CODEWORD)+o*t/Ft.MODULES_IN_CODEWORD;i+e[r]<=s&&(i+=e[r],r++),n[r]++}return n}static getDecodedCodewordValue(e){let t=en.getBitValue(e);return-1===Ft.getCodeword(t)?-1:t}static getBitValue(e){let t=0;for(let n=0;n<e.length;n++)for(let r=0;r<e[n];r++)t=t<<1|(n%2==0?1:0);return Math.trunc(t)}static getClosestDecodedValue(e){let t=ie.sum(e),n=new Array(Ft.BARS_IN_MODULE);if(t>1)for(let r=0;r<n.length;r++)n[r]=Math.fround(e[r]/t);let r=oe.MAX_VALUE,i=-1;this.bSymbolTableReady||en.initialize();for(let e=0;e<en.RATIOS_TABLE.length;e++){let t=0,o=en.RATIOS_TABLE[e];for(let e=0;e<Ft.BARS_IN_MODULE;e++){let i=Math.fround(o[e]-n[e]);if(t+=Math.fround(i*i),t>=r)break}t<r&&(r=t,i=Ft.SYMBOL_TABLE[e])}return i}}en.bSymbolTableReady=!1,en.RATIOS_TABLE=new Array(Ft.SYMBOL_TABLE.length).map(e=>new Array(Ft.BARS_IN_MODULE));class tn{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(e){this.segmentIndex=e}getFileId(){return this.fileId}setFileId(e){this.fileId=e}getOptionalData(){return this.optionalData}setOptionalData(e){this.optionalData=e}isLastSegment(){return this.lastSegment}setLastSegment(e){this.lastSegment=e}getSegmentCount(){return this.segmentCount}setSegmentCount(e){this.segmentCount=e}getSender(){return this.sender||null}setSender(e){this.sender=e}getAddressee(){return this.addressee||null}setAddressee(e){this.addressee=e}getFileName(){return this.fileName}setFileName(e){this.fileName=e}getFileSize(){return this.fileSize}setFileSize(e){this.fileSize=e}getChecksum(){return this.checksum}setChecksum(e){this.checksum=e}getTimestamp(){return this.timestamp}setTimestamp(e){this.timestamp=e}}class nn{static parseLong(e,t=void 0){return parseInt(e,t)}}class rn extends l{}rn.kind="NullPointerException";class on{writeBytes(e){this.writeBytesOffset(e,0,e.length)}writeBytesOffset(e,t,n){if(null==e)throw new rn;if(t<0||t>e.length||n<0||t+n>e.length||t+n<0)throw new p;if(0!==n)for(let r=0;r<n;r++)this.write(e[t+r])}flush(){}close(){}}class sn extends l{}class an extends on{constructor(e=32){if(super(),this.count=0,e<0)throw new d("Negative initial size: "+e);this.buf=new Uint8Array(e)}ensureCapacity(e){e-this.buf.length>0&&this.grow(e)}grow(e){let t=this.buf.length<<1;if(t-e<0&&(t=e),t<0){if(e<0)throw new sn;t=y.MAX_VALUE}this.buf=w.copyOfUint8Array(this.buf,t)}write(e){this.ensureCapacity(this.count+1),this.buf[this.count]=e,this.count+=1}writeBytesOffset(e,t,n){if(t<0||t>e.length||n<0||t+n-e.length>0)throw new p;this.ensureCapacity(this.count+n),m.arraycopy(e,t,this.buf,this.count,n),this.count+=n}writeTo(e){e.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return w.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(e){return e?"string"==typeof e?this.toString_string(e):this.toString_number(e):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(e){return new String(this.buf).toString()}toString_number(e){return new String(this.buf).toString()}close(){}}function ln(){if("undefined"!=typeof window)return window.BigInt||null;if(void 0!==ru)return ru.BigInt||null;if("undefined"!=typeof self)return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let cn;function dn(e){if(void 0===cn&&(cn=ln()),null===cn)throw new Error("BigInt is not supported!");return cn(e)}function un(){let e=[];e[0]=dn(1);let t=dn(900);e[1]=t;for(let n=2;n<16;n++)e[n]=e[n-1]*t;return e}!function(e){e[e.ALPHA=0]="ALPHA",e[e.LOWER=1]="LOWER",e[e.MIXED=2]="MIXED",e[e.PUNCT=3]="PUNCT",e[e.ALPHA_SHIFT=4]="ALPHA_SHIFT",e[e.PUNCT_SHIFT=5]="PUNCT_SHIFT"}(G||(G={}));class hn{static decode(e,t){let n=new S(""),r=E.ISO8859_1;n.enableDecoding(r);let i=1,o=e[i++],s=new tn;for(;i<e[0];){switch(o){case hn.TEXT_COMPACTION_MODE_LATCH:i=hn.textCompaction(e,i,n);break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:i=hn.byteCompaction(o,e,r,i,n);break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:n.append(e[i++]);break;case hn.NUMERIC_COMPACTION_MODE_LATCH:i=hn.numericCompaction(e,i,n);break;case hn.ECI_CHARSET:E.getCharacterSetECIByValue(e[i++]);break;case hn.ECI_GENERAL_PURPOSE:i+=2;break;case hn.ECI_USER_DEFINED:i++;break;case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:i=hn.decodeMacroBlock(e,i,s);break;case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:throw new C;default:i--,i=hn.textCompaction(e,i,n)}if(!(i<e.length))throw C.getFormatInstance();o=e[i++]}if(0===n.length())throw C.getFormatInstance();let a=new Y(null,n.toString(),null,t);return a.setOther(s),a}static decodeMacroBlock(e,t,n){if(t+hn.NUMBER_OF_SEQUENCE_CODEWORDS>e[0])throw C.getFormatInstance();let r=new Int32Array(hn.NUMBER_OF_SEQUENCE_CODEWORDS);for(let n=0;n<hn.NUMBER_OF_SEQUENCE_CODEWORDS;n++,t++)r[n]=e[t];n.setSegmentIndex(y.parseInt(hn.decodeBase900toBase10(r,hn.NUMBER_OF_SEQUENCE_CODEWORDS)));let i=new S;t=hn.textCompaction(e,t,i),n.setFileId(i.toString());let o=-1;for(e[t]===hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD&&(o=t+1);t<e[0];)switch(e[t]){case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:switch(e[++t]){case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME:let r=new S;t=hn.textCompaction(e,t+1,r),n.setFileName(r.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER:let i=new S;t=hn.textCompaction(e,t+1,i),n.setSender(i.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE:let o=new S;t=hn.textCompaction(e,t+1,o),n.setAddressee(o.toString());break;case hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT:let s=new S;t=hn.numericCompaction(e,t+1,s),n.setSegmentCount(y.parseInt(s.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP:let a=new S;t=hn.numericCompaction(e,t+1,a),n.setTimestamp(nn.parseLong(a.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM:let l=new S;t=hn.numericCompaction(e,t+1,l),n.setChecksum(y.parseInt(l.toString()));break;case hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE:let c=new S;t=hn.numericCompaction(e,t+1,c),n.setFileSize(nn.parseLong(c.toString()));break;default:throw C.getFormatInstance()}break;case hn.MACRO_PDF417_TERMINATOR:t++,n.setLastSegment(!0);break;default:throw C.getFormatInstance()}if(-1!==o){let r=t-o;n.isLastSegment()&&r--,n.setOptionalData(w.copyOfRange(e,o,o+r))}return t}static textCompaction(e,t,n){let r=new Int32Array(2*(e[0]-t)),i=new Int32Array(2*(e[0]-t)),o=0,s=!1;for(;t<e[0]&&!s;){let n=e[t++];if(n<hn.TEXT_COMPACTION_MODE_LATCH)r[o]=n/30,r[o+1]=n%30,o+=2;else switch(n){case hn.TEXT_COMPACTION_MODE_LATCH:r[o++]=hn.TEXT_COMPACTION_MODE_LATCH;break;case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:t--,s=!0;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r[o]=hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE,n=e[t++],i[o]=n,o++}}return hn.decodeTextCompaction(r,i,o,n),t}static decodeTextCompaction(e,t,n,r){let i=G.ALPHA,o=G.ALPHA,s=0;for(;s<n;){let n=e[s],a="";switch(i){case G.ALPHA:if(n<26)a=String.fromCharCode(65+n);else switch(n){case 26:a=" ";break;case hn.LL:i=G.LOWER;break;case hn.ML:i=G.MIXED;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.LOWER:if(n<26)a=String.fromCharCode(97+n);else switch(n){case 26:a=" ";break;case hn.AS:o=i,i=G.ALPHA_SHIFT;break;case hn.ML:i=G.MIXED;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.MIXED:if(n<hn.PL)a=hn.MIXED_CHARS[n];else switch(n){case hn.PL:i=G.PUNCT;break;case 26:a=" ";break;case hn.LL:i=G.LOWER;break;case hn.AL:i=G.ALPHA;break;case hn.PS:o=i,i=G.PUNCT_SHIFT;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT:if(n<hn.PAL)a=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:i=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.ALPHA_SHIFT:if(i=o,n<26)a=String.fromCharCode(65+n);else switch(n){case 26:a=" ";break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}break;case G.PUNCT_SHIFT:if(i=o,n<hn.PAL)a=hn.PUNCT_CHARS[n];else switch(n){case hn.PAL:i=G.ALPHA;break;case hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE:r.append(t[s]);break;case hn.TEXT_COMPACTION_MODE_LATCH:i=G.ALPHA}}""!==a&&r.append(a),s++}}static byteCompaction(e,t,n,r,i){let o=new an,s=0,a=0,l=!1;switch(e){case hn.BYTE_COMPACTION_MODE_LATCH:let e=new Int32Array(6),n=t[r++];for(;r<t[0]&&!l;)switch(e[s++]=n,a=900*a+n,n=t[r++],n){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:r--,l=!0;break;default:if(s%5==0&&s>0){for(let e=0;e<6;++e)o.write(Number(dn(a)>>dn(8*(5-e))));a=0,s=0}}r===t[0]&&n<hn.TEXT_COMPACTION_MODE_LATCH&&(e[s++]=n);for(let t=0;t<s;t++)o.write(e[t]);break;case hn.BYTE_COMPACTION_MODE_LATCH_6:for(;r<t[0]&&!l;){let e=t[r++];if(e<hn.TEXT_COMPACTION_MODE_LATCH)s++,a=900*a+e;else switch(e){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.NUMERIC_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:r--,l=!0}if(s%5==0&&s>0){for(let e=0;e<6;++e)o.write(Number(dn(a)>>dn(8*(5-e))));a=0,s=0}}}return i.append($.decode(o.toByteArray(),n)),r}static numericCompaction(e,t,n){let r=0,i=!1,o=new Int32Array(hn.MAX_NUMERIC_CODEWORDS);for(;t<e[0]&&!i;){let s=e[t++];if(t===e[0]&&(i=!0),s<hn.TEXT_COMPACTION_MODE_LATCH)o[r]=s,r++;else switch(s){case hn.TEXT_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH:case hn.BYTE_COMPACTION_MODE_LATCH_6:case hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK:case hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD:case hn.MACRO_PDF417_TERMINATOR:t--,i=!0}(r%hn.MAX_NUMERIC_CODEWORDS===0||s===hn.NUMERIC_COMPACTION_MODE_LATCH||i)&&r>0&&(n.append(hn.decodeBase900toBase10(o,r)),r=0)}return t}static decodeBase900toBase10(e,t){let n=dn(0);for(let r=0;r<t;r++)n+=hn.EXP900[t-r-1]*dn(e[r]);let r=n.toString();if("1"!==r.charAt(0))throw new C;return r.substring(1)}}hn.TEXT_COMPACTION_MODE_LATCH=900,hn.BYTE_COMPACTION_MODE_LATCH=901,hn.NUMERIC_COMPACTION_MODE_LATCH=902,hn.BYTE_COMPACTION_MODE_LATCH_6=924,hn.ECI_USER_DEFINED=925,hn.ECI_GENERAL_PURPOSE=926,hn.ECI_CHARSET=927,hn.BEGIN_MACRO_PDF417_CONTROL_BLOCK=928,hn.BEGIN_MACRO_PDF417_OPTIONAL_FIELD=923,hn.MACRO_PDF417_TERMINATOR=922,hn.MODE_SHIFT_TO_BYTE_COMPACTION_MODE=913,hn.MAX_NUMERIC_CODEWORDS=15,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_NAME=0,hn.MACRO_PDF417_OPTIONAL_FIELD_SEGMENT_COUNT=1,hn.MACRO_PDF417_OPTIONAL_FIELD_TIME_STAMP=2,hn.MACRO_PDF417_OPTIONAL_FIELD_SENDER=3,hn.MACRO_PDF417_OPTIONAL_FIELD_ADDRESSEE=4,hn.MACRO_PDF417_OPTIONAL_FIELD_FILE_SIZE=5,hn.MACRO_PDF417_OPTIONAL_FIELD_CHECKSUM=6,hn.PL=25,hn.LL=27,hn.AS=27,hn.ML=28,hn.AL=28,hn.PS=29,hn.PAL=29,hn.PUNCT_CHARS=";<>@[\\]_`~!\r\t,:\n-.$/\"|*()?{}'",hn.MIXED_CHARS="0123456789&\r\t,:#-.$/+%*=^",hn.EXP900=ln()?un():[],hn.NUMBER_OF_SEQUENCE_CODEWORDS=2;class fn{constructor(){}static decode(e,t,n,r,i,o,s){let a,l=new qt(e,t,n,r,i),c=null,d=null;for(let n=!0;;n=!1){if(null!=t&&(c=fn.getRowIndicatorColumn(e,l,t,!0,o,s)),null!=r&&(d=fn.getRowIndicatorColumn(e,l,r,!1,o,s)),a=fn.merge(c,d),null==a)throw N.getNotFoundInstance();let i=a.getBoundingBox();if(!n||null==i||!(i.getMinY()<l.getMinY()||i.getMaxY()>l.getMaxY()))break;l=i}a.setBoundingBox(l);let u=a.getBarcodeColumnCount()+1;a.setDetectionResultColumn(0,c),a.setDetectionResultColumn(u,d);let h=null!=c;for(let t=1;t<=u;t++){let n,r=h?t:u-t;if(void 0!==a.getDetectionResultColumn(r))continue;n=0===r||r===u?new Kt(l,0===r):new Yt(l),a.setDetectionResultColumn(r,n);let i=-1,c=i;for(let t=l.getMinY();t<=l.getMaxY();t++){if(i=fn.getStartColumn(a,r,t,h),i<0||i>l.getMaxX()){if(-1===c)continue;i=c}let d=fn.detectCodeword(e,l.getMinX(),l.getMaxX(),h,i,t,o,s);null!=d&&(n.setCodeword(t,d),c=i,o=Math.min(o,d.getWidth()),s=Math.max(s,d.getWidth()))}}return fn.createDecoderResult(a)}static merge(e,t){if(null==e&&null==t)return null;let n=fn.getBarcodeMetadata(e,t);if(null==n)return null;let r=qt.merge(fn.adjustBoundingBox(e),fn.adjustBoundingBox(t));return new Qt(n,r)}static adjustBoundingBox(e){if(null==e)return null;let t=e.getRowHeights();if(null==t)return null;let n=fn.getMax(t),r=0;for(let e of t)if(r+=n-e,e>0)break;let i=e.getCodewords();for(let e=0;r>0&&null==i[e];e++)r--;let o=0;for(let e=t.length-1;e>=0&&(o+=n-t[e],!(t[e]>0));e--);for(let e=i.length-1;o>0&&null==i[e];e--)o--;return e.getBoundingBox().addMissingRows(r,o,e.isLeft())}static getMax(e){let t=-1;for(let n of e)t=Math.max(t,n);return t}static getBarcodeMetadata(e,t){let n,r;return null==e||null==(n=e.getBarcodeMetadata())?null==t?null:t.getBarcodeMetadata():null==t||null==(r=t.getBarcodeMetadata())?n:n.getColumnCount()!==r.getColumnCount()&&n.getErrorCorrectionLevel()!==r.getErrorCorrectionLevel()&&n.getRowCount()!==r.getRowCount()?null:n}static getRowIndicatorColumn(e,t,n,r,i,o){let s=new Kt(t,r);for(let a=0;a<2;a++){let l=0===a?1:-1,c=Math.trunc(Math.trunc(n.getX()));for(let a=Math.trunc(Math.trunc(n.getY()));a<=t.getMaxY()&&a>=t.getMinY();a+=l){let t=fn.detectCodeword(e,0,e.getWidth(),r,c,a,i,o);null!=t&&(s.setCodeword(a,t),c=r?t.getStartX():t.getEndX())}}return s}static adjustCodewordCount(e,t){let n=t[0][1],r=n.getValue(),i=e.getBarcodeColumnCount()*e.getBarcodeRowCount()-fn.getNumberOfECCodeWords(e.getBarcodeECLevel());if(0===r.length){if(i<1||i>Ft.MAX_CODEWORDS_IN_BARCODE)throw N.getNotFoundInstance();n.setValue(i)}else r[0]!==i&&n.setValue(i)}static createDecoderResult(e){let t=fn.createBarcodeMatrix(e);fn.adjustCodewordCount(e,t);let n=new Array,r=new Int32Array(e.getBarcodeRowCount()*e.getBarcodeColumnCount()),i=[],o=new Array;for(let s=0;s<e.getBarcodeRowCount();s++)for(let a=0;a<e.getBarcodeColumnCount();a++){let l=t[s][a+1].getValue(),c=s*e.getBarcodeColumnCount()+a;0===l.length?n.push(c):1===l.length?r[c]=l[0]:(o.push(c),i.push(l))}let s=new Array(i.length);for(let e=0;e<s.length;e++)s[e]=i[e];return fn.createDecoderResultFromAmbiguousValues(e.getBarcodeECLevel(),r,Ft.toIntArray(n),Ft.toIntArray(o),s)}static createDecoderResultFromAmbiguousValues(e,t,n,r,i){let o=new Int32Array(r.length),s=100;for(;s-- >0;){for(let e=0;e<o.length;e++)t[r[e]]=i[e][o[e]];try{return fn.decodeCodewords(t,e,n)}catch(e){if(!(e instanceof h))throw e}if(0===o.length)throw h.getChecksumInstance();for(let e=0;e<o.length;e++){if(o[e]<i[e].length-1){o[e]++;break}if(o[e]=0,e===o.length-1)throw h.getChecksumInstance()}}throw h.getChecksumInstance()}static createBarcodeMatrix(e){let t=Array.from({length:e.getBarcodeRowCount()},()=>new Array(e.getBarcodeColumnCount()+2));for(let e=0;e<t.length;e++)for(let n=0;n<t[e].length;n++)t[e][n]=new Zt;let n=0;for(let r of e.getDetectionResultColumns()){if(null!=r)for(let e of r.getCodewords())if(null!=e){let r=e.getRowNumber();if(r>=0){if(r>=t.length)continue;t[r][n].setValue(e.getValue())}}n++}return t}static isValidBarcodeColumn(e,t){return t>=0&&t<=e.getBarcodeColumnCount()+1}static getStartColumn(e,t,n,r){let i=r?1:-1,o=null;if(fn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodeword(n)),null!=o)return r?o.getEndX():o.getStartX();if(o=e.getDetectionResultColumn(t).getCodewordNearby(n),null!=o)return r?o.getStartX():o.getEndX();if(fn.isValidBarcodeColumn(e,t-i)&&(o=e.getDetectionResultColumn(t-i).getCodewordNearby(n)),null!=o)return r?o.getEndX():o.getStartX();let s=0;for(;fn.isValidBarcodeColumn(e,t-i);){t-=i;for(let n of e.getDetectionResultColumn(t).getCodewords())if(null!=n)return(r?n.getEndX():n.getStartX())+i*s*(n.getEndX()-n.getStartX());s++}return r?e.getBoundingBox().getMinX():e.getBoundingBox().getMaxX()}static detectCodeword(e,t,n,r,i,o,s,a){i=fn.adjustCodewordStartColumn(e,t,n,r,i,o);let l,c=fn.getModuleBitCount(e,t,n,r,i,o);if(null==c)return null;let d=ie.sum(c);if(r)l=i+d;else{for(let e=0;e<c.length/2;e++){let t=c[e];c[e]=c[c.length-1-e],c[c.length-1-e]=t}l=i,i=l-d}if(!fn.checkCodewordSkew(d,s,a))return null;let u=en.getDecodedValue(c),h=Ft.getCodeword(u);return-1===h?null:new Jt(i,l,fn.getCodewordBucketNumber(u),h)}static getModuleBitCount(e,t,n,r,i,o){let s=i,a=new Int32Array(8),l=0,c=r?1:-1,d=r;for(;(r?s<n:s>=t)&&l<a.length;)e.get(s,o)===d?(a[l]++,s+=c):(l++,d=!d);return l===a.length||s===(r?n:t)&&l===a.length-1?a:null}static getNumberOfECCodeWords(e){return 2<<e}static adjustCodewordStartColumn(e,t,n,r,i,o){let s=i,a=r?-1:1;for(let l=0;l<2;l++){for(;(r?s>=t:s<n)&&r===e.get(s,o);){if(Math.abs(i-s)>fn.CODEWORD_SKEW_SIZE)return i;s+=a}a=-a,r=!r}return s}static checkCodewordSkew(e,t,n){return t-fn.CODEWORD_SKEW_SIZE<=e&&e<=n+fn.CODEWORD_SKEW_SIZE}static decodeCodewords(e,t,n){if(0===e.length)throw C.getFormatInstance();let r=1<<t+1,i=fn.correctErrors(e,n,r);fn.verifyCodewordCount(e,r);let o=hn.decode(e,""+t);return o.setErrorsCorrected(i),o.setErasures(n.length),o}static correctErrors(e,t,n){if(null!=t&&t.length>n/2+fn.MAX_ERRORS||n<0||n>fn.MAX_EC_CODEWORDS)throw h.getChecksumInstance();return fn.errorCorrection.decode(e,n,t)}static verifyCodewordCount(e,t){if(e.length<4)throw C.getFormatInstance();let n=e[0];if(n>e.length)throw C.getFormatInstance();if(0===n){if(!(t<e.length))throw C.getFormatInstance();e[0]=e.length-t}}static getBitCountForCodeword(e){let t=new Int32Array(8),n=0,r=t.length-1;for(;!((1&e)!==n&&(n=1&e,r--,r<0));)t[r]++,e>>=1;return t}static getCodewordBucketNumber(e){return e instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(e):this.getCodewordBucketNumber_number(e)}static getCodewordBucketNumber_number(e){return fn.getCodewordBucketNumber(fn.getBitCountForCodeword(e))}static getCodewordBucketNumber_Int32Array(e){return(e[0]-e[2]+e[4]-e[6]+9)%9}static toString(e){let t=new Xt;for(let n=0;n<e.length;n++){t.format("Row %2d: ",n);for(let r=0;r<e[n].length;r++){let i=e[n][r];0===i.getValue().length?t.format(" ",null):t.format("%4d(%2d)",i.getValue()[0],i.getConfidence(i.getValue()[0]))}t.format("%n")}return t.toString()}}fn.CODEWORD_SKEW_SIZE=2,fn.MAX_ERRORS=3,fn.MAX_EC_CODEWORDS=512,fn.errorCorrection=new jt;class mn{decode(e,t=null){let n=mn.decode(e,t,!1);if(null==n||0===n.length||null==n[0])throw N.getNotFoundInstance();return n[0]}decodeMultiple(e,t=null){try{return mn.decode(e,t,!0)}catch(e){if(e instanceof C||e instanceof h)throw N.getNotFoundInstance();throw e}}static decode(e,t,n){const r=new Array,i=Ut.detectMultiple(e,t,n);for(const e of i.getPoints()){const t=fn.decode(i.getBits(),e[4],e[5],e[6],e[7],mn.getMinCodewordWidth(e),mn.getMaxCodewordWidth(e)),n=new F(t.getText(),t.getRawBytes(),void 0,e,U.PDF_417);n.putMetadata(X.ERROR_CORRECTION_LEVEL,t.getECLevel());const o=t.getOther();null!=o&&n.putMetadata(X.PDF417_EXTRA_METADATA,o),r.push(n)}return r.map(e=>e)}static getMaxWidth(e,t){return null==e||null==t?0:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMinWidth(e,t){return null==e||null==t?y.MAX_VALUE:Math.trunc(Math.abs(e.getX()-t.getX()))}static getMaxCodewordWidth(e){return Math.floor(Math.max(Math.max(mn.getMaxWidth(e[0],e[4]),mn.getMaxWidth(e[6],e[2])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN),Math.max(mn.getMaxWidth(e[1],e[5]),mn.getMaxWidth(e[7],e[3])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(e){return Math.floor(Math.min(Math.min(mn.getMinWidth(e[0],e[4]),mn.getMinWidth(e[6],e[2])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN),Math.min(mn.getMinWidth(e[1],e[5]),mn.getMinWidth(e[7],e[3])*Ft.MODULES_IN_CODEWORD/Ft.MODULES_IN_STOP_PATTERN)))}reset(){}}class pn extends l{}pn.kind="ReaderException";class gn{constructor(e,t){this.verbose=!0===e,t&&this.setHints(t)}decode(e,t){return t&&this.setHints(t),this.decodeInternal(e)}decodeWithState(e){return null!==this.readers&&void 0!==this.readers||this.setHints(null),this.decodeInternal(e)}setHints(e){this.hints=e;const n=!t(e)&&!0===e.get(_.TRY_HARDER),r=t(e)?null:e.get(_.POSSIBLE_FORMATS),i=new Array;if(!t(r)){const t=r.some(e=>e===U.UPC_A||e===U.UPC_E||e===U.EAN_13||e===U.EAN_8||e===U.CODABAR||e===U.CODE_39||e===U.CODE_93||e===U.CODE_128||e===U.ITF||e===U.RSS_14||e===U.RSS_EXPANDED);t&&!n&&i.push(new at(e,this.verbose)),r.includes(U.QR_CODE)&&i.push(new Lt),r.includes(U.DATA_MATRIX)&&i.push(new yt),r.includes(U.AZTEC)&&i.push(new ge),r.includes(U.PDF_417)&&i.push(new mn),t&&n&&i.push(new at(e,this.verbose))}0===i.length&&(n||i.push(new at(e,this.verbose)),i.push(new Lt),i.push(new yt),i.push(new ge),i.push(new mn),n&&i.push(new at(e,this.verbose))),this.readers=i}reset(){if(null!==this.readers)for(const e of this.readers)e.reset()}decodeInternal(e){if(null===this.readers)throw new pn("No readers where selected, nothing can be read.");for(const t of this.readers)try{return t.decode(e,this.hints)}catch(e){if(e instanceof pn)continue}throw new N("No MultiFormat Readers were able to detect the code.")}}class wn extends L{constructor(e=null,t=500){const n=new gn;n.setHints(e),super(n,t)}decodeBitmap(e){return this.reader.decodeWithState(e)}}class yn extends L{constructor(e=500){super(new mn,e)}}class vn extends L{constructor(e=500){super(new Lt,e)}}var In;!function(e){e[e.ERROR_CORRECTION=0]="ERROR_CORRECTION",e[e.CHARACTER_SET=1]="CHARACTER_SET",e[e.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",e[e.MIN_SIZE=3]="MIN_SIZE",e[e.MAX_SIZE=4]="MAX_SIZE",e[e.MARGIN=5]="MARGIN",e[e.PDF417_COMPACT=6]="PDF417_COMPACT",e[e.PDF417_COMPACTION=7]="PDF417_COMPACTION",e[e.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",e[e.AZTEC_LAYERS=9]="AZTEC_LAYERS",e[e.QR_VERSION=10]="QR_VERSION"}(In||(In={}));var _n=In;class Cn{constructor(e){this.field=e,this.cachedGenerators=[],this.cachedGenerators.push(new K(e,Int32Array.from([1])))}buildGenerator(e){const t=this.cachedGenerators;if(e>=t.length){let n=t[t.length-1];const r=this.field;for(let i=t.length;i<=e;i++){const e=n.multiply(new K(r,Int32Array.from([1,r.exp(i-1+r.getGeneratorBase())])));t.push(e),n=e}}return t[e]}encode(e,t){if(0===t)throw new d("No error correction bytes");const n=e.length-t;if(n<=0)throw new d("No data bytes provided");const r=this.buildGenerator(t),i=new Int32Array(n);m.arraycopy(e,0,i,0,n);let o=new K(this.field,i);o=o.multiplyByMonomial(t,1);const s=o.divide(r)[1].getCoefficients(),a=t-s.length;for(let t=0;t<a;t++)e[n+t]=0;m.arraycopy(s,0,e,n+a,s.length)}}class En{constructor(){}static applyMaskPenaltyRule1(e){return En.applyMaskPenaltyRule1Internal(e,!0)+En.applyMaskPenaltyRule1Internal(e,!1)}static applyMaskPenaltyRule2(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i-1;e++){const i=n[e];for(let o=0;o<r-1;o++){const r=i[o];r===i[o+1]&&r===n[e+1][o]&&r===n[e+1][o+1]&&t++}}return En.N2*t}static applyMaskPenaltyRule3(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++)for(let o=0;o<r;o++){const s=n[e];o+6<r&&1===s[o]&&0===s[o+1]&&1===s[o+2]&&1===s[o+3]&&1===s[o+4]&&0===s[o+5]&&1===s[o+6]&&(En.isWhiteHorizontal(s,o-4,o)||En.isWhiteHorizontal(s,o+7,o+11))&&t++,e+6<i&&1===n[e][o]&&0===n[e+1][o]&&1===n[e+2][o]&&1===n[e+3][o]&&1===n[e+4][o]&&0===n[e+5][o]&&1===n[e+6][o]&&(En.isWhiteVertical(n,o,e-4,e)||En.isWhiteVertical(n,o,e+7,e+11))&&t++}return t*En.N3}static isWhiteHorizontal(e,t,n){t=Math.max(t,0),n=Math.min(n,e.length);for(let r=t;r<n;r++)if(1===e[r])return!1;return!0}static isWhiteVertical(e,t,n,r){n=Math.max(n,0),r=Math.min(r,e.length);for(let i=n;i<r;i++)if(1===e[i][t])return!1;return!0}static applyMaskPenaltyRule4(e){let t=0;const n=e.getArray(),r=e.getWidth(),i=e.getHeight();for(let e=0;e<i;e++){const i=n[e];for(let e=0;e<r;e++)1===i[e]&&t++}const o=e.getHeight()*e.getWidth();return Math.floor(10*Math.abs(2*t-o)/o)*En.N4}static getDataMaskBit(e,t,n){let r,i;switch(e){case 0:r=n+t&1;break;case 1:r=1&n;break;case 2:r=t%3;break;case 3:r=(n+t)%3;break;case 4:r=Math.floor(n/2)+Math.floor(t/3)&1;break;case 5:i=n*t,r=(1&i)+i%3;break;case 6:i=n*t,r=(1&i)+i%3&1;break;case 7:i=n*t,r=i%3+(n+t&1)&1;break;default:throw new d("Invalid mask pattern: "+e)}return 0===r}static applyMaskPenaltyRule1Internal(e,t){let n=0;const r=t?e.getHeight():e.getWidth(),i=t?e.getWidth():e.getHeight(),o=e.getArray();for(let e=0;e<r;e++){let r=0,s=-1;for(let a=0;a<i;a++){const i=t?o[e][a]:o[a][e];i===s?r++:(r>=5&&(n+=En.N1+(r-5)),r=1,s=i)}r>=5&&(n+=En.N1+(r-5))}return n}}En.N1=3,En.N2=3,En.N3=40,En.N4=10;class An{constructor(e,t){this.width=e,this.height=t;const n=new Array(t);for(let r=0;r!==t;r++)n[r]=new Uint8Array(e);this.bytes=n}getHeight(){return this.height}getWidth(){return this.width}get(e,t){return this.bytes[t][e]}getArray(){return this.bytes}setNumber(e,t,n){this.bytes[t][e]=n}setBoolean(e,t,n){this.bytes[t][e]=n?1:0}clear(e){for(const t of this.bytes)w.fill(t,e)}equals(e){if(!(e instanceof An))return!1;const t=e;if(this.width!==t.width)return!1;if(this.height!==t.height)return!1;for(let e=0,n=this.height;e<n;++e){const n=this.bytes[e],r=t.bytes[e];for(let e=0,t=this.width;e<t;++e)if(n[e]!==r[e])return!1}return!0}toString(){const e=new S;for(let t=0,n=this.height;t<n;++t){const n=this.bytes[t];for(let t=0,r=this.width;t<r;++t)switch(n[t]){case 0:e.append(" 0");break;case 1:e.append(" 1");break;default:e.append(" ")}e.append("\n")}return e.toString()}}class $n{constructor(){this.maskPattern=-1}getMode(){return this.mode}getECLevel(){return this.ecLevel}getVersion(){return this.version}getMaskPattern(){return this.maskPattern}getMatrix(){return this.matrix}toString(){const e=new S;return e.append("<<\n"),e.append(" mode: "),e.append(this.mode?this.mode.toString():"null"),e.append("\n ecLevel: "),e.append(this.ecLevel?this.ecLevel.toString():"null"),e.append("\n version: "),e.append(this.version?this.version.toString():"null"),e.append("\n maskPattern: "),e.append(this.maskPattern.toString()),this.matrix?(e.append("\n matrix:\n"),e.append(this.matrix.toString())):e.append("\n matrix: null\n"),e.append(">>\n"),e.toString()}setMode(e){this.mode=e}setECLevel(e){this.ecLevel=e}setVersion(e){this.version=e}setMaskPattern(e){this.maskPattern=e}setMatrix(e){this.matrix=e}static isValidMaskPattern(e){return e>=0&&e<$n.NUM_MASK_PATTERNS}}$n.NUM_MASK_PATTERNS=8;class bn extends l{}bn.kind="WriterException";class Sn{constructor(){}static clearMatrix(e){e.clear(255)}static buildMatrix(e,t,n,r,i){Sn.clearMatrix(i),Sn.embedBasicPatterns(n,i),Sn.embedTypeInfo(t,r,i),Sn.maybeEmbedVersionInfo(n,i),Sn.embedDataBits(e,r,i)}static embedBasicPatterns(e,t){Sn.embedPositionDetectionPatternsAndSeparators(t),Sn.embedDarkDotAtLeftBottomCorner(t),Sn.maybeEmbedPositionAdjustmentPatterns(e,t),Sn.embedTimingPatterns(t)}static embedTypeInfo(e,t,n){const r=new v;Sn.makeTypeInfoBits(e,t,r);for(let e=0,t=r.getSize();e<t;++e){const t=r.get(r.getSize()-1-e),i=Sn.TYPE_INFO_COORDINATES[e],o=i[0],s=i[1];if(n.setBoolean(o,s,t),e<8){const r=n.getWidth()-e-1,i=8;n.setBoolean(r,i,t)}else{const r=8,i=n.getHeight()-7+(e-8);n.setBoolean(r,i,t)}}}static maybeEmbedVersionInfo(e,t){if(e.getVersionNumber()<7)return;const n=new v;Sn.makeVersionInfoBits(e,n);let r=17;for(let e=0;e<6;++e)for(let i=0;i<3;++i){const o=n.get(r);r--,t.setBoolean(e,t.getHeight()-11+i,o),t.setBoolean(t.getHeight()-11+i,e,o)}}static embedDataBits(e,t,n){let r=0,i=-1,o=n.getWidth()-1,s=n.getHeight()-1;for(;o>0;){for(6===o&&(o-=1);s>=0&&s<n.getHeight();){for(let i=0;i<2;++i){const a=o-i;if(!Sn.isEmpty(n.get(a,s)))continue;let l;r<e.getSize()?(l=e.get(r),++r):l=!1,255!==t&&En.getDataMaskBit(t,a,s)&&(l=!l),n.setBoolean(a,s,l)}s+=i}i=-i,s+=i,o-=2}if(r!==e.getSize())throw new bn("Not all bits consumed: "+r+"/"+e.getSize())}static findMSBSet(e){return 32-y.numberOfLeadingZeros(e)}static calculateBCHCode(e,t){if(0===t)throw new d("0 polynomial");const n=Sn.findMSBSet(t);for(e<<=n-1;Sn.findMSBSet(e)>=n;)e^=t<<Sn.findMSBSet(e)-n;return e}static makeTypeInfoBits(e,t,n){if(!$n.isValidMaskPattern(t))throw new bn("Invalid mask pattern");const r=e.getBits()<<3|t;n.appendBits(r,5);const i=Sn.calculateBCHCode(r,Sn.TYPE_INFO_POLY);n.appendBits(i,10);const o=new v;if(o.appendBits(Sn.TYPE_INFO_MASK_PATTERN,15),n.xor(o),15!==n.getSize())throw new bn("should not happen but we got: "+n.getSize())}static makeVersionInfoBits(e,t){t.appendBits(e.getVersionNumber(),6);const n=Sn.calculateBCHCode(e.getVersionNumber(),Sn.VERSION_INFO_POLY);if(t.appendBits(n,12),18!==t.getSize())throw new bn("should not happen but we got: "+t.getSize())}static isEmpty(e){return 255===e}static embedTimingPatterns(e){for(let t=8;t<e.getWidth()-8;++t){const n=(t+1)%2;Sn.isEmpty(e.get(t,6))&&e.setNumber(t,6,n),Sn.isEmpty(e.get(6,t))&&e.setNumber(6,t,n)}}static embedDarkDotAtLeftBottomCorner(e){if(0===e.get(8,e.getHeight()-8))throw new bn;e.setNumber(8,e.getHeight()-8,1)}static embedHorizontalSeparationPattern(e,t,n){for(let r=0;r<8;++r){if(!Sn.isEmpty(n.get(e+r,t)))throw new bn;n.setNumber(e+r,t,0)}}static embedVerticalSeparationPattern(e,t,n){for(let r=0;r<7;++r){if(!Sn.isEmpty(n.get(e,t+r)))throw new bn;n.setNumber(e,t+r,0)}}static embedPositionAdjustmentPattern(e,t,n){for(let r=0;r<5;++r){const i=Sn.POSITION_ADJUSTMENT_PATTERN[r];for(let o=0;o<5;++o)n.setNumber(e+o,t+r,i[o])}}static embedPositionDetectionPattern(e,t,n){for(let r=0;r<7;++r){const i=Sn.POSITION_DETECTION_PATTERN[r];for(let o=0;o<7;++o)n.setNumber(e+o,t+r,i[o])}}static embedPositionDetectionPatternsAndSeparators(e){const t=Sn.POSITION_DETECTION_PATTERN[0].length;Sn.embedPositionDetectionPattern(0,0,e),Sn.embedPositionDetectionPattern(e.getWidth()-t,0,e),Sn.embedPositionDetectionPattern(0,e.getWidth()-t,e);const n=8;Sn.embedHorizontalSeparationPattern(0,n-1,e),Sn.embedHorizontalSeparationPattern(e.getWidth()-n,n-1,e),Sn.embedHorizontalSeparationPattern(0,e.getWidth()-n,e);const r=7;Sn.embedVerticalSeparationPattern(r,0,e),Sn.embedVerticalSeparationPattern(e.getHeight()-r-1,0,e),Sn.embedVerticalSeparationPattern(r,e.getHeight()-r,e)}static maybeEmbedPositionAdjustmentPatterns(e,t){if(e.getVersionNumber()<2)return;const n=e.getVersionNumber()-1,r=Sn.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE[n];for(let e=0,n=r.length;e!==n;e++){const i=r[e];if(i>=0)for(let e=0;e!==n;e++){const n=r[e];n>=0&&Sn.isEmpty(t.get(n,i))&&Sn.embedPositionAdjustmentPattern(n-2,i-2,t)}}}}Sn.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),Sn.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),Sn.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),Sn.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),Sn.VERSION_INFO_POLY=7973,Sn.TYPE_INFO_POLY=1335,Sn.TYPE_INFO_MASK_PATTERN=21522;class Tn{constructor(e,t){this.dataBytes=e,this.errorCorrectionBytes=t}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Nn{constructor(){}static calculateMaskPenalty(e){return En.applyMaskPenaltyRule1(e)+En.applyMaskPenaltyRule2(e)+En.applyMaskPenaltyRule3(e)+En.applyMaskPenaltyRule4(e)}static encode(e,t,n=null){let r=Nn.DEFAULT_BYTE_MODE_ENCODING;const i=null!==n&&void 0!==n.get(_n.CHARACTER_SET);i&&(r=n.get(_n.CHARACTER_SET).toString());const o=this.chooseMode(e,r),s=new v;if(o===Tt.BYTE&&(i||Nn.DEFAULT_BYTE_MODE_ENCODING!==r)){const e=E.getCharacterSetECIByName(r);void 0!==e&&this.appendECI(e,s)}this.appendModeInfo(o,s);const a=new v;let l;if(this.appendBytes(e,o,a,r),null!==n&&void 0!==n.get(_n.QR_VERSION)){const e=Number.parseInt(n.get(_n.QR_VERSION).toString(),10);l=At.getVersionForNumber(e);const r=this.calculateBitsNeeded(o,s,a,l);if(!this.willFit(r,l,t))throw new bn("Data too big for requested version")}else l=this.recommendVersion(t,o,s,a);const c=new v;c.appendBitArray(s);const d=o===Tt.BYTE?a.getSizeInBytes():e.length;this.appendLengthInfo(d,l,o,c),c.appendBitArray(a);const u=l.getECBlocksForLevel(t),h=l.getTotalCodewords()-u.getTotalECCodewords();this.terminateBits(h,c);const f=this.interleaveWithECBytes(c,l.getTotalCodewords(),h,u.getNumBlocks()),m=new $n;m.setECLevel(t),m.setMode(o),m.setVersion(l);const p=l.getDimensionForVersion(),g=new An(p,p),w=this.chooseMaskPattern(f,t,l,g);return m.setMaskPattern(w),Sn.buildMatrix(f,t,l,w,g),m.setMatrix(g),m}static recommendVersion(e,t,n,r){const i=this.calculateBitsNeeded(t,n,r,At.getVersionForNumber(1)),o=this.chooseVersion(i,e),s=this.calculateBitsNeeded(t,n,r,o);return this.chooseVersion(s,e)}static calculateBitsNeeded(e,t,n,r){return t.getSize()+e.getCharacterCountBits(r)+n.getSize()}static getAlphanumericCode(e){return e<Nn.ALPHANUMERIC_TABLE.length?Nn.ALPHANUMERIC_TABLE[e]:-1}static chooseMode(e,t=null){if(E.SJIS.getName()===t&&this.isOnlyDoubleByteKanji(e))return Tt.KANJI;let n=!1,r=!1;for(let t=0,i=e.length;t<i;++t){const i=e.charAt(t);if(Nn.isDigit(i))n=!0;else{if(-1===this.getAlphanumericCode(i.charCodeAt(0)))return Tt.BYTE;r=!0}}return r?Tt.ALPHANUMERIC:n?Tt.NUMERIC:Tt.BYTE}static isOnlyDoubleByteKanji(e){let t;try{t=$.encode(e,E.SJIS)}catch(e){return!1}const n=t.length;if(n%2!=0)return!1;for(let e=0;e<n;e+=2){const n=255&t[e];if((n<129||n>159)&&(n<224||n>235))return!1}return!0}static chooseMaskPattern(e,t,n,r){let i=Number.MAX_SAFE_INTEGER,o=-1;for(let s=0;s<$n.NUM_MASK_PATTERNS;s++){Sn.buildMatrix(e,t,n,s,r);let a=this.calculateMaskPenalty(r);a<i&&(i=a,o=s)}return o}static chooseVersion(e,t){for(let n=1;n<=40;n++){const r=At.getVersionForNumber(n);if(Nn.willFit(e,r,t))return r}throw new bn("Data too big")}static willFit(e,t,n){return t.getTotalCodewords()-t.getECBlocksForLevel(n).getTotalECCodewords()>=(e+7)/8}static terminateBits(e,t){const n=8*e;if(t.getSize()>n)throw new bn("data bits cannot fit in the QR Code"+t.getSize()+" > "+n);for(let e=0;e<4&&t.getSize()<n;++e)t.appendBit(!1);const r=7&t.getSize();if(r>0)for(let e=r;e<8;e++)t.appendBit(!1);const i=e-t.getSizeInBytes();for(let e=0;e<i;++e)t.appendBits(1&e?17:236,8);if(t.getSize()!==n)throw new bn("Bits size does not equal capacity")}static getNumDataBytesAndNumECBytesForBlockID(e,t,n,r,i,o){if(r>=n)throw new bn("Block ID too large");const s=e%n,a=n-s,l=Math.floor(e/n),c=l+1,d=Math.floor(t/n),u=d+1,h=l-d,f=c-u;if(h!==f)throw new bn("EC bytes mismatch");if(n!==a+s)throw new bn("RS blocks mismatch");if(e!==(d+h)*a+(u+f)*s)throw new bn("Total bytes mismatch");r<a?(i[0]=d,o[0]=h):(i[0]=u,o[0]=f)}static interleaveWithECBytes(e,t,n,r){if(e.getSizeInBytes()!==n)throw new bn("Number of bits and data bytes does not match");let i=0,o=0,s=0;const a=new Array;for(let l=0;l<r;++l){const c=new Int32Array(1),d=new Int32Array(1);Nn.getNumDataBytesAndNumECBytesForBlockID(t,n,r,l,c,d);const u=c[0],h=new Uint8Array(u);e.toBytes(8*i,h,0,u);const f=Nn.generateECBytes(h,d[0]);a.push(new Tn(h,f)),o=Math.max(o,u),s=Math.max(s,f.length),i+=c[0]}if(n!==i)throw new bn("Data bytes does not match offset");const l=new v;for(let e=0;e<o;++e)for(const t of a){const n=t.getDataBytes();e<n.length&&l.appendBits(n[e],8)}for(let e=0;e<s;++e)for(const t of a){const n=t.getErrorCorrectionBytes();e<n.length&&l.appendBits(n[e],8)}if(t!==l.getSizeInBytes())throw new bn("Interleaving error: "+t+" and "+l.getSizeInBytes()+" differ.");return l}static generateECBytes(e,t){const n=e.length,r=new Int32Array(n+t);for(let t=0;t<n;t++)r[t]=255&e[t];new Cn(J.QR_CODE_FIELD_256).encode(r,t);const i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=r[n+e];return i}static appendModeInfo(e,t){t.appendBits(e.getBits(),4)}static appendLengthInfo(e,t,n,r){const i=n.getCharacterCountBits(t);if(e>=1<<i)throw new bn(e+" is bigger than "+((1<<i)-1));r.appendBits(e,i)}static appendBytes(e,t,n,r){switch(t){case Tt.NUMERIC:Nn.appendNumericBytes(e,n);break;case Tt.ALPHANUMERIC:Nn.appendAlphanumericBytes(e,n);break;case Tt.BYTE:Nn.append8BitBytes(e,n,r);break;case Tt.KANJI:Nn.appendKanjiBytes(e,n);break;default:throw new bn("Invalid mode: "+t)}}static getDigit(e){return e.charCodeAt(0)-48}static isDigit(e){const t=Nn.getDigit(e);return t>=0&&t<=9}static appendNumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Nn.getDigit(e.charAt(r));if(r+2<n){const n=Nn.getDigit(e.charAt(r+1)),o=Nn.getDigit(e.charAt(r+2));t.appendBits(100*i+10*n+o,10),r+=3}else if(r+1<n){const n=Nn.getDigit(e.charAt(r+1));t.appendBits(10*i+n,7),r+=2}else t.appendBits(i,4),r++}}static appendAlphanumericBytes(e,t){const n=e.length;let r=0;for(;r<n;){const i=Nn.getAlphanumericCode(e.charCodeAt(r));if(-1===i)throw new bn;if(r+1<n){const n=Nn.getAlphanumericCode(e.charCodeAt(r+1));if(-1===n)throw new bn;t.appendBits(45*i+n,11),r+=2}else t.appendBits(i,6),r++}}static append8BitBytes(e,t,n){let r;try{r=$.encode(e,n)}catch(e){throw new bn(e)}for(let e=0,n=r.length;e!==n;e++){const n=r[e];t.appendBits(n,8)}}static appendKanjiBytes(e,t){let n;try{n=$.encode(e,E.SJIS)}catch(e){throw new bn(e)}const r=n.length;for(let e=0;e<r;e+=2){const r=(255&n[e])<<8&4294967295|255&n[e+1];let i=-1;if(r>=33088&&r<=40956?i=r-33088:r>=57408&&r<=60351&&(i=r-49472),-1===i)throw new bn("Invalid byte sequence");const o=192*(i>>8)+(255&i);t.appendBits(o,13)}}static appendECI(e,t){t.appendBits(Tt.ECI.getBits(),4),t.appendBits(e.getValue(),8)}}Nn.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Nn.DEFAULT_BYTE_MODE_ENCODING=E.UTF8.getName();class Rn{write(e,t,n,r=null){if(0===e.length)throw new d("Found empty contents");if(t<0||n<0)throw new d("Requested dimensions are too small: "+t+"x"+n);let i=It.L,o=Rn.QUIET_ZONE_SIZE;null!==r&&(void 0!==r.get(_n.ERROR_CORRECTION)&&(i=It.fromString(r.get(_n.ERROR_CORRECTION).toString())),void 0!==r.get(_n.MARGIN)&&(o=Number.parseInt(r.get(_n.MARGIN).toString(),10)));const s=Nn.encode(e,i,r);return this.renderResult(s,t,n,o)}writeToDom(e,t,n,r,i=null){"string"==typeof e&&(e=document.querySelector(e));const o=this.write(t,n,r,i);e&&e.appendChild(o)}renderResult(e,t,n,r){const i=e.getMatrix();if(null===i)throw new te;const o=i.getWidth(),s=i.getHeight(),a=o+2*r,l=s+2*r,c=Math.max(t,a),d=Math.max(n,l),u=Math.min(Math.floor(c/a),Math.floor(d/l)),h=Math.floor((c-o*u)/2),f=Math.floor((d-s*u)/2),m=this.createSVGElement(c,d);for(let e=0,t=f;e<s;e++,t+=u)for(let n=0,r=h;n<o;n++,r+=u)if(1===i.get(n,e)){const e=this.createSvgRectElement(r,t,u,u);m.appendChild(e)}return m}createSVGElement(e,t){const n=document.createElementNS(Rn.SVG_NS,"svg");return n.setAttributeNS(null,"height",e.toString()),n.setAttributeNS(null,"width",t.toString()),n}createSvgRectElement(e,t,n,r){const i=document.createElementNS(Rn.SVG_NS,"rect");return i.setAttributeNS(null,"x",e.toString()),i.setAttributeNS(null,"y",t.toString()),i.setAttributeNS(null,"height",n.toString()),i.setAttributeNS(null,"width",r.toString()),i.setAttributeNS(null,"fill","#000000"),i}}Rn.QUIET_ZONE_SIZE=4,Rn.SVG_NS="http://www.w3.org/2000/svg";class Dn{encode(e,t,n,r,i){if(0===e.length)throw new d("Found empty contents");if(t!==U.QR_CODE)throw new d("Can only encode QR_CODE, but got "+t);if(n<0||r<0)throw new d(`Requested dimensions are too small: ${n}x${r}`);let o=It.L,s=Dn.QUIET_ZONE_SIZE;null!==i&&(void 0!==i.get(_n.ERROR_CORRECTION)&&(o=It.fromString(i.get(_n.ERROR_CORRECTION).toString())),void 0!==i.get(_n.MARGIN)&&(s=Number.parseInt(i.get(_n.MARGIN).toString(),10)));const a=Nn.encode(e,o,i);return Dn.renderResult(a,n,r,s)}static renderResult(e,t,n,r){const i=e.getMatrix();if(null===i)throw new te;const o=i.getWidth(),s=i.getHeight(),a=o+2*r,l=s+2*r,c=Math.max(t,a),d=Math.max(n,l),u=Math.min(Math.floor(c/a),Math.floor(d/l)),h=Math.floor((c-o*u)/2),f=Math.floor((d-s*u)/2),m=new T(c,d);for(let e=0,t=f;e<s;e++,t+=u)for(let n=0,r=h;n<o;n++,r+=u)1===i.get(n,e)&&m.setRegion(r,t,u,u);return m}}Dn.QUIET_ZONE_SIZE=4;class xn{encode(e,t,n,r,i){let o;if(t!==U.QR_CODE)throw new d("No encoder available for format "+t);return o=new Dn,o.encode(e,t,n,r,i)}}class On extends x{constructor(e,t,n,r,i,o,s,a){if(super(o,s),this.yuvData=e,this.dataWidth=t,this.dataHeight=n,this.left=r,this.top=i,r+o>t||i+s>n)throw new d("Crop rectangle does not fit within image data.");a&&this.reverseHorizontal(o,s)}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth();(null==t||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return m.arraycopy(this.yuvData,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.yuvData;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return m.arraycopy(this.yuvData,i,r,0,n),r;for(let n=0;n<t;n++){const t=n*e;m.arraycopy(this.yuvData,i,r,t,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new On(this.yuvData,this.dataWidth,this.dataHeight,this.left+e,this.top+t,n,r,!1)}renderThumbnail(){const e=this.getWidth()/On.THUMBNAIL_SCALE_FACTOR,t=this.getHeight()/On.THUMBNAIL_SCALE_FACTOR,n=new Int32Array(e*t),r=this.yuvData;let i=this.top*this.dataWidth+this.left;for(let o=0;o<t;o++){const t=o*e;for(let o=0;o<e;o++){const e=255&r[i+o*On.THUMBNAIL_SCALE_FACTOR];n[t+o]=4278190080|65793*e}i+=this.dataWidth*On.THUMBNAIL_SCALE_FACTOR}return n}getThumbnailWidth(){return this.getWidth()/On.THUMBNAIL_SCALE_FACTOR}getThumbnailHeight(){return this.getHeight()/On.THUMBNAIL_SCALE_FACTOR}reverseHorizontal(e,t){const n=this.yuvData;for(let r=0,i=this.top*this.dataWidth+this.left;r<t;r++,i+=this.dataWidth){const t=i+e/2;for(let r=i,o=i+e-1;r<t;r++,o--){const e=n[r];n[r]=n[o],n[o]=e}}}invert(){return new O(this)}}On.THUMBNAIL_SCALE_FACTOR=2;class kn extends x{constructor(e,t,n,r,i,o,s){if(super(t,n),this.dataWidth=r,this.dataHeight=i,this.left=o,this.top=s,4===e.BYTES_PER_ELEMENT){const r=t*n,i=new Uint8ClampedArray(r);for(let t=0;t<r;t++){const n=e[t],r=n>>16&255,o=n>>7&510,s=255&n;i[t]=(r+o+s)/4&255}this.luminances=i}else this.luminances=e;if(void 0===r&&(this.dataWidth=t),void 0===i&&(this.dataHeight=n),void 0===o&&(this.left=0),void 0===s&&(this.top=0),this.left+t>this.dataWidth||this.top+n>this.dataHeight)throw new d("Crop rectangle does not fit within image data.")}getRow(e,t){if(e<0||e>=this.getHeight())throw new d("Requested row is outside the image: "+e);const n=this.getWidth();(null==t||t.length<n)&&(t=new Uint8ClampedArray(n));const r=(e+this.top)*this.dataWidth+this.left;return m.arraycopy(this.luminances,r,t,0,n),t}getMatrix(){const e=this.getWidth(),t=this.getHeight();if(e===this.dataWidth&&t===this.dataHeight)return this.luminances;const n=e*t,r=new Uint8ClampedArray(n);let i=this.top*this.dataWidth+this.left;if(e===this.dataWidth)return m.arraycopy(this.luminances,i,r,0,n),r;for(let n=0;n<t;n++){const t=n*e;m.arraycopy(this.luminances,i,r,t,e),i+=this.dataWidth}return r}isCropSupported(){return!0}crop(e,t,n,r){return new kn(this.luminances,n,r,this.dataWidth,this.dataHeight,this.left+e,this.top+t)}invert(){return new O(this)}}class Mn extends E{static forName(e){return this.getCharacterSetECIByName(e)}}class Pn{}Pn.ISO_8859_1=E.ISO8859_1;class Bn{isCompact(){return this.compact}setCompact(e){this.compact=e}getSize(){return this.size}setSize(e){this.size=e}getLayers(){return this.layers}setLayers(e){this.layers=e}getCodeWords(){return this.codeWords}setCodeWords(e){this.codeWords=e}getMatrix(){return this.matrix}setMatrix(e){this.matrix=e}}class Ln{static singletonList(e){return[e]}static min(e,t){return e.sort(t)[0]}}class Fn{constructor(e){this.previous=e}getPrevious(){return this.previous}}class Vn extends Fn{constructor(e,t,n){super(e),this.value=t,this.bitCount=n}appendTo(e,t){e.appendBits(this.value,this.bitCount)}add(e,t){return new Vn(this,e,t)}addBinaryShift(e,t){return console.warn("addBinaryShift on SimpleToken, this simply returns a copy of this token"),new Vn(this,e,t)}toString(){let e=this.value&(1<<this.bitCount)-1;return e|=1<<this.bitCount,"<"+y.toBinaryString(e|1<<this.bitCount).substring(1)+">"}}class Un extends Vn{constructor(e,t,n){super(e,0,0),this.binaryShiftStart=t,this.binaryShiftByteCount=n}appendTo(e,t){for(let n=0;n<this.binaryShiftByteCount;n++)(0===n||31===n&&this.binaryShiftByteCount<=62)&&(e.appendBits(31,5),this.binaryShiftByteCount>62?e.appendBits(this.binaryShiftByteCount-31,16):0===n?e.appendBits(Math.min(this.binaryShiftByteCount,31),5):e.appendBits(this.binaryShiftByteCount-31,5)),e.appendBits(t[this.binaryShiftStart+n],8)}addBinaryShift(e,t){return new Un(this,e,t)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function Hn(e,t,n){return new Un(e,t,n)}function Wn(e,t,n){return new Vn(e,t,n)}const zn=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],jn=0,qn=1,Gn=2,Xn=3,Yn=4,Zn=new Vn(null,0,0),Kn=[Int32Array.from([0,327708,327710,327709,656318]),Int32Array.from([590318,0,327710,327709,656318]),Int32Array.from([262158,590300,0,590301,932798]),Int32Array.from([327709,327708,656318,0,327710]),Int32Array.from([327711,656380,656382,656381,0])];function Qn(e){for(let t of e)w.fill(t,-1);return e[jn][Yn]=0,e[qn][Yn]=0,e[qn][jn]=28,e[Xn][Yn]=0,e[Gn][Yn]=0,e[Gn][jn]=15,e}const Jn=Qn(w.createInt32Array(6,6));class er{constructor(e,t,n,r){this.token=e,this.mode=t,this.binaryShiftByteCount=n,this.bitCount=r}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(e,t){let n=this.bitCount,r=this.token;if(e!==this.mode){let t=Kn[this.mode][e];r=Wn(r,65535&t,t>>16),n+=t>>16}let i=e===Gn?4:5;return r=Wn(r,t,i),new er(r,e,0,n+i)}shiftAndAppend(e,t){let n=this.token,r=this.mode===Gn?4:5;return n=Wn(n,Jn[this.mode][e],r),n=Wn(n,t,5),new er(n,this.mode,0,this.bitCount+r+5)}addBinaryShiftChar(e){let t=this.token,n=this.mode,r=this.bitCount;if(this.mode===Yn||this.mode===Gn){let e=Kn[n][jn];t=Wn(t,65535&e,e>>16),r+=e>>16,n=jn}let i=0===this.binaryShiftByteCount||31===this.binaryShiftByteCount?18:62===this.binaryShiftByteCount?9:8,o=new er(t,n,this.binaryShiftByteCount+1,r+i);return 2078===o.binaryShiftByteCount&&(o=o.endBinaryShift(e+1)),o}endBinaryShift(e){if(0===this.binaryShiftByteCount)return this;let t=this.token;return t=Hn(t,e-this.binaryShiftByteCount,this.binaryShiftByteCount),new er(t,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(e){let t=this.bitCount+(Kn[this.mode][e.mode]>>16);return this.binaryShiftByteCount<e.binaryShiftByteCount?t+=er.calculateBinaryShiftCost(e)-er.calculateBinaryShiftCost(this):this.binaryShiftByteCount>e.binaryShiftByteCount&&e.binaryShiftByteCount>0&&(t+=10),t<=e.bitCount}toBitArray(e){let t=[];for(let n=this.endBinaryShift(e.length).token;null!==n;n=n.getPrevious())t.unshift(n);let n=new v;for(const r of t)r.appendTo(n,e);return n}toString(){return b.format("%s bits=%d bytes=%d",zn[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(e){return e.binaryShiftByteCount>62?21:e.binaryShiftByteCount>31?20:e.binaryShiftByteCount>0?10:0}}function tr(e){const t=b.getCharCode(" "),n=b.getCharCode("."),r=b.getCharCode(",");e[jn][t]=1;const i=b.getCharCode("Z"),o=b.getCharCode("A");for(let t=o;t<=i;t++)e[jn][t]=t-o+2;e[qn][t]=1;const s=b.getCharCode("z"),a=b.getCharCode("a");for(let t=a;t<=s;t++)e[qn][t]=t-a+2;e[Gn][t]=1;const l=b.getCharCode("9"),c=b.getCharCode("0");for(let t=c;t<=l;t++)e[Gn][t]=t-c+2;e[Gn][r]=12,e[Gn][n]=13;const d=["\0"," ","","","","","","","","\b","\t","\n","\v","\f","\r","","","","","","@","\\","^","_","`","|","~",""];for(let t=0;t<d.length;t++)e[Xn][b.getCharCode(d[t])]=t;const u=["\0","\r","\0","\0","\0","\0","!","'","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","[","]","{","}"];for(let t=0;t<u.length;t++)b.getCharCode(u[t])>0&&(e[Yn][b.getCharCode(u[t])]=t);return e}er.INITIAL_STATE=new er(Zn,jn,0,0);const nr=tr(w.createInt32Array(5,256));class rr{constructor(e){this.text=e}encode(){const e=b.getCharCode(" "),t=b.getCharCode("\n");let n=Ln.singletonList(er.INITIAL_STATE);for(let r=0;r<this.text.length;r++){let i,o=r+1<this.text.length?this.text[r+1]:0;switch(this.text[r]){case b.getCharCode("\r"):i=o===t?2:0;break;case b.getCharCode("."):i=o===e?3:0;break;case b.getCharCode(","):i=o===e?4:0;break;case b.getCharCode(":"):i=o===e?5:0;break;default:i=0}i>0?(n=rr.updateStateListForPair(n,r,i),r++):n=this.updateStateListForChar(n,r)}return Ln.min(n,(e,t)=>e.getBitCount()-t.getBitCount()).toBitArray(this.text)}updateStateListForChar(e,t){const n=[];for(let r of e)this.updateStateForChar(r,t,n);return rr.simplifyStates(n)}updateStateForChar(e,t,n){let r=255&this.text[t],i=nr[e.getMode()][r]>0,o=null;for(let s=0;s<=Yn;s++){let a=nr[s][r];if(a>0){if(null==o&&(o=e.endBinaryShift(t)),!i||s===e.getMode()||s===Gn){const e=o.latchAndAppend(s,a);n.push(e)}if(!i&&Jn[e.getMode()][s]>=0){const e=o.shiftAndAppend(s,a);n.push(e)}}}if(e.getBinaryShiftByteCount()>0||0===nr[e.getMode()][r]){let r=e.addBinaryShiftChar(t);n.push(r)}}static updateStateListForPair(e,t,n){const r=[];for(let i of e)this.updateStateForPair(i,t,n,r);return this.simplifyStates(r)}static updateStateForPair(e,t,n,r){let i=e.endBinaryShift(t);if(r.push(i.latchAndAppend(Yn,n)),e.getMode()!==Yn&&r.push(i.shiftAndAppend(Yn,n)),3===n||4===n){let e=i.latchAndAppend(Gn,16-n).latchAndAppend(Gn,1);r.push(e)}if(e.getBinaryShiftByteCount()>0){let n=e.addBinaryShiftChar(t).addBinaryShiftChar(t+1);r.push(n)}}static simplifyStates(e){let t=[];for(const n of e){let e=!0;for(const r of t){if(r.isBetterThanOrEqualTo(n)){e=!1;break}n.isBetterThanOrEqualTo(r)&&(t=t.filter(e=>e!==r))}e&&t.push(n)}return t}}class ir{constructor(){}static encodeBytes(e){return ir.encode(e,ir.DEFAULT_EC_PERCENT,ir.DEFAULT_AZTEC_LAYERS)}static encode(e,t,n){let r,i,o,s,a,l=new rr(e).encode(),c=y.truncDivision(l.getSize()*t,100)+11,u=l.getSize()+c;if(n!==ir.DEFAULT_AZTEC_LAYERS){if(r=n<0,i=Math.abs(n),i>(r?ir.MAX_NB_BITS_COMPACT:ir.MAX_NB_BITS))throw new d(b.format("Illegal value %s for layers",n));o=ir.totalBitsInLayer(i,r),s=ir.WORD_SIZE[i];let e=o-o%s;if(a=ir.stuffBits(l,s),a.getSize()+c>e)throw new d("Data to large for user specified layer");if(r&&a.getSize()>64*s)throw new d("Data to large for user specified layer")}else{s=0,a=null;for(let e=0;;e++){if(e>ir.MAX_NB_BITS)throw new d("Data too large for an Aztec code");if(r=e<=3,i=r?e+1:e,o=ir.totalBitsInLayer(i,r),u>o)continue;null!=a&&s===ir.WORD_SIZE[i]||(s=ir.WORD_SIZE[i],a=ir.stuffBits(l,s));let t=o-o%s;if(!(r&&a.getSize()>64*s)&&a.getSize()+c<=t)break}}let h,f=ir.generateCheckWords(a,o,s),m=a.getSize()/s,p=ir.generateModeMessage(r,i,m),g=(r?11:14)+4*i,w=new Int32Array(g);if(r){h=g;for(let e=0;e<w.length;e++)w[e]=e}else{h=g+1+2*y.truncDivision(y.truncDivision(g,2)-1,15);let e=y.truncDivision(g,2),t=y.truncDivision(h,2);for(let n=0;n<e;n++){let r=n+y.truncDivision(n,15);w[e-n-1]=t-r-1,w[e+n]=t+r+1}}let v=new T(h);for(let e=0,t=0;e<i;e++){let n=4*(i-e)+(r?9:12);for(let r=0;r<n;r++){let i=2*r;for(let o=0;o<2;o++)f.get(t+i+o)&&v.set(w[2*e+o],w[2*e+r]),f.get(t+2*n+i+o)&&v.set(w[2*e+r],w[g-1-2*e-o]),f.get(t+4*n+i+o)&&v.set(w[g-1-2*e-o],w[g-1-2*e-r]),f.get(t+6*n+i+o)&&v.set(w[g-1-2*e-r],w[2*e+o])}t+=8*n}if(ir.drawModeMessage(v,r,h,p),r)ir.drawBullsEye(v,y.truncDivision(h,2),5);else{ir.drawBullsEye(v,y.truncDivision(h,2),7);for(let e=0,t=0;e<y.truncDivision(g,2)-1;e+=15,t+=16)for(let e=1&y.truncDivision(h,2);e<h;e+=2)v.set(y.truncDivision(h,2)-t,e),v.set(y.truncDivision(h,2)+t,e),v.set(e,y.truncDivision(h,2)-t),v.set(e,y.truncDivision(h,2)+t)}let I=new Bn;return I.setCompact(r),I.setSize(h),I.setLayers(i),I.setCodeWords(m),I.setMatrix(v),I}static drawBullsEye(e,t,n){for(let r=0;r<n;r+=2)for(let n=t-r;n<=t+r;n++)e.set(n,t-r),e.set(n,t+r),e.set(t-r,n),e.set(t+r,n);e.set(t-n,t-n),e.set(t-n+1,t-n),e.set(t-n,t-n+1),e.set(t+n,t-n),e.set(t+n,t-n+1),e.set(t+n,t+n-1)}static generateModeMessage(e,t,n){let r=new v;return e?(r.appendBits(t-1,2),r.appendBits(n-1,6),r=ir.generateCheckWords(r,28,4)):(r.appendBits(t-1,5),r.appendBits(n-1,11),r=ir.generateCheckWords(r,40,4)),r}static drawModeMessage(e,t,n,r){let i=y.truncDivision(n,2);if(t)for(let t=0;t<7;t++){let n=i-3+t;r.get(t)&&e.set(n,i-5),r.get(t+7)&&e.set(i+5,n),r.get(20-t)&&e.set(n,i+5),r.get(27-t)&&e.set(i-5,n)}else for(let t=0;t<10;t++){let n=i-5+t+y.truncDivision(t,5);r.get(t)&&e.set(n,i-7),r.get(t+10)&&e.set(i+7,n),r.get(29-t)&&e.set(n,i+7),r.get(39-t)&&e.set(i-7,n)}}static generateCheckWords(e,t,n){let r=e.getSize()/n,i=new Cn(ir.getGF(n)),o=y.truncDivision(t,n),s=ir.bitsToWords(e,n,o);i.encode(s,o-r);let a=t%n,l=new v;l.appendBits(0,a);for(const e of Array.from(s))l.appendBits(e,n);return l}static bitsToWords(e,t,n){let r,i,o=new Int32Array(n);for(r=0,i=e.getSize()/t;r<i;r++){let n=0;for(let i=0;i<t;i++)n|=e.get(r*t+i)?1<<t-i-1:0;o[r]=n}return o}static getGF(e){switch(e){case 4:return J.AZTEC_PARAM;case 6:return J.AZTEC_DATA_6;case 8:return J.AZTEC_DATA_8;case 10:return J.AZTEC_DATA_10;case 12:return J.AZTEC_DATA_12;default:throw new d("Unsupported word size "+e)}}static stuffBits(e,t){let n=new v,r=e.getSize(),i=(1<<t)-2;for(let o=0;o<r;o+=t){let s=0;for(let n=0;n<t;n++)(o+n>=r||e.get(o+n))&&(s|=1<<t-1-n);(s&i)===i?(n.appendBits(s&i,t),o--):0===(s&i)?(n.appendBits(1|s,t),o--):n.appendBits(s,t)}return n}static totalBitsInLayer(e,t){return((t?88:112)+16*e)*e}}ir.DEFAULT_EC_PERCENT=33,ir.DEFAULT_AZTEC_LAYERS=0,ir.MAX_NB_BITS=32,ir.MAX_NB_BITS_COMPACT=4,ir.WORD_SIZE=Int32Array.from([4,6,6,8,8,8,8,8,8,10,10,10,10,10,10,10,10,10,10,10,10,10,10,12,12,12,12,12,12,12,12,12,12]);class or{encode(e,t,n,r){return this.encodeWithHints(e,t,n,r,null)}encodeWithHints(e,t,n,r,i){let o=Pn.ISO_8859_1,s=ir.DEFAULT_EC_PERCENT,a=ir.DEFAULT_AZTEC_LAYERS;return null!=i&&(i.has(_n.CHARACTER_SET)&&(o=Mn.forName(i.get(_n.CHARACTER_SET).toString())),i.has(_n.ERROR_CORRECTION)&&(s=y.parseInt(i.get(_n.ERROR_CORRECTION).toString())),i.has(_n.AZTEC_LAYERS)&&(a=y.parseInt(i.get(_n.AZTEC_LAYERS).toString()))),or.encodeLayers(e,t,n,r,o,s,a)}static encodeLayers(e,t,n,r,i,o,s){if(t!==U.AZTEC)throw new d("Can only encode AZTEC, but got "+t);let a=ir.encode(b.getBytes(e,i),o,s);return or.renderResult(a,n,r)}static renderResult(e,t,n){let r=e.getMatrix();if(null==r)throw new te;let i=r.getWidth(),o=r.getHeight(),s=Math.max(t,i),a=Math.max(n,o),l=Math.min(s/i,a/o),c=(s-i*l)/2,d=(a-o*l)/2,u=new T(s,a);for(let e=0,t=d;e<o;e++,t+=l)for(let n=0,o=c;n<i;n++,o+=l)r.get(n,e)&&u.setRegion(o,t,l,l);return u}}e.AbstractExpandedDecoder=ze,e.ArgumentException=c,e.ArithmeticException=Q,e.AztecCode=Bn,e.AztecCodeReader=ge,e.AztecCodeWriter=or,e.AztecDecoder=re,e.AztecDetector=pe,e.AztecDetectorResult=le,e.AztecEncoder=ir,e.AztecHighLevelEncoder=rr,e.AztecPoint=me,e.BarcodeFormat=U,e.Binarizer=f,e.BinaryBitmap=u,e.BitArray=v,e.BitMatrix=T,e.BitSource=mt,e.BrowserAztecCodeReader=we,e.BrowserBarcodeReader=lt,e.BrowserCodeReader=L,e.BrowserDatamatrixCodeReader=vt,e.BrowserMultiFormatReader=wn,e.BrowserPDF417Reader=yn,e.BrowserQRCodeReader=vn,e.BrowserQRCodeSvgWriter=Rn,e.CharacterSetECI=E,e.ChecksumException=h,e.Code128Reader=ve,e.Code39Reader=Ie,e.DataMatrixDecodedBitStreamParser=pt,e.DataMatrixReader=yt,e.DecodeHintType=_,e.DecoderResult=Y,e.DefaultGridSampler=he,e.DetectorResult=ae,e.EAN13Reader=Se,e.EncodeHintType=_n,e.Exception=l,e.FormatException=C,e.GenericGF=J,e.GenericGFPoly=K,e.GlobalHistogramBinarizer=R,e.GridSampler=de,e.GridSamplerInstance=fe,e.HTMLCanvasElementLuminanceSource=k,e.HybridBinarizer=D,e.ITFReader=_e,e.IllegalArgumentException=d,e.IllegalStateException=te,e.InvertedLuminanceSource=O,e.LuminanceSource=x,e.MathUtils=ie,e.MultiFormatOneDReader=at,e.MultiFormatReader=gn,e.MultiFormatWriter=xn,e.NotFoundException=N,e.OneDReader=ye,e.PDF417DecodedBitStreamParser=hn,e.PDF417DecoderErrorCorrection=jt,e.PDF417Reader=mn,e.PDF417ResultMetadata=tn,e.PerspectiveTransform=ue,e.PlanarYUVLuminanceSource=On,e.QRCodeByteMatrix=An,e.QRCodeDataMask=$t,e.QRCodeDecodedBitStreamParser=Nt,e.QRCodeDecoderErrorCorrectionLevel=It,e.QRCodeDecoderFormatInformation=_t,e.QRCodeEncoder=Nn,e.QRCodeEncoderQRCode=$n,e.QRCodeMaskUtil=En,e.QRCodeMatrixUtil=Sn,e.QRCodeMode=Tt,e.QRCodeReader=Lt,e.QRCodeVersion=At,e.QRCodeWriter=Dn,e.RGBLuminanceSource=kn,e.RSS14Reader=st,e.RSSExpandedReader=it,e.ReaderException=pn,e.ReedSolomonDecoder=ne,e.ReedSolomonEncoder=Cn,e.ReedSolomonException=ee,e.Result=F,e.ResultMetadataType=X,e.ResultPoint=se,e.StringUtils=b,e.UnsupportedOperationException=A,e.VideoInputDevice=M,e.WhiteRectangleDetector=ce,e.WriterException=bn,e.ZXingArrays=w,e.ZXingCharset=Mn,e.ZXingInteger=y,e.ZXingStandardCharsets=Pn,e.ZXingStringBuilder=S,e.ZXingStringEncoding=$,e.ZXingSystem=m,e.createAbstractExpandedDecoder=tt,Object.defineProperty(e,"__esModule",{value:!0})}(t)}),cu=f({__proto__:null,default:iu(lu)},[lu]),du=function(){function e(e,t,n){if(this.formatMap=new Map([[Wd.QR_CODE,lu.BarcodeFormat.QR_CODE],[Wd.AZTEC,lu.BarcodeFormat.AZTEC],[Wd.CODABAR,lu.BarcodeFormat.CODABAR],[Wd.CODE_39,lu.BarcodeFormat.CODE_39],[Wd.CODE_93,lu.BarcodeFormat.CODE_93],[Wd.CODE_128,lu.BarcodeFormat.CODE_128],[Wd.DATA_MATRIX,lu.BarcodeFormat.DATA_MATRIX],[Wd.MAXICODE,lu.BarcodeFormat.MAXICODE],[Wd.ITF,lu.BarcodeFormat.ITF],[Wd.EAN_13,lu.BarcodeFormat.EAN_13],[Wd.EAN_8,lu.BarcodeFormat.EAN_8],[Wd.PDF_417,lu.BarcodeFormat.PDF_417],[Wd.RSS_14,lu.BarcodeFormat.RSS_14],[Wd.RSS_EXPANDED,lu.BarcodeFormat.RSS_EXPANDED],[Wd.UPC_A,lu.BarcodeFormat.UPC_A],[Wd.UPC_E,lu.BarcodeFormat.UPC_E],[Wd.UPC_EAN_EXTENSION,lu.BarcodeFormat.UPC_EAN_EXTENSION]]),this.reverseFormatMap=this.createReverseFormatMap(),!cu)throw"Use html5qrcode.min.js without edit, ZXing not found.";this.verbose=t,this.logger=n;var r=this.createZXingFormats(e),i=new Map;i.set(lu.DecodeHintType.POSSIBLE_FORMATS,r),i.set(lu.DecodeHintType.TRY_HARDER,!1),this.hints=i}return e.prototype.decodeAsync=function(e){var t=this;return new Promise(function(n,r){try{n(t.decode(e))}catch(e){r(e)}})},e.prototype.decode=function(e){var t=new lu.MultiFormatReader(this.verbose,this.hints),n=new lu.HTMLCanvasElementLuminanceSource(e),r=new lu.BinaryBitmap(new lu.HybridBinarizer(n)),i=t.decode(r);return{text:i.text,format:Zd.create(this.toHtml5QrcodeSupportedFormats(i.format)),debugData:this.createDebugData()}},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,r){e.set(t,n)}),e},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createZXingFormats=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];this.formatMap.has(i)?t.push(this.formatMap.get(i)):this.logger.logError("".concat(i," is not supported by")+"ZXingHtml5QrcodeShim")}return t},e.prototype.createDebugData=function(){return{decoderName:"zxing-js"}},e}(),uu=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},hu=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},fu=function(){function e(t,n,r){if(this.formatMap=new Map([[Wd.QR_CODE,"qr_code"],[Wd.AZTEC,"aztec"],[Wd.CODABAR,"codabar"],[Wd.CODE_39,"code_39"],[Wd.CODE_93,"code_93"],[Wd.CODE_128,"code_128"],[Wd.DATA_MATRIX,"data_matrix"],[Wd.ITF,"itf"],[Wd.EAN_13,"ean_13"],[Wd.EAN_8,"ean_8"],[Wd.PDF_417,"pdf417"],[Wd.UPC_A,"upc_a"],[Wd.UPC_E,"upc_e"]]),this.reverseFormatMap=this.createReverseFormatMap(),!e.isSupported())throw"Use html5qrcode.min.js without edit, Use BarcodeDetectorDelegate only if it isSupported();";this.verbose=n,this.logger=r;var i=this.createBarcodeDetectorFormats(t);if(this.detector=new BarcodeDetector(i),!this.detector)throw"BarcodeDetector detector not supported"}return e.isSupported=function(){return"BarcodeDetector"in window&&void 0!==new BarcodeDetector({formats:["qr_code"]})},e.prototype.decodeAsync=function(e){return uu(this,void 0,void 0,function(){var t,n;return hu(this,function(r){switch(r.label){case 0:return[4,this.detector.detect(e)];case 1:if(!(t=r.sent())||0===t.length)throw"No barcode or QR code detected.";return[2,{text:(n=this.selectLargestBarcode(t)).rawValue,format:Zd.create(this.toHtml5QrcodeSupportedFormats(n.format)),debugData:this.createDebugData()}]}})})},e.prototype.selectLargestBarcode=function(e){for(var t=null,n=0,r=0,i=e;r<i.length;r++){var o=i[r],s=o.boundingBox.width*o.boundingBox.height;s>n&&(n=s,t=o)}if(!t)throw"No largest barcode found";return t},e.prototype.createBarcodeDetectorFormats=function(e){for(var t=[],n=0,r=e;n<r.length;n++){var i=r[n];this.formatMap.has(i)?t.push(this.formatMap.get(i)):this.logger.warn("".concat(i," is not supported by")+"BarcodeDetectorDelegate")}return{formats:t}},e.prototype.toHtml5QrcodeSupportedFormats=function(e){if(!this.reverseFormatMap.has(e))throw"reverseFormatMap doesn't have ".concat(e);return this.reverseFormatMap.get(e)},e.prototype.createReverseFormatMap=function(){var e=new Map;return this.formatMap.forEach(function(t,n,r){e.set(t,n)}),e},e.prototype.createDebugData=function(){return{decoderName:"BarcodeDetector"}},e}(),mu=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},pu=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},gu=function(){function e(e,t,n,r){this.EXECUTIONS_TO_REPORT_PERFORMANCE=100,this.executions=0,this.executionResults=[],this.wasPrimaryDecoderUsedInLastDecode=!1,this.verbose=n,t&&fu.isSupported()?(this.primaryDecoder=new fu(e,n,r),this.secondaryDecoder=new du(e,n,r)):this.primaryDecoder=new du(e,n,r)}return e.prototype.decodeAsync=function(e){return mu(this,void 0,void 0,function(){var t;return pu(this,function(n){switch(n.label){case 0:t=performance.now(),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,this.getDecoder().decodeAsync(e)];case 2:return[2,n.sent()];case 3:return this.possiblyLogPerformance(t),[7];case 4:return[2]}})})},e.prototype.decodeRobustlyAsync=function(e){return mu(this,void 0,void 0,function(){var t,n;return pu(this,function(r){switch(r.label){case 0:t=performance.now(),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.primaryDecoder.decodeAsync(e)];case 2:return[2,r.sent()];case 3:if(n=r.sent(),this.secondaryDecoder)return[2,this.secondaryDecoder.decodeAsync(e)];throw n;case 4:return this.possiblyLogPerformance(t),[7];case 5:return[2]}})})},e.prototype.getDecoder=function(){return this.secondaryDecoder?!1===this.wasPrimaryDecoderUsedInLastDecode?(this.wasPrimaryDecoderUsedInLastDecode=!0,this.primaryDecoder):(this.wasPrimaryDecoderUsedInLastDecode=!1,this.secondaryDecoder):this.primaryDecoder},e.prototype.possiblyLogPerformance=function(e){if(this.verbose){var t=performance.now()-e;this.executionResults.push(t),this.executions++,this.possiblyFlushPerformanceReport()}},e.prototype.possiblyFlushPerformanceReport=function(){if(!(this.executions<this.EXECUTIONS_TO_REPORT_PERFORMANCE)){for(var e=0,t=0,n=this.executionResults;t<n.length;t++){e+=n[t]}var r=e/this.executionResults.length;console.log("".concat(r," ms for ").concat(this.executionResults.length," last runs.")),this.executions=0,this.executionResults=[]}},e}(),wu=(su=function(e,t){return su=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},su(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}su(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),yu=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},vu=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Iu=function(){function e(e,t){this.name=e,this.track=t}return e.prototype.isSupported=function(){return!!this.track.getCapabilities&&this.name in this.track.getCapabilities()},e.prototype.apply=function(e){var t={};t[this.name]=e;var n={advanced:[t]};return this.track.applyConstraints(n)},e.prototype.value=function(){var e=this.track.getSettings();return this.name in e?e[this.name]:null},e}(),_u=function(e){function t(t){return e.call(this,"zoom",t)||this}return wu(t,e),t}(function(e){function t(t,n){return e.call(this,t,n)||this}return wu(t,e),t.prototype.min=function(){return this.getCapabilities().min},t.prototype.max=function(){return this.getCapabilities().max},t.prototype.step=function(){return this.getCapabilities().step},t.prototype.apply=function(e){var t={};t[this.name]=e;var n={advanced:[t]};return this.track.applyConstraints(n)},t.prototype.getCapabilities=function(){this.failIfNotSupported();var e=this.track.getCapabilities()[this.name];return{min:e.min,max:e.max,step:e.step}},t.prototype.failIfNotSupported=function(){if(!this.isSupported())throw new Error("".concat(this.name," capability not supported"))},t}(Iu)),Cu=function(e){function t(t){return e.call(this,"torch",t)||this}return wu(t,e),t}(Iu),Eu=function(){function e(e){this.track=e}return e.prototype.zoomFeature=function(){return new _u(this.track)},e.prototype.torchFeature=function(){return new Cu(this.track)},e}(),Au=function(){function e(e,t,n){this.isClosed=!1,this.parentElement=e,this.mediaStream=t,this.callbacks=n,this.surface=this.createVideoElement(this.parentElement.clientWidth),e.append(this.surface)}return e.prototype.createVideoElement=function(e){var t=document.createElement("video");return t.style.width="".concat(e,"px"),t.style.display="block",t.muted=!0,t.setAttribute("muted","true"),t.playsInline=!0,t},e.prototype.setupSurface=function(){var e=this;this.surface.onabort=function(){throw"RenderedCameraImpl video surface onabort() called"},this.surface.onerror=function(){throw"RenderedCameraImpl video surface onerror() called"};var t=function(){var n=e.surface.clientWidth,r=e.surface.clientHeight;e.callbacks.onRenderSurfaceReady(n,r),e.surface.removeEventListener("playing",t)};this.surface.addEventListener("playing",t),this.surface.srcObject=this.mediaStream,this.surface.play()},e.create=function(t,n,r,i){return yu(this,void 0,void 0,function(){var o,s;return vu(this,function(a){switch(a.label){case 0:return o=new e(t,n,i),r.aspectRatio?(s={aspectRatio:r.aspectRatio},[4,o.getFirstTrackOrFail().applyConstraints(s)]):[3,2];case 1:a.sent(),a.label=2;case 2:return o.setupSurface(),[2,o]}})})},e.prototype.failIfClosed=function(){if(this.isClosed)throw"The RenderedCamera has already been closed."},e.prototype.getFirstTrackOrFail=function(){if(this.failIfClosed(),0===this.mediaStream.getVideoTracks().length)throw"No video tracks found";return this.mediaStream.getVideoTracks()[0]},e.prototype.pause=function(){this.failIfClosed(),this.surface.pause()},e.prototype.resume=function(e){this.failIfClosed();var t=this,n=function(){setTimeout(e,200),t.surface.removeEventListener("playing",n)};this.surface.addEventListener("playing",n),this.surface.play()},e.prototype.isPaused=function(){return this.failIfClosed(),this.surface.paused},e.prototype.getSurface=function(){return this.failIfClosed(),this.surface},e.prototype.getRunningTrackCapabilities=function(){return this.getFirstTrackOrFail().getCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getFirstTrackOrFail().getSettings()},e.prototype.applyVideoConstraints=function(e){return yu(this,void 0,void 0,function(){return vu(this,function(t){if("aspectRatio"in e)throw"Changing 'aspectRatio' in run-time is not yet supported.";return[2,this.getFirstTrackOrFail().applyConstraints(e)]})})},e.prototype.close=function(){if(this.isClosed)return Promise.resolve();var e=this;return new Promise(function(t,n){var r=e.mediaStream.getVideoTracks().length,i=0;e.mediaStream.getVideoTracks().forEach(function(n){e.mediaStream.removeTrack(n),n.stop(),++i>=r&&(e.isClosed=!0,e.parentElement.removeChild(e.surface),t())})})},e.prototype.getCapabilities=function(){return new Eu(this.getFirstTrackOrFail())},e}(),$u=function(){function e(e){this.mediaStream=e}return e.prototype.render=function(e,t,n){return yu(this,void 0,void 0,function(){return vu(this,function(r){return[2,Au.create(e,this.mediaStream,t,n)]})})},e.create=function(t){return yu(this,void 0,void 0,function(){var n;return vu(this,function(r){switch(r.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return[2,new e(r.sent())]}})})},e}(),bu=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Su=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Tu=function(){function e(){}return e.failIfNotSupported=function(){return bu(this,void 0,void 0,function(){return Su(this,function(t){if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return[2,new e]})})},e.prototype.create=function(e){return bu(this,void 0,void 0,function(){return Su(this,function(t){return[2,$u.create(e)]})})},e}(),Nu=function(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})},Ru=function(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(l){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,r=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){s.label=a[1];break}if(6===a[0]&&s.label<i[1]){s.label=i[1],i=a;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(a);break}i[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,l])}}},Du=function(){function e(){}return e.retrieve=function(){if(navigator.mediaDevices)return e.getCamerasFromMediaDevices();var t=MediaStreamTrack;return MediaStreamTrack&&t.getSources?e.getCamerasFromMediaStreamTrack():e.rejectWithError()},e.rejectWithError=function(){var t=tu.unableToQuerySupportedDevices();return e.isHttpsOrLocalhost()||(t=tu.insecureContextCameraQueryError()),Promise.reject(t)},e.isHttpsOrLocalhost=function(){if("https:"===location.protocol)return!0;var e=location.host.split(":")[0];return"127.0.0.1"===e||"localhost"===e},e.getCamerasFromMediaDevices=function(){return Nu(this,void 0,void 0,function(){var e,t,n,r,i,o,s;return Ru(this,function(a){switch(a.label){case 0:return e=function(e){for(var t=0,n=e.getVideoTracks();t<n.length;t++){var r=n[t];r.enabled=!1,r.stop(),e.removeTrack(r)}},[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0})];case 1:return t=a.sent(),[4,navigator.mediaDevices.enumerateDevices()];case 2:for(n=a.sent(),r=[],i=0,o=n;i<o.length;i++)"videoinput"===(s=o[i]).kind&&r.push({id:s.deviceId,label:s.label});return e(t),[2,r]}})})},e.getCamerasFromMediaStreamTrack=function(){return new Promise(function(e,t){MediaStreamTrack.getSources(function(t){for(var n=[],r=0,i=t;r<i.length;r++){var o=i[r];"video"===o.kind&&n.push({id:o.id,label:o.label})}e(n)})})},e}();!function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.NOT_STARTED=1]="NOT_STARTED",e[e.SCANNING=2]="SCANNING",e[e.PAUSED=3]="PAUSED"}(au||(au={}));var xu,Ou=function(){function e(){this.state=au.NOT_STARTED,this.onGoingTransactionNewState=au.UNKNOWN}return e.prototype.directTransition=function(e){this.failIfTransitionOngoing(),this.validateTransition(e),this.state=e},e.prototype.startTransition=function(e){return this.failIfTransitionOngoing(),this.validateTransition(e),this.onGoingTransactionNewState=e,this},e.prototype.execute=function(){if(this.onGoingTransactionNewState===au.UNKNOWN)throw"Transaction is already cancelled, cannot execute().";var e=this.onGoingTransactionNewState;this.onGoingTransactionNewState=au.UNKNOWN,this.directTransition(e)},e.prototype.cancel=function(){if(this.onGoingTransactionNewState===au.UNKNOWN)throw"Transaction is already cancelled, cannot cancel().";this.onGoingTransactionNewState=au.UNKNOWN},e.prototype.getState=function(){return this.state},e.prototype.failIfTransitionOngoing=function(){if(this.onGoingTransactionNewState!==au.UNKNOWN)throw"Cannot transition to a new state, already under transition"},e.prototype.validateTransition=function(e){switch(this.state){case au.UNKNOWN:throw"Transition from unknown is not allowed";case au.NOT_STARTED:this.failIfNewStateIs(e,[au.PAUSED]);case au.SCANNING:case au.PAUSED:}},e.prototype.failIfNewStateIs=function(e,t){for(var n=0,r=t;n<r.length;n++){if(e===r[n])throw"Cannot transition from ".concat(this.state," to ").concat(e)}},e}(),ku=function(){function e(e){this.stateManager=e}return e.prototype.startTransition=function(e){return this.stateManager.startTransition(e)},e.prototype.directTransition=function(e){this.stateManager.directTransition(e)},e.prototype.getState=function(){return this.stateManager.getState()},e.prototype.canScanFile=function(){return this.stateManager.getState()===au.NOT_STARTED},e.prototype.isScanning=function(){return this.stateManager.getState()!==au.NOT_STARTED},e.prototype.isStrictlyScanning=function(){return this.stateManager.getState()===au.SCANNING},e.prototype.isPaused=function(){return this.stateManager.getState()===au.PAUSED},e}(),Mu=function(){function e(){}return e.create=function(){return new ku(new Ou)},e}(),Pu=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Bu=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Pu(t,e),t.DEFAULT_WIDTH=300,t.DEFAULT_WIDTH_OFFSET=2,t.FILE_SCAN_MIN_HEIGHT=300,t.FILE_SCAN_HIDDEN_CANVAS_PADDING=100,t.MIN_QR_BOX_SIZE=50,t.SHADED_LEFT=1,t.SHADED_RIGHT=2,t.SHADED_TOP=3,t.SHADED_BOTTOM=4,t.SHADED_REGION_ELEMENT_ID="qr-shaded-region",t.VERBOSE=!1,t.BORDER_SHADER_DEFAULT_COLOR="#ffffff",t.BORDER_SHADER_MATCH_COLOR="rgb(90, 193, 56)",t}(Yd),Lu=function(){function e(e,t){this.logger=t,this.fps=Bu.SCAN_DEFAULT_FPS,e?(e.fps&&(this.fps=e.fps),this.disableFlip=!0===e.disableFlip,this.qrbox=e.qrbox,this.aspectRatio=e.aspectRatio,this.videoConstraints=e.videoConstraints):this.disableFlip=Bu.DEFAULT_DISABLE_FLIP}return e.prototype.isMediaStreamConstraintsValid=function(){return this.videoConstraints?nu.isMediaStreamConstraintsValid(this.videoConstraints,this.logger):(this.logger.logError("Empty videoConstraints",!0),!1)},e.prototype.isShadedBoxEnabled=function(){return!eu(this.qrbox)},e.create=function(t,n){return new e(t,n)},e}(),Fu=function(){function e(e,t){if(this.element=null,this.canvasElement=null,this.scannerPausedUiElement=null,this.hasBorderShaders=null,this.borderShaders=null,this.qrMatch=null,this.renderedCamera=null,this.qrRegion=null,this.context=null,this.lastScanImageFile=null,this.isScanning=!1,!document.getElementById(e))throw"HTML Element with id=".concat(e," not found");var n;this.elementId=e,this.verbose=!1,"boolean"==typeof t?this.verbose=!0===t:t&&(n=t,this.verbose=!0===n.verbose,n.experimentalFeatures),this.logger=new Jd(this.verbose),this.qrcode=new gu(this.getSupportedFormats(t),this.getUseBarCodeDetectorIfSupported(n),this.verbose,this.logger),this.foreverScanTimeout,this.shouldScan=!0,this.stateManagerProxy=Mu.create()}return e.prototype.start=function(e,t,n,r){var i,o=this;if(!e)throw"cameraIdOrConfig is required";if(!n||"function"!=typeof n)throw"qrCodeSuccessCallback is required and should be a function.";i=r||(this.verbose?this.logger.log:function(){});var s=Lu.create(t,this.logger);this.clearElement();var a=!1;s.videoConstraints&&(s.isMediaStreamConstraintsValid()?a=!0:this.logger.logError("'videoConstraints' is not valid 'MediaStreamConstraints, it will be ignored.'",!0));var l=a,c=document.getElementById(this.elementId);c.clientWidth?c.clientWidth:Bu.DEFAULT_WIDTH,c.style.position="relative",this.shouldScan=!0,this.element=c;var d=this,u=this.stateManagerProxy.startTransition(au.SCANNING);return new Promise(function(t,r){var a=l?s.videoConstraints:d.createVideoConstraints(e);if(!a)return u.cancel(),void r("videoConstraints should be defined");var c={};l&&!s.aspectRatio||(c.aspectRatio=s.aspectRatio);var h={onRenderSurfaceReady:function(e,t){d.setupUi(e,t,s),d.isScanning=!0,d.foreverScan(s,n,i)}};Tu.failIfNotSupported().then(function(e){e.create(a).then(function(e){return e.render(o.element,c,h).then(function(e){d.renderedCamera=e,u.execute(),t(null)}).catch(function(e){u.cancel(),r(e)})}).catch(function(e){u.cancel(),r(tu.errorGettingUserMedia(e))})}).catch(function(e){u.cancel(),r(tu.cameraStreamingNotSupported())})})},e.prototype.pause=function(e){if(!this.stateManagerProxy.isStrictlyScanning())throw"Cannot pause, scanner is not scanning.";this.stateManagerProxy.directTransition(au.PAUSED),this.showPausedState(),(eu(e)||!0!==e)&&(e=!1),e&&this.renderedCamera&&this.renderedCamera.pause()},e.prototype.resume=function(){if(!this.stateManagerProxy.isPaused())throw"Cannot result, scanner is not paused.";if(!this.renderedCamera)throw"renderedCamera doesn't exist while trying resume()";var e=this,t=function(){e.stateManagerProxy.directTransition(au.SCANNING),e.hidePausedState()};this.renderedCamera.isPaused()?this.renderedCamera.resume(function(){t()}):t()},e.prototype.getState=function(){return this.stateManagerProxy.getState()},e.prototype.stop=function(){var e=this;if(!this.stateManagerProxy.isScanning())throw"Cannot stop, scanner is not running or paused.";var t=this.stateManagerProxy.startTransition(au.NOT_STARTED);this.shouldScan=!1,this.foreverScanTimeout&&clearTimeout(this.foreverScanTimeout);var n=this;return this.renderedCamera.close().then(function(){return n.renderedCamera=null,n.element&&(n.element.removeChild(n.canvasElement),n.canvasElement=null),function(){if(e.element){var t=document.getElementById(Bu.SHADED_REGION_ELEMENT_ID);t&&e.element.removeChild(t)}}(),n.qrRegion&&(n.qrRegion=null),n.context&&(n.context=null),t.execute(),n.hidePausedState(),n.isScanning=!1,Promise.resolve()})},e.prototype.scanFile=function(e,t){return this.scanFileV2(e,t).then(function(e){return e.decodedText})},e.prototype.scanFileV2=function(e,t){var n=this;if(!(e&&e instanceof File))throw"imageFile argument is mandatory and should be instance of File. Use 'event.target.files[0]'.";if(eu(t)&&(t=!0),!this.stateManagerProxy.canScanFile())throw"Cannot start file scan - ongoing camera scan";return new Promise(function(r,i){n.possiblyCloseLastScanImageFile(),n.clearElement(),n.lastScanImageFile=URL.createObjectURL(e);var o=new Image;o.onload=function(){var e=o.width,s=o.height,a=document.getElementById(n.elementId),l=a.clientWidth?a.clientWidth:Bu.DEFAULT_WIDTH,c=Math.max(a.clientHeight?a.clientHeight:s,Bu.FILE_SCAN_MIN_HEIGHT),d=n.computeCanvasDrawConfig(e,s,l,c);if(t){var u=n.createCanvasElement(l,c,"qr-canvas-visible");u.style.display="inline-block",a.appendChild(u);var h=u.getContext("2d");if(!h)throw"Unable to get 2d context from canvas";h.canvas.width=l,h.canvas.height=c,h.drawImage(o,0,0,e,s,d.x,d.y,d.width,d.height)}var f=Bu.FILE_SCAN_HIDDEN_CANVAS_PADDING,m=Math.max(o.width,d.width),p=Math.max(o.height,d.height),g=m+2*f,w=p+2*f,y=n.createCanvasElement(g,w);a.appendChild(y);var v=y.getContext("2d");if(!v)throw"Unable to get 2d context from canvas";v.canvas.width=g,v.canvas.height=w,v.drawImage(o,0,0,e,s,f,f,m,p);try{n.qrcode.decodeRobustlyAsync(y).then(function(e){r(Kd.createFromQrcodeResult(e))}).catch(i)}catch(e){i("QR code parse error, error = ".concat(e))}},o.onerror=i,o.onabort=i,o.onstalled=i,o.onsuspend=i,o.src=URL.createObjectURL(e)})},e.prototype.clear=function(){this.clearElement()},e.getCameras=function(){return Du.retrieve()},e.prototype.getRunningTrackCapabilities=function(){return this.getRenderedCameraOrFail().getRunningTrackCapabilities()},e.prototype.getRunningTrackSettings=function(){return this.getRenderedCameraOrFail().getRunningTrackSettings()},e.prototype.getRunningTrackCameraCapabilities=function(){return this.getRenderedCameraOrFail().getCapabilities()},e.prototype.applyVideoConstraints=function(e){if(!e)throw"videoConstaints is required argument.";if(!nu.isMediaStreamConstraintsValid(e,this.logger))throw"invalid videoConstaints passed, check logs for more details";return this.getRenderedCameraOrFail().applyVideoConstraints(e)},e.prototype.getRenderedCameraOrFail=function(){if(null==this.renderedCamera)throw"Scanning is not in running state, call this API only when QR code scanning using camera is in running state.";return this.renderedCamera},e.prototype.getSupportedFormats=function(e){var t=[Wd.QR_CODE,Wd.AZTEC,Wd.CODABAR,Wd.CODE_39,Wd.CODE_93,Wd.CODE_128,Wd.DATA_MATRIX,Wd.MAXICODE,Wd.ITF,Wd.EAN_13,Wd.EAN_8,Wd.PDF_417,Wd.RSS_14,Wd.RSS_EXPANDED,Wd.UPC_A,Wd.UPC_E,Wd.UPC_EAN_EXTENSION];if(!e||"boolean"==typeof e)return t;if(!e.formatsToSupport)return t;if(!Array.isArray(e.formatsToSupport))throw"configOrVerbosityFlag.formatsToSupport should be undefined or an array.";if(0===e.formatsToSupport.length)throw"Atleast 1 formatsToSupport is needed.";for(var n=[],r=0,i=e.formatsToSupport;r<i.length;r++){var o=i[r];Gd(o)?n.push(o):this.logger.warn("Invalid format: ".concat(o," passed in config, ignoring."))}if(0===n.length)throw"None of formatsToSupport match supported values.";return n},e.prototype.getUseBarCodeDetectorIfSupported=function(e){if(eu(e))return!0;if(!eu(e.useBarCodeDetectorIfSupported))return!1!==e.useBarCodeDetectorIfSupported;if(eu(e.experimentalFeatures))return!0;var t=e.experimentalFeatures;return!!eu(t.useBarCodeDetectorIfSupported)||!1!==t.useBarCodeDetectorIfSupported},e.prototype.validateQrboxSize=function(e,t,n){var r=this,i=n.qrbox;this.validateQrboxConfig(i);var o,s=this.toQrdimensions(e,t,i),a=function(e){if(e<Bu.MIN_QR_BOX_SIZE)throw"minimum size of 'config.qrbox' dimension value is"+" ".concat(Bu.MIN_QR_BOX_SIZE,"px.")};a(s.width),a(s.height),s.width=((o=s.width)>e&&(r.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),o=e),o)},e.prototype.validateQrboxConfig=function(e){if("number"!=typeof e&&"function"!=typeof e&&(void 0===e.width||void 0===e.height))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(e,t,n){if("number"==typeof n)return{width:n,height:n};if("function"==typeof n)try{return n(e,t)}catch(e){throw new Error("qrbox config was passed as a function but it failed with unknown error"+e)}return n},e.prototype.setupUi=function(e,t,n){n.isShadedBoxEnabled()&&this.validateQrboxSize(e,t,n);var r=eu(n.qrbox)?{width:e,height:t}:n.qrbox;this.validateQrboxConfig(r);var i=this.toQrdimensions(e,t,r);i.height>t&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var o=n.isShadedBoxEnabled()&&i.height<=t,s={x:0,y:0,width:e,height:t},a=o?this.getShadedRegionBounds(e,t,i):s,l=this.createCanvasElement(a.width,a.height),c=l.getContext("2d",{willReadFrequently:!0});c.canvas.width=a.width,c.canvas.height=a.height,this.element.append(l),o&&this.possiblyInsertShadingElement(this.element,e,t,i),this.createScannerPausedUiElement(this.element),this.qrRegion=a,this.context=c,this.canvasElement=l},e.prototype.createScannerPausedUiElement=function(e){var t=document.createElement("div");t.innerText=tu.scannerPaused(),t.style.display="none",t.style.position="absolute",t.style.top="0px",t.style.zIndex="1",t.style.background="rgba(9, 9, 9, 0.46)",t.style.color="#FFECEC",t.style.textAlign="center",t.style.width="100%",e.appendChild(t),this.scannerPausedUiElement=t},e.prototype.scanContext=function(e,t){var n=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(t){return e(t.text,Kd.createFromQrcodeResult(t)),n.possiblyUpdateShaders(!0),!0}).catch(function(e){n.possiblyUpdateShaders(!1);var r=tu.codeParseError(e);return t(r,Qd.createFrom(r)),!1})},e.prototype.foreverScan=function(e,t,n){var r=this;if(this.shouldScan&&this.renderedCamera){var i=this.renderedCamera.getSurface(),o=i.videoWidth/i.clientWidth,s=i.videoHeight/i.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var a=this.qrRegion.width*o,l=this.qrRegion.height*s,c=this.qrRegion.x*o,d=this.qrRegion.y*s;this.context.drawImage(i,c,d,a,l,0,0,this.qrRegion.width,this.qrRegion.height);var u=function(){r.foreverScanTimeout=setTimeout(function(){r.foreverScan(e,t,n)},r.getTimeoutFps(e.fps))};this.scanContext(t,n).then(function(i){i||!0===e.disableFlip?u():(r.context.translate(r.context.canvas.width,0),r.context.scale(-1,1),r.scanContext(t,n).finally(function(){u()}))}).catch(function(e){r.logger.logError("Error happend while scanning context",e),u()})}},e.prototype.createVideoConstraints=function(e){if("string"==typeof e)return{deviceId:{exact:e}};if("object"==typeof e){var t="facingMode",n="deviceId",r={user:!0,environment:!0},i="exact",o=function(e){if(e in r)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(e,"'")},s=Object.keys(e);if(1!==s.length)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(s.length," keys");var a=Object.keys(e)[0];if(a!==t&&a!==n)throw"Only '".concat(t,"' and '").concat(n,"' ")+" are supported for 'cameraIdOrConfig'";if(a!==t){var l=e.deviceId;if("string"==typeof l)return{deviceId:l};if("object"==typeof l){if(i in l)return{deviceId:{exact:l["".concat(i)]}};throw"'deviceId' should be string or object with"+" ".concat(i," as key.")}throw"Invalid type of 'deviceId' = ".concat(typeof l)}var c=e.facingMode;if("string"==typeof c){if(o(c))return{facingMode:c}}else{if("object"!=typeof c)throw"Invalid type of 'facingMode' = ".concat(typeof c);if(!(i in c))throw"'facingMode' should be string or object with"+" ".concat(i," as key.");if(o(c["".concat(i)]))return{facingMode:{exact:c["".concat(i)]}}}}throw"Invalid type of 'cameraIdOrConfig' = ".concat(typeof e)},e.prototype.computeCanvasDrawConfig=function(e,t,n,r){if(e<=n&&t<=r)return{x:(n-e)/2,y:(r-t)/2,width:e,height:t};var i=e,o=t;return e>n&&(t*=n/e,e=n),t>r&&(e*=r/t,t=r),this.logger.log("Image downsampled from "+"".concat(i,"X").concat(o)+" to ".concat(e,"X").concat(t,".")),this.computeCanvasDrawConfig(e,t,n,r)},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var e=document.getElementById(this.elementId);e&&(e.innerHTML="")},e.prototype.possiblyUpdateShaders=function(e){this.qrMatch!==e&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(t){t.style.backgroundColor=e?Bu.BORDER_SHADER_MATCH_COLOR:Bu.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=e)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(e,t,n){var r=e,i=t,o=document.createElement("canvas");return o.style.width="".concat(r,"px"),o.style.height="".concat(i,"px"),o.style.display="none",o.id=eu(n)?"qr-canvas":n,o},e.prototype.getShadedRegionBounds=function(e,t,n){if(n.width>e||n.height>t)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(e-n.width)/2,y:(t-n.height)/2,width:n.width,height:n.height}},e.prototype.possiblyInsertShadingElement=function(e,t,n,r){if(!(t-r.width<1||n-r.height<1)){var i=document.createElement("div");i.style.position="absolute";var o=(t-r.width)/2,s=(n-r.height)/2;if(i.style.borderLeft="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderRight="".concat(o,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderTop="".concat(s,"px solid rgba(0, 0, 0, 0.48)"),i.style.borderBottom="".concat(s,"px solid rgba(0, 0, 0, 0.48)"),i.style.boxSizing="border-box",i.style.top="0px",i.style.bottom="0px",i.style.left="0px",i.style.right="0px",i.id="".concat(Bu.SHADED_REGION_ELEMENT_ID),t-r.width<11||n-r.height<11)this.hasBorderShaders=!1;else{var a=40;this.insertShaderBorders(i,a,5,-5,null,0,!0),this.insertShaderBorders(i,a,5,-5,null,0,!1),this.insertShaderBorders(i,a,5,null,-5,0,!0),this.insertShaderBorders(i,a,5,null,-5,0,!1),this.insertShaderBorders(i,5,45,-5,null,-5,!0),this.insertShaderBorders(i,5,45,null,-5,-5,!0),this.insertShaderBorders(i,5,45,-5,null,-5,!1),this.insertShaderBorders(i,5,45,null,-5,-5,!1),this.hasBorderShaders=!0}e.append(i)}},e.prototype.insertShaderBorders=function(e,t,n,r,i,o,s){var a=document.createElement("div");a.style.position="absolute",a.style.backgroundColor=Bu.BORDER_SHADER_DEFAULT_COLOR,a.style.width="".concat(t,"px"),a.style.height="".concat(n,"px"),null!==r&&(a.style.top="".concat(r,"px")),null!==i&&(a.style.bottom="".concat(i,"px")),s?a.style.left="".concat(o,"px"):a.style.right="".concat(o,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(a),e.appendChild(a)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(e){return 1e3/e},e}();function Vu(e,t,n){const r=e.slice();return r[19]=t[n].id,r[20]=t[n].label,r}function Uu(e){let t,n,r=e[1]&&Hu(e);return{c(){r&&r.c(),t=P(),n=O("reader"),U(n,"id","reader"),U(n,"class","svelte-9062r9")},m(e,i){r&&r.m(e,i),R(e,t,i),R(e,n,i)},p(e,n){e[1]?r?r.p(e,n):(r=Hu(e),r.c(),r.m(t.parentNode,t)):r&&(r.d(1),r=null)},d(e){r&&r.d(e),e&&D(t),e&&D(n)}}}function Hu(e){let t,n,r,i,o,s,a=e[1],l=[];for(let t=0;t<a.length;t+=1)l[t]=Wu(Vu(e,a,t));return{c(){t=O("div"),n=M("Quelle:\n "),r=O("select");for(let e=0;e<l.length;e+=1)l[e].c();r.disabled=i=1===e[1].length},m(i,a){R(i,t,a),N(t,n),N(t,r);for(let e=0;e<l.length;e+=1)l[e].m(r,null);o||(s=L(r,"change",e[4]),o=!0)},p(e,t){if(6&t){let n;for(a=e[1],n=0;n<a.length;n+=1){const i=Vu(e,a,n);l[n]?l[n].p(i,t):(l[n]=Wu(i),l[n].c(),l[n].m(r,null))}for(;n<l.length;n+=1)l[n].d(1);l.length=a.length}2&t&&i!==(i=1===e[1].length)&&(r.disabled=i)},d(e){e&&D(t),x(l,e),o=!1,s()}}}function Wu(e){let t,n,r,i,o=e[20]+"";return{c(){t=O("option"),n=M(o),t.__value=r=e[19],t.value=t.__value,t.selected=i=e[2]===e[19]},m(e,r){R(e,t,r),N(t,n)},p(e,s){2&s&&o!==(o=e[20]+"")&&H(n,o),2&s&&r!==(r=e[19])&&(t.__value=r,t.value=t.__value),6&s&&i!==(i=e[2]===e[19])&&(t.selected=i)},d(e){e&&D(t)}}}function zu(e){let t,n=!e[0]&&Uu(e);return{c(){t=O("main"),n&&n.c(),U(t,"class","svelte-9062r9")},m(e,r){R(e,t,r),n&&n.m(t,null)},p(e,[r]){e[0]?n&&(n.d(1),n=null):n?n.p(e,r):(n=Uu(e),n.c(),n.m(t,null))},i:I,o:I,d(e){e&&D(t),n&&n.d()}}}!function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"}(xu||(xu={}));const ju=()=>Fu.getCameras();function qu(e,t,n){let r;const i=K(),{loggedIn:o}=u;b(e,o,e=>n(9,r=e));let s,a,l,{keyboard:c}=t,{codeTypes:d=""}=t,{readerInit:h=!1}=t,f=!1;const m=r.tenant+"-ENABLERR-CAMERA";Y(function(){if(c)return void(f=!0);try{s||(s=new Fu("reader"));const e=window.localStorage.getItem(m);ju().then(t=>{if(!t?.length)return;n(1,a=t);const r=t.find(t=>t.id===e);r&&window.localStorage.setItem(m,r.id),g(r?.id||a[0].id)})}catch{}}),Z(function(){w(),i("exit")});var p=function(e,t){var n=250,r=e>t?t:e,i=Math.floor(.75*r);return i<n?r<n?{width:r,height:r}:{width:n,height:n}:{width:i,height:i}};function g(e){if(e&&n(2,l=e),l)try{s.start(l,{fps:5,qrbox:p,formatsToSupport:d||void 0,facingMode:"environment"},y),f=!0}catch{}}async function w(e=!1){try{c||(await s.stop(),e&&await s.clear())}catch{}finally{f=!1}}function y(e,t){f&&(i("scan",{text:e}),f=!1)}return e.$$set=e=>{"keyboard"in e&&n(0,c=e.keyboard),"codeTypes"in e&&n(6,d=e.codeTypes),"readerInit"in e&&n(5,h=e.readerInit)},e.$$.update=()=>{32&e.$$.dirty&&h&&(f=!0,n(5,h=!1))},[c,a,l,o,async e=>{const t=e.target.value;await w(),window.localStorage.setItem(m,t),g(t)},h,d]}class Gu extends Te{constructor(e){var t;super(),document.getElementById("svelte-9062r9-style")||((t=O("style")).id="svelte-9062r9-style",t.textContent="main.svelte-9062r9{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:20px;max-height:400px}reader.svelte-9062r9{width:400px;height:300px;background-color:gray}",N(document.head,t)),Se(this,e,qu,zu,$,{keyboard:0,codeTypes:6,readerInit:5})}}const{document:Xu}=_e;function Yu(e,t,n){const r=e.slice();return r[143]=t[n],r[145]=n,r}function Zu(e,t,n){const r=e.slice();return r[147]=t[n],r[149]=n,r}function Ku(e,t,n){const r=e.slice();return r[156]=t[n],r}function Qu(e,t,n){const r=e.slice();return r[151]=t[n].title,r[152]=t[n].toDelete,r[153]=t[n].icon,r}function Ju(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function eh(e){let t,n,r,i,o,s,a,l,c,d,u,h=(!e[2]||e[15]?.length&&e[15].length>1)&&th(e),f=e[19]&&nh(e),m=!1!==e[4].transfer&&e[49]?.length&&ih(e),p=!e[10]&&e[45]&&e[14]&&0!=e[14]&&sh(e),g=!e[10]&&e[43]&&e[17]&&0!=e[17]&&lh(e),w=e[41]&&e[13]&&0!=e[13]&&dh(e);l=new e[36]({props:{class:e[6]+e[4].name,$$slots:{default:[Eh,({closeOtherPanels:e})=>({146:e}),({closeOtherPanels:e})=>[0,0,0,0,e?4194304:0]]},$$scope:{ctx:e}}});let y=e[19]&&e[22]&&Ah(e);return{c(){h&&h.c(),t=P(),n=O("div"),f&&f.c(),r=P(),m&&m.c(),i=P(),p&&p.c(),o=P(),g&&g.c(),s=P(),w&&w.c(),a=P(),Ae(l.$$.fragment),c=P(),y&&y.c(),d=B(),U(n,"class","formList")},m(e,v){h&&h.m(e,v),R(e,t,v),R(e,n,v),f&&f.m(n,null),N(n,r),m&&m.m(n,null),N(n,i),p&&p.m(n,null),N(n,o),g&&g.m(n,null),N(n,s),w&&w.m(n,null),N(n,a),$e(l,n,null),R(e,c,v),y&&y.m(e,v),R(e,d,v),u=!0},p(e,c){!e[2]||e[15]?.length&&e[15].length>1?h?(h.p(e,c),32772&c[0]&&we(h,1)):(h=th(e),h.c(),we(h,1),h.m(t.parentNode,t)):h&&(pe(),ye(h,1,1,()=>{h=null}),ge()),e[19]?f?(f.p(e,c),524288&c[0]&&we(f,1)):(f=nh(e),f.c(),we(f,1),f.m(n,r)):f&&(pe(),ye(f,1,1,()=>{f=null}),ge()),!1!==e[4].transfer&&e[49]?.length?m?(m.p(e,c),16&c[0]&&we(m,1)):(m=ih(e),m.c(),we(m,1),m.m(n,i)):m&&(pe(),ye(m,1,1,()=>{m=null}),ge()),!e[10]&&e[45]&&e[14]&&0!=e[14]?p?(p.p(e,c),17408&c[0]&&we(p,1)):(p=sh(e),p.c(),we(p,1),p.m(n,o)):p&&(pe(),ye(p,1,1,()=>{p=null}),ge()),!e[10]&&e[43]&&e[17]&&0!=e[17]?g?(g.p(e,c),132096&c[0]&&we(g,1)):(g=lh(e),g.c(),we(g,1),g.m(n,s)):g&&(pe(),ye(g,1,1,()=>{g=null}),ge()),e[41]&&e[13]&&0!=e[13]?w?(w.p(e,c),8192&c[0]&&we(w,1)):(w=dh(e),w.c(),we(w,1),w.m(n,a)):w&&(pe(),ye(w,1,1,()=>{w=null}),ge());const u={};80&c[0]&&(u.class=e[6]+e[4].name),1612554239&c[0]|1&c[1]|4194304&c[4]|16&c[5]&&(u.$$scope={dirty:c,ctx:e}),l.$set(u),e[19]&&e[22]?y?(y.p(e,c),4718592&c[0]&&we(y,1)):(y=Ah(e),y.c(),we(y,1),y.m(d.parentNode,d)):y&&(pe(),ye(y,1,1,()=>{y=null}),ge())},i(e){u||(we(h),we(f),we(m),we(p),we(g),we(w),we(l.$$.fragment,e),we(y),u=!0)},o(e){ye(h),ye(f),ye(m),ye(p),ye(g),ye(w),ye(l.$$.fragment,e),ye(y),u=!1},d(e){h&&h.d(e),e&&D(t),e&&D(n),f&&f.d(),m&&m.d(),p&&p.d(),g&&g.d(),w&&w.d(),be(l),e&&D(c),y&&y.d(e),e&&D(d)}}}function th(e){let t,n;return t=new e[38]({props:{text:e[4].designation}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};16&n[0]&&(r.text=e[4].designation),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function nh(e){let t,n;return t=new e[35]({props:{disabled:e[1]||!e[0]._id&&e[21].input,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[rh]},$$scope:{ctx:e}}}),t.$on("click",e[70]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};2097155&n[0]&&(r.disabled=e[1]||!e[0]._id&&e[21].input),16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rh(e){let t,n,r;return n=new We({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Barcode scannen",Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function ih(e){let t,n;return t=new e[35]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[oh]},$$scope:{ctx:e}}}),t.$on("click",e[77]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};16&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function oh(e){let t,n,r,i,o=e[69](e[4].transfer)+"";return r=new Be({props:{size:"18"}}),{c(){t=O("span"),n=M(o),Ae(r.$$.fragment),z(t,"margin-right",".75em")},m(e,o){R(e,t,o),N(t,n),$e(r,e,o),i=!0},p(e,t){(!i||16&t[0])&&o!==(o=e[69](e[4].transfer)+"")&&H(n,o)},i(e){i||(we(r.$$.fragment,e),i=!0)},o(e){ye(r.$$.fragment,e),i=!1},d(e){e&&D(t),be(r,e)}}}function sh(e){let t,n;return t=new e[34]({props:{name:"Total Wochen",nameClass:"formField_italic",$$slots:{default:[ah]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};16384&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ah(e){let t,n,r;function i(t){e[83](t)}let o={item:e[46],disabled:!0};return void 0!==e[14]&&(o.value=e[14]),t=new $i({props:o}),ee.push(()=>Ee(t,"value",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};!n&&16384&r[0]&&(n=!0,i.value=e[14],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function lh(e){let t,n;return t=new e[34]({props:{name:"Total Stunden",nameClass:"formField_italic",$$slots:{default:[ch]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};131072&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ch(e){let t,n,r;function i(t){e[84](t)}let o={item:e[44],disabled:!0};return void 0!==e[17]&&(o.value=e[17]),t=new $i({props:o}),ee.push(()=>Ee(t,"value",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};!n&&131072&r[0]&&(n=!0,i.value=e[17],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function dh(e){let t,n;return t=new e[34]({props:{name:"Total Betrag",nameClass:"formField_italic",$$slots:{default:[uh]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};8448&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function uh(e){let t,n,r;function i(t){e[85](t)}let o={item:e[42],disabled:!0,currency:e[8]};return void 0!==e[13]&&(o.value=e[13]),t=new $i({props:o}),ee.push(()=>Ee(t,"value",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};256&r[0]&&(i.currency=e[8]),!n&&8192&r[0]&&(n=!0,i.value=e[13],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function hh(e){let t,n;return t=new e[37]({props:{class:e[29][e[149]],open:e[12]&&!e[2]&&0===e[149]&&!e[19],$$slots:{handle:[_h,({toggle:e,open:t})=>({150:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,e?67108864:0]],default:[gh,({toggle:e,open:t})=>({150:e,12:t}),({toggle:e,open:t})=>[t?4096:0,0,0,0,e?67108864:0]]},$$scope:{ctx:e}}}),t.$on("panel-open",function(){A(e[66](e[149],e[146]))&&e[66](e[149],e[146]).apply(this,arguments)}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(n,r){e=n;const i={};536870912&r[0]&&(i.class=e[29][e[149]]),528388&r[0]&&(i.open=e[12]&&!e[2]&&0===e[149]&&!e[19]),1075159035&r[0]|1&r[1]|67108864&r[4]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function fh(e){let t,n;return t=new Hd({props:{praefix:e[149],item:e[156],eventId:e[7],fullRecord:e[0],record:e[147],recordId:e[0]._id,multiValues:e[5],reqQuantity:e[3],notifyList:e[9],noForm:Vh,classId:e[6],disabled:e[1],required:e[40],selectionFields:e[50],propSelection:e[20],numberInput:e[31],dateInput:{...e[11],l:e[4].name,t:e[149]===e[15].length-1,n:e[48].get(e[156].name)},shortEdit:e[10],currency:e[8],initFinished:e[18],formnovalidate:e[149]===e[15].length-1||e[15][e[149]]._delete}}),t.$on("notify",function(){A(e[54](e[4],e[156],e[149]))&&e[54](e[4],e[156],e[149]).apply(this,arguments)}),t.$on("task",function(){A(e[53](e[4]))&&e[53](e[4]).apply(this,arguments)}),t.$on("invalid",e[55]),t.$on("defPrep",e[56]),t.$on("checkRange",e[57]),t.$on("formula",e[67](e[149])),t.$on("record",e[86]),t.$on("listRecord",e[58](e[149])),t.$on("propSelection",e[68](e[149])),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(n,r){e=n;const i={};16&r[0]&&(i.item=e[156]),128&r[0]&&(i.eventId=e[7]),1&r[0]&&(i.fullRecord=e[0]),32768&r[0]&&(i.record=e[147]),1&r[0]&&(i.recordId=e[0]._id),32&r[0]&&(i.multiValues=e[5]),8&r[0]&&(i.reqQuantity=e[3]),512&r[0]&&(i.notifyList=e[9]),64&r[0]&&(i.classId=e[6]),2&r[0]&&(i.disabled=e[1]),1048576&r[0]&&(i.propSelection=e[20]),1&r[1]&&(i.numberInput=e[31]),34832&r[0]&&(i.dateInput={...e[11],l:e[4].name,t:e[149]===e[15].length-1,n:e[48].get(e[156].name)}),1024&r[0]&&(i.shortEdit=e[10]),256&r[0]&&(i.currency=e[8]),262144&r[0]&&(i.initFinished=e[18]),32768&r[0]&&(i.formnovalidate=e[149]===e[15].length-1||e[15][e[149]]._delete),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function mh(e){let t,n,r=e[4].item,i=[];for(let t=0;t<r.length;t+=1)i[t]=fh(Ku(e,r,t));const o=e=>ye(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=B()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(1347579&n[0]|264897025&n[1]|96&n[2]){let s;for(r=e[4].item,s=0;s<r.length;s+=1){const o=Ku(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=fh(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){x(i,e),e&&D(t)}}}function ph(e){let t,n,r=e[15][e[149]]._delete,i=mh(e);return{c(){i.c(),t=B()},m(e,r){i.m(e,r),R(e,t,r),n=!0},p(e,n){32768&n[0]&&$(r,r=e[15][e[149]]._delete)?(pe(),ye(i,1,1,I),ge(),i=mh(e),i.c(),we(i),i.m(t.parentNode,t)):i.p(e,n)},i(e){n||(we(i),n=!0)},o(e){ye(i),n=!1},d(e){e&&D(t),i.d(e)}}}function gh(e){let t,n,r,i,o=e[15].length,s=ph(e);return{c(){t=O("div"),s.c(),r=P(),U(t,"id",n=`accordion-content-${e[6]}-${e[4].name}-${e[149]}`)},m(e,n){R(e,t,n),s.m(t,null),R(e,r,n),i=!0},p(e,r){32768&r[0]&&$(o,o=e[15].length)?(pe(),ye(s,1,1,I),ge(),s=ph(e),s.c(),we(s),s.m(t,null)):s.p(e,r),(!i||80&r[0]&&n!==(n=`accordion-content-${e[6]}-${e[4].name}-${e[149]}`))&&U(t,"id",n)},i(e){i||(we(s),i=!0)},o(e){ye(s),i=!1},d(e){e&&D(t),s.d(e),e&&D(r)}}}function wh(e){let t,n;return t=new e[35]({props:{$$slots:{default:[yh]},$$scope:{ctx:e}}}),t.$on("click",function(){A(e[59](e[150],e[149],e[12]))&&e[59](e[150],e[149],e[12]).apply(this,arguments)}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(n,r){e=n;const i={};1073840144&r[0]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function yh(e){let t,n,r,i,o,s=e[52](e[16],e[149])+"";return{c(){t=O("div"),n=M(s),U(t,"class",r=S("draggableListItem "+e[4].name)+" svelte-9vv5ub"),U(t,"draggable",!0),j(t,"delete",e[147]._delete),j(t,"is-active-top",e[30]?.top===e[149]),j(t,"is-active-bottom",e[30]?.bottom===e[149])},m(r,s){R(r,t,s),N(t,n),i||(o=[L(t,"dragover",e[64]),L(t,"dragleave",e[65](e[149])),L(t,"dragstart",e[62](e[149])),L(t,"drop",F(e[61](e[149]))),L(t,"dragenter",e[63](e[149]))],i=!0)},p(i,o){e=i,65536&o[0]&&s!==(s=e[52](e[16],e[149])+"")&&H(n,s),16&o[0]&&r!==(r=S("draggableListItem "+e[4].name)+" svelte-9vv5ub")&&U(t,"class",r),32784&o[0]&&j(t,"delete",e[147]._delete),1073741840&o[0]&&j(t,"is-active-top",e[30]?.top===e[149]),1073741840&o[0]&&j(t,"is-active-bottom",e[30]?.bottom===e[149])},d(e){e&&D(t),i=!1,E(o)}}}function vh(e){let t,n,r;var i=e[153];return i&&(t=new i({props:{size:"20"}})),{c(){t&&Ae(t.$$.fragment),n=B()},m(e,i){t&&$e(t,e,i),R(e,n,i),r=!0},p(e,r){if(i!==(i=e[153])){if(t){pe();const e=t;ye(e.$$.fragment,1,0,()=>{be(e,1)}),ge()}i?(t=new i({props:{size:"20"}}),Ae(t.$$.fragment),we(t.$$.fragment,1),$e(t,n.parentNode,n)):t=null}},i(e){r||(t&&we(t.$$.fragment,e),r=!0)},o(e){t&&ye(t.$$.fragment,e),r=!1},d(e){e&&D(n),t&&be(t,e)}}}function Ih(e){let t,n,r,i,o,s=!e[1]&&!e[4].readonly&&vh(e);return{c(){t=O("span"),s&&s.c(),U(t,"class","pointer icon svelte-9vv5ub"),U(t,"title",e[151]),t.hidden=n=e[149]===e[15].length-1||!(e[147]._delete^e[152])},m(n,a){R(n,t,a),s&&s.m(t,null),r=!0,i||(o=L(t,"click",function(){A(e[60](e[149],e[12],e[150]))&&e[60](e[149],e[12],e[150]).apply(this,arguments)}),i=!0)},p(i,o){(e=i)[1]||e[4].readonly?s&&(pe(),ye(s,1,1,()=>{s=null}),ge()):s?(s.p(e,o),18&o[0]&&we(s,1)):(s=vh(e),s.c(),we(s,1),s.m(t,null)),(!r||32768&o[0]&&n!==(n=e[149]===e[15].length-1||!(e[147]._delete^e[152])))&&(t.hidden=n)},i(e){r||(we(s),r=!0)},o(e){ye(s),r=!1},d(e){e&&D(t),s&&s.d(),i=!1,o()}}}function _h(e){let t,n,r,i,o,s=!e[10]&&wh(e),a=[{title:"löschen",toDelete:!0,icon:tt},{title:"undo",toDelete:!1,icon:Qe}],l=[];for(let t=0;t<2;t+=1)l[t]=Ih(Qu(e,a,t));const c=e=>ye(l[e],1,1,()=>{l[e]=null});return{c(){t=O("div"),s&&s.c(),n=P();for(let e=0;e<2;e+=1)l[e].c();r=P(),U(t,"class",i=S("accordion "+e[4].name)+" svelte-9vv5ub"),U(t,"slot","handle")},m(e,i){R(e,t,i),s&&s.m(t,null),N(t,n);for(let e=0;e<2;e+=1)l[e].m(t,null);N(t,r),o=!0},p(e,d){if(e[10]?s&&(pe(),ye(s,1,1,()=>{s=null}),ge()):s?(s.p(e,d),1024&d[0]&&we(s,1)):(s=wh(e),s.c(),we(s,1),s.m(t,n)),36882&d[0]|536870912&d[1]|67108864&d[4]){let n;for(a=[{title:"löschen",toDelete:!0,icon:tt},{title:"undo",toDelete:!1,icon:Qe}],n=0;n<2;n+=1){const i=Qu(e,a,n);l[n]?(l[n].p(i,d),we(l[n],1)):(l[n]=Ih(i),l[n].c(),we(l[n],1),l[n].m(t,r))}for(pe(),n=2;n<2;n+=1)c(n);ge()}(!o||16&d[0]&&i!==(i=S("accordion "+e[4].name)+" svelte-9vv5ub"))&&U(t,"class",i)},i(e){if(!o){we(s);for(let e=0;e<2;e+=1)we(l[e]);o=!0}},o(e){ye(s),l=l.filter(Boolean);for(let e=0;e<2;e+=1)ye(l[e]);o=!1},d(e){e&&D(t),s&&s.d(),x(l,e)}}}function Ch(e){let t,n,r=(!e[2]&&!e[1]||e[149]<e[15].length-1)&&hh(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){!e[2]&&!e[1]||e[149]<e[15].length-1?r?(r.p(e,n),32774&n[0]&&we(r,1)):(r=hh(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Eh(e){let t,n,r=e[15],i=[];for(let t=0;t<r.length;t+=1)i[t]=Ch(Zu(e,r,t));const o=e=>ye(i[e],1,1,()=>{i[e]=null});return{c(){for(let e=0;e<i.length;e+=1)i[e].c();t=B()},m(e,r){for(let t=0;t<i.length;t+=1)i[t].m(e,r);R(e,t,r),n=!0},p(e,n){if(1612554239&n[0]|2146042369&n[1]|127&n[2]|71303168&n[4]){let s;for(r=e[15],s=0;s<r.length;s+=1){const o=Zu(e,r,s);i[s]?(i[s].p(o,n),we(i[s],1)):(i[s]=Ch(o),i[s].c(),we(i[s],1),i[s].m(t.parentNode,t))}for(pe(),s=r.length;s<i.length;s+=1)o(s);ge()}},i(e){if(!n){for(let e=0;e<r.length;e+=1)we(i[e]);n=!0}},o(e){i=i.filter(Boolean);for(let e=0;e<i.length;e+=1)ye(i[e]);n=!1},d(e){x(i,e),e&&D(t)}}}function Ah(e){let t,n,r;function i(t){e[88](t)}let o={$$slots:{default:[Ph,({closeCallback:e})=>({142:e}),({closeCallback:e})=>[0,0,0,0,e?262144:0]]},$$scope:{ctx:e}};return void 0!==e[22]&&(o.open=e[22]),t=new e[32]({props:o}),ee.push(()=>Ee(t,"open",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};529006592&r[0]|262144&r[4]|16&r[5]&&(i.$$scope={dirty:r,ctx:e}),!n&&4194304&r[0]&&(n=!0,i.open=e[22],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function $h(e){let t,n;return{c(){t=O("td"),n=M(e[24])},m(e,r){R(e,t,r),N(t,n)},p(e,t){16777216&t[0]&&H(n,e[24])},d(e){e&&D(t)}}}function bh(e){let t,n,r,i;return{c(){t=O("td"),n=O("input"),U(n,"id","reader_focusId"),n.autofocus=!0,n.value=e[23]},m(o,s){R(o,t,s),N(t,n),n.focus(),r||(i=[L(n,"focus",e[72]),L(n,"input",function(){A(e[78](e[19].keyboard.length))&&e[78](e[19].keyboard.length).apply(this,arguments)})],r=!0)},p(t,r){e=t,8388608&r[0]&&n.value!==e[23]&&(n.value=e[23])},d(e){e&&D(t),r=!1,E(i)}}}function Sh(e){let t,n,r,i,o,s=e[73](e[19].refItem,!0)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" nicht gefunden!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){524288&t[0]&&s!==(s=e[73](e[19].refItem,!0)+"")&&H(i,s)},d(e){e&&D(t)}}}function Th(e){let t,n,r,i,o,s=e[73](e[19].refItem)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" bereits eingefügt!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){524288&t[0]&&s!==(s=e[73](e[19].refItem)+"")&&H(i,s)},d(e){e&&D(t)}}}function Nh(e){let t;let n=function(e){return"number"===e[143].type?Dh:Rh}(e),r=n(e);return{c(){r.c(),t=B()},m(e,n){r.m(e,n),R(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&D(t)}}}function Rh(e){let t;return{c(){t=O("input"),U(t,"id","reader_"+e[143].name),U(t,"type","text")},m(e,n){R(e,t,n)},p:I,d(e){e&&D(t)}}}function Dh(e){let t,n,r;return{c(){t=O("input"),z(t,"width","4em"),U(t,"id","reader_"+e[143].name),U(t,"type","number"),U(t,"min","0")},m(i,o){R(i,t,o),n||(r=L(t,"input",function(){A(e[78](e[19].keyboard.length,e[143]))&&e[78](e[19].keyboard.length,e[143]).apply(this,arguments)}),n=!0)},p(t,n){e=t},d(e){e&&D(t),n=!1,r()}}}function xh(e){let t,n,r,i,o,s,a=e[73](e[143].name)+"",l=e[25]&&Nh(e);return{c(){t=O("tr"),n=O("th"),r=M(a),i=P(),o=O("td"),l&&l.c(),s=P()},m(e,a){R(e,t,a),N(t,n),N(n,r),N(t,i),N(t,o),l&&l.m(o,null),N(t,s)},p(e,t){e[25]?l?l.p(e,t):(l=Nh(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&D(t),l&&l.d()}}}function Oh(e){let t;return{c(){t=M("Verwerfen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function kh(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Mh(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v,I,_,C,E,A=e[73](e[19].refItem)+"";function $(t){e[87](t)}let b={keyboard:e[19].keyboard,codeTypes:e[19].codeTypes};function S(e,t){return e[19].keyboard?bh:$h}void 0!==e[27]&&(b.readerInit=e[27]),t=new Gu({props:b}),ee.push(()=>Ee(t,"readerInit",$)),t.$on("scan",e[71]),t.$on("exit",e[76]);let T=S(e),k=T(e);function B(e,t){return e[28]?Th:e[24]&&!e[26]?Sh:void 0}let L=B(e),F=L&&L(e),V=e[47],U=[];for(let t=0;t<V.length;t+=1)U[t]=xh(Yu(e,V,t));return I=new e[35]({props:{disabled:!e[24],outline:!0,style:"float: left;",$$slots:{default:[Oh]},$$scope:{ctx:e}}}),I.$on("click",e[74]),C=new e[35]({props:{disabled:!e[26],filled:!0,style:"float: right;",$$slots:{default:[kh]},$$scope:{ctx:e}}}),C.$on("click",e[75]),{c(){Ae(t.$$.fragment),r=P(),i=O("div"),o=O("table"),s=O("tr"),a=O("th"),a.textContent="Code",l=P(),k.c(),c=P(),d=O("tr"),u=O("th"),h=M(A),f=P(),m=O("td"),p=O("div"),g=M(e[25]),w=P(),F&&F.c(),y=P();for(let e=0;e<U.length;e+=1)U[e].c();v=P(),Ae(I.$$.fragment),_=P(),Ae(C.$$.fragment),z(p,"max-width","14em"),z(o,"margin-top","1em"),z(o,"margin-bottom","1em"),z(o,"text-align","left"),z(i,"position","relative"),z(i,"z-index","1000"),z(i,"background-color","white"),z(i,"height","225px")},m(e,n){$e(t,e,n),R(e,r,n),R(e,i,n),N(i,o),N(o,s),N(s,a),N(s,l),k.m(s,null),N(o,c),N(o,d),N(d,u),N(u,h),N(d,f),N(d,m),N(m,p),N(p,g),N(o,w),F&&F.m(o,null),N(o,y);for(let e=0;e<U.length;e+=1)U[e].m(o,null);N(i,v),$e(I,i,null),N(i,_),$e(C,i,null),E=!0},p(e,r){const i={};if(524288&r[0]&&(i.keyboard=e[19].keyboard),524288&r[0]&&(i.codeTypes=e[19].codeTypes),!n&&134217728&r[0]&&(n=!0,i.readerInit=e[27],le(()=>n=!1)),t.$set(i),T===(T=S(e))&&k?k.p(e,r):(k.d(1),k=T(e),k&&(k.c(),k.m(s,null))),(!E||524288&r[0])&&A!==(A=e[73](e[19].refItem)+"")&&H(h,A),(!E||33554432&r[0])&&H(g,e[25]),L===(L=B(e))&&F?F.p(e,r):(F&&F.d(1),F=L&&L(e),F&&(F.c(),F.m(o,y))),34078720&r[0]|65536&r[1]|67584&r[2]){let t;for(V=e[47],t=0;t<V.length;t+=1){const n=Yu(e,V,t);U[t]?U[t].p(n,r):(U[t]=xh(n),U[t].c(),U[t].m(o,null))}for(;t<U.length;t+=1)U[t].d(1);U.length=V.length}const a={};16777216&r[0]&&(a.disabled=!e[24]),16&r[5]&&(a.$$scope={dirty:r,ctx:e}),I.$set(a);const l={};67108864&r[0]&&(l.disabled=!e[26]),16&r[5]&&(l.$$scope={dirty:r,ctx:e}),C.$set(l)},i(e){E||(we(t.$$.fragment,e),we(I.$$.fragment,e),we(C.$$.fragment,e),E=!0)},o(e){ye(t.$$.fragment,e),ye(I.$$.fragment,e),ye(C.$$.fragment,e),E=!1},d(e){be(t,e),e&&D(r),e&&D(i),k.d(),F&&F.d(),x(U,e),be(I),be(C)}}}function Ph(e){let t,n;return t=new e[33]({props:{title:"Scannen",class:"reader",closeCallback:e[142],$$slots:{default:[Mh]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};262144&n[4]&&(r.closeCallback=e[142]),529006592&n[0]|16&n[5]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Bh(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Lh(e){let t,n,r={ctx:e,current:null,token:null,hasCatch:!1,pending:Bh,then:eh,catch:Ju,value:141,blocks:[,,,]};return ve(e[51](),r),{c(){t=B(),r.block.c()},m(e,i){R(e,t,i),r.block.m(e,r.anchor=i),r.mount=()=>t.parentNode,r.anchor=t,n=!0},p(t,n){Ie(r,e=t,n)},i(e){n||(we(r.block),n=!0)},o(e){for(let e=0;e<3;e+=1){ye(r.blocks[e])}n=!1},d(e){e&&D(t),r.block.d(e),r.token=null,r=null}}}let Fh=new Map;const Vh=!0,Uh="pos/target";function Hh(e,n,r){let i,o,s;const{Modal:a,Dialog:l,FormField:d,TextField:h,Button:f,Accordion:w,AccordionSection:y,Divider:v}=c,I=K(),{loggedIn:_}=u;b(e,_,e=>r(96,s=e));let{list:C}=n,{mainSchema:E}=n,{schema:A}=n,{record:$}=n,{multiValues:S}=n,{classId:T}=n,{eventId:N}=n,{disabled:R}=n,{fixed:D}=n,{template:x={}}=n,{reqQuantity:O}=n,{open:k=!1}=n,{currency:M}=n,{notifyList:P}=n,{shortEdit:B}=n,{dateInput:L}=n;const F=A.find(e=>"price"===e.name&&!e.properties?.hidden),V=A.find(e=>"amount"===e.name&&!e.properties?.hidden)||A.find(e=>e.isAmount&&!e.properties?.hidden),U=A.find(e=>"quantity"===e.name&&!e.properties?.hidden),H=V||F&&U,W=H&&U;let z=0;const j=A.find(e=>"quantity"===e.name&&"h"===e.properties?.unit?.constant&&!e.properties?.hidden);let q=0;const G=A.find(e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden)?.name||"",X=!!G;let Z=0,J=!1;const ee={},te=C.reader;let ne,re,ie,oe=A.properties?.readonly,ae=T.split("form-")[1].slice(0,-4),le=new Map,ce="",de=!0,ue="",he="",fe="",me=!1,pe=!1,ge=!1;const we=A.filter(e=>e.properties?.reader);let ye=new Map;C.group&&(D=!0);const ve={},Ie=new Map,_e=C.item.filter(e=>"number"===e.type&&!!e.properties?.transfer);R||=oe;let Ce,Ee,Ae=[],$e=[],be=!1,Se={},Te=[];const Ne=async e=>{if("saleDelivery"!==C.name||!Ce?.length||e[C.name]?.length){if(r(3,O=e.quantity),B)r(15,Ce=e[C.name]||[]);else if(!e._id&&C.filter){const e=Ce;r(15,Ce=[]);const t=await Ze();r(15,Ce=!1!==t?t.concat({}):e)}else r(15,Ce=((e,t)=>{let n=e[t];if(n?.length||(n=[]),n=n.concat({}),e._id)return n;for(const t of A)t.preset&&!n[0][t.name]&&(n[0][t.name]=e[t.preset]);return n})(e,C.name)||[{}]);Ke(e)}};A.filter(e=>e.selection).map(e=>Ae.push({className:ae,parentClass:A,refClass:e.selection,value:""}));["readonly","hidden","required"].map(e=>{A.filter(t=>"object"==typeof(t.properties&&t.properties[e])).map(t=>{const n=t.properties[e].refItem||"",r=t.properties[e].refValue;let[i,o]=n.split(".");o||(o=i,i=void 0),Te.push({action:e,itemName:t.name,refObj:i,refName:o,refValue:r,op:t.properties[e].invert?"!":""})})});const Re=(e,t=!1)=>{if(!e)return"";try{if(e.split&&3===e.split("-").length)return new Date(e)?.toISOString();if(e.split&&3===e.split(".").length){const[t,n,r]=e.split("."),i=new Date(r,n-1,t);if(!isNaN(i))return i.toISOString()}}catch{}return t?e:""},De=e=>e.slice(0,3).join(", "),xe=(e,t,n)=>async({detail:o})=>{const{oldValue:s,value:a,add:l}=o;if(s&&!a){const e=A.find(e=>e.refItem===t.refClass&&e._formulaActor);e&&Ve(n,e._formulaActor,!0)}if(a&&t.refClass){const e="p$"+t.refClass+"$"+N;let n=await fm(e);0===n?.length&&(await(c=500,new Promise(e=>{setTimeout(e,c)})),n=await fm(e)),n&&n.find(({_id:e})=>e==a)||await ym(t.refClass,a)}var c;let{desc:d}=o;if(""===s&&""===a&&(d=""),e.refItem){const i=await Me(e,n,t,e.refItem);i&&r(15,Ce=i)}Ve(n,t._formulaActor);const u=Ae?.find(e=>e.refClass.split(":")[1]?.split(".")[0]===t.refClass);u&&(u.value=(u.value||new Map).set(n,a)),a&&Ce.length===n+1&&!B&&r(15,Ce=Ce.concat({})),d&&r(82,ee[a]=d,ee),B||await He(e,n,t,a,s),await Be(n,t.name),r(16,i=Ce),"number"===t.type&&r(31,Se={item:t,value:a,idx:n}),await Oe(n),Le(n)},Oe=async e=>{if(Ce[e]&&!C.filter&&Ce.length!==e+1)for(const t of A.filter(e=>!!e.refProp)){let n,i=$[t.refItem]||Ce[e][t.refItem];if(!i)continue;if(Array.isArray(i)){if(Ce[e][t.name])continue;i=i[e][t.refItem]}const o="p$"+t.refItem+"$"+N;let s=await fm(o);if(s&&(n=s.find(({_id:e})=>e==i)),n||(n=await ym(t.refItem,i)),!n)continue;const a=ke(n,t.refProp)?.replace(",",".")||n[t.refProp]&&n[t.refProp][t.name]?.replace(",",".")||n[t.refProp];Ce[e][t.name]||r(15,Ce[e][t.name]=a,Ce)}},ke=(e,t)=>{try{return e.split(".").reduce((e,t)=>e[t],t)}catch(e){return""}},Me=async(e,t,n,r)=>{if(e.filter)return;const i=$[r];if(!i?.length)return;const o=i[0][r];if(!o)return;const s=await ym(r,o);return s?s[e.name]:void 0},Pe=(e,t,n,i)=>{if(!e.filter){if(i&&!1===n.refItem){const e="boolean"!==n.type&&"";Ce[t][n.name]&&r(15,Ce[t][n.name]=e,Ce)}Ce.length!==t+1&&"number"==typeof n.properties?.value&&r(15,Ce[t][n.name]=n.properties.value,Ce)}},Be=async(e,t)=>{const n=Te.filter(e=>(e.refObj||ae)===t||e.refName===t);if(n?.length)for(const t of n){const{itemName:n,refObj:i,refName:o,refValue:s,op:a}=t;let l,c,{action:d}=t,u=!1,h=!1;if(i){const t=Ce[e][i];i===ae&&o?u=$:t&&(u=await ym(i,t))}!i&&o&&(u=Ce[e]),u&&(h=u[o],Array.isArray(h)&&0===h.length?h=!1:s&&(h=h==(u[s]||$[s]))),"!"===a&&(h=!h),"required"!==d&&"readonly"!==d||(d="required"===d?d:"disabled",setTimeout(()=>{l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field textarea`,c=document.querySelector(l),c||(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field input#${"dp-"+n+"-"+e}`,c=document.querySelector(l)),c||(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n} .field input`,c=document.querySelector(l)),c&&h&&c.setAttribute(d,""),c&&!h&&c.removeAttribute(d)},0)),"hidden"===d&&(l=`#accordion-content-${T}-${C.name}-${e} .form-field.${n}`,c=document.querySelector(l),c?.classList?.toggle("hidden",h),h&&r(15,Ce[e][n]="",Ce))}},Le=(e,t)=>{let n=`#accordion-content-${T}-${C.name}-${e} .form-field:not(.hidden) .field :required:not(:disabled)`;const i=document.querySelectorAll(n);let o=!1;i.forEach(e=>{!e.id.startsWith("dp-")&&e.required&&""===e.value&&(o=!0)}),void 0===t&&(n=`#accordion-content-${T}-${C.name}-${e} :not(.form-field.hidden) .field input.invalid`,document.querySelector(n)&&(t=!0)),r(29,$e[e]=o||t?"invalid":"",$e)},Fe=e=>{if(!e)return 0;const[t,n=0]=e.split(":");return 60*t+parseInt(n)},Ve=(e,t,n=!1)=>{if(!t)return;const i=A.find(e=>e.name===t);if(!i)return;const o=i.properties.value.formula,{operator:s,argument:a}=o,l=a.map(t=>Ce[e][t.refItem]||$[t.refItem]);let c=0;if("$preferred"===s)if(n)c="";else{if($._id&&void 0!==Ce[e][t])return;c=l.reduce((e,t)=>{let n=e;return"number"===i.type?n=+n||+t:n||=t,n})}if("$add"===s&&(c=l.reduce((e,t)=>+(e||0)+ +(t||0))),"$subtract"===s&&(c=l.reduce((e,t)=>{e||(e=""),t||(t=""),"number"==typeof e&&(e=e.toString());const[n,r]=e.split(":");e=r?(+n+ +r/60).toFixed(2):+(n||0);let[i,o]=t.split(":");return i||(i=0),e-=o?(+i+ +o/60).toFixed(2):+(i||0)})),"$multiply"===s&&(c=l.reduce((e,t)=>+(e||0)*+(t||0))),"$percentMultiply"===s){const[e,t]=l;c=+e,+t>0&&(c*=1-t/100)}if("$percentDivide"===s){const[e,t]=l;0!=+t&&(c=+e/+t*100)}if("$percentSubtract"===s){let[e,t]=l;t.replace&&(t=t.replace(",",".")),0!=+t&&(c=+e-e*+t/100)}const d=`#accordion-content-${T}-${C.name}-${e} .form-field.${t} .field input`,u=document.querySelector(d),h=u?.disabled;r(15,Ce[e][t]="$multiply"===s?c?Ue(c,i.properties?.decimals):"":Ue(c,i.properties?.decimals),Ce),r(31,Se={item:i,value:c,idx:e}),setTimeout(()=>{const t=document.querySelector(d);h&&t&&t.setAttribute("disabled",""),i._formulaActor&&Ve(e,i._formulaActor)},0)},Ue=(e,t)=>("number"==typeof e&&e||(e=Number(e||0)),e.toFixed(t||0));Ee=A.filter(e=>e.refClass).reduce((e,t)=>{const n=A.filter(e=>e.refItem===t.refClass);if(!n?.length)return e;if(t.selection){const[n,r]=t.selection.split(":"),[i]=r?.split(".")||[];i&&e.push({refClass:i,items:[n],selection:t.selection})}const r={refClass:t.refClass,items:[]};return n.forEach(e=>{r.items.push(e.name)}),e.push(r),e},[]);const He=async(e,t,n,i,o)=>{if(e.filter)return;const s=(await Ee).find(e=>e.refClass===n.refClass);if(!s)return;const{refClass:a,items:l,selection:c}=s,d=n.name;if(Te.find(e=>e.itemName===d)){const n=`#accordion-content-${T}-${e.name}-${t} .form-field.${a}.hidden`;if(document.querySelector(n))return}return i?Promise.all(l.map(async e=>{let s=A.find(t=>t.name===e);if(!s)return;let d=s.refName||s.name,u="",h="";if(s.lookup){if(h=Ce[t][s.name],r(15,Ce[t][s.name]="",Ce),!Ce[t][s.refItem])return void r(15,Ce[t][s.name]="",Ce);let[e,n,i]=s.lookup.split(".");i||(i=n,n="");const o=s.lookupRefItem||s.refItem,a=s.lookupRefName||d,l="p$"+s.refItem+"$"+N;let c,f=await fm(l);if(c=f?.find(({_id:e})=>e==Ce[t][s.refItem]),c||(c=await ym(s.refItem,Ce[t][s.refItem])),c){if(s.refItem2){const e=await ym(s.refItem2,c[s.refItem2]);if("dealerPrice"===d&&$.branch){const e=await ym("branch",$.branch);e?.sector?.includes("Privat")&&(d="price")}e&&(u=e[d])}0===+u&&(u=c[d])}if($[e]){const r=await ym(e,$[e]);if(r&&r[n]){const e=await ym(n,r[n]);if(e){const n=e[i].find(e=>e[o]===Ce[t][o]);n&&(u=n[a])}}else if(r&&r[i]){const e=r[i].find(e=>e[o]===Ce[t][o]);e&&(u=e[a])}}return Ce[t][s.name]||r(15,Ce[t][s.name]=u||h,Ce),void await Ve(t,s._formulaActor)}if(s.properties?.readonly&&!n.refInput){const i=Ce[t][n.refClass];return Promise.resolve(ym(n.refClass,i,!0)).then(n=>{let i=s.refPos?n[s.refPos]||ke(s.refPos,n):n[e];void 0!==s.factor&&(i*=s.factor),Array.isArray(i)&&(i=i.length?i[0][e]:""),r(15,Ce[t][e]=i,Ce),s._formulaActor&&Ve(t,s._formulaActor)})}const{refInput:f}=n;if(f&&Ce[t]){const[e,n]=f.split(".");u=n?Ce[t][n]:$[e]}if(c&&i!==o)l.map(e=>{r(15,Ce[t][e]="",Ce)});else{if(s.refItem2){const[n,i]=s.refItem2.split(".");$[n]&&ym(n,$[n]).then(n=>{n&&+n[i]&&r(15,Ce[t][e]=n[i],Ce)})}if(f&&!u||We(t,e)||o!==i){const i=A.find(e=>e.refClass===a),o=Ce[t][i.name];if(n.selection){const i=wm(n.selection+o.toString());if(i)return Promise.resolve(i).then(n=>r(15,Ce[t][e]=n[e],Ce))}const s="p$"+i.refClass+"$"+N;let l=await fm(s);if(l){const n=l.find(({_id:e})=>e==o);if(n)return Promise.resolve(()=>{r(15,Ce[t][e]=n[e],Ce)})}return Promise.resolve(ym(i.refClass,o)).then(n=>r(15,Ce[t][e]=n[e],Ce))}}})):Promise.resolve(l.map(e=>{r(15,Ce[t][e]="",Ce)}))},We=(e,t)=>{let n=Ce[e][t];return"number"===A.find(e=>e.name===t).type&&(n=Number(n||0)),!n},ze=e=>{if(!e)return;const{style:t,scrollHeight:n}=e;n&&(t.height=`${n}px`)};let je=!1;const qe=e=>!(!D&&e>=Ce.length-1),Ge=(e,t=!1)=>{const[n,r]=e.split(";");return C.name===r&&(!!qe(t)&&((!1===t||t!=n)&&parseInt(n)))};A.filter(e=>e.properties?.value?.formula?.argument).forEach(e=>{e.properties.value.formula.argument.forEach(t=>{const n=A.find(e=>e.name===t.refItem)||A.find(e=>e.name===t.refItem);n&&(n._formulaActor=e.name)})});const Xe=(e,t=!1)=>{const n=`#accordion-content-${T}-${C.name}-${e} > div.form-field:not(.hidden)`,i=document.querySelectorAll(n);if(!i?.length)return;const o=i[i.length-1];se().then(()=>{const t=`#accordion-content-${T}-${C.name}-${e} textarea`;Array.from(document.querySelectorAll(t)).forEach(ze)}).then(()=>{t&&o.scrollIntoView({behavior:"smooth",block:"end"})});for(const t of A){"number"==typeof t.properties?.value&&r(15,Ce[e][t.name]=t.properties.value,Ce);const n=C.preserve&&C.preserve.includes(t.preset);if(t.preset&&!n&&!Ce[e][t.name]){const n=Ie.get(t.preset);n&&r(15,Ce[e][t.name]=n,Ce)}!$._id&&t.refItem&&$[t.refItem]&&ym(t.refItem,$[t.refItem]).then(n=>r(15,Ce[e][t.name]=n[t.name],Ce))}if(!(e<1)&&Ce?.length&&e===Ce.length-1&&C.preserve&&!$._id)for(const t of C.preserve){if(!Ce[e-1][t])continue;const n=Re(Ce[e-1][t],!0);r(15,Ce[e][t]=n,Ce),Ie.set(t,n)}},Ye=new Map,Ze=async()=>{if(!C.filter)return[];let e,n,r,{date:i,level:o,isDealer:s}=$;if(i)[e,n,r]=i.split(".");else{i=(new Date).toISOString();const t=i.split("T")[0];[r,n,e]=t.split("-")}const a=`${r}-${n}-${e}`,l=Ye.get("dv"),c=Ye.get("lv"),d=Ye.get("iv");if(l===a&&c===o&&d===!!s)return!1;let u;Ye.set("dv",a),Ye.set("lv",o),Ye.set("iv",!!s),u=s?{$ne:""}:{$eq:""};const h={dealer:u,"_task.status":"Ready",payable:{$lt:a},_total:{$gt:0}};o&&(h.levelReminder=o),o||(h.levelReminder={$in:[void 0,!1,""]});const f=[{$addFields:{_docId:{$toString:"$_id"}}},{$lookup:{from:"_task",localField:"_docId",foreignField:"docId",as:"_task"}},{$unwind:{path:"$_task",preserveNullAndEmptyArrays:!0}},{$match:h},{$sort:{payable:1,invoiceId:1}}];return await t.getSectionView("invoice",f)},Ke=async e=>{if(!C.filter){if(e[C.name]?.length)for(const n of A)if((n.properties?.prefetch||1e3)<e[C.name].length){const r="p$"+n.refClass+"$"+N;if(fm(r))continue;hm(r,[]);const i=Qe(e[C.name],n.name);i?.length&&hm(r,t.getSectionView(n.refClass,{_id:{$in:i}}))}r(20,ne={record:e})}},Qe=(e,t)=>Array.from(new Set(e.map(e=>e[t]).filter(e=>!!e))),Je=()=>{r(28,pe=!1),r(25,he=""),r(23,ce=""),de=!0,r(24,ue=""),r(26,fe=""),r(22,ie=!0)},et=async({detail:e})=>{const{refItem:n,refValue:i,refDescription:o,keyboard:s,input:a}=te;let l,c="reader_";for(;e.text.length>s.length;)e.text=e.text.slice(1);if(ue===e.text&&e.item){const t=c+e.item.name;return l=document.getElementById(t),l.value=+(ye.get(e.item.name)||0)+1,ye.set(e.item.name,l.value),l.focus(),de=!0,void r(23,ce="")}if(r(28,pe=!1),r(25,he=""),r(24,ue=e.text||""),!ue)return;const d=A.find(e=>e.name===n)?.refClass;if(!d)return;let u=await t.getSectionView(d,{[i]:ue});u?.length?(u=u[0],r(26,fe=u._id),r(25,he=o.map(e=>u[e]).join(", ")),r(28,pe=Ce.find(e=>e[n]===fe)),setTimeout(()=>{A.filter(e=>e.properties?.reader).forEach(e=>{const t=document.getElementById("reader_"+e.name);t&&(t.value=ye.get(e.name)||(pe?pe[e.name]:"")),ye.set(e.name,t.value)});let t=1;if(a){const{refItem:e,refValue:n}=a;for(const r of n){const{value:n,factor:i}=r,o=u[e];n.includes(","+o.split("-")[0]+"-,")&&(t=i)}}if(e.item){const n=c+e.item.name;l=document.getElementById(n),l.value=+(ye.get(e.item.name)||0)+t,ye.set(e.item.name,l.value),l.focus()}else{const e=A.find(e=>e.properties?.reader).name,n=c+e;l=document.getElementById(n),l.value=+(ye.get(e)||0)+t,ye.set(e,l.value),l.focus()}de=!0,r(23,ce="")},0)):setTimeout(()=>{de=!0,r(23,ce=""),r(24,ue=""),ye=new Map;const e=document.getElementById("reader_focusId");e&&e.focus()},0)},tt=()=>{r(25,he=""),r(26,fe=""),r(28,pe=!1),r(27,me=!0),nt(),ye=new Map},nt=()=>{if(!te.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};Y(async()=>{if(!C.filter&&(re||r(21,re=await t.getEvent(N)),($._id||!re.input)&&!(Ce.length>1)&&!R&&te?.autostart)){if("object"==typeof te.autostart){if(!te.autostart.user)return;{const e=s.user,[t,n]=te.autostart.user.split(":"),r=E.find(e=>e.name===t),i=r?.refClass;if(!i||!n)return;const o=await ym(i,$[t]);if(!o)return;if(o[n]!==e)return}}else if(!0!==te.autostart)return;ge=!1,Je()}});return e.$$set=e=>{"list"in e&&r(4,C=e.list),"mainSchema"in e&&r(79,E=e.mainSchema),"schema"in e&&r(80,A=e.schema),"record"in e&&r(0,$=e.record),"multiValues"in e&&r(5,S=e.multiValues),"classId"in e&&r(6,T=e.classId),"eventId"in e&&r(7,N=e.eventId),"disabled"in e&&r(1,R=e.disabled),"fixed"in e&&r(2,D=e.fixed),"template"in e&&r(81,x=e.template),"reqQuantity"in e&&r(3,O=e.reqQuantity),"open"in e&&r(12,k=e.open),"currency"in e&&r(8,M=e.currency),"notifyList"in e&&r(9,P=e.notifyList),"shortEdit"in e&&r(10,B=e.shortEdit),"dateInput"in e&&r(11,L=e.dateInput)},e.$$.update=()=>{if(528&e.$$.dirty[0]&&P&&!C.filter){const{itemName:e,value:t}=P;Ie.set(e,t),e&&e===C.name&&r(0,$[e]=t,$)}1&e.$$.dirty[0]&&Ne($),32768&e.$$.dirty[0]&&r(16,i=Ce),122896&e.$$.dirty[0]&&i&&((()=>{if(j)r(17,q=Ce?.reduce((e,t)=>e+(t._delete?0:+(t.quantity||0)),0)||0)})(),(()=>{if(X)r(14,Z=Ce?.reduce((e,t)=>e+(t._delete?0:+(t[G]||0)),0)||0)})(),(()=>{if(H)r(13,z=Ce?.reduce((e,t)=>{if(t.amount){const n=t.amount??0;e+=t._delete?0:+n}else if(t.price){const n=(W?t.quantity??0:1)*(t.price??0);e+=t._delete?0:n}else if(t.value){const n=t.value??0;e+=t._delete?0:+n}return e},0)||0)})(),se().then(()=>I("save",{listName:C.name,value:Ce,amountValue:z,weeksValue:Z}))),1048576&e.$$.dirty[2]&&(o=e=>ee[e]?.split(" • ").filter(e=>!!e&&!/^[0-9a-f]{24}/.test(e)).slice(0,2).join(" · "))},[$,R,D,O,C,S,T,N,M,P,B,L,k,z,Z,Ce,i,q,J,te,ne,re,ie,ce,ue,he,fe,me,pe,$e,be,Se,a,l,d,f,w,y,v,_,undefined,H,{name:"amountValue",properties:{decimals:2}},j,{name:"hoursValue",properties:{decimals:2}},X,{name:"weeksValue",properties:{decimals:1}},we,Ie,_e,Ae,async()=>{if(!R&&(re||r(21,re=await t.getEvent(N)),($._id||!re.input)&&te&&!te.keyboard))try{const e=await ju();e?.length||r(19,te=!1)}catch{}},(e,t)=>{let n=e[t];return ve["pos"+t]&&(n=ve["pos"+t]),n&&A.filter(e=>!0!==e.properties?.hidden&&("dateRange"===e.type||void 0!==n[e.name])&&"textarea"!==e.properties?.format).map(e=>""===n[e.name]?"":"object"===e.type?o(n[e.name]):Array.isArray(n[e.name])?De(n[e.name]):"boolean"===e.type?g(n[e.name]):"number"===e.type?Ue(n[e.name],e.properties?.decimals||0):"dateRange"===e.type?((e,t)=>{let n,r;try{n=t[e+"_from"],n=new Date(n||"").toLocaleDateString(),"Invalid Date"===n&&(n=" ")}catch{n=" "}try{r=t[e+"_to"],r=new Date(r||"").toLocaleDateString(),"Invalid Date"===r&&(r="")}catch{r=""}return[n,r].filter(e=>""!==e).join(" - ").trim()})(e.name,n):"date"===e.type?m(Re(n[e.name])):"datetime"===e.type?p(n[e.name]):e.properties?.multi?"":n[e.name]).filter(e=>!!e).join(" • ")||"+"},e=>({detail:{row:t}})=>{if(I("task",{row:t}),!$._id&&t._id){for(let t=0;t<Ce.length;t++)for(const n of e.item)Pe(e,t,n,!J);r(18,J=!0)}},xe,({detail:e})=>{const{idx:t,value:n}=e;Le(t,n)},async({detail:{className:e,itemName:n,value:r}})=>{if(le.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===ae+"."+C.name)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&le.set(e,o[0])},({detail:e})=>{const{idx:t,fieldId:n,value:r}=e;if(!r)return;const i=Fe(r);let o=!1;Ce.forEach((e,n)=>{if(t===n)return;const{start:r,end:s}=Ce[n];r&&s&&i>Fe(r)&&i<Fe(s)&&(o=!0)});const s=document.getElementById(n);s?.classList?.toggle("invalid",o)},e=>({detail:t})=>{t.string?r(15,Ce[e][t.itemName]=t.value,Ce):r(15,Ce[e][t.itemName]=Ue(t.value,t.decimals),Ce)},(e,t,n)=>n=>{Ce[t]._delete||(e(n),Xe(t,!0))},(e,t,n)=>i=>{if(r(15,Ce[e]._delete=!Ce[e]._delete,Ce),Ce[e]._delete){ve["pos"+e]={...Ce[e]};for(const t of A)r(15,Ce[e][t.name]="",Ce);t&&n(i)}else{if(ve["pos"+e]){const t={};for(const n of A)t[n.name]=ve["pos"+e][n.name];r(15,Ce[e]=t,Ce)}ve["pos"+e]=void 0,t||n(i)}},e=>t=>{t.preventDefault(),r(30,be=!1);const n=Ge(t.dataTransfer.getData(Uh),e);if(!1===n)return;t.dataTransfer.dropEffect="move";const i=[...Ce].map((e,t)=>(e._index=t,e));n<e?(i.splice(e+1,0,i[n]),i.splice(n,1)):(i.splice(e,0,i[n]),i.splice(n+1,1)),i.map((e,t)=>{return n=e._index,r=t,void Fh.set(r,n);var n,r});let o=[];$e.map((e,t)=>{o[t]=$e[(e=>{const t=Fh.get(e);return void 0===t?e:t})(t)]}),r(29,$e=o),r(15,Ce=i.map((e,t)=>(delete e._index,e))),je=!1},e=>t=>{if(!qe(e))return!1;t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="move",t.dataTransfer.setData(Uh,e+";"+C.name),je=e},e=>t=>{const n=Ge(t.dataTransfer.getData(Uh),e)||je;return!1===n||n===e?r(30,be=!1):void r(30,be={top:n>e&&e,bottom:n<e&&e})},e=>e.preventDefault(),e=>e=>{r(30,be=!1)},(e,t)=>n=>{setTimeout(()=>{Array.from(le).forEach(([t,n])=>{Ce[e][t]||r(15,Ce[e][t]=n._id,Ce)})},500);const i=new Set;for(const e of Te)i.add(e.refObj||ae);for(const t of Array.from(i))Be(e,t);t(n),Xe(e)},e=>({detail:t})=>{Ve(e,t.item.name)},e=>async({detail:t})=>{const{itemName:n,itemType:i,source:o,target:s,sourceId:a,prop:l}=t;if(!a)return void r(15,Ce[e][n]="",Ce);let c=await ym(o,a);const d=c[l];c=await ym(C.name,$[C.name][e][C.name]);const u=c[s];let h="number"===i?0:"",f=0;u.forEach(e=>{const t=e[l];t.length<=f||t.every(e=>d.find(t=>t===e))&&(h=e[n],f=t.length)}),r(15,Ce[e][n]=h,Ce)},e=>e?.description||"Daten übernehmen",Je,et,()=>{de=!0,r(23,ce="")},(e,t=!1)=>t?(tt(),""):A.find(t=>t.name===e)?.designation||"",tt,()=>{const{refItem:e}=te,t={[e]:fe};let n;A.filter(e=>e.properties?.reader).forEach(e=>{const n=document.getElementById("reader_"+e.name);n&&(t[e.name]=n.value||("number"===e.type?0:""))});let i=Ce;const o=i.findIndex(t=>t[e]===fe);o>=0?(n=i[o],i[o]={...n,...t}):i=i.slice(0,-1).concat(t),r(15,Ce=i),A.filter(e=>e.properties?.reader).forEach(e=>{xe(e,o>=0?o:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})}),ge=!0,tt()},()=>{ge&&(I("readerSave"),ge=!1)},()=>{const e=new Map;_e.forEach(t=>{[].concat(t.properties.transfer.target).forEach(n=>{e.set(n,t.name)})});let t=0;for(const n of Ce){for(const[i,o]of e)!n[i]&&n[o]&&r(15,Ce[t][i]=n[o],Ce);t++}r(16,i=Ce)},(e,t)=>n=>{const{data:i}=n;"0123456789".includes(i)&&(de?(r(23,ce=i.toString()),de=!1):(r(23,ce+=i.toString()),"77"===ce&&r(23,ce="7"),ce.length===e&&et({detail:{text:ce,item:t}})))},E,A,x,ee,function(e){Z=e,r(14,Z)},function(e){q=e,r(17,q)},function(e){z=e,r(13,z)},function(t){Q(e,t)},function(e){me=e,r(27,me)},function(e){ie=e,r(22,ie)}]}class Wh extends Te{constructor(e){var t;super(),Xu.getElementById("svelte-9vv5ub-style")||((t=O("style")).id="svelte-9vv5ub-style",t.textContent=".accordion.svelte-9vv5ub{display:flex;overflow:hidden}.accordion-content.svelte-9vv5ub{position:relative}.formList .accordion > .btn{display:inline-block;margin-bottom:1em;background-color:#F5F5F5}.sTask .formList .accordion > .btn{width:95% !important}.sEmbedded .formList .accordion > .btn{width:97%}@media screen and (max-width: 600px){.formList .accordion > .btn{width:25em}}span.pointer.svelte-9vv5ub{padding-top:1em}div.delete.svelte-9vv5ub{text-decoration:line-through}.icon.svelte-9vv5ub{margin-right:-0.75em}.form-field .formField_italic{font-style:italic}.panel.invalid .btn{border:1px #b80000 solid}.draggableListItem.svelte-9vv5ub{cursor:drag}.draggableListItem.is-active-top.svelte-9vv5ub{border-top:3px purple solid;padding-top:2em}.draggableListItem.is-active-bottom.svelte-9vv5ub{border-bottom:3px purple solid;padding-bottom:2em}.modal-overlay > .dialog.reader{margin-top:0}",N(Xu.head,t)),Se(this,e,Hh,Lh,$,{list:4,mainSchema:79,schema:80,record:0,multiValues:5,classId:6,eventId:7,disabled:1,fixed:2,template:81,reqQuantity:3,open:12,currency:8,notifyList:9,shortEdit:10,dateInput:11},[-1,-1,-1,-1,-1,-1])}}const{Boolean:zh,document:jh}=_e;function qh(e,t,n){const r=e.slice();return r[203]=t[n],r[205]=n,r}function Gh(e,t,n){const r=e.slice();return r[207]=t[n],r}function Xh(e,t,n){const r=e.slice();return r[210]=t[n],r}function Yh(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Zh(e){let t,n,r=e[206]&&function(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v=e[23]&&Kh(e),I=e[40]&&Jh(e),_=e[0].items,C=[];for(let t=0;t<_.length;t+=1)C[t]=nf(Xh(e,_,t));const A=e=>ye(C[e],1,1,()=>{C[e]=null});let $=e[0].list&&rf(e),b=!e[4]&&!e[2]&&e[38]&&e[5]&&!e[43]&&mf(e);h=new e[48]({props:{outline:!0,$$slots:{default:[gf]},$$scope:{ctx:e}}}),h.$on("click",e[68]);const T=[yf,wf],k=[];function M(e,t){return e[11]?0:e[38]?1:-1}~(m=M(e))&&(p=k[m]=T[m](e));return{c(){t=O("section"),v&&v.c(),n=P(),I&&I.c(),r=P(),i=O("form"),o=O("input"),a=P();for(let e=0;e<C.length;e+=1)C[e].c();l=P(),$&&$.c(),c=P(),b&&b.c(),d=P(),u=O("div"),Ae(h.$$.fragment),f=P(),p&&p.c(),U(o,"class",S(e[55])+" svelte-lfqa43"),U(o,"name","_id"),U(o,"type","hidden"),o.value=s=e[10]._id||"",U(i,"class",S(e[56])+" svelte-lfqa43"),U(i,"id",e[55]),U(u,"class","form--buttons svelte-lfqa43"),U(t,"class",S(e[57])+" svelte-lfqa43")},m(s,p){R(s,t,p),v&&v.m(t,null),N(t,n),I&&I.m(t,null),N(t,r),N(t,i),N(i,o),N(i,a);for(let e=0;e<C.length;e+=1)C[e].m(i,null);N(i,l),$&&$.m(i,null),N(t,c),b&&b.m(t,null),N(t,d),N(t,u),$e(h,u,null),N(u,f),~m&&k[m].m(u,null),g=!0,w||(y=[L(i,"keydown",e[73]),L(i,"submit",F(e[67]))],w=!0)},p(e,a){if(e[23]?v?(v.p(e,a),8388608&a[0]&&we(v,1)):(v=Kh(e),v.c(),we(v,1),v.m(t,n)):v&&(pe(),ye(v,1,1,()=>{v=null}),ge()),e[40]?I?(I.p(e,a),512&a[1]&&we(I,1)):(I=Jh(e),I.c(),we(I,1),I.m(t,r)):I&&(pe(),ye(I,1,1,()=>{I=null}),ge()),(!g||1024&a[0]&&s!==(s=e[10]._id||""))&&(o.value=s),1074861057&a[0]|553652226&a[1]|2033544&a[2]){let t;for(_=e[0].items,t=0;t<_.length;t+=1){const n=Xh(e,_,t);C[t]?(C[t].p(n,a),we(C[t],1)):(C[t]=nf(n),C[t].c(),we(C[t],1),C[t].m(i,l))}for(pe(),t=_.length;t<C.length;t+=1)A(t);ge()}e[0].list?$?($.p(e,a),1&a[0]&&we($,1)):($=rf(e),$.c(),we($,1),$.m(i,null)):$&&(pe(),ye($,1,1,()=>{$=null}),ge()),e[4]||e[2]||!e[38]||!e[5]||e[43]?b&&(pe(),ye(b,1,1,()=>{b=null}),ge()):b?(b.p(e,a),52&a[0]|4224&a[1]&&we(b,1)):(b=mf(e),b.c(),we(b,1),b.m(t,d));const c={};134217728&a[6]&&(c.$$scope={dirty:a,ctx:e}),h.$set(c);let f=m;m=M(e),m===f?~m&&k[m].p(e,a):(p&&(pe(),ye(k[f],1,1,()=>{k[f]=null}),ge()),~m?(p=k[m],p?p.p(e,a):(p=k[m]=T[m](e),p.c()),we(p,1),p.m(u,null)):p=null)},i(e){if(!g){we(v),we(I);for(let e=0;e<_.length;e+=1)we(C[e]);we($),we(b),we(h.$$.fragment,e),we(p),g=!0}},o(e){ye(v),ye(I),C=C.filter(zh);for(let e=0;e<C.length;e+=1)ye(C[e]);ye($),ye(b),ye(h.$$.fragment,e),ye(p),g=!1},d(e){e&&D(t),v&&v.d(),I&&I.d(),x(C,e),$&&$.d(),b&&b.d(),be(h),~m&&k[m].d(),w=!1,E(y)}}}(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,t){e[206]&&r.p(e,t)},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function Kh(e){let t,n;return t=new e[48]({props:{disabled:e[43]||e[10]._id,filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[Qh]},$$scope:{ctx:e}}}),t.$on("click",e[90]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1024&n[0]|4096&n[1]&&(r.disabled=e[43]||e[10]._id),134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Qh(e){let t,n,r;return n=new We({props:{size:"18"}}),{c(){t=O("span"),t.textContent="QR Code scannen",Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Jh(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.75; margin-bottom: .5em;",$$slots:{default:[ef]},$$scope:{ctx:e}}}),t.$on("click",e[88]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ef(e){let t,n,r;return n=new at({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Dokument ergänzen",Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function tf(e){let t,n;return t=new Hd({props:{classId:e[55],item:e[210],selection:e[210].selection,record:e[10],disabled:e[43],eventId:e[65],multiValues:e[60],notifyList:e[12],toDelete:e[20],currency:e[16],changeValue:e[32],initFinished:e[30]}}),t.$on("save",e[72]),t.$on("task",e[69]),t.$on("notify",e[70]),t.$on("safeReference",e[79]),t.$on("multi",e[71]),t.$on("defPrep",e[78]),t.$on("record",e[80]),t.$on("objRecord",e[81]),t.$on("formula",e[82]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1&n[0]&&(r.item=e[210]),1&n[0]&&(r.selection=e[210].selection),1024&n[0]&&(r.record=e[10]),4096&n[1]&&(r.disabled=e[43]),4096&n[0]&&(r.notifyList=e[12]),1048576&n[0]&&(r.toDelete=e[20]),65536&n[0]&&(r.currency=e[16]),2&n[1]&&(r.changeValue=e[32]),1073741824&n[0]&&(r.initFinished=e[30]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function nf(e){let t,n,r="list"!==e[210].type&&tf(e);return{c(){r&&r.c(),t=B()},m(e,i){r&&r.m(e,i),R(e,t,i),n=!0},p(e,n){"list"!==e[210].type?r?(r.p(e,n),1&n[0]&&we(r,1)):(r=tf(e),r.c(),we(r,1),r.m(t.parentNode,t)):r&&(pe(),ye(r,1,1,()=>{r=null}),ge())},i(e){n||(we(r),n=!0)},o(e){ye(r),n=!1},d(e){r&&r.d(e),e&&D(t)}}}function rf(e){let t,n,r,i,o,s=e[7]&&e[61]&&e[17]&&0!=e[17]&&of(e),a=e[18]&&af(e),l=e[62]&&e[31]&&0!=e[31]&&cf(e),c=e[0].list,d=[];for(let t=0;t<c.length;t+=1)d[t]=ff(Gh(e,c,t));const u=e=>ye(d[e],1,1,()=>{d[e]=null});return{c(){s&&s.c(),t=P(),a&&a.c(),n=P(),l&&l.c(),r=P();for(let e=0;e<d.length;e+=1)d[e].c();i=B()},m(e,c){s&&s.m(e,c),R(e,t,c),a&&a.m(e,c),R(e,n,c),l&&l.m(e,c),R(e,r,c);for(let t=0;t<d.length;t+=1)d[t].m(e,c);R(e,i,c),o=!0},p(e,o){if(e[7]&&e[61]&&e[17]&&0!=e[17]?s?(s.p(e,o),131200&o[0]&&we(s,1)):(s=of(e),s.c(),we(s,1),s.m(t.parentNode,t)):s&&(pe(),ye(s,1,1,()=>{s=null}),ge()),e[18]?a?(a.p(e,o),262144&o[0]&&we(a,1)):(a=af(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,()=>{a=null}),ge()),e[62]&&e[31]&&0!=e[31]?l?(l.p(e,o),1&o[1]&&we(l,1)):(l=cf(e),l.c(),we(l,1),l.m(r.parentNode,r)):l&&(pe(),ye(l,1,1,()=>{l=null}),ge()),6411333&o[0]|553652236&o[1]|134480904&o[2]){let t;for(c=e[0].list,t=0;t<c.length;t+=1){const n=Gh(e,c,t);d[t]?(d[t].p(n,o),we(d[t],1)):(d[t]=ff(n),d[t].c(),we(d[t],1),d[t].m(i.parentNode,i))}for(pe(),t=c.length;t<d.length;t+=1)u(t);ge()}},i(e){if(!o){we(s),we(a),we(l);for(let e=0;e<c.length;e+=1)we(d[e]);o=!0}},o(e){ye(s),ye(a),ye(l),d=d.filter(zh);for(let e=0;e<d.length;e+=1)ye(d[e]);o=!1},d(e){s&&s.d(e),e&&D(t),a&&a.d(e),e&&D(n),l&&l.d(e),e&&D(r),x(d,e),e&&D(i)}}}function of(e){let t,n;return t=new e[49]({props:{name:"Total Dokument",nameClass:"formField_italic",$$slots:{default:[sf]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};196608&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function sf(e){let t,n,r;function i(t){e[105](t)}let o={item:e[58],disabled:!0,currency:e[16]};return void 0!==e[17]&&(o.value=e[17]),t=new $i({props:o}),ee.push(()=>Ee(t,"value",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};65536&r[0]&&(i.currency=e[16]),!n&&131072&r[0]&&(n=!0,i.value=e[17],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function af(e){let t,n;return t=new e[49]({props:{name:"Total MWSt "+(e[19]?"("+e[19]+"%)":""),nameClass:"formField_italic",$$slots:{default:[lf]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};524288&n[0]&&(r.name="Total MWSt "+(e[19]?"("+e[19]+"%)":"")),327680&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function lf(e){let t,n,r;function i(t){e[106](t)}let o={item:e[59],disabled:!0,currency:e[16]};return void 0!==e[18]&&(o.value=e[18]),t=new $i({props:o}),ee.push(()=>Ee(t,"value",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};65536&r[0]&&(i.currency=e[16]),!n&&262144&r[0]&&(n=!0,i.value=e[18],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function cf(e){let t,n;return t=new e[49]({props:{name:"Gesamtzeit in Wochen",nameClass:"formField_italic",$$slots:{default:[df]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};1&n[1]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function df(e){let t,n,r;function i(t){e[107](t)}let o={item:e[63],disabled:!0};return void 0!==e[31]&&(o.value=e[31]),t=new $i({props:o}),ee.push(()=>Ee(t,"value",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};!n&&1&r[1]&&(n=!0,i.value=e[31],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function uf(e){let t,n,r,i;return t=new e[47]({props:{text:e[207].designation}}),r=new Lr({props:{classId:e[55],open:!e[2]&&1===e[0].list.length,list:e[207],template:e[33],eventId:e[65],schema:e[207].item,record:e[10],disabled:e[43],currency:e[16],update:e[14]}}),{c(){Ae(t.$$.fragment),n=P(),Ae(r.$$.fragment)},m(e,o){$e(t,e,o),R(e,n,o),$e(r,e,o),i=!0},p(e,n){const i={};1&n[0]&&(i.text=e[207].designation),t.$set(i);const o={};5&n[0]&&(o.open=!e[2]&&1===e[0].list.length),1&n[0]&&(o.list=e[207]),4&n[1]&&(o.template=e[33]),1&n[0]&&(o.schema=e[207].item),1024&n[0]&&(o.record=e[10]),4096&n[1]&&(o.disabled=e[43]),65536&n[0]&&(o.currency=e[16]),16384&n[0]&&(o.update=e[14]),r.$set(o)},i(e){i||(we(t.$$.fragment,e),we(r.$$.fragment,e),i=!0)},o(e){ye(t.$$.fragment,e),ye(r.$$.fragment,e),i=!1},d(e){be(t,e),e&&D(n),be(r,e)}}}function hf(e){let t,n;return t=new Wh({props:{classId:e[55],open:e[22],list:e[207],template:e[34],eventId:e[65],schema:e[207].item,mainSchema:e[0].items,record:e[10],disabled:e[43],fixed:e[207].fixed,reqQuantity:e[21],currency:e[16],notifyList:e[12],multiValues:e[60],shortEdit:e[6],dateInput:e[15]}}),t.$on("save",e[72]),t.$on("record",e[80]),t.$on("readerSave",e[89]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4194304&n[0]&&(r.open=e[22]),1&n[0]&&(r.list=e[207]),8&n[1]&&(r.template=e[34]),1&n[0]&&(r.schema=e[207].item),1&n[0]&&(r.mainSchema=e[0].items),1024&n[0]&&(r.record=e[10]),4096&n[1]&&(r.disabled=e[43]),1&n[0]&&(r.fixed=e[207].fixed),2097152&n[0]&&(r.reqQuantity=e[21]),65536&n[0]&&(r.currency=e[16]),4096&n[0]&&(r.notifyList=e[12]),64&n[0]&&(r.shortEdit=e[6]),32768&n[0]&&(r.dateInput=e[15]),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function ff(e){let t,n,r,i;const o=[hf,uf],s=[];function a(e,t){return"array"===e[207].type?0:1}return t=a(e),n=s[t]=o[t](e),{c(){n.c(),r=B()},m(e,n){s[t].m(e,n),R(e,r,n),i=!0},p(e,i){let l=t;t=a(e),t===l?s[t].p(e,i):(pe(),ye(s[l],1,1,()=>{s[l]=null}),ge(),n=s[t],n?n.p(e,i):(n=s[t]=o[t](e),n.c()),we(n,1),n.m(r.parentNode,r))},i(e){i||(we(n),i=!0)},o(e){ye(n),i=!1},d(e){s[t].d(e),e&&D(r)}}}function mf(e){let t,n,r,i;function o(t){e[108](t)}let s={title:"",$$slots:{default:[pf]},$$scope:{ctx:e}};return void 0!==e[37]&&(s.checked=e[37]),n=new e[50]({props:s}),ee.push(()=>Ee(n,"checked",o)),{c(){t=O("div"),Ae(n.$$.fragment),U(t,"class","askNext"),z(t,"margin-top","1em"),z(t,"margin-left","23em")},m(e,r){R(e,t,r),$e(n,t,null),i=!0},p(e,t){const i={};134217728&t[6]&&(i.$$scope={dirty:t,ctx:e}),!r&&64&t[1]&&(r=!0,i.checked=e[37],le(()=>r=!1)),n.$set(i)},i(e){i||(we(n.$$.fragment,e),i=!0)},o(e){ye(n.$$.fragment,e),i=!1},d(e){e&&D(t),be(n)}}}function pf(e){let t;return{c(){t=O("span"),t.textContent="Weiter erfassen",z(t,"margin-left",".75em")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function gf(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function wf(e){let t,n,r,i,o,s=!(e[39]||e[37])&&vf(e),a=e[5]&&!e[43]&&_f(e),l=e[2]&&e[3]&&Ef(e),c=e[35]&&$f(e);return{c(){s&&s.c(),t=P(),a&&a.c(),n=P(),l&&l.c(),r=P(),c&&c.c(),i=B()},m(e,d){s&&s.m(e,d),R(e,t,d),a&&a.m(e,d),R(e,n,d),l&&l.m(e,d),R(e,r,d),c&&c.m(e,d),R(e,i,d),o=!0},p(e,o){e[39]||e[37]?s&&(pe(),ye(s,1,1,()=>{s=null}),ge()):s?(s.p(e,o),320&o[1]&&we(s,1)):(s=vf(e),s.c(),we(s,1),s.m(t.parentNode,t)),e[5]&&!e[43]?a?(a.p(e,o),32&o[0]|4096&o[1]&&we(a,1)):(a=_f(e),a.c(),we(a,1),a.m(n.parentNode,n)):a&&(pe(),ye(a,1,1,()=>{a=null}),ge()),e[2]&&e[3]?l?(l.p(e,o),12&o[0]&&we(l,1)):(l=Ef(e),l.c(),we(l,1),l.m(r.parentNode,r)):l&&(pe(),ye(l,1,1,()=>{l=null}),ge()),e[35]?c?(c.p(e,o),16&o[1]&&we(c,1)):(c=$f(e),c.c(),we(c,1),c.m(i.parentNode,i)):c&&(pe(),ye(c,1,1,()=>{c=null}),ge())},i(e){o||(we(s),we(a),we(l),we(c),o=!0)},o(e){ye(s),ye(a),ye(l),ye(c),o=!1},d(e){s&&s.d(e),e&&D(t),a&&a.d(e),e&&D(n),l&&l.d(e),e&&D(r),c&&c.d(e),e&&D(i)}}}function yf(e){let t,n,r,i;t=new e[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Of]},$$scope:{ctx:e}}}),t.$on("click",e[76]);let o=e[36]&&kf(e);return{c(){Ae(t.$$.fragment),n=P(),o&&o.c(),r=B()},m(e,s){$e(t,e,s),R(e,n,s),o&&o.m(e,s),R(e,r,s),i=!0},p(e,n){const i={};134217728&n[6]&&(i.$$scope={dirty:n,ctx:e}),t.$set(i),e[36]?o?(o.p(e,n),32&n[1]&&we(o,1)):(o=kf(e),o.c(),we(o,1),o.m(r.parentNode,r)):o&&(pe(),ye(o,1,1,()=>{o=null}),ge())},i(e){i||(we(t.$$.fragment,e),we(o),i=!0)},o(e){ye(t.$$.fragment,e),ye(o),i=!1},d(e){be(t,e),e&&D(n),o&&o.d(e),e&&D(r)}}}function vf(e){let t,n;return t=new e[48]({props:{class:"close",disabled:e[43],form:e[55],filled:!0,type:"submit",$$slots:{default:[If]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4096&n[1]&&(r.disabled=e[43]),134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function If(e){let t;return{c(){t=M("Speichern und schliessen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function _f(e){let t,n;return t=new e[48]({props:{form:e[55],filled:!0,type:"submit",style:"opacity: 0.75;",$$slots:{default:[Cf]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};256&n[1]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Cf(e){let t,n=(e[39]||"Speichern")+"";return{c(){t=M(n)},m(e,n){R(e,t,n)},p(e,r){256&r[1]&&n!==(n=(e[39]||"Speichern")+"")&&H(t,n)},d(e){e&&D(t)}}}function Ef(e){let t,n;return t=new e[48]({props:{disabled:e[43],danger:!0,outline:!0,$$slots:{default:[Af]},$$scope:{ctx:e}}}),t.$on("click",e[84]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};4096&n[1]&&(r.disabled=e[43]),134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Af(e){let t;return{c(){t=M("Löschen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function $f(e){let t,n,r,i,o;const s=[Sf,bf],a=[];t=function(e){return e[64]?0:1}(e),n=a[t]=s[t](e);let l=e[36]&&Df(e);return{c(){n.c(),r=P(),l&&l.c(),i=B()},m(e,n){a[t].m(e,n),R(e,r,n),l&&l.m(e,n),R(e,i,n),o=!0},p(e,t){n.p(e,t),e[36]?l?(l.p(e,t),32&t[1]&&we(l,1)):(l=Df(e),l.c(),we(l,1),l.m(i.parentNode,i)):l&&(pe(),ye(l,1,1,()=>{l=null}),ge())},i(e){o||(we(n),we(l),o=!0)},o(e){ye(n),ye(l),o=!1},d(e){a[t].d(e),e&&D(r),l&&l.d(e),e&&D(i)}}}function bf(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Tf]},$$scope:{ctx:e}}}),t.$on("click",function(){A(e[74](e[1]))&&e[74](e[1]).apply(this,arguments)}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(n,r){e=n;const i={};134217728&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Sf(e){let t,n;return t=new d({props:{text:e[64],extended:!0,$$slots:{default:[Rf]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};2&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Tf(e){let t,n,r;return n=new $t({props:{size:"18"}}),{c(){t=O("span"),t.textContent=`${e[83]()}`,Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Nf(e){let t,n,r;return n=new $t({props:{size:"18"}}),{c(){t=O("span"),t.textContent=`${e[83]()}`,Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Rf(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.6;",$$slots:{default:[Nf]},$$scope:{ctx:e}}}),t.$on("click",function(){A(e[74](e[1]))&&e[74](e[1]).apply(this,arguments)}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(n,r){e=n;const i={};134217728&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Df(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[xf]},$$scope:{ctx:e}}}),t.$on("click",function(){A(e[75](e[1]))&&e[75](e[1]).apply(this,arguments)}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(n,r){e=n;const i={};134217728&r[6]&&(i.$$scope={dirty:r,ctx:e}),t.$set(i)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function xf(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Daten",Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Of(e){let t,n,r;return n=new $t({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Erstellen",Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function kf(e){let t,n;return t=new e[48]({props:{filled:!0,style:"opacity: 0.75;",$$slots:{default:[Mf]},$$scope:{ctx:e}}}),t.$on("click",e[77]),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Mf(e){let t,n,r;return n=new Tt({props:{size:"18"}}),{c(){t=O("span"),t.textContent="Daten",Ae(n.$$.fragment),z(t,"margin-right",".75em")},m(e,i){R(e,t,i),$e(n,e,i),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n,e)}}}function Pf(e){return{c:I,m:I,p:I,i:I,o:I,d:I}}function Bf(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Lf(e){let t;return{c(){t=M("Ja, bitte löschen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Ff(e){let t,n,r,i,o,s,a,l,c;return s=new e[48]({props:{filled:!0,$$slots:{default:[Bf]},$$scope:{ctx:e}}}),s.$on("click",e[109]),l=new e[48]({props:{danger:!0,outline:!0,$$slots:{default:[Lf]},$$scope:{ctx:e}}}),l.$on("click",e[87]),{c(){t=O("p"),t.textContent="Willst du diese Daten löschen?",n=P(),r=O("p"),r.textContent="Das kann nicht rückgängig gemacht werden.",i=P(),o=O("div"),Ae(s.$$.fragment),a=P(),Ae(l.$$.fragment),U(o,"class","flex_div svelte-lfqa43")},m(e,d){R(e,t,d),R(e,n,d),R(e,r,d),R(e,i,d),R(e,o,d),$e(s,o,null),N(o,a),$e(l,o,null),c=!0},p(e,t){const n={};134217728&t[6]&&(n.$$scope={dirty:t,ctx:e}),s.$set(n);const r={};134217728&t[6]&&(r.$$scope={dirty:t,ctx:e}),l.$set(r)},i(e){c||(we(s.$$.fragment,e),we(l.$$.fragment,e),c=!0)},o(e){ye(s.$$.fragment,e),ye(l.$$.fragment,e),c=!1},d(e){e&&D(t),e&&D(n),e&&D(r),e&&D(i),e&&D(o),be(s),be(l)}}}function Vf(e){let t,n,r;return n=new ke({props:{size:"25"}}),{c(){t=O("div"),Ae(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function Uf(e){let t,n;return t=new e[46]({props:{title:"Bestätigung",closeCallback:e[202],danger:!0,$$slots:{"title-icon":[Vf],default:[Ff]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};65536&n[6]&&(r.closeCallback=e[202]),134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Hf(e){let t,n,r;function i(t){e[112](t)}let o={$$slots:{default:[Qf,({closeCallback:e})=>({202:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?65536:0]]},$$scope:{ctx:e}};return void 0!==e[24]&&(o.open=e[24]),t=new e[45]({props:o}),ee.push(()=>Ee(t,"open",i)),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};1048576e3&r[0]|134283264&r[6]&&(i.$$scope={dirty:r,ctx:e}),!n&&16777216&r[0]&&(n=!0,i.open=e[24],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Wf(e){let t,n,r,i,o,s=e[93](e[23].refItem,!0)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" nicht gefunden!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){8388608&t[0]&&s!==(s=e[93](e[23].refItem,!0)+"")&&H(i,s)},d(e){e&&D(t)}}}function zf(e){let t,n,r,i,o,s=e[93](e[23].refItem)+"";return{c(){t=O("tr"),n=O("th"),r=O("div"),i=M(s),o=M(" bereits eingefügt!"),z(r,"color","red"),U(n,"colspan","2")},m(e,s){R(e,t,s),N(t,n),N(n,r),N(r,i),N(r,o)},p(e,t){8388608&t[0]&&s!==(s=e[93](e[23].refItem)+"")&&H(i,s)},d(e){e&&D(t)}}}function jf(e){let t;let n=function(e){return"number"===e[203].type?Gf:qf}(e),r=n(e);return{c(){r.c(),t=B()},m(e,n){r.m(e,n),R(e,t,n)},p(e,t){r.p(e,t)},d(e){r.d(e),e&&D(t)}}}function qf(e){let t;return{c(){t=O("input"),U(t,"id","reader_"+e[203].name),U(t,"type","text")},m(e,n){R(e,t,n)},p:I,d(e){e&&D(t)}}}function Gf(e){let t;return{c(){t=O("input"),z(t,"width","4em"),U(t,"id","reader_"+e[203].name),U(t,"type","number"),U(t,"min","0")},m(e,n){R(e,t,n)},p:I,d(e){e&&D(t)}}}function Xf(e){let t,n,r,i,o,s,a=e[93](e[203].name)+"",l=e[25]&&e[26]&&jf(e);return{c(){t=O("tr"),n=O("th"),r=M(a),i=P(),o=O("td"),l&&l.c(),s=P()},m(e,a){R(e,t,a),N(t,n),N(n,r),N(t,i),N(t,o),l&&l.m(o,null),N(t,s)},p(e,t){e[25]&&e[26]?l?l.p(e,t):(l=jf(e),l.c(),l.m(o,null)):l&&(l.d(1),l=null)},d(e){e&&D(t),l&&l.d()}}}function Yf(e){let t;return{c(){t=M("Verwerfen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Zf(e){let t;return{c(){t=M("Speichern")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function Kf(e){let t,n,r,i,o,s,a,l,c,d,u,h,f,m,p,g,w,y,v,I,_,C,E,A,$,b=e[93](e[23].refItem)+"";function S(t){e[111](t)}let T={keyboard:e[23].keyboard,codeTypes:e[23].codeTypes};function k(e,t){return e[29]?zf:e[25]&&!e[27]?Wf:void 0}void 0!==e[28]&&(T.readerInit=e[28]),t=new Gu({props:T}),ee.push(()=>Ee(t,"readerInit",S)),t.$on("scan",e[91]),t.$on("exit",e[96]);let B=k(e),L=B&&B(e),F=e[92](),V=[];for(let t=0;t<F.length;t+=1)V[t]=Xf(qh(e,F,t));return C=new e[48]({props:{disabled:!e[25],outline:!0,style:"float: left;",$$slots:{default:[Yf]},$$scope:{ctx:e}}}),C.$on("click",e[94]),A=new e[48]({props:{disabled:!e[27],filled:!0,style:"float: right;",$$slots:{default:[Zf]},$$scope:{ctx:e}}}),A.$on("click",e[95]),{c(){Ae(t.$$.fragment),r=P(),i=O("div"),o=O("table"),s=O("tr"),a=O("th"),a.textContent="Code",l=P(),c=O("td"),d=M(e[25]),u=P(),h=O("tr"),f=O("th"),m=M(b),p=P(),g=O("td"),w=O("div"),y=M(e[26]),v=P(),L&&L.c(),I=P();for(let e=0;e<V.length;e+=1)V[e].c();_=P(),Ae(C.$$.fragment),E=P(),Ae(A.$$.fragment),z(w,"max-width","14em"),z(o,"margin-top","1em"),z(o,"margin-bottom","1em"),z(o,"text-align","left"),z(i,"position","relative"),z(i,"z-index","1000"),z(i,"background-color","white"),z(i,"height","225px")},m(e,n){$e(t,e,n),R(e,r,n),R(e,i,n),N(i,o),N(o,s),N(s,a),N(s,l),N(s,c),N(c,d),N(o,u),N(o,h),N(h,f),N(f,m),N(h,p),N(h,g),N(g,w),N(w,y),N(o,v),L&&L.m(o,null),N(o,I);for(let e=0;e<V.length;e+=1)V[e].m(o,null);N(i,_),$e(C,i,null),N(i,E),$e(A,i,null),$=!0},p(e,r){const i={};if(8388608&r[0]&&(i.keyboard=e[23].keyboard),8388608&r[0]&&(i.codeTypes=e[23].codeTypes),!n&&268435456&r[0]&&(n=!0,i.readerInit=e[28],le(()=>n=!1)),t.$set(i),(!$||33554432&r[0])&&H(d,e[25]),(!$||8388608&r[0])&&b!==(b=e[93](e[23].refItem)+"")&&H(m,b),(!$||67108864&r[0])&&H(y,e[26]),B===(B=k(e))&&L?L.p(e,r):(L&&L.d(1),L=B&&B(e),L&&(L.c(),L.m(o,I))),100663296&r[0]|1073741824&r[2]|1&r[3]){let t;for(F=e[92](),t=0;t<F.length;t+=1){const n=qh(e,F,t);V[t]?V[t].p(n,r):(V[t]=Xf(n),V[t].c(),V[t].m(o,null))}for(;t<V.length;t+=1)V[t].d(1);V.length=F.length}const s={};33554432&r[0]&&(s.disabled=!e[25]),134217728&r[6]&&(s.$$scope={dirty:r,ctx:e}),C.$set(s);const a={};134217728&r[0]&&(a.disabled=!e[27]),134217728&r[6]&&(a.$$scope={dirty:r,ctx:e}),A.$set(a)},i(e){$||(we(t.$$.fragment,e),we(C.$$.fragment,e),we(A.$$.fragment,e),$=!0)},o(e){ye(t.$$.fragment,e),ye(C.$$.fragment,e),ye(A.$$.fragment,e),$=!1},d(e){be(t,e),e&&D(r),e&&D(i),L&&L.d(),x(V,e),be(C),be(A)}}}function Qf(e){let t,n;return t=new e[46]({props:{title:"Scannen",class:"reader",closeCallback:e[202],$$slots:{default:[Kf]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};65536&n[6]&&(r.closeCallback=e[202]),1048576e3&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function Jf(e){let t;return{c(){t=M("Abbrechen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function em(e){let t,n,r,i,o;return i=new e[48]({props:{filled:!0,$$slots:{default:[Jf]},$$scope:{ctx:e}}}),i.$on("click",e[113]),{c(){t=O("progress"),n=P(),r=O("div"),Ae(i.$$.fragment),z(t,"width","100%"),U(t,"id","file"),U(t,"max","100"),t.value=e[42],U(r,"class","flex_div svelte-lfqa43")},m(e,s){R(e,t,s),R(e,n,s),R(e,r,s),$e(i,r,null),o=!0},p(e,n){(!o||2048&n[1])&&(t.value=e[42]);const r={};134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),i.$set(r)},i(e){o||(we(i.$$.fragment,e),o=!0)},o(e){ye(i.$$.fragment,e),o=!1},d(e){e&&D(t),e&&D(n),e&&D(r),be(i)}}}function tm(e){let t,n,r;return n=new ke({props:{size:"25"}}),{c(){t=O("div"),Ae(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function nm(e){let t,n;return t=new e[46]({props:{title:"Auswertung wird erstellt",closeCallback:e[202],$$slots:{"title-icon":[tm],default:[em]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};65536&n[6]&&(r.closeCallback=e[202]),2048&n[1]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function rm(e){let t,n;return{c(){t=O("p"),n=M(e[9])},m(e,r){R(e,t,r),N(t,n)},p(e,t){512&t[0]&&H(n,e[9])},d(e){e&&D(t)}}}function im(e){let t;return{c(){t=M("Schliessen")},m(e,n){R(e,t,n)},d(e){e&&D(t)}}}function om(e){let t,n,r,i,o;return t=new e[51]({props:{outline:!0,$$slots:{default:[rm]},$$scope:{ctx:e}}}),i=new e[48]({props:{danger:!0,outline:!0,$$slots:{default:[im]},$$scope:{ctx:e}}}),i.$on("click",e[115]),{c(){Ae(t.$$.fragment),n=P(),r=O("div"),Ae(i.$$.fragment),U(r,"class","flex_div svelte-lfqa43")},m(e,s){$e(t,e,s),R(e,n,s),R(e,r,s),$e(i,r,null),o=!0},p(e,n){const r={};512&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r);const o={};134217728&n[6]&&(o.$$scope={dirty:n,ctx:e}),i.$set(o)},i(e){o||(we(t.$$.fragment,e),we(i.$$.fragment,e),o=!0)},o(e){ye(t.$$.fragment,e),ye(i.$$.fragment,e),o=!1},d(e){be(t,e),e&&D(n),e&&D(r),be(i)}}}function sm(e){let t,n,r;return n=new ke({props:{size:"25"}}),{c(){t=O("div"),Ae(n.$$.fragment),U(t,"slot","title-icon")},m(e,i){R(e,t,i),$e(n,t,null),r=!0},p:I,i(e){r||(we(n.$$.fragment,e),r=!0)},o(e){ye(n.$$.fragment,e),r=!1},d(e){e&&D(t),be(n)}}}function am(e){let t,n;return t=new e[46]({props:{title:"Speichern nicht erfolgreich",danger:!0,$$slots:{"title-icon":[sm],default:[om]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,n){const r={};768&n[0]|134217728&n[6]&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function lm(e){let t,n,r,i,o,s,a,l,c,d,u,h,f;jh.title=t=e[44];let m={ctx:e,current:null,token:null,hasCatch:!1,pending:Pf,then:Zh,catch:Yh,value:206,blocks:[,,,]};function p(t){e[110](t)}ve(e[66](),m);let g={$$slots:{default:[Uf,({closeCallback:e})=>({202:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?65536:0]]},$$scope:{ctx:e}};void 0!==e[13]&&(g.open=e[13]),i=new e[45]({props:g}),ee.push(()=>Ee(i,"open",p));let w=e[23]&&e[24]&&Hf(e);function y(t){e[114](t)}let v={$$slots:{default:[nm,({closeCallback:e})=>({202:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?65536:0]]},$$scope:{ctx:e}};function I(t){e[116](t)}void 0!==e[41]&&(v.open=e[41]),l=new e[45]({props:v}),ee.push(()=>Ee(l,"open",y));let _={$$slots:{default:[am,({closeCallback:e})=>({202:e}),({closeCallback:e})=>[0,0,0,0,0,0,e?65536:0]]},$$scope:{ctx:e}};return void 0!==e[8]&&(_.open=e[8]),u=new e[45]({props:_}),ee.push(()=>Ee(u,"open",I)),{c(){n=P(),m.block.c(),r=P(),Ae(i.$$.fragment),s=P(),w&&w.c(),a=P(),Ae(l.$$.fragment),d=P(),Ae(u.$$.fragment)},m(e,t){R(e,n,t),m.block.m(e,m.anchor=t),m.mount=()=>r.parentNode,m.anchor=r,R(e,r,t),$e(i,e,t),R(e,s,t),w&&w.m(e,t),R(e,a,t),$e(l,e,t),R(e,d,t),$e(u,e,t),f=!0},p(n,r){e=n,(!f||8192&r[1])&&t!==(t=e[44])&&(jh.title=t),Ie(m,e,r);const s={};134283264&r[6]&&(s.$$scope={dirty:r,ctx:e}),!o&&8192&r[0]&&(o=!0,s.open=e[13],le(()=>o=!1)),i.$set(s),e[23]&&e[24]?w?(w.p(e,r),25165824&r[0]&&we(w,1)):(w=Hf(e),w.c(),we(w,1),w.m(a.parentNode,a)):w&&(pe(),ye(w,1,1,()=>{w=null}),ge());const d={};2048&r[1]|134283264&r[6]&&(d.$$scope={dirty:r,ctx:e}),!c&&1024&r[1]&&(c=!0,d.open=e[41],le(()=>c=!1)),l.$set(d);const p={};768&r[0]|134217728&r[6]&&(p.$$scope={dirty:r,ctx:e}),!h&&256&r[0]&&(h=!0,p.open=e[8],le(()=>h=!1)),u.$set(p)},i(e){f||(we(m.block),we(i.$$.fragment,e),we(w),we(l.$$.fragment,e),we(u.$$.fragment,e),f=!0)},o(e){for(let e=0;e<3;e+=1){ye(m.blocks[e])}ye(i.$$.fragment,e),ye(w),ye(l.$$.fragment,e),ye(u.$$.fragment,e),f=!1},d(e){e&&D(n),m.block.d(e),m.token=null,m=null,e&&D(r),be(i,e),e&&D(s),w&&w.d(e),e&&D(a),be(l,e),e&&D(d),be(u,e)}}}let cm=new Map,dm=new Map,um=new Map;const hm=(e,t)=>cm.set(e,t),fm=e=>cm.get(e),mm=async(e,n)=>{const r="p$"+e+"$"+n,i=cm.get(r);if(i?.length)return i;const o=n;return cm.has(o)||(cm.set(o,[]),cm.set(o,t.getTasksList(n).then(({data:e})=>e))),cm.get(o)},pm=async(e,n,r,i=!1)=>{let o=dm.get(r);if(!o)if(i)o=t.getTaskList(e,r),dm.set(r,o);else{const i="p$"+e+"$"+n,s=await cm.get(i);if(!s?.length)return mm(e,n).then(n=>(o=n.find(({_id:e})=>e===r),o||(o=t.getTaskList(e,r)),dm.set(r,o),o));o=s.find(({_id:e})=>e===r),o||(o=t.getTaskList(e,r)),dm.set(r,o)}return o},gm=(e,t)=>{um.set(e,t)},wm=e=>um.get(e),ym=(e,n,r=!1)=>{let i=!r&&um.get(n);return i||(i=t.getTask(e,n),um.set(n,i)),i},vm=(e,n)=>{if(!cm.get(n))return;const r=n;cm.set(r,t.getTasksList(n).then(({data:e})=>e))};function Im(e){return new Promise(t=>setTimeout(t,e))}function _m(e,o,l){let d,f,m,p,g,y,I,_;b(e,h,e=>l(134,g=e)),b(e,a,e=>l(135,y=e)),b(e,i,e=>l(136,I=e));const{Modal:C,Dialog:E,Divider:A,Button:$,FormField:S,Checkbox:N,Chip:R}=c,{loggedIn:D,currentTasks:x,environment:O}=u;b(e,D,e=>l(137,_=e)),b(e,x,e=>l(132,m=e)),b(e,O,e=>l(133,p=e)),JSON.parse(n.getItem("Locale"));const k=K();let{schema:M}=o,{recID:P}=o,{deletable:B}=o,{prevEventID:L=!1}=o,{prev:F=!1}=o,{taskId:V=!1}=o,{taskOrg:U}=o,{description:H=""}=o,{root:W=!1}=o,{readonly:z}=o,{isStandalone:j}=o,{shortEdit:q=!1}=o,{shortSchema:G=!1}=o,X=!0,Q=!1,J="",ee=window.location.href.split("/task/")[2];ee&&(ee=ee.split(":")[1],ee&&(ee=ee.split("?")[0])),q&&(M=G);let te,ne,re,ie,oe,ae,le={},ce={},de="form-"+M.class+Math.floor(9e3*Math.random()+1e3).toString(),ue=!1,he=!1;const fe=W?"fEmbedded":"fTask",me=W?"sEmbedded":"sTask";let pe="CHF";const ge=new Map;let we,ye,ve=0,Ie=0,_e=0,Ce=0,Ee=1,Ae=!P&&M.list&&1===M.list.length;const $e={},be=M.items.find(e=>"price"===e.name&&!e.properties?.hidden),Se=M.items.find(e=>"quantity"===e.name&&!e.properties?.hidden),Te=M.items.find(e=>"amount"===e.name&&!e.properties?.hidden),Ne=!!be||!!Te,Re=M.list?.filter(e=>"array"===e.type)?.length>1||M.items?.filter(e=>e.name.startsWith("amount"))||Ne,De=M.items.find(e=>"number"===e.type&&"w"===e.properties?.unit?.constant?.toLowerCase()&&!e.properties?.hidden)?.name,xe=!!De,Oe=M.list?.filter(e=>"array"===e.type)?.length>1||xe,ke={},Me=M.result?.resultDef[0].button?.description;let Pe,Be,Le,Fe,Ve,Ue,He,We,ze,je,qe,Ge,Xe,Ye="",Ze="",Ke="",Qe=!1,Je=!1,et=!1,tt=!1,nt=!1,rt=0,it=0,ot=[],st=[],at=[],lt={},ct=new Map,dt=M.class,ut=M.id,ht=!1,ft=-1!==window.location.search.indexOf("next="),mt=0;const pt=-1!==window.location.search.indexOf("back=true");ze=We=!m?.length||m.find(e=>e===ut);["readonly","hidden","required"].map(e=>{M.items.filter(t=>"object"==typeof(t.properties&&t.properties[e])).map(t=>{const n=t.properties[e].refItem||"",[r,i]=n.split(".");ot.push({action:e,itemName:t.name,refObj:r,refName:i,op:t.properties[e].invert?"!":""})})});M.items.filter(e=>e.selection&&e.constraint).map(e=>{st.push({name:e.name,selection:e.selection,constraint:e.constraint})});M.items.filter(e=>e.lookup).forEach(e=>{at.push({name:e.name,lookup:e.lookup})}),M.items.filter(e=>e.properties?.lookup).forEach(e=>{at.push({name:e.name,lookup:e.properties.lookup.split(":").at(-1)})});const gt=async e=>{if(e?.length)for(const n of e){if(!n.lookup)break;const{name:e}=n;if(le[e])break;const{domain:r,value:i}=n.lookup;if("user"===r&&i){const n=_.user,r={[i]:n},o=await t.getSectionView(e,r);if(o?.length){const[{_id:t}]=o;t&&l(10,le[e]=t,le)}}}},wt=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length<2)return;const n=!e.input.class[0].name&&e.input.class[0].selection;if(!n)return;const r=e.input.class[1].name,[i,o]=e.input.class[1].destination?.split(".");if(!r||!o)return;const s=M.list?.find(e=>e.name===i);if(!s)return;if(s.filter)return;const a=await t.getSchemaByClass(n),c=(await t.getTasks(a.id)).data;if(!c?.length)return;const d=[];for(const e of c)if(e.active??1){const t={};for(const n of s.item)n.name===o?t[n.name]=e._id:e[n.name]&&(t[n.name]=e[n.name]);d.push(t)}d.length&&l(10,le[i]=d,le)},yt=async e=>{if(!M.input)return;if(!M.input.length)return;if(M.input.length>1)return;const t=Ue.input.class[0],{name:n,selection:r,state:i,list:o}=t;n||r&&i&&o&&await vt(r,i,o)},vt=async(e,n,r)=>{const i=(await t.getEvents()).filter(t=>t.output?.class?.at(0)?.name===e),o={[r]:[]};for(const s of i){let i={event:s._id,status:n};const a=await t.getSectionView("_task",i);if(a?.length){i={_id:{$in:a.map(e=>e.docId)}};const n=await t.getSectionView(e,i);for(const t of n){const n=M.list.find(e=>e.name===r);if(n){const i={[e]:t._id.toString()};for(const e of n.item)t[e.name]&&(i[e.name]=t[e.name]);o[r].push(i)}}}}setTimeout(()=>l(10,le={...le,...o}),100)},It=()=>{for(const e of M.items)"boolean"==typeof e.properties?.value&&l(10,le[e.name]=e.properties.value,le),"string"==typeof e.properties?.value&&l(10,le[e.name]=e.properties.value,le),e.properties?.value?.concatenation&&Ct(e);_t()},_t=async()=>{for(const e of M.list||[])for(const n of e.item)if(n.refItem&&"array"!==e.type)if("owner"===n.refItem){const r=p.owner;r||T(O,p.owner=r=(await t.getSolitaire(n.refItem))[0],p),p.owner||(await t.getSolitaire(n.refItem))[0],r&&(le[e.name]||l(10,le[e.name]={},le),l(10,le[e.name][n.name]=v(r,n.refPos||n.name),le))}else if(le[n.refItem]){const r=await t.getTask(n.refItem,le[n.refItem]);r&&(le[e.name]||l(10,le[e.name]={},le),l(10,le[e.name][n.name]=v(r,n.refPos||n.name),le))}},Ct=async e=>{const t=e.properties.value.concatenation;let n="";for(const e of t)void 0!==e.constant&&(n+=e.constant),"year"===e.variable&&(n+=(new Date).getFullYear()),e.refItemNext&&(n+=await At(e.refItemNext));l(10,le[e.name]=n,le)},Et=async e=>{const t=ot.filter(t=>t.refObj===e||t.itemName===e);if(t?.length){l(32,lt={});for(const e of t){const{itemName:t,refObj:n,refName:r,op:i}=e;let{action:o}=e;if(!n)break;let s,a,c=!r&&le[n];const d=le[n];d&&r&&(c=(await ym(n,d))[r]),Array.isArray(c)&&0===c.length&&(c=!1),"!"===i&&(c=!c),"required"!==o&&"readonly"!==o||(o="required"===o?o:"disabled",setTimeout(()=>{s=`#${de} .form-field.${t} .field #${t}`,a=document.querySelector(s),a&&c&&a.setAttribute(o,""),a&&!c&&a.removeAttribute(o)},0)),"hidden"===o&&(s=`#${de} .form-field.${t}`,a=document.querySelector(s),a?.classList?.toggle("hidden",!!c),c&&l(32,lt[t]="",lt))}}},At=async e=>{const[n,r]=e.offset?.split(",")||[0,0],i=+e.base||0,o=+e.step||1;e.type;const s=e.refItem,a=await t.getLastId(M.class,s);if(!a?.length)return(i+o).toString().padStart(r,"0");let l=a[0][s];+l<i&&(l=i.toString());return((+l?.substring(n,n+r)||i)+o).toString().padStart(r,"0")},$t=(e,t,n,r=!1)=>{const i=n||t.name,o=i.startsWith("_")?i:i.split("_")[0],s=e.find(e=>e.name===o);let a=t.value;if(!s)return a;if(r||"signature"!==s.type&&!s.properties?.multi||le[i]&&!a&&(a=le[i]),"dateRange"===s.type){if(null===a)return;let e=new Date(a);if("Invalid Date"==e)return;return e=`${e.getFullYear()}-${(e.getMonth()+1).toString().padStart(2,"0")}-${e.getDate().toString().padStart(2,"0")}T00:00:00.000Z`,new Date(e).toISOString()}if(a&&s.type.startsWith("date"))try{return ur(a,"%d.%m.%Y").toISOString()}catch{return new Date(a).toISOString()}if("boolean"===s.type&&(a=!!t.checked),"number"===s.type){const e=s.properties?.decimals||0;try{a=Number(a.replace(",",".")).toFixed(e).toString()}catch{}}if(r&&"date"===s.type&&s.properties?.required&&!a&&le[i]){a=le[i];try{return ur(a,"%d.%m.%Y").toISOString()}catch{return a}}return a},bt=async e=>{l(43,d=!0);const n=e.submitter?.className?.includes("close"),r={_docAsync:e?._docAsync};Array.from(document.querySelectorAll("form#"+de+" ."+de)).map(e=>{if(e.name)if(e.name.includes(".")){const t=e.name.split(".")[0],n=M.items.find(e=>e.name===t);if(n&&"object"===n.type&&n.properties?.multi)r[t]=(r[t]||[]).concat(e.value);else{const[t,n]=e.name.split("."),i=M.list.find(e=>e.name===t);r[e.name]=$t(i.item,e)}}else r[e.name]=$t(M.items,e);else if(e.id){const t=M.items.find(t=>t.name===e.id);"signature"===t.type&&(e.name=e.id,r[e.name]=$t(M.items,e))}});let i=!1;if(M.list&&M.list.map(e=>{if(e.mandatory){const t=ce[e.name]?.filter(e=>!e._delete).length;if(!t||t<2)return void(i=!0)}"array"===e.type&&ce[e.name]&&(e.item.forEach(t=>{for(const n of ce[e.name])void 0===n[t.name]&&(n[t.name]="boolean"!==t.type&&"")}),r[e.name]=ce[e.name].reduce((t,n)=>n._delete||!Object.values(n).some(Boolean)?t:t.concat(Object.entries(n).reduce((t,[n,r])=>("_delete"!==n&&(t[n]=$t(e.item,{name:n,value:r,checked:r},"",!0)),t),{})),[]))}),i)return s.failed("Bitte Positionen erfassen",3e3),void l(43,d=!1);if(r._event=ut,r._prevEventId=L,r._taskId=V,ie){const e=ie.record;for(const t in e)t.includes(".")&&delete e[t];e._event=ie.event,e._taskId=ie.taskId;const{id:n}=await t.saveData(ie.class,e);r[ie.class]||(r[ie.class]=n)}if(q)return St(M.class,r),l(43,d=!1),Nt();const{id:o,task:a,tax:c,error:u,state:h,info:f}=await t.saveData(M.class,r);if(u?.text){const e=u.field?" in "+u.field+": "+u.value:"";if(l(9,J=`${u.text} ${e}`),l(8,Q=!0),!h)return void l(43,d=!1)}if(Ge){const e=new FormData;e.append("title",Ge.fileName),e.append("file",Ge.file),await t.uploadUserReport(a,e)}f&&!Array.isArray(f)&&f.accepted?f.accepted?.length?s.success(`Email versandt an ${f.accepted.join(", ")}, Dateigrösse: ${f.messageSize} Bytes.`,5e3):(l(9,J="Email konnte nicht versandt werden!"),l(8,Q=!0)):s.success("Die Daten wurden gespeichert.",2e3),l(43,d=!1),l(18,Ie=c?._amount||0),l(19,_e=100*(c?._rate||0)||""),kt(),r._id=o;const m=await t.getTaskList(M.class,o);if(k("choose",{row:m}),n)return l(43,d=!1),Nt();if(!P){if(ft){const e=Math.floor(9e3*Math.random()+1e3).toString();return window.singleSpaNavigate(`/task/${ut}/${ut}/task?next=${e}`)}return window.singleSpaNavigate(`/task/${ut}/${a}/task`)}},St=async(e,n)=>{if(!q.lookup)return;const r={};for(const e in n){const t=n[e];Array.isArray(t)||q.lookup.includes(e)&&(r[e]=n[e])}const i=await t.getSectionView(M.class,r);if(!i?.length)return void await t.saveData(e,n);let o,s;for(const r of i.toReversed()){if(!(await t.getTaskByDocId(r._id,!0)).status.startsWith("WaitingForApproval"))continue;s=r;const i=r[q.ref];for(let s=0;s<i.length;s++){o=!0;const a=i[s];for(const e in a)if(q.lookup.includes(e)&&a[e]!=n[q.ref][0][e]){o=!1;break}if(o)return i[s]=n[q.ref][0],r._event=n._event,r._prevEventId=n._prevEventId,r._taskId=n._taskId,void await t.saveData(e,r)}}if(s){const r=s;r[q.ref].push(n[q.ref][0]),r._event=n._event,r._prevEventId=n._prevEventId,r._taskId=n._taskId,await t.saveData(e,r)}else await t.saveData(e,n)},Tt=()=>q||re||j||!L?Nt():window.history.back(),Nt=()=>pt?k("back"):j?window.close():W?window.singleSpaNavigate("/"):k("back"),Rt=async({detail:e})=>{if(Array.isArray(e.value)&&ge.set(e.name,e.value),!(M.input?.length&&M.input.length>1))return;if(te?.class!==M.input[0]&&!ee)return;let n,{value:r,lookup:i,name:o,view:s}=e;if(!i&&!ee)return;if(i&&(n=i.split(":")[0]),s||(n=o,s="_id"),ee){if(n=M.input[1],!ge?.size||!ge.get(e.name)?.length)return void l(10,le[n]=[],le);s=o,r=[ee]}const a=await t.getSectionView(n,{[s]:{$in:r}}),c=a.map(e=>e._id);for(const e of M.input.slice(1)){l(10,le[e]=[],le);const r=await t.getSchemaByClass(e);r.id;let i=await t.getTasks(r.id);if(i=i.data.filter(e=>"Ready"===e._task?.status&&(c.includes(e[n])||c.includes(e._id))),i?.length){const{filter:r}=Ue.input.class.find(t=>t.name===e),{refItem:o,value:s}=r||{},c=[];if(i.forEach(e=>{if(r){const t=a.find(t=>t._id===e[n]);t&&t[o]===s&&c.push(e._id)}else c.push(e._id)}),c.length){const n=await t.getSectionView(e,{_id:{$in:c}});for(const t of n)t[e]=t._id;l(10,le[e]=n,le)}}}},Dt=async(e,n,r)=>{if(1===Ue.input?.class?.length){const t=Ue.input.class[0],{name:r,selection:i,state:o,list:s,exclude:a}=t;e===r&&i&&o&&s&&await xt(e,n,i,o,s,a)}if(M.input&&M.input.length>1&&!ee){if(M.input[0]!==e)return;const{name:i,source:o,destination:s,selection:a}=Ue.input.class[1];if(o&&s){const t=await ym(e,n);if(!t)return void l(10,le[s]=[],le);const r=await ym(a,t[a]);if(!r)return;const i=r[o]||[];return void l(10,le[s]=i,le)}const{recursive:c}=Ue.input.class[1];if(n){let i=await t.getTaskOptions(`${e}:${n}`,ut,c);if(r){const e=s.split(".")[1],t=[];i[e].forEach(n=>{le[e]?.find(t=>t[e]===n[e])||t.push(n)}),i={[e]:le[e]?[...le[e],...t]:[...t]}}l(10,le={...le,...i})}else{const e=M.input.slice(1);for(const t of e)l(10,le[t]=[],le)}}for(const e of Ue.output.class[0].item)"date"===e.type&&e.properties?.value?.formula?Wt(e.name):void 0!==e.factor&&l(10,le[e.name]=le[e.name]*e.factor,le);if((async()=>{const e=M.items.find(e=>"textarea"===e.properties?.format&&e.properties?.source);if(e&&!le[e.name]){const t=new Set;let n="";for(const r of e.properties.source){const[e,i,o]=r.split("."),s=le[e];for(const r of s||[]){const s=r[i];if(s&&!t.has(s)){t.add(s);const r=M.list?.find(t=>t.name===e),a=r?.item.find(e=>e.name===i);if(a?.refClass){const e=await ym(a.refClass,s);e&&e[o]&&(n+=e[o])}}if(n)break}if(n)break}n&&l(10,le[e.name]=n,le)}})(),M.list?.length){let e=We;for(const t of M.list)"array"===t.type&&t.mandatory&&le[t.name]&&!le[t.name].length&&(e=!1);l(38,ze=e)}},xt=async(e,t,n,r,i,o)=>{n=[].concat(n);for(const s of n)await Ot(e,t,s,r,i,o)},Ot=async(e,n,r,i,o,s)=>{let[a,c]=r.split(".");c||(c=r,a=""),o=[].concat(o);const d=a?(await t.getEvents()).filter(e=>e.output?.class?.at(0)?.name===c):(await t.getEvents()).filter(e=>e.output?.class?.at(0)?.name===c&&Ue.output?.class?.at(0)?.list?.find(t=>t.name===e.identity.name)),u={};for(const r of d)if(u[r.identity.name]=[],n){let l={event:r._id,status:i};const d=await t.getSectionView("_task",l);if(d?.length){const i=[];l={_id:{$in:d.map(e=>e.docId)},[e]:n};const h=await t.getSectionView(c,l);for(const e of h)for(const n of o)if(n.startsWith("$")){const t=n.slice(1),r=[];for(const n of e[t]||[]){const t={...n,[c]:e._id};for(const e in t)!t.quantity&&e.startsWith("quantity")&&(t.quantity=t[e]);t.quantity&&r.push(t)}let i=u[t]||[];i=i.concat(r),u[t]=i}else if(a){let r=!0;if(s){const i=await t.getSectionView(M.class,{[n+"."+c]:e._id});r=!i?.length}const o={[c]:e._id.toString()};r&&i.push(o)}else for(const t of e[n]||[]){const n={...t,[c]:e._id};for(const e in n)!n.quantity&&e.startsWith("quantity")&&(n.quantity=n[e]);n.quantity&&i.push(n)}a?u[o[0]]=i.length?i:[]:u[r.identity.name]=i.length?i:[]}}else a&&(u[o[0]]=[]);setTimeout(()=>l(10,le={...le,...u}),100)},kt=()=>{let e=0;if(be){let t=1;Se&&(t=Ee),e=Ce*t}Te&&(e=Ce);let t=0;for(const e in $e)t+=$e[e];let n=0;for(const e of M.items)e.name.startsWith("amount")&&(n+=+le[e.name]);l(17,ve=t+e),le.discount>0&&l(17,ve-=ve*le.discount*.01),l(17,ve+=n)},Mt=()=>{let e=0;for(const t in ke)e+=ke[t];l(31,rt=e+ +it)},Pt=({detail:e})=>{ce[e.listName]=e.value,Re&&($e[e.listName]=e.amountValue,kt()),Oe&&(ke[e.listName]=e.weeksValue||0,Mt()),e.addToRecord&&l(12,oe=e)};r.subscribe(async e=>{if(!e)return;if(!P)return;const n=await t.getSchema(e.eventId);if(!n)return;const r=M.list?.find(e=>e.name===n.class);if(!r)return;const i=await t.getTaskById(e.taskId);((e,t,n)=>{if(!cm.get(e))return;const r=t;dm.set(r,n)})(i.event,i.docId,i.data);const o=await t.getTask(n.class,i.docId),s=le[n.class].filter(e=>e[n.class]==o._id);s?.length&&s.map(e=>{e[n.class]=i.docId}),l(10,le),l(104,ne),l(103,te),l(0,M)}),Y(async()=>{if(cm=new Map,dm=new Map,um=new Map,await Lt(),!q)return;const e={...le};let n=e[q.ref][0];for(const e in n)n[e]||(n[e]=q.value[e]);const r={};for(const t in e){const i=e[t];if(Array.isArray(i))for(const e in n){const t=n[e];q.lookup.includes(e)&&(r[q.ref+"."+e]=t)}else q.lookup.includes(t)&&(r[t]=i)}if(q.lookup.includes("date")){const e=new Date,t=new Date(e.getFullYear(),e.getMonth(),e.getDate()).toISOString(),n=new Date(e.getFullYear(),e.getMonth(),e.getDate()+1).toISOString();r.date=t,r.date={$gte:t,$lt:n}}const i=await t.getSectionView(M.class,r);let o=!1;for(const e of i){if((await t.getTaskByDocId(e._id,!0)).status.startsWith("WaitingForApproval")){if(o)break;for(const t of e[q.ref]){let e=!0;for(const r in t)if(q.lookup.includes(r)&&t[r]!=n[r]){e=!1;break}if(e){for(const e in t)q.lookup.includes(e)||(n[e]=t[e]);o=!0;break}}}}l(10,le[q.ref][0]=n,le);const s=(q.focus||q.fill.at(-1))+"-0",a=document.getElementById(s);a&&a.focus()});const Bt=async()=>{Pe&&(Be||(Be=await t.getEvent(ut)),l(37,ft=!0),Pe.autostart&&Yt())},Lt=async()=>{const e=e=>new Promise(t=>setTimeout(t,e));let t,n=0;for(;!(t=document.getElementById(de)&&!tt&&!nt)&&++n<20;)await e(50);t||(t=document.getElementById(de)),t&&(()=>{if(P)return;const e=new Set;for(const t of ot)e.add(t.refObj||dt);Array.from(e).forEach(e=>Et(e))})(),Ft()},Ft=()=>{setTimeout(()=>{Array.from(ct).forEach(([e,t])=>{le[e]||l(10,le[e]=t._id,le)})},350)};Z(()=>{P&&T(h,g={[P]:{record:le,lists:ce}},g)});const Vt=()=>{const e={};Array.from(document.querySelectorAll("form#"+de+" ."+de)).map(t=>{if(t.name){const n=M.items.find(e=>e.name===t.name.split(".")[0]);if(n?.properties?.multi){const n=t.name.split(".")[0];e[n]=(e[n]||[]).concat(t.value)}else if(t.name.includes(".")){const[n,r]=t.name.split("."),i=M.list.find(e=>e.name===n);e[t.name]=$t(i.item,t)}else e[t.name]=$t(M.items,t,t.name.split("_")[0])}}),M.list&&M.list.map(t=>{"array"===t.type&&ce[t.name]&&(e[t.name]=ce[t.name].reduce((e,n)=>n._delete||!Object.values(n).some(Boolean)?e:e.concat(Object.entries(n).reduce((e,[n,r])=>("_delete"!==n&&(e[n]=$t(t.item,{name:n,value:r,checked:r},"",!0)),e),{})),[]))});let t=!0;return Object.entries(e).map(([e,n])=>{e=e.split("_")[0];const r=M.items.find(t=>t.name===e);r?.properties?.required&&!n&&(t=!1)}),t&&e},Ut=async e=>{let n;for(l(42,mt=0),Gt();!n&&Xe;){l(42,mt++,mt);const r=await t.progressReport(e);if(n=r?.progressValue,mt>300)break;await Im(1e3)}if(Xt(),n){const t="/api/report/list/"+e;window.open(t,"_self","width=1 height=1")}},Ht=(e,t)=>("number"==typeof e&&e||(e=Number(e||0)),e.toFixed(t||0)),Wt=async e=>{if(!e)return;const t=M.items.find(t=>t.name===e),n=t.properties.value.formula,{operator:r,argument:i}=n,o=i.map(e=>le[e.refItem]);let s=0;if("$add"===r){if("date"===t.type)return void l(10,le[e]=await zt(r,i),le);s=o.reduce((e,t)=>+(e||0)+ +(t||0))}if("$subtract"===r&&(s=o.reduce((e,t)=>{e||(e=""),t||(t="");const[n,r]=e.toString().split(":");e=r?(+n+ +r/60).toFixed(2):+(n||0);let[i,o]=t.toString().split(":");return i||(i=0),e-=o?(+i+ +o/60).toFixed(2):+(i||0)})),"$multiply"===r&&(s=o.reduce((e,t)=>+(e||0)*+(t||0))),"$percentMultiply"===r){const[e,t]=o;if(!+e)return;s=+e,+t>0&&(s*=1-t/100)}if("$percentDivide"===r){const[e,t]=o;if(!+e||!+t)return;s=+e/+t*100}l(10,le[e]="$multiply"===r?s?Ht(s,t.properties?.decimals):"":Ht(s,t.properties?.decimals),le)},zt=async(e,n)=>{const[r,i]=n.map(e=>e.refItem||e.value);let o,s;"string"==typeof i&&([o,...s]=i.split("."),0===s.length?(s=o,o=""):s=s.join("."));const a=jt(le[r])||Date.now();let l=s?0:i;if(o){if("owner"===o)p.owner||T(O,p.owner=await t.getSectionView("owner",{}),p),l=v(p.owner,s);else if(le[o]){const e=await ym(o,le[o]);e&&(l=v(e,s))}}else l=l||le[s];return c=l||0,(d=new Date(a)).setDate(d.getDate()+Number(c)),d;var c,d},jt=e=>{if(!e)return;let t,n,r;e.includes("T")?([t,n,r]=e.split("-"),r=r.split("T")[0]):[r,n,t]=e.split(".");return new Date(+t,+n-1,+r).toISOString()},qt=()=>{l(13,ue=!1)},Gt=()=>{l(41,Xe=!0)},Xt=()=>{l(41,Xe=!1)},Yt=()=>{l(29,Je=!1),l(26,Ze=""),l(25,Ye=""),l(27,Ke=""),l(24,Le=!0)},Zt=()=>{l(25,Ye=""),l(26,Ze=""),l(27,Ke=""),l(29,Je=!1),l(28,Qe=!0),Kt()},Kt=()=>{if(!Pe.keyboard)return;const e=document.getElementById("reader_focusId");e&&e.focus()};return e.$$set=e=>{"schema"in e&&l(0,M=e.schema),"recID"in e&&l(2,P=e.recID),"deletable"in e&&l(3,B=e.deletable),"prevEventID"in e&&l(99,L=e.prevEventID),"prev"in e&&l(4,F=e.prev),"taskId"in e&&l(1,V=e.taskId),"taskOrg"in e&&l(100,U=e.taskOrg),"description"in e&&l(97,H=e.description),"root"in e&&l(5,W=e.root),"readonly"in e&&l(98,z=e.readonly),"isStandalone"in e&&l(101,j=e.isStandalone),"shortEdit"in e&&l(6,q=e.shortEdit),"shortSchema"in e&&l(102,G=e.shortSchema)},e.$$.update=()=>{32&e.$$.dirty[3]&&l(43,d=z),1&e.$$.dirty[0]|3072&e.$$.dirty[3]&&ne&&te&&(M.items.map(({name:e,type:t,refItem:n,properties:r})=>{if(!1===n)return;const i=te.items.find(t=>t.name===e);if(!i)return;if(t!==i.type)return;const o="_"+e;ne[e]?l(10,le[e]=ne[e],le):n&&n.startsWith("owner")||r&&r.readonly||l(10,le[e]="",le),ne[o]&&l(10,le[o]=ne[o],le),l(22,Ae=!1)}),(()=>{for(const e of M.list||[]){const t=[],n=le[e.name];if(n?.length){for(const r of n){const n=r;for(const t of e.item)if(!1===t.refItem)n[t.name]="boolean"!==t.type&&"";else if(t.refItem)if("date"!==t.type||le[t.refItem])n[t.name]=le[t.refItem];else{const e=new Date,r=new Date(e.getFullYear(),e.getMonth(),e.getDate(),0,0,0);n[t.name]=r}t.push(n)}l(10,le[e.name]=t,le)}}})()),32&e.$$.dirty[0]|16&e.$$.dirty[3]&&l(44,f=W?H||"enablerr - Form":document.title)},[M,V,P,B,F,W,q,X,Q,J,le,re,oe,ue,he,ae,pe,ve,Ie,_e,we,ye,Ae,Pe,Le,Ye,Ze,Ke,Qe,Je,tt,rt,lt,Fe,Ve,ht,He,ft,ze,je,qe,Xe,mt,d,f,C,E,A,$,S,N,R,D,x,O,de,fe,me,{name:"amountValue",properties:{decimals:2}},{name:"taxValue",properties:{decimals:2}},ge,Re,Oe,{name:"weekValue",properties:{decimals:1}},Me,ut,async()=>{if(l(34,Ve=[]),p.owner||T(O,p.owner=await t.getSectionView("owner",{}),p),p.currency?l(16,pe=p.currency.designation):t.getSectionView("owner",{}).then(e=>{e?.length&&e[0].currency&&ym("currency",e[0].currency).then(e=>{e&&l(16,pe=e.designation)}).catch(e=>console.log("currency not found"))}),le.currency&&ym("currency",le.currency).then(e=>{e&&l(16,pe=e.designation)}).catch(e=>console.log("currency not found")),Ue=await t.getEvent(ut),q&&l(10,le[q.ref]=[{...q.value}],le),!P){if(l(33,Fe=Ve),gt(Ue.input?.class).then(()=>{nt=!0}),It(),wt(Ue),yt(),ee){const e=Ue.input.class[0].selection;le[e]||(l(10,le[e]=[ee],le),Rt({detail:{value:[ee],name:e}}))}await(async()=>{if(!d&&(Be||(Be=await t.getEvent(ut)),l(23,Pe=Be.output.class[0].reader),Pe&&!Pe.keyboard))try{const e=await getCameras();e?.length||l(23,Pe=!1)}catch{}})(),Bt()}if(P){if(g&&g[P]){const e=g[P],t=e.record;M.items.map(e=>{t[e.name]=$t(M.items,{name:e.name,value:t[e.name],checked:t[e.name]})}),l(10,le=t),M.list&&M.list.map(t=>{"array"===t.type&&e.lists[t.name]&&l(10,le[t.name]=e.lists[t.name].reduce((e,n)=>n._delete||!Object.values(n).some(Boolean)?e:e.concat(Object.entries(n).reduce((e,[n,r])=>("_delete"!==n&&(e[n]=$t(t.item,{name:n,value:r,checked:r},"",!0)),e),{})),[]),le)})}else l(10,le=await t.getTask(M.class,P));if(l(97,H=w(M,le)),M.result,l(35,ht=!!M.result?.resultDef&&!M.result.resultDef[0].createAfterSave),l(18,Ie=le._tax?._amount),l(19,_e=100*le._tax?._rate||""),l(40,qe=M.list?.find(e=>e.mandatory)&&Ue.input?.class?.length>1),qe){(U||await t.getTaskByDocId(P,!0)).visum&&l(40,qe=!1)}l(12,oe={itemName:M.class,value:P})}if(L){l(98,z=!1),l(103,te=await t.getSchema(L)),"string"==typeof F&&l(104,ne=await t.getTask(te.class,F));const e=M.items.find(e=>e.refClass===te.class);e&&l(10,le[e.name]=ne._id,le)}if(Oe&&(it=le[De]||0),Ue.trigger?.startOn&&!Ue.trigger.startOn.some(e=>e.type.indexOf("Manual")>=0)&&l(98,z=!0),y.role?.length&&M.authorization?.length){const e=M.authorization.some(e=>I?.find(t=>t===e.role&&"edit"===e.activity));l(98,z||=!e)}if(l(11,re="report"===Ue.output.type),l(7,X=!1!==Ue.output.class?.at(0)?.documentTotal),l(39,je=Ue.output.saveButton),p.userSetting){const e=p.userSetting;if(l(36,He=e.isAdmin),!He){const e=_.tenants.find(e=>e._id===_.tenant);e&&l(36,He=e.admin?.find(e=>e===_.user))}}else t.getUserSettings().then(e=>{if(l(36,He=e.isAdmin),!He){const e=_.tenants.find(e=>e._id===_.tenant);e&&l(36,He=e.admin?.find(e=>e===_.user))}});return l(30,tt=!0),!0},bt,Tt,async({detail:e})=>{const{row:n}=e;let{eventId:r}=e;if((()=>{if(P)for(const e of ot)e.refName||Et(e.itemName)})(),await(async(e,t)=>{if(!e&&!t?._id)return;let n,r=!1;const i={...le};for(const o of M.items){if("string"==typeof o.refItem&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItem.split(".");if("owner"===e)o.refItem.split(".").length<3&&(i[o.name]=p.owner[s||o.refClass],r=!0);else if(o.refInput?.includes("|")&&le[e]){const[t,s]=o.refInput.split("|");n=await ym(e,le[e]),i[o.name]=n[t]||n[s]||"",r=!0}else if(le[e]){if((t._id===le[e]||o.refItemAlt)&&(n=await ym(e,le[e]),n)){let e;24===n[s]?.toString().length?(n=await ym(s,n[s]),n&&(e=n[o.name||o.refInput])):s?(e=n[s][o.name]||n[s],"object"==typeof e&&(e=void 0)):e=n[o.name],void 0!==e&&(i[o.name]=e,r=!0)}}else s&&(i[o.name]="",r=!0)}if(!i[o.name]&&"string"==typeof o.refItemAlt&&(!e||o.properties?.linkOnly)){const[e,s]=o.refItemAlt.split(".");if((le[e]||t[e])&&(n=await ym(e,le[e]||t[e]),n)){let e;24===n[s]?.toString().length?(n=await ym(s,n[s]),n&&(e=n[o.name||o.refInput])):e=s?n[s][o.name]||n[s]:n[o.name],void 0!==e&&(i[o.name]=e,r=!0)}}}for(const t of M.list||[])if((!e||t.properties?.linkOnly)&&t.refItem&&le[t.refItem]){n=await ym(refItem,le[t.refItem]);const e=[];for(const i of n[t.name]){const n={};for(const e of t.item)i[e.name]&&(n[e.name]=i[e.name]);e.push(n),r=!0}i[t.name]=e}r&&l(10,le=i)})(!!P,n),P)return;if(r||=n._task?.event,r&&(await(async(e,n)=>{if(!e)return;const r=(await t.getEvent(e)).output.class[0].name,i=at.filter(e=>e.lookup===r);if(i?.length)for(const e of i){const{lookup:t,name:r}=e;let i="";if(n){let e=await ym(t,n);e&&e[r]?.length&&(i=e[r][0][r])}i&&l(10,le[r]=i,le)}})(r,n._id),M.items.filter(e=>e.properties?.lookup).forEach(async e=>{const n=await t.getEvent(r);n.output.class[0]?.name===e.properties.lookup&&l(10,le[e.name]="",le)})),!n._task)return;const i=n._task.event,o=await t.getEvent(i);for(const e of Ue.output.class[0].item)"date"===e.type&&e.properties?.value?.formula&&Wt(e.name);if(!Ue.output?.class?.length)return;const s=Ue.output.class[0]?.item.find(e=>(e.refClass||e.name)===o.output.class[0]?.name);(Ue.input?.class?.length&&Ue.input.class[0].name===o.output.class[0]?.name||s?.asInput)&&(l(103,te=await t.getSchema(i)),l(99,L=i),l(1,V=n._task._id),V&&n._task.docId?l(104,ne=await t.getTask(te.class,n._task.docId)):l(104,ne={}),await Dt(te.class,n?._task?.docId||n?._task?._id))},async({detail:e})=>{if(!q&&(l(12,oe=e),"quantity"===e.itemName&&l(21,ye=le.quantity),"currency"===e.itemName&&e.value&&ym("currency",e.value).then(e=>{e&&l(16,pe=e.designation)}).catch(e=>console.log("currency not found")),(async(e,t)=>{const n=st.filter(t=>t.selection===e||t.constraint===e);if(n?.length){l(20,we=!1);for(const r of n){const{selection:n,constraint:i,name:o}=r;if(t)break;l(10,le[o]="",le),e===n&&l(20,we=i);const s=le[n];if(s&&e===i){let e=await ym(n,s);const t=le[i];if(t?.length){const n=t[0].split(", ");e=e[i];let r="";for(const t of e)Object.values(t).map(e=>{n.includes(e)&&(r=t[o])});l(10,le[o]=r,le)}}}}})(e.itemName,e.oldValue===e.value),_t(),Et(e.itemName),Oe&&De&&(e.itemName===De&&(it=+e.value),Mt()),Ne&&Re)){if(e.itemName===be?.name)Ce=e.value;else if(e.itemName===Se?.name)Ee=e.value;else{if(e.itemName!==Te?.name)return;Ce=e.value}kt()}},Rt,Pt,e=>{"button"!==e.srcElement?.type&&"textarea"!==e.srcElement?.type&&13==e.which&&e.preventDefault()},e=>async()=>{const n=await t.getReportDoc(e)||{},{userReportId:r,type:i}=n;if(!r)return;if("eps"===i)return void s.success("Die Datei wurde erstellt und im Anhang abgelegt.");const o="/api/userreport/"+r;if("ics"===i)return window.open(o,"_self","width=1 height=1");const a="/viewer/doc/index.html?file="+o+"&type="+i;window.open(a,"","popup=yes toolbar=no width=624 height=900")},e=>async()=>{const e=await t.getDocData(V);(async e=>{const t=window.screen.height,n=window.open("","_blank","width=800,height="+t+",location=no");await se(),n?.document.write("<title>Report Daten für '"+M.identity.designation+"'</title>"),n?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+e+"</textarea>")})(JSON.stringify(e,null,4),M.identity.designation)},async()=>{const e=Vt();if(!e)return;const n=Ue.result?.resultDef[0]?.addToReports;if(n){const r=e[n];if(r){const n={docId:r},i=(await t.getSectionView("_task",n))[0];e._taskId=i._id}}const{reportId:r,type:i}=await t.createReport(ut,e);await Ut(r),Nt()},async()=>{const e=Vt();if(!e)return;const n=await t.getReportData(ut,e),r=window.screen.height,i=window.open("","_blank","width=800,height="+r+",location=no");await se(),i?.document.write("<title>Report Daten für '"+M.identity.designation+"'</title>"),i?.document.write("<textarea readonly style='resize: none; width: 100%; height: 100%;'>"+JSON.stringify(n,null,4)+"</textarea>")},async({detail:{className:e,itemName:n,value:r}})=>{if(dt!==r)return;if(!e)return;if(ct.has(e))return;if(!0!==r&&(r=(r=[].concat(r)).some(e=>e===dt)),!r)return;const i={[n]:!0},o=await t.getSectionView(e,i);o?.length&&ct.set(e,o[0])},({detail:e})=>{ie=e},({detail:e})=>{e.target&&M.list?.length?l(15,ae={ref:e.target,val:e.value}):e.itemName.startsWith("$")?Ge=e.value:setTimeout(()=>{l(10,le[e.itemName]=e.value,le)},200)},({detail:e})=>{l(14,he=!1);for(const t of e.items)l(10,le[e.listName][t.name]=t.value,le);l(14,he=!0)},({detail:e})=>{Wt(e.item.name)},()=>M.result.resultDef[0].button?.designation||"Dokument erstellen",()=>{l(13,ue=!0)},qt,Xt,async()=>{if(dt&&P){(await t.deleteData(dt,P)).taskId?(s.success("Die Daten wurden gelöscht.",3e3),Tt()):s.failed("Die Daten können nicht gelöscht werden!",3e3)}qt()},async()=>{if(!qe)return;const e=Ue.input.class[0].name,t=Ue.input.class[1].destination.split(".")[1];if(!e)return;if(!t)return;if(!le[e])return;const n=le[t]?.length||0;await Dt(e,le[e],!0),n<le[t].length?(Pt({detail:{listName:t,value:le[t]}}),bt({})):s.failed("Keine Positionen gefunden!",3e3)},()=>{P&&bt({_docAsync:!0})},Yt,async({detail:e})=>{if(l(29,Je=!1),l(26,Ze=""),l(25,Ye=e.text||""),!Ye)return;const n=$l(Ye);for(const e in n){if(M.items.find(t=>t.name===e))if("object"==typeof n[e]){let r={};for(const i in n[e])if("object"==typeof n[e][i])for(const o in n[e][i]){n[e][i][o]&&(r[o]=n[e][i][o]);const s=await t.getSectionView(i,r);if(s?.length){const n=await t.getSectionView(e,{[i]:s[0]._id});n?.length&&l(10,le[e]=n[0]._id,le)}}else{n[e][i]&&(r[i]=n[e][i]);const o=await t.getSectionView(e,r);o?.length&&l(10,le[e]=o[0]._id,le)}}else n[e]&&l(10,le[e]=n[e],le)}l(24,Le=!1)},()=>M.items.filter(e=>e.properties?.reader),(e,t=!1)=>t?(Zt(),""):M.items.find(t=>t.name===e)?.designation||"",Zt,()=>{const{refItem:e}=Pe,t={[e]:Ke};let n;M.filter(e=>e.properties?.reader).forEach(e=>{const n=document.getElementById("reader_"+e.name);n&&(t[e.name]=n.value||("number"===e.type?0:""))});let r=rec;const i=r.findIndex(t=>t[e]===Ke);i>=0?(n=r[i],r[i]={...n,...t}):r=r.slice(0,-1).concat(t),rec=r,M.filter(e=>e.properties?.reader).forEach(e=>{notify(e,i>=0?i:0)({detail:{oldValue:n?n[e.name]:"",value:t[e.name]}})}),et=!0,Zt()},()=>{et&&(et=!1,bt({}))},H,z,L,U,j,G,te,ne,function(e){ve=e,l(17,ve)},function(e){Ie=e,l(18,Ie)},function(e){rt=e,l(31,rt)},function(e){ft=e,l(37,ft)},()=>qt(),function(e){ue=e,l(13,ue)},function(e){Qe=e,l(28,Qe)},function(e){Le=e,l(24,Le)},()=>Xt(),function(e){Xe=e,l(41,Xe)},()=>{l(8,Q=!1)},function(e){Q=e,l(8,Q)}]}class Cm extends Te{constructor(e){var t;super(),jh.getElementById("svelte-lfqa43-style")||((t=O("style")).id="svelte-lfqa43-style",t.textContent="form.disabled.svelte-lfqa43 input.svelte-lfqa43{background-color:red !important}input:placeholder-shown{font-style:italic}form.svelte-lfqa43.svelte-lfqa43{min-width:25em}hr[data-text]{margin-bottom:1em !important}@media only screen and (min-width: 600px){form.svelte-lfqa43.svelte-lfqa43{min-width:30em}}.fEmbedded.svelte-lfqa43.svelte-lfqa43,.fTask.svelte-lfqa43.svelte-lfqa43{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-lfqa43.svelte-lfqa43{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-lfqa43.svelte-lfqa43{height:fit-content;max-height:70vh}.sTask.svelte-lfqa43.svelte-lfqa43{height:95%;display:inline-grid}.sTask.svelte-lfqa43 .btn.svelte-lfqa43{display:initial !important}.form--buttons.svelte-lfqa43.svelte-lfqa43{display:flex;gap:1em;padding-top:0.75em}.flex_div.svelte-lfqa43.svelte-lfqa43{display:flex;margin-top:1em;gap:0.5em;justify-content:space-between}section.sTask div.date-picker div.dropdown-shell div.dropdown.calendar{position:fixed !important;left:auto !important}form.fTask div.form-field{min-width:49vw}section.data + .modal-overlay > .dialog{margin-top:-5em}",N(jh.head,t)),Se(this,e,_m,lm,$,{schema:0,recID:2,deletable:3,prevEventID:99,prev:4,taskId:1,taskOrg:100,description:97,root:5,readonly:98,isStandalone:101,shortEdit:6,shortSchema:102},[-1,-1,-1,-1,-1,-1,-1])}}function Em(e){let t,n,r;function i(t){e[4](t)}let o={schema:e[5],recID:e[6]};return void 0!==e[0]&&(o.description=e[0]),t=new Cm({props:o}),ee.push(()=>Ee(t,"description",i)),t.$on("back",e[2]),{c(){Ae(t.$$.fragment)},m(e,n){$e(t,e,n),r=!0},p(e,r){const i={};32&r&&(i.schema=e[5]),64&r&&(i.recID=e[6]),!n&&1&r&&(n=!0,i.description=e[0],le(()=>n=!1)),t.$set(i)},i(e){r||(we(t.$$.fragment,e),r=!0)},o(e){ye(t.$$.fragment,e),r=!1},d(e){be(t,e)}}}function Am(e){let t,n;return t=new l({props:{update:e[1],description:e[0],$$slots:{default:[Em,({prop:{schema:e,recID:t,eventID:n}})=>({5:e,6:t,7:n}),({prop:e})=>(e?32:0)|(e?64:0)|(e?128:0)]},$$scope:{ctx:e}}}),{c(){Ae(t.$$.fragment)},m(e,r){$e(t,e,r),n=!0},p(e,[n]){const r={};1&n&&(r.description=e[0]),353&n&&(r.$$scope={dirty:n,ctx:e}),t.$set(r)},i(e){n||(we(t.$$.fragment,e),n=!0)},o(e){ye(t.$$.fragment,e),n=!1},d(e){be(t,e)}}}function $m(e,n,r){let i,{refresh:o}=n;return e.$$set=e=>{"refresh"in e&&r(3,o=e.refresh)},[i,(e,n)=>t.getSchema(e).then(t=>({schema:t,recID:n,eventID:e,title:t.identity.designation})),e=>{},o,function(e){i=e,r(0,i)}]}var bm=ou(function(e,t){function n(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function r(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){i(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("object"!==o(e))throw new Error("single-spa-svelte requires a configuration object");var t=r(r({},s),e);if(!t.component)throw new Error("single-spa-svelte must be passed opts.component");var n={};return{bootstrap:a.bind(null,t,n),mount:l.bind(null,t,n),unmount:c.bind(null,t,n),update:d.bind(null,t,n)}};var s={component:null,domElementGetter:null,props:{}};function a(e){return Promise.resolve()}function l(e,t,n){var i=Object.keys(s),o=Object.keys(e).reduce(function(t,n){return i.includes(n)||(t[n]=e[n]),t},{});return Promise.resolve().then(function(){var i=function(e,t){return(t=t&&t.customProps?t.customProps:t).domElement?function(){return t.domElement}:t.domElementGetter?function(){return t.domElementGetter(t)}:e.domElementGetter?function(){return e.domElementGetter(t)}:function(e){var t=e.appName||e.name;if(!t)throw Error("single-spa-svelte was not given an application name as a prop, so it can't make a unique dom element container for the svelte application");var n="single-spa-application:".concat(t);return function(){var e=document.getElementById(n);return e||((e=document.createElement("div")).id=n,document.body.appendChild(e)),e}}(t)}(e,n),s=i();t.instance=new e.component(r(r({},o),{},{target:s,props:Object.assign({},n,e.props)}))})}function c(e,t){return Promise.resolve().then(function(){t.instance.$destroy?t.instance.$destroy():t.instance.destroy()})}function d(e,t,n){return Promise.resolve().then(function(){t.instance.$set?t.instance.$set(n):t.instance.set(n)})}});const Sm=iu(bm)({component:class extends Te{constructor(e){super(),Se(this,e,$m,Am,$,{refresh:3})}},domElementGetter:()=>document.getElementById("detail-app")}),{bootstrap:Tm,mount:Nm,unmount:Rm}=Sm;e({bootstrap:Tm,mount:Nm,unmount:Rm});e("Form",Cm),e("List",Zt),e("Template",class extends Te{constructor(e){var t;super(),fr.getElementById("svelte-1phofh5-style")||((t=O("style")).id="svelte-1phofh5-style",t.textContent="form.svelte-1phofh5.svelte-1phofh5{min-width:25em}@media only screen and (min-width: 600px){form.svelte-1phofh5.svelte-1phofh5{min-width:30em}}.fEmbedded.svelte-1phofh5.svelte-1phofh5,.fTask.svelte-1phofh5.svelte-1phofh5{overflow-y:auto;padding-right:1em;overflow-x:hidden}.fEmbedded.svelte-1phofh5.svelte-1phofh5{height:fit-content;min-height:30vh;max-height:60vh}.fTask.svelte-1phofh5.svelte-1phofh5{height:fit-content;max-height:70vh}.sTask.svelte-1phofh5.svelte-1phofh5{height:95%;display:inline-grid;min-width:40em}.sTask.svelte-1phofh5 .btn.svelte-1phofh5{display:initial !important}.form--buttons.svelte-1phofh5.svelte-1phofh5{display:flex;gap:1em;padding-bottom:0.5em}",N(fr.head,t)),Se(this,e,Sr,$r,$,{schema:0,record:1})}})}}});
|