polotno 2.36.7 → 2.36.8
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/canvas/html-element.js +2 -2
- package/canvas/page.js +1 -1
- package/canvas/text-element.d.ts +1 -1
- package/canvas/text-element.js +1 -1
- package/model/group-model.d.ts +1 -0
- package/model/history.js +1 -1
- package/model/store.d.ts +1 -1
- package/model/store.js +1 -1
- package/model/text-model.d.ts +1 -0
- package/model/text-model.js +1 -1
- package/package.json +1 -1
- package/polotno.bundle.js +7 -7
- package/utils/__tests__/clipboard.test.d.ts +1 -0
- package/utils/__tests__/fonts.test.d.ts +1 -0
- package/utils/__tests__/gradient.test.d.ts +1 -0
- package/utils/__tests__/image-dpi.test.d.ts +1 -0
- package/utils/__tests__/loader.test.d.ts +1 -0
- package/utils/__tests__/luma.test.d.ts +1 -0
- package/utils/__tests__/svg.test.d.ts +1 -0
- package/utils/__tests__/text.test.d.ts +1 -0
- package/utils/fonts.d.ts +3 -2
- package/utils/fonts.js +1 -1
- package/utils/validate-key.js +1 -1
package/polotno.bundle.js
CHANGED
|
@@ -18,7 +18,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/256
|
|
|
18
18
|
`,nM=`ReactKonva: You are using "zIndex" attribute for a Konva node.
|
|
19
19
|
react-konva may get confused with ordering. Just define correct order of elements in your render function of a component.
|
|
20
20
|
For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
21
|
-
`,nN={};function nj(e,t,n=nN){if(!nA&&"zIndex"in t&&(console.warn(nM),nA=!0),!nI&&t.draggable){var r=void 0!==t.x||void 0!==t.y,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(nL),nI=!0)}for(var a in n)if(!nO[a]){var o="on"===a.slice(0,2),s=n[a]!==t[a];if(o&&s){var l=a.substr(2).toLowerCase();"content"===l.substr(0,7)&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),e.off(l,n[a])}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var c=t._useStrictMode,u={},d=!1;let h={};for(var a in t)if(!nO[a]){var o="on"===a.slice(0,2),f=n[a]!==t[a];if(o&&f){var l=a.substr(2).toLowerCase();"content"===l.substr(0,7)&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),t[a]&&(h[l]=t[a])}!o&&(t[a]!==n[a]||c&&t[a]!==e.getAttr(a))&&(d=!0,u[a]=t[a])}for(var l in d&&(e.setAttrs(u),nD(e)),h)e.on(l+nR,h[l])}function nD(e){if(!F.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}x("clk2u");let nz={},nB={};function nF(e,t){"string"==typeof t?console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`):(e.add(t),nD(e))}function nH(e,t,n){let r=tk[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=tk.Group);let i={},a={};for(var o in t)"on"===o.slice(0,2)?a[o]=t[o]:i[o]=t[o];let s=new r(i);return nj(s,a),s}function nV(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function nU(e,t,n){return!1}function n$(e){return e}function nq(){return null}function nW(){return null}function nG(e,t,n,r){return nB}function nK(){}function nY(e){}function nX(e,t){return!1}function nQ(){return nz}function nZ(){return nz}tk.Node.prototype._applyProps=nj;let nJ=setTimeout,n0=clearTimeout,n1=-1;function n2(e,t){return!1}let n4=!1,n3=!0,n8=!0;function n6(e,t){t.parent===e?t.moveToTop():e.add(t),nD(e)}function n5(e,t){t.parent===e?t.moveToTop():e.add(t),nD(e)}function n9(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),nD(e)}function n7(e,t,n){n9(e,t,n)}function re(e,t){t.destroy(),t.off(nR),nD(e)}function rt(e,t){t.destroy(),t.off(nR),nD(e)}function rn(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function rr(e,t,n){}function ri(e,t,n,r,i){nj(e,i,r)}function ra(e){e.hide(),nD(e)}function ro(e){}function rs(e,t){(null==t.visible||t.visible)&&e.show()}function rl(e,t){}function rc(e){}function ru(){}let rd=()=>nT.DefaultEventPriority;var S=x("8NFma"),rh=Object.defineProperty,rf=Object.defineProperties,rp=Object.getOwnPropertyDescriptors,rm=Object.getOwnPropertySymbols,rg=Object.prototype.hasOwnProperty,ry=Object.prototype.propertyIsEnumerable,rv=(e,t,n)=>t in e?rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rb=(e,t)=>{for(var n in t||(t={}))rg.call(t,n)&&rv(e,n,t[n]);if(rm)for(var n of rm(t))ry.call(t,n)&&rv(e,n,t[n]);return e};function rx(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}"u">typeof window&&((null==(jx=window.document)?void 0:jx.createElement)||(null==(jw=window.navigator)?void 0:jw.product)==="ReactNative")?S.useLayoutEffect:S.useEffect;let rw=console.error;console.error=function(){let e=[...arguments].join("");if((null==e?void 0:e.startsWith("Warning:"))&&e.includes("useContext")){console.error=rw;return}return rw.apply(this,arguments)};let rC=rx(S.createContext(null));class rS extends S.Component{render(){return S.createElement(rC.Provider,{value:this._reactInternals},this.props.children)}}function rk(){let e=function(){let e=function(){let e=S.useContext(rC);if(null===e)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let t=S.useId();return S.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=function e(t,n,r){if(!t)return;if(!0===r(t))return t;let i=n?t.return:t.child;for(;i;){let t=e(i,n,r);if(t)return t;i=n?null:i.sibling}}(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}(),[t]=S.useState(()=>new Map);t.clear();let n=e;for(;n;){if(n.type&&"object"==typeof n.type){let e=void 0===n.type._context&&n.type.Provider===n.type?n.type:n.type._context;e&&e!==rC&&!t.has(e)&&t.set(e,S.useContext(rx(e)))}n=n.return}return t}();return S.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>S.createElement(t,null,S.createElement(n.Provider,rf(rb({},r),rp({value:e.get(n)})))),e=>S.createElement(rS,rb({},e))),[e])}let r_=e=>{let t,n=m(S).useRef(null),r=m(S).useRef(null),i=m(S).useRef(null),a=(t=m(S).useRef({}),m(S).useLayoutEffect(()=>{t.current=e}),m(S).useLayoutEffect(()=>()=>{t.current={}},[]),t.current),o=rk(),s=t=>{let{forwardedRef:n}=e;n&&("function"==typeof n?n(t):n.current=t)};return m(S).useLayoutEffect(()=>(r.current=new tk.Stage({width:e.width,height:e.height,container:n.current}),s(r.current),i.current=rM.createContainer(r.current,nT.LegacyRoot,!1,null),rM.updateContainer(m(S).createElement(o,{},e.children),i.current),()=>{tk.isBrowser&&(s(null),rM.updateContainer(null,i.current,null),r.current.destroy())}),[]),m(S).useLayoutEffect(()=>{s(r.current),nj(r.current,e,a),rM.updateContainer(m(S).createElement(o,{},e.children),i.current,null)}),m(S).createElement("div",{ref:n,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},rE="Group",rT="Label",rP="Rect",rO="Line",rA="Image",rI="Text",rR="Path",rL="Transformer",rM=m(nE)(nP);rM.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:m(S).version,rendererPackageName:"react-konva"});let rN=m(S).forwardRef((e,t)=>m(S).createElement(rS,{},m(S).createElement(r_,{...e,forwardedRef:t})));var rj={},S=x("8NFma");rj=function(e,t,n){let r=S.useRef("loading"),i=S.useRef(),[a,o]=S.useState(0),s=S.useRef(),l=S.useRef(),c=S.useRef();return(s.current!==e||l.current!==t||c.current!==n)&&(r.current="loading",i.current=void 0,s.current=e,l.current=t,c.current=n),S.useLayoutEffect(function(){if(e){var a=document.createElement("img");return a.addEventListener("load",s),a.addEventListener("error",l),t&&(a.crossOrigin=t),n&&(a.referrerPolicy=n),a.src=e,function(){a.removeEventListener("load",s),a.removeEventListener("error",l)}}function s(){a.decode().catch(()=>{}).finally(()=>{r.current="loaded",i.current=a,o(Math.random())})}function l(){r.current="failed",i.current=void 0,o(Math.random())}},[e,t,n]),[i.current,r.current]};var S=(x("8NFma"),x("8NFma"),x("8NFma")),rD=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let rz=({children:e,groupProps:t,divProps:n,transform:r,transformFunc:i,parentNodeFunc:a})=>{let o=rk(),s=m(S).useRef(null),[l]=m(S).useState(()=>document.createElement("div")),c=m(S).useMemo(()=>m(k).createRoot(l),[l]),u=null==r||r,d=function(e=()=>{}){let t=m(S).useRef(e);return t.current=e,m(S).useCallback((...e)=>t.current.apply(null,e),[])}(()=>{if(u&&s.current){let e=s.current.getAbsoluteTransform().decompose();i&&(e=i(e)),l.style.position="absolute",l.style.zIndex="10",l.style.top="0px",l.style.left="0px",l.style.transform=`translate(${e.x}px, ${e.y}px) rotate(${e.rotation}deg) scaleX(${e.scaleX}) scaleY(${e.scaleY})`,l.style.transformOrigin="top left"}else l.style.position="",l.style.zIndex="",l.style.top="",l.style.left="",l.style.transform="",l.style.transformOrigin="";let e=n||{},{style:t}=e,r=rD(e,["style"]);Object.assign(l.style,t),Object.assign(l,r)});return m(S).useLayoutEffect(()=>{var e;let t=s.current;if(!t)return;let n=a?a({stage:t.getStage()}):null==(e=t.getStage())?void 0:e.container();if(n){let e;return n.appendChild(l),u&&"absolute"!==(e=window.getComputedStyle(n).position)&&"relative"!==e&&(n.style.position="relative"),t.on("absoluteTransformChange",d),d(),()=>{var e;t.off("absoluteTransformChange",d),null==(e=l.parentNode)||e.removeChild(l)}}},[u,a]),m(S).useLayoutEffect(()=>{d()},[n,i]),m(S).useLayoutEffect(()=>{queueMicrotask(()=>{(0,_.flushSync)(()=>{c.render(m(S).createElement(o,null,e))})})}),m(S).useLayoutEffect(()=>()=>{setTimeout(()=>{c.unmount()})},[]),m(S).createElement(rE,Object.assign({ref:s},t))};var S=x("8NFma");let rB=({selector:e,enabled:t,children:n})=>{let r=m(S).useRef(null),i=m(S).useRef(null),a=m(S).useRef(null),o=null==t||t;return m(S).useLayoutEffect(()=>{if(!r.current||!i.current)return;a.current=i.current;let t=r.current.getStage().findOne(e);o&&t?i.current.moveTo(t):i.current.moveTo(r.current);let n=r.current.getLayer();if(n&&(n.batchDraw(),t)){let e=t.getLayer();if(!e)return;e.batchDraw()}},[e,o]),m(S).useEffect(()=>()=>{var e;null==(e=a.current)||e.destroy()},[]),m(S).createElement(rE,{name:"_outer_portal",ref:r},m(S).createElement(rE,{name:"_inner_portal",ref:i},n))};var E=x("2SBKn");function rF(e,t,n){let r=n[t-1]||{values:{x:0,y:0}};if(e.marker===e.marker.toLowerCase())switch(e.marker=e.marker.toUpperCase(),e.marker){case"M":case"L":case"A":case"T":e.values.x+=r.values.x,e.values.y+=r.values.y;break;case"H":e.marker="L",e.values.x+=r.values.x,e.values.y=r.values.y;break;case"V":e.marker="L",e.values.x=r.values.x,e.values.y+=r.values.y;break;case"C":e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x1+=r.values.x,e.values.y1+=r.values.y,e.values.x2+=r.values.x,e.values.y2+=r.values.y;break;case"S":e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x2+=r.values.x,e.values.y2+=r.values.y;break;case"Q":e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x1+=r.values.x,e.values.y1+=r.values.y}else if(e.marker===e.marker.toUpperCase())switch(e.marker){case"H":e.marker="L",e.values.y=r.values.y;break;case"V":e.marker="L",e.values.x=r.values.x}if("Z"===e.marker){let r=function e(t,n){return"M"===t[n].marker?t[n]:e(t,n-1)}(n,t);e.values.x=r.values.x,e.values.y=r.values.y}return e}function rH(e,t,n){if(0!==t&&"L"===e.marker){let r=n[t-1];["x","y"].every(t=>0===Math.round(Math.abs(r.values[t]-e.values[t])))&&(e.overlap=!0)}return e}function rV(e,t){return Math.atan2(t.x-e.x,t.y-e.y)}function rU(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function r$(e,t){let n=t/Math.tan(e);return n===1/0||n===-1/0||isNaN(n)?t:n}function rq(e){let t=/-?[0-9]*\.?\d+/g;return[...e.matchAll(/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g)].map(e=>({marker:e[0],index:e.index})).reduceRight((t,n)=>{let r=e.substring(n.index,t.length?t[t.length-1].index:e.length);return t.concat([{marker:n.marker,index:n.index,chunk:r.length>0?r.substr(1,r.length-1):r}])},[]).reverse().flatMap(e=>{let n=e.chunk.match(t),r=n?n.map(parseFloat):[];return function(e,t){let n=[];switch(e.toUpperCase()){case"M":for(let r=0;r<t.length;r+=2){let i;i=e===e.toUpperCase()?0===r?"M":"L":0===r?"m":"l",n.push({marker:i,values:{x:t[r],y:t[r+1]}})}break;case"L":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"H":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:t[r],y:0}});break;case"V":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:0,y:t[r]}});break;case"C":for(let r=0;r<t.length;r+=6)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x2:t[r+2],y2:t[r+3],x:t[r+4],y:t[r+5]}});break;case"S":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x2:t[r],y2:t[r+1],x:t[r+2],y:t[r+3]}});break;case"Q":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x:t[r+2],y:t[r+3]}});break;case"T":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"A":for(let r=0;r<t.length;r+=7)n.push({marker:e,values:{radiusX:t[r],radiusY:t[r+1],rotation:t[r+2],largeArc:t[r+3],sweep:t[r+4],x:t[r+5],y:t[r+6]}});break;case"Z":n.push({marker:e,values:{x:0,y:0}})}return n}(e.marker,r)}).map(rF)}function rW(e,t,n){let r,i=[],a=[];return n&&e.forEach(e=>(Object.keys(e.values).forEach(t=>e.values[t]=e.values[t]&&parseFloat(e.values[t].toFixed(n))),e)),e.forEach(e=>{"M"===e.marker&&i.push([]),i[i.length-1].push(e)}),i.forEach(e=>{e.map(rH),function e(t,n){let r=["x","y"].every(e=>0===Math.round(Math.abs(t[n].values[e]-t[0].values[e])));"L"===t[n].marker&&r&&(t[n].overlap=!0,e(t,n-1)),"Z"===t[n].marker&&e(t,n-1)}(e,e.length-1);let n="Z"==e[e.length-1].marker;e.filter(e=>!e.overlap).map((e,r,i)=>{let o,s,l,c,u=function e(t,n,r){var i;let a=n-1,o=r[(a%(i=r.length)+i)%i];return"Z"!==o.marker?o:e(t,a,r)}(e,r,i),d=function e(t,n,r){var i;let a=n+1,o=r[(a%(i=r.length)+i)%i];return"Z"===o.marker?e(t,a,r):o}(e,r,i),h=rV(e.values,u.values),f=rV(e.values,d.values),p=f-h,m=180/Math.PI*p,g=Math.min(t,Math.abs((o=rU(e.values,d.values),Math.min(rU(u.values,e.values),o)/2*Math.tan(p/2)))),y=(l=0,(c=180/Math.PI*p)<0&&c>=-180||c>180&&c<360?s=r$(p/2,-g):(s=r$(p/2,g),l=1,s===1/0&&(s=g)),{offset:s,sweepFlag:l}),v=y.offset,b=y.sweepFlag,x=(0==r||r==i.length-1)&&!n;switch(e.marker){case"M":case"L":let w=[e.values.x+Math.sin(h)*v,e.values.y+Math.cos(h)*v],C=[e.values.x+Math.sin(f)*v,e.values.y+Math.cos(f)*v];x?a.push({marker:e.marker,values:e.values}):a.push({marker:e.marker,values:{x:parseFloat(w[0].toFixed(3)),y:parseFloat(w[1].toFixed(3))}}),x||"L"!==d.marker&&"M"!==d.marker||a.push({marker:"A",radius:g,values:{radiusX:parseFloat(g.toFixed(3)),radiusY:parseFloat(g.toFixed(3)),rotation:m,largeArc:0,sweep:b,x:parseFloat(C[0].toFixed(3)),y:parseFloat(C[1].toFixed(3))}});break;case"C":case"S":case"Q":case"T":case"A":case"Z":a.push({marker:e.marker,values:e.values})}})}),{path:(r=["radiusX","radiusY","rotation","largeArc","sweep","x1","y1","x2","y2","x","y"],a.map(e=>{let t="";if("Z"!==e.marker){let n=Object.keys(e.values);t=r.filter(e=>-1!==n.indexOf(e)).map(t=>e.values[t]).join()}return`${e.marker}${t}`}).join("").trim()),commands:a}}var S=x("8NFma"),rG={};h(rG,"parse",()=>jC,e=>jC=e),h(rG,"stringify",()=>jS,e=>jS=e);var rK=rK||{};rK.stringify=(N$={"visit_linear-gradient":function(e){return N$.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return N$.visit_gradient(e)},"visit_radial-gradient":function(e){return N$.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return N$.visit_gradient(e)},visit_gradient:function(e){var t=N$.visit(e.orientation);return t&&(t+=", "),e.type+"("+t+N$.visit(e.colorStops)+")"},visit_shape:function(e){var t=e.value,n=N$.visit(e.at),r=N$.visit(e.style);return r&&(t+=" "+r),n&&(t+=" at "+n),t},"visit_default-radial":function(e){var t="",n=N$.visit(e.at);return n&&(t+=n),t},"visit_extent-keyword":function(e){var t=e.value,n=N$.visit(e.at);return n&&(t+=" at "+n),t},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return N$.visit(e.value.x)+" "+N$.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return N$.visit_color(e.value,e)},visit_hex:function(e){return N$.visit_color("#"+e.value,e)},visit_rgb:function(e){return N$.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return N$.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return N$.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return N$.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return N$.visit_color("var("+e.value+")",e)},visit_color:function(e,t){var n=e,r=N$.visit(t.length);return r&&(n+=" "+r),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var t="",n=e.length;return e.forEach(function(e,r){t+=N$.visit(e),r<n-1&&(t+=", ")}),t},visit_object:function(e){return e.width&&e.height?N$.visit(e.width)+" "+N$.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return N$.visit_array(e);if("object"==typeof e&&!e.type)return N$.visit_object(e);if(e.type){var t=N$["visit_"+e.type];if(t)return t(e);throw Error("Missing visitor visit_"+e.type)}throw Error("Invalid node.")}},function(e){return N$.visit(e)});var rK=rK||{};rK.parse=function(){var e=/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,t=/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,n=/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,r=/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,i=/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,a=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,o=/^(left|center|right|top|bottom)/i,s=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,c=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,d=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rad/,h=/^\(/,f=/^\)/,p=/^,/,m=/^\#([0-9a-fA-F]+)/,g=/^([a-zA-Z]+)/,y=/^rgb/i,v=/^rgba/i,b=/^var/i,x=/^calc/i,w=/^(--[a-zA-Z0-9-,\s\#]+)/,C=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,S=/^hsl/i,k=/^hsla/i,_="";function E(e){var t=Error(_+": "+e);throw t.source=_,t}function T(){return P("linear-gradient",e,A)||P("repeating-linear-gradient",t,A)||P("radial-gradient",n,I)||P("repeating-radial-gradient",r,I)}function P(e,t,n){return O(t,function(t){var r=n();return r&&!V(p)&&E("Missing comma before color stops"),{type:e,orientation:r,colorStops:j(D)}})}function O(e,t){var n=V(e);if(n){V(h)||E("Missing (");var r=t(n);return V(f)||E("Missing )"),r}}function A(){var e=H("directional",i,1);if(e)return e;var t=H("position-keyword",o,1);return t?{type:"directional",value:t.value}:H("angular",u,1)||H("angular",d,1)}function I(){var e,t,n=R();return n&&((e=[]).push(n),t=_,V(p)&&((n=R())?e.push(n):_=t)),e}function R(){var e,t,n=((e=H("shape",/^(circle)/i,0))&&(e.style=F()||L()),e||((t=H("shape",/^(ellipse)/i,0))&&(t.style=N()||B()||L()),t));if(n)n.at=M();else{var r=L();if(r){n=r;var i=M();i&&(n.at=i)}else{var a=M();if(a)n={type:"default-radial",at:a};else{var o=N();o&&(n={type:"default-radial",at:o})}}}return n}function L(){return H("extent-keyword",a,1)}function M(){if(H("position",/^at/,0)){var e=N();return e||E("Missing positioning value"),e}}function N(){var e={x:B(),y:B()};if(e.x||e.y)return{type:"position",value:e}}function j(e){var t=e(),n=[];if(t)for(n.push(t);V(p);)(t=e())?n.push(t):E("One extra comma");return n}function D(){var e=H("hex",m,1)||O(k,function(){var e=z();V(p);var t=V(l),n=t?t[1]:null;V(p);var r=(t=V(l))?t[1]:null;V(p);var i=z();return n&&r||E("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[e,n,r,i]}})||O(S,function(){V(l)&&E("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");var e=z();V(p);var t=V(l),n=t?t[1]:null;V(p);var r=(t=V(l))?t[1]:null;return n&&r||E("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[e,n,r]}})||O(v,function(){return{type:"rgba",value:j(z)}})||O(y,function(){return{type:"rgb",value:j(z)}})||O(b,function(){return{type:"var",value:V(w)[1]}})||H("literal",g,0);return e||E("Expected color definition"),e.length=B(),e}function z(){return V(C)[1]}function B(){return H("%",l,1)||H("position-keyword",o,1)||O(x,function(){for(var e=1,t=0;e>0&&t<_.length;){var n=_.charAt(t);"("===n?e++:")"===n&&e--,t++}e>0&&E("Missing closing parenthesis in calc() expression");var r=_.substring(0,t-1);return U(t-1),{type:"calc",value:r}})||F()}function F(){return H("px",s,1)||H("em",c,1)}function H(e,t,n){var r=V(t);if(r)return{type:e,value:r[n]}}function V(e){var t,n;return(n=/^[\n\r\t\s]+/.exec(_))&&U(n[0].length),(t=e.exec(_))&&U(t[0].length),t}function U(e){_=_.substr(e)}return function(e){var t;return(_=e.toString().trim()).endsWith(";")&&(_=_.slice(0,-1)),t=j(T),_.length>0&&E("Invalid input not EOF"),t}}(),jC=rK.parse,jS=rK.stringify;let rY=e=>e.indexOf("linear-gradient")>=0,rX=e=>{if(!rY(e))return{rotation:0,stops:[{offset:0,color:e},{offset:1,color:e}]};let t=m(rG).parse(e)[0];return{rotation:t.orientation&&"value"in t.orientation?parseFloat(t.orientation.value):0,stops:t.colorStops.map((e,n)=>({color:"hex"===e.type?"#"+e.value:"literal"===e.type?e.value:`${e.type}(${e.value.join(",")})`,offset:e.length?parseFloat(e.length.value)/100:n/(t.colorStops.length-1)}))}},rQ=(e,t=e.fill??"",n="fill")=>m(S).useMemo(()=>{if(!rY(t))return{[n]:t};let{stops:r,rotation:i}=rX(t),a={x:e.a.width/2,y:e.a.height/2},o=(i%180+180)%180,s=o>45&&o<135?e.a.width:e.a.height,l=n_.Util.degToRad(i)-Math.PI/2,c=[];return(r.forEach(({offset:e,color:t})=>{c.push(e,t)}),"fill"===n)?{fillLinearGradientStartPointX:a.x-s/2*Math.cos(l),fillLinearGradientStartPointY:a.y-s/2*Math.sin(l),fillLinearGradientColorStops:c,fillLinearGradientEndPointX:a.x+s/2*Math.cos(l),fillLinearGradientEndPointY:a.y+s/2*Math.sin(l),fill:r[1].color,fillPriority:"linear-gradient"}:{strokeLinearGradientStartPointX:a.x-s/2*Math.cos(l),strokeLinearGradientStartPointY:a.y-s/2*Math.sin(l),strokeLinearGradientColorStops:c,strokeLinearGradientEndPointX:a.x+s/2*Math.cos(l),strokeLinearGradientEndPointY:a.y+s/2*Math.sin(l)}},[t,e.width,e.height]);var S=x("8NFma");let rZ=!1,rJ=(e=!rZ)=>{rZ=e};function r0(e,t){let n=m(S).useRef();m(S).useLayoutEffect(()=>{n.current&&n.current.destroy()},[t]),m(S).useLayoutEffect(()=>{if(!rZ)return;let t=e.current.opacity();if(t)return e.current.opacity(0),n.current=new n_.Tween({node:e.current,opacity:t,onFinish:()=>{n.current?.destroy()}}),n.current.play(),()=>{n.current?.destroy()}},[])}let r1=0,r2=[],r4=3e4,r3=e=>{r4=e},r8=6e3,r6=e=>{r8=e};function r5(e){r1+=1;let t=!1,n=!1,r=setTimeout(()=>{t||(it(`Timeout loading asset ${e}`),console.error("Timeout triggered for loader. Some assets may not have loaded.",e),t=!0,r9())},r4);return()=>{n?console.error("Finish called twice! That is not expected. id: ",e):(n=!0,t||(clearTimeout(r),r9()))}}function r9(){0==(r1-=1)&&(r2.forEach(e=>e()),r2=[])}let r7=[];function ie(e){r7.push(e)}function it(e){r7.forEach(t=>t(e))}var E=x("2SBKn");let ir=E.observable(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]),ii=E.observable({value:!1});function ia(){return ii.value}function io(e){if("default"===e){ii.value=!1;return}ii.value=!0,ir.splice(0,ir.length),ir.push(...e)}let is=E.observable([]);function il(e){is.push(e)}function ic(e){let t=is.findIndex(t=>t.fontFamily===e);-1!==t&&is.splice(t,1)}function iu(e){is.replace(e)}var id="Some test text;?#D-ПРИВЕТ!1230o9u8i7y6t5r4e3w2q1";function ih(e,t="sans-serif",n="normal",i="normal"){r||(r=document.createElement("canvas"));var a=r.getContext("2d");return a.font=`${n} ${i} 40px '${e}', ${t}`,a.measureText(id).width}let ip={Arial:!0},im=e=>Object.keys(ip).some(t=>t.startsWith(e+"_"))||!!ip[e];async function ig(e,t,n,i=""){let a=`${e}_${t}_${n}`;if(ip[a])return;let o=!!document.fonts?.load,s=function(e="normal",t="normal"){r||(r=document.createElement("canvas"));var n=r.getContext("2d");return n.font=`${e} ${t} 40px sans-serif`,n.measureText(id).width}(t,n);if(o)try{await document.fonts.load(`${t} ${n} 16px '${e}'`);let r=ih(e,"sans-serif",t,n);if(s!==r){ip[a]=!0;return}}catch{}let l=function(e="normal",t="normal"){r||(r=document.createElement("canvas"));var n=r.getContext("2d");return n.font=`${e} ${t} 40px serif`,n.measureText(id).width}(t,n),c=ih(e,"sans-serif",t,n),u=Math.min(6e3,r8)/60;for(let r=0;r<u;r++){let r=ih(e,"sans-serif",t,n),i=ih(e,"serif",t,n);if(r!==c||r!==s||i!==l){await new Promise(e=>setTimeout(e,100)),ip[a]=!0;return}await new Promise(e=>setTimeout(e,60))}console.warn(`Timeout for loading font "${e}". Looks like polotno can't load it. Is it a correct font family?`),it(`Timeout for loading font "${e}"`)}let iy={},iv="400,400italic,700,700italic";function ib(e){iv=e}function ix(e){let t=e.replace(/ /g,"+");return`https://fonts.googleapis.com/css?family=${t}:${iv}`}let iw={};var E=x("2SBKn"),iC=x("ibaza");let iS=E.observable({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:"resize",textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),ik="u">typeof window&&"localhost"===window.location.hostname,i_=E.action(e=>{iS.textVerticalResizeEnabled=e}),iE=E.action(e=>{iS.removeBackgroundEnabled=e}),iT=E.action(e=>{ik&&console.warn("useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead."),iE(e)}),iP=E.action(e=>{iS.aiTextEnabled=e}),iO=E.action(e=>{ik&&console.warn("useHtmlTextRender is deprecated. Use setRichTextEnabled instead."),iS.htmlRenderEnabled=e}),iA=E.action(e=>{iS.htmlRenderEnabled=e}),iI=E.action(e=>{iS.imageDownScalingEnabled=e}),iR=E.action(e=>{console.warn("useDownScaling is deprecated. Use setDownScalingEnabled instead."),iI(e)}),iL=E.action(e=>{console.warn("setForceTextFit is deprecated. Use setTextOverflow instead."),iS.textOverflow="change-font-size"}),iM=E.action(e=>{iS.textOverflow=e}),iN=E.action(e=>{iS.textSplitAllowed=e}),ij=E.action(e=>{iS.animationsEnabled=e}),iD=E.action(e=>{iS.autoDeleteEmptyText=e});function iz(e=""){return(e.match(/<\/p>/gi)||[]).length>1&&(e=e.replace(/<\/p>/gi,(e,t,n)=>(n.slice(t+e.length).match(/<\/p>/gi)||[]).length>0?"\n":e)),e.replace(/(<([^>]+)>)/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/ /g," ")}function iB(e){return e?/<[a-z][a-z0-9]*(\s[^>]*)?>[^<]*<\/[a-z][a-z0-9]*>/i.test(e)?e=(e=e.replace(/<(?![a-z/!])/gi,"<")).replace(/([^a-z0-9"'\s/])>/gi,"$1>"):e.replace(/</g,"<").replace(/>/g,">"):""}let iF={fontSize:14,fontFamily:"Roboto",fontWeight:"normal",fontStyle:"normal",lineHeight:1.2,letterSpacing:0,textTransform:"none",textDecoration:"",align:"center",fill:"black",stroke:"black",strokeWidth:0,curveEnabled:!1,curvePower:.5};function iH(e){return!function(e){e=e.replace(/\s/g,"");let t=0;for(var n=0;n<e.length;n++)(function(e){var t="֑-߿יִ-﷽ﹰ-ﻼ";return RegExp("^[^"+t+"]*?["+t+"]").test(e)})(e[n])&&(t+=1);return t>e.length/2}(e)?"ltr":"rtl"}function iV(e,t,n,r){let i=Math.max(-.9999,Math.min(.9999,n));if(1e-4>Math.abs(i))return`M 0 ${t/2} L ${e} ${t/2}`;let a=5*r/(2*Math.abs(i))-r,o=e/2;if(i>0){let e=2*a+r/2;return`M ${o} ${e} A ${a} ${a} 0 1 1 ${o} ${e-2*a} A ${a} ${a} 0 1 1 ${o} ${e}`}{let e=-(2*a-Math.round(t))-r/2;return`M ${o} ${e} A ${a} ${a} 0 1 0 ${o} ${e+2*a} A ${a} ${a} 0 1 0 ${o} ${e}`}}function iU(e,t,n,r){if(!rY(e))return"";let{stops:i,rotation:a}=rX(e),o=a*Math.PI/180,s=.5-.5*Math.sin(o),l=.5+.5*Math.cos(o),c=.5+.5*Math.sin(o),u=.5-.5*Math.cos(o),d=i.map(({offset:e,color:t})=>`<stop offset="${100*e}%" stop-color="${t}" />`).join("");return`<linearGradient id="${t}" x1="${100*s}%" y1="${100*l}%" x2="${100*c}%" y2="${100*u}%">${d}</linearGradient>`}function i$(e,{fontFamily:t="",color:n="black",forEditor:r=!1}={}){let i={...iF,...e},a=t||i.fontFamily,o=rY(i.fill),s=rY(i.stroke),l="ellipsis"===iS.textOverflow&&!r&&!i.curveEnabled&&!!i.height,c=(()=>{if(!l)return[];let e=Math.max(1,Math.round(i.height)),t=Math.max(1,Math.floor(e/Math.max(1,("number"==typeof i.lineHeight?i.lineHeight:1.2)*i.fontSize)));return[`max-height: ${e}px`,"overflow: hidden","display: -webkit-box","-webkit-box-orient: vertical",`-webkit-line-clamp: ${t}`,`line-clamp: ${t}`]})(),u=e=>`
|
|
21
|
+
`,nN={};function nj(e,t,n=nN){if(!nA&&"zIndex"in t&&(console.warn(nM),nA=!0),!nI&&t.draggable){var r=void 0!==t.x||void 0!==t.y,i=t.onDragEnd||t.onDragMove;r&&!i&&(console.warn(nL),nI=!0)}for(var a in n)if(!nO[a]){var o="on"===a.slice(0,2),s=n[a]!==t[a];if(o&&s){var l=a.substr(2).toLowerCase();"content"===l.substr(0,7)&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),e.off(l,n[a])}t.hasOwnProperty(a)||e.setAttr(a,void 0)}var c=t._useStrictMode,u={},d=!1;let h={};for(var a in t)if(!nO[a]){var o="on"===a.slice(0,2),f=n[a]!==t[a];if(o&&f){var l=a.substr(2).toLowerCase();"content"===l.substr(0,7)&&(l="content"+l.substr(7,1).toUpperCase()+l.substr(8)),t[a]&&(h[l]=t[a])}!o&&(t[a]!==n[a]||c&&t[a]!==e.getAttr(a))&&(d=!0,u[a]=t[a])}for(var l in d&&(e.setAttrs(u),nD(e)),h)e.on(l+nR,h[l])}function nD(e){if(!F.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}x("clk2u");let nz={},nB={};function nF(e,t){"string"==typeof t?console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`):(e.add(t),nD(e))}function nH(e,t,n){let r=tk[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=tk.Group);let i={},a={};for(var o in t)"on"===o.slice(0,2)?a[o]=t[o]:i[o]=t[o];let s=new r(i);return nj(s,a),s}function nV(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function nU(e,t,n){return!1}function n$(e){return e}function nq(){return null}function nW(){return null}function nG(e,t,n,r){return nB}function nK(){}function nY(e){}function nX(e,t){return!1}function nQ(){return nz}function nZ(){return nz}tk.Node.prototype._applyProps=nj;let nJ=setTimeout,n0=clearTimeout,n1=-1;function n2(e,t){return!1}let n4=!1,n3=!0,n8=!0;function n6(e,t){t.parent===e?t.moveToTop():e.add(t),nD(e)}function n5(e,t){t.parent===e?t.moveToTop():e.add(t),nD(e)}function n9(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),nD(e)}function n7(e,t,n){n9(e,t,n)}function re(e,t){t.destroy(),t.off(nR),nD(e)}function rt(e,t){t.destroy(),t.off(nR),nD(e)}function rn(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function rr(e,t,n){}function ri(e,t,n,r,i){nj(e,i,r)}function ra(e){e.hide(),nD(e)}function ro(e){}function rs(e,t){(null==t.visible||t.visible)&&e.show()}function rl(e,t){}function rc(e){}function ru(){}let rd=()=>nT.DefaultEventPriority;var S=x("8NFma"),rh=Object.defineProperty,rf=Object.defineProperties,rp=Object.getOwnPropertyDescriptors,rm=Object.getOwnPropertySymbols,rg=Object.prototype.hasOwnProperty,ry=Object.prototype.propertyIsEnumerable,rv=(e,t,n)=>t in e?rh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rb=(e,t)=>{for(var n in t||(t={}))rg.call(t,n)&&rv(e,n,t[n]);if(rm)for(var n of rm(t))ry.call(t,n)&&rv(e,n,t[n]);return e};function rx(e){try{return Object.defineProperties(e,{_currentRenderer:{get:()=>null,set(){}},_currentRenderer2:{get:()=>null,set(){}}})}catch(t){return e}}"u">typeof window&&((null==(jx=window.document)?void 0:jx.createElement)||(null==(jw=window.navigator)?void 0:jw.product)==="ReactNative")?S.useLayoutEffect:S.useEffect;let rw=console.error;console.error=function(){let e=[...arguments].join("");if((null==e?void 0:e.startsWith("Warning:"))&&e.includes("useContext")){console.error=rw;return}return rw.apply(this,arguments)};let rC=rx(S.createContext(null));class rS extends S.Component{render(){return S.createElement(rC.Provider,{value:this._reactInternals},this.props.children)}}function rk(){let e=function(){let e=function(){let e=S.useContext(rC);if(null===e)throw Error("its-fine: useFiber must be called within a <FiberProvider />!");let t=S.useId();return S.useMemo(()=>{for(let n of[e,null==e?void 0:e.alternate]){if(!n)continue;let e=function e(t,n,r){if(!t)return;if(!0===r(t))return t;let i=n?t.return:t.child;for(;i;){let t=e(i,n,r);if(t)return t;i=n?null:i.sibling}}(n,!1,e=>{let n=e.memoizedState;for(;n;){if(n.memoizedState===t)return!0;n=n.next}});if(e)return e}},[e,t])}(),[t]=S.useState(()=>new Map);t.clear();let n=e;for(;n;){if(n.type&&"object"==typeof n.type){let e=void 0===n.type._context&&n.type.Provider===n.type?n.type:n.type._context;e&&e!==rC&&!t.has(e)&&t.set(e,S.useContext(rx(e)))}n=n.return}return t}();return S.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>S.createElement(t,null,S.createElement(n.Provider,rf(rb({},r),rp({value:e.get(n)})))),e=>S.createElement(rS,rb({},e))),[e])}let r_=e=>{let t,n=m(S).useRef(null),r=m(S).useRef(null),i=m(S).useRef(null),a=(t=m(S).useRef({}),m(S).useLayoutEffect(()=>{t.current=e}),m(S).useLayoutEffect(()=>()=>{t.current={}},[]),t.current),o=rk(),s=t=>{let{forwardedRef:n}=e;n&&("function"==typeof n?n(t):n.current=t)};return m(S).useLayoutEffect(()=>(r.current=new tk.Stage({width:e.width,height:e.height,container:n.current}),s(r.current),i.current=rM.createContainer(r.current,nT.LegacyRoot,!1,null),rM.updateContainer(m(S).createElement(o,{},e.children),i.current),()=>{tk.isBrowser&&(s(null),rM.updateContainer(null,i.current,null),r.current.destroy())}),[]),m(S).useLayoutEffect(()=>{s(r.current),nj(r.current,e,a),rM.updateContainer(m(S).createElement(o,{},e.children),i.current,null)}),m(S).createElement("div",{ref:n,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},rE="Group",rT="Label",rP="Rect",rO="Line",rA="Image",rI="Text",rR="Path",rL="Transformer",rM=m(nE)(nP);rM.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:m(S).version,rendererPackageName:"react-konva"});let rN=m(S).forwardRef((e,t)=>m(S).createElement(rS,{},m(S).createElement(r_,{...e,forwardedRef:t})));var rj={},S=x("8NFma");rj=function(e,t,n){let r=S.useRef("loading"),i=S.useRef(),[a,o]=S.useState(0),s=S.useRef(),l=S.useRef(),c=S.useRef();return(s.current!==e||l.current!==t||c.current!==n)&&(r.current="loading",i.current=void 0,s.current=e,l.current=t,c.current=n),S.useLayoutEffect(function(){if(e){var a=document.createElement("img");return a.addEventListener("load",s),a.addEventListener("error",l),t&&(a.crossOrigin=t),n&&(a.referrerPolicy=n),a.src=e,function(){a.removeEventListener("load",s),a.removeEventListener("error",l)}}function s(){a.decode().catch(()=>{}).finally(()=>{r.current="loaded",i.current=a,o(Math.random())})}function l(){r.current="failed",i.current=void 0,o(Math.random())}},[e,t,n]),[i.current,r.current]};var S=(x("8NFma"),x("8NFma"),x("8NFma")),rD=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};let rz=({children:e,groupProps:t,divProps:n,transform:r,transformFunc:i,parentNodeFunc:a})=>{let o=rk(),s=m(S).useRef(null),[l]=m(S).useState(()=>document.createElement("div")),c=m(S).useMemo(()=>m(k).createRoot(l),[l]),u=null==r||r,d=function(e=()=>{}){let t=m(S).useRef(e);return t.current=e,m(S).useCallback((...e)=>t.current.apply(null,e),[])}(()=>{if(u&&s.current){let e=s.current.getAbsoluteTransform().decompose();i&&(e=i(e)),l.style.position="absolute",l.style.zIndex="10",l.style.top="0px",l.style.left="0px",l.style.transform=`translate(${e.x}px, ${e.y}px) rotate(${e.rotation}deg) scaleX(${e.scaleX}) scaleY(${e.scaleY})`,l.style.transformOrigin="top left"}else l.style.position="",l.style.zIndex="",l.style.top="",l.style.left="",l.style.transform="",l.style.transformOrigin="";let e=n||{},{style:t}=e,r=rD(e,["style"]);Object.assign(l.style,t),Object.assign(l,r)});return m(S).useLayoutEffect(()=>{var e;let t=s.current;if(!t)return;let n=a?a({stage:t.getStage()}):null==(e=t.getStage())?void 0:e.container();if(n){let e;return n.appendChild(l),u&&"absolute"!==(e=window.getComputedStyle(n).position)&&"relative"!==e&&(n.style.position="relative"),t.on("absoluteTransformChange",d),d(),()=>{var e;t.off("absoluteTransformChange",d),null==(e=l.parentNode)||e.removeChild(l)}}},[u,a]),m(S).useLayoutEffect(()=>{d()},[n,i]),m(S).useLayoutEffect(()=>{queueMicrotask(()=>{(0,_.flushSync)(()=>{c.render(m(S).createElement(o,null,e))})})}),m(S).useLayoutEffect(()=>()=>{setTimeout(()=>{c.unmount()})},[]),m(S).createElement(rE,Object.assign({ref:s},t))};var S=x("8NFma");let rB=({selector:e,enabled:t,children:n})=>{let r=m(S).useRef(null),i=m(S).useRef(null),a=m(S).useRef(null),o=null==t||t;return m(S).useLayoutEffect(()=>{if(!r.current||!i.current)return;a.current=i.current;let t=r.current.getStage().findOne(e);o&&t?i.current.moveTo(t):i.current.moveTo(r.current);let n=r.current.getLayer();if(n&&(n.batchDraw(),t)){let e=t.getLayer();if(!e)return;e.batchDraw()}},[e,o]),m(S).useEffect(()=>()=>{var e;null==(e=a.current)||e.destroy()},[]),m(S).createElement(rE,{name:"_outer_portal",ref:r},m(S).createElement(rE,{name:"_inner_portal",ref:i},n))};var E=x("2SBKn");function rF(e,t,n){let r=n[t-1]||{values:{x:0,y:0}};if(e.marker===e.marker.toLowerCase())switch(e.marker=e.marker.toUpperCase(),e.marker){case"M":case"L":case"A":case"T":e.values.x+=r.values.x,e.values.y+=r.values.y;break;case"H":e.marker="L",e.values.x+=r.values.x,e.values.y=r.values.y;break;case"V":e.marker="L",e.values.x=r.values.x,e.values.y+=r.values.y;break;case"C":e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x1+=r.values.x,e.values.y1+=r.values.y,e.values.x2+=r.values.x,e.values.y2+=r.values.y;break;case"S":e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x2+=r.values.x,e.values.y2+=r.values.y;break;case"Q":e.values.x+=r.values.x,e.values.y+=r.values.y,e.values.x1+=r.values.x,e.values.y1+=r.values.y}else if(e.marker===e.marker.toUpperCase())switch(e.marker){case"H":e.marker="L",e.values.y=r.values.y;break;case"V":e.marker="L",e.values.x=r.values.x}if("Z"===e.marker){let r=function e(t,n){return"M"===t[n].marker?t[n]:e(t,n-1)}(n,t);e.values.x=r.values.x,e.values.y=r.values.y}return e}function rH(e,t,n){if(0!==t&&"L"===e.marker){let r=n[t-1];["x","y"].every(t=>0===Math.round(Math.abs(r.values[t]-e.values[t])))&&(e.overlap=!0)}return e}function rV(e,t){return Math.atan2(t.x-e.x,t.y-e.y)}function rU(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function r$(e,t){let n=t/Math.tan(e);return n===1/0||n===-1/0||isNaN(n)?t:n}function rq(e){let t=/-?[0-9]*\.?\d+/g;return[...e.matchAll(/[MmLlSsQqLlHhVvCcSsQqTtAaZz]/g)].map(e=>({marker:e[0],index:e.index})).reduceRight((t,n)=>{let r=e.substring(n.index,t.length?t[t.length-1].index:e.length);return t.concat([{marker:n.marker,index:n.index,chunk:r.length>0?r.substr(1,r.length-1):r}])},[]).reverse().flatMap(e=>{let n=e.chunk.match(t),r=n?n.map(parseFloat):[];return function(e,t){let n=[];switch(e.toUpperCase()){case"M":for(let r=0;r<t.length;r+=2){let i;i=e===e.toUpperCase()?0===r?"M":"L":0===r?"m":"l",n.push({marker:i,values:{x:t[r],y:t[r+1]}})}break;case"L":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"H":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:t[r],y:0}});break;case"V":for(let r=0;r<t.length;r++)n.push({marker:e,values:{x:0,y:t[r]}});break;case"C":for(let r=0;r<t.length;r+=6)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x2:t[r+2],y2:t[r+3],x:t[r+4],y:t[r+5]}});break;case"S":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x2:t[r],y2:t[r+1],x:t[r+2],y:t[r+3]}});break;case"Q":for(let r=0;r<t.length;r+=4)n.push({marker:e,values:{x1:t[r],y1:t[r+1],x:t[r+2],y:t[r+3]}});break;case"T":for(let r=0;r<t.length;r+=2)n.push({marker:e,values:{x:t[r],y:t[r+1]}});break;case"A":for(let r=0;r<t.length;r+=7)n.push({marker:e,values:{radiusX:t[r],radiusY:t[r+1],rotation:t[r+2],largeArc:t[r+3],sweep:t[r+4],x:t[r+5],y:t[r+6]}});break;case"Z":n.push({marker:e,values:{x:0,y:0}})}return n}(e.marker,r)}).map(rF)}function rW(e,t,n){let r,i=[],a=[];return n&&e.forEach(e=>(Object.keys(e.values).forEach(t=>e.values[t]=e.values[t]&&parseFloat(e.values[t].toFixed(n))),e)),e.forEach(e=>{"M"===e.marker&&i.push([]),i[i.length-1].push(e)}),i.forEach(e=>{e.map(rH),function e(t,n){let r=["x","y"].every(e=>0===Math.round(Math.abs(t[n].values[e]-t[0].values[e])));"L"===t[n].marker&&r&&(t[n].overlap=!0,e(t,n-1)),"Z"===t[n].marker&&e(t,n-1)}(e,e.length-1);let n="Z"==e[e.length-1].marker;e.filter(e=>!e.overlap).map((e,r,i)=>{let o,s,l,c,u=function e(t,n,r){var i;let a=n-1,o=r[(a%(i=r.length)+i)%i];return"Z"!==o.marker?o:e(t,a,r)}(e,r,i),d=function e(t,n,r){var i;let a=n+1,o=r[(a%(i=r.length)+i)%i];return"Z"===o.marker?e(t,a,r):o}(e,r,i),h=rV(e.values,u.values),f=rV(e.values,d.values),p=f-h,m=180/Math.PI*p,g=Math.min(t,Math.abs((o=rU(e.values,d.values),Math.min(rU(u.values,e.values),o)/2*Math.tan(p/2)))),y=(l=0,(c=180/Math.PI*p)<0&&c>=-180||c>180&&c<360?s=r$(p/2,-g):(s=r$(p/2,g),l=1,s===1/0&&(s=g)),{offset:s,sweepFlag:l}),v=y.offset,b=y.sweepFlag,x=(0==r||r==i.length-1)&&!n;switch(e.marker){case"M":case"L":let w=[e.values.x+Math.sin(h)*v,e.values.y+Math.cos(h)*v],C=[e.values.x+Math.sin(f)*v,e.values.y+Math.cos(f)*v];x?a.push({marker:e.marker,values:e.values}):a.push({marker:e.marker,values:{x:parseFloat(w[0].toFixed(3)),y:parseFloat(w[1].toFixed(3))}}),x||"L"!==d.marker&&"M"!==d.marker||a.push({marker:"A",radius:g,values:{radiusX:parseFloat(g.toFixed(3)),radiusY:parseFloat(g.toFixed(3)),rotation:m,largeArc:0,sweep:b,x:parseFloat(C[0].toFixed(3)),y:parseFloat(C[1].toFixed(3))}});break;case"C":case"S":case"Q":case"T":case"A":case"Z":a.push({marker:e.marker,values:e.values})}})}),{path:(r=["radiusX","radiusY","rotation","largeArc","sweep","x1","y1","x2","y2","x","y"],a.map(e=>{let t="";if("Z"!==e.marker){let n=Object.keys(e.values);t=r.filter(e=>-1!==n.indexOf(e)).map(t=>e.values[t]).join()}return`${e.marker}${t}`}).join("").trim()),commands:a}}var S=x("8NFma"),rG={};h(rG,"parse",()=>jC,e=>jC=e),h(rG,"stringify",()=>jS,e=>jS=e);var rK=rK||{};rK.stringify=(N$={"visit_linear-gradient":function(e){return N$.visit_gradient(e)},"visit_repeating-linear-gradient":function(e){return N$.visit_gradient(e)},"visit_radial-gradient":function(e){return N$.visit_gradient(e)},"visit_repeating-radial-gradient":function(e){return N$.visit_gradient(e)},visit_gradient:function(e){var t=N$.visit(e.orientation);return t&&(t+=", "),e.type+"("+t+N$.visit(e.colorStops)+")"},visit_shape:function(e){var t=e.value,n=N$.visit(e.at),r=N$.visit(e.style);return r&&(t+=" "+r),n&&(t+=" at "+n),t},"visit_default-radial":function(e){var t="",n=N$.visit(e.at);return n&&(t+=n),t},"visit_extent-keyword":function(e){var t=e.value,n=N$.visit(e.at);return n&&(t+=" at "+n),t},"visit_position-keyword":function(e){return e.value},visit_position:function(e){return N$.visit(e.value.x)+" "+N$.visit(e.value.y)},"visit_%":function(e){return e.value+"%"},visit_em:function(e){return e.value+"em"},visit_px:function(e){return e.value+"px"},visit_calc:function(e){return"calc("+e.value+")"},visit_literal:function(e){return N$.visit_color(e.value,e)},visit_hex:function(e){return N$.visit_color("#"+e.value,e)},visit_rgb:function(e){return N$.visit_color("rgb("+e.value.join(", ")+")",e)},visit_rgba:function(e){return N$.visit_color("rgba("+e.value.join(", ")+")",e)},visit_hsl:function(e){return N$.visit_color("hsl("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%)",e)},visit_hsla:function(e){return N$.visit_color("hsla("+e.value[0]+", "+e.value[1]+"%, "+e.value[2]+"%, "+e.value[3]+")",e)},visit_var:function(e){return N$.visit_color("var("+e.value+")",e)},visit_color:function(e,t){var n=e,r=N$.visit(t.length);return r&&(n+=" "+r),n},visit_angular:function(e){return e.value+"deg"},visit_directional:function(e){return"to "+e.value},visit_array:function(e){var t="",n=e.length;return e.forEach(function(e,r){t+=N$.visit(e),r<n-1&&(t+=", ")}),t},visit_object:function(e){return e.width&&e.height?N$.visit(e.width)+" "+N$.visit(e.height):""},visit:function(e){if(!e)return"";if(e instanceof Array)return N$.visit_array(e);if("object"==typeof e&&!e.type)return N$.visit_object(e);if(e.type){var t=N$["visit_"+e.type];if(t)return t(e);throw Error("Missing visitor visit_"+e.type)}throw Error("Invalid node.")}},function(e){return N$.visit(e)});var rK=rK||{};rK.parse=function(){var e=/^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,t=/^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,n=/^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,r=/^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,i=/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,a=/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,o=/^(left|center|right|top|bottom)/i,s=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,l=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,c=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,u=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,d=/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))rad/,h=/^\(/,f=/^\)/,p=/^,/,m=/^\#([0-9a-fA-F]+)/,g=/^([a-zA-Z]+)/,y=/^rgb/i,v=/^rgba/i,b=/^var/i,x=/^calc/i,w=/^(--[a-zA-Z0-9-,\s\#]+)/,C=/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/,S=/^hsl/i,k=/^hsla/i,_="";function E(e){var t=Error(_+": "+e);throw t.source=_,t}function T(){return P("linear-gradient",e,A)||P("repeating-linear-gradient",t,A)||P("radial-gradient",n,I)||P("repeating-radial-gradient",r,I)}function P(e,t,n){return O(t,function(t){var r=n();return r&&!V(p)&&E("Missing comma before color stops"),{type:e,orientation:r,colorStops:j(D)}})}function O(e,t){var n=V(e);if(n){V(h)||E("Missing (");var r=t(n);return V(f)||E("Missing )"),r}}function A(){var e=H("directional",i,1);if(e)return e;var t=H("position-keyword",o,1);return t?{type:"directional",value:t.value}:H("angular",u,1)||H("angular",d,1)}function I(){var e,t,n=R();return n&&((e=[]).push(n),t=_,V(p)&&((n=R())?e.push(n):_=t)),e}function R(){var e,t,n=((e=H("shape",/^(circle)/i,0))&&(e.style=F()||L()),e||((t=H("shape",/^(ellipse)/i,0))&&(t.style=N()||B()||L()),t));if(n)n.at=M();else{var r=L();if(r){n=r;var i=M();i&&(n.at=i)}else{var a=M();if(a)n={type:"default-radial",at:a};else{var o=N();o&&(n={type:"default-radial",at:o})}}}return n}function L(){return H("extent-keyword",a,1)}function M(){if(H("position",/^at/,0)){var e=N();return e||E("Missing positioning value"),e}}function N(){var e={x:B(),y:B()};if(e.x||e.y)return{type:"position",value:e}}function j(e){var t=e(),n=[];if(t)for(n.push(t);V(p);)(t=e())?n.push(t):E("One extra comma");return n}function D(){var e=H("hex",m,1)||O(k,function(){var e=z();V(p);var t=V(l),n=t?t[1]:null;V(p);var r=(t=V(l))?t[1]:null;V(p);var i=z();return n&&r||E("Expected percentage value for saturation and lightness in HSLA"),{type:"hsla",value:[e,n,r,i]}})||O(S,function(){V(l)&&E("HSL hue value must be a number in degrees (0-360) or normalized (-360 to 360), not a percentage");var e=z();V(p);var t=V(l),n=t?t[1]:null;V(p);var r=(t=V(l))?t[1]:null;return n&&r||E("Expected percentage value for saturation and lightness in HSL"),{type:"hsl",value:[e,n,r]}})||O(v,function(){return{type:"rgba",value:j(z)}})||O(y,function(){return{type:"rgb",value:j(z)}})||O(b,function(){return{type:"var",value:V(w)[1]}})||H("literal",g,0);return e||E("Expected color definition"),e.length=B(),e}function z(){return V(C)[1]}function B(){return H("%",l,1)||H("position-keyword",o,1)||O(x,function(){for(var e=1,t=0;e>0&&t<_.length;){var n=_.charAt(t);"("===n?e++:")"===n&&e--,t++}e>0&&E("Missing closing parenthesis in calc() expression");var r=_.substring(0,t-1);return U(t-1),{type:"calc",value:r}})||F()}function F(){return H("px",s,1)||H("em",c,1)}function H(e,t,n){var r=V(t);if(r)return{type:e,value:r[n]}}function V(e){var t,n;return(n=/^[\n\r\t\s]+/.exec(_))&&U(n[0].length),(t=e.exec(_))&&U(t[0].length),t}function U(e){_=_.substr(e)}return function(e){var t;return(_=e.toString().trim()).endsWith(";")&&(_=_.slice(0,-1)),t=j(T),_.length>0&&E("Invalid input not EOF"),t}}(),jC=rK.parse,jS=rK.stringify;let rY=e=>e.indexOf("linear-gradient")>=0,rX=e=>{if(!rY(e))return{rotation:0,stops:[{offset:0,color:e},{offset:1,color:e}]};let t=m(rG).parse(e)[0];return{rotation:t.orientation&&"value"in t.orientation?parseFloat(t.orientation.value):0,stops:t.colorStops.map((e,n)=>({color:"hex"===e.type?"#"+e.value:"literal"===e.type?e.value:`${e.type}(${e.value.join(",")})`,offset:e.length?parseFloat(e.length.value)/100:n/(t.colorStops.length-1)}))}},rQ=(e,t=e.fill??"",n="fill")=>m(S).useMemo(()=>{if(!rY(t))return{[n]:t};let{stops:r,rotation:i}=rX(t),a={x:e.a.width/2,y:e.a.height/2},o=(i%180+180)%180,s=o>45&&o<135?e.a.width:e.a.height,l=n_.Util.degToRad(i)-Math.PI/2,c=[];return(r.forEach(({offset:e,color:t})=>{c.push(e,t)}),"fill"===n)?{fillLinearGradientStartPointX:a.x-s/2*Math.cos(l),fillLinearGradientStartPointY:a.y-s/2*Math.sin(l),fillLinearGradientColorStops:c,fillLinearGradientEndPointX:a.x+s/2*Math.cos(l),fillLinearGradientEndPointY:a.y+s/2*Math.sin(l),fill:r[1].color,fillPriority:"linear-gradient"}:{strokeLinearGradientStartPointX:a.x-s/2*Math.cos(l),strokeLinearGradientStartPointY:a.y-s/2*Math.sin(l),strokeLinearGradientColorStops:c,strokeLinearGradientEndPointX:a.x+s/2*Math.cos(l),strokeLinearGradientEndPointY:a.y+s/2*Math.sin(l)}},[t,e.width,e.height]);var S=x("8NFma");let rZ=!1,rJ=(e=!rZ)=>{rZ=e};function r0(e,t){let n=m(S).useRef();m(S).useLayoutEffect(()=>{n.current&&n.current.destroy()},[t]),m(S).useLayoutEffect(()=>{if(!rZ)return;let t=e.current.opacity();if(t)return e.current.opacity(0),n.current=new n_.Tween({node:e.current,opacity:t,onFinish:()=>{n.current?.destroy()}}),n.current.play(),()=>{n.current?.destroy()}},[])}let r1=0,r2=[],r4=3e4,r3=e=>{r4=e},r8=6e3,r6=e=>{r8=e};function r5(e){r1+=1;let t=!1,n=!1,r=setTimeout(()=>{t||(it(`Timeout loading asset ${e}`),console.error("Timeout triggered for loader. Some assets may not have loaded.",e),t=!0,r9())},r4);return()=>{n?console.error("Finish called twice! That is not expected. id: ",e):(n=!0,t||(clearTimeout(r),r9()))}}function r9(){0==(r1-=1)&&(r2.forEach(e=>e()),r2=[])}let r7=[];function ie(e){r7.push(e)}function it(e){r7.forEach(t=>t(e))}var E=x("2SBKn");let ir=E.observable(["Roboto","Amatic SC","Press Start 2P","Marck Script","Rubik Mono One"]),ii=E.observable({value:!1});function ia(){return ii.value}function io(e){if("default"===e){ii.value=!1;return}ii.value=!0,ir.splice(0,ir.length),ir.push(...e)}let is=E.observable([]);function il(e){is.push(e)}function ic(e){let t=is.findIndex(t=>t.fontFamily===e);-1!==t&&is.splice(t,1)}function iu(e){is.replace(e)}var id="Some test text;?#D-ПРИВЕТ!1230o9u8i7y6t5r4e3w2q1";function ih(e,t="sans-serif",n="normal",i="normal"){r||(r=document.createElement("canvas"));var a=r.getContext("2d");return a.font=`${n} ${i} 40px '${e}', ${t}`,a.measureText(id).width}let ip={Arial:!0},im=(e,t,n)=>t&&n?!!ip[`${e}_${t}_${n}`]:Object.keys(ip).some(t=>t.startsWith(e+"_"))||!!ip[e];async function ig(e,t,n){let i=`${e}_${t}_${n}`;if(ip[i])return;let a=!!document.fonts?.load,o=function(e="normal",t="normal"){r||(r=document.createElement("canvas"));var n=r.getContext("2d");return n.font=`${e} ${t} 40px sans-serif`,n.measureText(id).width}(t,n);if(a)try{await document.fonts.load(`${t} ${n} 16px '${e}'`);let r=ih(e,"sans-serif",t,n);if(o!==r){ip[i]=!0;return}}catch{}let s=function(e="normal",t="normal"){r||(r=document.createElement("canvas"));var n=r.getContext("2d");return n.font=`${e} ${t} 40px serif`,n.measureText(id).width}(t,n),l=ih(e,"sans-serif",t,n),c=Math.min(6e3,r8)/60;for(let r=0;r<c;r++){let r=ih(e,"sans-serif",t,n),a=ih(e,"serif",t,n);if(r!==l||r!==o||a!==s){await new Promise(e=>setTimeout(e,100)),ip[i]=!0;return}await new Promise(e=>setTimeout(e,60))}console.warn(`Timeout for loading font "${e}". Looks like polotno can't load it. Is it a correct font family?`),it(`Timeout for loading font "${e}"`)}let iy={},iv="400,400italic,700,700italic";function ib(e){iv=e}function ix(e){let t=e.replace(/ /g,"+");return`https://fonts.googleapis.com/css?family=${t}:${iv}`}let iw={};var E=x("2SBKn"),iC=x("ibaza");let iS=E.observable({imageDownScalingEnabled:!0,removeBackgroundEnabled:!1,htmlRenderEnabled:!1,forceTextFitEnabled:!1,textVerticalResizeEnabled:!1,textOverflow:"resize",textSplitAllowed:!1,animationsEnabled:!1,aiTextEnabled:!1,autoDeleteEmptyText:!0}),ik="u">typeof window&&"localhost"===window.location.hostname,i_=E.action(e=>{iS.textVerticalResizeEnabled=e}),iE=E.action(e=>{iS.removeBackgroundEnabled=e}),iT=E.action(e=>{ik&&console.warn("useRemoveBackground is deprecated. Use setRemoveBackgroundEnabled instead."),iE(e)}),iP=E.action(e=>{iS.aiTextEnabled=e}),iO=E.action(e=>{ik&&console.warn("useHtmlTextRender is deprecated. Use setRichTextEnabled instead."),iS.htmlRenderEnabled=e}),iA=E.action(e=>{iS.htmlRenderEnabled=e}),iI=E.action(e=>{iS.imageDownScalingEnabled=e}),iR=E.action(e=>{console.warn("useDownScaling is deprecated. Use setDownScalingEnabled instead."),iI(e)}),iL=E.action(e=>{console.warn("setForceTextFit is deprecated. Use setTextOverflow instead."),iS.textOverflow="change-font-size"}),iM=E.action(e=>{iS.textOverflow=e}),iN=E.action(e=>{iS.textSplitAllowed=e}),ij=E.action(e=>{iS.animationsEnabled=e}),iD=E.action(e=>{iS.autoDeleteEmptyText=e});function iz(e=""){return(e.match(/<\/p>/gi)||[]).length>1&&(e=e.replace(/<\/p>/gi,(e,t,n)=>(n.slice(t+e.length).match(/<\/p>/gi)||[]).length>0?"\n":e)),e.replace(/(<([^>]+)>)/gi,"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/ /g," ")}function iB(e){return e?/<[a-z][a-z0-9]*(\s[^>]*)?>[^<]*<\/[a-z][a-z0-9]*>/i.test(e)?e=(e=e.replace(/<(?![a-z/!])/gi,"<")).replace(/([^a-z0-9"'\s/])>/gi,"$1>"):e.replace(/</g,"<").replace(/>/g,">"):""}let iF={fontSize:14,fontFamily:"Roboto",fontWeight:"normal",fontStyle:"normal",lineHeight:1.2,letterSpacing:0,textTransform:"none",textDecoration:"",align:"center",fill:"black",stroke:"black",strokeWidth:0,curveEnabled:!1,curvePower:.5};function iH(e){return!function(e){e=e.replace(/\s/g,"");let t=0;for(var n=0;n<e.length;n++)(function(e){var t="֑-߿יִ-﷽ﹰ-ﻼ";return RegExp("^[^"+t+"]*?["+t+"]").test(e)})(e[n])&&(t+=1);return t>e.length/2}(e)?"ltr":"rtl"}function iV(e,t,n,r){let i=Math.max(-.9999,Math.min(.9999,n));if(1e-4>Math.abs(i))return`M 0 ${t/2} L ${e} ${t/2}`;let a=5*r/(2*Math.abs(i))-r,o=e/2;if(i>0){let e=2*a+r/2;return`M ${o} ${e} A ${a} ${a} 0 1 1 ${o} ${e-2*a} A ${a} ${a} 0 1 1 ${o} ${e}`}{let e=-(2*a-Math.round(t))-r/2;return`M ${o} ${e} A ${a} ${a} 0 1 0 ${o} ${e+2*a} A ${a} ${a} 0 1 0 ${o} ${e}`}}function iU(e,t,n,r){if(!rY(e))return"";let{stops:i,rotation:a}=rX(e),o=a*Math.PI/180,s=.5-.5*Math.sin(o),l=.5+.5*Math.cos(o),c=.5+.5*Math.sin(o),u=.5-.5*Math.cos(o),d=i.map(({offset:e,color:t})=>`<stop offset="${100*e}%" stop-color="${t}" />`).join("");return`<linearGradient id="${t}" x1="${100*s}%" y1="${100*l}%" x2="${100*c}%" y2="${100*u}%">${d}</linearGradient>`}function i$(e,{fontFamily:t="",color:n="black",forEditor:r=!1}={}){let i={...iF,...e},a=t||i.fontFamily,o=rY(i.fill),s=rY(i.stroke),l="ellipsis"===iS.textOverflow&&!r&&!i.curveEnabled&&!!i.height,c=(()=>{if(!l)return[];let e=Math.max(1,Math.round(i.height)),t=Math.max(1,Math.floor(e/Math.max(1,("number"==typeof i.lineHeight?i.lineHeight:1.2)*i.fontSize)));return[`max-height: ${e}px`,"overflow: hidden","display: -webkit-box","-webkit-box-orient: vertical",`-webkit-line-clamp: ${t}`,`line-clamp: ${t}`]})(),u=e=>`
|
|
22
22
|
background-image: ${e};
|
|
23
23
|
background-size: 100% 100%;
|
|
24
24
|
background-repeat: repeat;
|
|
@@ -71,7 +71,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
|
71
71
|
color: ${o.color};
|
|
72
72
|
opacity: 0.6;
|
|
73
73
|
}
|
|
74
|
-
`,r=(a||(a=document.getElementById("polotno-text-style"))||((a=document.createElement("style")).id="polotno-text-style",document.head.appendChild(a)),a);r.innerHTML="",r.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(o)&&s(e)});let c=m(S).useRef(null);if(m(S).useLayoutEffect(()=>{let e=c.current;if(!e)return;c.current?.focus();let t=i||e.value.length;e.selectionStart=e.selectionEnd=t,r&&(e?.select(),document.execCommand("selectAll",!1,void 0))},[]),m(S).useEffect(()=>{window.addEventListener("blur",n);let e=e=>{c.current?.contains(e.target)||n()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",n),window.removeEventListener("touchstart",e)}},[]),!l)return null;let u=0,d=l.textArr.length*l.lineHeight()*l.fontSize();"middle"===t.verticalAlign&&(u=(t.a.height-d)/2),"bottom"===t.verticalAlign&&(u=t.a.height-d);let h=iz(t.text);return(0,C.jsx)("textarea",{className:"polotno-input",ref:c,dir:iH(h),style:{...iJ,...o,paddingTop:u+"px"},value:h,onChange:e=>{let n=iX({oldText:t.text,newText:e.target.value,element:t});t.set({text:e.target.value,fontSize:n})},placeholder:t.placeholder,onBlur:n})}),i1=e=>(0,C.jsx)(rz,{children:(0,C.jsx)(i0,{...e})}),i2=(e,t)=>{let[n,r]=m(S).useReducer(e=>e+1,0),i=m(S).useRef(im(t)),a=m(S).useRef(null);return m(S).useLayoutEffect(()=>{if(i.current=im(t),i.current)return;let n=!0;return(async()=>{i.current=!1,r();let o=r5(`text ${t}`);(await e.loadFont(t),n)?(a.current=o,i.current=!0,r()):o()})(),()=>{a.current&&(a.current(),a.current=null),n=!1}},[t]),m(S).useEffect(()=>{i.current&&setTimeout(()=>{a.current&&(a.current(),a.current=null)})},[i.current]),[i.current]},i4=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>m(S).useMemo(()=>(function({fontFamily:e,fontSize:t,lineHeight:n}){if("number"==typeof n)return n;let r=document.createElement("div");r.style.fontFamily=e,r.style.fontSize=t+"px",r.style.lineHeight=n,r.innerText="Test text",document.body.appendChild(r);let i=r.offsetHeight;return document.body.removeChild(r),i/t})({fontFamily:t,fontSize:n,lineHeight:r}),[e,t,n,r]);function i3(e){let t=m(S).useRef(e),n=m(S).useRef(e);return m(S).useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}let i8=j(({element:e,store:t})=>{let n=m(S).useRef(null),r=m(S).useRef(null),i=m(S).useRef(null),a=m(S).useRef([]),[,o]=m(S).useReducer(e=>e+1,0),{editorEnabled:s,selectAll:l}=(e=>{let[t,n]=m(S).useState(!1),r=m(S).useRef(!1);return m(S).useEffect(()=>{var t=!0;return setTimeout(()=>{t&&(e._editModeEnabled&&(r.current=!0),n(!0),setTimeout(()=>{r.current=!1},50))},50),()=>{t=!1}},[]),{editorEnabled:t&&e._editModeEnabled,selectAll:r.current}})(e),[c,u]=m(S).useState(!1),d=m(S).useRef(e.a.height),h=t.selectedShapes.indexOf(e)>=0&&e.selectable,f=i3(h),{textVerticalResizeEnabled:p}=iS,g=iS.autoDeleteEmptyText,y=i3(e.fontFamily),[v,b]=m(S).useState([]);m(S).useEffect(()=>{let e=n.current?.textArr??[];JSON.stringify(e)!==JSON.stringify(v)&&b(e)}),m(S).useEffect(()=>{if(e.a.width)return;let t=n.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),m(S).useEffect(()=>{f&&!h&&g&&""===e.text&&e.removable&&!e.placeholder&&t.deleteElements([e.id])},[g,e.placeholder,e.removable,e.text,h,f]),m(S).useLayoutEffect(()=>(0,E.autorun)(()=>{iW(n.current,e)})),m(S).useEffect(()=>{let e=a.current;e.length>0&&(a.current=[],e.forEach(e=>e()))});let[x]=i2(t,e.fontFamily),w=iz(e.text);"uppercase"===e.textTransform&&(w=w.toUpperCase());let k=()=>{if(e.curveEnabled){let e=r.current;return e.getSelfRect().height||e.fontSize()}let t=n.current.clone({height:void 0}),i=Math.ceil(t.fontSize()*t.lineHeight()*t.textArr.length+1);return t.destroy(),i};m(S).useLayoutEffect(()=>{if(!x)return;let{textOverflow:r,textSplitAllowed:i}=iS,s=(n,...r)=>{let i=r5(`text ${e.id} before ignore`);t.history.ignore(n,...r).then(()=>{a.current.push(i),o()})};if(!e.height){let t=k();s(()=>{e.set({height:t})});return}if(!t.isPlaying)if("change-font-size"!==r||c){if("resize"===r){let t=k();p&&e.height<t&&!c&&s(()=>{(0,iY.isAlive)(e)&&e.set({height:t}),n.current?.height(t)},!1,!0),p||e.height===t||c||s(()=>{(0,iY.isAlive)(e)&&e.set({height:t}),n.current?.height(t)},!1,!0)}}else{let t=function(e,t,n=!1){let r=e.fontSize(),i=e.height(),a=iz(t.text),o=t.a.fontSize;e.height(void 0);let s=Math.round(2*t.a.fontSize)-1;for(let r=1;r<s;r++){let r=t.a.height&&e.height()>t.a.height,i=a.split("\n").join(" ").split(/[\s-]+/).reduce((e,t)=>{var n;return(n=t=t.toLowerCase(),/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(n))?e.concat(t.split("")):e.concat(t)},[]),s=e.textArr.map(e=>e.text.toLowerCase()).join(";"),l=i.find(e=>!s.includes(e)||(s=s.replace(e,""),!1));if(!(r||l&&!n))break;o-=.5,e.fontSize(o)}return e.fontSize(r),e.height(i),o}(n.current,e,i);if(t!==e.fontSize)return void s(()=>{e.set({fontSize:t})},!1,!0);let r=k();e.height===r||p||s(()=>{e.set({height:r})},!1,!0)}}),m(S).useLayoutEffect(()=>{if(x&&e.curveEnabled){let t=r.current?.getSelfRect().width;if(t){let n=t-e.a.width,r=e.a.rotation*Math.PI/180,i=-(n/2)*Math.cos(r),a=-(n/2)*Math.sin(r);e.set({width:t,x:e.a.x+i,y:e.a.y+a})}}},[x,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),m(S).useLayoutEffect(()=>{let t=n.current;t&&(t.width(t.width()+1e-8),t.width(t.width()-1e-8),t._setTextData(),iW(t,e))},[x]);let _=m(S).useRef(null),T=m(S).useRef(0),P=n=>{if(n.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable){var r,i;let t,a,o,s,l,c,u;(r=(t=n.target).getAbsoluteTransform().copy()).invert(),i=t.getStage().getPointerPosition(),a=r.point(i),o=t.textArr,s=Math.floor(a.y/(t.fontSize()*t.lineHeight())),l=o.slice(0,s).reduce((e,t)=>e+t.text.length,s),c=o[s]??o[0],u=0,"right"===t.align()?u=t.width()-c.width:"center"===t.align()&&(u=t.width()/2-c.width/2),T.current=l+Math.round((a.x-u)/c.width*c.text.length),e.toggleEditMode()}},O=!w&&e.placeholder?.6:e.a.opacity;r0(n,O);let A=i4({fontLoaded:x,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),I=e.selectable||"admin"===t.role,R=rQ(e),L=rQ(e,e.stroke,"stroke"),M=m(S).useMemo(()=>e.backgroundEnabled?e.curveEnabled?function({width:e,height:t,padding:n=0,cornerRadius:r=0}){let i=-n,a=-n,o=e+n,s=t+n;return rW(rq(`M ${i} ${a} L ${o} ${a} L ${o} ${s} L ${i} ${s} Z`),r).path}({width:e.a.width,height:e.a.height,cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*A*.5),padding:e.backgroundPadding*(e.a.fontSize*A*.5)}):function({lines:e,lineHeight:t,width:n,align:r="left",padding:i=0,cornerRadius:a=0}){e.forEach((e,t)=>{e.cx=n/2,"right"===r?e.cx=n-e.width/2:"left"===r&&(e.cx=e.width/2),"justify"!==r||e.lastInParagraph||(e.width=n),"justify"===r&&(e.cx=e.width/2)});let o=`M ${e[0]?.cx} ${-i}`;e.forEach((n,r)=>{let{cx:a}=n,s=e[r-1];s&&s.width>n.width?o+=` L ${a+n.width/2+i} ${r*t+i}`:o+=` L ${a+n.width/2+i} ${r*t-i}`;let l=e[r+1];l&&l.width>n.width?o+=` L ${a+n.width/2+i} ${(r+1)*t-i}`:o+=` L ${a+n.width/2+i} ${(r+1)*t+i}`});for(var s=e.length-1;s>=0;s--){let n=e[s],{cx:r}=n,a=e[s+1];a&&a.width>n.width?o+=` L ${r-n.width/2-i} ${(s+1)*t-i}`:o+=` L ${r-n.width/2-i} ${(s+1)*t+i}`;let l=e[s-1];l&&l.width>n.width?o+=` L ${r-n.width/2-i} ${s*t+i}`:o+=` L ${r-n.width/2-i} ${s*t-i}`}return rW(rq(o+=" Z"),a).path}({lines:JSON.parse(JSON.stringify(v)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*A*.5),lineHeight:A*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*A*.5),width:e.a.width,align:e.align}):"",[e.backgroundEnabled,e.curveEnabled,e.backgroundCornerRadius,e.a.fontSize,e.a.height,A,e.backgroundPadding,e.a.width,e.align,v]),N=iK(),j=0;e.curveEnabled||("middle"===e.verticalAlign?j=(e.a.height-v.length*A*e.a.fontSize)/2:"bottom"===e.verticalAlign&&(j=e.a.height-v.length*A*e.a.fontSize));let D=e.curveEnabled?iV(e.a.width,e.a.height,e.curvePower,e.a.fontSize):"",z=x?'"'+e.fontFamily+'"':y===e.fontFamily?"Arial":'"'+y+'"';return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rR,{ref:i,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*O,data:M,fill:e.backgroundColor,offsetY:-j}),(0,C.jsx)(rR,{data:D,stroke:"red",strokeWidth:1,x:e.a.x,y:e.a.y,rotation:e.a.rotation,visible:!1}),(0,C.jsx)("TextPath",{ref:r,visible:e.curveEnabled,data:D,text:w||e.placeholder,listening:!1,align:"center",textBaseline:"middle",...R,...L,strokeWidth:e.strokeWidth,lineJoin:"round",fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`"${e.fontFamily}", "${y}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration.trim(),letterSpacing:e.letterSpacing*e.a.fontSize,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e._editModeEnabled?.3:O,hideInExport:!e.showInExport,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity}),(0,C.jsx)(rI,{ref:n,id:e.id,name:"element",hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,text:w||e.placeholder,direction:iH(w),...R,...L,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:z,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:N?e.draggable&&h:e.draggable,preventDefault:!N||h,opacity:e.curveEnabled?0:O,visible:!e._editModeEnabled,ellipsis:"ellipsis"===iS.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:A,letterSpacing:e.letterSpacing*e.a.fontSize,listening:I,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onClick:P,onTap:P,onTransformStart:()=>{u(!0),d.current=n.current.height()},onTransform:t=>{let n=t.target;i.current?.setAttrs({x:n.x(),y:n.y(),rotation:n.rotation(),scale:n.scale()});let r=(n.getStage()?.findOne("Transformer")).getActiveAnchor();if("middle-left"===r||"middle-right"===r){let t=n.scaleX(),r=n.width()*t,i=e.a.fontSize,a=r;r<i&&(a=i,_.current&&n.position(_.current)),n.width(a),n.scaleX(1),n.scaleY(1);let o=k();if("ellipsis"===iS.textOverflow)o=d.current;else{let t=Math.max(o,d.current);n.height(t),e.set({height:n.height()})}let s=iS.textVerticalResizeEnabled?Math.max(o,d.current):k();e.set({x:n.x(),width:n.width(),rotation:n.rotation(),height:s}),iW(n,e)}if("top-center"===r||"bottom-center"===r){let n="resize"===iS.textOverflow?k():A*e.a.fontSize;t.target.height(Math.max(n,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}_.current=t.target.position();let a=t.target.scaleX();i.current?.setAttrs({scaleX:1,scaleY:1}),t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.a.fontSize*a,width:t.target.width()*a,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*a,shadowBlur:e.shadowBlur*a,shadowOffsetX:e.shadowOffsetX*a,shadowOffsetY:e.shadowOffsetY*a,strokeWidth:e.strokeWidth*a})},onTransformEnd:t=>{let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:Math.round(e.a.fontSize*n),width:Math.ceil(t.target.width()*n),x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*n,shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n,strokeWidth:e.strokeWidth*n}),i.current?.setAttrs({scaleX:1,scaleY:1}),u(!1)}}),s&&(0,C.jsx)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,children:(0,C.jsx)(i1,{textNodeRef:n,element:e,selectAll:l,cursorPosition:T.current,onBlur:()=>{e.toggleEditMode(!1)}})})]})});var S=x("8NFma"),E=x("2SBKn"),S=x("8NFma"),i6={};function i5(e){let t={};return e.querySelectorAll("style").forEach(e=>{for(let n of m(i6).parse(e.textContent).stylesheet.rules)n.selectors&&n.selectors.forEach(e=>{let r=t[e]||{};n.declarations.forEach(e=>{r[e.name]=e.value}),t[e]=r})}),t}function i9(e,t){let n={fill:"",stroke:""},r=e.getAttribute("class")?.split(" ")||[],i=e.getAttribute("id"),a={};i&&t[`#${i}`]?a=t[`#${i}`]:r.forEach(e=>{t[`.${e}`]&&(a={...a,...t[`.${e}`]})}),t[e.nodeName]&&(a={...a,...t[e.nodeName]});let o=e.getAttribute("fill");o&&"none"!==o?n.fill=o:a.fill&&"none"!==a.fill&&(n.fill=a.fill);let s=e.getAttribute("stroke");if(s&&"none"!==s?n.stroke=s:a.stroke&&"none"!==a.stroke&&(n.stroke=a.stroke),!n.fill&&e.style.fill&&"none"!==e.style.fill&&(n.fill=e.style.fill),!n.stroke&&e.style.stroke&&"none"!==e.style.stroke&&(n.stroke=e.style.stroke),!n.stroke&&!n.fill){let r=e.ownerSVGElement,i=r&&r!==e?i9(r,t):null;i?.fill!=="currentColor"&&i?.stroke!=="currentColor"&&(n.fill="black")}return n}i6={lex:x("lBdyc"),parse:x("7s4lq"),stringify:x("ShlyI")};let i7=["path","rect","circle","line","polygon","polyline","ellipse","text"];function ae(e){for(var t=[],n=e.getElementsByTagName("*"),r=0,i=n.length;r<i;r++){let e=n[r];!function(e){for(;e.parentNode;){if("defs"===e.nodeName)return!0;e=e.parentNode}return!1}(e)&&(null!==e.getAttribute("fill")&&t.push(e),null!==e.getAttribute("stroke")||e.style&&e.style.fill?t.push(e):i7.indexOf(e.nodeName)>=0&&t.push(e))}return t}async function at(e){let t=await fetch(e);return ar(await t.text())}async function an(e){let t=await fetch(e,{mode:"cors"});return await t.text()}function ar(e){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(e)))}async function ai(e){let t=await an(e),n=new DOMParser().parseFromString(t,"image/svg+xml").documentElement.getAttribute("viewBox"),[r,i,a,o]=n?.split(" ")||[];return{width:parseFloat(a),height:parseFloat(o)}}function aa(e){var t=new DOMParser().parseFromString(e,"image/svg+xml");let n=t.documentElement.getAttribute("viewBox"),[r,i,a,o]=n?.split(" ")||[],s=t.documentElement.getAttribute("width");s||t.documentElement.setAttribute("width",a+"px");let l=t.documentElement.getAttribute("height");if((!l||l.indexOf("%")>=0)&&t.documentElement.setAttribute("height",o+"px"),s&&s.indexOf("%")>=0&&l&&-1===l.indexOf("%")){let e=parseFloat(l)/parseFloat(o);t.documentElement.setAttribute("width",e*parseFloat(a)+"px")}if(l&&l.indexOf("%")>=0&&s&&-1===s.indexOf("%")){let e=parseFloat(s)/parseFloat(a);t.documentElement.setAttribute("height",e*parseFloat(o)+"px")}return"100%"===s&&"100%"===l&&(t.documentElement.setAttribute("width",a+"px"),t.documentElement.setAttribute("height",o+"px")),new XMLSerializer().serializeToString(t)}let ao=(e,t)=>{if(!e||!t)return!1;if("currentColor"===t&&"black"===e)return!0;let n=n_.Util.colorToRGBA(e),r=n_.Util.colorToRGBA(t);if(n&&r)return n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a};function as(e,t){var n=new DOMParser().parseFromString(e,"image/svg+xml");let r=ae(n),i=Array.from(t.keys()),a=i5(n);return r.forEach(e=>{let{fill:r,stroke:o}=i9(e,a);[{prop:"fill",color:r},{prop:"stroke",color:o}].forEach(({prop:r,color:a})=>{let o=i.find(e=>ao(e,a));if(o){let i=t.get(o);if(rY(i)){let{rotation:t,stops:a}=rX(i),o=a.map(e=>({offset:100*e.offset+"%","stop-color":e.color})),s="color"+Math.round(1e8*Math.random());!function(e,t,n,r){var i=e.namespaceURI,a=document.createElementNS(i,"linearGradient");let o=n_.Util.degToRad(n+90),s=(Math.cos(o)+1)/2,l=(Math.sin(o)+1)/2,c=(Math.cos(o+Math.PI)+1)/2,u=(Math.sin(o+Math.PI)+1)/2;a.setAttribute("x1",100*s+"%"),a.setAttribute("y1",100*l+"%"),a.setAttribute("x2",100*c+"%"),a.setAttribute("y2",100*u+"%"),a.setAttribute("gradientUnits","userSpaceOnUse"),a.setAttribute("id",t);for(var d=0;d<r.length;d++){var h=r[d],f=document.createElementNS(i,"stop");for(var p in h)h.hasOwnProperty(p)&&f.setAttribute(p,h[p]);a.appendChild(f)}(e.querySelector("defs")||e.insertBefore(document.createElementNS(i,"defs"),e.firstChild)).appendChild(a)}(n.children[0],s,t,o),e.style[r]=null,e.setAttribute(r,`url('#${s}')`)}else e.style[r]=t.get(o)}})}),ar(new XMLSerializer().serializeToString(n))}let al=e=>{let[t,n]=m(S).useState([]);return m(S).useEffect(()=>{let t=!1;return(async()=>{var r,i;let a,o,s;n([]);let l=(r=await an(e),a=i5(i=new DOMParser().parseFromString(r,"image/svg+xml")),o=ae(i),s=[],o.forEach(e=>{let{fill:t,stroke:n}=i9(e,a);[t,n].forEach(e=>{!e||("currentColor"===e&&(e="black"),n_.Util.colorToRGBA(e)&&-1===s.indexOf(e)&&s.push(e))})}),s);t||n(l)})(),()=>{t=!0}},[e]),t},ac=(e,t,n)=>{let r=t,i=n,a=1;for(;r>0&&i>0;){if(e.width=r,e.height=i,r+i<4e3)return;let o=e.getContext("2d");if(!o)return;if(o.fillStyle="rgba(0,0,0,0.1)",o.fillRect(0,0,1,1),0!==o.getImageData(0,0,1,1).data[3])return void o.clearRect(0,0,e.width,e.height);if(a*=.9,r=Math.floor(t*a),i=Math.floor(n*a),r=Math.max(r,1),i=Math.max(i,1),r<=1&&i<=1){e.width=1,e.height=1;return}}};var S=x("8NFma");let au=(e,t=100,n=!1,r)=>{let i=m(S).useRef(r??e),[,a]=m(S).useReducer(e=>e+1,0),o=m(S).useCallback(e=>{i.current!==e&&(i.current=e,a())},[i]),s=m(S).useRef(null);return e===n&&(s.current&&(clearTimeout(s.current),s.current=null),i.current=n),m(S).useEffect(()=>(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o(e),s.current=null},t),()=>{s.current&&clearTimeout(s.current)}),[e,t,n]),[i.current,o]};function ad(){return document.createElement("canvas")}let ah=e=>e.indexOf("data:image/svg+xml")>=0||e.indexOf(".svg")>=0;async function af(e){return ah(e)?ar(aa(await an(e))):e}let ap=e=>{let[t,n]=m(S).useState(e);return m(S).useEffect(()=>{(async()=>{let r=await af(e);r!==t&&n(r)})()},[e]),t};function am(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}let ag={boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2},ay=e=>{Object.assign(ag,e)},av={boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2},ab=e=>{Object.assign(av,e)},ax=(e,t,n)=>Math.max(t,Math.min(n,e)),aw=ad(),aC=j(({element:e})=>{let t=Math.min(30,e.a.width/4,e.a.height/4),n=m(S).useRef(null);return m(S).useEffect(()=>{let e=n.current;if(!e)return;let t=new n_.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}}),(0,C.jsxs)(rE,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.a.width,height:e.a.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,C.jsx)("Arc",{ref:n,x:e.a.width/2,y:e.a.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),aS=j(({element:e})=>{let t="Can not load the image...",n=Math.max(10,Math.min(30,e.a.width/t.length));return(0,C.jsxs)(rE,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.a.width,height:e.a.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,C.jsx)(rI,{text:t,fontSize:n,width:e.a.width,height:e.a.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}),ak=m(rj),a_=e=>{ak=e},aE=(e,t="",n="")=>{let r=m(S).useRef(),i=()=>{r.current?.(),r.current=void 0};m(S).useEffect(()=>i,[]),m(S).useLayoutEffect(()=>{let a=t.slice(0,200),o=`image with id ${n} url: ${a}`;"loading"!==e||r.current||(r.current=r5(o)),"loading"!==e&&i(),"failed"===e&&it(o)},[e])},aT=j(({element:e,store:t})=>{let n,r,i,[a,o]=m(S).useState(!1),s=m(S).useRef(null),l=m(S).useRef(null),c=t.selectedShapes.indexOf(e)>=0&&e.selectable,[u,d]=(e=>{let[t,n]=m(S).useReducer(e=>e+1,0),r=m(S).useRef("loading"),i=m(S).useRef(e.src),a=m(S).useRef(e.src);a.current!==e.src&&(a.current=e.src,r.current="loading");let o=m(S).useMemo(()=>ah(e.src)||"svg"===e.type,[e.src,e.type]);return(m(S).useEffect(()=>{if(!o||!e.src)return;let t=!1;return(async()=>{let a;r.current="loading",n();let o=aa(await an(e.src));a=e.colorsReplace?as(o,e.colorsReplace||new Map):ar(o),t||(i.current=a,r.current="loaded",n())})(),()=>{t=!0}},[e.src,JSON.stringify(e.colorsReplace)]),o)?[i.current,r.current]:[e.src,"loaded"]})(e),[h,f]=ak(u,"anonymous");aE("svg"!==e.type||"loaded"===d?f:"loading",e.src,e.id);let p=e.page._exportingOrRendering?1:Math.max(1,t.scale),g=t._elementsPixelRatio*p,y=(({image:e,status:t,type:n})=>{let r=m(S).useRef();return m(S).useEffect(()=>{r.current=e||r.current},[e]),"failed"!==t||"failed"!==t&&"svg"===n?r.current:void 0})({image:h,status:f,type:e.type}),v=(H=h||y,i=m(S).useMemo(()=>{let{flipX:t,flipY:n}=e,r="svg"===e.type||e.src.indexOf("data:image/svg+xml")>=0||e.src.indexOf(".svg")>=0,i=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,a=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||i)&&r||e.maskSrc;if(!t&&!n&&!a)return H;if(!H||!H.width||!H.height)return null;let o=ad(),s=1;"svg"===e.type&&(s=Math.max(e.a.width/H.width*g,e.a.height/H.height*g)),ac(o,Math.max(H.width*s,1),Math.max(H.height*s,1));let l=t?-o.width:0,c=n?-o.height:0;return o.getContext("2d")?.scale(t?-1:1,n?-1:1),o.getContext("2d")?.drawImage(H,l,c,o.width,o.height),o},[e.maskSrc,e.flipX,e.flipY,H,e.a.width,e.a.height,g]),m(S).useEffect(()=>()=>{i&&"CANVAS"===i.nodeName&&n_.Util.releaseCanvas(i)},[i]),i),b=((e,t)=>{let n=ap(e.maskSrc||""),[r,i]=ak(n,"anonymous");return aE(n?i:"loaded",n||"",e.id),m(S).useMemo(()=>{let n,i,a;if(!r||!t||!t.width||!t.height)return t;let o=ad();o.width=Math.max(t.width,1),o.height=Math.max(t.height,1);let s=o.getContext("2d");if(!s)return t;s.drawImage(t,0,0),s.globalCompositeOperation="source-in";let l=((a=e.width/e.height)>=r.width/r.height?(n=r.width,i=r.width/a):(n=r.height*a,i=r.height),{x:(r.width-n)/2,y:(r.height-i)/2,width:n,height:i});return s.drawImage(r,l.x,l.y,l.width,l.height,0,0,t.width,t.height),o},[t,r,e.a.width,e.a.height])})(e,v)||aw,{cropX:x,cropY:w,cropWidth:k,cropHeight:_}=e.a;"loaded"!==f&&(x=w=0,k=_=1);let T=b.width*k,P=b.height*_,O=e.a.width/e.a.height,A=T/P,I=e.stretchEnabled;I?(n=T,r=P):O>=A?(n=T,r=T/O):(n=P*O,r=P);let R={x:b.width*x,y:b.height*w,width:n,height:r},L=e.cornerRadius??0,M=e.page._exportingOrRendering?1:Math.min(2,t.scale),N=t._elementsPixelRatio*M,j=((e,t,n,r)=>{let i=ap(e.clipSrc||""),[a,o]=ak(i,"anonymous");aE(e.clipSrc?o:"loaded",e.clipSrc,e.id);let s=m(S).useMemo(()=>{if(t&&a)return ad()},[t,a]);return m(S).useLayoutEffect(()=>{if(!a||!t||!t.width||!t.height||!a||!a.width||!a.height||!s)return;let r=ad(),i=Math.max(e.a.width/a.width*n,e.a.height/a.height*n);r.width=Math.max(a.width*i,1),r.height=Math.max(a.height*i,1),r.getContext("2d")?.drawImage(a,0,0,r.width,r.height),s.width=Math.max(t.width,1),s.height=Math.max(t.height,1);let o=s.getContext("2d");o&&(o.save(),o.drawImage(r,0,0,t.width,t.height),n_.Util.releaseCanvas(r),o.globalCompositeOperation="source-in",o.drawImage(t,0,0,s.width,s.height),o.restore())},[s,t,a,e.a.width,e.a.height,n,...r]),e.clipSrc&&a?s:t})(e,((e,t,n,r,i=0,a=!1,o=!0)=>{let s=Math.floor(ax(e.a.width*r,1,1e4)),l=Math.floor(ax(e.a.height*r,1,1e4)),c=Math.min(i*r,s/2,l/2),u=Math.max(e.a.width/n.width,e.a.height/n.height)*r,d=e.page._exportingOrRendering&&iS.imageDownScalingEnabled&&u<1&&!a,h=0===n.x&&0===n.y&&n.width===t?.width&&n.height===t?.height,f=m(S).useMemo(()=>{if(!t||!t.width||!t.height)return;let e=0===c,n=!d;if(!h||!e||!n)return ad()},[t,c,d,h]);return m(S).useLayoutEffect(()=>{let e,r,i,a;if(!f||!t)return;ac(f,s,l);let o=f.getContext("2d");if(!o)return;c&&(o.beginPath(),o.moveTo(c,0),o.lineTo(s-c,0),o.arc(s-c,c,c,3*Math.PI/2,0,!1),o.lineTo(s,l-c),o.arc(s-c,l-c,c,0,Math.PI/2,!1),o.lineTo(c,l),o.arc(c,l-c,c,Math.PI/2,Math.PI,!1),o.lineTo(0,c),o.arc(c,c,c,Math.PI,3*Math.PI/2,!1),o.clip());let h=d?((e=ad()).width=t.width,e.height=t.height,r=Math.max(1,Math.floor(e.width*u)),i=Math.max(1,Math.floor(e.height*u)),e.getContext("2d")?.drawImage(t,0,0,e.width,e.height),a=function(e,t,n,r,i){for(var a=new ImageData(t,n),o=new Int32Array(e.data.buffer),s=e.width,l=new Int32Array(a.data.buffer),c=a.width,u=t/r,d=n/i,h=Math.round(1/u),f=Math.round(1/d),p=h*f,m=0;m<a.height;m++)for(var g=0;g<c;g++){for(var y=0+Math.round(g/u)+(0+Math.round(m/d))*s,v=0,b=0,x=0,w=0,C=0;C<f;C++)for(var S=0;S<h;S++){var k=o[y+S+C*s];v+=k<<24>>>24,b+=k<<16>>>24,x+=k<<8>>>24,w+=k>>>24}v=Math.round(v/p),b=Math.round(b/p),x=Math.round(x/p),w=Math.round(w/p),l[g+m*c]=w<<24|x<<16|b<<8|v}return a}(e.getContext("2d").getImageData(0,0,e.width,e.height),r,i,e.width,e.height),e.width=r,e.height=i,e.getContext("2d")?.putImageData(a,0,0),e):t,p=d?{x:Math.floor(n.x*u),y:Math.floor(n.y*u),width:Math.floor(n.width*u),height:Math.floor(n.height*u)}:n;o.drawImage(h,p.x,p.y,p.width,p.height,0,0,f.width,f.height)},[f,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,a,e.page._exportingOrRendering,d]),m(S).useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&n_.Util.releaseCanvas(f)},[f]),f||t})(e,b,R,N,L,a||e._cropModeEnabled||"svg"===e.type,!0),N,[R,L,N]),D=Math.max(e.a.width/n,e.a.height/r);m(S).useEffect(()=>{if(!e._cropModeEnabled)return;let t=s.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==l.current&&e.toggleCropMode(!1)}function r(n){e._cropModeEnabled&&n.target.parentNode!==t?.content&&e.toggleCropMode(!1)}return document.body.addEventListener("click",r),t?.on("click",n),t?.on("tap",n),()=>{document.body.removeEventListener("click",r),document.body.removeEventListener("touchstart",r),t?.off("click",n),t?.off("click",n)}},[e._cropModeEnabled]),m(S).useLayoutEffect(()=>{if(!a&&!e._cropModeEnabled)return iW(s.current,e),(0,E.autorun)(()=>{iW(s.current,e)},{delay:100})},[j,e.page._exportingOrRendering,a,k,_,e._cropModeEnabled]),m(S).useLayoutEffect(()=>{a||e._cropModeEnabled?s.current?.clearCache():iW(s.current,e)},[a,e.a.width,e.a.height,e._cropModeEnabled]),m(S).useEffect(()=>{iW(s.current,e)},[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let z=m(S).useRef(null),B=m(S).useRef(null),F=m(S).useRef(null);m(S).useLayoutEffect(()=>{e._cropModeEnabled&&(B.current.nodes([z.current]),F.current.nodes([l.current]))},[e._cropModeEnabled]);var H,V=m(S).useRef(null),U=m(S).useRef(0),$=m(S).useRef(!1);let q=t=>{t.evt.touches?.length>2&&t.target.stopDrag(),Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));let i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1,n/i),s=Math.min(1,r/a),l=Math.min(1-o,Math.max(0,Math.round(-t.target.x())/i)),c=Math.min(1-s,Math.max(0,Math.round(-t.target.y())/a));t.target.setAttrs({x:-l*b.width,y:-c*b.height,scaleX:1,scaleY:1}),e.set({cropX:l,cropY:c,cropWidth:o,cropHeight:s})},W=()=>{"svg"===e.type||!e.contentEditable||e.stretchEnabled||setTimeout(()=>{e.toggleCropMode(!0)})},G="svg"===e.type&&y,[K]=au("loading"===f&&!G,100,!1,!1),Y="failed"===f,X=!K&&!Y,Q=m(S).useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Z=X?e.a.opacity:0;r0(s,Z);let J=e.selectable||"admin"===t.role,ee=iK(),et=rQ(e,e.borderColor,"stroke");return(0,C.jsxs)(C.Fragment,{children:[K&&(0,C.jsx)(aC,{element:e}),Y&&(0,C.jsx)(aS,{element:e}),(0,C.jsx)(rA,{ref:s,name:"element",id:e.id,image:j,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:Z,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:R,listening:J,draggable:ee?e.draggable&&c:e.draggable,preventDefault:!ee||c,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDblClick:W,onDblTap:W,onTransformStart:()=>{o(!0),Q.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{let i=t.currentTarget,a=1e-7>Math.abs(i.scaleX()-1)?1:i.scaleX(),o=1e-7>Math.abs(i.scaleY()-1)?1:i.scaleY();i.scaleX(1),i.scaleY(1);let s=t.target.getStage()?.findOne("Transformer"),l=Math.min(1-n/b.width,Math.max(0,e.cropX)),c=Math.min(1-r/b.height,Math.max(0,e.cropY)),u=s.getActiveAnchor(),d=!(u.indexOf("middle")>=0||u.indexOf("center")>=0),h=!d&&a<1&&Q.current.cropHeight>r/b.height,f=d?e.cropWidth:e.cropWidth*a;h&&(f=e.cropWidth);let p=!d&&o<1&&Q.current.cropWidth>n/b.width,m=d?e.cropHeight:e.cropHeight*o;p&&(m=e.cropHeight),I&&(f=e.cropWidth,m=e.cropHeight),e.set({cropX:l,cropY:c,x:i.x(),y:i.y(),width:i.width()*a,height:i.height()*o,rotation:t.target.rotation(),cropWidth:Math.min(f,1-l),cropHeight:Math.min(m,1-c)})},onTransformEnd:t=>{let i=t.currentTarget;e.set({width:i.width(),height:i.height(),x:i.x(),y:i.y(),rotation:t.target.rotation(),cropWidth:n/b.width,cropHeight:r/b.height}),o(!1)}}),(0,C.jsx)(rP,{x:e.x,y:e.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:Z,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,...et,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,L-e.borderSize),hideInExport:!e.showInExport}),e._cropModeEnabled&&(0,C.jsxs)(rB,{selector:".page-abs-container",enabled:!0,children:[(0,C.jsx)(rP,{x:-window.innerWidth/t.scale,y:-window.innerWidth/t.scale,width:window.innerWidth/t.scale*3,height:window.innerWidth/t.scale*3,fill:"rgba(0,0,0,0.3)"}),(0,C.jsx)(rA,{listening:!1,image:j,x:e.x,y:e.y,width:e.a.width,height:e.a.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,C.jsxs)(rE,{x:e.x,y:e.y,rotation:e.rotation,scaleX:D,scaleY:D,children:[(0,C.jsx)(rA,{image:b,ref:l,opacity:.4,draggable:!0,x:-e.cropX*b.width,y:-e.cropY*b.height,onDragMove:q,onTransform:q,onTouchMove:e=>{e.evt.preventDefault();let t=e.target.getStage().getPointersPositions();var n=t[0],r=t[1];let i=e.target;if(n&&!r&&!i.isDragging()&&$.current&&(i.startDrag(),$.current=!1),n&&r){n_.hitOnDragEnabled=!0,i.isDragging()&&($.current=!0,i.stopDrag());let t=e.target.getAbsoluteTransform().copy();t.invert();var a={x:n.x,y:n.y},o={x:r.x,y:r.y};if(!V.current){V.current=am(a,o);return}var s=am(a,o),l=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2));U.current||(U.current=l);let p=i.position();var c={x:s.x-p.x,y:s.y-p.y},u=l/U.current;i.scaleX(u),i.scaleY(u);let m=t.point(s),g=t.point(V.current);var d=m.x-g.x,h=m.y-g.y,f={x:Math.min(0,s.x-c.x*u+d),y:Math.min(0,s.y-c.y*u+h)};i.position(f),U.current=l,V.current=s,q(e)}},onTouchEnd:e=>{U.current=0,V.current=null,n_.hitOnDragEnabled=!1}}),(0,C.jsx)(rL,{ref:F,...av}),(0,C.jsx)(rP,{width:n,height:r,ref:z,listening:!1,onTransform:t=>{if(e.cropX<Math.abs(t.target.x()/b.width)&&0>t.target.x()&&e.cropX>0){let n=(e.cropWidth+e.cropX)*b.width;t.target.scaleX(1),t.target.width(n)}if(e.cropY<Math.abs(t.target.y()/b.height)&&0>t.target.y()&&e.cropY>0){let n=(e.cropHeight+e.cropY)*b.height;t.target.scaleY(1),t.target.height(n)}t.target.x()<-e.cropX*b.width-1e-9&&(t.target.x(-e.cropX*b.width),t.target.scaleX(1)),t.target.y()<-e.cropY*b.height-1e-9&&(t.target.y(-e.cropY*b.height),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/b.width)),r=Math.min(1,Math.max(0,t.target.y()/b.height+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/b.width),s=Math.min(1-r,a/b.height),l=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:l.x,y:l.y,cropX:n,cropY:r,cropWidth:o,cropHeight:s,width:Math.min(i*D,b.width*(1-n)*D),height:Math.min(a*D,b.height*(1-r)*D)})}}),(0,C.jsx)(rL,{ref:B,...ag,visible:e.resizable})]})]})]})});var S=x("8NFma"),aP={};jk=function(e){for(var t,n=e.length,r=n%3,i=[],a=0,o=n-r;a<o;a+=16383)i.push(function(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(aO[r>>18&63]+aO[r>>12&63]+aO[r>>6&63]+aO[63&r]);return i.join("")}(e,a,a+16383>o?o:a+16383));return 1===r?i.push(aO[(t=e[n-1])>>2]+aO[t<<4&63]+"=="):2===r&&i.push(aO[(t=(e[n-2]<<8)+e[n-1])>>10]+aO[t>>4&63]+aO[t<<2&63]+"="),i.join("")};for(var aO=[],aA=[],aI="u">typeof Uint8Array?Uint8Array:Array,aR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",aL=0,aM=aR.length;aL<aM;++aL)aO[aL]=aR[aL],aA[aR.charCodeAt(aL)]=aL;aA[45]=62,aA[95]=63,j_=function(e,t,n,r,i){var a,o,s=8*i-r-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,a=f&(1<<-u)-1,f>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),a-=c}return(f?-1:1)*o*Math.pow(2,a-r)},jE=function(e,t,n,r,i,a){var o,s,l,c=8*a-i-1,u=(1<<c)-1,d=u>>1,h=5960464477539062e-23*(23===i),f=r?0:a-1,p=r?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[n+f]=255&o,f+=p,o/=256,c-=8);e[n+f-p]|=128*m};let aN="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function aj(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,aD.prototype),t}function aD(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return aF(e)}return az(e,t,n)}function az(e,t,n){if("string"==typeof e){var r=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!aD.isEncoding(i))throw TypeError("Unknown encoding: "+i);let n=0|a$(r,i),a=aj(n),o=a.write(r,i);return o!==n&&(a=a.slice(0,o)),a}if(ArrayBuffer.isView(e)){var a=e;if(or(a,Uint8Array)){let e=new Uint8Array(a);return aV(e.buffer,e.byteOffset,e.byteLength)}return aH(a)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(or(e,ArrayBuffer)||e&&or(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(or(e,SharedArrayBuffer)||e&&or(e.buffer,SharedArrayBuffer)))return aV(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(null!=o&&o!==e)return aD.from(o,t,n);let s=function(e){if(aD.isBuffer(e)){let t=0|aU(e.length),n=aj(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?aj(0):aH(e):"Buffer"===e.type&&Array.isArray(e.data)?aH(e.data):void 0}(e);if(s)return s;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return aD.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function aB(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function aF(e){return aB(e),aj(e<0?0:0|aU(e))}function aH(e){let t=e.length<0?0:0|aU(e.length),n=aj(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function aV(e,t,n){let r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),aD.prototype),r}function aU(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function a$(e,t){if(aD.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||or(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return oe(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ot(e).length;default:if(i)return r?-1:oe(e).length;t=(""+t).toLowerCase(),i=!0}}function aq(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=oi[e[r]];return i}(this,t,n);case"utf8":case"utf-8":return aY(this,t,n);case"ascii":return function(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":var i,a,o;return i=this,a=t,o=n,0===a&&o===i.length?jk(i):jk(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){let r=e.slice(t,n),i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}(this,t,n);default:if(r)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function aW(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function aG(e,t,n,r,i){var a;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(a=n*=1)!=a&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length)if(i)return -1;else n=e.length-1;else if(n<0)if(!i)return -1;else n=0;if("string"==typeof t&&(t=aD.from(t,r)),aD.isBuffer(t))return 0===t.length?-1:aK(e,t,n,r,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,n);else return Uint8Array.prototype.lastIndexOf.call(e,t,n);return aK(e,[t],n,r,i)}throw TypeError("val must be string, number or Buffer")}function aK(e,t,n,r,i){let a,o=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;o=2,s/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let r=-1;for(a=n;a<s;a++)if(c(e,a)===c(t,-1===r?0:a-r)){if(-1===r&&(r=a),a-r+1===l)return r*o}else -1!==r&&(a-=a-r),r=-1}else for(n+l>s&&(n=s-l),a=n;a>=0;a--){let n=!0;for(let r=0;r<l;r++)if(c(e,a+r)!==c(t,r)){n=!1;break}if(n)return a}return -1}function aY(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,l;switch(o){case 1:t<128&&(a=t);break;case 2:(192&(n=e[i+1]))==128&&(l=(31&t)<<6|63&n)>127&&(a=l);break;case 3:n=e[i+1],r=e[i+2],(192&n)==128&&(192&r)==128&&(l=(15&t)<<12|(63&n)<<6|63&r)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(192&n)==128&&(192&r)==128&&(192&s)==128&&(l=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s)>65535&&l<1114112&&(a=l)}}null===a?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=o}var a=r;let o=a.length;if(o<=4096)return String.fromCharCode.apply(String,a);let s="",l=0;for(;l<o;)s+=String.fromCharCode.apply(String,a.slice(l,l+=4096));return s}function aX(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function aQ(e,t,n,r,i,a){if(!aD.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function aZ(e,t,n,r,i){a6(t,r,i,e,n,7);let a=Number(t&BigInt(0xffffffff));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function aJ(e,t,n,r,i){a6(t,r,i,e,n,7);let a=Number(t&BigInt(0xffffffff));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function a0(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function a1(e,t,n,r,i){return t*=1,n>>>=0,i||a0(e,t,n,4,34028234663852886e22,-34028234663852886e22),jE(e,t,n,r,23,4),n+4}function a2(e,t,n,r,i){return t*=1,n>>>=0,i||a0(e,t,n,8,17976931348623157e292,-17976931348623157e292),jE(e,t,n,r,52,8),n+8}aD.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!aD.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(aD.prototype,"parent",{enumerable:!0,get:function(){if(aD.isBuffer(this))return this.buffer}}),Object.defineProperty(aD.prototype,"offset",{enumerable:!0,get:function(){if(aD.isBuffer(this))return this.byteOffset}}),aD.poolSize=8192,aD.from=function(e,t,n){return az(e,t,n)},Object.setPrototypeOf(aD.prototype,Uint8Array.prototype),Object.setPrototypeOf(aD,Uint8Array),aD.alloc=function(e,t,n){return(aB(e),e<=0)?aj(e):void 0!==t?"string"==typeof n?aj(e).fill(t,n):aj(e).fill(t):aj(e)},aD.allocUnsafe=function(e){return aF(e)},aD.allocUnsafeSlow=function(e){return aF(e)},aD.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==aD.prototype},aD.compare=function(e,t){if(or(e,Uint8Array)&&(e=aD.from(e,e.offset,e.byteLength)),or(t,Uint8Array)&&(t=aD.from(t,t.offset,t.byteLength)),!aD.isBuffer(e)||!aD.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},aD.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},aD.concat=function(e,t){let n;if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return aD.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;let r=aD.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(or(t,Uint8Array))i+t.length>r.length?(aD.isBuffer(t)||(t=aD.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(aD.isBuffer(t))t.copy(r,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return r},aD.byteLength=a$,aD.prototype._isBuffer=!0,aD.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)aW(this,t,t+1);return this},aD.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)aW(this,t,t+3),aW(this,t+1,t+2);return this},aD.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)aW(this,t,t+7),aW(this,t+1,t+6),aW(this,t+2,t+5),aW(this,t+3,t+4);return this},aD.prototype.toString=function(){let e=this.length;return 0===e?"":0==arguments.length?aY(this,0,e):aq.apply(this,arguments)},aD.prototype.toLocaleString=aD.prototype.toString,aD.prototype.equals=function(e){if(!aD.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===aD.compare(this,e)},aD.prototype.inspect=function(){let e="";return e=this.toString("hex",0,50).replace(/(.{2})/g,"$1 ").trim(),this.length>50&&(e+=" ... "),"<Buffer "+e+">"},aN&&(aD.prototype[aN]=aD.prototype.inspect),aD.prototype.compare=function(e,t,n,r,i){if(or(e,Uint8Array)&&(e=aD.from(e,e.offset,e.byteLength)),!aD.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,s=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n);for(let e=0;e<s;++e)if(l[e]!==c[e]){a=l[e],o=c[e];break}return a<o?-1:+(o<a)},aD.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},aD.prototype.indexOf=function(e,t,n){return aG(this,e,t,n,!0)},aD.prototype.lastIndexOf=function(e,t,n){return aG(this,e,t,n,!1)},aD.prototype.write=function(e,t,n,r){var i,a,o,s,l,c,u,d;if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-t;if((void 0===n||n>h)&&(n=h),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let f=!1;for(;;)switch(r){case"hex":return function(e,t,n,r){let i;n=Number(n)||0;let a=e.length-n;r?(r=Number(r))>a&&(r=a):r=a;let o=t.length;for(r>o/2&&(r=o/2),i=0;i<r;++i){var s;let r=parseInt(t.substr(2*i,2),16);if((s=r)!=s)break;e[n+i]=r}return i}(this,e,t,n);case"utf8":case"utf-8":return i=t,a=n,on(oe(e,this.length-i),this,i,a);case"ascii":case"latin1":case"binary":return o=t,s=n,on(function(e){let t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(e),this,o,s);case"base64":return l=t,c=n,on(ot(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,d=n,on(function(e,t){let n,r,i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i.push(n%256),i.push(r);return i}(e,this.length-u),this,u,d);default:if(f)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),f=!0}},aD.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},aD.prototype.slice=function(e,t){let n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,aD.prototype),r},aD.prototype.readUintLE=aD.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},aD.prototype.readUintBE=aD.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},aD.prototype.readUint8=aD.prototype.readUInt8=function(e,t){return e>>>=0,t||aX(e,1,this.length),this[e]},aD.prototype.readUint16LE=aD.prototype.readUInt16LE=function(e,t){return e>>>=0,t||aX(e,2,this.length),this[e]|this[e+1]<<8},aD.prototype.readUint16BE=aD.prototype.readUInt16BE=function(e,t){return e>>>=0,t||aX(e,2,this.length),this[e]<<8|this[e+1]},aD.prototype.readUint32LE=aD.prototype.readUInt32LE=function(e,t){return e>>>=0,t||aX(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},aD.prototype.readUint32BE=aD.prototype.readUInt32BE=function(e,t){return e>>>=0,t||aX(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},aD.prototype.readBigUInt64LE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];(void 0===t||void 0===n)&&a9(e,this.length-8);let r=t+256*this[++e]+65536*this[++e]+0x1000000*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+0x1000000*n;return BigInt(r)+(BigInt(i)<<BigInt(32))}),aD.prototype.readBigUInt64BE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];(void 0===t||void 0===n)&&a9(e,this.length-8);let r=0x1000000*t+65536*this[++e]+256*this[++e]+this[++e],i=0x1000000*this[++e]+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),aD.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},aD.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},aD.prototype.readInt8=function(e,t){return(e>>>=0,t||aX(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},aD.prototype.readInt16LE=function(e,t){e>>>=0,t||aX(e,2,this.length);let n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},aD.prototype.readInt16BE=function(e,t){e>>>=0,t||aX(e,2,this.length);let n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},aD.prototype.readInt32LE=function(e,t){return e>>>=0,t||aX(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},aD.prototype.readInt32BE=function(e,t){return e>>>=0,t||aX(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},aD.prototype.readBigInt64LE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];return(void 0===t||void 0===n)&&a9(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24))<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+0x1000000*this[++e])}),aD.prototype.readBigInt64BE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];return(void 0===t||void 0===n)&&a9(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<<BigInt(32))+BigInt(0x1000000*this[++e]+65536*this[++e]+256*this[++e]+n)}),aD.prototype.readFloatLE=function(e,t){return e>>>=0,t||aX(e,4,this.length),j_(this,e,!0,23,4)},aD.prototype.readFloatBE=function(e,t){return e>>>=0,t||aX(e,4,this.length),j_(this,e,!1,23,4)},aD.prototype.readDoubleLE=function(e,t){return e>>>=0,t||aX(e,8,this.length),j_(this,e,!0,52,8)},aD.prototype.readDoubleBE=function(e,t){return e>>>=0,t||aX(e,8,this.length),j_(this,e,!1,52,8)},aD.prototype.writeUintLE=aD.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){let r=Math.pow(2,8*n)-1;aQ(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},aD.prototype.writeUintBE=aD.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){let r=Math.pow(2,8*n)-1;aQ(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},aD.prototype.writeUint8=aD.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,1,255,0),this[t]=255&e,t+1},aD.prototype.writeUint16LE=aD.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},aD.prototype.writeUint16BE=aD.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},aD.prototype.writeUint32LE=aD.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},aD.prototype.writeUint32BE=aD.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},aD.prototype.writeBigUInt64LE=oa(function(e,t=0){return aZ(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),aD.prototype.writeBigUInt64BE=oa(function(e,t=0){return aJ(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),aD.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){let r=Math.pow(2,8*n-1);aQ(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},aD.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){let r=Math.pow(2,8*n-1);aQ(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},aD.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},aD.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},aD.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},aD.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},aD.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},aD.prototype.writeBigInt64LE=oa(function(e,t=0){return aZ(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),aD.prototype.writeBigInt64BE=oa(function(e,t=0){return aJ(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),aD.prototype.writeFloatLE=function(e,t,n){return a1(this,e,t,!0,n)},aD.prototype.writeFloatBE=function(e,t,n){return a1(this,e,t,!1,n)},aD.prototype.writeDoubleLE=function(e,t,n){return a2(this,e,t,!0,n)},aD.prototype.writeDoubleBE=function(e,t,n){return a2(this,e,t,!1,n)},aD.prototype.copy=function(e,t,n,r){if(!aD.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},aD.prototype.fill=function(e,t,n,r){let i;if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!aD.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){let t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{let a=aD.isBuffer(e)?e:aD.from(e,r),o=a.length;if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let a4={};function a3(e,t,n){a4[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function a8(e){let t="",n=e.length,r=+("-"===e[0]);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function a6(e,t,n,r,i,a){if(e>n||e<t){let r,i="bigint"==typeof t?"n":"";throw r=a>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(a+1)*8}${i}`:`>= -(2${i} ** ${(a+1)*8-1}${i}) and < 2 ** ${(a+1)*8-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new a4.ERR_OUT_OF_RANGE("value",r,e)}a5(i,"offset"),(void 0===r[i]||void 0===r[i+a])&&a9(i,r.length-(a+1))}function a5(e,t){if("number"!=typeof e)throw new a4.ERR_INVALID_ARG_TYPE(t,"number",e)}function a9(e,t,n){if(Math.floor(e)!==e)throw a5(e,n),new a4.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new a4.ERR_BUFFER_OUT_OF_BOUNDS;throw new a4.ERR_OUT_OF_RANGE(n||"offset",`>= ${+!!n} and <= ${t}`,e)}a3("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),a3("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),a3("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>0x100000000?i=a8(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=a8(i)),i+="n"),r+=` It must be ${t}. Received ${i}`},RangeError);let a7=/[^+/0-9A-Za-z-_]/g;function oe(e,t){let n;t=t||1/0;let r=e.length,i=null,a=[];for(let o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return a}function ot(e){return function(e){var t,n,r=function(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}(e),i=r[0],a=r[1],o=new aI((i+a)*3/4-a),s=0,l=a>0?i-4:i;for(n=0;n<l;n+=4)t=aA[e.charCodeAt(n)]<<18|aA[e.charCodeAt(n+1)]<<12|aA[e.charCodeAt(n+2)]<<6|aA[e.charCodeAt(n+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=255&t;return 2===a&&(t=aA[e.charCodeAt(n)]<<2|aA[e.charCodeAt(n+1)]>>4,o[s++]=255&t),1===a&&(t=aA[e.charCodeAt(n)]<<10|aA[e.charCodeAt(n+1)]<<4|aA[e.charCodeAt(n+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t),o}(function(e){if((e=(e=e.split("=")[0]).trim().replace(a7,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function on(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function or(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let oi=function(){let e="0123456789abcdef",t=Array(256);for(let n=0;n<16;++n){let r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function oa(e){return"u"<typeof BigInt?oo:e}function oo(){throw Error("BigInt not supported")}"u">typeof self&&self,aP=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=109)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),i=n(18),a=n(19),o=n(45),s=n(46),l=n(47),c=n(48),u=n(49),d=n(12),h=n(32),f=n(33),p=n(31),m=n(1);t.default={Scope:m.Scope,create:m.create,find:m.find,query:m.query,register:m.register,Container:r.default,Format:i.default,Leaf:a.default,Embed:c.default,Scroll:o.default,Block:l.default,Inline:s.default,Text:u.default,Attributor:{Attribute:d.default,Class:h.default,Style:f.default,Store:p.default}}},function(e,t,n){var r,i,a,o=this&&this.__extends||(i=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(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=this;return t="[Parchment] "+t,(n=e.call(this,t)||this).message=t,n.name=n.constructor.name,n}return o(t,e),t}(Error);t.ParchmentError=s;var l={},c={},u={},d={};function h(e,t){if(void 0===t&&(t=a.ANY),"string"==typeof e)n=d[e]||l[e];else if(e instanceof Text||e.nodeType===Node.TEXT_NODE)n=d.text;else if("number"==typeof e)e&a.LEVEL&a.BLOCK?n=d.block:e&a.LEVEL&a.INLINE&&(n=d.inline);else if(e instanceof HTMLElement){var n,r=(e.getAttribute("class")||"").split(/\s+/);for(var i in r)if(n=c[r[i]])break;n=n||u[e.tagName]}return null==n?null:t&a.LEVEL&n.scope&&t&a.TYPE&n.scope?n:null}t.DATA_KEY="__blot",(r=a=t.Scope||(t.Scope={}))[r.TYPE=3]="TYPE",r[r.LEVEL=12]="LEVEL",r[r.ATTRIBUTE=13]="ATTRIBUTE",r[r.BLOT=14]="BLOT",r[r.INLINE=7]="INLINE",r[r.BLOCK=11]="BLOCK",r[r.BLOCK_BLOT=10]="BLOCK_BLOT",r[r.INLINE_BLOT=6]="INLINE_BLOT",r[r.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",r[r.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",r[r.ANY=15]="ANY",t.create=function(e,t){var n=h(e);if(null==n)throw new s("Unable to create "+e+" blot");var r=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:n.create(t);return new n(r,t)},t.find=function e(n,r){return(void 0===r&&(r=!1),null==n)?null:null!=n[t.DATA_KEY]?n[t.DATA_KEY].blot:r?e(n.parentNode,r):null},t.query=h,t.register=function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(t.length>1)return t.map(function(t){return e(t)});var r=t[0];if("string"!=typeof r.blotName&&"string"!=typeof r.attrName)throw new s("Invalid definition");if("abstract"===r.blotName)throw new s("Cannot register abstract class");return d[r.blotName||r.attrName]=r,"string"==typeof r.keyName?l[r.keyName]=r:(null!=r.className&&(c[r.className]=r),null!=r.tagName&&(Array.isArray(r.tagName)?r.tagName=r.tagName.map(function(e){return e.toUpperCase()}):r.tagName=r.tagName.toUpperCase(),(Array.isArray(r.tagName)?r.tagName:[r.tagName]).forEach(function(e){(null==u[e]||null==r.className)&&(u[e]=r)}))),r}},function(e,t,n){var r=n(51),i=n(11),a=n(3),o=n(20),s=function(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]};s.prototype.insert=function(e,t){var n={};return 0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))},s.prototype.delete=function(e){return e<=0?this:this.push({delete:e})},s.prototype.retain=function(e,t){if(e<=0)return this;var n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)},s.prototype.push=function(e){var t=this.ops.length,n=this.ops[t-1];if(e=a(!0,{},e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,"object"!=typeof(n=this.ops[t-1])))return this.ops.unshift(e),this;if(i(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;else if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this},s.prototype.chop=function(){var e=this.ops[this.ops.length-1];return e&&e.retain&&!e.attributes&&this.ops.pop(),this},s.prototype.filter=function(e){return this.ops.filter(e)},s.prototype.forEach=function(e){this.ops.forEach(e)},s.prototype.map=function(e){return this.ops.map(e)},s.prototype.partition=function(e){var t=[],n=[];return this.forEach(function(r){(e(r)?t:n).push(r)}),[t,n]},s.prototype.reduce=function(e,t){return this.ops.reduce(e,t)},s.prototype.changeLength=function(){return this.reduce(function(e,t){return t.insert?e+o.length(t):t.delete?e-t.delete:e},0)},s.prototype.length=function(){return this.reduce(function(e,t){return e+o.length(t)},0)},s.prototype.slice=function(e,t){e=e||0,"number"!=typeof t&&(t=1/0);for(var n,r=[],i=o.iterator(this.ops),a=0;a<t&&i.hasNext();)a<e?n=i.next(e-a):(n=i.next(t-a),r.push(n)),a+=o.length(n);return new s(r)},s.prototype.compose=function(e){var t=o.iterator(this.ops),n=o.iterator(e.ops),r=[],a=n.peek();if(null!=a&&"number"==typeof a.retain&&null==a.attributes){for(var l=a.retain;"insert"===t.peekType()&&t.peekLength()<=l;)l-=t.peekLength(),r.push(t.next());a.retain-l>0&&n.next(a.retain-l)}for(var c=new s(r);t.hasNext()||n.hasNext();)if("insert"===n.peekType())c.push(n.next());else if("delete"===t.peekType())c.push(t.next());else{var u=Math.min(t.peekLength(),n.peekLength()),d=t.next(u),h=n.next(u);if("number"==typeof h.retain){var f={};"number"==typeof d.retain?f.retain=u:f.insert=d.insert;var p=o.attributes.compose(d.attributes,h.attributes,"number"==typeof d.retain);if(p&&(f.attributes=p),c.push(f),!n.hasNext()&&i(c.ops[c.ops.length-1],f)){var m=new s(t.rest());return c.concat(m).chop()}}else"number"==typeof h.delete&&"number"==typeof d.retain&&c.push(h)}return c.chop()},s.prototype.concat=function(e){var t=new s(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t},s.prototype.diff=function(e,t){if(this.ops===e.ops)return new s;var n=[this,e].map(function(t){return t.map(function(n){if(null!=n.insert)return"string"==typeof n.insert?n.insert:"\0";throw Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")}),a=new s,l=r(n[0],n[1],t),c=o.iterator(this.ops),u=o.iterator(e.ops);return l.forEach(function(e){for(var t=e[1].length;t>0;){var n=0;switch(e[0]){case r.INSERT:n=Math.min(u.peekLength(),t),a.push(u.next(n));break;case r.DELETE:n=Math.min(t,c.peekLength()),c.next(n),a.delete(n);break;case r.EQUAL:n=Math.min(c.peekLength(),u.peekLength(),t);var s=c.next(n),l=u.next(n);i(s.insert,l.insert)?a.retain(n,o.attributes.diff(s.attributes,l.attributes)):a.push(l).delete(n)}t-=n}}),a.chop()},s.prototype.eachLine=function(e,t){t=t||"\n";for(var n=o.iterator(this.ops),r=new s,i=0;n.hasNext();){if("insert"!==n.peekType())return;var a=n.peek(),l=o.length(a)-n.peekLength(),c="string"==typeof a.insert?a.insert.indexOf(t,l)-l:-1;if(c<0)r.push(n.next());else if(c>0)r.push(n.next(c));else{if(!1===e(r,n.next(1).attributes||{},i))return;i+=1,r=new s}}r.length()>0&&e(r,{},i)},s.prototype.transform=function(e,t){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);for(var n=o.iterator(this.ops),r=o.iterator(e.ops),i=new s;n.hasNext()||r.hasNext();)if("insert"===n.peekType()&&(t||"insert"!==r.peekType()))i.retain(o.length(n.next()));else if("insert"===r.peekType())i.push(r.next());else{var a=Math.min(n.peekLength(),r.peekLength()),l=n.next(a),c=r.next(a);if(l.delete)continue;c.delete?i.push(c):i.retain(a,o.attributes.transform(l.attributes,c.attributes,t))}return i.chop()},s.prototype.transformPosition=function(e,t){t=!!t;for(var n=o.iterator(this.ops),r=0;n.hasNext()&&r<=e;){var i=n.peekLength(),a=n.peekType();if(n.next(),"delete"===a){e-=Math.min(i,e-r);continue}"insert"===a&&(r<e||!t)&&(e+=i),r+=i}return e},e.exports=s},function(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},s=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var t,i=n.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!a)return!1;for(t in e);return void 0===t||n.call(e,t)},l=function(e,t){i&&"__proto__"===t.name?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;else if(a)return a(e,t).value}return e[t]};e.exports=function e(){var t,n,r,i,a,u,d=arguments[0],h=1,f=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<f;++h)if(t=arguments[h],null!=t)for(n in t)r=c(d,n),d!==(i=c(t,n))&&(p&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},l(d,{name:n,newValue:e(p,u,i)})):void 0!==i&&l(d,{name:n,newValue:i}));return d}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BlockEmbed=t.bubbleFormats=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=d(n(3)),o=d(n(2)),s=d(n(0)),l=d(n(16)),c=d(n(6)),u=d(n(7));function d(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function p(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return p(t,e),r(t,[{key:"attach",value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"attach",this).call(this),this.attributes=new s.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return new o.default().insert(this.value(),(0,a.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function(e,t){var n=s.default.query(e,s.default.Scope.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}},{key:"formatAt",value:function(e,t,n,r){this.format(n,r)}},{key:"insertAt",value:function(e,n,r){if("string"==typeof n&&n.endsWith("\n")){var a=s.default.create(g.blotName);this.parent.insertBefore(a,0===e?this:this.next),a.insertAt(0,n.slice(0,-1))}else i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,n,r)}}]),t}(s.default.Embed);m.scope=s.default.Scope.BLOCK_BLOT;var g=function(e){function t(e){h(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.cache={},n}return p(t,e),r(t,[{key:"delta",value:function(){return null==this.cache.delta&&(this.cache.delta=this.descendants(s.default.Leaf).reduce(function(e,t){return 0===t.length()?e:e.insert(t.value(),y(t))},new o.default).insert("\n",y(this))),this.cache.delta}},{key:"deleteAt",value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,n),this.cache={}}},{key:"formatAt",value:function(e,n,r,a){n<=0||(s.default.query(r,s.default.Scope.BLOCK)?e+n===this.length()&&this.format(r,a):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,Math.min(n,this.length()-e-1),r,a),this.cache={})}},{key:"insertAt",value:function(e,n,r){if(null!=r)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,n,r);if(0!==n.length){var a=n.split("\n"),o=a.shift();o.length>0&&(e<this.length()-1||null==this.children.tail?i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,Math.min(e,this.length()-1),o):this.children.tail.insertAt(this.children.tail.length(),o),this.cache={});var s=this;a.reduce(function(e,t){return(s=s.split(e,!0)).insertAt(0,t),t.length},e+o.length)}}},{key:"insertBefore",value:function(e,n){var r=this.children.head;i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,n),r instanceof l.default&&r.remove(),this.cache={}}},{key:"length",value:function(){return null==this.cache.length&&(this.cache.length=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"length",this).call(this)+1),this.cache.length}},{key:"moveChildren",value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"moveChildren",this).call(this,e,n),this.cache={}}},{key:"optimize",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.cache={}}},{key:"path",value:function(e){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e,!0)}},{key:"removeChild",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"removeChild",this).call(this,e),this.cache={}}},{key:"split",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n&&(0===e||e>=this.length()-1)){var r=this.clone();return 0===e?(this.parent.insertBefore(r,this),this):(this.parent.insertBefore(r,this.next),r)}var a=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"split",this).call(this,e,n);return this.cache={},a}}]),t}(s.default.Block);function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==e||("function"==typeof e.formats&&(t=(0,a.default)(t,e.formats())),null==e.parent||"scroll"==e.parent.blotName||e.parent.statics.scope!==e.statics.scope)?t:y(e.parent,t)}g.blotName="block",g.tagName="P",g.defaultChild="break",g.allowedChildren=[c.default,s.default.Embed,u.default],t.bubbleFormats=y,t.BlockEmbed=m,t.default=g},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.overload=t.expandConfig=void 0;var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(50);var o=g(n(2)),s=g(n(14)),l=g(n(8)),c=g(n(9)),u=g(n(0)),d=n(15),h=g(d),f=g(n(3)),p=g(n(10)),m=g(n(34));function g(e){return e&&e.__esModule?e:{default:e}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=(0,p.default)("quill"),b=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(this instanceof e))throw TypeError("Cannot call a class as a function");if(this.options=x(t,r),this.container=this.options.container,null==this.container)return v.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);var i=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new l.default,this.scroll=u.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new s.default(this.scroll),this.selection=new h.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e){e===l.default.events.TEXT_CHANGE&&n.root.classList.toggle("ql-blank",n.editor.isBlank())}),this.emitter.on(l.default.events.SCROLL_UPDATE,function(e,t){var r=n.selection.lastRange,i=r&&0===r.length?r.index:void 0;w.call(n,function(){return n.editor.update(null,t,i)},e)});var a=this.clipboard.convert("<div class='ql-editor' style=\"white-space: normal;\">"+i+"<p><br></p></div>");this.setContents(a),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return a(e,null,[{key:"debug",value:function(e){!0===e&&(e="log"),p.default.level(e)}},{key:"find",value:function(e){return e.__quill||u.default.find(e)}},{key:"import",value:function(e){return null==this.imports[e]&&v.error("Cannot import "+e+". Are you sure it was registered?"),this.imports[e]}},{key:"register",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof e){var i=e.attrName||e.blotName;"string"==typeof i?this.register("formats/"+i,e,t):Object.keys(e).forEach(function(r){n.register(r,e[r],t)})}else null==this.imports[e]||r||v.warn("Overwriting "+e+" with",t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&"abstract"!==t.blotName?u.default.register(t):e.startsWith("modules")&&"function"==typeof t.register&&t.register()}}]),a(e,[{key:"addContainer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){var n=e;(e=document.createElement("div")).classList.add(n)}return this.container.insertBefore(e,t),e}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(e,t,n){var r=this,a=i(C(e,t,n),4);return e=a[0],t=a[1],w.call(this,function(){return r.editor.deleteText(e,t)},n=a[3],e,-1*t)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}},{key:"focus",value:function(){var e=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=e,this.scrollIntoView()}},{key:"format",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;return w.call(this,function(){var r=n.getSelection(!0),i=new o.default;if(null==r)return i;if(u.default.query(e,u.default.Scope.BLOCK))i=n.editor.formatLine(r.index,r.length,y({},e,t));else{if(0===r.length)return n.selection.format(e,t),i;i=n.editor.formatText(r.index,r.length,y({},e,t))}return n.setSelection(r,l.default.sources.SILENT),i},r)}},{key:"formatLine",value:function(e,t,n,r,a){var o=this,s=void 0,l=i(C(e,t,n,r,a),4);return e=l[0],t=l[1],s=l[2],w.call(this,function(){return o.editor.formatLine(e,t,s)},a=l[3],e,0)}},{key:"formatText",value:function(e,t,n,r,a){var o=this,s=void 0,l=i(C(e,t,n,r,a),4);return e=l[0],t=l[1],s=l[2],w.call(this,function(){return o.editor.formatText(e,t,s)},a=l[3],e,0)}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=void 0;n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length);var r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}},{key:"getContents",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,n=i(C(e,t),2);return e=n[0],t=n[1],this.editor.getContents(e,t)}},{key:"getFormat",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}},{key:"getIndex",value:function(e){return e.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(e){return this.scroll.leaf(e)}},{key:"getLine",value:function(e){return this.scroll.line(e)}},{key:"getLines",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}},{key:"getModule",value:function(e){return this.theme.modules[e]}},{key:"getSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,n=i(C(e,t),2);return e=n[0],t=n[1],this.editor.getText(e,t)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(t,n,r){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return w.call(this,function(){return i.editor.insertEmbed(t,n,r)},a,t)}},{key:"insertText",value:function(e,t,n,r,a){var o=this,s=void 0,l=i(C(e,0,n,r,a),4);return e=l[0],s=l[2],w.call(this,function(){return o.editor.insertText(e,t,s)},a=l[3],e,t.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(e,t,n){this.clipboard.dangerouslyPasteHTML(e,t,n)}},{key:"removeFormat",value:function(e,t,n){var r=this,a=i(C(e,t,n),4);return e=a[0],t=a[1],w.call(this,function(){return r.editor.removeFormat(e,t)},n=a[3],e)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){e=new o.default(e);var n=t.getLength(),r=t.editor.deleteText(0,n),i=t.editor.applyDelta(e),a=i.ops[i.ops.length-1];return null!=a&&"string"==typeof a.insert&&"\n"===a.insert[a.insert.length-1]&&(t.editor.deleteText(t.getLength()-1,1),i.delete(1)),r.compose(i)},n)}},{key:"setSelection",value:function(t,n,r){if(null==t)this.selection.setRange(null,n||e.sources.API);else{var a=i(C(t,n,r),4);t=a[0],n=a[1],r=a[3],this.selection.setRange(new d.Range(t,n),r),r!==l.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API,n=new o.default().insert(e);return this.setContents(n,t)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.scroll.update(e);return this.selection.update(e),t}},{key:"updateContents",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){return e=new o.default(e),t.editor.applyDelta(e,n)},n,!0)}}]),e}();function x(e,t){if((t=(0,f.default)(!0,{container:e,modules:{clipboard:!0,keyboard:!0,history:!0}},t)).theme&&t.theme!==b.DEFAULTS.theme){if(t.theme=b.import("themes/"+t.theme),null==t.theme)throw Error("Invalid theme "+t.theme+". Did you register it?")}else t.theme=m.default;var n=(0,f.default)(!0,{},t.theme.DEFAULTS);[n,t].forEach(function(e){e.modules=e.modules||{},Object.keys(e.modules).forEach(function(t){!0===e.modules[t]&&(e.modules[t]={})})});var r=Object.keys(n.modules).concat(Object.keys(t.modules)).reduce(function(e,t){var n=b.import("modules/"+t);return null==n?v.error("Cannot load "+t+" module. Are you sure you registered it?"):e[t]=n.DEFAULTS||{},e},{});return null!=t.modules&&t.modules.toolbar&&t.modules.toolbar.constructor!==Object&&(t.modules.toolbar={container:t.modules.toolbar}),t=(0,f.default)(!0,{},b.DEFAULTS,{modules:r},n,t),["bounds","container","scrollingContainer"].forEach(function(e){"string"==typeof t[e]&&(t[e]=document.querySelector(t[e]))}),t.modules=Object.keys(t.modules).reduce(function(e,n){return t.modules[n]&&(e[n]=t.modules[n]),e},{}),t}function w(e,t,n,r){if(this.options.strict&&!this.isEnabled()&&t===l.default.sources.USER)return new o.default;var i=null==n?null:this.getSelection(),a=this.editor.delta,s=e();if(null!=i&&(!0===n&&(n=i.index),null==r?i=S(i,s,t):0!==r&&(i=S(i,n,r,t)),this.setSelection(i,l.default.sources.SILENT)),s.length()>0){var c,u,d=[l.default.events.TEXT_CHANGE,s,a,t];(c=this.emitter).emit.apply(c,[l.default.events.EDITOR_CHANGE].concat(d)),t!==l.default.sources.SILENT&&(u=this.emitter).emit.apply(u,d)}return s}function C(e,t,n,i,a){var o={};return"number"==typeof e.index&&"number"==typeof e.length?("number"!=typeof t&&(a=i,i=n,n=t),t=e.length,e=e.index):"number"!=typeof t&&(a=i,i=n,n=t,t=0),(void 0===n?"undefined":r(n))==="object"?(o=n,a=i):"string"==typeof n&&(null!=i?o[n]=i:a=n),[e,t,o,a=a||l.default.sources.API]}function S(e,t,n,r){if(null==e)return null;var a=void 0,s=void 0;if(t instanceof o.default){var c=i([e.index,e.index+e.length].map(function(e){return t.transformPosition(e,r!==l.default.sources.USER)}),2);a=c[0],s=c[1]}else{var u=i([e.index,e.index+e.length].map(function(e){return e<t||e===t&&r===l.default.sources.USER?e:n>=0?e+n:Math.max(t,e+n)}),2);a=u[0],s=u[1]}return new d.Range(a,s-a)}b.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},b.events=l.default.events,b.sources=l.default.sources,b.version="1.3.7",b.imports={delta:o.default,parchment:u.default,"core/module":c.default,"core/theme":m.default},t.expandConfig=x,t.overload=C,t.default=b},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=s(n(7)),o=s(n(0));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"formatAt",value:function(e,n,r,a){if(0>t.compare(this.statics.blotName,r)&&o.default.query(r,o.default.Scope.BLOT)){var s=this.isolate(e,n);a&&s.wrap(r,a)}else i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,n,r,a)}},{key:"optimize",value:function(e){if(i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.parent instanceof t&&t.compare(this.statics.blotName,this.parent.statics.blotName)>0){var n=this.parent.isolate(this.offset(),this.length());this.moveChildren(n),n.wrap(this)}}}],[{key:"compare",value:function(e,n){var r=t.order.indexOf(e),i=t.order.indexOf(n);return r>=0||i>=0?r-i:e===n?0:e<n?-1:1}}]),t}(o.default.Inline);l.allowedChildren=[l,o.default.Embed,a.default],l.order=["cursor","inline","underline","strike","italic","bold","script","link","code"],t.default=l},function(e,t,n){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(0))&&r.__esModule?r:{default:r}).default.Text)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=o(n(54));function o(e){return e&&e.__esModule?e:{default:e}}var s=(0,o(n(10)).default)("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(function(e){document.addEventListener(e,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];[].slice.call(document.querySelectorAll(".ql-container")).forEach(function(e){if(e.__quill&&e.__quill.emitter){var n;(n=e.__quill.emitter).handleDOM.apply(n,t)}})})});var l=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.listeners={},e.on("error",s.error),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"emit",value:function(){s.log.apply(s,arguments),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).apply(this,arguments)}},{key:"handleDOM",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.listeners[e.type]||[]).forEach(function(t){var r=t.node,i=t.handler;(e.target===r||r.contains(e.target))&&i.apply(void 0,[e].concat(n))})}},{key:"listenDOM",value:function(e,t,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({node:t,handler:n})}}]),t}(a.default);l.events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},l.sources={API:"api",SILENT:"silent",USER:"user"},t.default=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.quill=t,this.options=n};r.DEFAULTS={},t.default=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=["error","warn","log","info"],i="warn";function a(e){if(r.indexOf(e)<=r.indexOf(i)){for(var t,n=arguments.length,a=Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];(t=console)[e].apply(t,a)}}function o(e){return r.reduce(function(t,n){return t[n]=a.bind(console,n,e),t},{})}a.level=o.level=function(e){i=e},t.default=o},function(e,t,n){var r=Array.prototype.slice,i=n(52),a=n(53),o=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():e&&t&&("object"==typeof e||"object"==typeof t)?function(e,t,n){if(null==e||null==t||e.prototype!==t.prototype)return!1;if(a(e))return!!a(t)&&o(e=r.call(e),t=r.call(t),n);if(s(e)){if(!s(t)||e.length!==t.length)return!1;for(l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}try{var l,c,u=i(e),d=i(t)}catch(e){return!1}if(u.length!=d.length)return!1;for(u.sort(),d.sort(),l=u.length-1;l>=0;l--)if(u[l]!=d[l])return!1;for(l=u.length-1;l>=0;l--)if(!o(e[c=u[l]],t[c],n))return!1;return typeof e==typeof t}(e,t,n):n.strict?e===t:e==t)};function s(e){return!!e&&"object"==typeof e&&"number"==typeof e.length&&"function"==typeof e.copy&&"function"==typeof e.slice&&(!(e.length>0)||"number"==typeof e[0])}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(){function e(e,t,n){void 0===n&&(n={}),this.attrName=e,this.keyName=t;var i=r.Scope.TYPE&r.Scope.ATTRIBUTE;null!=n.scope?this.scope=n.scope&r.Scope.LEVEL|i:this.scope=r.Scope.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}return e.keys=function(e){return[].map.call(e.attributes,function(e){return e.name})},e.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)},e.prototype.canAdd=function(e,t){return null!=r.query(e,r.Scope.BLOT&(this.scope|r.Scope.TYPE))&&(null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1))},e.prototype.remove=function(e){e.removeAttribute(this.keyName)},e.prototype.value=function(e){var t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""},e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Code=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=d(n(2)),s=d(n(0)),l=d(n(4)),c=d(n(6)),u=d(n(7));function d(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function p(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return p(t,e),t}(c.default);m.blotName="code",m.tagName="CODE";var g=function(e){function t(){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return p(t,e),i(t,[{key:"delta",value:function(){var e=this,t=this.domNode.textContent;return t.endsWith("\n")&&(t=t.slice(0,-1)),t.split("\n").reduce(function(t,n){return t.insert(n).insert("\n",e.formats())},new o.default)}},{key:"format",value:function(e,n){if(e!==this.statics.blotName||!n){var i=r(this.descendant(u.default,this.length()-1),1)[0];null!=i&&i.deleteAt(i.length()-1,1),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n)}}},{key:"formatAt",value:function(e,n,r,i){if(0!==n&&null!=s.default.query(r,s.default.Scope.BLOCK)&&(r!==this.statics.blotName||i!==this.statics.formats(this.domNode))){var a=this.newlineIndex(e);if(!(a<0)&&!(a>=e+n)){var o=this.newlineIndex(e,!0)+1,l=a-o+1,c=this.isolate(o,l),u=c.next;c.format(r,i),u instanceof t&&u.formatAt(0,e-o+n-l,r,i)}}}},{key:"insertAt",value:function(e,t,n){if(null==n){var i=r(this.descendant(u.default,e),2),a=i[0],o=i[1];a.insertAt(o,t)}}},{key:"length",value:function(){var e=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?e:e+1}},{key:"newlineIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return this.domNode.textContent.slice(0,e).lastIndexOf("\n");var n=this.domNode.textContent.slice(e).indexOf("\n");return n>-1?e+n:-1}},{key:"optimize",value:function(e){this.domNode.textContent.endsWith("\n")||this.appendChild(s.default.create("text","\n")),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===n.statics.formats(n.domNode)&&(n.optimize(e),n.moveChildren(this),n.remove())}},{key:"replace",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(e){var t=s.default.find(e);null==t?e.parentNode.removeChild(e):t instanceof s.default.Embed?t.remove():t.unwrap()})}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return n.setAttribute("spellcheck",!1),n}},{key:"formats",value:function(){return!0}}]),t}(l.default);g.blotName="code-block",g.tagName="PRE",g.TAB=" ",t.Code=m,t.default=g},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=y(n(2)),s=y(n(20)),l=y(n(0)),c=y(n(13)),u=y(n(24)),d=n(4),h=y(d),f=y(n(16)),p=y(n(21)),m=y(n(11)),g=y(n(3));function y(e){return e&&e.__esModule?e:{default:e}}var v=/^[ -~]*$/;t.default=function(){function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.scroll=t,this.delta=this.getDelta()}return a(e,[{key:"applyDelta",value:function(e){var t=this,n=!1;this.scroll.update();var a=this.scroll.length();return this.scroll.batchStart(),(e=e.reduce(function(e,t){if(1===t.insert){var n=(0,p.default)(t.attributes);return delete n.image,e.insert({image:t.attributes.image},n)}if(null!=t.attributes&&(!0===t.attributes.list||!0===t.attributes.bullet)&&((t=(0,p.default)(t)).attributes.list?t.attributes.list="ordered":(t.attributes.list="bullet",delete t.attributes.bullet)),"string"==typeof t.insert){var r=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(r,t.attributes)}return e.push(t)},new o.default)).reduce(function(e,o){var c=o.retain||o.delete||o.insert.length||1,u=o.attributes||{};if(null!=o.insert){if("string"==typeof o.insert){var f=o.insert;f.endsWith("\n")&&n&&(n=!1,f=f.slice(0,-1)),e>=a&&!f.endsWith("\n")&&(n=!0),t.scroll.insertAt(e,f);var p=i(t.scroll.line(e),2),m=p[0],y=p[1],v=(0,g.default)({},(0,d.bubbleFormats)(m));if(m instanceof h.default){var b=i(m.descendant(l.default.Leaf,y),1)[0];v=(0,g.default)(v,(0,d.bubbleFormats)(b))}u=s.default.attributes.diff(v,u)||{}}else if("object"===r(o.insert)){var x=Object.keys(o.insert)[0];if(null==x)return e;t.scroll.insertAt(e,x,o.insert[x])}a+=c}return Object.keys(u).forEach(function(n){t.scroll.formatAt(e,c,n,u[n])}),e+c},0),e.reduce(function(e,n){return"number"==typeof n.delete?(t.scroll.deleteAt(e,n.delete),e):e+(n.retain||n.insert.length||1)},0),this.scroll.batchEnd(),this.update(e)}},{key:"deleteText",value:function(e,t){return this.scroll.deleteAt(e,t),this.update(new o.default().retain(e).delete(t))}},{key:"formatLine",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(r).forEach(function(i){if(null==n.scroll.whitelist||n.scroll.whitelist[i]){var a=n.scroll.lines(e,Math.max(t,1)),o=t;a.forEach(function(t){var a=t.length();if(t instanceof c.default){var s=e-t.offset(n.scroll),l=t.newlineIndex(s+o)-s+1;t.formatAt(s,l,i,r[i])}else t.format(i,r[i]);o-=a})}}),this.scroll.optimize(),this.update(new o.default().retain(e).retain(t,(0,p.default)(r)))}},{key:"formatText",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(r).forEach(function(i){n.scroll.formatAt(e,t,i,r[i])}),this.update(new o.default().retain(e).retain(t,(0,p.default)(r)))}},{key:"getContents",value:function(e,t){return this.delta.slice(e,e+t)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(e,t){return e.concat(t.delta())},new o.default)}},{key:"getFormat",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(function(e){var t=i(e,1)[0];t instanceof h.default?n.push(t):t instanceof l.default.Leaf&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(l.default.Leaf,e,t));var a=[n,r].map(function(e){if(0===e.length)return{};for(var t=(0,d.bubbleFormats)(e.shift());Object.keys(t).length>0;){var n=e.shift();if(null==n)break;t=function(e,t){return Object.keys(t).reduce(function(n,r){return null==e[r]||(t[r]===e[r]?n[r]=t[r]:Array.isArray(t[r])?0>t[r].indexOf(e[r])&&(n[r]=t[r].concat([e[r]])):n[r]=[t[r],e[r]]),n},{})}((0,d.bubbleFormats)(n),t)}return t});return g.default.apply(g.default,a)}},{key:"getText",value:function(e,t){return this.getContents(e,t).filter(function(e){return"string"==typeof e.insert}).map(function(e){return e.insert}).join("")}},{key:"insertEmbed",value:function(e,t,n){var r;return this.scroll.insertAt(e,t,n),this.update(new o.default().retain(e).insert((t in(r={})?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r)))}},{key:"insertText",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(r).forEach(function(i){n.scroll.formatAt(e,t.length,i,r[i])}),this.update(new o.default().retain(e).insert(t,(0,p.default)(r)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var e=this.scroll.children.head;return e.statics.blotName===h.default.blotName&&!(e.children.length>1)&&e.children.head instanceof f.default}},{key:"removeFormat",value:function(e,t){var n=this.getText(e,t),r=i(this.scroll.line(e+t),2),a=r[0],s=r[1],l=0,u=new o.default;null!=a&&(l=a instanceof c.default?a.newlineIndex(s)-s+1:a.length()-s,u=a.delta().slice(s,s+l-1).insert("\n"));var d=this.getContents(e,t+l).diff(new o.default().insert(n).concat(u)),h=new o.default().retain(e).concat(d);return this.applyDelta(h)}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(v)&&l.default.find(t[0].target)){var i=l.default.find(t[0].target),a=(0,d.bubbleFormats)(i),s=i.offset(this.scroll),c=t[0].oldValue.replace(u.default.CONTENTS,""),h=new o.default().insert(c),f=new o.default().insert(i.value());e=new o.default().retain(s).concat(h.diff(f,n)).reduce(function(e,t){return t.insert?e.insert(t.insert,a):e.push(t)},new o.default),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&(0,m.default)(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Range=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=c(n(0)),o=c(n(21)),s=c(n(11)),l=c(n(8));function c(e){return e&&e.__esModule?e:{default:e}}function u(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}function d(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}var h=(0,c(n(10)).default)("quill:selection"),f=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;d(this,e),this.index=t,this.length=n},p=function(){function e(t,n){var r=this;d(this,e),this.emitter=n,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=a.default.create("cursor",this),this.lastRange=this.savedRange=new f(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){r.mouseDown||setTimeout(r.update.bind(r,l.default.sources.USER),1)}),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e,t){e===l.default.events.TEXT_CHANGE&&t.length()>0&&r.update(l.default.sources.SILENT)}),this.emitter.on(l.default.events.SCROLL_BEFORE_UPDATE,function(){if(r.hasFocus()){var e=r.getNativeRange();null==e||e.start.node!==r.cursor.textNode&&r.emitter.once(l.default.events.SCROLL_UPDATE,function(){try{r.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset)}catch(e){}})}}),this.emitter.on(l.default.events.SCROLL_OPTIMIZE,function(e,t){if(t.range){var n=t.range,i=n.startNode,a=n.startOffset,o=n.endNode,s=n.endOffset;r.setNativeRange(i,a,o,s)}}),this.update(l.default.sources.SILENT)}return i(e,[{key:"handleComposition",value:function(){var e=this;this.root.addEventListener("compositionstart",function(){e.composing=!0}),this.root.addEventListener("compositionend",function(){if(e.composing=!1,e.cursor.parent){var t=e.cursor.restore();t&&setTimeout(function(){e.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}},{key:"handleDragging",value:function(){var e=this;this.emitter.listenDOM("mousedown",document.body,function(){e.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){e.mouseDown=!1,e.update(l.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(e,t){if(null==this.scroll.whitelist||this.scroll.whitelist[e]){this.scroll.update();var n=this.getNativeRange();if(!(null==n||!n.native.collapsed||a.default.query(e,a.default.Scope.BLOCK))){if(n.start.node!==this.cursor.textNode){var r=a.default.find(n.start.node,!1);if(null==r)return;if(r instanceof a.default.Leaf){var i=r.split(n.start.offset);r.parent.insertBefore(this.cursor,i)}else r.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.scroll.length();t=Math.min((e=Math.min(e,n-1))+t,n-1)-e;var i=void 0,a=r(this.scroll.leaf(e),2),o=a[0],s=a[1];if(null==o)return null;var l=r(o.position(s,!0),2);i=l[0],s=l[1];var c=document.createRange();if(t>0){c.setStart(i,s);var u=r(this.scroll.leaf(e+t),2);if(o=u[0],s=u[1],null==o)return null;var d=r(o.position(s,!0),2);return i=d[0],s=d[1],c.setEnd(i,s),c.getBoundingClientRect()}var h="left",f=void 0;return i instanceof Text?(s<i.data.length?(c.setStart(i,s),c.setEnd(i,s+1)):(c.setStart(i,s-1),c.setEnd(i,s),h="right"),f=c.getBoundingClientRect()):(f=o.domNode.getBoundingClientRect(),s>0&&(h="right")),{bottom:f.top+f.height,height:f.height,left:f[h],right:f[h],top:f.top,width:0}}},{key:"getNativeRange",value:function(){var e=document.getSelection();if(null==e||e.rangeCount<=0)return null;var t=e.getRangeAt(0);if(null==t)return null;var n=this.normalizeNative(t);return h.info("getNativeRange",n),n}},{key:"getRange",value:function(){var e=this.getNativeRange();return null==e?[null,null]:[this.normalizedToRange(e),e]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(e){var t=this,n=[[e.start.node,e.start.offset]];e.native.collapsed||n.push([e.end.node,e.end.offset]);var i=n.map(function(e){var n=r(e,2),i=n[0],o=n[1],s=a.default.find(i,!0),l=s.offset(t.scroll);return 0===o?l:s instanceof a.default.Container?l+s.length():l+s.index(i,o)}),o=Math.min(Math.max.apply(Math,u(i)),this.scroll.length()-1),s=Math.min.apply(Math,[o].concat(u(i)));return new f(s,o-s)}},{key:"normalizeNative",value:function(e){if(!m(this.root,e.startContainer)||!e.collapsed&&!m(this.root,e.endContainer))return null;var t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(function(e){for(var t=e.node,n=e.offset;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else if(t.childNodes.length===n)n=(t=t.lastChild)instanceof Text?t.data.length:t.childNodes.length+1;else break;e.node=t,e.offset=n}),t}},{key:"rangeToNative",value:function(e){var t=this,n=e.collapsed?[e.index]:[e.index,e.index+e.length],i=[],a=this.scroll.length();return n.forEach(function(e,n){e=Math.min(a-1,e);var o=void 0,s=r(t.scroll.leaf(e),2),l=s[0],c=s[1],u=r(l.position(c,0!==n),2);o=u[0],c=u[1],i.push(o,c)}),i.length<2&&(i=i.concat(i)),i}},{key:"scrollIntoView",value:function(e){var t=this.lastRange;if(null!=t){var n=this.getBounds(t.index,t.length);if(null!=n){var i=this.scroll.length()-1,a=r(this.scroll.line(Math.min(t.index,i)),1)[0],o=a;if(t.length>0&&(o=r(this.scroll.line(Math.min(t.index+t.length,i)),1)[0]),null!=a&&null!=o){var s=e.getBoundingClientRect();n.top<s.top?e.scrollTop-=s.top-n.top:n.bottom>s.bottom&&(e.scrollTop+=n.bottom-s.bottom)}}}}},{key:"setNativeRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(h.info("setNativeRange",e,t,n,r),null==e||null!=this.root.parentNode&&null!=e.parentNode&&null!=n.parentNode){var a=document.getSelection();if(null!=a)if(null!=e){this.hasFocus()||this.root.focus();var o=(this.getNativeRange()||{}).native;if(null==o||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){"BR"==e.tagName&&(t=[].indexOf.call(e.parentNode.childNodes,e),e=e.parentNode),"BR"==n.tagName&&(r=[].indexOf.call(n.parentNode.childNodes,n),n=n.parentNode);var s=document.createRange();s.setStart(e,t),s.setEnd(n,r),a.removeAllRanges(),a.addRange(s)}}else a.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;if("string"==typeof t&&(n=t,t=!1),h.info("setRange",e),null!=e){var r=this.rangeToNative(e);this.setNativeRange.apply(this,u(r).concat([t]))}else this.setNativeRange(null);this.update(n)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.lastRange,n=r(this.getRange(),2),i=n[0],a=n[1];if(this.lastRange=i,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,s.default)(t,this.lastRange)){!this.composing&&null!=a&&a.native.collapsed&&a.start.node!==this.cursor.textNode&&this.cursor.restore();var c,u,d=[l.default.events.SELECTION_CHANGE,(0,o.default)(this.lastRange),(0,o.default)(t),e];(c=this.emitter).emit.apply(c,[l.default.events.EDITOR_CHANGE].concat(d)),e!==l.default.sources.SILENT&&(u=this.emitter).emit.apply(u,d)}}}]),e}();function m(e,t){try{t.parentNode}catch(e){return!1}return t instanceof Text&&(t=t.parentNode),e.contains(t)}t.Range=f,t.default=p},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"insertInto",value:function(e,n){0===e.children.length?a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertInto",this).call(this,e,n):this.remove()}},{key:"length",value:function(){return 0}},{key:"value",value:function(){return""}}],[{key:"value",value:function(){}}]),t}(((r=n(0))&&r.__esModule?r:{default:r}).default.Embed);o.blotName="break",o.tagName="BR",t.default=o},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(44),o=n(30),s=n(1);function l(e){var t=s.find(e);if(null==t)try{t=s.create(e)}catch(n){t=s.create(s.Scope.INLINE),[].slice.call(e.childNodes).forEach(function(e){t.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(t.domNode,e),t.attach()}return t}t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.build(),n}return i(t,e),t.prototype.appendChild=function(e){this.insertBefore(e)},t.prototype.attach=function(){e.prototype.attach.call(this),this.children.forEach(function(e){e.attach()})},t.prototype.build=function(){var e=this;this.children=new a.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(t){try{var n=l(t);e.insertBefore(n,e.children.head||void 0)}catch(e){if(e instanceof s.ParchmentError)return;throw e}})},t.prototype.deleteAt=function(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,function(e,t,n){e.deleteAt(t,n)})},t.prototype.descendant=function(e,n){var r=this.children.find(n),i=r[0],a=r[1];return null==e.blotName&&e(i)||null!=e.blotName&&i instanceof e?[i,a]:i instanceof t?i.descendant(e,a):[null,-1]},t.prototype.descendants=function(e,n,r){void 0===n&&(n=0),void 0===r&&(r=Number.MAX_VALUE);var i=[],a=r;return this.children.forEachAt(n,r,function(n,r,o){(null==e.blotName&&e(n)||null!=e.blotName&&n instanceof e)&&i.push(n),n instanceof t&&(i=i.concat(n.descendants(e,r,a))),a-=o}),i},t.prototype.detach=function(){this.children.forEach(function(e){e.detach()}),e.prototype.detach.call(this)},t.prototype.formatAt=function(e,t,n,r){this.children.forEachAt(e,t,function(e,t,i){e.formatAt(t,i,n,r)})},t.prototype.insertAt=function(e,t,n){var r=this.children.find(e),i=r[0],a=r[1];if(i)i.insertAt(a,t,n);else{var o=null==n?s.create("text",t):s.create(t,n);this.appendChild(o)}},t.prototype.insertBefore=function(e,t){if(null!=this.statics.allowedChildren&&!this.statics.allowedChildren.some(function(t){return e instanceof t}))throw new s.ParchmentError("Cannot insert "+e.statics.blotName+" into "+this.statics.blotName);e.insertInto(this,t)},t.prototype.length=function(){return this.children.reduce(function(e,t){return e+t.length()},0)},t.prototype.moveChildren=function(e,t){this.children.forEach(function(n){e.insertBefore(n,t)})},t.prototype.optimize=function(t){if(e.prototype.optimize.call(this,t),0===this.children.length)if(null!=this.statics.defaultChild){var n=s.create(this.statics.defaultChild);this.appendChild(n),n.optimize(t)}else this.remove()},t.prototype.path=function(e,n){void 0===n&&(n=!1);var r=this.children.find(e,n),i=r[0],a=r[1],o=[[this,e]];return i instanceof t?o.concat(i.path(a,n)):(null!=i&&o.push([i,a]),o)},t.prototype.removeChild=function(e){this.children.remove(e)},t.prototype.replace=function(n){n instanceof t&&n.moveChildren(this),e.prototype.replace.call(this,n)},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var n=this.clone();return this.parent.insertBefore(n,this.next),this.children.forEachAt(e,this.length(),function(e,r,i){e=e.split(r,t),n.appendChild(e)}),n},t.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},t.prototype.update=function(e,t){var n=this,r=[],i=[];e.forEach(function(e){e.target===n.domNode&&"childList"===e.type&&(r.push.apply(r,e.addedNodes),i.push.apply(i,e.removedNodes))}),i.forEach(function(e){if(!(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var t=s.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===n.domNode)&&t.detach()}}),r.filter(function(e){return e.parentNode==n.domNode}).sort(function(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(e){var t=null;null!=e.nextSibling&&(t=s.find(e.nextSibling));var r=l(e);(r.next!=t||null==r.next)&&(null!=r.parent&&r.parent.removeChild(n),n.insertBefore(r,t||void 0))})},t}(o.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(12),o=n(31),s=n(17),l=n(1);t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.attributes=new o.default(n.domNode),n}return i(t,e),t.formats=function(e){return"string"==typeof this.tagName||(Array.isArray(this.tagName)?e.tagName.toLowerCase():void 0)},t.prototype.format=function(e,t){var n=l.query(e);n instanceof a.default?this.attributes.attribute(n,t):t&&null!=n&&(e!==this.statics.blotName||this.formats()[e]!==t)&&this.replaceWith(e,t)},t.prototype.formats=function(){var e=this.attributes.values(),t=this.statics.formats(this.domNode);return null!=t&&(e[this.statics.blotName]=t),e},t.prototype.replaceWith=function(t,n){var r=e.prototype.replaceWith.call(this,t,n);return this.attributes.copy(r),r},t.prototype.update=function(t,n){var r=this;e.prototype.update.call(this,t,n),t.some(function(e){return e.target===r.domNode&&"attributes"===e.type})&&this.attributes.build()},t.prototype.wrap=function(n,r){var i=e.prototype.wrap.call(this,n,r);return i instanceof t&&i.statics.scope===this.statics.scope&&this.attributes.move(i),i},t}(s.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(30),o=n(1);t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.value=function(e){return!0},t.prototype.index=function(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1},t.prototype.position=function(e,t){var n=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]},t.prototype.value=function(){var e;return(e={})[this.statics.blotName]=this.statics.value(this.domNode)||!0,e},t.scope=o.Scope.INLINE_BLOT,t}(a.default)},function(e,t,n){var r=n(11),i=n(3),a={attributes:{compose:function(e,t,n){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var r=i(!0,{},t);for(var a in n||(r=Object.keys(r).reduce(function(e,t){return null!=r[t]&&(e[t]=r[t]),e},{})),e)void 0!==e[a]&&void 0===t[a]&&(r[a]=e[a]);return Object.keys(r).length>0?r:void 0},diff:function(e,t){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var n=Object.keys(e).concat(Object.keys(t)).reduce(function(n,i){return r(e[i],t[i])||(n[i]=void 0===t[i]?null:t[i]),n},{});return Object.keys(n).length>0?n:void 0},transform:function(e,t,n){if("object"!=typeof e)return t;if("object"==typeof t){if(!n)return t;var r=Object.keys(t).reduce(function(n,r){return void 0===e[r]&&(n[r]=t[r]),n},{});return Object.keys(r).length>0?r:void 0}}},iterator:function(e){return new o(e)},length:function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"string"==typeof e.insert?e.insert.length:1}};function o(e){this.ops=e,this.index=0,this.offset=0}o.prototype.hasNext=function(){return this.peekLength()<1/0},o.prototype.next=function(e){e||(e=1/0);var t=this.ops[this.index];if(!t)return{retain:1/0};var n=this.offset,r=a.length(t);if(e>=r-n?(e=r-n,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof t.delete)return{delete:e};var i={};return t.attributes&&(i.attributes=t.attributes),"number"==typeof t.retain?i.retain=e:"string"==typeof t.insert?i.insert=t.insert.substr(n,e):i.insert=t.insert,i},o.prototype.peek=function(){return this.ops[this.index]},o.prototype.peekLength=function(){return this.ops[this.index]?a.length(this.ops[this.index])-this.offset:1/0},o.prototype.peekType=function(){if(this.ops[this.index]){if("number"==typeof this.ops[this.index].delete)return"delete";else if("number"!=typeof this.ops[this.index].retain)return"insert"}return"retain"},o.prototype.rest=function(){if(!this.hasNext())return[];if(0===this.offset)return this.ops.slice(this.index);var e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)},e.exports=a},function(e,t){var n=function(){var e,t,n;function r(e,t){return null!=t&&e instanceof t}try{e=Map}catch(t){e=function(){}}try{t=Set}catch(e){t=function(){}}try{n=Promise}catch(e){n=function(){}}function i(a,s,l,c,u){"object"==typeof s&&(l=s.depth,c=s.prototype,u=s.includeNonEnumerable,s=s.circular);var d=[],h=[];return void 0===s&&(s=!0),void 0===l&&(l=1/0),function a(l,f){if(null===l)return null;if(0===f||"object"!=typeof l)return l;if(r(l,e))p=new e;else if(r(l,t))p=new t;else if(r(l,n))p=new n(function(e,t){l.then(function(t){e(a(t,f-1))},function(e){t(a(e,f-1))})});else if(i.__isArray(l))p=[];else if(i.__isRegExp(l))p=new RegExp(l.source,o(l)),l.lastIndex&&(p.lastIndex=l.lastIndex);else if(i.__isDate(l))p=new Date(l.getTime());else{if(aD.isBuffer(l))return p=aD.allocUnsafe?aD.allocUnsafe(l.length):new aD(l.length),l.copy(p),p;r(l,Error)?p=Object.create(l):void 0===c?p=Object.create(m=Object.getPrototypeOf(l)):(p=Object.create(c),m=c)}if(s){var p,m,g,y=d.indexOf(l);if(-1!=y)return h[y];d.push(l),h.push(p)}for(var v in r(l,e)&&l.forEach(function(e,t){var n=a(t,f-1),r=a(e,f-1);p.set(n,r)}),r(l,t)&&l.forEach(function(e){var t=a(e,f-1);p.add(t)}),l)m&&(g=Object.getOwnPropertyDescriptor(m,v)),g&&null==g.set||(p[v]=a(l[v],f-1));if(Object.getOwnPropertySymbols)for(var b=Object.getOwnPropertySymbols(l),v=0;v<b.length;v++){var x=b[v],w=Object.getOwnPropertyDescriptor(l,x);(!w||w.enumerable||u)&&(p[x]=a(l[x],f-1),w.enumerable||Object.defineProperty(p,x,{enumerable:!1}))}if(u)for(var C=Object.getOwnPropertyNames(l),v=0;v<C.length;v++){var S=C[v],w=Object.getOwnPropertyDescriptor(l,S);w&&w.enumerable||(p[S]=a(l[S],f-1),Object.defineProperty(p,S,{enumerable:!1}))}return p}(a,l)}function a(e){return Object.prototype.toString.call(e)}function o(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return i.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},i.__objToStr=a,i.__isDate=function(e){return"object"==typeof e&&"[object Date]"===a(e)},i.__isArray=function(e){return"object"==typeof e&&"[object Array]"===a(e)},i.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===a(e)},i.__getRegExpFlags=o,i}();"object"==typeof e&&e.exports&&(e.exports=n)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=f(n(0)),s=f(n(8)),l=n(4),c=f(l),u=f(n(16)),d=f(n(13)),h=f(n(25));function f(e){return e&&e.__esModule?e:{default:e}}function p(e){return e instanceof c.default||e instanceof l.BlockEmbed}var m=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.emitter=n.emitter,Array.isArray(n.whitelist)&&(r.whitelist=n.whitelist.reduce(function(e,t){return e[t]=!0,e},{})),r.domNode.addEventListener("DOMNodeInserted",function(){}),r.optimize(),r.enable(),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(e,n){var i=r(this.line(e),2),o=i[0],s=i[1],c=r(this.line(e+n),1)[0];if(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,n),null!=c&&o!==c&&s>0){if(o instanceof l.BlockEmbed||c instanceof l.BlockEmbed)return void this.optimize();if(o instanceof d.default){var h=o.newlineIndex(o.length(),!0);if(h>-1&&(o=o.split(h+1))===c)return void this.optimize()}else if(c instanceof d.default){var f=c.newlineIndex(0);f>-1&&c.split(f+1)}var p=c.children.head instanceof u.default?null:c.children.head;o.moveChildren(c,p),o.remove()}this.optimize()}},{key:"enable",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.domNode.setAttribute("contenteditable",e)}},{key:"formatAt",value:function(e,n,r,i){(null==this.whitelist||this.whitelist[r])&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,n,r,i),this.optimize())}},{key:"insertAt",value:function(e,n,r){if(null==r||null==this.whitelist||this.whitelist[n]){if(e>=this.length())if(null==r||null==o.default.query(n,o.default.Scope.BLOCK)){var i=o.default.create(this.statics.defaultChild);this.appendChild(i),null==r&&n.endsWith("\n")&&(n=n.slice(0,-1)),i.insertAt(0,n,r)}else{var s=o.default.create(n,r);this.appendChild(s)}else a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,n,r);this.optimize()}}},{key:"insertBefore",value:function(e,n){if(e.statics.scope===o.default.Scope.INLINE_BLOT){var r=o.default.create(this.statics.defaultChild);r.appendChild(e),e=r}a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,n)}},{key:"leaf",value:function(e){return this.path(e).pop()||[null,-1]}},{key:"line",value:function(e){return e===this.length()?this.line(e-1):this.descendant(p,e)}},{key:"lines",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return function e(t,n,r){var i=[],a=r;return t.children.forEachAt(n,r,function(t,n,r){p(t)?i.push(t):t instanceof o.default.Container&&(i=i.concat(e(t,n,a))),a-=r}),i}(this,e,t)}},{key:"optimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e,n),e.length>0&&this.emitter.emit(s.default.events.SCROLL_OPTIMIZE,e,n))}},{key:"path",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e).slice(1)}},{key:"update",value:function(e){if(!0!==this.batch){var n=s.default.sources.USER;"string"==typeof e&&(n=e),Array.isArray(e)||(e=this.observer.takeRecords()),e.length>0&&this.emitter.emit(s.default.events.SCROLL_BEFORE_UPDATE,n,e),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"update",this).call(this,e.concat([])),e.length>0&&this.emitter.emit(s.default.events.SCROLL_UPDATE,n,e)}}}]),t}(o.default.Scroll);m.blotName="scroll",m.className="ql-editor",m.tagName="DIV",m.defaultChild="block",m.allowedChildren=[c.default,l.BlockEmbed,h.default],t.default=m},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.SHORTKEY=t.default=void 0;var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=m(n(21)),s=m(n(11)),l=m(n(3)),c=m(n(2)),u=m(n(20)),d=m(n(0)),h=m(n(5)),f=m(n(10)),p=m(n(9));function m(e){return e&&e.__esModule?e:{default:e}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y=(0,f.default)("quill:keyboard"),v=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",b=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.bindings={},Object.keys(r.options.bindings).forEach(function(t){("list autofill"!==t||null==e.scroll.whitelist||e.scroll.whitelist.list)&&r.options.bindings[t]&&r.addBinding(r.options.bindings[t])}),r.addBinding({key:t.keys.ENTER,shiftKey:null},k),r.addBinding({key:t.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(r.addBinding({key:t.keys.BACKSPACE},{collapsed:!0},w),r.addBinding({key:t.keys.DELETE},{collapsed:!0},C)):(r.addBinding({key:t.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},w),r.addBinding({key:t.keys.DELETE},{collapsed:!0,suffix:/^.?$/},C)),r.addBinding({key:t.keys.BACKSPACE},{collapsed:!1},S),r.addBinding({key:t.keys.DELETE},{collapsed:!1},S),r.addBinding({key:t.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},w),r.listen(),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),a(t,null,[{key:"match",value:function(e,t){return t=T(t),!["altKey","ctrlKey","metaKey","shiftKey"].some(function(n){return!!t[n]!==e[n]&&null!==t[n]})&&t.key===(e.which||e.keyCode)}}]),a(t,[{key:"addBinding",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=T(e);if(null==r||null==r.key)return y.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n}),r=(0,l.default)(r,t,n),this.bindings[r.key]=this.bindings[r.key]||[],this.bindings[r.key].push(r)}},{key:"listen",value:function(){var e=this;this.quill.root.addEventListener("keydown",function(n){if(!n.defaultPrevented){var a=n.which||n.keyCode,o=(e.bindings[a]||[]).filter(function(e){return t.match(n,e)});if(0!==o.length){var l=e.quill.getSelection();if(null!=l&&e.quill.hasFocus()){var c=i(e.quill.getLine(l.index),2),u=c[0],h=c[1],f=i(e.quill.getLeaf(l.index),2),p=f[0],m=f[1],g=i(0===l.length?[p,m]:e.quill.getLeaf(l.index+l.length),2),y=g[0],v=g[1],b=p instanceof d.default.Text?p.value().slice(0,m):"",x=y instanceof d.default.Text?y.value().slice(v):"",w={collapsed:0===l.length,empty:0===l.length&&1>=u.length(),format:e.quill.getFormat(l),offset:h,prefix:b,suffix:x};o.some(function(t){if(null!=t.collapsed&&t.collapsed!==w.collapsed||null!=t.empty&&t.empty!==w.empty||null!=t.offset&&t.offset!==w.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(function(e){return null==w.format[e]}))return!1}else if("object"===r(t.format)&&!Object.keys(t.format).every(function(e){return!0===t.format[e]?null!=w.format[e]:!1===t.format[e]?null==w.format[e]:(0,s.default)(t.format[e],w.format[e])}))return!1;return(null==t.prefix||!!t.prefix.test(w.prefix))&&(null==t.suffix||!!t.suffix.test(w.suffix))&&!0!==t.handler.call(e,l,w)})&&n.preventDefault()}}}})}}]),t}(p.default);function x(e,t){var n,r=e===b.keys.LEFT?"prefix":"suffix";return g(n={key:e,shiftKey:t,altKey:null},r,/^$/),g(n,"handler",function(n){var r=n.index;return e===b.keys.RIGHT&&(r+=n.length+1),!(i(this.quill.getLeaf(r),1)[0]instanceof d.default.Embed)||(e===b.keys.LEFT?t?this.quill.setSelection(n.index-1,n.length+1,h.default.sources.USER):this.quill.setSelection(n.index-1,h.default.sources.USER):t?this.quill.setSelection(n.index,n.length+1,h.default.sources.USER):this.quill.setSelection(n.index+n.length+1,h.default.sources.USER),!1)}),n}function w(e,t){if(!(0===e.index||1>=this.quill.getLength())){var n=i(this.quill.getLine(e.index),1)[0],r={};if(0===t.offset){var a=i(this.quill.getLine(e.index-1),1)[0];if(null!=a&&a.length()>1){var o=n.formats(),s=this.quill.getFormat(e.index-1,1);r=u.default.attributes.diff(o,s)||{}}}var l=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;this.quill.deleteText(e.index-l,l,h.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index-l,l,r,h.default.sources.USER),this.quill.focus()}}function C(e,t){var n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(!(e.index>=this.quill.getLength()-n)){var r={},a=0,o=i(this.quill.getLine(e.index),1)[0];if(t.offset>=o.length()-1){var s=i(this.quill.getLine(e.index+1),1)[0];if(s){var l=o.formats(),c=this.quill.getFormat(e.index,1);r=u.default.attributes.diff(l,c)||{},a=s.length()}}this.quill.deleteText(e.index,n,h.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index+a-1,n,r,h.default.sources.USER)}}function S(e){var t=this.quill.getLines(e),n={};if(t.length>1){var r=t[0].formats(),i=t[t.length-1].formats();n=u.default.attributes.diff(i,r)||{}}this.quill.deleteText(e,h.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(e.index,1,n,h.default.sources.USER),this.quill.setSelection(e.index,h.default.sources.SILENT),this.quill.focus()}function k(e,t){var n=this;e.length>0&&this.quill.scroll.deleteAt(e.index,e.length);var r=Object.keys(t.format).reduce(function(e,n){return d.default.query(n,d.default.Scope.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e},{});this.quill.insertText(e.index,"\n",r,h.default.sources.USER),this.quill.setSelection(e.index+1,h.default.sources.SILENT),this.quill.focus(),Object.keys(t.format).forEach(function(e){null!=r[e]||Array.isArray(t.format[e])||"link"!==e&&n.quill.format(e,t.format[e],h.default.sources.USER)})}function _(e){return{key:b.keys.TAB,shiftKey:!e,format:{"code-block":!0},handler:function(t){var n=d.default.query("code-block"),r=t.index,a=t.length,o=i(this.quill.scroll.descendant(n,r),2),s=o[0],l=o[1];if(null!=s){var c=this.quill.getIndex(s),u=s.newlineIndex(l,!0)+1,f=s.newlineIndex(c+l+a),p=s.domNode.textContent.slice(u,f).split("\n");l=0,p.forEach(function(t,i){e?(s.insertAt(u+l,n.TAB),l+=n.TAB.length,0===i?r+=n.TAB.length:a+=n.TAB.length):t.startsWith(n.TAB)&&(s.deleteAt(u+l,n.TAB.length),l-=n.TAB.length,0===i?r-=n.TAB.length:a-=n.TAB.length),l+=t.length+1}),this.quill.update(h.default.sources.USER),this.quill.setSelection(r,a,h.default.sources.SILENT)}}}}function E(e){return{key:e[0].toUpperCase(),shortKey:!0,handler:function(t,n){this.quill.format(e,!n.format[e],h.default.sources.USER)}}}function T(e){if("string"==typeof e||"number"==typeof e)return T({key:e});if((void 0===e?"undefined":r(e))==="object"&&(e=(0,o.default)(e,!1)),"string"==typeof e.key)if(null!=b.keys[e.key.toUpperCase()])e.key=b.keys[e.key.toUpperCase()];else{if(1!==e.key.length)return null;e.key=e.key.toUpperCase().charCodeAt(0)}return e.shortKey&&(e[v]=e.shortKey,delete e.shortKey),e}b.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},b.DEFAULTS={bindings:{bold:E("bold"),italic:E("italic"),underline:E("underline"),indent:{key:b.keys.TAB,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","+1",h.default.sources.USER)}},outdent:{key:b.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","-1",h.default.sources.USER)}},"outdent backspace":{key:b.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(e,t){null!=t.format.indent?this.quill.format("indent","-1",h.default.sources.USER):null!=t.format.list&&this.quill.format("list",!1,h.default.sources.USER)}},"indent code-block":_(!0),"outdent code-block":_(!1),"remove tab":{key:b.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(e){this.quill.deleteText(e.index-1,1,h.default.sources.USER)}},tab:{key:b.keys.TAB,handler:function(e){this.quill.history.cutoff();var t=new c.default().retain(e.index).delete(e.length).insert(" ");this.quill.updateContents(t,h.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,h.default.sources.SILENT)}},"list empty enter":{key:b.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(e,t){this.quill.format("list",!1,h.default.sources.USER),t.format.indent&&this.quill.format("indent",!1,h.default.sources.USER)}},"checklist enter":{key:b.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(e){var t=i(this.quill.getLine(e.index),2),n=t[0],r=t[1],a=(0,l.default)({},n.formats(),{list:"checked"}),o=new c.default().retain(e.index).insert("\n",a).retain(n.length()-r-1).retain(1,{list:"unchecked"});this.quill.updateContents(o,h.default.sources.USER),this.quill.setSelection(e.index+1,h.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:b.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(e,t){var n=i(this.quill.getLine(e.index),2),r=n[0],a=n[1],o=new c.default().retain(e.index).insert("\n",t.format).retain(r.length()-a-1).retain(1,{header:null});this.quill.updateContents(o,h.default.sources.USER),this.quill.setSelection(e.index+1,h.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(e,t){var n=t.prefix.length,r=i(this.quill.getLine(e.index),2),a=r[0],o=r[1];if(o>n)return!0;var s=void 0;switch(t.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(e.index," ",h.default.sources.USER),this.quill.history.cutoff();var l=new c.default().retain(e.index-o).delete(n+1).retain(a.length()-2-o).retain(1,{list:s});this.quill.updateContents(l,h.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,h.default.sources.SILENT)}},"code exit":{key:b.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(e){var t=i(this.quill.getLine(e.index),2),n=t[0],r=t[1],a=new c.default().retain(e.index+n.length()-r-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(a,h.default.sources.USER)}},"embed left":x(b.keys.LEFT,!1),"embed left shift":x(b.keys.LEFT,!0),"embed right":x(b.keys.RIGHT,!1),"embed right shift":x(b.keys.RIGHT,!0)}},t.default=b,t.SHORTKEY=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=l(n(0)),s=l(n(7));function l(e){return e&&e.__esModule?e:{default:e}}var c=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.selection=n,r.textNode=document.createTextNode(t.CONTENTS),r.domNode.appendChild(r.textNode),r._length=0,r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),a(t,null,[{key:"value",value:function(){}}]),a(t,[{key:"detach",value:function(){null!=this.parent&&this.parent.removeChild(this)}},{key:"format",value:function(e,n){if(0!==this._length)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n);for(var r=this,a=0;null!=r&&r.statics.scope!==o.default.Scope.BLOCK_BLOT;)a+=r.offset(r.parent),r=r.parent;null!=r&&(this._length=t.CONTENTS.length,r.optimize(),r.formatAt(a,t.CONTENTS.length,e,n),this._length=0)}},{key:"index",value:function(e,n){return e===this.textNode?0:i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,n)}},{key:"length",value:function(){return this._length}},{key:"position",value:function(){return[this.textNode,this.textNode.data.length]}},{key:"remove",value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this),this.parent=null}},{key:"restore",value:function(){if(!this.selection.composing&&null!=this.parent){var e=this.textNode,n=this.selection.getNativeRange(),i=void 0,a=void 0,l=void 0;if(null!=n&&n.start.node===e&&n.end.node===e){var c=[e,n.start.offset,n.end.offset];i=c[0],a=c[1],l=c[2]}for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==t.CONTENTS){var u=this.textNode.data.split(t.CONTENTS).join("");this.next instanceof s.default?(i=this.next.domNode,this.next.insertAt(0,u),this.textNode.data=t.CONTENTS):(this.textNode.data=u,this.parent.insertBefore(o.default.create(this.textNode),this),this.textNode=document.createTextNode(t.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),null!=a){var d=r([a,l].map(function(e){return Math.max(0,Math.min(i.data.length,e-1))}),2);return a=d[0],l=d[1],{startNode:i,startOffset:a,endNode:i,endOffset:l}}}}},{key:"update",value:function(e,t){var n=this;if(e.some(function(e){return"characterData"===e.type&&e.target===n.textNode})){var r=this.restore();r&&(t.range=r)}}},{key:"value",value:function(){return""}}]),t}(o.default.Embed);c.blotName="cursor",c.className="ql-cursor",c.tagName="span",c.CONTENTS="\uFEFF",t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(0)),i=n(4),a=o(i);function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(r.default.Container);s.allowedChildren=[a.default,i.BlockEmbed,s],t.default=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorStyle=t.ColorClass=t.ColorAttributor=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r},s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"value",value:function(e){var n=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e);return n.startsWith("rgb(")?"#"+(n=n.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"")).split(",").map(function(e){return("00"+parseInt(e).toString(16)).slice(-2)}).join(""):n}}]),t}(o.default.Attributor.Style),l=new o.default.Attributor.Class("color","ql-color",{scope:o.default.Scope.INLINE}),c=new s("color","color",{scope:o.default.Scope.INLINE});t.ColorAttributor=s,t.ColorClass=l,t.ColorStyle=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.sanitize=t.default=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"format",value:function(e,n){if(e!==this.statics.blotName||!n)return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n);n=this.constructor.sanitize(n),this.domNode.setAttribute("href",n)}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return e=this.sanitize(e),n.setAttribute("href",e),n.setAttribute("rel","noopener noreferrer"),n.setAttribute("target","_blank"),n}},{key:"formats",value:function(e){return e.getAttribute("href")}},{key:"sanitize",value:function(e){return s(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}}]),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);function s(e,t){var n=document.createElement("a");n.href=e;var r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}o.blotName="link",o.tagName="A",o.SANITIZED_URL="about:blank",o.PROTOCOL_WHITELIST=["http","https","mailto","tel"],t.default=o,t.sanitize=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r="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},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=s(n(23)),o=s(n(107));function s(e){return e&&e.__esModule?e:{default:e}}var l=0;function c(e,t){e.setAttribute(t,"true"!==e.getAttribute(t))}t.default=function(){function e(t){var n=this;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",function(){n.togglePicker()}),this.label.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:n.togglePicker();break;case a.default.keys.ESCAPE:n.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}return i(e,[{key:"togglePicker",value:function(){this.container.classList.toggle("ql-expanded"),c(this.label,"aria-expanded"),c(this.options,"aria-hidden")}},{key:"buildItem",value:function(e){var t=this,n=document.createElement("span");return n.tabIndex="0",n.setAttribute("role","button"),n.classList.add("ql-picker-item"),e.hasAttribute("value")&&n.setAttribute("data-value",e.getAttribute("value")),e.textContent&&n.setAttribute("data-label",e.textContent),n.addEventListener("click",function(){t.selectItem(n,!0)}),n.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:t.selectItem(n,!0),e.preventDefault();break;case a.default.keys.ESCAPE:t.escape(),e.preventDefault()}}),n}},{key:"buildLabel",value:function(){var e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML=o.default,e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}},{key:"buildOptions",value:function(){var e=this,t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id="ql-picker-options-"+l,l+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,[].slice.call(this.select.options).forEach(function(n){var r=e.buildItem(n);t.appendChild(r),!0===n.selected&&e.selectItem(r)}),this.container.appendChild(t)}},{key:"buildPicker",value:function(){var e=this;[].slice.call(this.select.attributes).forEach(function(t){e.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}},{key:"escape",value:function(){var e=this;this.close(),setTimeout(function(){return e.label.focus()},1)}},{key:"close",value:function(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}},{key:"selectItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.container.querySelector(".ql-selected");if(e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(e.parentNode.children,e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if(("u"<typeof Event?"undefined":r(Event))==="object"){var i=document.createEvent("Event");i.initEvent("change",!0,!0),this.select.dispatchEvent(i)}this.close()}}},{key:"update",value:function(){var e=void 0;if(this.select.selectedIndex>-1){var t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);var n=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",n)}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=y(n(0)),i=y(n(5)),a=n(4),o=y(a),s=y(n(16)),l=y(n(25)),c=y(n(24)),u=y(n(35)),d=y(n(6)),h=y(n(22)),f=y(n(7)),p=y(n(55)),m=y(n(42)),g=y(n(23));function y(e){return e&&e.__esModule?e:{default:e}}i.default.register({"blots/block":o.default,"blots/block/embed":a.BlockEmbed,"blots/break":s.default,"blots/container":l.default,"blots/cursor":c.default,"blots/embed":u.default,"blots/inline":d.default,"blots/scroll":h.default,"blots/text":f.default,"modules/clipboard":p.default,"modules/history":m.default,"modules/keyboard":g.default}),r.default.register(o.default,s.default,c.default,d.default,h.default,f.default),t.default=i.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(){function e(e){this.domNode=e,this.domNode[r.DATA_KEY]={blot:this}}return Object.defineProperty(e.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),e.create=function(e){var t;if(null==this.tagName)throw new r.ParchmentError("Blot definition missing tagName");return Array.isArray(this.tagName)?("string"==typeof e&&parseInt(e=e.toUpperCase()).toString()===e&&(e=parseInt(e)),t="number"==typeof e?document.createElement(this.tagName[e-1]):this.tagName.indexOf(e)>-1?document.createElement(e):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t},e.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},e.prototype.clone=function(){var e=this.domNode.cloneNode(!1);return r.create(e)},e.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[r.DATA_KEY]},e.prototype.deleteAt=function(e,t){this.isolate(e,t).remove()},e.prototype.formatAt=function(e,t,n,i){var a=this.isolate(e,t);if(null!=r.query(n,r.Scope.BLOT)&&i)a.wrap(n,i);else if(null!=r.query(n,r.Scope.ATTRIBUTE)){var o=r.create(this.statics.scope);a.wrap(o),o.format(n,i)}},e.prototype.insertAt=function(e,t,n){var i=null==n?r.create("text",t):r.create(t,n),a=this.split(e);this.parent.insertBefore(i,a)},e.prototype.insertInto=function(e,t){void 0===t&&(t=null),null!=this.parent&&this.parent.children.remove(this);var n=null;e.children.insertBefore(this,t),null!=t&&(n=t.domNode),(this.domNode.parentNode!=e.domNode||this.domNode.nextSibling!=n)&&e.domNode.insertBefore(this.domNode,n),this.parent=e,this.attach()},e.prototype.isolate=function(e,t){var n=this.split(e);return n.split(t),n},e.prototype.length=function(){return 1},e.prototype.offset=function(e){return(void 0===e&&(e=this.parent),null==this.parent||this==e)?0:this.parent.children.offset(this)+this.parent.offset(e)},e.prototype.optimize=function(e){null!=this.domNode[r.DATA_KEY]&&delete this.domNode[r.DATA_KEY].mutations},e.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},e.prototype.replace=function(e){null!=e.parent&&(e.parent.insertBefore(this,e.next),e.remove())},e.prototype.replaceWith=function(e,t){var n="string"==typeof e?r.create(e,t):e;return n.replace(this),n},e.prototype.split=function(e,t){return 0===e?this:this.next},e.prototype.update=function(e,t){},e.prototype.wrap=function(e,t){var n="string"==typeof e?r.create(e,t):e;return null!=this.parent&&this.parent.insertBefore(n,this.next),n.appendChild(this),n},e.blotName="abstract",e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(12),i=n(32),a=n(33),o=n(1);t.default=function(){function e(e){this.attributes={},this.domNode=e,this.build()}return e.prototype.attribute=function(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])},e.prototype.build=function(){var e=this;this.attributes={};var t=r.default.keys(this.domNode),n=i.default.keys(this.domNode),s=a.default.keys(this.domNode);t.concat(n).concat(s).forEach(function(t){var n=o.query(t,o.Scope.ATTRIBUTE);n instanceof r.default&&(e.attributes[n.attrName]=n)})},e.prototype.copy=function(e){var t=this;Object.keys(this.attributes).forEach(function(n){var r=t.attributes[n].value(t.domNode);e.format(n,r)})},e.prototype.move=function(e){var t=this;this.copy(e),Object.keys(this.attributes).forEach(function(e){t.attributes[e].remove(t.domNode)}),this.attributes={}},e.prototype.values=function(){var e=this;return Object.keys(this.attributes).reduce(function(t,n){return t[n]=e.attributes[n].value(e.domNode),t},{})},e}()},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function a(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return 0===e.indexOf(t+"-")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.keys=function(e){return(e.getAttribute("class")||"").split(/\s+/).map(function(e){return e.split("-").slice(0,-1).join("-")})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(this.keyName+"-"+t),!0)},t.prototype.remove=function(e){a(e,this.keyName).forEach(function(t){e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")},t.prototype.value=function(e){var t=(a(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""},t}(n(12).default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function a(e){var t=e.split("-"),n=t.slice(1).map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("");return t[0]+n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.keys=function(e){return(e.getAttribute("style")||"").split(";").map(function(e){return e.split(":")[0].trim()})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.style[a(this.keyName)]=t,!0)},t.prototype.remove=function(e){e.style[a(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")},t.prototype.value=function(e){var t=e.style[a(this.keyName)];return this.canAdd(e,t)?t:""},t}(n(12).default)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.quill=t,this.options=n,this.modules={}}return r(e,[{key:"init",value:function(){var e=this;Object.keys(this.options.modules).forEach(function(t){null==e.modules[t]&&e.addModule(t)})}},{key:"addModule",value:function(e){var t=this.quill.constructor.import("modules/"+e);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}}]),e}();i.DEFAULTS={modules:{}},i.themes={default:i},t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=s(n(0)),o=s(n(7));function s(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var n=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.contentNode=document.createElement("span"),n.contentNode.setAttribute("contenteditable",!1),[].slice.call(n.domNode.childNodes).forEach(function(e){n.contentNode.appendChild(e)}),n.leftGuard=document.createTextNode("\uFEFF"),n.rightGuard=document.createTextNode("\uFEFF"),n.domNode.appendChild(n.leftGuard),n.domNode.appendChild(n.contentNode),n.domNode.appendChild(n.rightGuard),n}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"index",value:function(e,n){return e===this.leftGuard?0:e===this.rightGuard?1:i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,n)}},{key:"restore",value:function(e){var t=void 0,n=void 0,r=e.data.split("\uFEFF").join("");if(e===this.leftGuard)if(this.prev instanceof o.default){var i=this.prev.length();this.prev.insertAt(i,r),t={startNode:this.prev.domNode,startOffset:i+r.length}}else n=document.createTextNode(r),this.parent.insertBefore(a.default.create(n),this),t={startNode:n,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof o.default?(this.next.insertAt(0,r),t={startNode:this.next.domNode,startOffset:r.length}):(n=document.createTextNode(r),this.parent.insertBefore(a.default.create(n),this.next),t={startNode:n,startOffset:r.length}));return e.data="\uFEFF",t}},{key:"update",value:function(e,t){var n=this;e.forEach(function(e){if("characterData"===e.type&&(e.target===n.leftGuard||e.target===n.rightGuard)){var r=n.restore(e.target);r&&(t.range=r)}})}}]),t}(a.default.Embed)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.AlignStyle=t.AlignClass=t.AlignAttribute=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a={scope:i.default.Scope.BLOCK,whitelist:["right","center","justify"]},o=new i.default.Attributor.Attribute("align","align",a),s=new i.default.Attributor.Class("align","ql-align",a),l=new i.default.Attributor.Style("align","text-align",a);t.AlignAttribute=o,t.AlignClass=s,t.AlignStyle=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundStyle=t.BackgroundClass=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a=n(26),o=new i.default.Attributor.Class("background","ql-bg",{scope:i.default.Scope.INLINE}),s=new a.ColorAttributor("background","background-color",{scope:i.default.Scope.INLINE});t.BackgroundClass=o,t.BackgroundStyle=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DirectionStyle=t.DirectionClass=t.DirectionAttribute=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a={scope:i.default.Scope.BLOCK,whitelist:["rtl"]},o=new i.default.Attributor.Attribute("direction","dir",a),s=new i.default.Attributor.Class("direction","ql-direction",a),l=new i.default.Attributor.Style("direction","direction",a);t.DirectionAttribute=o,t.DirectionClass=s,t.DirectionStyle=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.FontClass=t.FontStyle=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r},s={scope:o.default.Scope.INLINE,whitelist:["serif","monospace"]},l=new o.default.Attributor.Class("font","ql-font",s);t.FontStyle=new(function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"value",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e).replace(/["']/g,"")}}]),t}(o.default.Attributor.Style))("font","font-family",s),t.FontClass=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.SizeStyle=t.SizeClass=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a=new i.default.Attributor.Class("size","ql-size",{scope:i.default.Scope.INLINE,whitelist:["small","large","huge"]}),o=new i.default.Attributor.Style("size","font-size",{scope:i.default.Scope.INLINE,whitelist:["10px","18px","32px"]});t.SizeClass=a,t.SizeStyle=o},function(e,t,n){e.exports={align:{"":n(76),center:n(77),right:n(78),justify:n(79)},background:n(80),blockquote:n(81),bold:n(82),clean:n(83),code:n(58),"code-block":n(58),color:n(84),direction:{"":n(85),rtl:n(86)},float:{center:n(87),full:n(88),left:n(89),right:n(90)},formula:n(91),header:{1:n(92),2:n(93)},italic:n(94),image:n(95),indent:{"+1":n(96),"-1":n(97)},link:n(98),list:{ordered:n(99),bullet:n(100),check:n(101)},script:{sub:n(102),super:n(103)},strike:n(104),underline:n(105),video:n(106)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getLastChangeIndex=t.default=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(0)),a=o(n(5));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.lastRecorded=0,r.ignoreChange=!1,r.clear(),r.quill.on(a.default.events.EDITOR_CHANGE,function(e,t,n,i){e!==a.default.events.TEXT_CHANGE||r.ignoreChange||(r.options.userOnly&&i!==a.default.sources.USER?r.transform(t):r.record(t,n))}),r.quill.keyboard.addBinding({key:"Z",shortKey:!0},r.undo.bind(r)),r.quill.keyboard.addBinding({key:"Z",shortKey:!0,shiftKey:!0},r.redo.bind(r)),/Win/i.test(navigator.platform)&&r.quill.keyboard.addBinding({key:"Y",shortKey:!0},r.redo.bind(r)),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"change",value:function(e,t){if(0!==this.stack[e].length){var n=this.stack[e].pop();this.stack[t].push(n),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n[e],a.default.sources.USER),this.ignoreChange=!1;var r=l(n[e]);this.quill.setSelection(r)}}},{key:"clear",value:function(){this.stack={undo:[],redo:[]}}},{key:"cutoff",value:function(){this.lastRecorded=0}},{key:"record",value:function(e,t){if(0!==e.ops.length){this.stack.redo=[];var n=this.quill.getContents().diff(t),r=Date.now();if(this.lastRecorded+this.options.delay>r&&this.stack.undo.length>0){var i=this.stack.undo.pop();n=n.compose(i.undo),e=i.redo.compose(e)}else this.lastRecorded=r;this.stack.undo.push({redo:e,undo:n}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(e){this.stack.undo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)}),this.stack.redo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),t}(o(n(9)).default);function l(e){var t,n=e.reduce(function(e,t){return e+(t.delete||0)},0),r=e.length()-n;return null!=(t=e.ops[e.ops.length-1])&&(null!=t.insert?"string"==typeof t.insert&&t.insert.endsWith("\n"):null!=t.attributes&&Object.keys(t.attributes).some(function(e){return null!=i.default.query(e,i.default.Scope.BLOCK)}))&&(r-=1),r}s.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},t.default=s,t.getLastChangeIndex=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BaseTooltip=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=p(n(3)),o=p(n(2)),s=p(n(8)),l=p(n(23)),c=p(n(34)),u=p(n(59)),d=p(n(60)),h=p(n(28)),f=p(n(61));function p(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function g(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function y(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var v=[!1,"center","right","justify"],b=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],x=[!1,"serif","monospace"],w=["1","2","3",!1],C=["small",!1,"large","huge"],S=function(e){function t(e,n){m(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return e.emitter.listenDOM("click",document.body,function t(n){if(!document.body.contains(e.root))return document.body.removeEventListener("click",t);null==r.tooltip||r.tooltip.root.contains(n.target)||document.activeElement===r.tooltip.textbox||r.quill.hasFocus()||r.tooltip.hide(),null!=r.pickers&&r.pickers.forEach(function(e){e.container.contains(n.target)||e.close()})}),r}return y(t,e),r(t,[{key:"addModule",value:function(e){var n=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addModule",this).call(this,e);return"toolbar"===e&&this.extendToolbar(n),n}},{key:"buildButtons",value:function(e,t){e.forEach(function(e){(e.getAttribute("class")||"").split(/\s+/).forEach(function(n){if(n.startsWith("ql-")&&null!=t[n=n.slice(3)])if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{var r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}},{key:"buildPickers",value:function(e,t){var n=this;this.pickers=e.map(function(e){if(e.classList.contains("ql-align"))return null==e.querySelector("option")&&k(e,v),new d.default(e,t.align);if(!(e.classList.contains("ql-background")||e.classList.contains("ql-color")))return null==e.querySelector("option")&&(e.classList.contains("ql-font")?k(e,x):e.classList.contains("ql-header")?k(e,w):e.classList.contains("ql-size")&&k(e,C)),new h.default(e);var n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&k(e,b,"background"===n?"#ffffff":"#000000"),new u.default(e,t[n])}),this.quill.on(s.default.events.EDITOR_CHANGE,function(){n.pickers.forEach(function(e){e.update()})})}}]),t}(c.default);function k(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(function(t){var r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",t),e.appendChild(r)})}S.DEFAULTS=(0,a.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var e=this,t=this.container.querySelector("input.ql-image[type=file]");null==t&&((t=document.createElement("input")).setAttribute("type","file"),t.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),t.classList.add("ql-image"),t.addEventListener("change",function(){if(null!=t.files&&null!=t.files[0]){var n=new FileReader;n.onload=function(n){var r=e.quill.getSelection(!0);e.quill.updateContents(new o.default().retain(r.index).delete(r.length).insert({image:n.target.result}),s.default.sources.USER),e.quill.setSelection(r.index+1,s.default.sources.SILENT),t.value=""},n.readAsDataURL(t.files[0])}}),this.container.appendChild(t)),t.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}}),t.BaseTooltip=function(e){function t(e,n){m(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.textbox=r.root.querySelector('input[type="text"]'),r.listen(),r}return y(t,e),r(t,[{key:"listen",value:function(){var e=this;this.textbox.addEventListener("keydown",function(t){l.default.match(t,"enter")?(e.save(),t.preventDefault()):l.default.match(t,"escape")&&(e.cancel(),t.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+e)||""),this.root.setAttribute("data-mode",e)}},{key:"restoreFocus",value:function(){var e=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=e}},{key:"save",value:function(){var e,t,n=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var r=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",n,s.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",n,s.default.sources.USER)),this.quill.root.scrollTop=r;break;case"video":n=(t=(e=n).match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/))?(t[1]||"https")+"://www.youtube.com/embed/"+t[2]+"?showinfo=0":(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(t[1]||"https")+"://player.vimeo.com/video/"+t[2]+"/":e;case"formula":if(!n)break;var i=this.quill.getSelection(!0);if(null!=i){var a=i.index+i.length;this.quill.insertEmbed(a,this.root.getAttribute("data-mode"),n,s.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(a+1," ",s.default.sources.USER),this.quill.setSelection(a+2,s.default.sources.USER)}}this.textbox.value="",this.hide()}}]),t}(f.default),t.default=S},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){function e(){this.head=this.tail=null,this.length=0}return e.prototype.append=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.insertBefore(e[0],null),e.length>1&&this.append.apply(this,e.slice(1))},e.prototype.contains=function(e){for(var t,n=this.iterator();t=n();)if(t===e)return!0;return!1},e.prototype.insertBefore=function(e,t){e&&(e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)},e.prototype.offset=function(e){for(var t=0,n=this.head;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return -1},e.prototype.remove=function(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)},e.prototype.iterator=function(e){return void 0===e&&(e=this.head),function(){var t=e;return null!=e&&(e=e.next),t}},e.prototype.find=function(e,t){void 0===t&&(t=!1);for(var n,r=this.iterator();n=r();){var i=n.length();if(e<i||t&&e===i&&(null==n.next||0!==n.next.length()))return[n,e];e-=i}return[null,0]},e.prototype.forEach=function(e){for(var t,n=this.iterator();t=n();)e(t)},e.prototype.forEachAt=function(e,t,n){if(!(t<=0))for(var r,i=this.find(e),a=i[0],o=e-i[1],s=this.iterator(a);(r=s())&&o<e+t;){var l=r.length();e>o?n(r,e-o,Math.min(t,o+l-e)):n(r,0,Math.min(l,e+t-o)),o+=l}},e.prototype.map=function(e){return this.reduce(function(t,n){return t.push(e(n)),t},[])},e.prototype.reduce=function(e,t){for(var n,r=this.iterator();n=r();)t=e(t,n);return t},e}()},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(17),o=n(1),s={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.scroll=n,n.observer=new MutationObserver(function(e){n.update(e)}),n.observer.observe(n.domNode,s),n.attach(),n}return i(t,e),t.prototype.detach=function(){e.prototype.detach.call(this),this.observer.disconnect()},t.prototype.deleteAt=function(t,n){this.update(),0===t&&n===this.length()?this.children.forEach(function(e){e.remove()}):e.prototype.deleteAt.call(this,t,n)},t.prototype.formatAt=function(t,n,r,i){this.update(),e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.insertAt=function(t,n,r){this.update(),e.prototype.insertAt.call(this,t,n,r)},t.prototype.optimize=function(t,n){var r=this;void 0===t&&(t=[]),void 0===n&&(n={}),e.prototype.optimize.call(this,n);for(var i=[].slice.call(this.observer.takeRecords());i.length>0;)t.push(i.pop());for(var s=function(e,t){void 0===t&&(t=!0),null==e||e===r||null!=e.domNode.parentNode&&(null==e.domNode[o.DATA_KEY].mutations&&(e.domNode[o.DATA_KEY].mutations=[]),t&&s(e.parent))},l=function(e){null!=e.domNode[o.DATA_KEY]&&null!=e.domNode[o.DATA_KEY].mutations&&(e instanceof a.default&&e.children.forEach(l),e.optimize(n))},c=t,u=0;c.length>0;u+=1){if(u>=100)throw Error("[Parchment] Maximum optimize iterations reached");for(c.forEach(function(e){var t=o.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(s(o.find(e.previousSibling,!1)),[].forEach.call(e.addedNodes,function(e){var t=o.find(e,!1);s(t,!1),t instanceof a.default&&t.children.forEach(function(e){s(e,!1)})})):"attributes"===e.type&&s(t.prev)),s(t))}),this.children.forEach(l),i=(c=[].slice.call(this.observer.takeRecords())).slice();i.length>0;)t.push(i.pop())}},t.prototype.update=function(t,n){var r=this;void 0===n&&(n={}),(t=t||this.observer.takeRecords()).map(function(e){var t=o.find(e.target,!0);return null==t?null:null==t.domNode[o.DATA_KEY].mutations?(t.domNode[o.DATA_KEY].mutations=[e],t):(t.domNode[o.DATA_KEY].mutations.push(e),null)}).forEach(function(e){null!=e&&e!==r&&null!=e.domNode[o.DATA_KEY]&&e.update(e.domNode[o.DATA_KEY].mutations||[],n)}),null!=this.domNode[o.DATA_KEY].mutations&&e.prototype.update.call(this,this.domNode[o.DATA_KEY].mutations,n),this.optimize(t,n)},t.blotName="scroll",t.defaultChild="block",t.scope=o.Scope.BLOCK_BLOT,t.tagName="DIV",t}(a.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(18),o=n(1);t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.formats=function(n){if(n.tagName!==t.tagName)return e.formats.call(this,n)},t.prototype.format=function(n,r){var i=this;n!==this.statics.blotName||r?e.prototype.format.call(this,n,r):(this.children.forEach(function(e){e instanceof a.default||(e=e.wrap(t.blotName,!0)),i.attributes.copy(e)}),this.unwrap())},t.prototype.formatAt=function(t,n,r,i){null!=this.formats()[r]||o.query(r,o.Scope.ATTRIBUTE)?this.isolate(t,n).format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.optimize=function(n){e.prototype.optimize.call(this,n);var r=this.formats();if(0===Object.keys(r).length)return this.unwrap();var i=this.next;i instanceof t&&i.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(e[n]!==t[n])return!1;return!0}(r,i.formats())&&(i.moveChildren(this),i.remove())},t.blotName="inline",t.scope=o.Scope.INLINE_BLOT,t.tagName="SPAN",t}(a.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(18),o=n(1);t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.formats=function(n){var r=o.query(t.blotName).tagName;if(n.tagName!==r)return e.formats.call(this,n)},t.prototype.format=function(n,r){null==o.query(n,o.Scope.BLOCK)||(n!==this.statics.blotName||r?e.prototype.format.call(this,n,r):this.replaceWith(t.blotName))},t.prototype.formatAt=function(t,n,r,i){null!=o.query(r,o.Scope.BLOCK)?this.format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.insertAt=function(t,n,r){if(null==r||null!=o.query(n,o.Scope.INLINE))e.prototype.insertAt.call(this,t,n,r);else{var i=this.split(t),a=o.create(n,r);i.parent.insertBefore(a,i)}},t.prototype.update=function(t,n){navigator.userAgent.match(/Trident/)?this.build():e.prototype.update.call(this,t,n)},t.blotName="block",t.scope=o.Scope.BLOCK_BLOT,t.tagName="P",t}(a.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.formats=function(e){},t.prototype.format=function(t,n){e.prototype.formatAt.call(this,0,this.length(),t,n)},t.prototype.formatAt=function(t,n,r,i){0===t&&n===this.length()?this.format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.formats=function(){return this.statics.formats(this.domNode)},t}(n(19).default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(19),o=n(1);t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.text=n.statics.value(n.domNode),n}return i(t,e),t.create=function(e){return document.createTextNode(e)},t.value=function(e){var t=e.data;return t.normalize&&(t=t.normalize()),t},t.prototype.deleteAt=function(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)},t.prototype.index=function(e,t){return this.domNode===e?t:-1},t.prototype.insertAt=function(t,n,r){null==r?(this.text=this.text.slice(0,t)+n+this.text.slice(t),this.domNode.data=this.text):e.prototype.insertAt.call(this,t,n,r)},t.prototype.length=function(){return this.text.length},t.prototype.optimize=function(n){e.prototype.optimize.call(this,n),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},t.prototype.position=function(e,t){return void 0===t&&(t=!1),[this.domNode,e]},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var n=o.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next),this.text=this.statics.value(this.domNode),n},t.prototype.update=function(e,t){var n=this;e.some(function(e){return"characterData"===e.type&&e.target===n.domNode})&&(this.text=this.statics.value(this.domNode))},t.prototype.value=function(){return this.text},t.blotName="text",t.scope=o.Scope.INLINE_BLOT,t}(a.default)},function(e,t,n){var r=document.createElement("div");if(r.classList.toggle("test-class",!1),r.classList.contains("test-class")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return arguments.length>1&&!this.contains(e)==!t?t:i.call(this,e)}}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){var n=this.toString();("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t>n.length)&&(t=n.length),t-=e.length;var r=n.indexOf(e,t);return -1!==r&&r===t}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(this===null)throw TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw TypeError("predicate must be a function");for(var t,n=Object(this),r=n.length>>>0,i=arguments[1],a=0;a<r;a++)if(t=n[a],e.call(i,t,a,n))return t}}),document.addEventListener("DOMContentLoaded",function(){document.execCommand("enableObjectResizing",!1,!1),document.execCommand("autoUrlDetect",!1,!1)})},function(e,t){function n(e,t,s){if(e==t)return e?[[0,e]]:[];(s<0||e.length<s)&&(s=null);var l=i(e,t),c=e.substring(0,l);l=a(e=e.substring(l),t=t.substring(l));var u=e.substring(e.length-l),d=function(e,t){if(!e)return[[1,t]];if(!t)return[[-1,e]];var o,s=e.length>t.length?e:t,l=e.length>t.length?t:e,c=s.indexOf(l);if(-1!=c)return o=[[1,s.substring(0,c)],[0,l],[1,s.substring(c+l.length)]],e.length>t.length&&(o[0][0]=o[2][0]=-1),o;if(1==l.length)return[[-1,e],[1,t]];var u=function(e,t){var n,r,o,s,l,c=e.length>t.length?e:t,u=e.length>t.length?t:e;if(c.length<4||2*u.length<c.length)return null;function d(e,t,n){for(var r,o,s,l,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,d="";-1!=(u=t.indexOf(c,u+1));){var h=i(e.substring(n),t.substring(u)),f=a(e.substring(0,n),t.substring(0,u));d.length<f+h&&(d=t.substring(u-f,u)+t.substring(u,u+h),r=e.substring(0,n-f),o=e.substring(n+h),s=t.substring(0,u-f),l=t.substring(u+h))}return 2*d.length>=e.length?[r,o,s,l,d]:null}var h=d(c,u,Math.ceil(c.length/4)),f=d(c,u,Math.ceil(c.length/2));return h||f?(n=f?h&&h[4].length>f[4].length?h:f:h,e.length>t.length?(r=n[0],o=n[1],s=n[2],l=n[3]):(s=n[0],l=n[1],r=n[2],o=n[3]),[r,o,s,l,n[4]]):null}(e,t);if(u){var d=u[0],h=u[1],f=u[2],p=u[3],m=u[4],g=n(d,f),y=n(h,p);return g.concat([[0,m]],y)}return function(e,t){for(var n=e.length,i=t.length,a=Math.ceil((n+i)/2),o=2*a,s=Array(o),l=Array(o),c=0;c<o;c++)s[c]=-1,l[c]=-1;s[a+1]=0,l[a+1]=0;for(var u=n-i,d=u%2!=0,h=0,f=0,p=0,m=0,g=0;g<a;g++){for(var y=-g+h;y<=g-f;y+=2){for(var v,b=a+y,x=(v=y==-g||y!=g&&s[b-1]<s[b+1]?s[b+1]:s[b-1]+1)-y;v<n&&x<i&&e.charAt(v)==t.charAt(x);)v++,x++;if(s[b]=v,v>n)f+=2;else if(x>i)h+=2;else if(d){var w=a+u-y;if(w>=0&&w<o&&-1!=l[w]){var C=n-l[w];if(v>=C)return r(e,t,v,x)}}}for(var S=-g+p;S<=g-m;S+=2){for(var C,w=a+S,k=(C=S==-g||S!=g&&l[w-1]<l[w+1]?l[w+1]:l[w-1]+1)-S;C<n&&k<i&&e.charAt(n-C-1)==t.charAt(i-k-1);)C++,k++;if(l[w]=C,C>n)m+=2;else if(k>i)p+=2;else if(!d){var b=a+u-S;if(b>=0&&b<o&&-1!=s[b]){var v=s[b],x=a+v-b;if(v>=(C=n-C))return r(e,t,v,x)}}}}return[[-1,e],[1,t]]}(e,t)}(e=e.substring(0,e.length-l),t=t.substring(0,t.length-l));return c&&d.unshift([0,c]),u&&d.push([0,u]),function e(t){t.push([0,""]);for(var n,r=0,o=0,s=0,l="",c="";r<t.length;)switch(t[r][0]){case 1:s++,c+=t[r][1],r++;break;case -1:o++,l+=t[r][1],r++;break;case 0:o+s>1?(0!==o&&0!==s&&(0!==(n=i(c,l))&&(r-o-s>0&&0==t[r-o-s-1][0]?t[r-o-s-1][1]+=c.substring(0,n):(t.splice(0,0,[0,c.substring(0,n)]),r++),c=c.substring(n),l=l.substring(n)),0!==(n=a(c,l))&&(t[r][1]=c.substring(c.length-n)+t[r][1],c=c.substring(0,c.length-n),l=l.substring(0,l.length-n))),0===o?t.splice(r-s,o+s,[1,c]):0===s?t.splice(r-o,o+s,[-1,l]):t.splice(r-o-s,o+s,[-1,l],[1,c]),r=r-o-s+ +!!o+ +!!s+1):0!==r&&0==t[r-1][0]?(t[r-1][1]+=t[r][1],t.splice(r,1)):r++,s=0,o=0,l="",c=""}""===t[t.length-1][1]&&t.pop();var u=!1;for(r=1;r<t.length-1;)0==t[r-1][0]&&0==t[r+1][0]&&(t[r][1].substring(t[r][1].length-t[r-1][1].length)==t[r-1][1]?(t[r][1]=t[r-1][1]+t[r][1].substring(0,t[r][1].length-t[r-1][1].length),t[r+1][1]=t[r-1][1]+t[r+1][1],t.splice(r-1,1),u=!0):t[r][1].substring(0,t[r+1][1].length)==t[r+1][1]&&(t[r-1][1]+=t[r+1][1],t[r][1]=t[r][1].substring(t[r+1][1].length)+t[r+1][1],t.splice(r+1,1),u=!0)),r++;u&&e(t)}(d),null!=s&&(d=function(e,t){var n=function(e,t){if(0===t)return[0,e];for(var n=0,r=0;r<e.length;r++){var i=e[r];if(-1===i[0]||0===i[0]){var a=n+i[1].length;if(t===a)return[r+1,e];if(t<a){e=e.slice();var o=t-n,s=[i[0],i[1].slice(0,o)],l=[i[0],i[1].slice(o)];return e.splice(r,1,s,l),[r+1,e]}n=a}}throw Error("cursor_pos is out of bounds!")}(e,t),r=n[1],i=n[0],a=r[i],s=r[i+1];if(null==a||0!==a[0])return e;if(null!=s&&a[1]+s[1]===s[1]+a[1])return r.splice(i,2,s,a),o(r,i,2);if(null==s||0!==s[1].indexOf(a[1]))return e;r.splice(i,2,[s[0],a[1]],[0,a[1]]);var l=s[1].slice(a[1].length);return l.length>0&&r.splice(i+2,0,[s[0],l]),o(r,i,3)}(d,s)),d=function(e){for(var t,n=!1,r=function(e){return e.charCodeAt(0)>=56320&&57343>=e.charCodeAt(0)},i=2;i<e.length;i+=1)0===e[i-2][0]&&(t=e[i-2][1]).charCodeAt(t.length-1)>=55296&&56319>=t.charCodeAt(t.length-1)&&-1===e[i-1][0]&&r(e[i-1][1])&&1===e[i][0]&&r(e[i][1])&&(n=!0,e[i-1][1]=e[i-2][1].slice(-1)+e[i-1][1],e[i][1]=e[i-2][1].slice(-1)+e[i][1],e[i-2][1]=e[i-2][1].slice(0,-1));if(!n)return e;for(var a=[],i=0;i<e.length;i+=1)e[i][1].length>0&&a.push(e[i]);return a}(d)}function r(e,t,r,i){var a=e.substring(0,r),o=t.substring(0,i),s=e.substring(r),l=t.substring(i),c=n(a,o),u=n(s,l);return c.concat(u)}function i(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i}function a(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i}function o(e,t,n){for(var r=t+n-1;r>=0&&r>=t-1;r--)if(r+1<e.length){var i=e[r],a=e[r+1];i[0]===a[1]&&e.splice(r,2,[i[0],i[1]+a[1]])}return e}n.INSERT=1,n.DELETE=-1,n.EQUAL=0,e.exports=n},function(e,t){(e.exports="function"==typeof Object.keys?Object.keys:n).shim=n;function n(e){var t=[];for(var n in e)t.push(n);return t}},function(e,t){function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}(t=e.exports="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}()?n:r).supported=n,t.unsupported=r},function(e,t){var n=Object.prototype.hasOwnProperty,r="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),o.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)n.call(e,t)&&i.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},o.prototype.listeners=function(e,t){var n=r?r+e:e,i=this._events[n];if(t)return!!i;if(!i)return[];if(i.fn)return[i.fn];for(var a=0,o=i.length,s=Array(o);a<o;a++)s[a]=i[a].fn;return s},o.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,a),!0;case 6:return u.fn.call(u.context,t,n,i,a,o),!0}for(c=1,l=Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,i);break;default:if(!l)for(h=1,l=Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},o.prototype.on=function(e,t,n){var i=new a(t,n||this),o=r?r+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],i]:this._events[o].push(i):(this._events[o]=i,this._eventsCount++),this},o.prototype.once=function(e,t,n){var i=new a(t,n||this,!0),o=r?r+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],i]:this._events[o].push(i):(this._events[o]=i,this._eventsCount++),this},o.prototype.removeListener=function(e,t,n,a){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return 0==--this._eventsCount?this._events=new i:delete this._events[o],this;var s=this._events[o];if(s.fn)s.fn!==t||a&&!s.once||n&&s.context!==n||(0==--this._eventsCount?this._events=new i:delete this._events[o]);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||a&&!s[l].once||n&&s[l].context!==n)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:0==--this._eventsCount?this._events=new i:delete this._events[o]}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&(0==--this._eventsCount?this._events=new i:delete this._events[t])):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=r,o.EventEmitter=o,void 0!==e&&(e.exports=o)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.matchText=t.matchSpacing=t.matchNewline=t.matchBlot=t.matchAttributor=t.default=void 0;var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=b(n(3)),s=b(n(2)),l=b(n(0)),c=b(n(5)),u=b(n(10)),d=b(n(9)),h=n(36),f=n(37),p=b(n(13)),m=n(26),g=n(38),y=n(39),v=n(40);function b(e){return e&&e.__esModule?e:{default:e}}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=(0,u.default)("quill:clipboard"),C="__ql-matcher",S=[[Node.TEXT_NODE,j],[Node.TEXT_NODE,M],["br",function(e,t){return O(t,"\n")||t.insert("\n"),t}],[Node.ELEMENT_NODE,M],[Node.ELEMENT_NODE,L],[Node.ELEMENT_NODE,N],[Node.ELEMENT_NODE,R],[Node.ELEMENT_NODE,function(e,t){var n={},r=e.style||{};return r.fontStyle&&"italic"===P(e).fontStyle&&(n.italic=!0),r.fontWeight&&(P(e).fontWeight.startsWith("bold")||parseInt(P(e).fontWeight)>=700)&&(n.bold=!0),Object.keys(n).length>0&&(t=T(t,n)),parseFloat(r.textIndent||0)>0&&(t=new s.default().insert(" ").concat(t)),t}],["li",function(e,t){var n=l.default.query(e);if(null==n||"list-item"!==n.blotName||!O(t,"\n"))return t;for(var r=-1,i=e.parentNode;!i.classList.contains("ql-clipboard");)"list"===(l.default.query(i)||{}).blotName&&(r+=1),i=i.parentNode;return r<=0?t:t.compose(new s.default().retain(t.length()-1).retain(1,{indent:r}))}],["b",I.bind(I,"bold")],["i",I.bind(I,"italic")],["style",function(){return new s.default}]],k=[h.AlignAttribute,g.DirectionAttribute].reduce(function(e,t){return e[t.keyName]=t,e},{}),_=[h.AlignStyle,f.BackgroundStyle,m.ColorStyle,g.DirectionStyle,y.FontStyle,v.SizeStyle].reduce(function(e,t){return e[t.keyName]=t,e},{}),E=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.root.addEventListener("paste",r.onPaste.bind(r)),r.container=r.quill.addContainer("ql-clipboard"),r.container.setAttribute("contenteditable",!0),r.container.setAttribute("tabindex",-1),r.matchers=[],S.concat(r.options.matchers).forEach(function(e){var t=i(e,2),a=t[0],o=t[1];(n.matchVisual||o!==N)&&r.addMatcher(a,o)}),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),a(t,[{key:"addMatcher",value:function(e,t){this.matchers.push([e,t])}},{key:"convert",value:function(e){if("string"==typeof e)return this.container.innerHTML=e.replace(/\>\r?\n +\</g,"><"),this.convert();var t=this.quill.getFormat(this.quill.selection.savedRange.index);if(t[p.default.blotName]){var n=this.container.innerText;return this.container.innerHTML="",new s.default().insert(n,x({},p.default.blotName,t[p.default.blotName]))}var r=i(this.prepareMatching(),2),a=r[0],o=r[1],l=function e(t,n,r){return t.nodeType===t.TEXT_NODE?r.reduce(function(e,n){return n(t,e)},new s.default):t.nodeType===t.ELEMENT_NODE?[].reduce.call(t.childNodes||[],function(i,a){var o=e(a,n,r);return a.nodeType===t.ELEMENT_NODE&&(o=n.reduce(function(e,t){return t(a,e)},o),o=(a[C]||[]).reduce(function(e,t){return t(a,e)},o)),i.concat(o)},new s.default):new s.default}(this.container,a,o);return O(l,"\n")&&null==l.ops[l.ops.length-1].attributes&&(l=l.compose(new s.default().retain(l.length()-1).delete(1))),w.log("convert",this.container.innerHTML,l),this.container.innerHTML="",l}},{key:"dangerouslyPasteHTML",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.default.sources.API;if("string"==typeof e)this.quill.setContents(this.convert(e),t),this.quill.setSelection(0,c.default.sources.SILENT);else{var r=this.convert(t);this.quill.updateContents(new s.default().retain(e).concat(r),n),this.quill.setSelection(e+r.length(),c.default.sources.SILENT)}}},{key:"onPaste",value:function(e){var t=this;if(!e.defaultPrevented&&this.quill.isEnabled()){var n=this.quill.getSelection(),r=new s.default().retain(n.index),i=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(c.default.sources.SILENT),setTimeout(function(){r=r.concat(t.convert()).delete(n.length),t.quill.updateContents(r,c.default.sources.USER),t.quill.setSelection(r.length()-n.length,c.default.sources.SILENT),t.quill.scrollingContainer.scrollTop=i,t.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var e=this,t=[],n=[];return this.matchers.forEach(function(r){var a=i(r,2),o=a[0],s=a[1];switch(o){case Node.TEXT_NODE:n.push(s);break;case Node.ELEMENT_NODE:t.push(s);break;default:[].forEach.call(e.container.querySelectorAll(o),function(e){e[C]=e[C]||[],e[C].push(s)})}}),[t,n]}}]),t}(d.default);function T(e,t,n){return(void 0===t?"undefined":r(t))==="object"?Object.keys(t).reduce(function(e,n){return T(e,n,t[n])},e):e.reduce(function(e,r){return r.attributes&&r.attributes[t]?e.push(r):e.insert(r.insert,(0,o.default)({},x({},t,n),r.attributes))},new s.default)}function P(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};var t="__ql-computed-style";return e[t]||(e[t]=window.getComputedStyle(e))}function O(e,t){for(var n="",r=e.ops.length-1;r>=0&&n.length<t.length;--r){var i=e.ops[r];if("string"!=typeof i.insert)break;n=i.insert+n}return n.slice(-1*t.length)===t}function A(e){return 0!==e.childNodes.length&&["block","list-item"].indexOf(P(e).display)>-1}function I(e,t,n){return T(n,e,!0)}function R(e,t){var n=l.default.Attributor.Attribute.keys(e),r=l.default.Attributor.Class.keys(e),i=l.default.Attributor.Style.keys(e),a={};return n.concat(r).concat(i).forEach(function(t){var n=l.default.query(t,l.default.Scope.ATTRIBUTE);null!=n&&(a[n.attrName]=n.value(e),a[n.attrName])||(null!=(n=k[t])&&(n.attrName===t||n.keyName===t)&&(a[n.attrName]=n.value(e)||void 0),null!=(n=_[t])&&(n.attrName===t||n.keyName===t)&&(a[(n=_[t]).attrName]=n.value(e)||void 0))}),Object.keys(a).length>0&&(t=T(t,a)),t}function L(e,t){var n=l.default.query(e);if(null==n)return t;if(n.prototype instanceof l.default.Embed){var r={},i=n.value(e);null!=i&&(r[n.blotName]=i,t=new s.default().insert(r,n.formats(e)))}else"function"==typeof n.formats&&(t=T(t,n.blotName,n.formats(e)));return t}function M(e,t){return!O(t,"\n")&&(A(e)||t.length()>0&&e.nextSibling&&A(e.nextSibling))&&t.insert("\n"),t}function N(e,t){if(A(e)&&null!=e.nextElementSibling&&!O(t,"\n\n")){var n=e.offsetHeight+parseFloat(P(e).marginTop)+parseFloat(P(e).marginBottom);e.nextElementSibling.offsetTop>e.offsetTop+1.5*n&&t.insert("\n")}return t}function j(e,t){var n=e.data;if("O:P"===e.parentNode.tagName)return t.insert(n.trim());if(0===n.trim().length&&e.parentNode.classList.contains("ql-clipboard"))return t;if(!P(e.parentNode).whiteSpace.startsWith("pre")){var r=function(e,t){return(t=t.replace(/[^\u00a0]/g,"")).length<1&&e?" ":t};n=(n=n.replace(/\r\n/g," ").replace(/\n/g," ")).replace(/\s\s+/g,r.bind(r,!0)),(null==e.previousSibling&&A(e.parentNode)||null!=e.previousSibling&&A(e.previousSibling))&&(n=n.replace(/^\s+/,r.bind(r,!1))),(null==e.nextSibling&&A(e.parentNode)||null!=e.nextSibling&&A(e.nextSibling))&&(n=n.replace(/\s+$/,r.bind(r,!1)))}return t.insert(n)}E.DEFAULTS={matchers:[],matchVisual:!0},t.default=E,t.matchAttributor=R,t.matchBlot=L,t.matchNewline=M,t.matchSpacing=N,t.matchText=j},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"optimize",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:"create",value:function(){return a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this)}},{key:"formats",value:function(){return!0}}]),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);o.blotName="bold",o.tagName=["STRONG","B"],t.default=o},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.addControls=t.default=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=u(n(2)),o=u(n(0)),s=u(n(5)),l=u(n(10)),c=u(n(9));function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}var h=(0,l.default)("quill:toolbar"),f=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var i,a=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if(Array.isArray(a.options.container)){var o=document.createElement("div");m(o,a.options.container),e.container.parentNode.insertBefore(o,e.container),a.container=o}else"string"==typeof a.options.container?a.container=document.querySelector(a.options.container):a.container=a.options.container;return a.container instanceof HTMLElement?(a.container.classList.add("ql-toolbar"),a.controls=[],a.handlers={},Object.keys(a.options.handlers).forEach(function(e){a.addHandler(e,a.options.handlers[e])}),[].forEach.call(a.container.querySelectorAll("button, select"),function(e){a.attach(e)}),a.quill.on(s.default.events.EDITOR_CHANGE,function(e,t){e===s.default.events.SELECTION_CHANGE&&a.update(t)}),a.quill.on(s.default.events.SCROLL_OPTIMIZE,function(){var e=r(a.quill.selection.getRange(),1)[0];a.update(e)}),a):(i=h.error("Container required for toolbar",a.options),d(a,i))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"addHandler",value:function(e,t){this.handlers[e]=t}},{key:"attach",value:function(e){var t=this,n=[].find.call(e.classList,function(e){return 0===e.indexOf("ql-")});if(n){if(n=n.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[n]){if(null!=this.quill.scroll.whitelist&&null==this.quill.scroll.whitelist[n])return void h.warn("ignoring attaching to disabled format",n,e);if(null==o.default.query(n))return void h.warn("ignoring attaching to nonexistent format",n,e)}var i="SELECT"===e.tagName?"change":"click";e.addEventListener(i,function(i){var l,c,u,d=void 0;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;var h=e.options[e.selectedIndex];d=!h.hasAttribute("selected")&&(h.value||!1)}else d=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),i.preventDefault();t.quill.focus();var f=r(t.quill.selection.getRange(),1)[0];if(null!=t.handlers[n])t.handlers[n].call(t,d);else if(o.default.query(n).prototype instanceof o.default.Embed){if(!(d=prompt("Enter "+n)))return;t.quill.updateContents(new a.default().retain(f.index).delete(f.length).insert((l={},c=n,u=d,c in l?Object.defineProperty(l,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):l[c]=u,l)),s.default.sources.USER)}else t.quill.format(n,d,s.default.sources.USER);t.update(f)}),this.controls.push([n,e])}}},{key:"update",value:function(e){var t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(function(n){var i=r(n,2),a=i[0],o=i[1];if("SELECT"===o.tagName){var s=void 0;if(null==e)s=null;else if(null==t[a])s=o.querySelector("option[selected]");else if(!Array.isArray(t[a])){var l=t[a];"string"==typeof l&&(l=l.replace(/\"/g,'\\"')),s=o.querySelector('option[value="'+l+'"]')}null==s?(o.value="",o.selectedIndex=-1):s.selected=!0}else if(null==e)o.classList.remove("ql-active");else if(o.hasAttribute("value")){var c=t[a]===o.getAttribute("value")||null!=t[a]&&t[a].toString()===o.getAttribute("value")||null==t[a]&&!o.getAttribute("value");o.classList.toggle("ql-active",c)}else o.classList.toggle("ql-active",null!=t[a])})}}]),t}(c.default);function p(e,t,n){var r=document.createElement("button");r.setAttribute("type","button"),r.classList.add("ql-"+t),null!=n&&(r.value=n),e.appendChild(r)}function m(e,t){Array.isArray(t[0])||(t=[t]),t.forEach(function(t){var n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(function(e){if("string"==typeof e)p(n,e);else{var t,r,i,a,o=Object.keys(e)[0],s=e[o];Array.isArray(s)?(t=n,r=o,i=s,(a=document.createElement("select")).classList.add("ql-"+r),i.forEach(function(e){var t=document.createElement("option");!1!==e?t.setAttribute("value",e):t.setAttribute("selected","selected"),a.appendChild(t)}),t.appendChild(a)):p(n,o,s)}}),e.appendChild(n)})}f.DEFAULTS={},f.DEFAULTS={container:null,handlers:{clean:function(){var e=this,t=this.quill.getSelection();null!=t&&(0==t.length?Object.keys(this.quill.getFormat()).forEach(function(t){null!=o.default.query(t,o.default.Scope.INLINE)&&e.quill.format(t,!1)}):this.quill.removeFormat(t,s.default.sources.USER))},direction:function(e){var t=this.quill.getFormat().align;"rtl"===e&&null==t?this.quill.format("align","right",s.default.sources.USER):e||"right"!==t||this.quill.format("align",!1,s.default.sources.USER),this.quill.format("direction",e,s.default.sources.USER)},indent:function(e){var t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0);if("+1"===e||"-1"===e){var i="+1"===e?1:-1;"rtl"===n.direction&&(i*=-1),this.quill.format("indent",r+i,s.default.sources.USER)}},link:function(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,s.default.sources.USER)},list:function(e){var t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,s.default.sources.USER):this.quill.format("list","unchecked",s.default.sources.USER):this.quill.format("list",e,s.default.sources.USER)}}},t.default=f,t.addControls=m},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>'},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)};t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.label.innerHTML=n,r.container.classList.add("ql-color-picker"),[].slice.call(r.container.querySelectorAll(".ql-picker-item"),0,7).forEach(function(e){e.classList.add("ql-primary")}),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"buildItem",value:function(e){var n=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"buildItem",this).call(this,e);return n.style.backgroundColor=e.getAttribute("value")||"",n}},{key:"selectItem",value:function(e,n){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,n);var r=this.label.querySelector(".ql-color-label"),i=e&&e.getAttribute("data-value")||"";r&&("line"===r.tagName?r.style.stroke=i:r.style.fill=i)}}]),t}(((r=n(28))&&r.__esModule?r:{default:r}).default)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)};t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.container.classList.add("ql-icon-picker"),[].forEach.call(r.container.querySelectorAll(".ql-picker-item"),function(e){e.innerHTML=n[e.getAttribute("data-value")||""]}),r.defaultItem=r.container.querySelector(".ql-selected"),r.selectItem(r.defaultItem),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"selectItem",value:function(e,n){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,n),e=e||this.defaultItem,this.label.innerHTML=e.innerHTML}}]),t}(((r=n(28))&&r.__esModule?r:{default:r}).default)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=function(){function e(t,n){var r=this;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.quill=t,this.boundsContainer=n||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){r.root.style.marginTop=-1*r.quill.root.scrollTop+"px"}),this.hide()}return r(e,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(e){var t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=t+"px",this.root.style.top=n+"px",this.root.classList.remove("ql-flip");var r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect(),a=0;if(i.right>r.right&&(a=r.right-i.right,this.root.style.left=t+a+"px"),i.left<r.left&&(a=r.left-i.left,this.root.style.left=t+a+"px"),i.bottom>r.bottom){var o=i.bottom-i.top,s=e.bottom-e.top+o;this.root.style.top=n-s+"px",this.root.classList.add("ql-flip")}return a}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=f(n(3)),s=f(n(8)),l=n(43),c=f(l),u=f(n(27)),d=n(15),h=f(n(41));function f(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function m(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function g(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var y=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],v=function(e){function t(e,n){p(this,t),null!=n.modules.toolbar&&null==n.modules.toolbar.container&&(n.modules.toolbar.container=y);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.container.classList.add("ql-snow"),r}return g(t,e),a(t,[{key:"extendToolbar",value:function(e){e.container.classList.add("ql-snow"),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),h.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),h.default),this.tooltip=new b(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function(t,n){e.handlers.link.call(e,!n.format.link)})}}]),t}(c.default);v.DEFAULTS=(0,o.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){if(e){var t=this.quill.getSelection();if(null!=t&&0!=t.length){var n=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(n)&&0!==n.indexOf("mailto:")&&(n="mailto:"+n),this.quill.theme.tooltip.edit("link",n)}}else this.quill.format("link",!1)}}}}});var b=function(e){function t(e,n){p(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.preview=r.root.querySelector("a.ql-preview"),r}return g(t,e),a(t,[{key:"listen",value:function(){var e=this;i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function(t){e.root.classList.contains("ql-editing")?e.save():e.edit("link",e.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function(t){if(null!=e.linkRange){var n=e.linkRange;e.restoreFocus(),e.quill.formatText(n,"link",!1,s.default.sources.USER),delete e.linkRange}t.preventDefault(),e.hide()}),this.quill.on(s.default.events.SELECTION_CHANGE,function(t,n,i){if(null!=t){if(0===t.length&&i===s.default.sources.USER){var a=r(e.quill.scroll.descendant(u.default,t.index),2),o=a[0],l=a[1];if(null!=o){e.linkRange=new d.Range(t.index-l,o.length());var c=u.default.formats(o.domNode);e.preview.textContent=c,e.preview.setAttribute("href",c),e.show(),e.position(e.quill.getBounds(e.linkRange));return}}else delete e.linkRange;e.hide()}})}},{key:"show",value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),t}(l.BaseTooltip);b.TEMPLATE='<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a><input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL"><a class="ql-action"></a><a class="ql-remove"></a>',t.default=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=N(n(29)),i=n(36),a=n(38),o=n(64),s=N(n(65)),l=N(n(66)),c=n(67),u=N(c),d=n(37),h=n(26),f=n(39),p=n(40),m=N(n(56)),g=N(n(68)),y=N(n(27)),v=N(n(69)),b=N(n(70)),x=N(n(71)),w=N(n(72)),C=N(n(73)),S=n(13),k=N(S),_=N(n(74)),E=N(n(75)),T=N(n(57)),P=N(n(41)),O=N(n(28)),A=N(n(59)),I=N(n(60)),R=N(n(61)),L=N(n(108)),M=N(n(62));function N(e){return e&&e.__esModule?e:{default:e}}r.default.register({"attributors/attribute/direction":a.DirectionAttribute,"attributors/class/align":i.AlignClass,"attributors/class/background":d.BackgroundClass,"attributors/class/color":h.ColorClass,"attributors/class/direction":a.DirectionClass,"attributors/class/font":f.FontClass,"attributors/class/size":p.SizeClass,"attributors/style/align":i.AlignStyle,"attributors/style/background":d.BackgroundStyle,"attributors/style/color":h.ColorStyle,"attributors/style/direction":a.DirectionStyle,"attributors/style/font":f.FontStyle,"attributors/style/size":p.SizeStyle},!0),r.default.register({"formats/align":i.AlignClass,"formats/direction":a.DirectionClass,"formats/indent":o.IndentClass,"formats/background":d.BackgroundStyle,"formats/color":h.ColorStyle,"formats/font":f.FontClass,"formats/size":p.SizeClass,"formats/blockquote":s.default,"formats/code-block":k.default,"formats/header":l.default,"formats/list":u.default,"formats/bold":m.default,"formats/code":S.Code,"formats/italic":g.default,"formats/link":y.default,"formats/script":v.default,"formats/strike":b.default,"formats/underline":x.default,"formats/image":w.default,"formats/video":C.default,"formats/list/item":c.ListItem,"modules/formula":_.default,"modules/syntax":E.default,"modules/toolbar":T.default,"themes/bubble":L.default,"themes/snow":M.default,"ui/icons":P.default,"ui/picker":O.default,"ui/icon-picker":I.default,"ui/color-picker":A.default,"ui/tooltip":R.default},!0),t.default=r.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.IndentClass=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r};t.IndentClass=new(function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"add",value:function(e,n){if("+1"===n||"-1"===n){var r=this.value(e)||0;n="+1"===n?r+1:r-1}return 0===n?(this.remove(e),!0):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"add",this).call(this,e,n)}},{key:"canAdd",value:function(e,n){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,n)||a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,parseInt(n))}},{key:"value",value:function(e){return parseInt(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e))||void 0}}]),t}(o.default.Attributor.Class))("indent","ql-indent",{scope:o.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]})},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(4))&&r.__esModule?r:{default:r}).default);i.blotName="blockquote",i.tagName="blockquote",t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,null,[{key:"formats",value:function(e){return this.tagName.indexOf(e.tagName)+1}}]),t}(((r=n(4))&&r.__esModule?r:{default:r}).default);a.blotName="header",a.tagName=["H1","H2","H3","H4","H5","H6"],t.default=a},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ListItem=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=l(n(0)),o=l(n(4)),s=l(n(25));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),r(t,[{key:"format",value:function(e,n){e!==f.blotName||n?i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n):this.replaceWith(a.default.create(this.statics.scope))}},{key:"remove",value:function(){null==this.prev&&null==this.next?this.parent.remove():i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this)}},{key:"replaceWith",value:function(e,n){return(this.parent.isolate(this.offset(this.parent),this.length()),e===this.parent.statics.blotName)?(this.parent.replaceWith(e,n),this):(this.parent.unwrap(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e,n))}}],[{key:"formats",value:function(e){return e.tagName===this.tagName?void 0:i(t.__proto__||Object.getPrototypeOf(t),"formats",this).call(this,e)}}]),t}(o.default);h.blotName="list-item",h.tagName="LI";var f=function(e){function t(e){c(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=function(t){if(t.target.parentNode===e){var r=n.statics.formats(e),i=a.default.find(t.target);"checked"===r?i.format("list","unchecked"):"unchecked"===r&&i.format("list","checked")}};return e.addEventListener("touchstart",r),e.addEventListener("mousedown",r),n}return d(t,e),r(t,null,[{key:"create",value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,"ordered"===e?"OL":"UL");return("checked"===e||"unchecked"===e)&&n.setAttribute("data-checked","checked"===e),n}},{key:"formats",value:function(e){if("OL"===e.tagName)return"ordered";if("UL"===e.tagName)if(e.hasAttribute("data-checked"))return"true"===e.getAttribute("data-checked")?"checked":"unchecked";else return"bullet"}}]),r(t,[{key:"format",value:function(e,t){this.children.length>0&&this.children.tail.format(e,t)}},{key:"formats",value:function(){var e,t,n;return e={},t=this.statics.blotName,n=this.statics.formats(this.domNode),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},{key:"insertBefore",value:function(e,n){if(e instanceof h)i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,n);else{var r=null==n?this.length():n.offset(this),a=this.split(r);a.parent.insertBefore(e,a)}}},{key:"optimize",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&n.domNode.tagName===this.domNode.tagName&&n.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(n.moveChildren(this),n.remove())}},{key:"replace",value:function(e){if(e.statics.blotName!==this.statics.blotName){var n=a.default.create(this.statics.defaultChild);e.moveChildren(n),this.appendChild(n)}i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e)}}]),t}(s.default);f.blotName="list",f.scope=a.default.Scope.BLOCK_BLOT,f.tagName=["OL","UL"],f.defaultChild="list-item",f.allowedChildren=[h],t.ListItem=h,t.default=f},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(56))&&r.__esModule?r:{default:r}).default);i.blotName="italic",i.tagName=["EM","I"],t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,null,[{key:"create",value:function(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e)}},{key:"formats",value:function(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}]),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);o.blotName="script",o.tagName=["SUB","SUP"],t.default=o},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);i.blotName="strike",i.tagName="S",t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);i.blotName="underline",i.tagName="U",t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r},s=n(27),l=["alt","height","width"],c=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"format",value:function(e,n){l.indexOf(e)>-1?n?this.domNode.setAttribute(e,n):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n)}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&n.setAttribute("src",this.sanitize(e)),n}},{key:"formats",value:function(e){return l.reduce(function(t,n){return e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t},{})}},{key:"match",value:function(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}},{key:"sanitize",value:function(e){return(0,s.sanitize)(e,["http","https","data"])?e:"//:0"}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(o.default.Embed);c.blotName="image",c.tagName="IMG",t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=n(4),s=(r=n(27))&&r.__esModule?r:{default:r},l=["height","width"],c=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"format",value:function(e,n){l.indexOf(e)>-1?n?this.domNode.setAttribute(e,n):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n)}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",!0),n.setAttribute("src",this.sanitize(e)),n}},{key:"formats",value:function(e){return l.reduce(function(t,n){return e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t},{})}},{key:"sanitize",value:function(e){return s.default.sanitize(e)}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(o.BlockEmbed);c.blotName="video",c.className="ql-video",c.tagName="IFRAME",t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.FormulaBlot=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=l(n(35)),o=l(n(5)),s=l(n(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),r(t,null,[{key:"create",value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&(window.katex.render(e,n,{throwOnError:!1,errorColor:"#f00"}),n.setAttribute("data-value",e)),n}},{key:"value",value:function(e){return e.getAttribute("data-value")}}]),t}(a.default);h.blotName="formula",h.className="ql-formula",h.tagName="SPAN";var f=function(e){function t(){c(this,t);var e=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(null==window.katex)throw Error("Formula module requires KaTeX.");return e}return d(t,e),r(t,null,[{key:"register",value:function(){o.default.register(h,!0)}}]),t}(s.default);t.FormulaBlot=h,t.default=f},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.CodeToken=t.CodeBlock=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=l(n(0)),o=l(n(5)),s=l(n(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),r(t,[{key:"replaceWith",value:function(e){this.domNode.textContent=this.domNode.textContent,this.attach(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e)}},{key:"highlight",value:function(e){var t=this.domNode.textContent;this.cachedText!==t&&((t.trim().length>0||null==this.cachedText)&&(this.domNode.innerHTML=e(t),this.domNode.normalize(),this.attach()),this.cachedText=t)}}]),t}(l(n(13)).default);h.className="ql-syntax";var f=new a.default.Attributor.Class("token","hljs",{scope:a.default.Scope.INLINE}),p=function(e){function t(e,n){c(this,t);var r=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if("function"!=typeof r.options.highlight)throw Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var i=null;return r.quill.on(o.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(i),i=setTimeout(function(){r.highlight(),i=null},r.options.interval)}),r.highlight(),r}return d(t,e),r(t,null,[{key:"register",value:function(){o.default.register(f,!0),o.default.register(h,!0)}}]),r(t,[{key:"highlight",value:function(){var e=this;if(!this.quill.selection.composing){this.quill.update(o.default.sources.USER);var t=this.quill.getSelection();this.quill.scroll.descendants(h).forEach(function(t){t.highlight(e.options.highlight)}),this.quill.update(o.default.sources.SILENT),null!=t&&this.quill.setSelection(t,o.default.sources.SILENT)}}}]),t}(s.default);p.DEFAULTS={highlight:null==window.hljs?null:function(e){return window.hljs.highlightAuto(e).value},interval:1e3},t.CodeBlock=h,t.CodeToken=f,t.default=p},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <g class="ql-fill ql-color-label"> <polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>'},function(e,t){e.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>'},function(e,t){e.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class="ql-even ql-stroke" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class="ql-even ql-stroke" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class="ql-stroke ql-thin" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class="ql-stroke ql-thin" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>'},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BubbleTooltip=void 0;var r=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=d(n(3)),o=d(n(8)),s=n(43),l=d(s),c=n(15),u=d(n(41));function d(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function p(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],g=function(e){function t(e,n){h(this,t),null!=n.modules.toolbar&&null==n.modules.toolbar.container&&(n.modules.toolbar.container=m);var r=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.container.classList.add("ql-bubble"),r}return p(t,e),i(t,[{key:"extendToolbar",value:function(e){this.tooltip=new y(this.quill,this.options.bounds),this.tooltip.root.appendChild(e.container),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),u.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),u.default)}}]),t}(l.default);g.DEFAULTS=(0,a.default)(!0,{},l.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var y=function(e){function t(e,n){h(this,t);var r=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.on(o.default.events.EDITOR_CHANGE,function(e,t,n,i){if(e===o.default.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&i===o.default.sources.USER){r.show(),r.root.style.left="0px",r.root.style.width="",r.root.style.width=r.root.offsetWidth+"px";var a=r.quill.getLines(t.index,t.length);if(1===a.length)r.position(r.quill.getBounds(t));else{var s=a[a.length-1],l=r.quill.getIndex(s),u=Math.min(s.length()-1,t.index+t.length-l),d=r.quill.getBounds(new c.Range(l,u));r.position(d)}}else document.activeElement!==r.textbox&&r.quill.hasFocus()&&r.hide()}),r}return p(t,e),i(t,[{key:"listen",value:function(){var e=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){e.root.classList.remove("ql-editing")}),this.quill.on(o.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!e.root.classList.contains("ql-hidden")){var t=e.quill.getSelection();null!=t&&e.position(e.quill.getBounds(t))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(e){var n=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"position",this).call(this,e),i=this.root.querySelector(".ql-tooltip-arrow");if(i.style.marginLeft="",0===n)return n;i.style.marginLeft=-1*n-i.offsetWidth/2+"px"}}]),t}(s.BaseTooltip);y.TEMPLATE='<span class="ql-tooltip-arrow"></span><div class="ql-tooltip-editor"><input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL"><a class="ql-close"></a></div>',t.BubbleTooltip=y,t.default=g},function(e,t,n){e.exports=n(63)}]).default;var E=x("2SBKn"),os={};Nq=os,NW=function(e,t,n,r){var i,a,o,s,l,c,u,d,h,f,p,m,g,y,v,b,x,w,C,S,k,_,E,T,P,O,A,I,R,L,M,N,j,D,z,B,F,H,V,U,$,q,W,G,K,Y,X,Q,Z,J,ee,et=(a=[],(i={}).joinUrl=function(t,n){return t?e.resolve(t,n):n},i.getConstantUniqueIdFor=function(e){return 0>a.indexOf(e)&&a.push(e),a.indexOf(e)},i.clone=function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},o=function(e){return"object"==typeof e&&null!==e&&Object.prototype.toString.apply(e).match(/\[object (Canvas|HTMLCanvasElement|OffscreenCanvas)\]/i)},i.parseOptionalParameters=function(e){var t={canvas:null,options:{}};return null==e[0]||o(e[0])?(t.canvas=e[0]||null,t.options=i.clone(e[1])):t.options=i.clone(e[0]),t},i),en=(s={},l=function(e,t,n){var r=e[t];return e[t]=function(){var e=Array.prototype.slice.call(arguments);return n.apply(this,[e,r])},r},s.baseUrlRespectingXhr=function(e,t){return function(){var n=new e;return l(n,"open",function(e,n){var r=e.shift(),i=e.shift(),a=et.joinUrl(t,i);return n.apply(this,[r,a].concat(e))}),n}},s.finishNotifyingXhr=function(e){var t,n=0,r=0,i=!1,a=new Promise(function(e){t=function(){n-r<=0&&i&&e({totalCount:n})}}),o=function(){var i=new e;return l(i,"send",function(e,t){return n+=1,t.apply(this,arguments)}),i.addEventListener("load",function(){r+=1,t()}),i};return o.waitForRequestsToFinish=function(){return i=!0,t(),a},o},s),er=(c={},u=function(e){return Array.prototype.slice.call(e)},c.addClassName=function(e,t){e.className+=" "+t},c.addClassNameRecursively=function(e,t){c.addClassName(e,t),e.parentNode!==e.ownerDocument&&c.addClassNameRecursively(e.parentNode,t)},d=function(e,t){var n=e.parentStyleSheet,r=u(n.cssRules).indexOf(e);n.insertRule(t,r+1),n.deleteRule(r)},h=function(e,t){var n=e.cssText.replace(/^[^\{]+/,"");d(e,t+" "+n)},f=function(e){e.textContent=u(e.sheet.cssRules).reduce(function(e,t){return e+t.cssText},"")},p=function(e){var t=document.implementation.createHTMLDocument(""),n=document.createElement("style");n.textContent=e.textContent,t.body.appendChild(n),e.sheet=n.sheet},m=function(e,t,n){var r="((?:^|[^.#:\\w])|(?=\\W))("+t.join("|")+")(?=\\W|$)";u(e.querySelectorAll("style")).forEach(function(e){void 0===e.sheet&&p(e);var t=u(e.sheet.cssRules).filter(function(e){return e.selectorText&&RegExp(r,"i").test(e.selectorText)});t.length&&(t.forEach(function(e){var t=e.selectorText.replace(RegExp(r,"gi"),function(e,t,r){return t+n(r)});t!==e.selectorText&&h(e,t)}),f(e))})},c.rewriteCssSelectorWith=function(e,t,n){m(e,[t],function(){return n})},c.lowercaseCssTypeSelectors=function(e,t){m(e,t,function(e){return e.toLowerCase()})},c.findHtmlOnlyNodeNames=function(e){var t,n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),r={},i={};do t=n.currentNode.tagName.toLowerCase(),"http://www.w3.org/1999/xhtml"===n.currentNode.namespaceURI?r[t]=!0:i[t]=!0;while(n.nextNode())return Object.keys(r).filter(function(e){return!i[e]})},g=c,y={},v=function(e){return Array.prototype.slice.call(e)},b={active:!0,hover:!0,focus:!1,target:!1},y.fakeUserAction=function(e,t,n){var r=e.querySelector(t),i="rasterizehtml"+n;r&&(b[n]?g.addClassNameRecursively(r,i):g.addClassName(r,i),g.rewriteCssSelectorWith(e,":"+n,"."+i))},y.persistInputValues=function(e){var t=e.querySelectorAll("input"),n=e.querySelectorAll("textarea"),r=function(e){return"checkbox"===e.type||"radio"===e.type};v(t).filter(r).forEach(function(e){e.checked?e.setAttribute("checked",""):e.removeAttribute("checked")}),v(t).filter(function(e){return!r(e)}).forEach(function(e){e.setAttribute("value",e.value)}),v(n).forEach(function(e){e.textContent=e.value})},y.rewriteTagNameSelectorsToLowerCase=function(e){g.lowercaseCssTypeSelectors(e,g.findHtmlOnlyNodeNames(e))},y),ei=(x=window,w={},C=function(e,t,n,r){var i=e.createElement(t);return i.style.visibility="hidden",i.style.width=n+"px",i.style.height=r+"px",i.style.position="absolute",i.style.top=-1e4-r+"px",i.style.left=-1e4-n+"px",e.getElementsByTagName("body")[0].appendChild(i),i},w.executeJavascript=function(e,t){return new Promise(function(n){var r=C(x.document,"iframe",t.width,t.height),i=e.outerHTML,a=[],o=t.executeJsTimeout||0,s=function(){x.document.getElementsByTagName("body")[0].removeChild(r)},l=function(){n({document:r.contentDocument,errors:a,cleanUp:s})},c=r.contentWindow.XMLHttpRequest,u=en.finishNotifyingXhr(c),d=en.baseUrlRespectingXhr(u,t.baseUrl);r.onload=function(){(o>0?new Promise(function(e){setTimeout(e,o)}):Promise.resolve()).then(u.waitForRequestsToFinish).then(l)},r.contentDocument.open(),r.contentWindow.XMLHttpRequest=d,r.contentWindow.onerror=function(e){a.push({resourceType:"scriptExecution",msg:e})},r.contentDocument.write("<!DOCTYPE html>"),r.contentDocument.write(i),r.contentDocument.close()})},S=function(e,t,n){var r=e.createElement("iframe");return r.style.width=t+"px",r.style.height=n+"px",r.style.visibility="hidden",r.style.position="absolute",r.style.top=-1e4-n+"px",r.style.left=-1e4-t+"px",r.style.borderWidth=0,r.sandbox="allow-same-origin",r.scrolling="no",r},k=function(e,t,n){var r=Math.floor(e/n),i=Math.floor(t/n);return S(x.document,r,i)},_=function(e,t){var n=e.querySelector(t);if(n)return n;if(e.ownerDocument.querySelector(t)===e)return e;throw{message:"Clipping selector not found"}},E=function(e,t,n,r,i){var a,o,s,l,c,u,d,h,f=Math.max(e.scrollWidth,e.clientWidth),p=Math.max(e.scrollHeight,e.clientHeight);return t?(o=(d=_(e,t).getBoundingClientRect()).top,s=d.left,l=d.width,c=d.height):(o=0,s=0,l=f,c=p),h={width:Math.max((a={width:l,height:c}).width*i,n),height:Math.max(a.height*i,r)},u=x.getComputedStyle(e.ownerDocument.documentElement).fontSize,{left:s,top:o,width:h.width,height:h.height,viewportWidth:f,viewportHeight:p,rootFontSize:u}},T=function(e,t){var n=e.tagName;return t.querySelector(n)},P=function(e){var t=e.tagName.toLowerCase();return"html"===t||"body"===t?e.outerHTML:'<body style="margin: 0;">'+e.outerHTML+"</body>"},w.calculateDocumentContentSize=function(e,t){return new Promise(function(n,r){var i,a=t.zoom||1;i=k(t.width,t.height,a),x.document.getElementsByTagName("body")[0].appendChild(i),i.onload=function(){var o,s=i.contentDocument;try{o=E(T(e,s),t.clip,t.width,t.height,a),n(o)}catch(e){r(e)}finally{x.document.getElementsByTagName("body")[0].removeChild(i)}},i.contentDocument.open(),i.contentDocument.write("<!DOCTYPE html>"),i.contentDocument.write(P(e)),i.contentDocument.close()})},w.parseHtmlFragment=function(e){var t=x.document.implementation.createHTMLDocument("");t.documentElement.innerHTML=e;var n=t.querySelector("body").firstChild;if(!n)throw"Invalid source";return n},O=function(e,t){var n,r,i,a,o=/<html((?:\s+[^>]*)?)>/im.exec(t),s=x.document.implementation.createHTMLDocument("");if(o)for(r=0,n="<div"+o[1]+"></div>",s.documentElement.innerHTML=n,i=s.querySelector("div");r<i.attributes.length;r++)a=i.attributes[r],e.documentElement.setAttribute(a.name,a.value)},w.parseHTML=function(e){var t=x.document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,O(t,e),t},A=function(e){try{return n.failOnParseError(e)}catch(e){throw{message:"Invalid source",originalError:e}}},w.validateXHTML=function(e){A(new DOMParser().parseFromString(e,"application/xml"))},I=null,w.loadDocument=function(e,t){return new Promise(function(n,r){var i,a,o=new window.XMLHttpRequest,s=(i=et.joinUrl(t.baseUrl,e),"none"===(a=t.cache)||"repeated"===a?((null===I||"repeated"!==a)&&(I=Date.now()),i+"?_="+I):i),l=function(e){r({message:"Unable to load page",originalError:e})};o.addEventListener("load",function(){200===o.status||0===o.status?n(o.responseXML):l(o.statusText)},!1),o.addEventListener("error",function(e){l(e)},!1);try{o.open("GET",s,!0),o.responseType="document",o.send(null)}catch(e){l(e)}}).then(function(e){return A(e)})},w),ea=(window,L={},M=function(e,t){return t?URL.createObjectURL(new Blob([e],{type:"image/svg+xml"})):"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e)},N=function(e){e instanceof Blob&&URL.revokeObjectURL(e)},j='<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"><foreignObject></foreignObject></svg>',D=function(e){return new Promise(function(t,n){var r=document.createElement("canvas"),i=new Image;i.onload=function(){var e=r.getContext("2d");try{e.drawImage(i,0,0),r.toDataURL("image/png"),t(!0)}catch(e){t(!1)}},i.onerror=n,i.src=e})},z=function(){var e=M(j,!0);return D(e).then(function(t){return N(e),!t&&D(M(j,!1)).then(function(e){return e})},function(){return!1})},L.renderSvg=function(e){return new Promise(function(t,n){var r,i,a=function(){i.onload=null,i.onerror=null},o=function(){r&&N(r)};(i=new Image).onload=function(){a(),o(),t(i)},i.onerror=function(){o(),n()},(void 0===R&&(R=new Promise(function(e,t){z().then(function(t){e(!t)},function(){t()})})),R).then(function(t){return M(e,t)}).then(function(e){r=e,i.src=r},n)})},L),eo=(B={},F=function(e,t){var n=t||1,r={width:e.width,height:e.height,"font-size":e.rootFontSize};return 1!==n&&(r.style="transform:scale("+n+"); transform-origin: 0 0;"),r},H=function(e){var t,n;return t=Math.round(e.viewportWidth),n=Math.round(e.viewportHeight),{x:-e.left,y:-e.top,width:t,height:n}},V=function(e){var t=e.style||"";e.style=t+"float: left;"},U=function(e){e.externalResourcesRequired=!0},$=function(e){var t=Object.keys(e);return t.length?" "+t.map(function(t){return t+'="'+e[t]+'"'}).join(" "):""},q=function(e,n,r){var i=t.serializeToString(e);ei.validateXHTML(i);var a=H(n);return V(a),U(a),'<svg xmlns="http://www.w3.org/2000/svg"'+$(F(n,r))+'><style scoped="">html::-webkit-scrollbar { display: none; }</style><foreignObject'+$(a)+">"+i+"</foreignObject></svg>"},B.getSvgForDocument=function(e,t,n){return er.rewriteTagNameSelectorsToLowerCase(e),q(e,t,n)},B.drawDocumentAsSvg=function(e,t){return["hover","active","focus","target"].forEach(function(n){t[n]&&er.fakeUserAction(e,t[n],n)}),ei.calculateDocumentContentSize(e,t).then(function(n){return B.getSvgForDocument(e,n,t.zoom)})},B),es=(W={},G=function(e){return{message:"Error rendering page",originalError:e}},K=function(e){return ea.renderSvg(e).then(function(t){return{image:t,svg:e}},function(e){throw G(e)})},Y=function(e,t){try{t.getContext("2d").drawImage(e,0,0)}catch(e){throw G(e)}},W.rasterize=function(e,t,n){var i;return(i=et.clone(n)).inlineScripts=!0===n.executeJs,r.inlineReferences(e,i).then(function(t){return n.executeJs?ei.executeJavascript(e,n).then(function(e){var t=e.document;return er.persistInputValues(t),{document:t,errors:e.errors,cleanUp:e.cleanUp}}).then(function(e){return{element:e.document.documentElement,errors:t.concat(e.errors),cleanUp:e.cleanUp}}):{element:e,errors:t,cleanUp:function(){}}}).then(function(e){var r;return(r=e.element,eo.drawDocumentAsSvg(r,n).then(K).then(function(e){return t&&Y(e.image,t),e})).then(function(t){return e.cleanUp(),{image:t.image,svg:t.svg,errors:e.errors}})})},W);return X={},Q=function(e,t){var n=e?e.width:300,r=e?e.height:200;return{width:void 0!==t.width?t.width:n,height:void 0!==t.height?t.height:r}},Z=function(e){var t,n=Q(e.canvas,e.options);return(t=et.clone(e.options)).width=n.width,t.height=n.height,t},X.drawDocument=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=et.parseOptionalParameters(t),r=e.documentElement?e.documentElement:e;return es.rasterize(r,n.canvas,Z(n))},J=function(e,t,n){var r=ei.parseHTML(e);return X.drawDocument(r,t,n)},X.drawHTML=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=et.parseOptionalParameters(t);return J(e,n.canvas,n.options)},ee=function(e,t,n){var r=document.implementation.createHTMLDocument("");r.replaceChild(e.documentElement,r.documentElement);var i=n?et.clone(n):{};return n.baseUrl||(i.baseUrl=t),{document:r,options:i}},X.drawURL=function(){var e,t,n=arguments[0],r=Array.prototype.slice.call(arguments,1),i=et.parseOptionalParameters(r);return e=i.canvas,t=i.options,ei.loadDocument(n,t).then(function(r){var i=ee(r,n,t);return X.drawDocument(i.document,e,i.options)})},X},void 0===Nq&&void 0!==window&&(Nq=window),"function"==typeof define&&define.amd?define(["url","xmlserializer","sane-domparser-error","inlineresources"],function(e,t,n,r){return Nq.rasterizeHTML=NW(e,t,n,r)}):os?os=NW(x("kRFNf"),x("l4MZj"),x("lDFX4"),x("6cJtK")):Nq.rasterizeHTML=NW(Nq.url,Nq.xmlserializer,Nq.sanedomparsererror,Nq.inlineresources);let ol=`
|
|
74
|
+
`,r=(a||(a=document.getElementById("polotno-text-style"))||((a=document.createElement("style")).id="polotno-text-style",document.head.appendChild(a)),a);r.innerHTML="",r.appendChild(document.createTextNode(n)),JSON.stringify(e)!==JSON.stringify(o)&&s(e)});let c=m(S).useRef(null);if(m(S).useLayoutEffect(()=>{let e=c.current;if(!e)return;c.current?.focus();let t=i||e.value.length;e.selectionStart=e.selectionEnd=t,r&&(e?.select(),document.execCommand("selectAll",!1,void 0))},[]),m(S).useEffect(()=>{window.addEventListener("blur",n);let e=e=>{c.current?.contains(e.target)||n()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",n),window.removeEventListener("touchstart",e)}},[]),!l)return null;let u=0,d=l.textArr.length*l.lineHeight()*l.fontSize();"middle"===t.verticalAlign&&(u=(t.a.height-d)/2),"bottom"===t.verticalAlign&&(u=t.a.height-d);let h=iz(t.text);return(0,C.jsx)("textarea",{className:"polotno-input",ref:c,dir:iH(h),style:{...iJ,...o,paddingTop:u+"px"},value:h,onChange:e=>{let n=iX({oldText:t.text,newText:e.target.value,element:t});t.set({text:e.target.value,fontSize:n})},placeholder:t.placeholder,onBlur:n})}),i1=e=>(0,C.jsx)(rz,{children:(0,C.jsx)(i0,{...e})}),i2=(e,t,n,r)=>{let[i,a]=m(S).useReducer(e=>e+1,0),o=m(S).useRef(im(t,n,r)),s=m(S).useRef(null);return m(S).useLayoutEffect(()=>{if(o.current=im(t,n,r),o.current)return;let i=!0;return(async()=>{o.current=!1,a();let l=r5(`text ${t}`);(await e.loadFont(t,n,r),i)?(s.current=l,o.current=!0,a()):l()})(),()=>{s.current&&(s.current(),s.current=null),i=!1}},[t,n,r]),m(S).useEffect(()=>{o.current&&setTimeout(()=>{s.current&&(s.current(),s.current=null)})},[o.current]),[o.current]},i4=({fontLoaded:e,fontFamily:t,fontSize:n,lineHeight:r})=>m(S).useMemo(()=>(function({fontFamily:e,fontSize:t,lineHeight:n}){if("number"==typeof n)return n;let r=document.createElement("div");r.style.fontFamily=e,r.style.fontSize=t+"px",r.style.lineHeight=n,r.innerText="Test text",document.body.appendChild(r);let i=r.offsetHeight;return document.body.removeChild(r),i/t})({fontFamily:t,fontSize:n,lineHeight:r}),[e,t,n,r]);function i3(e){let t=m(S).useRef(e),n=m(S).useRef(e);return m(S).useMemo(()=>{n.current=t.current,t.current=e},[e]),n.current}let i8=j(({element:e,store:t})=>{let n=m(S).useRef(null),r=m(S).useRef(null),i=m(S).useRef(null),a=m(S).useRef([]),[,o]=m(S).useReducer(e=>e+1,0),{editorEnabled:s,selectAll:l}=(e=>{let[t,n]=m(S).useState(!1),r=m(S).useRef(!1);return m(S).useEffect(()=>{var t=!0;return setTimeout(()=>{t&&(e._editModeEnabled&&(r.current=!0),n(!0),setTimeout(()=>{r.current=!1},50))},50),()=>{t=!1}},[]),{editorEnabled:t&&e._editModeEnabled,selectAll:r.current}})(e),[c,u]=m(S).useState(!1),d=m(S).useRef(e.a.height),h=t.selectedShapes.indexOf(e)>=0&&e.selectable,f=i3(h),{textVerticalResizeEnabled:p}=iS,g=iS.autoDeleteEmptyText,y=i3(e.fontFamily),[v,b]=m(S).useState([]);m(S).useEffect(()=>{let e=n.current?.textArr??[];JSON.stringify(e)!==JSON.stringify(v)&&b(e)}),m(S).useEffect(()=>{if(e.a.width)return;let t=n.current;t.width(600),e.set({width:1.4*t.getTextWidth()})},[]),m(S).useEffect(()=>{f&&!h&&g&&""===e.text&&e.removable&&!e.placeholder&&t.deleteElements([e.id])},[g,e.placeholder,e.removable,e.text,h,f]),m(S).useLayoutEffect(()=>(0,E.autorun)(()=>{iW(n.current,e)})),m(S).useEffect(()=>{let e=a.current;e.length>0&&(a.current=[],e.forEach(e=>e()))});let[x]=i2(t,e.fontFamily,e.fontStyle,e.fontWeight),w=iz(e.text);"uppercase"===e.textTransform&&(w=w.toUpperCase());let k=()=>{if(e.curveEnabled){let e=r.current;return e.getSelfRect().height||e.fontSize()}let t=n.current.clone({height:void 0}),i=Math.ceil(t.fontSize()*t.lineHeight()*t.textArr.length+1);return t.destroy(),i};m(S).useLayoutEffect(()=>{if(!x)return;let{textOverflow:r,textSplitAllowed:i}=iS,s=(n,r,i,s)=>{let l=r5(`text ${e.id}`),c=()=>{t.history.ignore(n,r,i).then(()=>{a.current.push(l),o()})};s?queueMicrotask(c):c()};if(!e.height){let t=k();s(()=>{e.height||e.set({height:t})},void 0,void 0,!0);return}if(!t.isPlaying)if("change-font-size"!==r||c){if("resize"===r){let t=k();p&&e.height<t&&!c&&s(()=>{(0,iY.isAlive)(e)&&e.set({height:t}),n.current?.height(t)},!1,!0),p||e.height===t||c||s(()=>{(0,iY.isAlive)(e)&&e.set({height:t}),n.current?.height(t)},!1,!0)}}else{let t=function(e,t,n=!1){let r=e.fontSize(),i=e.height(),a=iz(t.text),o=t.a.fontSize;e.height(void 0);let s=Math.round(2*t.a.fontSize)-1;for(let r=1;r<s;r++){let r=t.a.height&&e.height()>t.a.height,i=a.split("\n").join(" ").split(/[\s-]+/).reduce((e,t)=>{var n;return(n=t=t.toLowerCase(),/[\u3000-\u303F\u3040-\u309F\u30A0-\u30FF\uFF00-\uFFEF\u4E00-\u9FAF\uAC00-\uD7AF]/.test(n))?e.concat(t.split("")):e.concat(t)},[]),s=e.textArr.map(e=>e.text.toLowerCase()).join(";"),l=i.find(e=>!s.includes(e)||(s=s.replace(e,""),!1));if(!(r||l&&!n))break;o-=.5,e.fontSize(o)}return e.fontSize(r),e.height(i),o}(n.current,e,i);if(t!==e.fontSize)return void s(()=>{e.set({fontSize:t})},!1,!0);let r=k();e.height===r||p||s(()=>{e.set({height:r})},!1,!0)}}),m(S).useLayoutEffect(()=>{if(x&&e.curveEnabled){let t=r.current?.getSelfRect().width;if(t){let n=t-e.a.width,r=e.a.rotation*Math.PI/180,i=-(n/2)*Math.cos(r),a=-(n/2)*Math.sin(r);e.set({width:t,x:e.a.x+i,y:e.a.y+a})}}},[x,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),m(S).useLayoutEffect(()=>{let t=n.current;t&&(t.width(t.width()+1e-8),t.width(t.width()-1e-8),t._setTextData(),iW(t,e))},[x]);let _=m(S).useRef(null),T=m(S).useRef(0),P=n=>{if(n.evt.preventDefault(),t.selectedShapes.find(t=>t===e)&&e.contentEditable){var r,i;let t,a,o,s,l,c,u;(r=(t=n.target).getAbsoluteTransform().copy()).invert(),i=t.getStage().getPointerPosition(),a=r.point(i),o=t.textArr,s=Math.floor(a.y/(t.fontSize()*t.lineHeight())),l=o.slice(0,s).reduce((e,t)=>e+t.text.length,s),c=o[s]??o[0],u=0,"right"===t.align()?u=t.width()-c.width:"center"===t.align()&&(u=t.width()/2-c.width/2),T.current=l+Math.round((a.x-u)/c.width*c.text.length),e.toggleEditMode()}},O=!w&&e.placeholder?.6:e.a.opacity;r0(n,O);let A=i4({fontLoaded:x,fontFamily:e.fontFamily,fontSize:e.a.fontSize,lineHeight:e.lineHeight}),I=e.selectable||"admin"===t.role,R=rQ(e),L=rQ(e,e.stroke,"stroke"),M=m(S).useMemo(()=>e.backgroundEnabled?e.curveEnabled?function({width:e,height:t,padding:n=0,cornerRadius:r=0}){let i=-n,a=-n,o=e+n,s=t+n;return rW(rq(`M ${i} ${a} L ${o} ${a} L ${o} ${s} L ${i} ${s} Z`),r).path}({width:e.a.width,height:e.a.height,cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*A*.5),padding:e.backgroundPadding*(e.a.fontSize*A*.5)}):function({lines:e,lineHeight:t,width:n,align:r="left",padding:i=0,cornerRadius:a=0}){e.forEach((e,t)=>{e.cx=n/2,"right"===r?e.cx=n-e.width/2:"left"===r&&(e.cx=e.width/2),"justify"!==r||e.lastInParagraph||(e.width=n),"justify"===r&&(e.cx=e.width/2)});let o=`M ${e[0]?.cx} ${-i}`;e.forEach((n,r)=>{let{cx:a}=n,s=e[r-1];s&&s.width>n.width?o+=` L ${a+n.width/2+i} ${r*t+i}`:o+=` L ${a+n.width/2+i} ${r*t-i}`;let l=e[r+1];l&&l.width>n.width?o+=` L ${a+n.width/2+i} ${(r+1)*t-i}`:o+=` L ${a+n.width/2+i} ${(r+1)*t+i}`});for(var s=e.length-1;s>=0;s--){let n=e[s],{cx:r}=n,a=e[s+1];a&&a.width>n.width?o+=` L ${r-n.width/2-i} ${(s+1)*t-i}`:o+=` L ${r-n.width/2-i} ${(s+1)*t+i}`;let l=e[s-1];l&&l.width>n.width?o+=` L ${r-n.width/2-i} ${s*t+i}`:o+=` L ${r-n.width/2-i} ${s*t-i}`}return rW(rq(o+=" Z"),a).path}({lines:JSON.parse(JSON.stringify(v)),cornerRadius:e.backgroundCornerRadius*(e.a.fontSize*A*.5),lineHeight:A*e.a.fontSize,padding:e.backgroundPadding*(e.a.fontSize*A*.5),width:e.a.width,align:e.align}):"",[e.backgroundEnabled,e.curveEnabled,e.backgroundCornerRadius,e.a.fontSize,e.a.height,A,e.backgroundPadding,e.a.width,e.align,v]),N=iK(),j=0;e.curveEnabled||("middle"===e.verticalAlign?j=(e.a.height-v.length*A*e.a.fontSize)/2:"bottom"===e.verticalAlign&&(j=e.a.height-v.length*A*e.a.fontSize));let D=e.curveEnabled?iV(e.a.width,e.a.height,e.curvePower,e.a.fontSize):"",z=x?'"'+e.fontFamily+'"':y===e.fontFamily?"Arial":'"'+y+'"';return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rR,{ref:i,x:e.a.x,y:e.a.y,rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*O,data:M,fill:e.backgroundColor,offsetY:-j}),(0,C.jsx)(rR,{data:D,stroke:"red",strokeWidth:1,x:e.a.x,y:e.a.y,rotation:e.a.rotation,visible:!1}),(0,C.jsx)("TextPath",{ref:r,visible:e.curveEnabled,data:D,text:w||e.placeholder,listening:!1,align:"center",textBaseline:"middle",...R,...L,strokeWidth:e.strokeWidth,lineJoin:"round",fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:`"${e.fontFamily}", "${y}"`,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration.trim(),letterSpacing:e.letterSpacing*e.a.fontSize,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e._editModeEnabled?.3:O,hideInExport:!e.showInExport,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity}),(0,C.jsx)(rI,{ref:n,id:e.id,name:"element",hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled,x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,text:w||e.placeholder,direction:iH(w),...R,...L,lineJoin:"round",strokeWidth:e.strokeWidth,fillAfterStrokeEnabled:!0,fontSize:e.a.fontSize,fontFamily:z,fontStyle:e.fontStyle+" "+e.fontWeight,textDecoration:e.textDecoration,align:e.align,verticalAlign:e.verticalAlign,draggable:N?e.draggable&&h:e.draggable,preventDefault:!N||h,opacity:e.curveEnabled?0:O,visible:!e._editModeEnabled,ellipsis:"ellipsis"===iS.textOverflow,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,lineHeight:A,letterSpacing:e.letterSpacing*e.a.fontSize,listening:I,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onClick:P,onTap:P,onTransformStart:()=>{u(!0),d.current=n.current.height()},onTransform:t=>{let n=t.target;i.current?.setAttrs({x:n.x(),y:n.y(),rotation:n.rotation(),scale:n.scale()});let r=(n.getStage()?.findOne("Transformer")).getActiveAnchor();if("middle-left"===r||"middle-right"===r){let t=n.scaleX(),r=n.width()*t,i=e.a.fontSize,a=r;r<i&&(a=i,_.current&&n.position(_.current)),n.width(a),n.scaleX(1),n.scaleY(1);let o=k();if("ellipsis"===iS.textOverflow)o=d.current;else{let t=Math.max(o,d.current);n.height(t),e.set({height:n.height()})}let s=iS.textVerticalResizeEnabled?Math.max(o,d.current):k();e.set({x:n.x(),width:n.width(),rotation:n.rotation(),height:s}),iW(n,e)}if("top-center"===r||"bottom-center"===r){let n="resize"===iS.textOverflow?k():A*e.a.fontSize;t.target.height(Math.max(n,t.target.height()*t.target.scaleY())),t.target.scaleY(1)}_.current=t.target.position();let a=t.target.scaleX();i.current?.setAttrs({scaleX:1,scaleY:1}),t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.a.fontSize*a,width:t.target.width()*a,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*a,shadowBlur:e.shadowBlur*a,shadowOffsetX:e.shadowOffsetX*a,shadowOffsetY:e.shadowOffsetY*a,strokeWidth:e.strokeWidth*a})},onTransformEnd:t=>{let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:Math.round(e.a.fontSize*n),width:Math.ceil(t.target.width()*n),x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),height:t.target.height()*n,shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n,strokeWidth:e.strokeWidth*n}),i.current?.setAttrs({scaleX:1,scaleY:1}),u(!1)}}),s&&(0,C.jsx)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,children:(0,C.jsx)(i1,{textNodeRef:n,element:e,selectAll:l,cursorPosition:T.current,onBlur:()=>{e.toggleEditMode(!1)}})})]})});var S=x("8NFma"),E=x("2SBKn"),S=x("8NFma"),i6={};function i5(e){let t={};return e.querySelectorAll("style").forEach(e=>{for(let n of m(i6).parse(e.textContent).stylesheet.rules)n.selectors&&n.selectors.forEach(e=>{let r=t[e]||{};n.declarations.forEach(e=>{r[e.name]=e.value}),t[e]=r})}),t}function i9(e,t){let n={fill:"",stroke:""},r=e.getAttribute("class")?.split(" ")||[],i=e.getAttribute("id"),a={};i&&t[`#${i}`]?a=t[`#${i}`]:r.forEach(e=>{t[`.${e}`]&&(a={...a,...t[`.${e}`]})}),t[e.nodeName]&&(a={...a,...t[e.nodeName]});let o=e.getAttribute("fill");o&&"none"!==o?n.fill=o:a.fill&&"none"!==a.fill&&(n.fill=a.fill);let s=e.getAttribute("stroke");if(s&&"none"!==s?n.stroke=s:a.stroke&&"none"!==a.stroke&&(n.stroke=a.stroke),!n.fill&&e.style.fill&&"none"!==e.style.fill&&(n.fill=e.style.fill),!n.stroke&&e.style.stroke&&"none"!==e.style.stroke&&(n.stroke=e.style.stroke),!n.stroke&&!n.fill){let r=e.ownerSVGElement,i=r&&r!==e?i9(r,t):null;i?.fill!=="currentColor"&&i?.stroke!=="currentColor"&&(n.fill="black")}return n}i6={lex:x("lBdyc"),parse:x("7s4lq"),stringify:x("ShlyI")};let i7=["path","rect","circle","line","polygon","polyline","ellipse","text"];function ae(e){for(var t=[],n=e.getElementsByTagName("*"),r=0,i=n.length;r<i;r++){let e=n[r];!function(e){for(;e.parentNode;){if("defs"===e.nodeName)return!0;e=e.parentNode}return!1}(e)&&(null!==e.getAttribute("fill")&&t.push(e),null!==e.getAttribute("stroke")||e.style&&e.style.fill?t.push(e):i7.indexOf(e.nodeName)>=0&&t.push(e))}return t}async function at(e){let t=await fetch(e);return ar(await t.text())}async function an(e){let t=await fetch(e,{mode:"cors"});return await t.text()}function ar(e){return"data:image/svg+xml;base64,"+window.btoa(unescape(encodeURIComponent(e)))}async function ai(e){let t=await an(e),n=new DOMParser().parseFromString(t,"image/svg+xml").documentElement.getAttribute("viewBox"),[r,i,a,o]=n?.split(" ")||[];return{width:parseFloat(a),height:parseFloat(o)}}function aa(e){var t=new DOMParser().parseFromString(e,"image/svg+xml");let n=t.documentElement.getAttribute("viewBox"),[r,i,a,o]=n?.split(" ")||[],s=t.documentElement.getAttribute("width");s||t.documentElement.setAttribute("width",a+"px");let l=t.documentElement.getAttribute("height");if((!l||l.indexOf("%")>=0)&&t.documentElement.setAttribute("height",o+"px"),s&&s.indexOf("%")>=0&&l&&-1===l.indexOf("%")){let e=parseFloat(l)/parseFloat(o);t.documentElement.setAttribute("width",e*parseFloat(a)+"px")}if(l&&l.indexOf("%")>=0&&s&&-1===s.indexOf("%")){let e=parseFloat(s)/parseFloat(a);t.documentElement.setAttribute("height",e*parseFloat(o)+"px")}return"100%"===s&&"100%"===l&&(t.documentElement.setAttribute("width",a+"px"),t.documentElement.setAttribute("height",o+"px")),new XMLSerializer().serializeToString(t)}let ao=(e,t)=>{if(!e||!t)return!1;if("currentColor"===t&&"black"===e)return!0;let n=n_.Util.colorToRGBA(e),r=n_.Util.colorToRGBA(t);if(n&&r)return n.r===r.r&&n.g===r.g&&n.b===r.b&&n.a===r.a};function as(e,t){var n=new DOMParser().parseFromString(e,"image/svg+xml");let r=ae(n),i=Array.from(t.keys()),a=i5(n);return r.forEach(e=>{let{fill:r,stroke:o}=i9(e,a);[{prop:"fill",color:r},{prop:"stroke",color:o}].forEach(({prop:r,color:a})=>{let o=i.find(e=>ao(e,a));if(o){let i=t.get(o);if(rY(i)){let{rotation:t,stops:a}=rX(i),o=a.map(e=>({offset:100*e.offset+"%","stop-color":e.color})),s="color"+Math.round(1e8*Math.random());!function(e,t,n,r){var i=e.namespaceURI,a=document.createElementNS(i,"linearGradient");let o=n_.Util.degToRad(n+90),s=(Math.cos(o)+1)/2,l=(Math.sin(o)+1)/2,c=(Math.cos(o+Math.PI)+1)/2,u=(Math.sin(o+Math.PI)+1)/2;a.setAttribute("x1",100*s+"%"),a.setAttribute("y1",100*l+"%"),a.setAttribute("x2",100*c+"%"),a.setAttribute("y2",100*u+"%"),a.setAttribute("gradientUnits","userSpaceOnUse"),a.setAttribute("id",t);for(var d=0;d<r.length;d++){var h=r[d],f=document.createElementNS(i,"stop");for(var p in h)h.hasOwnProperty(p)&&f.setAttribute(p,h[p]);a.appendChild(f)}(e.querySelector("defs")||e.insertBefore(document.createElementNS(i,"defs"),e.firstChild)).appendChild(a)}(n.children[0],s,t,o),e.style[r]=null,e.setAttribute(r,`url('#${s}')`)}else e.style[r]=t.get(o)}})}),ar(new XMLSerializer().serializeToString(n))}let al=e=>{let[t,n]=m(S).useState([]);return m(S).useEffect(()=>{let t=!1;return(async()=>{var r,i;let a,o,s;n([]);let l=(r=await an(e),a=i5(i=new DOMParser().parseFromString(r,"image/svg+xml")),o=ae(i),s=[],o.forEach(e=>{let{fill:t,stroke:n}=i9(e,a);[t,n].forEach(e=>{!e||("currentColor"===e&&(e="black"),n_.Util.colorToRGBA(e)&&-1===s.indexOf(e)&&s.push(e))})}),s);t||n(l)})(),()=>{t=!0}},[e]),t},ac=(e,t,n)=>{let r=t,i=n,a=1;for(;r>0&&i>0;){if(e.width=r,e.height=i,r+i<4e3)return;let o=e.getContext("2d");if(!o)return;if(o.fillStyle="rgba(0,0,0,0.1)",o.fillRect(0,0,1,1),0!==o.getImageData(0,0,1,1).data[3])return void o.clearRect(0,0,e.width,e.height);if(a*=.9,r=Math.floor(t*a),i=Math.floor(n*a),r=Math.max(r,1),i=Math.max(i,1),r<=1&&i<=1){e.width=1,e.height=1;return}}};var S=x("8NFma");let au=(e,t=100,n=!1,r)=>{let i=m(S).useRef(r??e),[,a]=m(S).useReducer(e=>e+1,0),o=m(S).useCallback(e=>{i.current!==e&&(i.current=e,a())},[i]),s=m(S).useRef(null);return e===n&&(s.current&&(clearTimeout(s.current),s.current=null),i.current=n),m(S).useEffect(()=>(s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o(e),s.current=null},t),()=>{s.current&&clearTimeout(s.current)}),[e,t,n]),[i.current,o]};function ad(){return document.createElement("canvas")}let ah=e=>e.indexOf("data:image/svg+xml")>=0||e.indexOf(".svg")>=0;async function af(e){return ah(e)?ar(aa(await an(e))):e}let ap=e=>{let[t,n]=m(S).useState(e);return m(S).useEffect(()=>{(async()=>{let r=await af(e);r!==t&&n(r)})()},[e]),t};function am(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}let ag={boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],keepRatio:!1,rotateEnabled:!1,anchorFill:"rgb(240, 240, 240)",anchorStrokeWidth:2,borderStrokeWidth:2},ay=e=>{Object.assign(ag,e)},av={boundBoxFunc:(e,t)=>t.width<5||t.height<5?e:t,anchorSize:20,enabledAnchors:["top-left","top-right","bottom-left","bottom-right"],rotateEnabled:!1,borderEnabled:!1,anchorCornerRadius:10,anchorStrokeWidth:2,borderStrokeWidth:2},ab=e=>{Object.assign(av,e)},ax=(e,t,n)=>Math.max(t,Math.min(n,e)),aw=ad(),aC=j(({element:e})=>{let t=Math.min(30,e.a.width/4,e.a.height/4),n=m(S).useRef(null);return m(S).useEffect(()=>{let e=n.current;if(!e)return;let t=new n_.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}}),(0,C.jsxs)(rE,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.a.width,height:e.a.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,C.jsx)("Arc",{ref:n,x:e.a.width/2,y:e.a.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),aS=j(({element:e})=>{let t="Can not load the image...",n=Math.max(10,Math.min(30,e.a.width/t.length));return(0,C.jsxs)(rE,{x:e.x,y:e.y,rotation:e.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.a.width,height:e.a.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,C.jsx)(rI,{text:t,fontSize:n,width:e.a.width,height:e.a.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}),ak=m(rj),a_=e=>{ak=e},aE=(e,t="",n="")=>{let r=m(S).useRef(),i=()=>{r.current?.(),r.current=void 0};m(S).useEffect(()=>i,[]),m(S).useLayoutEffect(()=>{let a=t.slice(0,200),o=`image with id ${n} url: ${a}`;"loading"!==e||r.current||(r.current=r5(o)),"loading"!==e&&i(),"failed"===e&&it(o)},[e])},aT=j(({element:e,store:t})=>{let n,r,i,[a,o]=m(S).useState(!1),s=m(S).useRef(null),l=m(S).useRef(null),c=t.selectedShapes.indexOf(e)>=0&&e.selectable,[u,d]=(e=>{let[t,n]=m(S).useReducer(e=>e+1,0),r=m(S).useRef("loading"),i=m(S).useRef(e.src),a=m(S).useRef(e.src);a.current!==e.src&&(a.current=e.src,r.current="loading");let o=m(S).useMemo(()=>ah(e.src)||"svg"===e.type,[e.src,e.type]);return(m(S).useEffect(()=>{if(!o||!e.src)return;let t=!1;return(async()=>{let a;r.current="loading",n();let o=aa(await an(e.src));a=e.colorsReplace?as(o,e.colorsReplace||new Map):ar(o),t||(i.current=a,r.current="loaded",n())})(),()=>{t=!0}},[e.src,JSON.stringify(e.colorsReplace)]),o)?[i.current,r.current]:[e.src,"loaded"]})(e),[h,f]=ak(u,"anonymous");aE("svg"!==e.type||"loaded"===d?f:"loading",e.src,e.id);let p=e.page._exportingOrRendering?1:Math.max(1,t.scale),g=t._elementsPixelRatio*p,y=(({image:e,status:t,type:n})=>{let r=m(S).useRef();return m(S).useEffect(()=>{r.current=e||r.current},[e]),"failed"!==t||"failed"!==t&&"svg"===n?r.current:void 0})({image:h,status:f,type:e.type}),v=(H=h||y,i=m(S).useMemo(()=>{let{flipX:t,flipY:n}=e,r="svg"===e.type||e.src.indexOf("data:image/svg+xml")>=0||e.src.indexOf(".svg")>=0,i=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,a=(/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||i)&&r||e.maskSrc;if(!t&&!n&&!a)return H;if(!H||!H.width||!H.height)return null;let o=ad(),s=1;"svg"===e.type&&(s=Math.max(e.a.width/H.width*g,e.a.height/H.height*g)),ac(o,Math.max(H.width*s,1),Math.max(H.height*s,1));let l=t?-o.width:0,c=n?-o.height:0;return o.getContext("2d")?.scale(t?-1:1,n?-1:1),o.getContext("2d")?.drawImage(H,l,c,o.width,o.height),o},[e.maskSrc,e.flipX,e.flipY,H,e.a.width,e.a.height,g]),m(S).useEffect(()=>()=>{i&&"CANVAS"===i.nodeName&&n_.Util.releaseCanvas(i)},[i]),i),b=((e,t)=>{let n=ap(e.maskSrc||""),[r,i]=ak(n,"anonymous");return aE(n?i:"loaded",n||"",e.id),m(S).useMemo(()=>{let n,i,a;if(!r||!t||!t.width||!t.height)return t;let o=ad();o.width=Math.max(t.width,1),o.height=Math.max(t.height,1);let s=o.getContext("2d");if(!s)return t;s.drawImage(t,0,0),s.globalCompositeOperation="source-in";let l=((a=e.width/e.height)>=r.width/r.height?(n=r.width,i=r.width/a):(n=r.height*a,i=r.height),{x:(r.width-n)/2,y:(r.height-i)/2,width:n,height:i});return s.drawImage(r,l.x,l.y,l.width,l.height,0,0,t.width,t.height),o},[t,r,e.a.width,e.a.height])})(e,v)||aw,{cropX:x,cropY:w,cropWidth:k,cropHeight:_}=e.a;"loaded"!==f&&(x=w=0,k=_=1);let T=b.width*k,P=b.height*_,O=e.a.width/e.a.height,A=T/P,I=e.stretchEnabled;I?(n=T,r=P):O>=A?(n=T,r=T/O):(n=P*O,r=P);let R={x:b.width*x,y:b.height*w,width:n,height:r},L=e.cornerRadius??0,M=e.page._exportingOrRendering?1:Math.min(2,t.scale),N=t._elementsPixelRatio*M,j=((e,t,n,r)=>{let i=ap(e.clipSrc||""),[a,o]=ak(i,"anonymous");aE(e.clipSrc?o:"loaded",e.clipSrc,e.id);let s=m(S).useMemo(()=>{if(t&&a)return ad()},[t,a]);return m(S).useLayoutEffect(()=>{if(!a||!t||!t.width||!t.height||!a||!a.width||!a.height||!s)return;let r=ad(),i=Math.max(e.a.width/a.width*n,e.a.height/a.height*n);r.width=Math.max(a.width*i,1),r.height=Math.max(a.height*i,1),r.getContext("2d")?.drawImage(a,0,0,r.width,r.height),s.width=Math.max(t.width,1),s.height=Math.max(t.height,1);let o=s.getContext("2d");o&&(o.save(),o.drawImage(r,0,0,t.width,t.height),n_.Util.releaseCanvas(r),o.globalCompositeOperation="source-in",o.drawImage(t,0,0,s.width,s.height),o.restore())},[s,t,a,e.a.width,e.a.height,n,...r]),e.clipSrc&&a?s:t})(e,((e,t,n,r,i=0,a=!1,o=!0)=>{let s=Math.floor(ax(e.a.width*r,1,1e4)),l=Math.floor(ax(e.a.height*r,1,1e4)),c=Math.min(i*r,s/2,l/2),u=Math.max(e.a.width/n.width,e.a.height/n.height)*r,d=e.page._exportingOrRendering&&iS.imageDownScalingEnabled&&u<1&&!a,h=0===n.x&&0===n.y&&n.width===t?.width&&n.height===t?.height,f=m(S).useMemo(()=>{if(!t||!t.width||!t.height)return;let e=0===c,n=!d;if(!h||!e||!n)return ad()},[t,c,d,h]);return m(S).useLayoutEffect(()=>{let e,r,i,a;if(!f||!t)return;ac(f,s,l);let o=f.getContext("2d");if(!o)return;c&&(o.beginPath(),o.moveTo(c,0),o.lineTo(s-c,0),o.arc(s-c,c,c,3*Math.PI/2,0,!1),o.lineTo(s,l-c),o.arc(s-c,l-c,c,0,Math.PI/2,!1),o.lineTo(c,l),o.arc(c,l-c,c,Math.PI/2,Math.PI,!1),o.lineTo(0,c),o.arc(c,c,c,Math.PI,3*Math.PI/2,!1),o.clip());let h=d?((e=ad()).width=t.width,e.height=t.height,r=Math.max(1,Math.floor(e.width*u)),i=Math.max(1,Math.floor(e.height*u)),e.getContext("2d")?.drawImage(t,0,0,e.width,e.height),a=function(e,t,n,r,i){for(var a=new ImageData(t,n),o=new Int32Array(e.data.buffer),s=e.width,l=new Int32Array(a.data.buffer),c=a.width,u=t/r,d=n/i,h=Math.round(1/u),f=Math.round(1/d),p=h*f,m=0;m<a.height;m++)for(var g=0;g<c;g++){for(var y=0+Math.round(g/u)+(0+Math.round(m/d))*s,v=0,b=0,x=0,w=0,C=0;C<f;C++)for(var S=0;S<h;S++){var k=o[y+S+C*s];v+=k<<24>>>24,b+=k<<16>>>24,x+=k<<8>>>24,w+=k>>>24}v=Math.round(v/p),b=Math.round(b/p),x=Math.round(x/p),w=Math.round(w/p),l[g+m*c]=w<<24|x<<16|b<<8|v}return a}(e.getContext("2d").getImageData(0,0,e.width,e.height),r,i,e.width,e.height),e.width=r,e.height=i,e.getContext("2d")?.putImageData(a,0,0),e):t,p=d?{x:Math.floor(n.x*u),y:Math.floor(n.y*u),width:Math.floor(n.width*u),height:Math.floor(n.height*u)}:n;o.drawImage(h,p.x,p.y,p.width,p.height,0,0,f.width,f.height)},[f,e.a.width,e.a.height,n.x,n.y,n.width,n.height,i,r,a,e.page._exportingOrRendering,d]),m(S).useEffect(()=>()=>{f&&"CANVAS"===f.nodeName&&n_.Util.releaseCanvas(f)},[f]),f||t})(e,b,R,N,L,a||e._cropModeEnabled||"svg"===e.type,!0),N,[R,L,N]),D=Math.max(e.a.width/n,e.a.height/r);m(S).useEffect(()=>{if(!e._cropModeEnabled)return;let t=s.current?.getStage();function n(t){e._cropModeEnabled&&t.target!==l.current&&e.toggleCropMode(!1)}function r(n){e._cropModeEnabled&&n.target.parentNode!==t?.content&&e.toggleCropMode(!1)}return document.body.addEventListener("click",r),t?.on("click",n),t?.on("tap",n),()=>{document.body.removeEventListener("click",r),document.body.removeEventListener("touchstart",r),t?.off("click",n),t?.off("click",n)}},[e._cropModeEnabled]),m(S).useLayoutEffect(()=>{if(!a&&!e._cropModeEnabled)return iW(s.current,e),(0,E.autorun)(()=>{iW(s.current,e)},{delay:100})},[j,e.page._exportingOrRendering,a,k,_,e._cropModeEnabled]),m(S).useLayoutEffect(()=>{a||e._cropModeEnabled?s.current?.clearCache():iW(s.current,e)},[a,e.a.width,e.a.height,e._cropModeEnabled]),m(S).useEffect(()=>{iW(s.current,e)},[e.shadowEnabled,e.shadowBlur,e.cornerRadius,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]);let z=m(S).useRef(null),B=m(S).useRef(null),F=m(S).useRef(null);m(S).useLayoutEffect(()=>{e._cropModeEnabled&&(B.current.nodes([z.current]),F.current.nodes([l.current]))},[e._cropModeEnabled]);var H,V=m(S).useRef(null),U=m(S).useRef(0),$=m(S).useRef(!1);let q=t=>{t.evt.touches?.length>2&&t.target.stopDrag(),Math.round(t.target.x())>0&&(t.target.x(0),t.target.scaleX(1)),Math.round(t.target.y())>0&&(t.target.y(0),t.target.scaleY(1));let i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1,n/i),s=Math.min(1,r/a),l=Math.min(1-o,Math.max(0,Math.round(-t.target.x())/i)),c=Math.min(1-s,Math.max(0,Math.round(-t.target.y())/a));t.target.setAttrs({x:-l*b.width,y:-c*b.height,scaleX:1,scaleY:1}),e.set({cropX:l,cropY:c,cropWidth:o,cropHeight:s})},W=()=>{"svg"===e.type||!e.contentEditable||e.stretchEnabled||setTimeout(()=>{e.toggleCropMode(!0)})},G="svg"===e.type&&y,[K]=au("loading"===f&&!G,100,!1,!1),Y="failed"===f,X=!K&&!Y,Q=m(S).useRef({cropX:0,cropY:0,cropWidth:0,cropHeight:0}),Z=X?e.a.opacity:0;r0(s,Z);let J=e.selectable||"admin"===t.role,ee=iK(),et=rQ(e,e.borderColor,"stroke");return(0,C.jsxs)(C.Fragment,{children:[K&&(0,C.jsx)(aC,{element:e}),Y&&(0,C.jsx)(aS,{element:e}),(0,C.jsx)(rA,{ref:s,name:"element",id:e.id,image:j,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:Z,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:R,listening:J,draggable:ee?e.draggable&&c:e.draggable,preventDefault:!ee||c,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDblClick:W,onDblTap:W,onTransformStart:()=>{o(!0),Q.current={cropX:e.cropX,cropY:e.cropY,cropWidth:e.cropWidth,cropHeight:e.cropHeight}},onTransform:t=>{let i=t.currentTarget,a=1e-7>Math.abs(i.scaleX()-1)?1:i.scaleX(),o=1e-7>Math.abs(i.scaleY()-1)?1:i.scaleY();i.scaleX(1),i.scaleY(1);let s=t.target.getStage()?.findOne("Transformer"),l=Math.min(1-n/b.width,Math.max(0,e.cropX)),c=Math.min(1-r/b.height,Math.max(0,e.cropY)),u=s.getActiveAnchor(),d=!(u.indexOf("middle")>=0||u.indexOf("center")>=0),h=!d&&a<1&&Q.current.cropHeight>r/b.height,f=d?e.cropWidth:e.cropWidth*a;h&&(f=e.cropWidth);let p=!d&&o<1&&Q.current.cropWidth>n/b.width,m=d?e.cropHeight:e.cropHeight*o;p&&(m=e.cropHeight),I&&(f=e.cropWidth,m=e.cropHeight),e.set({cropX:l,cropY:c,x:i.x(),y:i.y(),width:i.width()*a,height:i.height()*o,rotation:t.target.rotation(),cropWidth:Math.min(f,1-l),cropHeight:Math.min(m,1-c)})},onTransformEnd:t=>{let i=t.currentTarget;e.set({width:i.width(),height:i.height(),x:i.x(),y:i.y(),rotation:t.target.rotation(),cropWidth:n/b.width,cropHeight:r/b.height}),o(!1)}}),(0,C.jsx)(rP,{x:e.x,y:e.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:Z,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,...et,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,L-e.borderSize),hideInExport:!e.showInExport}),e._cropModeEnabled&&(0,C.jsxs)(rB,{selector:".page-abs-container",enabled:!0,children:[(0,C.jsx)(rP,{x:-window.innerWidth/t.scale,y:-window.innerWidth/t.scale,width:window.innerWidth/t.scale*3,height:window.innerWidth/t.scale*3,fill:"rgba(0,0,0,0.3)"}),(0,C.jsx)(rA,{listening:!1,image:j,x:e.x,y:e.y,width:e.a.width,height:e.a.height,rotation:e.rotation,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur}),(0,C.jsxs)(rE,{x:e.x,y:e.y,rotation:e.rotation,scaleX:D,scaleY:D,children:[(0,C.jsx)(rA,{image:b,ref:l,opacity:.4,draggable:!0,x:-e.cropX*b.width,y:-e.cropY*b.height,onDragMove:q,onTransform:q,onTouchMove:e=>{e.evt.preventDefault();let t=e.target.getStage().getPointersPositions();var n=t[0],r=t[1];let i=e.target;if(n&&!r&&!i.isDragging()&&$.current&&(i.startDrag(),$.current=!1),n&&r){n_.hitOnDragEnabled=!0,i.isDragging()&&($.current=!0,i.stopDrag());let t=e.target.getAbsoluteTransform().copy();t.invert();var a={x:n.x,y:n.y},o={x:r.x,y:r.y};if(!V.current){V.current=am(a,o);return}var s=am(a,o),l=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2));U.current||(U.current=l);let p=i.position();var c={x:s.x-p.x,y:s.y-p.y},u=l/U.current;i.scaleX(u),i.scaleY(u);let m=t.point(s),g=t.point(V.current);var d=m.x-g.x,h=m.y-g.y,f={x:Math.min(0,s.x-c.x*u+d),y:Math.min(0,s.y-c.y*u+h)};i.position(f),U.current=l,V.current=s,q(e)}},onTouchEnd:e=>{U.current=0,V.current=null,n_.hitOnDragEnabled=!1}}),(0,C.jsx)(rL,{ref:F,...av}),(0,C.jsx)(rP,{width:n,height:r,ref:z,listening:!1,onTransform:t=>{if(e.cropX<Math.abs(t.target.x()/b.width)&&0>t.target.x()&&e.cropX>0){let n=(e.cropWidth+e.cropX)*b.width;t.target.scaleX(1),t.target.width(n)}if(e.cropY<Math.abs(t.target.y()/b.height)&&0>t.target.y()&&e.cropY>0){let n=(e.cropHeight+e.cropY)*b.height;t.target.scaleY(1),t.target.height(n)}t.target.x()<-e.cropX*b.width-1e-9&&(t.target.x(-e.cropX*b.width),t.target.scaleX(1)),t.target.y()<-e.cropY*b.height-1e-9&&(t.target.y(-e.cropY*b.height),t.target.scaleY(1));let n=Math.min(1,Math.max(0,e.cropX+t.target.x()/b.width)),r=Math.min(1,Math.max(0,t.target.y()/b.height+e.cropY)),i=t.target.width()*t.target.scaleX(),a=t.target.height()*t.target.scaleY(),o=Math.min(1-n,i/b.width),s=Math.min(1-r,a/b.height),l=t.target.getAbsolutePosition(t.target.getParent().getParent());t.target.scale({x:1,y:1}),t.target.position({x:0,y:0}),e.set({x:l.x,y:l.y,cropX:n,cropY:r,cropWidth:o,cropHeight:s,width:Math.min(i*D,b.width*(1-n)*D),height:Math.min(a*D,b.height*(1-r)*D)})}}),(0,C.jsx)(rL,{ref:B,...ag,visible:e.resizable})]})]})]})});var S=x("8NFma"),aP={};jk=function(e){for(var t,n=e.length,r=n%3,i=[],a=0,o=n-r;a<o;a+=16383)i.push(function(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),i.push(aO[r>>18&63]+aO[r>>12&63]+aO[r>>6&63]+aO[63&r]);return i.join("")}(e,a,a+16383>o?o:a+16383));return 1===r?i.push(aO[(t=e[n-1])>>2]+aO[t<<4&63]+"=="):2===r&&i.push(aO[(t=(e[n-2]<<8)+e[n-1])>>10]+aO[t>>4&63]+aO[t<<2&63]+"="),i.join("")};for(var aO=[],aA=[],aI="u">typeof Uint8Array?Uint8Array:Array,aR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",aL=0,aM=aR.length;aL<aM;++aL)aO[aL]=aR[aL],aA[aR.charCodeAt(aL)]=aL;aA[45]=62,aA[95]=63,j_=function(e,t,n,r,i){var a,o,s=8*i-r-1,l=(1<<s)-1,c=l>>1,u=-7,d=n?i-1:0,h=n?-1:1,f=e[t+d];for(d+=h,a=f&(1<<-u)-1,f>>=-u,u+=s;u>0;a=256*a+e[t+d],d+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=256*o+e[t+d],d+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),a-=c}return(f?-1:1)*o*Math.pow(2,a-r)},jE=function(e,t,n,r,i,a){var o,s,l,c=8*a-i-1,u=(1<<c)-1,d=u>>1,h=5960464477539062e-23*(23===i),f=r?0:a-1,p=r?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(s=+!!isNaN(t),o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+d>=1?t+=h/l:t+=h*Math.pow(2,1-d),t*l>=2&&(o++,l/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*l-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[n+f]=255&o,f+=p,o/=256,c-=8);e[n+f-p]|=128*m};let aN="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function aj(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,aD.prototype),t}function aD(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return aF(e)}return az(e,t,n)}function az(e,t,n){if("string"==typeof e){var r=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!aD.isEncoding(i))throw TypeError("Unknown encoding: "+i);let n=0|a$(r,i),a=aj(n),o=a.write(r,i);return o!==n&&(a=a.slice(0,o)),a}if(ArrayBuffer.isView(e)){var a=e;if(or(a,Uint8Array)){let e=new Uint8Array(a);return aV(e.buffer,e.byteOffset,e.byteLength)}return aH(a)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(or(e,ArrayBuffer)||e&&or(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(or(e,SharedArrayBuffer)||e&&or(e.buffer,SharedArrayBuffer)))return aV(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(null!=o&&o!==e)return aD.from(o,t,n);let s=function(e){if(aD.isBuffer(e)){let t=0|aU(e.length),n=aj(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?aj(0):aH(e):"Buffer"===e.type&&Array.isArray(e.data)?aH(e.data):void 0}(e);if(s)return s;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return aD.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function aB(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function aF(e){return aB(e),aj(e<0?0:0|aU(e))}function aH(e){let t=e.length<0?0:0|aU(e.length),n=aj(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function aV(e,t,n){let r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),aD.prototype),r}function aU(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function a$(e,t){if(aD.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||or(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return oe(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return ot(e).length;default:if(i)return r?-1:oe(e).length;t=(""+t).toLowerCase(),i=!0}}function aq(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=oi[e[r]];return i}(this,t,n);case"utf8":case"utf-8":return aY(this,t,n);case"ascii":return function(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":var i,a,o;return i=this,a=t,o=n,0===a&&o===i.length?jk(i):jk(i.slice(a,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){let r=e.slice(t,n),i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}(this,t,n);default:if(r)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function aW(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function aG(e,t,n,r,i){var a;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(a=n*=1)!=a&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length)if(i)return -1;else n=e.length-1;else if(n<0)if(!i)return -1;else n=0;if("string"==typeof t&&(t=aD.from(t,r)),aD.isBuffer(t))return 0===t.length?-1:aK(e,t,n,r,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,n);else return Uint8Array.prototype.lastIndexOf.call(e,t,n);return aK(e,[t],n,r,i)}throw TypeError("val must be string, number or Buffer")}function aK(e,t,n,r,i){let a,o=1,s=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;o=2,s/=2,l/=2,n/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let r=-1;for(a=n;a<s;a++)if(c(e,a)===c(t,-1===r?0:a-r)){if(-1===r&&(r=a),a-r+1===l)return r*o}else -1!==r&&(a-=a-r),r=-1}else for(n+l>s&&(n=s-l),a=n;a>=0;a--){let n=!0;for(let r=0;r<l;r++)if(c(e,a+r)!==c(t,r)){n=!1;break}if(n)return a}return -1}function aY(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],a=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,s,l;switch(o){case 1:t<128&&(a=t);break;case 2:(192&(n=e[i+1]))==128&&(l=(31&t)<<6|63&n)>127&&(a=l);break;case 3:n=e[i+1],r=e[i+2],(192&n)==128&&(192&r)==128&&(l=(15&t)<<12|(63&n)<<6|63&r)>2047&&(l<55296||l>57343)&&(a=l);break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],(192&n)==128&&(192&r)==128&&(192&s)==128&&(l=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s)>65535&&l<1114112&&(a=l)}}null===a?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),i+=o}var a=r;let o=a.length;if(o<=4096)return String.fromCharCode.apply(String,a);let s="",l=0;for(;l<o;)s+=String.fromCharCode.apply(String,a.slice(l,l+=4096));return s}function aX(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function aQ(e,t,n,r,i,a){if(!aD.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function aZ(e,t,n,r,i){a6(t,r,i,e,n,7);let a=Number(t&BigInt(0xffffffff));e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function aJ(e,t,n,r,i){a6(t,r,i,e,n,7);let a=Number(t&BigInt(0xffffffff));e[n+7]=a,a>>=8,e[n+6]=a,a>>=8,e[n+5]=a,a>>=8,e[n+4]=a;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function a0(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function a1(e,t,n,r,i){return t*=1,n>>>=0,i||a0(e,t,n,4,34028234663852886e22,-34028234663852886e22),jE(e,t,n,r,23,4),n+4}function a2(e,t,n,r,i){return t*=1,n>>>=0,i||a0(e,t,n,8,17976931348623157e292,-17976931348623157e292),jE(e,t,n,r,52,8),n+8}aD.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!aD.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(aD.prototype,"parent",{enumerable:!0,get:function(){if(aD.isBuffer(this))return this.buffer}}),Object.defineProperty(aD.prototype,"offset",{enumerable:!0,get:function(){if(aD.isBuffer(this))return this.byteOffset}}),aD.poolSize=8192,aD.from=function(e,t,n){return az(e,t,n)},Object.setPrototypeOf(aD.prototype,Uint8Array.prototype),Object.setPrototypeOf(aD,Uint8Array),aD.alloc=function(e,t,n){return(aB(e),e<=0)?aj(e):void 0!==t?"string"==typeof n?aj(e).fill(t,n):aj(e).fill(t):aj(e)},aD.allocUnsafe=function(e){return aF(e)},aD.allocUnsafeSlow=function(e){return aF(e)},aD.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==aD.prototype},aD.compare=function(e,t){if(or(e,Uint8Array)&&(e=aD.from(e,e.offset,e.byteLength)),or(t,Uint8Array)&&(t=aD.from(t,t.offset,t.byteLength)),!aD.isBuffer(e)||!aD.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},aD.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},aD.concat=function(e,t){let n;if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return aD.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;let r=aD.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(or(t,Uint8Array))i+t.length>r.length?(aD.isBuffer(t)||(t=aD.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(aD.isBuffer(t))t.copy(r,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return r},aD.byteLength=a$,aD.prototype._isBuffer=!0,aD.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)aW(this,t,t+1);return this},aD.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)aW(this,t,t+3),aW(this,t+1,t+2);return this},aD.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)aW(this,t,t+7),aW(this,t+1,t+6),aW(this,t+2,t+5),aW(this,t+3,t+4);return this},aD.prototype.toString=function(){let e=this.length;return 0===e?"":0==arguments.length?aY(this,0,e):aq.apply(this,arguments)},aD.prototype.toLocaleString=aD.prototype.toString,aD.prototype.equals=function(e){if(!aD.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===aD.compare(this,e)},aD.prototype.inspect=function(){let e="";return e=this.toString("hex",0,50).replace(/(.{2})/g,"$1 ").trim(),this.length>50&&(e+=" ... "),"<Buffer "+e+">"},aN&&(aD.prototype[aN]=aD.prototype.inspect),aD.prototype.compare=function(e,t,n,r,i){if(or(e,Uint8Array)&&(e=aD.from(e,e.offset,e.byteLength)),!aD.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let a=i-r,o=n-t,s=Math.min(a,o),l=this.slice(r,i),c=e.slice(t,n);for(let e=0;e<s;++e)if(l[e]!==c[e]){a=l[e],o=c[e];break}return a<o?-1:+(o<a)},aD.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},aD.prototype.indexOf=function(e,t,n){return aG(this,e,t,n,!0)},aD.prototype.lastIndexOf=function(e,t,n){return aG(this,e,t,n,!1)},aD.prototype.write=function(e,t,n,r){var i,a,o,s,l,c,u,d;if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-t;if((void 0===n||n>h)&&(n=h),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let f=!1;for(;;)switch(r){case"hex":return function(e,t,n,r){let i;n=Number(n)||0;let a=e.length-n;r?(r=Number(r))>a&&(r=a):r=a;let o=t.length;for(r>o/2&&(r=o/2),i=0;i<r;++i){var s;let r=parseInt(t.substr(2*i,2),16);if((s=r)!=s)break;e[n+i]=r}return i}(this,e,t,n);case"utf8":case"utf-8":return i=t,a=n,on(oe(e,this.length-i),this,i,a);case"ascii":case"latin1":case"binary":return o=t,s=n,on(function(e){let t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(e),this,o,s);case"base64":return l=t,c=n,on(ot(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,d=n,on(function(e,t){let n,r,i=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i.push(n%256),i.push(r);return i}(e,this.length-u),this,u,d);default:if(f)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),f=!0}},aD.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},aD.prototype.slice=function(e,t){let n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,aD.prototype),r},aD.prototype.readUintLE=aD.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r},aD.prototype.readUintBE=aD.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},aD.prototype.readUint8=aD.prototype.readUInt8=function(e,t){return e>>>=0,t||aX(e,1,this.length),this[e]},aD.prototype.readUint16LE=aD.prototype.readUInt16LE=function(e,t){return e>>>=0,t||aX(e,2,this.length),this[e]|this[e+1]<<8},aD.prototype.readUint16BE=aD.prototype.readUInt16BE=function(e,t){return e>>>=0,t||aX(e,2,this.length),this[e]<<8|this[e+1]},aD.prototype.readUint32LE=aD.prototype.readUInt32LE=function(e,t){return e>>>=0,t||aX(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},aD.prototype.readUint32BE=aD.prototype.readUInt32BE=function(e,t){return e>>>=0,t||aX(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},aD.prototype.readBigUInt64LE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];(void 0===t||void 0===n)&&a9(e,this.length-8);let r=t+256*this[++e]+65536*this[++e]+0x1000000*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+0x1000000*n;return BigInt(r)+(BigInt(i)<<BigInt(32))}),aD.prototype.readBigUInt64BE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];(void 0===t||void 0===n)&&a9(e,this.length-8);let r=0x1000000*t+65536*this[++e]+256*this[++e]+this[++e],i=0x1000000*this[++e]+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),aD.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=this[e],i=1,a=0;for(;++a<t&&(i*=256);)r+=this[e+a]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},aD.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||aX(e,t,this.length);let r=t,i=1,a=this[e+--r];for(;r>0&&(i*=256);)a+=this[e+--r]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},aD.prototype.readInt8=function(e,t){return(e>>>=0,t||aX(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},aD.prototype.readInt16LE=function(e,t){e>>>=0,t||aX(e,2,this.length);let n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},aD.prototype.readInt16BE=function(e,t){e>>>=0,t||aX(e,2,this.length);let n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},aD.prototype.readInt32LE=function(e,t){return e>>>=0,t||aX(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},aD.prototype.readInt32BE=function(e,t){return e>>>=0,t||aX(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},aD.prototype.readBigInt64LE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];return(void 0===t||void 0===n)&&a9(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24))<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+0x1000000*this[++e])}),aD.prototype.readBigInt64BE=oa(function(e){a5(e>>>=0,"offset");let t=this[e],n=this[e+7];return(void 0===t||void 0===n)&&a9(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<<BigInt(32))+BigInt(0x1000000*this[++e]+65536*this[++e]+256*this[++e]+n)}),aD.prototype.readFloatLE=function(e,t){return e>>>=0,t||aX(e,4,this.length),j_(this,e,!0,23,4)},aD.prototype.readFloatBE=function(e,t){return e>>>=0,t||aX(e,4,this.length),j_(this,e,!1,23,4)},aD.prototype.readDoubleLE=function(e,t){return e>>>=0,t||aX(e,8,this.length),j_(this,e,!0,52,8)},aD.prototype.readDoubleBE=function(e,t){return e>>>=0,t||aX(e,8,this.length),j_(this,e,!1,52,8)},aD.prototype.writeUintLE=aD.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){let r=Math.pow(2,8*n)-1;aQ(this,e,t,n,r,0)}let i=1,a=0;for(this[t]=255&e;++a<n&&(i*=256);)this[t+a]=e/i&255;return t+n},aD.prototype.writeUintBE=aD.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){let r=Math.pow(2,8*n)-1;aQ(this,e,t,n,r,0)}let i=n-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+n},aD.prototype.writeUint8=aD.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,1,255,0),this[t]=255&e,t+1},aD.prototype.writeUint16LE=aD.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},aD.prototype.writeUint16BE=aD.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},aD.prototype.writeUint32LE=aD.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},aD.prototype.writeUint32BE=aD.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},aD.prototype.writeBigUInt64LE=oa(function(e,t=0){return aZ(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),aD.prototype.writeBigUInt64BE=oa(function(e,t=0){return aJ(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),aD.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){let r=Math.pow(2,8*n-1);aQ(this,e,t,n,r-1,-r)}let i=0,a=1,o=0;for(this[t]=255&e;++i<n&&(a*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},aD.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){let r=Math.pow(2,8*n-1);aQ(this,e,t,n,r-1,-r)}let i=n-1,a=1,o=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/a|0)-o&255;return t+n},aD.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},aD.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},aD.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},aD.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},aD.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||aQ(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},aD.prototype.writeBigInt64LE=oa(function(e,t=0){return aZ(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),aD.prototype.writeBigInt64BE=oa(function(e,t=0){return aJ(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),aD.prototype.writeFloatLE=function(e,t,n){return a1(this,e,t,!0,n)},aD.prototype.writeFloatBE=function(e,t,n){return a1(this,e,t,!1,n)},aD.prototype.writeDoubleLE=function(e,t,n){return a2(this,e,t,!0,n)},aD.prototype.writeDoubleBE=function(e,t,n){return a2(this,e,t,!1,n)},aD.prototype.copy=function(e,t,n,r){if(!aD.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},aD.prototype.fill=function(e,t,n,r){let i;if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!aD.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){let t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{let a=aD.isBuffer(e)?e:aD.from(e,r),o=a.length;if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%o]}return this};let a4={};function a3(e,t,n){a4[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function a8(e){let t="",n=e.length,r=+("-"===e[0]);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function a6(e,t,n,r,i,a){if(e>n||e<t){let r,i="bigint"==typeof t?"n":"";throw r=a>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(a+1)*8}${i}`:`>= -(2${i} ** ${(a+1)*8-1}${i}) and < 2 ** ${(a+1)*8-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new a4.ERR_OUT_OF_RANGE("value",r,e)}a5(i,"offset"),(void 0===r[i]||void 0===r[i+a])&&a9(i,r.length-(a+1))}function a5(e,t){if("number"!=typeof e)throw new a4.ERR_INVALID_ARG_TYPE(t,"number",e)}function a9(e,t,n){if(Math.floor(e)!==e)throw a5(e,n),new a4.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new a4.ERR_BUFFER_OUT_OF_BOUNDS;throw new a4.ERR_OUT_OF_RANGE(n||"offset",`>= ${+!!n} and <= ${t}`,e)}a3("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),a3("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),a3("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>0x100000000?i=a8(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=a8(i)),i+="n"),r+=` It must be ${t}. Received ${i}`},RangeError);let a7=/[^+/0-9A-Za-z-_]/g;function oe(e,t){let n;t=t||1/0;let r=e.length,i=null,a=[];for(let o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return a}function ot(e){return function(e){var t,n,r=function(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}(e),i=r[0],a=r[1],o=new aI((i+a)*3/4-a),s=0,l=a>0?i-4:i;for(n=0;n<l;n+=4)t=aA[e.charCodeAt(n)]<<18|aA[e.charCodeAt(n+1)]<<12|aA[e.charCodeAt(n+2)]<<6|aA[e.charCodeAt(n+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=255&t;return 2===a&&(t=aA[e.charCodeAt(n)]<<2|aA[e.charCodeAt(n+1)]>>4,o[s++]=255&t),1===a&&(t=aA[e.charCodeAt(n)]<<10|aA[e.charCodeAt(n+1)]<<4|aA[e.charCodeAt(n+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t),o}(function(e){if((e=(e=e.split("=")[0]).trim().replace(a7,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function on(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function or(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let oi=function(){let e="0123456789abcdef",t=Array(256);for(let n=0;n<16;++n){let r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function oa(e){return"u"<typeof BigInt?oo:e}function oo(){throw Error("BigInt not supported")}"u">typeof self&&self,aP=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=109)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(17),i=n(18),a=n(19),o=n(45),s=n(46),l=n(47),c=n(48),u=n(49),d=n(12),h=n(32),f=n(33),p=n(31),m=n(1);t.default={Scope:m.Scope,create:m.create,find:m.find,query:m.query,register:m.register,Container:r.default,Format:i.default,Leaf:a.default,Embed:c.default,Scroll:o.default,Block:l.default,Inline:s.default,Text:u.default,Attributor:{Attribute:d.default,Class:h.default,Style:f.default,Store:p.default}}},function(e,t,n){var r,i,a,o=this&&this.__extends||(i=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(e,t){function n(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){function t(t){var n=this;return t="[Parchment] "+t,(n=e.call(this,t)||this).message=t,n.name=n.constructor.name,n}return o(t,e),t}(Error);t.ParchmentError=s;var l={},c={},u={},d={};function h(e,t){if(void 0===t&&(t=a.ANY),"string"==typeof e)n=d[e]||l[e];else if(e instanceof Text||e.nodeType===Node.TEXT_NODE)n=d.text;else if("number"==typeof e)e&a.LEVEL&a.BLOCK?n=d.block:e&a.LEVEL&a.INLINE&&(n=d.inline);else if(e instanceof HTMLElement){var n,r=(e.getAttribute("class")||"").split(/\s+/);for(var i in r)if(n=c[r[i]])break;n=n||u[e.tagName]}return null==n?null:t&a.LEVEL&n.scope&&t&a.TYPE&n.scope?n:null}t.DATA_KEY="__blot",(r=a=t.Scope||(t.Scope={}))[r.TYPE=3]="TYPE",r[r.LEVEL=12]="LEVEL",r[r.ATTRIBUTE=13]="ATTRIBUTE",r[r.BLOT=14]="BLOT",r[r.INLINE=7]="INLINE",r[r.BLOCK=11]="BLOCK",r[r.BLOCK_BLOT=10]="BLOCK_BLOT",r[r.INLINE_BLOT=6]="INLINE_BLOT",r[r.BLOCK_ATTRIBUTE=9]="BLOCK_ATTRIBUTE",r[r.INLINE_ATTRIBUTE=5]="INLINE_ATTRIBUTE",r[r.ANY=15]="ANY",t.create=function(e,t){var n=h(e);if(null==n)throw new s("Unable to create "+e+" blot");var r=e instanceof Node||e.nodeType===Node.TEXT_NODE?e:n.create(t);return new n(r,t)},t.find=function e(n,r){return(void 0===r&&(r=!1),null==n)?null:null!=n[t.DATA_KEY]?n[t.DATA_KEY].blot:r?e(n.parentNode,r):null},t.query=h,t.register=function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];if(t.length>1)return t.map(function(t){return e(t)});var r=t[0];if("string"!=typeof r.blotName&&"string"!=typeof r.attrName)throw new s("Invalid definition");if("abstract"===r.blotName)throw new s("Cannot register abstract class");return d[r.blotName||r.attrName]=r,"string"==typeof r.keyName?l[r.keyName]=r:(null!=r.className&&(c[r.className]=r),null!=r.tagName&&(Array.isArray(r.tagName)?r.tagName=r.tagName.map(function(e){return e.toUpperCase()}):r.tagName=r.tagName.toUpperCase(),(Array.isArray(r.tagName)?r.tagName:[r.tagName]).forEach(function(e){(null==u[e]||null==r.className)&&(u[e]=r)}))),r}},function(e,t,n){var r=n(51),i=n(11),a=n(3),o=n(20),s=function(e){Array.isArray(e)?this.ops=e:null!=e&&Array.isArray(e.ops)?this.ops=e.ops:this.ops=[]};s.prototype.insert=function(e,t){var n={};return 0===e.length?this:(n.insert=e,null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n))},s.prototype.delete=function(e){return e<=0?this:this.push({delete:e})},s.prototype.retain=function(e,t){if(e<=0)return this;var n={retain:e};return null!=t&&"object"==typeof t&&Object.keys(t).length>0&&(n.attributes=t),this.push(n)},s.prototype.push=function(e){var t=this.ops.length,n=this.ops[t-1];if(e=a(!0,{},e),"object"==typeof n){if("number"==typeof e.delete&&"number"==typeof n.delete)return this.ops[t-1]={delete:n.delete+e.delete},this;if("number"==typeof n.delete&&null!=e.insert&&(t-=1,"object"!=typeof(n=this.ops[t-1])))return this.ops.unshift(e),this;if(i(e.attributes,n.attributes)){if("string"==typeof e.insert&&"string"==typeof n.insert)return this.ops[t-1]={insert:n.insert+e.insert},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this;else if("number"==typeof e.retain&&"number"==typeof n.retain)return this.ops[t-1]={retain:n.retain+e.retain},"object"==typeof e.attributes&&(this.ops[t-1].attributes=e.attributes),this}}return t===this.ops.length?this.ops.push(e):this.ops.splice(t,0,e),this},s.prototype.chop=function(){var e=this.ops[this.ops.length-1];return e&&e.retain&&!e.attributes&&this.ops.pop(),this},s.prototype.filter=function(e){return this.ops.filter(e)},s.prototype.forEach=function(e){this.ops.forEach(e)},s.prototype.map=function(e){return this.ops.map(e)},s.prototype.partition=function(e){var t=[],n=[];return this.forEach(function(r){(e(r)?t:n).push(r)}),[t,n]},s.prototype.reduce=function(e,t){return this.ops.reduce(e,t)},s.prototype.changeLength=function(){return this.reduce(function(e,t){return t.insert?e+o.length(t):t.delete?e-t.delete:e},0)},s.prototype.length=function(){return this.reduce(function(e,t){return e+o.length(t)},0)},s.prototype.slice=function(e,t){e=e||0,"number"!=typeof t&&(t=1/0);for(var n,r=[],i=o.iterator(this.ops),a=0;a<t&&i.hasNext();)a<e?n=i.next(e-a):(n=i.next(t-a),r.push(n)),a+=o.length(n);return new s(r)},s.prototype.compose=function(e){var t=o.iterator(this.ops),n=o.iterator(e.ops),r=[],a=n.peek();if(null!=a&&"number"==typeof a.retain&&null==a.attributes){for(var l=a.retain;"insert"===t.peekType()&&t.peekLength()<=l;)l-=t.peekLength(),r.push(t.next());a.retain-l>0&&n.next(a.retain-l)}for(var c=new s(r);t.hasNext()||n.hasNext();)if("insert"===n.peekType())c.push(n.next());else if("delete"===t.peekType())c.push(t.next());else{var u=Math.min(t.peekLength(),n.peekLength()),d=t.next(u),h=n.next(u);if("number"==typeof h.retain){var f={};"number"==typeof d.retain?f.retain=u:f.insert=d.insert;var p=o.attributes.compose(d.attributes,h.attributes,"number"==typeof d.retain);if(p&&(f.attributes=p),c.push(f),!n.hasNext()&&i(c.ops[c.ops.length-1],f)){var m=new s(t.rest());return c.concat(m).chop()}}else"number"==typeof h.delete&&"number"==typeof d.retain&&c.push(h)}return c.chop()},s.prototype.concat=function(e){var t=new s(this.ops.slice());return e.ops.length>0&&(t.push(e.ops[0]),t.ops=t.ops.concat(e.ops.slice(1))),t},s.prototype.diff=function(e,t){if(this.ops===e.ops)return new s;var n=[this,e].map(function(t){return t.map(function(n){if(null!=n.insert)return"string"==typeof n.insert?n.insert:"\0";throw Error("diff() called "+(t===e?"on":"with")+" non-document")}).join("")}),a=new s,l=r(n[0],n[1],t),c=o.iterator(this.ops),u=o.iterator(e.ops);return l.forEach(function(e){for(var t=e[1].length;t>0;){var n=0;switch(e[0]){case r.INSERT:n=Math.min(u.peekLength(),t),a.push(u.next(n));break;case r.DELETE:n=Math.min(t,c.peekLength()),c.next(n),a.delete(n);break;case r.EQUAL:n=Math.min(c.peekLength(),u.peekLength(),t);var s=c.next(n),l=u.next(n);i(s.insert,l.insert)?a.retain(n,o.attributes.diff(s.attributes,l.attributes)):a.push(l).delete(n)}t-=n}}),a.chop()},s.prototype.eachLine=function(e,t){t=t||"\n";for(var n=o.iterator(this.ops),r=new s,i=0;n.hasNext();){if("insert"!==n.peekType())return;var a=n.peek(),l=o.length(a)-n.peekLength(),c="string"==typeof a.insert?a.insert.indexOf(t,l)-l:-1;if(c<0)r.push(n.next());else if(c>0)r.push(n.next(c));else{if(!1===e(r,n.next(1).attributes||{},i))return;i+=1,r=new s}}r.length()>0&&e(r,{},i)},s.prototype.transform=function(e,t){if(t=!!t,"number"==typeof e)return this.transformPosition(e,t);for(var n=o.iterator(this.ops),r=o.iterator(e.ops),i=new s;n.hasNext()||r.hasNext();)if("insert"===n.peekType()&&(t||"insert"!==r.peekType()))i.retain(o.length(n.next()));else if("insert"===r.peekType())i.push(r.next());else{var a=Math.min(n.peekLength(),r.peekLength()),l=n.next(a),c=r.next(a);if(l.delete)continue;c.delete?i.push(c):i.retain(a,o.attributes.transform(l.attributes,c.attributes,t))}return i.chop()},s.prototype.transformPosition=function(e,t){t=!!t;for(var n=o.iterator(this.ops),r=0;n.hasNext()&&r<=e;){var i=n.peekLength(),a=n.peekType();if(n.next(),"delete"===a){e-=Math.min(i,e-r);continue}"insert"===a&&(r<e||!t)&&(e+=i),r+=i}return e},e.exports=s},function(e,t){var n=Object.prototype.hasOwnProperty,r=Object.prototype.toString,i=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=function(e){return"function"==typeof Array.isArray?Array.isArray(e):"[object Array]"===r.call(e)},s=function(e){if(!e||"[object Object]"!==r.call(e))return!1;var t,i=n.call(e,"constructor"),a=e.constructor&&e.constructor.prototype&&n.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!i&&!a)return!1;for(t in e);return void 0===t||n.call(e,t)},l=function(e,t){i&&"__proto__"===t.name?i(e,t.name,{enumerable:!0,configurable:!0,value:t.newValue,writable:!0}):e[t.name]=t.newValue},c=function(e,t){if("__proto__"===t){if(!n.call(e,t))return;else if(a)return a(e,t).value}return e[t]};e.exports=function e(){var t,n,r,i,a,u,d=arguments[0],h=1,f=arguments.length,p=!1;for("boolean"==typeof d&&(p=d,d=arguments[1]||{},h=2),(null==d||"object"!=typeof d&&"function"!=typeof d)&&(d={});h<f;++h)if(t=arguments[h],null!=t)for(n in t)r=c(d,n),d!==(i=c(t,n))&&(p&&i&&(s(i)||(a=o(i)))?(a?(a=!1,u=r&&o(r)?r:[]):u=r&&s(r)?r:{},l(d,{name:n,newValue:e(p,u,i)})):void 0!==i&&l(d,{name:n,newValue:i}));return d}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BlockEmbed=t.bubbleFormats=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=d(n(3)),o=d(n(2)),s=d(n(0)),l=d(n(16)),c=d(n(6)),u=d(n(7));function d(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function p(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return p(t,e),r(t,[{key:"attach",value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"attach",this).call(this),this.attributes=new s.default.Attributor.Store(this.domNode)}},{key:"delta",value:function(){return new o.default().insert(this.value(),(0,a.default)(this.formats(),this.attributes.values()))}},{key:"format",value:function(e,t){var n=s.default.query(e,s.default.Scope.BLOCK_ATTRIBUTE);null!=n&&this.attributes.attribute(n,t)}},{key:"formatAt",value:function(e,t,n,r){this.format(n,r)}},{key:"insertAt",value:function(e,n,r){if("string"==typeof n&&n.endsWith("\n")){var a=s.default.create(g.blotName);this.parent.insertBefore(a,0===e?this:this.next),a.insertAt(0,n.slice(0,-1))}else i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,n,r)}}]),t}(s.default.Embed);m.scope=s.default.Scope.BLOCK_BLOT;var g=function(e){function t(e){h(this,t);var n=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.cache={},n}return p(t,e),r(t,[{key:"delta",value:function(){return null==this.cache.delta&&(this.cache.delta=this.descendants(s.default.Leaf).reduce(function(e,t){return 0===t.length()?e:e.insert(t.value(),y(t))},new o.default).insert("\n",y(this))),this.cache.delta}},{key:"deleteAt",value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,n),this.cache={}}},{key:"formatAt",value:function(e,n,r,a){n<=0||(s.default.query(r,s.default.Scope.BLOCK)?e+n===this.length()&&this.format(r,a):i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,Math.min(n,this.length()-e-1),r,a),this.cache={})}},{key:"insertAt",value:function(e,n,r){if(null!=r)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,n,r);if(0!==n.length){var a=n.split("\n"),o=a.shift();o.length>0&&(e<this.length()-1||null==this.children.tail?i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,Math.min(e,this.length()-1),o):this.children.tail.insertAt(this.children.tail.length(),o),this.cache={});var s=this;a.reduce(function(e,t){return(s=s.split(e,!0)).insertAt(0,t),t.length},e+o.length)}}},{key:"insertBefore",value:function(e,n){var r=this.children.head;i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,n),r instanceof l.default&&r.remove(),this.cache={}}},{key:"length",value:function(){return null==this.cache.length&&(this.cache.length=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"length",this).call(this)+1),this.cache.length}},{key:"moveChildren",value:function(e,n){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"moveChildren",this).call(this,e,n),this.cache={}}},{key:"optimize",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.cache={}}},{key:"path",value:function(e){return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e,!0)}},{key:"removeChild",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"removeChild",this).call(this,e),this.cache={}}},{key:"split",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(n&&(0===e||e>=this.length()-1)){var r=this.clone();return 0===e?(this.parent.insertBefore(r,this),this):(this.parent.insertBefore(r,this.next),r)}var a=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"split",this).call(this,e,n);return this.cache={},a}}]),t}(s.default.Block);function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return null==e||("function"==typeof e.formats&&(t=(0,a.default)(t,e.formats())),null==e.parent||"scroll"==e.parent.blotName||e.parent.statics.scope!==e.statics.scope)?t:y(e.parent,t)}g.blotName="block",g.tagName="P",g.defaultChild="break",g.allowedChildren=[c.default,s.default.Embed,u.default],t.bubbleFormats=y,t.BlockEmbed=m,t.default=g},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.overload=t.expandConfig=void 0;var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(50);var o=g(n(2)),s=g(n(14)),l=g(n(8)),c=g(n(9)),u=g(n(0)),d=n(15),h=g(d),f=g(n(3)),p=g(n(10)),m=g(n(34));function g(e){return e&&e.__esModule?e:{default:e}}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var v=(0,p.default)("quill"),b=function(){function e(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(this instanceof e))throw TypeError("Cannot call a class as a function");if(this.options=x(t,r),this.container=this.options.container,null==this.container)return v.error("Invalid Quill container",t);this.options.debug&&e.debug(this.options.debug);var i=this.container.innerHTML.trim();this.container.classList.add("ql-container"),this.container.innerHTML="",this.container.__quill=this,this.root=this.addContainer("ql-editor"),this.root.classList.add("ql-blank"),this.root.setAttribute("data-gramm",!1),this.scrollingContainer=this.options.scrollingContainer||this.root,this.emitter=new l.default,this.scroll=u.default.create(this.root,{emitter:this.emitter,whitelist:this.options.formats}),this.editor=new s.default(this.scroll),this.selection=new h.default(this.scroll,this.emitter),this.theme=new this.options.theme(this,this.options),this.keyboard=this.theme.addModule("keyboard"),this.clipboard=this.theme.addModule("clipboard"),this.history=this.theme.addModule("history"),this.theme.init(),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e){e===l.default.events.TEXT_CHANGE&&n.root.classList.toggle("ql-blank",n.editor.isBlank())}),this.emitter.on(l.default.events.SCROLL_UPDATE,function(e,t){var r=n.selection.lastRange,i=r&&0===r.length?r.index:void 0;w.call(n,function(){return n.editor.update(null,t,i)},e)});var a=this.clipboard.convert("<div class='ql-editor' style=\"white-space: normal;\">"+i+"<p><br></p></div>");this.setContents(a),this.history.clear(),this.options.placeholder&&this.root.setAttribute("data-placeholder",this.options.placeholder),this.options.readOnly&&this.disable()}return a(e,null,[{key:"debug",value:function(e){!0===e&&(e="log"),p.default.level(e)}},{key:"find",value:function(e){return e.__quill||u.default.find(e)}},{key:"import",value:function(e){return null==this.imports[e]&&v.error("Cannot import "+e+". Are you sure it was registered?"),this.imports[e]}},{key:"register",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"!=typeof e){var i=e.attrName||e.blotName;"string"==typeof i?this.register("formats/"+i,e,t):Object.keys(e).forEach(function(r){n.register(r,e[r],t)})}else null==this.imports[e]||r||v.warn("Overwriting "+e+" with",t),this.imports[e]=t,(e.startsWith("blots/")||e.startsWith("formats/"))&&"abstract"!==t.blotName?u.default.register(t):e.startsWith("modules")&&"function"==typeof t.register&&t.register()}}]),a(e,[{key:"addContainer",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if("string"==typeof e){var n=e;(e=document.createElement("div")).classList.add(n)}return this.container.insertBefore(e,t),e}},{key:"blur",value:function(){this.selection.setRange(null)}},{key:"deleteText",value:function(e,t,n){var r=this,a=i(C(e,t,n),4);return e=a[0],t=a[1],w.call(this,function(){return r.editor.deleteText(e,t)},n=a[3],e,-1*t)}},{key:"disable",value:function(){this.enable(!1)}},{key:"enable",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.scroll.enable(e),this.container.classList.toggle("ql-disabled",!e)}},{key:"focus",value:function(){var e=this.scrollingContainer.scrollTop;this.selection.focus(),this.scrollingContainer.scrollTop=e,this.scrollIntoView()}},{key:"format",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;return w.call(this,function(){var r=n.getSelection(!0),i=new o.default;if(null==r)return i;if(u.default.query(e,u.default.Scope.BLOCK))i=n.editor.formatLine(r.index,r.length,y({},e,t));else{if(0===r.length)return n.selection.format(e,t),i;i=n.editor.formatText(r.index,r.length,y({},e,t))}return n.setSelection(r,l.default.sources.SILENT),i},r)}},{key:"formatLine",value:function(e,t,n,r,a){var o=this,s=void 0,l=i(C(e,t,n,r,a),4);return e=l[0],t=l[1],s=l[2],w.call(this,function(){return o.editor.formatLine(e,t,s)},a=l[3],e,0)}},{key:"formatText",value:function(e,t,n,r,a){var o=this,s=void 0,l=i(C(e,t,n,r,a),4);return e=l[0],t=l[1],s=l[2],w.call(this,function(){return o.editor.formatText(e,t,s)},a=l[3],e,0)}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=void 0;n="number"==typeof e?this.selection.getBounds(e,t):this.selection.getBounds(e.index,e.length);var r=this.container.getBoundingClientRect();return{bottom:n.bottom-r.top,height:n.height,left:n.left-r.left,right:n.right-r.left,top:n.top-r.top,width:n.width}}},{key:"getContents",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,n=i(C(e,t),2);return e=n[0],t=n[1],this.editor.getContents(e,t)}},{key:"getFormat",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.getSelection(!0),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return"number"==typeof e?this.editor.getFormat(e,t):this.editor.getFormat(e.index,e.length)}},{key:"getIndex",value:function(e){return e.offset(this.scroll)}},{key:"getLength",value:function(){return this.scroll.length()}},{key:"getLeaf",value:function(e){return this.scroll.leaf(e)}},{key:"getLine",value:function(e){return this.scroll.line(e)}},{key:"getLines",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return"number"!=typeof e?this.scroll.lines(e.index,e.length):this.scroll.lines(e,t)}},{key:"getModule",value:function(e){return this.theme.modules[e]}},{key:"getSelection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e&&this.focus(),this.update(),this.selection.getRange()[0]}},{key:"getText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.getLength()-e,n=i(C(e,t),2);return e=n[0],t=n[1],this.editor.getText(e,t)}},{key:"hasFocus",value:function(){return this.selection.hasFocus()}},{key:"insertEmbed",value:function(t,n,r){var i=this,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e.sources.API;return w.call(this,function(){return i.editor.insertEmbed(t,n,r)},a,t)}},{key:"insertText",value:function(e,t,n,r,a){var o=this,s=void 0,l=i(C(e,0,n,r,a),4);return e=l[0],s=l[2],w.call(this,function(){return o.editor.insertText(e,t,s)},a=l[3],e,t.length)}},{key:"isEnabled",value:function(){return!this.container.classList.contains("ql-disabled")}},{key:"off",value:function(){return this.emitter.off.apply(this.emitter,arguments)}},{key:"on",value:function(){return this.emitter.on.apply(this.emitter,arguments)}},{key:"once",value:function(){return this.emitter.once.apply(this.emitter,arguments)}},{key:"pasteHTML",value:function(e,t,n){this.clipboard.dangerouslyPasteHTML(e,t,n)}},{key:"removeFormat",value:function(e,t,n){var r=this,a=i(C(e,t,n),4);return e=a[0],t=a[1],w.call(this,function(){return r.editor.removeFormat(e,t)},n=a[3],e)}},{key:"scrollIntoView",value:function(){this.selection.scrollIntoView(this.scrollingContainer)}},{key:"setContents",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){e=new o.default(e);var n=t.getLength(),r=t.editor.deleteText(0,n),i=t.editor.applyDelta(e),a=i.ops[i.ops.length-1];return null!=a&&"string"==typeof a.insert&&"\n"===a.insert[a.insert.length-1]&&(t.editor.deleteText(t.getLength()-1,1),i.delete(1)),r.compose(i)},n)}},{key:"setSelection",value:function(t,n,r){if(null==t)this.selection.setRange(null,n||e.sources.API);else{var a=i(C(t,n,r),4);t=a[0],n=a[1],r=a[3],this.selection.setRange(new d.Range(t,n),r),r!==l.default.sources.SILENT&&this.selection.scrollIntoView(this.scrollingContainer)}}},{key:"setText",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API,n=new o.default().insert(e);return this.setContents(n,t)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.scroll.update(e);return this.selection.update(e),t}},{key:"updateContents",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.default.sources.API;return w.call(this,function(){return e=new o.default(e),t.editor.applyDelta(e,n)},n,!0)}}]),e}();function x(e,t){if((t=(0,f.default)(!0,{container:e,modules:{clipboard:!0,keyboard:!0,history:!0}},t)).theme&&t.theme!==b.DEFAULTS.theme){if(t.theme=b.import("themes/"+t.theme),null==t.theme)throw Error("Invalid theme "+t.theme+". Did you register it?")}else t.theme=m.default;var n=(0,f.default)(!0,{},t.theme.DEFAULTS);[n,t].forEach(function(e){e.modules=e.modules||{},Object.keys(e.modules).forEach(function(t){!0===e.modules[t]&&(e.modules[t]={})})});var r=Object.keys(n.modules).concat(Object.keys(t.modules)).reduce(function(e,t){var n=b.import("modules/"+t);return null==n?v.error("Cannot load "+t+" module. Are you sure you registered it?"):e[t]=n.DEFAULTS||{},e},{});return null!=t.modules&&t.modules.toolbar&&t.modules.toolbar.constructor!==Object&&(t.modules.toolbar={container:t.modules.toolbar}),t=(0,f.default)(!0,{},b.DEFAULTS,{modules:r},n,t),["bounds","container","scrollingContainer"].forEach(function(e){"string"==typeof t[e]&&(t[e]=document.querySelector(t[e]))}),t.modules=Object.keys(t.modules).reduce(function(e,n){return t.modules[n]&&(e[n]=t.modules[n]),e},{}),t}function w(e,t,n,r){if(this.options.strict&&!this.isEnabled()&&t===l.default.sources.USER)return new o.default;var i=null==n?null:this.getSelection(),a=this.editor.delta,s=e();if(null!=i&&(!0===n&&(n=i.index),null==r?i=S(i,s,t):0!==r&&(i=S(i,n,r,t)),this.setSelection(i,l.default.sources.SILENT)),s.length()>0){var c,u,d=[l.default.events.TEXT_CHANGE,s,a,t];(c=this.emitter).emit.apply(c,[l.default.events.EDITOR_CHANGE].concat(d)),t!==l.default.sources.SILENT&&(u=this.emitter).emit.apply(u,d)}return s}function C(e,t,n,i,a){var o={};return"number"==typeof e.index&&"number"==typeof e.length?("number"!=typeof t&&(a=i,i=n,n=t),t=e.length,e=e.index):"number"!=typeof t&&(a=i,i=n,n=t,t=0),(void 0===n?"undefined":r(n))==="object"?(o=n,a=i):"string"==typeof n&&(null!=i?o[n]=i:a=n),[e,t,o,a=a||l.default.sources.API]}function S(e,t,n,r){if(null==e)return null;var a=void 0,s=void 0;if(t instanceof o.default){var c=i([e.index,e.index+e.length].map(function(e){return t.transformPosition(e,r!==l.default.sources.USER)}),2);a=c[0],s=c[1]}else{var u=i([e.index,e.index+e.length].map(function(e){return e<t||e===t&&r===l.default.sources.USER?e:n>=0?e+n:Math.max(t,e+n)}),2);a=u[0],s=u[1]}return new d.Range(a,s-a)}b.DEFAULTS={bounds:null,formats:null,modules:{},placeholder:"",readOnly:!1,scrollingContainer:null,strict:!0,theme:"default"},b.events=l.default.events,b.sources=l.default.sources,b.version="1.3.7",b.imports={delta:o.default,parchment:u.default,"core/module":c.default,"core/theme":m.default},t.expandConfig=x,t.overload=C,t.default=b},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=s(n(7)),o=s(n(0));function s(e){return e&&e.__esModule?e:{default:e}}var l=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"formatAt",value:function(e,n,r,a){if(0>t.compare(this.statics.blotName,r)&&o.default.query(r,o.default.Scope.BLOT)){var s=this.isolate(e,n);a&&s.wrap(r,a)}else i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,n,r,a)}},{key:"optimize",value:function(e){if(i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.parent instanceof t&&t.compare(this.statics.blotName,this.parent.statics.blotName)>0){var n=this.parent.isolate(this.offset(),this.length());this.moveChildren(n),n.wrap(this)}}}],[{key:"compare",value:function(e,n){var r=t.order.indexOf(e),i=t.order.indexOf(n);return r>=0||i>=0?r-i:e===n?0:e<n?-1:1}}]),t}(o.default.Inline);l.allowedChildren=[l,o.default.Embed,a.default],l.order=["cursor","inline","underline","strike","italic","bold","script","link","code"],t.default=l},function(e,t,n){var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(0))&&r.__esModule?r:{default:r}).default.Text)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=o(n(54));function o(e){return e&&e.__esModule?e:{default:e}}var s=(0,o(n(10)).default)("quill:events");["selectionchange","mousedown","mouseup","click"].forEach(function(e){document.addEventListener(e,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];[].slice.call(document.querySelectorAll(".ql-container")).forEach(function(e){if(e.__quill&&e.__quill.emitter){var n;(n=e.__quill.emitter).handleDOM.apply(n,t)}})})});var l=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return e.listeners={},e.on("error",s.error),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"emit",value:function(){s.log.apply(s,arguments),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).apply(this,arguments)}},{key:"handleDOM",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];(this.listeners[e.type]||[]).forEach(function(t){var r=t.node,i=t.handler;(e.target===r||r.contains(e.target))&&i.apply(void 0,[e].concat(n))})}},{key:"listenDOM",value:function(e,t,n){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push({node:t,handler:n})}}]),t}(a.default);l.events={EDITOR_CHANGE:"editor-change",SCROLL_BEFORE_UPDATE:"scroll-before-update",SCROLL_OPTIMIZE:"scroll-optimize",SCROLL_UPDATE:"scroll-update",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},l.sources={API:"api",SILENT:"silent",USER:"user"},t.default=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.quill=t,this.options=n};r.DEFAULTS={},t.default=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=["error","warn","log","info"],i="warn";function a(e){if(r.indexOf(e)<=r.indexOf(i)){for(var t,n=arguments.length,a=Array(n>1?n-1:0),o=1;o<n;o++)a[o-1]=arguments[o];(t=console)[e].apply(t,a)}}function o(e){return r.reduce(function(t,n){return t[n]=a.bind(console,n,e),t},{})}a.level=o.level=function(e){i=e},t.default=o},function(e,t,n){var r=Array.prototype.slice,i=n(52),a=n(53),o=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():e&&t&&("object"==typeof e||"object"==typeof t)?function(e,t,n){if(null==e||null==t||e.prototype!==t.prototype)return!1;if(a(e))return!!a(t)&&o(e=r.call(e),t=r.call(t),n);if(s(e)){if(!s(t)||e.length!==t.length)return!1;for(l=0;l<e.length;l++)if(e[l]!==t[l])return!1;return!0}try{var l,c,u=i(e),d=i(t)}catch(e){return!1}if(u.length!=d.length)return!1;for(u.sort(),d.sort(),l=u.length-1;l>=0;l--)if(u[l]!=d[l])return!1;for(l=u.length-1;l>=0;l--)if(!o(e[c=u[l]],t[c],n))return!1;return typeof e==typeof t}(e,t,n):n.strict?e===t:e==t)};function s(e){return!!e&&"object"==typeof e&&"number"==typeof e.length&&"function"==typeof e.copy&&"function"==typeof e.slice&&(!(e.length>0)||"number"==typeof e[0])}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(){function e(e,t,n){void 0===n&&(n={}),this.attrName=e,this.keyName=t;var i=r.Scope.TYPE&r.Scope.ATTRIBUTE;null!=n.scope?this.scope=n.scope&r.Scope.LEVEL|i:this.scope=r.Scope.ATTRIBUTE,null!=n.whitelist&&(this.whitelist=n.whitelist)}return e.keys=function(e){return[].map.call(e.attributes,function(e){return e.name})},e.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.setAttribute(this.keyName,t),!0)},e.prototype.canAdd=function(e,t){return null!=r.query(e,r.Scope.BLOT&(this.scope|r.Scope.TYPE))&&(null==this.whitelist||("string"==typeof t?this.whitelist.indexOf(t.replace(/["']/g,""))>-1:this.whitelist.indexOf(t)>-1))},e.prototype.remove=function(e){e.removeAttribute(this.keyName)},e.prototype.value=function(e){var t=e.getAttribute(this.keyName);return this.canAdd(e,t)&&t?t:""},e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Code=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=d(n(2)),s=d(n(0)),l=d(n(4)),c=d(n(6)),u=d(n(7));function d(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function p(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=function(e){function t(){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return p(t,e),t}(c.default);m.blotName="code",m.tagName="CODE";var g=function(e){function t(){return h(this,t),f(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return p(t,e),i(t,[{key:"delta",value:function(){var e=this,t=this.domNode.textContent;return t.endsWith("\n")&&(t=t.slice(0,-1)),t.split("\n").reduce(function(t,n){return t.insert(n).insert("\n",e.formats())},new o.default)}},{key:"format",value:function(e,n){if(e!==this.statics.blotName||!n){var i=r(this.descendant(u.default,this.length()-1),1)[0];null!=i&&i.deleteAt(i.length()-1,1),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n)}}},{key:"formatAt",value:function(e,n,r,i){if(0!==n&&null!=s.default.query(r,s.default.Scope.BLOCK)&&(r!==this.statics.blotName||i!==this.statics.formats(this.domNode))){var a=this.newlineIndex(e);if(!(a<0)&&!(a>=e+n)){var o=this.newlineIndex(e,!0)+1,l=a-o+1,c=this.isolate(o,l),u=c.next;c.format(r,i),u instanceof t&&u.formatAt(0,e-o+n-l,r,i)}}}},{key:"insertAt",value:function(e,t,n){if(null==n){var i=r(this.descendant(u.default,e),2),a=i[0],o=i[1];a.insertAt(o,t)}}},{key:"length",value:function(){var e=this.domNode.textContent.length;return this.domNode.textContent.endsWith("\n")?e:e+1}},{key:"newlineIndex",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t)return this.domNode.textContent.slice(0,e).lastIndexOf("\n");var n=this.domNode.textContent.slice(e).indexOf("\n");return n>-1?e+n:-1}},{key:"optimize",value:function(e){this.domNode.textContent.endsWith("\n")||this.appendChild(s.default.create("text","\n")),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&this.statics.formats(this.domNode)===n.statics.formats(n.domNode)&&(n.optimize(e),n.moveChildren(this),n.remove())}},{key:"replace",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e),[].slice.call(this.domNode.querySelectorAll("*")).forEach(function(e){var t=s.default.find(e);null==t?e.parentNode.removeChild(e):t instanceof s.default.Embed?t.remove():t.unwrap()})}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return n.setAttribute("spellcheck",!1),n}},{key:"formats",value:function(){return!0}}]),t}(l.default);g.blotName="code-block",g.tagName="PRE",g.TAB=" ",t.Code=m,t.default=g},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=y(n(2)),s=y(n(20)),l=y(n(0)),c=y(n(13)),u=y(n(24)),d=n(4),h=y(d),f=y(n(16)),p=y(n(21)),m=y(n(11)),g=y(n(3));function y(e){return e&&e.__esModule?e:{default:e}}var v=/^[ -~]*$/;t.default=function(){function e(t){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.scroll=t,this.delta=this.getDelta()}return a(e,[{key:"applyDelta",value:function(e){var t=this,n=!1;this.scroll.update();var a=this.scroll.length();return this.scroll.batchStart(),(e=e.reduce(function(e,t){if(1===t.insert){var n=(0,p.default)(t.attributes);return delete n.image,e.insert({image:t.attributes.image},n)}if(null!=t.attributes&&(!0===t.attributes.list||!0===t.attributes.bullet)&&((t=(0,p.default)(t)).attributes.list?t.attributes.list="ordered":(t.attributes.list="bullet",delete t.attributes.bullet)),"string"==typeof t.insert){var r=t.insert.replace(/\r\n/g,"\n").replace(/\r/g,"\n");return e.insert(r,t.attributes)}return e.push(t)},new o.default)).reduce(function(e,o){var c=o.retain||o.delete||o.insert.length||1,u=o.attributes||{};if(null!=o.insert){if("string"==typeof o.insert){var f=o.insert;f.endsWith("\n")&&n&&(n=!1,f=f.slice(0,-1)),e>=a&&!f.endsWith("\n")&&(n=!0),t.scroll.insertAt(e,f);var p=i(t.scroll.line(e),2),m=p[0],y=p[1],v=(0,g.default)({},(0,d.bubbleFormats)(m));if(m instanceof h.default){var b=i(m.descendant(l.default.Leaf,y),1)[0];v=(0,g.default)(v,(0,d.bubbleFormats)(b))}u=s.default.attributes.diff(v,u)||{}}else if("object"===r(o.insert)){var x=Object.keys(o.insert)[0];if(null==x)return e;t.scroll.insertAt(e,x,o.insert[x])}a+=c}return Object.keys(u).forEach(function(n){t.scroll.formatAt(e,c,n,u[n])}),e+c},0),e.reduce(function(e,n){return"number"==typeof n.delete?(t.scroll.deleteAt(e,n.delete),e):e+(n.retain||n.insert.length||1)},0),this.scroll.batchEnd(),this.update(e)}},{key:"deleteText",value:function(e,t){return this.scroll.deleteAt(e,t),this.update(new o.default().retain(e).delete(t))}},{key:"formatLine",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return this.scroll.update(),Object.keys(r).forEach(function(i){if(null==n.scroll.whitelist||n.scroll.whitelist[i]){var a=n.scroll.lines(e,Math.max(t,1)),o=t;a.forEach(function(t){var a=t.length();if(t instanceof c.default){var s=e-t.offset(n.scroll),l=t.newlineIndex(s+o)-s+1;t.formatAt(s,l,i,r[i])}else t.format(i,r[i]);o-=a})}}),this.scroll.optimize(),this.update(new o.default().retain(e).retain(t,(0,p.default)(r)))}},{key:"formatText",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return Object.keys(r).forEach(function(i){n.scroll.formatAt(e,t,i,r[i])}),this.update(new o.default().retain(e).retain(t,(0,p.default)(r)))}},{key:"getContents",value:function(e,t){return this.delta.slice(e,e+t)}},{key:"getDelta",value:function(){return this.scroll.lines().reduce(function(e,t){return e.concat(t.delta())},new o.default)}},{key:"getFormat",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=[],r=[];0===t?this.scroll.path(e).forEach(function(e){var t=i(e,1)[0];t instanceof h.default?n.push(t):t instanceof l.default.Leaf&&r.push(t)}):(n=this.scroll.lines(e,t),r=this.scroll.descendants(l.default.Leaf,e,t));var a=[n,r].map(function(e){if(0===e.length)return{};for(var t=(0,d.bubbleFormats)(e.shift());Object.keys(t).length>0;){var n=e.shift();if(null==n)break;t=function(e,t){return Object.keys(t).reduce(function(n,r){return null==e[r]||(t[r]===e[r]?n[r]=t[r]:Array.isArray(t[r])?0>t[r].indexOf(e[r])&&(n[r]=t[r].concat([e[r]])):n[r]=[t[r],e[r]]),n},{})}((0,d.bubbleFormats)(n),t)}return t});return g.default.apply(g.default,a)}},{key:"getText",value:function(e,t){return this.getContents(e,t).filter(function(e){return"string"==typeof e.insert}).map(function(e){return e.insert}).join("")}},{key:"insertEmbed",value:function(e,t,n){var r;return this.scroll.insertAt(e,t,n),this.update(new o.default().retain(e).insert((t in(r={})?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r)))}},{key:"insertText",value:function(e,t){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=t.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),this.scroll.insertAt(e,t),Object.keys(r).forEach(function(i){n.scroll.formatAt(e,t.length,i,r[i])}),this.update(new o.default().retain(e).insert(t,(0,p.default)(r)))}},{key:"isBlank",value:function(){if(0==this.scroll.children.length)return!0;if(this.scroll.children.length>1)return!1;var e=this.scroll.children.head;return e.statics.blotName===h.default.blotName&&!(e.children.length>1)&&e.children.head instanceof f.default}},{key:"removeFormat",value:function(e,t){var n=this.getText(e,t),r=i(this.scroll.line(e+t),2),a=r[0],s=r[1],l=0,u=new o.default;null!=a&&(l=a instanceof c.default?a.newlineIndex(s)-s+1:a.length()-s,u=a.delta().slice(s,s+l-1).insert("\n"));var d=this.getContents(e,t+l).diff(new o.default().insert(n).concat(u)),h=new o.default().retain(e).concat(d);return this.applyDelta(h)}},{key:"update",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=this.delta;if(1===t.length&&"characterData"===t[0].type&&t[0].target.data.match(v)&&l.default.find(t[0].target)){var i=l.default.find(t[0].target),a=(0,d.bubbleFormats)(i),s=i.offset(this.scroll),c=t[0].oldValue.replace(u.default.CONTENTS,""),h=new o.default().insert(c),f=new o.default().insert(i.value());e=new o.default().retain(s).concat(h.diff(f,n)).reduce(function(e,t){return t.insert?e.insert(t.insert,a):e.push(t)},new o.default),this.delta=r.compose(e)}else this.delta=this.getDelta(),e&&(0,m.default)(r.compose(e),this.delta)||(e=r.diff(this.delta,n));return e}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Range=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=c(n(0)),o=c(n(21)),s=c(n(11)),l=c(n(8));function c(e){return e&&e.__esModule?e:{default:e}}function u(e){if(!Array.isArray(e))return Array.from(e);for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}function d(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}var h=(0,c(n(10)).default)("quill:selection"),f=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;d(this,e),this.index=t,this.length=n},p=function(){function e(t,n){var r=this;d(this,e),this.emitter=n,this.scroll=t,this.composing=!1,this.mouseDown=!1,this.root=this.scroll.domNode,this.cursor=a.default.create("cursor",this),this.lastRange=this.savedRange=new f(0,0),this.handleComposition(),this.handleDragging(),this.emitter.listenDOM("selectionchange",document,function(){r.mouseDown||setTimeout(r.update.bind(r,l.default.sources.USER),1)}),this.emitter.on(l.default.events.EDITOR_CHANGE,function(e,t){e===l.default.events.TEXT_CHANGE&&t.length()>0&&r.update(l.default.sources.SILENT)}),this.emitter.on(l.default.events.SCROLL_BEFORE_UPDATE,function(){if(r.hasFocus()){var e=r.getNativeRange();null==e||e.start.node!==r.cursor.textNode&&r.emitter.once(l.default.events.SCROLL_UPDATE,function(){try{r.setNativeRange(e.start.node,e.start.offset,e.end.node,e.end.offset)}catch(e){}})}}),this.emitter.on(l.default.events.SCROLL_OPTIMIZE,function(e,t){if(t.range){var n=t.range,i=n.startNode,a=n.startOffset,o=n.endNode,s=n.endOffset;r.setNativeRange(i,a,o,s)}}),this.update(l.default.sources.SILENT)}return i(e,[{key:"handleComposition",value:function(){var e=this;this.root.addEventListener("compositionstart",function(){e.composing=!0}),this.root.addEventListener("compositionend",function(){if(e.composing=!1,e.cursor.parent){var t=e.cursor.restore();t&&setTimeout(function(){e.setNativeRange(t.startNode,t.startOffset,t.endNode,t.endOffset)},1)}})}},{key:"handleDragging",value:function(){var e=this;this.emitter.listenDOM("mousedown",document.body,function(){e.mouseDown=!0}),this.emitter.listenDOM("mouseup",document.body,function(){e.mouseDown=!1,e.update(l.default.sources.USER)})}},{key:"focus",value:function(){this.hasFocus()||(this.root.focus(),this.setRange(this.savedRange))}},{key:"format",value:function(e,t){if(null==this.scroll.whitelist||this.scroll.whitelist[e]){this.scroll.update();var n=this.getNativeRange();if(!(null==n||!n.native.collapsed||a.default.query(e,a.default.Scope.BLOCK))){if(n.start.node!==this.cursor.textNode){var r=a.default.find(n.start.node,!1);if(null==r)return;if(r instanceof a.default.Leaf){var i=r.split(n.start.offset);r.parent.insertBefore(this.cursor,i)}else r.insertBefore(this.cursor,n.start.node);this.cursor.attach()}this.cursor.format(e,t),this.scroll.optimize(),this.setNativeRange(this.cursor.textNode,this.cursor.textNode.data.length),this.update()}}}},{key:"getBounds",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.scroll.length();t=Math.min((e=Math.min(e,n-1))+t,n-1)-e;var i=void 0,a=r(this.scroll.leaf(e),2),o=a[0],s=a[1];if(null==o)return null;var l=r(o.position(s,!0),2);i=l[0],s=l[1];var c=document.createRange();if(t>0){c.setStart(i,s);var u=r(this.scroll.leaf(e+t),2);if(o=u[0],s=u[1],null==o)return null;var d=r(o.position(s,!0),2);return i=d[0],s=d[1],c.setEnd(i,s),c.getBoundingClientRect()}var h="left",f=void 0;return i instanceof Text?(s<i.data.length?(c.setStart(i,s),c.setEnd(i,s+1)):(c.setStart(i,s-1),c.setEnd(i,s),h="right"),f=c.getBoundingClientRect()):(f=o.domNode.getBoundingClientRect(),s>0&&(h="right")),{bottom:f.top+f.height,height:f.height,left:f[h],right:f[h],top:f.top,width:0}}},{key:"getNativeRange",value:function(){var e=document.getSelection();if(null==e||e.rangeCount<=0)return null;var t=e.getRangeAt(0);if(null==t)return null;var n=this.normalizeNative(t);return h.info("getNativeRange",n),n}},{key:"getRange",value:function(){var e=this.getNativeRange();return null==e?[null,null]:[this.normalizedToRange(e),e]}},{key:"hasFocus",value:function(){return document.activeElement===this.root}},{key:"normalizedToRange",value:function(e){var t=this,n=[[e.start.node,e.start.offset]];e.native.collapsed||n.push([e.end.node,e.end.offset]);var i=n.map(function(e){var n=r(e,2),i=n[0],o=n[1],s=a.default.find(i,!0),l=s.offset(t.scroll);return 0===o?l:s instanceof a.default.Container?l+s.length():l+s.index(i,o)}),o=Math.min(Math.max.apply(Math,u(i)),this.scroll.length()-1),s=Math.min.apply(Math,[o].concat(u(i)));return new f(s,o-s)}},{key:"normalizeNative",value:function(e){if(!m(this.root,e.startContainer)||!e.collapsed&&!m(this.root,e.endContainer))return null;var t={start:{node:e.startContainer,offset:e.startOffset},end:{node:e.endContainer,offset:e.endOffset},native:e};return[t.start,t.end].forEach(function(e){for(var t=e.node,n=e.offset;!(t instanceof Text)&&t.childNodes.length>0;)if(t.childNodes.length>n)t=t.childNodes[n],n=0;else if(t.childNodes.length===n)n=(t=t.lastChild)instanceof Text?t.data.length:t.childNodes.length+1;else break;e.node=t,e.offset=n}),t}},{key:"rangeToNative",value:function(e){var t=this,n=e.collapsed?[e.index]:[e.index,e.index+e.length],i=[],a=this.scroll.length();return n.forEach(function(e,n){e=Math.min(a-1,e);var o=void 0,s=r(t.scroll.leaf(e),2),l=s[0],c=s[1],u=r(l.position(c,0!==n),2);o=u[0],c=u[1],i.push(o,c)}),i.length<2&&(i=i.concat(i)),i}},{key:"scrollIntoView",value:function(e){var t=this.lastRange;if(null!=t){var n=this.getBounds(t.index,t.length);if(null!=n){var i=this.scroll.length()-1,a=r(this.scroll.line(Math.min(t.index,i)),1)[0],o=a;if(t.length>0&&(o=r(this.scroll.line(Math.min(t.index+t.length,i)),1)[0]),null!=a&&null!=o){var s=e.getBoundingClientRect();n.top<s.top?e.scrollTop-=s.top-n.top:n.bottom>s.bottom&&(e.scrollTop+=n.bottom-s.bottom)}}}}},{key:"setNativeRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t,i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(h.info("setNativeRange",e,t,n,r),null==e||null!=this.root.parentNode&&null!=e.parentNode&&null!=n.parentNode){var a=document.getSelection();if(null!=a)if(null!=e){this.hasFocus()||this.root.focus();var o=(this.getNativeRange()||{}).native;if(null==o||i||e!==o.startContainer||t!==o.startOffset||n!==o.endContainer||r!==o.endOffset){"BR"==e.tagName&&(t=[].indexOf.call(e.parentNode.childNodes,e),e=e.parentNode),"BR"==n.tagName&&(r=[].indexOf.call(n.parentNode.childNodes,n),n=n.parentNode);var s=document.createRange();s.setStart(e,t),s.setEnd(n,r),a.removeAllRanges(),a.addRange(s)}}else a.removeAllRanges(),this.root.blur(),document.body.focus()}}},{key:"setRange",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.sources.API;if("string"==typeof t&&(n=t,t=!1),h.info("setRange",e),null!=e){var r=this.rangeToNative(e);this.setNativeRange.apply(this,u(r).concat([t]))}else this.setNativeRange(null);this.update(n)}},{key:"update",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l.default.sources.USER,t=this.lastRange,n=r(this.getRange(),2),i=n[0],a=n[1];if(this.lastRange=i,null!=this.lastRange&&(this.savedRange=this.lastRange),!(0,s.default)(t,this.lastRange)){!this.composing&&null!=a&&a.native.collapsed&&a.start.node!==this.cursor.textNode&&this.cursor.restore();var c,u,d=[l.default.events.SELECTION_CHANGE,(0,o.default)(this.lastRange),(0,o.default)(t),e];(c=this.emitter).emit.apply(c,[l.default.events.EDITOR_CHANGE].concat(d)),e!==l.default.sources.SILENT&&(u=this.emitter).emit.apply(u,d)}}}]),e}();function m(e,t){try{t.parentNode}catch(e){return!1}return t instanceof Text&&(t=t.parentNode),e.contains(t)}t.Range=f,t.default=p},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"insertInto",value:function(e,n){0===e.children.length?a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertInto",this).call(this,e,n):this.remove()}},{key:"length",value:function(){return 0}},{key:"value",value:function(){return""}}],[{key:"value",value:function(){}}]),t}(((r=n(0))&&r.__esModule?r:{default:r}).default.Embed);o.blotName="break",o.tagName="BR",t.default=o},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(44),o=n(30),s=n(1);function l(e){var t=s.find(e);if(null==t)try{t=s.create(e)}catch(n){t=s.create(s.Scope.INLINE),[].slice.call(e.childNodes).forEach(function(e){t.domNode.appendChild(e)}),e.parentNode&&e.parentNode.replaceChild(t.domNode,e),t.attach()}return t}t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.build(),n}return i(t,e),t.prototype.appendChild=function(e){this.insertBefore(e)},t.prototype.attach=function(){e.prototype.attach.call(this),this.children.forEach(function(e){e.attach()})},t.prototype.build=function(){var e=this;this.children=new a.default,[].slice.call(this.domNode.childNodes).reverse().forEach(function(t){try{var n=l(t);e.insertBefore(n,e.children.head||void 0)}catch(e){if(e instanceof s.ParchmentError)return;throw e}})},t.prototype.deleteAt=function(e,t){if(0===e&&t===this.length())return this.remove();this.children.forEachAt(e,t,function(e,t,n){e.deleteAt(t,n)})},t.prototype.descendant=function(e,n){var r=this.children.find(n),i=r[0],a=r[1];return null==e.blotName&&e(i)||null!=e.blotName&&i instanceof e?[i,a]:i instanceof t?i.descendant(e,a):[null,-1]},t.prototype.descendants=function(e,n,r){void 0===n&&(n=0),void 0===r&&(r=Number.MAX_VALUE);var i=[],a=r;return this.children.forEachAt(n,r,function(n,r,o){(null==e.blotName&&e(n)||null!=e.blotName&&n instanceof e)&&i.push(n),n instanceof t&&(i=i.concat(n.descendants(e,r,a))),a-=o}),i},t.prototype.detach=function(){this.children.forEach(function(e){e.detach()}),e.prototype.detach.call(this)},t.prototype.formatAt=function(e,t,n,r){this.children.forEachAt(e,t,function(e,t,i){e.formatAt(t,i,n,r)})},t.prototype.insertAt=function(e,t,n){var r=this.children.find(e),i=r[0],a=r[1];if(i)i.insertAt(a,t,n);else{var o=null==n?s.create("text",t):s.create(t,n);this.appendChild(o)}},t.prototype.insertBefore=function(e,t){if(null!=this.statics.allowedChildren&&!this.statics.allowedChildren.some(function(t){return e instanceof t}))throw new s.ParchmentError("Cannot insert "+e.statics.blotName+" into "+this.statics.blotName);e.insertInto(this,t)},t.prototype.length=function(){return this.children.reduce(function(e,t){return e+t.length()},0)},t.prototype.moveChildren=function(e,t){this.children.forEach(function(n){e.insertBefore(n,t)})},t.prototype.optimize=function(t){if(e.prototype.optimize.call(this,t),0===this.children.length)if(null!=this.statics.defaultChild){var n=s.create(this.statics.defaultChild);this.appendChild(n),n.optimize(t)}else this.remove()},t.prototype.path=function(e,n){void 0===n&&(n=!1);var r=this.children.find(e,n),i=r[0],a=r[1],o=[[this,e]];return i instanceof t?o.concat(i.path(a,n)):(null!=i&&o.push([i,a]),o)},t.prototype.removeChild=function(e){this.children.remove(e)},t.prototype.replace=function(n){n instanceof t&&n.moveChildren(this),e.prototype.replace.call(this,n)},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var n=this.clone();return this.parent.insertBefore(n,this.next),this.children.forEachAt(e,this.length(),function(e,r,i){e=e.split(r,t),n.appendChild(e)}),n},t.prototype.unwrap=function(){this.moveChildren(this.parent,this.next),this.remove()},t.prototype.update=function(e,t){var n=this,r=[],i=[];e.forEach(function(e){e.target===n.domNode&&"childList"===e.type&&(r.push.apply(r,e.addedNodes),i.push.apply(i,e.removedNodes))}),i.forEach(function(e){if(!(null!=e.parentNode&&"IFRAME"!==e.tagName&&document.body.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)){var t=s.find(e);null!=t&&(null==t.domNode.parentNode||t.domNode.parentNode===n.domNode)&&t.detach()}}),r.filter(function(e){return e.parentNode==n.domNode}).sort(function(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1}).forEach(function(e){var t=null;null!=e.nextSibling&&(t=s.find(e.nextSibling));var r=l(e);(r.next!=t||null==r.next)&&(null!=r.parent&&r.parent.removeChild(n),n.insertBefore(r,t||void 0))})},t}(o.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(12),o=n(31),s=n(17),l=n(1);t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.attributes=new o.default(n.domNode),n}return i(t,e),t.formats=function(e){return"string"==typeof this.tagName||(Array.isArray(this.tagName)?e.tagName.toLowerCase():void 0)},t.prototype.format=function(e,t){var n=l.query(e);n instanceof a.default?this.attributes.attribute(n,t):t&&null!=n&&(e!==this.statics.blotName||this.formats()[e]!==t)&&this.replaceWith(e,t)},t.prototype.formats=function(){var e=this.attributes.values(),t=this.statics.formats(this.domNode);return null!=t&&(e[this.statics.blotName]=t),e},t.prototype.replaceWith=function(t,n){var r=e.prototype.replaceWith.call(this,t,n);return this.attributes.copy(r),r},t.prototype.update=function(t,n){var r=this;e.prototype.update.call(this,t,n),t.some(function(e){return e.target===r.domNode&&"attributes"===e.type})&&this.attributes.build()},t.prototype.wrap=function(n,r){var i=e.prototype.wrap.call(this,n,r);return i instanceof t&&i.statics.scope===this.statics.scope&&this.attributes.move(i),i},t}(s.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(30),o=n(1);t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.value=function(e){return!0},t.prototype.index=function(e,t){return this.domNode===e||this.domNode.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY?Math.min(t,1):-1},t.prototype.position=function(e,t){var n=[].indexOf.call(this.parent.domNode.childNodes,this.domNode);return e>0&&(n+=1),[this.parent.domNode,n]},t.prototype.value=function(){var e;return(e={})[this.statics.blotName]=this.statics.value(this.domNode)||!0,e},t.scope=o.Scope.INLINE_BLOT,t}(a.default)},function(e,t,n){var r=n(11),i=n(3),a={attributes:{compose:function(e,t,n){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var r=i(!0,{},t);for(var a in n||(r=Object.keys(r).reduce(function(e,t){return null!=r[t]&&(e[t]=r[t]),e},{})),e)void 0!==e[a]&&void 0===t[a]&&(r[a]=e[a]);return Object.keys(r).length>0?r:void 0},diff:function(e,t){"object"!=typeof e&&(e={}),"object"!=typeof t&&(t={});var n=Object.keys(e).concat(Object.keys(t)).reduce(function(n,i){return r(e[i],t[i])||(n[i]=void 0===t[i]?null:t[i]),n},{});return Object.keys(n).length>0?n:void 0},transform:function(e,t,n){if("object"!=typeof e)return t;if("object"==typeof t){if(!n)return t;var r=Object.keys(t).reduce(function(n,r){return void 0===e[r]&&(n[r]=t[r]),n},{});return Object.keys(r).length>0?r:void 0}}},iterator:function(e){return new o(e)},length:function(e){return"number"==typeof e.delete?e.delete:"number"==typeof e.retain?e.retain:"string"==typeof e.insert?e.insert.length:1}};function o(e){this.ops=e,this.index=0,this.offset=0}o.prototype.hasNext=function(){return this.peekLength()<1/0},o.prototype.next=function(e){e||(e=1/0);var t=this.ops[this.index];if(!t)return{retain:1/0};var n=this.offset,r=a.length(t);if(e>=r-n?(e=r-n,this.index+=1,this.offset=0):this.offset+=e,"number"==typeof t.delete)return{delete:e};var i={};return t.attributes&&(i.attributes=t.attributes),"number"==typeof t.retain?i.retain=e:"string"==typeof t.insert?i.insert=t.insert.substr(n,e):i.insert=t.insert,i},o.prototype.peek=function(){return this.ops[this.index]},o.prototype.peekLength=function(){return this.ops[this.index]?a.length(this.ops[this.index])-this.offset:1/0},o.prototype.peekType=function(){if(this.ops[this.index]){if("number"==typeof this.ops[this.index].delete)return"delete";else if("number"!=typeof this.ops[this.index].retain)return"insert"}return"retain"},o.prototype.rest=function(){if(!this.hasNext())return[];if(0===this.offset)return this.ops.slice(this.index);var e=this.offset,t=this.index,n=this.next(),r=this.ops.slice(this.index);return this.offset=e,this.index=t,[n].concat(r)},e.exports=a},function(e,t){var n=function(){var e,t,n;function r(e,t){return null!=t&&e instanceof t}try{e=Map}catch(t){e=function(){}}try{t=Set}catch(e){t=function(){}}try{n=Promise}catch(e){n=function(){}}function i(a,s,l,c,u){"object"==typeof s&&(l=s.depth,c=s.prototype,u=s.includeNonEnumerable,s=s.circular);var d=[],h=[];return void 0===s&&(s=!0),void 0===l&&(l=1/0),function a(l,f){if(null===l)return null;if(0===f||"object"!=typeof l)return l;if(r(l,e))p=new e;else if(r(l,t))p=new t;else if(r(l,n))p=new n(function(e,t){l.then(function(t){e(a(t,f-1))},function(e){t(a(e,f-1))})});else if(i.__isArray(l))p=[];else if(i.__isRegExp(l))p=new RegExp(l.source,o(l)),l.lastIndex&&(p.lastIndex=l.lastIndex);else if(i.__isDate(l))p=new Date(l.getTime());else{if(aD.isBuffer(l))return p=aD.allocUnsafe?aD.allocUnsafe(l.length):new aD(l.length),l.copy(p),p;r(l,Error)?p=Object.create(l):void 0===c?p=Object.create(m=Object.getPrototypeOf(l)):(p=Object.create(c),m=c)}if(s){var p,m,g,y=d.indexOf(l);if(-1!=y)return h[y];d.push(l),h.push(p)}for(var v in r(l,e)&&l.forEach(function(e,t){var n=a(t,f-1),r=a(e,f-1);p.set(n,r)}),r(l,t)&&l.forEach(function(e){var t=a(e,f-1);p.add(t)}),l)m&&(g=Object.getOwnPropertyDescriptor(m,v)),g&&null==g.set||(p[v]=a(l[v],f-1));if(Object.getOwnPropertySymbols)for(var b=Object.getOwnPropertySymbols(l),v=0;v<b.length;v++){var x=b[v],w=Object.getOwnPropertyDescriptor(l,x);(!w||w.enumerable||u)&&(p[x]=a(l[x],f-1),w.enumerable||Object.defineProperty(p,x,{enumerable:!1}))}if(u)for(var C=Object.getOwnPropertyNames(l),v=0;v<C.length;v++){var S=C[v],w=Object.getOwnPropertyDescriptor(l,S);w&&w.enumerable||(p[S]=a(l[S],f-1),Object.defineProperty(p,S,{enumerable:!1}))}return p}(a,l)}function a(e){return Object.prototype.toString.call(e)}function o(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return i.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},i.__objToStr=a,i.__isDate=function(e){return"object"==typeof e&&"[object Date]"===a(e)},i.__isArray=function(e){return"object"==typeof e&&"[object Array]"===a(e)},i.__isRegExp=function(e){return"object"==typeof e&&"[object RegExp]"===a(e)},i.__getRegExpFlags=o,i}();"object"==typeof e&&e.exports&&(e.exports=n)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=f(n(0)),s=f(n(8)),l=n(4),c=f(l),u=f(n(16)),d=f(n(13)),h=f(n(25));function f(e){return e&&e.__esModule?e:{default:e}}function p(e){return e instanceof c.default||e instanceof l.BlockEmbed}var m=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.emitter=n.emitter,Array.isArray(n.whitelist)&&(r.whitelist=n.whitelist.reduce(function(e,t){return e[t]=!0,e},{})),r.domNode.addEventListener("DOMNodeInserted",function(){}),r.optimize(),r.enable(),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"batchStart",value:function(){this.batch=!0}},{key:"batchEnd",value:function(){this.batch=!1,this.optimize()}},{key:"deleteAt",value:function(e,n){var i=r(this.line(e),2),o=i[0],s=i[1],c=r(this.line(e+n),1)[0];if(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"deleteAt",this).call(this,e,n),null!=c&&o!==c&&s>0){if(o instanceof l.BlockEmbed||c instanceof l.BlockEmbed)return void this.optimize();if(o instanceof d.default){var h=o.newlineIndex(o.length(),!0);if(h>-1&&(o=o.split(h+1))===c)return void this.optimize()}else if(c instanceof d.default){var f=c.newlineIndex(0);f>-1&&c.split(f+1)}var p=c.children.head instanceof u.default?null:c.children.head;o.moveChildren(c,p),o.remove()}this.optimize()}},{key:"enable",value:function(){var e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.domNode.setAttribute("contenteditable",e)}},{key:"formatAt",value:function(e,n,r,i){(null==this.whitelist||this.whitelist[r])&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"formatAt",this).call(this,e,n,r,i),this.optimize())}},{key:"insertAt",value:function(e,n,r){if(null==r||null==this.whitelist||this.whitelist[n]){if(e>=this.length())if(null==r||null==o.default.query(n,o.default.Scope.BLOCK)){var i=o.default.create(this.statics.defaultChild);this.appendChild(i),null==r&&n.endsWith("\n")&&(n=n.slice(0,-1)),i.insertAt(0,n,r)}else{var s=o.default.create(n,r);this.appendChild(s)}else a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertAt",this).call(this,e,n,r);this.optimize()}}},{key:"insertBefore",value:function(e,n){if(e.statics.scope===o.default.Scope.INLINE_BLOT){var r=o.default.create(this.statics.defaultChild);r.appendChild(e),e=r}a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,n)}},{key:"leaf",value:function(e){return this.path(e).pop()||[null,-1]}},{key:"line",value:function(e){return e===this.length()?this.line(e-1):this.descendant(p,e)}},{key:"lines",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Number.MAX_VALUE;return function e(t,n,r){var i=[],a=r;return t.children.forEachAt(n,r,function(t,n,r){p(t)?i.push(t):t instanceof o.default.Container&&(i=i.concat(e(t,n,a))),a-=r}),i}(this,e,t)}},{key:"optimize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!0!==this.batch&&(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e,n),e.length>0&&this.emitter.emit(s.default.events.SCROLL_OPTIMIZE,e,n))}},{key:"path",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"path",this).call(this,e).slice(1)}},{key:"update",value:function(e){if(!0!==this.batch){var n=s.default.sources.USER;"string"==typeof e&&(n=e),Array.isArray(e)||(e=this.observer.takeRecords()),e.length>0&&this.emitter.emit(s.default.events.SCROLL_BEFORE_UPDATE,n,e),a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"update",this).call(this,e.concat([])),e.length>0&&this.emitter.emit(s.default.events.SCROLL_UPDATE,n,e)}}}]),t}(o.default.Scroll);m.blotName="scroll",m.className="ql-editor",m.tagName="DIV",m.defaultChild="block",m.allowedChildren=[c.default,l.BlockEmbed,h.default],t.default=m},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.SHORTKEY=t.default=void 0;var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=m(n(21)),s=m(n(11)),l=m(n(3)),c=m(n(2)),u=m(n(20)),d=m(n(0)),h=m(n(5)),f=m(n(10)),p=m(n(9));function m(e){return e&&e.__esModule?e:{default:e}}function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var y=(0,f.default)("quill:keyboard"),v=/Mac/i.test(navigator.platform)?"metaKey":"ctrlKey",b=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.bindings={},Object.keys(r.options.bindings).forEach(function(t){("list autofill"!==t||null==e.scroll.whitelist||e.scroll.whitelist.list)&&r.options.bindings[t]&&r.addBinding(r.options.bindings[t])}),r.addBinding({key:t.keys.ENTER,shiftKey:null},k),r.addBinding({key:t.keys.ENTER,metaKey:null,ctrlKey:null,altKey:null},function(){}),/Firefox/i.test(navigator.userAgent)?(r.addBinding({key:t.keys.BACKSPACE},{collapsed:!0},w),r.addBinding({key:t.keys.DELETE},{collapsed:!0},C)):(r.addBinding({key:t.keys.BACKSPACE},{collapsed:!0,prefix:/^.?$/},w),r.addBinding({key:t.keys.DELETE},{collapsed:!0,suffix:/^.?$/},C)),r.addBinding({key:t.keys.BACKSPACE},{collapsed:!1},S),r.addBinding({key:t.keys.DELETE},{collapsed:!1},S),r.addBinding({key:t.keys.BACKSPACE,altKey:null,ctrlKey:null,metaKey:null,shiftKey:null},{collapsed:!0,offset:0},w),r.listen(),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),a(t,null,[{key:"match",value:function(e,t){return t=T(t),!["altKey","ctrlKey","metaKey","shiftKey"].some(function(n){return!!t[n]!==e[n]&&null!==t[n]})&&t.key===(e.which||e.keyCode)}}]),a(t,[{key:"addBinding",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=T(e);if(null==r||null==r.key)return y.warn("Attempted to add invalid keyboard binding",r);"function"==typeof t&&(t={handler:t}),"function"==typeof n&&(n={handler:n}),r=(0,l.default)(r,t,n),this.bindings[r.key]=this.bindings[r.key]||[],this.bindings[r.key].push(r)}},{key:"listen",value:function(){var e=this;this.quill.root.addEventListener("keydown",function(n){if(!n.defaultPrevented){var a=n.which||n.keyCode,o=(e.bindings[a]||[]).filter(function(e){return t.match(n,e)});if(0!==o.length){var l=e.quill.getSelection();if(null!=l&&e.quill.hasFocus()){var c=i(e.quill.getLine(l.index),2),u=c[0],h=c[1],f=i(e.quill.getLeaf(l.index),2),p=f[0],m=f[1],g=i(0===l.length?[p,m]:e.quill.getLeaf(l.index+l.length),2),y=g[0],v=g[1],b=p instanceof d.default.Text?p.value().slice(0,m):"",x=y instanceof d.default.Text?y.value().slice(v):"",w={collapsed:0===l.length,empty:0===l.length&&1>=u.length(),format:e.quill.getFormat(l),offset:h,prefix:b,suffix:x};o.some(function(t){if(null!=t.collapsed&&t.collapsed!==w.collapsed||null!=t.empty&&t.empty!==w.empty||null!=t.offset&&t.offset!==w.offset)return!1;if(Array.isArray(t.format)){if(t.format.every(function(e){return null==w.format[e]}))return!1}else if("object"===r(t.format)&&!Object.keys(t.format).every(function(e){return!0===t.format[e]?null!=w.format[e]:!1===t.format[e]?null==w.format[e]:(0,s.default)(t.format[e],w.format[e])}))return!1;return(null==t.prefix||!!t.prefix.test(w.prefix))&&(null==t.suffix||!!t.suffix.test(w.suffix))&&!0!==t.handler.call(e,l,w)})&&n.preventDefault()}}}})}}]),t}(p.default);function x(e,t){var n,r=e===b.keys.LEFT?"prefix":"suffix";return g(n={key:e,shiftKey:t,altKey:null},r,/^$/),g(n,"handler",function(n){var r=n.index;return e===b.keys.RIGHT&&(r+=n.length+1),!(i(this.quill.getLeaf(r),1)[0]instanceof d.default.Embed)||(e===b.keys.LEFT?t?this.quill.setSelection(n.index-1,n.length+1,h.default.sources.USER):this.quill.setSelection(n.index-1,h.default.sources.USER):t?this.quill.setSelection(n.index,n.length+1,h.default.sources.USER):this.quill.setSelection(n.index+n.length+1,h.default.sources.USER),!1)}),n}function w(e,t){if(!(0===e.index||1>=this.quill.getLength())){var n=i(this.quill.getLine(e.index),1)[0],r={};if(0===t.offset){var a=i(this.quill.getLine(e.index-1),1)[0];if(null!=a&&a.length()>1){var o=n.formats(),s=this.quill.getFormat(e.index-1,1);r=u.default.attributes.diff(o,s)||{}}}var l=/[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(t.prefix)?2:1;this.quill.deleteText(e.index-l,l,h.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index-l,l,r,h.default.sources.USER),this.quill.focus()}}function C(e,t){var n=/^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(t.suffix)?2:1;if(!(e.index>=this.quill.getLength()-n)){var r={},a=0,o=i(this.quill.getLine(e.index),1)[0];if(t.offset>=o.length()-1){var s=i(this.quill.getLine(e.index+1),1)[0];if(s){var l=o.formats(),c=this.quill.getFormat(e.index,1);r=u.default.attributes.diff(l,c)||{},a=s.length()}}this.quill.deleteText(e.index,n,h.default.sources.USER),Object.keys(r).length>0&&this.quill.formatLine(e.index+a-1,n,r,h.default.sources.USER)}}function S(e){var t=this.quill.getLines(e),n={};if(t.length>1){var r=t[0].formats(),i=t[t.length-1].formats();n=u.default.attributes.diff(i,r)||{}}this.quill.deleteText(e,h.default.sources.USER),Object.keys(n).length>0&&this.quill.formatLine(e.index,1,n,h.default.sources.USER),this.quill.setSelection(e.index,h.default.sources.SILENT),this.quill.focus()}function k(e,t){var n=this;e.length>0&&this.quill.scroll.deleteAt(e.index,e.length);var r=Object.keys(t.format).reduce(function(e,n){return d.default.query(n,d.default.Scope.BLOCK)&&!Array.isArray(t.format[n])&&(e[n]=t.format[n]),e},{});this.quill.insertText(e.index,"\n",r,h.default.sources.USER),this.quill.setSelection(e.index+1,h.default.sources.SILENT),this.quill.focus(),Object.keys(t.format).forEach(function(e){null!=r[e]||Array.isArray(t.format[e])||"link"!==e&&n.quill.format(e,t.format[e],h.default.sources.USER)})}function _(e){return{key:b.keys.TAB,shiftKey:!e,format:{"code-block":!0},handler:function(t){var n=d.default.query("code-block"),r=t.index,a=t.length,o=i(this.quill.scroll.descendant(n,r),2),s=o[0],l=o[1];if(null!=s){var c=this.quill.getIndex(s),u=s.newlineIndex(l,!0)+1,f=s.newlineIndex(c+l+a),p=s.domNode.textContent.slice(u,f).split("\n");l=0,p.forEach(function(t,i){e?(s.insertAt(u+l,n.TAB),l+=n.TAB.length,0===i?r+=n.TAB.length:a+=n.TAB.length):t.startsWith(n.TAB)&&(s.deleteAt(u+l,n.TAB.length),l-=n.TAB.length,0===i?r-=n.TAB.length:a-=n.TAB.length),l+=t.length+1}),this.quill.update(h.default.sources.USER),this.quill.setSelection(r,a,h.default.sources.SILENT)}}}}function E(e){return{key:e[0].toUpperCase(),shortKey:!0,handler:function(t,n){this.quill.format(e,!n.format[e],h.default.sources.USER)}}}function T(e){if("string"==typeof e||"number"==typeof e)return T({key:e});if((void 0===e?"undefined":r(e))==="object"&&(e=(0,o.default)(e,!1)),"string"==typeof e.key)if(null!=b.keys[e.key.toUpperCase()])e.key=b.keys[e.key.toUpperCase()];else{if(1!==e.key.length)return null;e.key=e.key.toUpperCase().charCodeAt(0)}return e.shortKey&&(e[v]=e.shortKey,delete e.shortKey),e}b.keys={BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},b.DEFAULTS={bindings:{bold:E("bold"),italic:E("italic"),underline:E("underline"),indent:{key:b.keys.TAB,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","+1",h.default.sources.USER)}},outdent:{key:b.keys.TAB,shiftKey:!0,format:["blockquote","indent","list"],handler:function(e,t){if(t.collapsed&&0!==t.offset)return!0;this.quill.format("indent","-1",h.default.sources.USER)}},"outdent backspace":{key:b.keys.BACKSPACE,collapsed:!0,shiftKey:null,metaKey:null,ctrlKey:null,altKey:null,format:["indent","list"],offset:0,handler:function(e,t){null!=t.format.indent?this.quill.format("indent","-1",h.default.sources.USER):null!=t.format.list&&this.quill.format("list",!1,h.default.sources.USER)}},"indent code-block":_(!0),"outdent code-block":_(!1),"remove tab":{key:b.keys.TAB,shiftKey:!0,collapsed:!0,prefix:/\t$/,handler:function(e){this.quill.deleteText(e.index-1,1,h.default.sources.USER)}},tab:{key:b.keys.TAB,handler:function(e){this.quill.history.cutoff();var t=new c.default().retain(e.index).delete(e.length).insert(" ");this.quill.updateContents(t,h.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index+1,h.default.sources.SILENT)}},"list empty enter":{key:b.keys.ENTER,collapsed:!0,format:["list"],empty:!0,handler:function(e,t){this.quill.format("list",!1,h.default.sources.USER),t.format.indent&&this.quill.format("indent",!1,h.default.sources.USER)}},"checklist enter":{key:b.keys.ENTER,collapsed:!0,format:{list:"checked"},handler:function(e){var t=i(this.quill.getLine(e.index),2),n=t[0],r=t[1],a=(0,l.default)({},n.formats(),{list:"checked"}),o=new c.default().retain(e.index).insert("\n",a).retain(n.length()-r-1).retain(1,{list:"unchecked"});this.quill.updateContents(o,h.default.sources.USER),this.quill.setSelection(e.index+1,h.default.sources.SILENT),this.quill.scrollIntoView()}},"header enter":{key:b.keys.ENTER,collapsed:!0,format:["header"],suffix:/^$/,handler:function(e,t){var n=i(this.quill.getLine(e.index),2),r=n[0],a=n[1],o=new c.default().retain(e.index).insert("\n",t.format).retain(r.length()-a-1).retain(1,{header:null});this.quill.updateContents(o,h.default.sources.USER),this.quill.setSelection(e.index+1,h.default.sources.SILENT),this.quill.scrollIntoView()}},"list autofill":{key:" ",collapsed:!0,format:{list:!1},prefix:/^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,handler:function(e,t){var n=t.prefix.length,r=i(this.quill.getLine(e.index),2),a=r[0],o=r[1];if(o>n)return!0;var s=void 0;switch(t.prefix.trim()){case"[]":case"[ ]":s="unchecked";break;case"[x]":s="checked";break;case"-":case"*":s="bullet";break;default:s="ordered"}this.quill.insertText(e.index," ",h.default.sources.USER),this.quill.history.cutoff();var l=new c.default().retain(e.index-o).delete(n+1).retain(a.length()-2-o).retain(1,{list:s});this.quill.updateContents(l,h.default.sources.USER),this.quill.history.cutoff(),this.quill.setSelection(e.index-n,h.default.sources.SILENT)}},"code exit":{key:b.keys.ENTER,collapsed:!0,format:["code-block"],prefix:/\n\n$/,suffix:/^\s+$/,handler:function(e){var t=i(this.quill.getLine(e.index),2),n=t[0],r=t[1],a=new c.default().retain(e.index+n.length()-r-2).retain(1,{"code-block":null}).delete(1);this.quill.updateContents(a,h.default.sources.USER)}},"embed left":x(b.keys.LEFT,!1),"embed left shift":x(b.keys.LEFT,!0),"embed right":x(b.keys.RIGHT,!1),"embed right shift":x(b.keys.RIGHT,!0)}},t.default=b,t.SHORTKEY=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=l(n(0)),s=l(n(7));function l(e){return e&&e.__esModule?e:{default:e}}var c=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.selection=n,r.textNode=document.createTextNode(t.CONTENTS),r.domNode.appendChild(r.textNode),r._length=0,r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),a(t,null,[{key:"value",value:function(){}}]),a(t,[{key:"detach",value:function(){null!=this.parent&&this.parent.removeChild(this)}},{key:"format",value:function(e,n){if(0!==this._length)return i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n);for(var r=this,a=0;null!=r&&r.statics.scope!==o.default.Scope.BLOCK_BLOT;)a+=r.offset(r.parent),r=r.parent;null!=r&&(this._length=t.CONTENTS.length,r.optimize(),r.formatAt(a,t.CONTENTS.length,e,n),this._length=0)}},{key:"index",value:function(e,n){return e===this.textNode?0:i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,n)}},{key:"length",value:function(){return this._length}},{key:"position",value:function(){return[this.textNode,this.textNode.data.length]}},{key:"remove",value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this),this.parent=null}},{key:"restore",value:function(){if(!this.selection.composing&&null!=this.parent){var e=this.textNode,n=this.selection.getNativeRange(),i=void 0,a=void 0,l=void 0;if(null!=n&&n.start.node===e&&n.end.node===e){var c=[e,n.start.offset,n.end.offset];i=c[0],a=c[1],l=c[2]}for(;null!=this.domNode.lastChild&&this.domNode.lastChild!==this.textNode;)this.domNode.parentNode.insertBefore(this.domNode.lastChild,this.domNode);if(this.textNode.data!==t.CONTENTS){var u=this.textNode.data.split(t.CONTENTS).join("");this.next instanceof s.default?(i=this.next.domNode,this.next.insertAt(0,u),this.textNode.data=t.CONTENTS):(this.textNode.data=u,this.parent.insertBefore(o.default.create(this.textNode),this),this.textNode=document.createTextNode(t.CONTENTS),this.domNode.appendChild(this.textNode))}if(this.remove(),null!=a){var d=r([a,l].map(function(e){return Math.max(0,Math.min(i.data.length,e-1))}),2);return a=d[0],l=d[1],{startNode:i,startOffset:a,endNode:i,endOffset:l}}}}},{key:"update",value:function(e,t){var n=this;if(e.some(function(e){return"characterData"===e.type&&e.target===n.textNode})){var r=this.restore();r&&(t.range=r)}}},{key:"value",value:function(){return""}}]),t}(o.default.Embed);c.blotName="cursor",c.className="ql-cursor",c.tagName="span",c.CONTENTS="\uFEFF",t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=o(n(0)),i=n(4),a=o(i);function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(r.default.Container);s.allowedChildren=[a.default,i.BlockEmbed,s],t.default=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorStyle=t.ColorClass=t.ColorAttributor=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r},s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"value",value:function(e){var n=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e);return n.startsWith("rgb(")?"#"+(n=n.replace(/^[^\d]+/,"").replace(/[^\d]+$/,"")).split(",").map(function(e){return("00"+parseInt(e).toString(16)).slice(-2)}).join(""):n}}]),t}(o.default.Attributor.Style),l=new o.default.Attributor.Class("color","ql-color",{scope:o.default.Scope.INLINE}),c=new s("color","color",{scope:o.default.Scope.INLINE});t.ColorAttributor=s,t.ColorClass=l,t.ColorStyle=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.sanitize=t.default=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"format",value:function(e,n){if(e!==this.statics.blotName||!n)return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n);n=this.constructor.sanitize(n),this.domNode.setAttribute("href",n)}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return e=this.sanitize(e),n.setAttribute("href",e),n.setAttribute("rel","noopener noreferrer"),n.setAttribute("target","_blank"),n}},{key:"formats",value:function(e){return e.getAttribute("href")}},{key:"sanitize",value:function(e){return s(e,this.PROTOCOL_WHITELIST)?e:this.SANITIZED_URL}}]),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);function s(e,t){var n=document.createElement("a");n.href=e;var r=n.href.slice(0,n.href.indexOf(":"));return t.indexOf(r)>-1}o.blotName="link",o.tagName="A",o.SANITIZED_URL="about:blank",o.PROTOCOL_WHITELIST=["http","https","mailto","tel"],t.default=o,t.sanitize=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r="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},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=s(n(23)),o=s(n(107));function s(e){return e&&e.__esModule?e:{default:e}}var l=0;function c(e,t){e.setAttribute(t,"true"!==e.getAttribute(t))}t.default=function(){function e(t){var n=this;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.select=t,this.container=document.createElement("span"),this.buildPicker(),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),this.label.addEventListener("mousedown",function(){n.togglePicker()}),this.label.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:n.togglePicker();break;case a.default.keys.ESCAPE:n.escape(),e.preventDefault()}}),this.select.addEventListener("change",this.update.bind(this))}return i(e,[{key:"togglePicker",value:function(){this.container.classList.toggle("ql-expanded"),c(this.label,"aria-expanded"),c(this.options,"aria-hidden")}},{key:"buildItem",value:function(e){var t=this,n=document.createElement("span");return n.tabIndex="0",n.setAttribute("role","button"),n.classList.add("ql-picker-item"),e.hasAttribute("value")&&n.setAttribute("data-value",e.getAttribute("value")),e.textContent&&n.setAttribute("data-label",e.textContent),n.addEventListener("click",function(){t.selectItem(n,!0)}),n.addEventListener("keydown",function(e){switch(e.keyCode){case a.default.keys.ENTER:t.selectItem(n,!0),e.preventDefault();break;case a.default.keys.ESCAPE:t.escape(),e.preventDefault()}}),n}},{key:"buildLabel",value:function(){var e=document.createElement("span");return e.classList.add("ql-picker-label"),e.innerHTML=o.default,e.tabIndex="0",e.setAttribute("role","button"),e.setAttribute("aria-expanded","false"),this.container.appendChild(e),e}},{key:"buildOptions",value:function(){var e=this,t=document.createElement("span");t.classList.add("ql-picker-options"),t.setAttribute("aria-hidden","true"),t.tabIndex="-1",t.id="ql-picker-options-"+l,l+=1,this.label.setAttribute("aria-controls",t.id),this.options=t,[].slice.call(this.select.options).forEach(function(n){var r=e.buildItem(n);t.appendChild(r),!0===n.selected&&e.selectItem(r)}),this.container.appendChild(t)}},{key:"buildPicker",value:function(){var e=this;[].slice.call(this.select.attributes).forEach(function(t){e.container.setAttribute(t.name,t.value)}),this.container.classList.add("ql-picker"),this.label=this.buildLabel(),this.buildOptions()}},{key:"escape",value:function(){var e=this;this.close(),setTimeout(function(){return e.label.focus()},1)}},{key:"close",value:function(){this.container.classList.remove("ql-expanded"),this.label.setAttribute("aria-expanded","false"),this.options.setAttribute("aria-hidden","true")}},{key:"selectItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.container.querySelector(".ql-selected");if(e!==n&&(null!=n&&n.classList.remove("ql-selected"),null!=e&&(e.classList.add("ql-selected"),this.select.selectedIndex=[].indexOf.call(e.parentNode.children,e),e.hasAttribute("data-value")?this.label.setAttribute("data-value",e.getAttribute("data-value")):this.label.removeAttribute("data-value"),e.hasAttribute("data-label")?this.label.setAttribute("data-label",e.getAttribute("data-label")):this.label.removeAttribute("data-label"),t))){if("function"==typeof Event)this.select.dispatchEvent(new Event("change"));else if(("u"<typeof Event?"undefined":r(Event))==="object"){var i=document.createEvent("Event");i.initEvent("change",!0,!0),this.select.dispatchEvent(i)}this.close()}}},{key:"update",value:function(){var e=void 0;if(this.select.selectedIndex>-1){var t=this.container.querySelector(".ql-picker-options").children[this.select.selectedIndex];e=this.select.options[this.select.selectedIndex],this.selectItem(t)}else this.selectItem(null);var n=null!=e&&e!==this.select.querySelector("option[selected]");this.label.classList.toggle("ql-active",n)}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=y(n(0)),i=y(n(5)),a=n(4),o=y(a),s=y(n(16)),l=y(n(25)),c=y(n(24)),u=y(n(35)),d=y(n(6)),h=y(n(22)),f=y(n(7)),p=y(n(55)),m=y(n(42)),g=y(n(23));function y(e){return e&&e.__esModule?e:{default:e}}i.default.register({"blots/block":o.default,"blots/block/embed":a.BlockEmbed,"blots/break":s.default,"blots/container":l.default,"blots/cursor":c.default,"blots/embed":u.default,"blots/inline":d.default,"blots/scroll":h.default,"blots/text":f.default,"modules/clipboard":p.default,"modules/history":m.default,"modules/keyboard":g.default}),r.default.register(o.default,s.default,c.default,d.default,h.default,f.default),t.default=i.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1);t.default=function(){function e(e){this.domNode=e,this.domNode[r.DATA_KEY]={blot:this}}return Object.defineProperty(e.prototype,"statics",{get:function(){return this.constructor},enumerable:!0,configurable:!0}),e.create=function(e){var t;if(null==this.tagName)throw new r.ParchmentError("Blot definition missing tagName");return Array.isArray(this.tagName)?("string"==typeof e&&parseInt(e=e.toUpperCase()).toString()===e&&(e=parseInt(e)),t="number"==typeof e?document.createElement(this.tagName[e-1]):this.tagName.indexOf(e)>-1?document.createElement(e):document.createElement(this.tagName[0])):t=document.createElement(this.tagName),this.className&&t.classList.add(this.className),t},e.prototype.attach=function(){null!=this.parent&&(this.scroll=this.parent.scroll)},e.prototype.clone=function(){var e=this.domNode.cloneNode(!1);return r.create(e)},e.prototype.detach=function(){null!=this.parent&&this.parent.removeChild(this),delete this.domNode[r.DATA_KEY]},e.prototype.deleteAt=function(e,t){this.isolate(e,t).remove()},e.prototype.formatAt=function(e,t,n,i){var a=this.isolate(e,t);if(null!=r.query(n,r.Scope.BLOT)&&i)a.wrap(n,i);else if(null!=r.query(n,r.Scope.ATTRIBUTE)){var o=r.create(this.statics.scope);a.wrap(o),o.format(n,i)}},e.prototype.insertAt=function(e,t,n){var i=null==n?r.create("text",t):r.create(t,n),a=this.split(e);this.parent.insertBefore(i,a)},e.prototype.insertInto=function(e,t){void 0===t&&(t=null),null!=this.parent&&this.parent.children.remove(this);var n=null;e.children.insertBefore(this,t),null!=t&&(n=t.domNode),(this.domNode.parentNode!=e.domNode||this.domNode.nextSibling!=n)&&e.domNode.insertBefore(this.domNode,n),this.parent=e,this.attach()},e.prototype.isolate=function(e,t){var n=this.split(e);return n.split(t),n},e.prototype.length=function(){return 1},e.prototype.offset=function(e){return(void 0===e&&(e=this.parent),null==this.parent||this==e)?0:this.parent.children.offset(this)+this.parent.offset(e)},e.prototype.optimize=function(e){null!=this.domNode[r.DATA_KEY]&&delete this.domNode[r.DATA_KEY].mutations},e.prototype.remove=function(){null!=this.domNode.parentNode&&this.domNode.parentNode.removeChild(this.domNode),this.detach()},e.prototype.replace=function(e){null!=e.parent&&(e.parent.insertBefore(this,e.next),e.remove())},e.prototype.replaceWith=function(e,t){var n="string"==typeof e?r.create(e,t):e;return n.replace(this),n},e.prototype.split=function(e,t){return 0===e?this:this.next},e.prototype.update=function(e,t){},e.prototype.wrap=function(e,t){var n="string"==typeof e?r.create(e,t):e;return null!=this.parent&&this.parent.insertBefore(n,this.next),n.appendChild(this),n},e.blotName="abstract",e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(12),i=n(32),a=n(33),o=n(1);t.default=function(){function e(e){this.attributes={},this.domNode=e,this.build()}return e.prototype.attribute=function(e,t){t?e.add(this.domNode,t)&&(null!=e.value(this.domNode)?this.attributes[e.attrName]=e:delete this.attributes[e.attrName]):(e.remove(this.domNode),delete this.attributes[e.attrName])},e.prototype.build=function(){var e=this;this.attributes={};var t=r.default.keys(this.domNode),n=i.default.keys(this.domNode),s=a.default.keys(this.domNode);t.concat(n).concat(s).forEach(function(t){var n=o.query(t,o.Scope.ATTRIBUTE);n instanceof r.default&&(e.attributes[n.attrName]=n)})},e.prototype.copy=function(e){var t=this;Object.keys(this.attributes).forEach(function(n){var r=t.attributes[n].value(t.domNode);e.format(n,r)})},e.prototype.move=function(e){var t=this;this.copy(e),Object.keys(this.attributes).forEach(function(e){t.attributes[e].remove(t.domNode)}),this.attributes={}},e.prototype.values=function(){var e=this;return Object.keys(this.attributes).reduce(function(t,n){return t[n]=e.attributes[n].value(e.domNode),t},{})},e}()},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function a(e,t){return(e.getAttribute("class")||"").split(/\s+/).filter(function(e){return 0===e.indexOf(t+"-")})}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.keys=function(e){return(e.getAttribute("class")||"").split(/\s+/).map(function(e){return e.split("-").slice(0,-1).join("-")})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(this.remove(e),e.classList.add(this.keyName+"-"+t),!0)},t.prototype.remove=function(e){a(e,this.keyName).forEach(function(t){e.classList.remove(t)}),0===e.classList.length&&e.removeAttribute("class")},t.prototype.value=function(e){var t=(a(e,this.keyName)[0]||"").slice(this.keyName.length+1);return this.canAdd(e,t)?t:""},t}(n(12).default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});function a(e){var t=e.split("-"),n=t.slice(1).map(function(e){return e[0].toUpperCase()+e.slice(1)}).join("");return t[0]+n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.keys=function(e){return(e.getAttribute("style")||"").split(";").map(function(e){return e.split(":")[0].trim()})},t.prototype.add=function(e,t){return!!this.canAdd(e,t)&&(e.style[a(this.keyName)]=t,!0)},t.prototype.remove=function(e){e.style[a(this.keyName)]="",e.getAttribute("style")||e.removeAttribute("style")},t.prototype.value=function(e){var t=e.style[a(this.keyName)];return this.canAdd(e,t)?t:""},t}(n(12).default)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(t,n){if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.quill=t,this.options=n,this.modules={}}return r(e,[{key:"init",value:function(){var e=this;Object.keys(this.options.modules).forEach(function(t){null==e.modules[t]&&e.addModule(t)})}},{key:"addModule",value:function(e){var t=this.quill.constructor.import("modules/"+e);return this.modules[e]=new t(this.quill,this.options.modules[e]||{}),this.modules[e]}}]),e}();i.DEFAULTS={modules:{}},i.themes={default:i},t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=s(n(0)),o=s(n(7));function s(e){return e&&e.__esModule?e:{default:e}}t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var n=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.contentNode=document.createElement("span"),n.contentNode.setAttribute("contenteditable",!1),[].slice.call(n.domNode.childNodes).forEach(function(e){n.contentNode.appendChild(e)}),n.leftGuard=document.createTextNode("\uFEFF"),n.rightGuard=document.createTextNode("\uFEFF"),n.domNode.appendChild(n.leftGuard),n.domNode.appendChild(n.contentNode),n.domNode.appendChild(n.rightGuard),n}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"index",value:function(e,n){return e===this.leftGuard?0:e===this.rightGuard?1:i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"index",this).call(this,e,n)}},{key:"restore",value:function(e){var t=void 0,n=void 0,r=e.data.split("\uFEFF").join("");if(e===this.leftGuard)if(this.prev instanceof o.default){var i=this.prev.length();this.prev.insertAt(i,r),t={startNode:this.prev.domNode,startOffset:i+r.length}}else n=document.createTextNode(r),this.parent.insertBefore(a.default.create(n),this),t={startNode:n,startOffset:r.length};else e===this.rightGuard&&(this.next instanceof o.default?(this.next.insertAt(0,r),t={startNode:this.next.domNode,startOffset:r.length}):(n=document.createTextNode(r),this.parent.insertBefore(a.default.create(n),this.next),t={startNode:n,startOffset:r.length}));return e.data="\uFEFF",t}},{key:"update",value:function(e,t){var n=this;e.forEach(function(e){if("characterData"===e.type&&(e.target===n.leftGuard||e.target===n.rightGuard)){var r=n.restore(e.target);r&&(t.range=r)}})}}]),t}(a.default.Embed)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.AlignStyle=t.AlignClass=t.AlignAttribute=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a={scope:i.default.Scope.BLOCK,whitelist:["right","center","justify"]},o=new i.default.Attributor.Attribute("align","align",a),s=new i.default.Attributor.Class("align","ql-align",a),l=new i.default.Attributor.Style("align","text-align",a);t.AlignAttribute=o,t.AlignClass=s,t.AlignStyle=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundStyle=t.BackgroundClass=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a=n(26),o=new i.default.Attributor.Class("background","ql-bg",{scope:i.default.Scope.INLINE}),s=new a.ColorAttributor("background","background-color",{scope:i.default.Scope.INLINE});t.BackgroundClass=o,t.BackgroundStyle=s},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DirectionStyle=t.DirectionClass=t.DirectionAttribute=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a={scope:i.default.Scope.BLOCK,whitelist:["rtl"]},o=new i.default.Attributor.Attribute("direction","dir",a),s=new i.default.Attributor.Class("direction","ql-direction",a),l=new i.default.Attributor.Style("direction","direction",a);t.DirectionAttribute=o,t.DirectionClass=s,t.DirectionStyle=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.FontClass=t.FontStyle=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r},s={scope:o.default.Scope.INLINE,whitelist:["serif","monospace"]},l=new o.default.Attributor.Class("font","ql-font",s);t.FontStyle=new(function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"value",value:function(e){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e).replace(/["']/g,"")}}]),t}(o.default.Attributor.Style))("font","font-family",s),t.FontClass=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.SizeStyle=t.SizeClass=void 0;var r,i=(r=n(0))&&r.__esModule?r:{default:r},a=new i.default.Attributor.Class("size","ql-size",{scope:i.default.Scope.INLINE,whitelist:["small","large","huge"]}),o=new i.default.Attributor.Style("size","font-size",{scope:i.default.Scope.INLINE,whitelist:["10px","18px","32px"]});t.SizeClass=a,t.SizeStyle=o},function(e,t,n){e.exports={align:{"":n(76),center:n(77),right:n(78),justify:n(79)},background:n(80),blockquote:n(81),bold:n(82),clean:n(83),code:n(58),"code-block":n(58),color:n(84),direction:{"":n(85),rtl:n(86)},float:{center:n(87),full:n(88),left:n(89),right:n(90)},formula:n(91),header:{1:n(92),2:n(93)},italic:n(94),image:n(95),indent:{"+1":n(96),"-1":n(97)},link:n(98),list:{ordered:n(99),bullet:n(100),check:n(101)},script:{sub:n(102),super:n(103)},strike:n(104),underline:n(105),video:n(106)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.getLastChangeIndex=t.default=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=o(n(0)),a=o(n(5));function o(e){return e&&e.__esModule?e:{default:e}}var s=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.lastRecorded=0,r.ignoreChange=!1,r.clear(),r.quill.on(a.default.events.EDITOR_CHANGE,function(e,t,n,i){e!==a.default.events.TEXT_CHANGE||r.ignoreChange||(r.options.userOnly&&i!==a.default.sources.USER?r.transform(t):r.record(t,n))}),r.quill.keyboard.addBinding({key:"Z",shortKey:!0},r.undo.bind(r)),r.quill.keyboard.addBinding({key:"Z",shortKey:!0,shiftKey:!0},r.redo.bind(r)),/Win/i.test(navigator.platform)&&r.quill.keyboard.addBinding({key:"Y",shortKey:!0},r.redo.bind(r)),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),r(t,[{key:"change",value:function(e,t){if(0!==this.stack[e].length){var n=this.stack[e].pop();this.stack[t].push(n),this.lastRecorded=0,this.ignoreChange=!0,this.quill.updateContents(n[e],a.default.sources.USER),this.ignoreChange=!1;var r=l(n[e]);this.quill.setSelection(r)}}},{key:"clear",value:function(){this.stack={undo:[],redo:[]}}},{key:"cutoff",value:function(){this.lastRecorded=0}},{key:"record",value:function(e,t){if(0!==e.ops.length){this.stack.redo=[];var n=this.quill.getContents().diff(t),r=Date.now();if(this.lastRecorded+this.options.delay>r&&this.stack.undo.length>0){var i=this.stack.undo.pop();n=n.compose(i.undo),e=i.redo.compose(e)}else this.lastRecorded=r;this.stack.undo.push({redo:e,undo:n}),this.stack.undo.length>this.options.maxStack&&this.stack.undo.shift()}}},{key:"redo",value:function(){this.change("redo","undo")}},{key:"transform",value:function(e){this.stack.undo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)}),this.stack.redo.forEach(function(t){t.undo=e.transform(t.undo,!0),t.redo=e.transform(t.redo,!0)})}},{key:"undo",value:function(){this.change("undo","redo")}}]),t}(o(n(9)).default);function l(e){var t,n=e.reduce(function(e,t){return e+(t.delete||0)},0),r=e.length()-n;return null!=(t=e.ops[e.ops.length-1])&&(null!=t.insert?"string"==typeof t.insert&&t.insert.endsWith("\n"):null!=t.attributes&&Object.keys(t.attributes).some(function(e){return null!=i.default.query(e,i.default.Scope.BLOCK)}))&&(r-=1),r}s.DEFAULTS={delay:1e3,maxStack:100,userOnly:!1},t.default=s,t.getLastChangeIndex=l},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BaseTooltip=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=p(n(3)),o=p(n(2)),s=p(n(8)),l=p(n(23)),c=p(n(34)),u=p(n(59)),d=p(n(60)),h=p(n(28)),f=p(n(61));function p(e){return e&&e.__esModule?e:{default:e}}function m(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function g(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function y(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var v=[!1,"center","right","justify"],b=["#000000","#e60000","#ff9900","#ffff00","#008a00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],x=[!1,"serif","monospace"],w=["1","2","3",!1],C=["small",!1,"large","huge"],S=function(e){function t(e,n){m(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return e.emitter.listenDOM("click",document.body,function t(n){if(!document.body.contains(e.root))return document.body.removeEventListener("click",t);null==r.tooltip||r.tooltip.root.contains(n.target)||document.activeElement===r.tooltip.textbox||r.quill.hasFocus()||r.tooltip.hide(),null!=r.pickers&&r.pickers.forEach(function(e){e.container.contains(n.target)||e.close()})}),r}return y(t,e),r(t,[{key:"addModule",value:function(e){var n=i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addModule",this).call(this,e);return"toolbar"===e&&this.extendToolbar(n),n}},{key:"buildButtons",value:function(e,t){e.forEach(function(e){(e.getAttribute("class")||"").split(/\s+/).forEach(function(n){if(n.startsWith("ql-")&&null!=t[n=n.slice(3)])if("direction"===n)e.innerHTML=t[n][""]+t[n].rtl;else if("string"==typeof t[n])e.innerHTML=t[n];else{var r=e.value||"";null!=r&&t[n][r]&&(e.innerHTML=t[n][r])}})})}},{key:"buildPickers",value:function(e,t){var n=this;this.pickers=e.map(function(e){if(e.classList.contains("ql-align"))return null==e.querySelector("option")&&k(e,v),new d.default(e,t.align);if(!(e.classList.contains("ql-background")||e.classList.contains("ql-color")))return null==e.querySelector("option")&&(e.classList.contains("ql-font")?k(e,x):e.classList.contains("ql-header")?k(e,w):e.classList.contains("ql-size")&&k(e,C)),new h.default(e);var n=e.classList.contains("ql-background")?"background":"color";return null==e.querySelector("option")&&k(e,b,"background"===n?"#ffffff":"#000000"),new u.default(e,t[n])}),this.quill.on(s.default.events.EDITOR_CHANGE,function(){n.pickers.forEach(function(e){e.update()})})}}]),t}(c.default);function k(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t.forEach(function(t){var r=document.createElement("option");t===n?r.setAttribute("selected","selected"):r.setAttribute("value",t),e.appendChild(r)})}S.DEFAULTS=(0,a.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{formula:function(){this.quill.theme.tooltip.edit("formula")},image:function(){var e=this,t=this.container.querySelector("input.ql-image[type=file]");null==t&&((t=document.createElement("input")).setAttribute("type","file"),t.setAttribute("accept","image/png, image/gif, image/jpeg, image/bmp, image/x-icon"),t.classList.add("ql-image"),t.addEventListener("change",function(){if(null!=t.files&&null!=t.files[0]){var n=new FileReader;n.onload=function(n){var r=e.quill.getSelection(!0);e.quill.updateContents(new o.default().retain(r.index).delete(r.length).insert({image:n.target.result}),s.default.sources.USER),e.quill.setSelection(r.index+1,s.default.sources.SILENT),t.value=""},n.readAsDataURL(t.files[0])}}),this.container.appendChild(t)),t.click()},video:function(){this.quill.theme.tooltip.edit("video")}}}}}),t.BaseTooltip=function(e){function t(e,n){m(this,t);var r=g(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.textbox=r.root.querySelector('input[type="text"]'),r.listen(),r}return y(t,e),r(t,[{key:"listen",value:function(){var e=this;this.textbox.addEventListener("keydown",function(t){l.default.match(t,"enter")?(e.save(),t.preventDefault()):l.default.match(t,"escape")&&(e.cancel(),t.preventDefault())})}},{key:"cancel",value:function(){this.hide()}},{key:"edit",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"link",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.root.classList.remove("ql-hidden"),this.root.classList.add("ql-editing"),null!=t?this.textbox.value=t:e!==this.root.getAttribute("data-mode")&&(this.textbox.value=""),this.position(this.quill.getBounds(this.quill.selection.savedRange)),this.textbox.select(),this.textbox.setAttribute("placeholder",this.textbox.getAttribute("data-"+e)||""),this.root.setAttribute("data-mode",e)}},{key:"restoreFocus",value:function(){var e=this.quill.scrollingContainer.scrollTop;this.quill.focus(),this.quill.scrollingContainer.scrollTop=e}},{key:"save",value:function(){var e,t,n=this.textbox.value;switch(this.root.getAttribute("data-mode")){case"link":var r=this.quill.root.scrollTop;this.linkRange?(this.quill.formatText(this.linkRange,"link",n,s.default.sources.USER),delete this.linkRange):(this.restoreFocus(),this.quill.format("link",n,s.default.sources.USER)),this.quill.root.scrollTop=r;break;case"video":n=(t=(e=n).match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/)||e.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/))?(t[1]||"https")+"://www.youtube.com/embed/"+t[2]+"?showinfo=0":(t=e.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/))?(t[1]||"https")+"://player.vimeo.com/video/"+t[2]+"/":e;case"formula":if(!n)break;var i=this.quill.getSelection(!0);if(null!=i){var a=i.index+i.length;this.quill.insertEmbed(a,this.root.getAttribute("data-mode"),n,s.default.sources.USER),"formula"===this.root.getAttribute("data-mode")&&this.quill.insertText(a+1," ",s.default.sources.USER),this.quill.setSelection(a+2,s.default.sources.USER)}}this.textbox.value="",this.hide()}}]),t}(f.default),t.default=S},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){function e(){this.head=this.tail=null,this.length=0}return e.prototype.append=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.insertBefore(e[0],null),e.length>1&&this.append.apply(this,e.slice(1))},e.prototype.contains=function(e){for(var t,n=this.iterator();t=n();)if(t===e)return!0;return!1},e.prototype.insertBefore=function(e,t){e&&(e.next=t,null!=t?(e.prev=t.prev,null!=t.prev&&(t.prev.next=e),t.prev=e,t===this.head&&(this.head=e)):null!=this.tail?(this.tail.next=e,e.prev=this.tail,this.tail=e):(e.prev=null,this.head=this.tail=e),this.length+=1)},e.prototype.offset=function(e){for(var t=0,n=this.head;null!=n;){if(n===e)return t;t+=n.length(),n=n.next}return -1},e.prototype.remove=function(e){this.contains(e)&&(null!=e.prev&&(e.prev.next=e.next),null!=e.next&&(e.next.prev=e.prev),e===this.head&&(this.head=e.next),e===this.tail&&(this.tail=e.prev),this.length-=1)},e.prototype.iterator=function(e){return void 0===e&&(e=this.head),function(){var t=e;return null!=e&&(e=e.next),t}},e.prototype.find=function(e,t){void 0===t&&(t=!1);for(var n,r=this.iterator();n=r();){var i=n.length();if(e<i||t&&e===i&&(null==n.next||0!==n.next.length()))return[n,e];e-=i}return[null,0]},e.prototype.forEach=function(e){for(var t,n=this.iterator();t=n();)e(t)},e.prototype.forEachAt=function(e,t,n){if(!(t<=0))for(var r,i=this.find(e),a=i[0],o=e-i[1],s=this.iterator(a);(r=s())&&o<e+t;){var l=r.length();e>o?n(r,e-o,Math.min(t,o+l-e)):n(r,0,Math.min(l,e+t-o)),o+=l}},e.prototype.map=function(e){return this.reduce(function(t,n){return t.push(e(n)),t},[])},e.prototype.reduce=function(e,t){for(var n,r=this.iterator();n=r();)t=e(t,n);return t},e}()},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(17),o=n(1),s={attributes:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0};t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.scroll=n,n.observer=new MutationObserver(function(e){n.update(e)}),n.observer.observe(n.domNode,s),n.attach(),n}return i(t,e),t.prototype.detach=function(){e.prototype.detach.call(this),this.observer.disconnect()},t.prototype.deleteAt=function(t,n){this.update(),0===t&&n===this.length()?this.children.forEach(function(e){e.remove()}):e.prototype.deleteAt.call(this,t,n)},t.prototype.formatAt=function(t,n,r,i){this.update(),e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.insertAt=function(t,n,r){this.update(),e.prototype.insertAt.call(this,t,n,r)},t.prototype.optimize=function(t,n){var r=this;void 0===t&&(t=[]),void 0===n&&(n={}),e.prototype.optimize.call(this,n);for(var i=[].slice.call(this.observer.takeRecords());i.length>0;)t.push(i.pop());for(var s=function(e,t){void 0===t&&(t=!0),null==e||e===r||null!=e.domNode.parentNode&&(null==e.domNode[o.DATA_KEY].mutations&&(e.domNode[o.DATA_KEY].mutations=[]),t&&s(e.parent))},l=function(e){null!=e.domNode[o.DATA_KEY]&&null!=e.domNode[o.DATA_KEY].mutations&&(e instanceof a.default&&e.children.forEach(l),e.optimize(n))},c=t,u=0;c.length>0;u+=1){if(u>=100)throw Error("[Parchment] Maximum optimize iterations reached");for(c.forEach(function(e){var t=o.find(e.target,!0);null!=t&&(t.domNode===e.target&&("childList"===e.type?(s(o.find(e.previousSibling,!1)),[].forEach.call(e.addedNodes,function(e){var t=o.find(e,!1);s(t,!1),t instanceof a.default&&t.children.forEach(function(e){s(e,!1)})})):"attributes"===e.type&&s(t.prev)),s(t))}),this.children.forEach(l),i=(c=[].slice.call(this.observer.takeRecords())).slice();i.length>0;)t.push(i.pop())}},t.prototype.update=function(t,n){var r=this;void 0===n&&(n={}),(t=t||this.observer.takeRecords()).map(function(e){var t=o.find(e.target,!0);return null==t?null:null==t.domNode[o.DATA_KEY].mutations?(t.domNode[o.DATA_KEY].mutations=[e],t):(t.domNode[o.DATA_KEY].mutations.push(e),null)}).forEach(function(e){null!=e&&e!==r&&null!=e.domNode[o.DATA_KEY]&&e.update(e.domNode[o.DATA_KEY].mutations||[],n)}),null!=this.domNode[o.DATA_KEY].mutations&&e.prototype.update.call(this,this.domNode[o.DATA_KEY].mutations,n),this.optimize(t,n)},t.blotName="scroll",t.defaultChild="block",t.scope=o.Scope.BLOCK_BLOT,t.tagName="DIV",t}(a.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(18),o=n(1);t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.formats=function(n){if(n.tagName!==t.tagName)return e.formats.call(this,n)},t.prototype.format=function(n,r){var i=this;n!==this.statics.blotName||r?e.prototype.format.call(this,n,r):(this.children.forEach(function(e){e instanceof a.default||(e=e.wrap(t.blotName,!0)),i.attributes.copy(e)}),this.unwrap())},t.prototype.formatAt=function(t,n,r,i){null!=this.formats()[r]||o.query(r,o.Scope.ATTRIBUTE)?this.isolate(t,n).format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.optimize=function(n){e.prototype.optimize.call(this,n);var r=this.formats();if(0===Object.keys(r).length)return this.unwrap();var i=this.next;i instanceof t&&i.prev===this&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(var n in e)if(e[n]!==t[n])return!1;return!0}(r,i.formats())&&(i.moveChildren(this),i.remove())},t.blotName="inline",t.scope=o.Scope.INLINE_BLOT,t.tagName="SPAN",t}(a.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(18),o=n(1);t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.formats=function(n){var r=o.query(t.blotName).tagName;if(n.tagName!==r)return e.formats.call(this,n)},t.prototype.format=function(n,r){null==o.query(n,o.Scope.BLOCK)||(n!==this.statics.blotName||r?e.prototype.format.call(this,n,r):this.replaceWith(t.blotName))},t.prototype.formatAt=function(t,n,r,i){null!=o.query(r,o.Scope.BLOCK)?this.format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.insertAt=function(t,n,r){if(null==r||null!=o.query(n,o.Scope.INLINE))e.prototype.insertAt.call(this,t,n,r);else{var i=this.split(t),a=o.create(n,r);i.parent.insertBefore(a,i)}},t.prototype.update=function(t,n){navigator.userAgent.match(/Trident/)?this.build():e.prototype.update.call(this,t,n)},t.blotName="block",t.scope=o.Scope.BLOCK_BLOT,t.tagName="P",t}(a.default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i(t,e),t.formats=function(e){},t.prototype.format=function(t,n){e.prototype.formatAt.call(this,0,this.length(),t,n)},t.prototype.formatAt=function(t,n,r,i){0===t&&n===this.length()?this.format(r,i):e.prototype.formatAt.call(this,t,n,r,i)},t.prototype.formats=function(){return this.statics.formats(this.domNode)},t}(n(19).default)},function(e,t,n){var r,i=this&&this.__extends||(r=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(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var a=n(19),o=n(1);t.default=function(e){function t(t){var n=e.call(this,t)||this;return n.text=n.statics.value(n.domNode),n}return i(t,e),t.create=function(e){return document.createTextNode(e)},t.value=function(e){var t=e.data;return t.normalize&&(t=t.normalize()),t},t.prototype.deleteAt=function(e,t){this.domNode.data=this.text=this.text.slice(0,e)+this.text.slice(e+t)},t.prototype.index=function(e,t){return this.domNode===e?t:-1},t.prototype.insertAt=function(t,n,r){null==r?(this.text=this.text.slice(0,t)+n+this.text.slice(t),this.domNode.data=this.text):e.prototype.insertAt.call(this,t,n,r)},t.prototype.length=function(){return this.text.length},t.prototype.optimize=function(n){e.prototype.optimize.call(this,n),this.text=this.statics.value(this.domNode),0===this.text.length?this.remove():this.next instanceof t&&this.next.prev===this&&(this.insertAt(this.length(),this.next.value()),this.next.remove())},t.prototype.position=function(e,t){return void 0===t&&(t=!1),[this.domNode,e]},t.prototype.split=function(e,t){if(void 0===t&&(t=!1),!t){if(0===e)return this;if(e===this.length())return this.next}var n=o.create(this.domNode.splitText(e));return this.parent.insertBefore(n,this.next),this.text=this.statics.value(this.domNode),n},t.prototype.update=function(e,t){var n=this;e.some(function(e){return"characterData"===e.type&&e.target===n.domNode})&&(this.text=this.statics.value(this.domNode))},t.prototype.value=function(){return this.text},t.blotName="text",t.scope=o.Scope.INLINE_BLOT,t}(a.default)},function(e,t,n){var r=document.createElement("div");if(r.classList.toggle("test-class",!1),r.classList.contains("test-class")){var i=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(e,t){return arguments.length>1&&!this.contains(e)==!t?t:i.call(this,e)}}String.prototype.startsWith||(String.prototype.startsWith=function(e,t){return t=t||0,this.substr(t,e.length)===e}),String.prototype.endsWith||(String.prototype.endsWith=function(e,t){var n=this.toString();("number"!=typeof t||!isFinite(t)||Math.floor(t)!==t||t>n.length)&&(t=n.length),t-=e.length;var r=n.indexOf(e,t);return -1!==r&&r===t}),Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(this===null)throw TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw TypeError("predicate must be a function");for(var t,n=Object(this),r=n.length>>>0,i=arguments[1],a=0;a<r;a++)if(t=n[a],e.call(i,t,a,n))return t}}),document.addEventListener("DOMContentLoaded",function(){document.execCommand("enableObjectResizing",!1,!1),document.execCommand("autoUrlDetect",!1,!1)})},function(e,t){function n(e,t,s){if(e==t)return e?[[0,e]]:[];(s<0||e.length<s)&&(s=null);var l=i(e,t),c=e.substring(0,l);l=a(e=e.substring(l),t=t.substring(l));var u=e.substring(e.length-l),d=function(e,t){if(!e)return[[1,t]];if(!t)return[[-1,e]];var o,s=e.length>t.length?e:t,l=e.length>t.length?t:e,c=s.indexOf(l);if(-1!=c)return o=[[1,s.substring(0,c)],[0,l],[1,s.substring(c+l.length)]],e.length>t.length&&(o[0][0]=o[2][0]=-1),o;if(1==l.length)return[[-1,e],[1,t]];var u=function(e,t){var n,r,o,s,l,c=e.length>t.length?e:t,u=e.length>t.length?t:e;if(c.length<4||2*u.length<c.length)return null;function d(e,t,n){for(var r,o,s,l,c=e.substring(n,n+Math.floor(e.length/4)),u=-1,d="";-1!=(u=t.indexOf(c,u+1));){var h=i(e.substring(n),t.substring(u)),f=a(e.substring(0,n),t.substring(0,u));d.length<f+h&&(d=t.substring(u-f,u)+t.substring(u,u+h),r=e.substring(0,n-f),o=e.substring(n+h),s=t.substring(0,u-f),l=t.substring(u+h))}return 2*d.length>=e.length?[r,o,s,l,d]:null}var h=d(c,u,Math.ceil(c.length/4)),f=d(c,u,Math.ceil(c.length/2));return h||f?(n=f?h&&h[4].length>f[4].length?h:f:h,e.length>t.length?(r=n[0],o=n[1],s=n[2],l=n[3]):(s=n[0],l=n[1],r=n[2],o=n[3]),[r,o,s,l,n[4]]):null}(e,t);if(u){var d=u[0],h=u[1],f=u[2],p=u[3],m=u[4],g=n(d,f),y=n(h,p);return g.concat([[0,m]],y)}return function(e,t){for(var n=e.length,i=t.length,a=Math.ceil((n+i)/2),o=2*a,s=Array(o),l=Array(o),c=0;c<o;c++)s[c]=-1,l[c]=-1;s[a+1]=0,l[a+1]=0;for(var u=n-i,d=u%2!=0,h=0,f=0,p=0,m=0,g=0;g<a;g++){for(var y=-g+h;y<=g-f;y+=2){for(var v,b=a+y,x=(v=y==-g||y!=g&&s[b-1]<s[b+1]?s[b+1]:s[b-1]+1)-y;v<n&&x<i&&e.charAt(v)==t.charAt(x);)v++,x++;if(s[b]=v,v>n)f+=2;else if(x>i)h+=2;else if(d){var w=a+u-y;if(w>=0&&w<o&&-1!=l[w]){var C=n-l[w];if(v>=C)return r(e,t,v,x)}}}for(var S=-g+p;S<=g-m;S+=2){for(var C,w=a+S,k=(C=S==-g||S!=g&&l[w-1]<l[w+1]?l[w+1]:l[w-1]+1)-S;C<n&&k<i&&e.charAt(n-C-1)==t.charAt(i-k-1);)C++,k++;if(l[w]=C,C>n)m+=2;else if(k>i)p+=2;else if(!d){var b=a+u-S;if(b>=0&&b<o&&-1!=s[b]){var v=s[b],x=a+v-b;if(v>=(C=n-C))return r(e,t,v,x)}}}}return[[-1,e],[1,t]]}(e,t)}(e=e.substring(0,e.length-l),t=t.substring(0,t.length-l));return c&&d.unshift([0,c]),u&&d.push([0,u]),function e(t){t.push([0,""]);for(var n,r=0,o=0,s=0,l="",c="";r<t.length;)switch(t[r][0]){case 1:s++,c+=t[r][1],r++;break;case -1:o++,l+=t[r][1],r++;break;case 0:o+s>1?(0!==o&&0!==s&&(0!==(n=i(c,l))&&(r-o-s>0&&0==t[r-o-s-1][0]?t[r-o-s-1][1]+=c.substring(0,n):(t.splice(0,0,[0,c.substring(0,n)]),r++),c=c.substring(n),l=l.substring(n)),0!==(n=a(c,l))&&(t[r][1]=c.substring(c.length-n)+t[r][1],c=c.substring(0,c.length-n),l=l.substring(0,l.length-n))),0===o?t.splice(r-s,o+s,[1,c]):0===s?t.splice(r-o,o+s,[-1,l]):t.splice(r-o-s,o+s,[-1,l],[1,c]),r=r-o-s+ +!!o+ +!!s+1):0!==r&&0==t[r-1][0]?(t[r-1][1]+=t[r][1],t.splice(r,1)):r++,s=0,o=0,l="",c=""}""===t[t.length-1][1]&&t.pop();var u=!1;for(r=1;r<t.length-1;)0==t[r-1][0]&&0==t[r+1][0]&&(t[r][1].substring(t[r][1].length-t[r-1][1].length)==t[r-1][1]?(t[r][1]=t[r-1][1]+t[r][1].substring(0,t[r][1].length-t[r-1][1].length),t[r+1][1]=t[r-1][1]+t[r+1][1],t.splice(r-1,1),u=!0):t[r][1].substring(0,t[r+1][1].length)==t[r+1][1]&&(t[r-1][1]+=t[r+1][1],t[r][1]=t[r][1].substring(t[r+1][1].length)+t[r+1][1],t.splice(r+1,1),u=!0)),r++;u&&e(t)}(d),null!=s&&(d=function(e,t){var n=function(e,t){if(0===t)return[0,e];for(var n=0,r=0;r<e.length;r++){var i=e[r];if(-1===i[0]||0===i[0]){var a=n+i[1].length;if(t===a)return[r+1,e];if(t<a){e=e.slice();var o=t-n,s=[i[0],i[1].slice(0,o)],l=[i[0],i[1].slice(o)];return e.splice(r,1,s,l),[r+1,e]}n=a}}throw Error("cursor_pos is out of bounds!")}(e,t),r=n[1],i=n[0],a=r[i],s=r[i+1];if(null==a||0!==a[0])return e;if(null!=s&&a[1]+s[1]===s[1]+a[1])return r.splice(i,2,s,a),o(r,i,2);if(null==s||0!==s[1].indexOf(a[1]))return e;r.splice(i,2,[s[0],a[1]],[0,a[1]]);var l=s[1].slice(a[1].length);return l.length>0&&r.splice(i+2,0,[s[0],l]),o(r,i,3)}(d,s)),d=function(e){for(var t,n=!1,r=function(e){return e.charCodeAt(0)>=56320&&57343>=e.charCodeAt(0)},i=2;i<e.length;i+=1)0===e[i-2][0]&&(t=e[i-2][1]).charCodeAt(t.length-1)>=55296&&56319>=t.charCodeAt(t.length-1)&&-1===e[i-1][0]&&r(e[i-1][1])&&1===e[i][0]&&r(e[i][1])&&(n=!0,e[i-1][1]=e[i-2][1].slice(-1)+e[i-1][1],e[i][1]=e[i-2][1].slice(-1)+e[i][1],e[i-2][1]=e[i-2][1].slice(0,-1));if(!n)return e;for(var a=[],i=0;i<e.length;i+=1)e[i][1].length>0&&a.push(e[i]);return a}(d)}function r(e,t,r,i){var a=e.substring(0,r),o=t.substring(0,i),s=e.substring(r),l=t.substring(i),c=n(a,o),u=n(s,l);return c.concat(u)}function i(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i}function a(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?a=n=i:r=i,i=Math.floor((r-n)/2+n);return i}function o(e,t,n){for(var r=t+n-1;r>=0&&r>=t-1;r--)if(r+1<e.length){var i=e[r],a=e[r+1];i[0]===a[1]&&e.splice(r,2,[i[0],i[1]+a[1]])}return e}n.INSERT=1,n.DELETE=-1,n.EQUAL=0,e.exports=n},function(e,t){(e.exports="function"==typeof Object.keys?Object.keys:n).shim=n;function n(e){var t=[];for(var n in e)t.push(n);return t}},function(e,t){function n(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function r(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}(t=e.exports="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}()?n:r).supported=n,t.unsupported=r},function(e,t){var n=Object.prototype.hasOwnProperty,r="~";function i(){}function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),o.prototype.eventNames=function(){var e,t,i=[];if(0===this._eventsCount)return i;for(t in e=this._events)n.call(e,t)&&i.push(r?t.slice(1):t);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},o.prototype.listeners=function(e,t){var n=r?r+e:e,i=this._events[n];if(t)return!!i;if(!i)return[];if(i.fn)return[i.fn];for(var a=0,o=i.length,s=Array(o);a<o;a++)s[a]=i[a].fn;return s},o.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var l,c,u=this._events[s],d=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,a),!0;case 6:return u.fn.call(u.context,t,n,i,a,o),!0}for(c=1,l=Array(d-1);c<d;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,f=u.length;for(c=0;c<f;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),d){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,i);break;default:if(!l)for(h=1,l=Array(d-1);h<d;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},o.prototype.on=function(e,t,n){var i=new a(t,n||this),o=r?r+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],i]:this._events[o].push(i):(this._events[o]=i,this._eventsCount++),this},o.prototype.once=function(e,t,n){var i=new a(t,n||this,!0),o=r?r+e:e;return this._events[o]?this._events[o].fn?this._events[o]=[this._events[o],i]:this._events[o].push(i):(this._events[o]=i,this._eventsCount++),this},o.prototype.removeListener=function(e,t,n,a){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return 0==--this._eventsCount?this._events=new i:delete this._events[o],this;var s=this._events[o];if(s.fn)s.fn!==t||a&&!s.once||n&&s.context!==n||(0==--this._eventsCount?this._events=new i:delete this._events[o]);else{for(var l=0,c=[],u=s.length;l<u;l++)(s[l].fn!==t||a&&!s[l].once||n&&s[l].context!==n)&&c.push(s[l]);c.length?this._events[o]=1===c.length?c[0]:c:0==--this._eventsCount?this._events=new i:delete this._events[o]}return this},o.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&(0==--this._eventsCount?this._events=new i:delete this._events[t])):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prototype.setMaxListeners=function(){return this},o.prefixed=r,o.EventEmitter=o,void 0!==e&&(e.exports=o)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.matchText=t.matchSpacing=t.matchNewline=t.matchBlot=t.matchAttributor=t.default=void 0;var r="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},i=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=b(n(3)),s=b(n(2)),l=b(n(0)),c=b(n(5)),u=b(n(10)),d=b(n(9)),h=n(36),f=n(37),p=b(n(13)),m=n(26),g=n(38),y=n(39),v=n(40);function b(e){return e&&e.__esModule?e:{default:e}}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=(0,u.default)("quill:clipboard"),C="__ql-matcher",S=[[Node.TEXT_NODE,j],[Node.TEXT_NODE,M],["br",function(e,t){return O(t,"\n")||t.insert("\n"),t}],[Node.ELEMENT_NODE,M],[Node.ELEMENT_NODE,L],[Node.ELEMENT_NODE,N],[Node.ELEMENT_NODE,R],[Node.ELEMENT_NODE,function(e,t){var n={},r=e.style||{};return r.fontStyle&&"italic"===P(e).fontStyle&&(n.italic=!0),r.fontWeight&&(P(e).fontWeight.startsWith("bold")||parseInt(P(e).fontWeight)>=700)&&(n.bold=!0),Object.keys(n).length>0&&(t=T(t,n)),parseFloat(r.textIndent||0)>0&&(t=new s.default().insert(" ").concat(t)),t}],["li",function(e,t){var n=l.default.query(e);if(null==n||"list-item"!==n.blotName||!O(t,"\n"))return t;for(var r=-1,i=e.parentNode;!i.classList.contains("ql-clipboard");)"list"===(l.default.query(i)||{}).blotName&&(r+=1),i=i.parentNode;return r<=0?t:t.compose(new s.default().retain(t.length()-1).retain(1,{indent:r}))}],["b",I.bind(I,"bold")],["i",I.bind(I,"italic")],["style",function(){return new s.default}]],k=[h.AlignAttribute,g.DirectionAttribute].reduce(function(e,t){return e[t.keyName]=t,e},{}),_=[h.AlignStyle,f.BackgroundStyle,m.ColorStyle,g.DirectionStyle,y.FontStyle,v.SizeStyle].reduce(function(e,t){return e[t.keyName]=t,e},{}),E=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.root.addEventListener("paste",r.onPaste.bind(r)),r.container=r.quill.addContainer("ql-clipboard"),r.container.setAttribute("contenteditable",!0),r.container.setAttribute("tabindex",-1),r.matchers=[],S.concat(r.options.matchers).forEach(function(e){var t=i(e,2),a=t[0],o=t[1];(n.matchVisual||o!==N)&&r.addMatcher(a,o)}),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),a(t,[{key:"addMatcher",value:function(e,t){this.matchers.push([e,t])}},{key:"convert",value:function(e){if("string"==typeof e)return this.container.innerHTML=e.replace(/\>\r?\n +\</g,"><"),this.convert();var t=this.quill.getFormat(this.quill.selection.savedRange.index);if(t[p.default.blotName]){var n=this.container.innerText;return this.container.innerHTML="",new s.default().insert(n,x({},p.default.blotName,t[p.default.blotName]))}var r=i(this.prepareMatching(),2),a=r[0],o=r[1],l=function e(t,n,r){return t.nodeType===t.TEXT_NODE?r.reduce(function(e,n){return n(t,e)},new s.default):t.nodeType===t.ELEMENT_NODE?[].reduce.call(t.childNodes||[],function(i,a){var o=e(a,n,r);return a.nodeType===t.ELEMENT_NODE&&(o=n.reduce(function(e,t){return t(a,e)},o),o=(a[C]||[]).reduce(function(e,t){return t(a,e)},o)),i.concat(o)},new s.default):new s.default}(this.container,a,o);return O(l,"\n")&&null==l.ops[l.ops.length-1].attributes&&(l=l.compose(new s.default().retain(l.length()-1).delete(1))),w.log("convert",this.container.innerHTML,l),this.container.innerHTML="",l}},{key:"dangerouslyPasteHTML",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c.default.sources.API;if("string"==typeof e)this.quill.setContents(this.convert(e),t),this.quill.setSelection(0,c.default.sources.SILENT);else{var r=this.convert(t);this.quill.updateContents(new s.default().retain(e).concat(r),n),this.quill.setSelection(e+r.length(),c.default.sources.SILENT)}}},{key:"onPaste",value:function(e){var t=this;if(!e.defaultPrevented&&this.quill.isEnabled()){var n=this.quill.getSelection(),r=new s.default().retain(n.index),i=this.quill.scrollingContainer.scrollTop;this.container.focus(),this.quill.selection.update(c.default.sources.SILENT),setTimeout(function(){r=r.concat(t.convert()).delete(n.length),t.quill.updateContents(r,c.default.sources.USER),t.quill.setSelection(r.length()-n.length,c.default.sources.SILENT),t.quill.scrollingContainer.scrollTop=i,t.quill.focus()},1)}}},{key:"prepareMatching",value:function(){var e=this,t=[],n=[];return this.matchers.forEach(function(r){var a=i(r,2),o=a[0],s=a[1];switch(o){case Node.TEXT_NODE:n.push(s);break;case Node.ELEMENT_NODE:t.push(s);break;default:[].forEach.call(e.container.querySelectorAll(o),function(e){e[C]=e[C]||[],e[C].push(s)})}}),[t,n]}}]),t}(d.default);function T(e,t,n){return(void 0===t?"undefined":r(t))==="object"?Object.keys(t).reduce(function(e,n){return T(e,n,t[n])},e):e.reduce(function(e,r){return r.attributes&&r.attributes[t]?e.push(r):e.insert(r.insert,(0,o.default)({},x({},t,n),r.attributes))},new s.default)}function P(e){if(e.nodeType!==Node.ELEMENT_NODE)return{};var t="__ql-computed-style";return e[t]||(e[t]=window.getComputedStyle(e))}function O(e,t){for(var n="",r=e.ops.length-1;r>=0&&n.length<t.length;--r){var i=e.ops[r];if("string"!=typeof i.insert)break;n=i.insert+n}return n.slice(-1*t.length)===t}function A(e){return 0!==e.childNodes.length&&["block","list-item"].indexOf(P(e).display)>-1}function I(e,t,n){return T(n,e,!0)}function R(e,t){var n=l.default.Attributor.Attribute.keys(e),r=l.default.Attributor.Class.keys(e),i=l.default.Attributor.Style.keys(e),a={};return n.concat(r).concat(i).forEach(function(t){var n=l.default.query(t,l.default.Scope.ATTRIBUTE);null!=n&&(a[n.attrName]=n.value(e),a[n.attrName])||(null!=(n=k[t])&&(n.attrName===t||n.keyName===t)&&(a[n.attrName]=n.value(e)||void 0),null!=(n=_[t])&&(n.attrName===t||n.keyName===t)&&(a[(n=_[t]).attrName]=n.value(e)||void 0))}),Object.keys(a).length>0&&(t=T(t,a)),t}function L(e,t){var n=l.default.query(e);if(null==n)return t;if(n.prototype instanceof l.default.Embed){var r={},i=n.value(e);null!=i&&(r[n.blotName]=i,t=new s.default().insert(r,n.formats(e)))}else"function"==typeof n.formats&&(t=T(t,n.blotName,n.formats(e)));return t}function M(e,t){return!O(t,"\n")&&(A(e)||t.length()>0&&e.nextSibling&&A(e.nextSibling))&&t.insert("\n"),t}function N(e,t){if(A(e)&&null!=e.nextElementSibling&&!O(t,"\n\n")){var n=e.offsetHeight+parseFloat(P(e).marginTop)+parseFloat(P(e).marginBottom);e.nextElementSibling.offsetTop>e.offsetTop+1.5*n&&t.insert("\n")}return t}function j(e,t){var n=e.data;if("O:P"===e.parentNode.tagName)return t.insert(n.trim());if(0===n.trim().length&&e.parentNode.classList.contains("ql-clipboard"))return t;if(!P(e.parentNode).whiteSpace.startsWith("pre")){var r=function(e,t){return(t=t.replace(/[^\u00a0]/g,"")).length<1&&e?" ":t};n=(n=n.replace(/\r\n/g," ").replace(/\n/g," ")).replace(/\s\s+/g,r.bind(r,!0)),(null==e.previousSibling&&A(e.parentNode)||null!=e.previousSibling&&A(e.previousSibling))&&(n=n.replace(/^\s+/,r.bind(r,!1))),(null==e.nextSibling&&A(e.parentNode)||null!=e.nextSibling&&A(e.nextSibling))&&(n=n.replace(/\s+$/,r.bind(r,!1)))}return t.insert(n)}E.DEFAULTS={matchers:[],matchVisual:!0},t.default=E,t.matchAttributor=R,t.matchBlot=L,t.matchNewline=M,t.matchSpacing=N,t.matchText=j},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"optimize",value:function(e){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e),this.domNode.tagName!==this.statics.tagName[0]&&this.replaceWith(this.statics.blotName)}}],[{key:"create",value:function(){return a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this)}},{key:"formats",value:function(){return!0}}]),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);o.blotName="bold",o.tagName=["STRONG","B"],t.default=o},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.addControls=t.default=void 0;var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=u(n(2)),o=u(n(0)),s=u(n(5)),l=u(n(10)),c=u(n(9));function u(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}var h=(0,l.default)("quill:toolbar"),f=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var i,a=d(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if(Array.isArray(a.options.container)){var o=document.createElement("div");m(o,a.options.container),e.container.parentNode.insertBefore(o,e.container),a.container=o}else"string"==typeof a.options.container?a.container=document.querySelector(a.options.container):a.container=a.options.container;return a.container instanceof HTMLElement?(a.container.classList.add("ql-toolbar"),a.controls=[],a.handlers={},Object.keys(a.options.handlers).forEach(function(e){a.addHandler(e,a.options.handlers[e])}),[].forEach.call(a.container.querySelectorAll("button, select"),function(e){a.attach(e)}),a.quill.on(s.default.events.EDITOR_CHANGE,function(e,t){e===s.default.events.SELECTION_CHANGE&&a.update(t)}),a.quill.on(s.default.events.SCROLL_OPTIMIZE,function(){var e=r(a.quill.selection.getRange(),1)[0];a.update(e)}),a):(i=h.error("Container required for toolbar",a.options),d(a,i))}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"addHandler",value:function(e,t){this.handlers[e]=t}},{key:"attach",value:function(e){var t=this,n=[].find.call(e.classList,function(e){return 0===e.indexOf("ql-")});if(n){if(n=n.slice(3),"BUTTON"===e.tagName&&e.setAttribute("type","button"),null==this.handlers[n]){if(null!=this.quill.scroll.whitelist&&null==this.quill.scroll.whitelist[n])return void h.warn("ignoring attaching to disabled format",n,e);if(null==o.default.query(n))return void h.warn("ignoring attaching to nonexistent format",n,e)}var i="SELECT"===e.tagName?"change":"click";e.addEventListener(i,function(i){var l,c,u,d=void 0;if("SELECT"===e.tagName){if(e.selectedIndex<0)return;var h=e.options[e.selectedIndex];d=!h.hasAttribute("selected")&&(h.value||!1)}else d=!e.classList.contains("ql-active")&&(e.value||!e.hasAttribute("value")),i.preventDefault();t.quill.focus();var f=r(t.quill.selection.getRange(),1)[0];if(null!=t.handlers[n])t.handlers[n].call(t,d);else if(o.default.query(n).prototype instanceof o.default.Embed){if(!(d=prompt("Enter "+n)))return;t.quill.updateContents(new a.default().retain(f.index).delete(f.length).insert((l={},c=n,u=d,c in l?Object.defineProperty(l,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):l[c]=u,l)),s.default.sources.USER)}else t.quill.format(n,d,s.default.sources.USER);t.update(f)}),this.controls.push([n,e])}}},{key:"update",value:function(e){var t=null==e?{}:this.quill.getFormat(e);this.controls.forEach(function(n){var i=r(n,2),a=i[0],o=i[1];if("SELECT"===o.tagName){var s=void 0;if(null==e)s=null;else if(null==t[a])s=o.querySelector("option[selected]");else if(!Array.isArray(t[a])){var l=t[a];"string"==typeof l&&(l=l.replace(/\"/g,'\\"')),s=o.querySelector('option[value="'+l+'"]')}null==s?(o.value="",o.selectedIndex=-1):s.selected=!0}else if(null==e)o.classList.remove("ql-active");else if(o.hasAttribute("value")){var c=t[a]===o.getAttribute("value")||null!=t[a]&&t[a].toString()===o.getAttribute("value")||null==t[a]&&!o.getAttribute("value");o.classList.toggle("ql-active",c)}else o.classList.toggle("ql-active",null!=t[a])})}}]),t}(c.default);function p(e,t,n){var r=document.createElement("button");r.setAttribute("type","button"),r.classList.add("ql-"+t),null!=n&&(r.value=n),e.appendChild(r)}function m(e,t){Array.isArray(t[0])||(t=[t]),t.forEach(function(t){var n=document.createElement("span");n.classList.add("ql-formats"),t.forEach(function(e){if("string"==typeof e)p(n,e);else{var t,r,i,a,o=Object.keys(e)[0],s=e[o];Array.isArray(s)?(t=n,r=o,i=s,(a=document.createElement("select")).classList.add("ql-"+r),i.forEach(function(e){var t=document.createElement("option");!1!==e?t.setAttribute("value",e):t.setAttribute("selected","selected"),a.appendChild(t)}),t.appendChild(a)):p(n,o,s)}}),e.appendChild(n)})}f.DEFAULTS={},f.DEFAULTS={container:null,handlers:{clean:function(){var e=this,t=this.quill.getSelection();null!=t&&(0==t.length?Object.keys(this.quill.getFormat()).forEach(function(t){null!=o.default.query(t,o.default.Scope.INLINE)&&e.quill.format(t,!1)}):this.quill.removeFormat(t,s.default.sources.USER))},direction:function(e){var t=this.quill.getFormat().align;"rtl"===e&&null==t?this.quill.format("align","right",s.default.sources.USER):e||"right"!==t||this.quill.format("align",!1,s.default.sources.USER),this.quill.format("direction",e,s.default.sources.USER)},indent:function(e){var t=this.quill.getSelection(),n=this.quill.getFormat(t),r=parseInt(n.indent||0);if("+1"===e||"-1"===e){var i="+1"===e?1:-1;"rtl"===n.direction&&(i*=-1),this.quill.format("indent",r+i,s.default.sources.USER)}},link:function(e){!0===e&&(e=prompt("Enter link URL:")),this.quill.format("link",e,s.default.sources.USER)},list:function(e){var t=this.quill.getSelection(),n=this.quill.getFormat(t);"check"===e?"checked"===n.list||"unchecked"===n.list?this.quill.format("list",!1,s.default.sources.USER):this.quill.format("list","unchecked",s.default.sources.USER):this.quill.format("list",e,s.default.sources.USER)}}},t.default=f,t.addControls=m},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polyline class="ql-even ql-stroke" points="5 7 3 9 5 11"></polyline> <polyline class="ql-even ql-stroke" points="13 7 15 9 13 11"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>'},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)};t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.label.innerHTML=n,r.container.classList.add("ql-color-picker"),[].slice.call(r.container.querySelectorAll(".ql-picker-item"),0,7).forEach(function(e){e.classList.add("ql-primary")}),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"buildItem",value:function(e){var n=a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"buildItem",this).call(this,e);return n.style.backgroundColor=e.getAttribute("value")||"",n}},{key:"selectItem",value:function(e,n){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,n);var r=this.label.querySelector(".ql-color-label"),i=e&&e.getAttribute("data-value")||"";r&&("line"===r.tagName?r.style.stroke=i:r.style.fill=i)}}]),t}(((r=n(28))&&r.__esModule?r:{default:r}).default)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)};t.default=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(e,n){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var r=function(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.container.classList.add("ql-icon-picker"),[].forEach.call(r.container.querySelectorAll(".ql-picker-item"),function(e){e.innerHTML=n[e.getAttribute("data-value")||""]}),r.defaultItem=r.container.querySelector(".ql-selected"),r.selectItem(r.defaultItem),r}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"selectItem",value:function(e,n){a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"selectItem",this).call(this,e,n),e=e||this.defaultItem,this.label.innerHTML=e.innerHTML}}]),t}(((r=n(28))&&r.__esModule?r:{default:r}).default)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.default=function(){function e(t,n){var r=this;if(!(this instanceof e))throw TypeError("Cannot call a class as a function");this.quill=t,this.boundsContainer=n||document.body,this.root=t.addContainer("ql-tooltip"),this.root.innerHTML=this.constructor.TEMPLATE,this.quill.root===this.quill.scrollingContainer&&this.quill.root.addEventListener("scroll",function(){r.root.style.marginTop=-1*r.quill.root.scrollTop+"px"}),this.hide()}return r(e,[{key:"hide",value:function(){this.root.classList.add("ql-hidden")}},{key:"position",value:function(e){var t=e.left+e.width/2-this.root.offsetWidth/2,n=e.bottom+this.quill.root.scrollTop;this.root.style.left=t+"px",this.root.style.top=n+"px",this.root.classList.remove("ql-flip");var r=this.boundsContainer.getBoundingClientRect(),i=this.root.getBoundingClientRect(),a=0;if(i.right>r.right&&(a=r.right-i.right,this.root.style.left=t+a+"px"),i.left<r.left&&(a=r.left-i.left,this.root.style.left=t+a+"px"),i.bottom>r.bottom){var o=i.bottom-i.top,s=e.bottom-e.top+o;this.root.style.top=n-s+"px",this.root.classList.add("ql-flip")}return a}},{key:"show",value:function(){this.root.classList.remove("ql-editing"),this.root.classList.remove("ql-hidden")}}]),e}()},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw a}}return n}(e,t);throw TypeError("Invalid attempt to destructure non-iterable instance")},i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=f(n(3)),s=f(n(8)),l=n(43),c=f(l),u=f(n(27)),d=n(15),h=f(n(41));function f(e){return e&&e.__esModule?e:{default:e}}function p(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function m(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function g(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var y=[[{header:["1","2","3",!1]}],["bold","italic","underline","link"],[{list:"ordered"},{list:"bullet"}],["clean"]],v=function(e){function t(e,n){p(this,t),null!=n.modules.toolbar&&null==n.modules.toolbar.container&&(n.modules.toolbar.container=y);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.container.classList.add("ql-snow"),r}return g(t,e),a(t,[{key:"extendToolbar",value:function(e){e.container.classList.add("ql-snow"),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),h.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),h.default),this.tooltip=new b(this.quill,this.options.bounds),e.container.querySelector(".ql-link")&&this.quill.keyboard.addBinding({key:"K",shortKey:!0},function(t,n){e.handlers.link.call(e,!n.format.link)})}}]),t}(c.default);v.DEFAULTS=(0,o.default)(!0,{},c.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){if(e){var t=this.quill.getSelection();if(null!=t&&0!=t.length){var n=this.quill.getText(t);/^\S+@\S+\.\S+$/.test(n)&&0!==n.indexOf("mailto:")&&(n="mailto:"+n),this.quill.theme.tooltip.edit("link",n)}}else this.quill.format("link",!1)}}}}});var b=function(e){function t(e,n){p(this,t);var r=m(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.preview=r.root.querySelector("a.ql-preview"),r}return g(t,e),a(t,[{key:"listen",value:function(){var e=this;i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector("a.ql-action").addEventListener("click",function(t){e.root.classList.contains("ql-editing")?e.save():e.edit("link",e.preview.textContent),t.preventDefault()}),this.root.querySelector("a.ql-remove").addEventListener("click",function(t){if(null!=e.linkRange){var n=e.linkRange;e.restoreFocus(),e.quill.formatText(n,"link",!1,s.default.sources.USER),delete e.linkRange}t.preventDefault(),e.hide()}),this.quill.on(s.default.events.SELECTION_CHANGE,function(t,n,i){if(null!=t){if(0===t.length&&i===s.default.sources.USER){var a=r(e.quill.scroll.descendant(u.default,t.index),2),o=a[0],l=a[1];if(null!=o){e.linkRange=new d.Range(t.index-l,o.length());var c=u.default.formats(o.domNode);e.preview.textContent=c,e.preview.setAttribute("href",c),e.show(),e.position(e.quill.getBounds(e.linkRange));return}}else delete e.linkRange;e.hide()}})}},{key:"show",value:function(){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"show",this).call(this),this.root.removeAttribute("data-mode")}}]),t}(l.BaseTooltip);b.TEMPLATE='<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a><input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL"><a class="ql-action"></a><a class="ql-remove"></a>',t.default=v},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=N(n(29)),i=n(36),a=n(38),o=n(64),s=N(n(65)),l=N(n(66)),c=n(67),u=N(c),d=n(37),h=n(26),f=n(39),p=n(40),m=N(n(56)),g=N(n(68)),y=N(n(27)),v=N(n(69)),b=N(n(70)),x=N(n(71)),w=N(n(72)),C=N(n(73)),S=n(13),k=N(S),_=N(n(74)),E=N(n(75)),T=N(n(57)),P=N(n(41)),O=N(n(28)),A=N(n(59)),I=N(n(60)),R=N(n(61)),L=N(n(108)),M=N(n(62));function N(e){return e&&e.__esModule?e:{default:e}}r.default.register({"attributors/attribute/direction":a.DirectionAttribute,"attributors/class/align":i.AlignClass,"attributors/class/background":d.BackgroundClass,"attributors/class/color":h.ColorClass,"attributors/class/direction":a.DirectionClass,"attributors/class/font":f.FontClass,"attributors/class/size":p.SizeClass,"attributors/style/align":i.AlignStyle,"attributors/style/background":d.BackgroundStyle,"attributors/style/color":h.ColorStyle,"attributors/style/direction":a.DirectionStyle,"attributors/style/font":f.FontStyle,"attributors/style/size":p.SizeStyle},!0),r.default.register({"formats/align":i.AlignClass,"formats/direction":a.DirectionClass,"formats/indent":o.IndentClass,"formats/background":d.BackgroundStyle,"formats/color":h.ColorStyle,"formats/font":f.FontClass,"formats/size":p.SizeClass,"formats/blockquote":s.default,"formats/code-block":k.default,"formats/header":l.default,"formats/list":u.default,"formats/bold":m.default,"formats/code":S.Code,"formats/italic":g.default,"formats/link":y.default,"formats/script":v.default,"formats/strike":b.default,"formats/underline":x.default,"formats/image":w.default,"formats/video":C.default,"formats/list/item":c.ListItem,"modules/formula":_.default,"modules/syntax":E.default,"modules/toolbar":T.default,"themes/bubble":L.default,"themes/snow":M.default,"ui/icons":P.default,"ui/picker":O.default,"ui/icon-picker":I.default,"ui/color-picker":A.default,"ui/tooltip":R.default},!0),t.default=r.default},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.IndentClass=void 0;var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r};t.IndentClass=new(function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"add",value:function(e,n){if("+1"===n||"-1"===n){var r=this.value(e)||0;n="+1"===n?r+1:r-1}return 0===n?(this.remove(e),!0):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"add",this).call(this,e,n)}},{key:"canAdd",value:function(e,n){return a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,n)||a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"canAdd",this).call(this,e,parseInt(n))}},{key:"value",value:function(e){return parseInt(a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"value",this).call(this,e))||void 0}}]),t}(o.default.Attributor.Class))("indent","ql-indent",{scope:o.default.Scope.BLOCK,whitelist:[1,2,3,4,5,6,7,8]})},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(4))&&r.__esModule?r:{default:r}).default);i.blotName="blockquote",i.tagName="blockquote",t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,null,[{key:"formats",value:function(e){return this.tagName.indexOf(e.tagName)+1}}]),t}(((r=n(4))&&r.__esModule?r:{default:r}).default);a.blotName="header",a.tagName=["H1","H2","H3","H4","H5","H6"],t.default=a},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.ListItem=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=l(n(0)),o=l(n(4)),s=l(n(25));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),r(t,[{key:"format",value:function(e,n){e!==f.blotName||n?i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n):this.replaceWith(a.default.create(this.statics.scope))}},{key:"remove",value:function(){null==this.prev&&null==this.next?this.parent.remove():i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"remove",this).call(this)}},{key:"replaceWith",value:function(e,n){return(this.parent.isolate(this.offset(this.parent),this.length()),e===this.parent.statics.blotName)?(this.parent.replaceWith(e,n),this):(this.parent.unwrap(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e,n))}}],[{key:"formats",value:function(e){return e.tagName===this.tagName?void 0:i(t.__proto__||Object.getPrototypeOf(t),"formats",this).call(this,e)}}]),t}(o.default);h.blotName="list-item",h.tagName="LI";var f=function(e){function t(e){c(this,t);var n=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=function(t){if(t.target.parentNode===e){var r=n.statics.formats(e),i=a.default.find(t.target);"checked"===r?i.format("list","unchecked"):"unchecked"===r&&i.format("list","checked")}};return e.addEventListener("touchstart",r),e.addEventListener("mousedown",r),n}return d(t,e),r(t,null,[{key:"create",value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,"ordered"===e?"OL":"UL");return("checked"===e||"unchecked"===e)&&n.setAttribute("data-checked","checked"===e),n}},{key:"formats",value:function(e){if("OL"===e.tagName)return"ordered";if("UL"===e.tagName)if(e.hasAttribute("data-checked"))return"true"===e.getAttribute("data-checked")?"checked":"unchecked";else return"bullet"}}]),r(t,[{key:"format",value:function(e,t){this.children.length>0&&this.children.tail.format(e,t)}},{key:"formats",value:function(){var e,t,n;return e={},t=this.statics.blotName,n=this.statics.formats(this.domNode),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},{key:"insertBefore",value:function(e,n){if(e instanceof h)i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"insertBefore",this).call(this,e,n);else{var r=null==n?this.length():n.offset(this),a=this.split(r);a.parent.insertBefore(e,a)}}},{key:"optimize",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"optimize",this).call(this,e);var n=this.next;null!=n&&n.prev===this&&n.statics.blotName===this.statics.blotName&&n.domNode.tagName===this.domNode.tagName&&n.domNode.getAttribute("data-checked")===this.domNode.getAttribute("data-checked")&&(n.moveChildren(this),n.remove())}},{key:"replace",value:function(e){if(e.statics.blotName!==this.statics.blotName){var n=a.default.create(this.statics.defaultChild);e.moveChildren(n),this.appendChild(n)}i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replace",this).call(this,e)}}]),t}(s.default);f.blotName="list",f.scope=a.default.Scope.BLOCK_BLOT,f.tagName=["OL","UL"],f.defaultChild="list-item",f.allowedChildren=[h],t.ListItem=h,t.default=f},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(56))&&r.__esModule?r:{default:r}).default);i.blotName="italic",i.tagName=["EM","I"],t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,null,[{key:"create",value:function(e){return"super"===e?document.createElement("sup"):"sub"===e?document.createElement("sub"):a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e)}},{key:"formats",value:function(e){return"SUB"===e.tagName?"sub":"SUP"===e.tagName?"super":void 0}}]),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);o.blotName="script",o.tagName=["SUB","SUP"],t.default=o},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);i.blotName="strike",i.tagName="S",t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),t}(((r=n(6))&&r.__esModule?r:{default:r}).default);i.blotName="underline",i.tagName="U",t.default=i},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=(r=n(0))&&r.__esModule?r:{default:r},s=n(27),l=["alt","height","width"],c=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"format",value:function(e,n){l.indexOf(e)>-1?n?this.domNode.setAttribute(e,n):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n)}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&n.setAttribute("src",this.sanitize(e)),n}},{key:"formats",value:function(e){return l.reduce(function(t,n){return e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t},{})}},{key:"match",value:function(e){return/\.(jpe?g|gif|png)$/.test(e)||/^data:image\/.+;base64/.test(e)}},{key:"sanitize",value:function(e){return(0,s.sanitize)(e,["http","https","data"])?e:"//:0"}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(o.default.Embed);c.blotName="image",c.tagName="IMG",t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r,i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},o=n(4),s=(r=n(27))&&r.__esModule?r:{default:r},l=["height","width"],c=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function, not "+typeof e);function t(){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");var e=(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments);if(!this)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e&&("object"==typeof e||"function"==typeof e)?e:this}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e),i(t,[{key:"format",value:function(e,n){l.indexOf(e)>-1?n?this.domNode.setAttribute(e,n):this.domNode.removeAttribute(e):a(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"format",this).call(this,e,n)}}],[{key:"create",value:function(e){var n=a(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return n.setAttribute("frameborder","0"),n.setAttribute("allowfullscreen",!0),n.setAttribute("src",this.sanitize(e)),n}},{key:"formats",value:function(e){return l.reduce(function(t,n){return e.hasAttribute(n)&&(t[n]=e.getAttribute(n)),t},{})}},{key:"sanitize",value:function(e){return s.default.sanitize(e)}},{key:"value",value:function(e){return e.getAttribute("src")}}]),t}(o.BlockEmbed);c.blotName="video",c.className="ql-video",c.tagName="IFRAME",t.default=c},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.FormulaBlot=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=l(n(35)),o=l(n(5)),s=l(n(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),r(t,null,[{key:"create",value:function(e){var n=i(t.__proto__||Object.getPrototypeOf(t),"create",this).call(this,e);return"string"==typeof e&&(window.katex.render(e,n,{throwOnError:!1,errorColor:"#f00"}),n.setAttribute("data-value",e)),n}},{key:"value",value:function(e){return e.getAttribute("data-value")}}]),t}(a.default);h.blotName="formula",h.className="ql-formula",h.tagName="SPAN";var f=function(e){function t(){c(this,t);var e=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(null==window.katex)throw Error("Formula module requires KaTeX.");return e}return d(t,e),r(t,null,[{key:"register",value:function(){o.default.register(h,!0)}}]),t}(s.default);t.FormulaBlot=h,t.default=f},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.CodeToken=t.CodeBlock=void 0;var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},a=l(n(0)),o=l(n(5)),s=l(n(9));function l(e){return e&&e.__esModule?e:{default:e}}function c(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function d(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var h=function(e){function t(){return c(this,t),u(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return d(t,e),r(t,[{key:"replaceWith",value:function(e){this.domNode.textContent=this.domNode.textContent,this.attach(),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"replaceWith",this).call(this,e)}},{key:"highlight",value:function(e){var t=this.domNode.textContent;this.cachedText!==t&&((t.trim().length>0||null==this.cachedText)&&(this.domNode.innerHTML=e(t),this.domNode.normalize(),this.attach()),this.cachedText=t)}}]),t}(l(n(13)).default);h.className="ql-syntax";var f=new a.default.Attributor.Class("token","hljs",{scope:a.default.Scope.INLINE}),p=function(e){function t(e,n){c(this,t);var r=u(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));if("function"!=typeof r.options.highlight)throw Error("Syntax module requires highlight.js. Please include the library on the page before Quill.");var i=null;return r.quill.on(o.default.events.SCROLL_OPTIMIZE,function(){clearTimeout(i),i=setTimeout(function(){r.highlight(),i=null},r.options.interval)}),r.highlight(),r}return d(t,e),r(t,null,[{key:"register",value:function(){o.default.register(f,!0),o.default.register(h,!0)}}]),r(t,[{key:"highlight",value:function(){var e=this;if(!this.quill.selection.composing){this.quill.update(o.default.sources.USER);var t=this.quill.getSelection();this.quill.scroll.descendants(h).forEach(function(t){t.highlight(e.options.highlight)}),this.quill.update(o.default.sources.SILENT),null!=t&&this.quill.setSelection(t,o.default.sources.SILENT)}}}]),t}(s.default);p.DEFAULTS={highlight:null==window.hljs?null:function(e){return window.hljs.highlightAuto(e).value},interval:1e3},t.CodeBlock=h,t.CodeToken=f,t.default=p},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <g class="ql-fill ql-color-label"> <polygon points="6 6.868 6 6 5 6 5 7 5.942 7 6 6.868"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points="6.817 5 6 5 6 6 6.38 6 6.817 5"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points="4 11.439 4 11 3 11 3 12 3.755 12 4 11.439"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points="4.63 10 4 10 4 11 4.192 11 4.63 10"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points="13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points="12 6.868 12 6 11.62 6 12 6.868"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points="12.933 9 13 9 13 8 12.495 8 12.933 9"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points="5.5 13 9 5 12.5 13"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class="ql-fill ql-stroke" height=3 width=3 x=4 y=5></rect> <rect class="ql-fill ql-stroke" height=3 width=3 x=11 y=5></rect> <path class="ql-even ql-fill ql-stroke" d=M7,8c0,4.031-3,5-3,5></path> <path class="ql-even ql-fill ql-stroke" d=M14,8c0,4.031-3,5-3,5></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-color-label ql-stroke ql-transparent" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points="5.5 11 9 3 12.5 11"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="3 11 5 9 3 7 3 11"></polygon> <line class="ql-stroke ql-fill" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class="ql-stroke ql-fill" points="15 12 13 10 15 8 15 12"></polygon> <line class="ql-stroke ql-fill" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform="translate(24 18) rotate(-180)"/> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>'},function(e,t){e.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>'},function(e,t){e.exports='<svg viewBox="0 0 18 18"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class="ql-even ql-fill" points="5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class="ql-fill ql-stroke" points="3 7 3 11 5 9 3 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="5 7 5 11 3 9 5 7"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class="ql-even ql-stroke" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class="ql-even ql-stroke" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class="ql-stroke ql-thin" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class="ql-stroke ql-thin" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class="ql-stroke ql-thin" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>'},function(e,t){e.exports='<svg class="" viewbox="0 0 18 18"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points="3 4 4 5 6 3"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points="3 14 4 15 6 13"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points="3 9 4 10 6 8"></polyline> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <line class="ql-stroke ql-thin" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>'},function(e,t){e.exports='<svg viewbox="0 0 18 18"> <polygon class=ql-stroke points="7 11 9 13 11 11 7 11"></polygon> <polygon class=ql-stroke points="7 7 9 5 11 7 7 7"></polygon> </svg>'},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.BubbleTooltip=void 0;var r=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var a=Object.getPrototypeOf(t);if(null===a)return;return e(a,n,r)}if("value"in i)return i.value;var o=i.get;if(void 0!==o)return o.call(r)},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=d(n(3)),o=d(n(8)),s=n(43),l=d(s),c=n(15),u=d(n(41));function d(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}function f(e,t){if(!e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&("object"==typeof t||"function"==typeof t)?t:e}function p(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var m=[["bold","italic","link"],[{header:1},{header:2},"blockquote"]],g=function(e){function t(e,n){h(this,t),null!=n.modules.toolbar&&null==n.modules.toolbar.container&&(n.modules.toolbar.container=m);var r=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.container.classList.add("ql-bubble"),r}return p(t,e),i(t,[{key:"extendToolbar",value:function(e){this.tooltip=new y(this.quill,this.options.bounds),this.tooltip.root.appendChild(e.container),this.buildButtons([].slice.call(e.container.querySelectorAll("button")),u.default),this.buildPickers([].slice.call(e.container.querySelectorAll("select")),u.default)}}]),t}(l.default);g.DEFAULTS=(0,a.default)(!0,{},l.default.DEFAULTS,{modules:{toolbar:{handlers:{link:function(e){e?this.quill.theme.tooltip.edit():this.quill.format("link",!1)}}}}});var y=function(e){function t(e,n){h(this,t);var r=f(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return r.quill.on(o.default.events.EDITOR_CHANGE,function(e,t,n,i){if(e===o.default.events.SELECTION_CHANGE)if(null!=t&&t.length>0&&i===o.default.sources.USER){r.show(),r.root.style.left="0px",r.root.style.width="",r.root.style.width=r.root.offsetWidth+"px";var a=r.quill.getLines(t.index,t.length);if(1===a.length)r.position(r.quill.getBounds(t));else{var s=a[a.length-1],l=r.quill.getIndex(s),u=Math.min(s.length()-1,t.index+t.length-l),d=r.quill.getBounds(new c.Range(l,u));r.position(d)}}else document.activeElement!==r.textbox&&r.quill.hasFocus()&&r.hide()}),r}return p(t,e),i(t,[{key:"listen",value:function(){var e=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"listen",this).call(this),this.root.querySelector(".ql-close").addEventListener("click",function(){e.root.classList.remove("ql-editing")}),this.quill.on(o.default.events.SCROLL_OPTIMIZE,function(){setTimeout(function(){if(!e.root.classList.contains("ql-hidden")){var t=e.quill.getSelection();null!=t&&e.position(e.quill.getBounds(t))}},1)})}},{key:"cancel",value:function(){this.show()}},{key:"position",value:function(e){var n=r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"position",this).call(this,e),i=this.root.querySelector(".ql-tooltip-arrow");if(i.style.marginLeft="",0===n)return n;i.style.marginLeft=-1*n-i.offsetWidth/2+"px"}}]),t}(s.BaseTooltip);y.TEMPLATE='<span class="ql-tooltip-arrow"></span><div class="ql-tooltip-editor"><input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL"><a class="ql-close"></a></div>',t.BubbleTooltip=y,t.default=g},function(e,t,n){e.exports=n(63)}]).default;var E=x("2SBKn"),os={};Nq=os,NW=function(e,t,n,r){var i,a,o,s,l,c,u,d,h,f,p,m,g,y,v,b,x,w,C,S,k,_,E,T,P,O,A,I,R,L,M,N,j,D,z,B,F,H,V,U,$,q,W,G,K,Y,X,Q,Z,J,ee,et=(a=[],(i={}).joinUrl=function(t,n){return t?e.resolve(t,n):n},i.getConstantUniqueIdFor=function(e){return 0>a.indexOf(e)&&a.push(e),a.indexOf(e)},i.clone=function(e){var t,n={};for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n},o=function(e){return"object"==typeof e&&null!==e&&Object.prototype.toString.apply(e).match(/\[object (Canvas|HTMLCanvasElement|OffscreenCanvas)\]/i)},i.parseOptionalParameters=function(e){var t={canvas:null,options:{}};return null==e[0]||o(e[0])?(t.canvas=e[0]||null,t.options=i.clone(e[1])):t.options=i.clone(e[0]),t},i),en=(s={},l=function(e,t,n){var r=e[t];return e[t]=function(){var e=Array.prototype.slice.call(arguments);return n.apply(this,[e,r])},r},s.baseUrlRespectingXhr=function(e,t){return function(){var n=new e;return l(n,"open",function(e,n){var r=e.shift(),i=e.shift(),a=et.joinUrl(t,i);return n.apply(this,[r,a].concat(e))}),n}},s.finishNotifyingXhr=function(e){var t,n=0,r=0,i=!1,a=new Promise(function(e){t=function(){n-r<=0&&i&&e({totalCount:n})}}),o=function(){var i=new e;return l(i,"send",function(e,t){return n+=1,t.apply(this,arguments)}),i.addEventListener("load",function(){r+=1,t()}),i};return o.waitForRequestsToFinish=function(){return i=!0,t(),a},o},s),er=(c={},u=function(e){return Array.prototype.slice.call(e)},c.addClassName=function(e,t){e.className+=" "+t},c.addClassNameRecursively=function(e,t){c.addClassName(e,t),e.parentNode!==e.ownerDocument&&c.addClassNameRecursively(e.parentNode,t)},d=function(e,t){var n=e.parentStyleSheet,r=u(n.cssRules).indexOf(e);n.insertRule(t,r+1),n.deleteRule(r)},h=function(e,t){var n=e.cssText.replace(/^[^\{]+/,"");d(e,t+" "+n)},f=function(e){e.textContent=u(e.sheet.cssRules).reduce(function(e,t){return e+t.cssText},"")},p=function(e){var t=document.implementation.createHTMLDocument(""),n=document.createElement("style");n.textContent=e.textContent,t.body.appendChild(n),e.sheet=n.sheet},m=function(e,t,n){var r="((?:^|[^.#:\\w])|(?=\\W))("+t.join("|")+")(?=\\W|$)";u(e.querySelectorAll("style")).forEach(function(e){void 0===e.sheet&&p(e);var t=u(e.sheet.cssRules).filter(function(e){return e.selectorText&&RegExp(r,"i").test(e.selectorText)});t.length&&(t.forEach(function(e){var t=e.selectorText.replace(RegExp(r,"gi"),function(e,t,r){return t+n(r)});t!==e.selectorText&&h(e,t)}),f(e))})},c.rewriteCssSelectorWith=function(e,t,n){m(e,[t],function(){return n})},c.lowercaseCssTypeSelectors=function(e,t){m(e,t,function(e){return e.toLowerCase()})},c.findHtmlOnlyNodeNames=function(e){var t,n=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT),r={},i={};do t=n.currentNode.tagName.toLowerCase(),"http://www.w3.org/1999/xhtml"===n.currentNode.namespaceURI?r[t]=!0:i[t]=!0;while(n.nextNode())return Object.keys(r).filter(function(e){return!i[e]})},g=c,y={},v=function(e){return Array.prototype.slice.call(e)},b={active:!0,hover:!0,focus:!1,target:!1},y.fakeUserAction=function(e,t,n){var r=e.querySelector(t),i="rasterizehtml"+n;r&&(b[n]?g.addClassNameRecursively(r,i):g.addClassName(r,i),g.rewriteCssSelectorWith(e,":"+n,"."+i))},y.persistInputValues=function(e){var t=e.querySelectorAll("input"),n=e.querySelectorAll("textarea"),r=function(e){return"checkbox"===e.type||"radio"===e.type};v(t).filter(r).forEach(function(e){e.checked?e.setAttribute("checked",""):e.removeAttribute("checked")}),v(t).filter(function(e){return!r(e)}).forEach(function(e){e.setAttribute("value",e.value)}),v(n).forEach(function(e){e.textContent=e.value})},y.rewriteTagNameSelectorsToLowerCase=function(e){g.lowercaseCssTypeSelectors(e,g.findHtmlOnlyNodeNames(e))},y),ei=(x=window,w={},C=function(e,t,n,r){var i=e.createElement(t);return i.style.visibility="hidden",i.style.width=n+"px",i.style.height=r+"px",i.style.position="absolute",i.style.top=-1e4-r+"px",i.style.left=-1e4-n+"px",e.getElementsByTagName("body")[0].appendChild(i),i},w.executeJavascript=function(e,t){return new Promise(function(n){var r=C(x.document,"iframe",t.width,t.height),i=e.outerHTML,a=[],o=t.executeJsTimeout||0,s=function(){x.document.getElementsByTagName("body")[0].removeChild(r)},l=function(){n({document:r.contentDocument,errors:a,cleanUp:s})},c=r.contentWindow.XMLHttpRequest,u=en.finishNotifyingXhr(c),d=en.baseUrlRespectingXhr(u,t.baseUrl);r.onload=function(){(o>0?new Promise(function(e){setTimeout(e,o)}):Promise.resolve()).then(u.waitForRequestsToFinish).then(l)},r.contentDocument.open(),r.contentWindow.XMLHttpRequest=d,r.contentWindow.onerror=function(e){a.push({resourceType:"scriptExecution",msg:e})},r.contentDocument.write("<!DOCTYPE html>"),r.contentDocument.write(i),r.contentDocument.close()})},S=function(e,t,n){var r=e.createElement("iframe");return r.style.width=t+"px",r.style.height=n+"px",r.style.visibility="hidden",r.style.position="absolute",r.style.top=-1e4-n+"px",r.style.left=-1e4-t+"px",r.style.borderWidth=0,r.sandbox="allow-same-origin",r.scrolling="no",r},k=function(e,t,n){var r=Math.floor(e/n),i=Math.floor(t/n);return S(x.document,r,i)},_=function(e,t){var n=e.querySelector(t);if(n)return n;if(e.ownerDocument.querySelector(t)===e)return e;throw{message:"Clipping selector not found"}},E=function(e,t,n,r,i){var a,o,s,l,c,u,d,h,f=Math.max(e.scrollWidth,e.clientWidth),p=Math.max(e.scrollHeight,e.clientHeight);return t?(o=(d=_(e,t).getBoundingClientRect()).top,s=d.left,l=d.width,c=d.height):(o=0,s=0,l=f,c=p),h={width:Math.max((a={width:l,height:c}).width*i,n),height:Math.max(a.height*i,r)},u=x.getComputedStyle(e.ownerDocument.documentElement).fontSize,{left:s,top:o,width:h.width,height:h.height,viewportWidth:f,viewportHeight:p,rootFontSize:u}},T=function(e,t){var n=e.tagName;return t.querySelector(n)},P=function(e){var t=e.tagName.toLowerCase();return"html"===t||"body"===t?e.outerHTML:'<body style="margin: 0;">'+e.outerHTML+"</body>"},w.calculateDocumentContentSize=function(e,t){return new Promise(function(n,r){var i,a=t.zoom||1;i=k(t.width,t.height,a),x.document.getElementsByTagName("body")[0].appendChild(i),i.onload=function(){var o,s=i.contentDocument;try{o=E(T(e,s),t.clip,t.width,t.height,a),n(o)}catch(e){r(e)}finally{x.document.getElementsByTagName("body")[0].removeChild(i)}},i.contentDocument.open(),i.contentDocument.write("<!DOCTYPE html>"),i.contentDocument.write(P(e)),i.contentDocument.close()})},w.parseHtmlFragment=function(e){var t=x.document.implementation.createHTMLDocument("");t.documentElement.innerHTML=e;var n=t.querySelector("body").firstChild;if(!n)throw"Invalid source";return n},O=function(e,t){var n,r,i,a,o=/<html((?:\s+[^>]*)?)>/im.exec(t),s=x.document.implementation.createHTMLDocument("");if(o)for(r=0,n="<div"+o[1]+"></div>",s.documentElement.innerHTML=n,i=s.querySelector("div");r<i.attributes.length;r++)a=i.attributes[r],e.documentElement.setAttribute(a.name,a.value)},w.parseHTML=function(e){var t=x.document.implementation.createHTMLDocument("");return t.documentElement.innerHTML=e,O(t,e),t},A=function(e){try{return n.failOnParseError(e)}catch(e){throw{message:"Invalid source",originalError:e}}},w.validateXHTML=function(e){A(new DOMParser().parseFromString(e,"application/xml"))},I=null,w.loadDocument=function(e,t){return new Promise(function(n,r){var i,a,o=new window.XMLHttpRequest,s=(i=et.joinUrl(t.baseUrl,e),"none"===(a=t.cache)||"repeated"===a?((null===I||"repeated"!==a)&&(I=Date.now()),i+"?_="+I):i),l=function(e){r({message:"Unable to load page",originalError:e})};o.addEventListener("load",function(){200===o.status||0===o.status?n(o.responseXML):l(o.statusText)},!1),o.addEventListener("error",function(e){l(e)},!1);try{o.open("GET",s,!0),o.responseType="document",o.send(null)}catch(e){l(e)}}).then(function(e){return A(e)})},w),ea=(window,L={},M=function(e,t){return t?URL.createObjectURL(new Blob([e],{type:"image/svg+xml"})):"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(e)},N=function(e){e instanceof Blob&&URL.revokeObjectURL(e)},j='<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"><foreignObject></foreignObject></svg>',D=function(e){return new Promise(function(t,n){var r=document.createElement("canvas"),i=new Image;i.onload=function(){var e=r.getContext("2d");try{e.drawImage(i,0,0),r.toDataURL("image/png"),t(!0)}catch(e){t(!1)}},i.onerror=n,i.src=e})},z=function(){var e=M(j,!0);return D(e).then(function(t){return N(e),!t&&D(M(j,!1)).then(function(e){return e})},function(){return!1})},L.renderSvg=function(e){return new Promise(function(t,n){var r,i,a=function(){i.onload=null,i.onerror=null},o=function(){r&&N(r)};(i=new Image).onload=function(){a(),o(),t(i)},i.onerror=function(){o(),n()},(void 0===R&&(R=new Promise(function(e,t){z().then(function(t){e(!t)},function(){t()})})),R).then(function(t){return M(e,t)}).then(function(e){r=e,i.src=r},n)})},L),eo=(B={},F=function(e,t){var n=t||1,r={width:e.width,height:e.height,"font-size":e.rootFontSize};return 1!==n&&(r.style="transform:scale("+n+"); transform-origin: 0 0;"),r},H=function(e){var t,n;return t=Math.round(e.viewportWidth),n=Math.round(e.viewportHeight),{x:-e.left,y:-e.top,width:t,height:n}},V=function(e){var t=e.style||"";e.style=t+"float: left;"},U=function(e){e.externalResourcesRequired=!0},$=function(e){var t=Object.keys(e);return t.length?" "+t.map(function(t){return t+'="'+e[t]+'"'}).join(" "):""},q=function(e,n,r){var i=t.serializeToString(e);ei.validateXHTML(i);var a=H(n);return V(a),U(a),'<svg xmlns="http://www.w3.org/2000/svg"'+$(F(n,r))+'><style scoped="">html::-webkit-scrollbar { display: none; }</style><foreignObject'+$(a)+">"+i+"</foreignObject></svg>"},B.getSvgForDocument=function(e,t,n){return er.rewriteTagNameSelectorsToLowerCase(e),q(e,t,n)},B.drawDocumentAsSvg=function(e,t){return["hover","active","focus","target"].forEach(function(n){t[n]&&er.fakeUserAction(e,t[n],n)}),ei.calculateDocumentContentSize(e,t).then(function(n){return B.getSvgForDocument(e,n,t.zoom)})},B),es=(W={},G=function(e){return{message:"Error rendering page",originalError:e}},K=function(e){return ea.renderSvg(e).then(function(t){return{image:t,svg:e}},function(e){throw G(e)})},Y=function(e,t){try{t.getContext("2d").drawImage(e,0,0)}catch(e){throw G(e)}},W.rasterize=function(e,t,n){var i;return(i=et.clone(n)).inlineScripts=!0===n.executeJs,r.inlineReferences(e,i).then(function(t){return n.executeJs?ei.executeJavascript(e,n).then(function(e){var t=e.document;return er.persistInputValues(t),{document:t,errors:e.errors,cleanUp:e.cleanUp}}).then(function(e){return{element:e.document.documentElement,errors:t.concat(e.errors),cleanUp:e.cleanUp}}):{element:e,errors:t,cleanUp:function(){}}}).then(function(e){var r;return(r=e.element,eo.drawDocumentAsSvg(r,n).then(K).then(function(e){return t&&Y(e.image,t),e})).then(function(t){return e.cleanUp(),{image:t.image,svg:t.svg,errors:e.errors}})})},W);return X={},Q=function(e,t){var n=e?e.width:300,r=e?e.height:200;return{width:void 0!==t.width?t.width:n,height:void 0!==t.height?t.height:r}},Z=function(e){var t,n=Q(e.canvas,e.options);return(t=et.clone(e.options)).width=n.width,t.height=n.height,t},X.drawDocument=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=et.parseOptionalParameters(t),r=e.documentElement?e.documentElement:e;return es.rasterize(r,n.canvas,Z(n))},J=function(e,t,n){var r=ei.parseHTML(e);return X.drawDocument(r,t,n)},X.drawHTML=function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1),n=et.parseOptionalParameters(t);return J(e,n.canvas,n.options)},ee=function(e,t,n){var r=document.implementation.createHTMLDocument("");r.replaceChild(e.documentElement,r.documentElement);var i=n?et.clone(n):{};return n.baseUrl||(i.baseUrl=t),{document:r,options:i}},X.drawURL=function(){var e,t,n=arguments[0],r=Array.prototype.slice.call(arguments,1),i=et.parseOptionalParameters(r);return e=i.canvas,t=i.options,ei.loadDocument(n,t).then(function(r){var i=ee(r,n,t);return X.drawDocument(i.document,e,i.options)})},X},void 0===Nq&&void 0!==window&&(Nq=window),"function"==typeof define&&define.amd?define(["url","xmlserializer","sane-domparser-error","inlineresources"],function(e,t,n,r){return Nq.rasterizeHTML=NW(e,t,n,r)}):os?os=NW(x("kRFNf"),x("l4MZj"),x("lDFX4"),x("6cJtK")):Nq.rasterizeHTML=NW(Nq.url,Nq.xmlserializer,Nq.sanedomparsererror,Nq.inlineresources);let ol=`
|
|
75
75
|
p {
|
|
76
76
|
margin: 0;
|
|
77
77
|
padding: 0;
|
|
@@ -180,7 +180,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
|
180
180
|
.ql-direction-rtl {
|
|
181
181
|
direction: rtl;
|
|
182
182
|
}
|
|
183
|
-
`,oO=["bold","color","font","italic","size","strike","underline","indent","list","direction"],oA=e=>{oO=e},oI=e=>new(m(aP))(e,{toolbar:!1,keyboard:!1,clipboard:{matchVisual:!1},formats:oO}),oR=(e,t)=>{var n=e.clipboard.convert("<div class='ql-editor' style='outline: none;'>"+t+"<p><br></p></div>");e.setContents(n),e.history.clear()},oL=({html:e,onBlur:t,onChange:n,element:r,clickCoords:i})=>{let a=m(S).useRef(null);m(S).useEffect(()=>{if(!a.current)return;let r=oI(a.current);E.runInAction(()=>{oT.editor.instance=r}),window.__polotnoQuill=r,r.on("text-change",()=>{r.getSelection()&&E.runInAction(()=>{oT.currentFormat=r.getFormat(r.getSelection())}),setTimeout(()=>{let e=a.current?.childNodes[0];e&&n(oE(e.innerHTML))},10)}),oR(r,e),i?function(e,t){if(!e||!t)return;let{x:n,y:r}=t;try{let t=null;if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(n,r);else if(document.caretPositionFromPoint){let e=document.caretPositionFromPoint(n,r);e&&(t=document.createRange()).setStart(e.offsetNode,e.offset)}if(t){let n=m(aP).find(t.startContainer,!0);if(n){let r=n.offset(e.scroll)+t.startOffset;e.setSelection(r,0,"api");return}}}catch(e){}e.setSelection(0,0,"api")}(r,i):r.setSelection(0,0,"api"),r.on("selection-change",(e,t,n)=>{e&&E.runInAction(()=>{oT.currentFormat=r.getFormat(r.getSelection())})}),a.current.childNodes[0].addEventListener("blur",e=>{var n;let r=e.relatedTarget;r?.classList.contains("ql-clipboard")||(n=r)&&n.closest(".sketch-picker")||t()});let o=a.current.childNodes[0],s=e=>{let t=r.getSelection();if(!t||0===t.length)return;let n=r.getText(t.index,t.length).replace(/\n$/,""),i=window.getSelection(),a="";if(i&&i.rangeCount>0){let e=i.getRangeAt(0),t=document.createElement("div");t.appendChild(e.cloneContents()),a=t.innerHTML}if(e.clipboardData?.setData("text/plain",n),a){let t='<div style="white-space: pre-wrap; word-wrap: break-word;">'+a+"</div>";e.clipboardData?.setData("text/html",'<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>\x3c!--StartFragment--\x3e'+t+"\x3c!--EndFragment--\x3e</body></html>")}e.preventDefault()},l=e=>{s(e);let t=r.getSelection();t&&t.length>0&&r.deleteText(t.index,t.length)};return o.addEventListener("copy",s),o.addEventListener("cut",l),()=>{o.removeEventListener("copy",s),o.removeEventListener("cut",l),E.runInAction(()=>{oT.editor.instance=null,oT.currentFormat={}}),delete window.__polotnoQuill}},[]),m(S).useEffect(()=>(0,E.reaction)(()=>r.text,()=>{let t=oT.editor.instance;if(!t)return;let n=t.getSelection(),i=a.current?.childNodes?.[0];oE(i?.innerHTML||"")!==r.text&&(oR(t,e),n&&(t.setSelection(n.index,n.length),E.runInAction(()=>{oT.currentFormat=t.getFormat(t.getSelection())})))},{fireImmediately:!0}),[]),m(S).useEffect(()=>{window.addEventListener("blur",t);let e=e=>{a.current?.contains(e.target)||t()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",t),window.removeEventListener("touchstart",e)}},[]);let o={color:r.fill};r.fill.indexOf("gradient")>=0&&(o.backgroundColor=r.fill,o.backgroundImage=r.fill,o.backgroundSize="100% 100%",o.backgroundRepeat="repeat",o.webkitBackgroundClip="text",o.MozBackgroundClip="text",o.WebkitTextFillColor="transparent",o.MozTextFillColor="transparent");let s=iZ(r);return(0,C.jsx)(oP,{ref:a,style:{...o,fontSize:r.fontSize,fontWeight:r.fontWeight,textTransform:r.textTransform,width:r.a.width,fontFamily:'"'+r.fontFamily+'"',lineHeight:r.lineHeight,letterSpacing:r.letterSpacing*r.fontSize+"px",textAlign:r.align,opacity:Math.max(r.a.opacity,.2),textShadow:r.shadowEnabled?`${r.shadowOffsetX}px ${r.shadowOffsetY}px ${r.shadowBlur}px ${o_(r.shadowColor,r.shadowOpacity??1)}`:void 0,caretColor:s},dir:iH(iz(r.text))})},oM=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),oN=j(({element:e,store:t})=>{let n=m(S).useRef(null),[r,i]=m(S).useState(),[a,o]=m(S).useState(!1),[s,l]=m(S).useState(!1),c=m(S).useRef(e.height),u=t.selectedShapes.indexOf(e)>=0&&e.selectable,d=i3(u),h=e.fontSize/3,{textVerticalResizeEnabled:f}=iS,p=iS.autoDeleteEmptyText,g=i3(e.fontFamily),[y]=i2(t,e.fontFamily),v=e._editModeEnabled;r0(n);let b=y?e.fontFamily:g!==e.fontFamily?g:"Arial",x=rQ(e).fill,w=i$(e,{fontFamily:b,color:x}),k=i$(e,{fontFamily:b,color:x,forEditor:!0}),{width:_,height:T}=m(S).useMemo(()=>od(w),[w,e.width,y]);m(S).useEffect(()=>{if(!y)return;if(!e.height)return void t.history.ignore(()=>{e.set({height:T})});let{textOverflow:n}=iS;if("change-font-size"!==n||a)"resize"===n&&(f&&e.height<T&&!a&&t.history.ignore(()=>{e.set({height:T})}),f||e.height===T||t.history.ignore(()=>{e.set({height:T})}));else{let n=(e=>{let t=e.fontSize;for(let n=1;n<50;n++){let n=i$({...e.toJSON(),fontSize:t},{fontFamily:e.fontFamily}),{height:r}=od(n);if(!(e.height&&r>e.height||!iS.textSplitAllowed&&!e.curveEnabled&&function({html:e}){let t=document.createElement("div");t.innerHTML=e,t.style.display="inline-block",t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.zIndex="1000",t.style.whiteSpace="nowrap",t.style.visibility="hidden";let n=ou();n.appendChild(t);let r=t.innerText,i=t.childNodes[0];i.style.whiteSpace="nowrap";let a=r?.split(/\s+/)||[],o=!1;for(let e=0;e<a.length;e++){let n=a[e];if(i&&(i.textContent=n,o=i.scrollWidth>t.clientWidth))break}return n.removeChild(t),o}({html:n})))break;t-=.5}return t})(e);n!==e.fontSize?t.history.ignore(()=>{e.set({fontSize:n})}):e.height!==T&&(f&&e.height<T?t.history.ignore(()=>{e.set({height:T})}):f||t.history.ignore(()=>{e.set({height:T})}))}});let P=m(S).useMemo(()=>{let e={lastArgs:null,lastResult:null};return async function(t){var n;return e.lastArgs&&e.lastResult&&(n=e.lastArgs,JSON.stringify(n)===JSON.stringify(t))||(e.lastResult=await og(t),e.lastArgs={...t}),e.lastResult}},[]),O=m(S).useRef(0),A=m(S).useRef(null),I=async()=>{O.current++;let n=O.current,r=r5(`text ${e.id} ${n}`);A.current&&A.current(),A.current=r,l(!0);let a=null,o=oM?5:1;for(let r=0;r<o;r++){let i=r>0?P:og;try{var s;if(a=await i({skipCache:r>0,html:w,width:e.width||1,height:e.height||T||1,fontFamily:b,padding:h,pixelRatio:t._elementsPixelRatio,font:t.fonts.find(e=>e.fontFamily===b)||is.find(e=>e.fontFamily===b)}),n!==O.current)return;if(oM&&a&&(s=a,!function(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height).data;for(let e=0;e<t.length;e+=4)if(0!==t[e+3])return!0;return!1}(s))){await new Promise(e=>setTimeout(e,50*(r+1)));continue}break}catch(t){console.error(t),it(`Error rendering rich text with id ${e.id}`);break}}a?i(a):r?(r(),r=null):console.error("Finish function is called twice!"),l(!1)};m(S).useEffect(()=>{a||v||I()},[w,a,T,v,b,e.height,t._elementsPixelRatio,y]);let[R,L]=au(s,300),[M]=au(a,300,!0),N=M||R;m(S).useEffect(()=>N?void n.current?.clearCache():E.autorun(()=>{iW(n.current,e)}),[r,N,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]),m(S).useEffect(()=>{r&&!s&&A.current&&(A.current(),A.current=null)},[r,s]),m(S).useLayoutEffect(()=>{if(!y||!e.curveEnabled)return;let t=new n_.TextPath({data:iV(e.a.width,e.a.height,e.curvePower,e.a.fontSize),text:iz(e.text),letterSpacing:e.letterSpacing*e.a.fontSize,fontSize:e.a.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,align:"center",textBaseline:"middle",fill:e.fill}),n=t.getSelfRect().width;if(n){let t=n-e.a.width,r=e.a.rotation*Math.PI/180,i=-(t/2)*Math.cos(r),a=-(t/2)*Math.sin(r);e.set({width:n,x:e.a.x+i,y:e.a.y+a})}t.destroy()},[y,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),m(S).useEffect(()=>()=>{A.current&&A.current()},[]),m(S).useEffect(()=>{d&&!u&&p&&""===iz(e.text)&&e.removable&&!e.placeholder&&t.deleteElements([e.id])},[p,e.placeholder,e.removable,e.text,u,d]);let j=0;"middle"===e.verticalAlign&&(j=(e.height-T)/2),"bottom"===e.verticalAlign&&(j=e.height-T);let D=i4({fontLoaded:y,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),z=iK(),B=iV(e.a.width,T,e.curvePower,e.fontSize),F=m(S).useRef(null),H=m(S).useRef(null),V=v&&e.strokeWidth>0&&!e.curveEnabled;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rP,{x:e.a.x,y:e.a.y,offsetX:e.backgroundPadding*(e.fontSize*D*.5),offsetY:e.backgroundPadding*(e.fontSize*D*.5),rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,width:e.a.width+e.backgroundPadding*(e.fontSize*D),height:e.a.height+e.backgroundPadding*(e.fontSize*D),cornerRadius:e.backgroundCornerRadius*(e.fontSize*D*.5)}),(0,C.jsx)(rR,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,data:B,stroke:"red",strokeWidth:1,visible:!1}),(0,C.jsx)(rP,{ref:n,name:"element",x:e.a.x,y:e.a.y,listening:e.selectable,rotation:e.a.rotation,width:e.a.width,height:e.a.height,visible:!N,draggable:z?e.draggable&&u:e.draggable,preventDefault:!z||u,opacity:v?0:e.a.opacity,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},id:e.id,onDblClick:t=>{e.contentEditable&&(H.current={x:t.evt.clientX,y:t.evt.clientY},e.toggleEditMode(!0))},onDblTap:t=>{if(e.contentEditable){let n=t.evt.changedTouches?.[0];H.current=n?{x:n.clientX,y:n.clientY}:null,e.toggleEditMode(!0)}},onTransformStart:t=>{o(!0),c.current=e.height},onTransform:t=>{let n=t.target,r=(n.getStage()?.findOne("Transformer")).getActiveAnchor(),i=n.scaleX();if("middle-left"===r||"middle-right"===r){let t=n.scaleX(),r=n.width()*t,i=e.fontSize,a=r;if(r<i&&(a=i,F.current&&n.position(F.current)),n.width(a),n.scaleX(1),iS.textVerticalResizeEnabled){let t=Math.max(T,c.current);e.set({height:t})}e.set({width:n.width(),x:n.x(),y:n.y()})}else if("top-center"===r||"bottom-center"===r){let r="resize"===iS.textOverflow,i="number"==typeof e.lineHeight?e.lineHeight:1,a=Math.max(r?T:i*e.fontSize,t.target.height()*t.target.scaleY());n.scaleY(1),e.set({x:n.x(),y:n.y(),height:a,rotation:n.rotation()})}else n.scaleX(1),n.scaleY(1),e.set({fontSize:e.fontSize*i,letterSpacing:e.letterSpacing,width:n.width()*i,x:n.x(),y:n.y(),rotation:n.rotation(),height:n.height()*i});F.current=t.target.position()},onTransformEnd:t=>{o(!1),l(!0);let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.fontSize*n,width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n,strokeWidth:e.strokeWidth*n})}}),(0,C.jsx)(rA,{ref:n,image:r,x:e.a.x,y:e.a.y,offsetX:h,offsetY:h-j,listening:!1,rotation:e.a.rotation,width:e.a.width+2*h,height:(e.a.width+2*h)*((r?.height??0)/(r?.width||1)||1),visible:!N&&!v,opacity:e.a.opacity,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled||a||N}),(N||V)&&(0,C.jsx)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-j,children:(0,C.jsx)(rz,{divProps:{style:{pointerEvents:"none"}},children:(0,C.jsx)(oP,{dangerouslySetInnerHTML:{__html:w},style:{pointerEvents:"none",opacity:e.a.opacity,textShadow:e.shadowEnabled?`${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${o_(e.shadowColor,e.shadowOpacity??1)}`:void 0}})})}),v&&(0,C.jsx)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-j,children:(0,C.jsx)(rz,{children:(0,C.jsx)(oL,{html:k,element:e,onChange:t=>{let n=iX({oldText:iz(e.text),newText:iz(t),element:e});e.set({text:t,fontSize:n})},onBlur:t=>{e.toggleEditMode(!1),L(!0)},clickCoords:H.current})})})]})});var S=(x("8NFma"),x("8NFma"));function oj(e){return e/180*Math.PI}function oD(e,t,n,r,i){let a=Math.sqrt(n*n+r*r);return{x:e+a*Math.cos(i+=Math.atan2(r,n)),y:t+a*Math.sin(i)}}function oz(e){let{x:t,y:n,width:r,height:i}=e,a=oj(e.rotation),o=oD(t,n,0,0,a),s=oD(t,n,r,0,a),l=oD(t,n,r,i,a),c=oD(t,n,0,i,a),u=Math.min(o.x,s.x,l.x,c.x),d=Math.min(o.y,s.y,l.y,c.y),h=Math.max(o.x,s.x,l.x,c.x),f=Math.max(o.y,s.y,l.y,c.y);return{x:u,y:d,width:h-u,height:f-d,minX:u,minY:d,maxX:h,maxY:f}}function oB(e){let t=e.map(e=>oz(e)),n=Math.min(...t.map(e=>e.minX)),r=Math.min(...t.map(e=>e.minY)),i=Math.max(...t.map(e=>e.maxX)),a=Math.max(...t.map(e=>e.maxY));return{x:n,y:r,width:i-n,height:a-r,minX:n,minY:r,maxX:i,maxY:a}}let oF={stroke:"rgb(0, 161, 255)",strokeWidth:1,dash:[4,6]},oH=({targetKonvaNodes:e,guideKonvaNode:t,distance:n,snapDirection:r})=>n<5,oV=e=>{oH=e};function oU(e,t){var n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{var r=Math.abs(e.offset-t.guide);oH({targetKonvaNodes:t.nodes,guideKonvaNode:e.node,distance:r,snapDirection:e.snap})&&n.push({lineGuide:e.offset,diff:r,snap:t.snap,offset:t.offset})})}),e.horizontal.forEach(e=>{t.horizontal.forEach(t=>{var n=Math.abs(e.offset-t.guide);oH({targetKonvaNodes:t.nodes,guideKonvaNode:e.node,distance:n,snapDirection:e.snap})&&r.push({lineGuide:e.offset,diff:n,snap:t.snap,offset:t.offset})})});var i=[];let a=n.sort((e,t)=>e.diff-t.diff),o=r.sort((e,t)=>e.diff-t.diff);var s=a[0],l=o[0];return s&&a.filter(e=>.1>Math.abs(e.diff-s.diff)).forEach(e=>{i.push({orientation:"V",...e})}),l&&o.filter(e=>.1>Math.abs(e.diff-l.diff)).forEach(e=>{i.push({orientation:"H",...e})}),i}let o$=()=>{if(0===n_.DD._dragElements.size)return;let e=[...n_.DD._dragElements.entries()],t=e.find(([e,t])=>t.node instanceof n_.Transformer);t&&(e.splice(e.indexOf(t),1),e.unshift(t),n_.DD._dragElements.clear(),e.forEach(([e,t])=>{n_.DD._dragElements.set(e,t)}))};function oq(e,t,n){let r=e=>e.hasName("element")||e.hasName("line-anchor")||e.hasName("page-background")||e.hasName("elements-area"),i=n=>{let i,a,o,s=n.target.getLayer().children.find(e=>"line-guides"===e.name());s?.destroyChildren();var l,c,u,d,h=oU((l=[n.target,...t.map(e=>e.current)],i=e.current?.getStage(),c=[],u=[],i.find(r).forEach(e=>{if(!(l.indexOf(e)>=0)){var t=e.getClientRect({skipShadow:!0,skipStroke:!0});e.hasName("line-anchor")&&(t={x:e.absolutePosition().x,y:e.absolutePosition().y,width:0,height:0}),c.push({offset:t.x,node:e,snap:"start"},{offset:t.x+t.width,node:e,snap:"end"},{offset:t.x+t.width/2,node:e,snap:"center"}),u.push({offset:t.y,node:e,snap:"start"},{offset:t.y+t.height,node:e,snap:"end"},{offset:t.y+t.height/2,node:e,snap:"center"})}}),{vertical:c,horizontal:u}),{vertical:[{guide:(d=n.target).absolutePosition().x,offset:0,snap:"center",nodes:[d]}],horizontal:[{guide:d.absolutePosition().y,offset:0,snap:"center",nodes:[d]}]});if(!h.length)return;a=e.current?.getLayer(),o=a?.children.find(e=>"line-guides"===e.name()),h.forEach(e=>{if("H"===e.orientation){var t=new n_.Line({x:-a.getStage().x(),y:-a.getStage().y(),points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});o?.add(t),a.batchDraw()}else if("V"===e.orientation){var t=new n_.Line({x:-a.getStage().x(),y:-a.getStage().y(),points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});o?.add(t)}});let f=n.target.getAbsolutePosition(),p={...f};h.forEach(e=>{switch(e.snap){case"start":case"center":case"end":switch(e.orientation){case"V":p.x=e.lineGuide+e.offset;break;case"H":p.y=e.lineGuide+e.offset}}});let m=p.x-f.x,g=p.y-f.y;if(!(n.evt.ctrlKey||n.evt.metaKey)){let e=n.target.getAbsolutePosition();n.target.absolutePosition({x:e.x+m,y:e.y+g})}},a=e=>{if(!e.target)return;let t=e.target.getLayer(),n=t.children.find(e=>"line-guides"===e.name());n?.destroyChildren(),t.batchDraw()};m(S).useEffect(()=>{e.current&&(e.current.on("dragmove",i),e.current.on("dragend",a))},n)}function oW(e,t){return e.x*t.x+e.y*t.y}let oG={"top-left":"bottom-right","top-center":"bottom-center","top-right":"bottom-left","middle-right":"middle-left","bottom-right":"top-left","bottom-center":"top-center","bottom-left":"top-right","middle-left":"middle-right"};function oK(e){let{x:t,y:n,width:r,height:i,rotation:a}=e.a,o=a*Math.PI/180,s={x:t+i/2*Math.cos(o+Math.PI/2),y:n+i/2*Math.sin(o+Math.PI/2)},l={x:s.x+r*Math.cos(o),y:s.y+r*Math.sin(o)};return{middleLeft:s,middleRight:l}}function oY(e,t,n){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),i=Math.atan2(t.y-e.y,t.x-e.x),a=180*i/Math.PI;return{x:e.x+Math.cos(i-Math.PI/2)*n/2,y:e.y+Math.sin(i-Math.PI/2)*n/2,width:r,height:n,rotation:a}}let oX=(e,t)=>{let n=h9.anchorSize||10;return{offsetX:n/2/e,offsetY:n/2/e,width:n/e,height:n/e,cornerRadius:(h9.anchorCornerRadius||0)/e,fill:h9.anchorFill||"white",stroke:h9.anchorStroke||"rgb(0, 161, 255)",strokeWidth:h9.anchorStrokeWidth||2,strokeScaleEnabled:!1,draggable:!0,dragDistance:0,onMouseEnter:e=>{e.target.getStage().container().style.cursor="crosshair"},onMouseLeave:e=>{e.target.getStage().container().style.cursor=""},onDragStart:e=>{t.history.startTransaction()},onDragEnd:e=>{t.history.endTransaction()}}},oQ=j(({element:e,type:t})=>{let n=rQ(e,e.a.color,"fill"),r=rQ(e,e.a.color,"stroke"),i={strokeWidth:e.height,lineCap:"round",lineJoin:"round",...r,...n,opacity:e.a.opacity,hideInExport:!e.showInExport};return(0,C.jsxs)(C.Fragment,{children:["arrow"===t&&(0,C.jsx)(rO,{points:[3*e.height,-(2*e.height),0,0,3*e.height,2*e.height],...i}),"triangle"===t&&(0,C.jsx)(rO,{points:[3*e.height,-(2*e.height),0,0,3*e.height,2*e.height],closed:!0,...i}),"bar"===t&&(0,C.jsx)(rO,{points:[0,-(2*e.height),0,2*e.height],closed:!0,...i}),"square"===t&&(0,C.jsx)(rO,{points:[0,-(2*e.height),4*e.height,-(2*e.height),4*e.height,2*e.height,0,2*e.height],closed:!0,...i}),"circle"===t&&(0,C.jsx)("Circle",{x:2*e.height,y:0,radius:2*e.height,...i})]})}),oZ=j(({element:e,store:t})=>{let n=m(S).useRef(null),r=m(S).useRef(null),i=m(S).useRef(null),a=e.selectable||"admin"===t.role,o=iK(),s=t.selectedElements.indexOf(e)>=0&&1===t.selectedElements.length,l=t.selectedShapes.indexOf(e)>=0&&e.selectable,{middleLeft:c,middleRight:u}=oK(e);oq(r,[n],[s]),oq(i,[n],[s]);let d=rQ(e,e.a.color,"stroke");return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rO,{ref:n,name:"element",id:e.id,x:e.a.x,y:e.a.y,points:[0,0,e.a.width,0],offsetY:-e.a.height/2,strokeWidth:e.a.height,hitStrokeWidth:Math.max(e.a.height,20),dash:e.dash.map(t=>t*e.a.height),...d,rotation:e.a.rotation,opacity:e.animated("opacity"),shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,listening:a,draggable:o?e.draggable&&l:e.draggable,preventDefault:!o||l,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onTransform:t=>{let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({height:e.height*n,width:e.width*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})}}),(0,C.jsx)(rE,{x:c.x,y:c.y,rotation:e.rotation,hideInExport:!e.showInExport,onClick:e=>n.current?.fire("click",e),onTap:e=>n.current?.fire("tap",e),children:(0,C.jsx)(oQ,{element:e,type:e.startHead})}),(0,C.jsx)(rE,{x:u.x,y:u.y,rotation:e.rotation+180,onClick:e=>n.current?.fire("click",e),onTap:e=>n.current?.fire("tap",e),children:(0,C.jsx)(oQ,{element:e,type:e.endHead})}),s&&e.resizable&&(0,C.jsx)(rB,{selector:".page-abs-container",enabled:!0,children:(0,C.jsxs)(rE,{visible:s,children:[(0,C.jsx)(rP,{x:c.x,y:c.y,ref:r,name:"line-anchor",...oX(t.scale,t),onDragMove:t=>{let n=oY(t.target.position(),u,e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}}),(0,C.jsx)(rP,{x:u.x,y:u.y,ref:i,name:"line-anchor",...oX(t.scale,t),onDragMove:t=>{let n=oY(c,t.target.position(),e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}})]})})]})});var S=x("8NFma"),E=x("2SBKn"),S=x("8NFma"),E=x("2SBKn");function oJ(e){if(!e)throw Error("Assertion failed.")}let o0=e=>{let t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw Error(`Invalid rotation ${e}.`)},o1=e=>e&&e[e.length-1];class o2{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){let e=Math.floor(this.pos/8),t=this.bytes[e]??0,n=7-(7&this.pos);return this.pos++,(t&1<<n)>>n}readBits(e){if(1===e)return this.readBit();let t=0;for(let n=0;n<e;n++)t<<=1,t|=this.readBit();return t}writeBits(e,t){let n=this.pos+e;for(let e=this.pos;e<n;e++){let r=Math.floor(e/8),i=this.bytes[r],a=7-(7&e);i&=~(1<<a),i|=(t&1<<n-e-1)>>n-e-1<<a,this.bytes[r]=i}this.pos=n}readAlignedByte(){if(this.pos%8!=0)throw Error("Bitstream is not byte-aligned.");let e=this.pos/8,t=this.bytes[e]??0;return this.pos+=8,t}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){let e=new o2(this.bytes);return e.pos=this.pos,e}}let o4=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},o3=e=>{let t=o4(e);return(1&t)==0?-(t>>1):t+1>>1},o8=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),o6=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),o5=new TextDecoder,o9=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e])),o7={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},se=o9(o7),st={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},sn=o9(st),sr={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},si=o9(sr),sa=e=>e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e);class so{constructor(){this.currentPromise=Promise.resolve(),this.pending=0}async acquire(){let e,t=new Promise(t=>{let n=!1;e=()=>{n||(t(),this.pending--,n=!0)}}),n=this.currentPromise;return this.currentPromise=t,this.pending++,await n,e}}let ss=e=>[...e].map(e=>e.toString(16).padStart(2,"0")).join(""),sl=e=>(e=(e=(e=(e=(e=e>>1&0x55555555|(0x55555555&e)<<1)>>2&0x33333333|(0x33333333&e)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&e)<<4)>>8&0xff00ff|(0xff00ff&e)<<8)>>16&65535|(65535&e)<<16)>>>0,sc=(e,t,n)=>{let r=0,i=e.length-1,a=-1;for(;r<=i;){let o=r+i>>1,s=n(e[o]);s===t?(a=o,i=o-1):s<t?r=o+1:i=o-1}return a},su=(e,t,n)=>{let r=0,i=e.length-1,a=-1;for(;r<=i;){let o=r+(i-r+1)/2|0;n(e[o])<=t?(a=o,r=o+1):i=o-1}return a},sd=(e,t,n)=>{let r=su(e,n(t),n);e.splice(r+1,0,t)},sh=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},sf=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return e[n]},sp=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return -1},sm=async function*(e){Symbol.iterator in e?yield*e[Symbol.iterator]():yield*e[Symbol.asyncIterator]()},sg=e=>{throw Error(`Unexpected value: ${e}`)},sy=(e,t,n)=>{let r=e.getUint8(t),i=e.getUint8(t+1),a=e.getUint8(t+2);return n?r|i<<8|a<<16:r<<16|i<<8|a},sv=(e,t,n,r)=>{n>>>=0,n&=0xffffff,r?(e.setUint8(t,255&n),e.setUint8(t+1,n>>>8&255),e.setUint8(t+2,n>>>16&255)):(e.setUint8(t,n>>>16&255),e.setUint8(t+1,n>>>8&255),e.setUint8(t+2,255&n))},sb=(e,t)=>({async next(){let n=await e.next();return n.done?{value:void 0,done:!0}:{value:t(n.value),done:!1}},return:()=>e.return(),throw:t=>e.throw(t),[Symbol.asyncIterator](){return this}}),sx=(e,t,n)=>Math.max(t,Math.min(n,e)),sw=e=>{let t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e},sC=(e,t)=>Math.floor(e/t)*t,sS=/^[a-z]{3}$/,sk=1e6*(1+Number.EPSILON),s_=(e,t)=>{let n={...e,...t};if(e.headers||t.headers){let r=e.headers?sE(e.headers):{},i=t.headers?sE(t.headers):{},a={...r};Object.entries(i).forEach(([e,t])=>{let n=Object.keys(a).find(t=>t.toLowerCase()===e.toLowerCase());n&&delete a[n],a[e]=t}),n.headers=a}return n},sE=e=>{if(e instanceof Headers){let t={};return e.forEach((e,n)=>{t[n]=e}),t}if(Array.isArray(e)){let t={};return e.forEach(([e,n])=>{t[e]=n}),t}return e},sT=async(e,t,n,r,i)=>{let a=0;for(;;)try{return await e(t,n)}catch(n){if(i())throw n;let e=r(++a,n,t);if(null===e)throw n;if(console.error("Retrying failed fetch. Error:",n),!Number.isFinite(e)||e<0)throw TypeError("Retry delay must be a non-negative finite number.");if(e>0&&await new Promise(t=>setTimeout(t,1e3*e)),i())throw n}};class sP{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}}let sO=null,sA=()=>null!==sO?sO:sO=!!("u">typeof navigator&&(navigator.vendor?.match(/apple/i)||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent))),sI=null,sR=()=>null!==sI?sI:sI="u">typeof navigator&&navigator.userAgent?.includes("Firefox"),sL=null,sM=()=>null!==sL?sL:sL=!!("u">typeof navigator&&(navigator.vendor?.includes("Google Inc")||/Chrome/.test(navigator.userAgent))),sN=null,sj=()=>{if(null!==sN)return sN;if("u"<typeof navigator)return null;let e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?sN=Number(e[1]):null},sD=(e,t)=>-1!==e?e:t,sz=(e,t,n,r)=>e<=r&&n<=t,sB=e=>{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n},sF=()=>{Symbol.dispose??=Symbol("Symbol.dispose")},sH=e=>"number"==typeof e&&!Number.isNaN(e),sV=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"];[...sV];let sU=[{maxMacroblocks:99,maxBitrate:64e3,maxDpbMbs:396,level:10},{maxMacroblocks:396,maxBitrate:192e3,maxDpbMbs:900,level:11},{maxMacroblocks:396,maxBitrate:384e3,maxDpbMbs:2376,level:12},{maxMacroblocks:396,maxBitrate:768e3,maxDpbMbs:2376,level:13},{maxMacroblocks:396,maxBitrate:2e6,maxDpbMbs:2376,level:20},{maxMacroblocks:792,maxBitrate:4e6,maxDpbMbs:4752,level:21},{maxMacroblocks:1620,maxBitrate:4e6,maxDpbMbs:8100,level:22},{maxMacroblocks:1620,maxBitrate:1e7,maxDpbMbs:8100,level:30},{maxMacroblocks:3600,maxBitrate:14e6,maxDpbMbs:18e3,level:31},{maxMacroblocks:5120,maxBitrate:2e7,maxDpbMbs:20480,level:32},{maxMacroblocks:8192,maxBitrate:2e7,maxDpbMbs:32768,level:40},{maxMacroblocks:8192,maxBitrate:5e7,maxDpbMbs:32768,level:41},{maxMacroblocks:8704,maxBitrate:5e7,maxDpbMbs:34816,level:42},{maxMacroblocks:22080,maxBitrate:135e6,maxDpbMbs:110400,level:50},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:51},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:52},{maxMacroblocks:139264,maxBitrate:24e7,maxDpbMbs:696320,level:60},{maxMacroblocks:139264,maxBitrate:48e7,maxDpbMbs:696320,level:61},{maxMacroblocks:139264,maxBitrate:8e8,maxDpbMbs:696320,level:62}],s$=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:0x2200000,maxBitrate:18e7,level:60},{maxPictureSize:0x2200000,maxBitrate:24e7,level:61},{maxPictureSize:0x2200000,maxBitrate:48e7,level:62}],sq=".01.01.01.01.00",sW=".0.110.01.01.01.0",sG=e=>{let{codec:t,codecDescription:n,colorSpace:r,avcCodecInfo:i,hevcCodecInfo:a,vp9CodecInfo:o,av1CodecInfo:s}=e;if("avc"===t){if(oJ(null!==e.avcType),i){let t=new Uint8Array([i.avcProfileIndication,i.profileCompatibility,i.avcLevelIndication]);return`avc${e.avcType}.${ss(t)}`}if(!n||n.byteLength<4)throw TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${e.avcType}.${ss(n.subarray(1,4))}`}if("hevc"===t){let e,t,r,i,o,s;if(a)e=a.generalProfileSpace,t=a.generalProfileIdc,r=sl(a.generalProfileCompatibilityFlags),i=a.generalTierFlag,o=a.generalLevelIdc,s=[...a.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");let a=o6(n),l=a.getUint8(1);e=l>>6&3,t=31&l,r=sl(a.getUint32(2)),i=l>>5&1,o=a.getUint8(12),s=[];for(let e=0;e<6;e++)s.push(a.getUint8(6+e))}let l="hev1.";for(l+=["","A","B","C"][e]+t,l+=".",l+=r.toString(16).toUpperCase(),l+=".",l+=0===i?"L":"H",l+=o;s.length>0&&0===s[s.length-1];)s.pop();return s.length>0&&(l+=".",l+=s.map(e=>e.toString(16).toUpperCase()).join(".")),l}if("vp8"===t)return"vp8";if("vp9"===t){if(!o){let t=e.width*e.height,n=o1(s$).level;for(let e of s$)if(t<=e.maxPictureSize){n=e.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let t=o.profile.toString().padStart(2,"0"),n=o.level.toString().padStart(2,"0"),r=o.bitDepth.toString().padStart(2,"0"),i=o.chromaSubsampling.toString().padStart(2,"0"),a=o.colourPrimaries.toString().padStart(2,"0"),s=o.transferCharacteristics.toString().padStart(2,"0"),l=o.matrixCoefficients.toString().padStart(2,"0"),c=o.videoFullRangeFlag.toString().padStart(2,"0"),u=`vp09.${t}.${n}.${r}.${i}`;return(u+=`.${a}.${s}.${l}.${c}`).endsWith(sq)&&(u=u.slice(0,-sq.length)),u}if("av1"===t){if(!s){let t=e.width*e.height,n=o1(s$).level;for(let e of s$)if(t<=e.maxPictureSize){n=e.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}let t=s.profile,n=s.level.toString().padStart(2,"0"),i=s.tier?"H":"M",a=s.bitDepth.toString().padStart(2,"0"),o=s.monochrome?"1":"0",l=100*s.chromaSubsamplingX+10*s.chromaSubsamplingY+ +(s.chromaSubsamplingX&&s.chromaSubsamplingY?s.chromaSamplePosition:0),c=r?.primaries?o7[r.primaries]:1,u=r?.transfer?st[r.transfer]:1,d=r?.matrix?sr[r.matrix]:1,h=+!!r?.fullRange,f=`av01.${t}.${n}${i}.${a}`;return f+=`.${o}.${l.toString().padStart(3,"0")}`,f+=`.${c.toString().padStart(2,"0")}`,f+=`.${u.toString().padStart(2,"0")}`,f+=`.${d.toString().padStart(2,"0")}`,(f+=`.${h}`).endsWith(sW)&&(f=f.slice(0,-sW.length)),f}throw TypeError(`Unhandled codec '${t}'.`)},sK=e=>{let{codec:t,codecDescription:n,aacCodecInfo:r}=e;if("aac"===t){if(!r)throw TypeError("AAC codec info must be provided.");if(r.isMpeg2)return"mp4a.67";{let e;return e=null!==r.objectType?r.objectType:sQ(n).objectType,`mp4a.40.${e}`}}if("mp3"===t)return"mp3";if("opus"===t)return"opus";if("vorbis"===t)return"vorbis";if("flac"===t)return"flac";else if("ac3"===t)return"ac-3";else if("eac3"===t)return"ec-3";else if(t&&sV.includes(t))return t;throw TypeError(`Unhandled codec '${t}'.`)},sY=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],sX=[-1,1,2,3,4,5,6,8],sQ=e=>{if(!e||e.byteLength<2)throw TypeError("AAC description must be at least 2 bytes long.");let t=new o2(e),n=t.readBits(5);31===n&&(n=32+t.readBits(6));let r=t.readBits(4),i=null;15===r?i=t.readBits(24):r<sY.length&&(i=sY[r]);let a=t.readBits(4),o=null;return a>=1&&a<=7&&(o=sX[a]),{objectType:n,frequencyIndex:r,sampleRate:i,channelConfiguration:a,numberOfChannels:o}},sZ=/^pcm-([usf])(\d+)+(be)?$/,sJ=[48e3,44100,32e3],s0=[24e3,22050,16e3];(NK=jT||(jT={}))[NK.NON_IDR_SLICE=1]="NON_IDR_SLICE",NK[NK.SLICE_DPA=2]="SLICE_DPA",NK[NK.SLICE_DPB=3]="SLICE_DPB",NK[NK.SLICE_DPC=4]="SLICE_DPC",NK[NK.IDR=5]="IDR",NK[NK.SEI=6]="SEI",NK[NK.SPS=7]="SPS",NK[NK.PPS=8]="PPS",NK[NK.AUD=9]="AUD",NK[NK.SPS_EXT=13]="SPS_EXT",(NY=jP||(jP={}))[NY.RASL_N=8]="RASL_N",NY[NY.RASL_R=9]="RASL_R",NY[NY.BLA_W_LP=16]="BLA_W_LP",NY[NY.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",NY[NY.VPS_NUT=32]="VPS_NUT",NY[NY.SPS_NUT=33]="SPS_NUT",NY[NY.PPS_NUT=34]="PPS_NUT",NY[NY.AUD_NUT=35]="AUD_NUT",NY[NY.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",NY[NY.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT";let s1=function*(e){let t=0,n=-1;for(;t<e.length-2;){let r=e.indexOf(0,t);if(-1===r||r>=e.length-2)break;let i=0;if((t=r)+3<e.length&&0===e[t+1]&&0===e[t+2]&&1===e[t+3]?i=4:0===e[t+1]&&1===e[t+2]&&(i=3),0===i){t++;continue}-1!==n&&t>n&&(yield{offset:n,length:t-n}),t=n=t+i}-1!==n&&n<e.length&&(yield{offset:n,length:e.length-n})},s2=function*(e,t){let n=0,r=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;n+t<=e.length;){let e;1===t?e=r.getUint8(n):2===t?e=r.getUint16(n,!1):3===t?e=sy(r,n,!1):(oJ(4===t),e=r.getUint32(n,!1)),n+=t,yield{offset:n,length:e},n+=e}},s4=(e,t)=>t.description?s2(e,(3&o8(t.description)[4])+1):s1(e),s3=e=>31&e,s8=e=>{let t=[],n=e.length;for(let r=0;r<n;r++)r+2<n&&0===e[r]&&0===e[r+1]&&3===e[r+2]?(t.push(0,0),r+=2):t.push(e[r]);return new Uint8Array(t)},s6=new Uint8Array([0,0,0,1]),s5=e=>{try{let t=[],n=[],r=[];for(let i of s1(e)){let a=e.subarray(i.offset,i.offset+i.length),o=s3(a[0]);o===jT.SPS?t.push(a):o===jT.PPS?n.push(a):o===jT.SPS_EXT&&r.push(a)}if(0===t.length||0===n.length)return null;let i=t[0],a=s9(i);oJ(null!==a);let o=100===a.profileIdc||110===a.profileIdc||122===a.profileIdc||144===a.profileIdc;return{configurationVersion:1,avcProfileIndication:a.profileIdc,profileCompatibility:a.constraintFlags,avcLevelIndication:a.levelIdc,lengthSizeMinusOne:3,sequenceParameterSets:t,pictureParameterSets:n,chromaFormat:o?a.chromaFormatIdc:null,bitDepthLumaMinus8:o?a.bitDepthLumaMinus8:null,bitDepthChromaMinus8:o?a.bitDepthChromaMinus8:null,sequenceParameterSetExt:o?r:null}}catch(e){return console.error("Error building AVC Decoder Configuration Record:",e),null}},s9=e=>{try{let t=new o2(s8(e));t.skipBits(1),t.skipBits(2);let n=t.readBits(5);if(7!==n)return null;let r=t.readAlignedByte(),i=t.readAlignedByte(),a=t.readAlignedByte();o4(t);let o=1,s=0,l=0,c=0;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r)&&(o=o4(t),3===o&&(c=t.readBits(1)),s=o4(t),l=o4(t),t.skipBits(1),t.readBits(1))){for(let e=0;e<(3!==o?8:12);e++)if(t.readBits(1)){let n=e<6?16:64,r=8,i=8;for(let e=0;e<n;e++){if(0!==i){let e=o3(t);i=(r+e+256)%256}r=0===i?r:i}}}o4(t);let u=o4(t);if(0===u)o4(t);else if(1===u){t.skipBits(1),o3(t),o3(t);let e=o4(t);for(let n=0;n<e;n++)o3(t)}o4(t),t.skipBits(1);let d=o4(t),h=o4(t),f=16*(d+1),p=16*(h+1),m=f,g=p,y=t.readBits(1);if(y||t.skipBits(1),t.skipBits(1),t.readBits(1)){let e,n,r=o4(t),i=o4(t),a=o4(t),s=o4(t),l=0===c?o:0;if(0===l)e=1,n=2-y;else{let t=3===o?1:2,r=1===o?2:1;e=t,n=r*(2-y)}m-=e*(r+i),g-=n*(a+s)}let v=2,b=2,x=2,w=0,C=null,S=null;if(t.readBits(1)){if(t.readBits(1)){let e=t.readBits(8);255===e&&(t.skipBits(16),t.skipBits(16))}t.readBits(1)&&t.skipBits(1),t.readBits(1)&&(t.skipBits(3),w=t.readBits(1),t.readBits(1)&&(v=t.readBits(8),b=t.readBits(8),x=t.readBits(8))),t.readBits(1)&&(o4(t),o4(t)),t.readBits(1)&&(t.skipBits(32),t.skipBits(32),t.skipBits(1));let e=t.readBits(1);e&&s7(t);let n=t.readBits(1);n&&s7(t),(e||n)&&t.skipBits(1),t.skipBits(1),t.readBits(1)&&(t.skipBits(1),o4(t),o4(t),o4(t),o4(t),C=o4(t),S=o4(t))}if(null===C)if(oJ(null===S),(44===r||86===r||100===r||110===r||122===r||244===r)&&16&i)C=0,S=0;else{let e=sU.find(e=>e.level>=a)??o1(sU),t=Math.min(Math.floor(e.maxDpbMbs/((2-y)*(h+1)*(d+1))),16);C=t,S=t}return oJ(null!==S),{profileIdc:r,constraintFlags:i,levelIdc:a,frameMbsOnlyFlag:y,chromaFormatIdc:o,bitDepthLumaMinus8:s,bitDepthChromaMinus8:l,codedWidth:f,codedHeight:p,displayWidth:m,displayHeight:g,colourPrimaries:v,matrixCoefficients:x,transferCharacteristics:b,fullRangeFlag:w,numReorderFrames:C,maxDecFrameBuffering:S}}catch(e){return console.error("Error parsing AVC SPS:",e),null}},s7=e=>{let t=o4(e);e.skipBits(4),e.skipBits(4);for(let n=0;n<=t;n++)o4(e),o4(e),e.skipBits(1);e.skipBits(5),e.skipBits(5),e.skipBits(5),e.skipBits(5)},le=(e,t)=>t.description?s2(e,(3&o8(t.description)[21])+1):s1(e),lt=e=>e>>1&63,ln=e=>{try{let t=new o2(s8(e));t.skipBits(16),t.readBits(4);let n=t.readBits(3),r=t.readBits(1),{general_profile_space:i,general_tier_flag:a,general_profile_idc:o,general_profile_compatibility_flags:s,general_constraint_indicator_flags:l,general_level_idc:c}=li(t,n);o4(t);let u=o4(t),d=0;3===u&&(d=t.readBits(1));let h=o4(t),f=o4(t),p=h,m=f;if(t.readBits(1)){let e=o4(t),n=o4(t),r=o4(t),i=o4(t),a=1,o=1,s=0===d?u:0;1===s?(a=2,o=2):2===s&&(a=2,o=1),p-=(e+n)*a,m-=(r+i)*o}let g=o4(t),y=o4(t);o4(t);let v=t.readBits(1)?0:n,b=0;for(let e=v;e<=n;e++)o4(t),b=o4(t),o4(t);o4(t),o4(t),o4(t),o4(t),o4(t),o4(t),t.readBits(1)&&t.readBits(1)&&la(t),t.skipBits(1),t.skipBits(1),t.readBits(1)&&(t.skipBits(4),t.skipBits(4),o4(t),o4(t),t.skipBits(1));let x=o4(t);if(lo(t,x),t.readBits(1)){let e=o4(t);for(let n=0;n<e;n++)o4(t),t.skipBits(1)}t.skipBits(1),t.skipBits(1);let w=2,C=2,S=2,k=0,_=0;if(t.readBits(1)){let e=ll(t,n);w=e.colourPrimaries,C=e.transferCharacteristics,S=e.matrixCoefficients,k=e.fullRangeFlag,_=e.minSpatialSegmentationIdc}return{displayWidth:p,displayHeight:m,colourPrimaries:w,transferCharacteristics:C,matrixCoefficients:S,fullRangeFlag:k,maxDecFrameBuffering:b+1,spsMaxSubLayersMinus1:n,spsTemporalIdNestingFlag:r,generalProfileSpace:i,generalTierFlag:a,generalProfileIdc:o,generalProfileCompatibilityFlags:s,generalConstraintIndicatorFlags:l,generalLevelIdc:c,chromaFormatIdc:u,bitDepthLumaMinus8:g,bitDepthChromaMinus8:y,minSpatialSegmentationIdc:_}}catch(e){return console.error("Error parsing HEVC SPS:",e),null}},lr=e=>{try{let t=[],n=[],r=[],i=[];for(let a of s1(e)){let o=e.subarray(a.offset,a.offset+a.length),s=lt(o[0]);s===jP.VPS_NUT?t.push(o):s===jP.SPS_NUT?n.push(o):s===jP.PPS_NUT?r.push(o):(s===jP.PREFIX_SEI_NUT||s===jP.SUFFIX_SEI_NUT)&&i.push(o)}if(0===n.length||0===r.length)return null;let a=ln(n[0]);if(!a)return null;let o=0;if(r.length>0){let e=r[0],t=new o2(s8(e));t.skipBits(16),o4(t),o4(t),t.skipBits(1),t.skipBits(1),t.skipBits(3),t.skipBits(1),t.skipBits(1),o4(t),o4(t),o3(t),t.skipBits(1),t.skipBits(1),t.readBits(1)&&o4(t),o3(t),o3(t),t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);let n=t.readBits(1),i=t.readBits(1);o=n||i?n&&!i?2:!n&&i?3:0:0}let s=[...t.length?[{arrayCompleteness:1,nalUnitType:jP.VPS_NUT,nalUnits:t}]:[],...n.length?[{arrayCompleteness:1,nalUnitType:jP.SPS_NUT,nalUnits:n}]:[],...r.length?[{arrayCompleteness:1,nalUnitType:jP.PPS_NUT,nalUnits:r}]:[],...i.length?[{arrayCompleteness:1,nalUnitType:lt(i[0][0]),nalUnits:i}]:[]];return{configurationVersion:1,generalProfileSpace:a.generalProfileSpace,generalTierFlag:a.generalTierFlag,generalProfileIdc:a.generalProfileIdc,generalProfileCompatibilityFlags:a.generalProfileCompatibilityFlags,generalConstraintIndicatorFlags:a.generalConstraintIndicatorFlags,generalLevelIdc:a.generalLevelIdc,minSpatialSegmentationIdc:a.minSpatialSegmentationIdc,parallelismType:o,chromaFormatIdc:a.chromaFormatIdc,bitDepthLumaMinus8:a.bitDepthLumaMinus8,bitDepthChromaMinus8:a.bitDepthChromaMinus8,avgFrameRate:0,constantFrameRate:0,numTemporalLayers:a.spsMaxSubLayersMinus1+1,temporalIdNested:a.spsTemporalIdNestingFlag,lengthSizeMinusOne:3,arrays:s}}catch(e){return console.error("Error building HEVC Decoder Configuration Record:",e),null}},li=(e,t)=>{let n=e.readBits(2),r=e.readBits(1),i=e.readBits(5),a=0;for(let t=0;t<32;t++)a=a<<1|e.readBits(1);let o=new Uint8Array(6);for(let t=0;t<6;t++)o[t]=e.readBits(8);let s=e.readBits(8),l=[],c=[];for(let n=0;n<t;n++)l.push(e.readBits(1)),c.push(e.readBits(1));if(t>0)for(let n=t;n<8;n++)e.skipBits(2);for(let n=0;n<t;n++)l[n]&&e.skipBits(88),c[n]&&e.skipBits(8);return{general_profile_space:n,general_tier_flag:r,general_profile_idc:i,general_profile_compatibility_flags:a,general_constraint_indicator_flags:o,general_level_idc:s}},la=e=>{for(let t=0;t<4;t++)for(let n=0;n<(3===t?2:6);n++)if(e.readBits(1)){let n=Math.min(64,1<<4+(t<<1));t>1&&o3(e);for(let t=0;t<n;t++)o3(e)}else o4(e)},lo=(e,t)=>{let n=[];for(let r=0;r<t;r++)n[r]=ls(e,r,t,n)},ls=(e,t,n,r)=>{let i=0,a=0,o=0;if(0!==t&&(a=e.readBits(1)),a){o=t===n?t-(o4(e)+1):t-1,e.readBits(1),o4(e);let a=r[o]??0;for(let t=0;t<=a;t++)e.readBits(1)||e.readBits(1);i=r[o]}else{let t=o4(e),n=o4(e);for(let n=0;n<t;n++)o4(e),e.readBits(1);for(let t=0;t<n;t++)o4(e),e.readBits(1);i=t+n}return i},ll=(e,t)=>{let n=2,r=2,i=2,a=0,o=0;return e.readBits(1)&&255===e.readBits(8)&&(e.readBits(16),e.readBits(16)),e.readBits(1)&&e.readBits(1),e.readBits(1)&&(e.readBits(3),a=e.readBits(1),e.readBits(1)&&(n=e.readBits(8),r=e.readBits(8),i=e.readBits(8))),e.readBits(1)&&(o4(e),o4(e)),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(1)&&(o4(e),o4(e),o4(e),o4(e)),e.readBits(1)&&(e.readBits(32),e.readBits(32),e.readBits(1)&&o4(e),e.readBits(1)&&lc(e,!0,t)),e.readBits(1)&&(e.readBits(1),e.readBits(1),e.readBits(1),o=o4(e),o4(e),o4(e),o4(e),o4(e)),{colourPrimaries:n,transferCharacteristics:r,matrixCoefficients:i,fullRangeFlag:a,minSpatialSegmentationIdc:o}},lc=(e,t,n)=>{let r=!1,i=!1,a=!1;t&&(r=1===e.readBits(1),i=1===e.readBits(1),(r||i)&&((a=1===e.readBits(1))&&(e.readBits(8),e.readBits(5),e.readBits(1),e.readBits(5)),e.readBits(4),e.readBits(4),a&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5)));for(let t=0;t<=n;t++){let t=1===e.readBits(1),n=!0;t||(n=1===e.readBits(1));let o=!1;n?o4(e):o=1===e.readBits(1);let s=1;o||(s=o4(e)+1),r&&lu(e,s,a),i&&lu(e,s,a)}},lu=(e,t,n)=>{for(let r=0;r<t;r++)o4(e),o4(e),n&&(o4(e),o4(e)),e.readBits(1)},ld=e=>{let t=new o2(e);if(2!==t.readBits(2))return null;let n=t.readBits(1),r=(t.readBits(1)<<1)+n;if(3===r&&t.skipBits(1),1===t.readBits(1)||0!==t.readBits(1)||(t.skipBits(2),4817730!==t.readBits(24)))return null;let i=8;r>=2&&(i=t.readBits(1)?12:10);let a=t.readBits(3),o=0,s=0;if(7!==a)if(s=t.readBits(1),1===r||3===r){let e=t.readBits(1),n=t.readBits(1);o=e||n?e&&!n?2:1:3,t.skipBits(1)}else o=1;else o=3,s=1;let l=(t.readBits(16)+1)*(t.readBits(16)+1),c=o1(s$).level;for(let e of s$)if(l<=e.maxPictureSize){c=e.level;break}return{profile:r,level:c,bitDepth:i,chromaSubsampling:o,videoFullRangeFlag:s,colourPrimaries:2===a?1:1===a?6:2,transferCharacteristics:2===a?1:1===a?6:2,matrixCoefficients:7===a?0:2===a?1:1===a?6:2}},lh=function*(e){let t=new o2(e),n=()=>{let e=0;for(let n=0;n<8;n++){let r=t.readAlignedByte();if(e|=(127&r)<<7*n,!(128&r))break;if(7===n&&128&r)return null}return e>=0x100000000-1?null:e};for(;t.getBitsLeft()>=8;){let r;t.skipBits(1);let i=t.readBits(4),a=t.readBits(1),o=t.readBits(1);if(t.skipBits(1),a&&t.skipBits(8),o){let e=n();if(null===e)return;r=e}else r=Math.floor(t.getBitsLeft()/8);oJ(t.pos%8==0),yield{type:i,data:e.subarray(t.pos/8,t.pos/8+r)},t.skipBits(8*r)}},lf=e=>{for(let{type:t,data:n}of lh(e)){if(1!==t)continue;let e=new o2(n),r=e.readBits(3);e.readBits(1);let i=e.readBits(1),a=0,o=0,s=0;if(i)a=e.readBits(5);else{if(e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.readBits(1)))return null;let t=e.readBits(1);t&&(s=e.readBits(5),e.skipBits(32),e.skipBits(5),e.skipBits(5));let n=e.readBits(5);for(let r=0;r<=n;r++){e.skipBits(12);let n=e.readBits(5);if(0===r&&(a=n),n>7){let t=e.readBits(1);0===r&&(o=t)}if(t&&e.readBits(1)){let t=s+1;e.skipBits(t),e.skipBits(t),e.skipBits(1)}e.readBits(1)&&e.skipBits(4)}}let l=e.readBits(4),c=e.readBits(4),u=l+1;e.skipBits(u);let d=c+1;e.skipBits(d);if((i?0:e.readBits(1))&&(e.skipBits(4),e.skipBits(3)),e.skipBits(1),e.skipBits(1),e.skipBits(1),!i){e.skipBits(1),e.skipBits(1),e.skipBits(1),e.skipBits(1);let t=e.readBits(1);t&&(e.skipBits(1),e.skipBits(1));let n=e.readBits(1);(n?2:e.readBits(1))>0&&(e.readBits(1)||e.skipBits(1)),t&&e.skipBits(3)}e.skipBits(1),e.skipBits(1),e.skipBits(1);let h=e.readBits(1),f=8;2===r&&h?f=e.readBits(1)?12:10:r<=2&&(f=h?10:8);let p=0;1!==r&&(p=e.readBits(1));let m=1,g=1,y=0;return!p&&(0===r?(m=1,g=1):1===r?(m=0,g=0):12===f&&(m=e.readBits(1))&&(g=e.readBits(1)),m&&g&&(y=e.readBits(2))),{profile:r,level:a,tier:o,bitDepth:f,monochrome:p,chromaSubsamplingX:m,chromaSubsamplingY:g,chromaSamplePosition:y}}return null},lp=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960],lm=(e,t,n)=>{switch(e){case"avc":for(let e of s4(n,t)){let t=s3(n[e.offset]);if(t>=jT.NON_IDR_SLICE&&t<=jT.SLICE_DPC)break;if(t===jT.IDR)return"key";if(t===jT.SEI&&(!sM()||sj()>=144)){let t=s8(n.subarray(e.offset,e.offset+e.length)),r=1;do{let e=0;for(;;){let n=t[r++];if(void 0===n||(e+=n,n<255))break}let n=0;for(;;){let e=t[r++];if(void 0===e||(n+=e,e<255))break}if(6===e){let e=new o2(t);e.pos=8*r;let n=o4(e),i=e.readBits(1);if(0===n&&1===i)return"key"}r+=n}while(r<t.length-1)}}return"delta";case"hevc":for(let e of le(n,t)){let t=lt(n[e.offset]);if(t<jP.BLA_W_LP)break;if(t<=jP.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 0==(1&n[0])?"key":"delta";case"vp9":{let e=new o2(n);if(2!==e.readBits(2))return null;let t=e.readBits(1);if(3===(e.readBits(1)<<1)+t&&e.skipBits(1),e.readBits(1))return null;return 0===e.readBits(1)?"key":"delta"}case"av1":{let e=!1;for(let{type:t,data:r}of lh(n))if(1===t){let t=new o2(r);t.skipBits(4),e=!!t.readBits(1)}else if(3===t||6===t||7===t){if(e)return"key";let t=new o2(r);if(t.readBits(1))return null;return 0===t.readBits(2)?"key":"delta"}return null}default:sg(e),oJ(!1)}};(NX=jO||(jO={}))[NX.STREAMINFO=0]="STREAMINFO",NX[NX.VORBIS_COMMENT=4]="VORBIS_COMMENT",NX[NX.PICTURE=6]="PICTURE";let lg=(e,t)=>{let n=o6(e),r=0,i=n.getUint32(r,!0);r+=4;let a=o5.decode(e.subarray(r,r+i));r+=i,i>0&&(t.raw??={},t.raw.vendor??=a);let o=n.getUint32(r,!0);r+=4;for(let i=0;i<o;i++){let i=n.getUint32(r,!0);r+=4;let a=o5.decode(e.subarray(r,r+i));r+=i;let o=a.indexOf("=");if(-1===o)continue;let s=a.slice(0,o).toUpperCase(),l=a.slice(o+1);switch(t.raw??={},t.raw[s]??=l,s){case"TITLE":t.title??=l;break;case"DESCRIPTION":t.description??=l;break;case"ARTIST":t.artist??=l;break;case"ALBUM":t.album??=l;break;case"ALBUMARTIST":t.albumArtist??=l;break;case"COMMENT":t.comment??=l;break;case"LYRICS":t.lyrics??=l;break;case"TRACKNUMBER":{let e=l.split("/"),n=Number.parseInt(e[0],10),r=e[1]&&Number.parseInt(e[1],10);Number.isInteger(n)&&n>0&&(t.trackNumber??=n),r&&Number.isInteger(r)&&r>0&&(t.tracksTotal??=r)}break;case"TRACKTOTAL":{let e=Number.parseInt(l,10);Number.isInteger(e)&&e>0&&(t.tracksTotal??=e)}break;case"DISCNUMBER":{let e=l.split("/"),n=Number.parseInt(e[0],10),r=e[1]&&Number.parseInt(e[1],10);Number.isInteger(n)&&n>0&&(t.discNumber??=n),r&&Number.isInteger(r)&&r>0&&(t.discsTotal??=r)}break;case"DISCTOTAL":{let e=Number.parseInt(l,10);Number.isInteger(e)&&e>0&&(t.discsTotal??=e)}break;case"DATE":{let e=new Date(l);Number.isNaN(e.getTime())||(t.date??=e)}break;case"GENRE":t.genre??=l;break;case"METADATA_BLOCK_PICTURE":{let e=sB(l),n=o6(e),r=n.getUint32(0,!1),i=n.getUint32(4,!1),a=String.fromCharCode(...e.subarray(8,8+i)),o=n.getUint32(8+i,!1),s=o5.decode(e.subarray(12+i,12+i+o)),c=n.getUint32(i+o+28),u=e.subarray(i+o+32,i+o+32+c);t.images??=[],t.images.push({data:u,mimeType:a,kind:3===r?"coverFront":4===r?"coverBack":"unknown",name:void 0,description:s||void 0})}}}},ly=[2,1,2,3,3,4,4,5],lv=e=>{if(e.length<7||11!==e[0]||119!==e[1])return null;let t=new o2(e);t.skipBits(16),t.skipBits(16);let n=t.readBits(2);if(3===n)return null;let r=t.readBits(6),i=t.readBits(5);if(i>8)return null;let a=t.readBits(3),o=t.readBits(3);return(1&o)!=0&&1!==o&&t.skipBits(2),(4&o)!=0&&t.skipBits(2),2===o&&t.skipBits(2),{fscod:n,bsid:i,bsmod:a,acmod:o,lfeon:t.readBits(1),bitRateCode:Math.floor(r/2)}},lb=[128,138,192,128,140,192,160,174,240,160,176,240,192,208,288,192,210,288,224,242,336,224,244,336,256,278,384,256,280,384,320,348,480,320,350,480,384,416,576,384,418,576,448,486,672,448,488,672,512,556,768,512,558,768,640,696,960,640,698,960,768,834,1152,768,836,1152,896,974,1344,896,976,1344,1024,1114,1536,1024,1116,1536,1280,1392,1920,1280,1394,1920,1536,1670,2304,1536,1672,2304,1792,1950,2688,1792,1952,2688,2048,2228,3072,2048,2230,3072,2304,2506,3456,2304,2508,3456,2560,2786,3840,2560,2788,3840];new Uint8Array([5,4,65,67,45,51]),new Uint8Array([5,4,69,65,67,51]);let lx=[1,2,3,6],lw=e=>{let t;if(e.length<6||11!==e[0]||119!==e[1])return null;let n=new o2(e);n.skipBits(16);let r=n.readBits(2);if(n.skipBits(3),0!==r&&2!==r)return null;let i=n.readBits(11),a=n.readBits(2),o=0;3===a?(o=n.readBits(2),t=3):t=n.readBits(2);let s=n.readBits(3),l=n.readBits(1),c=n.readBits(5);if(c<11||c>16)return null;let u=lx[t];return{dataRate:Math.round((i+1)*(a<3?sJ[a]/1e3:s0[o]/1e3)/(16*u)),substreams:[{fscod:a,fscod2:o,bsid:c,bsmod:0,acmod:s,lfeon:l,numDepSub:0,chanLoc:0}]}},lC=e=>{let t=e.substreams[0];return(oJ(t),t.fscod<3)?sJ[t.fscod]:null!==t.fscod2&&t.fscod2<3?s0[t.fscod2]:null},lS=e=>{let t=e.substreams[0];oJ(t);let n=ly[t.acmod]+t.lfeon;if(t.numDepSub>0){let e=[2,2,1,1,2,2,2,1,1];for(let r=0;r<9;r++)t.chanLoc&1<<8-r&&(n+=e[r])}return n};class lk{constructor(e){this.input=e}}let l_=[],lE=[];class lT{constructor(e){this.source=e}requestSlice(e,t){if(this.source._disposed)throw new lZ;if(e<0||null!==this.fileSize&&e+t>this.fileSize)return null;let n=e+t,r=this.source._read(e,n);return r instanceof Promise?r.then(t=>t?new lP(t.bytes,t.view,t.offset,e,n):null):r?new lP(r.bytes,r.view,r.offset,e,n):null}requestSliceRange(e,t,n){if(this.source._disposed)throw new lZ;if(e<0)return null;if(null!==this.fileSize)return this.requestSlice(e,sx(this.fileSize-e,t,n));{let r=this.requestSlice(e,n),i=r=>{if(r)return r;let i=r=>(oJ(null!==r),this.requestSlice(e,sx(r-e,t,n))),a=this.source._retrieveSize();return a instanceof Promise?a.then(i):i(a)};return r instanceof Promise?r.then(i):i(r)}}}class lP{constructor(e,t,n,r,i){this.bytes=e,this.view=t,this.offset=n,this.start=r,this.end=i,this.bufferPos=r-n}static tempFromBytes(e){return new lP(e,o6(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,t=this.end-e){if(e<this.start||e+t>this.end)throw RangeError("Slicing outside of original slice.");return new lP(this.bytes,this.view,this.offset,e,e+t)}}let lO=(e,t)=>{if(e.filePos<e.start||e.filePos+t>e.end)throw RangeError(`Tried reading [${e.filePos}, ${e.filePos+t}), but slice is [${e.start}, ${e.end}). This is likely an internal error, please report it alongside the file that caused it.`)},lA=(e,t)=>{lO(e,t);let n=e.bytes.subarray(e.bufferPos,e.bufferPos+t);return e.bufferPos+=t,n},lI=e=>(lO(e,1),e.view.getUint8(e.bufferPos++)),lR=(e,t)=>{lO(e,2);let n=e.view.getUint16(e.bufferPos,t);return e.bufferPos+=2,n},lL=e=>{lO(e,2);let t=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,t},lM=e=>{lO(e,3);let t=sy(e.view,e.bufferPos,!1);return e.bufferPos+=3,t},lN=e=>{lO(e,2);let t=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,t},lj=(e,t)=>{lO(e,4);let n=e.view.getUint32(e.bufferPos,t);return e.bufferPos+=4,n},lD=e=>{lO(e,4);let t=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,t},lz=e=>{lO(e,4);let t=e.view.getUint32(e.bufferPos,!0);return e.bufferPos+=4,t},lB=e=>{lO(e,4);let t=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,t},lF=(e,t)=>{let n,r;return t?(n=lj(e,!0),r=lj(e,!0)):(r=lj(e,!1),n=lj(e,!1)),0x100000000*r+n},lH=e=>0x100000000*lD(e)+lD(e),lV=e=>0x100000000*lB(e)+lD(e),lU=e=>{lO(e,8);let t=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,t},l$=(e,t)=>{lO(e,t);let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n};x("foUwZ");class lq{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){if(this._disposed)throw new lZ;return this._sizePromise??=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new lZ;let e=await this.getSizeOrNull();if(null===e)throw Error("Cannot determine the size of an unsized source.");return e}}class lW extends lq{constructor(e){if(!(e instanceof ArrayBuffer)&&!("u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)&&!ArrayBuffer.isView(e))throw TypeError("buffer must be an ArrayBuffer, SharedArrayBuffer, or ArrayBufferView.");super(),this._onreadCalled=!1,this._bytes=o8(e),this._view=o6(e)}_retrieveSize(){return this._bytes.byteLength}_read(){return this._onreadCalled||(this.onread?.(0,this._bytes.byteLength),this._onreadCalled=!0),{bytes:this._bytes,view:this._view,offset:0}}_dispose(){}}let lG=(e,t,n)=>{if(t instanceof Error&&(t.message.includes("Failed to fetch")||t.message.includes("Load failed")||t.message.includes("NetworkError when attempting to fetch resource"))){let e=null;try{"u">typeof window&&void 0!==window.location&&(e=new URL(n instanceof Request?n.url:n,window.location.href).origin)}catch{}if(("u"<typeof navigator||"boolean"!=typeof navigator.onLine||navigator.onLine)&&null!==e&&e!==window.location.origin)return console.warn("Request will not be retried because a CORS error was suspected due to different origins. You can modify this behavior by providing your own function for the 'getRetryDelay' option."),null}return Math.min(2**(e-2),16)};class lK extends lq{constructor(e,t={}){if("string"!=typeof e&&!(e instanceof URL)&&!("u">typeof Request&&e instanceof Request))throw TypeError("url must be a string, URL or Request.");if(!t||"object"!=typeof t)throw TypeError("options must be an object.");if(void 0!==t.requestInit&&(!t.requestInit||"object"!=typeof t.requestInit))throw TypeError("options.requestInit, when provided, must be an object.");if(void 0!==t.getRetryDelay&&"function"!=typeof t.getRetryDelay)throw TypeError("options.getRetryDelay, when provided, must be a function.");if(void 0!==t.maxCacheSize&&(!sH(t.maxCacheSize)||t.maxCacheSize<0))throw TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(void 0!==t.parallelism&&(!Number.isInteger(t.parallelism)||t.parallelism<1))throw TypeError("options.parallelism, when provided, must be a positive number.");if(void 0!==t.fetchFn&&"function"!=typeof t.fetchFn)throw TypeError("options.fetchFn, when provided, must be a function.");super(),this._existingResponses=new WeakMap,this._url=e,this._options=t,this._getRetryDelay=t.getRetryDelay??lG,this._orchestrator=new lX({maxCacheSize:t.maxCacheSize??0x4000000,maxWorkerCount:t.parallelism??2,runWorker:this._runWorker.bind(this),prefetchProfile:lY.network})}async _retrieveSize(){let e,t,n=new AbortController,r=await sT(this._options.fetchFn??fetch,this._url,s_(this._options.requestInit??{},{headers:{Range:"bytes=0-"},signal:n.signal}),this._getRetryDelay,()=>this._disposed);if(!r.ok)throw Error(`Error fetching ${String(this._url)}: ${r.status} ${r.statusText}`);if(206===r.status)t=this._getTotalLengthFromRangeResponse(r),e=this._orchestrator.createWorker(0,Math.min(t,524288));else{let n=r.headers.get("Content-Length");if(n)t=Number(n),e=this._orchestrator.createWorker(0,t),this._orchestrator.options.maxCacheSize=1/0,console.warn("HTTP server did not respond with 206 Partial Content, meaning the entire remote resource now has to be downloaded. For efficient media file streaming across a network, please make sure your server supports range requests.");else throw Error(`HTTP response (status ${r.status}) must surface Content-Length header.`)}return this._orchestrator.fileSize=t,this._existingResponses.set(e,{response:r,abortController:n}),this._orchestrator.runWorker(e),t}_read(e,t){return this._orchestrator.read(e,t)}async _runWorker(e){for(;;){let t=this._existingResponses.get(e);this._existingResponses.delete(e);let n=t?.abortController,r=t?.response;if(n||(n=new AbortController,r=await sT(this._options.fetchFn??fetch,this._url,s_(this._options.requestInit??{},{headers:{Range:`bytes=${e.currentPos}-`},signal:n.signal}),this._getRetryDelay,()=>this._disposed)),oJ(r),!r.ok)throw Error(`Error fetching ${String(this._url)}: ${r.status} ${r.statusText}`);if(e.currentPos>0&&206!==r.status)throw Error("HTTP server did not respond with 206 Partial Content to a range request. To enable efficient media file streaming across a network, please make sure your server supports range requests.");if(!r.body)throw Error("Missing HTTP response body stream. The used fetch function must provide the response body as a ReadableStream.");let i=r.body.getReader();for(;;){let t;if(e.currentPos>=e.targetPos||e.aborted){n.abort(),e.running=!1;return}try{t=await i.read()}catch(t){if(this._disposed)throw t;let e=this._getRetryDelay(1,t,this._url);if(null!==e){console.error("Error while reading response stream. Attempting to resume.",t),await new Promise(t=>setTimeout(t,1e3*e));break}throw t}if(e.aborted)continue;let{done:r,value:a}=t;if(r){if(e.currentPos>=e.targetPos){this._orchestrator.forgetWorker(e),e.running=!1;return}break}this.onread?.(e.currentPos,e.currentPos+a.length),this._orchestrator.supplyWorkerData(e,a)}}}_getTotalLengthFromRangeResponse(e){let t=e.headers.get("Content-Range");if(t){let e=/\/(\d+)/.exec(t);if(e)return Number(e[1])}let n=e.headers.get("Content-Length");if(n)return Number(n);throw Error("Partial HTTP response (status 206) must surface either Content-Range or Content-Length header.")}_dispose(){this._orchestrator.dispose()}}let lY={network:(e,t,n)=>{for(let r of(e=Math.max(0,65536*Math.floor((e-65536)/65536)),n))if(sz(e,t,Math.max((r.startPos+r.targetPos)/2,r.targetPos-8388608),r.targetPos)){let e=r.targetPos-r.startPos,n=8388608*Math.ceil((e+1)/8388608),i=Math.min(2**Math.ceil(Math.log2(e+1)),n);t=Math.max(t,r.startPos+i)}return t=Math.max(t,e+524288),{start:e,end:t}}};class lX{constructor(e){this.options=e,this.fileSize=null,this.nextAge=0,this.workers=[],this.cache=[],this.currentCacheSize=0,this.disposed=!1}read(e,t){oJ(null!==this.fileSize);let n=this.options.prefetchProfile(e,t,this.workers),r=Math.max(n.start,0),i=Math.min(n.end,this.fileSize);oJ(r<=e&&t<=i);let a=null,o=su(this.cache,e,e=>e.start),s=-1!==o?this.cache[o]:null;s&&s.start<=e&&t<=s.end&&(s.age=this.nextAge++,a={bytes:s.bytes,view:s.view,offset:s.start});let l=su(this.cache,r,e=>e.start),c=a?null:new Uint8Array(t-e),u=0,d=r,h=[];if(-1!==l){for(let n=l;n<this.cache.length;n++){let a=this.cache[n];if(a.start>=i)break;if(a.end<=r)continue;let o=Math.max(r,a.start),s=Math.min(i,a.end);if(oJ(o<=s),d<o&&h.push({start:d,end:o}),d=s,c){let n=Math.max(e,a.start),r=Math.min(t,a.end);if(n<r){let t=n-e;c.set(a.bytes.subarray(n-a.start,r-a.start),t),t===u&&(u=r-e)}}a.age=this.nextAge++}d<i&&h.push({start:d,end:i})}else h.push({start:r,end:i});if(c&&u>=c.length&&(a={bytes:c,view:o6(c),offset:e}),0===h.length)return oJ(a),a;let{promise:f,resolve:p,reject:m}=sh(),g=[];for(let n of h){let r=Math.max(e,n.start),i=Math.min(t,n.end);r===n.start&&i===n.end?g.push(n):r<i&&g.push({start:r,end:i})}for(let t of h){let n=c&&{start:e,bytes:c,holes:g,resolve:p,reject:m},r=!1;for(let e of this.workers)if(sz(t.start-131072,t.start,e.currentPos,e.targetPos)){e.targetPos=Math.max(e.targetPos,t.end),r=!0,n&&!e.pendingSlices.includes(n)&&e.pendingSlices.push(n),e.running||this.runWorker(e);break}if(!r){let e=this.createWorker(t.start,t.end);n&&(e.pendingSlices=[n]),this.runWorker(e)}}return a||(oJ(c),a=f.then(t=>({bytes:t,view:o6(t),offset:e}))),a}createWorker(e,t){let n={startPos:e,currentPos:e,targetPos:t,running:!1,aborted:this.disposed,pendingSlices:[],age:this.nextAge++};for(this.workers.push(n);this.workers.length>this.options.maxWorkerCount;){let e=0,t=this.workers[0];for(let n=1;n<this.workers.length;n++){let r=this.workers[n];r.age<t.age&&(e=n,t=r)}if(t.running&&t.pendingSlices.length>0)break;t.aborted=!0,this.workers.splice(e,1)}return n}runWorker(e){oJ(!e.running),oJ(e.currentPos<e.targetPos),e.running=!0,e.age=this.nextAge++,this.options.runWorker(e).catch(t=>{if(e.running=!1,e.pendingSlices.length>0)e.pendingSlices.forEach(e=>e.reject(t)),e.pendingSlices.length=0;else throw t})}supplyWorkerData(e,t){oJ(!e.aborted);let n=e.currentPos,r=n+t.length;this.insertIntoCache({start:n,end:r,bytes:t,view:o6(t),age:this.nextAge++}),e.currentPos+=t.length,e.targetPos=Math.max(e.targetPos,e.currentPos);for(let i=0;i<e.pendingSlices.length;i++){let a=e.pendingSlices[i],o=Math.max(n,a.start),s=Math.min(r,a.start+a.bytes.length);o<s&&a.bytes.set(t.subarray(o-n,s-n),o-a.start);for(let e=0;e<a.holes.length;e++){let t=a.holes[e];n<=t.start&&r>t.start&&(t.start=r),t.end<=t.start&&(a.holes.splice(e,1),e--)}0===a.holes.length&&(a.resolve(a.bytes),e.pendingSlices.splice(i,1),i--)}for(let t=0;t<this.workers.length;t++){let i=this.workers[t];e!==i&&!i.running&&sz(n,r,i.currentPos,i.targetPos)&&(this.workers.splice(t,1),t--)}}forgetWorker(e){let t=this.workers.indexOf(e);oJ(-1!==t),this.workers.splice(t,1)}insertIntoCache(e){if(0===this.options.maxCacheSize)return;let t=su(this.cache,e.start,e=>e.start)+1;if(t>0){let n=this.cache[t-1];if(n.end>=e.end)return;if(n.end>e.start){let r=new Uint8Array(e.end-n.start);r.set(n.bytes,0),r.set(e.bytes,e.start-n.start),this.currentCacheSize+=e.end-n.end,n.bytes=r,n.view=o6(r),n.end=e.end,t--,e=n}else this.cache.splice(t,0,e),this.currentCacheSize+=e.bytes.length}else this.cache.splice(t,0,e),this.currentCacheSize+=e.bytes.length;for(let n=t+1;n<this.cache.length;n++){let t=this.cache[n];if(e.end<=t.start)break;if(e.end>=t.end){this.cache.splice(n,1),this.currentCacheSize-=t.bytes.length,n--;continue}let r=new Uint8Array(t.end-e.start);r.set(e.bytes,0),r.set(t.bytes,t.start-e.start),this.currentCacheSize-=e.end-t.start,e.bytes=r,e.view=o6(r),e.end=t.end,this.cache.splice(n,1);break}for(;this.currentCacheSize>this.options.maxCacheSize;){let e=0,t=this.cache[0];for(let n=1;n<this.cache.length;n++){let r=this.cache[n];r.age<t.age&&(e=n,t=r)}if(this.currentCacheSize-t.bytes.length<=this.options.maxCacheSize)break;this.cache.splice(e,1),this.currentCacheSize-=t.bytes.length}}dispose(){for(let e of this.workers)e.aborted=!0;this.workers.length=0,this.cache.length=0,this.disposed=!0}}sF();class lQ{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||"object"!=typeof e)throw TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some(e=>!(e instanceof uB)))throw TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof lq))throw TypeError("options.source must be a Source.");if(e.source._disposed)throw Error("options.source must not be disposed.");this._formats=e.formats,this._source=e.source,this._reader=new lT(e.source)}_getDemuxer(){return this._demuxerPromise??=(async()=>{for(let e of(this._reader.fileSize=await this._source.getSizeOrNull(),this._formats))if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),oJ(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){let e=await this.getTracks();return 0===e.length?0:Math.min(...await Promise.all(e.map(e=>e.getFirstTimestamp())))}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter(e=>e.isVideoTrack())}async getAudioTracks(){return(await this.getTracks()).filter(e=>e.isAudioTrack())}async getPrimaryVideoTrack(){return(await this.getTracks()).find(e=>e.isVideoTrack())??null}async getPrimaryAudioTrack(){return(await this.getTracks()).find(e=>e.isAudioTrack())??null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class lZ extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}let lJ=new Uint8Array(0);class l0{constructor(e,t,n,r,i=-1,a,o){if(this.data=e,this.type=t,this.timestamp=n,this.duration=r,this.sequenceNumber=i,e===lJ&&void 0===a)throw Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===a&&(a=e.byteLength),!(e instanceof Uint8Array))throw TypeError("data must be a Uint8Array.");if("key"!==t&&"delta"!==t)throw TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw TypeError("timestamp must be a number.");if(!Number.isFinite(r)||r<0)throw TypeError("duration must be a non-negative number.");if(!Number.isFinite(i))throw TypeError("sequenceNumber must be a number.");if(!Number.isInteger(a)||a<0)throw TypeError("byteLength must be a non-negative integer.");if(void 0!==o&&("object"!=typeof o||!o))throw TypeError("sideData, when provided, must be an object.");if(o?.alpha!==void 0&&!(o.alpha instanceof Uint8Array))throw TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(o?.alphaByteLength!==void 0&&(!Number.isInteger(o.alphaByteLength)||o.alphaByteLength<0))throw TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=a,this.sideData=o??{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===lJ}get microsecondTimestamp(){return Math.trunc(sk*this.timestamp)}get microsecondDuration(){return Math.trunc(sk*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if("u"<typeof EncodedVideoChunk)throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if("u"<typeof EncodedVideoChunk)throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("u"<typeof EncodedAudioChunk)throw Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(e,t){if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");let n=new Uint8Array(e.byteLength);return e.copyTo(n),new l0(n,e.type,e.timestamp/1e6,(e.duration??0)/1e6,void 0,void 0,t)}clone(e){if(void 0!==e&&("object"!=typeof e||null===e))throw TypeError("options, when provided, must be an object.");if(e?.data!==void 0&&!(e.data instanceof Uint8Array))throw TypeError("options.data, when provided, must be a Uint8Array.");if(e?.type!==void 0&&"key"!==e.type&&"delta"!==e.type)throw TypeError('options.type, when provided, must be either "key" or "delta".');if(e?.timestamp!==void 0&&!Number.isFinite(e.timestamp))throw TypeError("options.timestamp, when provided, must be a number.");if(e?.duration!==void 0&&!Number.isFinite(e.duration))throw TypeError("options.duration, when provided, must be a number.");if(e?.sequenceNumber!==void 0&&!Number.isFinite(e.sequenceNumber))throw TypeError("options.sequenceNumber, when provided, must be a number.");if(e?.sideData!==void 0&&("object"!=typeof e.sideData||null===e.sideData))throw TypeError("options.sideData, when provided, must be an object.");return new l0(e?.data??this.data,e?.type??this.type,e?.timestamp??this.timestamp,e?.duration??this.duration,e?.sequenceNumber??this.sequenceNumber,this.byteLength,e?.sideData??this.sideData)}}sF();let l1=-1/0,l2=-1/0,l4=null;"u">typeof FinalizationRegistry&&(l4=new FinalizationRegistry(e=>{let t=Date.now();"video"===e.type?(t-l1>=1e3&&(console.error("A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them."),l1=t),"u">typeof VideoFrame&&e.data instanceof VideoFrame&&e.data.close()):(t-l2>=1e3&&(console.error("An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them."),l2=t),"u">typeof AudioData&&e.data instanceof AudioData&&e.data.close())}));let l3=["I420","I420P10","I420P12","I420A","I420AP10","I420AP12","I422","I422P10","I422P12","I422A","I422AP10","I422AP12","I444","I444P10","I444P12","I444A","I444AP10","I444AP12","NV12","RGBA","RGBX","BGRA","BGRX"],l8=new Set(l3);class l6{get displayWidth(){return this.rotation%180==0?this.codedWidth:this.codedHeight}get displayHeight(){return this.rotation%180==0?this.codedHeight:this.codedWidth}get microsecondTimestamp(){return Math.trunc(sk*this.timestamp)}get microsecondDuration(){return Math.trunc(sk*this.duration)}get hasAlpha(){return this.format&&this.format.includes("A")}constructor(e,t){if(this._closed=!1,e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e)){if(!t||"object"!=typeof t)throw TypeError("init must be an object.");if(void 0===t.format||!l8.has(t.format))throw TypeError("init.format must be one of: "+l3.join(", "));if(!Number.isInteger(t.codedWidth)||t.codedWidth<=0)throw TypeError("init.codedWidth must be a positive integer.");if(!Number.isInteger(t.codedHeight)||t.codedHeight<=0)throw TypeError("init.codedHeight must be a positive integer.");if(void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(t.timestamp))throw TypeError("init.timestamp must be a number.");if(void 0!==t.duration&&(!Number.isFinite(t.duration)||t.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=o8(e).slice(),this._layout=t.layout??cn(t.format,t.codedWidth,t.codedHeight),this.format=t.format,this.codedWidth=t.codedWidth,this.codedHeight=t.codedHeight,this.rotation=t.rotation??0,this.timestamp=t.timestamp,this.duration=t.duration??0,this.colorSpace=new l5(t.colorSpace)}else if("u">typeof VideoFrame&&e instanceof VideoFrame){if(t?.rotation!==void 0&&![0,90,180,270].includes(t.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(t?.timestamp!==void 0&&!Number.isFinite(t?.timestamp))throw TypeError("init.timestamp, when provided, must be a number.");if(t?.duration!==void 0&&(!Number.isFinite(t.duration)||t.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=e,this._layout=null,this.format=e.format,this.codedWidth=e.displayWidth,this.codedHeight=e.displayHeight,this.rotation=t?.rotation??0,this.timestamp=t?.timestamp??e.timestamp/1e6,this.duration=t?.duration??(e.duration??0)/1e6,this.colorSpace=new l5(e.colorSpace)}else if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof SVGImageElement&&e instanceof SVGImageElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof HTMLVideoElement&&e instanceof HTMLVideoElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas){if(!t||"object"!=typeof t)throw TypeError("init must be an object.");if(void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(t.timestamp))throw TypeError("init.timestamp must be a number.");if(void 0!==t.duration&&(!Number.isFinite(t.duration)||t.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");if("u">typeof VideoFrame)return new l6(new VideoFrame(e,{timestamp:Math.trunc(t.timestamp*sk),duration:Math.trunc((t.duration??0)*sk)||void 0}),t);let n=0,r=0;if("naturalWidth"in e?(n=e.naturalWidth,r=e.naturalHeight):"videoWidth"in e?(n=e.videoWidth,r=e.videoHeight):"width"in e&&(n=Number(e.width),r=Number(e.height)),!n||!r)throw TypeError("Could not determine dimensions.");let i=new OffscreenCanvas(n,r),a=i.getContext("2d",{alpha:sR(),willReadFrequently:!0});oJ(a),a.drawImage(e,0,0),this._data=i,this._layout=null,this.format="RGBX",this.codedWidth=n,this.codedHeight=r,this.rotation=t.rotation??0,this.timestamp=t.timestamp,this.duration=t.duration??0,this.colorSpace=new l5({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else throw TypeError("Invalid data type: Must be a BufferSource or CanvasImageSource.");l4?.register(this,{type:"video",data:this._data},this)}clone(){if(this._closed)throw Error("VideoSample is closed.");return(oJ(null!==this._data),l9(this._data))?new l6(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?(oJ(this._layout),new l6(this._data,{format:this.format,layout:this._layout,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})):new l6(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})}close(){this._closed||(l4?.unregister(this),l9(this._data)?this._data.close():this._data=null,this._closed=!0)}allocationSize(e={}){if(ct(e),this._closed)throw Error("VideoSample is closed.");if(null===this.format)throw Error("Cannot get allocation size when format is null. Sorry!");if(oJ(null!==this._data),!l9(this._data)&&(e.colorSpace||e.format&&e.format!==this.format||e.layout||e.rect)){let t=this.toVideoFrame(),n=t.allocationSize(e);return t.close(),n}return l9(this._data)?this._data.allocationSize(e):this._data instanceof Uint8Array?this._data.byteLength:this.codedWidth*this.codedHeight*4}async copyTo(e,t={}){if(!sa(e))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(ct(t),this._closed)throw Error("VideoSample is closed.");if(null===this.format)throw Error("Cannot copy video sample data when format is null. Sorry!");if(oJ(null!==this._data),!l9(this._data)&&(t.colorSpace||t.format&&t.format!==this.format||t.layout||t.rect)){let n=this.toVideoFrame(),r=await n.copyTo(e,t);return n.close(),r}if(l9(this._data))return this._data.copyTo(e,t);if(this._data instanceof Uint8Array)return oJ(this._layout),o8(e).set(this._data),this._layout;{let t=this._data.getContext("2d");oJ(t);let n=t.getImageData(0,0,this.codedWidth,this.codedHeight);return o8(e).set(n.data),[{offset:0,stride:4*this.codedWidth}]}}toVideoFrame(){if(this._closed)throw Error("VideoSample is closed.");return(oJ(null!==this._data),l9(this._data))?new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0}):this._data instanceof Uint8Array?new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace}):new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}draw(e,t,n,r,i,a,o,s,l){let c=0,u=0,d=this.displayWidth,h=this.displayHeight,f=0,p=0,m=this.displayWidth,g=this.displayHeight;if(void 0!==a?(c=t,u=n,d=r,h=i,f=a,p=o,void 0!==s?(m=s,g=l):(m=d,g=h)):(f=t,p=n,void 0!==r&&(m=r,g=i)),!("u">typeof CanvasRenderingContext2D&&e instanceof CanvasRenderingContext2D||"u">typeof OffscreenCanvasRenderingContext2D&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Number.isFinite(c))throw TypeError("sx must be a number.");if(!Number.isFinite(u))throw TypeError("sy must be a number.");if(!Number.isFinite(d)||d<0)throw TypeError("sWidth must be a non-negative number.");if(!Number.isFinite(h)||h<0)throw TypeError("sHeight must be a non-negative number.");if(!Number.isFinite(f))throw TypeError("dx must be a number.");if(!Number.isFinite(p))throw TypeError("dy must be a number.");if(!Number.isFinite(m)||m<0)throw TypeError("dWidth must be a non-negative number.");if(!Number.isFinite(g)||g<0)throw TypeError("dHeight must be a non-negative number.");if(this._closed)throw Error("VideoSample is closed.");({sx:c,sy:u,sWidth:d,sHeight:h}=this._rotateSourceRegion(c,u,d,h,this.rotation));let y=this.toCanvasImageSource();e.save();let v=f+m/2,b=p+g/2;e.translate(v,b),e.rotate(this.rotation*Math.PI/180);let x=this.rotation%180==0?1:m/g;e.scale(1/x,x),e.drawImage(y,c,u,d,h,-m/2,-g/2,m,g),e.restore()}drawWithFit(e,t){let n,r,i,a;if(!("u">typeof CanvasRenderingContext2D&&e instanceof CanvasRenderingContext2D||"u">typeof OffscreenCanvasRenderingContext2D&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!t||"object"!=typeof t)throw TypeError("options must be an object.");if(!["fill","contain","cover"].includes(t.fit))throw TypeError("options.fit must be 'fill', 'contain', or 'cover'.");if(void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw TypeError("options.rotation, when provided, must be 0, 90, 180, or 270.");void 0!==t.crop&&ce(t.crop,"options.");let o=e.canvas.width,s=e.canvas.height,l=t.rotation??this.rotation,[c,u]=l%180==0?[this.codedWidth,this.codedHeight]:[this.codedHeight,this.codedWidth];t.crop&&l7(t.crop,c,u);let{sx:d,sy:h,sWidth:f,sHeight:p}=this._rotateSourceRegion(t.crop?.left??0,t.crop?.top??0,t.crop?.width??c,t.crop?.height??u,l);if("fill"===t.fit)n=0,r=0,i=o,a=s;else{let[e,l]=t.crop?[t.crop.width,t.crop.height]:[c,u],d="contain"===t.fit?Math.min(o/e,s/l):Math.max(o/e,s/l);i=e*d,a=l*d,n=(o-i)/2,r=(s-a)/2}e.save();let m=l%180==0?1:i/a;e.translate(o/2,s/2),e.rotate(l*Math.PI/180),e.scale(1/m,m),e.translate(-o/2,-s/2),e.drawImage(this.toCanvasImageSource(),d,h,f,p,n,r,i,a),e.restore()}_rotateSourceRegion(e,t,n,r,i){return 90===i?[e,t,n,r]=[t,this.codedHeight-e-n,r,n]:180===i?[e,t]=[this.codedWidth-e-n,this.codedHeight-t-r]:270===i&&([e,t,n,r]=[this.codedWidth-t-r,e,r,n]),{sx:e,sy:t,sWidth:n,sHeight:r}}toCanvasImageSource(){if(this._closed)throw Error("VideoSample is closed.");if(oJ(null!==this._data),!(this._data instanceof Uint8Array))return this._data;{let e=this.toVideoFrame();return queueMicrotask(()=>e.close()),e}}setRotation(e){if(![0,90,180,270].includes(e))throw TypeError("newRotation must be 0, 90, 180, or 270.");this.rotation=e}setTimestamp(e){if(!Number.isFinite(e))throw TypeError("newTimestamp must be a number.");this.timestamp=e}setDuration(e){if(!Number.isFinite(e)||e<0)throw TypeError("newDuration must be a non-negative number.");this.duration=e}[Symbol.dispose](){this.close()}}class l5{constructor(e){this.primaries=e?.primaries??null,this.transfer=e?.transfer??null,this.matrix=e?.matrix??null,this.fullRange=e?.fullRange??null}toJSON(){return{primaries:this.primaries,transfer:this.transfer,matrix:this.matrix,fullRange:this.fullRange}}}let l9=e=>"u">typeof VideoFrame&&e instanceof VideoFrame,l7=(e,t,n)=>{e.left=Math.min(e.left,t),e.top=Math.min(e.top,n),e.width=Math.min(e.width,t-e.left),e.height=Math.min(e.height,n-e.top),oJ(e.width>=0),oJ(e.height>=0)},ce=(e,t)=>{if(!e||"object"!=typeof e)throw TypeError(t+"crop, when provided, must be an object.");if(!Number.isInteger(e.left)||e.left<0)throw TypeError(t+"crop.left must be a non-negative integer.");if(!Number.isInteger(e.top)||e.top<0)throw TypeError(t+"crop.top must be a non-negative integer.");if(!Number.isInteger(e.width)||e.width<0)throw TypeError(t+"crop.width must be a non-negative integer.");if(!Number.isInteger(e.height)||e.height<0)throw TypeError(t+"crop.height must be a non-negative integer.")},ct=e=>{if(!e||"object"!=typeof e)throw TypeError("options must be an object.");if(void 0!==e.colorSpace&&!["display-p3","srgb"].includes(e.colorSpace))throw TypeError("options.colorSpace, when provided, must be 'display-p3' or 'srgb'.");if(void 0!==e.format&&"string"!=typeof e.format)throw TypeError("options.format, when provided, must be a string.");if(void 0!==e.layout){if(!Array.isArray(e.layout))throw TypeError("options.layout, when provided, must be an array.");for(let t of e.layout){if(!t||"object"!=typeof t)throw TypeError("Each entry in options.layout must be an object.");if(!Number.isInteger(t.offset)||t.offset<0)throw TypeError("plane.offset must be a non-negative integer.");if(!Number.isInteger(t.stride)||t.stride<0)throw TypeError("plane.stride must be a non-negative integer.")}}if(void 0!==e.rect){if(!e.rect||"object"!=typeof e.rect)throw TypeError("options.rect, when provided, must be an object.");if(void 0!==e.rect.x&&(!Number.isInteger(e.rect.x)||e.rect.x<0))throw TypeError("options.rect.x, when provided, must be a non-negative integer.");if(void 0!==e.rect.y&&(!Number.isInteger(e.rect.y)||e.rect.y<0))throw TypeError("options.rect.y, when provided, must be a non-negative integer.");if(void 0!==e.rect.width&&(!Number.isInteger(e.rect.width)||e.rect.width<0))throw TypeError("options.rect.width, when provided, must be a non-negative integer.");if(void 0!==e.rect.height&&(!Number.isInteger(e.rect.height)||e.rect.height<0))throw TypeError("options.rect.height, when provided, must be a non-negative integer.")}},cn=(e,t,n)=>{let r=cr(e),i=[],a=0;for(let e of r){let r=Math.ceil(t/e.widthDivisor),o=Math.ceil(n/e.heightDivisor),s=r*e.sampleBytes,l=s*o;i.push({offset:a,stride:s}),a+=l}return i},cr=e=>{let t=(e,t,n,r,i)=>{let a=[{sampleBytes:e,widthDivisor:1,heightDivisor:1},{sampleBytes:t,widthDivisor:n,heightDivisor:r},{sampleBytes:t,widthDivisor:n,heightDivisor:r}];return i&&a.push({sampleBytes:e,widthDivisor:1,heightDivisor:1}),a};switch(e){case"I420":return t(1,1,2,2,!1);case"I420P10":case"I420P12":return t(2,2,2,2,!1);case"I420A":return t(1,1,2,2,!0);case"I420AP10":case"I420AP12":return t(2,2,2,2,!0);case"I422":return t(1,1,2,1,!1);case"I422P10":case"I422P12":return t(2,2,2,1,!1);case"I422A":return t(1,1,2,1,!0);case"I422AP10":case"I422AP12":return t(2,2,2,1,!0);case"I444":return t(1,1,1,1,!1);case"I444P10":case"I444P12":return t(2,2,1,1,!1);case"I444A":return t(1,1,1,1,!0);case"I444AP10":case"I444AP12":return t(2,2,1,1,!0);case"NV12":return[{sampleBytes:1,widthDivisor:1,heightDivisor:1},{sampleBytes:2,widthDivisor:2,heightDivisor:2}];case"RGBA":case"RGBX":case"BGRA":case"BGRX":return[{sampleBytes:4,widthDivisor:1,heightDivisor:1}];default:sg(e),oJ(!1)}},ci=new Set(["f32","f32-planar","s16","s16-planar","s32","s32-planar","u8","u8-planar"]);class ca{get microsecondTimestamp(){return Math.trunc(sk*this.timestamp)}get microsecondDuration(){return Math.trunc(sk*this.duration)}constructor(e){if(this._closed=!1,cu(e)){if(null===e.format)throw TypeError("AudioData with null format is not supported.");this._data=e,this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=e.numberOfFrames,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp/1e6,this.duration=e.numberOfFrames/e.sampleRate}else{let t;if(!e||"object"!=typeof e)throw TypeError("Invalid AudioDataInit: must be an object.");if(!ci.has(e.format))throw TypeError("Invalid AudioDataInit: invalid format.");if(!Number.isFinite(e.sampleRate)||e.sampleRate<=0)throw TypeError("Invalid AudioDataInit: sampleRate must be > 0.");if(!Number.isInteger(e.numberOfChannels)||0===e.numberOfChannels)throw TypeError("Invalid AudioDataInit: numberOfChannels must be an integer > 0.");if(!Number.isFinite(e?.timestamp))throw TypeError("init.timestamp must be a number.");let n=e.data.byteLength/(co(e.format)*e.numberOfChannels);if(!Number.isInteger(n))throw TypeError("Invalid AudioDataInit: data size is not a multiple of frame size.");if(this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=n,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp,this.duration=n/e.sampleRate,e.data instanceof ArrayBuffer)t=new Uint8Array(e.data);else if(ArrayBuffer.isView(e.data))t=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength);else throw TypeError("Invalid AudioDataInit: data is not a BufferSource.");let r=this.numberOfFrames*this.numberOfChannels*co(this.format);if(t.byteLength<r)throw TypeError("Invalid AudioDataInit: insufficient data size.");this._data=t}l4?.register(this,{type:"audio",data:this._data},this)}allocationSize(e){if(!e||"object"!=typeof e)throw TypeError("options must be an object.");if(!Number.isInteger(e.planeIndex)||e.planeIndex<0)throw TypeError("planeIndex must be a non-negative integer.");if(void 0!==e.format&&!ci.has(e.format))throw TypeError("Invalid format.");if(void 0!==e.frameOffset&&(!Number.isInteger(e.frameOffset)||e.frameOffset<0))throw TypeError("frameOffset must be a non-negative integer.");if(void 0!==e.frameCount&&(!Number.isInteger(e.frameCount)||e.frameCount<0))throw TypeError("frameCount must be a non-negative integer.");if(this._closed)throw Error("AudioSample is closed.");let t=e.format??this.format,n=e.frameOffset??0;if(n>=this.numberOfFrames)throw RangeError("frameOffset out of range");let r=void 0!==e.frameCount?e.frameCount:this.numberOfFrames-n;if(r>this.numberOfFrames-n)throw RangeError("frameCount out of range");let i=co(t),a=cs(t);if(a&&e.planeIndex>=this.numberOfChannels||!a&&0!==e.planeIndex)throw RangeError("planeIndex out of range");return(a?r:r*this.numberOfChannels)*i}copyTo(e,t){if(!sa(e))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(!t||"object"!=typeof t)throw TypeError("options must be an object.");if(!Number.isInteger(t.planeIndex)||t.planeIndex<0)throw TypeError("planeIndex must be a non-negative integer.");if(void 0!==t.format&&!ci.has(t.format))throw TypeError("Invalid format.");if(void 0!==t.frameOffset&&(!Number.isInteger(t.frameOffset)||t.frameOffset<0))throw TypeError("frameOffset must be a non-negative integer.");if(void 0!==t.frameCount&&(!Number.isInteger(t.frameCount)||t.frameCount<0))throw TypeError("frameCount must be a non-negative integer.");if(this._closed)throw Error("AudioSample is closed.");let{planeIndex:n,format:r,frameCount:i,frameOffset:a}=t,o=this.format,s=r??this.format;if(!s)throw Error("Destination format not determined");let l=this.numberOfFrames,c=this.numberOfChannels,u=a??0;if(u>=l)throw RangeError("frameOffset out of range");let d=void 0!==i?i:l-u;if(d>l-u)throw RangeError("frameCount out of range");let h=co(s),f=cs(s);if(f&&n>=c||!f&&0!==n)throw RangeError("planeIndex out of range");let p=f?d:d*c;if(e.byteLength<p*h)throw RangeError("Destination buffer is too small");let m=o6(e),g=cc(s);if(cu(this._data))sA()&&c>2&&s!==o?cd(this._data,m,o,s,c,n,u,d):this._data.copyTo(e,{planeIndex:n,frameOffset:u,frameCount:d,format:s});else{let e=o6(this._data),t=cl(o),r=co(o),i=cs(o);for(let a=0;a<d;a++)if(f)g(m,a*h,t(e,i?(n*l+(a+u))*r:((a+u)*c+n)*r));else for(let n=0;n<c;n++)g(m,(a*c+n)*h,t(e,i?(n*l+(a+u))*r:((a+u)*c+n)*r))}}clone(){if(this._closed)throw Error("AudioSample is closed.");if(!cu(this._data))return new ca({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data});{let e=new ca(this._data.clone());return e.setTimestamp(this.timestamp),e}}close(){this._closed||(l4?.unregister(this),cu(this._data)?this._data.close():this._data=new Uint8Array(0),this._closed=!0)}toAudioData(){if(this._closed)throw Error("AudioSample is closed.");if(!cu(this._data))return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:this._data.buffer instanceof ArrayBuffer?this._data.buffer:this._data.slice()});if(this._data.timestamp===this.microsecondTimestamp)return this._data.clone();if(cs(this.format)){let e=this.allocationSize({planeIndex:0,format:this.format}),t=new ArrayBuffer(e*this.numberOfChannels);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(new Uint8Array(t,n*e,e),{planeIndex:n,format:this.format});return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:t})}{let e=new ArrayBuffer(this.allocationSize({planeIndex:0,format:this.format}));return this.copyTo(e,{planeIndex:0,format:this.format}),new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:e})}}toAudioBuffer(){if(this._closed)throw Error("AudioSample is closed.");let e=new AudioBuffer({numberOfChannels:this.numberOfChannels,length:this.numberOfFrames,sampleRate:this.sampleRate}),t=new Float32Array(this.allocationSize({planeIndex:0,format:"f32-planar"})/4);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(t,{planeIndex:n,format:"f32-planar"}),e.copyToChannel(t,n);return e}setTimestamp(e){if(!Number.isFinite(e))throw TypeError("newTimestamp must be a number.");this.timestamp=e}[Symbol.dispose](){this.close()}static*_fromAudioBuffer(e,t){if(!(e instanceof AudioBuffer))throw TypeError("audioBuffer must be an AudioBuffer.");let n=e.numberOfChannels,r=e.sampleRate,i=e.length,a=Math.floor(24e4/n),o=0,s=i;for(;s>0;){let i=Math.min(a,s),l=new Float32Array(n*i);for(let t=0;t<n;t++)e.copyFromChannel(l.subarray(t*i,(t+1)*i),t,o);yield new ca({format:"f32-planar",sampleRate:r,numberOfFrames:i,numberOfChannels:n,timestamp:t+o/r,data:l}),o+=i,s-=i}}static fromAudioBuffer(e,t){if(!(e instanceof AudioBuffer))throw TypeError("audioBuffer must be an AudioBuffer.");let n=e.numberOfChannels,r=e.sampleRate,i=e.length,a=Math.floor(24e4/n),o=0,s=i,l=[];for(;s>0;){let i=Math.min(a,s),c=new Float32Array(n*i);for(let t=0;t<n;t++)e.copyFromChannel(c.subarray(t*i,(t+1)*i),t,o);let u=new ca({format:"f32-planar",sampleRate:r,numberOfFrames:i,numberOfChannels:n,timestamp:t+o/r,data:c});l.push(u),o+=i,s-=i}return l}}let co=e=>{switch(e){case"u8":case"u8-planar":return 1;case"s16":case"s16-planar":return 2;case"s32":case"s32-planar":case"f32":case"f32-planar":return 4;default:throw Error("Unknown AudioSampleFormat")}},cs=e=>{switch(e){case"u8-planar":case"s16-planar":case"s32-planar":case"f32-planar":return!0;default:return!1}},cl=e=>{switch(e){case"u8":case"u8-planar":return(e,t)=>(e.getUint8(t)-128)/128;case"s16":case"s16-planar":return(e,t)=>e.getInt16(t,!0)/32768;case"s32":case"s32-planar":return(e,t)=>e.getInt32(t,!0)/0x80000000;case"f32":case"f32-planar":return(e,t)=>e.getFloat32(t,!0)}},cc=e=>{switch(e){case"u8":case"u8-planar":return(e,t,n)=>e.setUint8(t,sx((n+1)*127.5,0,255));case"s16":case"s16-planar":return(e,t,n)=>e.setInt16(t,sx(Math.round(32767*n),-32768,32767),!0);case"s32":case"s32-planar":return(e,t,n)=>e.setInt32(t,sx(Math.round(0x7fffffff*n),-0x80000000,0x7fffffff),!0);case"f32":case"f32-planar":return(e,t,n)=>e.setFloat32(t,n,!0)}},cu=e=>"u">typeof AudioData&&e instanceof AudioData,cd=(e,t,n,r,i,a,o,s)=>{let l=cl(n),c=cc(r),u=co(n),d=co(r),h=cs(n);if(cs(r))if(h){let r=new ArrayBuffer(s*u),i=o6(r);e.copyTo(r,{planeIndex:a,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=e*u;c(t,e*d,l(i,n))}}else{let r=new ArrayBuffer(s*i*u),h=o6(r);e.copyTo(r,{planeIndex:0,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=(e*i+a)*u;c(t,e*d,l(h,n))}}else if(h){let r=new ArrayBuffer(s*u),a=o6(r);for(let h=0;h<i;h++){e.copyTo(r,{planeIndex:h,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=e*u;c(t,(e*i+h)*d,l(a,n))}}}else{let r=new ArrayBuffer(s*i*u),a=o6(r);e.copyTo(r,{planeIndex:0,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++)for(let n=0;n<i;n++){let r=e*i+n,o=r*u;c(t,r*d,l(a,o))}}},ch=e=>{if(!e||"object"!=typeof e)throw TypeError("options must be an object.");if(void 0!==e.metadataOnly&&"boolean"!=typeof e.metadataOnly)throw TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==e.verifyKeyPackets&&"boolean"!=typeof e.verifyKeyPackets)throw TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(e.verifyKeyPackets&&e.metadataOnly)throw TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},cf=e=>{if(!sH(e))throw TypeError("timestamp must be a number.")},cp=(e,t,n)=>n.verifyKeyPackets?t.then(async t=>{if(!t||"delta"===t.type)return t;let n=await e.determinePacketType(t);return n&&(t.type=n),t}):t;class cm{constructor(e){if(!(e instanceof cS))throw TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(ch(e),this._track.input._disposed)throw new lZ;return cp(this._track,this._track._backing.getFirstPacket(e),e)}getPacket(e,t={}){if(cf(e),ch(t),this._track.input._disposed)throw new lZ;return cp(this._track,this._track._backing.getPacket(e,t),t)}getNextPacket(e,t={}){if(!(e instanceof l0))throw TypeError("packet must be an EncodedPacket.");if(ch(t),this._track.input._disposed)throw new lZ;return cp(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(cf(e),ch(t),this._track.input._disposed)throw new lZ;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);let n=await this._track._backing.getKeyPacket(e,t);return n&&(oJ("key"===n.type),"delta"===await this._track.determinePacketType(n))?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,t):n}async getNextKeyPacket(e,t={}){if(!(e instanceof l0))throw TypeError("packet must be an EncodedPacket.");if(ch(t),this._track.input._disposed)throw new lZ;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);let n=await this._track._backing.getNextKeyPacket(e,t);return n&&(oJ("key"===n.type),"delta"===await this._track.determinePacketType(n))?this.getNextKeyPacket(n,t):n}packets(e,t,n={}){if(void 0!==e&&!(e instanceof l0))throw TypeError("startPacket must be an EncodedPacket.");if(void 0!==e&&e.isMetadataOnly&&!n?.metadataOnly)throw TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==t&&!(t instanceof l0))throw TypeError("endPacket must be an EncodedPacket.");if(ch(n),this._track.input._disposed)throw new lZ;let r=[],{promise:i,resolve:a}=sh(),{promise:o,resolve:s}=sh(),l=!1,c=!1,u=null,d=[],h=()=>Math.max(2,d.length);(async()=>{let u=e??await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=t?.sequenceNumber);){if(r.length>h()){({promise:o,resolve:s}=sh()),await o;continue}r.push(u),a(),({promise:i,resolve:a}=sh()),u=await this.getNextPacket(u,n)}l=!0,a()})().catch(e=>{u||(u=e,a())});let f=this._track;return{async next(){for(;;)if(f.input._disposed)throw new lZ;else if(c)return{value:void 0,done:!0};else if(u)throw u;else if(r.length>0){let e=r.shift(),t=performance.now();for(d.push(t);d.length>0&&t-d[0]>=1e3;)d.shift();return s(),{value:e,done:!1}}else{if(l)return{value:void 0,done:!0};await i}},return:async()=>(c=!0,s(),a(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}}class cg{constructor(e,t){this.onSample=e,this.onError=t}}class cy{mediaSamplesInRange(e=0,t=1/0){cf(e),cf(t);let n=[],r=!1,i=null,{promise:a,resolve:o}=sh(),{promise:s,resolve:l}=sh(),c=!1,u=!1,d=!1,h=null;(async()=>{let f=await this._createDecoder(s=>{(l(),s.timestamp>=t&&(u=!0),u)?s.close():(i&&(s.timestamp>e?(n.push(i),r=!0):i.close()),s.timestamp>=e&&(n.push(s),r=!0),i=r?null:s,n.length>0&&(o(),{promise:a,resolve:o}=sh()))},e=>{h||(h=e,o())}),p=this._createPacketSink(),m=await p.getKeyPacket(e,{verifyKeyPackets:!0})??await p.getFirstPacket(),g=m,y=p.packets(m??void 0,void 0);for(await y.next();g&&!u&&!this._track.input._disposed;){let e=cv(n.length);if(n.length+f.getDecodeQueueSize()>e){({promise:s,resolve:l}=sh()),await s;continue}f.decode(g);let t=await y.next();if(t.done)break;g=t.value}await y.return(),d||this._track.input._disposed||await f.flush(),f.close(),!r&&i&&n.push(i),c=!0,o()})().catch(e=>{h||(h=e,o())});let f=this._track,p=()=>{for(let e of(i?.close(),n))e.close()};return{async next(){for(;;)if(f.input._disposed)throw p(),new lZ;else if(d)return{value:void 0,done:!0};else if(h)throw p(),h;else if(n.length>0){let e=n.shift();return l(),{value:e,done:!1}}else{if(c)return{value:void 0,done:!0};await a}},return:async()=>(d=!0,u=!0,l(),o(),p(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e){if(!(Symbol.iterator in e)&&!(Symbol.asyncIterator in e))throw TypeError("Argument must be an iterable or async iterable.");let t=sm(e),n=[],r=[],{promise:i,resolve:a}=sh(),{promise:o,resolve:s}=sh(),l=!1,c=!1,u=null,d=e=>{r.push(e),a(),{promise:i,resolve:a}=sh()};(async()=>{let e=await this._createDecoder(e=>{if(s(),c)return void e.close();let t=0;for(;n.length>0&&e.timestamp-n[0]>-1e-10;)t++,n.shift();if(t>0)for(let n=0;n<t;n++)d(n<t-1?e.clone():e);else e.close()},e=>{u||(u=e,a())}),i=this._createPacketSink(),h=null,f=null,p=-1,m=async()=>{oJ(f);let t=f;for(e.decode(t);t.sequenceNumber<p;){let n=cv(r.length);for(;r.length+e.getDecodeQueueSize()>n&&!c;)({promise:o,resolve:s}=sh()),await o;if(c)break;let a=await i.getNextPacket(t);oJ(a),e.decode(a),t=a}p=-1},g=async()=>{await e.flush();for(let e=0;e<n.length;e++)d(null);n.length=0};for await(let e of t){if(cf(e),c||this._track.input._disposed)break;let t=await i.getPacket(e),r=t&&await i.getKeyPacket(e,{verifyKeyPackets:!0});if(!r){-1!==p&&(await m(),await g()),d(null),h=null;continue}h&&(r.sequenceNumber!==f.sequenceNumber||t.timestamp<h.timestamp)&&(await m(),await g()),n.push(t.timestamp),p=Math.max(t.sequenceNumber,p),h=t,f=r}c||this._track.input._disposed||(-1!==p&&await m(),await g()),e.close(),l=!0,a()})().catch(e=>{u||(u=e,a())});let h=this._track,f=()=>{for(let e of r)e?.close()};return{async next(){for(;;)if(h.input._disposed)throw f(),new lZ;else if(c)return{value:void 0,done:!0};else if(u)throw f(),u;else if(r.length>0){let e=r.shift();return oJ(void 0!==e),s(),{value:e,done:!1}}else{if(l)return{value:void 0,done:!0};await i}},return:async()=>(c=!0,s(),a(),f(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}}let cv=e=>0===e?40:8;class cb extends cg{constructor(e,t,n,r,i,a){super(e,t),this.codec=n,this.decoderConfig=r,this.rotation=i,this.timeResolution=a,this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new sP,this.customDecoderQueueSize=0,this.inputTimestamps=[],this.sampleQueue=[],this.currentPacketIndex=0,this.raslSkipped=!1,this.alphaDecoder=null,this.alphaHadKeyframe=!1,this.colorQueue=[],this.alphaQueue=[],this.merger=null,this.mergerCreationFailed=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue=[],this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1;let o=l_.find(e=>e.supports(n,r));if(o)this.customDecoder=new o,this.customDecoder.codec=n,this.customDecoder.config=r,this.customDecoder.onSample=e=>{if(!(e instanceof l6))throw TypeError("The argument passed to onSample must be a VideoSample.");this.finalizeAndEmitSample(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{let e=e=>{if(this.alphaQueue.length>0){let t=this.alphaQueue.shift();oJ(void 0!==t),this.mergeAlpha(e,t)}else this.colorQueue.push(e)};if("avc"===n&&this.decoderConfig.description&&sM()){let e=(e=>{try{let t=o6(e),n=0,r=t.getUint8(n++),i=t.getUint8(n++),a=t.getUint8(n++),o=t.getUint8(n++),s=3&t.getUint8(n++),l=31&t.getUint8(n++),c=[];for(let r=0;r<l;r++){let r=t.getUint16(n,!1);n+=2,c.push(e.subarray(n,n+r)),n+=r}let u=t.getUint8(n++),d=[];for(let r=0;r<u;r++){let r=t.getUint16(n,!1);n+=2,d.push(e.subarray(n,n+r)),n+=r}let h={configurationVersion:r,avcProfileIndication:i,profileCompatibility:a,avcLevelIndication:o,lengthSizeMinusOne:s,sequenceParameterSets:c,pictureParameterSets:d,chromaFormat:null,bitDepthLumaMinus8:null,bitDepthChromaMinus8:null,sequenceParameterSetExt:null};if((100===i||110===i||122===i||144===i)&&n+4<=e.length){let r=3&t.getUint8(n++),i=7&t.getUint8(n++),a=7&t.getUint8(n++),o=t.getUint8(n++);h.chromaFormat=r,h.bitDepthLumaMinus8=i,h.bitDepthChromaMinus8=a;let s=[];for(let r=0;r<o;r++){let r=t.getUint16(n,!1);n+=2,s.push(e.subarray(n,n+r)),n+=r}h.sequenceParameterSetExt=s}return h}catch(e){return console.error("Error deserializing AVC Decoder Configuration Record:",e),null}})(o8(this.decoderConfig.description));if(e&&e.sequenceParameterSets.length>0){let t=s9(e.sequenceParameterSets[0]);t&&0===t.frameMbsOnlyFlag&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:"prefer-software"})}}let t=Error("Decoding error").stack;this.decoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.decoder.configure(this.decoderConfig)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(oJ(this.decoder),Math.max(this.decoder.decodeQueueSize,this.alphaDecoder?.decodeQueueSize??0))}decode(e){if("hevc"===this.codec&&this.currentPacketIndex>0&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}if(this.customDecoder)this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--);else{if(oJ(this.decoder),sA()||sd(this.inputTimestamps,e.timestamp,e=>e),sM()&&0===this.currentPacketIndex&&"avc"===this.codec){let t=[];for(let n of s4(e.data,this.decoderConfig)){let r=s3(e.data[n.offset]);r>=20&&r<=31||t.push(e.data.subarray(n.offset,n.offset+n.length))}e=new l0(((e,t)=>{if(t.description)return((e,t)=>{let n=new Uint8Array(e.reduce((e,n)=>e+t+n.byteLength,0)),r=0;for(let i of e){let e=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(t){case 1:e.setUint8(r,i.byteLength);break;case 2:e.setUint16(r,i.byteLength,!1);break;case 3:sv(e,r,i.byteLength,!1);break;case 4:e.setUint32(r,i.byteLength,!1)}r+=t,n.set(i,r),r+=i.byteLength}return n})(e,(3&o8(t.description)[4])+1);let n=new Uint8Array(e.reduce((e,t)=>e+s6.byteLength+t.byteLength,0)),r=0;for(let t of e)n.set(s6,r),r+=s6.byteLength,n.set(t,r),r+=t.byteLength;return n})(t,this.decoderConfig),e.type,e.timestamp,e.duration)}this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e)}this.currentPacketIndex++}decodeAlphaData(e){if(!e.sideData.alpha||this.mergerCreationFailed)return void this.pushNullAlphaFrame();if(!this.merger)try{this.merger=new cx}catch(t){console.error("Due to an error, only color data will be decoded.",t),this.mergerCreationFailed=!0,this.decodeAlphaData(e);return}if(!this.alphaDecoder){let e=e=>{if(this.alphaDecoderQueueSize--,this.colorQueue.length>0){let t=this.colorQueue.shift();oJ(void 0!==t),this.mergeAlpha(t,e)}else this.alphaQueue.push(e);for(this.decodedAlphaChunkCount++;this.nullAlphaFrameQueue.length>0&&this.nullAlphaFrameQueue[0]===this.decodedAlphaChunkCount;)if(this.nullAlphaFrameQueue.shift(),this.colorQueue.length>0){let e=this.colorQueue.shift();oJ(void 0!==e),this.mergeAlpha(e,null)}else this.alphaQueue.push(null)},t=Error("Decoding error").stack;this.alphaDecoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.alphaDecoder.configure(this.decoderConfig)}let t=lm(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||(this.alphaHadKeyframe="key"===t),this.alphaHadKeyframe){if("hevc"===this.codec&&this.currentAlphaPacketIndex>0&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha))return void this.pushNullAlphaFrame();this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(t??e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}pushNullAlphaFrame(){0===this.alphaDecoderQueueSize?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}hasHevcRaslPicture(e){for(let t of le(e,this.decoderConfig)){let n=lt(e[t.offset]);if(n===jP.RASL_N||n===jP.RASL_R)return!0}return!1}sampleHandler(e){if(sA()){if(this.sampleQueue.length>0&&e.timestamp>=o1(this.sampleQueue).timestamp){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}sd(this.sampleQueue,e,e=>e.timestamp)}else{let t=this.inputTimestamps.shift();oJ(void 0!==t),e.setTimestamp(t),this.finalizeAndEmitSample(e)}}finalizeAndEmitSample(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}mergeAlpha(e,t){if(!t){let t=new l6(e);this.sampleHandler(t);return}oJ(this.merger),this.merger.update(e,t),e.close(),t.close();let n=new l6(new VideoFrame(this.merger.canvas,{timestamp:e.timestamp,duration:e.duration??void 0}));this.sampleHandler(n)}async flush(){if(this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(oJ(this.decoder),await Promise.all([this.decoder.flush(),this.alphaDecoder?.flush()]),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1),sA()){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}this.currentPacketIndex=0,this.raslSkipped=!1}close(){for(let e of(this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(oJ(this.decoder),this.decoder.close(),this.alphaDecoder?.close(),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.merger?.close()),this.sampleQueue))e.close();this.sampleQueue.length=0}}class cx{constructor(){"u">typeof OffscreenCanvas?this.canvas=new OffscreenCanvas(300,150):this.canvas=document.createElement("canvas");let e=this.canvas.getContext("webgl2",{premultipliedAlpha:!1});if(!e)throw Error("Couldn't acquire WebGL 2 context.");this.gl=e,this.program=this.createProgram(),this.vao=this.createVAO(),this.colorTexture=this.createTexture(),this.alphaTexture=this.createTexture(),this.gl.useProgram(this.program),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_colorTexture"),0),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_alphaTexture"),1)}createProgram(){let e=this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
|
|
183
|
+
`,oO=["bold","color","font","italic","size","strike","underline","indent","list","direction"],oA=e=>{oO=e},oI=e=>new(m(aP))(e,{toolbar:!1,keyboard:!1,clipboard:{matchVisual:!1},formats:oO}),oR=(e,t)=>{var n=e.clipboard.convert("<div class='ql-editor' style='outline: none;'>"+t+"<p><br></p></div>");e.setContents(n),e.history.clear()},oL=({html:e,onBlur:t,onChange:n,element:r,clickCoords:i})=>{let a=m(S).useRef(null);m(S).useEffect(()=>{if(!a.current)return;let r=oI(a.current);E.runInAction(()=>{oT.editor.instance=r}),window.__polotnoQuill=r,r.on("text-change",()=>{r.getSelection()&&E.runInAction(()=>{oT.currentFormat=r.getFormat(r.getSelection())}),setTimeout(()=>{let e=a.current?.childNodes[0];e&&n(oE(e.innerHTML))},10)}),oR(r,e),i?function(e,t){if(!e||!t)return;let{x:n,y:r}=t;try{let t=null;if(document.caretRangeFromPoint)t=document.caretRangeFromPoint(n,r);else if(document.caretPositionFromPoint){let e=document.caretPositionFromPoint(n,r);e&&(t=document.createRange()).setStart(e.offsetNode,e.offset)}if(t){let n=m(aP).find(t.startContainer,!0);if(n){let r=n.offset(e.scroll)+t.startOffset;e.setSelection(r,0,"api");return}}}catch(e){}e.setSelection(0,0,"api")}(r,i):r.setSelection(0,0,"api"),r.on("selection-change",(e,t,n)=>{e&&E.runInAction(()=>{oT.currentFormat=r.getFormat(r.getSelection())})}),a.current.childNodes[0].addEventListener("blur",e=>{var n;let r=e.relatedTarget;r?.classList.contains("ql-clipboard")||(n=r)&&n.closest(".sketch-picker")||t()});let o=a.current.childNodes[0],s=e=>{let t=r.getSelection();if(!t||0===t.length)return;let n=r.getText(t.index,t.length).replace(/\n$/,""),i=window.getSelection(),a="";if(i&&i.rangeCount>0){let e=i.getRangeAt(0),t=document.createElement("div");t.appendChild(e.cloneContents()),a=t.innerHTML}if(e.clipboardData?.setData("text/plain",n),a){let t='<div style="white-space: pre-wrap; word-wrap: break-word;">'+a+"</div>";e.clipboardData?.setData("text/html",'<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>\x3c!--StartFragment--\x3e'+t+"\x3c!--EndFragment--\x3e</body></html>")}e.preventDefault()},l=e=>{s(e);let t=r.getSelection();t&&t.length>0&&r.deleteText(t.index,t.length)};return o.addEventListener("copy",s),o.addEventListener("cut",l),()=>{o.removeEventListener("copy",s),o.removeEventListener("cut",l),E.runInAction(()=>{oT.editor.instance=null,oT.currentFormat={}}),delete window.__polotnoQuill}},[]),m(S).useEffect(()=>(0,E.reaction)(()=>r.text,()=>{let t=oT.editor.instance;if(!t)return;let n=t.getSelection(),i=a.current?.childNodes?.[0];oE(i?.innerHTML||"")!==r.text&&(oR(t,e),n&&(t.setSelection(n.index,n.length),E.runInAction(()=>{oT.currentFormat=t.getFormat(t.getSelection())})))},{fireImmediately:!0}),[]),m(S).useEffect(()=>{window.addEventListener("blur",t);let e=e=>{a.current?.contains(e.target)||t()};return window.addEventListener("touchstart",e),()=>{window.removeEventListener("blur",t),window.removeEventListener("touchstart",e)}},[]);let o={color:r.fill};r.fill.indexOf("gradient")>=0&&(o.backgroundColor=r.fill,o.backgroundImage=r.fill,o.backgroundSize="100% 100%",o.backgroundRepeat="repeat",o.webkitBackgroundClip="text",o.MozBackgroundClip="text",o.WebkitTextFillColor="transparent",o.MozTextFillColor="transparent");let s=iZ(r);return(0,C.jsx)(oP,{ref:a,style:{...o,fontSize:r.fontSize,fontWeight:r.fontWeight,textTransform:r.textTransform,width:r.a.width,fontFamily:'"'+r.fontFamily+'"',lineHeight:r.lineHeight,letterSpacing:r.letterSpacing*r.fontSize+"px",textAlign:r.align,opacity:Math.max(r.a.opacity,.2),textShadow:r.shadowEnabled?`${r.shadowOffsetX}px ${r.shadowOffsetY}px ${r.shadowBlur}px ${o_(r.shadowColor,r.shadowOpacity??1)}`:void 0,caretColor:s},dir:iH(iz(r.text))})},oM=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),oN=j(({element:e,store:t})=>{let n=m(S).useRef(null),[r,i]=m(S).useState(),[a,o]=m(S).useState(!1),[s,l]=m(S).useState(!1),c=m(S).useRef(e.height),u=t.selectedShapes.indexOf(e)>=0&&e.selectable,d=i3(u),h=e.fontSize/3,{textVerticalResizeEnabled:f}=iS,p=iS.autoDeleteEmptyText,g=i3(e.fontFamily),[y]=i2(t,e.fontFamily,e.fontStyle,e.fontWeight),v=e._editModeEnabled;r0(n);let b=y?e.fontFamily:g!==e.fontFamily?g:"Arial",x=rQ(e).fill,w=i$(e,{fontFamily:b,color:x}),k=i$(e,{fontFamily:b,color:x,forEditor:!0}),_=m(S).useRef([]),[,T]=m(S).useReducer(e=>e+1,0);m(S).useEffect(()=>{let e=_.current;e.length>0&&(_.current=[],e.forEach(e=>e()))});let{width:P,height:O}=m(S).useMemo(()=>od(w),[w,e.width,y]);m(S).useEffect(()=>{if(!y)return;let n=(n,r,i,a)=>{let o=r5(`text ${e.id}`),s=()=>{t.history.ignore(n,r,i).then(()=>{_.current.push(o),T()})};a?queueMicrotask(s):s()};if(!e.height)return void n(()=>{e.height||e.set({height:O})},void 0,void 0,!0);let{textOverflow:r}=iS;if("change-font-size"!==r||a)"resize"===r&&(f&&e.height<O&&!a&&n(()=>{e.set({height:O})},!1,!0),f||e.height===O||n(()=>{e.set({height:O})},!1,!0));else{let t=(e=>{let t=e.fontSize;for(let n=1;n<50;n++){let n=i$({...e.toJSON(),fontSize:t},{fontFamily:e.fontFamily}),{height:r}=od(n);if(!(e.height&&r>e.height||!iS.textSplitAllowed&&!e.curveEnabled&&function({html:e}){let t=document.createElement("div");t.innerHTML=e,t.style.display="inline-block",t.style.position="fixed",t.style.top="0px",t.style.left="0px",t.style.zIndex="1000",t.style.whiteSpace="nowrap",t.style.visibility="hidden";let n=ou();n.appendChild(t);let r=t.innerText,i=t.childNodes[0];i.style.whiteSpace="nowrap";let a=r?.split(/\s+/)||[],o=!1;for(let e=0;e<a.length;e++){let n=a[e];if(i&&(i.textContent=n,o=i.scrollWidth>t.clientWidth))break}return n.removeChild(t),o}({html:n})))break;t-=.5}return t})(e);t!==e.fontSize?n(()=>{e.set({fontSize:t})},!1,!0):e.height!==O&&(f&&e.height<O?n(()=>{e.set({height:O})},!1,!0):f||n(()=>{e.set({height:O})},!1,!0))}});let A=m(S).useMemo(()=>{let e={lastArgs:null,lastResult:null};return async function(t){var n;return e.lastArgs&&e.lastResult&&(n=e.lastArgs,JSON.stringify(n)===JSON.stringify(t))||(e.lastResult=await og(t),e.lastArgs={...t}),e.lastResult}},[]),I=m(S).useRef(0),R=m(S).useRef(null),L=async()=>{I.current++;let n=I.current,r=r5(`text ${e.id} ${n}`);R.current&&R.current(),R.current=r,l(!0);let a=null,o=oM?5:1;for(let r=0;r<o;r++){let i=r>0?A:og;try{var s;if(a=await i({skipCache:r>0,html:w,width:e.width||1,height:e.height||O||1,fontFamily:b,padding:h,pixelRatio:t._elementsPixelRatio,font:t.fonts.find(e=>e.fontFamily===b)||is.find(e=>e.fontFamily===b)}),n!==I.current)return;if(oM&&a&&(s=a,!function(e){let t=e.getContext("2d").getImageData(0,0,e.width,e.height).data;for(let e=0;e<t.length;e+=4)if(0!==t[e+3])return!0;return!1}(s))){await new Promise(e=>setTimeout(e,50*(r+1)));continue}break}catch(t){console.error(t),it(`Error rendering rich text with id ${e.id}`);break}}a?i(a):r?(r(),r=null):console.error("Finish function is called twice!"),l(!1)};m(S).useEffect(()=>{a||v||L()},[w,a,O,v,b,e.height,t._elementsPixelRatio,y]);let[M,N]=au(s,300),[j]=au(a,300,!0),D=j||M;m(S).useEffect(()=>D?void n.current?.clearCache():E.autorun(()=>{iW(n.current,e)}),[r,D,e.shadowColor,e.shadowOffsetX,e.shadowOffsetY,e.shadowOpacity]),m(S).useEffect(()=>{r&&!s&&R.current&&(R.current(),R.current=null)},[r,s]),m(S).useLayoutEffect(()=>{if(!y||!e.curveEnabled)return;let t=new n_.TextPath({data:iV(e.a.width,e.a.height,e.curvePower,e.a.fontSize),text:iz(e.text),letterSpacing:e.letterSpacing*e.a.fontSize,fontSize:e.a.fontSize,fontFamily:e.fontFamily,fontWeight:e.fontWeight,fontStyle:e.fontStyle,align:"center",textBaseline:"middle",fill:e.fill}),n=t.getSelfRect().width;if(n){let t=n-e.a.width,r=e.a.rotation*Math.PI/180,i=-(t/2)*Math.cos(r),a=-(t/2)*Math.sin(r);e.set({width:n,x:e.a.x+i,y:e.a.y+a})}t.destroy()},[y,e.curveEnabled,e.curvePower,e.text,e.fontSize,e.fontFamily,e.fontWeight,e.fontStyle,e.letterSpacing]),m(S).useEffect(()=>()=>{R.current&&R.current()},[]),m(S).useEffect(()=>{d&&!u&&p&&""===iz(e.text)&&e.removable&&!e.placeholder&&t.deleteElements([e.id])},[p,e.placeholder,e.removable,e.text,u,d]);let z=0;"middle"===e.verticalAlign&&(z=(e.height-O)/2),"bottom"===e.verticalAlign&&(z=e.height-O);let B=i4({fontLoaded:y,fontFamily:e.fontFamily,fontSize:e.fontSize,lineHeight:e.lineHeight}),F=iK(),H=iV(e.a.width,O,e.curvePower,e.fontSize),V=m(S).useRef(null),U=m(S).useRef(null),$=v&&e.strokeWidth>0&&!e.curveEnabled;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rP,{x:e.a.x,y:e.a.y,offsetX:e.backgroundPadding*(e.fontSize*B*.5),offsetY:e.backgroundPadding*(e.fontSize*B*.5),rotation:e.a.rotation,hideInExport:!e.showInExport,listening:!1,visible:e.backgroundEnabled,opacity:e.backgroundOpacity*e.a.opacity,fill:e.backgroundColor,width:e.a.width+e.backgroundPadding*(e.fontSize*B),height:e.a.height+e.backgroundPadding*(e.fontSize*B),cornerRadius:e.backgroundCornerRadius*(e.fontSize*B*.5)}),(0,C.jsx)(rR,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,data:H,stroke:"red",strokeWidth:1,visible:!1}),(0,C.jsx)(rP,{ref:n,name:"element",x:e.a.x,y:e.a.y,listening:e.selectable,rotation:e.a.rotation,width:e.a.width,height:e.a.height,visible:!D,draggable:F?e.draggable&&u:e.draggable,preventDefault:!F||u,opacity:v?0:e.a.opacity,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},id:e.id,onDblClick:t=>{e.contentEditable&&(U.current={x:t.evt.clientX,y:t.evt.clientY},e.toggleEditMode(!0))},onDblTap:t=>{if(e.contentEditable){let n=t.evt.changedTouches?.[0];U.current=n?{x:n.clientX,y:n.clientY}:null,e.toggleEditMode(!0)}},onTransformStart:t=>{o(!0),c.current=e.height},onTransform:t=>{let n=t.target,r=(n.getStage()?.findOne("Transformer")).getActiveAnchor(),i=n.scaleX();if("middle-left"===r||"middle-right"===r){let t=n.scaleX(),r=n.width()*t,i=e.fontSize,a=r;if(r<i&&(a=i,V.current&&n.position(V.current)),n.width(a),n.scaleX(1),iS.textVerticalResizeEnabled){let t=Math.max(O,c.current);e.set({height:t})}e.set({width:n.width(),x:n.x(),y:n.y()})}else if("top-center"===r||"bottom-center"===r){let r="resize"===iS.textOverflow,i="number"==typeof e.lineHeight?e.lineHeight:1,a=Math.max(r?O:i*e.fontSize,t.target.height()*t.target.scaleY());n.scaleY(1),e.set({x:n.x(),y:n.y(),height:a,rotation:n.rotation()})}else n.scaleX(1),n.scaleY(1),e.set({fontSize:e.fontSize*i,letterSpacing:e.letterSpacing,width:n.width()*i,x:n.x(),y:n.y(),rotation:n.rotation(),height:n.height()*i});V.current=t.target.position()},onTransformEnd:t=>{o(!1),l(!0);let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({fontSize:e.fontSize*n,width:t.target.width()*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation(),shadowBlur:e.shadowBlur*n,shadowOffsetX:e.shadowOffsetX*n,shadowOffsetY:e.shadowOffsetY*n,strokeWidth:e.strokeWidth*n})}}),(0,C.jsx)(rA,{ref:n,image:r,x:e.a.x,y:e.a.y,offsetX:h,offsetY:h-z,listening:!1,rotation:e.a.rotation,width:e.a.width+2*h,height:(e.a.width+2*h)*((r?.height??0)/(r?.width||1)||1),visible:!D&&!v,opacity:e.a.opacity,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,hideInExport:!e.showInExport,editModeEnabled:e._editModeEnabled||a||D}),(D||$)&&(0,C.jsx)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-z,children:(0,C.jsx)(rz,{divProps:{style:{pointerEvents:"none"}},children:(0,C.jsx)(oP,{dangerouslySetInnerHTML:{__html:w},style:{pointerEvents:"none",opacity:e.a.opacity,textShadow:e.shadowEnabled?`${e.shadowOffsetX}px ${e.shadowOffsetY}px ${e.shadowBlur}px ${o_(e.shadowColor,e.shadowOpacity??1)}`:void 0}})})}),v&&(0,C.jsx)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,offsetY:-z,children:(0,C.jsx)(rz,{children:(0,C.jsx)(oL,{html:k,element:e,onChange:t=>{let n=iX({oldText:iz(e.text),newText:iz(t),element:e});e.set({text:t,fontSize:n})},onBlur:t=>{e.toggleEditMode(!1),N(!0)},clickCoords:U.current})})})]})});var S=(x("8NFma"),x("8NFma"));function oj(e){return e/180*Math.PI}function oD(e,t,n,r,i){let a=Math.sqrt(n*n+r*r);return{x:e+a*Math.cos(i+=Math.atan2(r,n)),y:t+a*Math.sin(i)}}function oz(e){let{x:t,y:n,width:r,height:i}=e,a=oj(e.rotation),o=oD(t,n,0,0,a),s=oD(t,n,r,0,a),l=oD(t,n,r,i,a),c=oD(t,n,0,i,a),u=Math.min(o.x,s.x,l.x,c.x),d=Math.min(o.y,s.y,l.y,c.y),h=Math.max(o.x,s.x,l.x,c.x),f=Math.max(o.y,s.y,l.y,c.y);return{x:u,y:d,width:h-u,height:f-d,minX:u,minY:d,maxX:h,maxY:f}}function oB(e){let t=e.map(e=>oz(e)),n=Math.min(...t.map(e=>e.minX)),r=Math.min(...t.map(e=>e.minY)),i=Math.max(...t.map(e=>e.maxX)),a=Math.max(...t.map(e=>e.maxY));return{x:n,y:r,width:i-n,height:a-r,minX:n,minY:r,maxX:i,maxY:a}}let oF={stroke:"rgb(0, 161, 255)",strokeWidth:1,dash:[4,6]},oH=({targetKonvaNodes:e,guideKonvaNode:t,distance:n,snapDirection:r})=>n<5,oV=e=>{oH=e};function oU(e,t){var n=[],r=[];e.vertical.forEach(e=>{t.vertical.forEach(t=>{var r=Math.abs(e.offset-t.guide);oH({targetKonvaNodes:t.nodes,guideKonvaNode:e.node,distance:r,snapDirection:e.snap})&&n.push({lineGuide:e.offset,diff:r,snap:t.snap,offset:t.offset})})}),e.horizontal.forEach(e=>{t.horizontal.forEach(t=>{var n=Math.abs(e.offset-t.guide);oH({targetKonvaNodes:t.nodes,guideKonvaNode:e.node,distance:n,snapDirection:e.snap})&&r.push({lineGuide:e.offset,diff:n,snap:t.snap,offset:t.offset})})});var i=[];let a=n.sort((e,t)=>e.diff-t.diff),o=r.sort((e,t)=>e.diff-t.diff);var s=a[0],l=o[0];return s&&a.filter(e=>.1>Math.abs(e.diff-s.diff)).forEach(e=>{i.push({orientation:"V",...e})}),l&&o.filter(e=>.1>Math.abs(e.diff-l.diff)).forEach(e=>{i.push({orientation:"H",...e})}),i}let o$=()=>{if(0===n_.DD._dragElements.size)return;let e=[...n_.DD._dragElements.entries()],t=e.find(([e,t])=>t.node instanceof n_.Transformer);t&&(e.splice(e.indexOf(t),1),e.unshift(t),n_.DD._dragElements.clear(),e.forEach(([e,t])=>{n_.DD._dragElements.set(e,t)}))};function oq(e,t,n){let r=e=>e.hasName("element")||e.hasName("line-anchor")||e.hasName("page-background")||e.hasName("elements-area"),i=n=>{let i,a,o,s=n.target.getLayer().children.find(e=>"line-guides"===e.name());s?.destroyChildren();var l,c,u,d,h=oU((l=[n.target,...t.map(e=>e.current)],i=e.current?.getStage(),c=[],u=[],i.find(r).forEach(e=>{if(!(l.indexOf(e)>=0)){var t=e.getClientRect({skipShadow:!0,skipStroke:!0});e.hasName("line-anchor")&&(t={x:e.absolutePosition().x,y:e.absolutePosition().y,width:0,height:0}),c.push({offset:t.x,node:e,snap:"start"},{offset:t.x+t.width,node:e,snap:"end"},{offset:t.x+t.width/2,node:e,snap:"center"}),u.push({offset:t.y,node:e,snap:"start"},{offset:t.y+t.height,node:e,snap:"end"},{offset:t.y+t.height/2,node:e,snap:"center"})}}),{vertical:c,horizontal:u}),{vertical:[{guide:(d=n.target).absolutePosition().x,offset:0,snap:"center",nodes:[d]}],horizontal:[{guide:d.absolutePosition().y,offset:0,snap:"center",nodes:[d]}]});if(!h.length)return;a=e.current?.getLayer(),o=a?.children.find(e=>"line-guides"===e.name()),h.forEach(e=>{if("H"===e.orientation){var t=new n_.Line({x:-a.getStage().x(),y:-a.getStage().y(),points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});o?.add(t),a.batchDraw()}else if("V"===e.orientation){var t=new n_.Line({x:-a.getStage().x(),y:-a.getStage().y(),points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});o?.add(t)}});let f=n.target.getAbsolutePosition(),p={...f};h.forEach(e=>{switch(e.snap){case"start":case"center":case"end":switch(e.orientation){case"V":p.x=e.lineGuide+e.offset;break;case"H":p.y=e.lineGuide+e.offset}}});let m=p.x-f.x,g=p.y-f.y;if(!(n.evt.ctrlKey||n.evt.metaKey)){let e=n.target.getAbsolutePosition();n.target.absolutePosition({x:e.x+m,y:e.y+g})}},a=e=>{if(!e.target)return;let t=e.target.getLayer(),n=t.children.find(e=>"line-guides"===e.name());n?.destroyChildren(),t.batchDraw()};m(S).useEffect(()=>{e.current&&(e.current.on("dragmove",i),e.current.on("dragend",a))},n)}function oW(e,t){return e.x*t.x+e.y*t.y}let oG={"top-left":"bottom-right","top-center":"bottom-center","top-right":"bottom-left","middle-right":"middle-left","bottom-right":"top-left","bottom-center":"top-center","bottom-left":"top-right","middle-left":"middle-right"};function oK(e){let{x:t,y:n,width:r,height:i,rotation:a}=e.a,o=a*Math.PI/180,s={x:t+i/2*Math.cos(o+Math.PI/2),y:n+i/2*Math.sin(o+Math.PI/2)},l={x:s.x+r*Math.cos(o),y:s.y+r*Math.sin(o)};return{middleLeft:s,middleRight:l}}function oY(e,t,n){let r=Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2)),i=Math.atan2(t.y-e.y,t.x-e.x),a=180*i/Math.PI;return{x:e.x+Math.cos(i-Math.PI/2)*n/2,y:e.y+Math.sin(i-Math.PI/2)*n/2,width:r,height:n,rotation:a}}let oX=(e,t)=>{let n=h9.anchorSize||10;return{offsetX:n/2/e,offsetY:n/2/e,width:n/e,height:n/e,cornerRadius:(h9.anchorCornerRadius||0)/e,fill:h9.anchorFill||"white",stroke:h9.anchorStroke||"rgb(0, 161, 255)",strokeWidth:h9.anchorStrokeWidth||2,strokeScaleEnabled:!1,draggable:!0,dragDistance:0,onMouseEnter:e=>{e.target.getStage().container().style.cursor="crosshair"},onMouseLeave:e=>{e.target.getStage().container().style.cursor=""},onDragStart:e=>{t.history.startTransaction()},onDragEnd:e=>{t.history.endTransaction()}}},oQ=j(({element:e,type:t})=>{let n=rQ(e,e.a.color,"fill"),r=rQ(e,e.a.color,"stroke"),i={strokeWidth:e.height,lineCap:"round",lineJoin:"round",...r,...n,opacity:e.a.opacity,hideInExport:!e.showInExport};return(0,C.jsxs)(C.Fragment,{children:["arrow"===t&&(0,C.jsx)(rO,{points:[3*e.height,-(2*e.height),0,0,3*e.height,2*e.height],...i}),"triangle"===t&&(0,C.jsx)(rO,{points:[3*e.height,-(2*e.height),0,0,3*e.height,2*e.height],closed:!0,...i}),"bar"===t&&(0,C.jsx)(rO,{points:[0,-(2*e.height),0,2*e.height],closed:!0,...i}),"square"===t&&(0,C.jsx)(rO,{points:[0,-(2*e.height),4*e.height,-(2*e.height),4*e.height,2*e.height,0,2*e.height],closed:!0,...i}),"circle"===t&&(0,C.jsx)("Circle",{x:2*e.height,y:0,radius:2*e.height,...i})]})}),oZ=j(({element:e,store:t})=>{let n=m(S).useRef(null),r=m(S).useRef(null),i=m(S).useRef(null),a=e.selectable||"admin"===t.role,o=iK(),s=t.selectedElements.indexOf(e)>=0&&1===t.selectedElements.length,l=t.selectedShapes.indexOf(e)>=0&&e.selectable,{middleLeft:c,middleRight:u}=oK(e);oq(r,[n],[s]),oq(i,[n],[s]);let d=rQ(e,e.a.color,"stroke");return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rO,{ref:n,name:"element",id:e.id,x:e.a.x,y:e.a.y,points:[0,0,e.a.width,0],offsetY:-e.a.height/2,strokeWidth:e.a.height,hitStrokeWidth:Math.max(e.a.height,20),dash:e.dash.map(t=>t*e.a.height),...d,rotation:e.a.rotation,opacity:e.animated("opacity"),shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,listening:a,draggable:o?e.draggable&&l:e.draggable,preventDefault:!o||l,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onTransform:t=>{let n=t.target.scaleX();t.target.scaleX(1),t.target.scaleY(1),e.set({height:e.height*n,width:e.width*n,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})}}),(0,C.jsx)(rE,{x:c.x,y:c.y,rotation:e.rotation,hideInExport:!e.showInExport,onClick:e=>n.current?.fire("click",e),onTap:e=>n.current?.fire("tap",e),children:(0,C.jsx)(oQ,{element:e,type:e.startHead})}),(0,C.jsx)(rE,{x:u.x,y:u.y,rotation:e.rotation+180,onClick:e=>n.current?.fire("click",e),onTap:e=>n.current?.fire("tap",e),children:(0,C.jsx)(oQ,{element:e,type:e.endHead})}),s&&e.resizable&&(0,C.jsx)(rB,{selector:".page-abs-container",enabled:!0,children:(0,C.jsxs)(rE,{visible:s,children:[(0,C.jsx)(rP,{x:c.x,y:c.y,ref:r,name:"line-anchor",...oX(t.scale,t),onDragMove:t=>{let n=oY(t.target.position(),u,e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}}),(0,C.jsx)(rP,{x:u.x,y:u.y,ref:i,name:"line-anchor",...oX(t.scale,t),onDragMove:t=>{let n=oY(c,t.target.position(),e.height);e.set({x:n.x,y:n.y,width:n.width,rotation:n.rotation})}})]})})]})});var S=x("8NFma"),E=x("2SBKn"),S=x("8NFma"),E=x("2SBKn");function oJ(e){if(!e)throw Error("Assertion failed.")}let o0=e=>{let t=(e%360+360)%360;if(0===t||90===t||180===t||270===t)return t;throw Error(`Invalid rotation ${e}.`)},o1=e=>e&&e[e.length-1];class o2{constructor(e){this.bytes=e,this.pos=0}seekToByte(e){this.pos=8*e}readBit(){let e=Math.floor(this.pos/8),t=this.bytes[e]??0,n=7-(7&this.pos);return this.pos++,(t&1<<n)>>n}readBits(e){if(1===e)return this.readBit();let t=0;for(let n=0;n<e;n++)t<<=1,t|=this.readBit();return t}writeBits(e,t){let n=this.pos+e;for(let e=this.pos;e<n;e++){let r=Math.floor(e/8),i=this.bytes[r],a=7-(7&e);i&=~(1<<a),i|=(t&1<<n-e-1)>>n-e-1<<a,this.bytes[r]=i}this.pos=n}readAlignedByte(){if(this.pos%8!=0)throw Error("Bitstream is not byte-aligned.");let e=this.pos/8,t=this.bytes[e]??0;return this.pos+=8,t}skipBits(e){this.pos+=e}getBitsLeft(){return 8*this.bytes.length-this.pos}clone(){let e=new o2(this.bytes);return e.pos=this.pos,e}}let o4=e=>{let t=0;for(;0===e.readBits(1)&&t<32;)t++;if(t>=32)throw Error("Invalid exponential-Golomb code.");return(1<<t)-1+e.readBits(t)},o3=e=>{let t=o4(e);return(1&t)==0?-(t>>1):t+1>>1},o8=e=>e.constructor===Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e),o6=e=>e.constructor===DataView?e:ArrayBuffer.isView(e)?new DataView(e.buffer,e.byteOffset,e.byteLength):new DataView(e),o5=new TextDecoder,o9=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[t,e])),o7={bt709:1,bt470bg:5,smpte170m:6,bt2020:9,smpte432:12},se=o9(o7),st={bt709:1,smpte170m:6,linear:8,"iec61966-2-1":13,pq:16,hlg:18},sn=o9(st),sr={rgb:0,bt709:1,bt470bg:5,smpte170m:6,"bt2020-ncl":9},si=o9(sr),sa=e=>e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e);class so{constructor(){this.currentPromise=Promise.resolve(),this.pending=0}async acquire(){let e,t=new Promise(t=>{let n=!1;e=()=>{n||(t(),this.pending--,n=!0)}}),n=this.currentPromise;return this.currentPromise=t,this.pending++,await n,e}}let ss=e=>[...e].map(e=>e.toString(16).padStart(2,"0")).join(""),sl=e=>(e=(e=(e=(e=(e=e>>1&0x55555555|(0x55555555&e)<<1)>>2&0x33333333|(0x33333333&e)<<2)>>4&0xf0f0f0f|(0xf0f0f0f&e)<<4)>>8&0xff00ff|(0xff00ff&e)<<8)>>16&65535|(65535&e)<<16)>>>0,sc=(e,t,n)=>{let r=0,i=e.length-1,a=-1;for(;r<=i;){let o=r+i>>1,s=n(e[o]);s===t?(a=o,i=o-1):s<t?r=o+1:i=o-1}return a},su=(e,t,n)=>{let r=0,i=e.length-1,a=-1;for(;r<=i;){let o=r+(i-r+1)/2|0;n(e[o])<=t?(a=o,r=o+1):i=o-1}return a},sd=(e,t,n)=>{let r=su(e,n(t),n);e.splice(r+1,0,t)},sh=()=>{let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}},sf=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return e[n]},sp=(e,t)=>{for(let n=e.length-1;n>=0;n--)if(t(e[n]))return n;return -1},sm=async function*(e){Symbol.iterator in e?yield*e[Symbol.iterator]():yield*e[Symbol.asyncIterator]()},sg=e=>{throw Error(`Unexpected value: ${e}`)},sy=(e,t,n)=>{let r=e.getUint8(t),i=e.getUint8(t+1),a=e.getUint8(t+2);return n?r|i<<8|a<<16:r<<16|i<<8|a},sv=(e,t,n,r)=>{n>>>=0,n&=0xffffff,r?(e.setUint8(t,255&n),e.setUint8(t+1,n>>>8&255),e.setUint8(t+2,n>>>16&255)):(e.setUint8(t,n>>>16&255),e.setUint8(t+1,n>>>8&255),e.setUint8(t+2,255&n))},sb=(e,t)=>({async next(){let n=await e.next();return n.done?{value:void 0,done:!0}:{value:t(n.value),done:!1}},return:()=>e.return(),throw:t=>e.throw(t),[Symbol.asyncIterator](){return this}}),sx=(e,t,n)=>Math.max(t,Math.min(n,e)),sw=e=>{let t=Math.round(e);return Math.abs(e/t-1)<10*Number.EPSILON?t:e},sC=(e,t)=>Math.floor(e/t)*t,sS=/^[a-z]{3}$/,sk=1e6*(1+Number.EPSILON),s_=(e,t)=>{let n={...e,...t};if(e.headers||t.headers){let r=e.headers?sE(e.headers):{},i=t.headers?sE(t.headers):{},a={...r};Object.entries(i).forEach(([e,t])=>{let n=Object.keys(a).find(t=>t.toLowerCase()===e.toLowerCase());n&&delete a[n],a[e]=t}),n.headers=a}return n},sE=e=>{if(e instanceof Headers){let t={};return e.forEach((e,n)=>{t[n]=e}),t}if(Array.isArray(e)){let t={};return e.forEach(([e,n])=>{t[e]=n}),t}return e},sT=async(e,t,n,r,i)=>{let a=0;for(;;)try{return await e(t,n)}catch(n){if(i())throw n;let e=r(++a,n,t);if(null===e)throw n;if(console.error("Retrying failed fetch. Error:",n),!Number.isFinite(e)||e<0)throw TypeError("Retry delay must be a non-negative finite number.");if(e>0&&await new Promise(t=>setTimeout(t,1e3*e)),i())throw n}};class sP{constructor(){this.currentPromise=Promise.resolve()}call(e){return this.currentPromise=this.currentPromise.then(e)}}let sO=null,sA=()=>null!==sO?sO:sO=!!("u">typeof navigator&&(navigator.vendor?.match(/apple/i)||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)||/\b(iPad|iPhone|iPod)\b/.test(navigator.userAgent))),sI=null,sR=()=>null!==sI?sI:sI="u">typeof navigator&&navigator.userAgent?.includes("Firefox"),sL=null,sM=()=>null!==sL?sL:sL=!!("u">typeof navigator&&(navigator.vendor?.includes("Google Inc")||/Chrome/.test(navigator.userAgent))),sN=null,sj=()=>{if(null!==sN)return sN;if("u"<typeof navigator)return null;let e=/\bChrome\/(\d+)/.exec(navigator.userAgent);return e?sN=Number(e[1]):null},sD=(e,t)=>-1!==e?e:t,sz=(e,t,n,r)=>e<=r&&n<=t,sB=e=>{let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n},sF=()=>{Symbol.dispose??=Symbol("Symbol.dispose")},sH=e=>"number"==typeof e&&!Number.isNaN(e),sV=["pcm-s16","pcm-s16be","pcm-s24","pcm-s24be","pcm-s32","pcm-s32be","pcm-f32","pcm-f32be","pcm-f64","pcm-f64be","pcm-u8","pcm-s8","ulaw","alaw"];[...sV];let sU=[{maxMacroblocks:99,maxBitrate:64e3,maxDpbMbs:396,level:10},{maxMacroblocks:396,maxBitrate:192e3,maxDpbMbs:900,level:11},{maxMacroblocks:396,maxBitrate:384e3,maxDpbMbs:2376,level:12},{maxMacroblocks:396,maxBitrate:768e3,maxDpbMbs:2376,level:13},{maxMacroblocks:396,maxBitrate:2e6,maxDpbMbs:2376,level:20},{maxMacroblocks:792,maxBitrate:4e6,maxDpbMbs:4752,level:21},{maxMacroblocks:1620,maxBitrate:4e6,maxDpbMbs:8100,level:22},{maxMacroblocks:1620,maxBitrate:1e7,maxDpbMbs:8100,level:30},{maxMacroblocks:3600,maxBitrate:14e6,maxDpbMbs:18e3,level:31},{maxMacroblocks:5120,maxBitrate:2e7,maxDpbMbs:20480,level:32},{maxMacroblocks:8192,maxBitrate:2e7,maxDpbMbs:32768,level:40},{maxMacroblocks:8192,maxBitrate:5e7,maxDpbMbs:32768,level:41},{maxMacroblocks:8704,maxBitrate:5e7,maxDpbMbs:34816,level:42},{maxMacroblocks:22080,maxBitrate:135e6,maxDpbMbs:110400,level:50},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:51},{maxMacroblocks:36864,maxBitrate:24e7,maxDpbMbs:184320,level:52},{maxMacroblocks:139264,maxBitrate:24e7,maxDpbMbs:696320,level:60},{maxMacroblocks:139264,maxBitrate:48e7,maxDpbMbs:696320,level:61},{maxMacroblocks:139264,maxBitrate:8e8,maxDpbMbs:696320,level:62}],s$=[{maxPictureSize:36864,maxBitrate:2e5,level:10},{maxPictureSize:73728,maxBitrate:8e5,level:11},{maxPictureSize:122880,maxBitrate:18e5,level:20},{maxPictureSize:245760,maxBitrate:36e5,level:21},{maxPictureSize:552960,maxBitrate:72e5,level:30},{maxPictureSize:983040,maxBitrate:12e6,level:31},{maxPictureSize:2228224,maxBitrate:18e6,level:40},{maxPictureSize:2228224,maxBitrate:3e7,level:41},{maxPictureSize:8912896,maxBitrate:6e7,level:50},{maxPictureSize:8912896,maxBitrate:12e7,level:51},{maxPictureSize:8912896,maxBitrate:18e7,level:52},{maxPictureSize:0x2200000,maxBitrate:18e7,level:60},{maxPictureSize:0x2200000,maxBitrate:24e7,level:61},{maxPictureSize:0x2200000,maxBitrate:48e7,level:62}],sq=".01.01.01.01.00",sW=".0.110.01.01.01.0",sG=e=>{let{codec:t,codecDescription:n,colorSpace:r,avcCodecInfo:i,hevcCodecInfo:a,vp9CodecInfo:o,av1CodecInfo:s}=e;if("avc"===t){if(oJ(null!==e.avcType),i){let t=new Uint8Array([i.avcProfileIndication,i.profileCompatibility,i.avcLevelIndication]);return`avc${e.avcType}.${ss(t)}`}if(!n||n.byteLength<4)throw TypeError("AVC decoder description is not provided or is not at least 4 bytes long.");return`avc${e.avcType}.${ss(n.subarray(1,4))}`}if("hevc"===t){let e,t,r,i,o,s;if(a)e=a.generalProfileSpace,t=a.generalProfileIdc,r=sl(a.generalProfileCompatibilityFlags),i=a.generalTierFlag,o=a.generalLevelIdc,s=[...a.generalConstraintIndicatorFlags];else{if(!n||n.byteLength<23)throw TypeError("HEVC decoder description is not provided or is not at least 23 bytes long.");let a=o6(n),l=a.getUint8(1);e=l>>6&3,t=31&l,r=sl(a.getUint32(2)),i=l>>5&1,o=a.getUint8(12),s=[];for(let e=0;e<6;e++)s.push(a.getUint8(6+e))}let l="hev1.";for(l+=["","A","B","C"][e]+t,l+=".",l+=r.toString(16).toUpperCase(),l+=".",l+=0===i?"L":"H",l+=o;s.length>0&&0===s[s.length-1];)s.pop();return s.length>0&&(l+=".",l+=s.map(e=>e.toString(16).toUpperCase()).join(".")),l}if("vp8"===t)return"vp8";if("vp9"===t){if(!o){let t=e.width*e.height,n=o1(s$).level;for(let e of s$)if(t<=e.maxPictureSize){n=e.level;break}return`vp09.00.${n.toString().padStart(2,"0")}.08`}let t=o.profile.toString().padStart(2,"0"),n=o.level.toString().padStart(2,"0"),r=o.bitDepth.toString().padStart(2,"0"),i=o.chromaSubsampling.toString().padStart(2,"0"),a=o.colourPrimaries.toString().padStart(2,"0"),s=o.transferCharacteristics.toString().padStart(2,"0"),l=o.matrixCoefficients.toString().padStart(2,"0"),c=o.videoFullRangeFlag.toString().padStart(2,"0"),u=`vp09.${t}.${n}.${r}.${i}`;return(u+=`.${a}.${s}.${l}.${c}`).endsWith(sq)&&(u=u.slice(0,-sq.length)),u}if("av1"===t){if(!s){let t=e.width*e.height,n=o1(s$).level;for(let e of s$)if(t<=e.maxPictureSize){n=e.level;break}return`av01.0.${n.toString().padStart(2,"0")}M.08`}let t=s.profile,n=s.level.toString().padStart(2,"0"),i=s.tier?"H":"M",a=s.bitDepth.toString().padStart(2,"0"),o=s.monochrome?"1":"0",l=100*s.chromaSubsamplingX+10*s.chromaSubsamplingY+ +(s.chromaSubsamplingX&&s.chromaSubsamplingY?s.chromaSamplePosition:0),c=r?.primaries?o7[r.primaries]:1,u=r?.transfer?st[r.transfer]:1,d=r?.matrix?sr[r.matrix]:1,h=+!!r?.fullRange,f=`av01.${t}.${n}${i}.${a}`;return f+=`.${o}.${l.toString().padStart(3,"0")}`,f+=`.${c.toString().padStart(2,"0")}`,f+=`.${u.toString().padStart(2,"0")}`,f+=`.${d.toString().padStart(2,"0")}`,(f+=`.${h}`).endsWith(sW)&&(f=f.slice(0,-sW.length)),f}throw TypeError(`Unhandled codec '${t}'.`)},sK=e=>{let{codec:t,codecDescription:n,aacCodecInfo:r}=e;if("aac"===t){if(!r)throw TypeError("AAC codec info must be provided.");if(r.isMpeg2)return"mp4a.67";{let e;return e=null!==r.objectType?r.objectType:sQ(n).objectType,`mp4a.40.${e}`}}if("mp3"===t)return"mp3";if("opus"===t)return"opus";if("vorbis"===t)return"vorbis";if("flac"===t)return"flac";else if("ac3"===t)return"ac-3";else if("eac3"===t)return"ec-3";else if(t&&sV.includes(t))return t;throw TypeError(`Unhandled codec '${t}'.`)},sY=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],sX=[-1,1,2,3,4,5,6,8],sQ=e=>{if(!e||e.byteLength<2)throw TypeError("AAC description must be at least 2 bytes long.");let t=new o2(e),n=t.readBits(5);31===n&&(n=32+t.readBits(6));let r=t.readBits(4),i=null;15===r?i=t.readBits(24):r<sY.length&&(i=sY[r]);let a=t.readBits(4),o=null;return a>=1&&a<=7&&(o=sX[a]),{objectType:n,frequencyIndex:r,sampleRate:i,channelConfiguration:a,numberOfChannels:o}},sZ=/^pcm-([usf])(\d+)+(be)?$/,sJ=[48e3,44100,32e3],s0=[24e3,22050,16e3];(NK=jT||(jT={}))[NK.NON_IDR_SLICE=1]="NON_IDR_SLICE",NK[NK.SLICE_DPA=2]="SLICE_DPA",NK[NK.SLICE_DPB=3]="SLICE_DPB",NK[NK.SLICE_DPC=4]="SLICE_DPC",NK[NK.IDR=5]="IDR",NK[NK.SEI=6]="SEI",NK[NK.SPS=7]="SPS",NK[NK.PPS=8]="PPS",NK[NK.AUD=9]="AUD",NK[NK.SPS_EXT=13]="SPS_EXT",(NY=jP||(jP={}))[NY.RASL_N=8]="RASL_N",NY[NY.RASL_R=9]="RASL_R",NY[NY.BLA_W_LP=16]="BLA_W_LP",NY[NY.RSV_IRAP_VCL23=23]="RSV_IRAP_VCL23",NY[NY.VPS_NUT=32]="VPS_NUT",NY[NY.SPS_NUT=33]="SPS_NUT",NY[NY.PPS_NUT=34]="PPS_NUT",NY[NY.AUD_NUT=35]="AUD_NUT",NY[NY.PREFIX_SEI_NUT=39]="PREFIX_SEI_NUT",NY[NY.SUFFIX_SEI_NUT=40]="SUFFIX_SEI_NUT";let s1=function*(e){let t=0,n=-1;for(;t<e.length-2;){let r=e.indexOf(0,t);if(-1===r||r>=e.length-2)break;let i=0;if((t=r)+3<e.length&&0===e[t+1]&&0===e[t+2]&&1===e[t+3]?i=4:0===e[t+1]&&1===e[t+2]&&(i=3),0===i){t++;continue}-1!==n&&t>n&&(yield{offset:n,length:t-n}),t=n=t+i}-1!==n&&n<e.length&&(yield{offset:n,length:e.length-n})},s2=function*(e,t){let n=0,r=new DataView(e.buffer,e.byteOffset,e.byteLength);for(;n+t<=e.length;){let e;1===t?e=r.getUint8(n):2===t?e=r.getUint16(n,!1):3===t?e=sy(r,n,!1):(oJ(4===t),e=r.getUint32(n,!1)),n+=t,yield{offset:n,length:e},n+=e}},s4=(e,t)=>t.description?s2(e,(3&o8(t.description)[4])+1):s1(e),s3=e=>31&e,s8=e=>{let t=[],n=e.length;for(let r=0;r<n;r++)r+2<n&&0===e[r]&&0===e[r+1]&&3===e[r+2]?(t.push(0,0),r+=2):t.push(e[r]);return new Uint8Array(t)},s6=new Uint8Array([0,0,0,1]),s5=e=>{try{let t=[],n=[],r=[];for(let i of s1(e)){let a=e.subarray(i.offset,i.offset+i.length),o=s3(a[0]);o===jT.SPS?t.push(a):o===jT.PPS?n.push(a):o===jT.SPS_EXT&&r.push(a)}if(0===t.length||0===n.length)return null;let i=t[0],a=s9(i);oJ(null!==a);let o=100===a.profileIdc||110===a.profileIdc||122===a.profileIdc||144===a.profileIdc;return{configurationVersion:1,avcProfileIndication:a.profileIdc,profileCompatibility:a.constraintFlags,avcLevelIndication:a.levelIdc,lengthSizeMinusOne:3,sequenceParameterSets:t,pictureParameterSets:n,chromaFormat:o?a.chromaFormatIdc:null,bitDepthLumaMinus8:o?a.bitDepthLumaMinus8:null,bitDepthChromaMinus8:o?a.bitDepthChromaMinus8:null,sequenceParameterSetExt:o?r:null}}catch(e){return console.error("Error building AVC Decoder Configuration Record:",e),null}},s9=e=>{try{let t=new o2(s8(e));t.skipBits(1),t.skipBits(2);let n=t.readBits(5);if(7!==n)return null;let r=t.readAlignedByte(),i=t.readAlignedByte(),a=t.readAlignedByte();o4(t);let o=1,s=0,l=0,c=0;if((100===r||110===r||122===r||244===r||44===r||83===r||86===r||118===r||128===r)&&(o=o4(t),3===o&&(c=t.readBits(1)),s=o4(t),l=o4(t),t.skipBits(1),t.readBits(1))){for(let e=0;e<(3!==o?8:12);e++)if(t.readBits(1)){let n=e<6?16:64,r=8,i=8;for(let e=0;e<n;e++){if(0!==i){let e=o3(t);i=(r+e+256)%256}r=0===i?r:i}}}o4(t);let u=o4(t);if(0===u)o4(t);else if(1===u){t.skipBits(1),o3(t),o3(t);let e=o4(t);for(let n=0;n<e;n++)o3(t)}o4(t),t.skipBits(1);let d=o4(t),h=o4(t),f=16*(d+1),p=16*(h+1),m=f,g=p,y=t.readBits(1);if(y||t.skipBits(1),t.skipBits(1),t.readBits(1)){let e,n,r=o4(t),i=o4(t),a=o4(t),s=o4(t),l=0===c?o:0;if(0===l)e=1,n=2-y;else{let t=3===o?1:2,r=1===o?2:1;e=t,n=r*(2-y)}m-=e*(r+i),g-=n*(a+s)}let v=2,b=2,x=2,w=0,C=null,S=null;if(t.readBits(1)){if(t.readBits(1)){let e=t.readBits(8);255===e&&(t.skipBits(16),t.skipBits(16))}t.readBits(1)&&t.skipBits(1),t.readBits(1)&&(t.skipBits(3),w=t.readBits(1),t.readBits(1)&&(v=t.readBits(8),b=t.readBits(8),x=t.readBits(8))),t.readBits(1)&&(o4(t),o4(t)),t.readBits(1)&&(t.skipBits(32),t.skipBits(32),t.skipBits(1));let e=t.readBits(1);e&&s7(t);let n=t.readBits(1);n&&s7(t),(e||n)&&t.skipBits(1),t.skipBits(1),t.readBits(1)&&(t.skipBits(1),o4(t),o4(t),o4(t),o4(t),C=o4(t),S=o4(t))}if(null===C)if(oJ(null===S),(44===r||86===r||100===r||110===r||122===r||244===r)&&16&i)C=0,S=0;else{let e=sU.find(e=>e.level>=a)??o1(sU),t=Math.min(Math.floor(e.maxDpbMbs/((2-y)*(h+1)*(d+1))),16);C=t,S=t}return oJ(null!==S),{profileIdc:r,constraintFlags:i,levelIdc:a,frameMbsOnlyFlag:y,chromaFormatIdc:o,bitDepthLumaMinus8:s,bitDepthChromaMinus8:l,codedWidth:f,codedHeight:p,displayWidth:m,displayHeight:g,colourPrimaries:v,matrixCoefficients:x,transferCharacteristics:b,fullRangeFlag:w,numReorderFrames:C,maxDecFrameBuffering:S}}catch(e){return console.error("Error parsing AVC SPS:",e),null}},s7=e=>{let t=o4(e);e.skipBits(4),e.skipBits(4);for(let n=0;n<=t;n++)o4(e),o4(e),e.skipBits(1);e.skipBits(5),e.skipBits(5),e.skipBits(5),e.skipBits(5)},le=(e,t)=>t.description?s2(e,(3&o8(t.description)[21])+1):s1(e),lt=e=>e>>1&63,ln=e=>{try{let t=new o2(s8(e));t.skipBits(16),t.readBits(4);let n=t.readBits(3),r=t.readBits(1),{general_profile_space:i,general_tier_flag:a,general_profile_idc:o,general_profile_compatibility_flags:s,general_constraint_indicator_flags:l,general_level_idc:c}=li(t,n);o4(t);let u=o4(t),d=0;3===u&&(d=t.readBits(1));let h=o4(t),f=o4(t),p=h,m=f;if(t.readBits(1)){let e=o4(t),n=o4(t),r=o4(t),i=o4(t),a=1,o=1,s=0===d?u:0;1===s?(a=2,o=2):2===s&&(a=2,o=1),p-=(e+n)*a,m-=(r+i)*o}let g=o4(t),y=o4(t);o4(t);let v=t.readBits(1)?0:n,b=0;for(let e=v;e<=n;e++)o4(t),b=o4(t),o4(t);o4(t),o4(t),o4(t),o4(t),o4(t),o4(t),t.readBits(1)&&t.readBits(1)&&la(t),t.skipBits(1),t.skipBits(1),t.readBits(1)&&(t.skipBits(4),t.skipBits(4),o4(t),o4(t),t.skipBits(1));let x=o4(t);if(lo(t,x),t.readBits(1)){let e=o4(t);for(let n=0;n<e;n++)o4(t),t.skipBits(1)}t.skipBits(1),t.skipBits(1);let w=2,C=2,S=2,k=0,_=0;if(t.readBits(1)){let e=ll(t,n);w=e.colourPrimaries,C=e.transferCharacteristics,S=e.matrixCoefficients,k=e.fullRangeFlag,_=e.minSpatialSegmentationIdc}return{displayWidth:p,displayHeight:m,colourPrimaries:w,transferCharacteristics:C,matrixCoefficients:S,fullRangeFlag:k,maxDecFrameBuffering:b+1,spsMaxSubLayersMinus1:n,spsTemporalIdNestingFlag:r,generalProfileSpace:i,generalTierFlag:a,generalProfileIdc:o,generalProfileCompatibilityFlags:s,generalConstraintIndicatorFlags:l,generalLevelIdc:c,chromaFormatIdc:u,bitDepthLumaMinus8:g,bitDepthChromaMinus8:y,minSpatialSegmentationIdc:_}}catch(e){return console.error("Error parsing HEVC SPS:",e),null}},lr=e=>{try{let t=[],n=[],r=[],i=[];for(let a of s1(e)){let o=e.subarray(a.offset,a.offset+a.length),s=lt(o[0]);s===jP.VPS_NUT?t.push(o):s===jP.SPS_NUT?n.push(o):s===jP.PPS_NUT?r.push(o):(s===jP.PREFIX_SEI_NUT||s===jP.SUFFIX_SEI_NUT)&&i.push(o)}if(0===n.length||0===r.length)return null;let a=ln(n[0]);if(!a)return null;let o=0;if(r.length>0){let e=r[0],t=new o2(s8(e));t.skipBits(16),o4(t),o4(t),t.skipBits(1),t.skipBits(1),t.skipBits(3),t.skipBits(1),t.skipBits(1),o4(t),o4(t),o3(t),t.skipBits(1),t.skipBits(1),t.readBits(1)&&o4(t),o3(t),o3(t),t.skipBits(1),t.skipBits(1),t.skipBits(1),t.skipBits(1);let n=t.readBits(1),i=t.readBits(1);o=n||i?n&&!i?2:!n&&i?3:0:0}let s=[...t.length?[{arrayCompleteness:1,nalUnitType:jP.VPS_NUT,nalUnits:t}]:[],...n.length?[{arrayCompleteness:1,nalUnitType:jP.SPS_NUT,nalUnits:n}]:[],...r.length?[{arrayCompleteness:1,nalUnitType:jP.PPS_NUT,nalUnits:r}]:[],...i.length?[{arrayCompleteness:1,nalUnitType:lt(i[0][0]),nalUnits:i}]:[]];return{configurationVersion:1,generalProfileSpace:a.generalProfileSpace,generalTierFlag:a.generalTierFlag,generalProfileIdc:a.generalProfileIdc,generalProfileCompatibilityFlags:a.generalProfileCompatibilityFlags,generalConstraintIndicatorFlags:a.generalConstraintIndicatorFlags,generalLevelIdc:a.generalLevelIdc,minSpatialSegmentationIdc:a.minSpatialSegmentationIdc,parallelismType:o,chromaFormatIdc:a.chromaFormatIdc,bitDepthLumaMinus8:a.bitDepthLumaMinus8,bitDepthChromaMinus8:a.bitDepthChromaMinus8,avgFrameRate:0,constantFrameRate:0,numTemporalLayers:a.spsMaxSubLayersMinus1+1,temporalIdNested:a.spsTemporalIdNestingFlag,lengthSizeMinusOne:3,arrays:s}}catch(e){return console.error("Error building HEVC Decoder Configuration Record:",e),null}},li=(e,t)=>{let n=e.readBits(2),r=e.readBits(1),i=e.readBits(5),a=0;for(let t=0;t<32;t++)a=a<<1|e.readBits(1);let o=new Uint8Array(6);for(let t=0;t<6;t++)o[t]=e.readBits(8);let s=e.readBits(8),l=[],c=[];for(let n=0;n<t;n++)l.push(e.readBits(1)),c.push(e.readBits(1));if(t>0)for(let n=t;n<8;n++)e.skipBits(2);for(let n=0;n<t;n++)l[n]&&e.skipBits(88),c[n]&&e.skipBits(8);return{general_profile_space:n,general_tier_flag:r,general_profile_idc:i,general_profile_compatibility_flags:a,general_constraint_indicator_flags:o,general_level_idc:s}},la=e=>{for(let t=0;t<4;t++)for(let n=0;n<(3===t?2:6);n++)if(e.readBits(1)){let n=Math.min(64,1<<4+(t<<1));t>1&&o3(e);for(let t=0;t<n;t++)o3(e)}else o4(e)},lo=(e,t)=>{let n=[];for(let r=0;r<t;r++)n[r]=ls(e,r,t,n)},ls=(e,t,n,r)=>{let i=0,a=0,o=0;if(0!==t&&(a=e.readBits(1)),a){o=t===n?t-(o4(e)+1):t-1,e.readBits(1),o4(e);let a=r[o]??0;for(let t=0;t<=a;t++)e.readBits(1)||e.readBits(1);i=r[o]}else{let t=o4(e),n=o4(e);for(let n=0;n<t;n++)o4(e),e.readBits(1);for(let t=0;t<n;t++)o4(e),e.readBits(1);i=t+n}return i},ll=(e,t)=>{let n=2,r=2,i=2,a=0,o=0;return e.readBits(1)&&255===e.readBits(8)&&(e.readBits(16),e.readBits(16)),e.readBits(1)&&e.readBits(1),e.readBits(1)&&(e.readBits(3),a=e.readBits(1),e.readBits(1)&&(n=e.readBits(8),r=e.readBits(8),i=e.readBits(8))),e.readBits(1)&&(o4(e),o4(e)),e.readBits(1),e.readBits(1),e.readBits(1),e.readBits(1)&&(o4(e),o4(e),o4(e),o4(e)),e.readBits(1)&&(e.readBits(32),e.readBits(32),e.readBits(1)&&o4(e),e.readBits(1)&&lc(e,!0,t)),e.readBits(1)&&(e.readBits(1),e.readBits(1),e.readBits(1),o=o4(e),o4(e),o4(e),o4(e),o4(e)),{colourPrimaries:n,transferCharacteristics:r,matrixCoefficients:i,fullRangeFlag:a,minSpatialSegmentationIdc:o}},lc=(e,t,n)=>{let r=!1,i=!1,a=!1;t&&(r=1===e.readBits(1),i=1===e.readBits(1),(r||i)&&((a=1===e.readBits(1))&&(e.readBits(8),e.readBits(5),e.readBits(1),e.readBits(5)),e.readBits(4),e.readBits(4),a&&e.readBits(4),e.readBits(5),e.readBits(5),e.readBits(5)));for(let t=0;t<=n;t++){let t=1===e.readBits(1),n=!0;t||(n=1===e.readBits(1));let o=!1;n?o4(e):o=1===e.readBits(1);let s=1;o||(s=o4(e)+1),r&&lu(e,s,a),i&&lu(e,s,a)}},lu=(e,t,n)=>{for(let r=0;r<t;r++)o4(e),o4(e),n&&(o4(e),o4(e)),e.readBits(1)},ld=e=>{let t=new o2(e);if(2!==t.readBits(2))return null;let n=t.readBits(1),r=(t.readBits(1)<<1)+n;if(3===r&&t.skipBits(1),1===t.readBits(1)||0!==t.readBits(1)||(t.skipBits(2),4817730!==t.readBits(24)))return null;let i=8;r>=2&&(i=t.readBits(1)?12:10);let a=t.readBits(3),o=0,s=0;if(7!==a)if(s=t.readBits(1),1===r||3===r){let e=t.readBits(1),n=t.readBits(1);o=e||n?e&&!n?2:1:3,t.skipBits(1)}else o=1;else o=3,s=1;let l=(t.readBits(16)+1)*(t.readBits(16)+1),c=o1(s$).level;for(let e of s$)if(l<=e.maxPictureSize){c=e.level;break}return{profile:r,level:c,bitDepth:i,chromaSubsampling:o,videoFullRangeFlag:s,colourPrimaries:2===a?1:1===a?6:2,transferCharacteristics:2===a?1:1===a?6:2,matrixCoefficients:7===a?0:2===a?1:1===a?6:2}},lh=function*(e){let t=new o2(e),n=()=>{let e=0;for(let n=0;n<8;n++){let r=t.readAlignedByte();if(e|=(127&r)<<7*n,!(128&r))break;if(7===n&&128&r)return null}return e>=0x100000000-1?null:e};for(;t.getBitsLeft()>=8;){let r;t.skipBits(1);let i=t.readBits(4),a=t.readBits(1),o=t.readBits(1);if(t.skipBits(1),a&&t.skipBits(8),o){let e=n();if(null===e)return;r=e}else r=Math.floor(t.getBitsLeft()/8);oJ(t.pos%8==0),yield{type:i,data:e.subarray(t.pos/8,t.pos/8+r)},t.skipBits(8*r)}},lf=e=>{for(let{type:t,data:n}of lh(e)){if(1!==t)continue;let e=new o2(n),r=e.readBits(3);e.readBits(1);let i=e.readBits(1),a=0,o=0,s=0;if(i)a=e.readBits(5);else{if(e.readBits(1)&&(e.skipBits(32),e.skipBits(32),e.readBits(1)))return null;let t=e.readBits(1);t&&(s=e.readBits(5),e.skipBits(32),e.skipBits(5),e.skipBits(5));let n=e.readBits(5);for(let r=0;r<=n;r++){e.skipBits(12);let n=e.readBits(5);if(0===r&&(a=n),n>7){let t=e.readBits(1);0===r&&(o=t)}if(t&&e.readBits(1)){let t=s+1;e.skipBits(t),e.skipBits(t),e.skipBits(1)}e.readBits(1)&&e.skipBits(4)}}let l=e.readBits(4),c=e.readBits(4),u=l+1;e.skipBits(u);let d=c+1;e.skipBits(d);if((i?0:e.readBits(1))&&(e.skipBits(4),e.skipBits(3)),e.skipBits(1),e.skipBits(1),e.skipBits(1),!i){e.skipBits(1),e.skipBits(1),e.skipBits(1),e.skipBits(1);let t=e.readBits(1);t&&(e.skipBits(1),e.skipBits(1));let n=e.readBits(1);(n?2:e.readBits(1))>0&&(e.readBits(1)||e.skipBits(1)),t&&e.skipBits(3)}e.skipBits(1),e.skipBits(1),e.skipBits(1);let h=e.readBits(1),f=8;2===r&&h?f=e.readBits(1)?12:10:r<=2&&(f=h?10:8);let p=0;1!==r&&(p=e.readBits(1));let m=1,g=1,y=0;return!p&&(0===r?(m=1,g=1):1===r?(m=0,g=0):12===f&&(m=e.readBits(1))&&(g=e.readBits(1)),m&&g&&(y=e.readBits(2))),{profile:r,level:a,tier:o,bitDepth:f,monochrome:p,chromaSubsamplingX:m,chromaSubsamplingY:g,chromaSamplePosition:y}}return null},lp=[480,960,1920,2880,480,960,1920,2880,480,960,1920,2880,480,960,480,960,120,240,480,960,120,240,480,960,120,240,480,960,120,240,480,960],lm=(e,t,n)=>{switch(e){case"avc":for(let e of s4(n,t)){let t=s3(n[e.offset]);if(t>=jT.NON_IDR_SLICE&&t<=jT.SLICE_DPC)break;if(t===jT.IDR)return"key";if(t===jT.SEI&&(!sM()||sj()>=144)){let t=s8(n.subarray(e.offset,e.offset+e.length)),r=1;do{let e=0;for(;;){let n=t[r++];if(void 0===n||(e+=n,n<255))break}let n=0;for(;;){let e=t[r++];if(void 0===e||(n+=e,e<255))break}if(6===e){let e=new o2(t);e.pos=8*r;let n=o4(e),i=e.readBits(1);if(0===n&&1===i)return"key"}r+=n}while(r<t.length-1)}}return"delta";case"hevc":for(let e of le(n,t)){let t=lt(n[e.offset]);if(t<jP.BLA_W_LP)break;if(t<=jP.RSV_IRAP_VCL23)return"key"}return"delta";case"vp8":return 0==(1&n[0])?"key":"delta";case"vp9":{let e=new o2(n);if(2!==e.readBits(2))return null;let t=e.readBits(1);if(3===(e.readBits(1)<<1)+t&&e.skipBits(1),e.readBits(1))return null;return 0===e.readBits(1)?"key":"delta"}case"av1":{let e=!1;for(let{type:t,data:r}of lh(n))if(1===t){let t=new o2(r);t.skipBits(4),e=!!t.readBits(1)}else if(3===t||6===t||7===t){if(e)return"key";let t=new o2(r);if(t.readBits(1))return null;return 0===t.readBits(2)?"key":"delta"}return null}default:sg(e),oJ(!1)}};(NX=jO||(jO={}))[NX.STREAMINFO=0]="STREAMINFO",NX[NX.VORBIS_COMMENT=4]="VORBIS_COMMENT",NX[NX.PICTURE=6]="PICTURE";let lg=(e,t)=>{let n=o6(e),r=0,i=n.getUint32(r,!0);r+=4;let a=o5.decode(e.subarray(r,r+i));r+=i,i>0&&(t.raw??={},t.raw.vendor??=a);let o=n.getUint32(r,!0);r+=4;for(let i=0;i<o;i++){let i=n.getUint32(r,!0);r+=4;let a=o5.decode(e.subarray(r,r+i));r+=i;let o=a.indexOf("=");if(-1===o)continue;let s=a.slice(0,o).toUpperCase(),l=a.slice(o+1);switch(t.raw??={},t.raw[s]??=l,s){case"TITLE":t.title??=l;break;case"DESCRIPTION":t.description??=l;break;case"ARTIST":t.artist??=l;break;case"ALBUM":t.album??=l;break;case"ALBUMARTIST":t.albumArtist??=l;break;case"COMMENT":t.comment??=l;break;case"LYRICS":t.lyrics??=l;break;case"TRACKNUMBER":{let e=l.split("/"),n=Number.parseInt(e[0],10),r=e[1]&&Number.parseInt(e[1],10);Number.isInteger(n)&&n>0&&(t.trackNumber??=n),r&&Number.isInteger(r)&&r>0&&(t.tracksTotal??=r)}break;case"TRACKTOTAL":{let e=Number.parseInt(l,10);Number.isInteger(e)&&e>0&&(t.tracksTotal??=e)}break;case"DISCNUMBER":{let e=l.split("/"),n=Number.parseInt(e[0],10),r=e[1]&&Number.parseInt(e[1],10);Number.isInteger(n)&&n>0&&(t.discNumber??=n),r&&Number.isInteger(r)&&r>0&&(t.discsTotal??=r)}break;case"DISCTOTAL":{let e=Number.parseInt(l,10);Number.isInteger(e)&&e>0&&(t.discsTotal??=e)}break;case"DATE":{let e=new Date(l);Number.isNaN(e.getTime())||(t.date??=e)}break;case"GENRE":t.genre??=l;break;case"METADATA_BLOCK_PICTURE":{let e=sB(l),n=o6(e),r=n.getUint32(0,!1),i=n.getUint32(4,!1),a=String.fromCharCode(...e.subarray(8,8+i)),o=n.getUint32(8+i,!1),s=o5.decode(e.subarray(12+i,12+i+o)),c=n.getUint32(i+o+28),u=e.subarray(i+o+32,i+o+32+c);t.images??=[],t.images.push({data:u,mimeType:a,kind:3===r?"coverFront":4===r?"coverBack":"unknown",name:void 0,description:s||void 0})}}}},ly=[2,1,2,3,3,4,4,5],lv=e=>{if(e.length<7||11!==e[0]||119!==e[1])return null;let t=new o2(e);t.skipBits(16),t.skipBits(16);let n=t.readBits(2);if(3===n)return null;let r=t.readBits(6),i=t.readBits(5);if(i>8)return null;let a=t.readBits(3),o=t.readBits(3);return(1&o)!=0&&1!==o&&t.skipBits(2),(4&o)!=0&&t.skipBits(2),2===o&&t.skipBits(2),{fscod:n,bsid:i,bsmod:a,acmod:o,lfeon:t.readBits(1),bitRateCode:Math.floor(r/2)}},lb=[128,138,192,128,140,192,160,174,240,160,176,240,192,208,288,192,210,288,224,242,336,224,244,336,256,278,384,256,280,384,320,348,480,320,350,480,384,416,576,384,418,576,448,486,672,448,488,672,512,556,768,512,558,768,640,696,960,640,698,960,768,834,1152,768,836,1152,896,974,1344,896,976,1344,1024,1114,1536,1024,1116,1536,1280,1392,1920,1280,1394,1920,1536,1670,2304,1536,1672,2304,1792,1950,2688,1792,1952,2688,2048,2228,3072,2048,2230,3072,2304,2506,3456,2304,2508,3456,2560,2786,3840,2560,2788,3840];new Uint8Array([5,4,65,67,45,51]),new Uint8Array([5,4,69,65,67,51]);let lx=[1,2,3,6],lw=e=>{let t;if(e.length<6||11!==e[0]||119!==e[1])return null;let n=new o2(e);n.skipBits(16);let r=n.readBits(2);if(n.skipBits(3),0!==r&&2!==r)return null;let i=n.readBits(11),a=n.readBits(2),o=0;3===a?(o=n.readBits(2),t=3):t=n.readBits(2);let s=n.readBits(3),l=n.readBits(1),c=n.readBits(5);if(c<11||c>16)return null;let u=lx[t];return{dataRate:Math.round((i+1)*(a<3?sJ[a]/1e3:s0[o]/1e3)/(16*u)),substreams:[{fscod:a,fscod2:o,bsid:c,bsmod:0,acmod:s,lfeon:l,numDepSub:0,chanLoc:0}]}},lC=e=>{let t=e.substreams[0];return(oJ(t),t.fscod<3)?sJ[t.fscod]:null!==t.fscod2&&t.fscod2<3?s0[t.fscod2]:null},lS=e=>{let t=e.substreams[0];oJ(t);let n=ly[t.acmod]+t.lfeon;if(t.numDepSub>0){let e=[2,2,1,1,2,2,2,1,1];for(let r=0;r<9;r++)t.chanLoc&1<<8-r&&(n+=e[r])}return n};class lk{constructor(e){this.input=e}}let l_=[],lE=[];class lT{constructor(e){this.source=e}requestSlice(e,t){if(this.source._disposed)throw new lZ;if(e<0||null!==this.fileSize&&e+t>this.fileSize)return null;let n=e+t,r=this.source._read(e,n);return r instanceof Promise?r.then(t=>t?new lP(t.bytes,t.view,t.offset,e,n):null):r?new lP(r.bytes,r.view,r.offset,e,n):null}requestSliceRange(e,t,n){if(this.source._disposed)throw new lZ;if(e<0)return null;if(null!==this.fileSize)return this.requestSlice(e,sx(this.fileSize-e,t,n));{let r=this.requestSlice(e,n),i=r=>{if(r)return r;let i=r=>(oJ(null!==r),this.requestSlice(e,sx(r-e,t,n))),a=this.source._retrieveSize();return a instanceof Promise?a.then(i):i(a)};return r instanceof Promise?r.then(i):i(r)}}}class lP{constructor(e,t,n,r,i){this.bytes=e,this.view=t,this.offset=n,this.start=r,this.end=i,this.bufferPos=r-n}static tempFromBytes(e){return new lP(e,o6(e),0,0,e.length)}get length(){return this.end-this.start}get filePos(){return this.offset+this.bufferPos}set filePos(e){this.bufferPos=e-this.offset}get remainingLength(){return Math.max(this.end-this.filePos,0)}skip(e){this.bufferPos+=e}slice(e,t=this.end-e){if(e<this.start||e+t>this.end)throw RangeError("Slicing outside of original slice.");return new lP(this.bytes,this.view,this.offset,e,e+t)}}let lO=(e,t)=>{if(e.filePos<e.start||e.filePos+t>e.end)throw RangeError(`Tried reading [${e.filePos}, ${e.filePos+t}), but slice is [${e.start}, ${e.end}). This is likely an internal error, please report it alongside the file that caused it.`)},lA=(e,t)=>{lO(e,t);let n=e.bytes.subarray(e.bufferPos,e.bufferPos+t);return e.bufferPos+=t,n},lI=e=>(lO(e,1),e.view.getUint8(e.bufferPos++)),lR=(e,t)=>{lO(e,2);let n=e.view.getUint16(e.bufferPos,t);return e.bufferPos+=2,n},lL=e=>{lO(e,2);let t=e.view.getUint16(e.bufferPos,!1);return e.bufferPos+=2,t},lM=e=>{lO(e,3);let t=sy(e.view,e.bufferPos,!1);return e.bufferPos+=3,t},lN=e=>{lO(e,2);let t=e.view.getInt16(e.bufferPos,!1);return e.bufferPos+=2,t},lj=(e,t)=>{lO(e,4);let n=e.view.getUint32(e.bufferPos,t);return e.bufferPos+=4,n},lD=e=>{lO(e,4);let t=e.view.getUint32(e.bufferPos,!1);return e.bufferPos+=4,t},lz=e=>{lO(e,4);let t=e.view.getUint32(e.bufferPos,!0);return e.bufferPos+=4,t},lB=e=>{lO(e,4);let t=e.view.getInt32(e.bufferPos,!1);return e.bufferPos+=4,t},lF=(e,t)=>{let n,r;return t?(n=lj(e,!0),r=lj(e,!0)):(r=lj(e,!1),n=lj(e,!1)),0x100000000*r+n},lH=e=>0x100000000*lD(e)+lD(e),lV=e=>0x100000000*lB(e)+lD(e),lU=e=>{lO(e,8);let t=e.view.getFloat64(e.bufferPos,!1);return e.bufferPos+=8,t},l$=(e,t)=>{lO(e,t);let n="";for(let r=0;r<t;r++)n+=String.fromCharCode(e.bytes[e.bufferPos++]);return n};x("foUwZ");class lq{constructor(){this._disposed=!1,this._sizePromise=null,this.onread=null}async getSizeOrNull(){if(this._disposed)throw new lZ;return this._sizePromise??=Promise.resolve(this._retrieveSize())}async getSize(){if(this._disposed)throw new lZ;let e=await this.getSizeOrNull();if(null===e)throw Error("Cannot determine the size of an unsized source.");return e}}class lW extends lq{constructor(e){if(!(e instanceof ArrayBuffer)&&!("u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)&&!ArrayBuffer.isView(e))throw TypeError("buffer must be an ArrayBuffer, SharedArrayBuffer, or ArrayBufferView.");super(),this._onreadCalled=!1,this._bytes=o8(e),this._view=o6(e)}_retrieveSize(){return this._bytes.byteLength}_read(){return this._onreadCalled||(this.onread?.(0,this._bytes.byteLength),this._onreadCalled=!0),{bytes:this._bytes,view:this._view,offset:0}}_dispose(){}}let lG=(e,t,n)=>{if(t instanceof Error&&(t.message.includes("Failed to fetch")||t.message.includes("Load failed")||t.message.includes("NetworkError when attempting to fetch resource"))){let e=null;try{"u">typeof window&&void 0!==window.location&&(e=new URL(n instanceof Request?n.url:n,window.location.href).origin)}catch{}if(("u"<typeof navigator||"boolean"!=typeof navigator.onLine||navigator.onLine)&&null!==e&&e!==window.location.origin)return console.warn("Request will not be retried because a CORS error was suspected due to different origins. You can modify this behavior by providing your own function for the 'getRetryDelay' option."),null}return Math.min(2**(e-2),16)};class lK extends lq{constructor(e,t={}){if("string"!=typeof e&&!(e instanceof URL)&&!("u">typeof Request&&e instanceof Request))throw TypeError("url must be a string, URL or Request.");if(!t||"object"!=typeof t)throw TypeError("options must be an object.");if(void 0!==t.requestInit&&(!t.requestInit||"object"!=typeof t.requestInit))throw TypeError("options.requestInit, when provided, must be an object.");if(void 0!==t.getRetryDelay&&"function"!=typeof t.getRetryDelay)throw TypeError("options.getRetryDelay, when provided, must be a function.");if(void 0!==t.maxCacheSize&&(!sH(t.maxCacheSize)||t.maxCacheSize<0))throw TypeError("options.maxCacheSize, when provided, must be a non-negative number.");if(void 0!==t.parallelism&&(!Number.isInteger(t.parallelism)||t.parallelism<1))throw TypeError("options.parallelism, when provided, must be a positive number.");if(void 0!==t.fetchFn&&"function"!=typeof t.fetchFn)throw TypeError("options.fetchFn, when provided, must be a function.");super(),this._existingResponses=new WeakMap,this._url=e,this._options=t,this._getRetryDelay=t.getRetryDelay??lG,this._orchestrator=new lX({maxCacheSize:t.maxCacheSize??0x4000000,maxWorkerCount:t.parallelism??2,runWorker:this._runWorker.bind(this),prefetchProfile:lY.network})}async _retrieveSize(){let e,t,n=new AbortController,r=await sT(this._options.fetchFn??fetch,this._url,s_(this._options.requestInit??{},{headers:{Range:"bytes=0-"},signal:n.signal}),this._getRetryDelay,()=>this._disposed);if(!r.ok)throw Error(`Error fetching ${String(this._url)}: ${r.status} ${r.statusText}`);if(206===r.status)t=this._getTotalLengthFromRangeResponse(r),e=this._orchestrator.createWorker(0,Math.min(t,524288));else{let n=r.headers.get("Content-Length");if(n)t=Number(n),e=this._orchestrator.createWorker(0,t),this._orchestrator.options.maxCacheSize=1/0,console.warn("HTTP server did not respond with 206 Partial Content, meaning the entire remote resource now has to be downloaded. For efficient media file streaming across a network, please make sure your server supports range requests.");else throw Error(`HTTP response (status ${r.status}) must surface Content-Length header.`)}return this._orchestrator.fileSize=t,this._existingResponses.set(e,{response:r,abortController:n}),this._orchestrator.runWorker(e),t}_read(e,t){return this._orchestrator.read(e,t)}async _runWorker(e){for(;;){let t=this._existingResponses.get(e);this._existingResponses.delete(e);let n=t?.abortController,r=t?.response;if(n||(n=new AbortController,r=await sT(this._options.fetchFn??fetch,this._url,s_(this._options.requestInit??{},{headers:{Range:`bytes=${e.currentPos}-`},signal:n.signal}),this._getRetryDelay,()=>this._disposed)),oJ(r),!r.ok)throw Error(`Error fetching ${String(this._url)}: ${r.status} ${r.statusText}`);if(e.currentPos>0&&206!==r.status)throw Error("HTTP server did not respond with 206 Partial Content to a range request. To enable efficient media file streaming across a network, please make sure your server supports range requests.");if(!r.body)throw Error("Missing HTTP response body stream. The used fetch function must provide the response body as a ReadableStream.");let i=r.body.getReader();for(;;){let t;if(e.currentPos>=e.targetPos||e.aborted){n.abort(),e.running=!1;return}try{t=await i.read()}catch(t){if(this._disposed)throw t;let e=this._getRetryDelay(1,t,this._url);if(null!==e){console.error("Error while reading response stream. Attempting to resume.",t),await new Promise(t=>setTimeout(t,1e3*e));break}throw t}if(e.aborted)continue;let{done:r,value:a}=t;if(r){if(e.currentPos>=e.targetPos){this._orchestrator.forgetWorker(e),e.running=!1;return}break}this.onread?.(e.currentPos,e.currentPos+a.length),this._orchestrator.supplyWorkerData(e,a)}}}_getTotalLengthFromRangeResponse(e){let t=e.headers.get("Content-Range");if(t){let e=/\/(\d+)/.exec(t);if(e)return Number(e[1])}let n=e.headers.get("Content-Length");if(n)return Number(n);throw Error("Partial HTTP response (status 206) must surface either Content-Range or Content-Length header.")}_dispose(){this._orchestrator.dispose()}}let lY={network:(e,t,n)=>{for(let r of(e=Math.max(0,65536*Math.floor((e-65536)/65536)),n))if(sz(e,t,Math.max((r.startPos+r.targetPos)/2,r.targetPos-8388608),r.targetPos)){let e=r.targetPos-r.startPos,n=8388608*Math.ceil((e+1)/8388608),i=Math.min(2**Math.ceil(Math.log2(e+1)),n);t=Math.max(t,r.startPos+i)}return t=Math.max(t,e+524288),{start:e,end:t}}};class lX{constructor(e){this.options=e,this.fileSize=null,this.nextAge=0,this.workers=[],this.cache=[],this.currentCacheSize=0,this.disposed=!1}read(e,t){oJ(null!==this.fileSize);let n=this.options.prefetchProfile(e,t,this.workers),r=Math.max(n.start,0),i=Math.min(n.end,this.fileSize);oJ(r<=e&&t<=i);let a=null,o=su(this.cache,e,e=>e.start),s=-1!==o?this.cache[o]:null;s&&s.start<=e&&t<=s.end&&(s.age=this.nextAge++,a={bytes:s.bytes,view:s.view,offset:s.start});let l=su(this.cache,r,e=>e.start),c=a?null:new Uint8Array(t-e),u=0,d=r,h=[];if(-1!==l){for(let n=l;n<this.cache.length;n++){let a=this.cache[n];if(a.start>=i)break;if(a.end<=r)continue;let o=Math.max(r,a.start),s=Math.min(i,a.end);if(oJ(o<=s),d<o&&h.push({start:d,end:o}),d=s,c){let n=Math.max(e,a.start),r=Math.min(t,a.end);if(n<r){let t=n-e;c.set(a.bytes.subarray(n-a.start,r-a.start),t),t===u&&(u=r-e)}}a.age=this.nextAge++}d<i&&h.push({start:d,end:i})}else h.push({start:r,end:i});if(c&&u>=c.length&&(a={bytes:c,view:o6(c),offset:e}),0===h.length)return oJ(a),a;let{promise:f,resolve:p,reject:m}=sh(),g=[];for(let n of h){let r=Math.max(e,n.start),i=Math.min(t,n.end);r===n.start&&i===n.end?g.push(n):r<i&&g.push({start:r,end:i})}for(let t of h){let n=c&&{start:e,bytes:c,holes:g,resolve:p,reject:m},r=!1;for(let e of this.workers)if(sz(t.start-131072,t.start,e.currentPos,e.targetPos)){e.targetPos=Math.max(e.targetPos,t.end),r=!0,n&&!e.pendingSlices.includes(n)&&e.pendingSlices.push(n),e.running||this.runWorker(e);break}if(!r){let e=this.createWorker(t.start,t.end);n&&(e.pendingSlices=[n]),this.runWorker(e)}}return a||(oJ(c),a=f.then(t=>({bytes:t,view:o6(t),offset:e}))),a}createWorker(e,t){let n={startPos:e,currentPos:e,targetPos:t,running:!1,aborted:this.disposed,pendingSlices:[],age:this.nextAge++};for(this.workers.push(n);this.workers.length>this.options.maxWorkerCount;){let e=0,t=this.workers[0];for(let n=1;n<this.workers.length;n++){let r=this.workers[n];r.age<t.age&&(e=n,t=r)}if(t.running&&t.pendingSlices.length>0)break;t.aborted=!0,this.workers.splice(e,1)}return n}runWorker(e){oJ(!e.running),oJ(e.currentPos<e.targetPos),e.running=!0,e.age=this.nextAge++,this.options.runWorker(e).catch(t=>{if(e.running=!1,e.pendingSlices.length>0)e.pendingSlices.forEach(e=>e.reject(t)),e.pendingSlices.length=0;else throw t})}supplyWorkerData(e,t){oJ(!e.aborted);let n=e.currentPos,r=n+t.length;this.insertIntoCache({start:n,end:r,bytes:t,view:o6(t),age:this.nextAge++}),e.currentPos+=t.length,e.targetPos=Math.max(e.targetPos,e.currentPos);for(let i=0;i<e.pendingSlices.length;i++){let a=e.pendingSlices[i],o=Math.max(n,a.start),s=Math.min(r,a.start+a.bytes.length);o<s&&a.bytes.set(t.subarray(o-n,s-n),o-a.start);for(let e=0;e<a.holes.length;e++){let t=a.holes[e];n<=t.start&&r>t.start&&(t.start=r),t.end<=t.start&&(a.holes.splice(e,1),e--)}0===a.holes.length&&(a.resolve(a.bytes),e.pendingSlices.splice(i,1),i--)}for(let t=0;t<this.workers.length;t++){let i=this.workers[t];e!==i&&!i.running&&sz(n,r,i.currentPos,i.targetPos)&&(this.workers.splice(t,1),t--)}}forgetWorker(e){let t=this.workers.indexOf(e);oJ(-1!==t),this.workers.splice(t,1)}insertIntoCache(e){if(0===this.options.maxCacheSize)return;let t=su(this.cache,e.start,e=>e.start)+1;if(t>0){let n=this.cache[t-1];if(n.end>=e.end)return;if(n.end>e.start){let r=new Uint8Array(e.end-n.start);r.set(n.bytes,0),r.set(e.bytes,e.start-n.start),this.currentCacheSize+=e.end-n.end,n.bytes=r,n.view=o6(r),n.end=e.end,t--,e=n}else this.cache.splice(t,0,e),this.currentCacheSize+=e.bytes.length}else this.cache.splice(t,0,e),this.currentCacheSize+=e.bytes.length;for(let n=t+1;n<this.cache.length;n++){let t=this.cache[n];if(e.end<=t.start)break;if(e.end>=t.end){this.cache.splice(n,1),this.currentCacheSize-=t.bytes.length,n--;continue}let r=new Uint8Array(t.end-e.start);r.set(e.bytes,0),r.set(t.bytes,t.start-e.start),this.currentCacheSize-=e.end-t.start,e.bytes=r,e.view=o6(r),e.end=t.end,this.cache.splice(n,1);break}for(;this.currentCacheSize>this.options.maxCacheSize;){let e=0,t=this.cache[0];for(let n=1;n<this.cache.length;n++){let r=this.cache[n];r.age<t.age&&(e=n,t=r)}if(this.currentCacheSize-t.bytes.length<=this.options.maxCacheSize)break;this.cache.splice(e,1),this.currentCacheSize-=t.bytes.length}}dispose(){for(let e of this.workers)e.aborted=!0;this.workers.length=0,this.cache.length=0,this.disposed=!0}}sF();class lQ{get disposed(){return this._disposed}constructor(e){if(this._demuxerPromise=null,this._format=null,this._disposed=!1,!e||"object"!=typeof e)throw TypeError("options must be an object.");if(!Array.isArray(e.formats)||e.formats.some(e=>!(e instanceof uB)))throw TypeError("options.formats must be an array of InputFormat.");if(!(e.source instanceof lq))throw TypeError("options.source must be a Source.");if(e.source._disposed)throw Error("options.source must not be disposed.");this._formats=e.formats,this._source=e.source,this._reader=new lT(e.source)}_getDemuxer(){return this._demuxerPromise??=(async()=>{for(let e of(this._reader.fileSize=await this._source.getSizeOrNull(),this._formats))if(await e._canReadInput(this))return this._format=e,e._createDemuxer(this);throw Error("Input has an unsupported or unrecognizable format.")})()}get source(){return this._source}async getFormat(){return await this._getDemuxer(),oJ(this._format),this._format}async computeDuration(){return(await this._getDemuxer()).computeDuration()}async getFirstTimestamp(){let e=await this.getTracks();return 0===e.length?0:Math.min(...await Promise.all(e.map(e=>e.getFirstTimestamp())))}async getTracks(){return(await this._getDemuxer()).getTracks()}async getVideoTracks(){return(await this.getTracks()).filter(e=>e.isVideoTrack())}async getAudioTracks(){return(await this.getTracks()).filter(e=>e.isAudioTrack())}async getPrimaryVideoTrack(){return(await this.getTracks()).find(e=>e.isVideoTrack())??null}async getPrimaryAudioTrack(){return(await this.getTracks()).find(e=>e.isAudioTrack())??null}async getMimeType(){return(await this._getDemuxer()).getMimeType()}async getMetadataTags(){return(await this._getDemuxer()).getMetadataTags()}dispose(){this._disposed||(this._disposed=!0,this._source._disposed=!0,this._source._dispose())}[Symbol.dispose](){this.dispose()}}class lZ extends Error{constructor(e="Input has been disposed."){super(e),this.name="InputDisposedError"}}let lJ=new Uint8Array(0);class l0{constructor(e,t,n,r,i=-1,a,o){if(this.data=e,this.type=t,this.timestamp=n,this.duration=r,this.sequenceNumber=i,e===lJ&&void 0===a)throw Error("Internal error: byteLength must be explicitly provided when constructing metadata-only packets.");if(void 0===a&&(a=e.byteLength),!(e instanceof Uint8Array))throw TypeError("data must be a Uint8Array.");if("key"!==t&&"delta"!==t)throw TypeError('type must be either "key" or "delta".');if(!Number.isFinite(n))throw TypeError("timestamp must be a number.");if(!Number.isFinite(r)||r<0)throw TypeError("duration must be a non-negative number.");if(!Number.isFinite(i))throw TypeError("sequenceNumber must be a number.");if(!Number.isInteger(a)||a<0)throw TypeError("byteLength must be a non-negative integer.");if(void 0!==o&&("object"!=typeof o||!o))throw TypeError("sideData, when provided, must be an object.");if(o?.alpha!==void 0&&!(o.alpha instanceof Uint8Array))throw TypeError("sideData.alpha, when provided, must be a Uint8Array.");if(o?.alphaByteLength!==void 0&&(!Number.isInteger(o.alphaByteLength)||o.alphaByteLength<0))throw TypeError("sideData.alphaByteLength, when provided, must be a non-negative integer.");this.byteLength=a,this.sideData=o??{},this.sideData.alpha&&void 0===this.sideData.alphaByteLength&&(this.sideData.alphaByteLength=this.sideData.alpha.byteLength)}get isMetadataOnly(){return this.data===lJ}get microsecondTimestamp(){return Math.trunc(sk*this.timestamp)}get microsecondDuration(){return Math.trunc(sk*this.duration)}toEncodedVideoChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if("u"<typeof EncodedVideoChunk)throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}alphaToEncodedVideoChunk(e=this.type){if(!this.sideData.alpha)throw TypeError("This packet does not contain alpha side data.");if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to a video chunk.");if("u"<typeof EncodedVideoChunk)throw Error("Your browser does not support EncodedVideoChunk.");return new EncodedVideoChunk({data:this.sideData.alpha,type:e,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}toEncodedAudioChunk(){if(this.isMetadataOnly)throw TypeError("Metadata-only packets cannot be converted to an audio chunk.");if("u"<typeof EncodedAudioChunk)throw Error("Your browser does not support EncodedAudioChunk.");return new EncodedAudioChunk({data:this.data,type:this.type,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration})}static fromEncodedChunk(e,t){if(!(e instanceof EncodedVideoChunk||e instanceof EncodedAudioChunk))throw TypeError("chunk must be an EncodedVideoChunk or EncodedAudioChunk.");let n=new Uint8Array(e.byteLength);return e.copyTo(n),new l0(n,e.type,e.timestamp/1e6,(e.duration??0)/1e6,void 0,void 0,t)}clone(e){if(void 0!==e&&("object"!=typeof e||null===e))throw TypeError("options, when provided, must be an object.");if(e?.data!==void 0&&!(e.data instanceof Uint8Array))throw TypeError("options.data, when provided, must be a Uint8Array.");if(e?.type!==void 0&&"key"!==e.type&&"delta"!==e.type)throw TypeError('options.type, when provided, must be either "key" or "delta".');if(e?.timestamp!==void 0&&!Number.isFinite(e.timestamp))throw TypeError("options.timestamp, when provided, must be a number.");if(e?.duration!==void 0&&!Number.isFinite(e.duration))throw TypeError("options.duration, when provided, must be a number.");if(e?.sequenceNumber!==void 0&&!Number.isFinite(e.sequenceNumber))throw TypeError("options.sequenceNumber, when provided, must be a number.");if(e?.sideData!==void 0&&("object"!=typeof e.sideData||null===e.sideData))throw TypeError("options.sideData, when provided, must be an object.");return new l0(e?.data??this.data,e?.type??this.type,e?.timestamp??this.timestamp,e?.duration??this.duration,e?.sequenceNumber??this.sequenceNumber,this.byteLength,e?.sideData??this.sideData)}}sF();let l1=-1/0,l2=-1/0,l4=null;"u">typeof FinalizationRegistry&&(l4=new FinalizationRegistry(e=>{let t=Date.now();"video"===e.type?(t-l1>=1e3&&(console.error("A VideoSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your VideoSamples as soon as you're done using them."),l1=t),"u">typeof VideoFrame&&e.data instanceof VideoFrame&&e.data.close()):(t-l2>=1e3&&(console.error("An AudioSample was garbage collected without first being closed. For proper resource management, make sure to call close() on all your AudioSamples as soon as you're done using them."),l2=t),"u">typeof AudioData&&e.data instanceof AudioData&&e.data.close())}));let l3=["I420","I420P10","I420P12","I420A","I420AP10","I420AP12","I422","I422P10","I422P12","I422A","I422AP10","I422AP12","I444","I444P10","I444P12","I444A","I444AP10","I444AP12","NV12","RGBA","RGBX","BGRA","BGRX"],l8=new Set(l3);class l6{get displayWidth(){return this.rotation%180==0?this.codedWidth:this.codedHeight}get displayHeight(){return this.rotation%180==0?this.codedHeight:this.codedWidth}get microsecondTimestamp(){return Math.trunc(sk*this.timestamp)}get microsecondDuration(){return Math.trunc(sk*this.duration)}get hasAlpha(){return this.format&&this.format.includes("A")}constructor(e,t){if(this._closed=!1,e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer||ArrayBuffer.isView(e)){if(!t||"object"!=typeof t)throw TypeError("init must be an object.");if(void 0===t.format||!l8.has(t.format))throw TypeError("init.format must be one of: "+l3.join(", "));if(!Number.isInteger(t.codedWidth)||t.codedWidth<=0)throw TypeError("init.codedWidth must be a positive integer.");if(!Number.isInteger(t.codedHeight)||t.codedHeight<=0)throw TypeError("init.codedHeight must be a positive integer.");if(void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(t.timestamp))throw TypeError("init.timestamp must be a number.");if(void 0!==t.duration&&(!Number.isFinite(t.duration)||t.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=o8(e).slice(),this._layout=t.layout??cn(t.format,t.codedWidth,t.codedHeight),this.format=t.format,this.codedWidth=t.codedWidth,this.codedHeight=t.codedHeight,this.rotation=t.rotation??0,this.timestamp=t.timestamp,this.duration=t.duration??0,this.colorSpace=new l5(t.colorSpace)}else if("u">typeof VideoFrame&&e instanceof VideoFrame){if(t?.rotation!==void 0&&![0,90,180,270].includes(t.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(t?.timestamp!==void 0&&!Number.isFinite(t?.timestamp))throw TypeError("init.timestamp, when provided, must be a number.");if(t?.duration!==void 0&&(!Number.isFinite(t.duration)||t.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");this._data=e,this._layout=null,this.format=e.format,this.codedWidth=e.displayWidth,this.codedHeight=e.displayHeight,this.rotation=t?.rotation??0,this.timestamp=t?.timestamp??e.timestamp/1e6,this.duration=t?.duration??(e.duration??0)/1e6,this.colorSpace=new l5(e.colorSpace)}else if("u">typeof HTMLImageElement&&e instanceof HTMLImageElement||"u">typeof SVGImageElement&&e instanceof SVGImageElement||"u">typeof ImageBitmap&&e instanceof ImageBitmap||"u">typeof HTMLVideoElement&&e instanceof HTMLVideoElement||"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement||"u">typeof OffscreenCanvas&&e instanceof OffscreenCanvas){if(!t||"object"!=typeof t)throw TypeError("init must be an object.");if(void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw TypeError("init.rotation, when provided, must be 0, 90, 180, or 270.");if(!Number.isFinite(t.timestamp))throw TypeError("init.timestamp must be a number.");if(void 0!==t.duration&&(!Number.isFinite(t.duration)||t.duration<0))throw TypeError("init.duration, when provided, must be a non-negative number.");if("u">typeof VideoFrame)return new l6(new VideoFrame(e,{timestamp:Math.trunc(t.timestamp*sk),duration:Math.trunc((t.duration??0)*sk)||void 0}),t);let n=0,r=0;if("naturalWidth"in e?(n=e.naturalWidth,r=e.naturalHeight):"videoWidth"in e?(n=e.videoWidth,r=e.videoHeight):"width"in e&&(n=Number(e.width),r=Number(e.height)),!n||!r)throw TypeError("Could not determine dimensions.");let i=new OffscreenCanvas(n,r),a=i.getContext("2d",{alpha:sR(),willReadFrequently:!0});oJ(a),a.drawImage(e,0,0),this._data=i,this._layout=null,this.format="RGBX",this.codedWidth=n,this.codedHeight=r,this.rotation=t.rotation??0,this.timestamp=t.timestamp,this.duration=t.duration??0,this.colorSpace=new l5({matrix:"rgb",primaries:"bt709",transfer:"iec61966-2-1",fullRange:!0})}else throw TypeError("Invalid data type: Must be a BufferSource or CanvasImageSource.");l4?.register(this,{type:"video",data:this._data},this)}clone(){if(this._closed)throw Error("VideoSample is closed.");return(oJ(null!==this._data),l9(this._data))?new l6(this._data.clone(),{timestamp:this.timestamp,duration:this.duration,rotation:this.rotation}):this._data instanceof Uint8Array?(oJ(this._layout),new l6(this._data,{format:this.format,layout:this._layout,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})):new l6(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.timestamp,duration:this.duration,colorSpace:this.colorSpace,rotation:this.rotation})}close(){this._closed||(l4?.unregister(this),l9(this._data)?this._data.close():this._data=null,this._closed=!0)}allocationSize(e={}){if(ct(e),this._closed)throw Error("VideoSample is closed.");if(null===this.format)throw Error("Cannot get allocation size when format is null. Sorry!");if(oJ(null!==this._data),!l9(this._data)&&(e.colorSpace||e.format&&e.format!==this.format||e.layout||e.rect)){let t=this.toVideoFrame(),n=t.allocationSize(e);return t.close(),n}return l9(this._data)?this._data.allocationSize(e):this._data instanceof Uint8Array?this._data.byteLength:this.codedWidth*this.codedHeight*4}async copyTo(e,t={}){if(!sa(e))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(ct(t),this._closed)throw Error("VideoSample is closed.");if(null===this.format)throw Error("Cannot copy video sample data when format is null. Sorry!");if(oJ(null!==this._data),!l9(this._data)&&(t.colorSpace||t.format&&t.format!==this.format||t.layout||t.rect)){let n=this.toVideoFrame(),r=await n.copyTo(e,t);return n.close(),r}if(l9(this._data))return this._data.copyTo(e,t);if(this._data instanceof Uint8Array)return oJ(this._layout),o8(e).set(this._data),this._layout;{let t=this._data.getContext("2d");oJ(t);let n=t.getImageData(0,0,this.codedWidth,this.codedHeight);return o8(e).set(n.data),[{offset:0,stride:4*this.codedWidth}]}}toVideoFrame(){if(this._closed)throw Error("VideoSample is closed.");return(oJ(null!==this._data),l9(this._data))?new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0}):this._data instanceof Uint8Array?new VideoFrame(this._data,{format:this.format,codedWidth:this.codedWidth,codedHeight:this.codedHeight,timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0,colorSpace:this.colorSpace}):new VideoFrame(this._data,{timestamp:this.microsecondTimestamp,duration:this.microsecondDuration||void 0})}draw(e,t,n,r,i,a,o,s,l){let c=0,u=0,d=this.displayWidth,h=this.displayHeight,f=0,p=0,m=this.displayWidth,g=this.displayHeight;if(void 0!==a?(c=t,u=n,d=r,h=i,f=a,p=o,void 0!==s?(m=s,g=l):(m=d,g=h)):(f=t,p=n,void 0!==r&&(m=r,g=i)),!("u">typeof CanvasRenderingContext2D&&e instanceof CanvasRenderingContext2D||"u">typeof OffscreenCanvasRenderingContext2D&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!Number.isFinite(c))throw TypeError("sx must be a number.");if(!Number.isFinite(u))throw TypeError("sy must be a number.");if(!Number.isFinite(d)||d<0)throw TypeError("sWidth must be a non-negative number.");if(!Number.isFinite(h)||h<0)throw TypeError("sHeight must be a non-negative number.");if(!Number.isFinite(f))throw TypeError("dx must be a number.");if(!Number.isFinite(p))throw TypeError("dy must be a number.");if(!Number.isFinite(m)||m<0)throw TypeError("dWidth must be a non-negative number.");if(!Number.isFinite(g)||g<0)throw TypeError("dHeight must be a non-negative number.");if(this._closed)throw Error("VideoSample is closed.");({sx:c,sy:u,sWidth:d,sHeight:h}=this._rotateSourceRegion(c,u,d,h,this.rotation));let y=this.toCanvasImageSource();e.save();let v=f+m/2,b=p+g/2;e.translate(v,b),e.rotate(this.rotation*Math.PI/180);let x=this.rotation%180==0?1:m/g;e.scale(1/x,x),e.drawImage(y,c,u,d,h,-m/2,-g/2,m,g),e.restore()}drawWithFit(e,t){let n,r,i,a;if(!("u">typeof CanvasRenderingContext2D&&e instanceof CanvasRenderingContext2D||"u">typeof OffscreenCanvasRenderingContext2D&&e instanceof OffscreenCanvasRenderingContext2D))throw TypeError("context must be a CanvasRenderingContext2D or OffscreenCanvasRenderingContext2D.");if(!t||"object"!=typeof t)throw TypeError("options must be an object.");if(!["fill","contain","cover"].includes(t.fit))throw TypeError("options.fit must be 'fill', 'contain', or 'cover'.");if(void 0!==t.rotation&&![0,90,180,270].includes(t.rotation))throw TypeError("options.rotation, when provided, must be 0, 90, 180, or 270.");void 0!==t.crop&&ce(t.crop,"options.");let o=e.canvas.width,s=e.canvas.height,l=t.rotation??this.rotation,[c,u]=l%180==0?[this.codedWidth,this.codedHeight]:[this.codedHeight,this.codedWidth];t.crop&&l7(t.crop,c,u);let{sx:d,sy:h,sWidth:f,sHeight:p}=this._rotateSourceRegion(t.crop?.left??0,t.crop?.top??0,t.crop?.width??c,t.crop?.height??u,l);if("fill"===t.fit)n=0,r=0,i=o,a=s;else{let[e,l]=t.crop?[t.crop.width,t.crop.height]:[c,u],d="contain"===t.fit?Math.min(o/e,s/l):Math.max(o/e,s/l);i=e*d,a=l*d,n=(o-i)/2,r=(s-a)/2}e.save();let m=l%180==0?1:i/a;e.translate(o/2,s/2),e.rotate(l*Math.PI/180),e.scale(1/m,m),e.translate(-o/2,-s/2),e.drawImage(this.toCanvasImageSource(),d,h,f,p,n,r,i,a),e.restore()}_rotateSourceRegion(e,t,n,r,i){return 90===i?[e,t,n,r]=[t,this.codedHeight-e-n,r,n]:180===i?[e,t]=[this.codedWidth-e-n,this.codedHeight-t-r]:270===i&&([e,t,n,r]=[this.codedWidth-t-r,e,r,n]),{sx:e,sy:t,sWidth:n,sHeight:r}}toCanvasImageSource(){if(this._closed)throw Error("VideoSample is closed.");if(oJ(null!==this._data),!(this._data instanceof Uint8Array))return this._data;{let e=this.toVideoFrame();return queueMicrotask(()=>e.close()),e}}setRotation(e){if(![0,90,180,270].includes(e))throw TypeError("newRotation must be 0, 90, 180, or 270.");this.rotation=e}setTimestamp(e){if(!Number.isFinite(e))throw TypeError("newTimestamp must be a number.");this.timestamp=e}setDuration(e){if(!Number.isFinite(e)||e<0)throw TypeError("newDuration must be a non-negative number.");this.duration=e}[Symbol.dispose](){this.close()}}class l5{constructor(e){this.primaries=e?.primaries??null,this.transfer=e?.transfer??null,this.matrix=e?.matrix??null,this.fullRange=e?.fullRange??null}toJSON(){return{primaries:this.primaries,transfer:this.transfer,matrix:this.matrix,fullRange:this.fullRange}}}let l9=e=>"u">typeof VideoFrame&&e instanceof VideoFrame,l7=(e,t,n)=>{e.left=Math.min(e.left,t),e.top=Math.min(e.top,n),e.width=Math.min(e.width,t-e.left),e.height=Math.min(e.height,n-e.top),oJ(e.width>=0),oJ(e.height>=0)},ce=(e,t)=>{if(!e||"object"!=typeof e)throw TypeError(t+"crop, when provided, must be an object.");if(!Number.isInteger(e.left)||e.left<0)throw TypeError(t+"crop.left must be a non-negative integer.");if(!Number.isInteger(e.top)||e.top<0)throw TypeError(t+"crop.top must be a non-negative integer.");if(!Number.isInteger(e.width)||e.width<0)throw TypeError(t+"crop.width must be a non-negative integer.");if(!Number.isInteger(e.height)||e.height<0)throw TypeError(t+"crop.height must be a non-negative integer.")},ct=e=>{if(!e||"object"!=typeof e)throw TypeError("options must be an object.");if(void 0!==e.colorSpace&&!["display-p3","srgb"].includes(e.colorSpace))throw TypeError("options.colorSpace, when provided, must be 'display-p3' or 'srgb'.");if(void 0!==e.format&&"string"!=typeof e.format)throw TypeError("options.format, when provided, must be a string.");if(void 0!==e.layout){if(!Array.isArray(e.layout))throw TypeError("options.layout, when provided, must be an array.");for(let t of e.layout){if(!t||"object"!=typeof t)throw TypeError("Each entry in options.layout must be an object.");if(!Number.isInteger(t.offset)||t.offset<0)throw TypeError("plane.offset must be a non-negative integer.");if(!Number.isInteger(t.stride)||t.stride<0)throw TypeError("plane.stride must be a non-negative integer.")}}if(void 0!==e.rect){if(!e.rect||"object"!=typeof e.rect)throw TypeError("options.rect, when provided, must be an object.");if(void 0!==e.rect.x&&(!Number.isInteger(e.rect.x)||e.rect.x<0))throw TypeError("options.rect.x, when provided, must be a non-negative integer.");if(void 0!==e.rect.y&&(!Number.isInteger(e.rect.y)||e.rect.y<0))throw TypeError("options.rect.y, when provided, must be a non-negative integer.");if(void 0!==e.rect.width&&(!Number.isInteger(e.rect.width)||e.rect.width<0))throw TypeError("options.rect.width, when provided, must be a non-negative integer.");if(void 0!==e.rect.height&&(!Number.isInteger(e.rect.height)||e.rect.height<0))throw TypeError("options.rect.height, when provided, must be a non-negative integer.")}},cn=(e,t,n)=>{let r=cr(e),i=[],a=0;for(let e of r){let r=Math.ceil(t/e.widthDivisor),o=Math.ceil(n/e.heightDivisor),s=r*e.sampleBytes,l=s*o;i.push({offset:a,stride:s}),a+=l}return i},cr=e=>{let t=(e,t,n,r,i)=>{let a=[{sampleBytes:e,widthDivisor:1,heightDivisor:1},{sampleBytes:t,widthDivisor:n,heightDivisor:r},{sampleBytes:t,widthDivisor:n,heightDivisor:r}];return i&&a.push({sampleBytes:e,widthDivisor:1,heightDivisor:1}),a};switch(e){case"I420":return t(1,1,2,2,!1);case"I420P10":case"I420P12":return t(2,2,2,2,!1);case"I420A":return t(1,1,2,2,!0);case"I420AP10":case"I420AP12":return t(2,2,2,2,!0);case"I422":return t(1,1,2,1,!1);case"I422P10":case"I422P12":return t(2,2,2,1,!1);case"I422A":return t(1,1,2,1,!0);case"I422AP10":case"I422AP12":return t(2,2,2,1,!0);case"I444":return t(1,1,1,1,!1);case"I444P10":case"I444P12":return t(2,2,1,1,!1);case"I444A":return t(1,1,1,1,!0);case"I444AP10":case"I444AP12":return t(2,2,1,1,!0);case"NV12":return[{sampleBytes:1,widthDivisor:1,heightDivisor:1},{sampleBytes:2,widthDivisor:2,heightDivisor:2}];case"RGBA":case"RGBX":case"BGRA":case"BGRX":return[{sampleBytes:4,widthDivisor:1,heightDivisor:1}];default:sg(e),oJ(!1)}},ci=new Set(["f32","f32-planar","s16","s16-planar","s32","s32-planar","u8","u8-planar"]);class ca{get microsecondTimestamp(){return Math.trunc(sk*this.timestamp)}get microsecondDuration(){return Math.trunc(sk*this.duration)}constructor(e){if(this._closed=!1,cu(e)){if(null===e.format)throw TypeError("AudioData with null format is not supported.");this._data=e,this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=e.numberOfFrames,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp/1e6,this.duration=e.numberOfFrames/e.sampleRate}else{let t;if(!e||"object"!=typeof e)throw TypeError("Invalid AudioDataInit: must be an object.");if(!ci.has(e.format))throw TypeError("Invalid AudioDataInit: invalid format.");if(!Number.isFinite(e.sampleRate)||e.sampleRate<=0)throw TypeError("Invalid AudioDataInit: sampleRate must be > 0.");if(!Number.isInteger(e.numberOfChannels)||0===e.numberOfChannels)throw TypeError("Invalid AudioDataInit: numberOfChannels must be an integer > 0.");if(!Number.isFinite(e?.timestamp))throw TypeError("init.timestamp must be a number.");let n=e.data.byteLength/(co(e.format)*e.numberOfChannels);if(!Number.isInteger(n))throw TypeError("Invalid AudioDataInit: data size is not a multiple of frame size.");if(this.format=e.format,this.sampleRate=e.sampleRate,this.numberOfFrames=n,this.numberOfChannels=e.numberOfChannels,this.timestamp=e.timestamp,this.duration=n/e.sampleRate,e.data instanceof ArrayBuffer)t=new Uint8Array(e.data);else if(ArrayBuffer.isView(e.data))t=new Uint8Array(e.data.buffer,e.data.byteOffset,e.data.byteLength);else throw TypeError("Invalid AudioDataInit: data is not a BufferSource.");let r=this.numberOfFrames*this.numberOfChannels*co(this.format);if(t.byteLength<r)throw TypeError("Invalid AudioDataInit: insufficient data size.");this._data=t}l4?.register(this,{type:"audio",data:this._data},this)}allocationSize(e){if(!e||"object"!=typeof e)throw TypeError("options must be an object.");if(!Number.isInteger(e.planeIndex)||e.planeIndex<0)throw TypeError("planeIndex must be a non-negative integer.");if(void 0!==e.format&&!ci.has(e.format))throw TypeError("Invalid format.");if(void 0!==e.frameOffset&&(!Number.isInteger(e.frameOffset)||e.frameOffset<0))throw TypeError("frameOffset must be a non-negative integer.");if(void 0!==e.frameCount&&(!Number.isInteger(e.frameCount)||e.frameCount<0))throw TypeError("frameCount must be a non-negative integer.");if(this._closed)throw Error("AudioSample is closed.");let t=e.format??this.format,n=e.frameOffset??0;if(n>=this.numberOfFrames)throw RangeError("frameOffset out of range");let r=void 0!==e.frameCount?e.frameCount:this.numberOfFrames-n;if(r>this.numberOfFrames-n)throw RangeError("frameCount out of range");let i=co(t),a=cs(t);if(a&&e.planeIndex>=this.numberOfChannels||!a&&0!==e.planeIndex)throw RangeError("planeIndex out of range");return(a?r:r*this.numberOfChannels)*i}copyTo(e,t){if(!sa(e))throw TypeError("destination must be an ArrayBuffer or an ArrayBuffer view.");if(!t||"object"!=typeof t)throw TypeError("options must be an object.");if(!Number.isInteger(t.planeIndex)||t.planeIndex<0)throw TypeError("planeIndex must be a non-negative integer.");if(void 0!==t.format&&!ci.has(t.format))throw TypeError("Invalid format.");if(void 0!==t.frameOffset&&(!Number.isInteger(t.frameOffset)||t.frameOffset<0))throw TypeError("frameOffset must be a non-negative integer.");if(void 0!==t.frameCount&&(!Number.isInteger(t.frameCount)||t.frameCount<0))throw TypeError("frameCount must be a non-negative integer.");if(this._closed)throw Error("AudioSample is closed.");let{planeIndex:n,format:r,frameCount:i,frameOffset:a}=t,o=this.format,s=r??this.format;if(!s)throw Error("Destination format not determined");let l=this.numberOfFrames,c=this.numberOfChannels,u=a??0;if(u>=l)throw RangeError("frameOffset out of range");let d=void 0!==i?i:l-u;if(d>l-u)throw RangeError("frameCount out of range");let h=co(s),f=cs(s);if(f&&n>=c||!f&&0!==n)throw RangeError("planeIndex out of range");let p=f?d:d*c;if(e.byteLength<p*h)throw RangeError("Destination buffer is too small");let m=o6(e),g=cc(s);if(cu(this._data))sA()&&c>2&&s!==o?cd(this._data,m,o,s,c,n,u,d):this._data.copyTo(e,{planeIndex:n,frameOffset:u,frameCount:d,format:s});else{let e=o6(this._data),t=cl(o),r=co(o),i=cs(o);for(let a=0;a<d;a++)if(f)g(m,a*h,t(e,i?(n*l+(a+u))*r:((a+u)*c+n)*r));else for(let n=0;n<c;n++)g(m,(a*c+n)*h,t(e,i?(n*l+(a+u))*r:((a+u)*c+n)*r))}}clone(){if(this._closed)throw Error("AudioSample is closed.");if(!cu(this._data))return new ca({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.timestamp,data:this._data});{let e=new ca(this._data.clone());return e.setTimestamp(this.timestamp),e}}close(){this._closed||(l4?.unregister(this),cu(this._data)?this._data.close():this._data=new Uint8Array(0),this._closed=!0)}toAudioData(){if(this._closed)throw Error("AudioSample is closed.");if(!cu(this._data))return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:this._data.buffer instanceof ArrayBuffer?this._data.buffer:this._data.slice()});if(this._data.timestamp===this.microsecondTimestamp)return this._data.clone();if(cs(this.format)){let e=this.allocationSize({planeIndex:0,format:this.format}),t=new ArrayBuffer(e*this.numberOfChannels);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(new Uint8Array(t,n*e,e),{planeIndex:n,format:this.format});return new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:t})}{let e=new ArrayBuffer(this.allocationSize({planeIndex:0,format:this.format}));return this.copyTo(e,{planeIndex:0,format:this.format}),new AudioData({format:this.format,sampleRate:this.sampleRate,numberOfFrames:this.numberOfFrames,numberOfChannels:this.numberOfChannels,timestamp:this.microsecondTimestamp,data:e})}}toAudioBuffer(){if(this._closed)throw Error("AudioSample is closed.");let e=new AudioBuffer({numberOfChannels:this.numberOfChannels,length:this.numberOfFrames,sampleRate:this.sampleRate}),t=new Float32Array(this.allocationSize({planeIndex:0,format:"f32-planar"})/4);for(let n=0;n<this.numberOfChannels;n++)this.copyTo(t,{planeIndex:n,format:"f32-planar"}),e.copyToChannel(t,n);return e}setTimestamp(e){if(!Number.isFinite(e))throw TypeError("newTimestamp must be a number.");this.timestamp=e}[Symbol.dispose](){this.close()}static*_fromAudioBuffer(e,t){if(!(e instanceof AudioBuffer))throw TypeError("audioBuffer must be an AudioBuffer.");let n=e.numberOfChannels,r=e.sampleRate,i=e.length,a=Math.floor(24e4/n),o=0,s=i;for(;s>0;){let i=Math.min(a,s),l=new Float32Array(n*i);for(let t=0;t<n;t++)e.copyFromChannel(l.subarray(t*i,(t+1)*i),t,o);yield new ca({format:"f32-planar",sampleRate:r,numberOfFrames:i,numberOfChannels:n,timestamp:t+o/r,data:l}),o+=i,s-=i}}static fromAudioBuffer(e,t){if(!(e instanceof AudioBuffer))throw TypeError("audioBuffer must be an AudioBuffer.");let n=e.numberOfChannels,r=e.sampleRate,i=e.length,a=Math.floor(24e4/n),o=0,s=i,l=[];for(;s>0;){let i=Math.min(a,s),c=new Float32Array(n*i);for(let t=0;t<n;t++)e.copyFromChannel(c.subarray(t*i,(t+1)*i),t,o);let u=new ca({format:"f32-planar",sampleRate:r,numberOfFrames:i,numberOfChannels:n,timestamp:t+o/r,data:c});l.push(u),o+=i,s-=i}return l}}let co=e=>{switch(e){case"u8":case"u8-planar":return 1;case"s16":case"s16-planar":return 2;case"s32":case"s32-planar":case"f32":case"f32-planar":return 4;default:throw Error("Unknown AudioSampleFormat")}},cs=e=>{switch(e){case"u8-planar":case"s16-planar":case"s32-planar":case"f32-planar":return!0;default:return!1}},cl=e=>{switch(e){case"u8":case"u8-planar":return(e,t)=>(e.getUint8(t)-128)/128;case"s16":case"s16-planar":return(e,t)=>e.getInt16(t,!0)/32768;case"s32":case"s32-planar":return(e,t)=>e.getInt32(t,!0)/0x80000000;case"f32":case"f32-planar":return(e,t)=>e.getFloat32(t,!0)}},cc=e=>{switch(e){case"u8":case"u8-planar":return(e,t,n)=>e.setUint8(t,sx((n+1)*127.5,0,255));case"s16":case"s16-planar":return(e,t,n)=>e.setInt16(t,sx(Math.round(32767*n),-32768,32767),!0);case"s32":case"s32-planar":return(e,t,n)=>e.setInt32(t,sx(Math.round(0x7fffffff*n),-0x80000000,0x7fffffff),!0);case"f32":case"f32-planar":return(e,t,n)=>e.setFloat32(t,n,!0)}},cu=e=>"u">typeof AudioData&&e instanceof AudioData,cd=(e,t,n,r,i,a,o,s)=>{let l=cl(n),c=cc(r),u=co(n),d=co(r),h=cs(n);if(cs(r))if(h){let r=new ArrayBuffer(s*u),i=o6(r);e.copyTo(r,{planeIndex:a,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=e*u;c(t,e*d,l(i,n))}}else{let r=new ArrayBuffer(s*i*u),h=o6(r);e.copyTo(r,{planeIndex:0,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=(e*i+a)*u;c(t,e*d,l(h,n))}}else if(h){let r=new ArrayBuffer(s*u),a=o6(r);for(let h=0;h<i;h++){e.copyTo(r,{planeIndex:h,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++){let n=e*u;c(t,(e*i+h)*d,l(a,n))}}}else{let r=new ArrayBuffer(s*i*u),a=o6(r);e.copyTo(r,{planeIndex:0,frameOffset:o,frameCount:s,format:n});for(let e=0;e<s;e++)for(let n=0;n<i;n++){let r=e*i+n,o=r*u;c(t,r*d,l(a,o))}}},ch=e=>{if(!e||"object"!=typeof e)throw TypeError("options must be an object.");if(void 0!==e.metadataOnly&&"boolean"!=typeof e.metadataOnly)throw TypeError("options.metadataOnly, when defined, must be a boolean.");if(void 0!==e.verifyKeyPackets&&"boolean"!=typeof e.verifyKeyPackets)throw TypeError("options.verifyKeyPackets, when defined, must be a boolean.");if(e.verifyKeyPackets&&e.metadataOnly)throw TypeError("options.verifyKeyPackets and options.metadataOnly cannot be enabled together.")},cf=e=>{if(!sH(e))throw TypeError("timestamp must be a number.")},cp=(e,t,n)=>n.verifyKeyPackets?t.then(async t=>{if(!t||"delta"===t.type)return t;let n=await e.determinePacketType(t);return n&&(t.type=n),t}):t;class cm{constructor(e){if(!(e instanceof cS))throw TypeError("track must be an InputTrack.");this._track=e}getFirstPacket(e={}){if(ch(e),this._track.input._disposed)throw new lZ;return cp(this._track,this._track._backing.getFirstPacket(e),e)}getPacket(e,t={}){if(cf(e),ch(t),this._track.input._disposed)throw new lZ;return cp(this._track,this._track._backing.getPacket(e,t),t)}getNextPacket(e,t={}){if(!(e instanceof l0))throw TypeError("packet must be an EncodedPacket.");if(ch(t),this._track.input._disposed)throw new lZ;return cp(this._track,this._track._backing.getNextPacket(e,t),t)}async getKeyPacket(e,t={}){if(cf(e),ch(t),this._track.input._disposed)throw new lZ;if(!t.verifyKeyPackets)return this._track._backing.getKeyPacket(e,t);let n=await this._track._backing.getKeyPacket(e,t);return n&&(oJ("key"===n.type),"delta"===await this._track.determinePacketType(n))?this.getKeyPacket(n.timestamp-1/this._track.timeResolution,t):n}async getNextKeyPacket(e,t={}){if(!(e instanceof l0))throw TypeError("packet must be an EncodedPacket.");if(ch(t),this._track.input._disposed)throw new lZ;if(!t.verifyKeyPackets)return this._track._backing.getNextKeyPacket(e,t);let n=await this._track._backing.getNextKeyPacket(e,t);return n&&(oJ("key"===n.type),"delta"===await this._track.determinePacketType(n))?this.getNextKeyPacket(n,t):n}packets(e,t,n={}){if(void 0!==e&&!(e instanceof l0))throw TypeError("startPacket must be an EncodedPacket.");if(void 0!==e&&e.isMetadataOnly&&!n?.metadataOnly)throw TypeError("startPacket can only be metadata-only if options.metadataOnly is enabled.");if(void 0!==t&&!(t instanceof l0))throw TypeError("endPacket must be an EncodedPacket.");if(ch(n),this._track.input._disposed)throw new lZ;let r=[],{promise:i,resolve:a}=sh(),{promise:o,resolve:s}=sh(),l=!1,c=!1,u=null,d=[],h=()=>Math.max(2,d.length);(async()=>{let u=e??await this.getFirstPacket(n);for(;u&&!c&&!this._track.input._disposed&&!(t&&u.sequenceNumber>=t?.sequenceNumber);){if(r.length>h()){({promise:o,resolve:s}=sh()),await o;continue}r.push(u),a(),({promise:i,resolve:a}=sh()),u=await this.getNextPacket(u,n)}l=!0,a()})().catch(e=>{u||(u=e,a())});let f=this._track;return{async next(){for(;;)if(f.input._disposed)throw new lZ;else if(c)return{value:void 0,done:!0};else if(u)throw u;else if(r.length>0){let e=r.shift(),t=performance.now();for(d.push(t);d.length>0&&t-d[0]>=1e3;)d.shift();return s(),{value:e,done:!1}}else{if(l)return{value:void 0,done:!0};await i}},return:async()=>(c=!0,s(),a(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}}class cg{constructor(e,t){this.onSample=e,this.onError=t}}class cy{mediaSamplesInRange(e=0,t=1/0){cf(e),cf(t);let n=[],r=!1,i=null,{promise:a,resolve:o}=sh(),{promise:s,resolve:l}=sh(),c=!1,u=!1,d=!1,h=null;(async()=>{let f=await this._createDecoder(s=>{(l(),s.timestamp>=t&&(u=!0),u)?s.close():(i&&(s.timestamp>e?(n.push(i),r=!0):i.close()),s.timestamp>=e&&(n.push(s),r=!0),i=r?null:s,n.length>0&&(o(),{promise:a,resolve:o}=sh()))},e=>{h||(h=e,o())}),p=this._createPacketSink(),m=await p.getKeyPacket(e,{verifyKeyPackets:!0})??await p.getFirstPacket(),g=m,y=p.packets(m??void 0,void 0);for(await y.next();g&&!u&&!this._track.input._disposed;){let e=cv(n.length);if(n.length+f.getDecodeQueueSize()>e){({promise:s,resolve:l}=sh()),await s;continue}f.decode(g);let t=await y.next();if(t.done)break;g=t.value}await y.return(),d||this._track.input._disposed||await f.flush(),f.close(),!r&&i&&n.push(i),c=!0,o()})().catch(e=>{h||(h=e,o())});let f=this._track,p=()=>{for(let e of(i?.close(),n))e.close()};return{async next(){for(;;)if(f.input._disposed)throw p(),new lZ;else if(d)return{value:void 0,done:!0};else if(h)throw p(),h;else if(n.length>0){let e=n.shift();return l(),{value:e,done:!1}}else{if(c)return{value:void 0,done:!0};await a}},return:async()=>(d=!0,u=!0,l(),o(),p(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}mediaSamplesAtTimestamps(e){if(!(Symbol.iterator in e)&&!(Symbol.asyncIterator in e))throw TypeError("Argument must be an iterable or async iterable.");let t=sm(e),n=[],r=[],{promise:i,resolve:a}=sh(),{promise:o,resolve:s}=sh(),l=!1,c=!1,u=null,d=e=>{r.push(e),a(),{promise:i,resolve:a}=sh()};(async()=>{let e=await this._createDecoder(e=>{if(s(),c)return void e.close();let t=0;for(;n.length>0&&e.timestamp-n[0]>-1e-10;)t++,n.shift();if(t>0)for(let n=0;n<t;n++)d(n<t-1?e.clone():e);else e.close()},e=>{u||(u=e,a())}),i=this._createPacketSink(),h=null,f=null,p=-1,m=async()=>{oJ(f);let t=f;for(e.decode(t);t.sequenceNumber<p;){let n=cv(r.length);for(;r.length+e.getDecodeQueueSize()>n&&!c;)({promise:o,resolve:s}=sh()),await o;if(c)break;let a=await i.getNextPacket(t);oJ(a),e.decode(a),t=a}p=-1},g=async()=>{await e.flush();for(let e=0;e<n.length;e++)d(null);n.length=0};for await(let e of t){if(cf(e),c||this._track.input._disposed)break;let t=await i.getPacket(e),r=t&&await i.getKeyPacket(e,{verifyKeyPackets:!0});if(!r){-1!==p&&(await m(),await g()),d(null),h=null;continue}h&&(r.sequenceNumber!==f.sequenceNumber||t.timestamp<h.timestamp)&&(await m(),await g()),n.push(t.timestamp),p=Math.max(t.sequenceNumber,p),h=t,f=r}c||this._track.input._disposed||(-1!==p&&await m(),await g()),e.close(),l=!0,a()})().catch(e=>{u||(u=e,a())});let h=this._track,f=()=>{for(let e of r)e?.close()};return{async next(){for(;;)if(h.input._disposed)throw f(),new lZ;else if(c)return{value:void 0,done:!0};else if(u)throw f(),u;else if(r.length>0){let e=r.shift();return oJ(void 0!==e),s(),{value:e,done:!1}}else{if(l)return{value:void 0,done:!0};await i}},return:async()=>(c=!0,s(),a(),f(),{value:void 0,done:!0}),async throw(e){throw e},[Symbol.asyncIterator](){return this}}}}let cv=e=>0===e?40:8;class cb extends cg{constructor(e,t,n,r,i,a){super(e,t),this.codec=n,this.decoderConfig=r,this.rotation=i,this.timeResolution=a,this.decoder=null,this.customDecoder=null,this.customDecoderCallSerializer=new sP,this.customDecoderQueueSize=0,this.inputTimestamps=[],this.sampleQueue=[],this.currentPacketIndex=0,this.raslSkipped=!1,this.alphaDecoder=null,this.alphaHadKeyframe=!1,this.colorQueue=[],this.alphaQueue=[],this.merger=null,this.mergerCreationFailed=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue=[],this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1;let o=l_.find(e=>e.supports(n,r));if(o)this.customDecoder=new o,this.customDecoder.codec=n,this.customDecoder.config=r,this.customDecoder.onSample=e=>{if(!(e instanceof l6))throw TypeError("The argument passed to onSample must be a VideoSample.");this.finalizeAndEmitSample(e)},this.customDecoderCallSerializer.call(()=>this.customDecoder.init());else{let e=e=>{if(this.alphaQueue.length>0){let t=this.alphaQueue.shift();oJ(void 0!==t),this.mergeAlpha(e,t)}else this.colorQueue.push(e)};if("avc"===n&&this.decoderConfig.description&&sM()){let e=(e=>{try{let t=o6(e),n=0,r=t.getUint8(n++),i=t.getUint8(n++),a=t.getUint8(n++),o=t.getUint8(n++),s=3&t.getUint8(n++),l=31&t.getUint8(n++),c=[];for(let r=0;r<l;r++){let r=t.getUint16(n,!1);n+=2,c.push(e.subarray(n,n+r)),n+=r}let u=t.getUint8(n++),d=[];for(let r=0;r<u;r++){let r=t.getUint16(n,!1);n+=2,d.push(e.subarray(n,n+r)),n+=r}let h={configurationVersion:r,avcProfileIndication:i,profileCompatibility:a,avcLevelIndication:o,lengthSizeMinusOne:s,sequenceParameterSets:c,pictureParameterSets:d,chromaFormat:null,bitDepthLumaMinus8:null,bitDepthChromaMinus8:null,sequenceParameterSetExt:null};if((100===i||110===i||122===i||144===i)&&n+4<=e.length){let r=3&t.getUint8(n++),i=7&t.getUint8(n++),a=7&t.getUint8(n++),o=t.getUint8(n++);h.chromaFormat=r,h.bitDepthLumaMinus8=i,h.bitDepthChromaMinus8=a;let s=[];for(let r=0;r<o;r++){let r=t.getUint16(n,!1);n+=2,s.push(e.subarray(n,n+r)),n+=r}h.sequenceParameterSetExt=s}return h}catch(e){return console.error("Error deserializing AVC Decoder Configuration Record:",e),null}})(o8(this.decoderConfig.description));if(e&&e.sequenceParameterSets.length>0){let t=s9(e.sequenceParameterSets[0]);t&&0===t.frameMbsOnlyFlag&&(this.decoderConfig={...this.decoderConfig,hardwareAcceleration:"prefer-software"})}}let t=Error("Decoding error").stack;this.decoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.decoder.configure(this.decoderConfig)}}getDecodeQueueSize(){return this.customDecoder?this.customDecoderQueueSize:(oJ(this.decoder),Math.max(this.decoder.decodeQueueSize,this.alphaDecoder?.decodeQueueSize??0))}decode(e){if("hevc"===this.codec&&this.currentPacketIndex>0&&!this.raslSkipped){if(this.hasHevcRaslPicture(e.data))return;this.raslSkipped=!0}if(this.customDecoder)this.customDecoderQueueSize++,this.customDecoderCallSerializer.call(()=>this.customDecoder.decode(e)).then(()=>this.customDecoderQueueSize--);else{if(oJ(this.decoder),sA()||sd(this.inputTimestamps,e.timestamp,e=>e),sM()&&0===this.currentPacketIndex&&"avc"===this.codec){let t=[];for(let n of s4(e.data,this.decoderConfig)){let r=s3(e.data[n.offset]);r>=20&&r<=31||t.push(e.data.subarray(n.offset,n.offset+n.length))}e=new l0(((e,t)=>{if(t.description)return((e,t)=>{let n=new Uint8Array(e.reduce((e,n)=>e+t+n.byteLength,0)),r=0;for(let i of e){let e=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(t){case 1:e.setUint8(r,i.byteLength);break;case 2:e.setUint16(r,i.byteLength,!1);break;case 3:sv(e,r,i.byteLength,!1);break;case 4:e.setUint32(r,i.byteLength,!1)}r+=t,n.set(i,r),r+=i.byteLength}return n})(e,(3&o8(t.description)[4])+1);let n=new Uint8Array(e.reduce((e,t)=>e+s6.byteLength+t.byteLength,0)),r=0;for(let t of e)n.set(s6,r),r+=s6.byteLength,n.set(t,r),r+=t.byteLength;return n})(t,this.decoderConfig),e.type,e.timestamp,e.duration)}this.decoder.decode(e.toEncodedVideoChunk()),this.decodeAlphaData(e)}this.currentPacketIndex++}decodeAlphaData(e){if(!e.sideData.alpha||this.mergerCreationFailed)return void this.pushNullAlphaFrame();if(!this.merger)try{this.merger=new cx}catch(t){console.error("Due to an error, only color data will be decoded.",t),this.mergerCreationFailed=!0,this.decodeAlphaData(e);return}if(!this.alphaDecoder){let e=e=>{if(this.alphaDecoderQueueSize--,this.colorQueue.length>0){let t=this.colorQueue.shift();oJ(void 0!==t),this.mergeAlpha(t,e)}else this.alphaQueue.push(e);for(this.decodedAlphaChunkCount++;this.nullAlphaFrameQueue.length>0&&this.nullAlphaFrameQueue[0]===this.decodedAlphaChunkCount;)if(this.nullAlphaFrameQueue.shift(),this.colorQueue.length>0){let e=this.colorQueue.shift();oJ(void 0!==e),this.mergeAlpha(e,null)}else this.alphaQueue.push(null)},t=Error("Decoding error").stack;this.alphaDecoder=new VideoDecoder({output:t=>{try{e(t)}catch(e){this.onError(e)}},error:e=>{e.stack=t,this.onError(e)}}),this.alphaDecoder.configure(this.decoderConfig)}let t=lm(this.codec,this.decoderConfig,e.sideData.alpha);if(this.alphaHadKeyframe||(this.alphaHadKeyframe="key"===t),this.alphaHadKeyframe){if("hevc"===this.codec&&this.currentAlphaPacketIndex>0&&!this.alphaRaslSkipped){if(this.hasHevcRaslPicture(e.sideData.alpha))return void this.pushNullAlphaFrame();this.alphaRaslSkipped=!0}this.currentAlphaPacketIndex++,this.alphaDecoder.decode(e.alphaToEncodedVideoChunk(t??e.type)),this.alphaDecoderQueueSize++}else this.pushNullAlphaFrame()}pushNullAlphaFrame(){0===this.alphaDecoderQueueSize?this.alphaQueue.push(null):this.nullAlphaFrameQueue.push(this.decodedAlphaChunkCount+this.alphaDecoderQueueSize)}hasHevcRaslPicture(e){for(let t of le(e,this.decoderConfig)){let n=lt(e[t.offset]);if(n===jP.RASL_N||n===jP.RASL_R)return!0}return!1}sampleHandler(e){if(sA()){if(this.sampleQueue.length>0&&e.timestamp>=o1(this.sampleQueue).timestamp){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}sd(this.sampleQueue,e,e=>e.timestamp)}else{let t=this.inputTimestamps.shift();oJ(void 0!==t),e.setTimestamp(t),this.finalizeAndEmitSample(e)}}finalizeAndEmitSample(e){e.setTimestamp(Math.round(e.timestamp*this.timeResolution)/this.timeResolution),e.setDuration(Math.round(e.duration*this.timeResolution)/this.timeResolution),e.setRotation(this.rotation),this.onSample(e)}mergeAlpha(e,t){if(!t){let t=new l6(e);this.sampleHandler(t);return}oJ(this.merger),this.merger.update(e,t),e.close(),t.close();let n=new l6(new VideoFrame(this.merger.canvas,{timestamp:e.timestamp,duration:e.duration??void 0}));this.sampleHandler(n)}async flush(){if(this.customDecoder?await this.customDecoderCallSerializer.call(()=>this.customDecoder.flush()):(oJ(this.decoder),await Promise.all([this.decoder.flush(),this.alphaDecoder?.flush()]),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.alphaHadKeyframe=!1,this.decodedAlphaChunkCount=0,this.alphaDecoderQueueSize=0,this.nullAlphaFrameQueue.length=0,this.currentAlphaPacketIndex=0,this.alphaRaslSkipped=!1),sA()){for(let e of this.sampleQueue)this.finalizeAndEmitSample(e);this.sampleQueue.length=0}this.currentPacketIndex=0,this.raslSkipped=!1}close(){for(let e of(this.customDecoder?this.customDecoderCallSerializer.call(()=>this.customDecoder.close()):(oJ(this.decoder),this.decoder.close(),this.alphaDecoder?.close(),this.colorQueue.forEach(e=>e.close()),this.colorQueue.length=0,this.alphaQueue.forEach(e=>e?.close()),this.alphaQueue.length=0,this.merger?.close()),this.sampleQueue))e.close();this.sampleQueue.length=0}}class cx{constructor(){"u">typeof OffscreenCanvas?this.canvas=new OffscreenCanvas(300,150):this.canvas=document.createElement("canvas");let e=this.canvas.getContext("webgl2",{premultipliedAlpha:!1});if(!e)throw Error("Couldn't acquire WebGL 2 context.");this.gl=e,this.program=this.createProgram(),this.vao=this.createVAO(),this.colorTexture=this.createTexture(),this.alphaTexture=this.createTexture(),this.gl.useProgram(this.program),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_colorTexture"),0),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"u_alphaTexture"),1)}createProgram(){let e=this.createShader(this.gl.VERTEX_SHADER,`#version 300 es
|
|
184
184
|
in vec2 a_position;
|
|
185
185
|
in vec2 a_texCoord;
|
|
186
186
|
out vec2 v_texCoord;
|
|
@@ -228,7 +228,7 @@ For more info see: https://github.com/konvajs/react-konva/issues/194
|
|
|
228
228
|
<!-- Path for the stroke, clipped by the star path -->
|
|
229
229
|
<path d="${c}" fill="none" stroke="${a}" stroke-width="${2*o}" clip-path="url(#${h})" transform="scale(${u}, ${d})" stroke-dasharray="${l.join(" ")}"/>
|
|
230
230
|
</svg>
|
|
231
|
-
`}(e,n):(console.error(`Polotno error: Can not convert ${e.subType} figure to svg.`),de(e))}let di={},da=j(({element:e,store:t})=>{var n;let r,i=m(S).useRef(null),a=e.selectable||"admin"===t.role,o=iK(),s=t.selectedShapes.indexOf(e)>=0&&e.selectable,l=Math.min(e.strokeWidth,e.width/2,e.height/2),c=Math.max(0,Math.min(e.width/2,e.height/2,e.cornerRadius)),u=rQ(e,e.a.fill,"fill"),d={width:e.a.width,height:e.a.height,...u,cornerRadius:c,opacity:e.animated("opacity"),shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,preventDefault:!o||s,hideInExport:!e.showInExport},h=rQ(e,e.stroke,"stroke"),f={visible:l>0,x:l/2,y:l/2,width:e.a.width-l,height:e.a.height-l,...h,strokeWidth:l,cornerRadius:Math.max(0,c-l),dash:e.dash.map(e=>e*l),opacity:e.animated("opacity"),hideInExport:!e.showInExport,listening:!1},p=(di[n=e.subType]||(di[n]=(r=dn[n]||de,j(({element:e,fillProps:t,strokeProps:n})=>{let i=r({width:e.a.width,height:e.a.height,cornerRadius:e.cornerRadius}),a=1,o=1;"string"!=typeof i&&(a=i.scaleX,o=i.scaleY,i=i.path);let s=m(S).useRef(null);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rP,{width:e.width,height:e.height,fill:"transparent"}),(0,C.jsx)(rR,{...t,ref:s,data:i,scaleX:a,scaleY:o}),(0,C.jsx)(rE,{clipFunc:e=>{let t=s.current;if(t){var n=t.dataArray;e.beginPath();for(var r=0;r<n.length;r++){var i=n[r].command,a=n[r].points;switch(i){case"L":e.lineTo(a[0],a[1]);break;case"M":e.moveTo(a[0],a[1]);break;case"C":e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":e.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":var o=a[0],l=a[1],c=a[2],u=a[3],d=a[4],h=a[5],f=a[6],p=a[7],m=c>u?c:u,g=c>u?1:c/u,y=c>u?u/c:1;e.translate(o,l),e.rotate(f),e.scale(g,y),e.arc(0,0,m,d,d+h,!p),e.scale(1/g,1/y),e.rotate(-f),e.translate(-o,-l);break;case"z":e.closePath()}}}},scaleX:a,scaleY:o,children:(0,C.jsx)(rR,{...n,x:0,y:0,data:i,strokeWidth:2*n.strokeWidth,dash:n.dash.map(e=>e)})})]})}))),di[n]||rE);return(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(rE,{ref:i,id:e.id,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e.a.opacity,listening:a,draggable:o?e.draggable&&s:e.draggable,name:"element",onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onTransform:t=>{let n=t.target.scale();t.target.scaleX(1),t.target.scaleY(1),e.set({width:e.width*n.x,height:e.height*n.y,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})},children:(0,C.jsx)(p,{element:e,fillProps:d,strokeProps:f})})})});var S=x("8NFma"),E=x("2SBKn"),ds={};Object.defineProperty(ds,"__esModule",{value:!0}),ds.decompressFrames=ds.decompressFrame=ds.parseGIF=void 0;var dl=(NB=x("e0MPM"))&&NB.__esModule?NB:{default:NB},dc=x("lc6Vt"),du=x("kPDMU"),dd={};Object.defineProperty(dd,"__esModule",{value:!0}),dd.deinterlace=void 0,dd.deinterlace=function(e,t){for(var n=Array(e.length),r=e.length/t,i=[0,4,2,1],a=[8,8,4,2],o=0,s=0;s<4;s++)for(var l=i[s];l<r;l+=a[s])!function(r,i){var a=e.slice(i*t,(i+1)*t);n.splice.apply(n,[r*t,t].concat(a))}(l,o),o++;return n};var dh={};Object.defineProperty(dh,"__esModule",{value:!0}),dh.lzw=void 0,dh.lzw=function(e,t,n){var r,i,a,o,s,l,c,u,d,h,f,p,m,g,y,v=Array(n),b=Array(4096),x=Array(4096),w=Array(4097);for(u=0,s=(i=1<<e)+1,r=i+2,c=-1,a=(1<<(o=e+1))-1;u<i;u++)b[u]=0,x[u]=u;for(d=0,h=f=p=m=g=y=0;d<n;){if(0===m){if(f<o){h+=t[y]<<f,f+=8,y++;continue}if(u=h&a,h>>=o,f-=o,u>r||u==s)break;if(u==i){a=(1<<(o=e+1))-1,r=i+2,c=-1;continue}if(-1==c){w[m++]=x[u],c=u,p=u;continue}for(l=u,u==r&&(w[m++]=p,u=c);u>i;)w[m++]=x[u],u=b[u];p=255&x[u],w[m++]=p,r<4096&&(b[r]=c,x[r]=p,(++r&a)==0&&r<4096&&(o++,a+=r)),c=l}m--,v[g++]=w[m],d++}for(d=g;d<n;d++)v[d]=0;return v},ds.parseGIF=function(e){var t=new Uint8Array(e);return(0,dc.parse)((0,du.buildStream)(t),dl.default)};var df=function(e){for(var t=e.pixels.length,n=new Uint8ClampedArray(4*t),r=0;r<t;r++){var i=4*r,a=e.pixels[r],o=e.colorTable[a]||[0,0,0];n[i]=o[0],n[i+1]=o[1],n[i+2]=o[2],n[i+3]=255*(a!==e.transparentIndex)}return n},dp=function(e,t,n){if(!e.image)return void console.warn("gif frame does not have associated image.");var r=e.image,i=r.descriptor.width*r.descriptor.height,a=(0,dh.lzw)(r.data.minCodeSize,r.data.blocks,i);r.descriptor.lct.interlaced&&(a=(0,dd.deinterlace)(a,r.descriptor.width));var o={pixels:a,dims:{top:e.image.descriptor.top,left:e.image.descriptor.left,width:e.image.descriptor.width,height:e.image.descriptor.height}};return r.descriptor.lct&&r.descriptor.lct.exists?o.colorTable=r.lct:o.colorTable=t,e.gce&&(o.delay=10*(e.gce.delay||10),o.disposalType=e.gce.extras.disposal,e.gce.extras.transparentColorGiven&&(o.transparentIndex=e.gce.transparentColorIndex)),n&&(o.patch=df(o)),o};function dm(e,t,n){let r=t.getContext("2d"),i=n.getContext("2d");if(!r||!i)return;2===e.disposalType&&r.clearRect(0,0,t.width,t.height),n.width=e.width,n.height=e.height;let a=i.createImageData(e.width,e.height);a.data.set(e.patch),i.putImageData(a,0,0),r.drawImage(n,e.left,e.top)}ds.decompressFrame=dp,ds.decompressFrames=function(e,t){return e.frames.filter(function(e){return e.image}).map(function(n){return dp(n,e.gct,t)})};let dg=j(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=m(S).useRef(null);return m(S).useEffect(()=>{let e=n.current;if(!e)return;let t=new n_.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}},[]),(0,C.jsxs)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.width,height:e.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,C.jsx)("Arc",{ref:n,x:e.width/2,y:e.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),dy=j(({element:e})=>{let t="Cannot load the GIF...",n=Math.max(10,Math.min(30,e.width/t.length));return(0,C.jsxs)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.width,height:e.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,C.jsx)(rI,{text:t,fontSize:n,width:e.width,height:e.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}),dv=j(({element:e,store:t})=>{let[n,r]=m(S).useState(!1),i=t.selectedShapes.indexOf(e)>=0&&e.selectable,a=m(S).useRef(null),o=m(S).useRef(),[s,l,c,u]=function(e){let[t,n]=m(S).useState([]),[r,i]=m(S).useState(0),[a,o]=m(S).useState("loading"),[s,l]=m(S).useState({width:0,height:0});return m(S).useEffect(()=>{(async()=>{try{let t=await fetch(e),r=await t.arrayBuffer(),a=(0,ds.parseGIF)(r),s=(0,ds.decompressFrames)(a,!0),c=a.lsd.width,u=a.lsd.height;l({width:c,height:u});let d=s.map(e=>({patch:new Uint8ClampedArray(e.patch),delay:e.delay,width:e.dims.width,height:e.dims.height,left:e.dims.left,top:e.dims.top,disposalType:e.disposalType})),h=d.reduce((e,t)=>e+t.delay,0);n(d),i(h),o("loaded")}catch(e){console.error("Failed to load GIF:",e),o("failed")}})()},[e]),[t,r,s,a]}(e.src);aE(u,e.src,e.id),m(S).useEffect(()=>(o.current=document.createElement("canvas"),()=>{o.current&&n_.Util.releaseCanvas(o.current)}),[]),m(S).useEffect(()=>{if("loaded"===u&&o.current&&(o.current.width=c.width,o.current.height=c.height,s.length>0)){let e=o.current.getContext("2d");if(e){e.clearRect(0,0,c.width,c.height);let t=document.createElement("canvas");dm(s[0],o.current,t)}}},[c,u,s]),m(S).useEffect(()=>{if(!s.length||!o.current)return;let n=o.current;n.width=c.width,n.height=c.height;let r=document.createElement("canvas"),i=n.getContext("2d");i&&i.clearRect(0,0,n.width,n.height);let u=-1;dm(s[0],n,r),b(),u=0;let d=e=>{let t=(e=>{let t=e%l,n=0;for(let e=0;e<s.length;e++)if((n+=s[e].delay)>t)return e;return 0})(e);t!==u&&(dm(s[t],n,r),b(),a.current.getLayer().draw(),u=t)};if(t.isPlaying||e.page._exportingOrRendering)return(0,E.autorun)(()=>{d(t.currentTime-e.page.startTime)});{let e=window.setInterval(()=>{d(t.currentTime||performance.now())},16);return()=>{clearInterval(e)}}},[t.isPlaying,s,l,e.page._exportingOrRendering]),m(S).useEffect(()=>{l&&t.history.ignore(()=>{e.set({duration:l})})},[l]);let{cropX:d,cropY:h,cropWidth:f,cropHeight:p}=e;"loaded"!==u&&(d=h=0,f=p=1);let g={x:c.width*d,y:c.height*h,width:c.width*f,height:c.height*p},y=e.cornerRadius??0,[v,b]=u2(e,o.current,g,t._elementsPixelRatio,y,n||e._cropModeEnabled);m(S).useLayoutEffect(()=>{if(!n&&!e._cropModeEnabled&&a.current)return iW(a.current,e),(0,E.autorun)(()=>{iW(a.current,e)},{delay:100})},[o.current,n,f,p,e._cropModeEnabled,c.width,c.height]);let x="loading"===u,w="failed"===u,k=x||w?0:e.a.opacity;r0(a,k);let _=e.selectable||"admin"===t.role,T=iK();return(0,C.jsxs)(C.Fragment,{children:[x&&(0,C.jsx)(dg,{element:e}),w&&(0,C.jsx)(dy,{element:e}),(0,C.jsx)(rA,{ref:a,name:"element",id:e.id,image:v,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:k,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:g,listening:_,draggable:T?e.draggable&&i:e.draggable,preventDefault:!T||i,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onTransformStart:()=>r(!0),onTransform:t=>{let n=t.currentTarget,r=1e-7>Math.abs(n.scaleX()-1)?1:n.scaleX(),i=1e-7>Math.abs(n.scaleY()-1)?1:n.scaleY();n.scaleX(1),n.scaleY(1),e.set({x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:n.rotation()})},onTransformEnd:()=>r(!1)}),(0,C.jsx)(rP,{x:e.a.x,y:e.a.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:k,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,y-e.borderSize),hideInExport:!e.showInExport})]})});x("8NFma");let db={stroke:"rgb(0, 161, 255)",strokeWidth:2},dx=e=>{Object.assign(db,e)},dw=j(({element:e})=>(0,C.jsx)(rP,{name:"highlighter",x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,listening:!1,strokeScaleEnabled:!1,...db}));var iY=x("58B0H");let dC=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>((t&=63)<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var iY=(x("58B0H"),x("58B0H"),x("58B0H"));let dS=function(e,t){if(e===t)return!0;if("object"!=typeof e||null==e||"object"!=typeof t||null==t||Object.keys(e).length!=Object.keys(t).length)return!1;for(var n in e)if(!t.hasOwnProperty(n))return!1;else if(!dS(e[n],t[n]))return!1;return!0};Object.assign(iY.types);let dk=iY.types.model("UndoManager",{history:iY.types.array(iY.types.frozen()),undoIdx:-1,targetPath:""}).views(e=>({get canUndo(){return e.undoIdx>0},get canRedo(){return e.undoIdx<e.history.length-1}})).actions(e=>{let t,n,r=!1,i=null,a=0,o=0;function s(){let e=(0,iY.getSnapshot)(t);return{pages:e.pages,width:e.width,height:e.height,custom:e.custom,audios:e.audios}}function l(e){let n=!dS(t.pages.map(e=>e.id),e.pages.map(e=>e.id)),r=!dS(t.custom,e.custom);n?(0,iY.applySnapshot)(t.pages,e.pages):t.pages.forEach((t,n)=>{(0,iY.applySnapshot)(t,e.pages[n])}),r&&t.set({custom:e.custom}),t.setSize(e.width,e.height)}let c={startTransaction(){o++},endTransaction(e){o--,e||c.requestAddState(s())},async ignore(e,t=!1,n=!1){n&&await new Promise(e=>setTimeout(e,10)),a&&c.addUndoState();let r=o>0;c.startTransaction();let i=o;try{await e()}catch(e){setTimeout(()=>{throw e})}let s=i!==o;c.endTransaction(!s),t||r||c.replaceState(),s||(clearTimeout(a),a=0)},async transaction(e){await c.ignore(e,!0),c.addUndoState()},requestAddState(e){if((i=e,!a)&&!(o>0)){if(r){r=!1;return}a=setTimeout(()=>{clearTimeout(a=0),o>0||c.addUndoState()},100)}},addUndoState(){if(r){r=!1;return}let t=e.history[e.undoIdx];dS(i,t)||(clearTimeout(a),a=0,e.history.splice(e.undoIdx+1),e.history.push(i),e.undoIdx=e.history.length-1)},afterCreate(){if(!(t=(0,iY.resolvePath)(e,"..")))throw Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=(0,iY.onSnapshot)(t,()=>{c.requestAddState(s())}),0===e.history.length&&c.requestAddState(s())},clear(){clearTimeout(a),a=0,e.history.splice(0,e.history.length),e.undoIdx=-1,c.addUndoState()},beforeDestroy(){n()},undo(){(a&&c.addUndoState(),o>0)?l(e.history[e.undoIdx]):e.canUndo?(e.undoIdx--,r=!0,l(e.history[e.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){(a&&c.addUndoState(),e.canRedo)?(e.undoIdx++,r=!0,l(e.history[e.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){e.history[e.undoIdx]=s()}};return c});var E=x("2SBKn");async function d_(e,t){let n=await (await fetch(e)).blob(),r=document.createElement("a"),i=URL.createObjectURL(n);r.href=i,r.download=t,document.body.appendChild(r),r.click(),setTimeout(function(){document.body.removeChild(r),window.URL.revokeObjectURL(i)},0)}let dE=null;async function dT({width:e,height:t}){return new(await (window.GIF?Promise.resolve(window.GIF):new Promise(e=>{var t=document.createElement("script");t.onload=function(){e(window.GIF)},t.src="https://cdnjs.cloudflare.com/ajax/libs/gif.js/0.2.0/gif.js",document.head.appendChild(t)})))({workers:4,width:e,height:t,workerScript:URL.createObjectURL(new Blob([`// gif.worker.js 0.2.0 - https://github.com/jnordberg/gif.js
|
|
231
|
+
`}(e,n):(console.error(`Polotno error: Can not convert ${e.subType} figure to svg.`),de(e))}let di={},da=j(({element:e,store:t})=>{var n;let r,i=m(S).useRef(null),a=e.selectable||"admin"===t.role,o=iK(),s=t.selectedShapes.indexOf(e)>=0&&e.selectable,l=Math.min(e.strokeWidth,e.width/2,e.height/2),c=Math.max(0,Math.min(e.width/2,e.height/2,e.cornerRadius)),u=rQ(e,e.a.fill,"fill"),d={width:e.a.width,height:e.a.height,...u,cornerRadius:c,opacity:e.animated("opacity"),shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,preventDefault:!o||s,hideInExport:!e.showInExport},h=rQ(e,e.stroke,"stroke"),f={visible:l>0,x:l/2,y:l/2,width:e.a.width-l,height:e.a.height-l,...h,strokeWidth:l,cornerRadius:Math.max(0,c-l),dash:e.dash.map(e=>e*l),opacity:e.animated("opacity"),hideInExport:!e.showInExport,listening:!1},p=(di[n=e.subType]||(di[n]=(r=dn[n]||de,j(({element:e,fillProps:t,strokeProps:n})=>{let i=r({width:e.a.width,height:e.a.height,cornerRadius:e.cornerRadius}),a=1,o=1;"string"!=typeof i&&(a=i.scaleX,o=i.scaleY,i=i.path);let s=m(S).useRef(null);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(rP,{width:e.width,height:e.height,fill:"transparent"}),(0,C.jsx)(rR,{...t,ref:s,data:i,scaleX:a,scaleY:o}),(0,C.jsx)(rE,{clipFunc:e=>{let t=s.current;if(t){var n=t.dataArray;e.beginPath();for(var r=0;r<n.length;r++){var i=n[r].command,a=n[r].points;switch(i){case"L":e.lineTo(a[0],a[1]);break;case"M":e.moveTo(a[0],a[1]);break;case"C":e.bezierCurveTo(a[0],a[1],a[2],a[3],a[4],a[5]);break;case"Q":e.quadraticCurveTo(a[0],a[1],a[2],a[3]);break;case"A":var o=a[0],l=a[1],c=a[2],u=a[3],d=a[4],h=a[5],f=a[6],p=a[7],m=c>u?c:u,g=c>u?1:c/u,y=c>u?u/c:1;e.translate(o,l),e.rotate(f),e.scale(g,y),e.arc(0,0,m,d,d+h,!p),e.scale(1/g,1/y),e.rotate(-f),e.translate(-o,-l);break;case"z":e.closePath()}}}},scaleX:a,scaleY:o,children:(0,C.jsx)(rR,{...n,x:0,y:0,data:i,strokeWidth:2*n.strokeWidth,dash:n.dash.map(e=>e)})})]})}))),di[n]||rE);return(0,C.jsx)(C.Fragment,{children:(0,C.jsx)(rE,{ref:i,id:e.id,x:e.a.x,y:e.a.y,rotation:e.a.rotation,opacity:e.a.opacity,listening:a,draggable:o?e.draggable&&s:e.draggable,name:"element",onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onTransform:t=>{let n=t.target.scale();t.target.scaleX(1),t.target.scaleY(1),e.set({width:e.width*n.x,height:e.height*n.y,x:t.target.x(),y:t.target.y(),rotation:t.target.rotation()})},children:(0,C.jsx)(p,{element:e,fillProps:d,strokeProps:f})})})});var S=x("8NFma"),E=x("2SBKn"),ds={};Object.defineProperty(ds,"__esModule",{value:!0}),ds.decompressFrames=ds.decompressFrame=ds.parseGIF=void 0;var dl=(NB=x("e0MPM"))&&NB.__esModule?NB:{default:NB},dc=x("lc6Vt"),du=x("kPDMU"),dd={};Object.defineProperty(dd,"__esModule",{value:!0}),dd.deinterlace=void 0,dd.deinterlace=function(e,t){for(var n=Array(e.length),r=e.length/t,i=[0,4,2,1],a=[8,8,4,2],o=0,s=0;s<4;s++)for(var l=i[s];l<r;l+=a[s])!function(r,i){var a=e.slice(i*t,(i+1)*t);n.splice.apply(n,[r*t,t].concat(a))}(l,o),o++;return n};var dh={};Object.defineProperty(dh,"__esModule",{value:!0}),dh.lzw=void 0,dh.lzw=function(e,t,n){var r,i,a,o,s,l,c,u,d,h,f,p,m,g,y,v=Array(n),b=Array(4096),x=Array(4096),w=Array(4097);for(u=0,s=(i=1<<e)+1,r=i+2,c=-1,a=(1<<(o=e+1))-1;u<i;u++)b[u]=0,x[u]=u;for(d=0,h=f=p=m=g=y=0;d<n;){if(0===m){if(f<o){h+=t[y]<<f,f+=8,y++;continue}if(u=h&a,h>>=o,f-=o,u>r||u==s)break;if(u==i){a=(1<<(o=e+1))-1,r=i+2,c=-1;continue}if(-1==c){w[m++]=x[u],c=u,p=u;continue}for(l=u,u==r&&(w[m++]=p,u=c);u>i;)w[m++]=x[u],u=b[u];p=255&x[u],w[m++]=p,r<4096&&(b[r]=c,x[r]=p,(++r&a)==0&&r<4096&&(o++,a+=r)),c=l}m--,v[g++]=w[m],d++}for(d=g;d<n;d++)v[d]=0;return v},ds.parseGIF=function(e){var t=new Uint8Array(e);return(0,dc.parse)((0,du.buildStream)(t),dl.default)};var df=function(e){for(var t=e.pixels.length,n=new Uint8ClampedArray(4*t),r=0;r<t;r++){var i=4*r,a=e.pixels[r],o=e.colorTable[a]||[0,0,0];n[i]=o[0],n[i+1]=o[1],n[i+2]=o[2],n[i+3]=255*(a!==e.transparentIndex)}return n},dp=function(e,t,n){if(!e.image)return void console.warn("gif frame does not have associated image.");var r=e.image,i=r.descriptor.width*r.descriptor.height,a=(0,dh.lzw)(r.data.minCodeSize,r.data.blocks,i);r.descriptor.lct.interlaced&&(a=(0,dd.deinterlace)(a,r.descriptor.width));var o={pixels:a,dims:{top:e.image.descriptor.top,left:e.image.descriptor.left,width:e.image.descriptor.width,height:e.image.descriptor.height}};return r.descriptor.lct&&r.descriptor.lct.exists?o.colorTable=r.lct:o.colorTable=t,e.gce&&(o.delay=10*(e.gce.delay||10),o.disposalType=e.gce.extras.disposal,e.gce.extras.transparentColorGiven&&(o.transparentIndex=e.gce.transparentColorIndex)),n&&(o.patch=df(o)),o};function dm(e,t,n){let r=t.getContext("2d"),i=n.getContext("2d");if(!r||!i)return;2===e.disposalType&&r.clearRect(0,0,t.width,t.height),n.width=e.width,n.height=e.height;let a=i.createImageData(e.width,e.height);a.data.set(e.patch),i.putImageData(a,0,0),r.drawImage(n,e.left,e.top)}ds.decompressFrame=dp,ds.decompressFrames=function(e,t){return e.frames.filter(function(e){return e.image}).map(function(n){return dp(n,e.gct,t)})};let dg=j(({element:e})=>{let t=Math.min(30,e.width/4,e.height/4),n=m(S).useRef(null);return m(S).useEffect(()=>{let e=n.current;if(!e)return;let t=new n_.Animation(t=>{e.rotate((t?.timeDiff||0)/2)},e.getLayer());return t.start(),()=>{t.stop()}},[]),(0,C.jsxs)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.width,height:e.height,fill:"rgba(124, 173, 212, 0.8)"}),(0,C.jsx)("Arc",{ref:n,x:e.width/2,y:e.height/2,fill:"white",outerRadius:Math.abs(t),innerRadius:Math.max(1,t-5),angle:270})]})}),dy=j(({element:e})=>{let t="Cannot load the GIF...",n=Math.max(10,Math.min(30,e.width/t.length));return(0,C.jsxs)(rE,{x:e.a.x,y:e.a.y,rotation:e.a.rotation,listening:!1,opacity:e.a.opacity,hideInExport:!e.showInExport,children:[(0,C.jsx)(rP,{width:e.width,height:e.height,fill:"rgba(223, 102, 102, 0.8)"}),(0,C.jsx)(rI,{text:t,fontSize:n,width:e.width,height:e.height,align:"center",fill:"white",verticalAlign:"middle",padding:5})]})}),dv=j(({element:e,store:t})=>{let[n,r]=m(S).useState(!1),i=t.selectedShapes.indexOf(e)>=0&&e.selectable,a=m(S).useRef(null),o=m(S).useRef(),[s,l,c,u]=function(e){let[t,n]=m(S).useState([]),[r,i]=m(S).useState(0),[a,o]=m(S).useState("loading"),[s,l]=m(S).useState({width:0,height:0});return m(S).useEffect(()=>{(async()=>{try{let t=await fetch(e),r=await t.arrayBuffer(),a=(0,ds.parseGIF)(r),s=(0,ds.decompressFrames)(a,!0),c=a.lsd.width,u=a.lsd.height;l({width:c,height:u});let d=s.map(e=>({patch:new Uint8ClampedArray(e.patch),delay:e.delay,width:e.dims.width,height:e.dims.height,left:e.dims.left,top:e.dims.top,disposalType:e.disposalType})),h=d.reduce((e,t)=>e+t.delay,0);n(d),i(h),o("loaded")}catch(e){console.error("Failed to load GIF:",e),o("failed")}})()},[e]),[t,r,s,a]}(e.src);aE(u,e.src,e.id),m(S).useEffect(()=>(o.current=document.createElement("canvas"),()=>{o.current&&n_.Util.releaseCanvas(o.current)}),[]),m(S).useEffect(()=>{if("loaded"===u&&o.current&&(o.current.width=c.width,o.current.height=c.height,s.length>0)){let e=o.current.getContext("2d");if(e){e.clearRect(0,0,c.width,c.height);let t=document.createElement("canvas");dm(s[0],o.current,t)}}},[c,u,s]),m(S).useEffect(()=>{if(!s.length||!o.current)return;let n=o.current;n.width=c.width,n.height=c.height;let r=document.createElement("canvas"),i=n.getContext("2d");i&&i.clearRect(0,0,n.width,n.height);let u=-1;dm(s[0],n,r),b(),u=0;let d=e=>{let t=(e=>{let t=e%l,n=0;for(let e=0;e<s.length;e++)if((n+=s[e].delay)>t)return e;return 0})(e);t!==u&&(dm(s[t],n,r),b(),a.current.getLayer().draw(),u=t)};if(t.isPlaying||e.page._exportingOrRendering)return(0,E.autorun)(()=>{d(t.currentTime-e.page.startTime)});{let e=window.setInterval(()=>{d(t.currentTime||performance.now())},16);return()=>{clearInterval(e)}}},[t.isPlaying,s,l,e.page._exportingOrRendering]),m(S).useEffect(()=>{l&&t.history.ignore(()=>{e.set({duration:l})})},[l]);let{cropX:d,cropY:h,cropWidth:f,cropHeight:p}=e;"loaded"!==u&&(d=h=0,f=p=1);let g={x:c.width*d,y:c.height*h,width:c.width*f,height:c.height*p},y=e.cornerRadius??0,[v,b]=u2(e,o.current,g,t._elementsPixelRatio,y,n||e._cropModeEnabled);m(S).useLayoutEffect(()=>{if(!n&&!e._cropModeEnabled&&a.current)return iW(a.current,e),(0,E.autorun)(()=>{iW(a.current,e)},{delay:100})},[o.current,n,f,p,e._cropModeEnabled,c.width,c.height]);let x="loading"===u,w="failed"===u,k=x||w?0:e.a.opacity;r0(a,k);let _=e.selectable||"admin"===t.role,T=iK();return(0,C.jsxs)(C.Fragment,{children:[x&&(0,C.jsx)(dg,{element:e}),w&&(0,C.jsx)(dy,{element:e}),(0,C.jsx)(rA,{ref:a,name:"element",id:e.id,image:v,x:e.a.x,y:e.a.y,width:e.a.width||1,height:e.a.height||1,rotation:e.a.rotation,opacity:k,shadowEnabled:e.shadowEnabled,shadowBlur:e.shadowBlur,shadowOffsetX:e.shadowOffsetX,shadowOffsetY:e.shadowOffsetY,shadowColor:e.shadowColor,shadowOpacity:e.shadowOpacity,customCrop:g,listening:_,draggable:T?e.draggable&&i:e.draggable,preventDefault:!T||i,hideInExport:!e.showInExport,onDragMove:t=>{e.set({x:t.target.x(),y:t.target.y()})},onDragEnd:t=>{e.set({x:t.target.x(),y:t.target.y()})},onTransformStart:()=>r(!0),onTransform:t=>{let n=t.currentTarget,r=1e-7>Math.abs(n.scaleX()-1)?1:n.scaleX(),i=1e-7>Math.abs(n.scaleY()-1)?1:n.scaleY();n.scaleX(1),n.scaleY(1),e.set({x:n.x(),y:n.y(),width:n.width()*r,height:n.height()*i,rotation:n.rotation()})},onTransformEnd:()=>r(!1)}),(0,C.jsx)(rP,{x:e.a.x,y:e.a.y,width:Math.max(e.a.width-e.borderSize,0),height:Math.max(e.a.height-e.borderSize,0),opacity:k,offsetX:-e.borderSize/2,offsetY:-e.borderSize/2,stroke:e.borderColor,strokeWidth:e.borderSize,listening:!1,visible:!!e.borderSize,rotation:e.rotation,cornerRadius:Math.max(0,y-e.borderSize),hideInExport:!e.showInExport})]})});x("8NFma");let db={stroke:"rgb(0, 161, 255)",strokeWidth:2},dx=e=>{Object.assign(db,e)},dw=j(({element:e})=>(0,C.jsx)(rP,{name:"highlighter",x:e.a.x,y:e.a.y,rotation:e.a.rotation,width:e.a.width,height:e.a.height,listening:!1,strokeScaleEnabled:!1,...db}));var iY=x("58B0H");let dC=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>((t&=63)<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+="-":e+="_",e),"");var iY=(x("58B0H"),x("58B0H"),x("58B0H"));let dS=function(e,t){if(e===t)return!0;if("object"!=typeof e||null==e||"object"!=typeof t||null==t||Object.keys(e).length!=Object.keys(t).length)return!1;for(var n in e)if(!t.hasOwnProperty(n))return!1;else if(!dS(e[n],t[n]))return!1;return!0};Object.assign(iY.types);let dk=iY.types.model("UndoManager",{history:iY.types.array(iY.types.frozen()),undoIdx:-1,targetPath:""}).views(e=>({get canUndo(){return e.undoIdx>0},get canRedo(){return e.undoIdx<e.history.length-1}})).actions(e=>{let t,n,r=!1,i=null,a=0,o=0;function s(){let e=(0,iY.getSnapshot)(t);return{pages:e.pages,width:e.width,height:e.height,custom:e.custom,audios:e.audios}}function l(e){let n=!dS(t.pages.map(e=>e.id),e.pages.map(e=>e.id)),r=!dS(t.custom,e.custom);n?(0,iY.applySnapshot)(t.pages,e.pages):t.pages.forEach((t,n)=>{(0,iY.applySnapshot)(t,e.pages[n])}),r&&t.set({custom:e.custom}),t.setSize(e.width,e.height)}let c={startTransaction(){o++},endTransaction(e){o--,e||c.requestAddState(s())},async ignore(e,t=!1,n=!1){n&&await new Promise(e=>setTimeout(e,10));let r=!!a;a&&c.addUndoState();let i=o>0;c.startTransaction();let s=o;try{await e()}catch(e){setTimeout(()=>{throw e})}let l=s!==o;c.endTransaction(!l),t||i&&!r||c.replaceState(),l||(clearTimeout(a),a=0)},async transaction(e){await c.ignore(e,!0),c.addUndoState()},requestAddState(e){if((i=e,!a)&&!(o>0)){if(r){r=!1;return}a=setTimeout(()=>{clearTimeout(a=0),o>0||c.addUndoState()},100)}},addUndoState(){if(r){r=!1;return}let t=e.history[e.undoIdx];dS(i,t)||(clearTimeout(a),a=0,e.history.splice(e.undoIdx+1),e.history.push(i),e.undoIdx=e.history.length-1)},afterCreate(){if(!(t=(0,iY.resolvePath)(e,"..")))throw Error("Failed to find target store for UndoManager. Please provide `targetPath` property, or a `targetStore` in the environment");n=(0,iY.onSnapshot)(t,()=>{c.requestAddState(s())}),0===e.history.length&&c.requestAddState(s())},clear(){clearTimeout(a),a=0,e.history.splice(0,e.history.length),e.undoIdx=-1,c.addUndoState()},beforeDestroy(){n()},undo(){(a&&c.addUndoState(),o>0)?l(e.history[e.undoIdx]):e.canUndo?(e.undoIdx--,r=!0,l(e.history[e.undoIdx])):console.warn("No undo history. Please check `store.history.canUndo` before calling undo action.")},redo(){(a&&c.addUndoState(),e.canRedo)?(e.undoIdx++,r=!0,l(e.history[e.undoIdx])):console.warn("No redo history. Please check `store.history.canRedo` before calling redo action.")},replaceState(){e.history[e.undoIdx]=s()}};return c});var E=x("2SBKn");async function d_(e,t){let n=await (await fetch(e)).blob(),r=document.createElement("a"),i=URL.createObjectURL(n);r.href=i,r.download=t,document.body.appendChild(r),r.click(),setTimeout(function(){document.body.removeChild(r),window.URL.revokeObjectURL(i)},0)}let dE=null;async function dT({width:e,height:t}){return new(await (window.GIF?Promise.resolve(window.GIF):new Promise(e=>{var t=document.createElement("script");t.onload=function(){e(window.GIF)},t.src="https://cdnjs.cloudflare.com/ajax/libs/gif.js/0.2.0/gif.js",document.head.appendChild(t)})))({workers:4,width:e,height:t,workerScript:URL.createObjectURL(new Blob([`// gif.worker.js 0.2.0 - https://github.com/jnordberg/gif.js
|
|
232
232
|
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){var NeuQuant=require("./TypedNeuQuant.js");var LZWEncoder=require("./LZWEncoder.js");function ByteArray(){this.page=-1;this.pages=[];this.newPage()}ByteArray.pageSize=4096;ByteArray.charMap={};for(var i=0;i<256;i++)ByteArray.charMap[i]=String.fromCharCode(i);ByteArray.prototype.newPage=function(){this.pages[++this.page]=new Uint8Array(ByteArray.pageSize);this.cursor=0};ByteArray.prototype.getData=function(){var rv="";for(var p=0;p<this.pages.length;p++){for(var i=0;i<ByteArray.pageSize;i++){rv+=ByteArray.charMap[this.pages[p][i]]}}return rv};ByteArray.prototype.writeByte=function(val){if(this.cursor>=ByteArray.pageSize)this.newPage();this.pages[this.page][this.cursor++]=val};ByteArray.prototype.writeUTFBytes=function(string){for(var l=string.length,i=0;i<l;i++)this.writeByte(string.charCodeAt(i))};ByteArray.prototype.writeBytes=function(array,offset,length){for(var l=length||array.length,i=offset||0;i<l;i++)this.writeByte(array[i])};function GIFEncoder(width,height){this.width=~~width;this.height=~~height;this.transparent=null;this.transIndex=0;this.repeat=-1;this.delay=0;this.image=null;this.pixels=null;this.indexedPixels=null;this.colorDepth=null;this.colorTab=null;this.neuQuant=null;this.usedEntry=new Array;this.palSize=7;this.dispose=-1;this.firstFrame=true;this.sample=10;this.dither=false;this.globalPalette=false;this.out=new ByteArray}GIFEncoder.prototype.setDelay=function(milliseconds){this.delay=Math.round(milliseconds/10)};GIFEncoder.prototype.setFrameRate=function(fps){this.delay=Math.round(100/fps)};GIFEncoder.prototype.setDispose=function(disposalCode){if(disposalCode>=0)this.dispose=disposalCode};GIFEncoder.prototype.setRepeat=function(repeat){this.repeat=repeat};GIFEncoder.prototype.setTransparent=function(color){this.transparent=color};GIFEncoder.prototype.addFrame=function(imageData){this.image=imageData;this.colorTab=this.globalPalette&&this.globalPalette.slice?this.globalPalette:null;this.getImagePixels();this.analyzePixels();if(this.globalPalette===true)this.globalPalette=this.colorTab;if(this.firstFrame){this.writeLSD();this.writePalette();if(this.repeat>=0){this.writeNetscapeExt()}}this.writeGraphicCtrlExt();this.writeImageDesc();if(!this.firstFrame&&!this.globalPalette)this.writePalette();this.writePixels();this.firstFrame=false};GIFEncoder.prototype.finish=function(){this.out.writeByte(59)};GIFEncoder.prototype.setQuality=function(quality){if(quality<1)quality=1;this.sample=quality};GIFEncoder.prototype.setDither=function(dither){if(dither===true)dither="FloydSteinberg";this.dither=dither};GIFEncoder.prototype.setGlobalPalette=function(palette){this.globalPalette=palette};GIFEncoder.prototype.getGlobalPalette=function(){return this.globalPalette&&this.globalPalette.slice&&this.globalPalette.slice(0)||this.globalPalette};GIFEncoder.prototype.writeHeader=function(){this.out.writeUTFBytes("GIF89a")};GIFEncoder.prototype.analyzePixels=function(){if(!this.colorTab){this.neuQuant=new NeuQuant(this.pixels,this.sample);this.neuQuant.buildColormap();this.colorTab=this.neuQuant.getColormap()}if(this.dither){this.ditherPixels(this.dither.replace("-serpentine",""),this.dither.match(/-serpentine/)!==null)}else{this.indexPixels()}this.pixels=null;this.colorDepth=8;this.palSize=7;if(this.transparent!==null){this.transIndex=this.findClosest(this.transparent,true)}};GIFEncoder.prototype.indexPixels=function(imgq){var nPix=this.pixels.length/3;this.indexedPixels=new Uint8Array(nPix);var k=0;for(var j=0;j<nPix;j++){var index=this.findClosestRGB(this.pixels[k++]&255,this.pixels[k++]&255,this.pixels[k++]&255);this.usedEntry[index]=true;this.indexedPixels[j]=index}};GIFEncoder.prototype.ditherPixels=function(kernel,serpentine){var kernels={FalseFloydSteinberg:[[3/8,1,0],[3/8,0,1],[2/8,1,1]],FloydSteinberg:[[7/16,1,0],[3/16,-1,1],[5/16,0,1],[1/16,1,1]],Stucki:[[8/42,1,0],[4/42,2,0],[2/42,-2,1],[4/42,-1,1],[8/42,0,1],[4/42,1,1],[2/42,2,1],[1/42,-2,2],[2/42,-1,2],[4/42,0,2],[2/42,1,2],[1/42,2,2]],Atkinson:[[1/8,1,0],[1/8,2,0],[1/8,-1,1],[1/8,0,1],[1/8,1,1],[1/8,0,2]]};if(!kernel||!kernels[kernel]){throw"Unknown dithering kernel: "+kernel}var ds=kernels[kernel];var index=0,height=this.height,width=this.width,data=this.pixels;var direction=serpentine?-1:1;this.indexedPixels=new Uint8Array(this.pixels.length/3);for(var y=0;y<height;y++){if(serpentine)direction=direction*-1;for(var x=direction==1?0:width-1,xend=direction==1?width:0;x!==xend;x+=direction){index=y*width+x;var idx=index*3;var r1=data[idx];var g1=data[idx+1];var b1=data[idx+2];idx=this.findClosestRGB(r1,g1,b1);this.usedEntry[idx]=true;this.indexedPixels[index]=idx;idx*=3;var r2=this.colorTab[idx];var g2=this.colorTab[idx+1];var b2=this.colorTab[idx+2];var er=r1-r2;var eg=g1-g2;var eb=b1-b2;for(var i=direction==1?0:ds.length-1,end=direction==1?ds.length:0;i!==end;i+=direction){var x1=ds[i][1];var y1=ds[i][2];if(x1+x>=0&&x1+x<width&&y1+y>=0&&y1+y<height){var d=ds[i][0];idx=index+x1+y1*width;idx*=3;data[idx]=Math.max(0,Math.min(255,data[idx]+er*d));data[idx+1]=Math.max(0,Math.min(255,data[idx+1]+eg*d));data[idx+2]=Math.max(0,Math.min(255,data[idx+2]+eb*d))}}}}};GIFEncoder.prototype.findClosest=function(c,used){return this.findClosestRGB((c&16711680)>>16,(c&65280)>>8,c&255,used)};GIFEncoder.prototype.findClosestRGB=function(r,g,b,used){if(this.colorTab===null)return-1;if(this.neuQuant&&!used){return this.neuQuant.lookupRGB(r,g,b)}var c=b|g<<8|r<<16;var minpos=0;var dmin=256*256*256;var len=this.colorTab.length;for(var i=0,index=0;i<len;index++){var dr=r-(this.colorTab[i++]&255);var dg=g-(this.colorTab[i++]&255);var db=b-(this.colorTab[i++]&255);var d=dr*dr+dg*dg+db*db;if((!used||this.usedEntry[index])&&d<dmin){dmin=d;minpos=index}}return minpos};GIFEncoder.prototype.getImagePixels=function(){var w=this.width;var h=this.height;this.pixels=new Uint8Array(w*h*3);var data=this.image;var srcPos=0;var count=0;for(var i=0;i<h;i++){for(var j=0;j<w;j++){this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];this.pixels[count++]=data[srcPos++];srcPos++}}};GIFEncoder.prototype.writeGraphicCtrlExt=function(){this.out.writeByte(33);this.out.writeByte(249);this.out.writeByte(4);var transp,disp;if(this.transparent===null){transp=0;disp=0}else{transp=1;disp=2}if(this.dispose>=0){disp=dispose&7}disp<<=2;this.out.writeByte(0|disp|0|transp);this.writeShort(this.delay);this.out.writeByte(this.transIndex);this.out.writeByte(0)};GIFEncoder.prototype.writeImageDesc=function(){this.out.writeByte(44);this.writeShort(0);this.writeShort(0);this.writeShort(this.width);this.writeShort(this.height);if(this.firstFrame||this.globalPalette){this.out.writeByte(0)}else{this.out.writeByte(128|0|0|0|this.palSize)}};GIFEncoder.prototype.writeLSD=function(){this.writeShort(this.width);this.writeShort(this.height);this.out.writeByte(128|112|0|this.palSize);this.out.writeByte(0);this.out.writeByte(0)};GIFEncoder.prototype.writeNetscapeExt=function(){this.out.writeByte(33);this.out.writeByte(255);this.out.writeByte(11);this.out.writeUTFBytes("NETSCAPE2.0");this.out.writeByte(3);this.out.writeByte(1);this.writeShort(this.repeat);this.out.writeByte(0)};GIFEncoder.prototype.writePalette=function(){this.out.writeBytes(this.colorTab);var n=3*256-this.colorTab.length;for(var i=0;i<n;i++)this.out.writeByte(0)};GIFEncoder.prototype.writeShort=function(pValue){this.out.writeByte(pValue&255);this.out.writeByte(pValue>>8&255)};GIFEncoder.prototype.writePixels=function(){var enc=new LZWEncoder(this.width,this.height,this.indexedPixels,this.colorDepth);enc.encode(this.out)};GIFEncoder.prototype.stream=function(){return this.out};module.exports=GIFEncoder},{"./LZWEncoder.js":2,"./TypedNeuQuant.js":3}],2:[function(require,module,exports){var EOF=-1;var BITS=12;var HSIZE=5003;var masks=[0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535];function LZWEncoder(width,height,pixels,colorDepth){var initCodeSize=Math.max(2,colorDepth);var accum=new Uint8Array(256);var htab=new Int32Array(HSIZE);var codetab=new Int32Array(HSIZE);var cur_accum,cur_bits=0;var a_count;var free_ent=0;var maxcode;var clear_flg=false;var g_init_bits,ClearCode,EOFCode;function char_out(c,outs){accum[a_count++]=c;if(a_count>=254)flush_char(outs)}function cl_block(outs){cl_hash(HSIZE);free_ent=ClearCode+2;clear_flg=true;output(ClearCode,outs)}function cl_hash(hsize){for(var i=0;i<hsize;++i)htab[i]=-1}function compress(init_bits,outs){var fcode,c,i,ent,disp,hsize_reg,hshift;g_init_bits=init_bits;clear_flg=false;n_bits=g_init_bits;maxcode=MAXCODE(n_bits);ClearCode=1<<init_bits-1;EOFCode=ClearCode+1;free_ent=ClearCode+2;a_count=0;ent=nextPixel();hshift=0;for(fcode=HSIZE;fcode<65536;fcode*=2)++hshift;hshift=8-hshift;hsize_reg=HSIZE;cl_hash(hsize_reg);output(ClearCode,outs);outer_loop:while((c=nextPixel())!=EOF){fcode=(c<<BITS)+ent;i=c<<hshift^ent;if(htab[i]===fcode){ent=codetab[i];continue}else if(htab[i]>=0){disp=hsize_reg-i;if(i===0)disp=1;do{if((i-=disp)<0)i+=hsize_reg;if(htab[i]===fcode){ent=codetab[i];continue outer_loop}}while(htab[i]>=0)}output(ent,outs);ent=c;if(free_ent<1<<BITS){codetab[i]=free_ent++;htab[i]=fcode}else{cl_block(outs)}}output(ent,outs);output(EOFCode,outs)}function encode(outs){outs.writeByte(initCodeSize);remaining=width*height;curPixel=0;compress(initCodeSize+1,outs);outs.writeByte(0)}function flush_char(outs){if(a_count>0){outs.writeByte(a_count);outs.writeBytes(accum,0,a_count);a_count=0}}function MAXCODE(n_bits){return(1<<n_bits)-1}function nextPixel(){if(remaining===0)return EOF;--remaining;var pix=pixels[curPixel++];return pix&255}function output(code,outs){cur_accum&=masks[cur_bits];if(cur_bits>0)cur_accum|=code<<cur_bits;else cur_accum=code;cur_bits+=n_bits;while(cur_bits>=8){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}if(free_ent>maxcode||clear_flg){if(clear_flg){maxcode=MAXCODE(n_bits=g_init_bits);clear_flg=false}else{++n_bits;if(n_bits==BITS)maxcode=1<<BITS;else maxcode=MAXCODE(n_bits)}}if(code==EOFCode){while(cur_bits>0){char_out(cur_accum&255,outs);cur_accum>>=8;cur_bits-=8}flush_char(outs)}}this.encode=encode}module.exports=LZWEncoder},{}],3:[function(require,module,exports){var ncycles=100;var netsize=256;var maxnetpos=netsize-1;var netbiasshift=4;var intbiasshift=16;var intbias=1<<intbiasshift;var gammashift=10;var gamma=1<<gammashift;var betashift=10;var beta=intbias>>betashift;var betagamma=intbias<<gammashift-betashift;var initrad=netsize>>3;var radiusbiasshift=6;var radiusbias=1<<radiusbiasshift;var initradius=initrad*radiusbias;var radiusdec=30;var alphabiasshift=10;var initalpha=1<<alphabiasshift;var alphadec;var radbiasshift=8;var radbias=1<<radbiasshift;var alpharadbshift=alphabiasshift+radbiasshift;var alpharadbias=1<<alpharadbshift;var prime1=499;var prime2=491;var prime3=487;var prime4=503;var minpicturebytes=3*prime4;function NeuQuant(pixels,samplefac){var network;var netindex;var bias;var freq;var radpower;function init(){network=[];netindex=new Int32Array(256);bias=new Int32Array(netsize);freq=new Int32Array(netsize);radpower=new Int32Array(netsize>>3);var i,v;for(i=0;i<netsize;i++){v=(i<<netbiasshift+8)/netsize;network[i]=new Float64Array([v,v,v,0]);freq[i]=intbias/netsize;bias[i]=0}}function unbiasnet(){for(var i=0;i<netsize;i++){network[i][0]>>=netbiasshift;network[i][1]>>=netbiasshift;network[i][2]>>=netbiasshift;network[i][3]=i}}function altersingle(alpha,i,b,g,r){network[i][0]-=alpha*(network[i][0]-b)/initalpha;network[i][1]-=alpha*(network[i][1]-g)/initalpha;network[i][2]-=alpha*(network[i][2]-r)/initalpha}function alterneigh(radius,i,b,g,r){var lo=Math.abs(i-radius);var hi=Math.min(i+radius,netsize);var j=i+1;var k=i-1;var m=1;var p,a;while(j<hi||k>lo){a=radpower[m++];if(j<hi){p=network[j++];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}if(k>lo){p=network[k--];p[0]-=a*(p[0]-b)/alpharadbias;p[1]-=a*(p[1]-g)/alpharadbias;p[2]-=a*(p[2]-r)/alpharadbias}}}function contest(b,g,r){var bestd=~(1<<31);var bestbiasd=bestd;var bestpos=-1;var bestbiaspos=bestpos;var i,n,dist,biasdist,betafreq;for(i=0;i<netsize;i++){n=network[i];dist=Math.abs(n[0]-b)+Math.abs(n[1]-g)+Math.abs(n[2]-r);if(dist<bestd){bestd=dist;bestpos=i}biasdist=dist-(bias[i]>>intbiasshift-netbiasshift);if(biasdist<bestbiasd){bestbiasd=biasdist;bestbiaspos=i}betafreq=freq[i]>>betashift;freq[i]-=betafreq;bias[i]+=betafreq<<gammashift}freq[bestpos]+=beta;bias[bestpos]-=betagamma;return bestbiaspos}function inxbuild(){var i,j,p,q,smallpos,smallval,previouscol=0,startpos=0;for(i=0;i<netsize;i++){p=network[i];smallpos=i;smallval=p[1];for(j=i+1;j<netsize;j++){q=network[j];if(q[1]<smallval){smallpos=j;smallval=q[1]}}q=network[smallpos];if(i!=smallpos){j=q[0];q[0]=p[0];p[0]=j;j=q[1];q[1]=p[1];p[1]=j;j=q[2];q[2]=p[2];p[2]=j;j=q[3];q[3]=p[3];p[3]=j}if(smallval!=previouscol){netindex[previouscol]=startpos+i>>1;for(j=previouscol+1;j<smallval;j++)netindex[j]=i;previouscol=smallval;startpos=i}}netindex[previouscol]=startpos+maxnetpos>>1;for(j=previouscol+1;j<256;j++)netindex[j]=maxnetpos}function inxsearch(b,g,r){var a,p,dist;var bestd=1e3;var best=-1;var i=netindex[g];var j=i-1;while(i<netsize||j>=0){if(i<netsize){p=network[i];dist=p[1]-g;if(dist>=bestd)i=netsize;else{i++;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}if(j>=0){p=network[j];dist=g-p[1];if(dist>=bestd)j=-1;else{j--;if(dist<0)dist=-dist;a=p[0]-b;if(a<0)a=-a;dist+=a;if(dist<bestd){a=p[2]-r;if(a<0)a=-a;dist+=a;if(dist<bestd){bestd=dist;best=p[3]}}}}}return best}function learn(){var i;var lengthcount=pixels.length;var alphadec=30+(samplefac-1)/3;var samplepixels=lengthcount/(3*samplefac);var delta=~~(samplepixels/ncycles);var alpha=initalpha;var radius=initradius;var rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(i=0;i<rad;i++)radpower[i]=alpha*((rad*rad-i*i)*radbias/(rad*rad));var step;if(lengthcount<minpicturebytes){samplefac=1;step=3}else if(lengthcount%prime1!==0){step=3*prime1}else if(lengthcount%prime2!==0){step=3*prime2}else if(lengthcount%prime3!==0){step=3*prime3}else{step=3*prime4}var b,g,r,j;var pix=0;i=0;while(i<samplepixels){b=(pixels[pix]&255)<<netbiasshift;g=(pixels[pix+1]&255)<<netbiasshift;r=(pixels[pix+2]&255)<<netbiasshift;j=contest(b,g,r);altersingle(alpha,j,b,g,r);if(rad!==0)alterneigh(rad,j,b,g,r);pix+=step;if(pix>=lengthcount)pix-=lengthcount;i++;if(delta===0)delta=1;if(i%delta===0){alpha-=alpha/alphadec;radius-=radius/radiusdec;rad=radius>>radiusbiasshift;if(rad<=1)rad=0;for(j=0;j<rad;j++)radpower[j]=alpha*((rad*rad-j*j)*radbias/(rad*rad))}}}function buildColormap(){init();learn();unbiasnet();inxbuild()}this.buildColormap=buildColormap;function getColormap(){var map=[];var index=[];for(var i=0;i<netsize;i++)index[network[i][3]]=i;var k=0;for(var l=0;l<netsize;l++){var j=index[l];map[k++]=network[j][0];map[k++]=network[j][1];map[k++]=network[j][2]}return map}this.getColormap=getColormap;this.lookupRGB=inxsearch}module.exports=NeuQuant},{}],4:[function(require,module,exports){var GIFEncoder,renderFrame;GIFEncoder=require("./GIFEncoder.js");renderFrame=function(frame){var encoder,page,stream,transfer;encoder=new GIFEncoder(frame.width,frame.height);if(frame.index===0){encoder.writeHeader()}else{encoder.firstFrame=false}encoder.setTransparent(frame.transparent);encoder.setRepeat(frame.repeat);encoder.setDelay(frame.delay);encoder.setQuality(frame.quality);encoder.setDither(frame.dither);encoder.setGlobalPalette(frame.globalPalette);encoder.addFrame(frame.data);if(frame.last){encoder.finish()}if(frame.globalPalette===true){frame.globalPalette=encoder.getGlobalPalette()}stream=encoder.stream();frame.data=stream.pages;frame.cursor=stream.cursor;frame.pageSize=stream.constructor.pageSize;if(frame.canTransfer){transfer=function(){var i,len,ref,results;ref=frame.data;results=[];for(i=0,len=ref.length;i<len;i++){page=ref[i];results.push(page.buffer)}return results}();return self.postMessage(frame,transfer)}else{return self.postMessage(frame)}};self.onmessage=function(event){return renderFrame(event.data)}},{"./GIFEncoder.js":1}]},{},[4]);
|
|
233
233
|
`],{type:"application/javascript"}))})}var E=x("2SBKn");let dP="https://api.polotno.com",dO=()=>dP+"/api",dA={},dI=(e,t)=>{dA[e]||(dA[e]=!0,console.error(t))},dR=`API for iconscout is provided as a demonstration.
|
|
234
234
|
For production usage you have to use your own API endpoint.
|
|
@@ -331,14 +331,14 @@ https://polotno.com/docs/server-api`,dL={unsplashList:({query:e,page:t=1})=>`${d
|
|
|
331
331
|
font-weight: ${s};
|
|
332
332
|
src: url(${n});
|
|
333
333
|
}`}));return hp("style",{},a.join("\n"))}catch(e){return console.error("Error embedding Google Font:",e),hp("defs",{},hp("style",{type:"text/css",innerHTML:`@import url('${t}');`.replace(/&/g,"&")}))}}}))}async function hk({json:e,elementHook:t,fontEmbedding:n="inline"}){let r=[];hf({children:e.pages},e=>{"text"===e.type&&-1===r.indexOf(e.fontFamily)&&r.push(e.fontFamily)});let i="inline"===n?await hS(r,e.fonts):[],a=await Promise.all(e.pages.map(n=>hw({page:n,store:e,elementHook:t})));return hp("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:`0 0 ${e.width} ${e.height}`,width:e.width,height:e.height},...i,...a)}let h_=({dom:e,nestLevel:t=0})=>{if("string"==typeof e)return e;if(!e)return"";let{innerHTML:n,...r}=e.props,i=Object.keys(r).map(e=>{var t;return"object"==typeof(t=r[e])?`${e}="${Object.keys(t).map(e=>`${e}:${t[e]};`).join(" ")}"`:null==t||""===t?"":`${e}="${t}"`}).filter(e=>e&&e.trim().length>0).join(" "),a=" ".repeat(t);return`${a}<${e.type}${i?" "+i:""}>${n||"\n"+e.children.map(e=>h_({dom:e,nestLevel:t+1})).join("")}${a}</${e.type}>
|
|
334
|
-
`};async function hE({json:e,elementHook:t,fontEmbedding:n="inline"}){return h_({dom:await hk({json:e,elementHook:t,fontEmbedding:n})})}var iY=x("58B0H");let hT=iY.types.model("Page",{id:iY.types.identifier,children:iY.types.array(iY.types.late(()=>hX)),width:iY.types.optional(iY.types.union(iY.types.number,iY.types.literal("auto")),"auto"),height:iY.types.optional(iY.types.union(iY.types.number,iY.types.literal("auto")),"auto"),background:"white",bleed:0,custom:iY.types.frozen(),duration:5e3,_exporting:!1,_rendering:!1,_forceMount:!1}).postProcessSnapshot(e=>{let t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n}).views(e=>({get store(){return(0,iY.getParentOfType)(e,hA)}})).views(e=>({get startTime(){let t=0;for(let n of e.store.pages){if(n.id===e.id)break;t+=n.duration}return t},get _exportingOrRendering(){return e._exporting||e._rendering}})).views(e=>({get computedWidth(){if("auto"===e.width)return e.store.width;return e.width},get computedHeight(){if("auto"===e.height)return e.store.height;return e.height}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify((0,iY.getSnapshot)(e))),_forEachElementUp(t,n){let r=t.map(t=>({id:t,index:e.children.findIndex(e=>e.id===t)}));for(let{index:i}of(r.sort((e,t)=>t.index-e.index),r)){if(-1==i)continue;let r=i<e.children.length-1&&e.children[i+1],a=t.indexOf(r?.id)>=0;i===e.children.length-1||a||n(i)}},_forEachElementDown(t,n){let r=t.map(t=>({id:t,index:e.children.findIndex(e=>e.id===t)}));for(let{index:i}of(r.sort((e,t)=>e.index-t.index),r)){if(-1==i)continue;let r=i>0&&e.children[i-1],a=t.indexOf(r?.id)>=0;0===i||a||n(i)}return!1}})).actions(e=>{let t={clone(t={}){let n=e.toJSON();n.children.forEach(e=>{e.id=dC(10),hK(e,e=>{e.id=dC(10)})});let r={...n,id:dC(10),...t},i=e.store.addPage(r),a=e.store.pages.indexOf(e);return i.setZIndex(a+1),i.select(),i},setZIndex(t){e.store.setPageZIndex(e.id,t)},set(t){Object.assign(e,t)},select(){e.store.selectPage(e.id)},addElement(t,{skipSelect:n=!1}={}){let r=hJ[t.type];if(!r)return void console.error("Can not find model with type "+t.type);"children"in t&&Array.isArray(t.children)&&hK(t,e=>{e.id=e.id||dC(10)});let i=e.children.reduce((e,n)=>{if("group"===n.type)return Math.max(e,n.children.reduce((e,n)=>{let r=n.name?.match(RegExp(`${t.type}-(\\d+)`));if(r)return Math.max(e,parseInt(r[1],10)||0)},0)||0);{let r=n.name.match(RegExp(`${t.type}-(\\d+)`));if(r)return Math.max(e,parseInt(r[1],10)||0)}return e},0),a=r.create({id:dC(10),name:`${t.type}-${i+1}`,...t});return e.children.push(a),a.selectable&&!n&&e.store.selectElements([a.id]),a},canMoveElementsUp(t){let n=!1;return e._forEachElementUp(t,()=>{n=n||!0}),n},moveElementsUp(t){e._forEachElementUp(t,t=>{let n=e.children[t];(0,iY.detach)(n),e.children.splice(t+1,0,n)})},canMoveElementsTop:e=>t.canMoveElementsUp(e),moveElementsTop(t){let n=[],r=[];e.children.forEach(e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)}),e.children.replace(r.concat(n))},canMoveElementsDown(t){let n=!1;return e._forEachElementDown(t,()=>{n=n||!0}),n},moveElementsDown(t){e._forEachElementDown(t,t=>{let n=e.children[t];(0,iY.detach)(n),e.children.splice(t-1,0,n)})},canMoveElementsBottom:e=>t.canMoveElementsDown(e),moveElementsBottom(t){let n=[],r=[];e.children.forEach(e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)}),e.children.replace(n.concat(r))},setElementZIndex(t,n){let r=e.children.find(e=>e.id===t);r&&((0,iY.detach)(r),e.children.remove(r),e.children.splice(n,0,r))},setSize({width:t,height:n,useMagic:r,softChange:i}){if(r){let r=[],i=t=>"image"===t.type&&t.x<1&&t.y<1&&t.width>=e.computedWidth-2&&t.height>=e.computedHeight-2;hK(e,e=>{"group"===e.type||i(e)||r.push(e)});let a=r.length?oB(r):{x:0,y:0,width:e.computedWidth,height:e.computedHeight},o=1/4,s=Math.max(0,Math.max(0,Math.min(a.x,e.computedWidth-a.x-a.width))-e.computedWidth*o),l=Math.max(0,Math.max(0,Math.min(a.y,e.computedHeight-a.y-a.height))-e.computedHeight*o),c=e.computedWidth-2*s,u=e.computedHeight-2*l,d=t/c,h=n/u,f=Math.min(d,h),p=(t-c*f)/2-s*f,m=(n-u*f)/2-l*f;hK(e,e=>{"group"===e.type||(i(e)?e.set({x:e.x*f,y:e.y*f,width:e.width*d,height:e.height*h,cropX:0,cropY:0,cropWidth:1,cropHeight:1}):(e.set({x:p+e.x*f,y:m+e.y*f,width:e.width*f,height:e.height*f}),"text"===e.type?e.set({fontSize:e.fontSize*f}):"figure"===e.type&&e.set({strokeWidth:e.strokeWidth*f})))})}i||(e.width=t),i||(e.height=n)}};return t}).actions(e=>({moveElementUp(t){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),e.moveElementsUp([t])},moveElementDown(t){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),e.moveElementsDown([t])},moveElementTop(t){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),e.moveElementsTop([t])},moveElementBottom(t){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),e.moveElementsBottom([t])},play(){e.store.play({startTime:e.startTime,endTime:e.startTime+e.duration})}}));var iY=x("58B0H");let hP=iY.types.model("Audio",{id:iY.types.identifier,src:"",duration:0,startTime:0,endTime:1,volume:1,delay:0,custom:iY.types.frozen()}).actions(e=>({toJSON:()=>({...(0,iY.getSnapshot)(e)})})).actions(e=>({set(t){Object.assign(e,t)}}));(0,iY.setLivelinessChecking)("ignore");let hO=iY.types.model("Font",{fontFamily:iY.types.string,url:iY.types.optional(iY.types.string,""),styles:iY.types.frozen()}).preProcessSnapshot(e=>({...e,fontFamily:e.fontFamily||e.name})),hA=iY.types.model("Store",{role:"",pages:iY.types.array(hT),fonts:iY.types.array(hO),audios:iY.types.array(hP),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:iY.types.optional(iY.types.enumeration("UnitType",["pt","mm","cm","in","px"]),"px"),dpi:72,schemaVersion:2,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,openedSidePanel:"",previousOpenedSidePanel:"",custom:iY.types.frozen(),tool:iY.types.optional(iY.types.enumeration("Tool",["selection","draw","pan","text","eraser"]),"selection"),toolOptions:iY.types.optional(iY.types.model({brushType:iY.types.optional(iY.types.enumeration("BrushType",["brush","highlighter"]),"brush"),strokeWidth:iY.types.optional(iY.types.number,5),stroke:iY.types.optional(iY.types.string,"#000000"),opacity:iY.types.optional(iY.types.number,1)}),{}),selectedElementsIds:iY.types.array(iY.types.string),animatedElementsIds:iY.types.array(iY.types.string),history:iY.types.optional(dk,{targetPath:"../pages"}),_elementsPixelRatio:Math.min(2,"u">typeof window&&window.devicePixelRatio||1),_activePageId:"",_selectedPagesIds:iY.types.array(iY.types.string),_forceShowCredit:!1,_key:"",_validated:!1}).views(e=>{let t=(0,E.computed)(()=>{let t={};return hK({children:e.pages},e=>(t[e.id]=e,!1)),t},{keepAlive:!0});return{get _idsMap(){return t.get()}}}).views(e=>({get _bleedVisible(){return console.warn("store._bleedVisible is deprecated. Please use store.bleedVisible instead."),e.bleedVisible},get selectedElements(){return e.selectedElementsIds.map(t=>{for(let n of e.pages)for(let e of n.children)if(e.id===t)return e}).filter(e=>!!e)},get children(){return e.pages},get selectedShapes(){let e=[];return hK({children:this.selectedElements},t=>{"group"!==t.type&&e.push(t)}),e},get activePage(){return e.pages.slice().find(t=>t.id===e._activePageId)||(e.pages.length?e.pages[0]:null)},get selectedPages(){return e._selectedPagesIds.map(t=>e.pages.find(e=>e.id===t))},get duration(){let t=0;return e.pages.forEach(e=>{t+=e.duration}),t},get _hasCroppedImages(){return this.find(e=>"image"===e.type&&e._cropModeEnabled)},find(t){let n;return hK({children:e.pages},e=>{if(!n&&t(e))return n=e,!0}),n},getElementById:t=>e._idsMap[t]})).actions(e=>{let t=0,n=null,r=!1,a={afterCreate(){e.history.canUndo},setCurrentTime(t){e.currentTime=t},_togglePlaying(t=!e.isPlaying){e.isPlaying=t},play({animatedElementsIds:i=[],startTime:o=0,currentTime:s=0,endTime:l=e.duration,repeat:c=!1}={}){s&&(console.warn("currentTime property of store.play() is deprecated. Please use startTime instead."),o=s),e.animatedElementsIds=(0,iY.cast)(i),e.currentTime=o,e.isPlaying=!0,t=Date.now(),n=l,r=c,requestAnimationFrame(()=>a.seek())},checkActivePage(){for(let t of e.pages){if(e.currentTime>=t.startTime&&e.currentTime<t.startTime+t.duration){a.selectPage(t.id);break}t.duration}},seek(){if(!e.isPlaying)return;let i=Date.now(),o=i-t;t=i,e.currentTime+=o,a.checkActivePage();let s=n||e.duration;e.isPlaying&&e.currentTime<s?requestAnimationFrame(()=>a.seek()):e.isPlaying&&r?(e.currentTime=0,requestAnimationFrame(()=>a.seek())):a.stop()},stop(){e.isPlaying=!1,e.currentTime=0,e.animatedElementsIds=(0,iY.cast)([]),a.checkActivePage()},__(){e._validated||(dY(e._key,e._forceShowCredit),e._validated=!0)},set(t){Object.assign(e,t)},setUnit({unit:t,dpi:n}){e.unit=t||e.unit,e.dpi=n||e.dpi},setRole(t){e.role=t},setTool(t){e.tool=t},setToolOptions(t){Object.assign(e.toolOptions,t)},addPage(t){let n=hT.create({id:dC(10),...t});return e.pages.push(n),e._activePageId=n.id,n},selectPage(t){e._activePageId=t,1===e._selectedPagesIds.length&&(e._selectedPagesIds=(0,iY.cast)([t]))},selectPages(t){e._selectedPagesIds=(0,iY.cast)(t),1===e._selectedPagesIds.length&&(e._activePageId=e._selectedPagesIds[0])},selectElements(t){let n=t.map(t=>e.getElementById(t)).sort((e,t)=>e.page.children.indexOf(e)-e.page.children.indexOf(t)).filter(e=>!!e).map(e=>e.id);e.selectedElementsIds=(0,iY.cast)(n)},toggleBleed(t){e.bleedVisible=t??!e.bleedVisible},toggleRulers(t){e.rulesVisible=t??!e.rulesVisible},toggleDistanceGuides(t){e.distanceGuidesVisible=t??!e.distanceGuidesVisible},openSidePanel(t){e.openedSidePanel!==t&&(e.previousOpenedSidePanel=e.openedSidePanel,e.openedSidePanel=t)},setScale(t){e.scale=t},_setScaleToFit(t){e.scaleToFit=t},setElementsPixelRatio(t){e._elementsPixelRatio=t},setSize(t,n,r){e.pages.forEach(e=>{e.setSize({width:t,height:n,useMagic:r,softChange:!0})}),e.width=t,e.height=n},setPageZIndex(t,n){let r=e.pages.find(e=>e.id===t);r&&((0,iY.detach)(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){let n=e.pages.indexOf(e.activePage);t.forEach(t=>{let n=e.pages.find(e=>e.id===t);(0,iY.destroy)(n)});let r=Math.min(e.pages.length-1,n),i=e.pages[r];i&&(e._activePageId=i.id),e.selectedElementsIds=(0,iY.cast)(e.selectedElementsIds.filter(t=>e.getElementById(t)))},groupElements(t,n={}){let r=t.map(t=>e.getElementById(t)),i=r[0].page;if(r.forEach(e=>{e&&(0,iY.detach)(e)}),!r.length)return;let a=i.children.reduce((e,t)=>{if("group"===t.type){let n=t.name.match(/group-(\d+)/);if(n)return Math.max(e,parseInt(n[1],10))}return e},0),o={id:dC(10),name:`group-${a+1}`,children:r,type:"group",...n};return i.children.push(o),e.selectedElementsIds=(0,iY.cast)([o.id]),i.children.find(e=>e.id===o.id)},ungroupElements(t){let n=t.map(t=>e.getElementById(t)),r=[];n.forEach(e=>{if(e&&"group"===e.type){let t=e.page,n=t.children.indexOf(e);e.children.forEach(e=>{r.push(e.id)}),e.children.forEach(e=>{(0,iY.detach)(e),t.children.push(e)}),t.children.splice(n,1)}}),e.selectedElementsIds=(0,iY.cast)(r)},deleteElements(t){let n=[];e.find(e=>(t.includes(e.id)&&n.push(e),!1)),n.forEach(e=>{(0,iY.destroy)(e)}),e.selectedElementsIds=(0,iY.cast)(e.selectedElementsIds.filter(t=>e.getElementById(t)))},on(t,n){if("change"===t){let t=a.toJSON();return(0,iY.onSnapshot)(e,e=>{let r=a.toJSON();dS(t,r)||(t=r,n(r))})}},async _toCanvas({pixelRatio:t,ignoreBackground:n,pageId:r,mimeType:i,includeBleed:o,_skipTimeout:s,quickMode:l=!1,_exportCanvases:c}={}){let u=t||1;r=r||e.pages[0]?.id;let d=e.pages.find(e=>e.id===r);if(!d)throw Error(`No page for export with id ${r}`);let h=e._elementsPixelRatio;u>e._elementsPixelRatio&&a.setElementsPixelRatio(u),l?d?.set({_forceMount:!0}):d?.set({_exporting:!0});let f=await d4(()=>{let e=n_.stages.filter(e=>e.getAttr("pageId")===r);return 0===e.length?null:e});if(!f)throw d?.set({_forceMount:!1,_exporting:!1}),a.setElementsPixelRatio(h),Error(`Export is failed. Can not find stage for page ${r}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);f.length>1&&console.error(`Polotno error: Detected several canvas elements for page "${r}" in the document. This is not supported and will lead to incorrect export. Make sure to use unique ids for all pages and make sure you unmount <Workspace /> when it is not needed.`);let p=f[0];await a.waitLoading({_skipTimeout:s});let m=p.findOne(".page-container");if(!m)throw a.setElementsPixelRatio(h),d?.set({_forceMount:!1,_exporting:!1}),Error("Export is failed. Canvas was unmounted.");let g=p.position();p.position({x:0,y:0}),p.find("Transformer").forEach(e=>{e.setAttr("oldVisible",e.visible()),e.visible(!1)}),m.find(".page-background").forEach(e=>e.shadowEnabled(!1)),m.find(".page-background").forEach(e=>e.strokeEnabled(!1)),m.find(".highlighter").forEach(e=>e.visible(!1));let y=m.findOne(".page-background-group"),v=y.clip();y.clip({x:null,y:null,width:null,height:null});let b=m.findOne(".elements-container"),x=b.clip();b.clip({x:null,y:null,width:null,height:null});let w=m.find(e=>!e.visible()&&e.getAttr("editModeEnabled")&&!e.getAttr("hideInExport"));w.forEach(e=>{e.setAttr("oldVisible",e.visible()),e.show()});let C=m.find(e=>e.getAttr("hideInExport"));C.forEach(e=>{e.setAttr("oldVisible",e.visible()),e.hide()}),n&&m.find(".page-background").forEach(e=>e.hide());let S=o?d.bleed:0,k=S;!e.bleedVisible&&o||(e.bleedVisible||o?e.bleedVisible&&o?k=0:e.bleedVisible&&!o&&(k=-d.bleed):k=0);let _=d.computedWidth+2*S,E=d.computedHeight+2*S,T=m.scale();m.scale({x:1,y:1});let P=function(e,t){let n=t.x??0,r=t.y??0,i=t.pixelRatio||1,a=Math.round(t.width*i),o=Math.round(t.height*i),s=a/i,l=o/i,c=t.sceneCanvas;c?(c.width!==a||c.height!==o||c.pixelRatio!==i)&&(c.setSize(s,l),c.setPixelRatio(i)):c=new es({width:s,height:l,pixelRatio:i});let u=c.getContext(),d=c.width/c.pixelRatio+Math.abs(n),h=c.height/c.pixelRatio+Math.abs(r),f=t.bufferCanvas;if(f){let e=Math.round(d*c.pixelRatio),t=Math.round(h*c.pixelRatio);(f.width!==e||f.height!==t||f.pixelRatio!==c.pixelRatio)&&(f.setSize(d,h),f.setPixelRatio(c.pixelRatio))}else f=new es({width:d,height:h,pixelRatio:c.pixelRatio});return!1===t.imageSmoothingEnabled&&(u._context.imageSmoothingEnabled=!1),u.save(),(n||r)&&u.translate(-1*n,-1*r),e.drawScene(c,void 0,f),u.restore(),c}(m,{x:m.x()-k,y:m.y()-k,width:_,height:E,pixelRatio:u,sceneCanvas:c?.sceneCanvas,bufferCanvas:c?.bufferCanvas});m.scale(T);let O=P._canvas;if("image/jpeg"===i){let e=O.getContext("2d");e.save(),e.globalCompositeOperation="destination-over",e.fillStyle="white",e.fillRect(0,0,O.width,O.height),e.restore()}return n&&m.find(".page-background").forEach(e=>e.show()),C.forEach(e=>{e.visible(e.getAttr("oldVisible"))}),w.forEach(e=>{e.visible(e.getAttr("oldVisible"))}),m.find(".page-background").forEach(e=>e.shadowEnabled(!0)),m.find(".page-background").forEach(e=>e.strokeEnabled(!0)),p.find("Transformer").forEach(e=>{e.visible(e.getAttr("oldVisible"))}),m.find(".highlighter").forEach(e=>e.visible(!0)),y.clip(v),b.clip(x),p.position(g),d?.set({_exporting:!1,_forceMount:!1}),await Promise.resolve(),a.setElementsPixelRatio(h),O},async toDataURL({mimeType:t,quality:n,dpi:r,dpiMetadata:i="auto",...o}={}){let s,l,c,u=await a._toCanvas({mimeType:t,...o}),d=t||"image/png",h=u.toDataURL(d,n);n_.Util.releaseCanvas(u);let f=r??e.dpi;return"image/png"!==d&&"image/jpeg"!==d||"never"===i||"auto"===i&&72===f?h:(l=(e=>{if("function"==typeof atob){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}let t=dZ();if(t)return new Uint8Array(t.from(e,"base64"));throw Error("No base64 decoder available")})((s=h.indexOf(","))>=0?h.slice(s+1):h),c="image/png"===d?((e,t)=>{var n;let r,i,a,o,s=(n=Math.round(t/.0254),(i=new DataView((r=new Uint8Array(9)).buffer)).setUint32(0,n,!1),i.setUint32(4,n,!1),r[8]=1,dJ(a=new Uint8Array(8+r.length+4),0,r.length),a.set(dX,4),a.set(r,8),(o=new Uint8Array(4+r.length)).set(dX,0),o.set(r,4),dJ(a,8+r.length,(e=>{let t=0xffffffff;for(let n=0;n<e.length;n++)t=dQ[(t^e[n])&255]^t>>>8;return(0xffffffff^t)>>>0})(o)),a),l=((e,t)=>{let n=8;for(;n+8<=e.length;){let r=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3],i=n+4,a=e.subarray(i,i+4),o=8+r+4;if(t.every((e,t)=>a[t]===e))return{offset:n,totalLength:o};n+=o}return null})(e,dX);if(l){let t=new Uint8Array(e.length-l.totalLength+s.length);return t.set(e.slice(0,l.offset),0),t.set(s,l.offset),t.set(e.slice(l.offset+l.totalLength),l.offset+s.length),t}let c=16+(e[8]<<24|e[9]<<16|e[10]<<8|e[11])+4;if(c>e.length)return e;let u=new Uint8Array(e.length+s.length);return u.set(e.slice(0,c),0),u.set(s,c),u.set(e.slice(c),c+s.length),u})(l,f):((e,t)=>{let n,r=(e=>{let t=2;for(;t+4<e.length&&255===e[t];){let n=e[t+1];if(216===n||217===n){t+=2;continue}let r=e[t+2]<<8|e[t+3];if(r<2)break;if(224===n&&74===e[t+4]&&70===e[t+5]&&73===e[t+6]&&70===e[t+7]&&0===e[t+8])return t;let i=t+2+r;if(i<=t||i>e.length)break;t=i}return -1})(e);if(r>=0){let n=new Uint8Array(e),i=r+11;return n[i]=1,n[i+1]=t>>8&255,n[i+2]=255&t,n[i+3]=t>>8&255,n[i+4]=255&t,n}let i=((n=new Uint8Array(18))[0]=255,n[1]=224,n[2]=0,n[3]=16,n[4]=74,n[5]=70,n[6]=73,n[7]=70,n[8]=0,n[9]=1,n[10]=1,n[11]=1,n[12]=t>>8&255,n[13]=255&t,n[14]=t>>8&255,n[15]=255&t,n),a=new Uint8Array(e.length+i.length);return a.set(e.subarray(0,2),0),a.set(i,2),a.set(e.subarray(2),2+i.length),a})(l,f),`data:${d};base64,${(e=>{if("function"==typeof btoa){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}let t=dZ();if(t)return t.from(e).toString("base64");throw Error("No base64 encoder available")})(c)}`)},async toBlob({mimeType:e,quality:t,...n}={}){let r=await a._toCanvas({mimeType:e,...n}),i=await new Promise(n=>{r.toBlob(n,e,t)});return n_.Util.releaseCanvas(r),i},async saveAsImage({fileName:e,...t}={}){let n=(t.mimeType||"image/png").split("/")[1];d_(await a.toDataURL(t),e||"polotno."+n)},async _toPDF(t){let n=t.dpi||e.dpi,r=t.parallel||1,i=t.unit||("px"===e.unit?"mm":e.unit),o=t.pixelRatio||1,s=t.pageIds||e.pages.map(e=>e.id),l=e.pages.filter(e=>s.includes(e.id)),c=await (window.jspdf?.jsPDF?Promise.resolve(window.jspdf.jsPDF):dE||(dE="function"==typeof window.__polotnoLoadJspdf?window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e):new Promise(e=>{var t=document.createElement("script");t.onload=function(){e(window.jspdf.jsPDF)},t.src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/3.0.1/jspdf.umd.min.js",document.head.appendChild(t)}))),u=e=>d0({px:e,unit:i,dpi:n}),d=t.cropMarkSize||0,h=u(d),f=l[0]||{},p=t.includeBleed?f.bleed:0,m=u(f.computedWidth+2*p+2*h),g=u(f.computedHeight+2*p+2*h);var y=new c({unit:i,orientation:m>g?"landscape":"portrait",format:[m,g],compress:!0,putOnlyUsedFonts:!0});y.deletePage(1);let v=((e,t)=>{let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(l,r),b=0;for(let e of v){let n=e.map(async e=>{let n=t.includeBleed?e.bleed:0,r=e.computedWidth+2*n+2*d,i=e.computedHeight+2*n+2*d,l=u(r),c=u(i),h=0,f=o;for(;h<10;){h+=1;let n=await a.toDataURL({...t,pageId:e.id,pixelRatio:f,dpiMetadata:"never"});if(n.length>20)return f!==o&&console.error(`Polotno can not export PDF with current settings. Quality is automatically reduced. pixelRatio was reduced to ${parseFloat(f.toFixed(3))}.`),t.onProgress&&t.onProgress(++b/s.length*.9),{url:n,width:l,height:c,widthPx:r,heightPx:i};f*=.8}});(await Promise.all(n)).filter(e=>void 0!==e).forEach(({url:e,width:t,height:n,widthPx:r,heightPx:a})=>{var o;y.addPage([t,n],t>n?"landscape":"portrait");let s=y.getCurrentPageInfo();switch(i){case"pt":o=1;break;case"mm":o=72/25.4;break;case"cm":o=72/2.54;break;case"in":o=72;break;case"px":o=.75;break;default:throw"Invalid unit: "+i}if(s.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:t*o,topRightY:n*o},s.pageContext.artBox={bottomLeftX:u(d+p)*o,bottomLeftY:u(d+p)*o,topRightX:u(r-d-p)*o,topRightY:u(a-d-p)*o},s.pageContext.bleedBox={bottomLeftX:u(d+p)*o,bottomLeftY:u(d+p)*o,topRightX:u(r-d-p)*o,topRightY:u(a-d-p)*o},h){y.setLineWidth(u(1));let e=h+u(p);y.line(e,0,e,h),y.line(0,e,h,e),y.line(t-e,0,t-e,h),y.line(t,e,t-h,e),y.line(0,n-e,h,n-e),y.line(e,n,e,n-h),y.line(t,n-e,t-h,n-e),y.line(t-e,n,t-e,n-h)}y.addImage(e,h,h,t-2*h,n-2*h,void 0,"FAST")})}return y},toPDFDataURL:async e=>(await a._toPDF({mimeType:"image/jpeg",...e})).output("datauristring"),async toGIFDataURL(t={}){let n=t.pixelRatio||1,r=await dT({width:e.width*n,height:e.height*n}),i=1e3/(t.fps||10),o=e.duration/i;for(let t=0;t<o-1;t++){let o=t*i||1;a.setCurrentTime(o);let s=0,l="";for(let t of e.pages)if(s+=t.duration,t.set({_rendering:s>o}),s>o){l=t.id;break}let c=await a._toCanvas({pixelRatio:n,pageId:l,_skipTimeout:!0});r.addFrame(c.getContext("2d"),{delay:i,copy:!0})}for(let t of e.pages)t.set({_rendering:!1});return a.stop(),r.render(),new Promise(e=>{r.on("finished",function(t){var n;(n=new FileReader).onload=function(t){e(t.target.result)},n.readAsDataURL(t)})})},async saveAsGIF({fileName:e,...t}={}){d_(await a.toGIFDataURL(t),e||"polotno.gif")},toHTML:async({elementHook:e}={})=>hh({json:a.toJSON(),elementHook:e}),async saveAsHTML({fileName:e,elementHook:t}={}){let n=await a.toHTML({elementHook:t});d_("data:text/html;base64,"+window.btoa(unescape(encodeURIComponent(n))),e||"polotno.html")},async toSVG({elementHook:e,pageId:t,fontEmbedding:n="inline"}={fontEmbedding:"inline"}){let r=a.toJSON();t=t||r.pages[0]?.id;let i=r.pages.find(e=>e.id===t);return hE({json:{...r,pages:i?[i]:[]},elementHook:e,fontEmbedding:n})},async saveAsSVG({fileName:e,elementHook:t,pageId:n,fontEmbedding:r="inline"}={}){let i=await a.toSVG({elementHook:t,pageId:n,fontEmbedding:r});d_("data:text/svg;base64,"+window.btoa(unescape(encodeURIComponent(i))),e||"polotno.svg")},async saveAsPDF({fileName:e,...t}={}){(await a._toPDF({mimeType:"image/jpeg",...t})).save(e||"polotno.pdf")},async waitLoading({_skipTimeout:e=!1}={}){e||await new Promise(e=>setTimeout(e,50)),await new Promise(e=>{var t;return t=()=>{rZ?setTimeout(e,300):e(!0)},void(0===r1?t():r2.push(t))})},toJSON:()=>({width:e.width,height:e.height,fonts:(0,iY.getSnapshot)(e.fonts),pages:(0,iY.getSnapshot)(e.pages),audios:(0,iY.getSnapshot)(e.audios),unit:e.unit,dpi:e.dpi,custom:e.custom,schemaVersion:e.schemaVersion}),loadJSON(t,n=!1){let r=JSON.parse(JSON.stringify(t)),i=r.schemaVersion||0;i<1&&iS.htmlRenderEnabled&&hK({children:r.pages},e=>{if("text"===e.type){let t=16*e.letterSpacing;e.letterSpacing=t/e.fontSize}}),i<2&&hK({children:r.pages},e=>{e.filters&&Object.keys(e.filters).forEach(t=>{if(["warm","cold","natural"].includes(t))return;let n=e.filters[t];n&&"number"==typeof n.intensity&&(n.intensity=n.intensity/100)})}),delete r.schemaVersion;let a=e.activePage?e.pages.indexOf(e.activePage):0,o=(r.pages[a]||r.pages[0])?.id;r._activePageId=o;let s={...(0,iY.getSnapshot)(e)};Object.assign(s,r),n?s.history=(0,iY.getSnapshot)(e.history):s.history={history:[],undoIdx:-1,targetPath:""},(0,iY.applySnapshot)(e,s)},clear({keepHistory:t=!1}={}){let n=e.pages.map(e=>e.id);a.deletePages(n),e.custom=null,t||e.history.clear()},addFont(t){a.removeFont(t.fontFamily),e.fonts.push(t)},removeFont(t){e.fonts.filter(e=>e.fontFamily===t).forEach(e=>(0,iY.destroy)(e))},addAudio(t){let n=hP.create({id:dC(10),...t});e.audios.push(n)},removeAudio(t){let n=e.audios.find(e=>e.id===t);n&&e.audios.remove(n)},async loadFont(t,n=""){let r=e.fonts.find(e=>e.fontFamily===t)||is.find(e=>e.fontFamily===t),a=[{fontStyle:"normal",fontWeight:"normal"},{fontStyle:"normal",fontWeight:"bold"}];return r?(r.styles&&(a=r.styles.map(e=>({fontStyle:e.fontStyle||"normal",fontWeight:e.fontWeight||"normal"}))),!function(e){let t=e.fontFamily;if(iw[t]||!e.url&&!e.styles)return;let n=e.styles||(e.url?[{src:`url("${e.url}")`}]:[]),r=(i||!(i=document.getElementById("polotno-font-style"))&&((i=document.createElement("style")).id="polotno-font-style",document.head.appendChild(i)),i).sheet;n.forEach(e=>{r.insertRule(`
|
|
334
|
+
`};async function hE({json:e,elementHook:t,fontEmbedding:n="inline"}){return h_({dom:await hk({json:e,elementHook:t,fontEmbedding:n})})}var iY=x("58B0H");let hT=iY.types.model("Page",{id:iY.types.identifier,children:iY.types.array(iY.types.late(()=>hX)),width:iY.types.optional(iY.types.union(iY.types.number,iY.types.literal("auto")),"auto"),height:iY.types.optional(iY.types.union(iY.types.number,iY.types.literal("auto")),"auto"),background:"white",bleed:0,custom:iY.types.frozen(),duration:5e3,_exporting:!1,_rendering:!1,_forceMount:!1}).postProcessSnapshot(e=>{let t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n}).views(e=>({get store(){return(0,iY.getParentOfType)(e,hA)}})).views(e=>({get startTime(){let t=0;for(let n of e.store.pages){if(n.id===e.id)break;t+=n.duration}return t},get _exportingOrRendering(){return e._exporting||e._rendering}})).views(e=>({get computedWidth(){if("auto"===e.width)return e.store.width;return e.width},get computedHeight(){if("auto"===e.height)return e.store.height;return e.height}})).actions(e=>({toJSON:()=>JSON.parse(JSON.stringify((0,iY.getSnapshot)(e))),_forEachElementUp(t,n){let r=t.map(t=>({id:t,index:e.children.findIndex(e=>e.id===t)}));for(let{index:i}of(r.sort((e,t)=>t.index-e.index),r)){if(-1==i)continue;let r=i<e.children.length-1&&e.children[i+1],a=t.indexOf(r?.id)>=0;i===e.children.length-1||a||n(i)}},_forEachElementDown(t,n){let r=t.map(t=>({id:t,index:e.children.findIndex(e=>e.id===t)}));for(let{index:i}of(r.sort((e,t)=>e.index-t.index),r)){if(-1==i)continue;let r=i>0&&e.children[i-1],a=t.indexOf(r?.id)>=0;0===i||a||n(i)}return!1}})).actions(e=>{let t={clone(t={}){let n=e.toJSON();n.children.forEach(e=>{e.id=dC(10),hK(e,e=>{e.id=dC(10)})});let r={...n,id:dC(10),...t},i=e.store.addPage(r),a=e.store.pages.indexOf(e);return i.setZIndex(a+1),i.select(),i},setZIndex(t){e.store.setPageZIndex(e.id,t)},set(t){Object.assign(e,t)},select(){e.store.selectPage(e.id)},addElement(t,{skipSelect:n=!1}={}){let r=hJ[t.type];if(!r)return void console.error("Can not find model with type "+t.type);"children"in t&&Array.isArray(t.children)&&hK(t,e=>{e.id=e.id||dC(10)});let i=e.children.reduce((e,n)=>{if("group"===n.type)return Math.max(e,n.children.reduce((e,n)=>{let r=n.name?.match(RegExp(`${t.type}-(\\d+)`));if(r)return Math.max(e,parseInt(r[1],10)||0)},0)||0);{let r=n.name.match(RegExp(`${t.type}-(\\d+)`));if(r)return Math.max(e,parseInt(r[1],10)||0)}return e},0),a=r.create({id:dC(10),name:`${t.type}-${i+1}`,...t});return e.children.push(a),a.selectable&&!n&&e.store.selectElements([a.id]),a},canMoveElementsUp(t){let n=!1;return e._forEachElementUp(t,()=>{n=n||!0}),n},moveElementsUp(t){e._forEachElementUp(t,t=>{let n=e.children[t];(0,iY.detach)(n),e.children.splice(t+1,0,n)})},canMoveElementsTop:e=>t.canMoveElementsUp(e),moveElementsTop(t){let n=[],r=[];e.children.forEach(e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)}),e.children.replace(r.concat(n))},canMoveElementsDown(t){let n=!1;return e._forEachElementDown(t,()=>{n=n||!0}),n},moveElementsDown(t){e._forEachElementDown(t,t=>{let n=e.children[t];(0,iY.detach)(n),e.children.splice(t-1,0,n)})},canMoveElementsBottom:e=>t.canMoveElementsDown(e),moveElementsBottom(t){let n=[],r=[];e.children.forEach(e=>{t.indexOf(e.id)>=0?n.push(e):r.push(e)}),e.children.replace(n.concat(r))},setElementZIndex(t,n){let r=e.children.find(e=>e.id===t);r&&((0,iY.detach)(r),e.children.remove(r),e.children.splice(n,0,r))},setSize({width:t,height:n,useMagic:r,softChange:i}){if(r){let r=[],i=t=>"image"===t.type&&t.x<1&&t.y<1&&t.width>=e.computedWidth-2&&t.height>=e.computedHeight-2;hK(e,e=>{"group"===e.type||i(e)||r.push(e)});let a=r.length?oB(r):{x:0,y:0,width:e.computedWidth,height:e.computedHeight},o=1/4,s=Math.max(0,Math.max(0,Math.min(a.x,e.computedWidth-a.x-a.width))-e.computedWidth*o),l=Math.max(0,Math.max(0,Math.min(a.y,e.computedHeight-a.y-a.height))-e.computedHeight*o),c=e.computedWidth-2*s,u=e.computedHeight-2*l,d=t/c,h=n/u,f=Math.min(d,h),p=(t-c*f)/2-s*f,m=(n-u*f)/2-l*f;hK(e,e=>{"group"===e.type||(i(e)?e.set({x:e.x*f,y:e.y*f,width:e.width*d,height:e.height*h,cropX:0,cropY:0,cropWidth:1,cropHeight:1}):(e.set({x:p+e.x*f,y:m+e.y*f,width:e.width*f,height:e.height*f}),"text"===e.type?e.set({fontSize:e.fontSize*f}):"figure"===e.type&&e.set({strokeWidth:e.strokeWidth*f})))})}i||(e.width=t),i||(e.height=n)}};return t}).actions(e=>({moveElementUp(t){console.warn("page.moveElementUp(id) is deprecated. Please use page.moveElementsUp([id1, id2]) instead."),e.moveElementsUp([t])},moveElementDown(t){console.warn("page.moveElementDown(id) is deprecated. Please use page.moveElementsDown([id1, id2]) instead."),e.moveElementsDown([t])},moveElementTop(t){console.warn("page.moveElementTop(id) is deprecated. Please use page.moveElementsTop([id1, id2]) instead."),e.moveElementsTop([t])},moveElementBottom(t){console.warn("page.moveElementBottom(id) is deprecated. Please use page.moveElementsBottom([id1, id2]) instead."),e.moveElementsBottom([t])},play(){e.store.play({startTime:e.startTime,endTime:e.startTime+e.duration})}}));var iY=x("58B0H");let hP=iY.types.model("Audio",{id:iY.types.identifier,src:"",duration:0,startTime:0,endTime:1,volume:1,delay:0,custom:iY.types.frozen()}).actions(e=>({toJSON:()=>({...(0,iY.getSnapshot)(e)})})).actions(e=>({set(t){Object.assign(e,t)}}));(0,iY.setLivelinessChecking)("ignore");let hO=iY.types.model("Font",{fontFamily:iY.types.string,url:iY.types.optional(iY.types.string,""),styles:iY.types.frozen()}).preProcessSnapshot(e=>({...e,fontFamily:e.fontFamily||e.name})),hA=iY.types.model("Store",{role:"",pages:iY.types.array(hT),fonts:iY.types.array(hO),audios:iY.types.array(hP),width:1080,height:1080,currentTime:0,isPlaying:!1,scale:1,scaleToFit:1,unit:iY.types.optional(iY.types.enumeration("UnitType",["pt","mm","cm","in","px"]),"px"),dpi:72,schemaVersion:2,bleedVisible:!1,rulesVisible:!1,distanceGuidesVisible:!1,openedSidePanel:"",previousOpenedSidePanel:"",custom:iY.types.frozen(),tool:iY.types.optional(iY.types.enumeration("Tool",["selection","draw","pan","text","eraser"]),"selection"),toolOptions:iY.types.optional(iY.types.model({brushType:iY.types.optional(iY.types.enumeration("BrushType",["brush","highlighter"]),"brush"),strokeWidth:iY.types.optional(iY.types.number,5),stroke:iY.types.optional(iY.types.string,"#000000"),opacity:iY.types.optional(iY.types.number,1)}),{}),selectedElementsIds:iY.types.array(iY.types.string),animatedElementsIds:iY.types.array(iY.types.string),history:iY.types.optional(dk,{targetPath:"../pages"}),_elementsPixelRatio:Math.min(2,"u">typeof window&&window.devicePixelRatio||1),_activePageId:"",_selectedPagesIds:iY.types.array(iY.types.string),_forceShowCredit:!1,_key:"",_validated:!1}).views(e=>{let t=(0,E.computed)(()=>{let t={};return hK({children:e.pages},e=>(t[e.id]=e,!1)),t},{keepAlive:!0});return{get _idsMap(){return t.get()}}}).views(e=>({get _bleedVisible(){return console.warn("store._bleedVisible is deprecated. Please use store.bleedVisible instead."),e.bleedVisible},get selectedElements(){return e.selectedElementsIds.map(t=>{for(let n of e.pages)for(let e of n.children)if(e.id===t)return e}).filter(e=>!!e)},get children(){return e.pages},get selectedShapes(){let e=[];return hK({children:this.selectedElements},t=>{"group"!==t.type&&e.push(t)}),e},get activePage(){return e.pages.slice().find(t=>t.id===e._activePageId)||(e.pages.length?e.pages[0]:null)},get selectedPages(){return e._selectedPagesIds.map(t=>e.pages.find(e=>e.id===t))},get duration(){let t=0;return e.pages.forEach(e=>{t+=e.duration}),t},get _hasCroppedImages(){return this.find(e=>"image"===e.type&&e._cropModeEnabled)},find(t){let n;return hK({children:e.pages},e=>{if(!n&&t(e))return n=e,!0}),n},getElementById:t=>e._idsMap[t]})).actions(e=>{let t=0,n=null,r=!1,a={afterCreate(){e.history.canUndo},setCurrentTime(t){e.currentTime=t},_togglePlaying(t=!e.isPlaying){e.isPlaying=t},play({animatedElementsIds:i=[],startTime:o=0,currentTime:s=0,endTime:l=e.duration,repeat:c=!1}={}){s&&(console.warn("currentTime property of store.play() is deprecated. Please use startTime instead."),o=s),e.animatedElementsIds=(0,iY.cast)(i),e.currentTime=o,e.isPlaying=!0,t=Date.now(),n=l,r=c,requestAnimationFrame(()=>a.seek())},checkActivePage(){for(let t of e.pages){if(e.currentTime>=t.startTime&&e.currentTime<t.startTime+t.duration){a.selectPage(t.id);break}t.duration}},seek(){if(!e.isPlaying)return;let i=Date.now(),o=i-t;t=i,e.currentTime+=o,a.checkActivePage();let s=n||e.duration;e.isPlaying&&e.currentTime<s?requestAnimationFrame(()=>a.seek()):e.isPlaying&&r?(e.currentTime=0,requestAnimationFrame(()=>a.seek())):a.stop()},stop(){e.isPlaying=!1,e.currentTime=0,e.animatedElementsIds=(0,iY.cast)([]),a.checkActivePage()},__(){e._validated||(dY(e._key,e._forceShowCredit),e._validated=!0)},set(t){Object.assign(e,t)},setUnit({unit:t,dpi:n}){e.unit=t||e.unit,e.dpi=n||e.dpi},setRole(t){e.role=t},setTool(t){e.tool=t},setToolOptions(t){Object.assign(e.toolOptions,t)},addPage(t){let n=hT.create({id:dC(10),...t});return e.pages.push(n),e._activePageId=n.id,n},selectPage(t){e._activePageId=t,1===e._selectedPagesIds.length&&(e._selectedPagesIds=(0,iY.cast)([t]))},selectPages(t){e._selectedPagesIds=(0,iY.cast)(t),1===e._selectedPagesIds.length&&(e._activePageId=e._selectedPagesIds[0])},selectElements(t){let n=t.map(t=>e.getElementById(t)).sort((e,t)=>e.page.children.indexOf(e)-e.page.children.indexOf(t)).filter(e=>!!e).map(e=>e.id);e.selectedElementsIds=(0,iY.cast)(n)},toggleBleed(t){e.bleedVisible=t??!e.bleedVisible},toggleRulers(t){e.rulesVisible=t??!e.rulesVisible},toggleDistanceGuides(t){e.distanceGuidesVisible=t??!e.distanceGuidesVisible},openSidePanel(t){e.openedSidePanel!==t&&(e.previousOpenedSidePanel=e.openedSidePanel,e.openedSidePanel=t)},setScale(t){e.scale=t},_setScaleToFit(t){e.scaleToFit=t},setElementsPixelRatio(t){e._elementsPixelRatio=t},setSize(t,n,r){e.pages.forEach(e=>{e.setSize({width:t,height:n,useMagic:r,softChange:!0})}),e.width=t,e.height=n},setPageZIndex(t,n){let r=e.pages.find(e=>e.id===t);r&&((0,iY.detach)(r),e.pages.remove(r),e.pages.splice(n,0,r))},deletePages(t){let n=e.pages.indexOf(e.activePage);t.forEach(t=>{let n=e.pages.find(e=>e.id===t);(0,iY.destroy)(n)});let r=Math.min(e.pages.length-1,n),i=e.pages[r];i&&(e._activePageId=i.id),e.selectedElementsIds=(0,iY.cast)(e.selectedElementsIds.filter(t=>e.getElementById(t)))},groupElements(t,n={}){let r=t.map(t=>e.getElementById(t)),i=r[0].page;if(r.forEach(e=>{e&&(0,iY.detach)(e)}),!r.length)return;let a=i.children.reduce((e,t)=>{if("group"===t.type){let n=t.name.match(/group-(\d+)/);if(n)return Math.max(e,parseInt(n[1],10))}return e},0),o={id:dC(10),name:`group-${a+1}`,children:r,type:"group",...n};return i.children.push(o),e.selectedElementsIds=(0,iY.cast)([o.id]),i.children.find(e=>e.id===o.id)},ungroupElements(t){let n=t.map(t=>e.getElementById(t)),r=[];n.forEach(e=>{if(e&&"group"===e.type){let t=e.page,n=t.children.indexOf(e);e.children.forEach(e=>{r.push(e.id)}),e.children.forEach(e=>{(0,iY.detach)(e),t.children.push(e)}),t.children.splice(n,1)}}),e.selectedElementsIds=(0,iY.cast)(r)},deleteElements(t){let n=[];e.find(e=>(t.includes(e.id)&&n.push(e),!1)),n.forEach(e=>{(0,iY.destroy)(e)}),e.selectedElementsIds=(0,iY.cast)(e.selectedElementsIds.filter(t=>e.getElementById(t)))},on(t,n){if("change"===t){let t=a.toJSON();return(0,iY.onSnapshot)(e,e=>{let r=a.toJSON();dS(t,r)||(t=r,n(r))})}},async _toCanvas({pixelRatio:t,ignoreBackground:n,pageId:r,mimeType:i,includeBleed:o,_skipTimeout:s,quickMode:l=!1,_exportCanvases:c}={}){let u=t||1;r=r||e.pages[0]?.id;let d=e.pages.find(e=>e.id===r);if(!d)throw Error(`No page for export with id ${r}`);let h=e._elementsPixelRatio;u>e._elementsPixelRatio&&a.setElementsPixelRatio(u),l?d?.set({_forceMount:!0}):d?.set({_exporting:!0});let f=await d4(()=>{let e=n_.stages.filter(e=>e.getAttr("pageId")===r);return 0===e.length?null:e});if(!f)throw d?.set({_forceMount:!1,_exporting:!1}),a.setElementsPixelRatio(h),Error(`Export is failed. Can not find stage for page ${r}. Looks like <Workspace /> component is not mounted, but it is required in order to process the export.`);f.length>1&&console.error(`Polotno error: Detected several canvas elements for page "${r}" in the document. This is not supported and will lead to incorrect export. Make sure to use unique ids for all pages and make sure you unmount <Workspace /> when it is not needed.`);let p=f[0];await a.waitLoading({_skipTimeout:s});let m=p.findOne(".page-container");if(!m)throw a.setElementsPixelRatio(h),d?.set({_forceMount:!1,_exporting:!1}),Error("Export is failed. Canvas was unmounted.");let g=p.position();p.position({x:0,y:0}),p.find("Transformer").forEach(e=>{e.setAttr("oldVisible",e.visible()),e.visible(!1)}),m.find(".page-background").forEach(e=>e.shadowEnabled(!1)),m.find(".page-background").forEach(e=>e.strokeEnabled(!1)),m.find(".highlighter").forEach(e=>e.visible(!1));let y=m.findOne(".page-background-group"),v=y.clip();y.clip({x:null,y:null,width:null,height:null});let b=m.findOne(".elements-container"),x=b.clip();b.clip({x:null,y:null,width:null,height:null});let w=m.find(e=>!e.visible()&&e.getAttr("editModeEnabled")&&!e.getAttr("hideInExport"));w.forEach(e=>{e.setAttr("oldVisible",e.visible()),e.show()});let C=m.find(e=>e.getAttr("hideInExport"));C.forEach(e=>{e.setAttr("oldVisible",e.visible()),e.hide()}),n&&m.find(".page-background").forEach(e=>e.hide());let S=o?d.bleed:0,k=S;!e.bleedVisible&&o||(e.bleedVisible||o?e.bleedVisible&&o?k=0:e.bleedVisible&&!o&&(k=-d.bleed):k=0);let _=d.computedWidth+2*S,E=d.computedHeight+2*S,T=m.scale();m.scale({x:1,y:1});let P=function(e,t){let n=t.x??0,r=t.y??0,i=t.pixelRatio||1,a=Math.round(t.width*i),o=Math.round(t.height*i),s=a/i,l=o/i,c=t.sceneCanvas;c?(c.width!==a||c.height!==o||c.pixelRatio!==i)&&(c.setSize(s,l),c.setPixelRatio(i)):c=new es({width:s,height:l,pixelRatio:i});let u=c.getContext(),d=c.width/c.pixelRatio+Math.abs(n),h=c.height/c.pixelRatio+Math.abs(r),f=t.bufferCanvas;if(f){let e=Math.round(d*c.pixelRatio),t=Math.round(h*c.pixelRatio);(f.width!==e||f.height!==t||f.pixelRatio!==c.pixelRatio)&&(f.setSize(d,h),f.setPixelRatio(c.pixelRatio))}else f=new es({width:d,height:h,pixelRatio:c.pixelRatio});return!1===t.imageSmoothingEnabled&&(u._context.imageSmoothingEnabled=!1),u.save(),(n||r)&&u.translate(-1*n,-1*r),e.drawScene(c,void 0,f),u.restore(),c}(m,{x:m.x()-k,y:m.y()-k,width:_,height:E,pixelRatio:u,sceneCanvas:c?.sceneCanvas,bufferCanvas:c?.bufferCanvas});m.scale(T);let O=P._canvas;if("image/jpeg"===i){let e=O.getContext("2d");e.save(),e.globalCompositeOperation="destination-over",e.fillStyle="white",e.fillRect(0,0,O.width,O.height),e.restore()}return n&&m.find(".page-background").forEach(e=>e.show()),C.forEach(e=>{e.visible(e.getAttr("oldVisible"))}),w.forEach(e=>{e.visible(e.getAttr("oldVisible"))}),m.find(".page-background").forEach(e=>e.shadowEnabled(!0)),m.find(".page-background").forEach(e=>e.strokeEnabled(!0)),p.find("Transformer").forEach(e=>{e.visible(e.getAttr("oldVisible"))}),m.find(".highlighter").forEach(e=>e.visible(!0)),y.clip(v),b.clip(x),p.position(g),d?.set({_exporting:!1,_forceMount:!1}),await Promise.resolve(),a.setElementsPixelRatio(h),O},async toDataURL({mimeType:t,quality:n,dpi:r,dpiMetadata:i="auto",...o}={}){let s,l,c,u=await a._toCanvas({mimeType:t,...o}),d=t||"image/png",h=u.toDataURL(d,n);n_.Util.releaseCanvas(u);let f=r??e.dpi;return"image/png"!==d&&"image/jpeg"!==d||"never"===i||"auto"===i&&72===f?h:(l=(e=>{if("function"==typeof atob){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}let t=dZ();if(t)return new Uint8Array(t.from(e,"base64"));throw Error("No base64 decoder available")})((s=h.indexOf(","))>=0?h.slice(s+1):h),c="image/png"===d?((e,t)=>{var n;let r,i,a,o,s=(n=Math.round(t/.0254),(i=new DataView((r=new Uint8Array(9)).buffer)).setUint32(0,n,!1),i.setUint32(4,n,!1),r[8]=1,dJ(a=new Uint8Array(8+r.length+4),0,r.length),a.set(dX,4),a.set(r,8),(o=new Uint8Array(4+r.length)).set(dX,0),o.set(r,4),dJ(a,8+r.length,(e=>{let t=0xffffffff;for(let n=0;n<e.length;n++)t=dQ[(t^e[n])&255]^t>>>8;return(0xffffffff^t)>>>0})(o)),a),l=((e,t)=>{let n=8;for(;n+8<=e.length;){let r=e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3],i=n+4,a=e.subarray(i,i+4),o=8+r+4;if(t.every((e,t)=>a[t]===e))return{offset:n,totalLength:o};n+=o}return null})(e,dX);if(l){let t=new Uint8Array(e.length-l.totalLength+s.length);return t.set(e.slice(0,l.offset),0),t.set(s,l.offset),t.set(e.slice(l.offset+l.totalLength),l.offset+s.length),t}let c=16+(e[8]<<24|e[9]<<16|e[10]<<8|e[11])+4;if(c>e.length)return e;let u=new Uint8Array(e.length+s.length);return u.set(e.slice(0,c),0),u.set(s,c),u.set(e.slice(c),c+s.length),u})(l,f):((e,t)=>{let n,r=(e=>{let t=2;for(;t+4<e.length&&255===e[t];){let n=e[t+1];if(216===n||217===n){t+=2;continue}let r=e[t+2]<<8|e[t+3];if(r<2)break;if(224===n&&74===e[t+4]&&70===e[t+5]&&73===e[t+6]&&70===e[t+7]&&0===e[t+8])return t;let i=t+2+r;if(i<=t||i>e.length)break;t=i}return -1})(e);if(r>=0){let n=new Uint8Array(e),i=r+11;return n[i]=1,n[i+1]=t>>8&255,n[i+2]=255&t,n[i+3]=t>>8&255,n[i+4]=255&t,n}let i=((n=new Uint8Array(18))[0]=255,n[1]=224,n[2]=0,n[3]=16,n[4]=74,n[5]=70,n[6]=73,n[7]=70,n[8]=0,n[9]=1,n[10]=1,n[11]=1,n[12]=t>>8&255,n[13]=255&t,n[14]=t>>8&255,n[15]=255&t,n),a=new Uint8Array(e.length+i.length);return a.set(e.subarray(0,2),0),a.set(i,2),a.set(e.subarray(2),2+i.length),a})(l,f),`data:${d};base64,${(e=>{if("function"==typeof btoa){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}let t=dZ();if(t)return t.from(e).toString("base64");throw Error("No base64 encoder available")})(c)}`)},async toBlob({mimeType:e,quality:t,...n}={}){let r=await a._toCanvas({mimeType:e,...n}),i=await new Promise(n=>{r.toBlob(n,e,t)});return n_.Util.releaseCanvas(r),i},async saveAsImage({fileName:e,...t}={}){let n=(t.mimeType||"image/png").split("/")[1];d_(await a.toDataURL(t),e||"polotno."+n)},async _toPDF(t){let n=t.dpi||e.dpi,r=t.parallel||1,i=t.unit||("px"===e.unit?"mm":e.unit),o=t.pixelRatio||1,s=t.pageIds||e.pages.map(e=>e.id),l=e.pages.filter(e=>s.includes(e.id)),c=await (window.jspdf?.jsPDF?Promise.resolve(window.jspdf.jsPDF):dE||(dE="function"==typeof window.__polotnoLoadJspdf?window.__polotnoLoadJspdf().then(e=>e?.jsPDF||e):new Promise(e=>{var t=document.createElement("script");t.onload=function(){e(window.jspdf.jsPDF)},t.src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/3.0.1/jspdf.umd.min.js",document.head.appendChild(t)}))),u=e=>d0({px:e,unit:i,dpi:n}),d=t.cropMarkSize||0,h=u(d),f=l[0]||{},p=t.includeBleed?f.bleed:0,m=u(f.computedWidth+2*p+2*h),g=u(f.computedHeight+2*p+2*h);var y=new c({unit:i,orientation:m>g?"landscape":"portrait",format:[m,g],compress:!0,putOnlyUsedFonts:!0});y.deletePage(1);let v=((e,t)=>{let n=[];for(let r=0;r<e.length;r+=t)n.push(e.slice(r,r+t));return n})(l,r),b=0;for(let e of v){let n=e.map(async e=>{let n=t.includeBleed?e.bleed:0,r=e.computedWidth+2*n+2*d,i=e.computedHeight+2*n+2*d,l=u(r),c=u(i),h=0,f=o;for(;h<10;){h+=1;let n=await a.toDataURL({...t,pageId:e.id,pixelRatio:f,dpiMetadata:"never"});if(n.length>20)return f!==o&&console.error(`Polotno can not export PDF with current settings. Quality is automatically reduced. pixelRatio was reduced to ${parseFloat(f.toFixed(3))}.`),t.onProgress&&t.onProgress(++b/s.length*.9),{url:n,width:l,height:c,widthPx:r,heightPx:i};f*=.8}});(await Promise.all(n)).filter(e=>void 0!==e).forEach(({url:e,width:t,height:n,widthPx:r,heightPx:a})=>{var o;y.addPage([t,n],t>n?"landscape":"portrait");let s=y.getCurrentPageInfo();switch(i){case"pt":o=1;break;case"mm":o=72/25.4;break;case"cm":o=72/2.54;break;case"in":o=72;break;case"px":o=.75;break;default:throw"Invalid unit: "+i}if(s.pageContext.cropBox={bottomLeftX:0,bottomLeftY:0,topRightX:t*o,topRightY:n*o},s.pageContext.artBox={bottomLeftX:u(d+p)*o,bottomLeftY:u(d+p)*o,topRightX:u(r-d-p)*o,topRightY:u(a-d-p)*o},s.pageContext.bleedBox={bottomLeftX:u(d+p)*o,bottomLeftY:u(d+p)*o,topRightX:u(r-d-p)*o,topRightY:u(a-d-p)*o},h){y.setLineWidth(u(1));let e=h+u(p);y.line(e,0,e,h),y.line(0,e,h,e),y.line(t-e,0,t-e,h),y.line(t,e,t-h,e),y.line(0,n-e,h,n-e),y.line(e,n,e,n-h),y.line(t,n-e,t-h,n-e),y.line(t-e,n,t-e,n-h)}y.addImage(e,h,h,t-2*h,n-2*h,void 0,"FAST")})}return y},toPDFDataURL:async e=>(await a._toPDF({mimeType:"image/jpeg",...e})).output("datauristring"),async toGIFDataURL(t={}){let n=t.pixelRatio||1,r=await dT({width:e.width*n,height:e.height*n}),i=1e3/(t.fps||10),o=e.duration/i;for(let t=0;t<o-1;t++){let o=t*i||1;a.setCurrentTime(o);let s=0,l="";for(let t of e.pages)if(s+=t.duration,t.set({_rendering:s>o}),s>o){l=t.id;break}let c=await a._toCanvas({pixelRatio:n,pageId:l,_skipTimeout:!0});r.addFrame(c.getContext("2d"),{delay:i,copy:!0})}for(let t of e.pages)t.set({_rendering:!1});return a.stop(),r.render(),new Promise(e=>{r.on("finished",function(t){var n;(n=new FileReader).onload=function(t){e(t.target.result)},n.readAsDataURL(t)})})},async saveAsGIF({fileName:e,...t}={}){d_(await a.toGIFDataURL(t),e||"polotno.gif")},toHTML:async({elementHook:e}={})=>hh({json:a.toJSON(),elementHook:e}),async saveAsHTML({fileName:e,elementHook:t}={}){let n=await a.toHTML({elementHook:t});d_("data:text/html;base64,"+window.btoa(unescape(encodeURIComponent(n))),e||"polotno.html")},async toSVG({elementHook:e,pageId:t,fontEmbedding:n="inline"}={fontEmbedding:"inline"}){let r=a.toJSON();t=t||r.pages[0]?.id;let i=r.pages.find(e=>e.id===t);return hE({json:{...r,pages:i?[i]:[]},elementHook:e,fontEmbedding:n})},async saveAsSVG({fileName:e,elementHook:t,pageId:n,fontEmbedding:r="inline"}={}){let i=await a.toSVG({elementHook:t,pageId:n,fontEmbedding:r});d_("data:text/svg;base64,"+window.btoa(unescape(encodeURIComponent(i))),e||"polotno.svg")},async saveAsPDF({fileName:e,...t}={}){(await a._toPDF({mimeType:"image/jpeg",...t})).save(e||"polotno.pdf")},async waitLoading({_skipTimeout:e=!1}={}){e||await new Promise(e=>setTimeout(e,50)),await new Promise(e=>{var t;return t=()=>{rZ?setTimeout(e,300):e(!0)},void(0===r1?t():r2.push(t))})},toJSON:()=>({width:e.width,height:e.height,fonts:(0,iY.getSnapshot)(e.fonts),pages:(0,iY.getSnapshot)(e.pages),audios:(0,iY.getSnapshot)(e.audios),unit:e.unit,dpi:e.dpi,custom:e.custom,schemaVersion:e.schemaVersion}),loadJSON(t,n=!1){let r=JSON.parse(JSON.stringify(t)),i=r.schemaVersion||0;i<1&&iS.htmlRenderEnabled&&hK({children:r.pages},e=>{if("text"===e.type){let t=16*e.letterSpacing;e.letterSpacing=t/e.fontSize}}),i<2&&hK({children:r.pages},e=>{e.filters&&Object.keys(e.filters).forEach(t=>{if(["warm","cold","natural"].includes(t))return;let n=e.filters[t];n&&"number"==typeof n.intensity&&(n.intensity=n.intensity/100)})}),delete r.schemaVersion;let a=e.activePage?e.pages.indexOf(e.activePage):0,o=(r.pages[a]||r.pages[0])?.id;r._activePageId=o;let s={...(0,iY.getSnapshot)(e)};Object.assign(s,r),n?s.history=(0,iY.getSnapshot)(e.history):s.history={history:[],undoIdx:-1,targetPath:""},(0,iY.applySnapshot)(e,s)},clear({keepHistory:t=!1}={}){let n=e.pages.map(e=>e.id);a.deletePages(n),e.custom=null,t||e.history.clear()},addFont(t){a.removeFont(t.fontFamily),e.fonts.push(t)},removeFont(t){e.fonts.filter(e=>e.fontFamily===t).forEach(e=>(0,iY.destroy)(e))},addAudio(t){let n=hP.create({id:dC(10),...t});e.audios.push(n)},removeAudio(t){let n=e.audios.find(e=>e.id===t);n&&e.audios.remove(n)},async loadFont(t,n,r){let a=e.fonts.find(e=>e.fontFamily===t)||is.find(e=>e.fontFamily===t),o=[{fontStyle:"normal",fontWeight:"normal"},{fontStyle:"normal",fontWeight:"bold"}];return a?(a.styles&&(o=a.styles.map(e=>({fontStyle:e.fontStyle||"normal",fontWeight:e.fontWeight||"normal"}))),!function(e){let t=e.fontFamily;if(iw[t]||!e.url&&!e.styles)return;let n=e.styles||(e.url?[{src:`url("${e.url}")`}]:[]),r=(i||!(i=document.getElementById("polotno-font-style"))&&((i=document.createElement("style")).id="polotno-font-style",document.head.appendChild(i)),i).sheet;n.forEach(e=>{r.insertRule(`
|
|
335
335
|
@font-face{
|
|
336
336
|
font-family:'${t}';
|
|
337
337
|
src:${e.src};
|
|
338
338
|
font-style:${e.fontStyle||"normal"};
|
|
339
339
|
font-weight:${e.fontWeight||"normal"};
|
|
340
340
|
font-display:swap; /* optional but recommended */
|
|
341
|
-
}`,r.cssRules.length)}),iw[e.fontFamily]=!0}(r)):!function(e){if(iy[e])return;let t=ix(e),n=document.createElement("link");n.type="text/css",n.href=t,n.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(n),iy[e]=!0}(t),Promise.all(a.map(e=>ig(t,e.fontStyle,e.fontWeight,n)))},validate:e=>hA.validate(e,[{path:"",type:hA}]).map(e=>({path:"store"+e.context.map(e=>e.path).join("."),message:e.message}))};return a}),hI=iY.types.model("Node",{id:iY.types.identifier,type:"none",name:"",opacity:1,custom:iY.types.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{for(var t in e)null===e[t]&&(e[t]=void 0);return e}).postProcessSnapshot(e=>{let t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n}).views(e=>({get page(){return(0,iY.getParentOfType)(e,hT)},get store(){return(0,iY.getParentOfType)(e,hA)},get top(){let t=e;for(;;)if(!(0,iY.hasParentOfType)(t,hQ))return t;else t=(0,iY.getParentOfType)(t,hQ)},get parent(){if((0,iY.hasParentOfType)(e,hQ)){let t=(0,iY.getParentOfType)(e,hQ);return t&&t.children&&t.children.length,t}if((0,iY.hasParentOfType)(e,hT)){let t=(0,iY.getParentOfType)(e,hT);return t&&t.children&&t.children.length,t}if((0,iY.hasParentOfType)(e,hA)){let t=(0,iY.getParentOfType)(e,hA);return t&&t.pages&&t.pages.length,t}return null},get zIndex(){return e.parent.children.indexOf(e)}})).actions(e=>({toJSON:()=>({...(0,iY.getSnapshot)(e)})})).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));return t.id=t.id||dC(10),hK(r,e=>{e.id=dC(10)}),Object.assign(r,t),e.page.addElement(r,{skipSelect:n})},set(t){Object.assign(e,t)},moveUp(){e.page.moveElementsUp([e.id])},moveTop(){e.page.moveElementsTop([e.id])},moveDown(){e.page.moveElementsDown([e.id])},moveBottom(){e.page.moveElementsBottom([e.id])},setZIndex(t){e.parent.setElementZIndex(e.id,t)},beforeDestroy(){}}));var iY=x("58B0H");let hR={right:{from:{x:-200},to:{x:0}},left:{from:{x:200},to:{x:0}},up:{from:{y:200},to:{y:0}},down:{from:{y:-200},to:{y:0}},"bottom-right":{from:{x:-200,y:-200},to:{x:0,y:0}},"bottom-left":{from:{x:200,y:-200},to:{x:0,y:0}},"top-right":{from:{x:-200,y:200},to:{x:0,y:0}},"top-left":{from:{x:200,y:200},to:{x:0,y:0}}},hL={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},hM={none:()=>({}),fade:({dTime:e,element:t,animation:n})=>{let r=e/n.duration;return"enter"===n.type?{opacity:r*t.opacity}:{opacity:(1-r)*t.opacity}},rotate:({dTime:e,element:t,animation:n})=>{var r,i;let a,o,s,l,c,u=n.duration;return r={x:t.x,y:t.y,width:t.width,height:t.height,rotation:t.rotation},i=e/u*360,a=oj(r.rotation||0),o={x:r.x+r.width/2*Math.cos(a)+r.height/2*Math.sin(-a),y:r.y+r.height/2*Math.cos(a)+r.width/2*Math.sin(a)},s=oj(i),l=o.x+(r.x-o.x)*Math.cos(s)-(r.y-o.y)*Math.sin(s),c=o.y+(r.x-o.x)*Math.sin(s)+(r.y-o.y)*Math.cos(s),{...r,rotation:r.rotation+i,x:l,y:c}},blink:({dTime:e,element:t,animation:n})=>{let r=n.duration,i=e%r/(r/2);return{opacity:t.opacity*(i<=1?i:2-i)}},bounce:({dTime:e,element:t,animation:n})=>{let r=n.duration,i=n.data.strength??1,a={},o={x:t.x+t.width/3*i,y:t.y+t.height/3*i,width:t.width/3*i,height:t.height/3*i,fontSize:t.fontSize/3*i},s={x:t.x,y:t.y,width:t.width,height:t.height,fontSize:t.fontSize},l=e%r/(r/2),c=l<=1?l:2-l;for(let e in o){let t=o[e],n=s[e]-t;a[e]=t+c*n}return a},move:({dTime:e,element:t,animation:n})=>{let r=hR[n.data.direction]||hR.right,i=n.data.strength??1,a={};for(var o in r.from){let s=r.from[o],l=r.to[o];"exit"===n.type&&(s=r.to[o],l=-r.from[o]),s*=i,l*=i;let c=t[o]+s,u=t[o]+l-c;a[o]=c+e/n.duration*u}return a},zoom:({dTime:e,element:t,animation:n})=>{let r={},i=1+(("in"===(n.data.direction||"in")?3/4:5/4)-1)*(n.data.strength??1),a=t.rotation*Math.PI/180,o=Math.cos(a),s=Math.sin(a),l=t.width*(1-i),c=t.height*(1-i),u={x:t.x+(l*o-c*s)/2,y:t.y+(l*s+c*o)/2,width:t.width*i,height:t.height*i,fontSize:t.fontSize*i},d={x:t.x,y:t.y,width:t.width,height:t.height,fontSize:t.fontSize};for(var h in u){let t=u[h],i=d[h];if("exit"===n.type){let e=t;t=i,i=e}let a=i-t;r[h]=t+e/n.duration*a}return r},cameraZoom:({dTime:e,element:t,animation:n})=>{let r,i,a={},o=hL[n.data.direction||"right"]||hL.right,s=n.data.movementStrength??.1,l=n.data.shakeStrength??.015,c=n.data.zoomStrength??.6,u=e/n.duration,d=l*(1-u),h=Math.sin(12*u)*d*.7+Math.sin(8*u)*d*.3;"exit"===n.type&&(c=Math.min(c,1-Math.max(t.cropWidth||1,t.cropHeight||1))),n.type;let f=1-Math.pow(1-u,2),p=t.cropX||0,m=t.cropY||0,g=t.cropWidth||1,y=t.cropHeight||1,v=0,b=0;return o.cropX&&(v=Math.min(o.cropX>0?1-(p+g):p,Math.abs(s))*o.cropX),o.cropY&&(b=Math.min(o.cropY>0?1-(m+y):m,Math.abs(s))*o.cropY),"enter"===n.type?(r=o.cropX?p+v*(1-f):p,i=o.cropY?m+b*(1-f):m):(r=o.cropX?p+v*f:p,i=o.cropY?m+b*f:m),a.cropX=Math.max(0,Math.min(1-g,r+h*g)),a.cropY=Math.max(0,Math.min(1-y,i+h*y)),a.cropWidth=g,a.cropHeight=y,a}},hN=({element:e,dTime:t,animation:n})=>{let r=hM[n.name];return r?r({element:e,dTime:t,animation:n}):(console.error("Can not find animation type: "+n.name),{})};var E=x("2SBKn");let hj=iY.types.model("Animation",{delay:0,duration:500,enabled:!0,type:iY.types.enumeration("Type",["enter","exit","loop"]),name:"none",data:iY.types.frozen({})}),hD=(e,t)=>{let n={};for(let r in t)if("number"==typeof e[r]&&"number"==typeof t[r]){let i=t[r]-e[r];0!==i&&(n[r]=i)}return n},hz=iY.types.model("ShapeFilter",{intensity:1}),hB=["temperature","contrast","highlights","shadows","white","black","saturation","vibrance"],hF=hI.named("Shape").props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:iY.types.array(hj),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:iY.types.map(hz),shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,visible:!0,draggable:!0,resizable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{let t={...e,x:"x"in e&&e.x||0,y:"y"in e&&e.y||0,filters:"filters"in e?Array.isArray(e.filters)?{}:e.filters:void 0};return"width"in e&&(t.width=t.width||1),"height"in e&&(t.height=t.height||1),"locked"in e&&e.locked&&(t.draggable=!1,t.contentEditable=!1,t.styleEditable=!1,t.resizable=!1,t.removable=!1),t}).views(e=>{let t={x:e.x??0,y:e.y??0,width:e.width??0,height:e.height??0,rotation:e.rotation??0,opacity:e.opacity??1};for(let n of["x","y","width","height","rotation","opacity","color","fontSize","cropX","cropY","cropWidth","cropHeight"])n in e&&(t[n]=e[n]);let n=(0,E.observable)(t),r=(0,E.action)(e=>{for(let t in e)n[t]=e[t]}),i=(0,E.action)(e=>{Object.assign(n,e)}),a=(0,E.action)(e=>{for(let t in e)"number"==typeof n[t]&&(n[t]=n[t]+e[t])});return{get locked(){return!e.draggable&&!e.contentEditable&&!e.styleEditable&&!e.resizable},get a(){let{currentTime:t}=e.store,o={};for(let t in n)o[t]=e[t];if(r(o),0===t)return n;let s=t-e.page.startTime;if(s>e.page.duration||s<0)return n;let l=e.store.animatedElementsIds;if(l.length&&!l.includes(e.id))return n;let c=e.animations.find(e=>"enter"===e.type),u=c?.enabled&&s<c.delay;u&&i({opacity:0});let d=c?.enabled&&s>=c.delay&&s<=c.delay+c.duration;if(d){let t=s-c.delay,n=hN({element:e,animation:c,dTime:t});a(hD(e,n))}let h=e.animations.find(e=>"exit"===e.type);if(!u&&!d&&h?.enabled&&s>=e.page.duration-h.duration-h.delay&&s<=e.page.duration-h.delay){let t=s-(e.page.duration-h.duration-h.delay),n=hN({element:e,animation:h,dTime:t});a(hD(e,n))}h?.enabled&&s>=e.page.duration-h.delay&&i({opacity:0});let f=e.animations.find(e=>"loop"===e.type);if(f?.enabled){let t=hN({element:e,animation:f,dTime:s});a(hD(e,t))}return n},animated(e){return this.a[e]}}}).actions(e=>({setAnimation(t,n){let r=e.animations.find(e=>e.type===t);r?Object.assign(r,n):e.animations.push({type:t,...n})},setFilter(t,n){hB.includes(t)||e.filters.forEach((t,n)=>{hB.includes(n.toString())||e.filters.delete(n.toString())}),null==n?e.filters.delete(t):e.filters.set(t,{intensity:n})}}));var iY=x("58B0H");let hH=hF.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",textTransform:"none",fill:"black",align:"center",width:100,height:0,verticalAlign:"top",strokeWidth:0,stroke:"black",lineHeight:iY.types.optional(iY.types.union(iY.types.number,iY.types.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:"#7ED321",backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5,curveEnabled:!1,curvePower:.5}).preProcessSnapshot(e=>({...e})).actions(e=>({toggleEditMode(t){e._editModeEnabled=t??!e._editModeEnabled,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}}));var E=x("2SBKn");let hV=hF.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,keepRatio:!1,stretchEnabled:!1}).extend(e=>{let t=E.observable.box(!1),n=!1;return{views:{get _cropModeEnabled(){return t.get()}},actions:{toggleCropMode(r){let i=r??!t.get();t.set(i),i&&!n?(e.store.history.startTransaction(),n=!0):!i&&n&&(e.store.history.endTransaction(),n=!1)},beforeDestroy(){n&&(e.store.history.endTransaction(),n=!1)}}}}),hU=hV.named("Video").props({type:"video",duration:0,startTime:0,endTime:1,volume:1});var iY=x("58B0H");let h$=hF.named("Line").props({type:"line",width:400,height:10,color:"black",dash:iY.types.array(iY.types.number),startHead:"",endHead:""}).actions(e=>({}));var iY=x("58B0H");let hq=hF.named("SVG").props({type:"svg",src:"",maskSrc:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,stretchEnabled:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,cornerRadius:0,colorsReplace:iY.types.map(iY.types.string)}).preProcessSnapshot(e=>({...e,src:e.src||e.svgSource,colorsReplace:Array.isArray(e.colorsReplace)?{}:e.colorsReplace})).actions(e=>({replaceColor(t,n){e.colorsReplace.set(t,n)}}));var iY=x("58B0H");let hW=hF.named("Figure").props({type:"figure",subType:"rect",fill:"rgb(0, 161, 255)",dash:iY.types.array(iY.types.number),strokeWidth:0,stroke:"rgba(98, 197, 255, 1)",cornerRadius:0}),hG=hV.named("Gif").props({type:"gif",duration:0,keepRatio:!0}),hK=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;hK(n,t)}},hY=[...Array(20)].map((e,t)=>iY.types.late(()=>hZ[t])),hX=iY.types.union({dispatcher:e=>{let t=hJ[e.type];if(!t)throw Error(`Unknown element type: "${e.type}"`);return t}},hq,hH,hV,h$,hU,hW,hG,iY.types.late(()=>hQ),...hY),hQ=hI.named("Group").props({type:"group",children:iY.types.array(hX)}).views(e=>({get draggable(){let t=!0;return hK(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return hK(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return hK(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return hK(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return hK(e,e=>{e.locked||(t=!1)}),t}})).actions(e=>({set({draggable:t,contentEditable:n,styleEditable:r,resizable:i,...a}){void 0!==t&&hK(e,e=>{e.set({draggable:t})}),void 0!==n&&hK(e,e=>{e.set({contentEditable:n})}),void 0!==r&&hK(e,e=>{e.set({styleEditable:r})}),void 0!==i&&hK(e,e=>{e.set({resizable:i})}),Object.assign(e,a)},addElement(t,{skipSelect:n=!1}={}){let r=hJ[t.type];if(!r)return void console.error("Can not find model with type "+t.type);t.children&&t.children.forEach(e=>{e.id=e.id||dC(10)});let i=r.create({id:dC(10),...t});return e.children.push(i),i.selectable&&!n&&e.store.selectElements([i.id]),i},setElementZIndex(t,n){let r=e.children.find(e=>e.id===t);r&&((0,iY.detach)(r),e.children.remove(r),e.children.splice(n,0,r))},setAnimation(t,n){hK(e,e=>{e.setAnimation(t,n)})}})),hZ=[],hJ={svg:hq,text:hH,image:hV,group:hQ,line:h$,video:hU,figure:hW,gif:hG};function h0(e,t){let n=e.type;if(!n)throw Error('You must pass "type" attribute to custom model.');let r=hF.named(n).props(e);t&&(r=t(r)),hJ[n]=r,hZ.push(r)}let h1={text:i8,image:aT,svg:aT,line:oZ,video:u7,figure:da,group:j(e=>{let{element:t,store:n}=e,{children:r}=t,i=t.selectable||"admin"===n.role;return(0,C.jsx)(rE,{opacity:t.opacity,listening:i,hideInExport:!t.showInExport,id:t.id,children:r.map(t=>(0,S.createElement)(h4,{...e,key:t.id,store:n,element:t}))})}),gif:dv};function h2(e,t){h1[e]=t}let h4=j(e=>{var t;let n,r,i,a,o,s,l,c,{element:u,store:d}=e,[h,f]=m(S).useState(!1),p=d.selectedElements.indexOf(u)>=0&&u.selectable,g=u.parent?.type==="group",y=(e=>{let[t,n]=m(S).useState();return m(S).useEffect(()=>{let t=setTimeout(()=>{let t=e.page.id,r=n_.stages.find(e=>e.getAttr("pageId")===t);r||console.error("No stage is found for element",e.id),n(r)});return()=>clearTimeout(t)},[e.id]),t})(u),v=y?.findOne("Transformer");m(S).useEffect(()=>{if(y){let e=e=>{let t=e.target.findAncestor(".element",!0),n=d.getElementById(t?.id()),r=n?.top;f(r?.id===u.id)};y.on("mouseover",e);let t=()=>{f(!1)};return y.on("mouseleave",t),()=>{y.off("mouseover",e),y.off("mouseleave",t)}}},[y]);let b=h1[e.element.type];return("text"===e.element.type&&iS.htmlRenderEnabled&&(b=oN),e.element.visible)?b?(0,C.jsxs)(rE,{name:"element-container",children:[(0,C.jsx)(b,{...e}),h&&!p&&!g&&(0,C.jsx)(dw,{element:"group"===u.type?{a:(t=v?.rotation()||0,n=[],hK(u,e=>{"group"!==e.type&&n.push(e.a)}),r=[],n.forEach(e=>{let t=[{x:0,y:0},{x:0+e.width,y:0},{x:0+e.width,y:0+e.height},{x:0,y:0+e.height}],n=new n_.Transform;n.translate(e.x,e.y),n.rotate(n_.Util.degToRad(e.rotation)),t.forEach(e=>{let t=n.point(e);r.push(t)})}),(i=new n_.Transform).rotate(-n_.Util.degToRad(t)),a=1/0,o=1/0,s=-1/0,l=-1/0,r.forEach(e=>{let t=i.point(e);a=Math.min(a,t.x),o=Math.min(o,t.y),s=Math.max(s,t.x),l=Math.max(l,t.y)}),i.invert(),{x:(c=i.point({x:a,y:o})).x,y:c.y,width:s-a,height:l-o,rotation:t})}:u})]}):(console.error("Can not find component for "+e.element.type),null):null});var S=x("8NFma");let h3=j(({store:e,page:t,width:n,height:r,scale:i,xPadding:a,yPadding:o,bleed:s})=>{let[l,c]=m(S).useState(!1),[u,d]=m(S).useState([]),h=m(S).useRef(null),f="draw"===e.tool,{strokeWidth:p,stroke:g,opacity:y,brushType:v}=e.toolOptions,b=m(S).useCallback(e=>{if(!f||(c(!0),e.cancelBubble=!0,!e.target.getStage()))return;let t=h.current.getRelativePointerPosition();t&&d([{x:t.x,y:t.y}])},[f,i,a,o,s]),x=m(S).useCallback(e=>{if(!f||!l||(e.cancelBubble=!0,!e.target.getStage()))return;let t=h.current.getRelativePointerPosition();t&&d(e=>[...e,{x:t.x,y:t.y}])},[f,l,i,a,o,s]),w=m(S).useCallback(()=>{if(f&&l){if(c(!1),u.length>=1)try{let n=function(e,t){if(0===e.length)throw Error("Cannot create SVG from empty path");let n=t.smooth?function(e,t=.5){if(e.length<3)return e;let n=[];n.push(e[0]);for(let t=0;t<e.length-1;t++){let r=e[Math.max(0,t-1)],i=e[t],a=e[t+1],o=e[Math.min(e.length-1,t+2)];for(let e=0;e<10;e++){let t=e/10,s=t*t,l=s*t,c=.5*(2*i.x+(-r.x+a.x)*t+(2*r.x-5*i.x+4*a.x-o.x)*s+(-r.x+3*i.x-3*a.x+o.x)*l),u=.5*(2*i.y+(-r.y+a.y)*t+(2*r.y-5*i.y+4*a.y-o.y)*s+(-r.y+3*i.y-3*a.y+o.y)*l);n.push({x:c,y:u})}}return n.push(e[e.length-1]),n}(e):e,r=function(e){if(0===e.length)return{x:0,y:0,width:0,height:0};let t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{x:t,y:n,width:r-t,height:i-n}}(n),i=t.strokeWidth,a=r.x-i,o=r.y-i,s=r.width+2*i,l=r.height+2*i,c=function(e){if(0===e.length)return"";if(1===e.length){let t=e[0];return`M ${t.x},${t.y} L ${t.x+.1},${t.y}`}let t=`M ${e[0].x},${e[0].y}`;for(let n=1;n<e.length-1;n++){let r=e[n],i=e[n+1],a=(r.x+i.x)/2,o=(r.y+i.y)/2;t+=` Q ${r.x},${r.y} ${a},${o}`}if(e.length>1){let n=e[e.length-1];t+=` L ${n.x},${n.y}`}return t}(n.map(e=>({x:e.x-a,y:e.y-o})));return{src:ar(`
|
|
341
|
+
}`,r.cssRules.length)}),iw[e.fontFamily]=!0}(a)):!function(e){if(iy[e])return;let t=ix(e),n=document.createElement("link");n.type="text/css",n.href=t,n.rel="stylesheet",document.getElementsByTagName("head")[0].appendChild(n),iy[e]=!0}(t),n&&r&&!o.some(e=>e.fontStyle===n&&e.fontWeight===r)&&o.push({fontStyle:n,fontWeight:r}),Promise.all(o.map(e=>ig(t,e.fontStyle,e.fontWeight)))},validate:e=>hA.validate(e,[{path:"",type:hA}]).map(e=>({path:"store"+e.context.map(e=>e.path).join("."),message:e.message}))};return a}),hI=iY.types.model("Node",{id:iY.types.identifier,type:"none",name:"",opacity:1,custom:iY.types.frozen(),visible:!0,selectable:!0,removable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{for(var t in e)null===e[t]&&(e[t]=void 0);return e}).postProcessSnapshot(e=>{let t={...e},n={};for(var r in t)"_"!==r[0]&&(n[r]=e[r]);return n}).views(e=>({get page(){return(0,iY.getParentOfType)(e,hT)},get store(){return(0,iY.getParentOfType)(e,hA)},get top(){let t=e;for(;;)if(!(0,iY.hasParentOfType)(t,hQ))return t;else t=(0,iY.getParentOfType)(t,hQ)},get parent(){if((0,iY.hasParentOfType)(e,hQ)){let t=(0,iY.getParentOfType)(e,hQ);return t&&t.children&&t.children.length,t}if((0,iY.hasParentOfType)(e,hT)){let t=(0,iY.getParentOfType)(e,hT);return t&&t.children&&t.children.length,t}if((0,iY.hasParentOfType)(e,hA)){let t=(0,iY.getParentOfType)(e,hA);return t&&t.pages&&t.pages.length,t}return null},get zIndex(){return e.parent.children.indexOf(e)}})).actions(e=>({toJSON:()=>({...(0,iY.getSnapshot)(e)})})).actions(e=>({clone(t={},{skipSelect:n=!1}={}){let r=JSON.parse(JSON.stringify(e.toJSON()));return t.id=t.id||dC(10),hK(r,e=>{e.id=dC(10)}),Object.assign(r,t),e.page.addElement(r,{skipSelect:n})},set(t){Object.assign(e,t)},moveUp(){e.page.moveElementsUp([e.id])},moveTop(){e.page.moveElementsTop([e.id])},moveDown(){e.page.moveElementsDown([e.id])},moveBottom(){e.page.moveElementsBottom([e.id])},setZIndex(t){e.parent.setElementZIndex(e.id,t)},beforeDestroy(){}}));var iY=x("58B0H");let hR={right:{from:{x:-200},to:{x:0}},left:{from:{x:200},to:{x:0}},up:{from:{y:200},to:{y:0}},down:{from:{y:-200},to:{y:0}},"bottom-right":{from:{x:-200,y:-200},to:{x:0,y:0}},"bottom-left":{from:{x:200,y:-200},to:{x:0,y:0}},"top-right":{from:{x:-200,y:200},to:{x:0,y:0}},"top-left":{from:{x:200,y:200},to:{x:0,y:0}}},hL={right:{cropX:-1},left:{cropX:1},up:{cropY:1},down:{cropY:-1}},hM={none:()=>({}),fade:({dTime:e,element:t,animation:n})=>{let r=e/n.duration;return"enter"===n.type?{opacity:r*t.opacity}:{opacity:(1-r)*t.opacity}},rotate:({dTime:e,element:t,animation:n})=>{var r,i;let a,o,s,l,c,u=n.duration;return r={x:t.x,y:t.y,width:t.width,height:t.height,rotation:t.rotation},i=e/u*360,a=oj(r.rotation||0),o={x:r.x+r.width/2*Math.cos(a)+r.height/2*Math.sin(-a),y:r.y+r.height/2*Math.cos(a)+r.width/2*Math.sin(a)},s=oj(i),l=o.x+(r.x-o.x)*Math.cos(s)-(r.y-o.y)*Math.sin(s),c=o.y+(r.x-o.x)*Math.sin(s)+(r.y-o.y)*Math.cos(s),{...r,rotation:r.rotation+i,x:l,y:c}},blink:({dTime:e,element:t,animation:n})=>{let r=n.duration,i=e%r/(r/2);return{opacity:t.opacity*(i<=1?i:2-i)}},bounce:({dTime:e,element:t,animation:n})=>{let r=n.duration,i=n.data.strength??1,a={},o={x:t.x+t.width/3*i,y:t.y+t.height/3*i,width:t.width/3*i,height:t.height/3*i,fontSize:t.fontSize/3*i},s={x:t.x,y:t.y,width:t.width,height:t.height,fontSize:t.fontSize},l=e%r/(r/2),c=l<=1?l:2-l;for(let e in o){let t=o[e],n=s[e]-t;a[e]=t+c*n}return a},move:({dTime:e,element:t,animation:n})=>{let r=hR[n.data.direction]||hR.right,i=n.data.strength??1,a={};for(var o in r.from){let s=r.from[o],l=r.to[o];"exit"===n.type&&(s=r.to[o],l=-r.from[o]),s*=i,l*=i;let c=t[o]+s,u=t[o]+l-c;a[o]=c+e/n.duration*u}return a},zoom:({dTime:e,element:t,animation:n})=>{let r={},i=1+(("in"===(n.data.direction||"in")?3/4:5/4)-1)*(n.data.strength??1),a=t.rotation*Math.PI/180,o=Math.cos(a),s=Math.sin(a),l=t.width*(1-i),c=t.height*(1-i),u={x:t.x+(l*o-c*s)/2,y:t.y+(l*s+c*o)/2,width:t.width*i,height:t.height*i,fontSize:t.fontSize*i},d={x:t.x,y:t.y,width:t.width,height:t.height,fontSize:t.fontSize};for(var h in u){let t=u[h],i=d[h];if("exit"===n.type){let e=t;t=i,i=e}let a=i-t;r[h]=t+e/n.duration*a}return r},cameraZoom:({dTime:e,element:t,animation:n})=>{let r,i,a={},o=hL[n.data.direction||"right"]||hL.right,s=n.data.movementStrength??.1,l=n.data.shakeStrength??.015,c=n.data.zoomStrength??.6,u=e/n.duration,d=l*(1-u),h=Math.sin(12*u)*d*.7+Math.sin(8*u)*d*.3;"exit"===n.type&&(c=Math.min(c,1-Math.max(t.cropWidth||1,t.cropHeight||1))),n.type;let f=1-Math.pow(1-u,2),p=t.cropX||0,m=t.cropY||0,g=t.cropWidth||1,y=t.cropHeight||1,v=0,b=0;return o.cropX&&(v=Math.min(o.cropX>0?1-(p+g):p,Math.abs(s))*o.cropX),o.cropY&&(b=Math.min(o.cropY>0?1-(m+y):m,Math.abs(s))*o.cropY),"enter"===n.type?(r=o.cropX?p+v*(1-f):p,i=o.cropY?m+b*(1-f):m):(r=o.cropX?p+v*f:p,i=o.cropY?m+b*f:m),a.cropX=Math.max(0,Math.min(1-g,r+h*g)),a.cropY=Math.max(0,Math.min(1-y,i+h*y)),a.cropWidth=g,a.cropHeight=y,a}},hN=({element:e,dTime:t,animation:n})=>{let r=hM[n.name];return r?r({element:e,dTime:t,animation:n}):(console.error("Can not find animation type: "+n.name),{})};var E=x("2SBKn");let hj=iY.types.model("Animation",{delay:0,duration:500,enabled:!0,type:iY.types.enumeration("Type",["enter","exit","loop"]),name:"none",data:iY.types.frozen({})}),hD=(e,t)=>{let n={};for(let r in t)if("number"==typeof e[r]&&"number"==typeof t[r]){let i=t[r]-e[r];0!==i&&(n[r]=i)}return n},hz=iY.types.model("ShapeFilter",{intensity:1}),hB=["temperature","contrast","highlights","shadows","white","black","saturation","vibrance"],hF=hI.named("Shape").props({x:0,y:0,width:100,height:100,rotation:0,opacity:1,animations:iY.types.array(hj),blurEnabled:!1,blurRadius:10,brightnessEnabled:!1,brightness:0,sepiaEnabled:!1,grayscaleEnabled:!1,filters:iY.types.map(hz),shadowEnabled:!1,shadowBlur:5,shadowOffsetX:0,shadowOffsetY:0,shadowColor:"black",shadowOpacity:1,visible:!0,draggable:!0,resizable:!0,selectable:!0,contentEditable:!0,styleEditable:!0,alwaysOnTop:!1,showInExport:!0}).preProcessSnapshot(e=>{let t={...e,x:"x"in e&&e.x||0,y:"y"in e&&e.y||0,filters:"filters"in e?Array.isArray(e.filters)?{}:e.filters:void 0};return"width"in e&&(t.width=t.width||1),"height"in e&&(t.height=t.height||1),"locked"in e&&e.locked&&(t.draggable=!1,t.contentEditable=!1,t.styleEditable=!1,t.resizable=!1,t.removable=!1),t}).views(e=>{let t={x:e.x??0,y:e.y??0,width:e.width??0,height:e.height??0,rotation:e.rotation??0,opacity:e.opacity??1};for(let n of["x","y","width","height","rotation","opacity","color","fontSize","cropX","cropY","cropWidth","cropHeight"])n in e&&(t[n]=e[n]);let n=(0,E.observable)(t),r=(0,E.action)(e=>{for(let t in e)n[t]=e[t]}),i=(0,E.action)(e=>{Object.assign(n,e)}),a=(0,E.action)(e=>{for(let t in e)"number"==typeof n[t]&&(n[t]=n[t]+e[t])});return{get locked(){return!e.draggable&&!e.contentEditable&&!e.styleEditable&&!e.resizable},get a(){let{currentTime:t}=e.store,o={};for(let t in n)o[t]=e[t];if(r(o),0===t)return n;let s=t-e.page.startTime;if(s>e.page.duration||s<0)return n;let l=e.store.animatedElementsIds;if(l.length&&!l.includes(e.id))return n;let c=e.animations.find(e=>"enter"===e.type),u=c?.enabled&&s<c.delay;u&&i({opacity:0});let d=c?.enabled&&s>=c.delay&&s<=c.delay+c.duration;if(d){let t=s-c.delay,n=hN({element:e,animation:c,dTime:t});a(hD(e,n))}let h=e.animations.find(e=>"exit"===e.type);if(!u&&!d&&h?.enabled&&s>=e.page.duration-h.duration-h.delay&&s<=e.page.duration-h.delay){let t=s-(e.page.duration-h.duration-h.delay),n=hN({element:e,animation:h,dTime:t});a(hD(e,n))}h?.enabled&&s>=e.page.duration-h.delay&&i({opacity:0});let f=e.animations.find(e=>"loop"===e.type);if(f?.enabled){let t=hN({element:e,animation:f,dTime:s});a(hD(e,t))}return n},animated(e){return this.a[e]}}}).actions(e=>({setAnimation(t,n){let r=e.animations.find(e=>e.type===t);r?Object.assign(r,n):e.animations.push({type:t,...n})},setFilter(t,n){hB.includes(t)||e.filters.forEach((t,n)=>{hB.includes(n.toString())||e.filters.delete(n.toString())}),null==n?e.filters.delete(t):e.filters.set(t,{intensity:n})}}));var iY=x("58B0H");let hH=hF.named("Text").props({type:"text",text:"",placeholder:"",fontSize:14,fontFamily:"Roboto",fontStyle:"normal",fontWeight:"normal",textDecoration:"",textTransform:"none",fill:"black",align:"center",width:100,height:0,verticalAlign:"top",strokeWidth:0,stroke:"black",lineHeight:iY.types.optional(iY.types.union(iY.types.number,iY.types.string),1.2),letterSpacing:0,_editModeEnabled:!1,backgroundEnabled:!1,backgroundColor:"#7ED321",backgroundOpacity:1,backgroundCornerRadius:.5,backgroundPadding:.5,curveEnabled:!1,curvePower:.5}).preProcessSnapshot(e=>({...e})).actions(e=>({afterCreate(){if(!e.height){let t=e.lineHeight,n="number"==typeof t?t:parseFloat(t)||1.2;e.height=Math.round(e.fontSize*n)}},toggleEditMode(t){e._editModeEnabled=t??!e._editModeEnabled,e._editModeEnabled?e.store.history.startTransaction():e.store.history.endTransaction()}}));var E=x("2SBKn");let hV=hF.named("Image").props({type:"image",width:100,height:100,src:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,cornerRadius:0,flipX:!1,flipY:!1,clipSrc:"",borderColor:"black",borderSize:0,keepRatio:!1,stretchEnabled:!1}).extend(e=>{let t=E.observable.box(!1),n=!1;return{views:{get _cropModeEnabled(){return t.get()}},actions:{toggleCropMode(r){let i=r??!t.get();t.set(i),i&&!n?(e.store.history.startTransaction(),n=!0):!i&&n&&(e.store.history.endTransaction(),n=!1)},beforeDestroy(){n&&(e.store.history.endTransaction(),n=!1)}}}}),hU=hV.named("Video").props({type:"video",duration:0,startTime:0,endTime:1,volume:1});var iY=x("58B0H");let h$=hF.named("Line").props({type:"line",width:400,height:10,color:"black",dash:iY.types.array(iY.types.number),startHead:"",endHead:""}).actions(e=>({}));var iY=x("58B0H");let hq=hF.named("SVG").props({type:"svg",src:"",maskSrc:"",cropX:0,cropY:0,cropWidth:1,cropHeight:1,keepRatio:!0,stretchEnabled:!0,flipX:!1,flipY:!1,width:100,height:100,borderColor:"black",borderSize:0,cornerRadius:0,colorsReplace:iY.types.map(iY.types.string)}).preProcessSnapshot(e=>({...e,src:e.src||e.svgSource,colorsReplace:Array.isArray(e.colorsReplace)?{}:e.colorsReplace})).actions(e=>({replaceColor(t,n){e.colorsReplace.set(t,n)}}));var iY=x("58B0H");let hW=hF.named("Figure").props({type:"figure",subType:"rect",fill:"rgb(0, 161, 255)",dash:iY.types.array(iY.types.number),strokeWidth:0,stroke:"rgba(98, 197, 255, 1)",cornerRadius:0}),hG=hV.named("Gif").props({type:"gif",duration:0,keepRatio:!0}),hK=(e,t)=>{if(e.children)for(let n of e.children){if(!0===t(n))break;hK(n,t)}},hY=[...Array(20)].map((e,t)=>iY.types.late(()=>hZ[t])),hX=iY.types.union({dispatcher:e=>{let t=hJ[e.type];if(!t)throw Error(`Unknown element type: "${e.type}"`);return t}},hq,hH,hV,h$,hU,hW,hG,iY.types.late(()=>hQ),...hY),hQ=hI.named("Group").props({type:"group",children:iY.types.array(hX)}).views(e=>({get draggable(){let t=!0;return hK(e,e=>{e.draggable||(t=!1)}),t},get resizable(){let t=!0;return hK(e,e=>{e.resizable||(t=!1)}),t},get contentEditable(){let t=!0;return hK(e,e=>{e.contentEditable||(t=!1)}),t},get styleEditable(){let t=!0;return hK(e,e=>{e.styleEditable||(t=!1)}),t},get locked(){let t=!0;return hK(e,e=>{e.locked||(t=!1)}),t}})).actions(e=>({set({draggable:t,contentEditable:n,styleEditable:r,resizable:i,...a}){void 0!==t&&hK(e,e=>{e.set({draggable:t})}),void 0!==n&&hK(e,e=>{e.set({contentEditable:n})}),void 0!==r&&hK(e,e=>{e.set({styleEditable:r})}),void 0!==i&&hK(e,e=>{e.set({resizable:i})}),Object.assign(e,a)},addElement(t,{skipSelect:n=!1}={}){let r=hJ[t.type];if(!r)return void console.error("Can not find model with type "+t.type);t.children&&t.children.forEach(e=>{e.id=e.id||dC(10)});let i=r.create({id:dC(10),...t});return e.children.push(i),i.selectable&&!n&&e.store.selectElements([i.id]),i},setElementZIndex(t,n){let r=e.children.find(e=>e.id===t);r&&((0,iY.detach)(r),e.children.remove(r),e.children.splice(n,0,r))},setAnimation(t,n){hK(e,e=>{e.setAnimation(t,n)})}})),hZ=[],hJ={svg:hq,text:hH,image:hV,group:hQ,line:h$,video:hU,figure:hW,gif:hG};function h0(e,t){let n=e.type;if(!n)throw Error('You must pass "type" attribute to custom model.');let r=hF.named(n).props(e);t&&(r=t(r)),hJ[n]=r,hZ.push(r)}let h1={text:i8,image:aT,svg:aT,line:oZ,video:u7,figure:da,group:j(e=>{let{element:t,store:n}=e,{children:r}=t,i=t.selectable||"admin"===n.role;return(0,C.jsx)(rE,{opacity:t.opacity,listening:i,hideInExport:!t.showInExport,id:t.id,children:r.map(t=>(0,S.createElement)(h4,{...e,key:t.id,store:n,element:t}))})}),gif:dv};function h2(e,t){h1[e]=t}let h4=j(e=>{var t;let n,r,i,a,o,s,l,c,{element:u,store:d}=e,[h,f]=m(S).useState(!1),p=d.selectedElements.indexOf(u)>=0&&u.selectable,g=u.parent?.type==="group",y=(e=>{let[t,n]=m(S).useState();return m(S).useEffect(()=>{let t=setTimeout(()=>{let t=e.page.id,r=n_.stages.find(e=>e.getAttr("pageId")===t);r||console.error("No stage is found for element",e.id),n(r)});return()=>clearTimeout(t)},[e.id]),t})(u),v=y?.findOne("Transformer");m(S).useEffect(()=>{if(y){let e=e=>{let t=e.target.findAncestor(".element",!0),n=d.getElementById(t?.id()),r=n?.top;f(r?.id===u.id)};y.on("mouseover",e);let t=()=>{f(!1)};return y.on("mouseleave",t),()=>{y.off("mouseover",e),y.off("mouseleave",t)}}},[y]);let b=h1[e.element.type];return("text"===e.element.type&&iS.htmlRenderEnabled&&(b=oN),e.element.visible)?b?(0,C.jsxs)(rE,{name:"element-container",children:[(0,C.jsx)(b,{...e}),h&&!p&&!g&&(0,C.jsx)(dw,{element:"group"===u.type?{a:(t=v?.rotation()||0,n=[],hK(u,e=>{"group"!==e.type&&n.push(e.a)}),r=[],n.forEach(e=>{let t=[{x:0,y:0},{x:0+e.width,y:0},{x:0+e.width,y:0+e.height},{x:0,y:0+e.height}],n=new n_.Transform;n.translate(e.x,e.y),n.rotate(n_.Util.degToRad(e.rotation)),t.forEach(e=>{let t=n.point(e);r.push(t)})}),(i=new n_.Transform).rotate(-n_.Util.degToRad(t)),a=1/0,o=1/0,s=-1/0,l=-1/0,r.forEach(e=>{let t=i.point(e);a=Math.min(a,t.x),o=Math.min(o,t.y),s=Math.max(s,t.x),l=Math.max(l,t.y)}),i.invert(),{x:(c=i.point({x:a,y:o})).x,y:c.y,width:s-a,height:l-o,rotation:t})}:u})]}):(console.error("Can not find component for "+e.element.type),null):null});var S=x("8NFma");let h3=j(({store:e,page:t,width:n,height:r,scale:i,xPadding:a,yPadding:o,bleed:s})=>{let[l,c]=m(S).useState(!1),[u,d]=m(S).useState([]),h=m(S).useRef(null),f="draw"===e.tool,{strokeWidth:p,stroke:g,opacity:y,brushType:v}=e.toolOptions,b=m(S).useCallback(e=>{if(!f||(c(!0),e.cancelBubble=!0,!e.target.getStage()))return;let t=h.current.getRelativePointerPosition();t&&d([{x:t.x,y:t.y}])},[f,i,a,o,s]),x=m(S).useCallback(e=>{if(!f||!l||(e.cancelBubble=!0,!e.target.getStage()))return;let t=h.current.getRelativePointerPosition();t&&d(e=>[...e,{x:t.x,y:t.y}])},[f,l,i,a,o,s]),w=m(S).useCallback(()=>{if(f&&l){if(c(!1),u.length>=1)try{let n=function(e,t){if(0===e.length)throw Error("Cannot create SVG from empty path");let n=t.smooth?function(e,t=.5){if(e.length<3)return e;let n=[];n.push(e[0]);for(let t=0;t<e.length-1;t++){let r=e[Math.max(0,t-1)],i=e[t],a=e[t+1],o=e[Math.min(e.length-1,t+2)];for(let e=0;e<10;e++){let t=e/10,s=t*t,l=s*t,c=.5*(2*i.x+(-r.x+a.x)*t+(2*r.x-5*i.x+4*a.x-o.x)*s+(-r.x+3*i.x-3*a.x+o.x)*l),u=.5*(2*i.y+(-r.y+a.y)*t+(2*r.y-5*i.y+4*a.y-o.y)*s+(-r.y+3*i.y-3*a.y+o.y)*l);n.push({x:c,y:u})}}return n.push(e[e.length-1]),n}(e):e,r=function(e){if(0===e.length)return{x:0,y:0,width:0,height:0};let t=e[0].x,n=e[0].y,r=e[0].x,i=e[0].y;for(let a of e)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{x:t,y:n,width:r-t,height:i-n}}(n),i=t.strokeWidth,a=r.x-i,o=r.y-i,s=r.width+2*i,l=r.height+2*i,c=function(e){if(0===e.length)return"";if(1===e.length){let t=e[0];return`M ${t.x},${t.y} L ${t.x+.1},${t.y}`}let t=`M ${e[0].x},${e[0].y}`;for(let n=1;n<e.length-1;n++){let r=e[n],i=e[n+1],a=(r.x+i.x)/2,o=(r.y+i.y)/2;t+=` Q ${r.x},${r.y} ${a},${o}`}if(e.length>1){let n=e[e.length-1];t+=` L ${n.x},${n.y}`}return t}(n.map(e=>({x:e.x-a,y:e.y-o})));return{src:ar(`
|
|
342
342
|
<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${l}" viewBox="0 0 ${s} ${l}">
|
|
343
343
|
<path
|
|
344
344
|
d="${c}"
|
|
@@ -352,7 +352,7 @@ https://polotno.com/docs/server-api`,dL={unsplashList:({query:e,page:t=1})=>`${d
|
|
|
352
352
|
`.trim()),x:a,y:o,width:s,height:l}}(u,{stroke:g,strokeWidth:p,smooth:!0}),r=e.selectedElementsIds.slice();e.history.transaction(()=>{t.addElement({type:"svg",x:n.x,y:n.y,width:n.width,height:n.height,src:n.src,opacity:y},{skipSelect:!0})}),e.selectElements(r)}catch(e){console.error("Error creating path SVG:",e)}d([])}},[f,l,u,g,p,y,t,e.history,e]),k=m(S).useMemo(()=>u.flatMap(e=>[e.x,e.y]),[u]);return(m(S).useEffect(()=>{if(f&&h.current){let e=h.current.getStage();if(!e)return;let t=p*i;if(t>100||t<4)e.container().style.cursor="crosshair";else{let n=t/2,r=t/2,i=`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}">
|
|
353
353
|
<circle cx="${r}" cy="${r}" r="${n-1}" fill="${g}" opacity="${y}" stroke="white" stroke-width="1"/>
|
|
354
354
|
<circle cx="${r}" cy="${r}" r="${n-1}" fill="none" stroke="black" stroke-width="1" opacity="0.3"/>
|
|
355
|
-
</svg>`,a=`data:image/svg+xml;base64,${btoa(i)}`;e.container().style.cursor=`url("${a}") ${r} ${r}, crosshair`}return()=>{e.container()&&(e.container().style.cursor="")}}},[f,g,p,y,i]),f)?(0,C.jsxs)(rE,{ref:h,listening:f,x:a+s*i,y:o+s*i,scaleX:i,scaleY:i,children:[(0,C.jsx)(rP,{x:-(a+s*i)/i,y:-(o+s*i)/i,width:n/i,height:r/i,fill:"transparent",onMouseDown:b,onMouseMove:x,onMouseUp:w,onTouchStart:b,onTouchMove:x,onTouchEnd:w}),u.length>0&&(0,C.jsx)(rO,{points:k,stroke:g,strokeWidth:p,lineCap:"round",lineJoin:"round",opacity:y,tension:.5,listening:!1})]}):null}),h8=n_.DD._drag;window.removeEventListener("mousemove",h8),n_.DD._drag=function(e){(0,E.runInAction)(()=>{h8.call(this,e)})},window.addEventListener("mousemove",n_.DD._drag);let h6=new n_.Group;h6.add(new n_.Rect({width:20,height:20,fill:"white"})),h6.add(new n_.Path({scaleX:20/24,scaleY:20/24,data:"M4.98313549,11.0001422 C5.49589839,10.9914935 5.92501998,11.3703506 5.99116425,11.8666444 L5.99985778,11.9831355 L6.00348884,12.2068855 C6.11245031,15.4321748 8.76323537,17.9999971 11.9999971,17.9999971 C12.1869612,17.9999971 12.3726725,17.9914753 12.5567465,17.9745765 L12.2928932,17.7071068 C11.9023689,17.3165825 11.9023689,16.6834175 12.2928932,16.2928932 C12.6834175,15.9023689 13.3165825,15.9023689 13.7071068,16.2928932 L15.7071068,18.2928932 C16.0976311,18.6834175 16.0976311,19.3165825 15.7071068,19.7071068 L13.7071068,21.7071068 C13.3165825,22.0976311 12.6834175,22.0976311 12.2928932,21.7071068 C11.9023689,21.3165825 11.9023689,20.6834175 12.2928932,20.2928932 L12.6111505,19.9769552 C12.4086045,19.9922816 12.2047796,19.9999971 11.9999971,19.9999971 C7.7687005,19.9999971 4.28886152,16.7094374 4.01666425,12.5105203 L4.00420123,12.2575143 L4.00014222,12.0168645 C3.9908282,11.4646583 4.43092928,11.0094562 4.98313549,11.0001422 Z M11.7071068,2.29289322 C12.0675907,2.65337718 12.0953203,3.22060824 11.7902954,3.61289944 L11.7071068,3.70710678 L11.3891629,4.0230186 C11.5916051,4.00770767 11.7953244,4 12,4 C16.418278,4 20,7.581722 20,12 C20,12.5522847 19.5522847,13 19,13 C18.4477153,13 18,12.5522847 18,12 C18,8.6862915 15.3137085,6 12,6 C11.8129339,6 11.6271216,6.00853145 11.4429483,6.02544919 L11.7071068,6.29289322 C12.0976311,6.68341751 12.0976311,7.31658249 11.7071068,7.70710678 C11.3466228,8.06759074 10.7793918,8.09532028 10.3871006,7.79029539 L10.2928932,7.70710678 L8.29289322,5.70710678 C7.93240926,5.34662282 7.90467972,4.77939176 8.20970461,4.38710056 L8.29289322,4.29289322 L10.2928932,2.29289322 C10.6834175,1.90236893 11.3165825,1.90236893 11.7071068,2.29289322 Z",fill:"black"}));let h5=h6.toCanvas({pixelRatio:2,width:20,height:20}),h9={enabledAnchors:["top-left","top-center","top-right","middle-left","bottom-left","bottom-right","bottom-center","middle-right"],borderEnabled:!0,rotateEnabled:!0,rotationSnaps:[0,45,90,135,180,225,270,315],ignoreStroke:!0,flipEnabled:!1,anchorStrokeWidth:2,borderStrokeWidth:2,rotateAnchorOffset:30,anchorStyleFunc:e=>{e.hasName("rotater")&&e.setAttrs({width:20,height:20,cornerRadius:10,offsetX:10,offsetY:10,fillPatternImage:h5,fillPatternScaleX:.5,fillPatternScaleY:.5,fillPriority:"pattern",fillPatternRepeat:"no-repeat"})}},h7=e=>{Object.assign(h9,e)},fe={text:{enabledAnchors:["top-left","top-right","middle-left","bottom-left","bottom-right","middle-right"]},svg:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},gif:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},line:{enabledAnchors:[],borderEnabled:!1,rotateEnabled:!1},image:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},many:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},group:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]}};function ft(e,t){fe[e]=fe[e]||t,Object.assign(fe[e],t)}let fn=e=>(0,C.jsx)(rP,{...e,preventDefault:!1}),fr=({url:e,...t})=>{let[n,r]=m(rj)(e,"anonymous"),i=n?function(e,t,n="scale"){let r,i,a=t.width/t.height;a>=e.width/e.height?(r=e.width,i=e.width/a):(r=e.height*a,i=e.height);let o=0,s=0;return"left-top"===n?(o=0,s=0):"left-middle"===n?(o=0,s=(e.height-i)/2):"left-bottom"===n?(o=0,s=e.height-i):"center-top"===n?(o=(e.width-r)/2,s=0):"center-middle"===n?(o=(e.width-r)/2,s=(e.height-i)/2):"center-bottom"===n?(o=(e.width-r)/2,s=e.height-i):"right-top"===n?(o=e.width-r,s=0):"right-middle"===n?(o=e.width-r,s=(e.height-i)/2):"right-bottom"===n?(o=e.width-r,s=e.height-i):"scale"===n?(o=0,s=0,r=e.width,i=e.height):console.error(Error("Unknown clip position property - "+n)),{cropX:o,cropY:s,cropWidth:r,cropHeight:i}}(n,{width:t.width,height:t.height},"center-middle"):{};return aE(r,e,"page background"),(0,C.jsx)(rA,{image:n,...t,...i})},fi=e=>{let t=rQ({a:{width:e.width,height:e.height},width:e.width,height:e.height},e.fill);return(0,C.jsx)(rP,{...e,...t})},fa=e=>{let{background:t,scale:n,borderColor:r,...i}=e,a=m(S).useMemo(()=>!!n_.Util.colorToRGBA(t)||rY(t),[t]),o=m(S).useMemo(()=>{let e=document.createElement("canvas");e.width=60,e.height=60;let t=e.getContext("2d");return t&&(t.fillStyle="black",t.fillRect(30,0,30,30),t.fillRect(0,30,30,30)),e},[]);return(0,C.jsxs)(m(S).Fragment,{children:[(0,C.jsx)(rP,{fillPatternImage:o,...i,opacity:.1,hideInExport:!0}),a?(0,C.jsx)(fi,{fill:t,...i}):(0,C.jsx)(fr,{url:t,...i})]})},fo=j(({selection:e,fill:t="rgba(0, 161, 255, 0.3)",stroke:n="rgb(0, 161, 255)",strokeWidth:r=1})=>e.visible?(0,C.jsx)(rP,{name:"selection",x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x1-e.x2),height:Math.abs(e.y1-e.y2),fill:t,stroke:n,strokeWidth:r}):null),fs=j(({x:e,y:t,width:n,height:r,rotation:i,anchor:a,store:o,tagFill:s,textFill:l})=>{let c;if(void 0===e||void 0===t||void 0===n||void 0===r||void 0===i||void 0===a)return null;let u=oz({x:e,y:t,width:n,height:r,rotation:n_.Util.radToDeg(i)}),d=(r/2+70)*Math.cos(i-Math.PI/2),h=(r/2+70)*Math.sin(i-Math.PI/2),f=d1({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:+("px"!==o.unit)})+" x "+d1({unit:o.unit,dpi:o.dpi,px:r/o.scale,precious:+("px"!==o.unit)})+("px"===o.unit?"":" "+o.unit);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(rT,{x:(u.minX+u.maxX)/2+d,y:(u.minY+u.maxY)/2+h,offsetX:14,offsetY:14,visible:"rotater"===a,children:[(0,C.jsx)("Tag",{cornerRadius:5,fill:s||"rgb(0, 161, 255)"}),(0,C.jsx)(rI,{align:"center",verticalAlign:"middle",fill:l||"white",padding:8,text:((c=180*i/Math.PI%360)>180?c-=360:c<-180&&(c+=360),Math.round(c)).toString()+"°"})]}),(0,C.jsxs)(rT,{x:(u.minX+u.maxX)/2,y:u.maxY+20,visible:"rotater"!==a,children:[(0,C.jsx)("Tag",{cornerRadius:5,fill:s||"rgb(0, 161, 255)",pointerDirection:"up",pointerHeight:0,pointerWidth:0}),(0,C.jsx)(rI,{align:"center",verticalAlign:"middle",fill:l||"white",padding:8,text:f})]})]})}),fl=j(({elements:e,store:t})=>{let n=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(n);return(0,C.jsx)(m(S).Fragment,{children:r.map(e=>(0,C.jsx)(h4,{store:t,element:e,onClick:()=>{console.warn("Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.")}},e.id))})}),fc=null,fu=e=>{fc=e},fd=atob("UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4="),fh=atob("I2MwMzkyYg=="),ff=atob("djAuOS4y"),fp=e=>(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(rT,{fill:fh,height:200,children:[(0,C.jsx)("Tag",{fill:fh}),(0,C.jsx)(rI,{...e,fill:"white",text:fd,height:void 0,padding:10,fontSize:20})]})}),fm=atob("RlJFRSAgVFJJQUwgIExJQ0VOU0U=");atob("UG93ZXJlZCBieSBQb2xvdG5v");let fg=atob("TElDRU5TRSAgS0VZICBJUyAgTUlTU0lORw=="),fy=atob("UGxlYXNlIGFjdGl2YXRlIHlvdXIgbGljZW5zZS4KTGljZW5zZSByZWxhdGVkIHF1ZXN0aW9uczoKcG9sb3Ruby5jb20vY29udGFjdA=="),fv=e=>{let t=1===dB.value,n=t?230:195;return(0,C.jsxs)(rE,{...e,listening:!1,children:[(0,C.jsx)(rP,{fill:fh,width:n,height:24,cornerRadius:2}),(0,C.jsx)(rI,{text:t?fg:fm,fill:"white",fontSize:13,fontFamily:"monospace",width:n,align:"center",y:5,listening:!1}),t&&(0,C.jsx)(rI,{text:fy,fill:"rgba(0,0,0,0.6)",fontSize:14,y:30,listening:!1})]})};var fb=j(({store:e,page:t,width:n,height:r,pageControlsEnabled:i,backColor:a,pageBorderColor:o,activePageBorderColor:s,components:l,bleedColor:c,altCloneEnabled:u,viewportSize:d,selectionRectFill:h,selectionRectStroke:f,selectionRectStrokeWidth:p,snapGuideStroke:g,snapGuideStrokeWidth:y,snapGuideDash:v,transformLabelFill:b,transformLabelTextFill:x,distanceGuideStroke:w,distanceLabelFill:k,distanceLabelTextFill:_,layout:T="vertical",tooltipSafeArea:P,transformerSafeArea:O})=>{var A;let I=e.bleedVisible?t.bleed:0,R=t.computedWidth+2*I,L=t.computedHeight+2*I,M=(n-R*e.scale)/2,N=(r-L*e.scale)/2,j=m(S).useRef(null),D=m(S).useRef(null),z=m(S).useRef(null),[B,F]=m(S).useState(null),[H,V]=m(S).useState({}),[U,$]=m(S).useState(0),q=(({store:e})=>{let[t,n]=m(S).useState(!1),[r,i]=m(S).useState({x:0,y:0});return{open:m(S).useCallback(e=>{n(!0),i(e)},[]),close:m(S).useCallback(()=>{n(!1)},[]),props:{isOpen:t,offset:r,setIsOpen:n}}})({store:e}),W=e.selectedElements.find(e=>e._cropModeEnabled),G=e.selectedElements.find(e=>e.curveEnabled),K=e.selectedShapes.filter(e=>!e.resizable).length>0,Y=e.selectedShapes.filter(e=>!e.draggable).length>0,X=e.selectedElements.filter(e=>!e.visible).length>0;m(S).useLayoutEffect(()=>{if(!j.current)return;let t=j.current.getStage(),n=e.selectedShapes.map(e=>e._cropModeEnabled?null:t.findOne("#"+e.id)).filter(e=>!!e),r=1===e.selectedElements.length,i=r&&e.selectedElements[0]?.type||"many";fe[i]?(j.current.setAttrs({...h9,...fe[i]}),"svg"!==i&&"image"!==i&&"gif"!==i||e.selectedElements[0].keepRatio||j.current.setAttrs({enabledAnchors:h9.enabledAnchors}),"text"===i&&iS.textVerticalResizeEnabled&&j.current.setAttrs({enabledAnchors:fe.text.enabledAnchors?.concat(["bottom-center"])}),"text"===i&&r&&e.selectedElements[0].curveEnabled&&j.current.setAttrs({enabledAnchors:fe.many.enabledAnchors})):j.current.setAttrs(h9),K&&j.current.enabledAnchors([]),Y&&j.current.rotateEnabled(!1),n.find(e=>e?.isDragging())&&n.forEach(e=>{e.isDragging()||e?.startDrag()}),j.current.nodes(n),o$(),j.current.getLayer()?.batchDraw()},[e.selectedShapes,W,K,X,Y,G]);let Q=()=>{let e=j.current;if(!e)return;if(!e.isTransforming())return void V({});if(!e.nodes().length||!e.isTransforming())return;let t=e.__getNodeRect(),n=e?.getActiveAnchor(),r=e.getStage();V({anchor:n,x:t.x-(r?.x()??0),y:t.y-(r?.y()??0),rotation:t.rotation,width:t.width,height:t.height})},Z=m(S).useCallback(()=>{if(j.current?.isTransforming())return;let e=j.current;if(!e||!e.nodes().length)return void $(0);let t=e.getClientRect();e.getStage()&&$(function(e,t,n,r=0){let i=e.x+e.width/2,a=e.y+e.height/2,o=e.width/2,s=e.height/2,l=r*Math.PI/180,c=e=>{let t,r=e*Math.PI/180,c=(e%360+360)%360,u=Math.sin(r)*((t=0===c||180===c?s:o)+n),d=-Math.cos(r)*(t+n);return{x:i+(u*Math.cos(l)-d*Math.sin(l)),y:a+(u*Math.sin(l)+d*Math.cos(l))}},u=e=>e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom;if(u(c(0)))return 0;for(let e of[180,270,90])if(u(c(e)))return e;return 0}(t,{top:O?.top||0,bottom:r-(O?.bottom||0),left:O?.left||0,right:n-(O?.right||0)},h9.rotateAnchorOffset||30,e.rotation()))},[O,n,r]);m(S).useEffect(()=>{j.current?.update(),Q(),Z()},[e.scale,Z]),m(S).useEffect(()=>{Z()},[e.selectedShapes,Z]);let J=(A=()=>({visible:!1,x1:0,y1:0,x2:0,y2:0}),(0,S.useState)(function(){return(0,E.observable)(A(),void 0,{autoBind:!0})})[0]),ee=m(S).useRef(!1),et=iK(),en=(0,E.action)(e=>{if(et)return;ee.current=!1;let t=e.target.findAncestor(".elements-container"),n=e.target.findAncestor("Transformer"),r=e.target.findAncestor(".page-abs-container");if(t||n||r)return;let i=e.target.getStage()?.getPointerPosition();i&&(i.x-=e.target.getStage()?.x()??0,i.y-=e.target.getStage()?.y()??0,J.visible=!0,J.x1=i.x,J.y1=i.y,J.x2=i.x,J.y2=i.y,(e.target.getStage()?.getPointersPositions().length??0)>=2&&(J.visible=!1))});(({stageRef:e,containerRef:t,viewportSize:n})=>{m(S).useEffect(()=>{let n=t.current?.closest(".polotno-workspace-inner");function r(){if(!e.current)return;let r=t.current?.getBoundingClientRect(),i=n?.getBoundingClientRect();if(!r||!i)return;let a=Math.max(0,i.left-r.left-100),o=Math.max(0,i.top-r.top-100);e.current.position({x:-a,y:-o}),e.current.container().style.transform=`translate(${a}px, ${o}px)`}return r(),n?.addEventListener("scroll",r),()=>{n?.removeEventListener("scroll",r)}},[n.width,n.height])})({stageRef:D,containerRef:z,viewportSize:d}),m(S).useEffect(()=>{let t=(0,E.action)(e=>{if(!J.visible)return;D.current?.setPointersPositions(e);let t=D.current?.getPointerPosition();t?(t.x-=D.current?.x()??0,t.y-=D.current?.y()??0):t={x:J.x2,y:J.y2},J.x2=t.x,J.y2=t.y}),n=(0,E.action)(()=>{if(!J.visible||!D.current)return;let t=D.current.findOne(".selection"),n=t?t.getClientRect({skipStroke:!0}):{width:0,height:0,x:0,y:0};if(n.width&&n.height){let t=[];D.current.find(".element").forEach(r=>{let i=r.getClientRect(),a=e.getElementById(r.id()),o=a?.draggable,s=a?.selectable;n_.Util.haveIntersection(n,i)&&o&&s&&t.push(a.top.id)});let r=[...new Set(t)];ee.current=!0,e.selectElements(r)}J.visible=!1});return window.addEventListener("mousemove",t),window.addEventListener("touchmove",t),window.addEventListener("mouseup",n,{capture:!0}),window.addEventListener("touchend",n,{capture:!0}),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("touchmove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchend",n)}},[]);let er=m(S).useCallback(n=>{if(!e.selectedElements[0]||n&&e.selectedElementsIds.includes(n))return;let r=oB(e.selectedShapes),i=oz(n?e.getElementById(n):{x:0,y:0,width:t.computedWidth,height:t.computedHeight,rotation:0}),a=[];r.minX>i.maxX&&a.push({distance:r.minX-i.maxX,box1:r,box2:i,points:[{x:r.minX,y:r.minY+r.height/2},{x:i.maxX,y:r.minY+r.height/2},{x:i.maxX,y:i.minY+i.height/2}]}),r.maxX<i.minX&&a.push({distance:i.minX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:r.minY+r.height/2},{x:i.minX,y:r.minY+r.height/2},{x:i.minX,y:i.minY+i.height/2}]}),r.minY>i.maxY&&a.push({box1:r,box2:i,distance:r.minY-i.maxY,points:[{x:r.minX+r.width/2,y:r.minY},{x:r.minX+r.width/2,y:i.maxY},{x:i.minX+i.width/2,y:i.maxY}]}),r.maxY<i.minY&&a.push({box1:r,box2:i,distance:i.minY-r.maxY,points:[{x:r.minX+r.width/2,y:r.maxY},{x:r.minX+r.width/2,y:i.minY},{x:i.minX+i.width/2,y:i.minY}]});let o=r.minX>=i.minX&&r.maxX<=i.maxX&&r.minY>=i.minY&&r.maxY<=i.maxY;if(o&&(a.push({distance:r.minX-i.minX,box1:r,box2:i,points:[{x:r.minX,y:r.minY+r.height/2},{x:i.minX,y:r.minY+r.height/2},{x:i.minX,y:i.minY+i.height/2}]}),a.push({distance:i.maxX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:r.minY+r.height/2},{x:i.maxX,y:r.minY+r.height/2},{x:i.maxX,y:i.minY+i.height/2}]}),a.push({box1:r,box2:i,distance:r.minY-i.minY,points:[{x:r.minX+r.width/2,y:r.minY},{x:r.minX+r.width/2,y:i.minY},{x:i.minX+i.width/2,y:i.minY}]}),a.push({box1:r,box2:i,distance:i.maxY-r.maxY,points:[{x:r.minX+r.width/2,y:r.maxY},{x:r.minX+r.width/2,y:i.maxY},{x:i.minX+i.width/2,y:i.maxY}]})),0===a.length&&!o){let e=r.minX<i.maxX&&r.maxX>i.minX,t=r.minY<i.maxY&&r.maxY>i.minY;if(e&&t){let e=(Math.max(r.minY,i.minY)+Math.min(r.maxY,i.maxY))/2,t=(Math.max(r.minX,i.minX)+Math.min(r.maxX,i.maxX))/2;r.minX<i.minX?a.push({distance:i.minX-r.minX,box1:r,box2:i,points:[{x:r.minX,y:e},{x:i.minX,y:e},{x:i.minX,y:e}]}):a.push({distance:r.minX-i.minX,box1:r,box2:i,points:[{x:r.minX,y:e},{x:i.minX,y:e},{x:i.minX,y:e}]}),r.maxX>i.maxX?a.push({distance:r.maxX-i.maxX,box1:r,box2:i,points:[{x:i.maxX,y:e},{x:r.maxX,y:e},{x:i.maxX,y:e}]}):a.push({distance:i.maxX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:e},{x:i.maxX,y:e},{x:i.maxX,y:e}]}),r.minY<i.minY?a.push({box1:r,box2:i,distance:i.minY-r.minY,points:[{x:t,y:r.minY},{x:t,y:i.minY},{x:t,y:i.minY}]}):a.push({box1:r,box2:i,distance:r.minY-i.minY,points:[{x:t,y:r.minY},{x:t,y:i.minY},{x:t,y:i.minY}]}),r.maxY>i.maxY?a.push({box1:r,box2:i,distance:r.maxY-i.maxY,points:[{x:t,y:i.maxY},{x:t,y:r.maxY},{x:t,y:i.maxY}]}):a.push({box1:r,box2:i,distance:i.maxY-r.maxY,points:[{x:t,y:r.maxY},{x:t,y:i.maxY},{x:t,y:i.maxY}]})}}JSON.stringify(B)!==JSON.stringify(a)&&F(a)},[e,t]);m(S).useEffect(()=>{e.distanceGuidesVisible?er():B&&F(null)},[e.distanceGuidesVisible,er,e.selectedShapes.map(e=>`${e.x},${e.y},${e.width},${e.height},${e.rotation}`).join("|")]);let ei=m(S).useRef(!1);m(S).useEffect(()=>{let e,t=z.current?.closest(".polotno-workspace-inner"),n=()=>{ei.current=!0,clearTimeout(e),e=setTimeout(()=>{ei.current=!1},300)};return t?.addEventListener("scroll",n),()=>{clearTimeout(e),t?.removeEventListener("scroll",n)}},[]);let ea=n=>{if(e.activePage!==t&&t.select(),ei.current||ee.current)return;let r=n.evt.ctrlKey||n.evt.metaKey||n.evt.shiftKey,i=n.target.findAncestor(".elements-container"),a=n.target.findAncestor(".page-abs-container"),o=n.target.findAncestor("Transformer");if(!r&&!i&&!o&&!a&&!J.visible)return void e.selectElements([]);let s=n.target.findAncestor(".element-container",!0),l=s?.findOne(".element")||n.target.findAncestor(".element",!0),c=e.getElementById(l?.id()),u=c?.top,d=u?.id,h=e.selectedElementsIds.indexOf(d)>=0,f=n.target.findAncestor(".page-container",!0);d&&r&&!h?e.selectElements(e.selectedElementsIds.concat([d])):d&&r&&h?e.selectElements(e.selectedElementsIds.filter(e=>e!==d)):!d||r||h?f?e.selectPages([t.id]):e.selectPages([]):e.selectElements([d])};!function(e,t){let n=m(S).useRef(null);t&&(({stroke:e,strokeWidth:t,dash:n})=>{void 0!==e&&(oF.stroke=e),void 0!==t&&(oF.strokeWidth=t),void 0!==n&&(oF.dash=n)})(t);let r=e=>e.hasName("element")||e.hasName("page-background")||!n.current&&e.hasName("elements-area");function i(t){let n=e.current?.getStage(),i=[],a=[];return n.find(r).forEach(e=>{if(!(t.indexOf(e)>=0)){var n=e.getClientRect({skipShadow:!0,skipStroke:!0});i.push({offset:n.x,node:e,snap:"start"},{offset:n.x+n.width,node:e,snap:"end"},{offset:n.x+n.width/2,node:e,snap:"center"}),a.push({offset:n.y,node:e,snap:"start"},{offset:n.y+n.height,node:e,snap:"end"},{offset:n.y+n.height/2,node:e,snap:"center"})}}),{vertical:i,horizontal:a}}function a(t){let n=e.current?.getLayer(),r=n?.children.find(e=>"line-guides"===e.name());t.forEach(e=>{if("H"===e.orientation){var t=new n_.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});r?.add(t),n.batchDraw()}else if("V"===e.orientation){var t=new n_.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});r?.add(t)}})}let o=e=>{let t,n,r,o=e.target.getLayer().children.find(e=>"line-guides"===e.name());o?.destroyChildren();var s,l=oU(i(e.target.nodes()),(n=oz({...t=(s=e.target).__getNodeRect(),rotation:n_.Util.radToDeg(t.rotation)}),r=s.getAbsolutePosition(),{vertical:[{guide:n.x,offset:r.x-n.x,snap:"start",nodes:s.nodes()},{guide:n.x+n.width/2,offset:r.x-n.x-n.width/2,snap:"center",nodes:s.nodes()},{guide:n.x+n.width,offset:r.x-n.x-n.width,snap:"end",nodes:s.nodes()}],horizontal:[{guide:n.y,offset:r.y-n.y,snap:"start",nodes:s.nodes()},{guide:n.y+n.height/2,offset:r.y-n.y-n.height/2,snap:"center",nodes:s.nodes()},{guide:n.y+n.height,offset:r.y-n.y-n.height,snap:"end",nodes:s.nodes()}]}));if(!l.length)return;a(l);let c=e.target.getAbsolutePosition();e.target.nodes().map(e=>e.getAbsolutePosition());let u={...c};l.forEach(e=>{switch(e.snap){case"start":case"center":case"end":switch(e.orientation){case"V":u.x=e.lineGuide+e.offset;break;case"H":u.y=e.lineGuide+e.offset}}});let d=u.x-c.x,h=u.y-c.y;e.evt.ctrlKey||e.evt.metaKey||e.target.nodes().forEach(e=>{let t=e.getAbsolutePosition();e.setAbsolutePosition({x:t.x+d,y:t.y+h})})},s=(t,n,r)=>{let o,s=e.current,l=s.getLayer().children.find(e=>"line-guides"===e.name());if(l?.destroyChildren(),"rotater"===s.getActiveAnchor())return n;let c=oG[s.getActiveAnchor()],u=s.findOne(`.${c}`)?.getAbsolutePosition();if(!u)return n;let d={x:t.x-u.x,y:t.y-u.y},h=(p={x:n.x-t.x,y:n.y-t.y},{x:(o=oW(p,m=d)/oW(m,m))*m.x,y:o*m.y});if(Math.sqrt(Math.pow(h.x,2)+Math.pow(h.y,2))>5)return n;let f={x:t.x+h.x,y:t.y+h.y};var p,m,g=oU(i(s.nodes()),{vertical:[{guide:f.x,offset:0,snap:"start",nodes:s.nodes()}],horizontal:[{guide:f.y,offset:0,snap:"start",nodes:s.nodes()}]});if(!g.length||(a(g),r.ctrlKey||r.metaKey))return n;let y=[];if(g.forEach(e=>{let t=function(e,t,n){if("V"===n.orientation){let r=n.lineGuide;if(1e-4>Math.abs(t.x-e.x))return null;let i=(t.y-e.y)/(t.x-e.x),a=e.y-i*e.x;return{x:r,y:i*r+a}}{let r=n.lineGuide;if(1e-4>Math.abs(t.y-e.y))return null;let i=(t.y-e.y)/(t.x-e.x);return{x:(r-e.y)/i+e.x,y:r}}}(f,u,{orientation:e.orientation,lineGuide:e.lineGuide});t&&y.push(t)}),y.length>0){let e=y[0],t=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2));if(y.forEach(n=>{let r=Math.sqrt(Math.pow(f.x-n.x,2)+Math.pow(f.y-n.y,2));r<t&&(t=r,e=n)}),t<10)return e}return f},l=e=>{if(!e.target)return;let t=e.target.getLayer(),n=t.children.find(e=>"line-guides"===e.name());n?.destroyChildren(),t.batchDraw()};m(S).useEffect(()=>{e.current&&(e.current.anchorDragBoundFunc(s),e.current.on("dragstart",e=>{setTimeout(()=>{o$()})}),e.current.on("dragmove",o),e.current.on("dragend",l),e.current.on("transformend",l),e.current.on("transform",t=>{t.evt.ctrlKey||t.evt.metaKey?e.current?.rotationSnapTolerance(0):e.current?.rotationSnapTolerance(5)}))},[])}(j,{stroke:g,strokeWidth:y,dash:v});let eo=e.activePage===t,es=e._selectedPagesIds.includes(t.id),el=l?.PageControls,ec=l?.Tooltip,eu=l?.ContextMenu,ed=1/e.scale,eh=0/e.scale;return(0,C.jsxs)("div",{ref:z,onDragOver:e=>e.preventDefault(),onDrop:n=>{if(n.preventDefault(),!D.current)return;D.current.setPointersPositions(n);let r=D.current.findOne(".elements-container"),i=r?.getRelativePointerPosition(),a=D.current.getPointerPosition(),o=[...new Set(D.current.getAllIntersections(a).map(e=>e.findAncestor(".element",!0)).filter(Boolean).reverse())].map(t=>e.getElementById(t.id())).filter(e=>!!e),s=o[0];fc&&i&&(fc(i,s,{elements:o,page:t}),fc=null)},style:{position:"relative",width:n+"px",height:r+"px",overflow:"hidden",flexShrink:0},className:"polotno-page-container"+(eo?" active-page":""),children:[(0,C.jsx)(rN,{ref:D,width:Math.min(n,d.width+200),height:Math.min(d.height+200,r),onClick:ea,onTap:ea,onContextMenu:t=>{t.evt.preventDefault();let n=t.target.findAncestor(".element",!0),r=e.getElementById(n?.id()),i=r?.top,a=i?.id;a?e.selectedElementsIds.indexOf(a)>=0||e.selectElements([a]):e.selectElements([]),q.open({x:t.evt.clientX,y:t.evt.clientY})},onMouseDown:en,onMouseMove:t=>{if(!(e.distanceGuidesVisible||t.evt.altKey)){B&&F(null);return}let n=t.target.findAncestor(".element",!0);er(n?.id())},onDragStart:t=>{let n=t.target.findAncestor(".element",!0);if(n){let r=e.getElementById(n?.id()),i=r?.top,a=i?.id;!(e.selectedElementsIds.indexOf(a)>=0)&&a&&(e.selectElements([a]),t.target.stopDrag(),t.target.startDrag(t),j.current?.startDrag(t))}B&&F(null)},pageId:t.id,style:{position:"absolute",overflow:"hidden",top:0,left:0},children:(0,C.jsxs)("Layer",{children:[(0,C.jsx)(fn,{width:n,height:r,fill:a}),(0,C.jsx)(rE,{x:M,y:N,scaleX:e.scale,scaleY:e.scale,name:"page-container",children:(0,C.jsxs)(rE,{name:"page-container-2",children:[(0,C.jsx)(rE,{name:"page-background-group",x:I,y:I,children:(0,C.jsx)(fa,{x:-t.bleed,y:-t.bleed,width:t.computedWidth+2*t.bleed,height:t.computedHeight+2*t.bleed,background:t.background,name:"page-background",preventDefault:!1,scale:e.scale})}),(0,C.jsxs)(rE,{x:I,y:I,name:"elements-container",listening:!e.isPlaying,children:[(0,C.jsx)(rP,{name:"elements-area",width:t.computedWidth,height:t.computedHeight,listening:!1}),(0,C.jsx)(fl,{elements:t.children,store:e})]}),(0,C.jsx)(rP,{stroke:c,name:"bleed",strokeWidth:t.bleed,x:t.bleed/2,y:t.bleed/2,width:t.computedWidth+t.bleed,height:t.computedHeight+t.bleed,listening:!1,visible:t.bleed>0&&e.bleedVisible,hideInExport:!0}),dz.value===ff&&(0,C.jsx)(fp,{name:"hit-detection",x:-ed/2-eh,y:-ed/2-eh,width:R+ed+2*eh,height:L+ed+2*eh})]})}),(0,C.jsx)(rO,{name:"workspace-background",points:[0,0,n,0,n,r,0,r,0,0,M,N,M,r-N,n-M,r-N,n-M,N,M,N],listening:!1,closed:!0,fill:a}),(0,C.jsx)(rE,{x:M,y:N,scaleX:e.scale,scaleY:e.scale,children:(0,C.jsx)(rP,{name:"page-highlight",hideInExport:!0,x:-ed/2-eh,y:-ed/2-eh,width:R+ed+2*eh,height:L+ed+2*eh,stroke:es?s:o,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})}),(0,C.jsxs)(rE,{x:M+I*e.scale,y:N+I*e.scale,scaleX:e.scale,scaleY:e.scale,name:"page-abs-container",children:[(0,C.jsx)(rL,{ref:j,rotateAnchorAngle:U,onDragStart:n=>{n.evt?.altKey&&u&&e.selectedElements.forEach(e=>{let n=e.clone({},{skipSelect:!0}),r=t.children.indexOf(e);t.setElementZIndex(n.id,r)}),e.history.startTransaction()},onDragEnd:()=>{e.history.endTransaction(),Z()},onTransformStart:()=>{e.history.startTransaction(),F(null)},boundBoxFunc:(e,t)=>{let n=1>Math.abs(t.width)||1>Math.abs(t.height),r=1>Math.abs(e.width)||1>Math.abs(e.height);return n&&!r?e:t},onTransform:e=>{let t=j.current.nodes(),n=t[t.length-1];e.target===n&&setTimeout(()=>{Q()},0)},onTransformEnd:t=>{V({}),e.history.endTransaction(),Z()},visible:!e.isPlaying}),B&&B.map(({points:t,distance:n,box1:r,box2:i},a)=>(0,C.jsxs)(rE,{name:"distances-container",hideInExport:!0,listening:!1,children:[(0,C.jsx)(rP,{...r,stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsx)(rP,{...i,stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsx)(rO,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsx)(rO,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsxs)(rT,{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,offsetY:-10,scaleX:1/e.scale,scaleY:1/e.scale,children:[(0,C.jsx)("Tag",{cornerRadius:5,fill:k,pointerDirection:"down"}),(0,C.jsx)(rI,{align:"center",verticalAlign:"middle",fill:_,padding:5,text:(e=>{let t=parseFloat(d0(e).toFixed(1));switch(e.unit){case"pt":return`${Math.round(t)}pt`;case"mm":return`${t}mm`;case"cm":return`${t}cm`;case"in":return`${t}in`;default:return`${Math.round(t)}px`}})({unit:e.unit,dpi:e.dpi,px:n})})]})]},a)),t._rendering&&(0,C.jsxs)(rE,{children:[(0,C.jsx)(rP,{width:R,height:L,fill:"rgba(255,255,255,0.9)"}),(0,C.jsx)(rI,{text:"Rendering...",fontSize:60,width:R,height:L,align:"center",verticalAlign:"middle"})]}),ec&&(0,C.jsx)(ec,{components:l,store:e,page:t,stageRef:D,tooltipSafeArea:P}),eu&&(0,C.jsx)(rz,{children:(0,C.jsx)(eu,{components:l,store:e,...q.props})})]}),(0,C.jsx)(h3,{store:e,page:t,width:n,height:r,scale:e.scale,xPadding:M,yPadding:N,bleed:I}),(0,C.jsx)(fs,{...H,store:e,tagFill:b,textFill:x}),(0,C.jsx)(fo,{selection:J,fill:h,stroke:f,strokeWidth:p}),dB.value>0&&(0,C.jsxs)(rE,{hideInExport:!0,children:[(0,C.jsx)(fv,{name:"cache-bounds",x:n-(1===dB.value?250:210),y:r-(1===dB.value?95:45)}),(0,C.jsx)(fv,{name:"cache-bounds-t",x:10,y:10})]}),dD.value&&(0,C.jsx)(rI,{text:"Powered by polotno.com",fontSize:14,fill:"rgba(0,0,0,0.6)",x:n-170,y:r-18,onMouseEnter:e=>{e.target.getStage().container().style.cursor="pointer"},onMouseLeave:e=>{e.target.getStage().container().style.cursor=""},onTouchStart:e=>{e.cancelBubble=!0},onMouseDown:e=>{e.cancelBubble=!0},onClick:()=>{window.open("https://polotno.com")},onTap:()=>{window.open("https://polotno.com")}}),(0,C.jsx)(rE,{name:"line-guides"})]})}),(i??!0)&&el&&(0,C.jsx)(el,{store:e,page:t,xPadding:M,yPadding:N,layout:T})]})}),S=x("8NFma");let fx=ok("div",m(S).forwardRef)`
|
|
355
|
+
</svg>`,a=`data:image/svg+xml;base64,${btoa(i)}`;e.container().style.cursor=`url("${a}") ${r} ${r}, crosshair`}return()=>{e.container()&&(e.container().style.cursor="")}}},[f,g,p,y,i]),f)?(0,C.jsxs)(rE,{ref:h,listening:f,x:a+s*i,y:o+s*i,scaleX:i,scaleY:i,children:[(0,C.jsx)(rP,{x:-(a+s*i)/i,y:-(o+s*i)/i,width:n/i,height:r/i,fill:"transparent",onMouseDown:b,onMouseMove:x,onMouseUp:w,onTouchStart:b,onTouchMove:x,onTouchEnd:w}),u.length>0&&(0,C.jsx)(rO,{points:k,stroke:g,strokeWidth:p,lineCap:"round",lineJoin:"round",opacity:y,tension:.5,listening:!1})]}):null}),h8=n_.DD._drag;window.removeEventListener("mousemove",h8),n_.DD._drag=function(e){(0,E.runInAction)(()=>{h8.call(this,e)})},window.addEventListener("mousemove",n_.DD._drag);let h6=new n_.Group;h6.add(new n_.Rect({width:20,height:20,fill:"white"})),h6.add(new n_.Path({scaleX:20/24,scaleY:20/24,data:"M4.98313549,11.0001422 C5.49589839,10.9914935 5.92501998,11.3703506 5.99116425,11.8666444 L5.99985778,11.9831355 L6.00348884,12.2068855 C6.11245031,15.4321748 8.76323537,17.9999971 11.9999971,17.9999971 C12.1869612,17.9999971 12.3726725,17.9914753 12.5567465,17.9745765 L12.2928932,17.7071068 C11.9023689,17.3165825 11.9023689,16.6834175 12.2928932,16.2928932 C12.6834175,15.9023689 13.3165825,15.9023689 13.7071068,16.2928932 L15.7071068,18.2928932 C16.0976311,18.6834175 16.0976311,19.3165825 15.7071068,19.7071068 L13.7071068,21.7071068 C13.3165825,22.0976311 12.6834175,22.0976311 12.2928932,21.7071068 C11.9023689,21.3165825 11.9023689,20.6834175 12.2928932,20.2928932 L12.6111505,19.9769552 C12.4086045,19.9922816 12.2047796,19.9999971 11.9999971,19.9999971 C7.7687005,19.9999971 4.28886152,16.7094374 4.01666425,12.5105203 L4.00420123,12.2575143 L4.00014222,12.0168645 C3.9908282,11.4646583 4.43092928,11.0094562 4.98313549,11.0001422 Z M11.7071068,2.29289322 C12.0675907,2.65337718 12.0953203,3.22060824 11.7902954,3.61289944 L11.7071068,3.70710678 L11.3891629,4.0230186 C11.5916051,4.00770767 11.7953244,4 12,4 C16.418278,4 20,7.581722 20,12 C20,12.5522847 19.5522847,13 19,13 C18.4477153,13 18,12.5522847 18,12 C18,8.6862915 15.3137085,6 12,6 C11.8129339,6 11.6271216,6.00853145 11.4429483,6.02544919 L11.7071068,6.29289322 C12.0976311,6.68341751 12.0976311,7.31658249 11.7071068,7.70710678 C11.3466228,8.06759074 10.7793918,8.09532028 10.3871006,7.79029539 L10.2928932,7.70710678 L8.29289322,5.70710678 C7.93240926,5.34662282 7.90467972,4.77939176 8.20970461,4.38710056 L8.29289322,4.29289322 L10.2928932,2.29289322 C10.6834175,1.90236893 11.3165825,1.90236893 11.7071068,2.29289322 Z",fill:"black"}));let h5=h6.toCanvas({pixelRatio:2,width:20,height:20}),h9={enabledAnchors:["top-left","top-center","top-right","middle-left","bottom-left","bottom-right","bottom-center","middle-right"],borderEnabled:!0,rotateEnabled:!0,rotationSnaps:[0,45,90,135,180,225,270,315],ignoreStroke:!0,flipEnabled:!1,anchorStrokeWidth:2,borderStrokeWidth:2,rotateAnchorOffset:30,anchorStyleFunc:e=>{e.hasName("rotater")&&e.setAttrs({width:20,height:20,cornerRadius:10,offsetX:10,offsetY:10,fillPatternImage:h5,fillPatternScaleX:.5,fillPatternScaleY:.5,fillPriority:"pattern",fillPatternRepeat:"no-repeat"})}},h7=e=>{Object.assign(h9,e)},fe={text:{enabledAnchors:["top-left","top-right","middle-left","bottom-left","bottom-right","middle-right"]},svg:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},gif:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},line:{enabledAnchors:[],borderEnabled:!1,rotateEnabled:!1},image:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},many:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]},group:{enabledAnchors:["top-left","top-right","bottom-left","bottom-right"]}};function ft(e,t){fe[e]=fe[e]||t,Object.assign(fe[e],t)}let fn=e=>(0,C.jsx)(rP,{...e,preventDefault:!1}),fr=({url:e,...t})=>{let[n,r]=m(rj)(e,"anonymous"),i=n?function(e,t,n="scale"){let r,i,a=t.width/t.height;a>=e.width/e.height?(r=e.width,i=e.width/a):(r=e.height*a,i=e.height);let o=0,s=0;return"left-top"===n?(o=0,s=0):"left-middle"===n?(o=0,s=(e.height-i)/2):"left-bottom"===n?(o=0,s=e.height-i):"center-top"===n?(o=(e.width-r)/2,s=0):"center-middle"===n?(o=(e.width-r)/2,s=(e.height-i)/2):"center-bottom"===n?(o=(e.width-r)/2,s=e.height-i):"right-top"===n?(o=e.width-r,s=0):"right-middle"===n?(o=e.width-r,s=(e.height-i)/2):"right-bottom"===n?(o=e.width-r,s=e.height-i):"scale"===n?(o=0,s=0,r=e.width,i=e.height):console.error(Error("Unknown clip position property - "+n)),{cropX:o,cropY:s,cropWidth:r,cropHeight:i}}(n,{width:t.width,height:t.height},"center-middle"):{};return aE(r,e,"page background"),(0,C.jsx)(rA,{image:n,...t,...i})},fi=e=>{let t=rQ({a:{width:e.width,height:e.height},width:e.width,height:e.height},e.fill);return(0,C.jsx)(rP,{...e,...t})},fa=e=>{let{background:t,scale:n,borderColor:r,...i}=e,a=m(S).useMemo(()=>!!n_.Util.colorToRGBA(t)||rY(t),[t]),o=m(S).useMemo(()=>{let e=document.createElement("canvas");e.width=60,e.height=60;let t=e.getContext("2d");return t&&(t.fillStyle="black",t.fillRect(30,0,30,30),t.fillRect(0,30,30,30)),e},[]);return(0,C.jsxs)(m(S).Fragment,{children:[(0,C.jsx)(rP,{fillPatternImage:o,...i,opacity:.1,hideInExport:!0}),a?(0,C.jsx)(fi,{fill:t,...i}):(0,C.jsx)(fr,{url:t,...i})]})},fo=j(({selection:e,fill:t="rgba(0, 161, 255, 0.3)",stroke:n="rgb(0, 161, 255)",strokeWidth:r=1})=>e.visible?(0,C.jsx)(rP,{name:"selection",x:Math.min(e.x1,e.x2),y:Math.min(e.y1,e.y2),width:Math.abs(e.x1-e.x2),height:Math.abs(e.y1-e.y2),fill:t,stroke:n,strokeWidth:r}):null),fs=j(({x:e,y:t,width:n,height:r,rotation:i,anchor:a,store:o,tagFill:s,textFill:l})=>{let c;if(void 0===e||void 0===t||void 0===n||void 0===r||void 0===i||void 0===a)return null;let u=oz({x:e,y:t,width:n,height:r,rotation:n_.Util.radToDeg(i)}),d=(r/2+70)*Math.cos(i-Math.PI/2),h=(r/2+70)*Math.sin(i-Math.PI/2),f=d1({unit:o.unit,dpi:o.dpi,px:n/o.scale,precious:+("px"!==o.unit)})+" x "+d1({unit:o.unit,dpi:o.dpi,px:r/o.scale,precious:+("px"!==o.unit)})+("px"===o.unit?"":" "+o.unit);return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(rT,{x:(u.minX+u.maxX)/2+d,y:(u.minY+u.maxY)/2+h,offsetX:14,offsetY:14,visible:"rotater"===a,children:[(0,C.jsx)("Tag",{cornerRadius:5,fill:s||"rgb(0, 161, 255)"}),(0,C.jsx)(rI,{align:"center",verticalAlign:"middle",fill:l||"white",padding:8,text:((c=180*i/Math.PI%360)>180?c-=360:c<-180&&(c+=360),Math.round(c)).toString()+"°"})]}),(0,C.jsxs)(rT,{x:(u.minX+u.maxX)/2,y:u.maxY+20,visible:"rotater"!==a,children:[(0,C.jsx)("Tag",{cornerRadius:5,fill:s||"rgb(0, 161, 255)",pointerDirection:"up",pointerHeight:0,pointerWidth:0}),(0,C.jsx)(rI,{align:"center",verticalAlign:"middle",fill:l||"white",padding:8,text:f})]})]})}),fl=j(({elements:e,store:t})=>{let n=e.filter(e=>e.alwaysOnTop),r=e.filter(e=>!e.alwaysOnTop).concat(n);return(0,C.jsx)(m(S).Fragment,{children:r.map(e=>(0,C.jsx)(h4,{store:t,element:e,onClick:()=>{console.warn("Polotno warning: onClick callback is deprecated. Just stop using it. Polotno will do selection automatically.")}},e.id))})}),fc=null,fu=e=>{fc=e},fd=atob("UG9sb3RubyBmcmVlIGxpY2Vuc2UgbGltaXRhdGlvbiBleGNlZWRlZCAtIFBsZWFzZSB1cGdyYWRlIHlvdXIgYWNjb3VudC4="),fh=atob("I2MwMzkyYg=="),ff=atob("djAuOS4y"),fp=e=>(0,C.jsx)(C.Fragment,{children:(0,C.jsxs)(rT,{fill:fh,height:200,children:[(0,C.jsx)("Tag",{fill:fh}),(0,C.jsx)(rI,{...e,fill:"white",text:fd,height:void 0,padding:10,fontSize:20})]})}),fm=atob("RlJFRSAgVFJJQUwgIExJQ0VOU0U=");atob("UG93ZXJlZCBieSBQb2xvdG5v");let fg=atob("TElDRU5TRSAgS0VZICBJUyAgTUlTU0lORw=="),fy=atob("UGxlYXNlIGFjdGl2YXRlIHlvdXIgbGljZW5zZS4KTGljZW5zZSByZWxhdGVkIHF1ZXN0aW9uczoKcG9sb3Ruby5jb20vY29udGFjdA=="),fv=e=>{let t=1===dB.value,n=t?230:195;return(0,C.jsxs)(rE,{...e,listening:!1,children:[(0,C.jsx)(rP,{fill:fh,width:n,height:24,cornerRadius:2}),(0,C.jsx)(rI,{text:t?fg:fm,fill:"white",fontSize:13,fontFamily:"monospace",width:n,align:"center",y:5,listening:!1}),t&&(0,C.jsx)(rI,{text:fy,fill:"rgba(0,0,0,0.6)",fontSize:14,y:30,listening:!1})]})};var fb=j(({store:e,page:t,width:n,height:r,pageControlsEnabled:i,backColor:a,pageBorderColor:o,activePageBorderColor:s,components:l,bleedColor:c,altCloneEnabled:u,viewportSize:d,selectionRectFill:h,selectionRectStroke:f,selectionRectStrokeWidth:p,snapGuideStroke:g,snapGuideStrokeWidth:y,snapGuideDash:v,transformLabelFill:b,transformLabelTextFill:x,distanceGuideStroke:w,distanceLabelFill:k,distanceLabelTextFill:_,layout:T="vertical",tooltipSafeArea:P,transformerSafeArea:O})=>{var A;let I=e.bleedVisible?t.bleed:0,R=t.computedWidth+2*I,L=t.computedHeight+2*I,M=(n-R*e.scale)/2,N=(r-L*e.scale)/2,j=m(S).useRef(null),D=m(S).useRef(null),z=m(S).useRef(null),B=m(S).useRef(!1),[F,H]=m(S).useState(null),[V,U]=m(S).useState({}),[$,q]=m(S).useState(0),W=(({store:e})=>{let[t,n]=m(S).useState(!1),[r,i]=m(S).useState({x:0,y:0});return{open:m(S).useCallback(e=>{n(!0),i(e)},[]),close:m(S).useCallback(()=>{n(!1)},[]),props:{isOpen:t,offset:r,setIsOpen:n}}})({store:e}),G=e.selectedElements.find(e=>e._cropModeEnabled),K=e.selectedElements.find(e=>e.curveEnabled),Y=e.selectedShapes.filter(e=>!e.resizable).length>0,X=e.selectedShapes.filter(e=>!e.draggable).length>0,Q=e.selectedElements.filter(e=>!e.visible).length>0;m(S).useLayoutEffect(()=>{if(!j.current)return;let t=j.current.getStage(),n=e.selectedShapes.map(e=>e._cropModeEnabled?null:t.findOne("#"+e.id)).filter(e=>!!e),r=1===e.selectedElements.length,i=r&&e.selectedElements[0]?.type||"many";fe[i]?(j.current.setAttrs({...h9,...fe[i]}),"svg"!==i&&"image"!==i&&"gif"!==i||e.selectedElements[0].keepRatio||j.current.setAttrs({enabledAnchors:h9.enabledAnchors}),"text"===i&&iS.textVerticalResizeEnabled&&j.current.setAttrs({enabledAnchors:fe.text.enabledAnchors?.concat(["bottom-center"])}),"text"===i&&r&&e.selectedElements[0].curveEnabled&&j.current.setAttrs({enabledAnchors:fe.many.enabledAnchors})):j.current.setAttrs(h9),Y&&j.current.enabledAnchors([]),X&&j.current.rotateEnabled(!1),n.find(e=>e?.isDragging())&&n.forEach(e=>{e.isDragging()||e?.startDrag()}),j.current.nodes(n),o$(),j.current.getLayer()?.batchDraw()},[e.selectedShapes,G,Y,Q,X,K]);let Z=()=>{let e=j.current;if(!e)return;if(!e.isTransforming())return void U({});if(!e.nodes().length||!e.isTransforming())return;let t=e.__getNodeRect(),n=e?.getActiveAnchor(),r=e.getStage();U({anchor:n,x:t.x-(r?.x()??0),y:t.y-(r?.y()??0),rotation:t.rotation,width:t.width,height:t.height})},J=m(S).useCallback(()=>{if(j.current?.isTransforming())return;let e=j.current;if(!e||!e.nodes().length)return void q(0);let t=e.getClientRect();e.getStage()&&q(function(e,t,n,r=0){let i=e.x+e.width/2,a=e.y+e.height/2,o=e.width/2,s=e.height/2,l=r*Math.PI/180,c=e=>{let t,r=e*Math.PI/180,c=(e%360+360)%360,u=Math.sin(r)*((t=0===c||180===c?s:o)+n),d=-Math.cos(r)*(t+n);return{x:i+(u*Math.cos(l)-d*Math.sin(l)),y:a+(u*Math.sin(l)+d*Math.cos(l))}},u=e=>e.x>=t.left&&e.x<=t.right&&e.y>=t.top&&e.y<=t.bottom;if(u(c(0)))return 0;for(let e of[180,270,90])if(u(c(e)))return e;return 0}(t,{top:O?.top||0,bottom:r-(O?.bottom||0),left:O?.left||0,right:n-(O?.right||0)},h9.rotateAnchorOffset||30,e.rotation()))},[O,n,r]);m(S).useEffect(()=>{j.current?.update(),Z(),J()},[e.scale,J]),m(S).useEffect(()=>{J()},[e.selectedShapes,J]);let ee=(A=()=>({visible:!1,x1:0,y1:0,x2:0,y2:0}),(0,S.useState)(function(){return(0,E.observable)(A(),void 0,{autoBind:!0})})[0]),et=m(S).useRef(!1),en=iK(),er=(0,E.action)(e=>{if(en)return;et.current=!1;let t=e.target.findAncestor(".elements-container"),n=e.target.findAncestor("Transformer"),r=e.target.findAncestor(".page-abs-container");if(t||n||r)return;let i=e.target.getStage()?.getPointerPosition();i&&(i.x-=e.target.getStage()?.x()??0,i.y-=e.target.getStage()?.y()??0,ee.visible=!0,ee.x1=i.x,ee.y1=i.y,ee.x2=i.x,ee.y2=i.y,(e.target.getStage()?.getPointersPositions().length??0)>=2&&(ee.visible=!1))});(({stageRef:e,containerRef:t,viewportSize:n})=>{m(S).useEffect(()=>{let n=t.current?.closest(".polotno-workspace-inner");function r(){if(!e.current)return;let r=t.current?.getBoundingClientRect(),i=n?.getBoundingClientRect();if(!r||!i)return;let a=Math.max(0,i.left-r.left-100),o=Math.max(0,i.top-r.top-100);e.current.position({x:-a,y:-o}),e.current.container().style.transform=`translate(${a}px, ${o}px)`}return r(),n?.addEventListener("scroll",r),()=>{n?.removeEventListener("scroll",r)}},[n.width,n.height])})({stageRef:D,containerRef:z,viewportSize:d}),m(S).useEffect(()=>{let t=(0,E.action)(e=>{if(!ee.visible)return;D.current?.setPointersPositions(e);let t=D.current?.getPointerPosition();t?(t.x-=D.current?.x()??0,t.y-=D.current?.y()??0):t={x:ee.x2,y:ee.y2},ee.x2=t.x,ee.y2=t.y}),n=(0,E.action)(()=>{if(!ee.visible||!D.current)return;let t=D.current.findOne(".selection"),n=t?t.getClientRect({skipStroke:!0}):{width:0,height:0,x:0,y:0};if(n.width&&n.height){let t=[];D.current.find(".element").forEach(r=>{let i=r.getClientRect(),a=e.getElementById(r.id()),o=a?.draggable,s=a?.selectable;n_.Util.haveIntersection(n,i)&&o&&s&&t.push(a.top.id)});let r=[...new Set(t)];et.current=!0,e.selectElements(r)}ee.visible=!1});return window.addEventListener("mousemove",t),window.addEventListener("touchmove",t),window.addEventListener("mouseup",n,{capture:!0}),window.addEventListener("touchend",n,{capture:!0}),()=>{window.removeEventListener("mousemove",t),window.removeEventListener("touchmove",t),window.removeEventListener("mouseup",n),window.removeEventListener("touchend",n)}},[]);let ei=m(S).useCallback(n=>{if(!e.selectedElements[0]||n&&e.selectedElementsIds.includes(n))return;let r=oB(e.selectedShapes),i=oz(n?e.getElementById(n):{x:0,y:0,width:t.computedWidth,height:t.computedHeight,rotation:0}),a=[];r.minX>i.maxX&&a.push({distance:r.minX-i.maxX,box1:r,box2:i,points:[{x:r.minX,y:r.minY+r.height/2},{x:i.maxX,y:r.minY+r.height/2},{x:i.maxX,y:i.minY+i.height/2}]}),r.maxX<i.minX&&a.push({distance:i.minX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:r.minY+r.height/2},{x:i.minX,y:r.minY+r.height/2},{x:i.minX,y:i.minY+i.height/2}]}),r.minY>i.maxY&&a.push({box1:r,box2:i,distance:r.minY-i.maxY,points:[{x:r.minX+r.width/2,y:r.minY},{x:r.minX+r.width/2,y:i.maxY},{x:i.minX+i.width/2,y:i.maxY}]}),r.maxY<i.minY&&a.push({box1:r,box2:i,distance:i.minY-r.maxY,points:[{x:r.minX+r.width/2,y:r.maxY},{x:r.minX+r.width/2,y:i.minY},{x:i.minX+i.width/2,y:i.minY}]});let o=r.minX>=i.minX&&r.maxX<=i.maxX&&r.minY>=i.minY&&r.maxY<=i.maxY;if(o&&(a.push({distance:r.minX-i.minX,box1:r,box2:i,points:[{x:r.minX,y:r.minY+r.height/2},{x:i.minX,y:r.minY+r.height/2},{x:i.minX,y:i.minY+i.height/2}]}),a.push({distance:i.maxX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:r.minY+r.height/2},{x:i.maxX,y:r.minY+r.height/2},{x:i.maxX,y:i.minY+i.height/2}]}),a.push({box1:r,box2:i,distance:r.minY-i.minY,points:[{x:r.minX+r.width/2,y:r.minY},{x:r.minX+r.width/2,y:i.minY},{x:i.minX+i.width/2,y:i.minY}]}),a.push({box1:r,box2:i,distance:i.maxY-r.maxY,points:[{x:r.minX+r.width/2,y:r.maxY},{x:r.minX+r.width/2,y:i.maxY},{x:i.minX+i.width/2,y:i.maxY}]})),0===a.length&&!o){let e=r.minX<i.maxX&&r.maxX>i.minX,t=r.minY<i.maxY&&r.maxY>i.minY;if(e&&t){let e=(Math.max(r.minY,i.minY)+Math.min(r.maxY,i.maxY))/2,t=(Math.max(r.minX,i.minX)+Math.min(r.maxX,i.maxX))/2;r.minX<i.minX?a.push({distance:i.minX-r.minX,box1:r,box2:i,points:[{x:r.minX,y:e},{x:i.minX,y:e},{x:i.minX,y:e}]}):a.push({distance:r.minX-i.minX,box1:r,box2:i,points:[{x:r.minX,y:e},{x:i.minX,y:e},{x:i.minX,y:e}]}),r.maxX>i.maxX?a.push({distance:r.maxX-i.maxX,box1:r,box2:i,points:[{x:i.maxX,y:e},{x:r.maxX,y:e},{x:i.maxX,y:e}]}):a.push({distance:i.maxX-r.maxX,box1:r,box2:i,points:[{x:r.maxX,y:e},{x:i.maxX,y:e},{x:i.maxX,y:e}]}),r.minY<i.minY?a.push({box1:r,box2:i,distance:i.minY-r.minY,points:[{x:t,y:r.minY},{x:t,y:i.minY},{x:t,y:i.minY}]}):a.push({box1:r,box2:i,distance:r.minY-i.minY,points:[{x:t,y:r.minY},{x:t,y:i.minY},{x:t,y:i.minY}]}),r.maxY>i.maxY?a.push({box1:r,box2:i,distance:r.maxY-i.maxY,points:[{x:t,y:i.maxY},{x:t,y:r.maxY},{x:t,y:i.maxY}]}):a.push({box1:r,box2:i,distance:i.maxY-r.maxY,points:[{x:t,y:r.maxY},{x:t,y:i.maxY},{x:t,y:i.maxY}]})}}JSON.stringify(F)!==JSON.stringify(a)&&H(a)},[e,t]);m(S).useEffect(()=>{e.distanceGuidesVisible?ei():F&&H(null)},[e.distanceGuidesVisible,ei,e.selectedShapes.map(e=>`${e.x},${e.y},${e.width},${e.height},${e.rotation}`).join("|")]);let ea=m(S).useRef(!1);m(S).useEffect(()=>{let e,t=z.current?.closest(".polotno-workspace-inner"),n=()=>{ea.current=!0,clearTimeout(e),e=setTimeout(()=>{ea.current=!1},300)};return t?.addEventListener("scroll",n),()=>{clearTimeout(e),t?.removeEventListener("scroll",n)}},[]),m(S).useEffect(()=>{let e=D.current;if(!e)return;let t=e.container(),n=e=>{e.touches.length>=2&&(j.current?.isDragging()&&j.current.stopDrag(),j.current?.nodes().forEach(e=>{e.isDragging()&&e.stopDrag()}))};return t.addEventListener("touchstart",n,{passive:!0}),t.addEventListener("touchmove",n,{passive:!0}),()=>{t.removeEventListener("touchstart",n),t.removeEventListener("touchmove",n)}},[]);let eo=n=>{if(e.activePage!==t&&t.select(),ea.current||et.current)return;let r=n.evt.ctrlKey||n.evt.metaKey||n.evt.shiftKey,i=n.target.findAncestor(".elements-container"),a=n.target.findAncestor(".page-abs-container"),o=n.target.findAncestor("Transformer");if(!r&&!i&&!o&&!a&&!ee.visible)return void e.selectElements([]);let s=n.target.findAncestor(".element-container",!0),l=s?.findOne(".element")||n.target.findAncestor(".element",!0),c=e.getElementById(l?.id()),u=c?.top,d=u?.id,h=e.selectedElementsIds.indexOf(d)>=0,f=n.target.findAncestor(".page-container",!0);d&&r&&!h?e.selectElements(e.selectedElementsIds.concat([d])):d&&r&&h?e.selectElements(e.selectedElementsIds.filter(e=>e!==d)):!d||r||h?f?e.selectPages([t.id]):e.selectPages([]):e.selectElements([d])};!function(e,t){let n=m(S).useRef(null);t&&(({stroke:e,strokeWidth:t,dash:n})=>{void 0!==e&&(oF.stroke=e),void 0!==t&&(oF.strokeWidth=t),void 0!==n&&(oF.dash=n)})(t);let r=e=>e.hasName("element")||e.hasName("page-background")||!n.current&&e.hasName("elements-area");function i(t){let n=e.current?.getStage(),i=[],a=[];return n.find(r).forEach(e=>{if(!(t.indexOf(e)>=0)){var n=e.getClientRect({skipShadow:!0,skipStroke:!0});i.push({offset:n.x,node:e,snap:"start"},{offset:n.x+n.width,node:e,snap:"end"},{offset:n.x+n.width/2,node:e,snap:"center"}),a.push({offset:n.y,node:e,snap:"start"},{offset:n.y+n.height,node:e,snap:"end"},{offset:n.y+n.height/2,node:e,snap:"center"})}}),{vertical:i,horizontal:a}}function a(t){let n=e.current?.getLayer(),r=n?.children.find(e=>"line-guides"===e.name());t.forEach(e=>{if("H"===e.orientation){var t=new n_.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[-6e3,e.lineGuide,6e3,e.lineGuide],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});r?.add(t),n.batchDraw()}else if("V"===e.orientation){var t=new n_.Line({x:-n.getStage().x(),y:-n.getStage().y(),points:[e.lineGuide,-6e3,e.lineGuide,6e3],stroke:oF.stroke,strokeWidth:oF.strokeWidth,name:"guid-line",dash:oF.dash});r?.add(t)}})}let o=e=>{let t,n,r,o=e.target.getLayer().children.find(e=>"line-guides"===e.name());o?.destroyChildren();var s,l=oU(i(e.target.nodes()),(n=oz({...t=(s=e.target).__getNodeRect(),rotation:n_.Util.radToDeg(t.rotation)}),r=s.getAbsolutePosition(),{vertical:[{guide:n.x,offset:r.x-n.x,snap:"start",nodes:s.nodes()},{guide:n.x+n.width/2,offset:r.x-n.x-n.width/2,snap:"center",nodes:s.nodes()},{guide:n.x+n.width,offset:r.x-n.x-n.width,snap:"end",nodes:s.nodes()}],horizontal:[{guide:n.y,offset:r.y-n.y,snap:"start",nodes:s.nodes()},{guide:n.y+n.height/2,offset:r.y-n.y-n.height/2,snap:"center",nodes:s.nodes()},{guide:n.y+n.height,offset:r.y-n.y-n.height,snap:"end",nodes:s.nodes()}]}));if(!l.length)return;a(l);let c=e.target.getAbsolutePosition();e.target.nodes().map(e=>e.getAbsolutePosition());let u={...c};l.forEach(e=>{switch(e.snap){case"start":case"center":case"end":switch(e.orientation){case"V":u.x=e.lineGuide+e.offset;break;case"H":u.y=e.lineGuide+e.offset}}});let d=u.x-c.x,h=u.y-c.y;e.evt.ctrlKey||e.evt.metaKey||e.target.nodes().forEach(e=>{let t=e.getAbsolutePosition();e.setAbsolutePosition({x:t.x+d,y:t.y+h})})},s=(t,n,r)=>{let o,s=e.current,l=s.getLayer().children.find(e=>"line-guides"===e.name());if(l?.destroyChildren(),"rotater"===s.getActiveAnchor())return n;let c=oG[s.getActiveAnchor()],u=s.findOne(`.${c}`)?.getAbsolutePosition();if(!u)return n;let d={x:t.x-u.x,y:t.y-u.y},h=(p={x:n.x-t.x,y:n.y-t.y},{x:(o=oW(p,m=d)/oW(m,m))*m.x,y:o*m.y});if(Math.sqrt(Math.pow(h.x,2)+Math.pow(h.y,2))>5)return n;let f={x:t.x+h.x,y:t.y+h.y};var p,m,g=oU(i(s.nodes()),{vertical:[{guide:f.x,offset:0,snap:"start",nodes:s.nodes()}],horizontal:[{guide:f.y,offset:0,snap:"start",nodes:s.nodes()}]});if(!g.length||(a(g),r.ctrlKey||r.metaKey))return n;let y=[];if(g.forEach(e=>{let t=function(e,t,n){if("V"===n.orientation){let r=n.lineGuide;if(1e-4>Math.abs(t.x-e.x))return null;let i=(t.y-e.y)/(t.x-e.x),a=e.y-i*e.x;return{x:r,y:i*r+a}}{let r=n.lineGuide;if(1e-4>Math.abs(t.y-e.y))return null;let i=(t.y-e.y)/(t.x-e.x);return{x:(r-e.y)/i+e.x,y:r}}}(f,u,{orientation:e.orientation,lineGuide:e.lineGuide});t&&y.push(t)}),y.length>0){let e=y[0],t=Math.sqrt(Math.pow(f.x-e.x,2)+Math.pow(f.y-e.y,2));if(y.forEach(n=>{let r=Math.sqrt(Math.pow(f.x-n.x,2)+Math.pow(f.y-n.y,2));r<t&&(t=r,e=n)}),t<10)return e}return f},l=e=>{if(!e.target)return;let t=e.target.getLayer(),n=t.children.find(e=>"line-guides"===e.name());n?.destroyChildren(),t.batchDraw()};m(S).useEffect(()=>{e.current&&(e.current.anchorDragBoundFunc(s),e.current.on("dragstart",e=>{setTimeout(()=>{o$()})}),e.current.on("dragmove",o),e.current.on("dragend",l),e.current.on("transformend",l),e.current.on("transform",t=>{t.evt.ctrlKey||t.evt.metaKey?e.current?.rotationSnapTolerance(0):e.current?.rotationSnapTolerance(5)}))},[])}(j,{stroke:g,strokeWidth:y,dash:v});let es=e.activePage===t,el=e._selectedPagesIds.includes(t.id),ec=l?.PageControls,eu=l?.Tooltip,ed=l?.ContextMenu,eh=1/e.scale,ef=0/e.scale;return(0,C.jsxs)("div",{ref:z,onDragOver:e=>e.preventDefault(),onDrop:n=>{if(n.preventDefault(),!D.current)return;D.current.setPointersPositions(n);let r=D.current.findOne(".elements-container"),i=r?.getRelativePointerPosition(),a=D.current.getPointerPosition(),o=[...new Set(D.current.getAllIntersections(a).map(e=>e.findAncestor(".element",!0)).filter(Boolean).reverse())].map(t=>e.getElementById(t.id())).filter(e=>!!e),s=o[0];fc&&i&&(fc(i,s,{elements:o,page:t}),fc=null)},style:{position:"relative",width:n+"px",height:r+"px",overflow:"hidden",flexShrink:0},className:"polotno-page-container"+(es?" active-page":""),children:[(0,C.jsx)(rN,{ref:D,width:Math.min(n,d.width+200),height:Math.min(d.height+200,r),onClick:eo,onTap:eo,onContextMenu:t=>{t.evt.preventDefault();let n=t.target.findAncestor(".element",!0),r=e.getElementById(n?.id()),i=r?.top,a=i?.id;a?e.selectedElementsIds.indexOf(a)>=0||e.selectElements([a]):e.selectElements([]),W.open({x:t.evt.clientX,y:t.evt.clientY})},onMouseDown:er,onMouseMove:t=>{if(!(e.distanceGuidesVisible||t.evt.altKey)){F&&H(null);return}let n=t.target.findAncestor(".element",!0);ei(n?.id())},onDragStart:t=>{let n=t.target.getStage();if(n&&n.getPointersPositions().length>=2)return void t.target.stopDrag();let r=t.target.findAncestor(".element",!0);if(r){let n=e.getElementById(r?.id()),i=n?.top,a=i?.id;!(e.selectedElementsIds.indexOf(a)>=0)&&a&&(e.selectElements([a]),t.target.stopDrag(),t.target.startDrag(t),j.current?.startDrag(t))}F&&H(null)},pageId:t.id,style:{position:"absolute",overflow:"hidden",top:0,left:0},children:(0,C.jsxs)("Layer",{children:[(0,C.jsx)(fn,{width:n,height:r,fill:a}),(0,C.jsx)(rE,{x:M,y:N,scaleX:e.scale,scaleY:e.scale,name:"page-container",children:(0,C.jsxs)(rE,{name:"page-container-2",children:[(0,C.jsx)(rE,{name:"page-background-group",x:I,y:I,children:(0,C.jsx)(fa,{x:-t.bleed,y:-t.bleed,width:t.computedWidth+2*t.bleed,height:t.computedHeight+2*t.bleed,background:t.background,name:"page-background",preventDefault:!1,scale:e.scale})}),(0,C.jsxs)(rE,{x:I,y:I,name:"elements-container",listening:!e.isPlaying,children:[(0,C.jsx)(rP,{name:"elements-area",width:t.computedWidth,height:t.computedHeight,listening:!1}),(0,C.jsx)(fl,{elements:t.children,store:e})]}),(0,C.jsx)(rP,{stroke:c,name:"bleed",strokeWidth:t.bleed,x:t.bleed/2,y:t.bleed/2,width:t.computedWidth+t.bleed,height:t.computedHeight+t.bleed,listening:!1,visible:t.bleed>0&&e.bleedVisible,hideInExport:!0}),dz.value===ff&&(0,C.jsx)(fp,{name:"hit-detection",x:-eh/2-ef,y:-eh/2-ef,width:R+eh+2*ef,height:L+eh+2*ef})]})}),(0,C.jsx)(rO,{name:"workspace-background",points:[0,0,n,0,n,r,0,r,0,0,M,N,M,r-N,n-M,r-N,n-M,N,M,N],listening:!1,closed:!0,fill:a}),(0,C.jsx)(rE,{x:M,y:N,scaleX:e.scale,scaleY:e.scale,children:(0,C.jsx)(rP,{name:"page-highlight",hideInExport:!0,x:-eh/2-ef,y:-eh/2-ef,width:R+eh+2*ef,height:L+eh+2*ef,stroke:el?s:o,strokeWidth:2,listening:!1,strokeScaleEnabled:!1})}),(0,C.jsxs)(rE,{x:M+I*e.scale,y:N+I*e.scale,scaleX:e.scale,scaleY:e.scale,name:"page-abs-container",children:[(0,C.jsx)(rL,{ref:j,rotateAnchorAngle:$,onDragStart:n=>{let r=n.target.getStage();r&&r.getPointersPositions().length>=2?n.target.stopDrag():(n.evt?.altKey&&u&&e.selectedElements.forEach(e=>{let n=e.clone({},{skipSelect:!0}),r=t.children.indexOf(e);t.setElementZIndex(n.id,r)}),B.current=!0,e.history.startTransaction())},onDragEnd:()=>{B.current&&(e.history.endTransaction(),B.current=!1),J()},onTransformStart:()=>{e.history.startTransaction(),H(null)},boundBoxFunc:(e,t)=>{let n=1>Math.abs(t.width)||1>Math.abs(t.height),r=1>Math.abs(e.width)||1>Math.abs(e.height);return n&&!r?e:t},onTransform:e=>{let t=j.current.nodes(),n=t[t.length-1];e.target===n&&setTimeout(()=>{Z()},0)},onTransformEnd:t=>{U({}),e.history.endTransaction(),J()},visible:!e.isPlaying}),F&&F.map(({points:t,distance:n,box1:r,box2:i},a)=>(0,C.jsxs)(rE,{name:"distances-container",hideInExport:!0,listening:!1,children:[(0,C.jsx)(rP,{...r,stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsx)(rP,{...i,stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsx)(rO,{points:[t[0].x,t[0].y,t[1].x,t[1].y],stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsx)(rO,{points:[t[1].x,t[1].y,t[2].x,t[2].y],stroke:w,strokeWidth:1,strokeScaleEnabled:!1}),(0,C.jsxs)(rT,{x:(t[0].x+t[1].x)/2,y:(t[0].y+t[1].y)/2,offsetY:-10,scaleX:1/e.scale,scaleY:1/e.scale,children:[(0,C.jsx)("Tag",{cornerRadius:5,fill:k,pointerDirection:"down"}),(0,C.jsx)(rI,{align:"center",verticalAlign:"middle",fill:_,padding:5,text:(e=>{let t=parseFloat(d0(e).toFixed(1));switch(e.unit){case"pt":return`${Math.round(t)}pt`;case"mm":return`${t}mm`;case"cm":return`${t}cm`;case"in":return`${t}in`;default:return`${Math.round(t)}px`}})({unit:e.unit,dpi:e.dpi,px:n})})]})]},a)),t._rendering&&(0,C.jsxs)(rE,{children:[(0,C.jsx)(rP,{width:R,height:L,fill:"rgba(255,255,255,0.9)"}),(0,C.jsx)(rI,{text:"Rendering...",fontSize:60,width:R,height:L,align:"center",verticalAlign:"middle"})]}),eu&&(0,C.jsx)(eu,{components:l,store:e,page:t,stageRef:D,tooltipSafeArea:P}),ed&&(0,C.jsx)(rz,{children:(0,C.jsx)(ed,{components:l,store:e,...W.props})})]}),(0,C.jsx)(h3,{store:e,page:t,width:n,height:r,scale:e.scale,xPadding:M,yPadding:N,bleed:I}),(0,C.jsx)(fs,{...V,store:e,tagFill:b,textFill:x}),(0,C.jsx)(fo,{selection:ee,fill:h,stroke:f,strokeWidth:p}),dB.value>0&&(0,C.jsxs)(rE,{hideInExport:!0,children:[(0,C.jsx)(fv,{name:"cache-bounds",x:n-(1===dB.value?250:210),y:r-(1===dB.value?95:45)}),(0,C.jsx)(fv,{name:"cache-bounds-t",x:10,y:10})]}),dD.value&&(0,C.jsx)(rI,{text:"Powered by polotno.com",fontSize:14,fill:"rgba(0,0,0,0.6)",x:n-170,y:r-18,onMouseEnter:e=>{e.target.getStage().container().style.cursor="pointer"},onMouseLeave:e=>{e.target.getStage().container().style.cursor=""},onTouchStart:e=>{e.cancelBubble=!0},onMouseDown:e=>{e.cancelBubble=!0},onClick:()=>{window.open("https://polotno.com")},onTap:()=>{window.open("https://polotno.com")}}),(0,C.jsx)(rE,{name:"line-guides"})]})}),(i??!0)&&ec&&(0,C.jsx)(ec,{store:e,page:t,xPadding:M,yPadding:N,layout:T})]})}),S=x("8NFma");let fx=ok("div",m(S).forwardRef)`
|
|
356
356
|
position: absolute;
|
|
357
357
|
top: 0;
|
|
358
358
|
left: 0;
|