PageSourceSearch

https://hipragya.ai/assets/SolveFreehandCanvas-BGG_zt3Q.js

js hipragya.ai collected 2026-10-05 14:36:25 UTC 33,703 bytes, 25 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KonvaEditor-B78eQ-mG.js","assets/index-CvryZg2y.js","assets/index-BkM8tNZ-.css","assets/ReactKonvaCore-BoFvEuLr.js","assets/index-BZ2t2ME_.js","assets/katex-BvYD9Wje.js","assets/pen-line-NmBQMQeu.js","assets/eraser-CABzwA7g.js","assets/mouse-pointer-2-BtNfp4di.js","assets/sigma-v5bYt0iK.js","assets/shapes-_MCj7arP.js","assets/undo-2-GnvWxbPU.js","assets/redo-2-Db2Et94C.js","assets/sliders-horizontal-DvQ3pI8h.js","assets/triangle-ClepLWdG.js","assets/square-DmpgiWbf.js","assets/circle-Bea7rSDR.js","assets/arrow-right-CFL0g_jY.js","assets/ruler-BOsxUq92.js","assets/table-2-DJewBNq6.js","assets/box-BDQ9y12m.js","assets/highlighter-o09UOrfP.js","assets/chart-line-Cmdgqw4k.js","assets/grid-3x3-D-NHnKHo.js","assets/loader-circle--EhcBSnm.js","assets/trash-2-pPBTvsdD.js","assets/rotate-ccw-kLCO3NtX.js","assets/KonvaEditor-DOFyMwL0.css","assets/katex-BVwrCjs-.css","assets/400-DRdbhCfz.css","assets/500-DnnFFs0Q.css"])))=>i.map(i=>d[i]);
2import{g as ye,R as A,k as st,al as ot,r as E,j as f,M as Le,X as Oe,_ as at,af as it,q as lt,x as ct}from"./index-CvryZg2y.js";import{P as ut}from"./pen-line-NmBQMQeu.js";import{C as dt}from"./cloud-D7cTCXm0.js";import{L as Te}from"./loader-circle--EhcBSnm.js";import{R as ft}from"./rotate-ccw-kLCO3NtX.js";/**
3 * @license lucide-react v0.562.0 - ISC
4 *
5 * This source code is licensed under the ISC license.
6 * See the LICENSE file in the root directory of this source tree.
7 */const ht=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],De=ye("smartphone",ht);/**
8 * @license lucide-react v0.562.0 - ISC
9 *
10 * This source code is licensed under the ISC license.
11 * See the LICENSE file in the root directory of this source tree.
12 */const pt=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Ae=ye("wifi-off",pt);/**
13 * @license lucide-react v0.562.0 - ISC
14 *
15 * This source code is licensed under the ISC license.
16 * See the LICENSE file in the root directory of this source tree.
17 */const gt=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],ge=ye("wifi",gt);var mt=Object.defineProperty,ue=Object.getOwnPropertySymbols,Fe=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,Ie=(a,r,o)=>r in a?mt(a,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[r]=o,me=(a,r)=>{for(var o in r||(r={}))Fe.call(r,o)&&Ie(a,o,r[o]);if(ue)for(var o of ue(r))je.call(r,o)&&Ie(a,o,r[o]);return a},ve=(a,r)=>{var o={};for(var l in a)Fe.call(a,l)&&r.indexOf(l)<0&&(o[l]=a[l]);if(a!=null&&ue)for(var l of ue(a))r.indexOf(l)<0&&je.call(a,l)&&(o[l]=a[l]);return o};/**
18 * @license QR Code generator library (TypeScript)
19 * Copyright (c) Project Nayuki.
20 * SPDX-License-Identifier: MIT
21 */var V;(a=>{const r=class S{constructor(e,t,n,s){if(this.version=e,this.errorCorrectionLevel=t,this.modules=[],this.isFunction=[],e<S.MIN_VERSION||e>S.MAX_VERSION)throw new RangeError("Version value out of range");if(s<-1||s>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let i=[];for(let c=0;c<this.size;c++)i.push(!1);for(let c=0;c<this.size;c++)this.modules.push(i.slice()),this.isFunction.push(i.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(n);if(this.drawCodewords(d),s==-1){let c=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);const m=this.getPenaltyScore();m<c&&(s=y,c=m),this.applyMask(y)}}h(0<=s&&s<=7),this.mask=s,this.applyMask(s),this.drawFormatBits(s),this.isFunction=[]}static encodeText(e,t){const n=a.QrSegment.makeSegments(e);return S.encodeSegments(n,t)}static encodeBinary(e,t){const n=a.QrSegment.makeBytes(e);return S.encodeSegments([n],t)}static encodeSegments(e,t,n=1,s=40,i=-1,d=!0){if(!(S.MIN_VERSION<=n&&n<=s&&s<=S.MAX_VERSION)||i<-1||i>7)throw new RangeError("Invalid value");let c,y;for(c=n;;c++){const g=S.getNumDataCodewords(c,t)*8,M=R.getTotalBits(e,c);if(M<=g){y=M;break}if(c>=s)throw new RangeError("Data too long")}for(const g of[S.Ecc.MEDIUM,S.Ecc.QUARTILE,S.Ecc.HIGH])d&&y<=S.getNumDataCodewords(c,g)*8&&(t=g);let m=[];for(const g of e){o(g.mode.modeBits,4,m),o(g.numChars,g.mode.numCharCountBits(c),m);
vendor: 4,447 bytes, line 21
21for(const M of g.getData())m.push(M)}h(m.length==y);const P=S.getNumDataCodewords(c,t)*8;h(m.length<=P),o(0,Math.min(4,P-m.length),m),o(0,(8-m.length%8)%8,m),h(m.length%8==0);for(let g=236;m.length<P;g^=253)o(g,8,m);let b=[];for(;b.length*8<m.length;)b.push(0);return m.forEach((g,M)=>b[M>>>3]|=g<<7-(M&7)),new S(c,t,b,i)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let n=0;n<this.size;n++)this.setFunctionModule(6,n,n%2==0),this.setFunctionModule(n,6,n%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let s=0;s<t;s++)n==0&&s==0||n==0&&s==t-1||n==t-1&&s==0||this.drawAlignmentPattern(e[n],e[s]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const t=this.errorCorrectionLevel.formatBits<<3|e;let n=t;for(let i=0;i<10;i++)n=n<<1^(n>>>9)*1335;const s=(t<<10|n)^21522;h(s>>>15==0);for(let i=0;i<=5;i++)this.setFunctionModule(8,i,l(s,i));this.setFunctionModule(8,7,l(s,6)),this.setFunctionModule(8,8,l(s,7)),this.setFunctionModule(7,8,l(s,8));for(let i=9;i<15;i++)this.setFunctionModule(14-i,8,l(s,i));for(let i=0;i<8;i++)this.setFunctionModule(this.size-1-i,8,l(s,i));for(let i=8;i<15;i++)this.setFunctionModule(8,this.size-15+i,l(s,i));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let n=0;n<12;n++)e=e<<1^(e>>>11)*7973;const t=this.version<<12|e;h(t>>>18==0);for(let n=0;n<18;n++){const s=l(t,n),i=this.size-11+n%3,d=Math.floor(n/3);this.setFunctionModule(i,d,s),this.setFunctionModule(d,i,s)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let s=-4;s<=4;s++){const i=Math.max(Math.abs(s),Math.abs(n)),d=e+s,c=t+n;0<=d&&d<this.size&&0<=c&&c<this.size&&this.setFunctionModule(d,c,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,t+n,Math.max(Math.abs(s),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){const t=this.version,n=this.errorCorrectionLevel;if(e.length!=S.getNumDataCodewords(t,n))throw new RangeError("Invalid argument");const s=S.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][t],i=S.ECC_CODEWORDS_PER_BLOCK[n.ordinal][t],d=Math.floor(S.getNumRawDataModules(t)/8),c=s-d%s,y=Math.floor(d/s);let m=[];const P=S.reedSolomonComputeDivisor(i);for(let g=0,M=0;g<s;g++){let k=e.slice(M,M+y-i+(g<c?0:1));M+=k.length;const $=S.reedSolomonComputeRemainder(k,P);g<c&&k.push(0),m.push(k.concat($))}let b=[];for(let g=0;g<m[0].length;g++)m.forEach((M,k)=>{(g!=y-i||k>=c)&&b.push(M[g])});return h(b.length==d),b}drawCodewords(e){if(e.length!=Math.floor(S.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let t=0;for(let n=this.size-1;n>=1;n-=2){n==6&&(n=5);for(let s=0;s<this.size;s++)for(let i=0;i<2;i++){const d=n-i,y=(n+1&2)==0?this.size-1-s:s;!this.isFunction[y][d]&&t<e.length*8&&(this.modules[y][d]=l(e[t>>>3],7-(t&7)),t++)}}h(t==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let s;switch(e){case 0:s=(n+t)%2==0;break;case 1:s=t%2==0;break;case 2:s=n%3==0;break;case 3:s=(n+t)%3==0;break;case 4:s=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:s=n*t%2+n*t%3==0;break;case 6:s=(n*t%2+n*t%3)%2==0;break;case 7:s=((n+t)%2+n*t%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[t][n]&&s&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let i=0;i<this.size;i++){let d=!1,c=0,y=[0,0,0,0,0,0,0];for(let m=0;m<this.size;m++)this.modules[i][m]==d?(c++,c==5?e+=S.PENALTY_N1:c>5&&e++):(this.finderPenaltyAddHistory(c,y),d||(e+=this.finderPenaltyCountPatterns(y)*S.PENALTY_N3),d=this.modules[i][m],c=1);e+=this.finderPenaltyTerminateAndCount(d,c,y)*S.PENALTY_N3}for(let i=0;i<this.size;i++){let d=!1,c=0,y=[0,0,0,0,0,0,0];for(let m=0;m<this.size;m++)this.modules[m][i]==d?(c++,c==5?e+=S.PENALTY_N1:c>5&&e++):(this.finderPenaltyAddHistory(c,y),d||(e+=this.finderPenaltyCountPatterns(y)*S.PENALTY_N3),d=this.modules[m][i],c=1);e+=this.finderPenaltyTerminateAndCount(d,c,y)*S.PENALTY_N3}for(let i=0;i<this.size-1;i++)for(let d=0;d<this.size-1;d++){const c=this.modules[i][d];c==this.modules[i][d+1]&&c==this.modules[i+1][d]&&c==this.modules[i+1][d+1]&&(e+=S.PENA
21LTY_N2)}let t=0;for(const i of this.modules)t=i.reduce((d,c)=>d+(c?1:0),t);const n=this.size*this.size,s=Math.ceil(Math.abs(t*20-n*10)/n)-1;return h(0<=s&&s<=9),e+=s*S.PENALTY_N4,h(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let n=[6];for(let s=this.size-7;n.length<e;s-=t)n.splice(1,0,s);return n}}static getNumRawDataModules(e){if(e<S.MIN_VERSION||e>S.MAX_VERSION)throw new RangeError("Version number out of range");let t=(16*e+128)*e+64;if(e>=2){const n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return h(208<=t&&t<=29648),t}static getNumDataCodewords(e,t){return Math.floor(S.getNumRawDataModules(e)/8)-S.ECC_CODEWORDS_PER_BLOCK[t.ordinal][e]*S.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let t=[];for(let s=0;s<e-1;s++)t.push(0);t.push(1);let n=1;for(let s=0;s<e;s++){for(let i=0;i<t.length;i++)t[i]=S.reedSolomonMultiply(t[i],n),i+1<t.length&&(t[i]^=t[i+1]);n=S.reedSolomonMultiply(n,2)}return t}static reedSolomonComputeRemainder(e,t){let n=t.map(s=>0);for(const s of e){const i=s^n.shift();n.push(0),t.forEach((d,c)=>n[c]^=S.reedSolomonMultiply(d,i))}return n}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw new RangeError("Byte out of range");let n=0;for(let s=7;s>=0;s--)n=n<<1^(n>>>7)*285,n^=(t>>>s&1)*e;return h(n>>>8==0),n}finderPenaltyCountPatterns(e){const t=e[1];h(t<=this.size*3);const n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};r.MIN_VERSION=1,r.MAX_VERSION=40,r.PENALTY_N1=3,r.PENALTY_N2=3,r.PENALTY_N3=40,r.PENALTY_N4=10,r.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],r.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],a.QrCode=r;function o(v,e,t){if(e<0||e>31||v>>>e)throw new RangeError("Value out of range");for(let n=e-1;n>=0;n--)t.push(v>>>n&1)}function l(v,e){return(v>>>e&1)!=0}function h(v){if(!v)throw new Error("Assertion error")}const u=class _{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw new RangeError("Invalid argument");this.bitData=n.slice()}static makeBytes(e){let t=[];for(const n of e)o(n,8,t);return new _(_.Mode.BYTE,e.length,t)}static makeNumeric(e){if(!_.isNumeric(e))throw new RangeError("String contains non-numeric characters");let t=[];for(let n=0;n<e.length;){const s=Math.min(e.length-n,3);o(parseInt(e.substring(n,n+s),10),s*3+1,t),n+=s}return new _(_.Mode.NUMERIC,e.length,t)}static makeAlphanumeric(e){if(!_.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let t=[],n;for(n=0;n+2<=e.length;n+=2){let s=_.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n))*45;s+=_.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n+1)),o(s,11,t)}return n<e.length&&o(_.ALPHANUMERIC_CHARSET.indexOf(e.charAt(n)),6,t),new _(_.Mode.ALPHANUMERIC,e.length,t)}static makeSegments(e){return e==""?[]:_.isNumeric(e)?[_.makeNumeric(e)]:_.isAlphanumeric(e)?[_.makeAlphanumeric(e)]:[_.makeBytes(_.toUtf8ByteArray(e))]}static makeEci(e){let t=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)o(e,8,t);else if(e<16384)o(2,2,t),o(e,14,t);else if(e<1e6)o(6,3,t),o(e,21,t);else throw new RangeError("ECI assignment value out of range");return new _(_.Mode.ECI,0,t)}static isNumeric(e){return _.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return _.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(const s of e){const i=s.mode.numCharCountBits(t);if(s.numChars>=1<<i)return 1/0;n+=4+i+s.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)!="%"?t.push(e.charCodeAt(n)):(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2);return t}};u.NUMERIC_REGEX=/^[0-9]*$/,u.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,u.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let R=u;a.QrSegment=u})(V||(V={}));(a=>{(r=>{const o=class{constructor(h,u){this.ordinal=h,this.formatBits=u}};o.LOW=new o(0,1),o.MEDIUM=new o(1,0),o.QUARTILE=new o(2,3),o.HIGH=new o(3,2),r.Ecc=o})(a.QrCode||(a.QrCode={}))})(V||(V={}));(a=>{(r=>{const o=class{constructor(h,u){this.modeBits=h,this.numBitsCharCount=u}numCharCountBits(h){return this.numBitsCharCount[Math.floor((h+7)/17)]}};o.NUMERIC=new o(1,[10,12,14]),o.ALPHANUMERIC=new o(2,[9,11,13]),o.BYTE=new o(4,[8,16,16]),o.KANJI=new o(8,[8,10,12]),o.ECI=new o(7,[0,0,0]),r.Mode=o})(a.QrSegment||(a.QrSegment={}))})(V||(V={}));var q=V;/**
22 * @license qrcode.react
23 * Copyright (c) Paul O'Shannessy
24 * SPDX-License-Identifier: ISC
25 */var vt={L:q.QrCode.Ecc.LOW,M:q.QrCode.Ecc.MEDIUM,Q:q.QrCode.Ecc.QUARTILE,H:q.QrCode.Ecc.HIGH},ze=128,Ue="L",Be="#FFFFFF",$e="#000000",Qe=!1,He=1,wt=4,yt=0,Et=.1;function Ge(a,r=0){const o=[];return a.forEach(function(l,h){let u=null;l.forEach(function(R,v){if(!R&&u!==null){o.push(`M${u+r} ${h+r}h${v-u}v1H${u+r}z`),u=null;return}if(v===l.length-1){if(!R)return;u===null?o.push(`M${v+r},${h+r} h1v1H${v+r}z`):o.push(`M${u+r},${h+r} h${v+1-u}v1H${u+r}z`);return}R&&u===null&&(u=v)})}),o.join("")}function We(a,r){return a.slice().map((o,l)=>l<r.y||l>=r.y+r.h?o:o.map((h,u)=>u<r.x||u>=r.x+r.w?h:!1))}function Ct(a,r,o,l){if(l==null)return null;const h=a.length+o*2,u=Math.floor(r*Et),R=h/r,v=(l.width||u)*R,e=(l.height||u)*R,t=l.x==null?a.length/2-v/2:l.x*R,n=l.y==null?a.length/2-e/2:l.y*R,s=l.opacity==null?1:l.opacity;let i=null;if(l.excavate){let c=Math.floor(t),y=Math.floor(n),m=Math.ceil(v+t-c),P=Math.ceil(e+n-y);i={x:c,y,w:m,h:P}}const d=l.crossOrigin;return{x:t,y:n,h:e,w:v,excavation:i,opacity:s,crossOrigin:d}}function St(a,r){return r!=null?Math.max(Math.floor(r),0):a?wt:yt}function Ye({value:a,level:r,minVersion:o,includeMargin:l,marginSize:h,imageSettings:u,size:R,boostLevel:v}){let e=A.useMemo(()=>{const c=(Array.isArray(a)?a:[a]).reduce((y,m)=>(y.push(...q.QrSegment.makeSegments(m)),y),[]);return q.QrCode.encodeSegments(c,vt[r],o,void 0,void 0,v)},[a,r,o,v]);const{cells:t,margin:n,numCells:s,calculatedImageSettings:i}=A.useMemo(()=>{let d=e.getModules();const c=St(l,h),y=d.length+c*2,m=Ct(d,R,c,u);return{cells:d,margin:c,numCells:y,calculatedImageSettings:m}},[e,R,u,l,h]);return{qrcode:e,margin:n,cells:t,numCells:s,calculatedImageSettings:i}}var Rt=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Mt=A.forwardRef(function(r,o){const l=r,{value:h,size:u=ze,level:R=Ue,bgColor:v=Be,fgColor:e=$e,includeMargin:t=Qe,minVersion:n=He,boostLevel:s,marginSize:i,imageSettings:d}=l,y=ve(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:m}=y,P=ve(y,["style"]),b=d==null?void 0:d.src,g=A.useRef(null),M=A.useRef(null),k=A.useCallback(O=>{g.current=O,typeof o=="function"?o(O):o&&(o.current=O)},[o]),[$,Y]=A.useState(!1),{margin:U,cells:Q,numCells:H,calculatedImageSettings:x}=Ye({value:h,level:R,minVersion:n,boostLevel:s,includeMargin:t,marginSize:i,imageSettings:d,size:u});A.useEffect(()=>{if(g.current!=null){const O=g.current,F=O.getContext("2d");if(!F)return;let te=Q;const B=M.current,ne=x!=null&&B!==null&&B.complete&&B.naturalHeight!==0&&B.naturalWi
25dth!==0;ne&&x.excavation!=null&&(te=We(Q,x.excavation));const G=window.devicePixelRatio||1;O.height=O.width=u*G;const X=u/H*G;F.scale(X,X),F.fillStyle=v,F.fillRect(0,0,H,H),F.fillStyle=e,Rt?F.fill(new Path2D(Ge(te,U))):Q.forEach(function(re,z){re.forEach(function(J,K){J&&F.fillRect(K+U,z+U,1,1)})}),x&&(F.globalAlpha=x.opacity),ne&&F.drawImage(B,x.x+U,x.y+U,x.w,x.h)}}),A.useEffect(()=>{Y(!1)},[b]);const L=me({height:u,width:u},m);let ee=null;return b!=null&&(ee=A.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{Y(!0)},ref:M,crossOrigin:x==null?void 0:x.crossOrigin})),A.createElement(A.Fragment,null,A.createElement("canvas",me({style:L,height:u,width:u,ref:k,role:"img"},P)),ee)});Mt.displayName="QRCodeCanvas";var Ve=A.forwardRef(function(r,o){const l=r,{value:h,size:u=ze,level:R=Ue,bgColor:v=Be,fgColor:e=$e,includeMargin:t=Qe,minVersion:n=He,boostLevel:s,title:i,marginSize:d,imageSettings:c}=l,y=ve(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:m,cells:P,numCells:b,calculatedImageSettings:g}=Ye({value:h,level:R,minVersion:n,boostLevel:s,includeMargin:t,marginSize:d,imageSettings:c,size:u});let M=P,k=null;c!=null&&g!=null&&(g.excavation!=null&&(M=We(P,g.excavation)),k=A.createElement("image",{href:c.src,height:g.h,width:g.w,x:g.x+m,y:g.y+m,preserveAspectRatio:"none",opacity:g.opacity,crossOrigin:g.crossOrigin}));const $=Ge(M,m);return A.createElement("svg",me({height:u,width:u,viewBox:`0 0 ${b} ${b}`,ref:o,role:"img"},y),!!i&&A.createElement("title",null,i),A.createElement("path",{fill:v,d:`M0,0 h${b}v${b}H0z`,shapeRendering:"crispEdges"}),A.createElement("path",{fill:e,d:$,shapeRendering:"crispEdges"}),k)});Ve.displayName="QRCodeSVG";function bt(a=""){const r=String(a).trim().replace(/^\[|\]$/g,"").toLowerCase();return r==="localhost"||r==="127.0.0.1"||r==="::1"}function Xe(){return"".trim().replace(/\/+$/,"")}async function xe(){const a=window.location.origin;return Xe()||a}async function _t(a=""){return(await st.post("/solve-freehand/sessions",{problem_text:a})).data}function Nt({sessionId:a,token:r,role:o}){const l=new URL(ot,window.location.origin),h=l.protocol==="https:"?"wss:":"ws:",u=new URL(`${h}//${l.host}/ws/solve-freehand/${encodeURIComponent(a)}`);return u.searchParams.set("token",r),u.searchParams.set("role",o),u.toString()}function Pt({sessionId:a,companionToken:r,companionOrigin:o}){const l=`/solve/freehand/${encodeURIComponent(a)}`;return`${String(o||Xe()||window.location.origin).replace(/\/+$/,"")}${l}#${encodeURIComponent(r)}`}const At=2500,Je=500,Ke=2500,It=new Set(["#ffffff","#fffbf5","#f8fafc","#f1f5f9","#fefce8","#f0f9ff","#f0fdf4","#fdf2f8","#faf5ff","#faf7f2","grid","dotted"]);function Ze(a){if(!a)return null;if(typeof a=="string")try{return JSON.parse(a)}catch{return null}return typeof a=="object"?a:null}function Ee(a={}){return{background:It.has(a.background)?a.background:"#ffffff"}}function qe(a,r=At){return!Array.isArray(a)||a.length>r?null:a.filter(o=>o&&typeof o=="object"&&(typeof o.id=="string"||typeof o.id=="number")&&typeof o.type=="string")}function T(a){const r=Ze(a);if(!r)return null;const o=qe(r.shapes);return o?{type:"pragya-canvas",version:3,shapes:o,canvas:Ee(r.canvas)}:null}function Ce(a=[],r={}){return T({shapes:a,canvas:r})||{type:"pragya-canvas",version:3,shapes:[],canvas:Ee(r)}}function ce(a){const r=T(a);return r?JSON.stringify(r):""}function we(a){var r;return!!((r=T(a))!=null&&r.shapes.length)}function xt(a,r){const o=T(a)||Ce(),l=T(r);if(!l)return null;const h=new Map(o.shapes.map(t=>[String(t.id),t])),u=new Set,R=[];l.shapes.forEach(t=>{const n=String(t.id);u.add(n);const s=h.get(n);(!s||JSON.stringify(s)!==JSON.stringify(t))&&R.push(t)});const v=o.shapes.filter(t=>!u.has(String(t.id))).map(t=>String(t.id)),e=o.canvas.background!==l.canvas.background;return!R.length&&!v.length&&!e||R.length>Je||v.length>Ke?null:{type:"pragya-canvas-patch",version:1,upserts:R,removed_ids:v,...e?{canvas:l.canvas}:{}}}function kt(a){const r=Ze(a);if(!r||r.type!=="pragya-canvas-patch")return null;const o=qe(r.upserts||[],Je);if(!o||!Array.isArray(r.removed_ids)||r.removed_ids.length>Ke)return null;const l=r.removed_ids.filter(h=>typeof h=="string"||typeof h=="number").map(String);return{type:"pragya-canvas-patch",version:1,upserts:o,removed_ids:l,...r.canvas?{canvas:Ee(r.canvas)}:{}}}function ke(a,r){const o=T(a)||Ce(),l=kt(r);if(!l)return null;const h=new Set(l.removed_ids.map(String)),u=new Map(l.upserts.map(v=>[String(v.id),v])),R=[];
25return o.shapes.forEach(v=>{const e=String(v.id);h.has(e)||(R.push(u.get(e)||v),u.delete(e))}),u.forEach(v=>R.push(v)),T({shapes:R,canvas:l.canvas||o.canvas})}const Lt=E.lazy(()=>at(()=>import("./KonvaEditor-B78eQ-mG.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30]))),Ot="pragya:solve-freehand:draft:v2:",Tt=10080*60*1e3;function Dt(a){let r=5381;const o=String(a||"new-problem");for(let l=0;l<o.length;l+=1)r=(r<<5)+r^o.charCodeAt(l);return(r>>>0).toString(36)}function Ft(a,r){const o=r!=null&&r.sessionId?`session:${r.sessionId}`:`problem:${a||"new-problem"}`;return`${Ot}${Dt(o)}`}function jt(a){if(typeof window>"u")return null;try{const r=JSON.parse(window.localStorage.getItem(a)||"null");return!r||Date.now()-Number(r.saved_at||0)>Tt?(window.localStorage.removeItem(a),null):T(r.scene)}catch{return null}}function pe(a,r){try{if(typeof window>"u")return;if(!we(r)){window.localStorage.removeItem(a);return}window.localStorage.setItem(a,JSON.stringify({version:2,saved_at:Date.now(),scene:r}))}catch{}}function zt({url:a,status:r,connected:o,error:l,onClose:h}){const[u,R]=E.useState(!1),v=E.useRef(null),e=E.useRef(null);E.useEffect(()=>{var s;e.current=document.activeElement,(s=v.current)==null||s.focus();const n=i=>{i.key==="Escape"&&h()};return window.addEventListener("keydown",n),()=>{var i,d;window.removeEventListener("keydown",n),(d=(i=e.current)==null?void 0:i.focus)==null||d.call(i)}},[h]);const t=async()=>{try{await navigator.clipboard.writeText(a),R(!0),window.setTimeout(()=>R(!1),1600)}catch{R(!1)}};return Le.createPortal(f.jsx("div",{className:"solve-freehand-dialog-backdrop",role:"presentation",onMouseDown:h,children:f.jsxs("section",{className:"solve-freehand-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"solve-freehand-pairing-title",onMouseDown:n=>n.stopPropagation(),children:[f.jsx("button",{ref:v,type:"button",className:"solve-freehand-dialog__close",onClick:h,"aria-label":"Close pairing dialog",children:f.jsx(Oe,{"aria-hidden":"true"})}),f.jsx("div",{className:"solve-freehand-dialog__brand",children:f.jsx(it,{variant:"colour",size:"xs",animated:!1})}),f.jsxs("div",{className:"solve-freehand-dialog__eyebrow",children:[f.jsx(De,{"aria-hidden":"true"})," Mobile freehand"]}),f.jsx("h2",{id:"solve-freehand-pairing-title",children:"Write on your phone or tablet"}),f.jsx("p",{children:"Scan once, then your handwriting appears here as you write. No second login is needed."}),f.jsxs("div",{className:"solve-freehand-dialog__scan-stack",children:[f.jsx("div",{className:"solve-freehand-dialog__qr","aria-label":"QR code for the mobile freehand companion",children:f.jsx(Ve,{value:a,size:208,level:"M",marginSize:2,fgColor:"#20124d"})}),f.jsxs("div",{className:`solve-freehand-dialog__status ${o?"is-connected":""}`,role:"status",children:[o?f.jsx(ge,{"aria-hidden":"true"}):f.jsx(Te,{className:r==="connecting"?"spin":"","aria-hidden":"true"}),o?"Device connected — start writing":r==="connecting"?"Waiting for your device…":"Ready to scan"]})]}),l?f.jsx("p",{className:"solve-freehand-dialog__error",children:l}):null,f.jsxs("button",{type:"button",className:"solve-freehand-dialog__copy",onClick:t,children:[u?f.jsx(lt,{"aria-hidden":"true"}):f.jsx(ct,{"aria-hidden":"true"}),u?"Link copied":"Copy mobile link"]}),bt(new URL(a).hostname)?f.jsxs("p",{className:"solve-freehand-dialog__local-note",children:["A physical device cannot open ",f.jsx("strong",{children:"localhost"}),". Use Pragya’s deployed URL or open this development server through your computer’s network address."]}):null,f.jsx("p",{className:"solve-freehand-dialog__privacy",children:"This private pairing expires automatically after 30 minutes."})]})}),document.body)}const et=E.forwardRef(({initialData:a=null,onChange:r,onRemoteSubmit:o,onSessionMeta:l,onConnectionState:h,problemText:u="",allowCompanion:R=!0,connection:v=null,mobile:e=!1,className:t="",figureContext:n=null,ariaLabel:s="Freehand working canvas",ariaDescription:i="Draw or write your working with the canvas toolbar. Your work is saved automatically."},d)=>{const c=E.useId(),y=E.useRef(Ft(u,v)),m=E.useRef(null);if(!m.current){const C=T(a),p=C?null:jt(y.current);m.current={scene:C||p||Ce(),recovered:!!p}}const P=E.useRef(null),b=E.useRef(null),g=E.useRef(m.current.scene),M=E.useRef(null),k=E.useRef(null),$=E.useRef(null),Y=E.useRef(""),U=E.useRef(!1),Q=E.useRef(r),H=E.useRef(o),x=E.useRef(l),L=E.useRef(h),ee=E.useRef(""),[O,F]=E.useState(null),[te,B]=E.useState(""),[ne,G]=E.useState(!1),[X,re]=E.useState(!1),[z,J]=E.useState(v?"connecting":"idle"),[K,tt]=E.useState(!1),[de,se]=E.useState("");Q.current=r,H.current=o,x.current=l,L.current=h;const j=v||O,oe=E.useCallback(C=>{pe(y.current,C),window.clearTimeout(k.current),k.current=window.setTimeout(()=>{var p;(p=Q.current)==null||p.call(Q,ce(C))},100)},[]),ae=E.useCallback((C="scene_update",p=null)=>{const w=b.current,I=T(p||g.current);return!I||!w||w.readyState!==WebSocket.OPEN?!1:(w.send(JSON.stringify({type:C,scene:I})),M.current=I,!0)},[]),Se=E.useCallback(C=>{window.clearTimeout($.current),$.current=window.setTimeout(()=>{const p=b.current,w=T(g.current||C);if(!w||!p||p.readyState!==WebSocket.OPEN)return;const I=xt(M.current,w),D=JSON.stringify({type:"scene_update",scene:w}),Z=I?JSON.stringify({type:"scene_patch",patch:I}):"";Z&&Z.length<D.length?(p.send(Z),M.current=w):(!M.current||I)&&(p.send(D),M.current=w)},140)},[]),nt=E.useCallback(C=>{const p=T(C);if(!p)return;if(U.current){g.current=p,pe(y.current,p);return}const w=ce(p);if(Y.current&&w===Y.current){Y.current="",g.current=p,pe(y.current,p);return}g.current=p,oe(p),Se(p)},[oe,Se]),W=E.useCallback((C,p=null)=>{var I,D;const w=T(C);return w?(g.current=w,M.current=T(p)||w,Y.current=ce(w),U.current=!0,(D=(I=P.current)==null?void 0:I.updateScene)==null||D.call(I,w),window.setTimeout(()=>{U.current=!1},0),oe(w),w):null},[oe]),Re=E.useCallback(C=>{const p=ke(M.current,C),w=ke(g.current,C);return w?W(w,p):null},[W]);E.useEffect(()=>{if(!(j!=null&&j.sessionId)||!(j!=null&&j.token)||!(j!=null&&j.role))return;let C,p=!1,w=0;const I=()=>{var Z;if(p)return;J("connecting"),(Z=L.current)==null||Z.call(L,"connecting"),se("");const D=new WebSocket(Nt(j));b.current=D,D.onmessage=le=>{var be,_e,Ne;let N;try{N=JSON.parse(le.data)}catch{return}if(N.type==="connected"){w=0,ee.current=N.source_id||"",J("connected"),(be=L.current)==null||be.call(L,"connected"),(_e=x.current)==null||_e.call(x,{problemText:N.problem_text||"",expiresAt:N.expires_at||""}),N.scene?W(N.scene):ae("scene_update",g.current);return}if(!(N.source_id&&N.source_id===ee.current)){if(N.type==="peer_status"&&N.role==="companion"){tt(N.message==="connected");return}if(N.type==="scene_update"){W(N.scene);return}if(N.type==="scene_patch"){Re(N.patch);return}
25if(N.type==="submit"){const rt=W(N.scene);window.requestAnimationFrame(()=>{var Pe;return(Pe=H.current)==null?void 0:Pe.call(H,rt)});return}if(N.type==="expired"){J("expired"),(Ne=L.current)==null||Ne.call(L,"expired"),se("This pairing has expired. Create a new one from Solve Hub.");return}N.type==="error"&&se(N.message||"The paired canvas could not be updated.")}},D.onclose=()=>{var le;p||(J("disconnected"),(le=L.current)==null||le.call(L,"disconnected"),w+=1,w<=4&&(C=window.setTimeout(I,Math.min(1e3*2**(w-1),8e3))))},D.onerror=()=>D.close()};return I(),()=>{var D;p=!0,window.clearTimeout(C),(D=b.current)==null||D.close(),b.current=null}},[j,Re,W,ae]),E.useEffect(()=>()=>{window.clearTimeout(k.current),window.clearTimeout($.current)},[]);const ie=E.useCallback(async()=>{var C,p;if(G(!0),re(!0),se(""),B(""),O&&z!=="disconnected"&&z!=="expired"){try{B(await xe())}finally{re(!1)}return}O&&F(null);try{const[w,I]=await Promise.all([_t(u),xe()]);F({sessionId:w.session_id,token:w.host_token,companionToken:w.companion_token,role:"host",expiresAt:w.expires_at}),B(I)}catch(w){se(((p=(C=w.response)==null?void 0:C.data)==null?void 0:p.error)||"Could not create the mobile pairing. Please try again.")}finally{re(!1)}},[z,O,u]),Me=E.useCallback(()=>{const C=T(g.current);return we(C)?ae("submit",C):!1},[ae]),fe=E.useCallback(()=>{var C,p;return(p=(C=P.current)==null?void 0:C.clearCanvas)==null?void 0:p.call(C)},[]);E.useImperativeHandle(d,()=>({exportToBlob:(...C)=>{var p,w;return(w=(p=P.current)==null?void 0:p.exportToBlob)==null?void 0:w.call(p,...C)},exportToDataURL:(...C)=>{var p,w;return(w=(p=P.current)==null?void 0:p.exportToDataURL)==null?void 0:w.call(p,...C)},exportToCanvas:(...C)=>{var p,w;return(w=(p=P.current)==null?void 0:p.exportToCanvas)==null?void 0:w.call(p,...C)},clear:fe,clearCanvas:fe,hasContent:()=>we(g.current),getScene:()=>g.current,updateScene:W,submit:Me,startPairing:ie}),[W,fe,ie,Me]);const he=O&&te?Pt({sessionId:O.sessionId,companionToken:O.companionToken,companionOrigin:te}):"";return f.jsxs("div",{className:`solve-freehand-canvas solve-freehand-canvas--pragya ${e?"solve-freehand-canvas--mobile":""} ${t}`,role:"group","aria-label":s,"aria-describedby":c,children:[f.jsx("p",{id:c,className:"sr-only",children:i}),e?null:f.jsxs("div",{className:"solve-freehand-canvas__bar",children:[f.jsxs("div",{className:"solve-freehand-canvas__identity",children:[f.jsx("span",{className:"solve-freehand-canvas__mark",children:f.jsx(ut,{"aria-hidden":"true"})}),f.jsxs("span",{children:[f.jsx("strong",{children:"Pragya Canvas"}),f.jsx("small",{children:m.current.recovered?"Draft restored · autosaving":"Autosaves as you work"})]})]}),f.jsxs("span",{className:"solve-freehand-canvas__saved",children:[f.jsx(dt,{"aria-hidden":"true"})," Draft protected"]}),R?f.jsxs("button",{type:"button",className:`solve-freehand-canvas__phone ${K?"is-connected":""}`,onClick:ie,children:[K?f.jsx(ge,{"aria-hidden":"true"}):f.jsx(De,{"aria-hidden":"true"}),K?"Phone connected":"Write on phone"]}):null]}),f.jsx("div",{className:"solve-freehand-canvas__stage",children:f.jsx(E.Suspense,{fallback:f.jsx("div",{className:"solve-freehand-canvas__loading","aria-label":"Loading Pragya Canvas"}),children:f.jsx(Lt,{ref:P,initialData:ce(m.current.scene),onChange:nt,compact:!0,enableRecognition:!e,figureContext:n})})}),e?f.jsxs("div",{className:`solve-freehand-canvas__mobile-status is-${z}`,role:"status",children:[z==="connected"?f.jsx(ge,{"aria-hidden":"true"}):f.jsx(Ae,{"aria-hidden":"true"}),z==="connected"?"Live with your Solve Hub":z==="connecting"?"Connecting…":"Connection interrupted"]}):null,ne&&he?f.jsx(zt,{url:he,status:z,connected:K,error:de,onClose:()=>G(!1)}):null,ne&&!he?Le.createPortal(f.jsx("div",{className:"solve-freehand-dialog-backdrop",role:"presentation",onMouseDown:()=>G(!1),children:f.jsxs("section",{className:"solve-freehand-dialog solve-freehand-dialog--loading",role:"dialog","aria-modal":"true",onMouseDown:C=>C.stopPropagation(),children:[f.jsx("button",{type:"button",className:"solve-freehand-dialog__close",onClick:()=>G(!1),"aria-label":"Close pairing dialog",children:f.jsx(Oe,{"aria-hidden":"true"})}),X?f.jsx(Te,{className:"spin","aria-hidden":"true"}):f.jsx(Ae,{"aria-hidden":"true"}),f.jsx("h2",{children:X?"Creating a private canvas…":"Pairing unavailable"}),de?f.jsx("p",{className:"solve-freehand-dialog__error",children:de}):null,X?null:f.jsxs("button",{type:"button",className:"solve-freehand-dialog__copy",onClick:()=>{G(!1),F(null),window.setTimeout(ie,0)},children:[f.jsx(ft,{"aria-hidden":"true"}),"Try again"]})]})}),document.body):null]})});et.displayName="SolveFreehandCanvas";const Yt=Object.freeze(Object.defineProperty({__proto__:null,default:et},Symbol.toStringTag,{value:"Module"}));
25export{et as S,Ae as W,Yt as a,we as s};

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.