1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1f0f9a5e-712d-59eb-a461-3ca190e129c0")}catch(e){}}(); 3(globalThis.webpackChunksat_monorepo=globalThis.webpackChunksat_monorepo||[]).push([[2982],{97058(t,e,i){"use strict";i.d(e,{L:()=>o});var n=i(74692),r=!1;function o(){setInterval(function(){!1===r&&s()},18e5)}var s=function(){n("#expirationWarning").hasClass("hidden")&&(n("#expirationWarning").toast("show"),n("#expirationWarning").toggleClass("hidden"))},a=function(){n("#expirationWarning").toast("hide"),n("#expirationWarning").addClass("hidden")};function h(){r=!0}n("#dismissExpirationWarning").on("click",function(){a()}),n("#dontRemindMeExpirationWarning").on("click",function(){a(),h()}),n(".save-as-btn").on("click",function(){a(),h()})},11732(t,e,i){"use strict";i.d(e,{e:()=>r});var n=i(74692);class r{constructor(){this.logBrokenThumbnailSent=!1}getContainer(){const t=n("#editor-pages");if(t.length>0)return t;const e=n("#pages-sort");if(e.length>0)return e;const i=n(".pages-container");if(0===i.length)throw new Error("could not find container");return i}getPageBoxes(){return this.getContainer().find(".page-tpl-box")}getNumberOfPages(){return this.getPageBoxes().length}updatePages(t){var e=this.getContainer();e.find(".page-tpl-box").detach(),e.append(t)}getSelectedPages(){return this.getContainer().find(".page-tpl-box.i-am-selected")}getInputIds(){var t=this.getPageBoxes();let e=[];return t.each(function(t){e.push(n(this).data("input"))}),e}}},12474(t,e,i){var n=i(74692);t.exports=function t(e,i,n){function r(s,a){if(!i[s]){if(!e[s]){if(o)return o(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var l=i[s]={exports:{}};e[s][0].call(l.exports,function(t){var i=e[s][1][t];return r(i||t)},l,l.exports,t,e,i,n)}return i[s].exports}for(var o=void 0,s=0;s<n.length;s++)r(n[s]);return r}({1:[function(t,e,i){var n,r,o,s,a,h,l,c,u,p,d,g=function(t,e){return function(){return t.apply(e,arguments)}},f=[].slice,y=[].indexOf||function(t){for(var e=0,i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1};o=t("./actions"),s=t("./bindEvents"),a=t("./math"),(h=t("./shapes")).createShape,p=h.shapeToJSON,r=h.JSONToShape,l=t("./canvasRenderer").renderShapeToContext,t("./svgRenderer").renderShapeToSVG,c=t("./renderSnapshotToImage"),u=t("./renderSnapshotToSVG"),t("../tools/Pencil"),d=t("./util"),n="infinite",e.exports=function(){function t(t,e){var i,r;this.setImageSize=g(this.setImageSize,this),r=null,i=null,t instanceof HTMLElement?(i=t,r=e):r=t,this.opts=r||{},this.config={zoomMin:r.zoomMin||.2,zoomMax:r.zoomMax||4,zoomStep:r.zoomStep||.2},this.colors={primary:r.primaryColor||"#000",secondary:r.secondaryColor||"#fff",background:r.backgroundColor||"transparent"},this.watermarkImage=r.watermarkImage,this.watermarkScale=r.watermarkScale||1,this.backgroundCanvas=document.createElement("canvas"),this.backgroundCtx=this.backgroundCanvas.getContext("2d"),this.canvas=document.createElement("canvas"),this.canvas.style["background-color"]="transparent",this.buffer=document.createElement("canvas"),this.buffer.style["background-color"]="transparent",this.ctx=this.canvas.getContext("2d"),this.bufferCtx=this.buffer.getContext("2d"),this.backingScale=d.getBackingScale(this.ctx),this.backgroundShapes=r.backgroundShapes||[],this._shapesInProgress=[],this.shapes=[],this.undoStack=[],this.redoStack=[],this.deleteStack=[],this.shapeDeletedStack=[],this.isDragging=!1,this.position={x:0,y:0},this.scale=1,this.setTool(new this.opts.tools[0](this)),this.width=r.imageSize.width||n,this.height=r.imageSize.height||n,this.setZoom(this.scale),r.snapshot&&this.loadSnapshot(r.snapshot),this.isBound=!1,i&&this.bindToElement(i)}return t.prototype.bindToElement=function(t){var e,i,n;if(!this.containerEl)return this.containerEl=t,this._unsubscribeEvents=s(this,this.containerEl,this.opts.keyboardShortcuts),this.containerEl.style["background-color"]=this.colors.background,this.containerEl.appendChild(this.backgroundCanvas),this.containerEl.appendChild(this.canvas),this.isBound=!0,n=this,i=function(){return n.keepPanInImageBounds(),n.repaintAllLayers()},d.matchElementSize(this.containerEl,[this.backgroundCanvas,this.canvas],this.backingScale,i),this.watermarkImage&&(this.watermarkImage.onload=function(t){return function(){return t.repaintLayer("background")}}(this)),null!=(e=this.tool)&&e.didBecomeActive(this),i();console.warn("Trying to bind Literally Canvas to a DOM element more than once is unsupported.")},t.prototype._teardown=function(){return this.tool.willBecomeInactive(this),"function"==typeof this._unsubscribeEvents&&this._unsubscribeEvents(),this.tool=null,this.containerEl=null,this.isBound=!1},t.prototype.trigger=function(t,e){return this.canvas.dispatchEvent(new CustomEvent(t,{detail:e})),null},t.prototype.on=function(t,e){var i,n;return i=function(t){return e(t.detail)},this.canvas.addEventListener(t,i),n=this,function(){return n.canvas.removeEventListener(t,i)}},t.prototype.getRenderScale=function(){return this.scale*this.backingScale},t.prototype.clientCoordsToDrawingCoords=function(t,e){return{x:(t*this.backingScale-this.position.x)/this.getRenderScale(),y:(e*this.backingScale-this.position.y)/this.getRenderScale()}},t.prototype.drawingCoordsToClientCoords=function(t,e){return{x:t*this.getRenderScale()+this.position.x,y:e*this.getRenderScale()+this.position.y}},t.prototype.setImageSize=function(t,e){return this.width=t||n,this.height=e||n,this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("imageSizeChange",{width:this.width,height:this.height})},t.prototype.setTool=function(t){var e;if(this.isBound&&null!=(e=this.tool)&&e.willBecomeInactive(this),this.tool=t,this.trigger("toolChange",{tool:t}),this.isBound)return this.tool.didBecomeActive(this)},t.prototype.setShapesInProgress=function(t){return this._shapesInProgress=t},t.prototype.pointerDown=function(t,e){var i;return i=this.clientCoordsToDrawingCoords(t,e),void 0!==this.tool&&""!=this.tool&&void 0!==this.tool.usesSimpleAPI&&this.tool.usesSimpleAPI?(this.tool.begin(i.x,i.y,this),this.isDragging=!0,this.trigger("drawStart",{tool:this.tool})):(this.isDragging=!0,this.trigger("lc-pointerdown",{tool:this.tool,x:i.x,y:i.y,rawX:t,rawY:e}))},t.prototype.pointerMove=function(t,e){return d.requestAnimationFrame((i=this,function(){var n,r;return n=i.clientCoordsToDrawingCoords(t,e),(null!=(r=i.tool)?r.usesSimpleAPI:void 0)?i.isDragging?(i.tool.continue(n.x,n.y,i),i.trigger("drawContinue",{tool:i.tool})):void 0:i.isDragging?i.trigger("lc-pointerdrag",{tool:i.tool,x:n.x,y:n.y,rawX:t,rawY:e}):i.trigger("lc-pointermove",{tool:i.tool,x:n.x,y:n.y,rawX:t,rawY:e})}));var i},t.prototype.pointerUp=function(t,e){var i;return i=this.clientCoordsToDrawingCoords(t,e),void 0!==this.tool&&""!=this.tool&&void 0!==this.tool.usesSimpleAPI&&this.tool.usesSimpleAPI?this.isDragging?(this.tool.end(i.x,i.y,this),this.isDragging=!1,this.trigger("drawEnd",{tool:this.tool})):void 0:(this.isDragging=!1,this.trigger("lc-pointerup",{tool:this.tool,x:i.x,y:i.y,rawX:t,rawY:e}))},t.prototype.setColor=function(t,e){if(this.colors[t]=e,this.isBound){switch(t){case"background":this.containerEl.style.backgroundColor=this.colors.background,this.repaintLayer("background");break;case"primary":case"secondary":this.repaintLayer("main")}return this.trigger(t+"ColorChange",this.colors[t]),"background"===t?this.trigger("drawingChange"):void 0}},t.prototype.getColor=function(t){return this.colors[t]}
3,t.prototype.saveShape=function(t,e,i,n){return null==e&&(e=!0),null==i&&(i=null),i||(i=this.shapes.length?this.shapes[this.shapes.length-1].id:null),this.execute(new o.AddShapeAction(this,t,i)),e&&this.trigger("shapeSave",{shape:t,previousShapeId:i}),this.trigger("drawingChange")},t.prototype.pan=function(t,e){return this.setPan(this.position.x-t,this.position.y-e)},t.prototype.keepPanInImageBounds=function(){var t,e,i,r;return e=this.getRenderScale(),i=(t=this.position).x,r=t.y,this.width!==n&&(i=this.canvas.width>this.width*e?(this.canvas.width-this.width*e)/2:Math.max(Math.min(0,i),this.canvas.width-this.width*e)),this.height!==n&&(r=this.canvas.height>this.height*e?(this.canvas.height-this.height*e)/2:Math.max(Math.min(0,r),this.canvas.height-this.height*e)),this.position={x:i,y:r}},t.prototype.setPan=function(t,e){return this.position={x:t,y:e},this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("pan",{x:this.position.x,y:this.position.y})},t.prototype.zoom=function(t){var e;return e=this.scale+t,e=Math.max(e,this.config.zoomMin),e=Math.min(e,this.config.zoomMax),e=Math.round(100*e)/100,this.setZoom(e)},t.prototype.setZoom=function(t){var e;return e=this.scale,this.scale=t,this.position.x=a.scalePositionScalar(this.position.x,this.canvas.width,e,this.scale),this.position.y=a.scalePositionScalar(this.position.y,this.canvas.height,e,this.scale),this.keepPanInImageBounds(),this.repaintAllLayers(),this.trigger("zoom",{oldScale:e,newScale:this.scale})},t.prototype.setWatermarkImage=function(t){var e;if(this.watermarkImage=t,d.addImageOnload(t,(e=this,function(){return e.repaintLayer("background")})),t.width)return this.repaintLayer("background")},t.prototype.repaintAllLayers=function(){var t,e,i,n;for(t=0,i=(n=["background","main"]).length;t<i;t++)e=n[t],this.repaintLayer(e);return null},t.prototype.repaintLayer=function(t,e){var i;if(null==e&&(e="main"===t),this.isBound){switch(t){case"background":this.backgroundCtx.clearRect(0,0,this.backgroundCanvas.width,this.backgroundCanvas.height),n=this,i=function(){return n.repaintLayer("background")},this.watermarkImage&&this._renderWatermark(this.backgroundCtx,!0,i),this.draw(this.backgroundShapes,this.backgroundCtx,i);break;case"main":i=function(t){return function(){return t.repaintLayer("main",!0)}}(this),e&&(this.buffer.width=this.canvas.width,this.buffer.height=this.canvas.height,this.bufferCtx.clearRect(0,0,this.buffer.width,this.buffer.height),this.draw(this.shapes,this.bufferCtx,i)),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.canvas.width>0&&this.canvas.height>0&&(this.ctx.fillStyle="#ccc",this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height),this.clipped(function(t){return function(){return t.ctx.clearRect(0,0,t.canvas.width,t.canvas.height),t.ctx.drawImage(t.buffer,0,0)}}(this),this.ctx),this.clipped(function(t){return function(){return t.transformed(function(){var e,i,n,r,o;for(r=[],e=0,i=(n=t._shapesInProgress).length;e<i;e++)o=n[e],r.push(l(t.ctx,o,{bufferCtx:t.bufferCtx,shouldOnlyDrawLatest:!0}));return r},t.ctx,t.bufferCtx)}}(this),this.ctx,this.bufferCtx))}var n;return this.trigger("repaint",{layerKey:t})}},t.prototype._renderWatermark=function(t,e,i){if(null==e&&(e=!0),this.watermarkImage.width)return t.save(),t.translate(t.canvas.width/2,t.canvas.height/2),t.scale(this.watermarkScale,this.watermarkScale),e&&t.scale(this.backingScale,this.backingScale),t.drawImage(this.watermarkImage,-this.watermarkImage.width/2,-this.watermarkImage.height/2),t.restore();this.watermarkImage.onload=i},t.prototype.drawShapeInProgress=function(t){return this.repaintLayer("main",!1),this.clipped((e=this,function(){return e.transformed(function(){return l(e.ctx,t,{bufferCtx:e.bufferCtx,shouldOnlyDrawLatest:!0})},e.ctx,e.bufferCtx)}),this.ctx,this.bufferCtx);var e},t.prototype.draw=function(t,e,i){var n,r;if(t.length)return n=function(){var n,r,o,s;for(o=[],n=0,r=t.length;n<r;n++)s=t[n],o.push(l(e,s,{retryCallback:i}));return o},this.clipped((r=this,function(){return r.transformed(n,e)}),e)},t.prototype.clipped=function(){var t,e,i,r,o,s,a,h,l,c,u,p;
3for(i=arguments[0],t=2<=arguments.length?f.call(arguments,1):[],u=this.width===n?0:this.position.x,p=this.height===n?0:this.position.y,c=function(){return this.width===n?this.canvas.width:this.width*this.getRenderScale()}.call(this),r=function(){return this.height===n?this.canvas.height:this.height*this.getRenderScale()}.call(this),o=0,a=t.length;o<a;o++)(e=t[o]).save(),e.beginPath(),e.rect(u,p,c,r),e.clip();for(i(),l=[],s=0,h=t.length;s<h;s++)e=t[s],l.push(e.restore());return l},t.prototype.transformed=function(){var t,e,i,n,r,o,s,a,h;for(i=arguments[0],n=0,o=(t=2<=arguments.length?f.call(arguments,1):[]).length;n<o;n++)(e=t[n]).save(),e.translate(Math.floor(this.position.x),Math.floor(this.position.y)),h=this.getRenderScale(),e.scale(h,h);for(i(),a=[],r=0,s=t.length;r<s;r++)e=t[r],a.push(e.restore());return a},t.prototype.clear=function(t){var e,i;return null==t&&(t=!0),i=this.shapes,e=[],this.setShapesInProgress([]),this.execute(new o.ClearAction(this,i,e)),this.repaintLayer("main"),t&&this.trigger("clear",null),this.trigger("drawingChange",{})},t.prototype.execute=function(t){return this.undoStack.push(t),this.deleteStack.push(t),t.do(),this.redoStack=[]},t.prototype.undo=function(){var t;if(this.undoStack.length)return(t=this.undoStack.pop()).undo(),this.redoStack.push(t),this.trigger("undo",{action:t}),this.trigger("drawingChange",{})},t.prototype.delete=function(t){if(this.deleteStack.length){var e,i,n=this.deleteStack.pop();return n.delete(t),this.trigger("delete",{action:n}),i=t,e=[],this.setShapesInProgress([]),new o.ClearAction(this,i,e),this.repaintLayer("main"),t&&this.trigger("clear",null),this.trigger("drawingChange",{})}},t.prototype.clearDrawing=function(t){var e,i,n,r,o;if(void 0!==t.rectcopy)for(n=[],e=0,i=(r=this.shapes).length;e<i;e++)void 0===(o=r[e]).rectcopy&&n.push(o);return this.shapes=n,this.repaintLayer("main"),this.trigger("drawingChange",{})},t.prototype.redo=function(){var t;if(this.redoStack.length)return t=this.redoStack.pop(),this.undoStack.push(t),this.deleteStack.push(t),t.do(),this.trigger("redo",{action:t}),this.trigger("drawingChange",{})},t.prototype.canUndo=function(){return!!this.undoStack.length},t.prototype.canRedo=function(){return!!this.redoStack.length},t.prototype.getPixel=function(t,e){var i,n;return i=this.drawingCoordsToClientCoords(t,e),(n=this.ctx.getImageData(i.x,i.y,1,1).data)[3]?"rgb("+n[0]+", "+n[1]+", "+n[2]+")":null},t.prototype.getContentBounds=function(){return d.getBoundingRect(this.shapes.concat(this.backgroundShapes).map(function(t){return t.getBoundingRect()}),this.width===n?0:this.width,this.height===n?0:this.height)},t.prototype.getDefaultImageRect=function(t,e){var i;return null==t&&(t={width:0,height:0}),null==e&&(e={top:0,right:0,bottom:0,left:0}),d.getDefaultImageRect(function(){var t,e,n,r;for(r=[],t=0,e=(n=this.shapes.concat(this.backgroundShapes)).length;t<e;t++)i=n[t],r.push(i.getBoundingRect(this.ctx));return r}.call(this),t,e)},t.prototype.getImage=function(t){return null==t&&(t={}),null==t.includeWatermark&&(t.includeWatermark=!0),null==t.scaleDownRetina&&(t.scaleDownRetina=!0),null==t.scale&&(t.scale=1),t.scaleDownRetina||(t.scale*=this.backingScale),t.includeWatermark&&(t.watermarkImage=this.watermarkImage,t.watermarkScale=this.watermarkScale,t.scaleDownRetina||(t.watermarkScale*=this.backingScale)),c(this.getSnapshot(),t)},t.prototype.canvasForExport=function(){return this.repaintAllLayers(),d.combineCanvases(this.backgroundCanvas,this.canvas)},t.prototype.canvasWithBackground=function(t){return d.combineCanvases(t,this.canvasForExport())},t.prototype.getSnapshot=function(t){var e,i,n,r,o,s;for(null==t&&(t=null),null==t&&(t=["shapes","imageSize","colors","position","scale","backgroundShapes"]),s={},e=0,n=(r=["colors","position","scale"]).length;e<n;e++)i=r[e],y.call(t,i)>=0&&(s[i]=this[i]);return y.call(t,"shapes")>=0&&(s.shapes=function(){var t,e,i,n;for(n=[],t=0,e=(i=this.shapes).length;t<e;t++)o=i[t],n.push(p(o));return n}.call(this)),y.call(t,"backgroundShapes")>=0&&(s.backgroundShapes=function(){var t,e,i,n;for(n=[],t=0,e=(i=this.backgroundShapes).length;t<e;t++)o=i[t],n.push(p(o));return n}.call(this)),y.call(t,"imageSize")>
3=0&&(s.imageSize={width:this.width,height:this.height}),s},t.prototype.getSnapshotJSON=function(){return console.warn("lc.getSnapshotJSON() is deprecated. use JSON.stringify(lc.getSnapshot()) instead."),JSON.stringify(this.getSnapshot())},t.prototype.getSVGString=function(t){return null==t&&(t={}),u(this.getSnapshot(),t)},t.prototype.loadSnapshot=function(t){var e,i,n,s,a,h,l,c,u,p;if(t){if(t.colors)for(e=0,s=(h=["primary","secondary","background"]).length;e<s;e++)n=h[e],this.setColor(n,t.colors[n]);if(t.shapes)for(this.shapes=[],i=0,a=(l=t.shapes).length;i<a;i++)p=l[i],(u=r(p))&&this.execute(new o.AddShapeAction(this,u));return t.backgroundShapes&&(this.backgroundShapes=function(){var e,i,n,o;for(o=[],e=0,i=(n=t.backgroundShapes).length;e<i;e++)c=n[e],o.push(r(c));return o}()),t.imageSize&&(this.width=t.imageSize.width,this.height=t.imageSize.height),t.position&&(this.position=t.position),t.scale&&(this.scale=t.scale),this.repaintAllLayers(),this.trigger("snapshotLoad"),this.trigger("drawingChange",{})}},t.prototype.loadSnapshotJSON=function(t){return console.warn("lc.loadSnapshotJSON() is deprecated. use lc.loadSnapshot(JSON.parse(snapshot)) instead."),this.loadSnapshot(JSON.parse(t))},t.prototype.rerender=function(t){var e;e=this.shapes,this.setShapesInProgress([]),this.execute(new o.ClearAction(this,e,t),!1),this.trigger("drawingChange",{}),this.repaintLayer("main")},t}()},{"../tools/Pencil":24,"./actions":3,"./bindEvents":4,"./canvasRenderer":5,"./math":10,"./renderSnapshotToImage":11,"./renderSnapshotToSVG":12,"./shapes":13,"./svgRenderer":14,"./util":15}],2:[function(t,e,i){var r,o,s,a,h,l;l=function(t,e,i){var r=n("<span>"+t+"</span>").css({"font-family":e,"font-size":i});n("body").append(r);var o=parseInt(window.getComputedStyle(r[0]).fontSize,10)-1;return r.remove(),o},h=function(t,e,i,n){var r=i.x,o=l(e,i.fontFamily,i.size);"line-through"==i.name&&(o/=2);var s=i.y+o;t.beginPath(),t.strokeStyle=i.color,t.lineWidth=1,t.moveTo(r,s),t.lineTo(r+t.measureText(e).width,s),t.stroke()},t("./fontmetrics.js"),a=function(t){var e,i,n,r,o,s;for(i=0,r=0,o=(e=t.split(" ")).length;r<o;r++)n=e[r],s=parseInt(n.replace("px",""),10),isNaN(s)||(i=s);if(!i)throw"Font size not found";return{fontSize:i,fontFamily:t.substring(e[0].length+e[1].length+e[2].length+e[3].length+e[4].length+5),textDecoration:e[4]}},s=function(t,e,i){var n,r,o,s,a,h,l,c,u,p;if(!e.length)return["",""];for(r=0,h=0,l=0,p=!1;;)if(s=(a=!(o=(r+=1)>=e.length)&&e[r].match(/\s/))||o,u=e.substring(0,r),(n=!i||t.measureTextWidth(u).width<=i)&&(l=r),s&&p&&(p=!1,n&&(h=r)),p=!a,o||!n){if(n)return[e,""];if(h>0){for(c=h+1;c<e.length&&e[c].match("/s/");)c+=1;return[e.substring(0,h),e.substring(c)]}return[e.substring(0,l),e.substring(l)]}},o=function(t,e,i){var n,r,o,a,h,l,c,u,p;for(o=[],n=0,r=(p=e.split(/\r\n|\r|\n/g)).length;n<r;n++)if(u=p[n],a=(h=s(t,u,i))[0],c=h[1],a)for(;a;)o.push(a),a=(l=s(t,c,i))[0],c=l[1];else o.push(u);return o},r=function(){function t(t,e,i,n,r,s,h,l){var c,u,p,d;this.text=e,this.font=i,this.forcedWidth=n,this.forcedHeight=r,c=(p=a(this.font)).fontFamily,u=p.fontSize,this.textDecoration={name:p.textDecoration,x:s,y:h,fontFamily:c,color:l,size:u},t.font=this.font.replace("underline ","").replace("line-through ","").replace("none ",""),t.textBaseline="baseline",this.emDashWidth=t.measureTextWidth("â",u,c).width,this.caratWidth=t.measureTextWidth("|",u,c).width,this.lines=o(t,this.text,this.forcedWidth),this.metricses=this.lines.map((d=this,function(e){return t.measureText2(e||"X",u,d.font)})),this.metrics={ascent:Math.max.apply(Math,this.metricses.map(function(t){return t.ascent})),descent:Math.max.apply(Math,this.metricses.map(function(t){return t.descent})),fontsize:Math.max.apply(Math,this.metricses.map(function(t){return t.fontsize})),leading:Math.max.apply(Math,this.metricses.map(function(t){return t.leading})),width:Math.max.apply(Math,this.metricses.map(function(t){return t.width})),height:Math.max.apply(Math,this.metricses.map(function(t){return t.height})),bounds:{minx:Math.min.apply(Math,this.metricses.map(function(t){return t.bounds.minx})),miny:Math.min.apply(Math,this.metricses.map(function(t){return t.bounds.miny})),maxx:Math.max.apply(Math,this.metricses.map(function(t){return t.bounds.maxx})),maxy:Math.max.apply(Math,this.metricses.map(function(t){return t.bounds.maxy}))}},this.boundingBoxWidth=Math.ceil(this.metrics.width)}var e=4;return t.prototype.draw=function(t,i,n){var r,o,s,a,l,c;for(t.textBaseline="top",t.font=this.font.replace("underline ","").replace("line-through ","").replace("none ",""),r=0,l=this.lines,c=[],i+=e,n+=e,o=0,s=l.length;o<s;o++)a=l[o],t.fillText(a,i,n+r*this.metrics.leading),this.textDecoration.x=i,this.textDecoration.y=n,"underline"!=this.textDecoration.name&&"line-through"!=this.textDecoration.name||h(t,a,this.textDecoration),c.push(r+=1);return c},t.prototype.getWidth=function(t){return null==t&&(t=!1),this.forcedWidth?this.forcedWidth:t?this.metrics.bounds.maxx+this.caratWidth:this.metrics.bounds.maxx},t.prototype.getHeight=function(){return this.forcedHeight||this.metrics.leading*this.lines.length},t}(),e.exports=r},{"./fontmetrics.js":7}
3],3:[function(t,e,i){var n,r;r=function(){function t(t,e,i){this.lc=t,this.oldShapes=e,this.newShapes=i}return t.prototype.do=function(){return this.lc.shapes=this.newShapes,this.lc.repaintLayer("main")},t.prototype.undo=function(){return this.lc.shapes=this.oldShapes,this.lc.repaintLayer("main")},t.prototype.delete=function(){return this.lc.shapes=this.oldShapes,this.lc.repaintLayer("main")},t}(),n=function(){var t=[];function e(t,e,i,n){this.lc=t,this.shape=e,this.previousShapeId=null!=i?i:null,this.undostack=n}return e.prototype.do=function(){var t,e,i,n,r,o;if(this.lc.shapes.length&&this.lc.shapes[this.lc.shapes.length-1].id!==this.previousShapeId&&null!==this.previousShapeId){for(n=[],t=!1,e=0,i=(r=this.lc.shapes).length;e<i;e++)o=r[e],n.push(o),o.id===this.previousShapeId&&(n.push(this.shape),t=!0);t||n.push(this.shape),this.lc.shapes=n}else this.lc.shapes.push(this.shape);return this.lc.repaintLayer("main")},e.prototype.undo=function(){var t,e,i,n,r;if(""!=this.lc.shapes&&void 0!==this.lc.shapes)if(this.lc.shapes[this.lc.shapes.length-1].id===this.shape.id)this.lc.shapes.pop();else{for(i=[],t=0,e=(n=this.lc.shapes).length;t<e;t++)(r=n[t]).id!==this.shape.id&&i.push(r);this.lc.shapes=i}return this.lc.repaintLayer("main")},e.prototype.delete=function(e){var i,n,r,o,s;for(r=[],i=0,n=(o=this.lc.shapes).length;i<n;i++)(s=o[i]).id!==e.id&&r.push(s);return this.lc.shapes=r,t.push(e),this.lc.repaintLayer("main")},e}(),e.exports={ClearAction:r,AddShapeAction:n}},{}],4:[function(t,e,i){var n,r;n=function(t,e){var i,n,r;return n=e.changedTouches[0].clientX,r=e.changedTouches[0].clientY,[n-(i=t.getBoundingClientRect()).left,r-i.top]},r=function(t,e){var i;return i=t.getBoundingClientRect(),{left:e.clientX-i.left,top:e.clientY-i.top}},e.exports=function(t,e,i){var o,s,a,h,l,c;return null==i&&(i=!1),c=[],s=function(i){var n;return i.preventDefault(),n=r(e,i),t.pointerMove(n.left,n.top)},a=function(i){var n;return i.preventDefault(),e.onselectstart=function(){return!0},n=r(e,i),t.pointerUp(n.left,n.top),document.removeEventListener("mousemove",s),document.removeEventListener("mouseup",a),e.addEventListener("mousemove",s)},e.addEventListener("mousedown",function(i){var n;if("canvas"===i.target.tagName.toLowerCase())return i.preventDefault(),e.onselectstart=function(){return!1},n=r(e,i),t.pointerDown(n.left,n.top),e.removeEventListener("mousemove",s),document.addEventListener("mousemove",s),document.addEventListener("mouseup",a)}),l=function(i){return i.preventDefault(),t.pointerMove.apply(t,n(e,i))},h=function(i){return i.preventDefault(),t.pointerUp.apply(t,n(e,i)),document.removeEventListener("touchmove",l),document.removeEventListener("touchend",h),document.removeEventListener("touchcancel",h)},e.addEventListener("touchstart",function(i){if("canvas"===i.target.tagName.toLowerCase())return i.preventDefault(),1===i.touches.length?(t.pointerDown.apply(t,n(e,i)),document.addEventListener("touchmove",l),document.addEventListener("touchend",h),document.addEventListener("touchcancel",h)):t.pointerMove.apply(t,n(e,i))}),i&&(console.warn("Keyboard panning is deprecated."),o=function(e){switch(e.keyCode){case 37:t.pan(-10,0);break;case 38:t.pan(0,-10);break;case 39:t.pan(10,0);break;case 40:t.pan(0,10)}return t.repaintAllLayers()},document.addEventListener("keydown",o),c.push(function(){return document.removeEventListener(o)})),function(){var t,e,i,n;for(n=[],e=0,i=c.length;e<i;e++)t=c[e],n.push(t());return n}}},{}],5:[function(t,e,i){var n,r,o,s,a,h,l,c,u,p;a=t("./lineEndCapShapes"),u={},h=function(){},c=function(t,e,i){var n;if(null==i&&(i={}),null==i.shouldIgnoreUnsupportedShapes&&(i.shouldIgnoreUnsupportedShapes=!1),null==i.retryCallback&&(i.retryCallback=h),null==i.shouldOnlyDrawLatest&&(i.shouldOnlyDrawLatest=!1),null==i.bufferCtx&&(i.bufferCtx=null),n=i.bufferCtx,u[e.className])return i.shouldOnlyDrawLatest&&u[e.className].drawLatestFunc?u[e.className].drawLatestFunc(t,n,e,i.retryCallback):u[e.className].drawFunc(t,e,i.retryCallback);if(i.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+e.className+" to canvas");throw"Can't render shape of type "+e.className+" to canvas"}
3,l=function(t,e,i){return c(t.getContext("2d"),e,i)},(r=function(t,e,i){return u[t]={drawFunc:e,drawLatestFunc:i}})("Rectangle",function(t,e){var i,n;return i=e.x,n=e.y,e.strokeWidth%2!=0&&(i+=.5,n+=.5),t.fillStyle=e.fillColor,t.fillRect(i,n,e.width,e.height),t.lineWidth=e.strokeWidth,t.strokeStyle=e.strokeColor,t.strokeRect(i,n,e.width,e.height)}),r("Ellipse",function(t,e){var i,n,r,o;return t.save(),o=Math.floor(e.width/2),r=Math.floor(e.height/2),i=e.x+o,n=e.y+r,t.translate(i,n),t.scale(1,Math.abs(e.height/e.width)),t.beginPath(),t.arc(0,0,Math.abs(o),0,2*Math.PI),t.closePath(),t.restore(),t.fillStyle=e.fillColor,t.fill(),t.lineWidth=e.strokeWidth,t.strokeStyle=e.strokeColor,t.stroke()}),r("SelectionBox",(p=function(t,e,i){var n,r;if(n=e.x,r=e.y,0!==i)return t.fillStyle="#fff",t.fillRect(n,r,i,i),t.strokeStyle="#000",t.strokeRect(n,r,i,i)},function(t,e){return p(t,e.getTopLeftHandleRect(),e.handleSize),p(t,e.getTopRightHandleRect(),e.handleSize),p(t,e.getBottomLeftHandleRect(),e.handleSize),p(t,e.getBottomRightHandleRect(),e.handleSize),e.backgroundColor&&(t.fillStyle=e.backgroundColor,t.fillRect(e._br.x-e.margin,e._br.y-e.margin,e._br.width+2*e.margin,e._br.height+2*e.margin)),t.lineWidth=1,t.strokeStyle="#000",t.setLineDash([2,4]),t.strokeRect(e._br.x-e.margin,e._br.y-e.margin,e._br.width+2*e.margin,e._br.height+2*e.margin),t.setLineDash([])})),r("Image",function(t,e,i){var n=e.image?.style?.opacity||"";return""==n&&(n=1),t.globalAlpha=n,e.image.width?1===e.scale?t.drawImage(e.image,e.x,e.y):t.drawImage(e.image,e.x,e.y,e.image.width*e.scale,e.image.height*e.scale):i?e.image.onload=i:void 0}),r("Line",function(t,e){var i,n,r,o,s;if(e.x1!==e.x2||e.y1!==e.y2)return n=e.x1,r=e.x2,o=e.y1,s=e.y2,e.strokeWidth%2!=0&&(n+=.5,r+=.5,o+=.5,s+=.5),t.lineWidth=e.strokeWidth,t.strokeStyle=e.color,t.lineCap=e.capStyle,e.dash&&t.setLineDash(e.dash),t.beginPath(),t.moveTo(n,o),t.lineTo(r,s),t.stroke(),e.dash&&t.setLineDash([]),i=Math.max(2.2*e.strokeWidth,5),e.endCapShapes[0]&&a[e.endCapShapes[0]].drawToCanvas(t,n,o,Math.atan2(o-s,n-r),i,e.color),e.endCapShapes[1]?a[e.endCapShapes[1]].drawToCanvas(t,r,s,Math.atan2(s-o,r-n),i,e.color):void 0}),n=function(t,e,i,n){var r,o,s,a;if(null==i&&(i=!1),null==n&&(n="round"),e.length){for(t.lineCap=n,t.strokeStyle=e[0].color,t.lineWidth=e[0].size,t.beginPath(),e[0].size%2==0?t.moveTo(e[0].x,e[0].y):t.moveTo(e[0].x+.5,e[0].y+.5),r=0,o=(a=e.slice(1)).length;r<o;r++)s=a[r],e[0].size%2==0?t.lineTo(s.x,s.y):t.lineTo(s.x+.5,s.y+.5);return i?t.closePath():void 0}},r("LinePath",o=function(t,e){return n(t,e.smoothedPoints),t.stroke()},s=function(t,e,i){var r,o,s;return i.tail?(o=(s=i.smoothedPoints.length-i.segmentSize*i.tailSize)<2*i.segmentSize?0:s,r=s+i.segmentSize+1,n(e,i.smoothedPoints.slice(o,r)),e.stroke()):(n(e,i.smoothedPoints),e.stroke())}),r("ErasedLinePath",function(t,e){return t.save(),t.globalCompositeOperation="destination-out",o(t,e),t.restore()},function(t,e,i){return t.save(),t.globalCompositeOperation="destination-out",e.save(),e.globalCompositeOperation="destination-out",s(t,e,i),t.restore(),e.restore()}),r("Text",function(t,e){e.renderer||e._makeRenderer(t);var i=e.getBoundingRect(t);return e.backgroundColor&&(t.save(),t.fillStyle=e.backgroundColor,t.fillRect(i.x,i.y,i.width,i.height),t.restore()),e.strokeWidth&&(t.save(),t.strokeStyle=e.color,t.lineWidth=e.strokeWidth,t.strokeRect(i.x,i.y,i.width,i.height),t.restore()),t.fillStyle=e.color,e.renderer.draw(t,e.x,e.y)}),r("Polygon",function(t,e){return t.fillStyle=e.fillColor,n(t,e.points,e.isClosed,"butt"),t.fill(),t.stroke()}),e.exports={defineCanvasRenderer:r,renderShapeToCanvas:l,renderShapeToContext:c}},{"./lineEndCapShapes":8}],6:[function(t,e,i){"use strict";e.exports={imageURLPrefix:"lib/img",primaryColor:"hsla(0, 0%, 0%, 1)",secondaryColor:"hsla(0, 0%, 100%, 1)",backgroundColor:"transparent",strokeWidths:[1,2,5,10,20,30],defaultStrokeWidth:5,toolbarPosition:"top",keyboardShortcuts:!1,imageSize:{width:"infinite",height:"infinite"},backgroundShapes:[],watermarkImage:null,watermarkScale:1,zoomMin:.2,zoomMax:4,zoomStep:.2,snapshot:null,tools:[t("../tools/Pencil"),t("../tools/Eraser"),t("../tools/Line"),t("../tools/Rectangle"),t("../tools/Ellipse"),t("../tools/Text"),t("../tools/Polygon"),t("../tools/Pan"),t("../tools/Eyedropper")]}},{"../tools/Ellipse":19,"../tools/Eraser":20,"../tools/Eyedropper":21,"../tools/Line":22,"../tools/Pan":23,"../tools/Pencil":24,"../tools/Polygon":25,"../tools/Rectangle":26,"../tools/Text":28}
3],7:[function(t,e,i){"use strict";!function(){if(!document.defaultView.getComputedStyle)throw"ERROR: 'document.defaultView.getComputedStyle' not found. This library only works in browsers that can report computed CSS values.";CanvasRenderingContext2D.prototype.measureTextWidth=CanvasRenderingContext2D.prototype.measureText;var t=function(t,e){return document.defaultView.getComputedStyle(t,null).getPropertyValue(e)};CanvasRenderingContext2D.prototype.measureText2=function(e,i,n){n=n.replace("none ","").replace("underline ","").replace("line-through ","");var r=this.measureTextWidth(e),o=!/\S/.test(e);r.fontsize=i;var s=document.createElement("div");s.style.position="absolute",s.style.opacity=0,s.style.font=n,s.innertText=e+"\n"+e,document.body.appendChild(s),r.leading=1.2*i;var a=t(s,"height");if((a=a.replace("px",""))>=2*i&&(r.leading=a/2|0),document.body.removeChild(s),o)r.ascent=0,r.descent=0,r.bounds={minx:0,maxx:r.width,miny:0,maxy:0},r.height=0;else{var h=document.createElement("canvas"),l=100;h.width=r.width+l,h.height=3*i,h.style.opacity=1,h.style.font=n;var c=h.getContext("2d");c.font=n;var u=h.width,p=h.height,d=p/2;c.fillStyle="white",c.fillRect(-1,-1,u+2,p+2),c.fillStyle="black",c.fillText(e,l/2,d);for(var g=c.getImageData(0,0,u,p).data,f=0,y=4*u,m=g.length;++f<m&&255===g[f];);var S=f/y|0;for(f=m-1;--f>0&&255===g[f];);var x=f/y|0;for(f=0;f<m&&255===g[f];)(f+=y)>=m&&(f=f-m+4);var v=f%y/4|0,w=1;for(f=m-3;f>=0&&255===g[f];)(f-=y)<0&&(f=m-3-4*w++);var k=f%y/4+1|0;r.ascent=d-S,r.descent=x-d,r.bounds={minx:v-l/2,maxx:k-l/2,miny:0,maxy:x-S},r.height=x-S+1}return r}}()},{}],8:[function(t,e,i){var n;e.exports={arrow:(n=function(t,e,i,n,r){return[{x:t+Math.cos(i+Math.PI/2)*n/2,y:e+Math.sin(i+Math.PI/2)*n/2},{x:t+Math.cos(i)*r,y:e+Math.sin(i)*r},{x:t+Math.cos(i-Math.PI/2)*n/2,y:e+Math.sin(i-Math.PI/2)*n/2}]},{drawToCanvas:function(t,e,i,r,o,s,a){var h;return null==a&&(a=0),a=a||o,t.fillStyle=s,t.lineWidth=0,t.strokeStyle="transparent",t.beginPath(),h=n(e,i,r,o,a),t.moveTo(h[0].x,h[0].y),t.lineTo(h[1].x,h[1].y),t.lineTo(h[2].x,h[2].y),t.fill()},svg:function(t,e,i,r,o,s){return null==s&&(s=0),"<polygon fill='"+o+"' stroke='none' points='"+n(t,e,i,r,s=s||r).map(function(t){return t.x+","+t.y})+"' />"}})}},{}],9:[function(t,e,i){var n,r,o;o={},r=function(t){return o=t},n=function(t){return o[t]||t},e.exports={localize:r,_:n}},{}],10:[function(t,e,i){var n,r,o,s;t("./shapes").Point,t("./util"),(r={}).toPoly=function(t){var e,i,r,s,a,h,l;for(h=[],l=[],i=0,e=0,r=t.length;e<r;e++)a=t[e],s=o(a,n(t,i)),h=h.concat([s[0]]),l=[s[1]].concat(l),i+=1;return h.concat(l)},n=function(t,e){return t.length,0===e?n(t,e+1):e===t.length-1?n(t,e-1):r.diff(t[e-1],t[e+1])},r.diff=function(t,e){return{x:e.x-t.x,y:e.y-t.y}},s=function(t){var e;return e=r.len(t),{x:t.x/e,y:t.y/e}},o=function(t,e){return(e=s(e)).x=e.x*t.size/2,e.y=e.y*t.size/2,[{x:t.x-e.y,y:t.y+e.x,color:t.color},{x:t.x+e.y,y:t.y-e.x,color:t.color}]},r.len=function(t){return Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2))},r.scalePositionScalar=function(t,e,i,n){return t+(e*i-e*n)/2},e.exports=r},{"./shapes":13,"./util":15}],11:[function(t,e,i){var n,r,o,s;s=t("./util"),r=t("./shapes").JSONToShape,n="infinite",o=function(t,e,i){if(e.width)return t.save(),t.translate(t.canvas.width/2,t.canvas.height/2),t.scale(i,i),t.drawImage(e,-e.width/2,-e.height/2),t.restore()},e.exports=function(t,e){var i,a,h,l,c,u,p,d;return null==e&&(e={}),null==e.scale&&(e.scale=1),u=function(){var e,i,n,o;for(o=[],e=0,i=(n=t.shapes).length;e<i;e++)c=n[e],o.push(r(c));return o}(),a=[],t.backgroundShapes&&(a=function(){var e,i,n,o;for(o=[],e=0,i=(n=t.backgroundShapes).length;e<i;e++)c=n[e],o.push(r(c));return o}()),null==e.margin&&(e.margin={top:0,right:0,bottom:0,left:0}),l=t.imageSize||{width:n,height:n},h=t.colors||{background:"transparent"},i=u.concat(a),p=document.createElement("canvas"),d=p.getContext("2d"),e.rect?(e.rect.x-=e.margin.left,e.rect.y-=e.margin.top,e.rect.width+=e.margin.left+e.margin.right,e.rect.height+=e.margin.top+e.margin.bottom):e.rect=s.getDefaultImageRect(function(){var t,e,n;for(n=[],t=0,e=i.length;t<e;
3t++)c=i[t],n.push(c.getBoundingRect(d));return n}(),l,e.margin),p.width=e.rect.width*e.scale,p.height=e.rect.height*e.scale,d.fillStyle=h.background,d.fillRect(0,0,p.width,p.height),e.rect.width&&e.rect.height?(e.watermarkImage&&o(d,e.watermarkImage,e.watermarkScale),s.combineCanvases(p,s.renderShapes(a,e.rect,e.scale),s.renderShapes(u,e.rect,e.scale))):null}},{"./shapes":13,"./util":15}],12:[function(t,e,i){var n,r,o;o=t("./util"),r=t("./shapes").JSONToShape,n="infinite",e.exports=function(t,e){var i,s,a,h,l,c,u,p;return null==e&&(e={}),p=function(){var e,i,n,o;for(o=[],e=0,i=(n=t.shapes).length;e<i;e++)u=n[e],o.push(r(u));return o}(),s=[],t.backgroundShapes&&(s=function(){var e,i,n,o;for(o=[],e=0,i=(n=t.backgroundShapes).length;e<i;e++)u=n[e],o.push(r(u));return o}()),null==e.margin&&(e.margin={top:0,right:0,bottom:0,left:0}),c=t.imageSize||{width:n,height:n},a=t.colors||{background:"transparent"},i=p.concat(s),l=document.createElement("canvas"),h=l.getContext("2d"),e.rect?(e.rect.x-=e.margin.left,e.rect.y-=e.margin.top,e.rect.width+=e.margin.left+e.margin.right,e.rect.height+=e.margin.top+e.margin.bottom):e.rect=o.getDefaultImageRect(function(){var t,e,n;for(n=[],t=0,e=i.length;t<e;t++)u=i[t],n.push(u.getBoundingRect(h));return n}(),c,e.margin),LC.renderShapesToSVG(s.concat(p),e.rect,a.background)}},{"./shapes":13,"./util":15}],13:[function(t,e,i){var n,r,o,s,a,h,l,c,u,p,d,g,f,y,m,S,x,v,w,k;k=t("./util"),r=t("./TextRenderer"),t("./lineEndCapShapes"),y=t("./canvasRenderer"),p=y.defineCanvasRenderer,S=y.renderShapeToContext,m=t("./svgRenderer"),d=m.defineSVGRenderer,x=m.renderShapeToSVG,w={},g=function(t,e){var i,n,r,o,s,a,h,l;for(o in i=function(t,i,n,r,o,s,a,h,l,c,u,p,d,g,f,y){return e.constructor.call(this,t,i,n,r,o,s,a,h,l,c,u,p,d,g,f,y),this},i.prototype.className=t,i.fromJSON=e.fromJSON,e.draw&&(s=e.draw,a=e.draw||function(t,e,i){return this.draw(t,e,i)},n=function(t,e,i){return s.call(e,t,i)},r=function(t,e,i,n){return a.call(i,t,e,n)},delete e.draw,e.drawLatest&&delete e.drawLatest,p(t,n,r)),e.toSVG&&(h=e.toSVG,l=function(t){return h.call(t)},delete e.toSVG,d(t,l)),i.prototype.draw=function(t,e){return S(t,this,{retryCallback:e})},i.prototype.drawLatest=function(t,e,i){return S(t,this,{retryCallback:i,bufferCtx:e,shouldOnlyDrawLatest:!0})},i.prototype.toSVG=function(){return x(this)},e)"fromJSON"!==o&&(i.prototype[o]=e[o]);return w[t]=i,i},u=function(t,e,i,n,r,o,s,a,h,l,c,u,p,d,g,f,y){var m;return(m=new w[t](e,i,n,r,o,s,a,h,l,c,u,p,d,g,f,y)).id=k.getGUID(),m},n=function(t){var e,i,n,r;return e=t.className,i=t.data,n=t.id,e in w?(r=w[e].fromJSON(i))?(n&&(r.id=n),r):(console.log("Unreadable shape:",e,i),null):(console.log("Unknown shape:",e,i),null)},v=function(t){return{className:t.className,data:t.toJSON(),id:t.id}},c=function(t,e){return e?c(a(a(l(t))),e-1):t},l=function(t){var e,i,n,r,o;for(o=[],e=0,r=0,i=(t=[t[0]].concat(t).concat(k.last(t))).length;r<i;r++)n=t[r],o[2*e]=n,t[e+1]&&(o[2*e+1]=h(n,t[e+1])),e+=1;return o},a=function(t){var e,i,n,r,o;for(e=[],i=0,o=0,n=t.length;o<n;o++)r=t[o],t[i+1]&&(e[i]=h(r,t[i+1])),i+=1;return e},h=function(t,e){return u("Point",{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2,size:t.size+(e.size-t.size)/2,color:t.color})},g("Image",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.scale=t.scale||1,this.image=t.image||null},getBoundingRect:function(){return{x:this.x,y:this.y,width:this.image.width*this.scale,height:this.image.height*this.scale}},toJSON:function(){return{x:this.x,y:this.y,imageSrc:this.image.src,imageObject:this.image,scale:this.scale,opacity:this.image.style.opacity,imgWidth:this.image.width,imgHeight:this.image.height,imgType:void 0!==this.image&&null!=this.image&&void 0!==this.image.dataset&&null!=this.image.dataset&&void 0!==this.image.dataset.imageType&&null!=this.image.dataset.imageType&&"checkmark"==this.image.dataset.imageType?"checkmark":"general"}},fromJSON:function(t){var e,i;return e=null,(null!=(i=t.imageObject)?i.width:void 0)?e=t.imageObject:(e=new Image).src=t.imageSrc,e.style.opacity=t.opacity,"checkmark"==t.imgType&&(e.width=t.imgWidth,e.height=t.imgHeight),""!=t.imgType&&void 0!==t.imgType&&(e.dataset.imageType=t.imgType),u("Image",{x:t.x,y:t.y,image:e,scale:t.scale})},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Rectangle",{constructor:function(t){return null==t&&(t={}),!0===t.isWhiteout&&(t.strokeWidth=1),this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.strokeWidth=t.strokeWidth||1,this.strokeColor=t.strokeColor||"black",this.isWhiteout=t.isWhiteout,this.originalFillColor=t.originalFillColor,this.rect
3copy=t.rectcopy,this.rectAlpha=t.rectAlpha,this.setHighliter=t.setHighliter,this.fillColor=t.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,fillColor:this.fillColor,isWhiteout:this.isWhiteout,originalFillColor:this.originalFillColor,rectcopy:this.rectcopy,rectAlpha:this.rectAlpha,setHighliter:this.setHighliter}},fromJSON:function(t){return u("Rectangle",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Ellipse",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.strokeWidth=t.strokeWidth||1,this.strokeColor=t.strokeColor||"black",this.alpha=t.alpha,this.originalFillColor=t.originalFillColor,this.fillColor=t.fillColor||"transparent"},getBoundingRect:function(){return{x:this.x-this.strokeWidth/2,y:this.y-this.strokeWidth/2,width:this.width+this.strokeWidth,height:this.height+this.strokeWidth}},toJSON:function(){return{x:this.x,y:this.y,width:this.width,height:this.height,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor,originalFillColor:this.originalFillColor,alpha:this.alpha,fillColor:this.fillColor}},fromJSON:function(t){return u("Ellipse",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Line",{constructor:function(t){return null==t&&(t={}),this.x1=t.x1||0,this.y1=t.y1||0,this.x2=t.x2||0,this.y2=t.y2||0,this.strokeWidth=t.strokeWidth||1,this.color=t.color||"black",this.capStyle=t.capStyle||"round",this.endCapShapes=t.endCapShapes||[null,null],this.dash=t.dash||null},getBoundingRect:function(){return{x:Math.min(this.x1,this.x2)-this.strokeWidth/2,y:Math.min(this.y1,this.y2)-this.strokeWidth/2,width:Math.abs(this.x2-this.x1)+this.strokeWidth/2,height:Math.abs(this.y2-this.y1)+this.strokeWidth/2}},toJSON:function(){return{x1:this.x1,y1:this.y1,x2:this.x2,y2:this.y2,strokeWidth:this.strokeWidth,color:this.color,capStyle:this.capStyle,dash:this.dash,endCapShapes:this.endCapShapes}},fromJSON:function(t){return u("Line",t)},move:function(t){return null==t&&(t={}),this.x1=this.x1-t.xDiff,this.y1=this.y1-t.yDiff,this.x2=this.x2-t.xDiff,this.y2=this.y2-t.yDiff},setUpperLeft:function(t){var e,i,n;return null==t&&(t={}),i=(e=this.getBoundingRect()).x-t.x,n=e.y-t.y,this.move({xDiff:i,yDiff:n})}}),s=function(t){var e,i,n,r,o;if(!t.length)return!1;for(o=t[0].size,e=t[0].color,r=0,i=t.length;r<i;r++)if((n=t[r]).size===o&&n.color===e||console.log(o,e,n.size,n.color),n.size!==o||n.color!==e)return!1;return!0},o=function(t,e){var i,r,o,s,a;return r=null,e.points?r=function(){var t,r,o,s;for(s=[],r=0,t=(o=e.points).length;r<t;r++)i=o[r],s.push(n(i));return s}():e.pointCoordinatePairs&&(r=function(){var t,i,r,o,h;for(h=[],i=0,t=(r=e.pointCoordinatePairs).length;i<t;i++)o=r[i],s=o[0],a=o[1],h.push(n({className:"Point",data:{x:s,y:a,size:e.pointSize,color:e.pointColor,smooth:e.smooth}}));return h}()),o=null,e.smoothedPointCoordinatePairs&&(o=function(){var t,i,r,o,h;for(h=[],i=0,t=(r=e.smoothedPointCoordinatePairs).length;i<t;i++)o=r[i],s=o[0],a=o[1],h.push(n({className:"Point",data:{x:s,y:a,size:e.pointSize,color:e.pointColor,smooth:e.smooth}}));return h}()),r[0]?u(t,{points:r,smoothedPoints:o,order:e.order,tailSize:e.tailSize,smooth:e.smooth}):null},g("LinePath",f={constructor:function(t){var e,i,n,r,o;if(null==t&&(t={}),n=t.points||[],this.order=t.order||3,this.tailSize=t.tailSize||3,this.smooth=!("smooth"in t)||t.smooth,this.segmentSize=Math.pow(2,this.order),this.sampleSize=this.tailSize+1,t.smoothedPoints)return this.points=t.points,this.smoothedPoints=t.smoothedPoints;for(this.points=[],o=[],r=0,e=n.length;r<e;r++)i=n[r],o.push(this.addPoint(i));return o}
3,getBoundingRect:function(){return k.getBoundingRect(this.points.map(function(t){return{x:t.x-t.size/2,y:t.y-t.size/2,width:t.size,height:t.size}}))},toJSON:function(){var t,e;return s(this.points)?{order:this.order,tailSize:this.tailSize,smooth:this.smooth,pointCoordinatePairs:function(){var t,i,n,r;for(r=[],i=0,t=(n=this.points).length;i<t;i++)e=n[i],r.push([e.x,e.y]);return r}.call(this),smoothedPointCoordinatePairs:function(){var t,i,n,r;for(r=[],i=0,t=(n=this.smoothedPoints).length;i<t;i++)e=n[i],r.push([e.x,e.y]);return r}.call(this),pointSize:this.points[0].size,pointColor:this.points[0].color}:{order:this.order,tailSize:this.tailSize,smooth:this.smooth,points:function(){var e,i,n,r;for(r=[],i=0,e=(n=this.points).length;i<e;i++)t=n[i],r.push(v(t));return r}.call(this)}},fromJSON:function(t){return o("LinePath",t)},addPoint:function(t){if(this.points.push(t),this.smooth)return!this.smoothedPoints||this.points.length<this.sampleSize?this.smoothedPoints=c(this.points,this.order):(this.tail=k.last(c(k.last(this.points,this.sampleSize),this.order),this.segmentSize*this.tailSize),this.smoothedPoints=this.smoothedPoints.slice(0,this.smoothedPoints.length-this.segmentSize*(this.tailSize-1)).concat(this.tail));this.smoothedPoints=this.points},move:function(t){var e,i,n;for(null==t&&(t={}),n=0,e=(i=this.smooth?this.smoothedPoints:this.points).length;n<e;n++)i[n].move(t);return this.points=this.smoothedPoints},setUpperLeft:function(t){var e,i,n;return null==t&&(t={}),i=(e=this.getBoundingRect()).x-t.x,n=e.y-t.y,this.move({xDiff:i,yDiff:n})}}),g("ErasedLinePath",{constructor:f.constructor,toJSON:f.toJSON,addPoint:f.addPoint,getBoundingRect:f.getBoundingRect,fromJSON:function(t){return o("ErasedLinePath",t)}}),g("Point",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.size=t.size||0,this.color=t.color||""},getBoundingRect:function(){return{x:this.x-this.size/2,y:this.y-this.size/2,width:this.size,height:this.size}},toJSON:function(){return{x:this.x,y:this.y,size:this.size,color:this.color}},fromJSON:function(t){return u("Point",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("Polygon",{constructor:function(t){var e,i,n,r,o;for(null==t&&(t={}),this.points=t.points,this.fillColor=t.fillColor||"white",this.strokeColor=t.strokeColor||"black",this.strokeWidth=t.strokeWidth,this.originalFillColor=t.originalFillColor,this.alpha=t.alpha,this.dash=t.dash||null,null==t.isClosed&&(t.isClosed=!0),this.isClosed=t.isClosed,o=[],n=0,e=(r=this.points).length;n<e;n++)(i=r[n]).color=this.strokeColor,o.push(i.size=this.strokeWidth);return o},addPoint:function(t,e){return this.points.push(LC.createShape("Point",{x:t,y:e}))},getBoundingRect:function(){return k.getBoundingRect(this.points.map(function(t){return t.getBoundingRect()}))},toJSON:function(){return{strokeWidth:this.strokeWidth,fillColor:this.fillColor,strokeColor:this.strokeColor,dash:this.dash,isClosed:this.isClosed,originalFillColor:this.originalFillColor,alpha:this.alpha,pointCoordinatePairs:this.points.map(function(t){return[t.x,t.y]})}},fromJSON:function(t){return t.points=t.pointCoordinatePairs.map(function(e){var i,n;return i=e[0],n=e[1],u("Point",{x:i,y:n,size:t.strokeWidth,color:t.strokeColor})}),u("Polygon",t)},move:function(t){var e,i,n,r,o;for(null==t&&(t={}),o=[],n=0,e=(r=this.points).length;n<e;n++)i=r[n],o.push(i.move(t));return o},setUpperLeft:function(t){var e,i,n;return null==t&&(t={}),i=(e=this.getBoundingRect()).x-t.x,n=e.y-t.y,this.move({xDiff:i,yDiff:n})}}),g("Text",{constructor:function(t){return null==t&&(t={}),this.x=t.x||0,this.y=t.y||0,this.v=t.v||0,this.text=t.text||"",this.color=t.color||"black",this.font=t.font||"18px sans-serif",this.forcedWidth=t.forcedWidth||null,this.fontItalic=t.fontItalic||null,this.fontBold=t.fontBold||null,this.fontSize=t.fontSize||null,this.fontType=t.fontType||null,this.backgroundColor=t.backgroundColor||null,this.strokeWidth=t.strokeWidth||0,this.forcedHeight=t.forcedHeight||null},_makeRenderer:function(t){if(t.lineHeight=1.2,this.renderer=new r(t,this.text,this.font,this.forcedWidth,this.forcedHeight,this.x,this.y,this.color),this.v<1)return console.log("repairing baseline"),this.v=1,this.x-=this.renderer.metrics.bounds.minx,this.y-=this.renderer.metrics.leading-this.renderer.metrics.descent},setText:function(t){return this.text=t,this.renderer=null},setFont:function(t){return this.font=t,this.renderer=null},setStrokeWidth:function(t){return this.strokeWidth=t,this.renderer=null},setPosition:function(t,e){return this.x=t,this.y=e},setSize:function(t,e){return this.forcedWidth=Math.max(t,0),this.forcedHeight=Math.max(e,0),this.renderer=null},enforceMaxBoundingRect:function(t){var e,i,n;
3if(e=this.getBoundingRect(t.ctx),n={x:-t.position.x/t.scale,y:-t.position.y/t.scale,width:t.canvas.width/t.scale,height:t.canvas.height/t.scale},e.x+e.width>n.x+n.width)return i=e.x-n.x,this.forcedWidth=n.width-i-10,this.renderer=null},getBoundingRect:function(t,e){if(null==e&&(e=!1),!this.renderer){if(!t)throw"Must pass ctx if text hasn't been rendered yet";this._makeRenderer(t)}return{x:Math.floor(this.x),y:Math.floor(this.y),width:Math.ceil(this.renderer.getWidth(!0)),height:Math.ceil(this.renderer.getHeight())}},toJSON:function(){return{x:this.x,y:this.y,text:this.text,color:this.color,backgroundColor:this.backgroundColor,font:this.font,forcedWidth:this.forcedWidth,forcedHeight:this.forcedHeight,fontItalic:this.fontItalic,fontBold:this.fontBold,fontSize:this.fontSize,fontType:this.fontType,v:this.v,strokeWidth:this.strokeWidth}},fromJSON:function(t){return u("Text",t)},move:function(t){return null==t&&(t={}),this.x=this.x-t.xDiff,this.y=this.y-t.yDiff},setUpperLeft:function(t){return null==t&&(t={}),this.x=t.x,this.y=t.y}}),g("SelectionBox",{constructor:function(t){return null==t&&(t={}),this.shape=t.shape,null!=t.handleSize?this.handleSize=t.handleSize:this.handleSize=10,this.margin=4,this.backgroundColor=t.backgroundColor||null,this._br=this.shape.getBoundingRect(t.ctx)},toJSON:function(){return{shape:v(this.shape),backgroundColor:this.backgroundColor}},fromJSON:function(t){var e,i;return i=t.shape,t.handleSize,t.margin,e=t.backgroundColor,u("SelectionBox",{shape:n(i),backgroundColor:e})},getTopLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomLeftHandleRect:function(){return{x:this._br.x-this.handleSize-this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getTopRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y-this.handleSize-this.margin,width:this.handleSize,height:this.handleSize}},getBottomRightHandleRect:function(){return{x:this._br.x+this._br.width+this.margin,y:this._br.y+this._br.height+this.margin,width:this.handleSize,height:this.handleSize}},getBoundingRect:function(){return{x:this._br.x-this.margin,y:this._br.y-this.margin,width:this._br.width+2*this.margin,height:this._br.height+2*this.margin}}}),e.exports={defineShape:g,createShape:u,JSONToShape:n,shapeToJSON:v}},{"./TextRenderer":2,"./canvasRenderer":5,"./lineEndCapShapes":8,"./svgRenderer":14,"./util":15}],14:[function(t,e,i){var n,o,s,a;o=t("./lineEndCapShapes"),a={},s=function(t,e){if(null==e&&(e={}),null==e.shouldIgnoreUnsupportedShapes&&(e.shouldIgnoreUnsupportedShapes=!1),a[t.className])return a[t.className](t);if(e.shouldIgnoreUnsupportedShapes)return console.warn("Can't render shape of type "+t.className+" to SVG"),"";throw"Can't render shape of type "+t.className+" to SVG"},(n=function(t,e){return a[t]=e})("Rectangle",function(t){var e,i,n,r,o,s,a,h,l;return"yes"===t.setHighliter&&(l=" fill-opacity='0.4'",t.strokeWidth=0,t.fillColor=t.originalFillColor),void 0!==t.isWhiteout&&(l=" fill-opacity='1'",t.fillColor="#FFFFFF"),"copy"===t.rectcopy&&(l=" fill-opacity='0' stroke-opacity='0'",t.fillColor="transparent",t.strokeWidth=1,t.strokeColor="black"),void 0!==t.rectAlpha&&(l=" fill-opacity='"+t.rectAlpha+"'",t.fillColor=t.originalFillColor),void 0===l&&(l=" fill-opacity='0'",t.fillColor="transparent"),r=t.x,a=t.y,o=t.x+t.width,h=t.y+t.height,n=Math.min(r,o),s=Math.min(a,h),i=Math.max(r,o)-n,e=Math.max(a,h)-s,t.strokeWidth%2!=0&&(n+=.5,s+=.5),"<rect x='"+n+"' y='"+s+"' width='"+i+"' height='"+e+"' stroke='"+t.strokeColor+"' fill='"+t.fillColor+"' stroke-width='"+t.strokeWidth+"'"+l+" />"}),n("SelectionBox",function(t){return""}),n("Ellipse",function(t){var e,i,n,r,o;return r=Math.floor(t.width/2),n=Math.floor(t.height/2),e=t.x+r,i=t.y+n,"undefined"!=t.alpha&&(o=" fill-opacity='"+t.alpha+"'"),void 0===t.originalFillColor&&(o=" fill-opacity='0'",t.originalFillColor="transparent"),"<ellipse cx='"+e+"' cy='"+i+"' rx='"+Math.abs(r)+"' ry='"+Math.abs(n)+"' stroke='"+t.strokeColor+"' fill='"+t.originalFillColor+"' stroke-width='"+t.strokeWidth+"'"+o+" />"}),n("Image",function(t){var e;return e="<image x='"+t.x+"' y='"+t.y+"' style='opacity:"+t.image.style.opacity+"'","checkmark"==t.image.dataset.imageType?e+=" width='"+t.image.width*t.scale+"' height='"+t.image.height*t.scale+"'":e+=" width='"+t.image.naturalWi
3dth*t.scale+"' height='"+t.image.naturalHeight*t.scale+"'",e+=" xlink:href='"+t.image.src+"' />"}),n("Line",function(t){var e,i,n,r,s,a,h;return n=t.dash?"stroke-dasharray='"+t.dash.join(", ")+"'":"",i="",e=Math.max(2.2*t.strokeWidth,5),r=t.x1,s=t.x2,a=t.y1,h=t.y2,t.strokeWidth%2!=0&&(r+=.5,s+=.5,a+=.5,h+=.5),t.endCapShapes[0]&&(i+=o[t.endCapShapes[0]].svg(r,a,Math.atan2(a-h,r-s),e,t.color)),t.endCapShapes[1]&&(i+=o[t.endCapShapes[1]].svg(s,h,Math.atan2(h-a,s-r),e,t.color)),"<g> <line x1='"+r+"' y1='"+a+"' x2='"+s+"' y2='"+h+"' "+n+" stroke-linecap='"+t.capStyle+"' stroke='"+t.color+"' stroke-width='"+t.strokeWidth+"' /> "+i+" </g>"}),n("LinePath",function(t){return"<polyline fill='none' points='"+t.smoothedPoints.map(function(t){var e;return e=t.strokeWidth%2==0?0:.5,t.x+e+","+(t.y+e)}).join(" ")+"' stroke='"+t.points[0].color+"' stroke-linecap='round' stroke-width='"+t.points[0].size+"' />"}),n("ErasedLinePath",function(t){return""}),n("Polygon",function(t){return void 0===t.alpha&&(t.alpha=1),void 0===t.originalFillColor&&(t.originalFillColor="transparent",t.alpha=0),t.isClosed?"<polygon fill='"+t.originalFillColor+"' points='"+t.points.map(function(t){var e;return e=t.strokeWidth%2==0?0:.5,t.x+e+","+(t.y+e)}).join(" ")+"' stroke='"+t.strokeColor+"' stroke-width='"+t.strokeWidth+"' fill-opacity='"+t.alpha+"' />":"<polyline fill='"+t.originalFillColor+"' points='"+t.points.map(function(t){var e;return e=t.strokeWidth%2==0?0:.5,t.x+e+","+(t.y+e)}).join(" ")+"' stroke='none' /> <polyline fill='none' points='"+t.points.map(function(t){var e;return e=t.strokeWidth%2==0?0:.5,t.x+e+","+(t.y+e)}).join(" ")+"' stroke='"+t.strokeColor+"' stroke-width='"+t.strokeWidth+"' fill-opacity='"+t.alpha+"' />"}),n("Text",function(t){var e,i,n;n=t.forcedWidth?"width='"+t.forcedWidth+"px'":"",e=t.forcedHeight?"height='"+t.forcedHeight+"px'":"",i=t.text.split(/\r\n|\r|\n/g),t.renderer&&(i=t.renderer.lines);var o=4;return"<text xml:space='preserve' x='"+(t.x+o)+"' y='"+(t.y+o)+"' "+n+" "+e+" fill='"+t.color+"' style='font: "+t.font+";' "+t.fontItalic+" "+t.fontBold+" "+t.fontSize+" "+t.fontType+"> "+i.map(function(e,i){var n,s;return n=0===i?0:"1.2em",s=0,"<tspan x='"+(t.x+o)+"' dy='"+n+"' dx='"+s+"' alignment-baseline='text-before-edge' dominant-baseline='text-before-edge' text-decoration='"+t.font.split(" ")[4]+"'>"+r(e)+"</tspan>"}).join("")+" </text>"}),e.exports={defineSVGRenderer:n,renderShapeToSVG:s}},{"./lineEndCapShapes":8}],15:[function(t,e,i){var n,r,o,s,a,h=[].slice;o=Array.prototype.slice,n=t("./canvasRenderer").renderShapeToContext,r=t("./svgRenderer").renderShapeToSVG,s={addImageOnload:function(t,e){var i;return i=t.onload,t.onload=function(){return"function"==typeof i&&i(),e()},t},last:function(t,e){return null==e&&(e=null),e?o.call(t,Math.max(t.length-e,0)):t[t.length-1]},classSet:function(t){var e,i;for(i in e=[],t)t[i]&&e.push(i);return e.join(" ")},matchElementSize:function(t,e,i,n){var r;return null==n&&(n=function(){}),r=function(){var r,o,s;for(o=0,s=e.length;o<s;o++)(r=e[o]).style.width=t.offsetWidth+"px",r.style.height=t.offsetHeight+"px",null!=r.width&&(r.setAttribute("width",r.offsetWidth*i),r.setAttribute("height",r.offsetHeight*i));return n()},t.addEventListener("resize",r),window.addEventListener("resize",r),window.addEventListener("orientationchange",r),r()},combineCanvases:function(){var t,e,i,n,r,o,s,a;for(i=1<=arguments.length?h.call(arguments,0):[],(t=document.createElement("canvas")).width=i[0].width,t.height=i[0].height,r=0,s=i.length;r<s;r++)e=i[r],t.width=Math.max(e.width,t.width),t.height=Math.max(e.height,t.height);for(n=t.getContext("2d"),o=0,a=i.length;o<a;o++)e=i[o],n.drawImage(e,0,0);return t},renderShapes:function(t,e,i,r){var o,s,a,h;for(null==i&&(i=1),null==r&&(r=null),(r=r||document.createElement("canvas")).width=e.width*i,r.height=e.height*i,(o=r.getContext("2d")).translate(-e.x*i,-e.y*i),o.scale(i,i),s=0,a=t.length;s<a;s++)h=t[s],n(o,h);return r},renderShapesToSVG:function(t,e,i){var n,o,s,a;return s=e.x,a=e.y,("<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='"+(o=e.width)+"' height='"+(n=e.height)+"' viewBox='0 0 "+o+" "+n+"' version='1.1' preserveAspectRatio='xMidYMid meet' zoomAndPan='magnify' contentScriptType='application/ecmascript'> <rect width='"+o+"' height='"+n+"' x='0' y='0' fill='"+i+"' /> <g transform='translate("+-s+", "+-a+")'> "+t.map(r).join("")+" </g> </svg>").replace(/(\r\n|\n|\r)/gm,"")}
3,getBoundingRect:function(t,e,i){var n,r,o,s,a,h,l;if(!t.length)return{x:0,y:0,width:e,height:i};for(a=t[0].x,h=t[0].y,o=t[0].x+t[0].width,s=t[0].y+t[0].height,n=0,r=t.length;n<r;n++)l=t[n],a=Math.floor(Math.min(l.x,a)),h=Math.floor(Math.min(l.y,h)),o=Math.ceil(Math.max(o,l.x+l.width)),s=Math.ceil(Math.max(s,l.y+l.height));return{x:a=e?0:a,y:h=i?0:h,width:(o=e||o)-a,height:(s=i||s)-h}},getDefaultImageRect:function(t,e,i){var n,r,o;return null==e&&(e={width:0,height:0}),null==i&&(i={top:0,right:0,bottom:0,left:0}),o=e.width,n=e.height,(r=s.getBoundingRect(t,"infinite"===o?0:o,"infinite"===n?0:n)).x-=i.left,r.y-=i.top,r.width+=i.left+i.right,r.height+=i.top+i.bottom,r},getBackingScale:function(t){return null==window.devicePixelRatio?1:window.devicePixelRatio>1?window.devicePixelRatio:1},requestAnimationFrame:(window.requestAnimationFrame||window.setTimeout).bind(window),getGUID:(a=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)},function(){return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}),requestAnimationFrame:function(t){return window.webkitRequestAnimationFrame?window.webkitRequestAnimationFrame(t):window.requestAnimationFrame?window.requestAnimationFrame(t):window.mozRequestAnimationFrame?window.mozRequestAnimationFrame(t):setTimeout(t,0)},cancelAnimationFrame:function(t){return window.webkitCancelRequestAnimationFrame?window.webkitCancelRequestAnimationFrame(t):window.webkitCancelAnimationFrame?window.webkitCancelAnimationFrame(t):window.cancelAnimationFrame?window.cancelAnimationFrame(t):window.mozCancelAnimationFrame?window.mozCancelAnimationFrame(t):clearTimeout(t)}},e.exports=s},{"./canvasRenderer":5,"./svgRenderer":14}],16:[function(t,e,i){"use strict";!function(){function t(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i}t.prototype=window.CustomEvent.prototype,window.CustomEvent=t}()},{}],17:[function(t,e,i){"use strict";var n=!1;CanvasRenderingContext2D.prototype.setLineDash||(CanvasRenderingContext2D.prototype.setLineDash=function(){n||(console.warn("context2D.setLineDash is a no-op in this browser."),n=!0)}),e.exports=null},{}],18:[function(t,e,i){var n,r,o,s,a,h,l,c,u,p,d,g,f,y,m,S,x;t("./ie_customevent"),t("./ie_setLineDash"),n=t("./core/LiterallyCanvas"),a=t("./core/defaultOptions"),o=t("./core/canvasRenderer"),m=t("./core/svgRenderer"),y=t("./core/shapes"),x=t("./core/util"),d=t("./core/renderSnapshotToImage"),g=t("./core/renderSnapshotToSVG"),u=t("./core/localization").localize,s={snapshotToShapes:function(t){var e,i,n,r,o;for(r=[],e=0,i=(n=t.shapes).length;e<i;e++)o=n[e],r.push(y.JSONToShape(o));return r},snapshotJSONToShapes:function(t){return s.snapshotToShapes(JSON.parse(t))}},r=t("./tools/base"),S={Pencil:t("./tools/Pencil"),Eraser:t("./tools/Eraser"),Line:t("./tools/Line"),Rectangle:t("./tools/Rectangle"),Ellipse:t("./tools/Ellipse"),Text:t("./tools/Text"),Polygon:t("./tools/Polygon"),Pan:t("./tools/Pan"),Eyedropper:t("./tools/Eyedropper"),SelectShape:t("./tools/SelectShape"),Tool:r.Tool,ToolWithStroke:r.ToolWithStroke},h=a.tools,a.imageURLPrefix,f=function(t){return a.imageURLPrefix=t},l=function(t,e){var i,n,r,o,s;for(o in null==e&&(e={}),a)o in e||(e[o]=a[o]);for(n=0,r=(s=t.children).length;n<r;n++)i=s[n],t.removeChild(i);return c(t,e)},c=function(t,e){var i,r,o;return o=t.className,-1===[" "," "].join(t.className).indexOf(" literally ")&&(t.className=t.className+" literally"),t.className=t.className+" toolbar-hidden",(i=document.createElement("div")).className="lc-drawing",t.appendChild(i),(r=new n(i,e)).teardown=function(){var e,i,n,s;for(r._teardown(),i=0,n=(s=t.children).length;i<n;i++)e=s[i],t.removeChild(e);return t.className=o},"onInit"in e&&e.onInit(r),r},p=function(t){return t.fn.literallycanvas=function(t){return null==t&&(t={}),this.each(function(e,i){return i.literallycanvas=l(i,t)}),this}},"undefined"!=typeof window&&(window.LC={init:l},window.$&&p(window.$)),e.exports={init:l,registerJQueryPlugin:p,util:x,tools:S,setDefaultImageURLPrefix:f,defaultTools:h,defineShape:y.defineShape,createShape:y.createShape,JSONToShape:y.JSONToShape,shapeToJSON:y.shapeToJSON,defineCanvasRenderer:o.defineCanvasRenderer,renderShapeToContext:o.renderShapeToContext,render
3ShapeToCanvas:o.renderShapeToCanvas,renderShapesToCanvas:x.renderShapes,defineSVGRenderer:m.defineSVGRenderer,renderShapeToSVG:m.renderShapeToSVG,renderShapesToSVG:x.renderShapesToSVG,snapshotToShapes:s.snapshotToShapes,snapshotJSONToShapes:s.snapshotJSONToShapes,renderSnapshotToImage:d,renderSnapshotToSVG:g,localize:u}},{"./core/LiterallyCanvas":1,"./core/canvasRenderer":5,"./core/defaultOptions":6,"./core/localization":9,"./core/renderSnapshotToImage":11,"./core/renderSnapshotToSVG":12,"./core/shapes":13,"./core/svgRenderer":14,"./core/util":15,"./ie_customevent":16,"./ie_setLineDash":17,"./tools/Ellipse":19,"./tools/Eraser":20,"./tools/Eyedropper":21,"./tools/Line":22,"./tools/Pan":23,"./tools/Pencil":24,"./tools/Polygon":25,"./tools/Rectangle":26,"./tools/SelectShape":27,"./tools/Text":28,"./tools/base":29}],19:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./base").ToolWithStroke,r=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.name="Ellipse",e.prototype.iconName="ellipse",e.prototype.begin=function(t,e,i){return this.currentShape=r("Ellipse",{x:t,y:e,strokeWidth:this.strokeWidth,strokeColor:i.getColor("primary"),fillColor:this.fillColor||i.getColor("secondary"),alpha:this.alpha,originalFillColor:this.originalFillColor})},e.prototype.continue=function(t,e,i){return this.currentShape.width=t-this.currentShape.x,this.currentShape.height=e-this.currentShape.y,i.drawShapeInProgress(this.currentShape)},e.prototype.end=function(t,e,i){return i.saveShape(this.currentShape)},e.prototype.setFillColor=function(t){return this.fillColor=t},e.prototype.setRectAlpha=function(t){return this.alpha=t},e.prototype.setOriginalFillColor=function(t){return this.originalFillColor=t},e}(n)},{"../core/shapes":13,"./base":29}],20:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./Pencil"),r=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.name="Eraser",e.prototype.iconName="eraser",e.prototype.makePoint=function(t,e,i){return r("Point",{x:t,y:e,size:this.strokeWidth,color:"#000"})},e.prototype.makeShape=function(){return r("ErasedLinePath")},e}(n)},{"../core/shapes":13,"./Pencil":24}],21:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./base").Tool,r=function(t,e){var i,n,r;return n=e.x,r=e.y,(i=t.getImageData(n,r,1,1).data)[3]?"rgb("+i[0]+", "+i[1]+", "+i[2]+")":null},e.exports=function(t){function e(t){e.__super__.constructor.call(this,t),this.strokeOrFill="stroke"}return o(e,t),e.prototype.name="Eyedropper",e.prototype.iconName="eyedropper",e.prototype.optionsStyle="stroke-or-fill",e.prototype.readColor=function(t,e,i){var n,o,s;return s=i.getDefaultImageRect(),n=i.getImage(),(o=r(n.getContext("2d"),{x:t-s.x,y:e-s.y}))||i.getColor("background"),"stroke"===this.strokeOrFill?i.setColor("primary",o):i.setColor("secondary",o)},e.prototype.begin=function(t,e,i){return this.readColor(t,e,i)},e.prototype.continue=function(t,e,i){return this.readColor(t,e,i)},e}(n)},{"./base":29}],22:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./base").ToolWithStroke,r=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.name="Line",e.prototype.iconName="line",e.prototype.optionsStyle="line-options-and-stroke-width",e.prototype.begin=function(t,e,
3i){return this.currentShape=r("Line",{x1:t,y1:e,x2:t,y2:e,strokeWidth:this.strokeWidth,dash:function(){return 0==!this.isDashed?[2*this.strokeWidth,4*this.strokeWidth]:null}.call(this),endCapShapes:this.hasEndArrow?[null,"arrow"]:null,color:i.getColor("primary")})},e.prototype.continue=function(t,e,i){return this.currentShape.x2=t,this.currentShape.y2=e,i.drawShapeInProgress(this.currentShape)},e.prototype.end=function(t,e,i){return i.saveShape(this.currentShape)},e}(n)},{"../core/shapes":13,"./base":29}],23:[function(t,e,i){var n,r=function(t,e){for(var i in e)o.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},o={}.hasOwnProperty;n=t("./base").Tool,t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return r(e,t),e.prototype.name="Pan",e.prototype.iconName="pan",e.prototype.usesSimpleAPI=!1,e.prototype.didBecomeActive=function(t){var e,i;return e=[],this.unsubscribe=function(){var t,i,n,r;for(r=[],i=0,n=e.length;i<n;i++)t=e[i],r.push(t());return r},e.push(t.on("lc-pointerdown",(i=this,function(e){var n,r;return n=e.rawX,r=e.rawY,i.oldPosition=t.position,i.pointerStart={x:n,y:r}}))),e.push(t.on("lc-pointerdrag",function(e){return function(i){var n,r,o;return r=i.rawX,o=i.rawY,n={x:(r-e.pointerStart?.x)*t.backingScale,y:(o-e.pointerStart?.y)*t.backingScale},t.setPan(e.oldPosition?.x+n.x,e.oldPosition?.y+n.y)}}(this)))},e.prototype.willBecomeInactive=function(t){return this.unsubscribe()},e}(n)},{"../core/shapes":13,"./base":29}],24:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./base").ToolWithStroke,r=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.name="Pencil",e.prototype.iconName="pencil",e.prototype.eventTimeThreshold=10,e.prototype.begin=function(t,e,i){return this.color=i.getColor("primary"),this.currentShape=this.makeShape(),this.currentShape.addPoint(this.makePoint(t,e,i)),this.lastEventTime=Date.now()},e.prototype.continue=function(t,e,i){var n;if((n=Date.now()-this.lastEventTime)>this.eventTimeThreshold)return this.lastEventTime+=n,this.currentShape.addPoint(this.makePoint(t,e,i)),i.drawShapeInProgress(this.currentShape)},e.prototype.end=function(t,e,i){return i.saveShape(this.currentShape),this.currentShape=void 0},e.prototype.makePoint=function(t,e,i){return r("Point",{x:t,y:e,size:this.strokeWidth,color:this.color})},e.prototype.makeShape=function(){return r("LinePath")},e}(n)},{"../core/shapes":13,"./base":29}],25:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./base").ToolWithStroke,r=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.name="Polygon",e.prototype.iconName="polygon",e.prototype.usesSimpleAPI=!1,e.prototype.didBecomeActive=function(t){var i,n,r,o,s,a,h,l;return e.__super__.didBecomeActive.call(this,t),h=[],this.polygonUnsubscribe=function(){var t,e,i,n;for(n=[],e=0,i=h.length;e<i;e++)t=h[e],n.push(t());return n},this.points=null,this.maybePoint=null,l=this,r=function(){return l._getWillFinish()?l._close(t):(t.trigger("lc-polygon-started"),l.points?l.points.push(l.maybePoint):l.points=[l.maybePoint],l.maybePoint={x:l.maybePoint.x,y:l.maybePoint.y},t.setShapesInProgress(l._getShapes(t)),t.repaintLayer("main"))},n=function(e){return function(i){var n,r;if(n=i.x,r=i.y,e.maybePoint)return e.maybePoint.x=n,e.maybePoint.y=r,t.setShapesInProgress(e._getShapes(t)),t.repaintLayer("main")}}(this),i=function(e){return function(i){var n,r;return n=i.x,r=i.y,e.maybePoint={x:n,y:r},t.setShapesInProgress(e._getShapes(t)),t.repaintLayer("main")}}(this),a=function(e){return function(){return e.maybePoint={x:1/0,y:1/0},e._close(t)}}(this),s=function(e){return function(){return e.maybePoint=e.points[0],e._close(t)}}(this),o=function(e){return function(){return e._cancel(t)}}(this),h.push(t.on("drawingChange",function(e){return function(){return e._cancel(t)}}(this))),h.push(t.on("lc-pointerdown",i)),h.push(t.on("lc-pointerdrag",n)),h.push(t.on("lc-pointermove",n)),h.push(t.on("lc-pointerup",r)),h.push(t.on("lc-polygon-finishopen",a)),h.push(t.on("lc-polygon-finishclosed",s)),h.push(t.on("lc-polygon-cancel",o))},e.prototype.willBecomeInactive=function(t){return e.__super__.willBecomeInactive.call(this,t),(this.points||this.maybePoint)&&this._cancel(t),this.polygonUnsubscribe()},e.prototype._getArePointsClose=function(t,e){return Math.abs(t.x-e.x)+Math.abs(t.y-e.y)<10},e.prototype._getWillClose=function(){return!!(this.points&&this.points.length>1)&&!!this.maybePoint&&this._getArePointsClose(this.points[0],this.maybePoint)},e.prototype._getWillFinish=function(){return!!(this.points&&this.points.length>1)&&!!this.maybePoint&&(this._getArePointsClose(this.points[0],this.maybePoint)||this._getArePointsClose(this.points[this.points.length-1],this.maybePoint))},e.prototype._cancel=function(t){return t.trigger("lc-polygon-stopped"),this.maybePoint=null,this.points=null,t.setShapesInProgress([]),t.repaintLayer("main")},e.prototype._close=function(t){return t.trigger("lc-polygon-stopped"),t.setShapesInProgress([]),this.points.length>2&&t.saveShape(this._getShape(t,!1)),this.maybePoint=null,this.points=null},e.prototype._getShapes=function(t,e){var i;return null==e&&(e=!0),(i=this._getShape(t,e))?[i]:[]},e.prototype._getShape=function(t,e){var i;return null==e&&(e=!0),i=[],this.points&&(i=i.concat(this.points)),!e&&i.length<3?null:(e&&this.maybePoint&&i.push(this.maybePoint),i.length>1?r("Polygon",{isClosed:this._getWillClose(),strokeColor:t.getColor("primary"),fillColor:this.fillColor||t.getColor("secondary"),originalFillColor:this.originalFillColor,alpha:this.alpha,strokeWidth:this.strokeWidth,points:i.map(function(t){return r("Point",t)})}):null)},e.prototype.setOriginalFillColor=function(t){return this.originalFillColor=t},e.prototype.setFillColor=function(t){return this.fillColor=t},e.prototype.setRectAlpha=function(t){return this.alpha=t},e.prototype.optionsStyle="polygon-and-stroke-width",e}(n)},{"../core/shapes":13,"./base":29}
3],26:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./base").ToolWithStroke,r=t("../core/shapes").createShape,e.exports=function(t){function e(){return e.__super__.constructor.apply(this,arguments)}return o(e,t),e.prototype.name="Rectangle",e.prototype.iconName="rectangle",e.prototype.begin=function(t,e,i){return this.currentShape=r("Rectangle",{x:t,y:e,strokeWidth:this.strokeWidth,strokeColor:this.strokeColor||i.getColor("primary"),fillColor:this.fillColor||i.getColor("secondary"),isWhiteout:this.isWhiteout,originalFillColor:this.originalFillColor,rectcopy:this.rectcopy,rectAlpha:this.rectAlpha,setHighliter:this.setHighliter})},e.prototype.continue=function(t,e,i){return this.currentShape.width=t-this.currentShape.x,this.currentShape.height=e-this.currentShape.y,i.drawShapeInProgress(this.currentShape)},e.prototype.end=function(t,e,i){return!0===this.currentShape.isWhiteout&&(this.currentShape.strokeColor="transparent"),i.saveShape(this.currentShape)},e.prototype.setOriginalFillColor=function(t){return this.originalFillColor=t},e.prototype.setFillColor=function(t){return this.fillColor=t},e.prototype.setRectCopy=function(t){return this.rectcopy=t},e.prototype.setRectAlpha=function(t){return this.rectAlpha=t},e}(n)},{"../core/shapes":13,"./base":29}],27:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;n=t("./base").Tool,r=t("../core/shapes").createShape,e.exports=function(t){function e(t){this.selectCanvas=document.createElement("canvas"),this.selectCanvas.style["background-color"]="transparent",this.selectCtx=this.selectCanvas.getContext("2d")}return o(e,t),e.prototype.name="SelectShape",e.prototype.usesSimpleAPI=!1,e.prototype.didBecomeActive=function(t){var e,i,n,o,s;return o=[],this._selectShapeUnsubscribe=function(){var t,e,i,n;for(n=[],e=0,i=o.length;e<i;e++)t=o[e],n.push(t());return n},s=this,e=function(e){var i,n,o,a;if(o=e.x,a=e.y,s.didDrag=!1,n=s._getPixel(o,a,t,s.selectCtx),s.selectedShape=t.shapes[n],null!=s.selectedShape)return t.trigger("shapeSelected",{selectedShape:s.selectedShape}),t.setShapesInProgress([s.selectedShape,r("SelectionBox",{shape:s.selectedShape,handleSize:0})]),t.repaintLayer("main"),i=s.selectedShape.getBoundingRect(),s.dragOffset={x:o-i.x,y:a-i.y}},i=function(e){return function(i){var n,o;if(n=i.x,o=i.y,null!=e.selectedShape)return e.didDrag=!0,e.selectedShape.setUpperLeft({x:n-e.dragOffset.x,y:o-e.dragOffset.y}),t.setShapesInProgress([e.selectedShape,r("SelectionBox",{shape:e.selectedShape,handleSize:0})]),t.repaintLayer("main")}}(this),n=function(e){return function(i){if(i.x,i.y,e.didDrag)return e.didDrag=!1,t.trigger("shapeMoved",{shape:e.selectedShape}),t.trigger("drawingChange",{}),t.repaintLayer("main"),e._drawSelectCanvas(t)}}(this),o.push(t.on("lc-pointerdown",e)),o.push(t.on("lc-pointerdrag",i)),o.push(t.on("lc-pointerup",n)),this._drawSelectCanvas(t)},e.prototype.willBecomeInactive=function(t){return this._selectShapeUnsubscribe(),t.setShapesInProgress([])},e.prototype._drawSelectCanvas=function(t){var e,i;return this.selectCanvas.width=t.canvas.width,this.selectCanvas.height=t.canvas.height,this.selectCtx.clearRect(0,0,this.selectCanvas.width,this.selectCanvas.height),e=t.shapes.map((i=this,function(t,e){return r("SelectionBox",{shape:t,handleSize:0,backgroundColor:"#"+i._intToHex(e)})})),t.draw(e,this.selectCtx)},e.prototype._intToHex=function(t){return("000000"+t.toString(16)).slice(-6)},e.prototype._getPixel=function(t,e,i,n){var r,o;return r=i.drawingCoordsToClientCoords(t,e),(o=n.getImageData(r.x,r.y,1,1).data)[3]?parseInt(this._rgbToHex(o[0],o[1],o[2]),16):null},e.prototype._componentToHex=function(t){return("0"+t.toString(16)).slice(-2)},e.prototype._rgbToHex=function(t,e,i){return""+this._componentToHex(t)+this._componentToHex(e)+this._componentToHex(i)},e}(n)},{"../core/shapes":13,"./base":29}
3],28:[function(t,e,i){var n,r,o,s=function(t,e){for(var i in e)a.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},a={}.hasOwnProperty;n=t("./base").Tool,r=t("../core/shapes").createShape,o=function(t,e){return!(t.x<e.x||t.y<e.y||t.x>e.x+e.width||t.y>e.y+e.height)},e.exports=function(t){function e(){this.text="",this.font="bold 18px sans-serif",this.currentShape=null,this.currentShapeState=null,this.initialShapeBoundingRect=null,this.dragAction=null,this.didDrag=!1}return s(e,t),e.prototype.name="Text",e.prototype.iconName="text",e.prototype.didBecomeActive=function(t){var e,i,n,r;return i=[],this.unsubscribe=function(){var t,e,n,r;for(r=[],e=0,n=i.length;e<n;e++)t=i[e],r.push(t());return r},r=this,e=function(){return r._ensureNotEditing(t),r._clearCurrentShape(t),t.repaintLayer("main")},n=function(e){return function(){return e._updateInputEl(t)}}(this),i.push(t.on("drawingChange",e)),i.push(t.on("zoom",n)),i.push(t.on("imageSizeChange",n)),i.push(t.on("snapshotLoad",function(e){return function(){return e._clearCurrentShape(t),t.repaintLayer("main")}}(this))),i.push(t.on("primaryColorChange",function(e){return function(i){if(e.currentShape)return e.currentShape.color=i,e._updateInputEl(t),t.repaintLayer("main")}}(this))),i.push(t.on("secondaryColorChange",function(e){return function(i){if(e.currentShape)return e.currentShape.backgroundColor=i,e._updateInputEl(t),t.repaintLayer("main")}}(this))),i.push(t.on("setFont",function(e){return function(i){if(e.currentShape)return e.font=i,e.currentShape.setFont(i),e._setShapesInProgress(t),e._updateInputEl(t),t.repaintLayer("main")}}(this))),i.push(t.on("setStrokeWidth",function(e){return function(i){e.strokeWidth=i,e.currentShape&&(e.currentShape.strokeWidth=i,e._setShapesInProgress(t),e._updateInputEl(t),t.repaintLayer("main"))}}(this)))},e.prototype.willBecomeInactive=function(t){return this.currentShape&&(this._ensureNotEditing(t),this.commit(t)),this.unsubscribe()},e.prototype.setText=function(t){return this.text=t},e.prototype._ensureNotEditing=function(t){if("editing"===this.currentShapeState)return this._exitEditingState(t)},e.prototype._clearCurrentShape=function(t){return this.currentShape=null,this.initialShapeBoundingRect=null,this.currentShapeState=null,t.setShapesInProgress([])},e.prototype.commit=function(t){return this.currentShape.text&&t.saveShape(this.currentShape),this._clearCurrentShape(t),t.repaintLayer("main")},e.prototype._getSelectionShape=function(t,e){return null==e&&(e=null),r("SelectionBox",{shape:this.currentShape,ctx:t,backgroundColor:e})},e.prototype._setShapesInProgress=function(t){switch(this.currentShapeState){case"selected":return t.setShapesInProgress([this._getSelectionShape(t.ctx),this.currentShape]);case"editing":return t.setShapesInProgress([this._getSelectionShape(t.ctx,"#fff")]);default:return t.setShapesInProgress([this.currentShape])}},e.prototype.begin=function(t,e,i){var n,s,a;if(this.dragAction="none",this.didDrag=!1,"selected"===this.currentShapeState||"editing"===this.currentShapeState?(n=this.currentShape.getBoundingRect(i.ctx),(a=this._getSelectionShape(i.ctx)).getBoundingRect(),o(s={x:t,y:e},n)&&(this.dragAction="move"),o(s,a.getBottomRightHandleRect())&&(this.dragAction="resizeBottomRight"),o(s,a.getTopLeftHandleRect())&&(this.dragAction="resizeTopLeft"),o(s,a.getBottomLeftHandleRect())&&(this.dragAction="resizeBottomLeft"),o(s,a.getTopRightHandleRect())&&(this.dragAction="resizeTopRight"),"none"===this.dragAction&&"editing"===this.currentShapeState&&(this.dragAction="stop-editing",this._exitEditingState(i))):(this.color=i.getColor("primary"),this.backgroundColor=i.getColor("secondary"),this.currentShape=r("Text",{x:t,y:e,text:this.text,color:this.color,backgroundColor:this.backgroundColor,font:this.font,fontItalic:this.fontItalic,fontBold:this.fontBold,fontSize:this.fontSize,fontType:this.fontType,v:1,strokeWidth:this.strokeWidth}),this.dragAction="place",this.currentShapeState="selected"),"none"!==this.dragAction)return this.initialShapeBoundingRect=this.currentShape.getBoundingRect
3(i.ctx),this.dragOffset={x:t-this.initialShapeBoundingRect.x,y:e-this.initialShapeBoundingRect.y},this._setShapesInProgress(i),i.repaintLayer("main");this.commit(i)},e.prototype.continue=function(t,e,i){var n,r,o;if("none"!==this.dragAction){if(void 0!==(n=this.initialShapeBoundingRect)&&null!=n)switch(o=n.x+n.width,r=n.y+n.height,this.dragAction){case"place":this.currentShape.x=t,this.currentShape.y=e,this.didDrag=!0;break;case"move":this.currentShape.x=t-this.dragOffset.x,this.currentShape.y=e-this.dragOffset.y,this.didDrag=!0;break;case"resizeBottomRight":this.currentShape.setSize(t-(this.dragOffset.x-this.initialShapeBoundingRect.width)-n.x,e-(this.dragOffset.y-this.initialShapeBoundingRect.height)-n.y);break;case"resizeTopLeft":this.currentShape.setSize(o-t+this.dragOffset.x,r-e+this.dragOffset.y),this.currentShape.setPosition(t-this.dragOffset.x,e-this.dragOffset.y);break;case"resizeBottomLeft":this.currentShape.setSize(o-t+this.dragOffset.x,e-(this.dragOffset.y-this.initialShapeBoundingRect.height)-n.y),this.currentShape.setPosition(t-this.dragOffset.x,this.currentShape.y);break;case"resizeTopRight":this.currentShape.setSize(t-(this.dragOffset.x-this.initialShapeBoundingRect.width)-n.x,r-e+this.dragOffset.y),this.currentShape.setPosition(this.currentShape.x,e-this.dragOffset.y)}return this._setShapesInProgress(i),i.repaintLayer("main"),this._updateInputEl(i)}},e.prototype.end=function(t,e,i){if(this.currentShape)return this.currentShape.setSize(this.currentShape.forcedWidth,0),"selected"===this.currentShapeState&&("place"===this.dragAction||"move"===this.dragAction&&!this.didDrag)&&this._enterEditingState(i),this._setShapesInProgress(i),i.repaintLayer("main"),this._updateInputEl(i)},e.prototype._enterEditingState=function(t){var e,i;if(this.currentShapeState="editing",this.inputEl)throw"State error";return this.inputEl=document.createElement("textarea"),this.inputEl.className="text-tool-input",this.inputEl.name="canvasTextArea",this.inputEl.id="canvasTextArea",this.inputEl.style.position="absolute",this.inputEl.style.transformOrigin="0px 0px",this.inputEl.style.backgroundColor=this.currentShape.backgroundColor||"transparent",this.currentShape.strokeWidth?this.inputEl.style.border=this.currentShape.strokeWidth+"px solid "+this.currentShape.color:this.inputEl.style.border="none",this.inputEl.style.outline="none",this.inputEl.style.margin="0",this.inputEl.style.padding="4px",this.inputEl.style.zIndex="1000",this.inputEl.style.overflow="hidden",this.inputEl.style.resize="none",this.inputEl.value=this.currentShape.text,this.inputEl.addEventListener("mousedown",function(t){return t.stopPropagation()}),this.inputEl.addEventListener("touchstart",function(t){return t.stopPropagation()}),i=this,e=function(e){return i.currentShape.setText(e.target.value),i.currentShape.enforceMaxBoundingRect
3(t),i._setShapesInProgress(t),t.repaintLayer("main"),i._updateInputEl(t),e.stopPropagation()},this.inputEl.addEventListener("keydown",function(e){return function(){return e._updateInputEl(t,!0)}}(this)),this.inputEl.addEventListener("keyup",e),this.inputEl.addEventListener("change",e),this._updateInputEl(t),t.containerEl.appendChild(this.inputEl),this.inputEl.focus(),this._setShapesInProgress(t)},e.prototype._exitEditingState=function(t){return this.currentShapeState="selected",t.containerEl.removeChild(this.inputEl),this.inputEl=null,this._setShapesInProgress(t),t.repaintLayer("main")},e.prototype._updateInputEl=function(t,e){var i,n;if(null==e&&(e=!1),this.inputEl)return i=this.currentShape.getBoundingRect(t.ctx,!0),this.inputEl.style.font=this.currentShape.font.replace("underline ","").replace("line-through ","").replace("none ",""),this.inputEl.style.textDecoration=this.currentShape.font.split(" ")[4],this.inputEl.style.color=this.currentShape.color,this.inputEl.style.backgroundColor=this.currentShape.backgroundColor||"transparent",this.inputEl.style.left=t.position.x/t.backingScale+i.x*t.scale-4+"px",this.inputEl.style.top=t.position.y/t.backingScale+i.y*t.scale-4+"px",e&&!this.currentShape.forcedWidth?this.inputEl.style.width=i.width+10+this.currentShape.renderer.emDashWidth+"px":this.inputEl.style.width=i.width+12+"px",this.inputEl.style.height=e?i.height+10+this.currentShape.renderer.metrics.leading+"px":i.height+10+"px",n="scale("+t.scale+")",this.inputEl.style.transform=n,this.inputEl.style.webkitTransform=n,this.inputEl.style.MozTransform=n,this.inputEl.style.msTransform=n,this.inputEl.style.OTransform=n},e.prototype.optionsStyle="font",e}(n)},{"../core/shapes":13,"./base":29}],29:[function(t,e,i){var n,r,o=function(t,e){for(var i in e)s.call(e,i)&&(t[i]=e[i]);function n(){this.constructor=t}return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},s={}.hasOwnProperty;(r={}).Tool=n=function(){function t(){}return t.prototype.name=null,t.prototype.iconName=null,t.prototype.usesSimpleAPI=!0,t.prototype.begin=function(t,e,i){},t.prototype.continue=function(t,e,i){},t.prototype.end=function(t,e,i){},t.prototype.optionsStyle=null,t.prototype.didBecomeActive=function(t){},t.prototype.willBecomeInactive=function(t){},t}(),r.ToolWithStroke=function(t){function e(t){this.strokeWidth=t.opts.defaultStrokeWidth}return o(e,t),e.prototype.optionsStyle="stroke-width",e.prototype.didBecomeActive=function(t){var e,i;return e=[],this.unsubscribe=function(){var t,i,n,r;for(r=[],i=0,n=e.length;i<n;i++)t=e[i],r.push(t());return r},e.push(t.on("setStrokeWidth",(i=this,function(e){return i.strokeWidth=e,t.trigger("toolDidUpdateOptions")})))},e.prototype.willBecomeInactive=function(t){return this.unsubscribe()},e}(n),e.exports=r},{}]},{},[18])(18);var r=function(t){return t.replace(/[<>&'"]/g,function(t){switch(t){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return"""}})}}}]); 4//# debugId=1f0f9a5e-712d-59eb-a461-3ca190e129c0
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.